// function to create preference list as per the requirement 
	function module(objPassed)
	{
		module_selection= new String;
		module_selection="";
		for(i=0;i<objPassed.length;i++)
		{ 
			if(objPassed.options[i].selected!=0)
			{ 
				module_selection+=objPassed.options[i].value+"#";
			} 
		}
		module_selection=module_selection.substring(0,(module_selection.length-1))
		return module_selection;
	}
// end of creation preference list 

//function to check if all the characters are spaces
	function checkblank(textval)
	{
		isblank= new String
		isblank="";
		isblank1= new String
		isblank1="";

		for(j=0; j<textval.length; j++)
		{
			if(textval.substring(j,j+1)==' ') { isblank=isblank+'1'; }
			else { isblank=isblank+'0'; }
			isblank1=isblank1+'1';
		}
//		alert(isblank +'  '+ isblank1);
		if(isblank == isblank1) { textval=""; return false; }
		else { return true; }
	}
// end of function checkblank
	
//function to check if the text field is null or only spaces
	function checktext(textvalue,message)
	{
		var str="";
		var str=textvalue.value;
		if(!(checkblank(str)))
		{
			alert(message);
			textvalue.select()
			return false
		}
		else
		{
			return true
		}
	}
// end of function checktext

// function to check  textarea value null or spaces or maximum limit crosses
	function checktextarea(textvalue,message,limit)
	{
		var str="";
		var str=textvalue.value;
		if((str.length > limit || str.length < 3) || (!(checkblank(str))))
		{
			alert(message + limit + 'characters\n'+ 'You entered text with Length '+str.length);
//			textvalue.focus()
			return false;
		}
		else
		{
			return true;
		}

	}
// end of function checktextarea

//function to check email
	function checkemail(textval,message)
	{
		var str="";
		var atrate=0;
		var str = textval.value;
		
		if (str=="")
		{
			alert(message)
			textval.select()
			return false;
		}
		else 
		{
			for (var i = 0; i < str.length; i++) 
			{
				var ch = str.substring(i, i + 1);
			if ( 
					((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && 
					(ch < "0" || "9" < ch) && 
					(ch != '_') && 
					(ch != '-') &&
					(ch != '@') && 
					(ch != '.') 
				) 
				{
					alert('Please enter valid Email ID')
					textval.select()
					return false;
				}
			}

			if ((str.indexOf ('@') == -1) || (str.indexOf ('.') == -1) || (str.indexOf (' ') > 0))
			{
				alert('Please enter valid Email ID')
				textval.select()
				return false
			}
			for (var i = 0; i < str.length; i++) 
			{
				var ch = str.substring(i, i + 1);
				if ( ch=='@')
				atrate=atrate+1;
			}
			if (atrate > 1 )
			{
				alert('Only 1 ( @ ) symbol allowed \n  '+message)
				textval.select()
				return false
			}
		}
	return true
	}
//end of function checkemail

//function to check for numeric data only
	function checknumval(numval,message)
	{
		var str="";
		var str=numval.value;
		if (str != "") 
		{
			if (String((str)*1)=="NaN")
			{
				alert('Please enter numeric value as a Telephone no.')
				numval.select()
				return false
			}
		}
		else // if it is null
		{
			alert(message)	
			numval.select()
			return false 
		}
	return true
	}
//end of function checknumval

//function to check for drop down selection
	function checkdropdown(objPassed,message)
	{
		if(objPassed.options[objPassed.selectedIndex].value =="") 
		//if(objPassed.value =="") 
		{
			alert ("Error: "+message)
			objPassed.focus()
			return false
		}
		else
		{
			return true
		}
	}
//end of function

//function to check the date & return date format
function checkDates(strdd,strmm,stryy,Adate) 
{
	var dd_index = strdd.selectedIndex;
	var mm_index = strmm.selectedIndex;
	if(strdd.options[dd_index].value == "DD" || strmm.options[mm_index].value =="MM" || String((stryy.value)*1)=="NaN")
	{
		alert("Please fill the Date ");
		strdd.focus();
		return false
	}
	else 
	{
		var new_dob = new String()
		new_dob=strmm.options[mm_index].value+'/'+strdd.options[dd_index].value+'/'+stryy.value.substring(2,stryy.value.length)
		var indate=new_dob;
		
		if (indate.indexOf("-")!=-1) { var sdate = indate.split("-") }
		else if (indate.indexOf("/")!=-1) { var sdate = indate.split("/") }

		var chkDate=new Date(Date.parse(indate))
		var cmpDate=(chkDate.getMonth()+1)+"/"+(chkDate.getDate())+"/"+(chkDate.getYear())
		var indate2=(Math.abs(sdate[0]))+"/"+(Math.abs(sdate[1]))+"/"+(Math.abs(sdate[2]))    
		
		if (indate2!=cmpDate)
		{
			alert("Invalid Date Format (DD-MON-YYYY)");
			strdd.focus();
			return false;
		}
		else
		{
			Adate.value = new_dob;
				return true;
		}
	}

}
//end of function checkdate

//new window open disclaimer

  function new_window(name){
  game=window.open (name,"","height=300,width=450,resizable=1,navigationbar=0,status=0,menubar=0,location=0,scrollbars=yes")
  }
  
  //use the function
 //<a href="javascript:new_window('disclaimer.htm')">Disclaimer</a> 

//end
