/*################ BEGIN Images-functions ##################*/
function BildDown(DownURL,winfeatures) {
	window.open(DownURL,'Filedown','top=0,left=0' + (winfeatures ? (','+winfeatures) : '') );
}
function $(id)
{
	if (document.getElementById) return document.getElementById(id);
	else return false;
}
function getAttrib(selEl, nm, default_value)
{
	if(typeof(default_value) == "undefined") default_value = "";
	var v = default_value;
	if (selEl.getAttribute)
	{
		if (selEl.getAttribute(nm,0) != null) v = selEl.getAttribute(nm,0);
	}
	else if (selEl.attributes)
	{
		var oAttrColl = selEl.attributes;
		var oAttr = oAttrColl.getNamedItem(nm);
		if(oAttr != null) v = oAttr.value;
	}
	if (nm == "noWrap") v = selEl.noWrap;
	if (nm == "class") v = selEl.className;
	return '' + v;
}
var lastZInd = 1000;
function createLayer(namlay)
{
	if (typeof(namlay) == "undefined") return;
	if (!$(namlay))
	{
		b=document.createElement("div");
		var zI =  lastZInd + 1;
		b.style.cssText='visibility:hidden;position:absolute;z-index:' + zI.toString() + '';
		b.id = namlay;
		if (document.getElementsByTagName)
			document.getElementsByTagName("body")[0].appendChild(b);
		else if (document.all)
			document.all("body").parentNode.appendChild(b);
	}
}
function OpenFoto(BildURL, x, y) {
	var win = "";
	win = window.open("","bild",'height=' + y + ',width=' + x +',location=0,status=0,toolbar=no,resizable=0,scrollbar=no,top=0,left=0');
	win.document.writeln('<html><head><title>Das Bild</title>');
	win.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	win.document.writeln('</head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
	win.document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">');
	win.document.writeln('<tr><td align="center">');
	win.document.writeln('<a href="javascript:window.close()">');
	win.document.writeln('<img src="' + BildURL + '" border=0  alt="Fenster schließen">');
	win.document.writeln('</a></td></tr></table></body></html>');
	win.document.close();
	win.focus();
}
function in_array(needle, arr)
{
	var CurStr = new String("," + arr + ",");
	if (CurStr.indexOf("," + needle + ",") == -1) return false;
	else return true;
}
var allCollection = new Array();
var curPos = 0;
function getDoBildImgs(BILD)
{
	allCollection = new Array();
	if (document.getElementsByTagName)
		var elements=document.getElementsByTagName('a');
	else if (document.all)
		var elements=document.all('a');
	var txt;
	if(elements.length > 0)
	{
		var re=new RegExp("[ \t\n\r\f]","gi");
		for (var i = 0; i < elements.length; i++)
		{
			txt = new String(elements[i].href);
			if (txt.toLowerCase().indexOf("javascript:") == -1)
			{
				txt = new String(getAttrib(elements[i],"onclick"));
				if (txt.indexOf("DoBild(") != -1) txt = "javascript:"+txt;
			}
			txt = txt.replace(re, "");
			if (txt.toLowerCase().indexOf("javascript:") != -1 && txt.indexOf("DoBild(") != -1)
			{
				txt = txt.substring(txt.indexOf("'")+1, txt.lastIndexOf("'"));
				if (!in_array(txt, allCollection))
				{
					if (txt == BILD) curPos = allCollection.length;
					allCollection.push(txt);
				}
			}
		}
	}
}
function DoBild(BILD)
{
	//getDoBildImgs(BILD);
	if (DoBildWindowClose == "") DoBildWindowClose = "Bitte klicken zum Verkleinern";
	var x = 0;
	var y = 0;

	if (typeof window.pageXOffset != 'undefined')
	{
		x = window.pageXOffset;
		y = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined')
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}

	if (!document.getElementById("sashadow"))
	{
		var b = document.createElement("div");
		b.id = "sashadow";
		b.style.display = "none";
		b.innerHTML = "&nbsp;";
		addEvent(b, "click", HideImage);
		document.getElementsByTagName("body")[0].appendChild(b);
	}
	if (!document.getElementById("imagelayer"))
	{
		var b = document.createElement("div");
		b.id = "imagelayer";
		b.style.display = "none";
		document.getElementsByTagName("body")[0].appendChild(b);
	}
	
	var b_g = document.getElementById("sashadow");
	var b_i = document.getElementById("imagelayer");

	b_i.style.left = x+"px";
	b_i.style.top = y+"px";

	var h = 0, w = 0;
	if (document.documentElement) h = parseInt(document.documentElement.scrollHeight);
	if (document.body.scrollHeight > h) h = parseInt(document.body.scrollHeight);
	if (document.body.clientHeight > h) h = parseInt(document.body.clientHeight);
	if (h > 0)
	{
		if (!document.all) h += 20;
		b_g.style.height = h+"px";
	}

	if (document.documentElement) w = parseInt(document.documentElement.scrollWidth);
	if (w == 0) h = parseInt(document.body.scrollWidth);
	if (document.body.clientWidth > w) w = parseInt(document.body.clientWidth);
	if (w > 0) b_g.style.width = w+"px";


	b_i.innerHTML = "<table border=0 cellspacing=0 cellpadding=1 style='width:100%;height:100%;'><tr><td align='center' valign='middle'><table border=0 cellspacing=0 cellpadding=8 bgcolor=#FFFFFF><tr><td bgcolor=#FFFFFF><a href='#' onclick='HideImage();return false;' id='ecomasResizedLink' style='text-decoration:none;color:#999;'><div align='right' style='padding:2px 0 2px;'>" + DoBildWindowClose + " <span style='padding:1px 4px 0 4px;'>X</span></div><img src='" + BILD + "' alt='" + DoBildWindowClose + "' title='" + DoBildWindowClose + "' class='BildHidden' onLoad='resizeImage()' width='1' height='1' id='ecomasResizedImage'><img src='http://www.babyonlineshop.de/navigation/img_load.gif' id='ecomasLoadImage' width='42' height='12' border='0' onClick='HideImage();'></a><div id='ArraowsLayer' style='display:none;'></div></td></tr></table></td></tr></table>";

	b_g.style.display = "";
	b_i.style.display = "";
}
function HideImage()
{
	var b_g = document.getElementById("sashadow");
	var b_i = document.getElementById("imagelayer");
	b_g.style.display = "none";
	b_i.style.display = "none";
}
function resizeImage()
{
	var ibj = document.getElementById("ecomasResizedImage");
	var img = new Image();
	img.src = ibj.src;
	var cS = 1;
	var sta = img.width/cS;
	var stb = img.height/cS;
	document.getElementById("ecomasLoadImage").style.display = "none";
	ibj.className = "BildVisible";
	dynamicImage(1,1,img.width,img.height,sta, stb);
}
function dynamicImage(wc,hc,w,h,sta,stb)
{
	var ibj = document.getElementById("ecomasResizedImage");
	wc = Math.round(wc + sta);
	hc = Math.round(hc + stb);
	if (wc >= w) wc = w;
	if (hc >= h) hc = h;
	ibj.width = wc;
	ibj.height = hc;
	if (wc == w || hc == h)
	{
		if(allCollection.length > 0)
		{
			document.getElementById("ArraowsLayer").style.display = "";
			document.getElementById("ArraowsLayer").style.paddingTop = "3px";
			var  HTML = "";
			if (curPos < (allCollection.length -1))
				HTML = "<img src='http://www.babyonlineshop.de/navigation/img_arrow_r.gif' align='right' style='cursor:pointer;' onClick='DoBild(\"" + allCollection[parseInt(curPos)+1] + "\");'>";
			if (curPos > 0)
				HTML += "<img src='http://www.babyonlineshop.de/navigation/img_arrow_l.gif' align='left' style='cursor:pointer;' onClick='DoBild(\"" + allCollection[parseInt(curPos)-1] + "\");''>";
			document.getElementById("ArraowsLayer").innerHTML = HTML;
		}
		return;
	}
	window.setTimeout("dynamicImage(" + wc + ","+ hc +"," + w + "," + h + "," + sta + "," + stb + ")", 0);
}
/*################ END Images-functions ####################*/
/*############## BEGIN Comment-functions ###################*/
/***   Editable: ***/
var backcolor	= '#ffffe1';		// Hintergrund
var bordercolor	= '#000';			// Ramenfarbe
var textcolor	= '#000';			// Textfarbe
var displaytime	=  30000;		// Zeit
var tablewidth	=  230;			// Tabellenbreite in px
var object	= 'Layer2';		// objekt - Ebene ID
/*******************/
var tipTimer = false;			// dHTML Toolltip Timer

function hideKommentar() 
{
	if (document.getElementById)
	{
		if (tipTimer) window.clearTimeout(tipTimer);
		tipTimer = false;
		document.getElementById(object).style.visibility="hidden";
		document.getElementById(object).style.left = -200;
		document.getElementById(object).style.top = -200;
		return false;
	}
	else return true;
}

function showKommentar(e, tipContent)
{
	if (!document.getElementById) return true;
	if (tipTimer) window.clearTimeout(tipTimer);
	document.getElementById(object).innerHTML='<div style="text-align:left; font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: 1px solid '+bordercolor+'; background-color: '+backcolor+'; padding:4px; width:'+tablewidth+'px; max-width:'+tablewidth+'px; color: '+textcolor+';">'+unescape(tipContent)+'</div>';
	var top = 0, left = 0;

	if (typeof window.pageXOffset != 'undefined')
	{
		left = window.pageXOffset;
		top = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
	{
		left = document.documentElement.scrollLeft;
		top = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined')
	{
//		left = document.body.scrollLeft;
//		top = document.body.scrollTop;
	}
	left = parseInt(left);
	top = parseInt(top);
	if (e.x)
	{
		left += e.x;
		top += e.y;
		if ( (left + tablewidth + 20) > (document.body.clientWidth + document.body.scrollLeft)) left =  left - tablewidth;
	}
	else if (e.clientX)
	{
		left += e.clientX;
		top += e.clientY;
		if ( (left + tablewidth + 20) > (window.pageXOffset + window.innerWidth) ) left =  left - tablewidth;
	}
	left = parseInt(left) - 10;
	top = parseInt(top) + 20;

	document.getElementById(object).style.top = top.toString()+"px";
	document.getElementById(object).style.left = left.toString()+"px";
	document.getElementById(object).style.visibility="visible";
	tipTimer = window.setTimeout("hideKommentar('"+object+"')", displaytime);
	return true;
}

/*############### END Comment-functions ####################*/

function CheckSendForm(formname) {
	if(typeof(formname) == "undefined") formname = "ecomasform";
	eval("var f = document." + formname);
	var dothis = true;
         var arrCheck = new Array();	
         var arrElements = new Array();
         var TMP = new Array();
	for (i = 0; i < f.elements.length; i++) 
         {
                  NameIndex="";
		if (f.elements[i].title != "") 
                  {
                      NameIndex=f.elements[i].name;
                      if(!TMP[NameIndex])                      
                      {
                        TMP[NameIndex]=1;
                        arrElements[arrElements.length]=NameIndex;
                        if(!arrCheck[NameIndex])arrCheck[NameIndex]=new Array();
                      } 
		       
                      if (f.elements[i].type == "text") 
                      {
                               if(f.elements[i].value == "")
				arrCheck[NameIndex]['check']=0;
                               else  arrCheck[NameIndex]['check']=1;
                      }
		    else if (f.elements[i].type == "checkbox" || f.elements[i].type == "radio")
		    {	
                                if( f.elements[i].checked == false && !arrCheck[NameIndex]['check'])
                                  arrCheck[NameIndex]['check']=0;
                                else if(f.elements[i].checked == true)
                                   arrCheck[NameIndex]['check']=1;
                       }
			
                       arrCheck[NameIndex]['title'] = f.elements[i].title;
                       arrCheck[NameIndex]['index'] = i;

		}
	}


         for(j=0;j< arrElements.length;j++)
         {            if(arrCheck[arrElements[j]]['check']==0)
            {
             dothis=false;
             alert(arrCheck[arrElements[j]]['title']);
             f.elements[arrCheck[arrElements[j]]['index']].focus();
             break;
            }
         }
	
         //if(dothis)alert('true');
         //else alert('false');

	return dothis;
}


var cssHref = "";
function MakeFontSize(s)
{
	if (document.getElementById)
	{
		var Dt = new Date();
		if (cssHref == "") cssHref = document.getElementById("cssLink").href;
		if (document.getElementById("cssLink")) document.getElementById("cssLink").href = cssHref+"?t=" + Dt.getTime() + "&s="+s;
	}
}

// Suchbegr. 
function Validate()
{
	errfound = false;
	if(document.search.suchbegriff.value == "" || document.search.suchbegriff.value == "Produktsuche")
	{
      		alert("Geben Sie bitte den Suchbegriff ein.");
		document.search.suchbegriff.focus();
	} else errfound = true;
	return errfound; 
}

function getParam(nm) {
var cons = nm + '=';
var ps = window.location.search;
 if (ps.length > 0) {
     var start = ps.indexOf(cons);
	 if (start != -1) {
	     start += cons.length;
		 var end = ps.indexOf('&',start);
		 if (end == -1) end = ps.length;
		  return unescape(ps.substring(start,end));
	}
}
   return null;
}

// Inhalt
function ShowHighLights()
{
	if (document.getElementById("PrintBody")) return;
	createLayer("Layer1");
	createLayer("Layer2");
	if (typeof(Ebene1ID) == "undefined") return;
	//try {
		if (Ebene1ID != "" && Ebene1ID != 0)
		{
			var obj = document.getElementById("lay_" + Ebene1ID);
			obj.className = obj.className.replace("bosNavigation","bosNavigationAct","g");
		}	
		if (Ebene2 != "") document.getElementById("Link" + Ebene2).className = "act";	
		if (Ebene3 != "") document.getElementById("Link" + Ebene3).className = "act";
		if (Ebene4 != "") document.getElementById("Link" + Ebene4).className = "act";
//	} catch(e) {}
//	CheckFontSize();

	//if (document.ecomasform) FindFirstField();

	var sstr = getParam("herst");
	if (sstr != null)
	{
		document.getElementById("herst_all").className = "";
		document.getElementById("herst_" + sstr).className = "herst_act";

	}
	sstr = getParam("suchbegriff");
	if (sstr != null)
	{
		sstr = str_replace(sstr, String.fromCharCode(153), "™","gi");
		sstr = str_replace(sstr, String.fromCharCode(8482), "™","gi");
		sstr = str_replace(sstr, String.fromCharCode(128), "€","gi");
		sstr = str_replace(sstr, String.fromCharCode(8364), "€","gi");
		sstr = str_replace(sstr, "[\+]", " ","gi");
		document.search.suchbegriff.value = sstr;
	}

	if (typeof(ShopLogin_Target) == "undefined") ShopLogin_Target = "_self";
	if(document.getElementById("shoplogin_link") && document.getElementById("shoplogin_link").target)
		document.getElementById("shoplogin_link").target = ShopLogin_Target;
	LoadSearchhelp();

	if (typeof(tooltip) != "undefined") tooltip.init();
	TollsTrasparent();
	addEvent(window,"resize",TollsTrasparent);
	loadScript("/ferien_2008.js.php");
}

var hc = 0, h = 0, hsb = 0, stransprt = false;
function TollsTrasparent()
{
	if (window.innerHeight) hc =  parseInt(window.innerHeight);
	else if (document.documentElement.clientHeight) hc =  parseInt(document.documentElement.clientHeight);
	else if (document.body.clientHeight) hc =  parseInt(document.body.clientHeight);
	if (document.documentElement) h = parseInt(document.documentElement.scrollHeight);
	if (document.body.scrollHeight > h) h = parseInt(document.body.scrollHeight);
	if (document.body.clientHeight > h) h = parseInt(document.body.clientHeight);
	if (hc == 0 || h == 0) return;

	if (!stransprt)
	{
		addEvent($("dInfoarea"),"mouseover",function() { $("dInfoarea").className = ""; });
		addEvent($("dInfoarea"),"mouseout",SetTransp);
		addEvent(window,"scroll",SetTransp);
	}
	SetTransp();
}
function SetTransp()
{
	if (typeof window.pageXOffset != 'undefined') hsb = parseInt(window.pageYOffset);
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') hsb = document.documentElement.scrollTop;
	else if (typeof document.body != 'undefined') hsb = document.body.scrollTop;
	else hsb = h;
	if(hc+10+hsb < h) $("dInfoarea").className = "opct";
	else  $("dInfoarea").className = "";
}

function str_replace(in_str, reg_exp, replace_str, opts)
{
	if(in_str==null) return in_str;
	if(typeof(opts)=="undefined") opts='g';
	var re=new RegExp(reg_exp,opts);
	return in_str.replace(re,replace_str);
}

function loadScript(url)
{
	if (document.createElementNS)
		var se=document.createElementNS('http://www.w3.org/1999/xhtml','script');
	else if (document.createElement)
		var se=document.createElement('script');

	if (typeof (se) != "undefined")
	{
		se.setAttribute('language','javascript');
		se.setAttribute('type','text/javascript');
		se.setAttribute('src', url );

		if (document.getElementsByTagName)
			document.getElementsByTagName("head")[0].appendChild(se);
		else if (document.all)
			document.all("head").parentNode.appendChild(se);

		return true;
	}
	else return false;
}

var ac = false, accounter = 0;
function loadAC()
{
	if (accounter > 10) return;
	if (typeof(listAdvice_Class) == "undefined")
	{
		window.setTimeout("loadAC()",100);
		accounter++;
		return;
	}
	
	if (!ac)
	{
		ac = new listAdvice_Class();
		ac.init({
			adv_emnts : "document.search.suchbegriff",
			keytokey : {"document.search.suchbegriff":"suchbegriff"},
			elmb_url : {"document.search.suchbegriff":"/scripts/list_keywords.php?langid=1&bgnstr={STRING}&t={TIME}"}
		});
		if (!ac.loaded) ac.onLoad();
	}
}
function LoadSearchhelp()
{
	if (!loadScript("/scripts/dCatalogue.js")) return;
	window.setTimeout("loadAC()",100);
}
function addEvent(o,n,h)
{
	if(o.attachEvent) o.attachEvent("on"+n,h);
	else if (o.addEventListener) o.addEventListener(n,h,false);
}
function cancelEvent (e)
{
	try
	{
		if (typeof(e) == "undefined") e = window.event;
		if (typeof(e) == "undefined") return false;
		if(e.preventDefault)
		{
			e.preventDefault();
		}
		else
		{
			e.returnValue=false;
			e.cancelBubble=true;
		}
	}
	catch(e) {}
	return false;
}

addEvent(window, "load", ShowHighLights);
//document.oncontextmenu = cancelEvent;
//document.onselectstart = cancelEvent;
//document.ondragstart = cancelEvent;

//##### Stokke Artikel ####
var TTArray = new Array(3004040022, 3004040023, 3004040032, 3004040033, 3004040042, 3004040043, 3004040052, 3004040053, 3004040062, 3004040063, 3004040072, 3004040073, 3004040082, 3004040083, 3004040092, 3004040093, 3004040112, 3004040113, 3004040122, 3004040123, 3004040132, 3004040133, 3004040142, 3004040143, 3004040152, 3004040153, 3004040162, 3004040163);