jQuery(document).ready(function(){         
    var typeSize=typeof(windowWidth);
    if(typeSize=="string")
        var index=windowWidth.indexOf("%");
    else
        index=-1;
    if(index!=-1)
    {
        windowWidth=windowWidth.replace("%","");
        windowHeight=windowHeight.replace("%","");
        windowWidth=parseInt(windowWidth);
        windowHeight=parseInt(windowHeight);
        windowHeight=(screen.height/100)*windowHeight;
        windowWidth=(screen.width/100)*windowWidth;
        if(windowHeight==screen.height)
            windowHeight-=65;
        windowWidth=windowWidth-5;
    }
    else
    {
        windowWidth=windowWidth.replace("px","");
        windowHeight=windowHeight.replace("px","");
        windowWidth=parseInt(windowWidth);
        windowHeight=parseInt(windowHeight);
    }
    
    if(typeof($.fancybox) == 'undefined')
    {
        var scriptURL=scrURL+"/global/js/jquery/fancybox/jquery.fancybox.js";
        var cssURL=scrURL+"/global/styles/fancybox/jquery.fancybox.css";
        $('body').append('<link rel="stylesheet" href="'+cssURL+'" />');
        $.getScript(scriptURL,function(){
            getFancyBox(); 
       });
    } 
    else
        getFancyBox();  
        
    function getFancyBox()
    {
        $(".fancyIFrame").fancybox({                
            "width": windowWidth,
            "height": windowHeight,
            "scrolling": "no"            
        });
    }
});
function popup(elem){    
    $(elem).next().click();
    $("#fancybox-overlay").css("height", $(document).height());
}
