// Copyright CameoHD 2009
// CameoHD Placement Script 2.1

// VisiStat Snippet
// var DID=60441;
// var pcheck=(window.location.protocol == "https:") ? "https://sniff.visistat.com/live.js":"http://sniff.visistat.com/live.js";
// document.writeln('<scr'+'ipt src="'+pcheck+'" type="text\/javascript"><\/scr'+'ipt>');

setTimeout("writeObj()",2000);      

function init(){
    setIEStyle();
}

function IEVersion() {
   var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
         if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}

function setIEStyle(){
var ver = IEVersion();
var Obj = document.getElementById('cameohd');
  if (ver < 8.0 && ver >= 1){
   if (navigator.appName =="Microsoft Internet Explorer" && navigator.userAgent.indexOf("Opera") < 0){ 
	if(document.body.currentStyle['backgroundImage']=='none')
		{
			document.body.style.backgroundImage="url(http://www.poweredbycameohd.com/scripts/fixed.gif)";
			document.body.style.backgroundRepeat='no-repeat';
			document.body.style.backgroundAttachment='fixed';
		} 
	  Obj.style.setExpression('top','IE_Fixed()');
        } 
     }
}

function IE_Fixed() {
    var Obj = document.getElementById('cameohd');
	var TopValue;
	var scrollTop;
	var WinHeight;
  if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 
    WinHeight  = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
    WinHeight  = document.body.clientHeight;
  }
  if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {  
    scrollTop = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrollTop = document.documentElement.scrollTop;
  } else {scrollTop=0;}
	
        TopValue = scrollTop + WinHeight - Obj.clientHeight ;	
	
	return TopValue;
}

function closeIframe(){
    var Obj = document.getElementById('cameohd');
        var p1 = Obj.parentNode;
	    p1.removeChild(Obj);
}

function writeObj(){
    var ver = IEVersion();
    var position;
    if (navigator.appName =="Microsoft Internet Explorer" && navigator.userAgent.indexOf("Opera") < 0 && ver < 8.0){ 
        position = "absolute";
        } else {
        position = "fixed";
    }

var URL = 'http://www.poweredbycameohd.com/live/ccbd/ccbd_cavey_pp_live.swf';
var Width = '528';
var Height = '296';

var CameoDiv = document.createElement('div');
    CameoDiv.id = "cameohd";
    CameoDiv.style.position = position;
    CameoDiv.style.zIndex = 9999;
    CameoDiv.style.height = Height;
    CameoDiv.style.width = Width;
    CameoDiv.style.bottom = 0;
    CameoDiv.style.right = 0;

CameoHDStr = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'";
CameoHDStr += "codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0'";
CameoHDStr += "width='"+Width+"' height='"+Height+"'>";
CameoHDStr += "<param name='movie' value='"+URL+"' />";
CameoHDStr += "<param name='quality' value='high' />";
CameoHDStr += "<param name='menu' value='false' />";
CameoHDStr += "<param name='wmode' value='transparent' />";
CameoHDStr += "<param name='AllowScriptAccess' value='always' />";
CameoHDStr += "<embed src='"+URL+"' quality='high' wmode='transparent'"; 
CameoHDStr += "pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'";
CameoHDStr += "width='"+Width+"' height='"+Height+"' menu='false' AllowScriptAccess='always'></embed></object>";

CameoDiv.innerHTML = CameoHDStr;

document.body.appendChild(CameoDiv);

        init();
}


