// DFP ad serving variables
var ord		= Math.random()*10000000000000000;
var ordnum	= Math.round(Math.random() * 1000000000);


/*******************************************************************
 *	Cookie Functions
 *******************************************************************/
// Check for a cookie's existance
function getCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');

	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
// Create a new cookie
function setCookie(name, value, expires, path, domain, secure) {
	var expDate		= new Date(expires);
	var curCookie	= name + "=" + escape(value) +
		((expires) ? "; expires=" + expDate.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
}
// Delete an existing cookie
function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		var curCookie	= name + "=" +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
		document.cookie = curCookie;
	}
}


/*******************************************************************
 *	FireClick Functions
 *******************************************************************/
// Track a click and redirect the page
function flashFire (name, url) {
	window.open(url);
	fc_click(name, 'ad', url);
}
// Track a click without redirecting page
function flashFireNoGo (name, url) {
	fc_click(name, 'ad', url);
}


/*******************************************************************
 *	CNN Video Player Functions
 *******************************************************************/
// Open popup window
function CNN_openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	try {
		window.top.name = "opener";
	} catch (e) {}
	var popupWin = window.open( url, name, widgets );
	if ( popupWin) {
		popupWin.focus();
	}
}
// Play a PGATOUR.com video
function cnnVideo( mode, arg, expiration ) {
	cnnVideoArgs = 'url=' + arg;
	openURL = '/video/player/player.html';;
	CNN_openPopup( 'http://www.pgatour.com/'+openURL+'?'+cnnVideoArgs, 'CNNVideoPlayer', 'scrollbars=no,resizable=no,width=770,height=570' );
}
//Gets the current URL and replaces /news/ with /news/print/
//Used on the microsite news articles to pop up a printable version of the article
//TFH - 6/28/2007
function GetPrintURL()
{
	var myURL;
	var newURL;
	var f = "/news/";
	
	myURL = window.location;
	myURL = String(myURL);
	newURL = myURL.replace(f, "/news/print/");
		
	window.open(newURL, "mywindow","location=0,status=1,scrollbars=1,width=650,height=800");	
}
//Used to assist in closing a window in Firefox.
//TFH - 6/28/2007
function closeWindow() {

window.open('','_parent','');

window.close();

}