﻿//START: "light" Lightbox
var lbCurrent;

function flb_Show(inLb){
	//alert(mySrc)
	lbCurrent = inLb;
	$(".lbWrap").hide(); //hide others
	
	var arrWH = ___getPageSize()
	$("#lbOverlay").css({width: arrWH[0], height:  arrWH[1]})

	//arrWH = flbReg_GetBrowserWidth();	
	var iPosLeft = (arrWH[0]/2) - ($(inLb).css("width").replace("px","")/2);
	
	//$(inLb).css({width: inWidth+"px", height: (inHeight-20)+"px", left: iPosLeft+"px"});
	$(inLb).css({left: iPosLeft+"px"});
	
	$("#lbOverlay").fadeIn("fast", function(){
	        $(".module_home_lg_wrap .adType1, .module_home_sm_wrap .adType1").hide();
  			$(inLb).fadeIn("fast");
	});
	
}

var bOverrideNavAway=false;
var allowClose; // Dev Team made this variable global QC 5746 
function flb_Hide(inOverRideNavAway){
	if(bOverrideNavAway || inOverRideNavAway){
		allowClose = true;
	}else{			
		var strAlert ="";
		strAlert +="\n------------------------------------ WARNING! ---------------------------------------------\n";
		strAlert +="YOUR ENTRY WILL BE FORFEITED IF YOU LEAVE THIS PAGE.\n";
		strAlert +="Press CANCEL to stay on this page to claim your chance to win.\n";
		strAlert +="------------------------------------------------------------------------------------------------------";
	
		//return "You have not yet completed your entry!";
		
		allowClose = confirm(strAlert);
	}
	
	if(allowClose){
		$(lbCurrent).fadeOut("fast", function(){
			$("#lbOverlay").fadeOut("fast");
	        $(".module_home_lg_wrap .adType1, .module_home_sm_wrap .adType1").show();					
		});	
	}
	bOverrideNavAway=false; //always reset.
	return false;	
}
//END: "light" Lightbox

function flbReg_GetBrowserWidth(){
	var winW = 630, winH = 460;//default
	
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	
	return [winW, winH];
}

function ___getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
};