function sizeWindow() { 
var winSize = document.body.clientWidth; 
if (winSize < 1025) { 
document.getElementById("content2").style.left = "40px"; 
} else if (winSize > 1024) { 
document.getElementById("content2").style.left = "995px"; 
} else { 
document.getElementById("content2").style.left = "995px"; 
} 
}

function myPopup(url) {
    window.open( url ,'_self' )
}

function MM_preloadImages() {
    //v3.0
    var d=document;
    if(d.images) {
        if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
        for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0) {
            d.MM_p[j]=new Image;
            d.MM_p[j++].src=a[i];
        }
    }
}
sfHover = function() {
    var sfEls = document.getElementById("navbar").getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" hover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" hover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function loadSWF(url, targetID, galleryID) {
    
    //Check for existing SWF
    if(isObject(targetID)) {
        
        //replace object/element with a new div
        replaceSwfWithEmptyDiv(targetID);
    }
    
    //Embed SWF
    if (swfobject.hasFlashPlayerVersion("7")) {
        
        var attributes = {
        }
        ;
        var params = {
            bgcolor:"#444547",
            valign: "top"
        }
        ;
        
        var flashvars = {
            xmlDataPath: 'gallery.php?id='+galleryID,
            preloaderColor: '0x363636F'
        }
        ;
        
        
        
        var obj = swfobject.embedSWF(url, "content", "642", "800", "6.0.0", "#FFFFFF", flashvars, params, attributes);
    }
}


function isObject(targetID) {
    
    var isFound = false;
    var el = document.getElementById(targetID);
    
    if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")) {
        
        isFound = true;
    }
    
    return isFound;
}


function replaceSwfWithEmptyDiv(targetID) {
    
    var el = document.getElementById(targetID);
    
    if(el) {
        
        var div = document.createElement("div");
        
        el.parentNode.insertBefore(div, el);
        
        //Remove the SWF
        swfobject.removeSWF(targetID);
        
        //Give the new DIV the old element's ID
        div.setAttribute("id", targetID);
    }
}
