var lightboxAction = 0;



 function getPageSize() {

	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			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
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				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 = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
return [pageHeight];
		//return [pageWidth,pageHeight];
	}



function initBackground(){

document.getElementById("boxMainJs").style.height = getPageSize() +"px";

}



function getScrollXY() {   

    var scrOfX = 0, scrOfY = 0;   

  

    if( typeof( window.pageYOffset ) == 'number' ) {   

        //Netscape compliant   

        scrOfY = window.pageYOffset;   

        scrOfX = window.pageXOffset;   

    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {   

        //DOM compliant   

        scrOfY = document.body.scrollTop;   

        scrOfX = document.body.scrollLeft;   

    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {   

        //IE6 standards compliant mode   

        scrOfY = document.documentElement.scrollTop;   

        scrOfX = document.documentElement.scrollLeft;   

    }   

    return [scrOfY ];   

}  

















function createRequestObject() {

    var ro;

    var browser = navigator.appName;

    if(browser == "Microsoft Internet Explorer") {

        ro = new ActiveXObject("Microsoft.XMLHTTP");

    } else {

        ro = new XMLHttpRequest();

    }

    return ro;

}

var http = createRequestObject();



var DivOut;



function ActionResizeClose(myId, myName) {

lightboxAction=0;

document.getElementById("boxScreenAlpha").style.height = 0+"px";

document.getElementById("boxScreenAlpha").style.width = 0+"px";

document.getElementById("boxScreenContent").style.display = "none";



}



function ActionResize(myImageId,myId, myName,myType) {



initLightbox(1)





ActionDisplay(myImageId, myId, myName,0,myType);



}



function ActionDisplay(myImageId, myId, myName, myStatus,myType) {



DivOut = "boxScreenContent";

//document.getElementById("boxScreenContent").innerHTML = "<img src=\"img/uploadBig/"+myId+"\" />";



  http.open('POST','ajax/AjaxGallery.php');

 http.onreadystatechange = handleResponse;

 http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

 http.send('AjVal=jdfeiUU56e3reww&AjImageId='+myImageId+'&AjId='+myId+'&AjName='+myName+'&AjType='+myType);





}



function  AjaxCheckForm(myType,myName,myInfo,myStatus){

 DivOut = "boxCorrect"+ myName;

CheckFormGlobal = true;

NameFormGlobal = myName;

//alert(NameFormGlobal)

 var varFormElement = document.formCheck["frm"+myName].value;

 document.formCheck.frmCheckVal.value = 1;



http.open('POST','ajax/checkForm.php');

 http.onreadystatechange = handleResponse;

 http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

 http.send('AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjName='+myName+'&AjFormElement='+varFormElement+'&AjInfo='+myInfo+'&AjStatus='+myStatus);



//document.getElementById(["boxCorrect"+ myName]).innerHTML = "<font color=\"red\">*</font>";



}









function  handleResponse() {

    if(http.readyState == 4){

        var response = http.responseText;

//alert(http.getAllResponseHeaders()  )  

      

        var update = new Array();

         

       if(response.indexOf('|' != -1)) {

            update = response.split('|');





//alert(DivOut)

//alert(response)



}

document.getElementById(DivOut).innerHTML = response; 

}

}



function printer()

{

this.print();

this.close();



}



function initLightbox(myType) {

var height = getPageSize();


if(myType==1) {
	lightboxAction = 1;

}



document.getElementById("boxScreenContent").style.top = getScrollXY()+"px";





if(lightboxAction==1) {



    var browser = navigator.appName;

    if(browser == "Microsoft Internet Explorer") {
            //document.getElementById("boxScreenAlpha").style.height = document.body.offsetHeight+"px";
    } else {
            
//var height = window.innerHeight;
if( window.scrollMaxY){
//height += window.scrollMaxY;

}




    
}

document.getElementById("boxScreenAlpha").style.height = height +"px";
    
document.getElementById("boxScreenAlpha").style.width = document.body.offsetWidth+"px";




var t = (height/2)-265;

var l = (document.body.offsetWidth/2)-(480/2);



document.getElementById("boxScreenContent").style.left = l +"px";

document.getElementById("boxScreenContent").style.display = "block";

}

}

window.onresize = initLightbox; 
//window.onload=initBackground;


//window.onload=getPageSize
