function getViewportSize()
{
        var size = [0, 0];
        if (typeof window.innerWidth != "undefined")
        {
                size = [window.innerWidth, window.innerHeight];
        } else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0)
        {
                size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
        } else {
                size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight];
        }
        return size;
}

if (swfobject.hasFlashPlayerVersion("9.0.0"))
{
        swfobject.addDomLoadEvent(onDomLoad);
}

function onDomLoad(){
        window.onresize = function()
        {
                var el = document.getElementById("frame");
                var size = getViewportSize();
                el.style.width = size[0] < 960 ? "960px" : "100%";
                el.style.height = size[1] < 575 ? "575px" : "100%";
        };
        window.onresize();
       
        
}

var flashvars = {
    baseurl: websiteurl,
    templateurl: templateurl,
    pageid: pageid,
    hash: window.location.hash
};

swfobject.embedSWF(templateurl + "flash/kameeliejon.swf", "frame", "100%", "100%", "9.0.0", templateurl +  "flash/expressInstall.swf",flashvars);

var SH;

SplitHistory = function(mymovie){
    this.flash = mymovie;
    alert(this.flash);
    this.lastlocation = "";
    this.currentlocation = "";
    this.history = new Array();
}

SplitTracker = function(){
    SH.currentlocation = window.location.hash;

    if(SH.currentlocation!=SH.lastlocation){
       SH.flash("ExternalInterfaceExample").setSplitPath(SH.currentlocation);
    }
    SH.lastlocation = SH.currentlocation
    var index = SH.history.indexOf(SH.currentlocation);
    if(index==-1)SH.history.push(SH.currentlocation);
    return true;
}

function initSplitHistory(mymovie){
    SH = new SplitHistory(mymovie);
    setInterval(SplitTracker,100);
}


document.observe("dom:loaded",initImages);

function initImages(event){
    $$('img').each(function(image){
       var parent = image.parentNode;
       if(parent.tagName.toLowerCase()=="a"){
           var link = parent.href;           
           var pattern = /\.jpg$/i;
           if(link.match(pattern) && parent.rel=="")parent.rel = "lightbox";
       }
    });
}






