function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}


function chkYippy()
{

	country_holduserreg()
	var usernameRegxp = /^([0-9a-zA-Z]+)$/;
	var Errormsg
	Errormsg=""

	if (document.UserRegistrationForm.YippyEmailtxt.value=="")
	{
		Errormsg =Errormsg+ "Yippy UserName is mandatory\n"
	}	
	if(usernameRegxp.test(document.UserRegistrationForm.YippyEmailtxt.value)== false)
	{
		Errormsg =Errormsg+ "Yippy UserName is not valid\n"
	}	
			
	if (Errormsg!="")
	{
		alert(Errormsg)
	}
	else
	{
		document.UserRegistrationForm.Yippy_chk.value="Y"
		document.UserRegistrationForm.submit()
		document.UserRegistrationForm.Yippy_chk.value="N"	
	}
	
}



function saveData()
{

country_holduserreg()
var Errormsg
Errormsg=""


	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	var nameRegxp = /^([a-zA-Z\s]+)$/;
	var usernameRegxp = /^([0-9a-zA-Z]+)$/;


	if (document.UserRegistrationForm.FirstNametxt.value == "")
	{
		Errormsg =Errormsg+ "First Name is mandatory\n"
	}
	if (document.UserRegistrationForm.FirstNametxt.value != "")
		{
			if (nameRegxp.test(document.UserRegistrationForm.FirstNametxt.value)==false)
			{
				Errormsg =Errormsg+ "First Name is Not Valid\n"
			}
	}
	if (document.UserRegistrationForm.LastNametxt.value == "")
	{
		Errormsg =Errormsg+ "Last Name is mandatory\n"
	}
	if (document.UserRegistrationForm.LastNametxt.value != "")
		{
			if (nameRegxp.test(document.UserRegistrationForm.LastNametxt.value)==false)
			{
				Errormsg =Errormsg+ "Last Name is Not Valid\n"
			}
	}
	if (document.UserRegistrationForm.Emailtxt.value == "")
	{
		Errormsg =Errormsg+ "Email is mandatory\n"	
	}	
	if (document.UserRegistrationForm.Emailtxt.value != "")
	{
				
		var my_email=document.UserRegistrationForm.Emailtxt.value
		var ind=my_email.indexOf("@");
		value1=my_email.slice((ind+1),my_email.length);
		if (value1 =="yippy.com")
		{
			Errormsg =Errormsg+ "Email Address Domain name cannot be yippy.com\n"		
		}
	}
	
	if (document.UserRegistrationForm.ConfirmEmailtxt.value == "")
	{
		Errormsg =Errormsg+ "Confirm Email is mandatory\n"
	}
	if (document.UserRegistrationForm.ConfirmEmailtxt.value != "")
	{
		var my_email1=document.UserRegistrationForm.ConfirmEmailtxt.value
		var ind1=my_email1.indexOf("@");
		value2=my_email1.slice((ind1+1),my_email1.length);
		if (value2 =="yippy.com")
		{
			Errormsg =Errormsg+ "Confirm Email Address Domain name should not be yippy.com\n"		
		}
	}
	
	if (document.UserRegistrationForm.YippyEmailtxt.value=="")
	{
		Errormsg =Errormsg+ "Yippy UserName is mandatory\n"
	}	
	if(usernameRegxp.test(document.UserRegistrationForm.YippyEmailtxt.value)== false)
	{
		Errormsg =Errormsg+ "Yippy UserName is not valid\n"
	}	
	
	/*
	if((!document.UserRegistrationForm.ConfirmYippyEmailrad[0].checked) && (!document.UserRegistrationForm.ConfirmYippyEmailrad[1].checked))
	{
			Errormsg =Errormsg+ "Confirm Yippy Email Radio button is not checked\n"
	}
	
	if (document.UserRegistrationForm.ConfirmYippyEmailrad[0].checked)
		{
			if (document.UserRegistrationForm.YippyEmailtxt.value=="")
			{
				Errormsg =Errormsg+ "Yippy Email is mandatory\n"
			}
			else if(reg.test(document.UserRegistrationForm.YippyEmailtxt.value)== false)
			{
				Errormsg =Errormsg+ "Yippy Email is not valid\n"
			}
			else if(!document.UserRegistrationForm.LoginYippyEmailrad[0].checked && !document.UserRegistrationForm.LoginYippyEmailrad[1].checked)
			{
				Errormsg =Errormsg+ "Login By Yippy Email is mandatory\n"
			}
	}
	*/
	if (document.UserRegistrationForm.Passwordtxt.value == "")
	{
		Errormsg =Errormsg+ "Password is mandatory\n"
	}
	if (document.UserRegistrationForm.ConfirmPasswordtxt.value == "")
	{
		Errormsg =Errormsg+ "Confirm Password is mandatory\n"
	}
	if (document.UserRegistrationForm.Passwordtxt.value.length<8)
		{
			Errormsg =Errormsg+ "Minimum number of characters in Password should be 8!\n"
	}
	if (document.UserRegistrationForm.ConfirmPasswordtxt.value.length<8)
		{
			Errormsg =Errormsg+ "Minimum number of characters in Confirm Password should be 8!\n"
	}
	/*
	if (document.UserRegistrationForm.Agetxt.value == "")
	{
		Errormsg =Errormsg+ "Age is mandatory\n"
	}

	if (document.UserRegistrationForm.Agetxt.value != "")
	{
		if (anum.test(document.UserRegistrationForm.Agetxt.value)==false)
		{
			Errormsg =Errormsg+ "Age is Not Valid\n"
		}
	}
	*/
	if (document.UserRegistrationForm.demo1.value == "")
	{
		Errormsg =Errormsg+ "Age Range is mandatory\n"		
	}
	
	if (document.UserRegistrationForm.demo1.value != "")
	{
		var dt=document.UserRegistrationForm.demo1
		if (isDate(dt.value)==false)
		{
			Errormsg =Errormsg+ "Date is Not Valid\n"
		}
	}
	if (document.UserRegistrationForm.Emailtxt.value !=document.UserRegistrationForm.ConfirmEmailtxt.value)
	{
		Errormsg =Errormsg+ "Email and Confirm Email do not match!\n"
	}
	if  (document.UserRegistrationForm.Passwordtxt.value !=document.UserRegistrationForm.ConfirmPasswordtxt.value)
	{
		Errormsg =Errormsg+ "Password and Confirm Password do not match!\n"
	}

	if (document.UserRegistrationForm.Emailtxt.value != "")
	{
		if (reg.test(document.UserRegistrationForm.Emailtxt.value)== false)
		{
			Errormsg =Errormsg+ "Email is not valid\n"
		}
	}
	if (document.UserRegistrationForm.ConfirmEmailtxt.value != "")
	{
		if (reg.test(document.UserRegistrationForm.ConfirmEmailtxt.value)== false)
		{
			Errormsg =Errormsg+ "Confirm Email is not valid\n"
		}
	}

	if (document.UserRegistrationForm.Citytxt.value != "")
	{
		if (nameRegxp.test(document.UserRegistrationForm.Citytxt.value)==false)
		{
			Errormsg =Errormsg+ "City is Not Valid\n"
		}
	}
	if (document.UserRegistrationForm.State_chk.value != "")
	{
		if (nameRegxp.test(document.UserRegistrationForm.State_chk.value)==false)
		{
			Errormsg =Errormsg+ "State is Not Valid\n"
		}
	}

if (Errormsg!="")
	{
		alert(Errormsg)
	}
	else
	{
		if (confirm("Do you want to create this profile?"))
		{
			document.UserRegistrationForm.SaveChk.value="Y"
			document.UserRegistrationForm.submit()
			document.UserRegistrationForm.SaveChk.value="N"
		}
		else
		{
			document.UserRegistrationForm.SaveChk.value="N"
		}
	}

}

function resetDatauserreg()
{
	document.UserRegistrationForm.SaveChk.value="N"
}

function ConfirmYippyEmail_rd()
{
 	country_holduserreg()
    document.UserRegistrationForm.submit();
}

function country_holduserreg()
{
	document.UserRegistrationForm.Country_chk.value=document.getElementById("countrySelect").value;
	document.UserRegistrationForm.State_chk.value=document.getElementById("stateSelect").value;


}

function country_slctuserreg()
{
	postState = document.UserRegistrationForm.State_chk.value
	postCountry = document.UserRegistrationForm.Country_chk.value
	initCountry(postCountry);
}

function clickenteruserreg(keyCode)
{
	if (keyCode==13)
	{
	saveData();
	}
}

/*
//This works in IE But not in Safari or Firefox
function clickenter1()
{
if (event.keyCode == 13)document.getElementById('Loginbtn').click()
}

*/
