/*	
Created by: Arnel C. Navarra for Tri-Isys Internet
Date: 03/14/2002
Updated: 01/26/2006
Email: arnel.n@tri-isys.com

	*************************************************
	*  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",490,35);
	changeLayerPos("subscribersMenu",605,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");
}

//for faqs popups:
function popAns(page) {
	window.open("http://www.tri-isys.com/help/pop_faqs.html#"+page, target="_blank", "scrollbars=yes,resizable=no,width=330,height=350,left=100px,top=50px");
}

//for popup ads:
function popup(size) {
	window.open("popup_"+size+".html", target="_blank", "scrollbars=no,resizable=no,width="+size+",height="+size+",left=100px,top=50px");
}

	
//for random full banner: (07/26/2002)
function postFullBannerAd() {
	fbI = new Array(
		"<img src='http://www.ispx.com.ph/ads/eScan-468-x-60-pixels-web.jpg' width='468' height='60' alt='Tipid Tawag' border=0>"
		//"<img src='http://www.ispx.com.ph/ads/tipid.gif' width='468' height='60' alt='Tipid Tawag' border=0>"
		//"<img src='http://www.ispx.com.ph/ads/freetoplay_468x60.gif' width='468' height='60' alt='Free2Play' border=0>",
		//"<img src='http://www.ispx.com.ph/ads/santabonanza08_468x60.gif' width='468' height='60' alt='Free2Play' border=0>",				
		//"<img src='http://www.tri-isys.com/images/banners/bizhostreferral.gif' width='468' height='60' alt='Bizhost referral' border=0>",
		//"<img src='http://www.tri-isys.com/images/banners/refer.gif' width='468' height='60' alt='eScan Refer and Earn Promo' border=0>",
		//"<img src='http://www.tri-isys.com/images/banners/ad_gcash.gif' width='468' height='60' alt='Globe GCash' border=0>"
		//"<img src='http://www.tri-isys.com/images/banners/ad_loyaltycard_468x60.gif' width='468' height='60' alt='Tri-Isys Loyalty Card' border=0>"
		//"<img src='http://www.ispx.com.ph/images/banner/ad_surfandsave_468x60.gif' width='468' height='60' alt='ISPx Surf n Save' border=0>"
		//"<img src='http://www.ispx.com.ph/images/banner/ad_textload_468x60.gif' width='468' height='60' alt='ISPx Text2Connect' border=0>",
		//"<img src='http://www.ispx.com.ph/images/banner/ad_auto-max.gif' width='468' height='60' alt='Mag Load Na Ng ISPX BONANZA Tru GLOBE' border=0>",			
		//"<img src='http://www.ispx.com.ph/images/banner/summertreat_468x60.gif' width='468' height='60' alt=Promo Summer Treat 2008' border=0>",				
		//"<img src='http://www.ispx.com.ph/images/banner/ad_freeaccess_468x60.gif' width='468' height='60' alt='FREE Access 12AM-8AM' border=0>"
	);
	
	fbL = new Array(
		"http://www.escan.ph/"
		//"http://www.ispx.com.ph/tipidtawag"
		//"http://netplay.ph",
		//"http://www.ispx.com.ph/santabonanza08/",		
		//"http://www.bizhost.ph/referral/refer.php",					
		//"http://www.escan.ph/referral/refer.php",
		//"http://www.tri-isys.com/gcash.php"
		//"http://www.tri-isys.com/loyaltycard.php" 
		//"http://www.ispx.com.ph/bonanza/index.php3?m=surfnsave"
		//"http://www.ispx.com.ph/bonanza/index.php3?m=textload",
		//"http://www.ispx.com.ph/bonanza/?m=globe",	
		//"http://www.tri-isys.com/power_summer_treat_2008.php",			
		//"http://www.ispx.com.ph/bonanza/"
	);
	
	fbT = new Array(
		"_blank"
		//"_blank"
		//"_blank",
		//"_blank",		
		//"_blank",			
		//"_blank",
		//"_self",
		//"_self"
		//"_self"
		//"_self",
		//"_self",	
		//"_self",
		//"_self"
	);
		
	
	ix = fbI.length - 1;
	i = Math.round(ix*Math.random());
	//i=1;
	document.write("<a href="+fbL[i]+" target="+fbT[i]+">"+fbI[i]+"</a><br>");
}


function popFreeWeb() {
	window.open("http://www.tri-isys.com/products-services/hosting/freeweb.html", target="freeweb", "menubar=no,resizable=no,width=350,height=400");
	void(0);
}

// 08-23-2004
function d_new_win() {
	var iwin = window.open("http://account.tri-isys.com/Default0.php","IWIN","resizable=yes,status=no,location=no,toolbar=no,scrollbars=yes,menu=no,width=1000,height=670,left=0,top=0");
}

//for tri-isys home main banner (2005-12-07)
function mainBanner() {
	fbI = new Array(
	"http://www.tri-isys.com/images/home_ad_award4.gif"
	);

	fbL = new Array(
	"http://www.tri-isys.com/dialup_plans.php"
	);
	
	fbT = new Array(
	"_self"
	);
	
	ix = fbI.length - 1 ; //number of objects
	i = Math.round(ix*Math.random());
	document.write("<center><a href="+fbL[i]+" target="+fbT[i]+"><img src='"+fbI[i]+"' border='0'></a></center>");
	
}