	function checkToggle (theForm, theCheckbox, action) {
		// Set target elements
    	var theElements = document.forms[theForm].elements[theCheckbox];
   		// Loop through the elements
    	//alert(document.forms[theForm].elements[theCheckbox].value);
		for (var count = 0; count < theElements.length; count++) {
			 theElements[count].checked = action;
    	}
    	//return false;
	} 

	function confirmBox(val){
 		var val
		if (val==1) { 
			var agree=confirm("Are you sure you want to permanently Delete the selected record(s)?");
		}else if (val==2) {
			var agree=confirm("Select user as the WINNER?");
		}else if (val==4) {
			var agree=confirm("Approve selected articles?");
		}else{
			var agree=confirm("Deselect this WINNER?");
		}
		if (agree) {
			return true ;
		} else {
			return false ; } 
	}
	function winUpload(pageTitle,w,h,adress) {
		newWin = window.open(adress,pageTitle,'width='+w+',height='+h+',status=no,location=no,toolbar=no,scrollbars=yes,resizable=no')
	}
	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 validate_comment( )
	{
	    if ( document.myForm.comment.value == "" )
	    {
	        alert ( "'Comment' box is empty!" );
	        return false;
	    }
	}
	function validate_blog( )
	{
	    if ( document.myForm.title.value == "" )
	    {
	        alert ( "Please input a title!" );
	        return false;
	    }
	}
	function validate_form ( )
	{
	    if ( document.myForm.email.value == "" )
	    {
	        alert ( "Please fill in the 'Email Address' box." );
	        return false;
	    }
		var emailID=document.myForm.email
		
		if ((emailID.value==null)||(emailID.value=="")){
			alert("Please enter a valid Email Address.")
			emailID.focus()
			return false
		}
		if (echeck(emailID.value)==false){
			emailID.value=""
			emailID.focus()
			return false
		}
		if ( document.myForm.password.value == "" )
	    {
	        alert ( "Please fill in the 'Password' box." );
	        return false;
	    }
		if ( document.myForm.password2.value == "" )
	    {
	        alert ( "Please fill in the 'Confirm Password' box." );
	        return false;
	    }
		if ( document.myForm.password.value != document.myForm.password2.value )
	    {
	        alert ( "Password and Confirm Password entries don't match." );
	        return false;
	    }
		if ( document.myForm.fname.value == "" )
	    {
	        alert ( "Please fill in the 'First Name' box." );
	        return false;
	    }
		if ( document.myForm.lname.value == "" )
	    {
	        alert ( "Please fill in the 'Last Name' box." );
	        return false;
	    }
		if ( document.myForm.street.value == "" )
	    {
	        alert ( "Please fill in the 'Street Address' box." );
	        return false;
	    }
		if ( document.myForm.city.value == "" )
	    {
	        alert ( "Please fill in the 'City' box." );
	        return false;
	    }
		
		if ( document.myForm.blog.value == "" )
	    {
	        alert ( "Please fill in the 'Blog Title' box." );
	        return false;
	    }
	}

