numberform=0;
tpaffiche=1000;
readytop=false;


// ROLL EN FADE. IE 5.5 & 6.0 ONLY !!!!!

//identification de IE 5.5 et 6.0
if (document.all && (navigator.appVersion.indexOf('5.5') != -1 || navigator.appVersion.indexOf('6.0') != -1 )) varfilter=true;
else varfilter=false;

tempofade=false;
timetempofade=50;
// valeur alpha
Tfade=new Array(new Array(),new Array(),new Array(0,90,90,90,90,90,90),new Array(0,90,90,90),new Array(0,90,90,90),new Array(0,90,90),new Array(0,90,90,90,90),new Array(0,90,90,90),new Array(0,90,90));
// sens du fade
Tsensfade=new Array(new Array(),new Array(),new Array(0,10,10,10,10,10,10),new Array(0,10,10,10),new Array(0,10,10,10),new Array(0,10,10),new Array(0,10,10,10,10),new Array(0,10,10,10),new Array(0,10,10));

function fadeit(m,n){
	Tfade[m][n]+=Tsensfade[m][n];
	objimgtop=eval("document.navtop"+m+"_"+n+";");
	objimgtop.style.filter="alpha(opacity="+Tfade[m][n]+")";	
	if (Tfade[m][n] !=0 && Tfade[m][n] !=100) tempofade=setTimeout('fadeit('+m+','+n+')',timetempofade);
	else {
		if (Tsensfade[m][n]==10)Tfade[m][n]=90;
		else Tfade[m][n]=10;
	}
}
// FIN ROLL EN FADE.

function IS_top(m,n,o) {
	if(readytop){
		if (!varfilter){
		objimgtop=eval("(document.layers)?document.forms[0].navtop"+m+"_"+n+":document.navtop"+m+"_"+n+";");
		objimgtop.src = eval("'/img/_de/_de/nav/nav_top/de_de_nav_"+m+"_"+n+"_"+o+".gif'");
		}
		else {
			if (o=="off")Tsensfade[m][n]=10;else Tsensfade[m][n]=-10;
			fadeit(m,n);
		}
	}
}

function gosearch(n,numberform){

	var mf = GetMainFormName();
	if (!mf) return;
	
	var n2 = "";
	var str2 = "";
	var cat = "";
	if (numberform) {

		str=eval ("document.forms[mf].search"+numberform);
		var cptspace = 0;
		for (i=0;i<str.value.length;i++) {
			if(str.value.charAt(i)==" ") {
				str2+="%20";
				cptspace++;
			}
			else {
				str2+=str.value.charAt(i);
			}
		}
		if (str.value.length==cptspace || str.value.length==1) {
			str2="Nach Stichwort";	
		}
		n2 = n + str2 + '&catcode=';		
	} else {
		var str = document.getElementById('search-box');
		var cptspace = 0;
		for (i=0; i<str.value.length; i++) {
			if(str.value.charAt(i) == " ") {
				str2 += "%20";
				cptspace++;
			} else {
				str2+=str.value.charAt(i);
			}
		}
		if (str.value.length==cptspace || str.value.length==1) {
			str2="Nach Stichwort";
		}
		n2 = n + str2 + '&catcode=';	
	}
	
    if(str2=='%20Nach%20Stichwort%20')
	{
	}
	else if(str2=='Nach%20Stichwort')
	{
	}
	else
	{
	location.href = n2;
	}
}	
function search_onfocus(el){
	var mf = GetMainFormName();
	if (mf==null) return;
	el.value = '';
}



tmp2=false;
lay_top_current=0;


function init2(){
	for(i=1; i<9; i++){
		eval("navhoff"+i+"=new Image();");
		eval("navhoff"+i+".src='/img/_de/_de/nav/nav_top/de_de_nav_"+i+"_off.gif';");
		eval("navhroll"+i+"=new Image();");
		eval("navhroll"+i+".src='/img/_de/_de/nav/nav_top/de_de_nav_"+i+"_roll.gif';");
	}
	if (navhaut){
		eval("navhoff"+navhaut+".src='/img/_de/_de/nav/nav_top/de_de_nav_"+navhaut+"_roll.gif';");
		objnh = eval("document.navh"+navhaut);
		if (objnh) objnh.src = eval("navhoff"+navhaut+".src");
	}
	readytop=true;
}

function affiche(x){
	if(readytop){
		if (tmp2) clearTimeout(tmp2);
		if (x!= lay_top_current) cache();
		if (x!=1){
			objlaynavh = eval("(document.all)?document.all.laynavh"+x+".style:(document.layers)?document.laynavh"+x+":document.getElementById(\"laynavh"+x+"\").style");
			objlaynavh.visibility="visible";
		}
		objnh = eval("document.navh"+x);
		if (objnh) objnh.src = eval("navhroll"+x+".src");	
		lay_top_current=x;
	}
}

function cache(){
	if(readytop){
	for(i=2; i<9; i++){
		objlaynavh = eval("(document.all)?document.all.laynavh"+i+".style:(document.layers)?document.laynavh"+i+":document.getElementById(\"laynavh"+i+"\").style");
		objlaynavh.visibility="hidden";
	}
	for(i=1; i<9; i++){
		objnh = eval("document.navh"+i);
		if (objnh) objnh.src = eval("navhoff"+i+".src");
	}
	lay_top_current=0;
	}
}

function hide(n){tmp2=setTimeout('cache()',tpaffiche);}

function GetMainFormName()
	{
		var i;
		for (i=0;i<document.forms.length;i++)
		{
			if ((document.forms[i].name.indexOf("_aspnetForm") != -1) || (document.forms[i].name.indexOf("__aspnetForm") != -1) || (document.forms[i].name.indexOf("_ServerForm") != -1))
				return document.forms[i].name;
		}
		return null;
	}
	
function GetElementName(n, mf)
	{
		if (n==null || n=="") return null;
		var i, s, j;
		for (i=0;i<document.forms[mf].elements.length;i++)
		{
			if (document.forms[mf].elements[i].name.toLowerCase().indexOf(n.toLowerCase()) != -1)
				return document.forms[mf].elements[i].name;
		}
		return null;
	}	
	
function setProductCount(count)
	{
		if(!document.images) return;
		var counter = document.images["prodcount"];
		if(counter)
		{
			counter.src = "/img/_de/_de/00nav/b_top_articles_" + count + ".gif";
		}
	}
	
function setBagCount(count)
	{
		if(!document.images) return;
		var counter = document.images["bag"];
		if(counter)
		{
			counter.src = "/img/_de/_de/bag_" + count + ".gif";
		}
	}
	

	function QueryStringtop( param )
	{
		var begin,end;
		if(self.location.search.length>1)
		{
			begin=self.location.search.indexOf(param) +param.length+1;
			end=self.location.search.indexOf("&",begin);
			if(end==(-1)) end=self.location.search.length;
			//return(self.location.search.substring(begin,end));
			strl1=self.location.search.substring(begin+1,end-1);
			strl2="";
			
			for (i=0;i<strl1.length;i++) {
				if(strl1.charAt(i)=="%" && strl1.charAt(i+1)=="2" && strl1.charAt(i+2)=="0"){
				strl2+=" ";
				i++;
				i++;
				}
				else {
					strl2+=strl1.charAt(i);
				}
			}
			
			document.getElementById('search-box').value = strl2;
			// document.forms[0].search.value=strl2;
			document.forms[0].search2.value=strl2;
		}
		else if(self.location.hash.length>1)
		{
			begin=self.location.hash.indexOf(param) +param.length+1;
			end=self.location.hash.indexOf("&",begin);
			if(end==(-1)) end=self.location.hash.length;
			//return(self.location.hash.substring(begin,end));
			strl1=self.location.hash.substring(begin+1,end-1);
			strl2="";
			
			for (i=0;i<strl1.length;i++) {
				if(strl1.value.charAt(i)=="%" && strl1.value.charAt(i+1)=="2" && strl1.value.charAt(i+2)=="0"){
				strl2+=" ";
				i++;
				i++;
				}
				else {
					strl2+=strl1.value.charAt(i);
				}
			}
			document.getElementById('search-box').value = strl2;
			//document.forms[0].search.value=strl2;
			document.forms[0].search2.value=strl2;
		}
		//else return("");
	}
	
function onUnloadEZFActiveX(flagDisposeMandatory)
	{
		//alert('onUnloadEZFActiveX');
		if (flagDisposeMandatory || etatEzface == 2)
		{
			//alert(flagDescactiv);
			if (!flagDisposeMandatory)
			{
				if (!flagDescactiv)
				{
					DeleteCCBTempLook();
					SaveCCBTempLook();
				}
			}
			DisposeEZfaceActiveX();
		}
	}
	
	
/***** ERROR ******/
	
// hide the error layer	
function hideerror(n){
	if(n=="")n=0;
	var x = document.getElementById('errorpopup'+n);
	ifrlayer.kill(x);
	x.style.visibility='hidden';
}
// show the error layer	
function showerror(){
	document.getElementById('errorpopuphidden').style.visibility='visible';
	ifrlayer.make("errorpopuphidden");
	document.location.href = '#';
}
// hide the error layer	
function hideerrorhidden(){
	document.getElementById('errorpopuphidden').style.visibility='hidden';
	ifrlayer.kill("errorpopuphidden");
}


// build the error layer	
function writeerror(txt,n){
	if(n=="")n=0;
	output = [
		"<div id=\"errorpopup"+n+"\" style=\"POSITION:absolute;TOP:100px; LEFT:250px;width:281px;visibility: visible;z-index:10"+n+"\">",
		"<table width=\"281\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">",
		"<tr bgcolor=\"#c96597\">",
		"	<td colspan=\"3\"><img src=\"/img/_de/_de/common/txt_error_top.gif\" alt=\"\"></td>",
		"</tr>",
		"<tr bgcolor=\"#c96597\">",
		"	<td width=\"40\" nowrap></td>",
		"	<td style=\"font-size:12px;font-family: arial;color:#FFFFFF;font-weight:600;\">"+txt+"</td>",
		"	<td width=\"20\" nowrap></td>",
		"</tr>",
		"<tr bgcolor=\"#c96597\">",
		"	<td colspan=\"2\" align=\"right\" height=\"33\"><a href=\"javascript:hideerror("+n+");\"><img src=\"/img/_de/_de/common/txt_bt_close.gif\" alt=\"\" vspace=\"10\" border=\"0\"></a></td>",
		"	<td></td>",
		"</tr>",
		"</table>",
		"</div>"
	]
	//if(txt.length>2) 
	document.write(output.join('\n'));
	setTimeout("ifrlayer.make('errorpopup"+n+"')",500);
//	ifrlayer.make("errorpopup"+n);
}	
// build the error layer (visible=hidden)	
function writeerrorhidden(txt){
	output = [
		"<div id=\"errorpopuphidden\" style=\"POSITION:absolute;TOP:100px; LEFT:300px;width:281px;visibility: hidden;z-index:100\">",
		"<table width=\"281\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">",
		"<tr bgcolor=\"#c96597\">",
		"	<td colspan=\"3\"><img src=\"/img/_de/_de/common/txt_error_top.gif\" alt=\"\"></td>",
		"</tr>",
		"<tr bgcolor=\"#c96597\">",
		"	<td width=\"40\" nowrap></td>",
		"	<td style=\"font-size:12px;font-family: arial;color:#FFFFFF;font-weight:600;\">"+txt+"</td>",
		"	<td width=\"20\" nowrap></td>",
		"</tr>",
		"<tr bgcolor=\"#c96597\">",
		"	<td colspan=\"2\" align=\"right\" height=\"33\"><a href=\"javascript:hideerrorhidden();\"><img src=\"/img/_de/_de/common/txt_bt_close.gif\" alt=\"\" vspace=\"10\" border=\"0\"></a></td>",
		"	<td></td>",
		"</tr>",
		"</table>",
		"</div>"
	]
	//if(txt.length>2) 
	document.write(output.join('\n'));
}


//Genere une iframe sous un layer (corrige bug IE)
ifrlayer = {
	make:function(obj) {
		if(!obj) return; obj = (typeof(obj)=="string") ? document.getElementById(obj) : obj; if(!obj) return;
		if((document.getElementsByTagName("select").length>0 || document.getElementsByTagName("embed").length>0 || document.getElementsByTagName("object").length>0) && document.all && document.getElementById && !window.opera) {
			if(obj.parentNode && !obj.iframelayer) var ifr = obj.parentNode.insertBefore(document.createElement("iframe"), obj);
			else return;
			if(obj.currentStyle.zIndex != "" && parseInt(obj.currentStyle.zIndex)>1 ) {
				ifr.style.zIndex = parseInt(obj.currentStyle.zIndex)-1;
			}
			ifr.src = "about:blank";
			with(ifr.style) { 
				filter = "alpha(opacity=0)";
				position = "absolute";
				width =  obj.offsetWidth+"px";
				height =  obj.offsetHeight+"px";
			}
			obj.iframelayer = ifr;
			ifrlayer.move(obj)
		}
	},
	kill:function(obj) {
		if(!obj) return; obj = (typeof(obj)=="string") ? document.getElementById(obj) : obj; if (!obj) return;
		var ifr = obj.iframelayer;
		if(ifr && ifr.parentNode) {
			ifr.parentNode.removeChild(ifr);
			obj.iframelayer = null
		}
	},
	move:function(obj) {
		if(!obj || !obj.iframelayer) return;
		with(obj.iframelayer.style) {
			top = obj.offsetTop+"px";
			left =obj.offsetLeft+"px";
		}
	}
}


