// (c) vondir.de //

 var viewportwidth=0;
 var viewportheight=0;
 
 
function maxViewport() {
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 
 
 }
 
function closePopUp(target){
//alert(target.id);
}
 
//http://www.webmasterworld.com/forum91/1000.htm
 
function zoom1clicker(image){
	alert(image);
}
function zoom1loaded(){
	document.getElementById('zoom1ani').innerHTML='';
}
function zoom1load(){
	document.getElementById('zoom1ani').innerHTML='<img src=\"/js/scriptaculous/lw/ajax-loading.gif\">';
}


function recommendThis(url){
		var mWidth= 870;
		return zoomHTML(url,"vondir_de_divpoplayer_invite",mWidth);
}

function zoomHTML(url,pi,mWidth){

	var thediv=document.getElementById('zoom1displaybox');
	var thediv2=document.getElementById('zoom1displaybox2');
 
	maxViewport();
	//alert(viewportwidth);
 
	//var mHeight= 330;
	var mHeight= viewportheight-60;
    //var mWidth= viewportwidth-80;
 
	try {
		//stop flash on startpage
		stopstartpagehighlights();
	}catch(err)
  {
  //Handle errors here
  }
 
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv2.style.display = "";
		var popup = "<div onclick='return closePopUp(this)' style=\"text-align:center;width:100%;margin-top:40px;\"><div onclick='return closePopUp(this)' class=\"zoom1inbox\" style=\"margin:auto;width:"+mWidth+"px;height:"+mHeight+"px;zIndex:999;\">";
		popup += "<div style=\"width:"+(mWidth-10)+"px;height:"+(mHeight-70)+"px;\" >";
		popup += "<div style=\"text-align:right;width:"+(mWidth-18)+"\" ><a style=\"font-size:10px;color:#000;text-decoration:underline;\" href='#' onclick='return clicker();'>[x]schliessen</a></div>";
		popup += "<iframe width=\""+(mWidth-4)+"\" height=\""+(mHeight-30)+"\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\""+url+"\" style=\"margin:0px;\"></iframe>";
		if (pi != ""){
			popup += "<img src=\"/tools/pi?id="+pi+"\">";
		}
		popup += "</div>";

		popup += "</div></div>";
		thediv2.innerHTML = popup;
 
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
		thediv2.style.display = "none";
		thediv2.innerHTML = '';
	}
	return false;
}


function zoomPopUp(url,pi,mWidth,mHeight){

	var thediv=document.getElementById('zoom1displaybox');//blackbackground - background-color:#000000;
	var thediv2=document.getElementById('zoom1displaybox2');

	if (mWidth == null){ 
    	mWidth= viewportwidth-80;
	}
	if (mHeight == null){
		mHeight= viewportheight-60;
	}
 
	try {
		//stop flash on startpage
		stopstartpagehighlights();
	}catch(err) { }
 
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv2.style.display = "";
		thediv2.innerHTML = "";
		var popup = "<div onclick='return closePopUp(this)' style=\"text-align:center;width:100%;margin-top:40px;\"><div onclick='return closePopUp(this)' class=\"zoom1inbox\" style=\"border:6px solid #878787;margin:auto;width:"+mWidth+"px;height:"+mHeight+"px;zIndex:999;overflow:hidden;\">";
		popup += "<iframe width=\""+(mWidth-2)+"\" height=\""+(mHeight-2)+"\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\""+url+"&rnd="+parseInt( Math.random()*100)+"\" style=\"border:0px solid #f00;\"></iframe>";
		if (pi != ""){
			popup += "<img src=\"/tools/pi?id="+pi+"\" width=\"1\" height=\"1\">";
		}
		popup += "</div></div>";
		thediv2.innerHTML = popup;
 
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
		thediv2.style.display = "none";
		thediv2.innerHTML = '';
	}
	return false;
}





function userWelcome(searchfor,type){
	var thediv=document.getElementById('zoom1displaybox');
	var thediv2=document.getElementById('zoom1displaybox2');
 
	maxViewport();
	//alert(viewportwidth);
 
	var mHeight= 330;
	var mWidth= 670;
	
 
 
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv2.style.display = "";
		var popup = "<div onclick='return closePopUp(this)' style=\"text-align:center;width:100%;margin-top:40px;\"><div onclick='return closePopUp(this)' class=\"zoom1inbox\" style=\"margin:auto;width:"+mWidth+"px;height:"+mHeight+"px;\">";
		popup += "<div style=\"width:"+(mWidth-10)+"px;height:"+(mHeight-70)+"px;\" >";
		popup += "<div style=\"text-align:right;width:"+(mWidth-18)+"\" ><a style=\"font-size:8px;color:#000;text-decoration:underline;\" href='#' onclick='return clicker();'>[x]schliessen</a></div>";
		popup += "<h2>56.000 Unikate gibts hier!</h2> St&ouml;bere und entdecke mehr als nur einen<br> "; //"+searchfor+"   ";
		popup += "<br>";
		popup += "<a style=\"border:1px solid #2F62FE;background-color:#D2EBF8;padding:5px;font-size:20px;color:#000;text-decoration:underline;font-weight:bold;\" href='#' onclick='return clicker();'>Nein danke, jetzt gefundenen Artikel zeigen</a>";
		popup += "<br>";
		popup += " <br>oder viel mehr entdecken zB:<br>";
		//popup += "<iframe width=\"510\" height=\"200\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\"http://www.vondir.de/tools/newestarticles.pl\"></iframe>";
		popup += "<iframe width=\"670\" height=\"130\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\"/pages/userWelcome.html\"></iframe>";
		popup += "<img src=\"/tools/pi?id=vondir_de_divpoplayer_"+type+"\">";
		popup += "</div>";

		popup += "</div></div>";
		thediv2.innerHTML = popup;
 
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
		thediv2.style.display = "none";
		thediv2.innerHTML = '';
	}
	return false;
}

function topWelcome(username,type){
	var thediv=document.getElementById('zoom1displaybox'); // grauer hintergrund
	var thediv2=document.getElementById('zoom1displaybox2');
 
	maxViewport();
	//alert(viewportwidth);
 
	var mHeight= 100;
	var mWidth= 940;
	
 
 
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv.style.height = "100px";
		thediv.style.width = "100%";
//		thediv.style.border = "1px dotted #f00";
		thediv.style.background = "none";
		thediv.style.position = "absolute";
		thediv2.style.position = "absolute";
		thediv2.style.display = "";
		var popup = "<div style=\"text-align:center;width:100%;\"><div onclick='return closePopUp(this)' class=\"zoom1inbox\" style=\"width:"+mWidth+"px;height:"+mHeight+"px; margin: 0px auto 0px auto;border-color:#b62e27;\">";

		popup += "<div style=\"width:"+(mWidth-10)+"px;height:"+(mHeight-70)+"px;\" >";
		popup += "<iframe width=\"900\" height=\"100\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\"/tools/ext_shopbanneriframe.pl?mode=h&items=12&shop="+username+"\"></iframe>";

		//popup += "<iframe width=\"900\" height=\"100\"  marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" align=\"left\" scrolling=\"no\" src=\"/tools/easyslider1.5/slide.pl\"></iframe>";

		popup += "</div></div>";
		thediv2.innerHTML = popup;
 
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
		thediv2.style.display = "none";
		thediv2.innerHTML = '';
	}
	return false;
}



//----------------------------------------------------------------------------------------------------
	// create an image object
	objImage=null;
	objImageurl='';
	objMaxCnt=0;

	function imagesLoaded()
	{    
		if ((objImage.width==0)&&(objMaxCnt<100)){
			objMaxCnt++;
			setTimeout(imagesLoaded, 1000);
		}else{
			zoom1loaded();
			var info='';
			info = info+'1c:'+objImage.complete+'<br>';
			info = info+'2w:'+objImage.width+'<br>';
			info = info+'3h:'+objImage.height+'<br>';
			info = info+'4src:'+objImage.src+'<br>';
			info = info+'5url:'+objImageurl+'<br>';

	var mHeight= viewportheight-80;
	var mWidth= viewportwidth-80;
		mWidth= mWidth-10;
		mHeight=mHeight-70;

		var verhaeltnis=0;
			if (objImage.width/objImage.height < 1){
				//hochkant
				verhaeltnis=objImage.width/objImage.height;
				document.getElementById('theimage').innerHTML='<img id="zoom1largeimage" src="'+objImageurl+'" height="800" width="'+Math.round(800*verhaeltnis)+'" >';
			}else{
				//quer
				verhaeltnis=objImage.height/objImage.width;
				document.getElementById('theimage').innerHTML='<img id="zoom1largeimage" src="'+objImageurl+'" width="800" height="'+Math.round(800*verhaeltnis)+'" >';
			}

//		document.getElementById('theimage').innerHTML=document.getElementById('theimage').innerHTML+'<hr>'+info+'<img id=zoom1largeimage src="'+objImageurl+'">';
			//		alert(objImageurl);
			//			document.getElementById('zoom1largeimage').src=objImageurl;
		}

	}

function clicker(image){

	//kein support fuer IE6
	if (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1){
		return true;
	}

	var thediv=document.getElementById('zoom1displaybox');
	var thediv2=document.getElementById('zoom1displaybox2');
 
	maxViewport();
	//alert(viewportwidth);
 
 
	var mHeight= viewportheight-80;
	var mWidth= viewportwidth-80;

 
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv2.style.display = "";
		var popup = "<div onclick='return closePopUp(this)' style=\"text-align:center;width:100%;margin-top:40px;\"><div onclick='return closePopUp(this)' class=\"zoom1inbox\" style=\"margin:auto;width:"+mWidth+"px;height:"+mHeight+"px;\">";
//		popup += "<a href=\"#\" onclick=\"imagesLoaded();return false;\">xx</a>";
		popup += "";
		popup += "<table width=100% align=\"center\"><tr><td><a style=\"font-size:20px;color:#000;text-decoration:underline;\" href='#' onclick='return clicker();'>Zoom schliessen</a></td><td><div id=\"zoom1ani\"><img src=\"/js/scriptaculous/lw/ajax-loading.gif\"> &nbsp;</div></td></tr></table><br><br>";
		popup += "<div style=\"overflow:auto;width:"+(mWidth-10)+"px;height:"+(mHeight-70)+"px;\" >";
		//popup += "<img src=\""+image+"\" onload='zoom1loaded();' >  ";
		popup += "<div id=\"theimage\">Bild wird geladen, bitte warten...</div>";
		popup += "</div>";

		popup += "</div></div>";
		thediv2.innerHTML = popup;


		//---------------------------

		objImageurl = null;
		objMaxCnt=0;
		objImage = null;
		objImageurl=''+image+'';

		objImage = new Image();
		objImage.onLoad = imagesLoaded(); //geht aber nicht richtig deswegen die setTimeout kruecke..
		objImage.src=image+'?id='+parseInt( Math.random()*100);

 
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
		thediv2.style.display = "none";
		thediv2.innerHTML = '';
	}
	return false;
}


//--

