// determine server
//if (top.location != self.location) {
  //top.location = self.location;
//}

var url = self.location.href;
url = url.toLowerCase();

var DOM    = '';
//var local = 'localhost/star/';
//var local = 'site230.webhost4life.com/star/';
local = 'file:///D:/_websites/_STARparent/_Site/';

//var live  = 'cubefree.com';
var live  = 'starparent.com';
//var suppl = '/clients/star/dev/';
var suppl = '/';

((url.indexOf('_websites') > -1)? DOM = local: DOM = 'http:\/\/www.' + live + suppl);
/*
var DotComPosn = url.indexOf('.com');
if( DotComPosn < 0 )
    DOM = url.substr(0, url.indexOf('_Site')+6);
else
    DOM = url.substr(0, url.indexOf('.com')+5);
//DOM = url.substr(0, url.indexOf('ecrary')+7);
*/

// image variables used in menu
var imgLN  = DOM + "images/nav/left/";
var imgLLN = DOM + "images/nav/lower/";
var imgTN  = DOM + "images/nav/top/";
var imgPU  = DOM + "images/nav/star/";
var imgPUa = DOM + "images/nav/star_new/";

// file extension
var ext = ".html";

// go to top function (not in use)
function gotoTop() {
	window.location = "http:\/\/" + location.hostname + location.pathname + "#top";
}



// Search box text
var main_term = '\>\> Search STAR';
var repl_term = '\>\> Enter search text'
function checkSearchForm(f){
	if(f.term.value.length < 1 || f.term.value == main_term ){
		alert("Please enter the text you want to find.");
		f.term.focus();
		f.term.value=repl_term;
		return false;
	} else {
		return true;
	}
}

function checkSearch(f){
	if (f.term.value == main_term) {
		f.term.value = '';
	}	
	if (f.term.value == repl_term) {
		f.term.value = '';
	}
}

function checkSearchSubmit() {
	if (checkSearchForm(document.ssearch)) { 		
		document.ssearch.submit();
	}
}

// controls new windows for PopUp teaching pages
function fPopWin(page) {
	popWin=open(DOM+'star/'+page+ext,'popUp','toolbar=no,resizable=yes,scrollbars=yes,width=670,height=650,top=50,left=50');
	window.popWin.focus();
	setTimeout('checkPopWin()', 2000);
}

function checkPopWin() {
	if (!window.popWin) {
		alert("Your internet browser does NOT allow popup windows. \n\nThe STAR PopUps will be opened in your existing window.");
		location.href = DOM + "star/whatis"+ ext;
	}
}
//
function winCntrl(loc) {
	
	if (!loc) loc = 'index';

	if (window.opener==null || (!window.opener)) {
		var x = self.screen.availWidth;
		var y = self.screen.availHeight;		
		Win=open(DOM + loc + ext,'index','toolbar=yes,menubar=yes,location=yes, resizable=yes,scrollbars=yes,width='+x+',height='+y+',top=0,left=0');
		//,
		window.Win.focus();
		window.opener = self.window
		window.opener.close();
	} else {
		window.close();
		window.opener.location = DOM + loc + ext
		window.opener.focus();
	}
}

//Anchor jump for IFRAME
function goAnchor(popup) {
	document.location.href =  popup + ext + "#top"; 
	//document.location.href =  "#poptop"; 
}