var count_radio;

function checkMobilePhone(mobileNumber)
	{
      if(mobileNumber != "" && mobileNumber != 0)
		{

if(isNaN(mobileNumber))
	    {
			 return false;
		}
	    else 	
	     {
			 var str_value=mobileNumber;
			 str=mobileNumber;
             str=str.length;
             
             var i=0;
			 var flage=0;
			 while(i < 2)
			  {
				 if(i==0 && str_value.charAt(i)!=0)
				 {
					flage=1;
					break;
				 }
				else if(flage==0 && i==1 && str_value.charAt(i)!=7)
				 {
				   	flage=1;
					break;
				 }
 
				i++;
			  }
			  
			  if(flage==1 || str!=11)
			   {
				 return false;
			   }
			   
             }
		 }
		else
			return false;

	return true;		
	}
	


function change_img(it, id, url)
{
	window.open('process_index2.php?custid='+url);
	
	getPoints();
}


function checkHomePhone(phoneNumber)
	{
		
		
		if(isNaN(phoneNumber))
			{
			
				 return false;
			}
			
		  else 	
			 {
				 
				 var str_value	=	phoneNumber;
				 str			=	phoneNumber;
				 str			=	str.length;
				 var i			=	0;
				 var flage		=	0;
			 
				 var f_2=0;
				 
			 while(i < 2)
			  {
				
				if(i==0 && str_value.charAt(i)==0)
				 {
					 
					 f_2=1;
				 //break;
				 }
				 
				 
				if(f_2==1 && i==1 && (str_value.charAt(i)==7  || str_value.charAt(i)==8 || str_value.charAt(i)==9))
				 {
					flage=1;
					break;
				 }
 
				i++;
			  }
			  
			  if(flage==1 || str!=11)
			   {
				 return false;
 			   }
         }
	
	return true;
	
	}

function checkCampsValues()
	{
		var selectedItems = new Array();
		var myCheck = true;
		var mycname = "";
		var mycCheck	=	"";
		var mycvalue	=	"";
		
		$("input[@name='campIDS[]']:checked").each(function() {
								
			// ---------- checking for phones in creatives ------------------------------
			
			
			if($(this).val() >= 1)
			{
			//alert($(this).val())
			mycname		=	"campHomePhone_"+$(this).val();
			
			
				// ---------- checking for phones in creatives ------------------------------
			if($("#"+mycname)[0])
				{
					mycvalue	=	$("#"+mycname).val();
					mycCheck	=	checkHomePhone(mycvalue);
					if(mycCheck == false)
					{
						alert("Please enter HomePhone correctly ");	
						$("#"+mycname).focus();
						myCheck = false;
						return false;
					}
				}
			
			mycname		=	"campMobilePhone_"+$(this).val();
			
			
			if($("#"+mycname)[0])
				{
					
					mycvalue	=	$("#"+mycname).val();
					
					mycCheck	=	checkMobilePhone(mycvalue);
					
					if(mycCheck == false)
						{
							alert("Please enter MobilePhone correctly");	
							$("#"+mycname).focus();
							myCheck = false;
							return false;
						}
				}
			
				
				
				var i = 1;
				while(i < 15)
					{
						var fieldName = $(this).val()+"_field"+i;
						
						
						if($("#"+fieldName)[0])
							{
								
								if($("#"+fieldName).val() == ""  ||  $("#"+fieldName).val() == "YYYY-MM-DD")	
									{
										alert("Please fill the details");
										//alert("RETUTN FALSE")
										$("#"+fieldName).focus();
										myCheck = false;
										return false;
									}
								
								
							}
					i++;
					}
			}
		
		});
 		
		
		//$("input[@name='CampIDS[]']:checked").each(function() {
			//alert("MyCamp = ".$(this).val());
		//});
 	
	if(myCheck == false)
		return false;	
	else
		return true;	
		return false;
	}




function check()
{		
	
	if(document.frmmain.title)
	{
		
	if(document.frmmain.title.value =="")
		{
			
			alert("Please Select A Title");
			document.frmmain.title.focus();
			return false;
		
		}
	}
				
	if(document.frmmain.firstName)
	{
		
		if(document.frmmain.firstName.value=="")
			{
			alert("Please Enter First Name");
			document.frmmain.firstName.focus();
			return false;
			}
			
			if(!isNaN(document.frmmain.firstName.value))
			{
				
				alert("Your First Name appears to be in-correct");
				document.frmmain.firstName.focus();
				return false;

			}
			
			
			// If the element's string matches the regular expression it is all letters

			var alphaExp = /^[a-zA-Z]+$/;
				if(!document.frmmain.firstName.value.match(alphaExp))
				{
					alert("Your First Name appears to be in-correct");
					document.frmmain.firstName.focus();
					return false;
				}

	}  // end first Name
	
	if(document.frmmain.lastName)
	{
		if(document.frmmain.lastName.value=="")
			{
				alert("Please Enter Last Name");
				document.frmmain.lastName.focus();
				return false;
			
			}
			
		if(!isNaN(document.frmmain.lastName.value))
			{
				
				alert("Your Last Name appears to be in-correct");
				document.frmmain.lastName.focus();
				return false;

			}
			
			var len	= document.frmmain.lastName.value;
			var len_lname=len.length;
			if(len_lname<=2)
			{
			alert("Your Last Name appears to be in-correct");
			document.frmmain.lastName.focus();
			return false;
			}
			
			
			
	}
				//$$$$$$$$$$$$$$$$$$$$ Email $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$4
	
	if(document.frmmain.email)
	{
	if(document.frmmain.email.value=="")
			   
		{
				alert("Please Enter Correct Email.");
				document.frmmain.email.focus();
				return false;
		}
			
			else
				
			{
					var str=document.frmmain.email.value;
					var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
					
					if (!filter.test(str))
							
						   {
								alert("Please enter valid email address.");
								document.frmmain.email.focus();
								return false;
							}
						
/*					
			  		else
					
							{
								if(document.getElementById('div_email').innerHTML == "Email Exists")
							
									{
							
										alert("Email Already Exists");
										return false;
						
									}
				
							}*/
			}
		}


		if(document.frmmain.password){
			if(document.frmmain.password.value== "")
			
				{
					alert("Please Enter the correct Password");
					document.frmmain.password.focus();
					return false;
				}
		}

	
	if(document.frmmain.gender)
	{
		if(document.frmmain.gender.value=="")
		{
		alert("Please Select Your Gender");
		document.frmmain.gender.focus();
		return false;
		}
	}

	if(document.frmmain.Day)
	{
	if(document.frmmain.Day.value=="")
			{
				alert("Please Select  Day Of Birth");
				document.frmmain.Day.focus();
				return false;
			}
	}
	
	
	if(document.frmmain.Month)
	{
	if(document.frmmain.Month.value== "")
		{
			alert("Please Select  Month Of Birth");
			document.frmmain.Month.focus();
			return false;
		}
	}
			
	if(document.frmmain.Year)
	{
		if(document.frmmain.Year.value== "")
			{
				alert("Please Select Year Of Birth");
				document.frmmain.Year.focus();
				return false;
			}
	}
	
	if(document.frmmain.address1)
	{
		if(document.frmmain.address1.value == "")
			{
				alert("Please Enter the correct Address");
				document.frmmain.address1.focus();
				return false;
			}
	}
	
	if(document.frmmain.city)
	{
		if(document.frmmain.city.value== "")
			
			{
				alert("Please Enter the correct City");
				document.frmmain.city.focus();
				return false;
			}
			
			if(!isNaN(document.frmmain.city.value))
			{
				
				alert("Your City appears to be in-correct");
				document.frmmain.city.focus();
				return false;

			}
			
			var len	= document.frmmain.city.value;
			var len_city=len.length;
			
			if(len_city<=2)
			{
			alert("Your City appears to be in-correct");
			document.frmmain.city.focus();
			return false;
			}
			
			
			
				var alphaExp = /^[a-zA-Z]+$/;
				if(!document.frmmain.city.value.match(alphaExp))
				{
					alert("Your city appears to be in-correct");
					document.frmmain.city.focus();
					return false;
				}

			
	}


	if(document.frmmain.state)
	{
		if(document.frmmain.state.value== "")
			
			{
				alert("Please Enter the correct State");
				document.frmmain.state.focus();
				return false;
			}
			
			if(!isNaN(document.frmmain.state.value))
			{
				
				alert("Your State appears to be in-correct");
				document.frmmain.state.focus();
				return false;

			}
			
			
			var len	= document.frmmain.state.value;
			var len_state=len.length;
			
			if(len_state<=2)
			{
			alert("Your State appears to be in-correct");
			document.frmmain.state.focus();
			return false;
			}
			
			
				var alphaExp = /^[a-zA-Z]+$/;
				if(!document.frmmain.state.value.match(alphaExp))
				{
					alert("Your state appears to be in-correct");
					document.frmmain.state.focus();
					return false;
				}


			
	}

			
			//$$$$$$$$$$$$$$$$$$$$ Post Code $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$4
	if(document.frmmain.postCode)
	{
		if(document.frmmain.postCode.value=="")
		{
			alert("Please Enter the correct Post Code");
				document.frmmain.postCode.focus();
				return false;
		}
			else
				{
				
				
				
							var postcode = document.frmmain.postCode.value;
							var len = postcode.length;
							if(len<6 || len>8 || postcode.indexOf(" ")== -1)
							{
								alert("Your Post Code appears to be in-correct");
								document.frmmain.postCode.focus();
								return false;
							}
							else
							{
								
							var count = 0 ;
							var str = postcode.split(" ");
							var begin=str[0];
							var last=str[1];
							if(last.length==3 && (begin.length== 2 || begin.length== 3 || begin.length== 4))
							{
							validchars1="1234567890";
							validchars2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
							validchars3="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
							if(((validchars1.indexOf(last.charAt(0))<0)||(validchars3.indexOf(last.charAt(1))<0)||(validchars2.indexOf(last.charAt(2)))<0) )
							{
								count+=0;
							}
							else 
							{
								count+=1;
							}
							
							if(begin.length==4)
							{
							 if(((validchars2.indexOf(begin.charAt(0))<0)||(validchars2.indexOf(begin.charAt(1))<0)||(validchars3.indexOf(begin.charAt(2)))<0)||(validchars3.indexOf(begin.charAt(3))<0))
								{			 
									count+=0;
								 }
								else 
								{
								count+=1;
								}
							}
							
							if(begin.length==3)
							{
								if(((validchars2.indexOf(begin.charAt(0))<0)||(validchars3.indexOf(begin.charAt(1))<0)||(validchars1.indexOf(begin.charAt(2)))<0))
								{			 
									count+=0;
								 }
								else 
								{
									count+=1;
								}
								
								
							}
							
							else if(begin.length==2)
								{
									if(((validchars2.indexOf(begin.charAt(0))<0)||(validchars1.indexOf(begin.charAt(1)))<0))
									{			 
										count+=0;
									 }
									else 
									{
									count+=1;
									}
									
								 }
							
							if(count!=2)
								{
									 alert("Your Post Code appears to be in-correct");
									 document.frmmain.postCode.focus();
									 return false;
								}
							 }
							else
								{
									alert("Your Post Code appears to be in-correct");
									document.frmmain.postCode.focus();
									return false;
								}
							
						   }
		   
				}
		
		}


	if(document.frmmain.homePhone)
	{
		

		
		if(document.frmmain.homePhone.value=="")
		   {
				alert("Please Enter Correct homephone Number.");
				document.frmmain.homePhone.focus();
				return false;
			}
			
		  else if(isNaN(document.frmmain.homePhone.value))
			
			{
				 alert("Please enter home phone in number ");
				 document.frmmain.homePhone.focus();
				 return false;
			}
			
		  else 	
			 {
				 
				 var str_value=document.frmmain.homePhone.value;
				 str=document.frmmain.homePhone.value;
				 str=str.length;
				 var i=0;
				 var flage=0;
				 $f_2=0;
			 while(i < 2)
			  {
				 if(i==0 && str_value.charAt(i)==0)
				 {
					$f_2=1;
				 //break;
				 }
				if($f_2==1 && i==1 && (str_value.charAt(i)==7  || str_value.charAt(i)==8 || str_value.charAt(i)==9))
				 {
					flage=1;
					break;
				 }
 
				i++;
			  }
			  
			  if(flage==1 || str!=11)
			   {
				 alert("Your telephone number is invalid");
                 document.frmmain.homePhone.focus();
			     return false;
 
			   }
         }
	
	}
	
	
	if(document.frmmain.mobilePhone)
	{
		
      if(document.frmmain.mobilePhone.value!="" && document.frmmain.mobilePhone.value!=0)
		{
			
	 
	   if(isNaN(document.frmmain.mobilePhone.value))
	    {
			 alert("Invalid mobile number");
			 document.frmmain.mobilePhone.focus();
			 return false;
		}
	    else 	
	     {
			 var str_value=document.frmmain.mobilePhone.value;
			 str=document.frmmain.mobilePhone.value;
             str=str.length;
             
             var i=0;
			 var flage=0;
			 while(i < 2)
			  {
				 if(i==0 && str_value.charAt(i)!=0)
				 {
					flage=1;
					break;
				 }
				else if(flage==0 && i==1 && str_value.charAt(i)!=7)
				 {
				   	flage=1;
					break;
				 }
 
				i++;
			  }
			  
			  if(flage==1 || str!=11)
			   {
				 alert("Invalid mobile number");
             document.frmmain.mobilePhone.focus();
			     return false;
			   }
			   
             }
		 }

	}
	

	if(document.frmmain.homeStatus)
	{
		if(document.frmmain.homeStatus.value=="" || document.frmmain.homeStatus.value=="~Select")
			{
			alert("Please Select Home Owner");
			document.frmmain.homeStatus.focus();
			return false;
			}
	}
	
	if(document.frmmain.occupation)
	{
		if(document.frmmain.occupation.value=="" || document.frmmain.occupation.value=="~Select")
			{
			alert("Please Select Occupation");
			document.frmmain.occupation.focus();
			return false;
			}
	}

	if(document.frmmain.annualIncome)
	{
		if(document.frmmain.annualIncome.value=="" || document.frmmain.annualIncome.value=="~Select")
			{
			alert("Please Select annualIncome");
			document.frmmain.annualIncome.focus();
			return false;
			}
	}


	if(document.frmmain.maritalStatus)
	   {

		if(document.frmmain.maritalStatus.value=="" || document.frmmain.maritalStatus.value=="~Select")
			{
			alert("Please Select Your Marital Status");
			document.frmmain.maritalStatus.focus();
			return false;
			}
	   }

	if(document.frmmain.peopleLiving)
	{
	if(document.frmmain.peopleLiving.value=="" || document.frmmain.peopleLiving.value=="~Select")
			{
			alert("Please Select People Living Status");
			document.frmmain.peopleLiving.focus();
			return false;
			}
	}


	if(document.frmmain.underEighteen)
	{
		if(document.frmmain.underEighteen.value=="" || document.frmmain.underEighteen.value=="~Select")
			{
			alert("Please Select UnderEighteen Status");
			document.frmmain.underEighteen.focus();
			return false;
			}
	}
	
	if(document.getElementById('terms'))
		{
			if(document.getElementById('terms').checked == false)
				{
					alert("Please check terms and privacy policy");
					return false;	
				}
		}
	
	
	
	
return true;	
}

	
	
function preloadimages()
	{
		alert("IN SINE " + preloadimages.arguments.length)
		for (i = 0; i < preloadimages.arguments.length; i++)
			{
				myimages[i] 		= new Image();
				myimages[i].src 	= preloadimages.arguments[i];
				
				alert("IN"+ preloadimages.arguments[i])
			}
	}
	
function ravi(GiftId,image_name,mystyle,giftname,giftmagepadd)
	{
	
	if(headerchange == "Yes")
		{
			var i = 1;
			while(i <= headersplits)
				{
					document.getElementById('header_'+i).src = "images/header_"+i+"_"+giftmagepadd+".jpg";
					
					i++;
				}
			document.getElementById('submit').src = "images/button_"+giftmagepadd+".jpg";	
		}
							
		document.getElementById('myGiftID').value = GiftId;
		document.getElementById('formHeading').innerHTML = giftname;
		prevContent = document.getElementById('middle_right').innerHTML;
		
		/*document.getElementById('middle_right').innerHTML = '<a onclick="back_to_default_images()" style=color:red>back</a><img src="'+image_name+'">';*/
		
		document.getElementById('middle_right').innerHTML = '<input type="button" value="Back" onclick="back_to_default_images()" id="back_button"/><img src="'+image_name+'"><div id="gift_description"></div>';
		document.getElementById('gift_description').innerHTML = document.getElementById('hid_gift_desc_'+GiftId).value;
		document.getElementById('default').href = "styles/"+mystyle;
	}

function back_to_default_images()
	{	
	
	if(headerchange == "Yes")
		{
			var i = 1;
			while(i <= headersplits)
				{
					document.getElementById('header_'+i).src = "images/header_"+i+".jpg";
					i++;
				}
				
			document.getElementById('submit').src = "images/button.jpg";	
		}
		
		document.getElementById('myGiftID').value = "";
		document.getElementById('formHeading').innerHTML = "Select the prize and enter the draw";
		document.getElementById('middle_right').innerHTML = prevContent;
		document.getElementById('default').href = "styles/homepage.css";
		
	}
	

function getPoints()
	{
		var ajaxaction = "POINTS"
					$.post("ajaxcon.php", {ajaxaction:ajaxaction}, function(data){
						
						
						$("#earn").html(data);
						
					}); // ajax
	}


function load_form(myGiftID)
	{
		
			var posturl	= "registration_form1.php?fromlogin=yes";
			$.ajax({
			  type:"POST", 
			  url:posturl,
			  data:{},
			  dataType:"html",
			  success:function ( data ) { 
				
				$("div#div_my_form").html(data);		 
				$("input#myGiftID").val(myGiftID);
			  } ,
			  
			  error:function(xhr,err,e){ alert( "Error: " + err ); }
			}); // $.ajax()
		
	}
	

var mypage = 0;
	
	function banners_View(limit , act , imagePefix)
	{
		getPoints();
		
		if(act == "NEXT" && mypage == 1)	
			{
				
				var mysbmt = my_submit2();
				
				if(mysbmt == false)
				{
					return false;
				}
				else
				{
					
					var str 			= $('form#frmmain').serialize();
					
					$.post("process_index1.php?frmP4u=Yes", str, function(data){
			
						
					}); // ajax

			
				}
			}

		
		
		if(act == "NEXT" || act == "LOAD")
			mypage++;
		else
			mypage--;
		
		if(mypage < 1)
			mypage = 1;
	
	
	if(mypage > 1)
		{
			$("#formSecond").hide();
			$("#prevButt").attr("disabled",false);
		}
	else if(mypage == 1)
		{
			$("#formSecond").show();
			$("#prevButt").attr("disabled",true);
			
		}
		
	start = parseInt(mypage) * parseInt(limit); 		
			
	var ajaxaction	=	'bannerShowDetails';
	$.post("ajaxcon.php?start="+start+"&limit="+limit+"&imagePefix="+imagePefix, {ajaxaction:ajaxaction}, function(data){
			
			var chdata = "HELLO"+data;
			//alert(data+data.indexOf("NOBANNER"));
			if(chdata.indexOf("NOBANNER") > 0)
				{
					
					window.location.href = "thankyou.php";
					
				}
			else	
				{
					$("#banerDV").html(data);
				}
	});

	return false;
	}
	
	
	
function Login_Now()
	{
		
		var email 			=	$("input#loginEmail").val();
		var password 		=	$("input#loginPassword").val();
		
		if(email == "")
			{
				alert("Please enter email");
				return false;
			}
			
		
		if(password == "")
			{
				alert("Please enter password");
				return false;
			}
		
		var posturl			=	"process_login.php";
		
				$.ajax({
				  type:"POST", 
				  url:posturl,
				  data:{email:email,password:password},
				  dataType:"html",
				  success:function ( data ) { 
				
					if(data.indexOf("Refresh") >= 0)
						{
							window.location.href = "\?loggedIn";
							//document.getElementById('submit').src = "images/button_update.jpg";
						}
					else
						$("#Login_error_mesage").html( data ); 
				  
				  } ,
				  
				  error:function(xhr,err,e){ alert( "Error: " + err ); }
				}); // $.ajax()
	}


function my_submit2()
	{
		
		var myFlag = check();
		
			if(myFlag == false)
				return false;
	
			
			
			
			
		/*	var campCheckFlag = checkCampsValues();
			
			//alert(campCheckFlag)
			if(campCheckFlag == false)
				return false;
		
		
		if(document.getElementById("hidden_count") != null){
		var radio_len = document.getElementById("hidden_count").value;
		var chk_all_radio_not_chek=0;
		var yes_length=0;
		for(i=0; i<radio_len; i++){
			var getradio = document.getElementById("check_radio"+i).getElementsByTagName("input");
			if(getradio[0].checked == false && getradio[1].checked == false){
				chk_all_radio_not_chek=1;
			//	return false;
			}
			
			if(getradio[0].checked == true){
				yes_length=yes_length+1;
				
			}
		}   // end for loop
		

		if(chk_all_radio_not_chek==1)
		{
		alert("Please select radio button");
		return false;
		}
		
			if(document.getElementById('terms') == null)
	{	
		
				if(radio_len>4)
			{

				if(yes_length<2)
					{
						alert("Please Clicked Atleast Two Yes Option");
						return false;
					}
	}
			}
	}
		*/
		
		return true;
	}



function forgotpassword()


{
		if(document.getElementById('ForgetEmail').value == "")
		{
			alert("Please Enter Correct Email");
			//$("#submit").attr("disabled",false).css('opacity', 1);
			return false;
		}
	
	$("#forgot_error").html("<center><b>Please Wait.....</b><img src='image/loaderA32.gif'><center>");
	
	
	
	var email 		=	$("#ForgetEmail").val();
	
	var ajaxaction	=	'chkRegFieldName';
	
	$.post("ajaxcon.php", {ajaxaction:ajaxaction, email:email}, function(data){
		$("#forgot_error").html(data);
	});
	
}



function my_submit()
{
	
		//$("#submit").attr("disabled",true).css('opacity', 0.4);
	
	if(document.getElementById('myPrizeID').value == "")
		{
			alert("Please select a Gift");
			//$("#submit").attr("disabled",false).css('opacity', 1);
			return false;
		}	
		
	else
		{
			var myFlag = check();
			if(myFlag == false)
				return false;
			
			var campCheckFlag = checkCampsValues();
			if(campCheckFlag == false)
			return false;
				
		if(document.getElementById("hidden_count") != null){
		var radio_len = document.getElementById("hidden_count").value;
		var chk_all_radio_not_chek=0;
		var yes_length=0;
		for(i=0; i<radio_len; i++){
			//alert("yes_length" + yes_length);
			var getradio = document.getElementById("check_radio"+i).getElementsByTagName("input");
			if(getradio[0].checked == false && getradio[1].checked == false){
				chk_all_radio_not_chek=1;
			//	return false;
			}
			
			if(getradio[0].checked == true){
				yes_length=yes_length+1;
				
			}
		}   // end for loop
		
		if(chk_all_radio_not_chek==1)
		{
		alert("Please select radio button");
		return false;
		}
	
	}				
		
			var posturl 		= "process_index.php";
			var str 			= $('form#frmmain').serialize();
			$.ajax({
			type:"POST", 
			url:posturl,
			data:str,
			dataType:"html",
			success:function ( data ) { 
				  
				if(data.indexOf("Done") != -1)
					{
						//alert("indedddddddddddddd");
						window.location.href = "index1.php";
					}
				else
					{	
					
						//alert("page2")
					  	//alert("OKK");
					  	
						$("div#submit_result").html( data ); 
					  //$("#submit").attr("disabled",false).css('opacity', 1);
					  
					  
					}								  
				  
				  } ,
				  
				  error:function(xhr,err,e){ alert( "Error: " + err ); }
				}); // $.ajax()
		
		}

return false;
}


function email_check()
	{
		var posturl = "check_email.php";
		var email 	=	$("input#email").val();
			$.ajax({
			  type:"POST", 
			  url:posturl,
			  data:{ email:email},
			  dataType:"html",
			  success:function ( data ) { 
			 // if(data == "Available")
				//$("#submit").attr("disabled",false).css('opacity', 1);
				
			  $("div#div_email").html( data ); 
			  
			  if(data == "Duplicate")
			  
					click_options("LoginDup");	
					
			  
			  } ,
			  error:function(xhr,err,e){ alert( "Error: " + err ); }
			}); // $.ajax()

	
	}

function setFocusOnEmailLogin()
	{
	 $('#LoginEmail').focus();
	}
	
function click_options(choice)	
	{
		
		if(choice == "Login")
				{
				var posturl = "login.php";
				
					$.ajax({
					  type:"POST", 
					  url:posturl,
					  data:{choice:choice},
					  dataType:"html",
					  success:function ( data ) { 
					  $("div#div_my_form").html( data ); 
					 	 setTimeout("setFocusOnEmailLogin()",500);
					 // $('input.focus:LoginPassword').focus();
					  
					  } ,
					  error:function(xhr,err,e){ alert( "Error: " + err ); }
					}); // $.ajax()
					
					
					document.getElementById("shw_camp").style.display = 'none'
					document.getElementById("button").style.display = 'none'
				// $('#LoginPassword').focus();
				}
			else if(choice == "Register")
				{
					var posturl = "registration_form1.php?fromlogin=yes";
				
					$.ajax({
					  type:"POST", 
					  url:posturl,
					  data:{},
					  dataType:"html",
					  success:function ( data ) { 
					  $("div#div_my_form").html( data ); } ,
					  error:function(xhr,err,e){ alert( "Error: " + err ); }
					}); // $.ajax()
					
				document.getElementById("shw_camp").style.display = '';
				document.getElementById("button").style.display = ''
				
				}
				
			else if(choice == "forget")
				{
						var posturl			=	"forget_password.php";
					$.ajax({
						  type:"POST", 
						  url:posturl,
						  data:{},
						  dataType:"html",
						  success:function ( data ) { 
							
								$("div#div_my_form").html( data ); 
						  
						  } ,
						  
						  error:function(xhr,err,e){ alert( "Error: " + err ); }
						}); // $.ajax()	
					
				document.getElementById("shw_camp").style.display = 'none'
				document.getElementById("button").style.display = 'none'
				
				}
				
			else if(choice == "LoginDup")
				{
				var posturl = "login.php?type1=DUP";
				
					$.ajax({
					  type:"POST", 
					  url:posturl,
					  data:{choice:choice},
					  dataType:"html",
					  success:function ( data ) { 
					  $("div#div_my_form").html( data ); 
					 	 setTimeout("setFocusOnEmailLogin()",500);
					 // $('input.focus:LoginPassword').focus();
					  
					  } ,
					  error:function(xhr,err,e){ alert( "Error: " + err ); }
					}); // $.ajax()
					
					
					document.getElementById("shw_camp").style.display = 'none'
					document.getElementById("button").style.display = 'none'
				// $('#LoginPassword').focus();
				}	
			
		//alert("testing");	
	
	}
	
	
	

function check_contact()
{	
if(document.frmmain.firstName)
	{
		
	if(document.frmmain.firstName.value =="")
		
		{
			alert("Please Enter The Name");
			document.frmmain.firstName.focus();
			return false;
		
		}
		
	}
		
	if(document.frmmain.email)
	{
	if(document.frmmain.email.value=="")
			   
		{
				alert("Please Enter Correct Email.");
				document.frmmain.email.focus();
				return false;
		}
			
			else
				
			{
					var str=document.frmmain.email.value;
					var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
					
					if (!filter.test(str))
							
						   {
								alert("Please enter valid email address.");
								document.frmmain.email.focus();
								return false;
							}
						
					

			}
		}



if(document.frmmain.homePhone)
	{
		
	if(document.frmmain.homePhone.value =="")
		
		{
			alert("Please Enter homePhone ");
			document.frmmain.homePhone.focus();
			return false;
		
		}
		
		if(isNaN(document.frmmain.homePhone.value))
			
			{
				 alert("Please enter home phone in number ");
				 document.frmmain.homePhone.focus();
				 return false;
			}
		
	}



if(document.frmmain.message1)
	{
		
	if(document.frmmain.message1.value =="")
		
		{
			alert("Please Enter Message");
			document.frmmain.message1.focus();
			return false;
		
		}
		
	}
	

	}



function perform_inaction(CampID)
{
	
$("#div_creative_"+CampID).hide("slow");	
	
}


	function perform_action(mycheck,CampID,ShowCreative,Units)
		{
			/*if(mycheck.checked == true)
				{
					var value = parseInt($("input#CountChecked").val()) + 1;
					$("input#CountChecked").val(value);
				}	
			else
				{
					var value = parseInt($("input#CountChecked").val()) - 1;
					$("input#CountChecked").val(value);	
				}	*/
		
		/*if($("input#CountChecked").val() >= 1)
			$("#submit").attr("disabled",false).css('opacity', 1);
		else
			$("#submit").attr("disabled",true).css('opacity', 0.4);
		*/		
			if(ShowCreative == "Y")
				{
					if(mycheck.checked == true)
						{
							$("#div_creative_"+CampID).show("slow");
							
							if($("#campTitle_"+CampID))
								$("#campTitle_"+CampID).val($("#title").val());
							
							if($("#campFirstName_"+CampID))
								$("#campFirstName_"+CampID).val($("#firstName").val());
							
							if($("#campLastName_"+CampID))
								$("#campLastName_"+CampID).val($("#lastName").val());
							
							if($("#campEmail_"+CampID))
								$("#campEmail_"+CampID).val($("#email").val());
							
							if($("#campCity_"+CampID))
								$("#campCity_"+CampID).val($("#city").val());
								
							if($("#campState_"+CampID))
								$("#campState_"+CampID).val($("#state").val());
							
							if($("#campAddress1_"+CampID))
								$("#campAddress1_"+CampID).val($("#address1").val());
								
							if($("#campAddress2_"+CampID))
								$("#campAddress2_"+CampID).val($("#address2").val());
							
							if($("#campPostCode_"+CampID))
								$("#campPostCode_"+CampID).val($("#postCode").val());
							
							if($("#campDay_"+CampID))
								$("#campDay_"+CampID).val($("#Day").val());
							
							if($("#campMonth_"+CampID))
								$("#campMonth_"+CampID).val($("#Month").val());
							
							if($("#campYear_"+CampID))
								$("#campYear_"+CampID).val($("#Year").val());
							
							if($("#campHomePhone_"+CampID))
								$("#campHomePhone_"+CampID).val($("#homePhone").val());
								
								if($("#campCountry_"+CampID))
								$("#campCountry_"+CampID).val($("#country").val());
								
								if($("#campMaritalStatus_"+CampID))
								$("#campMaritalStatus_"+CampID).val($("#maritalStatus").val());
								
								if($("#campHomeStatus_"+CampID))
								$("#campHomeStatus_"+CampID).val($("#homeStatus").val());
								
								if($("#campMobilePhone_"+CampID))
								$("#campMobilePhone_"+CampID).val($("#mobilePhone").val());

								
								if($("#campOccuptation_"+CampID))
								$("#campOccuptation_"+CampID).val($("#occupation").val());


							
						}
					else
						$("#div_creative_"+CampID).hide("slow");	
				}
			else
				{
					/*var posturl 		= "process_campaigns.php";
					$.ajax({
					  type:"POST", 
					  url:posturl,
					  data:{CampID:CampID,Units:Units},
					  dataType:"html",
					  success:function ( data ) { 
					
						if(data == "Done")
							$("#SpanCamp_"+CampID).html( data );
					  } ,
					  
					  error:function(xhr,err,e){ alert( "Error: " + err ); }
					}); // $.ajax()*/
				}	
						
		}	