	var error="";
	var tag="";
	var cvalue="";
	var expire="";
	var emailforgot="";
	var timeoutminutes;
	var iddaughter;
	var idsinfoid = Array();
	var idsinfoname = Array();
	var idsuserType = Array();
	var idsquestions = Array();
	var textquestions = Array();
	var childidentity;
	var childname;
	var struserType;
	var strstringoptions="";
	var emailoldcurrent;

// JavaScript Document
	$(window).load(function(){
			
			
	   var strLogout = window.location.search.substring(1);
	   var contentLogout = strLogout.split("=");
	   if(contentLogout[0]!="" && contentLogout[0] =="logout" && contentLogout[1]=="true")
	   	{
			logOutPage();
		}
/*		
		if(contentLogout[0]!="" && contentLogout[0] =="action" && contentLogout[1]=="ad")
		{
			
			isValidSesion(logicalShowmydrUrl);
			$("#listgirls").css("display","none");				
			
			alert('entro');
			function logicalShowmydrUrl(success)
				{
					alert('entro a logicalShowmydrUrl');
					if (success)
						{
								alert('entro a success');
							$(".myparentaccount").css("background-image", "url(IMG/parents/spacer.gif)");
							successGobal =true;
							$("#img").css("background-image","url(IMG/parents/img_parent.gif)");
							$("#img").css("background-repeat","no-repeat");
							$(".myparentaccount").css("cursor","pointer");
							$("#menu_text_active").css("display","block");	
							$("#menu_text_inactive").css("display","none");	
						

							$("#editdaughtercaseclosed").css("display","none");
							$("#editdaughtercaseBanned").css("display","none");
							$("#contenidoSafety").css("display","none");
							$("#contenidoAccount").css("display","block");
							$("#contenidoGeneralInfo").css("display","none");
							$("#contenidoHome").css("display","none");
							$(".parentHome").css("background-image", "url(IMG/parents/tab_01.gif)");
							$(".generalParentInfo").css("background-image", "url(IMG/parents/tab_03.gif)");
							$(".safetyInfomation").css("background-image", "url(IMG/parents/tab_04.gif)");
							$("#editdaughtercase3").css("display","none");
							$("#editdaughtercase2").css("display","none");				
							$("#editdaughtercase1").css("display","none");					
							$("#editdaughtercase4").css("display","none");	
							tabParenthome=true;
							tabParentAccountDetails=false;
							tabParentMessageParents=true;
							tabParentOnlineSafety=true;
	
							fillDaughter('2')
							//fillDaughter('2')
						}
						else
							{
								successGobal =false;
								$("#menu_text_active").css("display","none");	
								$("#menu_text_inactive").css("display","block");	
								$(".myparentaccount").css("background-image", "url(IMG/parents/tab_02_over.gif)");
							}
			

			
			
				}
			
			
		}
*/		
		
			webService("pi/parentGetQuestions.do","");
			var stridquestions = parseXml("id");
			var strdescription= parseXml("text");
			var flag;

				for(var i=0;i<stridquestions.length;i++)
				{
					idsquestions = stridquestions[i].split("|");
					textquestions = strdescription[i].split("|");
					strstringoptions = strstringoptions+ "<option value='"+idsquestions+"'>"+textquestions+"</option>"

					if(i==0)
					 {
					  flag=true;
					 }
					else
					{
					 flag=false;
					}
					$("#selectSecretQuestion").addOption(idsquestions[0], textquestions, flag);			//add option to combo secret question on the registration form
					$("#selectChangeSecretQuestion").addOption(idsquestions[0], textquestions, flag);	//add option to combo secret question on the daughter’s list table
					$("#selectSecretQuestionDaughter").addOption(idsquestions[0], textquestions, flag);	//add option to combo secret question on the daughter’s detail
				}
			
				webService("pi/subscriptionAgeGroups.do","");
				var stridage_S3 = parseXml("id");
				var strdescriptionage_S3= parseXml("text");
				var flagage_S3;
				var strstringoptions_S3;
				var idsquestionsage_S3;
				var textquestionsage_S3;
				var strstringoptionsage_S3;
				
				for(var i=0;i<stridage_S3.length;i++)
				{
					idsquestionsage_S3 = stridage_S3[i].split("|");
					textquestionsage_S3 = strdescriptionage_S3[i].split("|");
					strstringoptionsage_S3 = strstringoptionsage_S3+ "<option value='"+idsquestionsage_S3+"'>"+textquestionsage_S3+"</option>"
				
					if(i==0)
						flagage_S3=true;
					else 
						flagage_S3=false;
						
					$("#dAge").addOption(idsquestionsage_S3[0], textquestionsage_S3, flagage_S3);			//add option to combo secret age on the transaction form
				}		
		

			$("#img").css("background-image","url(IMG/parents/img_home.gif)");
			$("#img").css("background-repeat","no-repeat");					
	});


$(document).ready(function(){
	
	var error="";
	var strtmp="";
	var strtmp1="";
	var toppx=0;
	var toppx1=0;
	var error="";

	$("#btregistrationparentstep1").click(function(){
		registerparent();
	});
	
	$("#txtregisterparentemail").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});	
	
	$("#txtregisterparentpassword").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});	
	
	$("#txtregisterparentpasswordagain").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});		
	
	$("#txtregisterparentsecretquestion").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});		
	
	$("#txtregistrationparentscreenname").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});		
	
	$("#txtregistrationparentpassword").keypress(function (e) {
      if (e.which == 13)
		registerparent(); 
	});		
	
/**LOGIN HOME PAGE STARTS*/
	$("#btloggedhomepage").click(function(){
		loginFromHomePage();
	});
/*CALL WEB SREEVICES LOGIN ON KEY PRESS*/	
	$("#youremailhomepage").keypress(function (e) {
      if (e.which == 13)
		loginFromHomePage(); 
	});
/*CALL WEB SREEVICES LOGIN ON KEY PRESS ENDS*/		

/*CALL WEB SREEVICES LOGIN ON KEY PRESS*/	
	$("#yourepasswordhomepage").keypress(function (e) {
      if (e.which == 13)
		loginFromHomePage();
	});
/*CALL WEB SREEVICES LOGIN ON KEY PRESS ENDS*/	

/*CALL WEB SREEVICES LOGIN ON KEY PRESS*/	
	$("#loginloggedoutemail").keypress(function (e) {
      if (e.which == 13)
		 loginFromLoggedOut();
	});
/*CALL WEB SREEVICES LOGIN ON KEY PRESS ENDS*/	

/*CALL WEB SREEVICES LOGIN ON KEY PRESS*/	
	$("#loginloggedoutpassword").keypress(function (e) {
      if (e.which == 13)
		 loginFromLoggedOut();
	});
/*CALL WEB SREEVICES LOGIN ON KEY PRESS ENDS*/	



/**LOGIN HOME PAGE ENDS*/
/**LOGIN LOGGED PAGE STARTS*/
	$("#btloginlogged").click(function(){
		 loginFromLoggedOut();
	});	
/**LOGIN LOGGED PAGE ENDS*/	


/**CHANGE MY EMAIL ADDRESSS PAGE STARTS*/
	$("#btsaveparentemail").click(function(){
		sendparentemail();
	});
	
	
	$("#txtpopupparentemail").keypress(function (e) {
      if (e.which == 13)
		sendparentemail(); 
	});
	
	
	$("#txtpopupparentemail2").keypress(function (e) {
      if (e.which == 13)
		sendparentemail(); 
	});	
	
/**CHANGE MY EMAIL ADDRESSS PAGE ENDS*/

/**CHANGE MY PASSWORD PAGE STARTS*/
	$("#btsaveparentchangepassword").click(function(){
		parentchangepassword();	
	});	

	$("#currentpasswordparent").keypress(function (e) {
      if (e.which == 13)
		parentchangepassword();
	});
	
	
	$("#newpasswordparent").keypress(function (e) {
      if (e.which == 13)
		parentchangepassword();
	});	

	$("#retypenewpasswordparent").keypress(function (e) {
      if (e.which == 13)
		parentchangepassword();
	});	
/**CHANGE MY PASSWORD PAGE ENDS*/
	
/**CHANGE QUESTION PAGE STARTS*/
	$("#btsaveparentquestionanswer").click(function(){
	  parentchangequestion();
	});	

	$("#quetionsecretanswer").keypress(function (e) {
      if (e.which == 13)
		parentchangequestion();
	});	
/**CHANGE QUESTION PAGE ENDS*/


/**CHANGE QUESTION PAGE STARTS*/
	$("#btchangestatuschat").click(function(){
		isValidSesion(changestatuschat);
	});	

/**CHANGE QUESTION PAGE ENDS*/
	
/**CHANGE PASSWORD DAUGHTER PAGE STARTS*/
	$("#btsavechangepassworddaughter").click(function(){
		daughterchangepassword()
	});
	
	$("#changedaughtercurrentpassword").keypress(function (e) {
      if (e.which == 13)
		daughterchangepassword();
	});		

	$("#changedaughtercurrentnewpassword").keypress(function (e) {
      if (e.which == 13)
		daughterchangepassword();
	});		
	
	$("#changedaughterretypecurrentnewpassword").keypress(function (e) {
      if (e.which == 13)
		daughterchangepassword();
	});			
/**CHANGE PASSWORD DAUGHTER PAGE ENDS*/

/**CHANGE PASSWORD DAUGHTER PAGE STARTS*/
	$("#btsavesecretquestiondaughter").click(function(){
		aughterchangequestion();
	});

	$("#txtsecretanswerdaughter").keypress(function (e) {
      if (e.which == 13)
		aughterchangequestion();
	});			
/**CHANGE PASSWORD DAUGHTER PAGE ENDS*/

	$("#forgotpasswordlink").click(function(){
		 $.modal.impl.close(true);
		 	$("#forgotpasswordpopup").modal();
			$('#contentStep1').css("display","block");
			$('#contentStep2').css("display","none");
			$('#forgotpasswordpopup').css("height","350px");
			$('#forgotpasswordpopup').css("width","455px");
			$('#forgotpasswordpopup').css("padding-left","130px");
		});	
	
	/**CHANGE FORGOT PASSWORD PAGE STARTS*/
	$("#btnextforgotpassword").click(function(){
		sendForgotPassword();
	});
	
	$("#txtemailaddressforgotpassword").keypress(function (e) {
      if (e.which == 13)
		sendForgotPassword(); 
	});

/**CHANGE FORGOT PASSWORD PAGE ENDS*/


/**CHANGE FORGOT PASSWORD PAGE STARTS*/


	$("#btnextanswer").click(function(){
		forgotPasswordAswer()
	});

	$("#txtyouranswerforgotpassword").keypress(function (e) {
      if (e.which == 13)
		forgotPasswordAswer(); 
	});

/**CHANGE FORGOT PASSWORD PAGE ENDS*/

		$("#btforgotpassworderror").click(function(){
			$.modal.impl.close(true);
			$('#forgotpasswordpopup').modal();
			$('#forgotpasswordpopup').css("height","350px");
			$('#forgotpasswordpopup').css("width","455px");
			$('#forgotpasswordpopup').css("padding-left","130px");
		});
		
		$("#btregistererror").click(function(){
			$.modal.impl.close(true);
			$('#registerpopup').modal();
			$('#registerpopup').css("height","455px");
			if((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1)){
				$('#registerpopup').css("width","585px");
			}
			else
				$('#registerpopup').css("width","355px");

			$('#registerpopup').css("padding-left","10px");
		});

		$("#btadddaugter").click(function(){
			adddaugterlist();
		});

		$("#txtusernamedaughter").keypress(function (e) {
		  if (e.which == 13)
			adddaugterlist();
		});

		$("#txtuserpassworddaughter").keypress(function (e) {
		  if (e.which == 13)
			adddaugterlist();
		});




		$("#log_out_text_header").click(function(){
			logOutPage();
			});


		$("#btlogged").click(function(){
			logOutPage();
			});

		$('#changechatstatus').click(function (e) {
			e.preventDefault();
			isValidSesion(changechatstatusSession);
			function changechatstatusSession(success)
				{
					if (success)
					{			
						$('#editchatstatuspopup').modal();
						$('#editchatstatuspopup').css("height","350px");
						$('#editchatstatuspopup').css("width","455px");
						$('#editchatstatuspopup').css("padding-left","130px");
						deliveryparameters(idGirlsglobal,globalnameGirl,globaluserType);
					}
					else
					{
						loggedexpire();		
					}
				}
		});

			$('#changechatstatusstep1').click(function (e) {
			e.preventDefault();
			isValidSesion(changechatstatusstep1);
			function changechatstatusstep1(success)
			{
				if (success)
				{	
					$('#editchatstatuspopup').modal();
					$('#editchatstatuspopup').css("height","350px");
					$('#editchatstatuspopup').css("width","455px");
					$('#editchatstatuspopup').css("padding-left","130px");
					deliveryparameters(idGirlsglobal,globalnameGirl,globaluserType);
				}
				else
				{
					loggedexpire();		
				}		
			}
		});

		$('#changechatstatusstep2').click(function (e) {
			e.preventDefault();
			isValidSesion(changechatstatusstep2);
			function changechatstatusstep2(success)
			{			
				if (success)
				{			
					$('#editchatstatuspopup').modal();
					$('#editchatstatuspopup').css("height","350px");
					$('#editchatstatuspopup').css("width","455px");
					$('#editchatstatuspopup').css("padding-left","130px");
					deliveryparameters(idGirlsglobal,globalnameGirl,globaluserType);
				}
				else
				{
					loggedexpire();			
				}	
			}
		});


		$('#changeemailaddress').click(function (e){
			e.preventDefault();
			isValidSesion(changeemailaddress);
			function changeemailaddress(success) {
		
		
				parentprocessInfoResponseFormSwf();
		
				if (success)
					{		
					parentprocessInfoResponseFormSwf();
					
					$('#changeemailPopup').modal();
					$('#changeemailPopup').css("height","340px");
					$('#changeemailPopup').css("width","455px");
					$('#changeemailPopup').css("padding-left","130px");
					}
				else
				{
					loggedexpire();
				}
			}
		});
		
		$('#parent_manage').click(function (e){	
			
			isValidSesion(parentManageAccount);

			function parentManageAccount(success)
			{
				
			if (success)	
				$("#parentManageAccount").submit();
			else
				loggedexpire();
				
			}
		});

		$("#get_more_vip").click(function (e)
		{
			$('#parentselectsupgradeoptions').modal();	
			$('#parentselectsupgradeoptions').css("height","340px");
			$('#parentselectsupgradeoptions').css("width","522px");
			$('#parentselectsupgradeoptions').css("padding-left","130px");
		});

		$('#parent_manage_close').click(function (e){	
			$("#parentManageAccount_close").submit();
		});

		
		$("#btparentselectsupgradeoptionsdeluxe").click(function (e)
		{
			$('#parentselectsupgradeoptions').modal();	
			$('#parentselectsupgradeoptions').css("height","340px");
			$('#parentselectsupgradeoptions').css("width","522px");
			$('#parentselectsupgradeoptions').css("padding-left","130px");
		});
		
		

		$("#parent_renew_now").click(function (e)
		{
			$('#parentselectsupgradeoptions').modal();	
			$('#parentselectsupgradeoptions').css("height","340px");
			$('#parentselectsupgradeoptions').css("width","522px");
			$('#parentselectsupgradeoptions').css("padding-left","130px");
		});
		
		$("#renew_now_inactive").click(function (e)
		{
			$('#parentselectsupgradeoptions').modal();	
			$('#parentselectsupgradeoptions').css("height","340px");
			$('#parentselectsupgradeoptions').css("width","522px");
			$('#parentselectsupgradeoptions').css("padding-left","130px");
		});		
		
		
		$("#btnextupgradeoptions").click(function (e)
		{
			var strOfferId;
			var optiondIddAge = $("#dAge").selectedValues();  //get value combo of Secret Question
			isValidSesion(btnextupgradeoptions);
			function btnextupgradeoptions(success)
				{			
				if (success)
					{		
					if(optiondIddAge==0)
					{
						$('#errorselectage_girls').css("display","block");	
					}
					else
						{
						$("#dId").val(idGirlsglobal);
						$("#screenname").val(globalnameGirl);
						$("#pick_the_vip_purchase").submit();
						$.modal.impl.close(true);		
						}
					
					}
				else
				{
					loggedexpire();
				}
			}
		});	
		
		
	});
