var unFocus = {
  addHystory: function(){
  if(document.all){
    if(!unFocus.Hystory_Iframe){unFocus.create_iframe();}
   }
   for (var i=0; i<arguments.length; i++){
       unFocus.create_iframe_HTML(arguments[i]);
    }
   },
  create_iframe: function(){
   var g = document.createElement("iframe");
        g.id ="unFocusHistoryFrame";
        g.style.display="none";
        document.body.insertBefore(g,document.body.firstChild);
        unFocus.Hystory_Iframe=frames[0];
  },
  create_iframe_HTML: function(a){

   if(!document.all){ unFocus.onchage_history(a); return false; } //Mozilla
   if(!unFocus.Hystory_Iframe) return false;
        with(unFocus.Hystory_Iframe.document){//MSI
           open("text/html");
           if(typeof ActiveXObject!="undefined"){
            write("<html><head></head><body>"+a+"</body></html>");
            unFocus.onchage_history(a);
           }else{ //Opera
             write("<html><head></head><body onl",'oad="parent.unFocus.onchage_history(\''+a+'\');">',a+"</body></html>");
           }
           close()
        }},
  onchage_history: function(a){
       document.location.hash = "#"+a;
       unFocus._currentHash=a;
   },
  get_current_hash : function(){
    var a = parent.location.hash.substring(1);
//    if(window.opera){ a = unFocus.get_iframe_content();}
    if(document.all){ a = unFocus.get_iframe_content();}
    return a;
  },
 get_iframe_content: function(){
    var  o = document.getElementById("unFocusHistoryFrame");
    if(!o) return parent.location.hash.substring(1);
     var srcContent = (o.contentDocument) ?
          o.contentDocument.getElementsByTagName("BODY")[0].innerHTML :
          (o.contentWindow) ?
          o.contentWindow.document.body.innerHTML : "";
    return srcContent;
  },
 watchHash: function (){
    var a = unFocus.get_current_hash();
    if(!a && unFocus.start_page ){a = unFocus.start_page; };
    if( !unFocus.a ) { unFocus.a=1;  unFocus.addHystory(a); if(a) unFocus.onchange(a);  return false;}
    if(unFocus._currentHash+""!=a+"" ){
         unFocus._currentHash=a;
         if(typeof ActiveXObject!="undefined"){unFocus.onchage_history(a); }
         if(unFocus.onchange)unFocus.onchange(a);
     }
 }

}//end_of_unFocus;
