//$(document).ready(function() {

function showNewContent() {
		
			$('#siteContent').show('normal');
			//$('#siteContent').fadeIn('normal');
			
		}
		//for loader
		function hideLoader() {
	
		
			$('#loader').fadeOut('normal',showNewContent);

		}
		
		
function checkemail()
		{
		if(isValidEmail())
	{
		// document.getElementById("email").style.backgroundColor="RED";	
		 //alert(document.forms[0].email.value);
	   $.post('register.php',{email:document.forms[0].email.value},function(data){
																			  //alert(data);
																			  if (data=="false")
																			  {
																			  
																			  document.getElementById("email").style.backgroundColor="RED";	
																			  return false;
																			  }
																			  else
																			  document.getElementById("email").style.backgroundColor="WHITE";	
																			  
																			  
																			  
	});
		

}
		else
	{
		document.getElementById("email").style.backgroundColor="RED";	
	return false;
	}
		}
		
		
		function chkpass()
		{
		var pw=document.getElementById("passw").value;
	  var cpw=document.getElementById("passw1").value;	  	  
	  if(pw.length==0||cpw.length==0)
	  {
		  document.getElementById("passw").style.backgroundColor="RED";	
		document.getElementById("passw1").style.backgroundColor="RED";	
		 return false;
	  }
	  	
		if(pw==cpw)	
		{			
		
		document.getElementById("passw").style.backgroundColor="WHITE";		
		document.getElementById("passw1").style.backgroundColor="WHITE";	
		
			
		}
		else		
		{		
		
		document.getElementById("passw").style.backgroundColor="RED";	
		document.getElementById("passw1").style.backgroundColor="RED";	
			
		return false;		
		}	
		}
		
		function chkname()
		{
		isFullName();
		}
		function chkclg()
		{
		isFullClg();
		}
		
		
		
function subm()
{
	
if(isValidEmail())
	{
		// document.getElementById("email").style.backgroundColor="RED";	
		 //alert(document.forms[0].email.value);
	   $.post('register.php',{email:document.forms[0].email.value},function(data){
																			  //alert(data);
																			  if (data=="false")
																			  {
																			  
																			  document.getElementById("email").style.backgroundColor="RED";	
																			  return false;
																			  }
																			  else
																			  document.getElementById("email").style.backgroundColor="WHITE";	
																			  
																			  
																			  
	});
		

}
else
	{
		document.getElementById("email").style.backgroundColor="RED";	
	return false;
	}

	
	var pw=document.getElementById("passw").value;
	  var cpw=document.getElementById("passw1").value;	  	  
	  if(pw.length==0||cpw.length==0)
	  {
		  document.getElementById("passw").style.backgroundColor="RED";	
		document.getElementById("passw1").style.backgroundColor="RED";	
		 return false;
	  }
	  	
		if(pw==cpw)	
		{			
		
		document.getElementById("passw").style.backgroundColor="WHITE";		
		document.getElementById("passw1").style.backgroundColor="WHITE";	
		
			
		}
		else		
		{		
		
		document.getElementById("passw").style.backgroundColor="RED";	
		document.getElementById("passw1").style.backgroundColor="RED";	
			
		return false;		
		}	
		
	if(!isFullName())
	return false;
	if(!isFullClg())
return false;

//$('#submit').click(function(){
var name3 = document.forms[0].name.value;
var name4 = document.forms[0].college.value;
	//var usname=  document.forms[0].uname.value;

var yr=document.forms[0].year.value;
	var ph=document.forms[0].phono.value;
	var pw=document.getElementById("passw").value;
	var em=document.forms[0].email.value;
$('#siteContent').html("");
	//getNewContent();
		$('#siteContent').hide('slow',getNewContent);
		//$('#siteContent').fadeOut('slow',getNewContent);
		//$('#siteContent').fadeIn('slow',getNewContent);
		//alert("Started");
		$('#loader').remove();
		$('#wrapper').append('<div id="loader"></div>');
		$('#loader').fadeIn('normal');

							  

function getNewContent(){

//alert(em);
$.post('register_ok.php',{passw:pw,name:name3,college:name4,year:yr,email:em,phono:ph}, function(data)
																												 {
																													if(data=="YES")
																													$('#siteContent').html("<p>An activation mail has been sent to you</p><p>Please activate your account</p>" );
																													else
																													$('#siteContent').html("<p>Something seems to be wrong .  <a href=\"mailto:mist@dcetech.com\" > Contact Admin</a></p>" );
																													

																													
																													$('#siteContent').ajaxComplete(hideLoader);
});
							}}//);


//
//});
// JavaScript Document
