/*
 * common.js
 *
 * Copyright (c) 2002 WebNetwork.com. All Rights Reserved.
 *
 */

var isRollEnabled = (((navigator.appName == "Netscape") &&
	(parseInt(navigator.appVersion) >= 3 )) ||
	((navigator.appName == "Microsoft Internet Explorer") &&
	(parseInt(navigator.appVersion) >= 4 )));

function fLoadImg(sImage) {
	a=new Image()
	a.src="/images/"+sImage+".gif"
	return a
}

function fRollover(sImage) {if (isRollEnabled) document[sImage].src = eval(sImage + "hot.src")}

function fRollout(sImage) {if (isRollEnabled) document[sImage].src = eval(sImage + ".src");}

function fCheckField(oFld,sMsg) {
	if (oFld.value=='') {
		alert(sMsg)
		oFld.focus()
		if (oFld.type!='submit'&&oFld.type.substr(0,6)!='select') oFld.select()
		return false
	}
	return true
}

function fCheckCondition(oFld,isBadCondition,sMsg) {
	if (isBadCondition) {
		alert(sMsg)
		oFld.focus()
		if (oFld.type!='submit'&&oFld.type.substr(0,6)!='select') oFld.select()
		return false
	}
	return true
}

function fFormatPhone(s) {
	var ss = ''
	for (var i=0;i<s.length;i++) {
		ch = s.substring(i, i + 1)
		if (ch >= "0"&&ch <= "9") ss+=ch
	}
	a=ss.substring(0,3)
	if (a=='') a='   '
	b=ss.substring(3,6)
	if (b=='') b='   '
	c=ss.substring(6,10)
	d=ss.substring(10,99)
	if (d.length>0) d=' '+d
	ss='('+a+') '+b+'-'+c+d
	return ss
}

function fFixSize(h,w) {
	if (window.resizeTo) self.resizeTo(h,w)
}