// copyrighted Eddie Traversa 2002
// http://dhtmlnirvana.com
// etraversa@dhtmlnirvana.com 


var ns4 				= (document.layers);
var w3dom 				= (document.getElementById);
var iedom 				= (document.all);
px 						=  "px";
timer1					= null;
var decrease			= 0.1; 
var offset				= 0;
var selected_id			= null;
var selected_info		= "Welcome";


function defineObjects() {
	if (w3dom || iedom) {
	content			= new layerSetup("contentLYR");
	info			= new layerSetup("infoLYR"); 
  	title			= new layerSetup("titleLYR");
	     
	actionManager('start');
    
	} else {
    document.write('<html><body><center><br><br><br><table width="320"><tr><td><font size="4" face="arial,helvetica,sans-serif">Web Browser Support<\/font><\/td><\/tr><tr><td><img src="images/home_screen.jpg" width="320" height="208"><\/td><\/tr><tr><td><font size="1" face="arial,helvetica,sans-serif">Sorry but this page cannot be displayed in your browser. This site uses the full feature set of Dynamic HTML as supported by W3C capable browers.please download either NS7 or the latest version of Internet Explorer from the following links;<ul><li><a href="www.netscape.com">Netscape<\/a> 7.x and <a href="www.mozilla.org">Mozilla<\/a> 1.1x<li><a href="www.microsoft.com/ie">Internet Explorer<\/a> 6.x<\/ul>. <\/font><\/td><\/tr><\/table><\/center><\/body><\/html>')
 }
}

function layerSetup(id) {
	this.obj			= document.getElementById(id).style;
	this.obj.htm		= document.getElementById(id);
	return this.obj;
 }

function getPosition(id) { 
		endPos = document.getElementById(id).offsetTop;
}	

function verglideMenu(obj,steps) {
		if (document.getElementById) {
		el = document.getElementById(obj) ;
}
		el.xpos = el.offsetTop;
	if (el.xpos < endPos) {
		clearTimeout(timer1);
}
	else if (el.xpos >= endPos) {
		clearTimeout(timer1);
}
		distance = endPos - el.xpos + offset;
		steps = distance*decrease; 
		el.xpos += steps;
		el.style.top = el.xpos+px ;
		timer1= setTimeout("verglideMenu('" + obj + "')",25);
}

function actionManager() {
	var args 			= actionManager.arguments;
	switch(args[0]) {
    case "start" :
		pageManager("display_info",title," ");
		pageManager("load_page","content/blog.html");
		
	break;
	
	case "menu_highlight" :
	if(selected_id		!= args[1]) {
		el				= document.getElementById(args[1]);
		el.className	=  args[2];
 }
	break;
	
	case "menu_click" :
		if(selected_id	!= null) {
		document.getElementById(selected_id).className =  args[2];
}
		document.getElementById(args[1]).className	=	args[3];
		selected_id		=	args[1];
	break;
   }
}

var page_timer			= null;
var motion_timer 		= null;
var page_title			= "Welcome";

function pageManager() {
	var args				= pageManager.arguments;
	switch(args[0]) {
	case "load_page" :
		content.visibility= "hidden";
		content.top			= 10+px;
		document.getElementById("frameData").src = args[1];
		pageManager("display_info",info,"<font class='loadmsg'>Loading...</font>");
	break;
	case "page_is_loaded" :
		pageManager("display_info",title,"<font class='header1'>" + args[1] + " </font>");
		clearTimeout(page_timer);
		page_timer			= setTimeout("pageManager('display_page')",500);
		
	break;
	case "display_page" :
 		content.visibility	= "visible";
		content.top			= 10+px;
 		content.htm.innerHTML = window.frames.frameData.document.getElementById('body').innerHTML;
		pageManager("display_info",info,"<font class='loadmsg'>"  + selected_info + "</font>");
	break;
		
	case "display_info" :
		args[1].htm.innerHTML = args[2];
	break;
}
}

function handleLinks() {
	theLinks 			= document.getElementsByTagName("a");
	for(i=0; i<theLinks.length; i++) {
	theLinks[i].setAttribute("href","#")
    }
  }


var s=document.cookie.split(":");
var v=s[0],f=(s[1])?s[1]:'nirvana.css';
document.write('<link rel="stylesheet" type="text/css" href="'+f+'">\n');//.css">\n');
function switchStyle (n,s){
  var x=new Date();x.setTime(x.getTime()+(60*60*24*365));
    document.cookie=s+':'+n+':'+';expires='+x.toGMTString()+';path=/';
      history.go(0);
}

function sendtoLoc(theurl){
	window.open(theurl);
}

function sendMail(theurl){
	window.location=theurl;
}

var jimWindow   = null;
function openJim() {
  if(screen.height <= 600) {
    var window_width = screen.width-12;
    var window_height = screen.height-12;
  } else {
    var window_width = 800;
    var window_height = 600;
  }
  if(iedom) {
    var window_left = (screen.width - 800) / 2;
    var window_top = (screen.height - 600) / 2;
    jimWindow = window.open('http://dhtmlnirvana.com/jim/jim_stage.htm','JIM','resizable=yes,status=yes,width=' + window_width + ',height=' + window_height
    + ',top=' + window_top + ',left=' + window_left + '');
  } else {
    alert('Note: Attempts to make the site compatible with Netscape 4.x and 6.x ran into a stumbling block due to the fact that this browser doesn\'t support the transparent overlay of plugins with DHTML layers which is essential for the two to work together in this design.  So for now, it is restricted to Explorer 5+, Flash 4 plus the Media Player Plugin.');
  }
}

function openWin() {
   	var window_width  = 765;
    var window_height = 540;
    var window_top    = 10;
    var window_left   = (screen.width-window_width)/2;
    window.open('http://dhtmlnirvana.com/oldnirvana/cyborgdom1.htm','display','resizable=no,menubar=no,scrollbars=yes,width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + '');
}

function Lvl_openWin(u,n,w,h,l,t,c,f) { //v1.0 4LevelWebs available as dw extension from trents site
// http://www.www.fourlevel.com/
  var ww=((screen.width-w)/2);if(c==1){l=ww;t=(screen.height-h)/2;}if(c==2){l=ww}
	f+=',top='+t+',left='+l;LvlWin = window.open(u,n,f);LvlWin.focus();
}

window.onresize 			= function () {
		history.go(0);
}
