// Notes:  The .flv and .swf file must reside in the same directory.

// iefix.js
objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
    objects[i].outerHTML = objects[i].outerHTML;
}
	
// start cookie --- to remove cookie, delete the content between this and the "end cookie" tag.	
function GetCookie (name)  { 
var arg = name + "="; 
var alen = arg.length; 
var clen = document.cookie.length; 
var i = 0; 
while (i < clen) {
var j = i + alen;   
if (document.cookie.substring(i, j) == arg)     
return getCookieVal (j);   
i = document.cookie.indexOf(" ", i) + 1;   
if (i == 0) break;  
} 
return null;
}
function SetCookie (name, value) { 
var argv = SetCookie.arguments; 
var argc = SetCookie.arguments.length; 
var expires = (argc > 2) ? argv[2] : null; 
var path = (argc > 3) ? argv[3] : null; 
var domain = (argc > 4) ? argv[4] : null; 
var secure = (argc > 5) ? argv[5] : false; 
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) + 
((domain == null) ? "" : ("; domain=" + domain)) +   
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) { 
var exp = new Date(); 
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name); 
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 180; // -- How long the cookie will last for.
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

if (amt() < 2) {  // -- number of views

// end cookie
	
	// Make sure the .flv file is located in the same directory as the .swf
	var flash_src="adverdeNEW/FlashPlayer3.swf";
	
	// Choose desired size of flash video.
	var myWidth = 350, myHeight = 270;
	
	//Only define one of the following.
	var pixel_from_top = null;
	var pixel_from_bottom = 0;

	// Only define one of the following.
	var pixel_from_right = 0;
	var pixel_from_left = null;
	
	document.write("<div id=\"swf_video\" style=\"position: absolute; z-index:500; left:"+pixel_from_left+"px; top:"+pixel_from_top+"px; right: "+pixel_from_right+"px; bottom: "+pixel_from_bottom+"px\">");
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" "+ 
	"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+myWidth+"\" height=\""+myHeight+ 
	"\"  align=\"middle\" ");
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
	document.write("<param name=\"movie\" value=\""+flash_src+"\" />");
	document.write("<param name=\"FlashVars\" value=\"click_here.htm\" />");
	document.write("<param name=\"quality\" value=\"high\" />");
	document.write("<param name=\"wmode\" value=\"transparent\" />");
	document.write("<param name=\"bgcolor\" value=\" #FFFF00\" />");
	document.write("<embed src=\""+flash_src+"\" quality=\"high\" wmode=\"transparent\"  width=\""+myWidth+"\" height=\""+myHeight+"\" name=\"movienameID\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\""+ 
		   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></embed></object>");
	document.write("</div>");
	
	// function getViewPortSize() obtains the dimensions of the user's broswer. 
	function getViewPortSize() 
	{
		if( typeof( window.innerWidth ) == 'number' ) 
		{
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		{
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} 
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
		{

			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}

		window.alert('Width = ' + myWidth + ' Height = ' + myHeight);
		document.writeln("The dimensions of this browser's viewport is <br />");
		document.writeln("Width = " + myWidth + " Height = " + myHeight);
	}
	}
	else {

	}
	
	// closes div layer
	function close_div_layer()
	{
	document.getElementById('swf_video').style.display = 'none';
	}