var ValFader = 0;


var GlobalBrowser;
var win;
function winOpen(url,wt,ht) {
lt=(screen.width/2)-(wt/2);
tp=(screen.height/2)-(ht/2);


win=window.open(url, "id","status=yes, scrollbars=yes,menubars=no,resizable=yes,toolbars=no,height="+ht+",width="+wt+",top="+tp+",left="+lt)
win.focus;

}


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
		GlobalBrowser = "ff";
			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 ActionPresse(myAction, myType) {

      var height = getPageSize();
          var width = parseInt(getPageSize([0]));  
   
        var t = 120;
       var l = (document.body.offsetWidth/2)-(860/2);
         
        if(GlobalBrowser!= "ff"){
       // alert("ie")
            //document.getElementById("boxScreenPresseInner").style.left = l-75+"px";
        //l = l+30;
        //t = t +55;
        }
 
        
        if(myAction==0){
                document.getElementById("boxScreenPresse").style.top = t +"px";
        document.getElementById("boxScreenPresse").style.left = l +"px";
        document.getElementById("boxScreenPresse").style.display = "block";


        DivOut = "boxScreenPresseInner";

//document.getElementById("boxScreenContent").innerHTML = "<img src=\"img/uploadBig/"+myId+"\" />";



  http.open('POST','ajax/AjaxPresse.php');
 http.onreadystatechange = handleResponse;
 http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 http.send('AjVal=jdfeiUU56e3reww&AjType='+myType);

}else if(myAction==1){
        document.getElementById("boxScreenPresse").style.display = "none";
}
}



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 popUpClose(){

document.getElementById("boxPopUp").style.display = "none";
}


function popUpCloseAdd(myId,myFirma){

document.getElementById("boxPopUp").style.display = "none";

document.myForm.frmUserId.value=myId;


DivOut = "boxTextfield";

  http.open('POST','ajax/textfieldData.php');
  http.onreadystatechange = handleResponse;
  http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  http.send('AjVal=jdfeiUU56e3reww&AjFirma='+myFirma);





}




function AjaxSchreiner(myReferer){

document.getElementById("boxPopUp").style.display = "block";


AjaxQuickSearch(0,0,0,myReferer) 
}








function AjaxQuickSearch(myType,myPageFlipNo,myAction,myReferer,myUserCode) {


DivOut = "boxSearchMain";
//document.getElementById("boxQuickSearch"+myType).style.visibility="visible";

if(myType==100 ){
    document.formQuickSearch0["frmQs"+1].value = "";
    document.formQuickSearch0["frmQs"+0].value = "";

}



if(myType==0){
   
    document.formQuickSearch0["frmQs"+1].value = "";
}else if(myType==1){
 
   document.formQuickSearch0["frmQs"+0].value = "";
}


var VarSearchString0 = document.formQuickSearch0["frmQs"+0].value;
var VarSearchString1 = document.formQuickSearch0["frmQs"+1].value;




if(myType==100){
myType=0;
}

///formUpdateAccount
  http.open('POST','ajax/quicksearchData.php');
  http.onreadystatechange = handleResponse;
  http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  http.send('AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjReferer='+myReferer+'&AjAction='+myAction+'&AjPageFlipNo='+myPageFlipNo+'&AjSearchString0='+VarSearchString0+'&AjSearchString1='+VarSearchString1+'&AjUserCode='+myUserCode);
}









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 moveElements(mydiv,type,pos,mode)
{

if(pos =="")
{
document.getElementById(mydiv).style[type] = mode
}
else
{
document.getElementById(mydiv).style[type] = pos +"\""+mode+"\";";
}
}




function fader()
{


ValFader += 14;

window.status= ValFader
//document.getElementById('header_image').style.MozOpacity

document.getElementById("boxImageMain").style.opacity = ValFader/10;
document.getElementById("boxImageMain").style.filter = 'alpha(opacity=' + ValFader + ')';


if(ValFader < 83)
{
window.setTimeout("fader()",100); 
}

}





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

















