function embed_flash() {
  
window.onload = checkSizes;
  
window.onresize = checkSizes;
  
var bLoaded = false;
  
function checkSizes() {
    
  var height = window.innerHeight ? window.innerHeight : 
                 
         (document.documentElement.clientHeight);
    
  var width  = window.innerWidth ? window.innerWidth :
                 
         (document.documentElement.clientWidth);
    
  var fc = document.getElementById('flashcontent');
    
//var f = document.getElementById('jsk_flash');

    


   
if(bLoaded == false) {
      
  bLoaded = true;
      
  window.setTimeout(function() {
        
   var so = new SWFObject("autorun2.swf", "autorun2", "100%", "100%", "8", "#FFFFFF");
        
   so.addParam("allowScriptAccess", "sameDomain");
        
   so.addParam("scale", "noscale");
        
   so.addParam("menu", "false");
        
   so.addParam("quality", "high");
        
   //so.addParam("wmode", "transparent");
        
   so.addParam("align", "middle");
        
   so.addParam("bgcolor", "#FFFFFF");

   so.addParam("allowFullScreen", "true");        
   so.setAttribute("redirectUrl","/noflash_hotel_rural");
        
 hashurl = sGetValidHashUrlForFlash();
        
  //alert(hashurl);
        
  so.addVariable("startPageId",window.location.hash?window.location.hash.substr(1):hashurl); 
        
  so.write("flashcontent");
      
  }, 50 );

    
document.historyHandler = new historyHandler ();

    
   }
  
 }

}
      


function sGetValidHashUrlForFlash() {
  
 var url = window.location.href.match(/.+?:\/\/.*?(\/.*)#?/);
  
 if(!url) url = new Array()
  if(!url[1] || url[1].length<4) url[1] = '';
  
 if(url[1].match(/#/)) url[1] = url[1].replace(/(.*?)#.*/,'$1');

  

var hashurl = url[1];
  
  

var p1 = /^(.*?)\/(projects|associates|architecture)\/(.*?)\.html.*?unique_id=([0-9]+).*$/;
  
var p2 = /^(.*?\/.*?)\.html.*$/;
  
var p3 = /^(.*?)\/(projects)\.html.*?type=([0-9]+).*$/;
  
 
if(hashurl.match(p1)) {
    
 hashurl = hashurl.replace(p1,'$1/$2/$4');
  
 } else if(hashurl.match(p3)) {
    
 hashurl = hashurl.replace(p3,'$1/$2/type/$3');
  
 } else {
    
 hashurl = hashurl.replace(p2,'$1');
  
}
  
return(hashurl);

}



function historyHandler () {

  

window.onload = function() {
    

//document.getElementById('accessories').innerHTML = unescape(state);
  
};
  
this.setDocumentTitle = function(title) {
    
//alert('setDocumentTitle: ' + title);
    
document.title = 'JSK Dipl. Ing. Architekten - ' + title;
  
};
  

// this is the public method that will be called to add an entry
  
this.addHistory = function(data,title) {
    
unFocus.History.Keeper.addHistory(escape(data));
  
};
  
  

// the method that will take updates from the History Keeper
  
this.onHistoryChange = function(pageId) {
    
//alert('onHistoryChange: ' + pushDeeplink);
    
pushDeeplink (pageId);
  
};
  
  

// add the event listener
  
// :NOTE: onHistoryChange has to be anchored to this object.
  
// A private method would not be properly scoped, and could not update state.
  
unFocus.History.Keeper.addEventListener('historyChange', this.onHistoryChange);
  
  

this.getCurrentState = function() {
    
//alert(state);
  
 };

};




function getSWF (movieName) {
    
  if (navigator.appName.indexOf("Microsoft") != -1) {
        
  return window[movieName]
    
  } else {
        
    return document[movieName]
    
  }

}



function pushDeeplink (id) {
    
  getSWF("jsk_flash").pushDeeplink (id);


}
