var isDOM = (document.getElementById?1:0);
var isIE = (document.all?1:0);
var isNS4 = (navigator.appName=='Netscape' && !isDOM)?1:0;
var isIE4 = (isIE && !isDOM)?1:0;
var isDyn = (isDOM||isIE||isNS4);
var isNS6 = (document.getElementById&&!document.all);

function isEmail(email) {
	invalidChars = " /:,;"
	if (email == "") { return (false); }
	for (i=0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) != -1) { return (false);	 }
	}
	atPos = email.indexOf("@", 1)
	if (atPos == -1) {return (false);}
	if (email.indexOf("@", atPos + 1) != -1) { return (false); }
	periodPos = email.indexOf(".", atPos)
	if (periodPos == -1) {	return (false);}
	if (periodPos + 3 > email.length) {	return (false);}
	return (true);
}

function preload() { //v3.0
	var d = document; 
	if (d.images) { 
		if (!d.pic) d.pic = new Array();
		var i, j = d.pic.length, a = preload.arguments;
		for (i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.pic[j]=new Image; d.pic[j++].src=a[i]; }
	}
}

function check(href)
{
	href = href.toLowerCase();
	var slash = href.lastIndexOf("/");
	if (-1 != slash) { href = href.substr(slash + 1); }
	return href;
}

function menu_over( ob ) {
	ob.style.cursor = ( isIE ? "hand" : "pointer" );
	ob.style.background = "#F8F7CB";
}
function menu_out( ob ) {
	ob.style.background = "#FEFFED";
}

function NumOnly() {
	if (event.keyCode>='0'.charCodeAt()&&event.keyCode <= '9'.charCodeAt())
		event.returnValue = true;
	else
		event.returnValue = false;
}

function ccur(val, decCou) {
	var len = val.length;
	var actChr;
	var newVal = "";
	if(val.length == 0) {
		return "";
	}
	else {
		for(var i1 = 0; i1 < len; i1++) {
			actChr = val.charAt(i1);
			switch(actChr) {
				case "0" :
					newVal = newVal + actChr;
					break;
				case "1" :
					newVal = newVal + actChr;
					break;
				case "2" :
					newVal = newVal + actChr;
					break;
				case "3" :
					newVal = newVal + actChr;
					break;
				case "4" :
					newVal = newVal + actChr;
					break;
				case "5" :
					newVal = newVal + actChr;
					break;
				case "6" :
					newVal = newVal + actChr;
					break;
				case "7" :
					newVal = newVal + actChr;
					break;
				case "8" :
					newVal = newVal + actChr;
					break;
				case "9" :
					newVal = newVal + actChr;
					break;
				case "," :
					if(newVal.indexOf(".") == -1) {
						newVal = newVal + ".";
					}
					break;
				case "." :
					if(newVal.indexOf(".") == -1) {
						newVal = newVal + actChr;
					}
					break;
				default :
					break;
			}
		}
		if(newVal.indexOf(".") == -1) {
			return newVal * 1;
		}
		else {
			if(decCou >= 0) {
				var posDot = newVal.indexOf(".");
				newVal = newVal.substring(0, ((posDot + 1) + decCou));
			}
			else {
				newVal = newVal.substring(0, (len + 1))
			} 
		}
		if(len == newVal.indexOf(".")) {
			newVal = newVal.substring(0, (len + 1));
			return newVal * 1;
		}
		else {
			return newVal * 1;
		}
	} 
}

function xOver( ob ) {
	var ex = "";
	ex = ( isIE ? "hand" : "pointer" );
	ob.style.cursor = ex;
}

function pOver( ob, p ) {
	document.images[ob].src = p;
}

function pLink( lk ) {
	location.href = lk;
}

function FileType( f )
{
	f = f.toLowerCase();
	var slash = f.lastIndexOf(".");
	if (-1 != slash) { f = f.substr(slash + 1); }
	return f;
}

function se_over( ob, c ) {
	ob.style.color = c;
}

function openpx( p, w, h, r, s ) {
	if ( document.all ) {
		w += 20;
		h += 24;
	} else {
		w += 16;
		h += 16;
	}
	var wnew = window.open( p ,"","resizable="+r+",toolbar=0,directories=0,menubar=0,scrollbars="+s+",status=1,width=" + w + ",height=" + h );
	if ( ! wnew.opener ) wnew.opener = self;
	if ( document.all ) wnew.moveTo( (( screen.width - w ) / 2 ) , (( screen.height - h ) / 2 ) );
	else wnew.moveTo( (( screen.availWidth - w ) / 2 ) , (( screen.availHeight - h ) / 2 ) );
	wnew.focus();
}