		function validate_signup() {
		    
		    if (document.signupForm.email.value=='' ) {
			alert('Please enter email id');
			document.signupForm.email.focus();
			return false
		    }

		    emailStr1=document.signupForm.email.value;
			if(isEmail(emailStr1) == false)	{
				document.signupForm.email.focus();		
				return false;
			}

		    if (document.signupForm.name.value=='' ) {
			alert('Please enter your name');
			document.signupForm.name.focus();
			return false
		    }

		    if (document.signupForm.username.value=='' ) {
			alert('Please enter username');
			document.signupForm.username.focus();
			return false
		    }

		    if (document.signupForm.password.value=='' ) {
			alert('Please enter password');
			document.signupForm.password.focus();
			return false
		    }

		    if (document.signupForm.cpassword.value=='' ) {
			alert('Please enter confirm password');
			document.signupForm.cpassword.focus();
			return false
		    }
		   
		    if (document.signupForm.password.value!=document.signupForm.cpassword.value ) {
			alert('Please enter correct confirm password');
			document.signupForm.cpassword.focus();
			return false
		    }
		   
		    if (document.signupForm.country.value=='' ) {
			alert('Please enter country id');
			document.signupForm.country.focus();
			return false
		    }

		    if (document.signupForm.security_code.value=='' ) {
			alert('Please enter security');
			document.signupForm.security_code.focus();
			return false
		    }

		    if(document.signupForm.terms.checked==0 || document.signupForm.terms.checked=='') {
			alert("Please select the terms and condition");
			document.signupForm.terms.focus();
			return false;
		   }
		   
		   return true;
	     }
		
	   function validate_login() {

		    if (document.loginForm.username.value=='' ) {
			alert('Please enter username');
			document.loginForm.username.focus();
			return false
		    }

		    if (document.loginForm.password.value=='' ) {
			alert('Please enter password');
			document.loginForm.password.focus();
			return false
		    }
		    return true;
	    }
		
		
	    function show_comment() {		
		if(document.addcomment.comment_show.value=='0'){
			document.getElementById("addcomment").style.display='inline';
			document.addcomment.comment_show.value=1;
		}else{
			document.getElementById("addcomment").style.display='none';
			document.addcomment.comment_show.value=0;
		}		
	    }
		
	    function validate_comment() {
		    if (document.addcomment.firstname.value=='' ) {
			alert('Please enter firstname');
			document.addcomment.firstname.focus();
			return false
		    }
		    if (document.addcomment.lastname.value=='' ) {
			alert('Please enter lastname');
			document.addcomment.lastname.focus();
			return false
		    }
		    if (document.addcomment.email.value=='' ) {
			alert('Please enter email');
			document.addcomment.email.focus();
			return false
		    }
		    if (document.addcomment.comment.value=='' ) {
			alert('Please enter comment');
			document.addcomment.comment.focus();
			return false
		    }
		    return true;
	    }
		
	   
	    function validate_editprofile() {
		    
		    if (document.editProfileForm.email.value=='' ) {
			alert('Please enter email id');
			document.editProfileForm.email.focus();
			return false
		    }

		    emailStr1=document.editProfileForm.email.value;
			if(isEmail(emailStr1) == false)	{
				document.editProfileForm.email.focus();		
				return false;
			}

		    if (document.editProfileForm.name.value=='' ) {
			alert('Please enter your name');
			document.editProfileForm.name.focus();
			return false
		    }

		    if (document.editProfileForm.username.value=='' ) {
			alert('Please enter username');
			document.editProfileForm.username.focus();
			return false
		    }

		    if (document.editProfileForm.country.value=='' ) {
			alert('Please enter country id');
			document.editProfileForm.country.focus();
			return false
		    }

		    if (document.editProfileForm.security_code.value=='' ) {
			alert('Please enter security');
			document.editProfileForm.security_code.focus();
			return false
		    }
		   return true;
	     }  
	    
	    
	    
	    function validate_editpassword() {

		    if (document.editPasswordForm.oldpassword.value=='' ) {
			alert('Please enter old password');
			document.editPasswordForm.oldpassword.focus();
			return false
		    }

		    if (document.editPasswordForm.newpassword.value=='' ) {
			alert('Please enter new password');
			document.editPasswordForm.newpassword.focus();
			return false
		    }

		    if (document.editPasswordForm.cpassword.value=='' ) {
			alert('Please enter confirm password');
			document.editPasswordForm.cpassword.focus();
			return false
		    }

		     if (document.editPasswordForm.newpassword.value!=document.editPasswordForm.cpassword.value ) {
			alert('Please enter correct confirm password');
			document.editPasswordForm.cpassword.focus();
			return false
		    }

		    return true;
	    }
	    
	   
	   function validate_subscribeNewsletter() {

		    if (document.subscribeNewsletter.name.value=='' ) {
			alert('Please enter name');
			document.subscribeNewsletter.name.focus();
			return false
		    }

		    if (document.subscribeNewsletter.email.value=='' ) {
			alert('Please enter email');
			document.subscribeNewsletter.email.focus();
			return false
		    }

		    emailStr1=document.subscribeNewsletter.email.value;
			if(isEmail(emailStr1) == false)	{
				document.subscribeNewsletter.email.focus();		
				return false;
			}

		    return true;
	    }
	    

	     function validate_forgetPassword() {
		  
		    if (document.forgetPasswordForm.email.value=='' ) {
			alert('Please enter email');
			document.forgetPasswordForm.email.focus();
			return false
		    }

		    emailStr1=document.forgetPasswordForm.email.value;
			if(isEmail(emailStr1) == false)	{
				document.forgetPasswordForm.email.focus();		
				return false;
			}

		    return true;
	    }

	   
	    function validate_emailThisPage() {

		
		if(document.emailThisPageForm.recipientName.value=='') {
			alert('Please enter recipient name');
			document.emailThisPageForm.recipientName.focus();
			return false
		} else {
			var totalname=document.emailThisPageForm.recipientName.value
				if(totalname.charAt(totalname.length-1)==','){
					totalname=totalname.slice(0,totalname.length-1);
				} 
			arrayname=totalname.split(",")
			//alert(arrayname.length)
		}

		if(document.emailThisPageForm.recipientEmail.value=='') {
			alert('Please enter recipient email id');
			document.emailThisPageForm.recipientEmail.focus();
			return false
		} else {
			var totalemail=document.emailThisPageForm.recipientEmail.value
				if(totalemail.charAt(totalemail.length-1)==',') {
					totalemail=totalemail.slice(0,totalemail.length-1);

				}
			arrayemail=totalemail.split(",")
			//alert(arrayemail.length)
		
			 for(i=0;i<arrayemail.length;i++) {
				if(arrayemail[i]!='') {	
					if(isEmail(arrayemail[i]) == false) {
						document.emailThisPageForm.recipientEmail.focus();
						return false;
					}
			       }
			}  
	      } 

	      if(arrayname.length!=arrayemail.length) {
			alert('Number of recipient name and recipient email id doesn\'t match')
			document.emailThisPageForm.recipientEmail.focus();
			return false;
	      }

	      if(document.emailThisPageForm.senderName.value=='') {
			alert('Please enter your name');
			document.emailThisPageForm.senderName.focus();
			return false
	      }

	      if(document.emailThisPageForm.senderEmail.value=='') {
			alert('Please enter email id');
			document.emailThisPageForm.senderEmail.focus();
			return false
	      } else {
			if(isEmail(document.emailThisPageForm.senderEmail.value) == false) {
				document.emailThisPageForm.senderEmail.focus();
				return false;
			}
	      }

	      if(document.emailThisPageForm.subject.value=='') {
			 alert('Please enter subject');
			 document.emailThisPageForm.subject.focus();
			 return false
	      }

	      if(document.emailThisPageForm.message.value=='') {
			alert('Please enter message');
			document.emailThisPageForm.message.focus();
			return false
	      }

	      return true
	}
	    
	function share(s) {

		var u = escape(window.location);
		var t = escape(document.title);
		var l = u;

		if(s=='digg'){
			window.open('http://digg.com/submit?title=' + t + '&url=' + u, s);		
		}

	        if(s=='facebook'){	
			window.open('http://www.facebook.com/sharer.php?title=' + t + '&u=' + u, s);		
		}

		if(s=='delicious'){
			window.open('http://del.icio.us/post?title=' + t + '&url=' + u, s);	
		}

		if(s=='technorati'){		
			window.open('http://www.technorati.com/faves?add=' + u, s);	
		}

		if(s=='stumbleupon'){
			window.open('http://www.stumbleupon.com/submit?title=' + t + '&url=' + u, s);		
		}

		if(s=='google'){
			window.open('http://www.google.com/bookmarks/mark?op=add&title=' + t + '&bkmk=' + u, s);		
		}	

	}
   
	    
	    
	    
	    /*  FUNCTION FOR EMAIL VALIDATION   */ 

	    function isEmail(emailStr1)	{
			
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr1.match(emailPat)
			if (matchArray==null)  	{
				alert("Email address seems incorrect (check @ and .'s)")				
				return false
			}
			
			var user=matchArray[1]
			var domain=matchArray[2]
			if (user.match(userPat)==null) 	{
				alert("The username doesn't seem to be valid.")				
				return false
			}

			var IPArray=domain.match(ipDomainPat)
			if (IPArray!=null) {
				  for (var i=1;i<=4;i++)
				  {
					if (IPArray[i]>255)
					{
						alert("Destination IP address is invalid!")						
						return false
					}
				  }	    
				  return true
			}

			var domainArray=domain.match(domainPat)
			if (domainArray==null) 
			{
				alert("The domain name doesn't seem to be valid.")				
				return false
			}

			var atomPat=new RegExp(atom,"g")
			var domArr=domain.match(atomPat)
			var len=domArr.length
			if (domArr[domArr.length-1].length<2 || 
				domArr[domArr.length-1].length>3)
			{
			   alert("The address must end in a three-letter domain, or two letter country.")			   
			   return false
			}

			if (len<2)
			{
			   var errStr="This address is missing a hostname!"			   
			   alert(errStr)
			   return false
			}	
			return true
		}

/*   EMAIL VALIDATION FUNCTION ENDS   */


function share(s) {
	var u = escape(window.location);
	var t = escape(document.title);
	var l = u;
	if(s=='digg'){		
		window.open('http://digg.com/submit?title=' + t + '&url=' + u, s);		
	}
	
	if(s=='yahoo'){		
		window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?title=' + t + '&u=' + u, s);		
	}
	
	if(s=='delicious'){		
		window.open('http://del.icio.us/post?title=' + t + '&url=' + u, s);		
	}

	if(s=='technorati'){		
		window.open('http://www.technorati.com/faves?add=' + u, s);		
	}

	if(s=='stumbleupon'){		
		window.open('http://www.stumbleupon.com/submit?title=' + t + '&url=' + u, s);		
	}

	if(s=='google'){		
		window.open('http://www.google.com/bookmarks/mark?op=add&title=' + t + '&bkmk=' + u, s);		
	}	
}
