//screenshots functions
var attempt = 0;
function showScreen(obj){     
        pic = new Image();
        //alert(typeof(obj)=="string");
        
        if(typeof(obj) == "string"){
            pic.src = obj;            
        }else{                        
            pic.src = obj.href;
        }
        
        //pic.src = pic.src.replace(/http:\/\/(www\.)?7tools(\.paragon\-software)?\.com\/export\/sites\/7tools\.com\//, "/");
        //document.title = pic.src;
        
        if(pic.src.indexOf('7tools') > -1){
            window.open(pic.src,'screenshot','');
            return;
        }
        
        img = document.getElementById("big_screen");
        img.src = "/images/interface/loading.gif";
        
        c = document.getElementById("screens_container");
        c.style.display='block';
        
        b = document.getElementById("screens_body");
        
        b.style.width="92";
        b.style.height="48";
        
        
        
       
        position(c, 128, 128);
        if(pic.complete){
            img.src = pic.src;
            position(c, pic.width + 16, pic.height + 48);
            b.style.width=pic.width + 16;
            b.style.height=pic.height + 48;    
        }else if(attempt<128){
            attempt++;
            //document.title=attempt;
            
            setTimeout("showScreen('" + pic.src + "')", 1000);
        }     
        
          
        
        
        
        //alert(pic.width + " x " + pic.height + " " + pic.complete);
    }
    

    function scr_close(){
        c = document.getElementById("screens_container");
        c.style.display='none';
    }
    
    function position(obj, x, y){
        //alert(defScroll().x + " " + defScroll().y);
        try{
            obj.style.left = ((document.body.offsetWidth - x) / 2) + "px";                
            obj.style.top = ((document.body.offsetHeight - y)  / 4) + defScroll().y + "px";
        
        }catch(ex){}
        //alert(obj.style.top);
    }
    
    function defScroll() {
      var x = y = 0;
      // Gecko поддерживает свойства scrollX(scrollY)
      // Для IE & Opera приходится идти в обход
      x = (window.scrollX) ? window.scrollX : document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
      y = y = (window.scrollY) ? window.scrollY : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
      return {x:x, y:y};
}
    