function fEnterNow(){
	cmCreateConversionEventTag("PCHTV Entry","1","PCHTV INTERACTIONS");	
	
	if(bPlaying) player.sendEvent("STOP","true");

	openit2('http://prism.pch.com/Path/PCHTVReg/Reg.aspx?tid=0b85b5b5-f875-42a4-b2d2-b2c09832a17d',850, 625);
}


//popup with scroll
function openit2(sURL,w,h){
	newwindow=window.open(sURL,"nextwin","scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=yes,status=no,width="+w+",height="+h+"");
	newwindow.window.focus();
}


function fSubmitEntry(){
	
//SET THE ENTERED COOKIE DATE VALUE TO SHOW THE BUTTON ONLY ONCE PER DAY
	//PCHTV: ENTER DATE @ MIDNIGHT
	var entDate = new Date(SERVER_DATE); //TODAY
	entDate.setHours(23);
	entDate.setMinutes(59);
	entDate.setSeconds(59);
	entDate.setMilliseconds(999); //SET TO 11:59:59 PM
	setNameVal("pchTV","entered",entDate); //SAVE IT

//HIDE THE BUTTON
	//$("#nowPlayingWrap .enterButtonWrap").hide();
	fInterstitial()
}

function fInterstitial(){
	document.location="http://search.pch.com";
}

function fCloseRegLb(bEnter){
	$("#registration").fadeOut("fast");	
	
	if(bEnter) {
		$("#interstitial").fadeIn();
		window.setTimeout(fInterstitial,5555);
	}else{
		$("#regOverlay").fadeOut("fast");
	}
	return false;
}


function fValidateEntry(){
	var Title = document.getElementById("regTitle").selectedIndex;
	var fname = $.trim($("#FName").val());
	var lname = $.trim($("#LName").val());
	var address1 = $.trim($("#Address1").val());
	var address2 = $.trim($("#Address2").val());
	var city = $.trim($("#City").val());
	var state = document.getElementById("State").selectedIndex;
	var zip = $.trim($("#Zip").val());
	var email = $.trim($("#Email").val());
	
	$("#FName").val(fname);	
	$("#LName").val(lname);
	$("#Address1").val(address1);
	$("#Address2").val(address2);
	$("#City").val(city);
	$("#Zip").val(zip);
	$("#Email").val(email);

	if(Title==0)
	{
		alert("Please enter a valid Title")
		document.getElementById("regTitle").focus()
		return false
	}
	
	if(fname=="" || !strRegEx_FName.test(fname))
	{
		alert("Please enter a valid First Name")
		document.getElementById("FName").focus()
		return false
	}
	
	if(lname=="" || (!strRegEx_LName.test(lname)))
	{
		alert("Please enter a valid Last Name")
		document.getElementById("LName").focus()
		return false
	}
	
	if(address1==""|| (!strRegEx_Address1.test(address1)))
	{
		alert("Please enter a valid Address 1")
		document.getElementById("Address1").focus()
		return false
	}
	
	if(address2 !="" && (!strRegEx_Address2.test(address2)))
	{
		alert("Please enter a valid Address 2")
		document.getElementById("Address2").focus()
		return false
	}

	if(city==""|| (!strRegEx_City.test(city)))
	{
		alert("Please enter a valid City")
		document.getElementById("City").focus()
		return false
	}
	
	if(state==0)
	{
		alert("Please enter a valid State")
		document.getElementById("State").focus()
		return false
	}
	
	if(zip==""|| (!strRegEx_Zip.test(zip)))
	{
		alert("Please enter a valid Zip")
		document.getElementById("Zip").focus()
		return false
	}
	
	if(email=="" || (!strRegEx_Email.test(email)))
	{
		alert("Please enter a valid Email")
		document.getElementById("Email").focus()
		return false
	}
/*	
	if (!checkEmail(document.frmOrder.Email,"Email")) {
		return false;
	}		
*/	
	
	return true
}

/**** LIGHTBOC SETTINGS ********************************************************************/

function _set_interface() {
	// Get page sizes

	// Style overlay and show it

	// Get page scroll

	// Calculate top and left offset for the jquery-lightbox div object and show it
	jQuery('#registration').css({
		top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
		left:	arrPageScroll[0]
	});


	// If window was resized, calculate the new overlay dimensions
	jQuery(window).resize(function() {
		// Get page sizes
		var arrPageSizes = ___getPageSize();
		// Style overlay and show it
		jQuery('#regOverlay').css({
			width:		arrPageSizes[0],
			height:		arrPageSizes[1]
		});
		// Get page scroll
		var arrPageScroll = ___getPageScroll();
		// Calculate top and left offset for the jquery-lightbox div object and show it
		jQuery('#registration').css({
			top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
			left:	arrPageScroll[0]
		});
	});
}

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;
};
/**
 / THIRD FUNCTION
 * getPageScroll() by quirksmode.com
 *
 * @return Array Return an array with x,y page scroll values.
 */
function ___getPageScroll() {
	var xScroll, yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll);
	return arrayPageScroll;
};
