// utility functions

var os = navigator.platform.toLowerCase();
var agent = navigator.userAgent.toLowerCase();

var is_mac = (os.indexOf("mac") != -1);
var is_ff = (navigator.appName == "Netscape");
var is_ie = (agent.indexOf("msie") !=-1);
var is_ie8 = (navigator.appVersion.match(/msie 8/i))  ? 1 : 0;
//if(is_ie8){alert("is_ie8:"+is_ie8)}

var major = is_ie? parseInt(agent.substring(agent.indexOf('msie')+5)):parseInt(navigator.appVersion);
var minor = is_ie? parseFloat(agent.substring(agent.indexOf('msie')+5)):parseFloat(navigator.appVersion);
//alert(navigator.appName+"\n"+agent+"\n"+major+"\n"+minor)

function tellerror(msg, url, linenumber){
alert(msg+'\n\n'+url+'\n\nLine '+linenumber)
return true
}
window.onerror=tellerror

var utilang=self.location.search.substring(1,3)    // in allcases

function $(){ // replaces document.getElementByID()
	var r=arguments[0];
	r= (typeof r == 'object') ? r : document.getElementById(r);
    if (r=="undefined" || r == null || !r) {

		//return
			var s=document.createElement("SPAN")
			document.body.appendChild(s);
			with(s.style){fontFamily='arial';fontSize='11px';color='#2A2A2A';padding="3px"}
			var w=document.createTextNode("object not found!");
			s.appendChild(w);
			s.id="XINQ"
			r=s
			setTimeout("document.body.removeChild($('XINQ'))",500)
		}
    return r
}

var $=window.$;

function showMe(){
	var r;
	if(arguments[0]){r=arguments[0]}

	if (r === null) {alert("NULL!");return}

	try{if (  !r  || r=="undefined" || r === null ) {return} }catch(e){alert("Objekt nicht gefunden!");return}
	r= (typeof r == 'object') ? r : document.getElementById(r);

	with(r.style){
		display="block";
		visibility="visible"
	}
}

function hideMe(){
	var r;
	if(arguments[0]){r=arguments[0] }
	//else{alert("999");return}
	if (r=="undefined" || r == null || !r) {return}
	r= (typeof r == 'object') ? r : document.getElementById(r);
	with(r.style){
		display="none";
		visibility="hidden"
	}
}

function stopEvent(){
		e=e||window.event;
		if (e.stopPropagation) {e.stopPropagation();alert("Propstop")}	 //moz
		else {e.cancelBubble = true;alert("CancelBub")}	  //ie
}


function toEl(e){
	var relTarg;
	if (!e) var e = window.event;
	if (e.relatedTarget) relTarg = e.relatedTarget;
	else if (e.toElement) relTarg = e.toElement;
	return relTarg
}

// Routines used in all levels

var timeouts =[];

function clearTOs(){
if (timeouts) for (var i in timeouts) if (timeouts[i]) clearTimeout(timeouts[i]);
timeouts = [];
}

// use thus: timeouts[timeouts.length] =setTimeout('preShow()',500)


function setOpacity(obj,o){
// round opacity to 3 decimal points to avoid excessive;ly long values
o=Math.round(o*10000)/10000;

if(o<0){o=0}

if(document.all) {
        var bigO=parseInt(o*100);
         $(obj).style.filter="alpha(opacity="+bigO+")";
   }
   else{
       $(obj).style.opacity=o;
    }
    $(obj).style.display='block';
	//alert("Just set opacity to "+o)
}


function goBack(){
	window.history.back(-1)
}

function goOn(){
	window.history.forward(1)
}


//---------------------------------------------------//

//alert("Utils loaded! ßäüö\n"+self.location.href);



