function showSdiv(divName,ixi,iqi,bibi,bibi2)
		{
		divName.style.display="block"		
		ixi.style.display="none"
		iqi.style.display="none"
		bibi.style.display="none"
		bibi2.style.display="none"
		}
		
function hidediv(divName,ixi,iqi,bibi,bibi2)
		{
		divName.style.display="none"		
		ixi.style.display="none"
		iqi.style.display="none"
		bibi.style.display="none"
		bibi2.style.display="none"
		}
		

function bgChange(Obj)
{
alert(Obj.style.backgroundColor)
//which.style.background="#003466"
}

function check_resellerform(){
	
	iserror='false';
	error_desc='';
	if (resellerform.company_name.value==''){
		iserror='true';
		error_desc=error_desc+'\nCompany Name';
	}
	if (resellerform.contact_name.value==''){
		iserror='true';
		error_desc=error_desc+'\nContact Name';
	}
	if (resellerform.title.value==''){
		iserror='true';
		error_desc=error_desc+'\nTitle';
	}
	if (resellerform.email.value==''){
		iserror='true';
		error_desc=error_desc+'\nEmail';
	}
	if (resellerform.telephone.value==''){
		iserror='true';
		error_desc=error_desc+'\nTelephone';
	}
	if (iserror=='true'){
		alert('The following fields must be filled:\n'+error_desc+'\n');
	}else{
		document.resellerform.submit();
	}
	}
	
	function check_merchantform(){
	
	iserror='false';
	error_desc='';
	if (merchantform.CompanyName.value==''){
		iserror='true';
		error_desc=error_desc+'\nCompany Name';
	}
	if (merchantform.ContactName.value==''){
		iserror='true';
		error_desc=error_desc+'\nContact Name';
	}
	if (merchantform.title.value==''){
		iserror='true';
		error_desc=error_desc+'\nTitle';
	}
	if (merchantform.email.value==''){
		iserror='true';
		error_desc=error_desc+'\nEmail';
	}
	if (merchantform.tell.value==''){
		iserror='true';
		error_desc=error_desc+'\nTelephone';
	}
	if (merchantform.countrylist.value==''){
		iserror='true';
		error_desc=error_desc+'\nCountry';
	}
	if (iserror=='true'){
		alert('The following fields must be filled:\n'+error_desc+'\n');
	}else{
		document.merchantform.submit();
	}
	}
	
function check_contactform ()
{
// This line does not allow for dashes in the website or 4 letter cdos like .asia	
//	var RE_EMAIL = /^(\w+[\-\.])*\w+@(\w+\.)[A-Za-z]{2,3}$/;
// This line does!
	var RE_EMAIL = /^[a-zA-Z0-9._-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}$/;

	fb = document.feedback;
	
    if (fb.subject.value == "")
    {
      alert ("The subject field cannot be left blank.");
	  fb.subject.focus ();
	  return false;
    }
    else
    {
      fb.subject.value = fb.subject.value.replace (/[^a-zA-Z\s]+/g,'');	
    }

    if (fb.contact_name.value == "")
	{
	  alert ("The name field cannot be left blank.");
	  fb.contact_name.focus ();
	  return false;
	}
    else
    {
      fb.contact_name.value = fb.contact_name.value.replace (/[^a-zA-Z ]+/g,'');	
    }
	
	if (fb.company_name.value != "")
    {
	  fb.company_name.value = fb.company_name.value.replace (/[^A-Za-z]+/g,'');
    }

	if (fb.email.value == "")
    {
      alert ("The email address cannot be left blank.");
	  fb.email.focus ();
	  return false;
    }
    if (!RE_EMAIL.test(fb.email.value)) 
    {
      alert ("You must enter a valid email address.");
	  fb.email.focus ();
	  return false;
    }

	if (fb.telephone.value != "")
    {
	  fb.telephone.value = fb.telephone.value.replace (/[^0-9]+/g,'');
    }
	
	if (fb.fax.value != "")
    {
      fb.fax.value = fb.fax.value.replace (/[^0-9]+/g,'');
    }
	
	if (fb.comments.value == "")
	{
	  alert ("Please use the comments field to tell us why you are contacting us.");
	  fb.comments.focus ();
	  return false;
	}
	else
	{
	  fb.comments.value = fb.comments.value.replace (/[^a-zA-Z\s\'\"]+/g,'');
	} 	
}

function getParameter ( queryString, parameterName ) {
	// Add '=' to the parameter name (i.e. parameterName=value)
	var parameterName = parameterName + '=';
	if ( queryString.length > 0 ) {
		// Find the beginning of the string
		begin = queryString.indexOf ( parameterName );
		// If the parameter name is not found, skip it, otherwise return the value
		if ( begin != -1 ) {
			// Add the length (integer) to the beginning
			begin += parameterName.length;
			// Multiple parameters are separated by the '&' sign
			end = queryString.indexOf ( '&' , begin );
			if ( end == -1 ) {
				end = queryString.length
			}
			// Return the string
			return unescape ( queryString.substring ( begin, end ) );
		}
		// Return 'null' if no parameter has been found
		return 'null';
	}
}
function ShowErrorMessage() { 
	if ( window.top.location.search != 0 ) {
		sQueryString = window.top.location.search;
	} else {
		sQueryString = '?NoValue';
	}
	var sErrorCode = getParameter ( sQueryString, 'ErrorCode' );
	if( sErrorCode != 'null' && sErrorCode != '0')
		alert(GetErrorMessage( sErrorCode ));
	var MerchantID = getParameter ( sQueryString, 'MerchantID' );
	if( MerchantID != 'null' && MerchantID != '0')
		alert('Your Application was inserted succefully');
}


	//If an error message exist, this function will show an alert with the Errors
	ShowErrorMessage();

	function FormValidator(fb) {
		if( fb.CompanyName.value.length == 0 ) {
			alert("Please, type a Company Name");
			return(false);
		}
		
		if( fb.ContactName.value.length == 0 ) {
			alert("Please, type a Contact Name");
			return(false);
		}
		
		if( fb.Email.value.length == 0 ) {
			alert("Please, type an Email");
			return(false);
		} else {
			var regEx=/^\w(?:\w|-|\.(?!\.|\@))*\@\w(?:\w|-|\.(?!\.))*\.\w{2,3}/;

			if (! regEx.test( fb.Email.value )) {
				alert("Please, type a valid e-mail");
				return(false);
			}
		}
		
		if( fb.Tel.value.length == 0 ) {
			alert("Please, type a telephone for contact");
			return(false);
		}
		
		if( fb.Country.value == "0" ) {
			alert("Please, choose a country");
			return(false);
		}
		
		return(true);
	}

