var sAdUnitBaseUrl = "http://adsremote.scripps.com/html.ng/adType=UNSIZED_AD&PagePos=5&";
var sCurrentQueryParams;

/*****************************************************************************************
	function:		onVideoLoad
	description:	This function gets called from within your flash file. What it actually
					does is application-specific, but it will always have some method of
					adding and/or removing ads at the appropriate times.
					In this case, it retrieves a big box ad when a video ad is playing. It
					could just as easily do the same thing with a leader board ad unit(you 
					would have been given and additional ad base url for that).
*****************************************************************************************/	
function onVideoLoad(sNewQueryParams, isContent, isNewPlaylist)
{
  //alert("videoLoad: "+isContent);
	if(isContent.toString() == "true"){
		hideAd();
		
	//if it's not content, then you want to see if you just served up the same ad. If you did
	//then don't bother going and getting it again. The exception is if it's a new playlist. In
	//that case, we don't care whether or not it's the same ad; go ahead and fetch it again.
	}else if(sNewQueryParams != sCurrentQueryParams || isNewPlaylist == true){
	  //alert("js: showing ad");
		showAd(sNewQueryParams);
		sCurrentQueryParams = sNewQueryParams;
	}
}

/*****************************************************************************************
	function:		showAd
	description:	Why am I putting the ad information inside an iframe instead of a div?
					Because you don't know what you'll get back. It could be as simple as
					a jpg, or as complex as another flash app with a bunch of javascript 
					tagged on. We don't care what the content is, as long as we are able to
					handle it.
*****************************************************************************************/	
function showAd(sQueryParams)
{
	var adLink = sAdUnitBaseUrl + sQueryParams;
	var myAdHolder = document.getElementById("adContainer");
	var myAdCont   = document.getElementById("adholder_si");
	myAdCont.src   = adLink;
	myAdHolder.style.display = "block";
}
/*****************************************************************************************
	function:		hideAd
*****************************************************************************************/	
function hideAd(){
	document.getElementById("adContainer").style.display = "none";
	var myAdCont   = document.getElementById("adholder_si");
	myAdCont.src   = null; //so you don't see the previously loaded ad
}

