<!--
//*******************************************************
// Display Functions
//*******************************************************
function toggle(el)
{
  if( document.getElementById(el).style.display=='none' ) 
  {
    document.getElementById(el).style.display = '';
  }
  else
  {
    document.getElementById(el).style.display = 'none';
  }
}

function showElement(el)
{
   document.getElementById(el).style.display = '';
   
   return true;
}

function hideElement(el)
{
   document.getElementById(el).style.display = 'none';
   
   return true;
}

function showlaptop(theTable)
{
	if (document.getElementById(theTable).style.display == 'none')
	{
		document.getElementById(theTable).style.display = 'block';
	}
}

function hidelaptop(theTable)
{
	if (document.getElementById(theTable).style.display == 'none')
	{
		document.getElementById(theTable).style.display = 'none';
	}
	else
	{
		document.getElementById(theTable).style.display = 'none';
	}
}

function trimAll(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}

	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}

	return sString;
}

function loadDefaultPayments(payType)
{		
	switch (payType) 
	{
		case "Check": 
			insertCheckPayment(); 
			break;
			
		case "ACH": 
			insertACHPayment(); 
			break;
			
		case "Neteller": 
			insertNetellerPayment(); 
			break;

		case "Casino": 
			insertCasinoPayment(); 
			break;

		case "ATM": 
			insertPrepaidATMPayment(); 
			break;
											
		default: 
			break;
	}		
	return true;		
}

function insertCheckPayment()
{
	hidelaptop('tbAchPayment');
	hidelaptop('tbNetellerPayment');
	hidelaptop('tbCasinoPayment');
	hidelaptop('tbATMPayment');
	return true;
}   
	
function insertACHPayment()
{
	showlaptop('tbAchPayment');
	hidelaptop('tbNetellerPayment');
	hidelaptop('tbCasinoPayment');
	hidelaptop('tbATMPayment');
	return true;		
}    

function insertNetellerPayment()
{	
	hidelaptop('tbAchPayment');
	showlaptop('tbNetellerPayment');
	hidelaptop('tbCasinoPayment');
	hidelaptop('tbATMPayment');
	return true;	
}  	

function insertCasinoPayment()
{
	hidelaptop('tbAchPayment');
	hidelaptop('tbNetellerPayment');
	showlaptop('tbCasinoPayment');
	hidelaptop('tbATMPayment');
	return true;		
} 	

function insertPrepaidATMPayment()
{
	hidelaptop('tbAchPayment');
	hidelaptop('tbNetellerPayment');
	hidelaptop('tbCasinoPayment');
	showlaptop('tbATMPayment');
	return true;		
}  	

function TrimString(sInString) 
{
  	sInString = sInString.replace( /^\s+/g, "" );
  	return sInString.replace( /\s+$/g, "" );
}

function checkemail(str)
{
  	var filter=/^.+@.+\..{2,3}$/;
  	return (filter.test(str));
}

function getNaturalName($name)
{
	var v = $name.split(':');
	return v(v.length-1);
}

function isEmail(str)
{
	var filter=/^.+@.+\..{2,3}$/;
	return (filter.test(str));
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) 
		{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
			{
			IsNumber = false;
			}
		}
	return IsNumber;
} 

function isPhone(aString) 
{
	var aChar = null;
	var status = true;

	if(aString.length == 0) 
	{
		status = false;
	}
	else
	{
		for(var i = 0; i <= aString.length; i++) 
		{
			aChar = aString.charAt(i);
			if (aChar == "("  || aChar == ")" || aChar == "-" || IsNumeric(aChar))
			{
				continue;
			}
			else
			{
				status = false;
				break;
			}
		}
	}
	return(status);
}

function isUrl(s) 
{
	//var regexp = "^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$"
	var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
	return regexp.test(s);
}


function getURLParam(strParamName)
{
	var strReturn = "";
	var strHref = window.location.href;
	
	strParamName = strParamName.toLowerCase();
	
	if ( strHref.indexOf("?") > -1 )
	{	
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");

		for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
		{
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 )
			{
				var aParam = aQueryString[iParam].split("=");				
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}



function CheckContactInfo()
{
	if ( ((Form1._ctl2_Name.value) == "") || ((Form1._ctl2_Name.value.length) < 4) )
	{
		ErrorInfoMsj.innerHTML = "Please write a correct name.";	
		return false;		
	}
	
	if ( ((isEmail(Form1._ctl2_Email.value)==false)) || ((Form1._ctl2_Email.value.length) < 5) )
	{
		ErrorInfoMsj.innerHTML = "Please write a correct email.";				
		return false;
	} 
		
	if ( ((isPhone(Form1._ctl2_Phone.value)==false)) || ((Form1._ctl2_Phone.value.length) < 7) )
	{
		ErrorInfoMsj.innerHTML = "Please write a correct phone.";
		return false;			
	}		
	
	if (  ((Form1._ctl2_Query.value) == "") || ((Form1._ctl2_Query.value.length) < 5) )
	{
		ErrorInfoMsj.innerHTML = "Please write a correct comments/concerns.";	
		return false;		
	}		
	
	return true;
	
}

function SetAdditionalInfo()
{
	var strOptionalWS = "";
	var WSName = "";
	var WSInputName = "";
	var intAdditionalWS = 0;
	var strI = "";
		
	intAdditionalWS = document.Form1._ctl3_OptionalWS.options[document.Form1._ctl3_OptionalWS.selectedIndex].value;
	
	for(i=0; i < intAdditionalWS; i++) 
	{		
		strI = (i + 1) + '';
		WSName = strI + "st Website URL:"
		WSInputName = "affWebSite" + strI;
		strOptionalWS = strOptionalWS + "<table id='tblWS1' class='TableArea'>";
		strOptionalWS = strOptionalWS + "<tr><td align='left' width='150'>" + WSName + "</td>";
		strOptionalWS = strOptionalWS + "<td align='left'>";
		strOptionalWS = strOptionalWS + "<input  runat='server' name='" + WSInputName + "' id='affWebSite" + (i + 1) + "' type='text' class='boxs2' maxlength='250' size='50' value='http://'/></td>";
		strOptionalWS = strOptionalWS + "</tr></table>";
	}
		
	divAdditionalWeb.innerHTML = strOptionalWS;
	
	return true;		
}

function CheckSignUpInfo()
{			
	if ( (trimAll(document.Form1._ctl3_affUsername.value)).length < 2)
	{
		alert("Username must have a minimun length of 2 characters.");	
		document.Form1._ctl3_affUsername.focus();
		return false;
	}

	if ( (trimAll(document.Form1._ctl3_affPassword.value)).length < 2)
	{
		alert("Password must have a minimun length of 2 characters.");
		document.Form1._ctl3_affPassword.focus();
		return false;
	}
			
	if ( trimAll(document.Form1._ctl3_affRePassword.value) != trimAll(document.Form1._ctl3_affPassword.value) )
	{
		alert("The re-type password must be the same as the password.");
		document.Form1._ctl3_affRePassword.focus();
		return false;
	}
	
	if ( (trimAll(document.Form1._ctl3_affFName.value)).length < 2 )
	{
		alert("First Name must have a minimun length of 2 characters.");
		document.Form1._ctl3_affFName.focus();
		return false;
	}		

	if ( (trimAll(document.Form1._ctl3_affLName.value)).length < 2 )
	{
		alert("Last Name must have a minimun length of 2 characters.");
		document.Form1._ctl3_affLName.focus();
		return false;
	}	

	if ( (trimAll(document.Form1._ctl3_affCompany.value)).length < 2 )
	{
		alert("Company Name must have a minimun length of 2 characters.");
		document.Form1._ctl3_affCompany.focus();
		return false;
	}		
	
	if ( (trimAll(document.Form1._ctl3_affAddress1.value)).length < 2 )
	{
		alert("Address must have a minimun length of 2 characters.");
		document.Form1._ctl3_affAddress1.focus();
		return false;
	}

	if ( (trimAll(document.Form1._ctl3_affCity.value)).length < 2 )
	{
		alert("City must have a minimun length of 2 characters.");
		document.Form1._ctl3_affCity.focus();
		return false;
	}	
	
	if ( (trimAll(document.Form1._ctl3_affZipCode.value)).length < 2 )
	{
		alert("Zip Code must have a minimun length of 2 characters.");
		document.Form1._ctl3_affZipCode.focus();
		return false;
	}	
				
	if (! (isEmail( trimAll(document.Form1._ctl3_affEmail.value))) )
	{
		alert("The E-mail address must be real.");	
		document.Form1._ctl3_affEmail.focus();
		return false;
	}

	if (! (isPhone( trimAll(document.Form1._ctl3_affHomePhone.value))) ||  (trimAll(document.Form1._ctl3_affHomePhone.value)).length < 2 )
	{
		alert("Home Phone must be real.");
		document.Form1._ctl3_affHomePhone.focus();
		return false;
	}

	if ( (trimAll(document.Form1._ctl3_affBussinesPhone.value)).length < 2 )
	{
		alert("Bussiness Phone must must be real.");
		document.Form1._ctl3_affBussinesPhone.focus();
		return false;
	}

	if ( (trimAll(document.Form1._ctl3_affPayeeName.value)).length < 2 )
	{
		alert("Payee Name must have a minimun length of 2 characters.");
		document.Form1._ctl3_affPayeeName.focus();
		return false;
	}	
	
	if (document.Form1._ctl3_pmtAch.checked)
	{	
		if ( (trimAll(document.Form1._ctl3_affBankName.value)).length < 2 )
		{
			alert("Bank Name must have a minimun length of 2 characters.");
			document.Form1._ctl3_affBankName.focus();
			return false;
		}
		
		if ( (trimAll(document.Form1._ctl3_affAccountHolder.value)).length < 2 )
		{
			alert("Account Holder must have a minimun length of 2 characters.");
			document.Form1._ctl3_affAccountHolder.focus();
			return false;
		}

		if ( (trimAll(document.Form1._ctl3_affRoutingNumber.value)).length < 2 )
		{
			alert("Routing Number must have a minimun length of 2 numbers.");
			document.Form1._ctl3_affRoutingNumber.focus();
			return false;
		}
		
		if ( (trimAll(document.Form1._ctl3_affAccountNumber.value)).length < 2 )
		{
			alert("Account Number must have a minimun length of 2 numbers.");
			document.Form1._ctl3_affAccountNumber.focus();
			return false;
		}					
	}	

	if (document.Form1._ctl3_pmtNeteller.checked)
	{	
		if ( (trimAll(document.Form1._ctl3_affNetellerAddress.value)).length < 2 )
		{
			alert("Neteller e-Mail Address must have a minimun length of 2 characters.");
			document.Form1._ctl3_affNetellerAddress.focus();
			return false;
		}				
	}

	if (document.Form1._ctl3_pmtCasino.checked)
	{	
		if ( (trimAll(document.Form1._ctl3_affCasinoUser.value)).length < 2 )
		{
			alert("Casino User must have a minimun length of 2 characters.");
			document.Form1._ctl3_affCasinoUser.focus();
			return false;
		}				
	}

	if (document.Form1._ctl3_pmtATM.checked)
	{	
		if ( (trimAll(document.Form1._ctl3_affATMNumber.value)).length < 2 )
		{
			alert("ATM number must have a minimun length of 2 numbers.");
			document.Form1._ctl3_affATMNumber.focus();
			return false;
		}				
	}		
	
	if ( !(isUrl(trimAll(document.Form1._ctl3_affWebSite.value)) ) )
	{			
		alert("Primary Website URL must be correct.");
		document.Form1._ctl3_affWebSite.focus();
		return false;
	}	
						
	return true;	
}

// -->