var lightboxAction = 0;

var ItemGlobal = 0;

var DivFader;
var ValFader = 0;
var opacityStatus = 0;


var myPercent1 = 300;

function clearAlert(myId)
{

document.getElementById("boxItemAction"+myId).style.display = "none";
document.getElementById("boxItemAction"+myId).style.zIndex= 1;


document.getElementById("boxItemAction"+myId).style.filter = 'alpha(opacity=0)';
ValFader = 0;
opacityStatus = 0;
}

function fader(myId){


ValFader += 1;


//document.getElementById('header_image').style.MozOpacity

document.getElementById("boxItemAction"+myId).style.opacity = ValFader/10;
document.getElementById("boxItemAction"+myId).style.filter = 'alpha(opacity=' + ValFader + ')';


if(ValFader < 100){

window.setTimeout("fader(ItemGlobal)",100); 
}
}



function submitForm(){

  document.myForm.submit();


}











 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 AjaxNewsletter(myType,myLanguage){
        DivOut = "newsletter";

        var VarHobby = document.myFormNewsletter.frmHobby.value;
        var VarNewsletter;
        
        for( i = 0; i < document.myFormNewsletter.frmNewsletter.length; i++ ) {
              if( document.myFormNewsletter.frmNewsletter[i].checked == true ){
                    VarNewsletter = document.myFormNewsletter.frmNewsletter[i].value;
            break;
        }
 }

http.open('POST','ajax/ajaxNewsletter.php');
http.onreadystatechange = handleResponse;
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.send('AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjHobby='+VarHobby+'&AjNewsletter='+VarNewsletter+'&AjVL='+myLanguage);
      

}      
        
        
        

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 AjaxOrder(myType,myAction,myId,myAction,myFileName){

var VarAnzahl=1;

if(myAction==0){
          VarAnzahl = document.getElementById("anzahl"+myId).value;

}
      if(myType == 0){
  
            DivOut = "boxShop";
      }else if (myType == 1){
            DivOut = "boxShopMain";    
      
      }
      http.open('POST','ajax/shopData.php');
      http.onreadystatechange = handleResponse;
      http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      http.send('AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjId='+myId+'&AjAction='+myAction+'&AjFileName='+myFileName+'&AjAnzahl='+VarAnzahl);



}



function AjaxDisplaySearch(myType,myId,myLanguage,myBgColor){


      DivOut = "boxSearch";

//document.getElementById("boxScreenContent").innerHTML = "<img src=\"img/uploadBig/"+myId+"\" />";



      http.open('POST','ajax/searchInfo.php');
      http.onreadystatechange = handleResponse;
      http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      http.send('AjVal=jdfeiUU56e3reww&AjId='+myId+'&AjType='+myType);


}

function AjaxInfo(myType,myId,myLanguage,myBgColor){


if(myType==0){
clearAlert(ItemGlobal)
//document.getElementById("boxItemAction"+myId).style.display = "none";
document.getElementById("boxItem"+ItemGlobal).style.visibility= "visible";
ItemGlobal=0

}else if(myType==1){

if(ItemGlobal>0){
//document.getElementById("boxItem"+ItemGlobal).style.display = "block";
//document.getElementById("boxItemAction"+ItemGlobal).style.display = "none";
clearAlert(ItemGlobal)
//document.getElementById("boxItemAction"+myId).style.display = "none";
document.getElementById("boxItem"+ItemGlobal).style.visibility= "visible";


}
document.getElementById("boxItem"+myId).style.visibility= "hidden";
//document.getElementById("boxItem"+myId).style.display = "none";
document.getElementById("boxItemAction"+myId).style.display = "block";
document.getElementById("boxItemAction"+myId).innerHTML="<img src=\"img/elements/ajaxLoader.gif\" />";

document.getElementById("boxOuter"+myId).style.zIndex= 120;
document.getElementById("boxItemAction"+myId).style.zIndex= 500;

fader(myId)
document.getElementById("boxItemAction"+myId).style.backgroundColor = myBgColor;




//document.getElementsByTagName('h1').style.display = "none";

ItemGlobal = myId;

 DivOut = "boxItemAction"+myId;
 

}else if(myType==2 || myType==3 || myType==4){

 DivOut = "boxItemAction"+myId;
}

 http.open('POST','ajax/shopInfo.php');
      http.onreadystatechange = handleResponse;
      http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      http.send('AjVal=jdfeiUU56e3reww&AjId='+myId+'&AjType='+myType+'&AjLanguage='+myLanguage);


}


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();



}



