//These are Macromedia functions

//Function used for netscape page reload fix
/*function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
} */

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var winObj;
  winObj = window.open(theURL,winName,features);
  return winObj
}

//These functions are based on those by Seb Chevrel of Second Story

function showLayer(layer,vis) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		theLayer.style.visibility= vis;
		return;
	}
	if (isNav) {
		theLayer.visibility= vis;
		return;
	}
	else if (isW3C || isOpera) {
		obj=document.getElementById(layer);
		obj.style.visibility=vis;
	}
}

function moveLayer(layer,x,y) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp)	{
		theLayer.style.pixelLeft= x;
		theLayer.style.pixelTop=y;
		return;
	}
	else if (isNav) {
		theLayer.moveTo(x, y);
		return;
	}
	else if (isW3C) {
		obj=document.getElementById(layer);
		obj.style.left=x+'px';
		obj.style.top=y+'px';	
		return;
	} 
	else if (isOpera) {
		obj=document.getElementById(layer);
		obj.style.left=x;
		obj.style.top=y;
		return;	
	}
}

// This function writes HTML code in a layer
function writeLayer(layer,code) {
	if (isNav) {
		layer.document.open()
		layer.document.write(code)
		layer.document.close()
		}
	else if (isExp) {
		layer.innerHTML = code
	}
	else if (isW3C) {
		//obj=document.getElementById(layer);
		obj = layer
		obj.innerHTML=code;
	}
	else if (isOpera) {
		obj=document.getElementById(layer);
		obj.style.innerHTML=code;
	}
}



function getwindowWidth() {
	if (isExp) {
		return document.body.clientWidth;
	}
	else if (isNav || isW3C || isOpera) {
		return window.innerWidth;
	}
}

function getwindowHeight() {
	if (isExp) {
		return document.body.clientHeight;
	}
	else if (isNav || isW3C || isOpera) {
		return window.innerHeight;
	}
}

function getlayerX(layer) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		return theLayer.style.pixelLeft;
	}
	else if (isNav) {
		return theLayer.left;
	}
	else if (isW3C) {
		if(isSafari) {
			return theLayer.offsetLeft;
		}
		obj=document.getElementById(layer);
		if(document.defaultView.getComputedStyle) {
			style=document.defaultView.getComputedStyle(obj,null); // computed style vs. style definition
			return parseInt(style.getPropertyValue('left')); // we need to parse 'px' out
		}
	}
}

function getlayerY(layer) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		return theLayer.style.pixelTop;
	}
	else if (isNav) {
		return theLayer.top;
	}
	else if (isW3C) {
		if(isSafari) {
			return theLayer.offsetTop;
		}
		obj=document.getElementById(layer);
		if(document.defaultView.getComputedStyle) {
			style=document.defaultView.getComputedStyle(obj,null); // computed style vs. style definition
			return parseInt(style.getPropertyValue('top')); // we need to parse 'px' out
		}
		
	}
}

function Resizelayer(layer,w,h) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		theLayer.style.pixelWidth=w;
		theLayer.style.pixelHeight=h;
	}
	else if (isNav) {
		theLayer.resizeTo(w, h);
	}
}


function getlayerWidth(layer) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		return theLayer.clientWidth;
	}
	else if (isNav) {
		return theLayer.clip.width;
	}
	else if (isW3C) {
		obj=document.getElementById(layer);
		//obj = theLayer
		if(document.defaultView.getComputedStyle) {
			style=document.defaultView.getComputedStyle(obj,null); // won't work if width was assigned in original style definition: NN6
			return parseInt(style.getPropertyValue('width'));
		}
		if(isSafari) {
			return obj.clientWidth;
		}
	}
}

function getlayerHeight(layer) {
	if((theLayer= MM_findObj(layer)) ==null) return;
	if (isExp) {
		return theLayer.clientHeight;
	}
	else if (isNav) {
		return theLayer.clip.height;
	}
	else if (isW3C) {
		obj=document.getElementById(layer);
		if(document.defaultView.getComputedStyle) {
			style=document.defaultView.getComputedStyle(obj,null);
			return parseInt(style.getPropertyValue('height'));
		}
		if(isSafari) {
			return obj.clientHeight;
		}
	}
}

// 
