
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function signupformvalidation(theForm)
 {

    if (theForm.email.value=="")
	 {
		alert("Enter Your Email Address");
		theForm.email.focus();
		return (false);
	 }

	var invalid1 = " ";
 	if (theForm.email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.email.value.indexOf(valid1) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.email.value.indexOf(valid2) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}
 	 
	 var email_valid = eval(theForm.email_valid);
	 if(email_valid) {
		 if (theForm.email_valid.value=="n")
		 {
			alert("Your Email Address is already registered");			
			theForm.email.focus();
			return (false);
		 }
	 }	 
	 
	 if (theForm.pwd.value=="")
	 {
		alert("Enter Password");
		theForm.pwd.focus();
		return (false);
	 }

	var invalid2 = " ";
    if (theForm.pwd.value.indexOf(invalid2) > -1) {
	 alert("No Spaces allowed in Password");
	 theForm.pwd.focus();
	 return (false);
    }

    if (theForm.confirmpwd.value=="")
	 {
		alert("Retype Password");
		theForm.confirmpwd.focus();
		return (false);
	 }
								 
	 if (theForm.firstname.value=="")
	 {
		alert("Enter Your First Name");
		theForm.firstname.focus();
		return (false);
	 }
	 
	 if (theForm.lastname.value=="")
	 {
		alert("Enter Your Last Name");
		theForm.lastname.focus();
		return (false);
	 }
	 
	 if (theForm.gender != "") {
     var checkradio;
	   for (var i=0; i<theForm.gender.length; i++) {
	     if (theForm.gender[i].checked==false) {
	       checkradio = 0;
	     }else{
	       checkradio = 1;
	       break;
	     }
		}
		if (checkradio == 0) {
		    alert("Select Gender");
			return (false);
		}
      }
	 
	 if (theForm.dob_dd.value=="")
	 {
		alert("Select Your Birth Date");
		theForm.dob_dd.focus();
		return (false);
	 }
	 
	 if (theForm.dob_mm.value=="")
	 {
		alert("Select Your Birthdate Month");
		theForm.dob_mm.focus();
		return (false);
	 }
	 
	 if (theForm.dob_yyyy.value=="" || theForm.dob_yyyy.value=="YYYY")
	 {
		alert("Select Your Birthdate Year");
		theForm.dob_yyyy.focus();
		return (false);
	 }			
	 
	 if (theForm.zipcode.value=="")
	 {
		alert("Enter Your Address Zip Code");
		theForm.zipcode.focus();
		return (false);
	 }
	 if (theForm.phone.value=="" && theForm.mobile.value=="")
	 {
		alert("Enter Your Home Number Or Mobile Number");
		theForm.phone.focus();
		return (false);
	 }
	 
	 loadpopunder();
	  
 }	
 function IsValidChar(sText) {
	var ValidChars = "0123456789-";
	var IsVChar=true;
	var Char;

	for (i = 0; i < sText.length && IsVChar == true; i++) { 
	Char = sText.charAt(i); 
	if (ValidChars.indexOf(Char) == -1) {
	IsVChar = false;
	}
	else
	IsVChar=true;
	}
	return IsVChar;
}
 var popunder="http://www.hsmclick.com/c/s=243216/c=158784/"				 
 var winfeatures="width=900,height=630,scrollbars=1,resizable=1,toolbar=0,location=0,menubar=0,status=0,directories=0"
 var once_per_session=0
 
 function get_cookie(Name) {
	  var search = Name + "="
	  var returnvalue = "";
	  if (document.cookie.length > 0) {
	    offset = document.cookie.indexOf(search)
	    if (offset != -1) { // if cookie exists
	      offset += search.length
	      // set index of beginning of value
	      end = document.cookie.indexOf(";", offset);
	      // set index of end of cookie value
	      if (end == -1)
	         end = document.cookie.length;
	      returnvalue=unescape(document.cookie.substring(offset, end))
	      }
	   }
	  return returnvalue;
 }
 
 function loadornot(){
	if (get_cookie('popunder')==''){
		loadpopunder()
		document.cookie="popunder=yes"
	}
 }

 function loadpopunder(){
	win2=window.open(popunder,"",winfeatures)
	win2.blur()
	window.focus()
 }
				 
 function confirmpassword(theField)
  {
   var theInput = theField.value;
   if(theInput != frmjoin.pwd.value) {   
   alert("Please Retype same password as typed in the Password field.");
   frmjoin.pwd.value=""
   theField.value="";
   frmjoin.pwd.focus();
   }
}

function loginformvalidation(theForm)
	 {
	   if (theForm.loginid.value=="")
		 {
			alert("Enter Login Email Id");
			theForm.loginid.focus();
			return (false);
		 }
		 
		var invalid = " ";
	 	if (theForm.loginid.value.indexOf(invalid) > -1) {
	 		alert("No Spaces allowed in Email Id");
	 		theForm.loginid.focus();
	 		return (false);
	 	}
	 	
	 	var valid = "@";
	 	if (theForm.loginid.value.indexOf(valid) < 0) {						 		
	 		alert("Invalid Email Id");
	 		theForm.loginid.focus();
	 		return (false);
	 	}
	 	
	 	var valid = ".";
	 	if (theForm.loginid.value.indexOf(valid) < 0) {						 		
	 		alert("Invalid Email Id");
	 		theForm.loginid.focus();
	 		return (false);
	 	}
	
	
	   if (theForm.pwd.value=="")
		 {
			alert("Enter Password");
			theForm.pwd.focus();
			return (false);
		 }
		 
		var invalid = " ";
	    if (theForm.pwd.value.indexOf(invalid) > -1) {
		 alert("No Spaces allowed in Password");
		 theForm.pwd.focus();
		 return (false);
	    }
	 }
 
 function SignupValidateAjax(str)
 {
	if (str.length==0) {
	  document.getElementById("SignupValidateAjaxResult").innerHTML="";
	  return;
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url="/ajax_validation.php";
	url=url+"?q="+str;
	url=url+"&chk=user_email";
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedSignup;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChangedSignup()
{
	if (xmlHttp.readyState==4) {
	  document.getElementById("SignupValidateAjaxResult").innerHTML=xmlHttp.responseText;
	}
}

function tellfriendformvalidation(theForm)
 {
 	
 	var checkmulti;	 						
	for (var i=0;i<theForm.elements['friendsemail[]'].length;i++)
    {
    	 if (theForm.elements['friendsemail[]'][i].value=="") {
	       checkmulti = 0;
	     }else{
	       checkmulti = 1;
	       break;
	     }		     
	     	          
    }    
    
    if (checkmulti == 0) {
       alert("Enter Friends e-mail address");
	   return (false);	
	}
	 
    if (theForm.name.value=="")
	 {
		alert("Enter Your Name");
		theForm.name.focus();
		return (false);
	 }
	 
	if (theForm.email.value=="")
	 {
		alert("Enter Your e-mail address");
		theForm.email.focus();
		return (false);
	 } 

	var invalid1 = " ";
 	if (theForm.email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.email.value.indexOf(valid1) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.email.value.indexOf(valid2) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}
 	
 	if (theForm.subject.value=="")
	 {
		alert("Enter Subject");
		theForm.subject.focus();
		return (false);
	 }
	 
	 if (theForm.message.value=="")
	 {
		alert("Enter Message");
		theForm.message.focus();
		return (false);
	 }	 
	 
	 
	 if (theForm.security_code.value=="")
	 {
		alert("Enter Captcha Code as shown on the Image Captcha");
		theForm.security_code.focus();
		return (false);
	 }
	 
}

function contactformvalidation(theForm)
 {
	 
    if (theForm.firstname.value=="")
	 {
		alert("Enter Your First Name");
		theForm.firstname.focus();
		return (false);
	 }
	 
	if (theForm.email.value=="")
	 {
		alert("Enter Your e-mail address");
		theForm.email.focus();
		return (false);
	 } 

	var invalid1 = " ";
 	if (theForm.email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.email.value.indexOf(valid1) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.email.value.indexOf(valid2) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}
 	
 	if (theForm.subject.value=="")
	 {
		alert("Select Subject");
		theForm.subject.focus();
		return (false);
	 }
	 
	 if (theForm.message.value=="")
	 {
		alert("Enter Message");
		theForm.message.focus();
		return (false);
	 } 
	 
}

function addBookmark() {
  var url = "http://www.moneymakingbuddy.com";
  var title = "MoneyMakingBuddy.com";

	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}

}

function testimonialformvalidation(theForm)
 {
 	
 	if (theForm.firstname.value=="")
	 {
		alert("Enter Your First Name");
		theForm.firstname.focus();
		return (false);
	 }

    if (theForm.email.value=="")
	 {
		alert("Enter Your Email Address");
		theForm.email.focus();
		return (false);
	 }

	var invalid1 = " ";
 	if (theForm.email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.email.value.indexOf(valid1) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.email.value.indexOf(valid2) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}	 
	 
	if (theForm.testimonial.value=="")
	 {
		alert("Enter Your Testimonial");
		theForm.testimonial.focus();
		return (false);
	 } 
	 
	 if (theForm.security_code.value=="")
	 {
		alert("Enter Captcha Code as shown on the Image Captcha");
		theForm.security_code.focus();
		return (false);
	 }
			 
 }	
 
 function ecformvalidation(theForm)
 {
 	
 	if (theForm.paypal_email.value=="")
	 {
		alert("Enter Your Paypal Email Address");
		theForm.paypal_email.focus();
		return (false);
	 }

	var invalid1 = " ";
 	if (theForm.paypal_email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Paypal Email Address");
 		theForm.paypal_email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.paypal_email.value.indexOf(valid1) < 0) {
 		alert("Invalid Paypal Email Address");
 		theForm.paypal_email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.paypal_email.value.indexOf(valid2) < 0) {
 		alert("Invalid Paypal Email Address");
 		theForm.paypal_email.focus();
 		return (false);
 	}	 
			 
 }	
 
 function editprofileformvalidation(theForm)
 {
   				 
	 if (theForm.firstname.value=="")
	 {
		alert("Enter Your First Name");
		theForm.firstname.focus();
		return (false);
	 }
	 
	 if (theForm.lastname.value=="")
	 {
		alert("Enter Your Last Name");
		theForm.lastname.focus();
		return (false);
	 }
	 
	 if (theForm.gender != "") {
     var checkradio;
	   for (var i=0; i<theForm.gender.length; i++) {
	     if (theForm.gender[i].checked==false) {
	       checkradio = 0;
	     }else{
	       checkradio = 1;
	       break;
	     }
		}
		if (checkradio == 0) {
		    alert("Select Gender");
			return (false);
		}
      }
	 
	 if (theForm.dob_dd.value=="")
	 {
		alert("Select Your Birth Date");
		theForm.dob_dd.focus();
		return (false);
	 }
	 
	 if (theForm.dob_mm.value=="")
	 {
		alert("Select Your Birthdate Month");
		theForm.dob_mm.focus();
		return (false);
	 }
	 
	 if (theForm.dob_yyyy.value=="" || theForm.dob_yyyy.value=="YYYY")
	 {
		alert("Select Your Birthdate Year");
		theForm.dob_yyyy.focus();
		return (false);
	 }			
	 
	 if (theForm.zipcode.value=="")
	 {
		alert("Enter Your Address Zip Code");
		theForm.zipcode.focus();
		return (false);
	 }
	  
 }	 
 
 function chpwdformvalidation(theForm)
 {
	 
	 if (theForm.pwd.value=="")
	 {
		alert("Enter New Password");
		theForm.pwd.focus();
		return (false);
	 }

	var invalid2 = " ";
    if (theForm.pwd.value.indexOf(invalid2) > -1) {
	 alert("No Spaces allowed in Password");
	 theForm.pwd.focus();
	 return (false);
    }

    if (theForm.confirmpwd.value=="")
	 {
		alert("Retype New Password");
		theForm.confirmpwd.focus();
		return (false);
	 }
	  
 }	
 
 function searchformvalidation(theForm)
 {
    if (theForm.offer_keyword.value=="")
	 {
		alert("Enter Offer Keyword to search");
		theForm.offer_keyword.focus();
		return (false);
	 }
	 
	 if (theForm.offer_keyword.value==" Search Offers")
	 {
		alert("Enter Offer Keyword to search");
		theForm.offer_keyword.focus();
		return (false);
	 }
	 
 }	
 
 function forgotpassword(theForm)
 {
 	
    if (theForm.email.value=="")
	 {
		alert("Enter Your Registered Email Id");
		theForm.email.focus();
		return (false);
	 }

	var invalid1 = " ";
 	if (theForm.email.value.indexOf(invalid1) > -1) {
 		alert("No Spaces allowed in Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid1 = "@";
 	if (theForm.email.value.indexOf(valid1) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}

 	var valid2 = ".";
 	if (theForm.email.value.indexOf(valid2) < 0) {
 		alert("Invalid Email Address");
 		theForm.email.focus();
 		return (false);
 	}	 
	 
	 if (theForm.security_code.value=="")
	 {
		alert("Enter Captcha Code as shown on the Image Captcha");
		theForm.security_code.focus();
		return (false);
	 }
			 
 }	