/* -- Adobe GoLive JavaScript Library */

CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
CSIsW3CDOM = ((document.getElementById) && !(IsIE()&&CSBVers<6)) ? true : false;
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { if (CSIsW3CDOM) return document.getElementById(s).style; else return CSFindElement(s,0);  }
CSIImg=false;
function CSInitImgID() {if (!CSIImg && document.images) { for (var i=0; i<document.images.length; i++) { if (!document.images[i].id) document.images[i].id=document.images[i].name; } CSIImg = true;}}
function CSFindElement(n,ly) { if (CSBVers<4) return document[n];
	if (CSIsW3CDOM) {CSInitImgID();return(document.getElementById(n));}
	var curDoc = ly?ly.document:document; var elem = curDoc[n];
	if (!elem) {for (var i=0;i<curDoc.layers.length;i++) {elem=CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}
function CSGetImage(n) {if(document.images) {return ((!IsIE()&&CSBVers<5)?CSFindElement(n,0):document.images[n]);} else {return null;}}
CSDInit=false;
function CSIDOM() { if (CSDInit)return; CSDInit=true; if(document.getElementsByTagName) {var n = document.getElementsByTagName('DIV'); for (var i=0;i<n.length;i++) {CSICSS2Prop(n[i].id);}}}
function CSICSS2Prop(id) { var n = document.getElementsByTagName('STYLE');for (var i=0;i<n.length;i++) { var cn = n[i].childNodes; for (var j=0;j<cn.length;j++) { CSSetCSS2Props(CSFetchStyle(cn[j].data, id),id); }}}
function CSFetchStyle(sc, id) {
	var s=sc; while(s.indexOf("#")!=-1) { s=s.substring(s.indexOf("#")+1,sc.length); if (s.substring(0,s.indexOf("{")).toUpperCase().indexOf(id.toUpperCase())!=-1) return(s.substring(s.indexOf("{")+1,s.indexOf("}")));}
	return "";
}
function CSGetStyleAttrValue (si, id, st) {
	var s=si.toUpperCase();
	var myID=id.toUpperCase()+":";
	var id1=s.indexOf(myID,st);
	if (id1==-1) return "";
	var ch=s.charAt(id1-1);
	if (ch!=" " && ch!="\t" && ch!="\n" && ch!=";" && ch!="{")
		return CSGetStyleAttrValue (si, id, id1+1);
	var start=id1+myID.length;
	ch=s.charAt(start);
	while(ch==" " || ch=="\t" || ch=="\n") {start++; ch=s.charAt(start);}
	s=s.substring(start,si.length);
	var id2=s.indexOf(";");
	return ((id2==-1)?s:s.substring(0,id2));
}
function CSSetCSS2Props(si, id) {
	var el=document.getElementById(id);
	if (el==null) return;
	var style=document.getElementById(id).style;
	if (style) {
		if (style.left=="") style.left=CSGetStyleAttrValue(si,"left",0);
		if (style.top=="") style.top=CSGetStyleAttrValue(si,"top",0);
		if (style.width=="") style.width=CSGetStyleAttrValue(si,"width",0);
		if (style.height=="") style.height=CSGetStyleAttrValue(si,"height",0);
		if (style.visibility=="") style.visibility=CSGetStyleAttrValue(si,"visibility",0);
		if (style.zIndex=="") style.zIndex=CSGetStyleAttrValue(si,"z-index",0);
	}
}
function CSSetStyleVis(s,v) {
	if (CSIsW3CDOM){CSIDOM();document.getElementById(s).style.visibility=(v==0)?"hidden":"visible";}
	else if(IsIE())CSIEStyl(s).visibility=(v==0)?"hidden":"visible";
	else CSNSStyl(s).visibility=(v==0)?'hide':'show';
}
function CSGetStyleVis(s) {
	if (CSIsW3CDOM) {CSIDOM();return(document.getElementById(s).style.visibility=="hidden")?0:1;}
	else if(IsIE())return(CSIEStyl(s).visibility=="hidden")?0:1;
	else return(CSNSStyl(s).visibility=='hide')?0:1;
}
CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);}
CSStopExecution=false;
function CSAction(array) {return CSAction2(CSAct, array);}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var aa = fct[array[i]];
		if (aa == null) return false;
		var ta = new Array;
		for(var j=1;j<aa.length;j++) {
			if((aa[j]!=null)&&(typeof(aa[j])=="object")&&(aa[j].length==2)){
				if(aa[j][0]=="VAR"){ta[j]=CSStateArray[aa[j][1]];}
				else{if(aa[j][0]=="ACT"){ta[j]=CSAction(new Array(new String(aa[j][1])));}
				else ta[j]=aa[j];}
			} else ta[j]=aa[j];
		}			
		result=aa[0](ta);
	}
	return result;
}
CSAct = new Object;

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
mustInitImg = true;
function initImgID() {var di = document.images; if (mustInitImg && di) { for (var i=0; i<di.length; i++) { if (!di[i].id) di[i].id=di[i].name; } mustInitImg = false;}}

function findElement(n,ly) {
	var d = document;
	if (browserVers < 4)		return d[n];
	if ((browserVers >= 6) && (d.getElementById)) {initImgID; return(d.getElementById(n))}; 
	var cd = ly ? ly.document : d;
	var elem = cd[n];
	if (!elem) {
		for (var i=0;i<cd.layers.length;i++) {
			elem = findElement(n,cd.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImagesArray(array) {
	if (preloadFlag == true) {
		var d = document; var img;
		for (i=0;i<array.length;i+=2) {
			img = null; var n = array[i];
			if (d.images) {
				if (d.layers) {img = findElement(n,0);}
				else {img = d.images[n];}
			}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (!img && d.getElementsByName) {
				var elms = d.getElementsByName(n);
				if (elms) {
					for (j=0;j<elms.length;j++) {
						if (elms[j].src) {img = elms[j]; break;}
					}
				}
			}
			if (img) {img.src = array[i+1];}
		}
	}
}


function changeImages() {
	changeImagesArray(changeImages.arguments);
}


function toggleImages() {
	for (var i=0; i<toggleImages.arguments.length; i+=2) {
		if (selected == toggleImages.arguments[i])
			changeImagesArray(toggleImages.arguments[i+1]);
	}
}

function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; /* dont follow link */
	else return false; /* dont follow link */
}

function CSFixFct() {
	var d = document; var w = window;
	if (d.cs.csFix.w != w.innerWidth || d.cs.csFix.h != w.innerHeight) {
		d.location = d.location; }
}
function CSNSFix(action) { 
	var d = document; var w = window;
	if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
		if (typeof d.cs == 'undefined') { 
			d.cs = new Object;
			d.cs.csFix = new Object; 
		} else if (CSIsFrame (w) == true) CSFixFct();
		d.cs.csFix.w = w.innerWidth;
		d.cs.csFix.h = w.innerHeight; 
		window.onresize = CSFixFct;
	  }
}
function CSIsFrame (window) {
	var rootWindow = window.parent;
	if (rootWindow == 'undefined') return false;
	for (i = 0; i < rootWindow.frames.length; i++)
		if (window == rootWindow.frames[i]) return true;
	return false;
}

function CSIEPNGFix(action) 
   {
   var bAgent	= window.navigator.userAgent;
   var bAppName	= window.navigator.appName;
   var bAppVers = window.navigator.appVersion;

   var isIE     = (bAppName.indexOf("Explorer") >= 0);
   var isWin    = (bAgent.indexOf("Win") >= 0); 
    
   if (isIE && isWin)
	   {
       var vers = 0;
       var idx1 = bAppVers.indexOf ("MSIE");
 
       if (idx1 != -1)
          {
          idx1 += 4;
          var idx2 =  bAppVers.indexOf(";", idx1)
          if (idx2 != -1)
              {
              vers = bAppVers.substring(idx1, idx2);
              }
          else
              {
              vers = bAppVers.substring(idx1);
		      }
          }
	   
	   if (vers >= 5.5)
	       {	   	   
	       for(var i=0; i<document.images.length; i++)
	          {
	    	  var img = document.images[i];
		      var imgName = img.src.toUpperCase();
		      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		         {
			     var imgID = (img.id) ? "id='" + img.id + "' " : "";
			     var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			     var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			     var imgStyle = "display:inline-block;" + img.style.cssText;
			     if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			     if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			     if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			     var strNewHTML = "<span " + imgID + imgClass + imgTitle
			     + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			     + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			     img.outerHTML = strNewHTML;
			     i = i-1;
		         }
	          }
	       }
        }
     }



// JM Remove Link Box - Version 1.9
// GoLive Action by Jesper G.O. M&#248;ller 2006 - http://www.jart.dk/jgom/index.html
//
function JMRemoveLinkbox() {
	var a=["a","area"];
	for(i in a){b=document.getElementsByTagName(a[i]);
	for(j in b)b[j].onfocus=function(){this.blur()};}
}
//
//
function timeRedirect(action) {
var now = new Date();
var hours = now.getHours();
var timeValue = action[1];
if (timeValue >= 12) { timeValue = timeValue - 12; } /* deals with 24-hour time */
if (action[2] == true) { timeValue += 12; } /* deals with PM times */
if (hours < timeValue && action[4] != "(Empty Reference!)" && action[4] != "(EmptyReference!)" && action[3] == true) {
window.location = action[4]; }
if (hours >= timeValue && action[6] != "(Empty Reference!)" && action[6] != "(EmptyReference!)" && action[5] == true) {
window.location = action[6]; }
}

// JM Center Layer - Version 2.0 
// GoLive Action by Jesper G.O. MÃ¸ller 2007 - http://www.jart.dk/jgom/index.html
//
function JMCenterLayer(action) {
centerDiv = action[1];
JMCenterLayerSet(centerDiv);
}

function JMCenterLayerSet() {
windowHeight = 0;
windowWidth = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
		windowWidth = window.innerWidth;
		}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
			windowWidth = document.documentElement.clientWidth;
			}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
				windowWidth = document.body.clientWidth;
			}
		}
	}
	if (windowHeight > 0 || windowWidth > 0) {
		var layerElement = document.getElementById(centerDiv);
		var layerWidth =layerElement.offsetWidth;
		var layerHeight =layerElement.offsetHeight;
		layerElement.style.position = "absolute";
			if (windowWidth - layerWidth > 0) {
				layerElement.style.left = ((windowWidth / 2) - (layerWidth / 2)) + 'px';
				}
			else {
				layerElement.style.left = 0 + 'px';
				}
			if (windowHeight - layerHeight > 0) {
				layerElement.style.top = ((windowHeight / 2) - (layerHeight / 2)) + 'px';
				}
			else {
				layerElement.style.top = 0 + 'px';
				}
	}
}

window.onresize = function() {
var uamac = navigator.userAgent.toLowerCase();
	if(uamac.indexOf('msie 5.1')>-1 && uamac.indexOf('mac')>-1){
		window.location.reload( false );
		}
	else {
		JMCenterLayerSet();
		}
}


//This is a very basic small script which will simply bring upthe print dialog box for users.
//Very helpfull if you have a page designed to be printed out and people just don't seem to get it.
//This can be used as a head action or simply applied to a link. Enjoy :-)

function printWin()
{
        if (self.print)
                self.print();
}
// 

function CSresizeWindow(){
if (navigator.appVersion.indexOf("MSIE 5.5")!=-1){ 
top.window.resizeBy( -1 , -1); 
setTimeout(resetWindow,500) 
}
}
function resetWindow(){
top.window.resizeBy(1 , 1); 
}
// 
function CSShowHide(action) {
	if (action[1] == '') return;
	var type=action[2];
	if(type==0) CSSetStyleVis(action[1],0);
	else if(type==1) CSSetStyleVis(action[1],1);
	else if(type==2) { 
		if (CSGetStyleVis(action[1]) == 0) CSSetStyleVis(action[1],1);
		else CSSetStyleVis(action[1],0);
	}
}

/* 
Fix Layer Position 1.0
A component of MenuMachine 2.1
Copyright 2006 Big Bang Software Pty Ltd
*/
/*begin FixLayerPosition*/
function __bbFLP(el,s,amt)
	{
	if(typeof(__bbElCache[el])=="undefined"){__bbElCache[el]=__bbgID(el);}
	var d=document,e=__bbElCache[el],mvAmt=0,sOf=__bbGST(),targetPos=e.origPos+sOf;
	if(e.currentPos!=targetPos){if(s){var diff=e.currentPos-targetPos;mvAmt=(Math.abs(diff)<amt)?-diff:((diff>0)?-amt:amt);mvAmt=(Math.abs(diff)>(amt*4))?mvAmt+mvAmt:mvAmt;var mtp=(e.currentPos+=mvAmt)+_bbBr.px;_bbBr.op?e.style.pixelTop=mtp:e.style.top=mtp;e.currentPos+=mvAmt;}
	else{var mtp=targetPos+_bbBr.px;_bbBr.op?e.style.pixelTop=mtp:e.style.top=mtp;e.currentPos=targetPos;}}
	};
function bbFixLayer(action)
	{
	var n=action[1],sm=action[2],spd=action[3],tks,px;
	if(!sm){tks=10;px=100;}
	else{if(!spd)spd="m";switch(spd){case "f":tks=10;px=20;break;case "m":tks=20;px=4;break;case "s":tks=30;px=2;break;}}
	var d=document,ua=navigator.userAgent.toLowerCase();function o(n){return (ua.indexOf("opera "+n)>-1||ua.indexOf("opera/"+n)>-1)&&window.opera?1:0};
	_bbBr.op5=o(5);_bbBr.op6=o(6);_bbBr.op=(_bbBr.op5||_bbBr.op6||window.opera)?1:0;
	_bbBr.ie=(ua.indexOf('msie')!=-1&&!_bbBr.op)?1:0;_bbBr.dt=(ua.indexOf("mac")==-1&&((d.doctype&&d.doctype.name&&d.doctype.name.indexOf("http:\/\/")>-1)||(d.compatMode&&(d.compatMode!="BackCompat"&&d.compatMode!="QuirksMode"))))?1:0;
	_bbBr.px=_bbBr.op?"":"px";var el=__bbgID(n);if(!el)return;el.origPos=__bbyP(el);el.currentPos=el.origPos-__bbGST();setInterval("__bbFLP('"+n+"',"+sm+","+px+");",tks);
	};
function __bbyP(o){var c=0;if (o.offsetParent){while (o.offsetParent){c+=o.offsetTop;o=o.offsetParent;}}else if(o.y){c+=o.y;} return c;};
function __bbGST(){return _bbBr.ie?(_bbBr.dt?document.documentElement.scrollTop:document.body.scrollTop):window.pageYOffset;};
function __bbgID(i){if(document.getElementById){return document.getElementById(i);}else if(document.all){return document.all[i];}else{return false;}};
var __bbElCache=[],_bbBr={};
/*end FixLayerPosition*/


// Version 1.2. A Michael Ahgren action.
function CSRemoveIEbox(){
if (document.images&&navigator.userAgent.indexOf("MSIE")!=-1){
	for(i=0;i<document.links.length;i++){
		target=eval("document.links[i]")
		target.onfocus=blurHandler
		}
	}
}

function blurHandler(){
obj=window.event.srcElement
if(obj.tagName == "A"||obj.tagName=="AREA") obj.blur()
}

// 

function focusFormField(action){
target=eval ("document."+action[1]+"."+action[2])
if (target){
target.focus()
}
}
// 

