// Create an iframe for tracking
function randomInt( min, max ) { return Math.floor(Math.random() * (max - min + 1) + min) ; }
var tile = randomInt( 100000, 1000000 ); 
var ord = randomInt( 100000, 1000000 ); 
document.write( '<iframe id="trackingStreamer" src="http://ads.active.com/html.ng/tile=' + tile + '&site=network2&channel=nochannel&subchannel=nosubchannel&tanproduct=amg&b2borb2c=b2c&feature=nofeature&subfeature1=timex&subfeature2=nosubfeature2&subfeature3=nosubfeature3&sz=pop_1x1&position=pop_up&ord=' + ord + '?" width="1" height="1" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no">' ) ;
document.write( '<a href="http://ads.active.com/click.ng/Params.richmedia=yes&tile=' + tile + '&site=network2&channel=nochannel&subchannel=nosubchannel&tanproduct=amg&b2borb2c=b2c&feature=nofeature&subfeature1=timex&subfeature2=nosubfeature2&subfeature3=nosubfeature3&sz=pop_1x1&position=pop_up&ord=' + ord + '?" target="_blank">' );
document.write( '<img src="http://ads.active.com/image.ng/Params.richmedia=yes&tile=' + tile + '&site=network2&channel=nochannel&subchannel=nosubchannel&tanproduct=amg&b2borb2c=b2c&feature=nofeature&subfeature1=timex&subfeature2=nosubfeature2&subfeature3=nosubfeature3&sz=pop_1x1&position=pop_up&ord=' + ord + '?" border="0" height="1" width="1" /></a>' );
document.write( '</iframe>' );

// Function for Flash to call that refreshes the iframe
ord=Math.random()*10000000000000000;
tile=Math.random()*10000000000000000;
function reloadAd(cType){
	ord=Math.random()*10000000000000000;
	tile=Math.random()*10000000000000000;
        document.getElementById('trackingStreamer').src = "http://ads.active.com/html.ng/tile=' + tile + '&site=network2&channel=nochannel&subchannel=nosubchannel&tanproduct=amg&b2borb2c=b2c&feature=nofeature&subfeature1=timex&subfeature2=nosubfeature2&subfeature3=nosubfeature3&sz=pop_1x1&position=pop_up&ord=' + ord + '?";

}

var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 28;
	
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if ( hasProductInstall && !hasRequestedVersion ) {
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "992",
		"height", "827",
		"align", "middle",
		"id", "ActiveToyotaMain",
		"quality", "high",
		"bgcolor", "#ffffff",
		"name", "ActiveToyotaMain",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
			"src", "ActiveToyotaMain",
			"width", "992",
			"height", "827",
			"align", "middle",
			"id", "ActiveToyotaMain",
			"quality", "high",
			"bgcolor", "#ffffff",
			"name", "ActiveToyotaMain",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
