(function(a){
  a.bikeZoom=function(c){
    this.obj=c;
    var b=document.getElementById("sb-overlay");
    this.height=c.height?parseInt(c.height,10):b.offsetHeight;
    this.width=c.width?parseInt(c.width,10):b.offsetWidth};
    a.bikeZoom.prototype={
      
      append:function(b,e,d){       
        this.id=e;
        var c='<iframe id="'+e+'" name="'+e+'" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"';
        if(a.client.isIE){
          c+=' allowtransparency="true"';        
          if(a.client.isIE6){
            c+=" src=\"javascript:false;document.write('');\""
          }
        }
        c+="></iframe>";
        b.innerHTML=c;
                
        var viewPortWidth  = $(window).width();
   	    var viewPortHeight = $(window).height();       
        var paddingTop     = parseInt($("#sb-wrapper").css("top").replace('px',''));                            
        var sboxHeight     = parseInt($('#sb-body').css("height").replace('px',''));
        var sboxWidth      = parseInt($('#sb-wrapper').css("width").replace('px',''));                
        
        if(viewPortWidth <= 1000 || viewPortHeight <= 650) {
          //Miniumu ShadowBox dimensions for a bike zoom
          sboxWidth   = 962;
          sboxHeight  = 590;   
          paddingTop  = 0;                   
        }
        
        sboxHeight -= 40;
                
        //Remove 40px to hide the Scene7 Logo
        $("#sb-body").css("height",   sboxHeight+"px");
        $("#sb-wrapper").css("width", sboxWidth+"px");
        $("#sb-wrapper").css("top",   paddingTop+"px");          
         
      },
      
      remove:function(){
        var b=document.getElementById(this.id);
        if(b){
          a.lib.remove(b);
          if(a.client.isGecko){
            delete window.frames[this.id]
          }
        }
      },
      
      onLoad:function(){
        var b=a.client.isIE?document.getElementById(this.id).contentWindow:window.frames[this.id];
        b.location.href=this.obj.content
      },
      
      onWindowResize:function() {            
        
        var viewPortWidth  = $(window).width();
   	    var viewPortHeight = $(window).height();       
        var paddingTop     = parseInt($("#sb-wrapper").css("top").replace('px',''));                            
        var sboxHeight     = parseInt($('#sb-body').css("height").replace('px',''));
        var sboxWidth      = parseInt($('#sb-wrapper').css("width").replace('px',''));                
        
        if(viewPortWidth <= 1000 || viewPortHeight <= 650) {
          //Miniumu ShadowBox dimensions for a bike zoom
          sboxWidth   = 962;
          sboxHeight  = 590;   
          paddingTop  = 0;                   
        }
        
        sboxHeight -= 40;
                
        //Remove 40px to hide the Scene7 Logo
        $("#sb-body").css("height",   sboxHeight+"px");
        $("#sb-wrapper").css("width", sboxWidth+"px");
        $("#sb-wrapper").css("top",   paddingTop+"px");      
      }
      
    }})(Shadowbox);
