var is = new Is();

//############ BrowserCheck  IS ##################
function Is() {

	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.agent = agent;
	//alert(this.major);
	//alert(this.minor);
	//alert(agent);
	
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ns7 = (this.ns && agent.indexOf('netscape/7') != -1);
	this.op6 = (agent.indexOf('opera/6') != -1);
	this.op7 = (agent.indexOf('opera/7') != -1);
	this.vop7 = (agent.indexOf('opera 7') != -1);
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
}


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.0
  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 && document.getElementById) x=document.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 ctc(id, idLink, bgCol, bgColLink){
	document.getElementById(id).style.backgroundColor = bgCol;
	document.getElementById(idLink).style.color = bgColLink;
}

function ctclmenu(id, idLink){

	document.getElementById(id).style.backgroundColor = "#FFFFFF";
	//document.getElementById(idLink).src = "url('/images/px.gif')";
	document.images[idLink].src = "/images/px.gif";
}

function ctclmenuOut(id, idLink){
	
	document.getElementById(id).style.backgroundColor = "#666666";
	document.images[idLink].src = "/images/icons/ic_arrow_right_grey_grey.gif";
}



function ctclmenu2(id, idLink, tempBgColor){

	document.getElementById(id).style.backgroundColor = tempBgColor;
	document.images[idLink].src = "/images/px4.gif";
}

function ctclmenuOut2(id, idLink, tempBgColor, tempNewImageName){
	
	document.getElementById(id).style.backgroundColor = tempBgColor;
	document.images[idLink].src = "/images/icons/" + tempNewImageName;
}



function ctcl(id, idLink, bgCol, imgName){
	var bgTab = "";
	
	if (bgCol == ''){ bgTab = "#FFFFFF";} else {bgTab = bgCol;}

	
	document.getElementById(id).style.backgroundColor = bgTab;
	document.images[idLink].src = imgName;
	
}

function ctclOut(id, idLink, bgCol, imgNameOut){
	var bgTab = "";
	
	if (bgCol == ''){ bgTab = "#000000";} else {bgTab = bgCol;}
	 
	
	document.getElementById(id).style.backgroundColor = bgTab;
	document.images[idLink].src = imgNameOut;
	
}




function ctcl2(id, idLink, bgCol){
	var bgTab = "";
	var bgTab2 = "";
	var linkColor = "#FFFFFF";
	
	
	switch(bgCol){
         case '0':
             bgTab = "#FFFFFF";
         break;
         case '1':
             bgTab = "#000000";
		 	 bgTab2 = "black.gif";
         break;
         case '2':
             bgTab = "#A3A3A3";
			 bgTab2 = "a3.gif";
         break;
         case '3':
             bgTab = "#E6E6E6";
			 bgTab2 = "black.gif";
         break;
         case '4':
             bgTab = "#666666";
			 bgTab2 = "6.gif";
         break;
		 case '5':
             bgTab = "#FFFFFF";
			 bgTab2 = "px.gif";
			linkColor = "#000000";
         break; 
		 case '10':
            bgTab = "#000000";
	 	 	bgTab2 = "black.gif";
         break;
		 case '11':
            bgTab = "#89b587";
	 	 	bgTab2 = "black.gif";
         break;   
		 case '13':
            bgTab = "#000000";
	 	 	bgTab2 = "black.gif";
         break;              
		  case '16':
            bgTab = "#000000";
	 	 	bgTab2 = "black.gif";
         break;                              
     }
	 
	
	document.getElementById(id).style.backgroundColor = bgTab;
	document.getElementById(idLink).style.backgroundImage = "url('/images/px.gif')";
	document.getElementById(idLink).style.color = linkColor;
	
}

function ctclOut2(id, idLink, bgCol, bgCol2){
	var bgTab = "";
	var bgTab2 = "";
	var linkColor = "#000000";
	

	switch(bgCol){
         case '0':
             bgTab = "#FFFFFF";
         break;
         case '1':
             bgTab = "#000000";
         break;
         case '2':
             bgTab = "#A3A3A3";
         break;
         case '3':
             bgTab = "#E6E6E6";
         break;
         case '4':
             bgTab = "#333333";
         break;                                                
     }
	 
	 
	 switch(bgCol2){
         case '0':
			 bgTab2 = "ic_arrow_right_black_white.gif";
         break;
         case '1':
			 bgTab2 = "ic_arrow_right_black_white.gif";
         break;
         case '2':
			 bgTab2 = "ic_arrow_right_grey_white_main_nav.gif";
			 linkColor = "666666";
         break;
         case '3':
			 bgTab2 = "ic_arrow_right_black_white.gif";
         break;
         case '4':
			 bgTab2 = "ic_arrow_right_black_white.gif";
         break;
		 case '5':
			 bgTab2 = "ic_arrow_right_6_white.gif";
			 linkColor = "FFFFFF";
         break; 
		 case '10':
			 bgTab2 = "ic_arrow_right_black_white.gif";
         break;  
		 case '11':
			 bgTab2 = "butt_weiter_black.gif";
         break;  
		 case '13':
			 bgTab2 = "butt_weiter_black.gif";
         break;                 
		  case '15':
			bgTab2 = "butt_weiter_grey.png";
         break;
		 case '16':
			bgTab2 = "butt_weiter_black.gif";
         break;                              
     }
	
	document.getElementById(id).style.backgroundColor = bgTab;
	document.getElementById(idLink).style.backgroundImage = "url('/images/icons/" + bgTab2 + "')";
	document.getElementById(idLink).style.color = linkColor;
	
}





function ctclQuick(id, idLink){
     	
	document.getElementById(id).style.backgroundColor = "#666666";
	document.getElementById(idLink).style.backgroundImage = "url('/images/px4.gif')";
	document.getElementById(idLink).style.color = "#FFFFFF";
	
}

function ctclOutQuick(id, idLink){
	
	document.getElementById(id).style.backgroundColor = "#E6E6E6";
	document.getElementById(idLink).style.backgroundImage = "url('/images/icons/ic_arrow_right_black_white.gif')";
	document.getElementById(idLink).style.color = "#000000";
	
}



function checkBgGlossar(idLink, imgName, idLinkName){
	document.getElementById(idLink).style.backgroundImage = "url('/images/masks/" + imgName + "_6.gif')";
	document.getElementById(idLinkName).style.color = "#FFFFFF";
}

function checkBgGlossarOut(idLink, imgName, idLinkName){
	document.getElementById(idLink).style.backgroundImage = "url('/images/masks/" + imgName + "_0.gif')";
	document.getElementById(idLinkName).style.color = "#000000";
}


function openZub(sFile,text,modell,w,h){
	var OD = null;
  	//alert(sNrSeite);
  	OD = window.open("zubehoer_pict.asp?file=" + sFile + "&text=" + text + "&id=" + encodeURIComponent(modell), "OD", "resizable=yes, status=no, scrollbars=yes, scrollbars=1, width=" + w + ", height=" + h);
	OD.focus();	
	return;
}


 function openPdf(sModell,sDateiPfadName){
 	var doc = "";
	//alert(sDateiPfadName);
	doc = window.open("/product/fs_pdf.asp?id=" + sModell + "&pathDoc=" + sDateiPfadName, 'ProduktPreisliste', 'resizable=yes,status=no,scrollbars=no');
  	doc.focus();
 }

 
 
  function opennewwind(sDateiPfadName,w,h){
 	var doc = "";
	//alert(sDateiPfadName);
	doc = window.open(sDateiPfadName, 'SHOW',  "resizable=yes, status=no, scrollbars=yes, scrollbars=1, width=" + w + ", height=" + h);
  	doc.focus();
 }

 
 function openPictWind(pathDatei,w,h) { //v2.0
 
 	var winPic

  	winPic = window.open(pathDatei, 'PIC', "resizable=no, status=no, scrollbars=no, scrollbars=0, width=" + w + ", height=" + h);
  	winPic.focus();
	return;
}

 
 
 function DisplayMessage(text1,text2) 
 {

 if(is.ns)
         {
         alert(text2);
         } 
 else 
         {
         alert(text1);
         }
 }

 

/*Submit Rollovers*/

function submit_blue_hi(instanz){
  var instanz = instanz;
  /*alert ("er ist drin "+instanz);*/
  instanz.style.backgroundColor='#003399';
  instanz.style.color='#FFF';
  instanz.style.backgroundImage='url(/images/icons/ic_next_hi_blue_blue.gif)';
  return true;
}
function submit_blue_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='#010101';
  instanz.style.backgroundImage='url(/images/icons/ic_next_lo_blue_white.gif)';
  return true;
}

function submit_blue_back_hi(instanz){
  var instanz = instanz;
  /*alert ("er ist drin "+instanz);*/
  instanz.style.backgroundColor='#003399';
  instanz.style.color='#FFF';
  instanz.style.backgroundImage='url(/images/icons/ic_back_hi_blue_blue.gif)';
  return true;
}
function submit_blue_back_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='#010101';
  instanz.style.backgroundImage='url(/images/icons/ic_back_lo_blue_white.gif)';
  return true;
}
function submit_blue_grey_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='#010101';
  instanz.style.backgroundImage='url(/images/icons/ic_next_blue_grey.gif)';
  return true;
}

function submit_black_hi(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='#000000';
  instanz.style.color='#fff';
  instanz.style.backgroundImage='none';
  return true;
}
function submit_black_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='#666';
  instanz.style.backgroundImage='url(/images/color_default/icons/ic_arrow_right_black_white.gif)';
  return true;
}
function submit_black_black_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='rgb(1,1,1)';
  instanz.style.backgroundImage='url(/images/color_default/icons/ic_arrow_right_black_white.gif)';
  return true;
}


function submit_white_hi(instanz){
  var instanz = instanz;
  instanz.parentNode.style.backgroundColor='#fff';
  instanz.style.color='#000';
  instanz.style.backgroundImage='none';
  return true;
}
function submit_white_lo(instanz){
  var instanz = instanz;
  instanz.parentNode.style.backgroundColor='transparent';
  instanz.style.color='#fff';
  instanz.style.backgroundImage='url(/images/icons/ic_arrow_right_white_grey.gif)';
  return true;
}

function submit_up_blue_hi(instanz){
  var instanz = instanz;
  /*alert ("er ist drin "+instanz);*/
  instanz.style.backgroundColor='#003399';
  instanz.style.color='#fff';
  instanz.style.backgroundImage='url(/images/icons/ic_up_hi_blue_blue2.gif)';
  return true;
}

function submit_up_blue_grey_lo(instanz){
  var instanz = instanz;
  instanz.style.backgroundColor='transparent';
  instanz.style.color='#010101';
  instanz.style.backgroundImage='url(/images/icons/ic_up_lo_blue_light_blue.gif)';
  return true;
}


function display_switch(id) {
  	if (document.getElementById(id).style.display == "none" ) {
    	document.getElementById(id).style.display = "block";
  	} else {
    	document.getElementById(id).style.display = "none";
	}
  }
  


function windowOpen(pathDatei) { //v2.0
 
 	var win

  	win = window.open(pathDatei, 'PDF', 'resizable=yes,status=no,scrollbars=yes');
  	win.focus();
	return;
}



function newteasewindowopen(pathDatei, parPage) { //v2.0
 
 	var win
	var pageParameter = "resizable=yes, status=no, scrollbars=yes, scrollbars=1";
	
	if (parPage != ''){ pageParameter = pageParameter + ", " + parPage; }

  	win = window.open(pathDatei, 'PDF', pageParameter);
  	win.focus();
	return;
}



function startmeinedaten(formName){
	eval("document." + formName + ".submit();")
}


function formNwsAboStart(){
	document.nwsabo.submit();
}



function changePict(idLink, tempNewImageName){
	document.images[idLink].src = tempNewImageName;
}



function openPreisAnf(sLinkPA,sLang){
	var ANF
  	ANF = window.open(sLinkPA, "ANF", "resizable=yes, status=no, scrollbars=yes, scrollbars=yes, width=1000, height=800");
	ANF.focus();
	return;
}


function changeModPic(iNrPic, sTempPicNameBig, sTempPicNameZoom){
	
	document.images['produktphoto'].src = sTempPicNameBig;
	document.frmModellDaten.zoom_pict.value = sTempPicNameZoom;
}


function startFormSubmit(formName){
	eval("document." + formName + ".submit();")
}



//******************************* WARENKORB ****************************************************
var leer = 0;
var wohin = '/home/index.html';
var maxmenge = 20;

var MyObj;


function del_me(cnt,text1) {

	if (confirm(text1)) {
	
	var del = '';
	basket = parent.parent.basket.substring(0, parent.parent.basket.length-3);
	if (basket != null) items = basket.split('###');

	for (i in items) {
		 if (i != cnt) del += items[i] +'###';
	     }
 
 	parent.parent.basket = del;
	location.href = '/basket/index.asp';
	
	}

}


function update() {

	var upd = '';
	var tmp = '';

	for (i in items) {
		 upd += eval('document.forms[0].menge'+i+'.value')+'~';
         }

	upd = upd.substring(0, upd.length-1);
	upd = upd.split('~');

	for (i in items) {
	 	 items[i][3] = upd[i];
	 	 tmp += items[i][0]+ '|' +items[i][1]+ '|' +items[i][2]+ '|' +items[i][3]+ '###';
	 	 }

	parent.parent.basket = tmp;
	self.location = '/basket/index.asp';

}


function aktion(x,text1,text2) {

	if (x==1) {
		if (confirm(text1))
		   { parent.parent.basket = ''; parent.history.go(-1); }
		}
		
	if (x==2) {
		if (parent.parent.basket != "") top.inhalt.daten.location = '/basket/index.asp';
		else alert(text2);
		}
				
}


function gesamt () {

	var Gesamtgroesse = 0;
	var ItemGroesse
	
	for (i in items) {
		ItemGroesse = items[i][2]-0
		Gesamtgroesse = Gesamtgroesse + ItemGroesse;
	}
	return Gesamtgroesse;
}



