function addDays(myDate,days) 
{
    return new Date(myDate.getTime() + days*24*60*60*1000);
}

function setCookie(name)
{
	var the_date = addDays(new Date(),2);
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = name + " = true";
	the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie = the_cookie;
}

// THIS SCRIPT DOES THE DOUBLE SWAP (CLOSES THE POP-UP, CHANGES THE PARENT)
// USAGE: <a href="#" ONCLICK="DoubleSwap('http://www.domain.com')">text link</a>
function DoubleSwap(URL)
{
	window.opener.location = URL;
	window.close();
}

// THIS SCRIPT RUNS THE POPUP WINDOWS
// USAGE: <a href="javascript:NewWindow('page.html', 'nameOfWindow', 500, 300, 1, 1)">Text Link</a>
function NewWindow(url, myname, w, h, scroll, resize) 
{
	winprops = 'height='+h+',width='+w+',top=10,left=10,scrollbars='+scroll+',resizable='+resize+',toolbar=0'
	win = window.open(url, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}