
firstPlay=true;
floatIsOpen=false;

historyList=new Array('');
if ( navigator.userAgent.indexOf("iPhone") > 0) {
	window.location = "http://www.edenspany.com/08/iphone/";
} else { 
}
	
function loadFuncs() { 
    var ga=location.href.split('#')[1];
    if (ga) {newPage(ga);}
    //	loadAllSwfs(VidSwfs,VidSwfSettings);
	loadAdSwfs();
}
    
// ui
function navOO(c, t) { 
    var e=document.getElementById('nav'+c);
    var sp='images/navs/'+c;
    e.src=(!t) ? sp+'.gif' : sp+'_.gif';
}
 
    //navigating
function newPage(doc) { 
    addToHistory(doc);
    changeMainDivText(doc);
    changeHrefAnchor(doc);
    scroll(0,0);
}

function changeMainDivText(doc) {
    ajaxDivLoad("main", "./text/"+doc+".php");
}
  
function addToHistory(d) { 
    historyList.push(d);
    if (historyList.length>20) { historyList.shift();}
}

function elementHS(e,t) { 
    var E=(typeof(e)=='string') ? document.getElementById(e) : e;
    if(E) { 
        E.style.display=(!t) ? "none" : "block";
    }
}

function changeHrefAnchor(d) { 
    var g=location.href;
    var ga='';
    g=(g.indexOf('#')==-1) ? g+'#' : g;
    ga=g.split('#');
    g=ga[0]+'#'+d;
    if(document.frames) { 
        top.frames['doo'].location='__doo.php?'+d;
    }
    else {
        location.href=g;
    }
}

    // floating ad
function close_float(seed) { 
    floatOC(seed, false);
}

function open_float(seed, timer) { 
    floatOC(seed, true, timer);
}

function floatOC(seed,  t, timer) { 
    floatIsOpen=t;
    var x=(t) ? true : false;
    elementHS("float_div",t);
    elementHS("float_mask_left",t);
    elementHS("float_mask_right",t);
    elementHS("float_close",t);
}



/* ajax functions
modified from Michael Mahemoff (c) 2006 O'Reilly books
*/

function $(id) { return document.getElementById(id);}

function createXMLHttpRequest( ) {
    try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
    try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
    try { return new XMLHttpRequest( ); } catch(e) {}
    return null;
    }
  
function ajaxDivLoad(divRef, doc) {
    var xhr = createXMLHttpRequest( );
    xhr.onreadystatechange = function( ) {
      if (xhr.readyState==4) { // Request is finished
        if (xhr.status==200) {
          $(divRef).innerHTML = xhr.responseText;
        } else {
        }
      }
    }
    xhr.open("GET", doc, true);
    xhr.send(null);
  }
  
  
function goBack(){ 
    if (document.frames) { 
        var dd=top.frames['doo'];
        var ddx=dd.getLocation().split('?')[1];
    } else {
        var dd=location.href;
        var ddx=location.href.split('#')[1];
    }
    var hh=historyList[historyList.length-1];
    

    if (historyList.length<=0){
        setTimeout(goBack, 400);
        return;
    }
    
    if(hh==ddx) { 
        setTimeout(goBack, 400);
        delete ddx;
        return;
    } else { 
        if(document.frames) { 
            //location.href=location.href.split('#')[0]+'#'+ddx;
            newPage(ddx);
        } else {
            newPage(ddx);
        }
        
        setTimeout(goBack,400);
        delete ddx;
        return;
    }
   
  }
  
 
 
  function loadAdSwfs() {
	  if (isSafari())  return;
//	  swfobject.embedSWF(float_parent_swf+"?="+Math.random(),
	//	  "float_parent", "260", "140", "9.0.45", {}, {"wmode":"transparent"});
	  swfobject.embedSWF(float_swf+"?="+Math.random(), 
		  "float_div", 555, 416, "9.0.0", {"wmode":"transparent"});
  }
  
  function isSafari() { 
	  try { 
		  return (navigator.vendor.indexOf("Apple")>-1);
	  } catch(err) { 
		  return false;
	  }
	  
	  
  }
