
<!--//

/*	
Created by: Arnel C. Navarra
Date: 03/14/2002
Updated: 2006/11/27
Email: webservant@onlineservant.net
Website: http://www.onlineservant.net

	*************************************************
	*  You may use this script only if this header  *
	*  is NOT altered or deleted. You may email me  *
	*  if you find this script helpful. I'm open    *
	*  for discussion. Thank you.                   *
	*  Otherwise, you are not authorized to use     *
	*  this script.                                 *
	*************************************************
*/

browser = navigator.appName;
version = parseInt(navigator.appVersion);

//array function for initializing preloaded buttons:
function initButtons(n,imgLoc) {
	button = new Array();
	for(i=1;i<=n;i++) {
		button[i] = new Image();
		button[i].src = imgLoc+i+'.gif';
	}	
}

//array function for initializing preloaded images:
function initImages(n,imgBox) {
	imgObj = new Array();
	for(i=1;i<=n;i++) {
		imgObj[i] = new Image();
		imgObj[i].src = imgBox+i+'.gif';
	}

}

//for onMouseOut and onMouseOver function:
function doMouse(btnName,btnCtr) {
	if(browser == "Netscape") {
		if(version >= 5) {
			document.images[btnName].src = button[btnCtr].src;
		} else {
			alert("Sorry. Your browser version doesn't support this feature. Upgrade your browser to Netcape 6.x or MSIE 4.x/higher. Thank you.");
		}
	} else {
		document.images[btnName].src = button[btnCtr].src;
	}
}

//for Changing Images:
function changeImage(imgName,imgCtr) {
	document.images[imgName].src = imgObj[imgCtr].src;
}

//for changing images regardless of browser:
function changeFace(btnName,btnCtr) {
	document.images[btnName].src = button[btnCtr].src;
}

//onloading function:
function onLoadThis() {
	autoChangeMenuPos();
	window.focus();
}

//for changing the image width and height:
function changeImageSize(n,w,h) {
	document.images[n].width = w;
	document.images[n].height = h;
}

//undo focus on the clicked button:
function blurMe(thisButton) {
		thisButton.blur();
		return false;
}

//for hiding layers:
function hideLayer(layerName) {
	if(navigator.appName == "Netscape") {
		document.layers[layerName].visibility = "hidden";
	} else {
		document.all[layerName].style.visibility = "hidden";
	}
}

//for showing layers:
function showLayer(layerName) {
	if(navigator.appName == "Netscape") {
		document.layers[layerName].visibility = "visible";
	} else {
		document.all[layerName].style.visibility = "visible";
	}
}

//for hiding all layers except "thisMenu":
function hideAllMenuBut(thisMenu) {
	idName = new Array();
	idName[0] = "servicesMenu";
	idName[1] = "subscribersMenu";
	idName[2] = "helpMenu";
	iMax = idName.length;
	//hides all menu:
	for(i=0;i<iMax;i++) {
		hideLayer(idName[i]);
	}
	
	if(thisMenu != "") {
		//shows the current menu:
		showLayer(thisMenu);
	} 
	
}

//for changing cell color:
function changeBgColor(tableCell,bg,fg) {
	tableCell.style.backgroundColor = bg;
	tableCell.style.color = fg;
}

//for detecting window width and height:
function getWindowSize() {
	w = document.body.clientWidth;
	h = document.body.clientHeight;
}

//for changing layer position:
function changeLayerPos(layerName,l,t){
	getWindowSize();
	l2 = l+(w/2)-395;
	t2 = t;
	document.all[layerName].style.left = l2;
	document.all[layerName].style.top = t2;
}

//for changing menu positions:
function autoChangeMenuPos() {
	changeLayerPos("servicesMenu",450,35);
	changeLayerPos("subscribersMenu",585,35);
	changeLayerPos("helpMenu",615,35);
}

//for pages under construction:
function noLinkNotice() {
	alert("Sorry. The link is still under development. Please try again later. Thank you.");
}

//for reloding the page in the current window:
function refreshWindow() {
	if(browser == "Netscape") {
		if(version < 5) {
			window.location.reload();
		}
	} 
}

//for validating webmail:
function validateMail() {
	wmForm = document.forms["wm"];
	user = wmForm.login_username;
	pass = wmForm.login_password;
	
	if(user.value == "") {
		alert("Please check your User Name and try again. Thank you.");
		user.focus(); return false;
	}
	
	if(pass.value == "") { 
		alert("Please check your Password and try again. Thank you.");
		pass.focus(); return false;
	}
}

//for submitting form data:
function submitThisForm(f) { 
	document.forms[f].submit();
}

//for clearing form elements:
function clearThisForm(f) { 
	document.forms[f].reset();
	document.forms[f].elements[0].focus();
}

//for document.write:
function print(text) {
	document.write(text);
}

//for loading preloaded:
function loadPreloaded() {
	changeImage("triLogo","5");
	changeFace("aboutus","1");
	changeFace("prodserv","2");
	changeFace("subscribers","3");
	changeFace("help","4");
}


function newWindow(page_url,target_win,extra) {
	window.open(page_url, target=target_win, extra);
}

function ValidateEmail(theinput) {
	s=theinput.value
	if(s.search) {
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0)
	}
	if(s.indexOf) {
		at_character=s.indexOf('@')
		if(at_character<=0 || at_character+4>s.length)
			return false
	}
	if(s.length<6)
		return false
	else
		return true
}

function validateUsername(userinput) {
	username = userinput.value;
	if(username.match(' ')==' ') {
		return false;
	}
	
}

function alertMe(txtMsg) {
	alert(txtMsg);
}

function popResume(jsk_id,pic_id) {
	window.open("viewResume.php?id="+jsk_id+"&pId="+pic_id, target="_blank", "menubar=0,scrollbars=1,width=650,height=600,resizable=0,toolbar=0,location=0,status=0");
}



//-->



