var ordnum = Math.round(Math.random() * 1000000000);

function buildAd (server, site, page, width, height, tile, pos, tags) {
	var ad;
	if (!server) server = "ad.doubleclick.net"; 
	if (!site) site = "pgacom.cpc";
	if (!page) page = "all";
	if (!width) width = 468;
	if (!height) height = 60;
	if (!tile) tile = 1;
	if (!pos) pos = 1;
	if (!tags) tags = "!category=adult;";
	ad = '<iframe src="' + buildAdUrl("adi", server, site, page, width, height, tile, pos, tags) + '" width="' + width + '" height="' + height + '" marginheight="0" scrolling="no" frameborder="0">';
	ad = ad + '<a href="' + buildAdUrl("jump", server, site, page, width, height, tile, pos, tags) + 'target="_blank">';
	ad = ad + '<img width="' + width + '" height="' + height + '" src="' + buildAdUrl("ad", server, site, page, width, height, tile, pos, tags) + '" alt="Advertisement" /></a>';
	ad = ad + '</iframe>';
	if ((!document.images && navigator.userAgent.indexOf("Mozilla/2.") >= 0)  || navigator.userAgent.indexOf("WebTV")>= 0) {
		var backupad;
		backupad = '<a href="'+ buildAdUrl("jump", server, site, page, width, height, tile, pos, tags) + 'target="_blank">';
		backupad = backupad + '<img width="' + width + '" height="' + height + '" src="' + buildAdUrl("ad", server, site, page, width, height, tile, pos, tags) + '" alt="Advertisement" /></a>';
		document.write(backupad);
	} else {
		document.write(ad);
	}
}
function buildAdUrl (type, server, site, page, width, height, tile, pos, tags) {
   	var myUrl = 'http://'+server+'/'+ type+'/'+site+'/'+page+';'+tags+'sz='+width+'x'+height+';ptile='+tile+';pos='+pos+'ord='+ordnum;
	return myUrl;
}

/* GolfVR Window Pop */
function openHole(pagename) {
	window.open(pagename, 'VirtualTour', 'width=482,height=390,scrollbars=0,toolbar=0')
}

/* Flash jump function for Fireclick */
function flashFire (name, url) {
	fc_click(name, 'flashad', url);
}

/*  Pops windowMaker */	
function windowMaker(url, name) {
			window.open( url, name, 'toolbar=no,resizable=no,scrollbars=no,menubar=no,location=no,width=600,height=400,top=10,left=10' );
		}
		
/*  Pops Photo Gallery windows */		
function photoGallery(url, name) {
			window.open( url, name, 'toolbar=no,resizable=no,scrollbars=no,menubar=no,location=no,width=678,height=460,top=10,left=10' );
		}
		
/* for AOL Webcast Offer */
function aolPop(url, name) {
			window.open( url, name, 'toolbar=no,resizable=yes,status=yes,scrollbars=yes,menubar=no,location=no,width=470,height=400,top=10,left=10' );
}

/* Extra stuff to enable nav hovers in lame IE */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


/* --------------------------------------------------------------------------------------------------- */

/*  */
function dropDownJumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}