// JavaScript Document


//IMPORTANT - these values must be set
//this is important, you must change the 'VideoPlayer1' to the name of your windows media player object, if you do not do this, you will recieve JS errors
var myRPOjbect="VideoPlayer1";
ord=Math.random()*10000000000000000;


//used to log trace events when testing ad calls, by default set to false
var loggingEnabled=false;



//Used for companion ads, if any ads will have companions, set the value to yes
var areCompanions=false;

//Companion ad tags, use dc_seed for best results, contact your account manager if you need help using dc_seed. You leave the dc_seed value as blank, it is filled in when the syncRoadBlockAd is called
//var adTag = "http://ad.doubleclick.net/adi/instreamsite/;sz=300x60;dc_seed=";
var adTag = "http://ad.doubleclick.net/adi/instreamsite/windowsmedia;sz=160x600;tile=2;dc_seed=";

//Indicates to the DARTPlayer object callbacks will be used. if not truestandard events such as mute, stop ect will not be tracked
var enableCallbacks = true;		

//Indicates to the DARTPlayer object	
var enableAuto3rdPartyTracking = true;		
   
//places the companion ad in the slot - make sure you change the size to your ad slot and add a div called roadblock to your page
function syncRoadBlockAd(adTag, masterAdId) {
	var compString=adTag+masterAdId+';ord='+ord;
	var compTag = dartPlayer.getRoadblockURL(compString);
	
}

//use this to either place a new ad in the roadblock div or remove the div once the master ad as completed, in this example the companion ad is replaced by a standalone ad of the same dimensions
function clearRoadBlock() {
 
}



 
/* --------------------------------------------------------------------
		Assign any desired callbacks
-------------------------------------------------------------------- */
DARTReady = function() {
if(enableCallbacks) {
	 dartPlayer.attachOnClick(logClick);
	 dartPlayer.attachOnMute(logMute);
	 dartPlayer.attachOnAdMidpoint(logMidpoint);
	 dartPlayer.attachOnAdStart(logStart);
	 dartPlayer.attachOnAdComplete(logComplete);
	 dartPlayer.attachOnPause(logPause);
	 dartPlayer.attachOnRestart(logRestart);
	 dartPlayer.attachOnFullscreen(logFullscreen);

 }
if(!enableAuto3rdPartyTracking) {
  dartPlayer.setAutoLogThirdPartyImpression(false);
  dartPlayer.setAutoLogThirdPartyClick(false);
 }



}
/* ------------------------------------------------------------
	Construct an instance of the DARTPlayer using the 
	Windows Media Player id= attribute as a pointer
------------------------------------------------------------ */
dartPlayer = new DartPlayer(myRPOjbect, DARTReady);


/* --------------------------------------------------------------------
		Begin Optional Callback functions
-------------------------------------------------------------------- */

function logStart() {
//this is what is called when the advertisement is loaded

//this changes the word feature presentation to advertisment  when an ad is  playing in a div called playerheading, this is optional
		if(areCompanions){
			syncRoadBlockAd(adTag,dartPlayer.getAd().getDartId());
		}
}
 
function logClick() {
	// This custom call opens the landing URL on a new browser window
	// It makes use of the metadata fields in DART
	 dartPlayer.setClickThroughWindowFeatures("width=600,height=600,menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
	 dartPlayer.setClickThroughWindowBlocked(function(){logCallback("pub callback popup blocked");});
}
 
function detach() {
	dartPlayer.unregister();
}
 
function logFullscreen() {

}
 
function logRestart() {

}
 
function logPause() {

}
 
function logMidpoint() {

}
 
function logMute() {

}




function logComplete() {

	if(areCompanions){
		clearRoadBlock();
	}


}
 
function flushPoint() {
	
}





