//Popcenter allgemein + Forum

function popcenter(uri,wi,he,poptype) {
    if(poptype=="narrow"){
        wi=parseInt(wi)+16; he=parseInt(he)+16;
    }else{
        wi=parseInt(window.screen.availWidth*.8); he=parseInt(window.screen.availHeight*.8);
    }
    uri="zoom.php?path="+uri;
    var w=(window.screen.availWidth-wi)/2-16;
    var h=(window.screen.availHeight-he)/2-16;
    var strscroll="";
    if(wi>window.screen.availWidth-24 || he>window.screen.availHeight-24){ strscroll=",scrollbars=1,resizable=1";}
    str="width="+wi+",height="+he+",top="+h+",left="+w+""+strscroll+"";

    zoom=window.open(uri,"zoom",str);
}

//Herstellersuche (Select)

function gotopage() {
    if(document.h){
        var hersteller = document.h.hersteller.value;
        if(hersteller){
            location.href="kat.php?h="+hersteller+"";
        }
    }
}

//Suche

function go() {
    if(document.s){
        var q = document.s.q.value;
        if(q){
            location.href="kat.php?q="+q+"";
        }
    }
}

function checkStichwort() {
    if(document.s){
        var q = document.s.q.value;
        if(!q){
            return false;
        }
    }
}

//Einkaufswagen Finanzierung

function finanz(x,y,farbcheck)
{
	var testen = true;
	if(farbcheck)
	{
		if (document.f.Selectfeld.options[document.f.Selectfeld.options.selectedIndex].value == "nix")
		{
			alert("Bitte treffen Sie eine Auswahl! \n\nPlease select! \n\nVotre Selection s.v.p.");
			document.f.Selectfeld.focus();
			testen = false;
		}
	}
	if(testen)
	{
		document.f.Finanzierungslaufzeit.value=x;
		document.f.Finanzierungsrate.value=y;
		document.f.kennzeichen.value += "Finanzierung";
		document.f.submit();
	}
}

//Popup allgemein + team + produkt + smiley

function popup(uri,str) {
    popupWin=window.open(uri,"teamPopup",str);
}

//Funktion mit Selectbox

function oSelect()
{
	var check = false;
	if (document.f.Selectfeld) // Farben
	{
		var wert = eval( "document.f.Selectfeld.options[document.f.Selectfeld.options.selectedIndex].value");
		if (wert == "nix")
		{
        		alert("Bitte treffen Sie eine Auswahl! \n\nPlease select! \n\nVotre Selection s.v.p.");
        		check = true;
		}
	}
	if (document.f.kabellaenge) // Kabellange
	{
		
		var wert = eval( "document.f.kabellaenge.options[document.f.kabellaenge.options.selectedIndex].value");
		if (wert == "nix")
		{
        		alert("Bitte treffen Sie eine Auswahl! \n\nPlease select! \n\nVotre Selection s.v.p.");
        		check = true;
		}
	}
	if (check == false) document.f.submit();
	else return false;
}

//Produktsuche

function cmsfenster(url,breite,hoehe)
	{
		cmswin = window.open(url,"cms","toolbar=0,top=40,left=40,screenX=50,screenY=50,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=" + breite + ",height="+ hoehe);
	}

function checkSearch(){
    if(document.f.Kategorie.value=="" && document.f.Hersteller.value=="") {
        alert("Bitte wählen Sie Kategorie oder Hersteller oder beides! ");
        return false;
    }
}
    
function change_color()
{
	if (document.getElementsByName('SONDERPOSTEN 30/50/70%')[0])
	//if (document.getElementsByName('Fundgrube')[0])
	{
		//alert(farbe_neu);
		
		if (farbe_neu == "#FFFFFF") farbe_neu = "red";
	 	else farbe_neu = "#FFFFFF";
	 	document.getElementsByName('SONDERPOSTEN 30/50/70%')[0].style.color = farbe_neu;
	}
}

function pop(url,rem,str)
	{
		cmswin = window.open(url,rem,str);
	}

function neues_fenster(url,width,height)
	{
		popup = window.open(url,"_blank","toolbar=0,top=40,left=40,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + width + ",height=" + height + "screenX=50,screenY=50");
	}

function change_image_gross(bild,breite,hoehe)
{
	ausgabe ="document.getElementById('hauptbild').innerHTML = '<img src=" + encodeURI(bild) + " width=" + breite + " height=" + hoehe + ">';";
	//alert(bild.replace("_"," "));
	eval(ausgabe);
}

function change_image_klein(bild,breite,hoehe)
{
	eval ("document.getElementById('bild_klein').innerHTML = '<img src=" + bild + " width=" + breite + " height=" + hoehe + ">';");
}

if (document.layers) {navigator.family = "nn4"}
if (document.all) {navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {navigator.family = "gecko"}
//alert(navigator.family);
overdiv="0";

function popLayer2(inhalt)
{
	inhalt = inhalt.replace(/\[t\]/g,"'");
	//var desc = "<table style=\"\"><tr><td>\n" + "<tr><td style=\"background-color:#fffecb;\">" + inhalt + "</td></tr></table>";
	var desc = inhalt;	
	if(navigator.family =="nn4") {
		document.text_preisalarm.document.write(desc);
		document.text_preisalarm.document.close();
		document.text_preisalarm.left=x-8;
		document.text_preisalarm.top=y-5;
	}
	else if(navigator.family =="ie4") {
		//alert (x + ' x ' + y);
		text_preisalarm.innerHTML=desc;
		ausgabe = "text_preisalarm.style.pixelLeft='" + (x-40) + "';";
		//alert(ausgabe);
		eval(ausgabe);
		ausgabe = "text_preisalarm.style.pixelTop='" +  (y+20) + "';";
		eval(ausgabe);
		text_preisalarm.style.visibility = "visible";

	}
	else if(navigator.family =="gecko") {
		document.getElementById("text_preisalarm").innerHTML=desc;
		document.getElementById("text_preisalarm").style.left= (x-40) + 'px';
		document.getElementById("text_preisalarm").style.top= (y+20) + 'px';
		document.getElementById("text_preisalarm").style.visibility="visible";
	}
}

function hideLayer2()
{
	if (overdiv == "0")
	{
		if(navigator.family =="nn4") {eval(document.text_preisalarm.top="-500");}
		else if(navigator.family =="ie4"){
			text_preisalarm.innerHTML="";
			text_preisalarm.style.visibility = "hidden";
		}
		else if(navigator.family =="gecko") {
			document.getElementById("text_preisalarm").style.visibility = "hidden";
		}
        }
}

var isNav = (navigator.appName.indexOf("Netscape") !=-1);

function handlerMM(e)
{
	x = (isNav) ? e.pageX : event.clientX + document.body.scrollLeft;
	y = (isNav) ? e.pageY : event.clientY + document.body.scrollTop;
}
if (isNav){document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove = handlerMM;