
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode >=48 && charCode <=57 )|| (charCode == 46 )||(charCode == 10 )||(charCode == 13 )|| (charCode == 8)||(charCode == 32)||(charCode == 45))
        {
	       return true; 
        }
         else
          {
	         alert("Please Enter Only Numbers");
            return false;
        }
        
    }

function IsEmpty(obj, obj_type)
{
 if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file") {
  var objValue;
  
  objValue = obj.value.replace(/\s+$/,"");
  
  if (objValue.length == 0) {
   //obj.focus();
   return true;
  } else {
   return false;
  }
 } else if (obj_type == "select") {
  for (i=0; i < obj.length; i++) {
   if (obj.options[i].selected) {
    if(obj.options[i].value == "0") {
     //obj.focus();
     return true;
    } else {
     return false;
    }
   }
   
  }
  return true; 
 } else if (obj_type == "radio" || obj_type == "checkbox") {
  if (!obj[0] && obj) {
   if (obj.checked) {
    return false;
   } else {
    //obj.focus();
    return true; 
   }
  } else {
   for (i=0; i < obj.length-1; i++) {
    if (obj[i].checked) {
     return false;
    }
   }
   //obj[0].focus();
   return true;
  }
 } else {
  return false;
 }
}





function GetValuesForAffSignUp()
{

//	var oreason=document.getElementById("oreason").value;

var password=document.getElementById("password").value;
var password2=document.getElementById("password2").value;
var email=document.getElementById("email").value;

var payment=document.getElementById("payment").value;

var paypal_id=document.getElementById("paypal_id").value;

var start = document.frm;


if (IsEmpty(start.username,'text'))
 {
  alert("Please enter Username");
  start.username.focus();
  return false;
 }	


 if (IsEmpty(start.password,'text'))
 {
  alert("Please enter password");
  start.password.focus();
  return false;
 }	
if(password.length<6){
		alert("The password should be enter 6 or more characters");
		document.frm.password.value="";
		document.frm.password.focus();
		document.frm.password.select();
		return false;
	}


 if (IsEmpty(start.password2,'text'))
 {
  alert("Please enter confirm password");
  start.password2.focus();
  return false;
 }	

if(password!=password2){
		alert("Passwords are not same, Please Re-enter");
		document.frm.password.value="";
		document.frm.password2.value="";
		document.frm.password.focus();
		return false;
		
	}




 if (IsEmpty(start.company,'text'))
 {
  alert("Please enter company");
  start.company.focus();
  return false;
 }	

/////////////////////////////


 if (IsEmpty(start.firstname,'text'))
 {
  alert("Please enter firstname");
  start.firstname.focus();
  return false;
 }	

 if (IsEmpty(start.lastname,'text'))
 {
  alert("Please enter lastname");
  start.lastname.focus();
  return false;
 }	

 if(email=="")
	{
	alert("Please enter the Email address!");
	document.frm.email.focus();
	document.frm.email.select();
	return false;
	}
	else if(email!=""){
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.email.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.email.value="";
		document.frm.email.focus();
		return false;
		}
	}

 if (IsEmpty(start.phone,'text'))
 {
  alert("Please enter phone");
  start.phone.focus();
  return false;
 }	

 if (IsEmpty(start.payable,'text'))
 {
  alert("Please enter payable to");
  start.payable.focus();
  return false;
 }	

 if (IsEmpty(start.ssntaxid,'text'))
 {
  alert("Please enter SSN TAX ID");
  start.ssntaxid.focus();
  return false;
 }	

if(payment == "0")
{
  alert("Please select payment method");
  start.payment.focus();
  return false;
}

if(payment == "PayPal")
{

 if(paypal_id=="")
	{
	alert("Please enter the paypal id!");
	document.frm.paypal_id.focus();
	document.frm.paypal_id.select();
	return false;
	}
	else if(paypal_id!=""){
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.paypal_id.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.paypal_id.value="";
		document.frm.paypal_id.focus();
		return false;
		}
	}

}


 if (IsEmpty(start.address1,'text'))
 {
  alert("Please enter address1");
  start.address1.focus();
  return false;
 }	

 if (IsEmpty(start.address2,'text'))
 {
  alert("Please enter address2");
  start.address2.focus();
  return false;
 }	

 if (IsEmpty(start.city,'text'))
 {
  alert("Please enter city");
  start.city.focus();
  return false;
 }	

 if (IsEmpty(start.state,'text'))
 {
  alert("Please enter state");
  start.state.focus();
  return false;
 }	



 if (IsEmpty(start.zip,'text'))
 {
  alert("Please enter zip");
  start.zip.focus();
  return false;
 }	

 if (IsEmpty(start.country,'text'))
 {
  alert("Please enter country");
  start.country.focus();
  return false;
 }	

 

 if (IsEmpty(start.websitetitle,'text'))
 {
  alert("Please enter website title");
  start.websitetitle.focus();
  return false;
 }	

 if (IsEmpty(start.websitedescription,'textarea'))
 {
  alert("Please enter website description");
  start.websitedescription.focus();
  return false;
 }	

return true;
 
}




function GetValuesForSignUp()
{

//	var oreason=document.getElementById("oreason").value;

var password=document.getElementById("password").value;
var password2=document.getElementById("password2").value;
var email=document.getElementById("email").value;

var start = document.frm;


if (IsEmpty(start.username,'text'))
 {
  alert("Please enter Username");
  start.username.focus();
  return false;
 }	


 if (IsEmpty(start.password,'text'))
 {
  alert("Please enter password");
  start.password.focus();
  return false;
 }	
if(password.length<6){
		alert("The password should be enter 6 or more characters");
		document.frm.password.value="";
		document.frm.password.focus();
		document.frm.password.select();
		return false;
	}


 if (IsEmpty(start.password2,'text'))
 {
  alert("Please enter confirm password");
  start.password2.focus();
  return false;
 }	

if(password!=password2){
		alert("Passwords are not same, Please Re-enter");
		document.frm.password.value="";
		document.frm.password2.value="";
		document.frm.password.focus();
		return false;
		
	}




if(IsEmpty(start.company,'text'))
 {
  alert("Please enter company");
  start.company.focus();
  return false;
 }	

if (IsEmpty(start.company_logo_url,'text'))
 {
  alert("Please enter company logo url");
  start.company_logo_url.focus();
  return false;
 }	

/////////////////////////////


if (IsEmpty(start.firstname,'text'))
 {
  alert("Please enter firstname");
  start.firstname.focus();
  return false;
 }	

 if (IsEmpty(start.lastname,'text'))
 {
  alert("Please enter lastname");
  start.lastname.focus();
  return false;
 }	

 if(email=="")
	{
	alert("Please enter the Email address!");
	document.frm.email.focus();
	document.frm.email.select();
	return false;
	}
	else if(email!=""){
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.email.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.email.value="";
		document.frm.email.focus();
		return false;
		}
	}

 if (IsEmpty(start.phone,'text'))
 {
  alert("Please enter phone");
  start.phone.focus();
  return false;
 }	

 if (IsEmpty(start.address1,'text'))
 {
  alert("Please enter address1");
  start.address1.focus();
  return false;
 }	

 if (IsEmpty(start.address2,'text'))
 {
  alert("Please enter address2");
  start.address2.focus();
  return false;
 }	

 if (IsEmpty(start.city,'text'))
 {
  alert("Please enter city");
  start.city.focus();
  return false;
 }	

 if (IsEmpty(start.state,'text'))
 {
  alert("Please enter state");
  start.state.focus();
  return false;
 }	

 if (IsEmpty(start.zip,'text'))
 {
  alert("Please enter zip");
  start.zip.focus();
  return false;
 }	

 if (IsEmpty(start.country.value,'select'))
 {
  alert("Please select country");
  start.country.focus();
  return false;
 }	

 

 if (IsEmpty(start.websitetitle,'text'))
 {
  alert("Please enter website title");
  start.websitetitle.focus();
  return false;
 }	

 if (IsEmpty(start.websitedescription,'textarea'))
 {
  alert("Please enter website description");
  start.websitedescription.focus();
  return false;
 }	

return true;
 
}


function GetUsernamePassword()
{
var start = document.frm;

 if (IsEmpty(start.username,'text'))
 {
  alert("Please enter username");
  start.username.focus();
  return false;
 }	

 if (IsEmpty(start.password,'text'))
 {
  alert("Please enter password");
  start.password.focus();
  return false;
 }	


return true;
}



function GetaffUsernamePassword()
{

	
var start = document.frm;

 if (IsEmpty(start.AFFuser,'text'))
 {
  alert("Please enter username");
  start.AFFuser.focus();
  return false;
 }	

 if (IsEmpty(start.password,'text'))
 {
  alert("Please enter password");
  start.password.focus();
  return false;
 }	


return true;
}



function ValiEmail()
{
var email=document.getElementById("email").value;

 if(email=="")
	{
	alert("Please enter the Email address!");
	document.frm.email.focus();
	document.frm.email.select();
	return false;
	}
	else if(email!=""){
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.email.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.email.value="";
		document.frm.email.focus();
		return false;
		}
	}

}




function SelectOfferPage()
{

var OFID=document.getElementById("OFID").value;
var page=document.getElementById("page").value;

var start = document.frm;

if(OFID == "NONE")
{
  alert("Please select Offers");
  start.OFID.focus();
  return false;
}


if(page == "NONE")
{
  alert("Please select page");
  start.page.focus();
  return false;
}

return true;

}


function paymodeselection(obj)
{
	var val=obj.value;
//	alert(val);
	if((val=="PayPal"))
		{		
		document.frm.paypal_id.disabled="";	
		}
		else
		{
			document.frm.paypal_id.value="";	
			document.frm.paypal_id.disabled="disabled";	
		}
	
	if((val=="Check"))
		{		
		document.frm.payable.disabled="";	
		}
		else
		{
			document.frm.payable.value="";	
			document.frm.payable.disabled="disabled";	
		}
}

function paymodeselection_in(obj)
{
	var val=obj.value;
	//alert(val);
	if((val=="PayPal"))
		{		
		document.frm.paypalid.disabled="";	
		}
		else
		{
			document.frm.paypalid.value="";	
			document.frm.paypalid.disabled="disabled";	
		}	
}

