if(typeof(site) != "undefined") lurl=site;
function mdec(input) {
   var keyStr = "ijklsZa012tFRSTUVWXY34mnopqwxyzGHIJKLr5CDEhf6789+ABgu/=bcdevMNOPQ";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);
      if (enc3 != 64) output = output + String.fromCharCode(chr2);
      if (enc4 != 64) output = output + String.fromCharCode(chr3);
   } while (i < input.length);
   return output;
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
    try {
      if (oldonload) {
        oldonload();
      }
     } catch(err) {
     }
      func();
    }
  }
}

addLoadEvent(function() {
		// addScript('/scripts/snow.js');
		// setTimeout("if (!alreadyrunflag){putBanner();}", 0)
		// var st = document.createElement('script');
		// st.type = 'text/javascript'; st.async = true;
      // st.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://') + 's50.sitemeter.com/js/counter.js?site=s50plantia';
      // (document.getElementsByTagName('body')[0]).appendChild(st);
    }); 
	
addLoadEvent(function() { 
	var social = document.getElementById("socialDiv")

	if(social){
		var fbScript = document.createElement('script'); 
			fbScript.setAttribute("src","/scripts/social.js");
			fbScript.setAttribute("type","text/javascript");
			
			social.appendChild(fbScript);
					
			 var fb = document.createElement('fb:like'); 
			 fb.setAttribute("href", document.location); 

			 fb.setAttribute("send","true");
			 fb.setAttribute("show_faces","false");
			 fb.setAttribute("width","480");
			 document.getElementById("FbCont").appendChild(fb);

		
			 
			 
			var twShare = document.createElement('a'); 
			twShare.innerHTML = "Tweet";
			twShare.setAttribute("href","https://twitter.com/share");
			twShare.setAttribute("class","twitter-share-button");
			twShare.setAttribute("data-count","horizontal");
			twShare.setAttribute("data-via","plantiashop");
			twShare.setAttribute("data-lang","fr");
			social.appendChild(twShare);
			
			var twScript = document.createElement('script'); 
			twScript.setAttribute("src","//platform.twitter.com/widgets.js");
			twScript.setAttribute("type","text/javascript");
			
			social.appendChild(twScript);
		
			var twShare2 = document.createElement('a'); 
			twShare2.innerHTML = "Suivre @plantiashop";
			twShare2.setAttribute("href","https://twitter.com/plantiashop");
			twShare2.setAttribute("class","twitter-follow-button");
			twShare2.setAttribute("data-lang","fr");
			social.appendChild(twShare2);
			social.appendChild(twScript);
			
	}		
});	


	
small_window = 0;
function open_pop() {
	if (!small_window) {
		document.getElementById("lostclick").className='imageTipHover';
		
		small_window = document.createElement('div');
		small_window.setAttribute('name','small_window');
		
		//small_window.innerHTML = "asdasdasdasdasdasd";
					
		small_window.setAttribute('id','small_window');
		//small_window.setAttribute('onload','adjustMyFrameHeight();');
		small_window.style.border='0px';
		small_window.scrolling = 'no';
		small_window.frameBorder='0';
		//small_window.src= '/' + lang + '/retrieve_password.php';
		small_window = document.getElementById("forgotpass").appendChild(small_window);
		setTimeout('document.body.onclick = function () {close_pop()}',10);
	}
}

function close_pop() {
	document.getElementById("forgotpass").removeChild(small_window);
	document.getElementById("lostclick").className='SimpleTip';
	document.body.onclick = function () {}
	small_window = 0;
}


function open_pop2() {
	if (!small_window) {
		document.getElementById("lostclick2").className='imageTipHover';
		
		small_window = document.createElement('div');
		small_window.setAttribute('name','small_window');
		
		//small_window.innerHTML = "asdasdasdasdasdasd";
					
		small_window.setAttribute('id','small_window');
		//small_window.setAttribute('onload','adjustMyFrameHeight();');
		small_window.style.border='0px';
		small_window.scrolling = 'no';
		small_window.frameBorder='0';
		//small_window.src= '/' + lang + '/retrieve_password.php';
		small_window = document.getElementById("forgotpass2").appendChild(small_window);
		setTimeout('document.body.onclick = function () {close_pop2()}',10);
	}
}

function close_pop2() {
	document.getElementById("forgotpass2").removeChild(small_window);
	document.getElementById("lostclick2").className='SimpleTip';
	document.body.onclick = function () {}
	small_window = 0;
}



function open_popEx(objID) {
	if (!small_window) {
		document.getElementById("lostclick" + objID).className='imageTipHover';
		
		small_window = document.createElement('div');
		small_window.setAttribute('name','small_window');
		
		//small_window.innerHTML = "asdasdasdasdasdasd";
					
		small_window.setAttribute('id','small_window');
		//small_window.setAttribute('onload','adjustMyFrameHeight();');
		small_window.style.border='0px';
		small_window.scrolling = 'no';
		small_window.frameBorder='0';
		//small_window.src= '/' + lang + '/retrieve_password.php';
		small_window = document.getElementById("forgotpass" + objID).appendChild(small_window);
		setTimeout("document.body.onclick = function () {close_popEx(" + objID + ")}",10);
	}
}

function close_popEx(objID) {
	document.getElementById("forgotpass" + objID).removeChild(small_window);
	document.getElementById("lostclick" + objID).className='SimpleTip';
	document.body.onclick = function () {}
	small_window = 0;
}




var alreadyrunflag=0 //flag to indicate whether target function has already been run

if (document.addEventListener)
  document.addEventListener("DOMContentLoaded", function(){alreadyrunflag=1; putBanner(); }, false)
else if (document.all && !window.opera){
  document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
  var contentloadtag=document.getElementById("contentloadtag")
  contentloadtag.onreadystatechange=function(){
    if (this.readyState=="complete"){
      alreadyrunflag=1
      putBanner();
    }
  }
}


function putBanner(){
var myimage = document.body.getElementsByTagName('div');
	var x = "";
	if(document.getElementsByTagName('div')[25].innerHTML == "<h1>Zu Ihren Diensten</h1>"){
	for(i=0;i<myimage.length;i++){
		if(myimage[i].className == "leftside"){
			
			 newlinkChild = document.createElement("a");
			 newlinkChild.href = "/de/Bestellen-Plantia.html";
			 
			 newChild = document.createElement("img");
			 newChild.src = "/images/left_banner.jpg";
			 var divTag = document.createElement("div");

			 newlinkChild.appendChild(newChild);
			 
			 divTag.appendChild(newlinkChild); 
			 document.body.getElementsByTagName('div')[i].appendChild( divTag );
			 i=myimage.length;
		 }
	}
	}
}


function addScript(scriptName){

   var head= document.getElementsByTagName('head')[0];
   var script= document.createElement('script');
   script.type= 'text/javascript';
   script.src= scriptName;
   head.appendChild(script);
}

small_window = 0;
function open_lost_password() {
	if (!small_window) {
		document.getElementById("lostclick").className='imageTipHover';
		
		small_window = document.createElement('iframe');
		small_window.setAttribute('name','small_window');
		small_window.setAttribute('id','small_window');
		small_window.setAttribute('onload','adjustMyFrameHeight();');
		small_window.style.border='0px';
		small_window.scrolling = 'no';
		small_window.frameBorder='0';
		small_window.style.height = "200px";
		small_window.src= '/' + lang + '/retrieve_password.php';
		small_window = document.getElementById("forgotpass").appendChild(small_window);
		setTimeout('document.body.onclick = function () {close_lost_password()}',10);
	}
}

function close_lost_password() {
	document.getElementById("forgotpass").removeChild(small_window);
	document.getElementById("lostclick").className='SimpleTip';
	document.body.onclick = function () {}
	small_window = 0;
}

function adjustMyFrameHeight() {
	var frame = getElement("small_window");
	var frameDoc = getIFrameDocument("small_window");
	frame.height = frameDoc.body.offsetHeight;
}

function getElement(aID) {
	return (document.getElementById) ?
	document.getElementById(aID) : 

	document.all[aID];
}
function addScript(scriptName){
   var head= document.getElementsByTagName('head')[0];
   var script= document.createElement('script');
   script.type= 'text/javascript';
   script.src= scriptName;
   head.appendChild(script);
}
