function Is() {
	var agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla')!=-1) 
 && ((agent.indexOf('spoofer')==-1) && 
 (agent.indexOf('compatible')==-1)));
	this.ns4 = (this.ns && (this.major >= 4));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie4 = (this.ie && (this.major >= 4));
}
var is = new Is()
if(is.ns4) {
	doc = "document";
	sty = "";
	htm = ".document"
} else if(is.ie4) {
	doc = "document.all";
	sty = ".style";
	htm = ""
}

var count=0;
function preLoad() {
	menumap = new Image();
	menumap.onload = loadcheck;
	menumap.src = "menumap.gif";
	sphere=new Image();
	sphere.onload = loadcheck;
	sphere.src = "menu.gif";	
        menu=new Image();
	menu.onload = loadcheck;
	menu.src = "menuitem.gif";
	}

function loadcheck() {
	count++;
	if(count == 3) {
		layersetup();
		}
	}

function layersetup() {
	menumaplyr = eval(doc + '["menumaplayer"]' + sty);
	menumaplyr.left = 5;
	menumaplyr.top = available_height-170;
	spherelyr = eval(doc + '["spherelayer"]' + sty);
	spherelyr.left = parseInt(menumaplyr.left);
	spherelyr.top = parseInt(menumaplyr.top);
	menulyr = eval(doc + '["menulayer"]' + sty);
	menulyr.left = parseInt(menumaplyr.left)+10;
	menulyr.top = parseInt(menumaplyr.top)+78;
        visibilitysetup();
	}

function visibilitysetup() {
	arraysetup();
	menulyr.visibility = "visible";
	spherelyr.visibility = "visible";
	menumaplyr.visibility = "visible";
	}

function arrayvalues(move,top,right,bottom,left,url) {
	this.move = move;
	this.top = top;
	this.right = right;
	this.bottom = bottom;
	this.left = left;
	this.url = url;
}

function arraysetup() {
	spherearray = new Array();
	spherearray[0] = new arrayvalues(parseInt(spherelyr.left),0,178,178,0);
	spherearray[1] = new arrayvalues(parseInt(spherelyr.left)-178,0,356,178,178);
	menuarray = new Array();
	menuarray[0] = new arrayvalues(parseInt(menumaplyr.top)+78,0,154,40,0,"abouttps.php");
	menuarray[1] = new arrayvalues(parseInt(menumaplyr.top)+46,30,154,60,0,"calendar.php");
	menuarray[2] = new arrayvalues(parseInt(menumaplyr.top)+13,60,154,90,0,"contactus.php");
	menuarray[3] = new arrayvalues(parseInt(menumaplyr.top)-19,90,154,120,0,"singerprofile.php");
	menuarray[4] = new arrayvalues(parseInt(menumaplyr.top)-50,120,154,150,0,"home.php");
	menuarray[5] = new arrayvalues(parseInt(menumaplyr.top)-82,150,154,180,0,"links.php");
	menuarray[6] = new arrayvalues(parseInt(menumaplyr.top)-114,180,154,210,0,"services.php");
}

function movesphere(index) {
	spherelyr.left = spherearray[index].move;
	cliplayer(spherelyr,spherearray,index);
	}

var illus_index = 0;
function changeillus(changedir){
	if (changedir == 'right' && illus_index !=29) {
		illus_index++;
	}else if(changedir == 'left' && illus_index !=0) { 
		illus_index--;
	}
	illusarraysetup();
	mywindow = window.open(illusarray[illus_index].url,"viewer_window");
}

var menu_index = 0;
function movemenu(dir) {
	if (dir == 'up' && menu_index !=6) {
		menu_index++;
	}else if(dir == 'dn' && menu_index !=0) {
		menu_index--;
	}
	menulyr.top = menuarray[menu_index].move;
	cliplayer(menulyr,menuarray,menu_index);
	}

function selectoption() {
	myotherwindow = window.open(menuarray[menu_index].url,"main_window");
}

function cliplayer(layer,array,index) {
	var ctop = array[index].top;
	var cright = array[index].right;
	var cbottom = array[index].bottom;
	var cleft = array[index].left;
	if(is.ns4) {
		layer.clip.top = ctop;
		layer.clip.right = cright;
		layer.clip.bottom = cbottom;
		layer.clip.left = cleft;
	}else {
		layer.clip ='rect('+ ctop + ' ' + cright + ' ' + cbottom + ' ' + cleft + ')';
	}
	}

function tarrayvalues(move,top,right,bottom,left,url) {
	this.move = move;
	this.top = top;
	this.right = right;
	this.bottom = bottom;
	this.left = left;
	this.url = url;
}

function TPSarraysetup() {
	TPSarray = new Array();
	TPSarray[0] = new tarrayvalues(0,0,0,0,0,"TPS1.htm");
	TPSarray[1] = new tarrayvalues(0,0,0,0,0,"TPS2.htm");
	TPSarray[2] = new tarrayvalues(0,0,0,0,0,"TPS3.htm");
	TPSarray[3] = new tarrayvalues(0,0,0,0,0,"TPS4.htm");
	}

var TPS_index = 0;
function changeTPS(changedir){
	if (changedir == 'right' && TPS_index !=3) {
		TPS_index++;
	}else if(changedir == 'left' && TPS_index !=0) { 
		TPS_index--;
	}
	TPSarraysetup();
	mywindow = window.open(TPSarray[TPS_index].url,"TPS");
}

function sarrayvalues(move,top,right,bottom,left,url) {
	this.move = move;
	this.top = top;
	this.right = right;
	this.bottom = bottom;
	this.left = left;
	this.url = url;
}

function singerarraysetup() {
	singerarray = new Array();
	singerarray[0] = new sarrayvalues(0,0,0,0,0,"tim.htm");
	singerarray[1] = new sarrayvalues(0,0,0,0,0,"dionne.htm");
	singerarray[2] = new sarrayvalues(0,0,0,0,0,"melvin.htm");
	singerarray[3] = new sarrayvalues(0,0,0,0,0,"evangeline.htm");
	singerarray[4] = new sarrayvalues(0,0,0,0,0,"ray.htm");
	singerarray[5] = new sarrayvalues(0,0,0,0,0,"peretha.htm");
	singerarray[6] = new sarrayvalues(0,0,0,0,0,"lillian.htm");
	singerarray[7] = new sarrayvalues(0,0,0,0,0,"dorothy.htm");
	singerarray[8] = new sarrayvalues(0,0,0,0,0,"clifford.htm");
	singerarray[9] = new sarrayvalues(0,0,0,0,0,"teri.htm");
	singerarray[10] = new sarrayvalues(0,0,0,0,0,"tammi.htm");
	}

var singer_index = 0;
function changesinger(changedir){
	if (changedir == 'right' && singer_index !=10) {
		singer_index++;
	}else if(changedir == 'left' && singer_index !=0) { 
		singer_index--;
	}
	singerarraysetup();
	mywindow = window.open(singerarray[singer_index].url,"singer");
}

function carrayvalues(move,top,right,bottom,left,url) {
	this.move = move;
	this.top = top;
	this.right = right;
	this.bottom = bottom;
	this.left = left;
	this.url = url;
}

function calarraysetup() {
	calarray = new Array();
	calarray[0] = new carrayvalues(0,0,0,0,0,"month1.htm");
	calarray[1] = new carrayvalues(0,0,0,0,0,"month2.htm");
	calarray[2] = new carrayvalues(0,0,0,0,0,"month3.htm");
	}

var cal_index = 0;
function changecal(changedir){
	if (changedir == 'right' && cal_index !=2) {
		cal_index++;
	}else if(changedir == 'left' && cal_index !=0) { 
		cal_index--;
	}
	calarraysetup();
	mywindow = window.open(calarray[cal_index].url,"calendar");
}
