var myBrowserValue = 0;
var myTimer = null;
var mySwf = 0;
var myQt = 0;
myPlugins();
whichBrowser();

// IMAGE INITIALIZATION
imag = new Array();
imag[0] = "http://www.fallcreekconsultants.com/images/nav/nav_about_off.gif";
imag[1] = "http://www.fallcreekconsultants.com/images/nav/nav_about_over.gif";
imag[2] = "http://www.fallcreekconsultants.com/images/nav/skyline_about_off.jpg";
imag[3] = "http://www.fallcreekconsultants.com/images/nav/skyline_about_over.jpg";
imag[4] = "http://www.fallcreekconsultants.com/images/nav/nav_services_off.gif";
imag[5] = "http://www.fallcreekconsultants.com/images/nav/nav_services_over.gif";
imag[6] = "http://www.fallcreekconsultants.com/images/nav/skyline_services_off.jpg";
imag[7] = "http://www.fallcreekconsultants.com/images/nav/skyline_services_over.jpg";
imag[8] = "http://www.fallcreekconsultants.com/images/nav/nav_clients_off.gif";
imag[9] = "http://www.fallcreekconsultants.com/images/nav/nav_clients_over.gif";
imag[10] = "http://www.fallcreekconsultants.com/images/nav/skyline_clients_off.jpg";
imag[11] = "http://www.fallcreekconsultants.com/images/nav/skyline_clients_over.jpg";
imag[12] = "http://www.fallcreekconsultants.com/images/nav/nav_resources_off.gif";
imag[13] = "http://www.fallcreekconsultants.com/images/nav/nav_resources_over.gif";
imag[14] = "http://www.fallcreekconsultants.com/images/nav/skyline_resources_off.jpg";
imag[15] = "http://www.fallcreekconsultants.com/images/nav/skyline_resources_over.jpg";
imag[16] = "http://www.fallcreekconsultants.com/images/nav/nav_new_off.gif";
imag[17] = "http://www.fallcreekconsultants.com/images/nav/nav_new_over.gif";
imag[18] = "http://www.fallcreekconsultants.com/images/nav/skyline_new_off.jpg";
imag[19] = "http://www.fallcreekconsultants.com/images/nav/skyline_new_over.jpg"
imag[20] = "http://www.fallcreekconsultants.com/images/nav/nav_contact_off.gif";
imag[21] = "http://www.fallcreekconsultants.com/images/nav/nav_contact_over.gif";

im = new Array();
for (var i = 0; i < imag.length; i++) {
	im[i] = new Image()
	im[i].src = imag[i]
}

function changeImage(num,imgname){
	document.images[imgname].src = im[num].src;
}

function myPop(myFile, myWidth, myHeight, myToolbar, myStatusbar, myScrollbars, myResizeable, myLocationbar, myMenubar) {
	myInsert="";
	if (myWidth == null) {myWidth = 300;}
	if (myHeight == null) {myHeight = 300;}
	if (myStatusbar==1) {myInsert+="status=1,";} else {myInsert+="status=0,";}
	if (myLocationbar==1) {myInsert+="location=1,";} else {myInsert+="location=0,";}
	if (myScrollbars==1) {myInsert+="scrollbars=1,";} else {myInsert+="scrollbars=0,";}
	if (myMenubar==1) {myInsert+="menubar=1,";} else {myInsert+="menubar=0,";}
	if (myResizeable==1) {myInsert+="resizable=1,";} else {myInsert+="resizable=0,";}
	if (myToolbar==1) {myInsert+="toolbar=1,";} else {myInsert+="toolbar=0,";}
	myInsert += "width="+myWidth+",height="+myHeight;
	if(myFile.search("clndr.php")!=-1) {
		newWin3 = window.open(myFile,'newWin3',myInsert);
		newWin3.focus();
	}
	else {
		newWin2 = window.open(myFile,'newWin2',myInsert);
		newWin2.focus();
	}
}

function myPop2(myFile, myWidth, myHeight, myToolbar, myStatusbar, myScrollbars, myResizeable, myLocationbar, myMenubar) {
	myInsert="";
	if (myWidth == null) {myWidth = 300;}
	if (myHeight == null) {myHeight = 300;}
	if (myStatusbar==1) {myInsert+="status=1,";} else {myInsert+="status=0,";}
	if (myLocationbar==1) {myInsert+="location=1,";} else {myInsert+="location=0,";}
	if (myScrollbars==1) {myInsert+="scrollbars=1,";} else {myInsert+="scrollbars=0,";}
	if (myMenubar==1) {myInsert+="menubar=1,";} else {myInsert+="menubar=0,";}
	if (myResizeable==1) {myInsert+="resizable=1,";} else {myInsert+="resizable=0,";}
	if (myToolbar==1) {myInsert+="toolbar=1,";} else {myInsert+="toolbar=0,";}
	myInsert += "width="+myWidth+",height="+myHeight;
	otherWin = window.open(myFile,'otherWin',myInsert);
	otherWin.focus();
}

function whichBrowser() {
	var platforminfo = new Array()
	if (navigator.userAgent.search(/MSIE/) != -1) {
		platformInfo = navigator.appVersion.split(';');
		myBrowser = navigator.appName + " " + platformInfo[1].substr(6);
		myPlatform = platformInfo[2];
		myBrowserValue = 1;
	}
	else if(navigator.userAgent.search(/Netscape6/) != -1){
		platformInfo = navigator.appVersion.split(' ');
		myBrowser = navigator.appName + " " + platformInfo[0];
		myPlatform = platformInfo[1].substr(1);
		myBrowserValue = 3;
	}
	else if(navigator.userAgent.search(/Gecko/) != -1){
		platformInfo = navigator.appVersion.split(' ');
		myBrowser = navigator.appName + " " + platformInfo[0];
		myPlatform = platformInfo[2].substr(1);
		myBrowserValue = 4;
	}
	else if (navigator.userAgent.search(/Mozilla/) != -1) {
		platformInfo = navigator.appVersion.split(' ');
		myBrowser = navigator.appName + " " + platformInfo[0];
		myPlatform = platformInfo[2].substr(1);
		myBrowserValue = 2;
	}
	else {
		document.write("NEITHER<br>");
		myBrowser=navigator.appName;
		myPlatform = navigator.userAgent;
		myBrowserValue = 2;
	}
}

function changeLayer(myLayer, myAction) {
	if (myTimer) { myCancel(); }
	otherLayer = myLayer+"buttons";
	anotherLayer = myLayer+"back";
	if (myBrowserValue == 2) {
		document.layers[myLayer].visibility = myAction;
		document.layers[otherLayer].visibility = myAction;
		document.layers[anotherLayer].visibility = myAction;
	}
	else if (myBrowserValue == 1) {
		if (myAction=="show") { myAction = "visible"; }
		else { myAction = "hidden"; }
		document.all[myLayer].style.visibility = myAction;
		document.all[otherLayer].style.visibility = myAction;
		document.all[anotherLayer].style.visibility = myAction;
	}
	else if (myBrowserValue == 3) {
		if (myAction=="show") { myAction = "visible"; }
		else { myAction = "hidden"; }
		document.getElementById(myLayer).style.visibility = myAction;
		document.getElementById(otherLayer).style.visibility = myAction;
		document.getElementById(anotherLayer).style.visibility = myAction;
	}
	else {
		if (myAction=="show") { myAction = "visible"; }
		else { myAction = "hidden"; }
		document.getElementById(myLayer).style.visibility = myAction;
		document.getElementById(otherLayer).style.visibility = myAction;
		document.getElementById(anotherLayer).style.visibility = myAction;
	}
}

function myWatcher(myLayer) {
	myGo = "changeLayer('"+myLayer+"','hide');";
	myTimer = setTimeout(myGo,1250);
}

function myCancel() {
	self.clearTimeout(myTimer);
}

function myV() {
	var myError = "";
	for(i=0;i<document.myForm.elements.length;i++) {
		for(c=0;c<myElementCheckList.length;c++) {
			if ((document.myForm.elements[i].name==myElementCheckList[c])&&(document.myForm.elements[i].value=="")) {
					if(ereport[i]) { myError += ereport[i]+"\n"; }
					else { myError += document.myForm.elements[i].name.replace(/_/g, " ")+"\n"; }
			}
		}
		if ((document.myForm.elements[i].value!="")&&(document.myForm.elements[i].name=="email")) {
			if(document.myForm.elements[i].value.search("@")==-1) { myError += "Email address is in improper format\n"; }
			else {
				thisEmail=document.myForm.elements[i].value.split("@");
				if((!thisEmail[0])&&(!thisEmail[1])) { myError+= "Email address is in improper format\n"; }
				else {
					if(thisEmail[1].search(/\./)==-1) { myError += "Email address is in improper format\n"; }
					else {
						tdc = thisEmail[1].split(/\./);
						if((!tdc[0])&&(!tdc[1])) { myError += "Email address is in improper format\n"; }
					}
				}
			}
		}
	}
	if (myError != "") {
		alert("Please fill out the following field(s):\n"+myError);
		return false
	}
	else {
		return true
	}
}

function myScreen() {
	if (myBrowserValue == 1) { myWidth = 750 - document.body.clientWidth; myHeight = 550 -
	document.body.clientHeight; resizeBy(myWidth,myHeight); }
	else if ((myBrowserValue == 2) || (myBrowserValue ==3)) { resizeTo(750,550); }
}

function myPlugins() {
	if (navigator.mimeTypes) {
		for (i = 0; i < navigator.mimeTypes.length; i++) {
			if (navigator.mimeTypes[i].suffixes.search('swf') != -1) { mySwf = 1; }
			if (navigator.mimeTypes[i].suffixes.search('mov') != -1) { myQt = 1; }
		}
	}
}

function myClientLogout() {
	allTheCookies = document.cookie;
	myCookiePosition = allTheCookies.indexOf("session_id=");
	myCookieStart = myCookiePosition + 11;
	myCookieEnd = allTheCookies.indexOf(";", myCookieStart);
	myCookie = allTheCookies.substr(myCookieStart, myCookieEnd);
	var lastYear = new Date();
	lastYear.setFullYear(lastYear.getFullYear() - 1);
	document.cookie = "session_id=" + myCookie + "; expires=" + lastYear.toGMTString() + "; path=/;";
	location="";
}

function editJump(thisId) {
	document.editForm.prid.value=thisId;
	document.editForm.submit();
}

function viewP(thisId) {
	document.viewForm.prid.value=thisId;
	document.viewForm.submit();
}

function clndr(thisVar,thisWay) {
	al='http://www.fallcreekconsultants.com/clndr.php';
	if(thisVar) { al += '?osd='+thisVar; }
	myPop(al,300,200,0,0,1);
}