if(!websiteurl){
    var websiteurl = "http://www.santafeenobras.com.ar/";
    var templateurl = websiteurl + "site/template/";
    var systemurl = websiteurl;
    var page = "home";
    var obra_id = false;
}

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);
        swfobject.addLoadEvent(initSplitHistory)
}

function onDomLoad(){ 
	
        document.body.className = "flash";
        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%";
            if(size[0] < 960 || size[1] < 575){
                 document.body.style.overflow = "auto";
            }else{
                 document.body.style.overflow = "hidden";
            }
            
        };        
        window.onresize();
}
var flashvars = {
    baseurl: websiteurl,
    templateurl: templateurl,
    systemurl: systemurl,
    page: page
};

if(obra_id){
    flashvars.obra = obra_id;
}

var params = {
    allowFullScreen: true,
    menu:false,
    allowScriptAccess:"always"
}

swfobject.embedSWF(templateurl + "flash/santafe.swf?version=23032010", "frame", "100%", "100%", "9.0.0", templateurl +  "flash/expressInstall.swf",flashvars, params);

var SH;

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

SplitHistory.prototype.setLastLocation = function(){    
    this.lastlocation = this.currentlocation;
    clearTimeout(this.timer);
    this.timer = setTimeout("SplitNavigate()",500);
}

SplitHistory.prototype.hasLocation = function(str){
    for(var i in this.hashHistory){
        var location = this.hashHistory[i];
        if(location==str)return true;

    }
    return false;
}

SplitHistory.prototype.setLocation = function(str){
    if(document.location.hash){
        document.location.hash = "#" + str;
        this.lastlocation = document.location.hash;
    }else{
        window.location.hash = "#" + str;
        this.lastlocation = window.location.hash;
    }    
}

SplitHistory.prototype.output = function(str){
    alert(str);
}

SplitTracker = function(){
    SH.currentlocation = (document.location.hash)?document.location.hash:window.location.hash;
    if(SH.currentlocation!=SH.lastlocation)SH.setLastLocation();
    if(!SH.hasLocation(SH.currentlocation))SH.hashHistory.push(SH.currentlocation);
    return true;
}

function initSplitHistory(mymovie){
    var mymovie = document.getElementById("frame");
    SH = new SplitHistory(mymovie);
    setInterval(SplitTracker,100);
}

SplitNavigate = function(){
    SH.flash.SplitNavigateTo(SH.currentlocation);
}



