// Browser-Detection

var version=parseFloat(navigator.appVersion), agent=navigator.userAgent.toLowerCase();
var isOpera=(agent.indexOf('opera')!=-1)?true:false;
var isIE=((document.all)&&(version>=4.0)&&(!isOpera))?true:false;
var isDOM=document.getElementById?true:false;
var isNS4=document.layers?true:false;
var isIEOld=((agent.indexOf('msie 4')!=-1) || (agent.indexOf('msie 5.0')!=-1) || (agent.indexOf('msie 5.5')!=-1))?true:false;
var isGecko=((version>=5.0)&&((agent.indexOf('netscape')>=0)||(agent.indexOf('gecko')>=0)))?true:false;
var isWin=(navigator.appVersion.indexOf("Windows") != -1) ? true : false;


// Inits

var fWiping=false, nWipeSteps=12, procedure='';


// Utilities

function hideLayer(id){
	document.getElementById(id).style.display="none";
}

function showLayer(id){
	document.getElementById(id).style.display="block";
}

function getClipping(id,idx){
	if(isIE){
		var s=document.all[id].style.clip.split("rect(")[1].split(")")[0].split("px");
		if(idx=="t")return Number(s[0]);
		if(idx=="r")return Number(s[1]);
		if(idx=="b")return Number(s[2]);
		if(idx=="l")return Number(s[3]);
	}
	else if(isDOM){
		var s=document.getElementById(id).style.clip.split("rect(")[1].split(")")[0].split(",");
		if(idx=="t")return parseInt(s[0]);
		if(idx=="r")return parseInt(s[1]);
		if(idx=="b")return parseInt(s[2]);
		if(idx=="l")return parseInt(s[3]);
	} else {
		return false;
	}
}

function setClipping(id,l,t,r,b){
	if(isIE)document.all[id].style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
	else if(isDOM)document.getElementById(id).style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}

function setClipItem(id,s,val){
	if(isIE){
		var c=document.all[id].style.clip.split("rect(")[1].split(")")[0].split("px");
		var t=Number(c[0]);if(s=="t")t=val;
		var r=Number(c[1]);if(s=="r")r=val;
		var b=Number(c[2]);if(s=="b")b=val;
		var l=Number(c[3]);if(s=="l")l=val;
		document.all[id].style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
	}
	else if(isDOM){
		var c=document.getElementById(id).style.clip.split("rect(")[1].split(")")[0].split("px");
		var t=Number(c[0]);if(s=="t")t=val;
		var r=Number(c[1]);if(s=="r")r=val;
		var b=Number(c[2]);if(s=="b")b=val;
		var l=Number(c[3]);if(s=="l")l=val;
		document.getElementById(id).style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
	}
}

function wipeLeft(id){
return;
	var l=getClipping(id,"r");
	if(l>0){
		fWiping=true;
		setClipping(id,getClipping(id,"l"),getClipping(id,"t"),getClipping(id,"r")-nWipeSteps,getClipping(id,"b"));
		setTimeout("wipeLeft('"+id+"')",20);
	}else{fWiping=false;if(procedure!="")eval(procedure)}
}

function wipeRight(id,maxi){
	var r=getClipping(id,"r");
	if(r<maxi){
		fWiping=true;
		setClipping(id,getClipping(id,"l"),getClipping(id,"t"),r+nWipeSteps,getClipping(id,"b"));
		setTimeout("wipeRight('"+id+"',"+maxi+")",10);
	}else{fWiping=false;if(procedure!="")eval(procedure)}
}

function mOver(cell) {if (!isIEOld) {cell.style.cursor="pointer"; cell.bgColor="#ffffff";}}
function mOut(cell) {if (!isIEOld) {cell.style.cursor="default"; cell.bgColor="";}}
function mClick(url) { if (url!='') document.location.href=url;}


// Flash-Detection

var verRequired=4;
var flash2Installed=false;
var flash3Installed=false;
var flash4Installed=false;
var flash5Installed=false;
var flash6Installed=false;
var maxVersion=6;
var actualVersion=0;
var fFlash=false;
var jsVersion=1.0;
jsVersion = 1.1;

if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('</SCR' + 'IPT\> \n');
}

function flashInstalled(){
	if (navigator.plugins){
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			flash2Installed = flashVersion == 2;
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
			flash6Installed = flashVersion == 6;
		}
	}

	for (var i = 2; i <= maxVersion; i++) {
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}
	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;
	if (actualVersion >= verRequired) fFlash = true;
	return fFlash;
}


// Popups

function zoom(filename,text,w,h) {
	var l=10, t=10;
	if (!w) w=660;
	if (!h) h=520;
	if ((screen.width)&&(!isOpera)) {
		l=(screen.width)?(screen.width-w)/2:0;
		t=(screen.height)?(screen.height-h)/2:0;
	}
	var p=window.open("shared/zoom.php?filename="+escape(filename)+"&text="+escape(text), "zoom", "toolbar=no,scrollbars=auto,location=no,directories=no,status=no,menubar=no,resizable=yes,width="+w+",height="+h+",left="+l+",top="+t);
	if (p) {p.opener=self;p.focus();}
}


function popup(filename,w,h) {
	var l=10, t=10;
	if (!w) w=600;
	if (!h) h=500;
	if ((screen.width)&&(!isOpera)) {
		l=(screen.width)?(screen.width-w)/2:0;
		t=(screen.height)?(screen.height-h)/2:0;
	}
	var p=window.open(filename, "popup", "toolbar=no,scrollbars=auto,location=no,directories=no,status=no,menubar=no,resizable=yes,width="+w+",height="+h+",left="+l+",top="+t+",screenX="+l+",screenY="+t);
	if (p) {p.opener=self;p.focus();}
}


function popupmap(filename,w,h) {
	var l=10, t=10;
	if (!w) w=600;
	if (!h) h=500;
	if ((screen.width)&&(!isOpera)) {
		l=(screen.width)?(screen.width-w)/2:0;
		t=(screen.height)?(screen.height-h)/2:0;
	}
	var p=window.open(filename, "popup", "toolbar=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=yes,resizable=yes,width="+w+",height="+h+",left="+l+",top="+t+",screenX="+l+",screenY="+t);
	if (p) {p.opener=self;p.focus();}
}


// Menu

var mouX=0, mouY=0;
var mCurr=-1, mouOver=false;
var timer=null, counter=0, canCollapse=true, timerRunning=false;

function chkCollapse() {
	if (timer!=null) {
		clearTimeout(timer);
		timer=null;
	}
	if (!mouOver && (mCurr!=-1)) {
		mcollapse();
	} else {
		timer=setTimeout("chkCollapse()", 1500);
	}
}

function mcollapse() {
	procedure='';
	// wipeLeft("lay"+mCurr);
	hideLayer("lay"+mCurr);
	document.getElementById('tr'+mCurr).style.backgroundColor='transparent';
	mCurr=-1;
}

function mshow(id) {
	mouOver=true;
	if (timer!=null) clearTimeout(timer);
	if (mCurr!=-1) mcollapse();
	mCurr=id;
	document.getElementById('tr'+id).style.backgroundColor='#ffffff';
	showLayer("lay"+id);
	setClipping(("lay"+id),0, -1, 0, 20);
	wipeRight("lay"+id, 800);
}

function mhide(id) {
	mouOver=false;
	timer=setTimeout("chkCollapse()", 1500);
}


function initMenu() {}


