﻿
var winfeatures="width=720,height=700,scrollbars=1,resizable=1,toolbar=0,location=0,menubar=0,status=0,directories=0"

function GetCookie(Name) {
	var search = Name + "=";
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length;
			returnvalue = unescape(document.cookie.substring(offset, end));
		}
	}
	return returnvalue;
}

function LoadPopUnder(gotoUrl){
	// Only pop under the window one time for this browser session
	if (GetCookie('SessionPopUnder') == '') {
		win2 = window.open(gotoUrl, "popunderwin", winfeatures);
		win2.blur();
		window.focus();
		document.cookie = "SessionPopUnder=done";
	}
}


function SetCookie(cookieName, cookieValue, nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays == null || nDays == 0) nDays = 1;
	expire.setTime(today.getTime() + 3600000 * 24 * nDays);
	document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";expires=" + expire.toGMTString();
}

function OptOut() {
	SetCookie("JobDetailPopUnderOptOut", "true", 365);
	window.close();
}
