function adddetails(main_link,sub_link,x)
{
	var stremail=document.all.email_address.value;
		if (emailCheck(stremail)==false)
		{
			alert("Please enter the correct Email Address...");
			document.frmindex.email_address.focus();
			return false;
		}
		if(document.frmindex.sessiontimes.value=="" || document.frmindex.email_address.value=="")
		{
			alert("Please fill the details.");
		}
		else
		{
				document.frmindex.choice.value="yes";
				dummy(main_link,sub_link,x);
		}
}
function valide(v)
{
	var found=new Array();
	var m;
	var x=document.getElementById(v).value;

	for(i=0; i<x.length; i++)
	{
		m=0;
		y=x.charAt(i);
		found[i]=0;
		for(j=0; j<10;j++)
			if(j==y)
			found[i]=1;
	}
	for(i=0;i<x.length;i++)
	{
		if(found[i]==0)
			m=1;
	}
	if(m==1)
	{	
		document.getElementById(v).value="";
		alert("Please enter numbers only.");
	}
}
function intsubmit(main_link,sub_link,x)
{
	document.frmindex.choice.value="yes";
	dummy(main_link,sub_link,x);
}
<!-- Begin
function emailCheck(emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */

var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */

var ipDomainPat="/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/";

/* The following string represents an atom (basically a series of
   non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */

//	alert("Email address seems incorrect (check @ and .'s)");
	return false
}

var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 

if (user.match(userPat)==null) {
    // user is not valid
//    alert("The username doesn't seem to be valid.");
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */

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

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

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */

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) {
   // the address must end in a two letter or three letter word.
//   alert("The address must end in a three-letter domain, or two letter country.");
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
//   alert(errStr);
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//  End -->
function fncModule(main_link,sub_link,x,extra)
{	
// 	alert(main_link+"---"+sub_link+"---"+x+"---"+extra);
	dummy(main_link,sub_link,x,extra);
}
// New code Dec052006
function fncViewAll(main_link,sub_link,x,param1,param2,param3)
{
//	alert(document.getElementById(param1).value);	
//	alert(document.getElementById(param2).value);
//	alert(document.getElementById(param3).value); 
	
	if(document.getElementById(param1))		// to do
		document.getElementById(param1).value='';
	if(document.getElementById(param2))
		document.getElementById(param2).value='';
	if(document.getElementById(param3))
		document.getElementById(param3).value='';		
	dummy(main_link,sub_link,x,param1);
}

function dummy(main_link,sub_link,x,extra)
{
 	document.frmindex.txtsub_mod.value=sub_link;
	document.frmindex.pages.value=x;
	document.frmindex.txtmod.value=main_link;
	document.frmindex.extrachanges.value=extra;
	document.frmindex.action="index.php";
	document.frmindex.submit();
}
function itempages(main_link,sub_link,x)
{	
	f=document.frmindex		
	if(f.newss.value=="" || f.users.value==""  || f.notess.value=="" || f.manages.value=="")
		alert("Please fill the details.");
	else
	{
		document.getElementById("choice").value="yes";
		dummy(main_link,sub_link,x);
	}
}
function savefile(main_link,sub_link,x)
{
 var f=document.frmindex;
	if(f.uploaded.value=="" || f.pictures.value=="" || f.messages.value==""|| f.user.value=="")
	alert("Please fill the details.");
	else
	{
		document.frmindex.choice.value="yes";
		dummy(main_link,sub_link,x);
	}
}
function addetails(main_link,sub_link,x)
{
	f=document.frmindex;
	if(f.minchar.value=="")
		alert("Please fill the details.");
	else
	{
		document.frmindex.choice.value="yes";
		dummy(main_link,sub_link,x);
	}
}
	function nextrecords(m,main_link,sub_link,x)
	{
		document.frmindex.nextval.value=m;
		dummy(main_link,sub_link,x);
	}
	function prevrecords(m,main_link,sub_link,x)
	{
		document.frmindex.prevval.value=m;
		dummy(main_link,sub_link,x);
	}
	function deletrecord(main_link,sub_link,x,y)
	{
			con=confirm("Are you sure you want to delete?");
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
	/*	New code SEP-12-2006 [s] */	
	function deactive(main_link,sub_link,x,y)
	{
//			alert(main_link +"####" + sub_link+"####" + x+"###"+y);
			con=confirm("Are you sure you want to de-active?");
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
	function active(main_link,sub_link,x,y)
	{
			con=confirm("Are you sure you want to active?");
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
	/*	New code SEP-12-2006 [e] */	
	function modrecord(main_link,sub_link,x,y)
	{
			document.frmindex.id.value=y;
			dummy(main_link,sub_link,x);
	}
	function addrecord(main_link,sub_link,x)
	{
		if(document.frmindex.status.checked==true)
			document.frmindex.status.value='Y';

		if(document.frmindex.title.value=="" || document.frmindex.short_description.value=="" || document.frmindex.long_description.value=="")
		{
			alert("Please fill the details.");
		}		
		else
		{
			dummy(main_link,sub_link,x);
		}
	}
function modnews(main_link,sub_link,x)
	{
		if(document.frmindex.status.checked==true)
			document.frmindex.status.value="Y";
			dummy(main_link,sub_link,x);
	}
function modclient(main_link,sub_link,x,y)
	{
			document.frmindex.id.value=y;
			dummy(main_link,sub_link,x);
	}
function delrecord(main_link,sub_link,x,y,z)
	{
			
			con=confirm("Are you sure you want to Activate Or Deactivate?");
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.stat.value=z;
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
function activeDeactive(main_link,sub_link,x,y,z)
	{

			if(z=='A')
			{
				con=confirm("Are you sure you want to Activate?");
			}
			else if(z=='D')
			{
				con=confirm("Are you sure you want to Deactivate?");
			}
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.stat.value=z;
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}

function next(m,main_link,sub_link,x)
	{
		document.frmindex.nextval.value=m;
		dummy(main_link,sub_link,x);
	}
function previous(m,main_link,sub_link,x)
	{
		document.frmindex.prevval.value=m;
		dummy(main_link,sub_link,x);
	}
	function confom(main_link,sub_link,x,y)
	{
//		con=confirm("This Client has Expired, For activate it you must go to modify page");
		con = 1;
			if(con)
			{
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
function checkvalid()
{
	if(document.frmindex.life.checked==true)
	{
		document.frmindex.validity.value="";
		document.getElementById("validity").disabled=true;
	}
	if(document.frmindex.life.checked==false)
	{
		document.frmindex.validity.value="";
		document.getElementById("validity").disabled=false;
	}
}
	function addrec(main_link,sub_link,x)
	{
		var stremail=document.frmindex.emails.value;
		if (emailCheck(stremail)==false)
		{
			alert("Please enter the correct Email Address.");
			document.frmindex.emails.focus();
			return false;
		}
		if(document.frmindex.pswd.value!=document.frmindex.cpswd.value)
		{
			alert("Please confirm password");
			document.frmindex.pswd.value="";
			document.frmindex.cpswd.value="";
			document.frmindex.pswd.focus();
			return false;
		}		
		if(parseInt(document.frmindex.validity.value) >300)
		{
			alert("Please enter the number below 300.");
			return false;
		}		
		if(document.frmindex.usid.value=="" || document.frmindex.frname.value=="" || document.frmindex.laname.value=="" || document.frmindex.pswd.value=="" || document.frmindex.emails.value=="" || document.frmindex.addr.value=="")
		{
			alert("Please fill the details.");
		}
		else
		{
			dummy(main_link,sub_link,x);
		}
	}
	function drecord(main_link,sub_link,x,y,z)
	{
			if(z=="A")
				con=confirm("Are you sure you want to make this user active?");
			else if(z=="D")
				con=confirm("Are you sure you want to make this user de-active?");
				
			if(con)
			{
				document.frmindex.del.value="yes";
				document.frmindex.stat.value=z;
				document.frmindex.id.value=y;
				dummy(main_link,sub_link,x);
			}
	}
	function modus(main_link,sub_link,x,y)
	{
			document.frmindex.id.value=y;
			dummy(main_link,sub_link,x);
	}
	function addus(main_link,sub_link,x)
	{
		var stremail=document.frmindex.emails.value;
		
		if(document.frmindex.usid.value.length==0) 
		{
			alert("Please enter the user id.");	
			document.frmindex.usid.focus(); 
			return false;
		}
			
		if(document.frmindex.frname.value.length==0) 
		{	
			alert("Please enter the first name.");	
			document.frmindex.frname.focus(); 
			return false;
		}	 
		if(document.frmindex.pswd.value.length==0) 
		{	
			alert("Please enter the password.");	
			document.frmindex.pswd.focus();
			return false;
		}	
		if(document.frmindex.cpswd.value.length==0) 
		{	
			alert("Please enter the confirmation password.");	
			document.frmindex.cpswd.focus(); 	
			return false;
		}	
		if(document.frmindex.emails.value.length==0) 
		{	
			alert("Please enter the email address.");	
			document.frmindex.emails.focus(); 				
			return false;
		}				
		
		if (emailCheck(stremail)==false)
		{
			alert("Please enter the correct Email Address.");
			document.frmindex.emails.focus();
			return false;
		}
		if(parseInt(document.frmindex.validity.value) > 300)
		{
			alert("Please enter the number below 300.");
			return false;
		}			
		
		if(document.frmindex.pswd.value!=document.frmindex.cpswd.value)
		{
			alert("Please enter the confirm password.");
			document.frmindex.pswd.value="";
			document.frmindex.cpswd.value="";
			document.frmindex.pswd.focus();
			return false;
		}
		if(document.frmindex.usid.value=="" || document.frmindex.frname.value=="" || document.frmindex.pswd.value=="" || document.frmindex.emails.value=="" || stremail=="")
		{
			alert("Please fill the details which are marked with star symbol.");
			return false;
		}
		else
		{
			dummy(main_link,sub_link,x);
		}
	}
	function modius(main_link,sub_link,x)
	{
		var stremail=document.frmindex.emails.value;
		if (emailCheck(stremail)==false)
		{
			alert("Please enter correct Email Address.");
			document.frmindex.emails.focus();
			return false;
		}
		if(parseInt(document.frmindex.validity.value) >300)
		{
			alert("Please enter the number below 300.");
			return false;
		}
		if(document.frmindex.frname)
		{
			if((document.frmindex.frname.value.length==0) || (document.frmindex.frname.value=="")) 
			{
				alert("Please enter the first name.");
				document.frmindex.frname.focus();
				return false;
			}
		}
		if(document.frmindex.pswd.value!="")
		{
			if(document.frmindex.pswd.value!=document.frmindex.cpswd.value)
			{
				alert("Please enter the confirm password.");
				document.frmindex.pswd.value="";
				document.frmindex.cpswd.value="";
				document.frmindex.pswd.focus();
				return false;
			}
		}
		// Old Code if(document.frmindex.usid.value=="" || document.frmindex.frname.value=="" || document.frmindex.laname.value=="" || document.frmindex.emails.value=="" || document.frmindex.addr.value=="" || document.frmindex.pswd.value=="" || document.frmindex.cpswd.value=="")
		
	//	if(document.frmindex.usid.value=="" || document.frmindex.frname.value=="" || document.frmindex.emails.value=="") 
	//	{
	//		alert("Please fill the details.");
	//	}
	//	else
	//	{
			document.frmindex.choice.value="yes";
			dummy(main_link,sub_link,x);
	//	}
	}
	// Check for explorer
	var isNavigator;
	isNavigator= (navigator.appName=="Netscape")?1:0;

	// function to check for accepting numbers
	function fncnumbersonly()
	{				
		 if(!isNavigator)
		 { 
			if(event.keyCode < 45 || event.keyCode > 57)
			{ 
				alert("Please enter the numbers only");						
				event.returnValue = false;
			}						
		 }
		 else
		 {
			if(event.which < 45 || event.which > 57) 
			alert("Please enter the numbers only");
			return false;
		 }	 
	}
	function fncOpenCourseDet()
	{ 
// 		document.getElementById("").style.visiblity="hidden"; 
	
	}
	var courseItemsCount=5;  
	function fncOpenCourseList(itemNo)
	{ 
//		alert("commlab--" + itemNo);	
		document.getElementById("contentmain").style.visibility="hidden";
		document.getElementById("contentmain").style.display="none";
		
		var intI;
	 	var courseItem,courseHtItem;
		
		for(intI=0;intI<courseItemsCount;intI++)
		{	
  			courseItem="courselist"+intI; 
			document.getElementById(courseItem).style.visibility="hidden";
			document.getElementById(courseItem).style.display="none";
//			alert(courseItemsCount+ "--" + courseItem);
		}	
		courseHtItem="courselist"+itemNo;
 		document.getElementById(courseHtItem).style.visibility="visible";
 		document.getElementById(courseHtItem).style.display="block";
	}
	
	function fncViewCourse(itNo,itSubNo)
	{
		document.getElementById("contentmain").style.visibility="hidden";
		document.getElementById("contentmain").style.display="none";			
		var courseItem;
		for(intI=0;intI<courseItemsCount;intI++)
		{		
  			courseItem="courselist"+intI; 
			document.getElementById(courseItem).style.visibility="hidden";
			document.getElementById(courseItem).style.display="none"; 
		}
		var courseview="courseview"+itNo+itSubNo;
 		document.getElementById(courseview).style.visibility="visible";
 		document.getElementById(courseview).style.display="block";
	}
	function fncBack(itListNo,itNo)
	{
 		document.getElementById("contentmain").style.visibility="hidden";
		document.getElementById("contentmain").style.display="none";			
		for(intI=0;intI<courseItemsCount;intI++)
		{		
			courseItem="courselist"+intI; 
			document.getElementById(courseItem).style.visibility="hidden";
			document.getElementById(courseItem).style.display="none"; 
		}
		var courseview="courseview"+itListNo+itNo;
	 
 		document.getElementById(courseview).style.visibility="hidden";
 		document.getElementById(courseview).style.display="none";
	
		courseHtItem="courselist"+itListNo;
 		document.getElementById(courseHtItem).style.visibility="visible";
 		document.getElementById(courseHtItem).style.display="block";
	}
	
	 
	