﻿var imgControl = {
        _currentImg:null,
        _bigImgSrc:"",
        _bigImgElement:$("#img-bigimage"),
        _bigImgParent:$("#modal-bigimg"),
        _alphalayer:$("#layer-alpha"),
        _clickText:"",
        _visible:false,
       
        
        swap:function(img,bigImgSrc)
        {
            if(imgControl._currentImg != img)
            {
               $("#mainProductImage").attr("src",img);
                imgControl._bigImgSrc = bigImgSrc;
                
               
                imgControl._currentImg = img;
                imgControl.checkBigImg();
                
                
            }
            
        },
        
        popup:function()
        {  
           
                /* Check if there is a big img or product popup is active */
            if(imgControl._bigImgSrc == "" || modalSendEmail.isActive == true)
                   return;
            
       
            $("#img-bigimage").attr("src",imgControl._bigImgSrc);
            imgControl.showHide(); 
        },
        
        checkBigImg:function()
        {
            if(imgControl._bigImgSrc != "")
            {
                $("#mainProductImage").attr("title",imgControl._clickText);
              
                /* Show click cursors */
                $("#mainProductImage").css("cursor","");
                $(".offer-product").css("cursor",""); 
            }
            else
            {
                $("#mainProductImage").attr("title","");
                
                  /* Show normal cursors */
               // $("#mainProductImage").attr("style"," cursor:crosshair !important;");
                //$(".offer-product").attr("style"," cursor:crosshair !important;"); 
                
                 $(".offer-product").css("cursor","default");
                $("#mainProductImage").css("cursor","default");
               
            }
            
        },
        
        close:function()
        {
            imgControl.showHide();
       
        },
        
        showHide:function()
        {
            if(!imgControl._visible)
            {
              imgControl._alphalayer.show();
              imgControl._bigImgParent.show();
            
              if($.browser.msie)
                   $("select.productSort").hide();
                   
               imgControl._visible = true;
            }
            else
            {
              imgControl._alphalayer.hide();
              imgControl._bigImgParent.hide();
            
              if($.browser.msie)
                    $("select.productSort").show();
                    
                imgControl._visible = false;
            }
        
           
        }
                 
}