self.name = 'Main';
var ie = document.all; var ns6 = document.getElementById; var ns4 = document.layers;

function showDialog() {
	var l = (ie) ? document.all['statusDialog'] : (ns6) ? document.getElementById('statusDialog') : null;
	var cen = (ie) ? document.body.clientWidth/2-(l.offsetWidth/2) : window.innerWidth/2-(l.offsetWidth/2);
	cen += 65; cen += "px";

	if( document.all ) {
		// Internet Explorer
		l.style.left = cen;
		l.style.visibility = "visible";
	} else if( document.getElementById ) {
		// Netscape 6
		l.style.left = cen;
		l.style.visibility = "visible";
	}
}

function getParams() {
	var idx = document.URL.indexOf('?');
	var params = new Array();
	if (idx != -1) {
		var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
		for (var i=0; i<pairs.length; i++) {
			nameVal = pairs[i].split('=');
			params[nameVal[0]] = nameVal[1];
		}
	}
	return params;
}
params = getParams();

function submitForm( theForm, custid, countSearches, maxSearches ) {
	if( custid <= 0 ) { if(!cSrchCount(countSearches, maxSearches)) return false; }
	if( theForm.SCtra.value.length > 2 ) {
		showDialog();
		return true;
	} else {
		alert( "A minimum of three (3) characters is required for a search!" );
		theForm.SCtra.focus();
	}
	return false;
}
      
function cSrchCount(n, m) {
	if(n != 0 && n % m == 0) {
		if(confirm("Hello, sorry for the interruption, but we\'ve noticed that you\'ve searched " + n + " times this hour.  Although creating a complimentary user name and password is not required, registering gives you the following benefits:\n    * Unlimited searches\n    * Various forms (RFQ, etc) will be pre-filled\n    * Ability to attach drawings to RFQs\n    * Priority support\n    * Access to future features\n\nPress OK to establish a user account, otherwise press Cancel.") ) {
			window.location.href = '/AddUserProfile.asp';
			return false;
		}
	}
	return true;
}