// Aktivate Jquery plugin
$(function() {
    $('.photo-border a').lightBox();
    $('.g-border a').lightBox();
});

//otev?en? nov?ho okna
var myTWin = window.myTWin; //objekt okna
function OpenMyWin(link,winName,width,height,origw,origh) {
    var retValue=true;
    if (myTWin!=null && !myTWin.closed){
        myTWin.focus();
        myTWin.location.href=link.href;
    }else{
        //zajisteni proti zakryti obrazovky
        var resizable = "no";
        var scroll = "no";
        if (width > window.screen.width-100){
            width = window.screen.width-100;
            resizable = "yes";
        }
        
        if (height > window.screen.height-100){
            height = window.screen.height-100;
            resizable = "yes";
        }
        
        if (origw > width || origh > height){
            resizable = "yes";
            scroll = "yes";
        }
        
        //nastaveni centrovane pozice
        var iwidth = (window.screen.width/2) - (width/2);
        var iheight = (window.screen.height/2) - (height/2);
        
        //zjisteni pripony z 'link'
        var fparts = link.toString().split(".");
        var ext = fparts[fparts.length-1];
        
        if (ext == 'gif' || ext == 'jpg' || ext == 'png'){
            myTWin = window.open("", winName, "location=no,menubar=no,scrollbars="+scroll+",titlebar=no,toolbar=no,personalbar=no,status=no,resizable="+resizable+",width="+width+",height="+height+",left="+iwidth+",top="+iheight+",screenX="+iwidth+",screenY="+iheight);
        
            myTWin.document.open();
            //myTWin.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
            myTWin.document.writeln('<html lang="cs" xml:lang="cs" xmlns="http://www.w3.org/1999/xhtml">');
            myTWin.document.writeln('<head>');
            myTWin.document.writeln('<meta content="text/html; charset=windows-1250" http-equiv="Content-Type" />');
            myTWin.document.writeln('<meta content="cs" http-equiv="Content-Language" />');
            myTWin.document.writeln('<meta content="no-cache" http-equiv="Cache-control" />');
            myTWin.document.writeln('<meta content="(C) 2006 Liquid Design" name="Copyright" />');
            myTWin.document.writeln('<meta content="robots" name="noindex,nofollow" />');
            myTWin.document.writeln('<title>Thumbnail viewer</title>');
            myTWin.document.writeln('<link media="screen" type="text/css" href="style.css" rel="Stylesheet" />');
            myTWin.document.writeln('<link media="print" type="text/css" href="style.css" rel="Stylesheet" />');
            myTWin.document.writeln('</head>');
            myTWin.document.writeln('<body style="margin: 0px;">');
            myTWin.document.writeln('<a href="javascript: self.close();"><img src="'+link.href+'" width="'+origw+'" height="'+origh+'" alt="" style="border: 0px;" /></a>');
            myTWin.document.writeln('</body>');
            myTWin.document.writeln('</html>');
            myTWin.document.close();
        }else{
            myTWin = window.open(link.href, winName, "location=no,menubar=no,scrollbars=no,titlebar=no,toolbar=no,personalbar=no,status=no,resizable=yes,width="+width+",height="+height+",left="+iwidth+",top="+iheight+",screenX="+iwidth+",screenY="+iheight);
        }
        
        if (myTWin==null || typeof(myTWin)=="undefined"){
            retValue=false;
        }else{
            link.target=winName;
            myTWin.focus();
        }
    }
    return retValue;
}

//end