var ie=0; var ff2=0;
if (document.all) ie=1;
if (document.getElementById && !ie) ff2=1;

var arrow='<IMG src="/Images/arrow_ani_trans.gif" width="20" height="20" border="0" hspace="5" vspace="0" align="absbottom">';
var arrowno='<IMG src="/Images/arrow_trans.gif" width="20" height="20" border="0" hspace="5" vspace="0" align="absbottom">';

function openPop(url, w, h) {
	var nw=window.open(url, "holimore","height="+h+",width="+w+",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes,left=250,top=50");
	if (nw) nw.focus();
}

function setClass(idname, newclass) {
	var e=document.getElementById(idname);
	if (e){
		e.className=newclass;
	}
}

function doDisplay(obj){
	if(obj.tagName=='TR' && ie==0){
		return 'table-row';
	}else{
		return 'block';
	}
}

function setPos(idname, lpos, tpos, vis){
	var e=document.getElementById(idname);
	if (e){
		if (lpos!='') e.style.left=lpos+'px';
		if (tpos!='') e.style.top=tpos+'px';
		e.style.visibility=vis;
	}
}

function showMes(msg) {
	if (msg!='') {
		var m=document.getElementById('Mes');
		var mtab=document.getElementById('MesTable');
		if (m){
			if (msg==''){
				m.innerHTML='&nbsp;';
				m.style.display='none';
			}else{
				var neubutton='<INPUT type="button" name="RESET" value="neue Suche" class="knob ks" onClick="location.href=\'http://'+window.location.host+'/index.asp?SessionId='+sessionID+'\';">';
				var backbutton='<INPUT type="button" name="RESET" value="zurück" class="knob ks" onClick="history.back();">&nbsp;&nbsp;&nbsp;';

				//1.Hinweis 2..Hinweis mit Neue Suche  0..Fehler
				if (errorlevel==1) {
					m.innerHTML='<SPAN class="headklein">Achtung: </SPAN><DIV>'+msg+'</DIV><DIV style="text-align: right;"><BR>'+backbutton+neubutton+'</DIV>';
				}else if (errorlevel==2) {
					m.innerHTML='<SPAN class="headklein">Hinweis: </SPAN><DIV>'+msg+'</DIV>';
				}else if (errorlevel==3) {
					m.innerHTML='<SPAN class="headklein">Hinweis: </SPAN><DIV>'+msg+'</DIV><DIV style="text-align: right;"><BR>'+backbutton+neubutton+'</DIV>';
				}else if (errorlevel==4) {
					m.innerHTML='<DIV class="head">'+msg+'</DIV>';
				}else{
					m.innerHTML='<SPAN class="headklein">Achtung: </SPAN><DIV>'+msg+'</DIV>';
				}
				if (mtab) {
					mtab.className='addcolor2';
				}else{
					if (errorlevel!=4) m.className='addcolor2';
				}
				m.style.visibility='visible';
			}
		}
	}
}

function checkForm(formname) {
	var noText = /^\s?$/
	if (checkWanteds.length==0) return '';
	var description='';
	for(var i=0;i<checkWanteds.length;i++) {
		var checkSplit=checkWanteds[i].split("#")
		if (checkSplit[2]=='0') {
			var val=eval('document.'+formname+'.'+checkSplit[0]+'.value');
		}else if (checkSplit[2]=='1') {
			var val=eval('document.'+formname+'.'+checkSplit[0]+'.options[document.'+formname+'.'+checkSplit[0]+'.selectedIndex].value');
		}
		if (noText.test(val)) {
			description+='<LI onclick="document.'+formname+'.'+checkSplit[0]+'.focus();" style="cursor: pointer;">'+checkSplit[1]+'</LI>'
			document.getElementById(checkSplit[0]).parentNode.className='addColor2';
		}else{
			document.getElementById(checkSplit[0]).parentNode.className='';
		}
	}
	return description;
}

function setForm(actio, targ, formobj) {
	with (formobj) {
		action='http://'+window.location.host+actio+'?sessionID='+sessionID+'&Prod='+prod;
		PageRequest.value=targ;
		submit();
	}
}

function wW() {
	var ww=0;
	if (window.innerWidth) ww=window.innerWidth;
	else if (document.body && document.body.offsetWidth) ww=document.body.offsetWidth;
	return ww;
}

function wH() {
	var hh=0;
	if (window.innerHeight) hh=window.innerHeight;
	else if (document.body && document.body.offsetHeight) hh=document.body.offsetHeight;
	return hh;
}

function setH(corr){
	var e=document.getElementById('content');
	if (e){
		if(e.offsetHeight){
			var corh=wH()-corr;
			var orh=e.offsetHeight;
			if (orh<corh) e.style.height=corh+'px';
		}
	}
}

function setT(aNumber,aDez) {
	var mEx = Math.pow(10,aDez);
	if(isFinite(aNumber)) {
		var mNeu = Math.abs(Math.round(parseFloat(aNumber)*mEx)/mEx);
		var mG   = Math.floor(mNeu);

		var mK   = Math.round((mNeu-mG) * mEx)/mEx;
		
		for (var i=mG.toString().length,j=0,mNeu='';i>-1;i--,j++) mNeu=((j%3==0)&&(j!=0)&&(j!=mG.toString().length)?'.':'')+mG.toString().charAt(i)+mNeu;
			return (parseFloat(aNumber)<0?'-':'')+mNeu+(aDez>0?','+(mK==0?mEx.toString().substr(1,aDez):(mK+mEx.toString().substr(1,aDez)).substr(2,aDez)):'')+ ' &euro;';
	} else return aDez>0?'0,'+(mEx.toString()).substr(1,aDez):'0'+ ' &euro;';
}

function writeInfo(idname, txt) {
	var e=document.getElementById(idname);
	if (e){
		e.innerHTML=txt;
	}else{
//		alert(idname);
	}
}

function addInfo(idname, txt) {
	var e=document.getElementById(idname);
	if (e){
		e.innerHTML+=txt;
	}
}

function checkImage(id) {
	var actbild=eval('document.images.bld'+id);
	if (actbild){
		actbild.height=129
		actbild.src=noimage.src;
//		setPos('bld'+id, '', '', 'visible');
	}
}

function setImi(id) {
	var actbild=eval('document.images.bld'+id);
	if (actbild){
		addInfo('dummy', '<IMG src="'+actbild.src+'" onLoad="setImiW(\''+id+'\');" name="dummyB'+id+'" id="dummyB'+id+'">')
	}
}

function setImiW(imiId) {
	var imageW=190;
	var dummybild=eval('document.images.dummyB'+imiId);
	if (dummybild){
		if(dummybild.width<imageW) imageW=dummybild.width;
	}
	var actbild=eval('document.images.bld'+imiId);
	if (actbild){
		actbild.width=imageW;
	}
}

function checkRadioValue(name) {
	var rvalue='';
	var obj=eval(name);
	if (obj){
		if (obj.length){
			for (var i=0;i<obj.length;i++) {
				if (obj[i].checked==true) {
					rvalue=obj[i].value
					break;
				}
			}
		}else{
			if (obj.checked==true) {
				rvalue=obj.value;
			}
		}
	}
	return rvalue;
}

function checkSetRadioValue(obj, value) {
	if (obj){
		if (obj.length){
			for (var i=0;i<obj.length;i++) {
				if (obj[i].value==value) {
					obj[i].checked=true;
					break;
				}
			}
		}else{
			if (obj.value==value) {
				obj.checked=true;
			}
		}
	}
}

function goScroll(anker){
	location.hash='#'+anker;
}
