function highlightWord(node,word,w) {
	// Iterate into this nodes childNodes
	if (node.hasChildNodes) {
		var hi_cn;
		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {
			highlightWord(node.childNodes[hi_cn],word,w);
		}
	}
	
	// And do this node itself
	if (node.nodeType == 3) { // text node
		tempNodeVal = node.nodeValue.toLowerCase();
		tempWordVal = word.toLowerCase();
		if (tempNodeVal.indexOf(tempWordVal) != -1) {
			pn = node.parentNode;
			if (pn.className != "searchword"+w && pn.className !=  "header") {
				// word has not already been highlighted!
				nv = node.nodeValue;
				ni = tempNodeVal.indexOf(tempWordVal);
				// Create a load of replacement nodes
				before = document.createTextNode(nv.substr(0,ni));
				docWordVal = nv.substr(ni,word.length);
				after = document.createTextNode(nv.substr(ni+word.length));
				hiwordtext = document.createTextNode(docWordVal);
				hiword = document.createElement("span");
				hiword.className = "searchword"+w;
				hiword.appendChild(hiwordtext);
				pn.insertBefore(before,node);
				pn.insertBefore(hiword,node);
				pn.insertBefore(after,node);
				pn.removeChild(node);
			}
		}
	}
}

function googleSearchHighlight() {
var c = 0;
	for (w=0;w<arrHighlight.length;w++) {	
		highlightWord(document.getElementsByTagName("body")[0],arrHighlight[w],c);
		c++;
		if(c>4){
			c=0;
		}
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}


function clearFld(fld){
if(fld.value==" Suchbegriff"){
fld.value="";
}
}

function showReihe(reihe){
window.open("infoReihen.php?&reihe="+reihe,"new","height=130,width=470,resize=0,scrollbars=0,left="+(screen.width-470)/2+",top=160");
}

function initSearchDetail(objForm){
objForm.submit();
}

function initsearch(objForm){
if(objForm.term.value==" Suchbegriff"){
objForm.term.value="";
objForm.term.focus();
return ;
}else if(objForm.term.value.length<4){
alert("Geben Sie bitte ein Suchbegriff mit einer Länge von mehr als 3 Zeichen an!");
objForm.term.focus();
return ;
}else{
objForm.submit();
}
}

function goBack(objForm){
parent.frames[4].history.go((Number(Number(objForm.history.value)*-1)));
//window.history.go((Number(Number(objForm.history.value)*-1)))
}

function go(){
//objForm = document.forms[0];
//objForm.submit();
}

function reloadTop(sessDestroy){
top.frames["headFrame"].location.href="preview.php?&sessDestroy=" + sessDestroy;
}

function reloadItem(objForm){
alert(objForm.maxPage.value)
}


function order(objForm){
if (!(objForm.re_anrede[0].checked || objForm.re_anrede[1].checked || objForm.re_anrede[2].checked)){
			alert("Geben Sie bitte eine Anrede an!");
			return;
		}
		
		
if(objForm.re_vorname.value == ""){
			alert("Geben Sie bitte einen Vornamen an!");
			objForm.re_vorname.focus();
			return;
		}
if(objForm.re_name.value == ""){
			alert("Geben Sie bitte einen Nachnamen an!");
			objForm.re_name.focus();
			return;
		} 
		  
if(objForm.re_strasse.value == ""){
			alert("Geben Sie bitte ihre Strasse an!");
			objForm.re_strasse.focus();
			return;
		} 	
		if(objForm.re_ort.value == "")		{
			alert("Geben Sie bitte auch einen Ort an!");
			objForm.re_ort.focus();
			return;
		} 
		if(objForm.re_email.value.indexOf("@") < 2 || objForm.re_email.value.indexOf(".") < 1)		{
			alert("Geben Sie bitte ihre Email-Adresse an!");
			objForm.re_email.focus();
			return;
		} 
if(objForm.bezahlung!=null){
if(objForm.bezahlung[1].checked){
if(objForm.spd_bankname.value == ""){
			alert("Geben Sie bitte den Namen ihrer Bank an!");
			objForm.spd_bankname.focus();
			return;
		}
if(objForm.spd_konto.value == "" || Number(objForm.spd_konto.value)!=objForm.spd_konto.value){
			alert("Geben Sie bitte ihre Kontonummer (ohne Leerstellen) an!");
			objForm.spd_konto.focus();
			return;
		}
if(objForm.spd_blz.value == "" || Number(objForm.spd_blz.value)!=objForm.spd_blz.value){
			alert("Geben Sie bitte die Bankleitzahl (ohne Leerstellen) ihrer Bank an!");
			objForm.spd_blz.focus();
			return;
}		
if(objForm.cookieBankSelection.checked==true){
			objForm.cookie.value="Ja";
		    objForm.cookieBank.value="Ja";
}
}
}
		
		
		if(objForm.accept.checked != true){
			alert("Bestätigen sie bitte die Geschäfts- und Lieferbedingungen!");
			return;
		}
		
		if(objForm.cookieSelection.checked==true){
		    objForm.cookie.value="Ja";
		}
		if(objForm.katalogSelection.checked==true){
		    objForm.katalog.value="Ja";
		}
		objForm.action=objForm.action_path.value
		objForm.submit();

}

function changeBasket(bestNr){
parent.frames['headFrame'].document.basket.ordered.value=document.basket["action_"+bestNr].value;
parent.frames['headFrame'].document.basket.BestNr.value=bestNr;
parent.frames['headFrame'].document.basket.submit();
getArrBasket(bestNr);
}

function getArrBasket(bestNr){
if (document.layers && parent.frames["mainFrame"].document["id_" + bestNr]!=null) {
if(parent.frames["mainFrame"].basket["action_"+bestNr].value=="ordered"){
parent.frames["mainFrame"].document["tbl_" + bestNr].style.backgroundColor ="FFFFFF";
parent.frames["mainFrame"].document.basket["action_"+bestNr].value=""
parent.frames["mainFrame"].document["id_" + bestNr].document.open()
parent.frames["mainFrame"].document["id_" + bestNr].document.write("<img src='images/inDenWarenkorb.gif' width='118' height='19' hspace='0' vspace='0' border='0' alt=' In den Warenkorb legen '>");
parent.frames["mainFrame"].document["id_" + bestNr].document.close();
}else{
parent.frames["mainFrame"].document["tbl_" + bestNr].style.backgroundColor ="F0F0F0";
parent.frames["mainFrame"].document.basket["action_"+bestNr].value="ordered"
parent.frames["mainFrame"].document["id_" + bestNr].document.open()
parent.frames["mainFrame"].document["id_" + bestNr].document.write("<img src='images/imWarenkorb.gif' width='118' height='19' hspace='0' vspace='0' border='0' alt=' Aus dem Warenkorb l&ouml;schen '>");
parent.frames["mainFrame"].document["id_" + bestNr].document.close();
}	
}else{
if (document.getElementById){
if (parent.frames["mainFrame"].document.getElementById("id_" + bestNr)!=null){
if(parent.frames["mainFrame"].document.basket["action_"+bestNr].value=="ordered"){
parent.frames["mainFrame"].document.getElementById("tbl_" + bestNr).style.backgroundColor ="FFFFFF";
parent.frames["mainFrame"].document.basket["action_"+bestNr].value=""
parent.frames["mainFrame"].document.getElementById("id_" + bestNr).innerHTML ="<img src='images/inDenWarenkorb.gif' width='118' height='19' hspace='0' vspace='0' border='0' alt=' In den Warenkorb legen '>";
}else{
parent.frames["mainFrame"].document.getElementById("tbl_" + bestNr).style.backgroundColor ="F0F0F0";
parent.frames["mainFrame"].document.basket["action_"+bestNr].value="ordered"
parent.frames["mainFrame"].document.getElementById("id_" + bestNr).innerHTML ="<img src='images/imWarenkorb.gif' width='118' height='19' hspace='0' vspace='0' border='0' alt=' Aus dem Warenkorb l&ouml;schen '>";
}	
} 
	}	
	}
}

function reloadForm(f){
if(f.re_land.value != ""){
f.submit()
}else{
alert("Bitte geben sie ein Land an!")
}
}

function setCookie(name, wert, domain, expires, path, secure){
   var cook = "name="+unescape(wert);
   cook += (domain)?"; domain="+domain:"";
   cook += (expires)?"; expires="+expires:"";
   cook += (path)?"; path="+path:"";
   cook += (secure)?"; secure":"";
   document.cookie = cook;
}
