var lightboxAction = 0;


function initBackground(){
      document.getElementById("boxMainJs").style.height = getPageSize() +"px";
}






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";
      
           $('#boxScreenContent').fadeOut(400);
           $('#boxGallery').fadeIn(400);
        $('#boxDiaGallery').fadeOut(700);
         $('#boxDia').fadeOut(800);
}



function ActionResize() {
      initLightbox(1)
}


var BooleanBubble=0;

function ActionChgButton(myType) {

     if(myType==1){

          if(BooleanBubble==6){
               BooleanBubble=0;
          }
    
          if(BooleanBubble==0){
                $('#boxCenterContentBubble').animate({opacity:'1'}, 400);
                $('#boxCenterContentBubble').delay(2500).animate({opacity:'0'}, 400);
            
          }
          $('#boxCenterContentStar').animate({opacity:'1'}, 200);
          
     }else{
          $('#boxCenterContentStar').animate({opacity:'0.35'}, 200);
     }
     
         BooleanBubble+=1;
     
     
}



function ActionBookmark(myType, myGalleryId, myId,myIdTemp) {

//alert(myGalleryId+"-"+myId)



      if(myType==10){
            $('#boxBookmark').fadeOut(400);
      }else {     
            $('#boxBookmark').fadeIn(400);
            
      }
     
      if(myType==108){
            var GalleryText = document.getElementById("GalleryText").value;
      
      }
      if(myType== 4 ){  
      // alert(myGalleryId+"_"+myId)
              $('#GalleryStarSmall'+myGalleryId+''+myId).fadeIn(400);

      }
      
      if(myType== 102 ){  
    
        for(i=0;i<myIdTemp;i++) {
  //alert(myGalleryId+"-"+i)
              $('#GalleryStarSmall'+myGalleryId+''+i).fadeOut(400);
        }
            
            
            
      }        
      if(myType== 105 ){  
    
              $('#GalleryStarSmall'+myGalleryId+''+myIdTemp).fadeOut(400);
      }
      
      
      
      
     // var VarSender = 'AjVal=jdfeiUU56e3reww&AjType='+myType;
      var VarSender = 'AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjGalleryId='+myGalleryId+'&AjId='+myId+'&AjGalleryText='+GalleryText;
      RequestHandleResponse('boxBookmarkInner','ajax/AjaxBookmark.php',VarSender)
      
      
      
      
      

}



var GlobalId=0;

function getMoverLeft(myImageCounter){

      var lefter = $('#cellGalleryDiaInnerMover').position();
      var lefterx = $('#cellGalleryDiaInnerInnerInner').position();
      
      
      if(myImageCounter>18){
      
      
            //getMoverLeft
            var varLeft= -140;
            
            
            if(GlobalImageCounter<10){
                  var action_width= GlobalImageCounter *90 + 49;
            }else{
                  var action_width= GlobalImageCounter  *54 + 49;
            }
            
            
            var varLeft= 920 -action_width;


            if(lefter.left<450){

                  $('#cellGalleryDiaInnerInnerInner').animate({left:0}, 300);    
                  var action = "left"
            }else  if(lefter.left>= 450){
                  $('#cellGalleryDiaInnerInnerInner').animate({left:varLeft}, 300); 
                var action = "right"
            }
            
           // var output=lefter.left+"..."+action+"...."+varLeft+"..."+lefterx.left
             //$('#status').html(output)
            
      }
}



function ActionGalleryMover(myType, myId,myWidth,myImageCounter){


      if(myWidth==""){
            if(myImageCounter<10){
                  myWidth=76;
            }else{
                  myWidth=40;
            }
      }
      
      if(myType==2 || myType==3){
            if(myType==2){
                  IdTemp = GlobalIdMover+1;
            }else if  (myType==3){
                  IdTemp = GlobalIdMover-1;
            }
      
            var PositionLeftTemp = (IdTemp*(myWidth+14)+29)
            $('#cellGalleryDiaInnerMover').animate({left:PositionLeftTemp}, 990); 
      }else{

            var PositionLeft = (myId*(myWidth+14)+29)
            $('#cellGalleryDiaInnerMover').delay(10).animate({left:PositionLeft}, 90);  

      }
      getMoverLeft(myImageCounter)
      GlobalId = myId;
     
     
     
}



var GlobalImageCounter;

var GlobalImageTypeTemp;
var GlobalTypeTemp;
var GlobalGalleryIdTemp;
var GlobalTextTypeTemp;
var GlobalIdTemp;




function ActionDisplay(myType,myGalleryId,myId,myImageType,myTextType, myImageCounter,myImageNumber) {
      GlobalTypeTemp=myType;

      GlobalTypeTemp=myType;
      GlobalGalleryIdTemp=myGalleryId;
      GlobalIdTemp=myImageNumber;
      
      GlobalImageTypeTemp=myImageType;
      GlobalTextTypeTemp=myTextType;

      GlobalImageCounter = myImageCounter;

      $('#boxDia').fadeIn(400);
      $('#boxGallery').fadeOut(400);
      $('#boxScreenContent').fadeIn(400);
      $('#boxDiaGallery').fadeIn(400);
      
  
      var widthMin= 600;
      var widthManx= 1200;   
      
      
      
      var LayoutWindow_width = $(document).width()-140;
      var LayoutWindow_height = $(document).height();
      var  LayoutWindow_left =140/2;

      $('#boxDia').css("width",LayoutWindow_width);
      $('#boxDia').css("left",LayoutWindow_left);
            
      $('#boxDiaGallery').css("width",LayoutWindow_width-200);
      $('#boxDiaGallery').css("left",LayoutWindow_left+100);
      
      if(myImageCounter<10){
      
      
      }

      var VarSender = 'AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjGalleryId='+myGalleryId+'&AjId='+myId+'&AjImageCounter='+myImageCounter;
      RequestHandleResponse('boxDiaGalleryInner','ajax/AjaxSlider.php',VarSender)

}


var GlobalImageType;
var GlobalIdMover;
var GlobalImageTypeChange=0;

function initLightbox(myType,myGalleryId,myId,myImageType,myTextType, myImageCounter) {

      GlobalIdMover =myId;
      
      
      if(myType==1){
            $('#cellGalleryDiaInnerMoverInner').animate({opacity:'0.6'}, 200).animate({opacity:'0.1'}, 500)
            var sliderValue = document.getElementById("HiddenSlider").value;
 
            
            arraySlider = sliderValue.split("##");
            arraySliderSub = arraySlider[GlobalId].split("#");
          
            myType = arraySliderSub[0];
            myGalleryId = arraySliderSub[1];
            myId = arraySliderSub[2];
            myImageType = arraySliderSub[3];
            myTextType = arraySliderSub[4];
            myImageCounter = arraySliderSub[5];
            
            
            
            
      }else if(myType==2 || myType==3){
      
            ActionGalleryMover(myType,myId,'',myImageCounter); 
            ActionGalleryMover(0,myId,'',myImageCounter); 
      
      }


      if(GlobalImageType==myImageType){
            GlobalImageTypeChange=0;
        
      }else{
            GlobalImageTypeChange=1;
      }


      if(myImageType=="l"){
      
            GlobalImageType="l"
      
      }else{
            GlobalImageType="p"
      }



      var lightboxAction=1
      if(lightboxAction==1) {

                 
            var VarSender = 'AjVal=jdfeiUU56e3reww&AjType='+myType+'&AjGalleryId='+myGalleryId+'&AjId='+myId+'&AjImageType='+myImageType;
            RequestHandleResponse('boxScreenContent','ajax/AjaxGallery.php',VarSender)
  
/*


            var LayoutContent_width=700;
            var LayoutContent_height=740;
            var LayoutContent_top=20;    
                
             var LayoutContent_left= (LayoutWindow_width/2)-(LayoutContent_width/2);
              
            document.getElementById("boxScreenContent").style.display = "block";
            
            $('#boxScreenContent').css("width",LayoutContent_width);
            $('#boxScreenContent').css("height",LayoutContent_height);
            $('#boxScreenContent').css("left",LayoutContent_left);
    $('#boxScreenContent').css("top",LayoutContent_top);
            
        */    
            
      }
}

//window.onresize = initLightbox; 
//window.onload=initBackground;


//window.onload=getPageSize

