/**
 * This project is NOT free software; you are NOT allowed to redistribute it
 * and/or modify it.
 *
 * @author Gilbert Guttmann <guttmann@clandrei.de>
 * @copyright (C) 2005 clan.drei GmbH, http://www.clandrei.de
 */

var its;
var browserName;
var browserNameLong;
var browserNew;
var preloadFlag = false;
var Macintosh = navigator.userAgent.indexOf('Mac')>0;

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function its() {
	var n = navigator;
	var ua = ' ' + n.userAgent.toLowerCase();
	var pl = n.platform.toLowerCase();
	var an = n.appName.toLowerCase();

	// browser version
	this.version = n.appVersion;
	this.nn = ua.indexOf('mozilla') > 0;

	// 'compatible' versions of mozilla aren't navigator
	if(ua.indexOf('compatible') > 0) 
	{
		this.nn = false;
	}
	
	this.opera = ua.indexOf('opera') > 0;
	this.ie = ua.indexOf('msie') > 0;
	this.major = parseInt( this.version );
	this.minor = parseFloat( this.version );

	// platform
	this.mac = ua.indexOf('mac') > 0;
	this.win = ua.indexOf('win') > 0;

	// workaround for IE5 which reports itself as version 4.0
	if(this.ie) {
		if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
		}
	}

	return this;
}

function checkBrowser() {
	its = new its();
	
	// is it a DOM-enabled browser?
	if (!document.getElementById) {
		browserNew = false;
	} else {
		browserNew = true;
	}

	// need the name, too
	if (its.opera) {
		browserName = "Opera";
	} else if (its.ie) {
		browserName = "IE";
	} else {
		browserName = "NS";
	}

	// and the number
	browserNameLong = browserName + its.major;

}

function UI_reloadPage(init) {
	if (init==true) with (navigator) {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.UI_pgW=innerWidth; 
			document.UI_pgH=innerHeight; 
			onresize=UI_reloadPage; 
		}
	} else if (innerWidth!=document.UI_pgW || innerHeight!=document.UI_pgH) {
		location.reload();
	}
}

UI_reloadPage(true);

function noBlur() {
	this.blur();
}

function noBorder() {
	if ((browserNew) || (browserName == "IE")) {
		if (browserNew) {
			links = document.getElementsByTagName("a");
		} else {
			links = document.all.tags("a");
		}
		
		for(i=0; i<links.length; i++) {
			links[i].onfocus = noBlur
		}
	}
	if (browserName == "IE") {
		if (browserNew) {
			drops = document.getElementsByTagName("select");
		} else {
			drops = document.all.tags("select");
		}
		
		for(i=0; i<drops.length; i++) {
			drops[i].onfocus = noBlur
		}
	}
}
	
function preloadImage(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) {
			eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src');
			alert(layer);
			alert(imgName);
			alert(imgObj);
		} else {
			document.images[imgName].src = eval(imgObj+".src");
		}
	}
}

function visible(layID,value) {
	document.getElementById(layID).style.visibility = value;
}

function popUp(desktopURL,windowName,width,height,scroll) {
	if (Macintosh) {
		if (browserNameLong == "IE4") {
			newheight = parseInt(height + 17);
		} else if (browserNameLong == "IE4.5") {
			newheight = parseInt(height + 17);
		} else {
			newheight = height;
		}
	} else { 
		newheight = height; 
	}
	
	if (scroll == '') { 
		scroll = 'no'; 
	}
	
	window.open(desktopURL, windowName, "toolbar=no,location=no,status=yes,menubar=no,scrollbars="+scroll+",width="+width+",height="+newheight+",resizable=no" );
}

function centerPopUp(width,height) {
	var left = 0;
	var top = 0;
	
	links = (screen.availWidth - width)/2;
	oben = (screen.availHeight - height)/2;
	self.moveTo(left,top);
	self.focus();
}

function verify(msg){  
	return confirm(msg); 
} 