function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openPic(url,winName,winParams) {
	var theWindow = window.open(url,winName,winParams);
	if (theWindow)  {theWindow.focus();}
}

function JumpToSite(Box) {
	ID=Box[Box.selectedIndex].value;
	if(ID!="") {
		window.location.href="/Quickfinder."+ID+".0.html";
	}
}

sfHover = function() {
	var sfEls = document.getElementsByTagName("TD");	
	for (var i=0; i<sfEls.length; i++) {
		if(/MouseOver/.test(sfEls[i].className)) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

function UnCryptMailto(s) {	//
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}
  // JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s)	{	//
	location.href=UnCryptMailto(s);
}

// Webtrekk
function wt_sendinfo(p){
	var wt_content=(p?p:wt_be);
	if(!wt_content)wt_content="no_content";
	var wt_url=location.protocol+"//track.webtrekk.de/314535532140005/wt.pl?p=132,";
	var wt_c=escape(wt_content)+",1,";
	wt_c+=screen.width+"x"+screen.height+","+(navigator.appName!='Netscape'?screen.colorDepth:screen.pixelDepth)+",";
	wt_c+=((navigator.cookieEnabled==true)?"1,":((navigator.cookieEnabled==false)?"0,":((document.cookie.indexOf("=")!=-1)?"1,":"0,")));
	wt_c+=new Date().getTime()+",";
	wt_c+=((document.referrer.length>0)? escape(document.referrer):"0")+",0";
	if(document.images){wt_i=new Image();wt_i.src=wt_url+wt_c;}else
	document.write("<img src='"+wt_url+wt_c+"' height='1' width='1'>");
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


function bildWechsel(dieses,jenes){
	eval('window.document.images[dieses].src = "fileadmin/' + jenes + '"');
}

/*PopUp*/
var Fenster = null;
function neuesfenster(meineSeite,meinName,w,h,scroll)
{

LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

settings ='height='+h+',width='+w+',top='+TopPosition+
',left='+LeftPosition+',scrollbars='+scroll+',resizable'
Fenster = window.open(meineSeite,meinName,settings);
}


function ebene_anzeigen(bildId, bild, linkId, href, divAnzeige){
	document.getElementById(bildId).src = bild;
	document.getElementById(linkId).href = "href";
	document.getElementById(divAnzeige).style.display = "block";
}

function ebene_verbergen(bildId, bild, linkId, href, divAnzeige){
	document.getElementById(bildId).src = "bild";
	document.getElementById(linkId).href = "href";
	document.getElementById(divAnzeige).style.display = "none";
}


function ebeneAus(ebene) {
 document.getElementById(ebene).style.display = "none";
 //document.getElementById('wt_in_ort_rechts_detail_aktiv').style.display = "block";

}

function ebeneAn(ebene) {
	document.getElementById(ebene).style.display = "block";

}

function hoeheInaktivKleiner3(){
	//document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='180px';
}

function hoeheScroller(anzahl){
	 var anzahlWT = anzahl;
	 //alert (anzahlWT);
	 
	 if (anzahlWT < 3) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='170px';
	 	document.getElementById('holder2').style.height='100px';
	 	document.getElementById('wn2').style.height='100px';
	 }
	 if (anzahlWT ==3) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='200px';
	 	document.getElementById('holder2').style.height='130px';
	 	document.getElementById('wn2').style.height='130px';
	 }
	 if (anzahlWT ==4) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='230px';
	 	document.getElementById('holder2').style.height='140px';
	 	document.getElementById('wn2').style.height='140px';
	 }
}

function hoeheScrollerKarte(anzahl){
	 var anzahlWT = anzahl;
	 
	 if (anzahlWT < 3) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='170px';
	 	document.getElementById('holder2').style.height='100px';
	 	document.getElementById('wn2').style.height='100px';
	 	document.getElementById('dhtml_rechts_top').style.display='none';
	 	document.getElementById('dhtml_rechts_bottom').style.display='none';
	 }
	 if (anzahlWT ==3) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='210px';
	 	document.getElementById('holder2').style.height='140px';
	 	document.getElementById('wn2').style.height='140px';
	 	document.getElementById('dhtml_rechts_top').style.display='none';
	 	document.getElementById('dhtml_rechts_bottom').style.display='none';
	 }
	 if (anzahlWT ==4) {
	 	document.getElementById('wt_in_ort_rechts_detail_inaktiv').style.height='280px';
	 	document.getElementById('holder2').style.height='190px';
	 	document.getElementById('wn2').style.height='190px';
	 	document.getElementById('dhtml_rechts_top').style.display='none';
	 	document.getElementById('dhtml_rechts_bottom').style.display='none';
	 }
}

function merkzettel (werbetraeger,typ) {
	
	var anzahlWT = parseInt(document.getElementById('merkzettel_'+typ).value) + 1;
	document.getElementById('merkzettel_'+typ).value = anzahlWT;
	
	var anzahl = parseInt(document.getElementById('merkzettel_zaehler').value) + 1;
	document.getElementById('merkzettel_zaehler').value = anzahl;
	
	var eintrag = merkzettel_sidebar();
	
	document.getElementById('cookiemaster').src = "/fileadmin/weitclickscripts/cookiemaster.php?add=" + werbetraeger +"&gesamt="+anzahl+eintrag;
}

function merkzettel_sidebar () {
						
	var anzahl = parseInt(document.getElementById('merkzettel_zaehler').value);
	
	if (anzahl == 1) {
		var produkte = "Produkt";
	}
	else {
		var produkte = "Produkte";
	}
	document.getElementById('merkzettelliste_details').innerHTML = anzahl + " " + produkte;
	document.getElementById('merkzettelliste_navigation').innerHTML = anzahl;
	
	
	typen = new Array("GS", "GF", "VI", "GV", "ML");
	typenlang = new Array("Ganzs&auml;le", "Ganzfl&auml;che", "City-Light-Poster", "Mega-Light", "Mega-Light");
	
	var liste = "";
	var eintrag = "";
	for(i=0;i<typen.length;i++) {
		if (document.getElementById('merkzettel_'+typen[i]).value!=0) {
			liste+= document.getElementById('merkzettel_'+typen[i]).value+"x "+typenlang[i]+"<br/>";
		}
		eintrag+="&"+typen[i]+"="+document.getElementById('merkzettel_'+typen[i]).value;
	}
	
	if (liste == "") {
		liste = "Keine Produkte auf dem Merkzettel";
	}
		
	document.getElementById('merkzettelliste_liste').innerHTML = liste;
	return eintrag;
}

// Positionieren des Info-Fensters
function infoPos(id,left,top){
    document.getElementById(""+id+"").style.left = left;
    document.getElementById(""+id+"").style.top = top;
}


var openpopupWindow=null;
function openpopup (mypage,myname,w,h,pos,infocus){
 if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if((pos!='center' && pos!='random') || pos==null){
		LeftPosition=100;TopPosition=100;
	}
	var settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';

    var openpopupWindow=window.open('',myname,settings);
    if(infocus=='front'){
		openpopupWindow.focus();
		openpopupWindow.location=mypage;
	}
}

function openpopupWithScrollbar (mypage,myname,w,h,pos,infocus){
 if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if((pos!='center' && pos!='random') || pos==null){
		LeftPosition=100;TopPosition=100;
	}
	var settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no';

    var openpopupWindow=window.open('',myname,settings);
    if(infocus=='front'){
		openpopupWindow.focus();
		openpopupWindow.location=mypage;
	}
}

//Bildertausch
function bilderTausch(bildID,ersatz) {
	eval('window.document.images[bildID].src = "' + ersatz + '"');
}

function divSichtbar(div,link){
        document.getElementById(div).style.display = "block";
        document.getElementById(link+'Open').style.display = "block";
        document.getElementById(link+'Closed').style.display = "none";
}

function divUnsichtbar(div,link){
        document.getElementById(div).style.display = "none";
        document.getElementById(link+'Open').style.display = "none";
        document.getElementById(link+'Closed').style.display = "block";
}

function divSichtbarReddot(){
        document.getElementById('reddot').style.display = "block";
        document.getElementById('reddotOpen').style.display = "block";
        document.getElementById('reddotClosed').style.display = "none";
        document.getElementById('if').style.display = "none";
        document.getElementById('ifOpen').style.display = "none";
        document.getElementById('ifClosed').style.display = "block";
}

function divUnichtbarReddot(){
        document.getElementById('reddot').style.display = "none";
        document.getElementById('reddotOpen').style.display = "none";
        document.getElementById('reddotClosed').style.display = "block";
}

function divSichtbarIf(){
        document.getElementById('if').style.display = "block";
        document.getElementById('ifOpen').style.display = "block";
        document.getElementById('ifClosed').style.display = "none";
        document.getElementById('reddot').style.display = "none";
        document.getElementById('reddotOpen').style.display = "none";
        document.getElementById('reddotClosed').style.display = "block";
}

function divUnsichtbarIf(){
        document.getElementById('if').style.display = "none";
        document.getElementById('ifOpen').style.display = "none";
        document.getElementById('ifClosed').style.display = "block";
}


function klassenTausch(elementId, klassenname) {
	document.getElementById(elementId).className = klassenname;
}

function changeDisplay(elementId)
{
	if (document.getElementById(elementId).style.display == 'none') {
        //vista = 'block';
        document.getElementById(elementId).style.display = 'block';
	} else {
        //vista = 'none';
        document.getElementById(elementId).style.display = 'none';
	}
		//vista = (document.getElementById(elementId).style.display == 'none') ? 'block' : 'none';
		//document.getElementById(elementId).style.display = vista;

}

function changeDisplay2(elementId)
{
	if (document.getElementById(elementId).style.display == 'block') {
        vista = 'block';
	} else {
        vista = 'none';
	}
		//vista = (document.getElementById(elementId).style.display == 'none') ? 'block' : 'none';
		document.getElementById(elementId).style.display = vista;

}


function ladeSeite(link){
	document.location.href = link;
}




function mediadatenPopUp(id) {

	var left = (screen.width)?(screen.width-850)/2:100;
	var top  = (screen.height)?(screen.height-649)/2:100;

	window.open('/fileadmin/mediadaten_special/index1.php?wt_id='+id+'&aktion=singleWT', 'mediadaten', "width=850,height=649,left=" + left + ",top=" + top + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");


}