// JavaScript Document
function rOI(iid,isrc) {
	document.getElementById(iid).src=isrc; 
}
  
function cms_showhide (did,sh) {
	document.getElementById(did).className = sh=="S"?"showcms":"hidecms";	
}
 
function show_hide_deps(obj,value,eid) {
	v=obj.value; 
	if (v == value || (v == '' && value == '!Urms!NaN!')) 
		document.getElementById(eid).className="showcms"; 
	else 
		document.getElementById(eid).className="hidecms"; 
}

function getWidth() {
	wWidth=0;
	if( typeof(window.innerWidth) == 'number' ) {
		wWidth = window.innerWidth;
	}
	else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			wWidth = document.documentElement.clientWidth;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		wWidth = document.body.clientWidth;
	}	
	return wWidth;
	
}

function getHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}


function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    scrOfY = window.pageYOffset;
  } 
  else if ( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  } 
  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;	
}

function shModal(cnt,w,h) {
	 
	 dIo=document.getElementById("modal");
     dIo.style.display = "block"; 
     
	 document.getElementById("modal").style.height=h+"px";
	 document.getElementById("modalbackground").style.height=getHeight()+"px";
	 document.getElementById("modallayer").style.height=h+"px"; 
	 document.getElementById("modal").style.width=w+"px";
	 document.getElementById("modalbackground").style.width=getWidth()+"px";
	 document.getElementById("modallayer").style.width=w+"px";
	 document.getElementById("modalbox").style.top = getScrollY()+25+"px";
	 document.getElementById("modalbox").style.left=Math.round((getWidth()-956)/2)+"px";
	
	 document.getElementById("modalcontent").innerHTML=cnt; 
}

function hdModal(dI) {
	 document.getElementById("modal").innerHTML="";
	 document.getElementById("modal").style.display = "none";
	 if (typeof(window.onclick)=="function") {
		 window.onclick=null;
	 }
}

function evCMS_showVideo(vid,w,h,n) {
	shModal(AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',w,'height',h,'src','/modules/video/video','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/modules/video/video', 'flashvars', 'vid='+vid ),parseInt(w),parseInt(h)+25); //end AC code	
}

//quirksmode cookie functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function loadAnimation() {
	
	if (readCookie("annesAnimation")==null) {
	
		createCookie("annesAnimation","1",1)
		shModal(AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','956','height','640','src','/media/animation','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/media/animation'),956,665); //end AC code	

		window.onclick=function() {
			hdModal(); 
		};
	}
}
 
evCMS_noOnlExec=false; 
evCMS_onl=function() {};
 
function evCMS_onlHandle() {
	if (evCMS_noOnlExec==false) {
		evCMS_onl();	
		if (typeof(urms_checkdeps_onload)=="function") {
		   	 urms_checkdeps_onload(); 
		}
		evCMS_noOnlExec=true;
	}
}

// This is the javascript boostrap, which delays the load for FF for the custom fonts
(function(){
// if firefox 3.5+, hide content till load (or 3 seconds)
var d = document, e = d.documentElement, s = d.createElement('style');
if (e.style.MozTransform === ''){ // gecko 1.9.1 inference
s.textContent = 'body{visibility:hidden}';
e.firstChild.appendChild(s);
function f(){ 
	evCMS_onlHandle();
	s.parentNode && s.parentNode.removeChild(s); 
}
addEventListener('load',f,false);
setTimeout(f,3000);
}
else {
	window.onload=function() { evCMS_onlHandle(); }	
}
})(); 
