<!--

if (self != top)
{
	history.back(); top.location.href = 'http://www.mopaintball.com/';
}

var browser = 0;
if ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3) || (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4))
	browser = 1;

if (browser)
{
	splash_acquire_on = new Image();
	splash_acquire_on.src = "/images/splash_acquire.gif";
	splash_acquire_off = new Image();
	splash_acquire_off.src = "/images/space.gif";
	
	splash_manage_on = new Image();
	splash_manage_on.src = "/images/splash_manage.gif";
	splash_manage_off = new Image();
	splash_manage_off.src = "/images/space.gif";
	
	splash_invest_on = new Image();
	splash_invest_on.src = "/images/splash_invest.gif";
	splash_invest_off = new Image();
	splash_invest_off.src = "/images/space.gif";
	
	splash_cashout_on = new Image();
	splash_cashout_on.src = "/images/splash_cashout.gif";
	splash_cashout_off = new Image();
	splash_cashout_off.src = "/images/space.gif";
}

function imageOn(imgName, imgSource)	{ if (browser) document[imgName].src = eval(imgSource + "_on.src");		}
function imageOff(imgName, imgSource)	{ if (browser) document[imgName].src = eval(imgSource + "_off.src");	}

function checkSubmitFieldForm(thisForm) {
	if (isBlank(thisForm.form.vcSubmittedByName.value)) { alert ("Please enter a valid Submitted By Name."); thisForm.form.vcSubmittedByName.focus(); return;}
	if (isBlank(thisForm.form.vcSubmittedByEmail.value)) { alert ("Please enter a valid Submitted By Email."); thisForm.form.vcSubmittedByEmail.focus(); return;}
	if (isBlank(thisForm.form.vcName.value)) { alert ("Please enter a valid Field Name."); thisForm.form.vcName.focus(); return;}
	if (isBlank(thisForm.form.vcCity.value)) { alert ("Please enter a valid Field City."); thisForm.form.vcCity.focus(); return;}
	if (isBlank(thisForm.form.vcState.value)) { alert ("Please enter a valid Field State."); thisForm.form.vcState.focus(); return;}
	
	if (!isValidEmail(thisForm.form.vcSubmittedByEmail.value)) {
		alert ("Please enter a valid Submitted By Email.");  thisForm.form.vcSubmittedByEmail.focus(); return;
	} else {
		thisForm.form.submit();
	}
	return;
}

function checkSubmitEventForm(thisForm) {
	if (isBlank(thisForm.form.vcHeader.value)) { alert ("Please enter a valid Event Name."); thisForm.form.vcHeader.focus(); return;}
	if (isBlank(thisForm.form.vcBody.value)) { alert ("Please enter a valid Event Comment."); thisForm.form.vcBody.focus(); return;}
	if (isBlank(thisForm.form.vcSubmittedByName.value)) { alert ("Please enter a valid Submitted By Name."); thisForm.form.vcSubmittedByName.focus(); return;}
	if (!isValidEmail(thisForm.form.vcSubmittedByEmail.value)) {
		alert ("Please enter a valid Submitted By Email.");  thisForm.form.vcSubmittedByEmail.focus(); return;
	} else {
		thisForm.form.submit();
	}
	return;
}

function isValidEmail(inputStr) {
	var testValue = inputStr.indexOf("@")
	if(!(testValue > 0)){  return false }
	if(!(inputStr.indexOf(".",(testValue + 1)) > (testValue + 1))) { return false}
	return true
}			

function isBlank(inputStr) {
	var len=inputStr.length
	var i
	for (i=0; i<len; ++i) {
		if(inputStr.charAt(i)!= " ") return false
	}
	return true
}
function ReplaceQuotes(s) {return s.replace(/\"/g, "'");}

function isAddress1(ss, min, max){
	var inputStr = ss.toString()
	var BadChar = "~!@$%^*_+|`={}<>?[];"
	var inputStr2 = BadChar.toString()
	var SearchItem = " "
	if (inputStr == null || inputStr == ""){// can not empty
		return false
	}
	if((inputStr.length > 0) && (inputStr.search(SearchItem) == 0)){//no leading space
		return false
	}
	if ((inputStr.length >= min)&&(inputStr.length <= max)){
		for (var i = 0; i < inputStr.length; i++){
			for (var j = 0; j < inputStr2.length; j++){
				if((inputStr.charAt(i) == inputStr2.charAt(j))){
					return false;
				}
			}
		}
		return true;
	}
	else{
		return false;
	}
}

function isAllowedCharsOnly(ss,OkChar) {
	var inputStr	= ss.toString()
	var match
	for (var i = 0; i < inputStr.length; i++){
		match = false;
		for (var j = 0; j < OkChar.length; j++){
			if(inputStr.charAt(i) == OkChar.charAt(j)){
				match=true;
				j=OkChar.length;
			}
		}
		if(!match){
			return false;
		}
	}	
	return true;
}
function isDecimalOnly(ss){
	var inputStr	= ss.toString()
	var OkChar		= ".1234567890"
	var match
	return isAllowedCharsOnly(ss,OkChar);
}
function isZipOnly(ss){
	var inputStr	= ss.toString()
	var OkChar		= "-1234567890"
	var match
	return isAllowedCharsOnly(ss,OkChar);
}
function isPhoneOnly(ss){
	var inputStr	= ss.toString()
	var OkChar		= "-1234567890"
	var match
	return isAllowedCharsOnly(ss,OkChar);
}

function isAlphaNumericOnly(ss,min,max,bolSpace){
	var inputStr	= ss.toString()
	var OkChar
	var match
	if ( isEmpty(min) ) min = 1;
	if ( isEmpty(max) ) max = 1000;
	if((inputStr.length >= min)&&(inputStr.length <= max)){
		if(bolSpace)	{ OkChar	= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1234567890"	}
		else			{ OkChar	= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"	}
		return isAllowedCharsOnly(ss,OkChar);
	} else {
		return false;
	}
}

function isAlphaOnly(ss,min,max,bolSpace){
	var inputStr = ss.toString()
	var OkChar
	var match
	if ( isEmpty(min) ) min = 1;
	if ( isEmpty(max) ) max = 1000;
	if((inputStr.length >= min)&&(inputStr.length <= max)){
		if(bolSpace)	{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"	}
		else			{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"	}
		return isAllowedCharsOnly(ss,OkChar);
	} else {
		return false;
	}
	
}
function isName(ss,min,max,bolSpace){
	var inputStr = ss.toString()
	var OkChar
	var match
	if ( isEmpty(min) ) min = 1;
	if ( isEmpty(max) ) max = 1000;
	if((inputStr.length >= min)&&(inputStr.length <= max)){
		if(bolSpace)	{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZ'.- abcdefghijklmnopqrstuvwxyz"	}
		else			{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZ'.-abcdefghijklmnopqrstuvwxyz"	}
		return isAllowedCharsOnly(ss,OkChar);
	} else {
		return false;
	}
	
}


function isNumericOnly(ss,min,max,bolSpace){
	var inputStr = ss.toString()
	var OkChar
	var match
	var testVal;
	if ( isEmpty(min) ) min = 1;
	if ( isEmpty(max) ) max = 1000000000;
	
	//alert('min: '+min+'\n'+'max: '+max+'\n'+'ss: '+inputStr.length+'\n');
	if((inputStr.length >= min)&&(inputStr.length <= max)){
		if(bolSpace)	{ OkChar =  "12345 67890"	}
		else			{ OkChar =  "1234567890"	}
		return isAllowedCharsOnly(ss,OkChar);
	} else {
		return false;
	}
	
}
function getDecimalOnly(ss){
	var OkChar =  ".1234567890";
	return getAllowedCharsOnly(ss, OkChar);
}
function getNumericOnly(ss, bolSpace){
	var OkChar;
	if(bolSpace)	{ OkChar =  "12345 67890"	}
	else			{ OkChar =  "1234567890"	}
	return getAllowedCharsOnly(ss, OkChar);
}
function getZipOnly(ss){
	var OkChar =  "-1234567890"
	return getAllowedCharsOnly(ss, OkChar);
}
function getPhoneOnly(ss){
	var OkChar =  "-1234567890"
	return getAllowedCharsOnly(ss, OkChar);
}
function getAlphaNumericOnly(ss, bolSpace){
	var OkChar;
	if(bolSpace)	{ OkChar	= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1234567890"	}
	else			{ OkChar	= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"	}
	return getAllowedCharsOnly(ss, OkChar);
}
function getAlphaOnly(ss, bolSpace){
	var OkChar;
	if(bolSpace)	{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"	}
	else			{ OkChar =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"	}
	return getAllowedCharsOnly(ss, OkChar);
}
function getAllowedCharsOnly(ss, OkChar){
	var inputStr = ss.toString()
	var newVal = "";
	for(var i = 0; i < inputStr.length; i++){
		for (var j = 0; j < OkChar.length; j++){
			if((inputStr.charAt(i) == OkChar.charAt(j))){
				newVal += inputStr.charAt(i)
			}
		}
	}
	return newVal;
}

function isEmpty(s) {
	if (s == undefined) return true;
	var inputStr = s.toString();
	// the first one executes them all.... therefore it is better the last way...
	//return ((s == null) || (inputStr == null) || (inputStr.length == 0) || isBlank(inputStr) ); 
	if (s == null)					return true;
	else if (inputStr == null)		return true;
	else if (inputStr.length == 0)	return true;
	else if (isBlank(inputStr) )	return true;
	else 							return false;
}

function isFloat(s, emptyOK)
{
// Returns true if valid float
  if(isEmpty(s))
    if(isFloat.arguments.length == 1) return false;
    else return (emptyOK == true);

  AlreadyHaveDecimalPoint = new Number(0);
  for(i = new Number(0); i < s.length; i++)
  {
    if((s.charAt(i) >= "0") && (s.charAt(i) <= "9")) continue;
    if(s.charAt(i) != ".") return false;
    if(AlreadyHaveDecimalPoint == 1) return false;
    AlreadyHaveDecimalPoint = 1;
  }
  return true;
}

function isCurrency(s, emptyOK)
{
// Returns true if valid currency
  if(!isFloat(s, emptyOK)) return false;
  if (s=="0") return false;
	pos = new Number(0);
  for(i = new Number(s.length) - 1; i >= 0; i--)
  {
    pos++;
    if(s.charAt(i) == ".")
			if(pos > 3) return false;
			else return true;
  }
  return true;
}

function isNumber(s, emptyOK)
{
// Returns true if positive number
  if(isEmpty(s))
    if(isNumber.arguments.length == 1) return false;
    else return (emptyOK == true);

  for(i =0; i < s.length; i++)
    if(!((s.charAt(i) >= "0") && (s.charAt(i) <= "9"))) return false;
  return true;
}

function isWhiteSpace(s)
{
  var whitespace = " \t\n\r";
  if(isEmpty(s)) return true;

  for(i = new Number(0); i < s.length; i++)
    if(whitespace.indexOf(s.charAt(i)) == -1) return false;

  return true;
}

function isEmail(s, emptyOK)
{
// Must conform to a@b.c
  s = s.toString()
  if(!emptyOK) { emptyOK = false; }
  if(isEmpty(s)) return (emptyOK == true);

  i = new Number(s.indexOf("@", 1));
  if(i == -1) return false;

  i = (s.indexOf(".", i + 2));
  if(i == -1) return false;
  
  return (s.length > i + 1);
}

function isPhoneNbr(areacode, exchange, nbr, emptyOK)
{
  
  if(isEmpty(areacode.value + exchange.value + nbr.value)){
    if(isPhoneNbr.arguments.length == 3) return false;
    else return (emptyOK == true);
  }

  if(!isNumber(areacode.value + exchange.value + nbr.value)) return false;
  else
  {
    if (!isNumber(exchange.value + nbr.value)) return false;
    else
      if (!isNumber(nbr.value)) return false;
  }
  return true;
}



function getAddress(s)
{
	n = s.indexOf(":");
	return s.substr(n + 2);
}
function CheckBankInfo(theForm)
{

  if (isEmpty(theForm.txtFirstName.value)){
    return ResetUI(theForm.txtFirstName, "Please enter your First Name as it appears on your bank account.");
  }

  if (isEmpty(theForm.txtLastName.value)){
    return ResetUI(theForm.txtLastName, "Please enter your Last Name as it appears on your bank account.");
  }
  
  if (!isNumber(theForm.txtBankAcct.value,false)){
    return ResetUI(theForm.txtBankAcct, "Please enter only numbers for the Bank Account #");
  }
  if (!isNumber(theForm.txtRtNumber.value,false)){
    return ResetUI(theForm.txtRtNumber, "Please enter only numbers for the Bank Routing #.");
  }
  if (isEmpty(theForm.txtBankName.value,false)){
    return ResetUI(theForm.txtBankName, "Please enter your Bank Name exactly as it appears on your checks.");
  }
  
  return (true);
 }

 function ResetUI(focusObj, ErrMsg)
{
	if (ErrMsg > "") {
		alert(ErrMsg);
	}
	focusObj.focus();
	return (false);
}

function isUnchecked(theObj) {
	var is_checked = false;
	for (var i=0;i<theObj.length;i++) {
		if (theObj[i].checked) is_checked = true;
	}
	if (is_checked) { return(0); } else { return(1); }
}

function set_checked(theObj, the_val) {
	for (var i=0;i<theObj.length;i++) {
		if (theObj[i].value == the_val) theObj[i].checked = true;
	}
}
function get_checked(theObj) {
	for (var i=0;i<theObj.length;i++) {
		if (theObj[i].checked) return(theObj[i].value);
	}
}

function isUnselected(theObj,minSelection) {
	if (!minSelection) minSelection = 0;
//	alert(theObj.selectedIndex);
//	alert(minSelection);
	if (theObj.selectedIndex >= minSelection) { return(0); } else { return(1); }
}
function strtrim() {
    //Match spaces at beginning and end of text and replace
    //with null strings
    return this.replace(/^\s+/,'').replace(/\s+$/,'');
}
function trim2(str) { 
    str.replace(/^\s*/, '').replace(/\s*$/, ''); 
   return str;
}
function remove_whitespace(s) {
    //Match spaces at beginning and end of text and replace
    //with null strings
	s = s.toString()
    //return s.replace(/\s+/,'');
	return s.replace(/\s/g,'');
}
//String.prototype.trim = function() 
//{
 // return( this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') ); 
//}

function strltrim() {
	return this.replace(/^\s+/,'');
}

function strrtrim() {
	return this.replace(/\s+$/,'');
}
function strtrim() {
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;


function open_window(the_file_path, the_window_name, the_width, the_height, resizable, do_reposition, do_scroll) {
	if (the_window_name == '')	the_window_name		= 'Popup';
	if (the_width == '')		the_width			= '300';
	if (the_height == '')		the_height			= '300';
	if (resizable == '')		resizable			= 'no';
	if (do_scroll == '')		do_scroll			= 'no';
	var windowXY									= '';
	
	if (do_reposition != 'N') {
		if (window.screen) {
	    	var the_screenX = Math.floor((screen.availWidth-the_width)/2);
		    var the_screenY = Math.floor((screen.availHeight-the_height)/2);
			windowXY = ',screenX='+the_screenX+',screenY='+the_screenY+',left='+the_screenX+',top='+the_screenY;
		}
	}
	windowHandle = window.open('',the_window_name,'scrollbars='+do_scroll+',status=no,width='+the_width+',height='+the_height+',resizable='+resizable+windowXY)
	windowHandle.location.href = the_file_path;
	windowHandle.focus();
}
function SetDisabledStatus(theCheckObj, theActionObj, the_min, the_max, the_new_val_disabled, the_display_text) {
	if (the_min == '')	the_min = 0;
	if (the_max == '')	the_max = 0;
	if ( the_new_val_disabled == undefined ) the_new_val_disabled = false;
	//alert(theCheckObj.selectedIndex);
	// see if it was previously disable
	var prev_disabled = false;
	if (theActionObj.disabled) prev_disabled = true;
	
	if ( (theCheckObj.selectedIndex >= the_min) && (theCheckObj.selectedIndex <= the_max) ) {
		theActionObj.disabled	= the_new_val_disabled;
	} else {
		theActionObj.disabled = !(the_new_val_disabled);
	}
	if ( (theActionObj.disabled) && (the_display_text != '') ) {
		theActionObj.value		= the_display_text;
	} else {
		if (prev_disabled) theActionObj.value = '';
	}
}

//-->

