// Notification......
function viewnotification(){
    document.getElementById('circular').style.display="none";
	document.getElementById('publicnotification').style.display="none";
	document.getElementById('notification').style.display="block";
	
}
function nonnotification(){
	
	document.getElementById('notification').style.display="none";
	
}
function notificationcustoms(){
	
  document.getElementById('notificentral').style.display="none";
  document.getElementById('notificustoms').style.display="block";
}
function notificationcentral(){
	
 document.getElementById('notificustoms').style.display="none";
 document.getElementById('notificentral').style.display="block";
}
// Public Notification......
function viewpublicnotification(){
	document.getElementById('circular').style.display="none";
	document.getElementById('notification').style.display="none";
	document.getElementById('publicnotification').style.display="block";
	
}
function nonpublicnotification(){
	
	
	document.getElementById('publicnotification').style.display="none";
	
}
function publicnotificationcustoms(){
	
  document.getElementById('publicnotificentral').style.display="none";
  document.getElementById('publicnotificustoms').style.display="block";
}
function publicnotificationcentral(){
	
 document.getElementById('publicnotificustoms').style.display="none";
 document.getElementById('publicnotificentral').style.display="block";
}

function viewcirculars(){
	document.getElementById('notification').style.display="none";
	document.getElementById('publicnotification').style.display="none";
	document.getElementById('circular').style.display="block";
	
}
function noncirculars(){
	
	
	document.getElementById('circular').style.display="none";
	
}
function circularcustoms(){
	
  document.getElementById('circularcentral').style.display="none";
  document.getElementById('circularcustoms').style.display="block";
}
function circularcentral(){
	
 document.getElementById('circularcustoms').style.display="none";
 document.getElementById('circularcentral').style.display="block";
}




function updatecost()
{
//delegatetypevar = document.getElementById('delegateType').value;
var typecost=600;
var selindex = document.getElementById('noOfAttendees').selectedIndex;
var attendees = document.getElementById('noOfAttendees').options[selindex].value;
document.getElementById('costs').value = typecost * attendees;
//document.getElementById('paymentmodevar').value = document.getElementById('paymentmode').value;
//document.getElementById('newcostfield').value=(newcost/48).toFixed(0);
}

function validate_email(field)
{
with (field)
{
apos=field.indexOf("@")
dotpos=field.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {return false}
else {return true}
}
}

function validate_contact(field)
{
with (field)
{
  var number="0123456789";
  var m=0;
  for(i=0;i<field.length;i++)
  {
	for(j=0;j<number.length;j++)
	{
	  if(field.charAt(i)==number.charAt(j))
	  {
		  m=m+1;
	  }
	}
  }
  
  if(m==field.length)
  {
	  return true;
  }
  else
  {
	  return false;
  }
}
}



function valid()
{
	
	
	
	   var name=document.getElementById("name").value;
	   var pass=document.getElementById("pass").value;
	   
	   if (name=="" || validate_email(name)==false)
       {
		   alert("Invalid email");
		   document.getElementById("name").focus();
		   return false;
	   }
	   
	  else if (pass=="")
       {
			 alert(" Password  is required");
			 document.getElementById("pass").focus();
			 return false;
	   }
}

function validate()
{	 
  
       var email=document.getElementById("email").value;
	   var pass=document.getElementById("pass").value;
	   var fname=document.getElementById("fname").value;
	   var lname=document.getElementById("lname").value;
	   var contactno=document.getElementById("contactno").value;
	   var address=document.getElementById("address").value;
	   var city=document.getElementById("city").value;
	   var state=document.getElementById("state").value;
	   var pcode=document.getElementById("pcode").value;
	   var country=document.getElementById("country").value;
	   var noOfAttendees=document.getElementById("noOfAttendees").value;
	   var paymentmode=document.getElementById("paymentmode").value;
	   var costs=document.getElementById("costs").value;
       var newcostfield=(costs/48).toFixed(0);
	  
	   if (email=="" || validate_email(email)==false)
       {
		   alert("Invalid email");
		   document.getElementById("email").focus();
		   document.getElementById("paymentmode").value="";
		   
		   return false;
	   }
	   else if (pass=="")
       {
			 alert(" Pass word is required");
			 document.getElementById("pass").focus();
			 
			 
			 return false;
	   }
	  else if (fname=="")
       {
			 alert("First name is required");
			 document.getElementById("fname").focus();
			 document.getElementById("paymentmode").value="";
			
			 return false;
	   }
       else if (lname=="")
       {
			 alert("Last name is required");
			 document.getElementById("lname").focus();
			 document.getElementById("paymentmode").value="";
			 
        	 return false;
	   }
       else if (contactno=="" || validate_contact(contactno)==false)
       {
		     alert("Invalid contact number");
			 document.getElementById("contactno").focus();
			 document.getElementById("paymentmode").value="";
			
			 return false;
	   }
	  
	   else if(paymentmode=="")
	   {
	       alert("Please select payment mode");
		   document.getElementById("paymentmode").value="";
		   document.getElementById("paybutton").innerHTML="";
		  
		   return false;
	   }
	}

function viewpaper()
{
	//alert("sheik");
	 var dt=document.getElementById("date").value;
	 //alert(dt);
	 window.location.href='archive.php?id='+dt;
}

function changedate()
{
	//alert("sheik");
	 var dt=document.getElementById("date").value;
	 if(dt==""){
		 alert("Please seelct issue date");
		  return false;
	 }
	 else{
		 window.location.href='newarchive.php?id='+dt;
		 return false;
	 }
}
