<!--//
function fxIntialize() {
}

var bInfoWindow = 0

function openInfoWindow(strHTMLPage, intHeight){
	bInfoWindow = 1
	infoWindow = window.open(strHTMLPage, "Info", "toolbar=0,width=360,height="+intHeight+",resizable=1,scrollbars=1");
	infoWindow.focus();
}

function closeInfoWindow(){
	if (bInfoWindow == 1) {
		if (infoWindow && !infoWindow.closed){
			infoWindow.close();
		}
	}
}
function OpenCouponPreview(p_iCouponID, p_iSurveyID, p_iSurveyUserID, p_bPrint){
	if (p_iSurveyID == 0 || isNaN(p_iSurveyID))
		p_iSurveyID = '';
	if (p_iSurveyUserID == 0 || isNaN(p_iSurveyUserID))
		p_iSurveyUserID = '';
	if (isNaN(p_bPrint))
		p_bPrint = '';
	window.open('/webcoupons/couponview.asp?popup=1&cid=' + p_iCouponID + '&sid=' + p_iSurveyID + '&uid=' + p_iSurveyUserID + '&print=' + p_bPrint, 'Coupon_Preview', "width=600,height=480,toolbar=0,resizable=1,scrollbars=1");
}

function OpenEmailToFriend(p_iCouponID) {
	window.open("/webcoupons/EmailCoupon.asp?cid=" + p_iCouponID, "Email", "toolbar=no,width=500,height=300,resizable=0,scrollbars=1");
}	

function OpenOptInWindow()
{	
	var iUserID = document.frmSubscribe.userID.value;
	var sEmail = document.frmSubscribe.email.value;
	window.open('/webcoupons/optin.asp?email=' + sEmail + '&userID=' + iUserID, 'OptIn', "toolbar=no,width=500,height=300,resizable=yes,scrollbars=yes");
}

function ViewPrivacyPolicy()
{
	window.opener.location.href = "/displayContent.asp?keywords=privacypolicy";
}

function ToggleDropdowns(p_sMode) 
{
	var objForm;
	var objElement;
	
	for (var i=0; i<document.forms.length; i++)
	{
		objForm = document.forms[i];
		if (objForm.name != "frm") 
		{
			for (var j=0; j<objForm.elements.length; j++)
			{
				objElement = objForm.elements[j];
				objElement.style.visibility  = p_sMode;
			}
		}
	}
}


/*
Created By: Chris Campbell
Website: http://particletree.com
Date: 2/1/2006

Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
*/

/*-------------------------------GLOBAL VARIABLES------------------------------------*/

var detect = navigator.userAgent.toLowerCase();
var browser;

getBrowserInfo();

/*-----------------------------------------------------------------------------------------------*/

//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/


function getBrowserInfo() {
	// check for IE b/c of quirks
	if (checkIt('msie')) 
		browser = "Internet Explorer";
	else
		browser = '';
}

function checkIt(string) {
	return detect.indexOf(string) + 1;
}

/*-----------------------------------------------------------------------------------------------*/

	// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
	function prepareIE (height, overflow){
		bod = document.getElementsByTagName('body')[0];
		bod.style.height = height;
		bod.style.overflow = overflow;
  
		htm = document.getElementsByTagName('html')[0];
		htm.style.height = height;
		htm.style.overflow = overflow; 
	}
	
	// In IE, select elements hover on top of the lightbox
	function hideSelects(visibility){
		selects = document.getElementsByTagName('select');
		for(i = 0; i < selects.length; i++) {
			selects[i].style.visibility = visibility;
		}
	}
	
	// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
	function getScroll(){
		if (self.pageYOffset) {
			this.yPos = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){
			this.yPos = document.documentElement.scrollTop; 
		} else if (document.body) {
			this.yPos = document.body.scrollTop;
		}
	}
	
	function setScroll(x, y){
		window.scrollTo(x, y); 
	}

	
function InitSplashPage()
{
	if (browser == 'Internet Explorer'){
//		this.getScroll();
//		prepareIE('100%', 'hidden');
		setScroll(0,0);
//		hideSelects('hidden');
		ToggleDropdowns('hidden');
		document.getElementById('GrayBackground').style.height = document.body.scrollHeight;
	}
	// if screen res is 800 or less, then reposition at the top left corner
	var objForm = document.getElementById("LeadGeneratorForm");
	if (screen.width <= 800) {
		objForm.style.top = '0px';
		objForm.style.left = '0px';
//		objForm.style.width = '50%';
		objForm.style.position = 'absolute';
	} 
}

function CloseDivs() 
{
	if (browser == "Internet Explorer"){
//		this.setScroll(0,this.yPos);
		prepareIE("auto", "auto");
//		hideSelects("visible");
		ToggleDropdowns('visible');
	}
	document.getElementById('GrayBackground').style.visibility  = 'hidden';
	document.getElementById('LeadGeneratorForm').style.visibility  = 'hidden';
}


//-->