function editAlert(alertid)
{
		document.alert.REQ_TYPE.value="EDIT_ALERT";
		document.alert.alertid.value=alertid;
		//Anand changes for Requestprocessor
		document.alert.action = document.alert.EDIT_ALERT.value;
		//Anand changes for Requestprocessor
		document.alert.submit();
}


function viewResults(alertID){

	//alert("For View results");
	document.alert.action = document.alert.SHOW_SMAPLE_ALERT_FT.value;
	document.alert.alertid.value=alertID;
	//alert("Alert _id " + alertID);
	document.alert.submit();
}

//Added this function for NLR-187
function unSubscribe(sitePK){
	//alert(sitePK);
	document.F1.site_name.value = sitePK;
    document.F1.REQ_TYPE.value = "UNSUBSCRIBE_NEWSLETTER";
	document.F1.action = document.F1.AFTER_NEWSLETTER_UNSUBSCRIBE_URL.value;
    document.F1.UNSUBSCRIBE.value = "ANY";
	document.F1.submit();	
}

function open_popup(page) 
{
    window.open(page,"","menubar=0,toolbar=0,width=600,height=250,status=0,scrollbars=1,resizable=1,screenX=10,screenY=10");
    //Changed for NLR-66
    //return false;
}
//For step-3 & step-4
function open_popup_step3(page) {
    window.open(page,"","menubar=0,toolbar=0,width=600,height=400,status=0,scrollbars=1,resizable=1,screenX=10,screenY=10");
	//Changed for NLR-66
    //return false;
}

function showSample()
{
		document.alert.REQ_TYPE.value="SHOW_SMAPLE_ALERT";
		document.alert.submit();
}

function initialize()
{

	document.alert.pressrelease.disabled = true;
	document.alert.pubs.disabled = true;
	document.alert.news.disabled = true;
	document.alert.research.disabled = true;
}

function deleteAlert(alertid)
{

	var res=confirm("Are you sure, you want to delete this Alert?");
	if(res==true)
	{
		document.alert.REQ_TYPE.value="DELETE_ALERT";
		document.alert.alertid.value=alertid;
		//Anand changes for Requestprocessor
		document.alert.action = document.alert.DELETE_ALERT.value;
		//Anand changes for Requestprocessor
		document.alert.submit();	
	}
}

function saveAlert(alertid)
{
	document.forms[1].action_type="SAVE";
	document.forms[1].alertid=alertid;
	document.forms[1].submit();
}



function isSubscribes()
{
	var i=document.F1.elements.length
	var total=i-2;
	var increment=0
	//alert(" i ="+i);
	for(var index=0;index<total;++index)
	{
		if(document.F1.elements[index].checked != true) 
		{
			increment++;
		}
	}
	//alert(" increment ="+increment);	

	if(increment == total)
	{
		alert("Please select a Newsletter to subscribe");
	}
	else
	{
		document.F1.REQ_TYPE.value = "SUBSCRIBE_NEWSLETTER";
          //Anand for RequestProcessor
 		document.F1.action = document.F1.SUBSCRIBE_NEWSLETTER.value;
	   	document.F1.submit();
          //Anand for RequestProcessor ends
	}
}

function isUnSubscribes(siteType)
{
	var i=document.F1.elements.length;
	var total=i-3;
	if(siteType == "ANY"){
		total=i;
	}
	var increment=0;
	for(var index=0;index<total;++index)
	{
		if(document.F1.elements[index].checked != true) 
		{
			increment++;
		}
	}
	if(increment==total)
	{
		//Changes made to display message for NLR-101
		if(siteType == "ANY"){
			alert("Select a Newsletter to Unsubscribe");
		}else{
			alert("You have not subscribed for any Newsletter");
		}
	}
	else
	{
	   document.F1.REQ_TYPE.value = "UNSUBSCRIBE_NEWSLETTER";
	   document.F1.action = document.F1.UNSUBSCRIBE_NEWSLETTER.value;
	   // For NLR - 101, this if block has been added.
	   if(siteType == "ANY"){
		   document.F1.UNSUBSCRIBE.value = "ANY";
	   }
	   document.F1.submit();
	}
}

function listFilter()
{
	//alert("filtering the list");
	for(var i=0;i<document.alert.TmpList1.options.length;i++)
	{
		document.alert.TmpList1.options[i].selected = true;
	}	
	for(var j=0;j<document.alert.TmpList2.options.length;j++)
	{
		document.alert.TmpList2.options[j].selected = true;
	}
	for(var k=0;k<document.alert.TmpList3.options.length;k++)
	{
		document.alert.TmpList3.options[k].selected = true;
	}
}


//*******************Srart Quick USER************

function validateEmail(email)
{

    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}



function quickUserSave()
{
	 if (document.Quick.EMAIL_ID.value == "") 
	 {
    	     alert("Please Enter EMAIL ID");     
        	 document.Quick.EMAIL_ID.focus();
	         return false;
          
	 }
	 else if(!validateEmail(document.Quick.EMAIL_ID.value)) 
	 { 
          strError = "Enter a valid Email address "; 
          alert(strError); 
          document.Quick.EMAIL_ID.focus();
          document.Quick.EMAIL_ID.select();
          return false; 
	 }  

	    str   = new String(document.Quick.EMAIL_ID.value);
    	atPos =  str.indexOf("@");
	    dotPos = str.indexOf(".");
    	if(str.substring(atPos+1,dotPos+1)==".")
	    {
               strError = "Enter a valid Email address "; 
               alert(strError); 
               return false;
	    }
	 	 document.Quick.REQ_TYPE.value = "QUICK_USER";
 		 document.Quick.action =  	 document.Quick.QUICK_USER.value;
	 	 document.Quick.submit();
}   


function quickUserCheck()
{
	 if (document.Quick.EMAIL_ID.value == "") 
	 {
    	     alert("Please Enter EMAIL ID");     
        	 document.Quick.EMAIL_ID.focus();
	         return false;
          
	 }
	 else if(!validateEmail(document.Quick.EMAIL_ID.value)) 
	 { 
          strError = "Enter a valid Email address "; 
          alert(strError); 
          document.Quick.EMAIL_ID.focus();
          document.Quick.EMAIL_ID.select();
          return false; 
	 }  

	    str   = new String(document.Quick.EMAIL_ID.value);
    	atPos =  str.indexOf("@");
	    dotPos = str.indexOf(".");
    	if(str.substring(atPos+1,dotPos+1)==".")
	    {
               strError = "Enter a valid Email address "; 
               alert(strError); 
               return false;
	    }
		//Below two lines un commented in order to resolve NLR-208 : Anand
	 	 document.Quick.REQ_TYPE.value = "QUICK_USER";
 		 document.Quick.action = document.Quick.QUICK_USER.value;
	 	// document.Quick.submit();
}   

//*******************End Quick USER*************
function validateAlertList()
{
	var alertTitle=document.alert.assignalert.value;
	for(var i=0;i<document.alert.AlertList.options.length;i++)
	{
		if(document.alert.AlertList.options[i].value==alertTitle)
		{
			alert("This Alert already exists.Please change the title.");
			return false;
		}
	}
}



function arrangeRegion()
{
	var srcRegionLen = document.alert.SourceList1.options.length;
	var tmpRegionLen = document.alert.TmpList1.options.length;
    var srcRegionCnt = srcRegionLen;
    if(srcRegionLen != document.alert.regionLen.value)
    {
	    if(srcRegionLen!=srcRegionLen+tmpRegionLen && document.alert.TmpList1.options[0].text !='All')
    	{
	  		document.alert.SourceList1.options.length=srcRegionLen+tmpRegionLen;
	 	    for(i=0;i<tmpRegionLen;i++)
			{
			      document.alert.SourceList1.options[srcRegionCnt].text=document.alert.TmpList1.options[i].text;
		    	  srcRegionCnt=srcRegionCnt+1;
	        }	
	    }    
    }	
    
    
}


function arrangeCountry()
{
	var srcCountryLen = document.alert.SourceList2.options.length;
	var tmpCountryLen = document.alert.TmpList2.options.length;
    var srcCountryCnt = srcCountryLen;
    if(srcCountryLen != document.alert.countryLen.value)
    {
	    if(srcCountryLen!=srcCountryLen+tmpCountryLen && document.alert.TmpList2.options[0].text !='All')
    	{
	  		document.alert.SourceList2.options.length=srcCountryLen+tmpCountryLen;
	 	    for(i=0;i<tmpCountryLen;i++)
			{
			      document.alert.SourceList2.options[srcCountryCnt].text=document.alert.TmpList2.options[i].text;
		    	  srcCountryCnt=srcCountryCnt+1;
	        }	
    	}	
    }	
}

function arrangeTopic()
{
	var srcTopicLen = document.alert.SourceList3.options.length;
	var tmpTopicLen = document.alert.TmpList3.options.length;
    var srcTopicCnt = srcTopicLen;
    if(srcTopicLen != document.alert.topicLen.value)
	{
	    if(srcTopicLen !=srcTopicLen+tmpTopicLen && document.alert.TmpList3.options[0].text !='All')
    	{
	  		document.alert.SourceList3.options.length=srcTopicLen+tmpTopicLen;
	 	    for(i=0;i<tmpTopicLen;i++)
			{
			      document.alert.SourceList3.options[srcTopicCnt].text=document.alert.TmpList3.options[i].text;
		    	  srcTopicCnt=srcTopicCnt+1;
	        }	
        }	
     }   
}


// Put All option for Topic, Region & Country
function swapTRC()
{
	
	arrangeRegion();
	arrangeCountry();
	arrangeTopic();	

	if(document.alert.content2[0].checked)
	{
	      document.alert.TmpList1.options.length=1;	        
	      document.alert.TmpList1.options[0].text="All";
	      
	      document.alert.TmpList2.options.length=1;	        
	      document.alert.TmpList2.options[0].text="All";
	      
	      document.alert.TmpList3.options.length=1;	        
	      document.alert.TmpList3.options[0].text="All";
	}	        
}

function swapSelectedTRC()
{
	//arrangeRegion();
	//arrangeTopic();
	//arrangeCountry();

	if(document.alert.content2[1].checked)
	{
	      document.alert.TmpList1.options.length=0;	        
	      //To remove the error reported by Rajkumar on...4th October, Anand
	      //document.alert.TmpList2.options.length=0;	        
	      document.alert.TmpList3.options.length=0;	        
	}
}



function swapList()
{
	
	//arrangeRegion();
	//arrangeTopic();
	//arrangeCountry();
	
	if(document.alert.content2[0].checked)
	{
		     	   
	      document.alert.TmpList1.options.length=1;	        
	      document.alert.TmpList1.options[0].text="All";

 		 // document.alert.TmpList2.options.remove(0);	  
	      //document.alert.TmpList2.options.length=0;	         		  
	    	      
	      document.alert.TmpList3.options.length=1;	        
	      document.alert.TmpList3.options[0].text="All";

	}

	
	
	/*if(document.alert.TmpList1.options.length>0)
	{
		var sListLength1=document.alert.SourceList1.options.length;
		while(document.alert.SourceList1.options.length>0)
		{
			document.alert.SourceList1.options.remove(document.alert.SourceList1.options.length-1)
		}
		for(var i=0;i<document.alert.swapRegionList.options.length;i++)
		{
			var newRegionOpt = new Option(document.alert.swapRegionList.options[i].text, document.alert.swapRegionList.options[i].value);
			var targetRegionSize = document.alert.SourceList1.options.length;
			document.alert.SourceList1.options[targetRegionSize] = newRegionOpt;
		}
		for(;document.alert.TmpList1.options.length>0;)
		{
			document.alert.TmpList1.options.remove(0);
		}
	}

//Country Block.
	if(document.alert.TmpList2.options.length>0)
	{
		var sListLength2=document.alert.SourceList2.options.length;
		while(document.alert.SourceList2.options.length>0)
		{
			document.alert.SourceList2.options.remove(document.alert.SourceList2.options.length-1)
		}
		for(var j=0;j<document.alert.swapCountryList.options.length;j++)
		{
			var newCountryOpt = new Option(document.alert.swapCountryList.options[j].text, document.alert.swapCountryList.options[j].value);
			var targetCountrySize = document.alert.SourceList2.options.length;
			document.alert.SourceList2.options[targetCountrySize] = newCountryOpt;
		}
		for(;document.alert.TmpList2.options.length>0;)
		{
			document.alert.TmpList2.options.remove(0);
		}
		
	}

	if(document.alert.TmpList3.options.length>0)
	{
		var sListLength3=document.alert.SourceList3.options.length;
		while(document.alert.SourceList3.options.length>0)
		{
			document.alert.SourceList3.options.remove(document.alert.SourceList3.options.length-1)
		}
		for(var k=0;k<document.alert.swapTopicList.options.length;k++)
		{
			var newTopicOpt = new Option(document.alert.swapTopicList.options[k].text, document.alert.swapTopicList.options[k].value);
			var targetTopicSize = document.alert.SourceList3.options.length;
			document.alert.SourceList3.options[targetTopicSize] = newTopicOpt;
		}
		for(;document.alert.TmpList3.options.length>0;)
		{
			document.alert.TmpList3.options.remove(0);
		}
	}*/
}


/*
==================================================================
LTrim(string) : Returns a copy of a string without leading spaces.
==================================================================
*/
function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
RTrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}

/*
=============================================================
Trim(string) : Returns a copy of a string without leading or trailing spaces
=============================================================
*/
function Trim(str)
/*
   PURPOSE: Remove trailing and leading blanks from our string.
   IN: str - the string we want to Trim

   RETVAL: A Trimmed string!
*/
{
   return RTrim(LTrim(str));
}




function validateform()
{
	//alert("Test");
	//alert("Value " +document.alert.value);
	var alertname = document.alert.assignalert.value;
	if((alertname.substring(0,1)<"a" || alertname.substring(0,1)>"z") && (alertname.substring(0,1)<"A" || alertname.substring(0,1)>"Z"))
		{
			alert("The Alert Name Cannot Start With Numbers, Blank spaces & Special characters.");
		return false;
		}
	var alertname = Trim(document.alert.assignalert.value);	

	if ( alertname == "") {
	 	alert("Please enter Alert Name");
	 	document.alert.assignalert.focus();
	 	document.alert.assignalert.select();
 		return false;
 	}
	
 		var alertTitle=Trim(document.alert.assignalert.value);
 		var pageMode=document.alert.REQ_TYPE.value;
 		//alert("REQ_TYPE " + pageMode  );

 		if(pageMode != "EDIT_ALERT")
 		{
			for(var i=0;i<document.alert.AlertList.options.length;i++)
			{
				if(document.alert.AlertList.options[i].value==alertTitle)
				{
					alert("This Alert already exists.Please change the title.");
					return false;
				}
			}
		}
 	
	listFilter();
 	if(document.alert.content2[1].checked && checkCategory())
 	{
	     //alert("Hi08");
 		 if((document.alert.TmpList1.options.length >=1) || (document.alert.TmpList2.options.length >=1) || (document.alert.TmpList3.options.length >=1))
		 {
			
 		 }
 		 else
 		 {
 			alert("Please select at least a Region or a Country, or a Topic"); 		 
			return (false); 
 		 }
 	}
 	
 	
 	
  		 if(document.alert.REQ_TYPE.value=="EDIT_ALERT")
		 {
		    // alert("Hi09");
		 
		 		      if(checkCategory())
		 		      {
		 			//document.alert.all.saveId.style.visibility='hidden';
		 			//document.alert.submit();
		 		      }
		 		      else
		 		      {
		   			  alert("Please Select At Least One Type of Content");
		 			  return false; 
		      		      }
		 
		 	//alert("Edit Alert1");
			document.alert.REQ_TYPE.value="UPDATE_ALERT";
	  		//Anand changed for Requestprocessor
	  		document.alert.action = document.alert.UPDATE_ALERT.value;
	  		//Anand changed for Requestprocessor ends		  		
			//document.alert.all.saveId.style.visibility='hidden';
			//document.alert.submit();
			
			
		 }
		 else 
		 {
		     //alert("Hi10");
		     document.alert.REQ_TYPE.value="CREATE_ALERT";
  		     //Anand changed for Requestprocessor
 		     document.alert.action = document.alert.CREATE_ALERT.value;
 		     //Anand changed for Requestprocessor ends	
 		     //alert(" document.alert.action = "+ document.alert.action);
 		     //alert("checkCategory() "+checkCategory())
 		     
 		     if(checkCategory())
		     {
				//document.alert.all.saveId.style.visibility='hidden';
				document.alert.submit();
		      }
		      else
		      {
  			  alert("Please Select At Least One Type of Content");
			  return false; 
		      }
 		     
		 }
  	

		<!-------start added for edit mode --------->
		
		
		if(pageMode =="EDIT_ALERT")
		{
			var alertExists =false;	
			var oldalertTitle = document.alert.oldalert.value;
			for(var i=0;i<document.alert.AlertList.options.length;i++)
			{
				if(document.alert.AlertList.options[i].value == alertTitle)
				{
				   alertExists = true;	
				   if(alertTitle == oldalertTitle)
				    {
				    
			       //f alert("This Alert in edit  equal second ");
			       		//alert("Edit Alert2");
	  				document.alert.action = document.alert.UPDATE_ALERT.value;
					//document.alert.all.saveId.style.visibility='hidden';
					document.alert.submit();
				    } 
				     else
				     {
				    
				        //alert("This Alertin edit   first else");
				    	alert("This Alert already exists.Please change the title.");
					return false;
				    
				    }
				}
			}
			
			if(alertExists)
			{
				return false;
			}else{
					//alert("Edit Alert3");
	  				document.alert.action = document.alert.UPDATE_ALERT.value;
					//document.alert.all.saveId.style.visibility='hidden';
					document.alert.submit();				
			}
		
		
	}	
 	<!-------ended code for added for edit mode --------->

}


function validateShowform(){
	
 		var alertTitle=document.alert.assignalert.value;
 		var pageMode=document.alert.REQ_TYPE.value;
		
		
				
		if ( alertTitle == "") {
	 	alert("Please Enter Alert Name");
	 		 	
	 	document.alert.assignalert.focus();
	 	document.alert.assignalert.select();
 		return false;
 	}

 	listFilter();
 	if(document.alert.content2[1].checked)
 	{
 		 if((document.alert.TmpList1.options.length >=1) || (document.alert.TmpList2.options.length >=1) || (document.alert.TmpList3.options.length >=1))
		 {

 		 }
 		 else
 		 {
 			alert("Please select at least a Region or a Country, or a Topic"); 		 
			return false; 
 		 }

 	}
 	
 	if (document.alert.content[1].checked)
 	{
 		// alert("inside content1");
 		 if ((document.alert.pressrelease.checked == true)||(document.alert.pubs.checked == true)||(document.alert.news.checked == true)||(document.alert.research.checked == true)||(document.alert.Project.checked == true)||(document.alert.ProjectInfo.checked == true)||(document.alert.advisory_work.checked == true)||(document.alert.Publications.checked == true))
 		 {
 		  	//alert("inside pressrelease ");
 		  	if(document.alert.REQ_TYPE.value=="EDIT_ALERT")
 		  	{
 		  		//alert("inside inner if req type UPDATE_ALERT");
 		  		document.alert.REQ_TYPE.value="UPDATE_ALERT";
 		  		document.alert.submit();
 		  	}else{
 		  		//alert("Inside create alert1 req_type CREATE_ALERT");
 		  		document.alert.REQ_TYPE.value="CREATE_ALERT";
 		  		document.alert.submit();
 		  	}
 		  } else {
  			alert("Please select atleast one alert Catagory");
  			document.alert.content[1].focus();
  			return;
  		  }
  		  //alert("end inside content1");
  	}else{
	     document.alert.REQ_TYPE.value="SHOW_SMAPLE_ALERT";


        contentType="F"; // Based on NLR-71
		
		/****** The following block of code has been commented based on NLR-71, It may use for future.... Commented on 25-Aug-04 by Rajesh M***/
        /*contentTypeLength =  document.alert.content_mail.length;
	    for( i=0;i<contentTypeLength;++i)
	    {
			if(document.alert.content_mail[i].checked)
			{
			     contentType = document.alert.content_mail[i].value;
			}
	    }*/
	    /************************************************************************************************/
 	   
 	   //Anand changed for Requestprocessor
	     if(contentType == "H")	
 	     	document.alert.action = document.alert.SHOW_SMAPLE_ALERT_HD.value;
 	     else
 	     	document.alert.action = document.alert.SHOW_SMAPLE_ALERT_FT.value;
 	     //Anand changed for Requestprocessor ends		  		
   	     document.alert.all.sampledisplay.style.visibility='hidden';
	     document.alert.submit();
  	}
}





function validatebutton(buttonvalue){
//alert("inside validation");
box = eval("document.alert.pressrelease"); 
if (box.checked == true) box.checked = false;
box = eval("document.alert.pubs"); 
if (box.checked == true) box.checked = false;
box = eval("document.alert.news"); 
if (box.checked == true) box.checked = false;
box = eval("document.alert.research"); 
if (box.checked == true) box.checked = false; 
if (buttonvalue =="all") {


document.alert.pressrelease.disabled = true;
document.alert.pubs.disabled = true;
document.alert.news.disabled = true;
document.alert.research.disabled = true;  

buttonvalue="";

}
if (buttonvalue=="selected")
{


document.alert.pressrelease.disabled = false;
document.alert.pubs.disabled = false;
document.alert.news.disabled = false;
document.alert.research.disabled = false;


buttonvalue="";
}

}




<!-- *************************************************  --->

function getData(theForm, newForm) 
{
	var srtName;
	strName = theForm.name.substr(0,6)
	if(document.alert.content2[1].checked) 
	{
		if(theForm.options.selectedIndex == -1)
		{
			alert ('Please make a selection.');
			return;
		}
		for(var i = 0; i < theForm.options.length; i++ )
		{
			if(theForm.options[i].selected )
			{
				var Val = theForm.options[i].value;
				var Txt = theForm.options[i].text;			
				if(strName=='Source')
				{
					addOpt(Txt, Val, newForm);
				}	
				//addOpt(Txt, Val, hiddenForm,true);
				//if(strName == "SELECT")
				//	addOpt(Txt, Val, hiddenForm,true);
			}
		}
		for(var j = theForm.options.length - 1; j >= 0; j-- )
		{
			if(strName=='TmpLis')
			{
				if (theForm.options[j].selected )
				{			
					theForm.options[j] = null;
				}
			//if(strName != "SELECT")	hiddenForm.options[j] = null;			
			}
		}
	}

}

//Specially for Country List
function getCountryData (theForm, newForm) 
{
	
	var srtName;
	strName = theForm.name.substr(0,6)
	if (document.alert.content2[0].checked || document.alert.content2[1].checked)
	{
	
		if (theForm.options.selectedIndex == -1)
		{
			alert ('Please make a selection.');
			return;
		}
		for ( var i = 0; i < theForm.options.length; i++ )
		{
			if (theForm.options[i].selected )
			{
				var Val = theForm.options[i].value;
				var Txt = theForm.options[i].text;			
				if(strName=='Source')
				{
					addOpt(Txt, Val, newForm);
				}	
			}
		}
		
		for ( var j = theForm.options.length - 1; j >= 0; j-- )
		{
			if(strName=='TmpLis')
			{
				if (theForm.options[j].selected)
				{			
					theForm.options[j] = null;
				}
			}
		}
	}	
}

function addOpt(theText, theVal, theSelObj) 
{
		
		var valueFlag=false;
		var strList  ="";
		if(theSelObj.options.length <=0)
		{
			var newOpt = new Option(theText, theVal);
			var targetSize = theSelObj.options.length;
			theSelObj.options[targetSize] = newOpt;
		}
		else
		{
			for(var k=0;k<theSelObj.options.length;k++)
			{
				if(theSelObj.options[k].text == theText)
				{
					valueFlag=true;
					break;
				}
			}
			if(!valueFlag)
			{							
					var newOpt = new Option(theText, theVal);
					var targetSize = theSelObj.options.length;
					theSelObj.options[targetSize] = newOpt;
			}
		}		
}

function isNotAlphabets(str)
{
	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 != '_')) 
		{
			return true;
		}
	}
	return false;
}
//By WB274448 for ALL Selection
function CheckAll()
{
for (var i=0;i < document.alert.elements.length;i++)
	{
		var e = document.alert.elements[i];
		if ((e.type == 'checkbox'))
		{
			e.checked = document.alert.AllCategories.checked;
		}
	}
}
//By WB274448 for ALL Selection
function CheckAllPlus()
{
        
        
              var categories = 0;
		for (var i=0;i < document.alert.elements.length;i++)
				{
					var e = document.alert.elements[i];
					if ((e.type == 'checkbox'))
					{  
					     			
						if(document.alert.elements[i].checked == true && document.alert.AllCategories.checked == false)
						      {
						      ++categories;
						      //alert(categories);
						      }
											
					}
					
					
				}
			
		/*	if(categories == 3)
			  document.alert.AllCategories.checked = true;
			  else
	             document.alert.AllCategories.checked = false;
	             
	             if(categories == 6)
			  document.alert.AllCategories.checked = true;
			  else
	             document.alert.AllCategories.checked = false;
	      */       
		// NLPE - 5 : Replacing the count of categories - 6, with 5.
		// This is due to the merging of Project Information and Project Information Document	      
	          if(categories == 5)
			  	document.alert.AllCategories.checked = true;
			  else
	            document.alert.AllCategories.checked = false;
}
function checkCategory()
{
        	
             // alert("Check category calling");
              var categories = 0;
              var i =document.alert.elements.length;
              
                var catflag="false";
		for (var i=0;i < document.alert.elements.length;i++)
		{
						     
			var e = document.alert.elements[i];
			if ((e.type == 'checkbox'))
			{  
				if(document.alert.elements[i].checked == true)
			         {
			            catflag="true";
			            break;
				 //   ++categories;
			         }
											
			}
					
		}
		if(catflag=="false")
 	        {
 	            //alert("Please select atleast one category");
 	            return false;
		}
		else
		{
		   return true;
		}
		
}



