// Flash debugging code
var printable;
var popup;
var newwindow = 0;
var lastpageid = "Home";


if(getCookie("referrer") == "" && document.referrer != ""){
	document.cookie="referrer="+escape(document.referrer);	
}







function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
} 



function openWindow (url, target){
    window.open("redirect.aspx?url="+url, target);   
}


function getURL(newWindow){
	window.open(newWindow);
}


function trace(str)
{
	if (newwindow == 0) {
		newwindow = window.open("about:blank", "", "width=400,height=500,scrollbars=yes");
		newwindow.document.write("<html><head></head><body><div id=\"debugspace\"></div></body></html>");
	}
	newwindow.document.all("debugspace").innerHTML += str;
}

function getFlashVars(wcflashvars)
{
	var fv;
	var qs = '' + window.location;
	var left = qs.indexOf("?") + 1;
	qs = qs.substring(left, qs.length);
	fv = qs + ((wcflashvars == '' && qs == '')?'':'&') + wcflashvars;
}
function printview (url, width, height, resizable){
//trace("url: "+url+" width: "+width+" height: "+height)
    if(printable == undefined || (printable && printable.closed)){
        printable = window.open("","printable", "width="+width+",height="+height+",resizable="+resizable+",scrollbars=yes,toolbar=yes,menubar=yes,status=yes")
    }   
    printable.location.replace(url);
}
function getLocation(){
    return location.toString();
}
function getReferrer()
{
    var cookieReferrer=getCookie("referrer");
    document.cookie =  "referrer=;expires=Thu, 01-Jan-1970 00:00:01 GMT";
    
    if(document.referrer != ""){
	    //alert("document: "+document.referrer);
	    return document.referrer;
    }else{
	//alert("cookie: "+cookieReferrer);
	    return cookieReferrer;
    }
}
function getElement(nm)
{
	return document.getElementById(nm);
}

function shouldDebugTracking()
{
	var qs = '' + window.location;
	return (qs.search(/showtracking=true/) != -1);
}

function track(a, ignore)
{
	if (shouldDebugTracking()) {
		window.status = '' + a;
	}
	for (var i = 0 ; i < a.length ; i++) {
		var ta = a[i].split('|');
		var pix = ta[0];
		var type = ta[1];
		var catname = ta[ta.length - 2];
		var tag = ta[ta.length - 1];
		if (pix == '1') {
			loadPixel();
		}
		if (type == 'PV') {
			cmCreatePageviewTag(tag, catname);
			lastpageid = tag;
		} else if (type == 'click') {
			cmCreateManualLinkClickTag(tag, tag, lastpageid);
		} else if (type == 'vidstart') {
			cmMovieTime(tag,"0");
		} else if (type == 'vidpause') {
			cmMovieTime(tag,"1");
		} else if (type == 'vidplay') {
			cmMovieTime(tag,"2");
		} else if (type == 'vidend') {
			cmMovieTime(tag,"3");
		}
	}
}
function loadPixel()
{
	var i = new Image();
	i.src = "http://www.xctrk.com/conversion.php?tid=1187&aid=2";
}






/* ADDED TO TEST BACKGROUND CENTERING */

function getWinSize()
{
	var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' )
      {
         //Non-IE
         myWidth = window.innerWidth;
         myHeight = window.innerHeight;
      }
      else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
      {
          //IE 6+ in 'standards compliant mode'
          myWidth = document.documentElement.clientWidth;
          myHeight = document.documentElement.clientHeight;
      }
      else if(document.body && (document.body.clientWidth || document.body.clientHeight))
      {
          //IE 4 compatible
          myWidth = document.body.clientWidth;
          myHeight = document.body.clientHeight;
      }
      return {w:myWidth,h:myHeight}
      
}   
   
function adjustObjectSize(id,w,h)
{
//alert("test");
      var winSizes = getWinSize();
            
      var tmpObject = document.getElementById(id);

      if(winSizes.w < w)
      {
         tmpObject.style.width = w + "px";
      }
      else
      {
         tmpObject.style.width = "100%";
      }
      if(winSizes.h < h)
      {
         tmpObject.style.height = h + "px";
      }
      else
      {
         tmpObject.style.height = (winSizes.h)-2 + "px";
      }
}
var flashPlayerDownloadWindow;
var strFPDWFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
function getFlash()
{
    // document.location.href = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
    flashPlayerDownloadWindow = window.open("http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash", "coh_getFlashPlayer", strFPDWFeatures);

}
window.onload = function()
{
    if (document.getElementById("getFlashPlayerImg")!= null)
    {
        document.getElementById("getFlashPlayerImg").onclick = function()
        {
            getFlash();
        }
    }
}