
lightbox = {
    
	/* Main function initiation
	--------------------------------------------------------------*/
	init: function(){
		if(this._INIT == null){
			this._INIT = true;
			
			this.wrap   = $('#body_wrapper');
			this.fade   = $('#fade_bkd');
			this.lb     = $('.lightbox');
			//this.lbs    = $('.lightbox_share');
			this.top    = $('.lb_top');
			this.bot    = $('.lb_bot');
			this.cnt    = $('.lb_cnt');
            		this.nav    = $('.lb_nav');
			this.shNav  = $('.lb_nav_share');
        		this.note   = $('.foot_note');
			this.b_sub  = $('.lb_nav .b_lb_subscribe');
			this.b_log  = $('.lb_nav .b_lb_connect');
			this.b_fb   = $('.lb_nav_share .b_lb_fb');
			this.b_mail = $('.lb_nav_share .b_lb_mail');
						
			this.success = false;
			this.sitePage = "";
			
			// set error labels
			this.errorLabels = {
			
				// french
				'fr' : {
					'required' 		: 'CHAMP<br />OBLIGATOIRE',
					'invalid' 		: 'CHAMP<br />INVALIDE',
					'existing_user'		: 'CE NOM D\'USAGER<br />EST D&Eacute;J&Agrave; UTILIS&Eacute;',
					'existing_email'	: 'CE COURRIEL<br />EST D&Eacute;J&Agrave; UTILIS&Eacute;',
					'invalid_user_pass' 	: 'NOM D\'USAGER ET/OU<br />MOT DE PASSE INVALIDE(S)',
					'existing_facebook'	: 'CE COMPTE FACEBOOK<br />EST D&Eacute;J&Agrave; UTILIS&Eacute;'
				},
			
				// english
				'en' : {
					'required' 		: 'REQUIRED<br />FIELD',
					'invalid'		: 'INVALID<br />FIELD',
					'existing_user'		: 'THIS USER NAME<br />IS ALREADY IN USE',
					'existing_email'	: 'THIS EMAIL<br />IS ALREADY IN USE',
					'invalid_user_pass' 	: 'INVALID USERNAME<br />AND/OR PASSWORD',
					'existing_facebook'	: 'THIS FACEBOOK ACCOUNT<br />IS ALREADY IN USE'
				}
				
			};
			
		};
		
		this.startup();
	},
	
	/* Startup function
	--------------------------------------------------------------*/
	startup: function(){
		this.reset();
	},
	
	
	/* Force hide via FB button
	--------------------------------------------------------------*/
	forceHide: function(buttonName){
		
		var self = this;
		var btn = $(buttonName);
							
		btn.bind('click', function(){ 
			self.hide();
		});
		
	},
	
	
	/* Reset lightbox sections
	--------------------------------------------------------------*/
	reset: function(){
		this.b_log.removeClass('active');
		this.b_sub.removeClass('active');
		this.b_fb.removeClass('active');
		this.b_mail.removeClass('active');
	},
	
	
	/* Show lightbox
	--------------------------------------------------------------*/
	show: function(showId){
		this.reset();
		
		var hgt  = $(document).height();
		
		this.fade.css({'height': hgt + 'px'});
		this.fade.fadeIn('fast');
		this.lb.fadeIn('fast');
		
		this.showDiv(showId);
	},
	
	
	/* Hide lightbox
	--------------------------------------------------------------*/
	hide: function(){
		
		// special case to force window refresh
		if (this.dorefresh && this.success) {
		
			window.location.reload(true);
			
		} else {
		
			this.lb.fadeOut('fast');
			this.fade.fadeOut('fast');
			
		}

	},
	
	
	/* Function to set the current language
	--------------------------------------------------------------*/
	setLang: function(curLang){
		this.siteLang = curLang;
	},
	
	/* Function to set video url (used in /vampires contest)
	--------------------------------------------------------------*/
	setVideoUrl: function(url){
		this.videoUrl = url;
	},
	
	/* Function to set the current appWebPath
	--------------------------------------------------------------*/
	setAppWebPath: function(path){
		this.appWebPath = path;
	},
	
	
	/* Function to set the current refresh status
	--------------------------------------------------------------*/
	setRefresh: function(curRefresh){
		//alert(curRefresh);
		this.dorefresh = curRefresh;
		//alert(this.dorefresh);
	},
	
	/* Function to set the current share page
	--------------------------------------------------------------*/
	setSharePage: function(curPage){
		this.sitePage = curPage;
		this.show('lightbox_fb_share');
	},
	
	/* Facebook Login Event Handlers : Login to FB success for register
	--------------------------------------------------------------*/
	/*facebookRegisterHandler: function(){
		alert("facebookRegisterHandler");
		this.showDiv('registerfacebookuser');
	},*/
	
	/* Facebook Login Event Handlers : Login to FB success for login
	--------------------------------------------------------------*/
	/*facebookLoginHandler: function(){
		alert("facebookLoginHandler");
		this.showDiv('loginconfirm');
	},*/
	
	
	
	
	/* Send register request by Facebook
	--------------------------------------------------------------*/
	sendFacebookRegister: function() {
		var self = this;
		
		$('.error').css('display','none');
		
		// serialize form
		var dataString = $('#sub_fb_form').serialize();  
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_register_fbuser.php",
	   		dataType: "json",
	   		data: dataString,
	   		success: function(jsonObj){
				// check if there was an error
				if (jsonObj.status == "error" && jsonObj.detail == "facebook") {
					lightbox.showDiv("registerfacebookconnect");
					return false;
				} else if (jsonObj.status == "error" && jsonObj.detail == "login") {
					lightbox.showDiv("loginchoice");
					return false;
				} else if (jsonObj.status == "error") {
					//$('.error').html(jsonObj.detail);
					//$('.error').css('display','block');
					self.errorFacebookRegister(jsonObj);
					return false;
					
				} else {
					
					lightbox.success = true;
					lightbox.reloadNav();
					//lightbox.showDiv("registerconfirm");
					lightbox.hide();
					return false;
					
				}
	   		}
	 	});
	},
	
	
	
	/* Send user registration by site
	--------------------------------------------------------------*/
	sendUserRegister: function() {
		var self = this;
		
		$('.error').css('display','none');
		
		// serialize form
		var dataString = $('#sub_st_form').serialize();  
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_register_user.php",
	   		dataType: "json",
	   		data: dataString,
	   		success: function(jsonObj){
				// check if there was an error
				if (jsonObj.status == "error" && jsonObj.detail == "login") {
					lightbox.showDiv("loginchoice");
					return false;
				} else if (jsonObj.status == "error") {
					
					self.errorUserRegister(jsonObj);
					return false;
					
				} else {
					
					lightbox.success = true;
					lightbox.reloadNav();
					//lightbox.showDiv("registerconfirm");
					lightbox.hide();
					return false;
					
				}
	   		}
	 	});
	},
	
	
	
	/* Send login request by Facebook
	--------------------------------------------------------------*/
	sendFacebookLogin: function() {
		//alert("sendFacebookLogin");
		
		$('.error').css('display','none');
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_login_fbuser.php",
	   		dataType: "json",
	   		data: { 'site_lang' : this.siteLang },
	   		success: function(jsonObj){
				// check if there was an error
				if (jsonObj.status == "error" && jsonObj.detail == "facebook") {
					lightbox.showDiv("registerfacebookconnect");
					return false;
				} else if (jsonObj.status == "error") {
					$('.error').html(jsonObj.detail);
					$('.error').css('display','block');
					return false;
				} else {
					lightbox.success = true;
					lightbox.reloadNav();
					//lightbox.showDiv("loginconfirm");
					lightbox.hide();
					return false;
				}
	   		}
	 	});
	},
	
	
	
	/* Send login request by site
	--------------------------------------------------------------*/
	sendUserLogin: function() {
		var self = this;
		
		$('.error').css('display','none');
		
		// serialize form
		var dataString = $('#login_form').serialize();  
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_login_user.php",
	   		dataType: "json",
	   		data: dataString,
	   		success: function(jsonObj){
				
				// check if there was an error
				if (jsonObj.status == "error") {
					
					self.errorUserLogin(jsonObj);
					return false;
					
				} else {
					
					lightbox.success = true;
					lightbox.reloadNav();
					//lightbox.showDiv("loginconfirm");
					lightbox.hide();
					return false;
					
				}
	   		}
	 	});
	},
	
	
	
	/* Send share request by email
	--------------------------------------------------------------*/
	sendShareEmail: function() {
		//alert("sendShareEmail");
		
		var self = this;
		
		$('.error').css('display','none');
		
		// serialize form
		var dataString = $('#form_email_share').serialize();  
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_share_email.php",
	   		dataType: "json",
	   		data: dataString,
	   		success: function(jsonObj){
				// check if there was an error
				if (jsonObj.status == "error") {
					
					lightbox.errorShareEmail(jsonObj);
					return false;
					
				} else {
					
					//lightbox.showDiv("lightbox_email_share_confirm");
					lightbox.hide();
					return false;
					
				}
	   		}
	 	});
	},
	
	/* Send forgot password request by email
	--------------------------------------------------------------*/
	sendForgotPassword: function() {
		//alert("sendShareEmail");
		
		var self = this;
		
		$('.error').css('display','none');
		
		// serialize form
		var dataString = $('#fp_form').serialize();  
		
		// begin ajax request
		$.ajax({
	   		type: "post",
	   		url: this.appWebPath + "ajax/process_forgot_password.php",
	   		dataType: "json",
	   		data: dataString,
	   		success: function(jsonObj){
				// check if there was an error
				if (jsonObj.status == "error") {
					
					lightbox.errorForgotPass(jsonObj);
					return false;
					
				} else {
					
					//lightbox.showDiv("forgotpasswordconfirm");
					lightbox.hide();
					return false;
					
				}
	   		}
	 	});
	},
	
	/* Reload navigation
	--------------------------------------------------------------*/
	reloadNav: function() {
		//alert("reloadNav");
		
		// prevent reloading when dorefresh is set, unnecessary
		if (!this.dorefresh) {
		
			// begin ajax request
			$.ajax({
		   		type: "post",
		   		url: this.appWebPath + "ajax/nav_login.php",
		   		dataType: "html",
		   		data: { 'site_lang' : this.siteLang },
		   		success: function(data){
					$('.login_nav_cnt').html(data);
		   		}
		 	});
		 }
		 
	},
	
	
	
	/* Process forgot password email error
	--------------------------------------------------------------*/
	errorForgotPass: function(arError) {
		
		// Reset error flags
		$('.fp_mail_error').css('display','none');
		
		// Empty email
		if (arError.email_error == "empty") {
			$('.fp_mail_error span').html(this.errorLabels[this.siteLang].required);
			$('.fp_mail_error').css('display','block');
		};
		
		// Invalid email
		if (arError.email_error == "invalid") {
			$('.fp_mail_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.fp_mail_error').css('display','block');
		};
		
		// Invalid email
		if (arError.email_error == "noresult") {
			$('.fp_mail_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.fp_mail_error').css('display','block');
		};
	},
	
	
	
	/* Process share by email errors
	--------------------------------------------------------------*/
	errorShareEmail: function(arError) {
		
		// Reset error flags
		$('.share_fmail_error').css('display','none');
		$('.share_mail_error').css('display','none');
		$('.share_name_error').css('display','none');
		
		// Empty friend email
		if (arError.friend_email_error == "empty") {
			$('.share_fmail_error span').html(this.errorLabels[this.siteLang].required);
			$('.share_fmail_error').css('display','block');
		};
		
		// Invalid friend email
		if (arError.friend_email_error == "invalid") {
			$('.share_fmail_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.share_fmail_error').css('display','block');
		};
		
		// Empty friend email
		if (arError.email_error == "empty") {
			$('.share_mail_error span').html(this.errorLabels[this.siteLang].required);
			$('.share_mail_error').css('display','block');
		};
		
		// Invalid friend email
		if (arError.email_error == "invalid") {
			$('.share_mail_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.share_mail_error').css('display','block');
		};
		
		// Invalid friend email
		if (arError.name_error) {
			$('.share_name_error span').html(this.errorLabels[this.siteLang].required);
			$('.share_name_error').css('display','block');
		};
	},
	
	
	
	/* Process new user registration errors
	--------------------------------------------------------------*/
	errorUserRegister: function(arError) {
		
		// Reset error flags
		$('.subsc_user_error').css('display','none');
		$('.subsc_pwd_error').css('display','none');
		$('.subsc_fname_error').css('display','none');
		$('.subsc_lname_error').css('display','none');
		$('.subsc_email_error').css('display','none');
		$('.subsc_pwd2_error').css('display','none');
		
		// Empty firstname
		if (arError.fname_error) {
			$('.subsc_fname_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_fname_error').css('display','block');
		};
		
		// Empty lastname
		if (arError.lname_error) {
			$('.subsc_lname_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_lname_error').css('display','block');
		};
		
		// Empty username
		if (arError.user_error) {
			$('.subsc_user_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_user_error').css('display','block');
		};
		
		// Empty email
		if (arError.mail_error == "empty") {
			$('.subsc_email_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_email_error').css('display','block');
		};
		
		// Invalid email
		if (arError.mail_error == "invalid") {
			$('.subsc_email_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.subsc_email_error').css('display','block');
		};
		
		// Empty password
		if (arError.pwd_error == "empty") {
			$('.subsc_pwd_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_pwd_error').css('display','block');
		};
		
		// Invalid password
		if (arError.pwd_error == "invalid") {
			$('.subsc_pwd_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.subsc_pwd_error').css('display','block');
		};
		
		// Empty password 2
		if (arError.pwd2_error == "empty") {
			$('.subsc_pwd2_error span').html(this.errorLabels[this.siteLang].required);
			$('.subsc_pwd2_error').css('display','block');
		};
		
		// Invalid password 2
		if (arError.pwd2_error == "invalid") {
			$('.subsc_pwd2_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.subsc_pwd2_error').css('display','block');
		};
		
		// User exists
		if (arError.user_exists) {
			$('.subsc_user_error span').html(this.errorLabels[this.siteLang].existing_user);
			$('.subsc_user_error').css('display','block');
		};
		
		// Email exists
		if (arError.mail_exists) {
			$('.subsc_email_error span').html(this.errorLabels[this.siteLang].existing_email);
			$('.subsc_email_error').css('display','block');
		};
	},
	
	
	
	/* Process user login errors
	--------------------------------------------------------------*/
	errorUserLogin: function(arError) {
		
		// Reset error fields
		$('.login_user_error').css('display','none');
		$('.login_pwd_error').css('display','none');
		
		// Empty username
		if (arError.user_error) {
			$('.login_user_error span').html(this.errorLabels[this.siteLang].required);
			$('.login_user_error').css('display','block');
		};
		
		// Empty password
		if (arError.pwd_error) {
			$('.login_pwd_error span').html(this.errorLabels[this.siteLang].required);
			$('.login_pwd_error').css('display','block');
		};
		
		// Valid username/password but not active in DB
		if (!arError.pwd_error && !arError.user_error && !arError.valid_login) {
			$('.login_user_error span').html(this.errorLabels[this.siteLang].invalid_user_pass);
			$('.login_user_error').css('display','block');
			$('.login_pwd_error span').html(this.errorLabels[this.siteLang].invalid_user_pass);
			$('.login_pwd_error').css('display','block');
		};
	},
	
	
	
	/* Process facebook registration errors
	--------------------------------------------------------------*/
	errorFacebookRegister: function(arError) {
		
		// Reset error fields
		$('.fbsub_user_error').css('display','none');
		$('.fbsub_email_error').css('display','none');
		
		// Empty username
		if (arError.user_error == "empty") {
			$('.fbsub_user_error span').html(this.errorLabels[this.siteLang].required);
			$('.fbsub_user_error').css('display','block');
		};
		
		// Existing username
		if (arError.user_error == "exists") {
			$('.fbsub_user_error span').html(this.errorLabels[this.siteLang].existing_user);
			$('.fbsub_user_error').css('display','block');
		};
		
		// Empty email
		if (arError.email_error == "empty") {
			$('.fbsub_email_error span').html(this.errorLabels[this.siteLang].required);
			$('.fbsub_email_error').css('display','block');
		};
		
		// Invalid email
		if (arError.email_error == "invalid") {
			$('.fbsub_email_error span').html(this.errorLabels[this.siteLang].invalid);
			$('.fbsub_email_error').css('display','block');
		};
		
		// Existing email
		if (arError.email_error == "exists") {
			$('.fbsub_email_error span').html(this.errorLabels[this.siteLang].existing_email);
			$('.fbsub_email_error').css('display','block');
		};
		
		// Existing email
		if (arError.fb_error) {
			$('.fbsub_user_error span').html(this.errorLabels[this.siteLang].existing_facebook);
			$('.fbsub_user_error').css('display','block');
			$('.fbsub_email_error span').html(this.errorLabels[this.siteLang].existing_facebook);
			$('.fbsub_email_error').css('display','block');
		};
	},
	
	/*
	fixIframeSize: function() {
		jQuery( "#RES_ID_fb_pop_dialog_table").height( 360 );
		jQuery( "#fb_dialog_content").height( 360 );
		jQuery( ".fb_shareIFrame").height( 360 );
		
		jQuery( ".UISharer_ComposerInputsAndStage").height( 300 );
		jQuery( ".UIShareComposer").height( 310 );
		jQuery( "#booklet").height( 320 );
		jQuery( ".fb_content clearfix").height( 318 );
		jQuery( ".UISharer_Body").height( 316 );
		
		//jQuery( ".fb_connect_dialog_iframe").height( 360 );
	},
	*/
	
	
	
	/* Main controller for divs
	--------------------------------------------------------------*/
	showDiv: function(pageName){
		switch (pageName) {
			// show the specific div over the site based on pageName
			// ex. lightbox.switchSection('lightbox_home');
			
			case "registerchoice":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_register_home.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// because this is XFBML, we need to tell Facebook to re-process the document
						FB.XFBML.Host.parseDomTree();
						
						// manage css params
						$('.lightbox_home').css('display','block');
						lightbox.nav.css('display','block');
						lightbox.note.css('display','block');
						lightbox.b_sub.addClass('active');
						lightbox.b_log.removeClass('active');
			   		}
			 	});
				
				break;
				
			case "registerfacebookconnect":
				// open div with iframe for connection to Facebook
				//alert("showDiv >> " + pageName);
				
				var btn = $('.lightbox .subscription_mode .FB_login_button');
				var ldr = $('.lightbox .subscription_mode .subscript_fb .ajaxLdr');
				btn.css('display','none');
				ldr.css('display','block');
				
				break;
				
			case "registerfacebooklogout":
				//alert("showDiv >> " + pageName);
				
				FB.Connect.logout( lgaFacebookLogoutHandler );
				
				break;
				
			case "registerfacebookuser":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				//this.switchSection('lightbox_subscription_fb');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_register_fbuser.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						//alert(data);
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_subscription_fb').css('display','block');
						lightbox.nav.css('display','block');
						lightbox.note.css('display','block');
						lightbox.b_sub.addClass('active');
						lightbox.b_log.removeClass('active');
						
						// bind submit action of form to specific lightbox.function
						$('#sub_fb_form').submit(function() {
							lightbox.sendFacebookRegister();
							return false;
						});
						
						$('#form_submit_button').click(function() {
							$('#sub_fb_form').submit();
						});
			   		}
			 	});
				
				break;
				
			case "registeruser":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_register_user.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_subscription_st').css('display','block');
						lightbox.nav.css('display','block');
						lightbox.note.css('display','block');
						lightbox.b_sub.addClass('active');
						lightbox.b_log.removeClass('active');
						
						// bind submit action of form to specific lightbox.function
						$('#sub_st_form').submit(function() {
							lightbox.sendUserRegister();
							return false;
						});
						
						$('#form_submit_button').click(function() {
							$('#sub_st_form').submit();
						});
			   		}
			 	});
				
				break;
				
			case "registerconfirm":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_register_confirm.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_forgot_password').css('display','block');
						lightbox.nav.css('display','none');
						lightbox.note.css('display','none');
						lightbox.b_sub.removeClass('active');
						lightbox.b_log.removeClass('active');
			   		}
			 	});
				
				break;
				
			case "loginchoice":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_login_home.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// because this is XFBML, we need to tell Facebook to re-process the document
						FB.XFBML.Host.parseDomTree();
						
						// manage css params
						$('.lightbox_login').css('display','block');
						lightbox.nav.css('display','block');
						lightbox.note.css('display','block');
						lightbox.b_log.addClass('active');
						lightbox.b_sub.removeClass('active');
						
						// bind submit action of form to specific lightbox.function
						$('#login_form').submit(function() {
							lightbox.sendUserLogin();
							return false;
						});
						
						$('#form_submit_button').click(function() {
							$('#login_form').submit();
						});
			   		}
			 	});
				
				break;
				
			case "loginfacebookconnect":
				// open div with iframe for connection to Facebook
				//alert("showDiv >> " + pageName);
				
				FB.Connect.requireSession( lgaFacebookLoginHandler );
				
				break;
				
			case "loginconfirm":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_login_confirm.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_forgot_password').css('display','block');
						lightbox.nav.css('display','none');
						lightbox.note.css('display','none');
						lightbox.b_sub.removeClass('active');
						lightbox.b_log.removeClass('active');
			   		}
			 	});
				
				break;
				
			case "forgotpassword":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_forgot_password.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_forgot_password').css('display','block');
						lightbox.nav.css('display','none');
						lightbox.note.css('display','none');
						lightbox.b_sub.removeClass('active');
						lightbox.b_log.removeClass('active');
						
						// bind submit action of form to specific lightbox.function
						$('#fp_form').submit(function() {
							lightbox.sendForgotPassword();
							return false;
						});
						
						$('#form_submit_button').click(function() {
							$('#fp_form').submit();
						});
			   		}
			 	});
				
				break;
				
			case "forgotpasswordconfirm":
				//alert("showDiv >> " + pageName);
				
				var nav = $('.lb_nav_share');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_forgot_password_confirm.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_forgot_password').css('display','block');
						lightbox.nav.css('display','none');
						lightbox.note.css('display','none');
						lightbox.b_sub.removeClass('active');
						lightbox.b_log.removeClass('active');
			   		}
			 	});
				
				break;
				
			case "lightbox_fb_share":
				//alert("showDiv >> " + pageName);
				
				// determine site_page being shared
				var site_page;
				site_page = (this.sitePage != "") ? this.sitePage : window.location.href;
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_share_fb.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang, 'site_page' : site_page },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// because this is XFBML, we need to tell Facebook to re-process the document
						//FB.XFBML.Host.parseDomTree();
						
						// manage css params
						lightbox.nav.css('display','none');
						lightbox.shNav.css('display','block');
						lightbox.b_fb.addClass('active');
						lightbox.b_mail.removeClass('active');
						
						/*
						// bind div with facebook share and hide lightbox on click
						$('#fb_share_button_div').click(function() {
							lightbox.hide();
							
							// use function to increase height of FB lightbox
							//setTimeout( lightbox.fixIframeSize, 2000 );
						});
						*/
			   		}
			 	});
				
				break;
				
			case "lightbox_email_share":
				//alert("showDiv >> " + pageName);
				
				// determine site_page being shared
				var site_page;
				site_page = (this.sitePage != "") ? this.sitePage : window.location.href;
				
				var nav = $('.lb_nav');
				nav.css('display','none');
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_share_email.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang, 'site_page' : site_page },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						lightbox.nav.css('display','none');
						lightbox.shNav.css('display','block');
						lightbox.b_fb.removeClass('active');
						lightbox.b_mail.addClass('active');
						
						// bind submit action of form to specific lightbox.function
						$('#form_email_share').submit(function() {
							lightbox.sendShareEmail();
							return false;
						});
						
						
						$('#form_submit_button').click(function() {
							$('#form_email_share').submit();
						});
						
						/*
						btn = $('#form_submit_button');
						btn.bind('click', function(){
							alert('test');
							$('#form_email_share').submit();
							return false;
						});
						*/
			   		}
			 	});
				
				break;
				
			case "lightbox_email_share_confirm":
				//alert("showDiv >> " + pageName);
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_share_email_confirm.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang },
			   		success: function(data){
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						$('.lightbox_forgot_password').css('display','block');
						lightbox.nav.css('display','none');
						lightbox.shNav.css('display','none');
						lightbox.note.css('display','none');
						lightbox.b_sub.removeClass('active');
						lightbox.b_log.removeClass('active');
			   		}
			 	});
				
				break;
				
			case "lightbox_vampires_video":
				
				// begin ajax request
				$.ajax({
			   		type: "post",
			   		url: this.appWebPath + "ajax/lightbox_vampires_video.php",
			   		dataType: "html",
			   		data: { 'site_lang' : this.siteLang, 'youtube_url' : this.videoUrl },
			   		success: function(data){
			   		
						// populate main content div
						lightbox.updateContentDiv(data);
						
						// manage css params
						lightbox.nav.css('display','none');
						lightbox.shNav.css('display','none');
						lightbox.note.css('display','none');
						
			   		}
			 	});
				
				break;
				
			default:
				// problem, so start over
				//alert("showDiv >> " + pageName + "???");
				break;
		}
	},
	
	
	
	/* Update the content of the lightbox content div
	--------------------------------------------------------------*/
	updateContentDiv: function(content){
		//alert("updateContentDiv");
		$('.cnt_main').html(content);
	},
	
	
	
	/* Update the content of the main page meta description
	--------------------------------------------------------------*/
	/*
	updateMetaDescription: function(itemID) {
		//alert("updateContentDiv");
		temp = $('#' + itemID).value;
		$('meta[name=description]').attr("content") = temp;
	},
	*/
	
	
	
	/* Use may vary
	--------------------------------------------------------------*/
	empty: function(){
	
	},
	
	
	
	/* Handles window events
	--------------------------------------------------------------*/
	onWindowDomReady: function(){
        this.init();
	}
};

$(document).ready(function(){
	lightbox.onWindowDomReady();
});

//*** JS FNCS : facebook login

//Event Handlers : Login to FB success for register
function lgaFacebookRegisterHandler() {
	//alert("lgaFacebookRegisterHandler");
	lightbox.showDiv("registerfacebookuser");
}
function lgaFacebookLoginHandler() {
	//alert("lgaFacebookLoginHandler");
	lightbox.sendFacebookLogin();
}
function lgaFacebookLogoutHandler() {
	//alert("lgaFacebookLoginHandler");
	lightbox.showDiv("registerchoice");
}
