// BEGIN: RC SURVEY WIN IPOD VIDEO SUPERSTITIAL
// copy all functions below, also add body onload="javascript:initSuperstitial();"
// if superstitial is no longer needed, simply remove that function from the body onload event

function secureCheck(destUrl) {
	if (!getCookie('prefupdate')){
		location = 'rc_prefuser.asp';
	} else {
		location = destUrl;
	}
}

function secureCheck2(destUrl) {
	//if (!getCookie('prefupdate')){
		//location = 'rc_prefuser.asp';
	//} else {
		var paycheckcity = window.open(destUrl, "paycheckcity", 'toolbar=no,resizable=yes,scrollbars=yes,width=527,height=650');
	//}
}

function closeDiv(){
	document.getElementById('laySuperstitial').style.visibility = 'hidden';
}

function openDiv(){
	document.getElementById('laySuperstitial').style.visibility = 'visible';
}

function getCookie(NameOfCookie){
	// var somestring = getCookie('NameOfCookie');
	if (document.cookie.length > 0){ 

	begin = document.cookie.indexOf(NameOfCookie+"="); 
	if (begin != -1){ 

	begin += NameOfCookie.length+1; 
	end = document.cookie.indexOf(";", begin);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(begin, end)); } 
	}
	return null; 
}

function setCookie(NameOfCookie, value, expiredays){
	// setCookie('NameOfCookie', 'value', 365);
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

	document.cookie = NameOfCookie + "=" + escape(value) + 
	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie(NameOfCookie){
	// delCookie('NameOfCookie');
	if (getCookie(NameOfCookie)) {
	document.cookie = NameOfCookie + "=" +
	"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function clickYes(){
	closeDiv();
	setCookie('hideDiv', 'Yes', 999);
	var ipodWindow = window.open("http://www.insightexpress.com/s/RCSu87158", "ipodWindow", 'toolbar=yes,resizable=yes,scrollbars=yes,width=750,height=550');

}

function clickNo(){
	closeDiv();
	setCookie('hideDiv', 'No', 999);
}

function clickCancel(){
	closeDiv();
}

function initSuperstitial(){
	if (getCookie('hideDiv') == null){
		openDiv();
	}
}

// END RC SURVEY WIN IPOD VIDEO SUPERSTITIAL


//THIS IS THE "BOOKMARK THIS PAGE" LINK
var url = "http://www.adp.com/rc_index.asp";
var title = "ADP Resource Center";

function makeLink(){
	if(document.all){
		window.external.AddFavorite(url,title); 
	}else{
		alert("Click Control+D to add this page to your favorites");
	}
}

//THIS IS THE "MAKE THIS YOUR HOMEPAGE" LINK
function checkHP(zlink) {
	if (document.all){
		zlink.style.behavior = 'url(#default#homepage)';
		zlink.setHomePage('http://www.adp.com/rc_index.asp');
	}else{
		alert("To make this your homepage in Netscape, Go to edit, then preferences and click the 'Use Current Page' button!");
	}
}

//THIS OPENS UP A POP-UP FOR THE PREMIUM ONLY PLAN BANNER
function openWin(URL) {
Window=window.open(URL,"window","width=400,height=310,status=no,scrollbars=no,resizable=no,location=0,menubar=0,toolbar=no");
Window.focus();
}

//THIS OPENS UP A POP-UP FOR THE VALUE ADD CONTENT
function openWin2(URL) {
Window=window.open(URL,"window","width=415,height=400,status=no,scrollbars=yes,resizable=no,location=0,menubar=0,toolbar=no");
Window.focus();
}

//THIS OPENS UP A POP-UP FOR THE TAXFIN UI SEMINAR
function openWin4(URL) { 
	newWin=window.open(URL,"winPop","width=600,height=449,left=300,top=208,status=no,scrollbars=auto,resizable=no,location=0,menubar=0,toolbar=no");
	newWin.focus(); 
}

//THIS OPENS UP A POP-UP FOR THE "Update Your Profile" LINK
function openWin6(URL) {
Window=window.open(URL,"window","width=417,height=330,status=no,scrollbars=yes,resizable=no,location=0,menubar=0,toolbar=no");
Window.focus();
} 

//THIS OPENS UP A POP-UP FOR THE "Resource Center Survey" REQUEST
function openWin8(URL) { 
	newWin=window.open(URL,"winPop","width=400,height=500,status=no,scrollbars=auto,resizable=no,location=0,menubar=0,toolbar=no");
  newWin.focus(); 
} 

//THIS FUNCTION CHECKS FOR EXISTENCE OF A COOKIE AND RETURNS TRUE OR FALSE
function findCookie(name){ 
   var cookieFound = false; 
   var start = 0; 
   var end = 0; 
   var cookieString = document.cookie; 
        
   var i = 0 
   while (i <= cookieString.length){ 
       start = i; 
       end = start + name.length; 
       if (cookieString.substring(start,end) == name){ 
          cookieFound = true; 
          break; 
      } 
      i++; 
   } 
   return cookieFound; 
 } 

//THIS FUNCTION CHECKS FOR RC SURVEY POPUP COOKIE AND OPENS SURVEY POPUP IF NOT FOUND
function checkCookie() {
	if (findCookie('rcsurvpop')==false) { 
    openWin8('rcsurvey_pop.asp'); 
 	}  
}   