function formValidation( str , str_name  ) 
{
	var str_error = "error_" ; 
	var final_str = str_error + str.getAttribute( 'id' ) ; 
	// final_str contain the string like error_username 
	
	var oDiv = document.getElementById( final_str ) ;
	
	// oDiv contain the object of div where we have to display the error message 
	
	var message = "Enter The " +  str_name ; 
	
	// message variable is used to build the messgae like Enter The Username
	
	/*
	var oH2 = document.createElement( "h2" ) ; 
	oH2.setAttribute( 'id' , 'error_msg' ) ; 
	oH2.setAttribute( 'style' , '' ) ; 
	*/
	// oTextNode contain actual text node
	
	var element_id = str.getAttribute( 'id' ) ; 

	//alert( 'gr__>'+element_id ) ;  	
	
	if( document.getElementById( element_id ).value == '' ) 
	{
		if( oDiv.hasChildNodes() == false ) 
		{
			/*
			oH2.innerHTML = message ; 
			oDiv.appendChild( oH2 ) ; 			
			Effect.BlindDown( oDiv ) ; 
			return false ; 
			*/
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	else
	{
		
		oDiv.style.display = 'none' ; 
		oDiv.innerHTML = "" ; 
		return true ; 
	}
}

function emailValidation( str , str_name  ) 
{
	var str_error = "error_" ; 
	var final_str = str_error + str.getAttribute( 'id' ) ; 
	
	// final_str contain the string like error_username 
	
	var oDiv = document.getElementById( final_str ) ;
	
	// oDiv contain the object of div where we have to display the error message 
	
	var message = "Enter The " +  str_name ; 
	
	// message variable is used to build the messgae like Enter The Username
	
	/*
	var oH2 = document.createElement( "h2" ) ; 
	oH2.setAttribute( 'id' , 'error_msg' ) ; 
	oH2.setAttribute( 'style' , '' ) ; 
	*/
	// oTextNode contain actual text node
	
	var element_id = str.getAttribute( 'id' ) ; 
	
	var url = document.getElementById( element_id ).value ; 
	
	var at="@"
	var dot="."
	var lat=url.indexOf(at)
	var lstr=url.length
	var ldot=url.indexOf(dot)
	
	
	
	if (url.indexOf(at)==-1){
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	
	if (url.indexOf(at)==-1 || url.indexOf(at)==0 || url.indexOf(at)==lstr) {
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false;
	}
	
	if (url.indexOf(dot)==-1 || url.indexOf(dot)==0 || url.indexOf(dot)==lstr) {
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	
	if (url.indexOf(at,(lat+1))!=-1) {
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	
	if (url.substring(lat-1,lat)==dot || url.substring(lat+1,lat+2)==dot){
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	
	if (url.indexOf(dot,(lat+2))==-1) {
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}
	
	if (url.indexOf(" ")!=-1) {
		if( oDiv.hasChildNodes() == false ) 
		{			
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ; 			
		}
		return false ; 
	}	
	oDiv.style.display = 'none' ; 
	oDiv.innerHTML = "" ; 
	return true ; 	
}
function numberValidation( str , str_name   )
{ 
	var str_error = "error_" ; 
	var final_str = str_error + str.getAttribute( 'id' ) ; 
	
	// final_str contain the string like error_username 
	
	var oDiv = document.getElementById( final_str ) ;
	
	// oDiv contain the object of div where we have to display the error message 
	
	var message = "Enter a " +  str_name ; 
	
	// message variable is used to build the messgae like Enter The Username
	
	/*
	var oH2 = document.createElement( "h2" ) ; 
	oH2.setAttribute( 'id' , 'error_msg' ) ; 
	oH2.setAttribute( 'style' , '' ) ; 
	*/
	// oTextNode contain actual text node
	
	var element_id = str.getAttribute( 'id' ) ; 	
	var number = document.getElementById(element_id).value  ; 
	var intRegex = /^(0|[1-9][0-9]*)$/;
    num = parseInt( number ) ;	
	//alert( intRegex.test( num ) ) ; 
    if( intRegex.test( num ) ) 	
	{
		oDiv.style.display = 'none' ; 
		oDiv.innerHTML = "" ; 
		return true ;         
    }
	else
	{
		if( oDiv.hasChildNodes() == false ) 
        {   
		 oDiv.innerHTML = message ; 
         Effect.BlindDown( oDiv ) ;                         
        }
           return false ;
	}

	
}
function selectBoxValidation( str , str_name ) { 
	var str_error = "error_" ; 
	var final_str = str_error + str.getAttribute( 'id' ) ; 

	// final_str contain the string like error_username 
	
	var oDiv = document.getElementById( final_str ) ;
	
	// oDiv contain the object of div where we have to display the error message 
	
	var message = "Please " +  str_name ; 
	
	var element_id = str.getAttribute( 'id' ) ; 
	
	var oSelectBox = document.getElementById( element_id )	; 
	
	var selectedElementValue = oSelectBox.options[oSelectBox.selectedIndex].value ; 
	
	
	if( selectedElementValue == 0 ) {
               if( oDiv.hasChildNodes() == false ) 
               {
               		oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ;                        
               }
               return false ;
       }
       oDiv.style.display = 'none' ; 
       oDiv.innerHTML = "" ; 
       return true ;

	
	
}

function checkBoxValidation( str , str_name ) { 
	var str_error = "error_" ; 
	var final_str = str_error + str.getAttribute( 'id' ) ; 

	// final_str contain the string like error_username 
	
	var oDiv = document.getElementById( final_str ) ;
	
	// oDiv contain the object of div where we have to display the error message 
	
	var message = "Please Select The " +  str_name ; 
	
	var element_id = str.getAttribute( 'id' ) ; 
	
	if( document.getElementById( element_id ).checked == false ) {
		if( document.getElementById( 'chkProspect' ).style.display == 'none' ) { 
			document.getElementById( 'chkProspect' ).style.display = 'block' ; 
		}	
		if( oDiv.hasChildNodes() == false ) 
        	{
        		oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ;                        
        	}
               return false ; 
	} else if( document.getElementById( element_id ).checked == true ) {
		if( document.getElementById( 'chkProspect' ).style.display == 'block' ) { 
			document.getElementById( 'chkProspect' ).style.display = 'none' ; 
		}
		oDiv.style.display = 'none' ; 
		oDiv.innerHTML = "" ; 
		return true ;
	}
}



function RadioButtonValidation( str ,str_name) { 	
	var str_error = "error_" ; 
	var final_str = str_error + str ; 
	var message = "Please Select " + str_name;
	
	var oDiv = document.getElementById( final_str ) ;
	
	var oRadio = document.getElementsByName( str ) ;
	
	flag = 0 ; 
		
	for( i = 0 ; i < oRadio.length ; i++ )  { 
		if( oRadio[ i ].checked == true ) {
			flag = 1 ; 
		}			
	}	
	if( flag == 0 ) { 		
		if( oDiv.hasChildNodes() == false ) 
	    {
			oDiv.innerHTML = message ; 
			Effect.BlindDown( oDiv ) ;  		
	    }
	    return false ; 		
	} else { 	
		
		oDiv.style.display = 'none' ; 
		oDiv.innerHTML = "" ; 
		return true ;	
	}
}

