// ---------------------------------------------------------
//	GLOBAL VARIABLES
//----------------------------------------------------------
var newwin, newpop;
// default values
var popWinName="popWin";
var newWinName="newWin";
var popWidth=300;
var popHeight=300;
var newWinWidth=600;
var newWinHeight=600;
var reSize = "yes";
var currentProject ="blank";

	var agt = navigator.userAgent.toLowerCase();
	var browser = navigator.appName.toLowerCase();
	var isNav = (browser=="netscape");
	if (agt.indexOf("msie") !=-1) { br = 'ie' }
	var isMac = (agt.indexOf("mac") != -1);
	if (isNav && agt.indexOf("netscape6") != -1) { 
		ver=agt.substr(agt.indexOf("netscape6")).split("/")[1];
		br='nn6';
	} else if (isNav && agt.indexOf("mozilla") != -1) {
		br='nn6';
	} else if (isNav) { 
		ver=(isNav)?parseFloat(navigator.appVersion):agt.split(";")[1].substr(6) ;
		 br='nn4';
	};



// ---------------------------------------------------------
//	FUNCTIONS
//----------------------------------------------------------

function GetTheObj(theItm) {
	if (br == 'ie') {
		theObj = eval("document.all." + theItm);
	} else if (br == 'nn4') {
		theObj = eval("document.layers.parent.layers[theItm]");
	} else if (br == 'nn6'){ 
		theObj = eval("document.getElementById(theItm)");
	}
	return theObj;
}

function popUp(filename){
	var argv=popUp.arguments;  
	var argc=argv.length;  
	var name=(argc>1) ? argv[1] : popWinName;  
	var w=(argc>2) ? argv[2]:popWidth;
	var h=(argc>3) ? argv[3]:popHeight;
	var s=(argc>4) ? argv[4]:reSize;
	var scroll=(argc>5) ? argv[5]:"no";
	var left=(argc>6) ? argv[6]:200;
	var top=(argc>7) ? argv[7]:100;
	window.name="popWin";
	if(!newpop||newpop.closed) {
	    
	    } else {
	    
	}
	newpop=window.open(filename, name, "toolbar=no,width="+w+",height="+h+",menubar=no,resizable="+s+",status=no,scrollbars="+scroll+",left="+left+",top="+top);

};

function newWindow(filename){
	var argv=newWindow.arguments;  
	var argc=argv.length;  
	var name=(argc>1) ? argv[1] : newWinName;  
	var w=(argc>2) ? argv[2]:newWinWidth;
	var h=(argc>3) ? argv[3]:newWinHeight;
	window.name="zokaWin";
	if(!newwin||newwin.closed) {
		newwin=window.open(filename, name, "toolbar=yes,width="+w+",height="+h+",menubar=no,resizable=no,status=yes,scrollbars=yes,left=200,top=100");
	} else {
		newwin.focus();
	}
};

function switchImg(imageName) {
    theImg = "swapimage";

  if (document.images) {
    document[theImg].src = "images/prj_home_"+ imageName;
  }
}

function switchDiv(id,state) {
   obj = GetTheObj(id);
    if (state == "ON") {
	obj.style.display = "block";
    } else {
	obj.style.display = "none";
    }
  }

function swapproject(name,imagename) {
    oldProject = currentProject;
    switchDiv(oldProject,"OFF")
    currentProject = name;
    switchImg(imagename)
    switchDiv(name,"ON")
}

function swapDetails(section,name,imageName) {
	currentProject = defaultSection[section];
	oldProject = currentProject;
    switchDiv(oldProject,"OFF")
    defaultSection[section] = name;
	sectionImage = "swapsection" + section;
	  if (document.images) {
		document[sectionImage].src = "images/" + imageName;
	  }
    switchDiv(name,"ON")
}
