var version=parseFloat(navigator.appVersion), agent=navigator.userAgent.toLowerCase();
var opera=(agent.indexOf('opera')!=-1)?true:false;
var ie=((document.all)&&(version>=4.0)&&(!opera))?true:false;
var oldie=((agent.indexOf("msie 4")!=-1) || (agent.indexOf("msie 5.0")!=-1)) ? true : false;
var nn4=document.layers?true:false;
var dom=(document.getElementById)?true:false;
var gecko=((version>=5.0)&&((agent.indexOf('netscape')>=0)||(agent.indexOf('gecko')>=0)))?true:false;
var mac=(agent.indexOf("mac")!=-1)?true:false;
var win=(agent.indexOf("windows")!=-1)?true:false;
var compat=(document.getElementById || document.all) ? false: true;

var nClicked=-1;
var BLEND_NORMAL=100;
var BLEND_GLOW=35;

function getWindowW() {
	if (document.all) return parent.document.body.clientWidth; 
	if (dom || document.layers) return window.innerWidth;
}

function getWindowH() {
	if (document.all) return parent.document.body.clientHeight; 
	if (dom || document.layers) return window.innerHeight;
}

function getCanvasH() {
	if (document.all) return document.body.offsetHeight;
	else if (document.layers||dom) return self.innerHeight;
	else return -1;
}

function getCanvasW() {
	if (document.all) return document.body.offsetWidth;
	else if (document.layers||dom) return self.innerWidth;
	else return -1;
}

function getLeft(id){
	if (ie) p=document.all[id].style;
	else if (dom) p=document.getElementById(id).style;
	else if (nn4) p=document.layers[id];
	return parseInt(p.left);
}

function getTop(id){
	if (ie) p=document.all[id].style;
	if (dom) p=document.getElementById(id).style;
	if (nn4) p=document.layers[id];
	return parseInt(p.top);
}

function getWidth(id) {
	if (ie) w=document.all[id].offsetWidth;
	else if (dom||nn4) w=document.getElementById(id).offsetWidth;
	return w;
}

function getHeight(id) {
	if (ie) w=document.all[id].offsetHeight;
	else if (dom||nn4) w=document.getElementById(id).offsetHeight;
	return w;
}

function hideLayer(id){
	if(ie)document.all[id].style.visibility="hidden";
	if(dom)document.getElementById(id).style.visibility="hidden";
	if(nn4)document.layers[id].visibility="hide";
}

function showLayer(id){
	if(ie)document.all[id].style.visibility="visible";
	if(dom)document.getElementById(id).style.visibility="visible";
	if(nn4)document.layers[id].visibility="show";
}

function popup(w,h,filename,flags,name) {
	var l=10, t=10;
	if (!w) w=400;
	if (!h) h=400;
	if (!name) name='popup';
	if (h==0) h=screen.availHeight-40;
	if ((version>=4.0)&&(!opera)) {
		l=(screen.width)?(screen.width-w)/2:0;
		t=(screen.height)?(screen.height-h)/2:0;
		if (t>20) t-=10;
	}
	var fImage=((filename.indexOf('.htm')==0) && (filename.indexOf('.php')==0) && (filename.indexOf('.asp')==0)) ? true:false;
	var s='scrollbars=';
	if (flags.indexOf('s')>=0) s+='yes,'; else s+='no,';
	s+='resizable=';
	if (flags.indexOf('r')>=0) s+='yes,'; else s+='no,';
	s+='toolbar='; 
	if (flags.indexOf('t')>=0) s+='yes,'; else s+='no,';
	s+='menubar=';
	if (flags.indexOf('m')>=0) s+='yes,'; else s+='no,';
	s+="location=no,toolbar=no,directories=no,status=no,width="+w+",height="+h+",left="+l+",top="+t;

	var p=window.open(filename, name, s);
	if (p) {
		if (fImage && !document.layers) {
			p.document.writeln("<html><head><title>Zoom</title></head><body bgcolor='#56595C'>");
			p.document.writeln("<table cellpadding=0 cellspacing=0 border=0 width='100%' height='100%' style='height:100%; width:100%'>");
			p.document.writeln("<tr><td align='center' valign='middle'><a href='javascript:self.close()'><img src='"+filename+"' border=0 alt='Schlie&szlig;en' title='Schlie&szlig;en'></a></td></tr>");
			p.document.writeln("</table>");
			p.document.writeln("</body></html>");
		}
		p.resizeTo(w,h);
		p.moveTo(l,t);
		p.opener=self;
		p.focus();
	}
}

function tnglow(id,state) {
	if (document.all && !oldie) {
		document.all["img"+id].filters.alpha.opacity = ((state==1) ? BLEND_GLOW : BLEND_NORMAL);
	}
}

function setmenu(id) {
	if (parent!=self) parent.setMenuByName(id);
}
