// JavaScript Document
$(document).ready(function(){
$(function(){
	$("#menu1_lnk").css("background-position","bottom");
	$("#menu1_lnk").css("color","#d92888");
	$("#menu2_lnk").css("color","#f99cd1");
	$("#menu3_lnk").css("color","#f99cd1");
	

	/*REGISTER PARENT STARTS*/
	$('#btsubscriptionregister').click(function (e) {
			e.preventDefault();
			$('#registerparentpopup').modal();
			$('#registerparentpopup').css("height","445px");
			
			if((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1)){
			$('#registerparentpopup').css("width","585px");	
			}
			else
				$('#registerparentpopup').css("width","555px");
			
			
			$('#registerparentpopup').css("padding-left","30px");											 
		//registerparent();
	});
	
	$('#linkforgotpassword').click(function (e) {
			e.preventDefault();
			$('#forgotpasswordpopup').modal();
			$('#forgotpasswordpopup').css("height","350px");
			$('#forgotpasswordpopup').css("width","454px");
			$('#forgotpasswordpopup').css("padding-left","130px");
		//registerparent();
	});	
	
	
/*	$("#btredirect_loginparent").click(function(){*/
												

	/*});	*/
	
	
	
	$("#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(); 
	});		
	
	$("#btclosesuccesregister").click(function(){
	$.modal.impl.close(true);
	});		
	
	$("#CancelSR1").click(function(){
	$.modal.impl.close(true);
	});			
	
	/*REGISTER PARENT ENDS*/	
	
	$("#cancelforgotpass").click(function(){
		$.modal.impl.close(true);
	});	
	
	$("#btcancelforgotpass").click(function(){
		$.modal.impl.close(true);
	});	
	
	$("#btclosparenemail").click(function(){
		$.modal.impl.close(true);
	});
	
	
	$("#btlogin_parent").click(function(){
		loginFromHomePage();
	});	
		
	$("#textemailparentlogin").keypress(function (e) {
      if (e.which == 13)
		loginFromHomePage(); 
	});				
		
	$("#textPasswordparentlogin").keypress(function (e) {
      if (e.which == 13)
		loginFromHomePage(); 
	});		
	
	$("#bttryagainerror").click(function(){
		$.modal.impl.close(true);
	});	
	
	$("#btcloseregister").click(function(){
		$.modal.impl.close(true);
	});		
	
	$("#btcloseexpiresession").click(function(){
		$.modal.impl.close(true);
	});			
	
	$("#btregistererror").click(function(){
		$.modal.impl.close(true);
		$('#registerparentpopup').modal();
		$('#registerparentpopup').css("height","445px");

		if((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1)){
			$('#registerparentpopup').css("width","585px");	
		}		
		else
			$('#registerparentpopup').css("width","555px");
			
			$('#registerparentpopup').css("padding-left","30px");
	});	


	$("#box1_btnS1").click(function(){
		dsttrack(13);
		MATTEL.tracker.Tracker.track({brand:"barbiegirls",channel:"Registration",contenttype:"Form",name:"Registration_Ajax 1 - Start",action:"View",scenarioname:"Registration_Ajax",scenariostep:"1",scenariostatus:"0",subchannel:"Registration-AJAX"});
		$('#registergirls_step1').modal();
		$('#registergirls_step1').css("height","505px");
		$('#registergirls_step1').css("width","585px");
		$('#registergirls_step1').css("padding-left","30px");
	});	
	
	/*REGISTER GIRLS STEP 1 STARTS*/
	$("#btregistergirlsStep2").click(function(){
		registergirls_subscription();
	});		

	$("#SR1screenname").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription();
	});		
	
	$("#SR1spassword").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription();
	});	
	
	$("#SR1typePassword").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription();
	});		
	
	$("#SR1answerQuestion").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription();
	});			
	
	/*REGISTER GIRLS STEP 1 ENDS*/
	
	/*REGISTER GIRLS STEP 2 STARTS*/
	$("#btsubmitregistergirlsstep3").click(function(){
		registergirls_subscription_step2_parent();
	});		

	$("#SR2parentsEmail").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription_step2_parent();
	});	
	
	$("#SR2parentsEmail2").keypress(function (e) {
      if (e.which == 13)
		registergirls_subscription_step2_parent();
	});	
	

	$("#print_this_page").click(function(){
		window.print();  
	});	
	/*REGISTER GIRLS STEP 2 ENDS*/
	
	/*CONFIRMATION REGISTER GIRLS STARTS*/
	$("#ContinueDeluxeReg").click(function(){
										   
		//$.modal.impl.close(true);
		window.close();
		dsttrack(15);
		dsttrack1(2);
		dsttrack2(2);
		MATTEL.tracker.Tracker.track({brand:"barbiegirls",channel:"Subscription",contenttype:"Form",name:"Subscription 3 - Parent Login",action:"View",scenarioname:"Subscription",scenariostep:"3",scenariostatus:"0",subchannel:"Subscription"});

		$("#s1").css("display","none");
		$("#s2").css("display","block");
		$("#s3").css("display","none");
		$("#box_renew").css("display","none");
		$("#menu1_lnk").css("background-position","top");
		$("#menu2_lnk").css("background-position","bottom");
		$("#menu3_lnk").css("background-position","top");
		$("#menu1_lnk").css("color","#f99cd1");
		$("#menu2_lnk").css("color","#d92888");
		$("#menu3_lnk").css("color","#f99cd1");
	});				
	/*CONFIRMATION REGISTER GIRLS ENDS*/

});


$('#addanotherdaughter').click(function (e) {
			e.preventDefault();
		$.showLoader();
		isValidSesion(openAddaugter);
		
	});	
		
	$("#btadddaughteraccount0").click(function(){
		$.modal.impl.close(true);
	});
	
	$("#btadddaughteraccount1").click(function(){
		$.modal.impl.close(true);
	});	

		
	});			
		