function chkNumber(field,val){if(isNaN(val)&&val.length>0){return false;};return true;};function chkString(val){if(val==""){return false;}else{tempval=new String(val);for(y=0;y<tempval.length;y++){if(tempval.substring(y,y+1)!=" "){tempval=tempval.slice(y,tempval.length);y=tempval.length;objName=tempval}else{if(y==tempval.length-1){val='';return false;};};};};tempval=new String(val);for(y=tempval.length;y>0;y--){if(tempval.substring(y-1,y)!=" "){tempval=tempval.slice(0,y);y=0;val=tempval};};return true;};function validate(valu){var novalid="<>\';@#&*`~";var ok="yes";var temp;for(var i=0;i<valu.length;i++){temp=""+valu.substring(i,i+1);if(novalid.indexOf(temp)!="-1")return false;};return true;};
function chkMail(valu)
{	var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(filter.test(valu))
		return true;
	else 
		return false;
};
function doJSCheck()
{for(i=0;i<JSArr.length;i++)
	{
		field=JSArr[i][0];
		func=JSArr[i][1];
		err=JSArr[i][2];
		eval("val = document.all."+field+".value");
		switch(func)
		{
			case"Number":ret=chkNumber(field,val);
				break;
			case"String":ret=chkString(val);if(ret){ret=validate(val);err=JSArr[i][3]};
				break;
			case"ValidString":ret=chkString(val);if(ret){ret=validate(val);err=JSArr[i][3]}else ret=true;
				break;
			case"ValidMail":ret=chkString(val);if(ret){ret=chkMail(val);err=JSArr[i][3]};
				break;
		};
		if(!ret)
			{
				alert(err);
				eval("document.all."+field+".focus()");
				eval("document.all."+field+".select()");
				return false;
			};
	};
	return true;
};
function isObject(obj) { return (typeof obj == 'object'); }
function cartadd(id, quan){
	if ((quan == "")||(isNaN(quan)))
		quan = 1

	document.CartAction.CartProductID.value = id
	document.CartAction.CartQuan.value = quan
	document.CartAction.act.value = 1
	document.CartAction.submit()
}

function cartadd_specialoffer(id, quan){
	if ((quan == "")||(isNaN(quan)))
		quan = 1

	document.CartAction_se.CartProductID.value = id
	document.CartAction_se.CartQuan.value = quan
	document.CartAction_se.act.value = 1
	document.CartAction_se.submit()
}

function quickbuy(id, quan){

}

function doSearch(val){err = chkString(val);
if (err) {err = validate(val);if (!err) {alert(invalidSearch);	document.all.sq.focus();return false;
}}else{	alert(emptySearch);document.all.sq.focus();return false;}	
document.sf.submit();}

function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
	IN:
		NUM - the number to format
		decimalNum - the number of decimal places to format the number to
		bolLeadingZero - true / false - display a leading zero for
										numbers between -1 and 1
		bolParens - true / false - use parenthesis around negative numbers
		bolCommas - put commas as number separators.
 
	RETVAL:
		The formatted number!
 **********************************************************************/
{ 
        if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}

if (!admin) {
var debug = true; function 
right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' 
&& (event.button == 2 || event.button == 3)) { alert(noRightMessage); return false; } return true; } document.onmousedown=right; if (document.layers) 
window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; 

}

function viewAnswer(id){
obj = document.getElementById("a_"+id)
obj_sep = document.getElementById("a_"+id+"_sep")
if (obj.style.display == "none")
	dispstyle = "block"
else
	dispstyle = "none" 
obj.style.display = dispstyle
obj_sep.style.display = dispstyle

}

function viewAnswers(flag){
if (flag == 1) {
	dispstyle = "block"
	document.getElementById("openall").style.display = "none"
	document.getElementById("closeall").style.display = "block"
}
else {
	dispstyle = "none"
	document.getElementById("closeall").style.display = "none"
	document.getElementById("openall").style.display = "block"
}
for (i=0;i<arrAnswers.length;i++){
	document.getElementById("a_"+arrAnswers[i]).style.display = dispstyle
	document.getElementById("a_"+arrAnswers[i]+"_sep").style.display = dispstyle
}
	
}

function openSecureCert(siteCert){
	URL = "http://www.trustlogo.com/ttb_searcher/trustlogo?v_querytype=W&v_shortname=SCAS&v_search="+siteCert+"&x=6&y=5"
	window.open(URL,null,"height=600,width=420,status=yes,toolbar=no,menubar=no,location=no");	
}