var xmlHttpGetSuggestions = createXmlHttpRequestObject();
var seite = 1;

function hidebox1(){ 
document.getElementById('showimage1').style.visibility="hidden";
} 
function showbox1(){ 
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
document.getElementById('showimage1').style.width=windowWidth;
document.getElementById('showimage1').style.height=windowHeight;
document.getElementById('showimage1').style.visibility="visible";
document.getElementById('showimage11').style.top=(windowHeight-600)/2;
document.getElementById('showimage11').style.left=(windowWidth-1200)/2;
}

function show(ordner) {
	divlayer("Bilder");

	document.getElementById("inlay").innerHTML = '<iframe src="../Includes/PixelPicBox/pixelpicbox.php?ordener='+ordner+'&seite='+seite+'" width="100%" height="100%" frameborder="0" ></iframe>';

}


function divlayer(titel) {

	var inlinehoehe = 675;
	var inlinebreite = 905;
	var hoehe = 0;
	var breite = 0;

	var arrayPageSize = getPageSize();

	var objBody = document.getElementsByTagName("body").item(0);
		
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	//objOverlay.onclick = function() { EndDel(); return false; };
	objOverlay.style.display = 'block';
	objOverlay.style.position = 'absolute';
	objOverlay.style.left = '0px';
	objOverlay.style.top = '0px';
	objOverlay.style.padding = '0px';
	//objOverlay.style.filter = 'alpha(opacity=75)';
	//objOverlay.style.filter = '-moz-opacity: 0.75';
	objOverlay.style.opacity = (60 / 100);
	objOverlay.style.MozOpacity = (60 / 100);
	objOverlay.style.KhtmlOpacity = (60 / 100);
	objOverlay.style.filter = "alpha(opacity=" + 60 + ")";
	
	objOverlay.style.backgroundColor = '#000000';
	//objOverlay.style.backgroundImage = 'url(Bilder/div.png)';
	objBody.appendChild(objOverlay);
	objOverlay.style.width=arrayPageSize[0];
	objOverlay.style.height=arrayPageSize[1];

	var hoehe = inlinehoehe + 35;
	var breite = inlinebreite + 10;
	var objInlay1 = document.createElement("div");
	objInlay1.setAttribute('id','inlay1');
	objInlay1.style.display = 'block';
	objInlay1.style.position = 'absolute';
	objInlay1.style.left = (arrayPageSize[0]/2)-(breite/2);
	objInlay1.style.top = '50px';
	objInlay1.style.overflow = 'auto';
	objInlay1.style.border = '2px solid #cccccc';
	objInlay1.style.backgroundColor = '#FFFFFF';
	objBody.appendChild(objInlay1);

	objInlay1.style.width=breite+"px";
	objInlay1.style.height=hoehe+"px";

	hoehe = 17;
	breite = inlinebreite + 6;
	var objTitel = document.createElement("div");
	objTitel.setAttribute('id','titel');
	objTitel.style.display = 'block';
	objTitel.style.position = 'absolute';
	objTitel.style.left = '0px';
	objTitel.style.top = '0px';
	objTitel.style.overflow = 'hidden';
	objTitel.style.backgroundColor = '#cccccc';
	objTitel.style.border = '2px solid #cccccc';
	objTitel.innerHTML = '<font color="#FFFFFF"><strong>'+titel+'</strong></font>';
	objInlay1.appendChild(objTitel);

	objTitel.style.width=breite+"px";
	objTitel.style.height=hoehe+"px";

	var objInlay = document.createElement("div");
	objInlay.setAttribute('id','inlay');
	objInlay.style.display = 'block';
	objInlay.style.position = 'absolute';
	objInlay.style.left = '3px';
	objInlay.style.top = '22px';
	objInlay.style.overflow = 'auto';
	objInlay.style.border = '2px solid #cccccc';
	objInlay.style.backgroundColor = '#FFFFFF';
	objInlay1.appendChild(objInlay);

	objInlay.style.width=inlinebreite+"px";
	objInlay.style.height=inlinehoehe+"px";


	hoehe = inlinehoehe + 4;
	breite = inlinebreite - 85;
	var objExit = document.createElement("div");
	objExit.setAttribute('id','exit1');
	objExit.onclick = function() { Ende(); return false; };
	objExit.style.display = 'block';
	objExit.style.position = 'absolute';
	objExit.style.left = breite+'px';
	objExit.style.top = hoehe+'px';
	objExit.style.overflow = 'auto';
	objExit.style.zIndex  = 3;
	objExit.style.border = '2px solid #cccccc';
	objExit.style.backgroundImage = 'url(../Bilder/beenden.jpg)';
	objExit.style.backgroundColor = '#FFFFFF';
	objExit.style.cursor = 'pointer';
	//objExit.innerHTML = "Beenden";
	objInlay1.appendChild(objExit);

	objExit.style.width="62px";
	objExit.style.height="23px";
	hoehe = inlinehoehe + 5;
	breite = inlinebreite - 85;

		
}

function Ende(){
	document.getElementById("overlay").style.display = "none";
	document.getElementById("inlay1").style.display = "none";
	var objOverlay = document.getElementById("overlay");
	objOverlay.setAttribute('id','overlay1');
	var objInlay = document.getElementById("inlay1");
	objInlay.setAttribute('id','inlay1_alt');
	var objInlay = document.getElementById("inlay");
	objInlay.setAttribute('id','inlay_alt');
}

function createXmlHttpRequestObject() 
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // this should work for all browsers except IE6 and older
  try
  {
    // try to create XMLHttpRequest object
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // assume IE6 or older
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                                    "MSXML2.XMLHTTP.5.0",
                                    "MSXML2.XMLHTTP.4.0",
                                    "MSXML2.XMLHTTP.3.0",
                                    "MSXML2.XMLHTTP",
                                    "Microsoft.XMLHTTP");
    // try every prog id until one works
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
 
      { 
        // try to create XMLHttpRequest object
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}


function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
