function trim(s)
{
	while(''+s.charAt(s.length-1)==' ')
		{s=s.substring(0,s.length-1);}
	while(''+s.charAt(0)==' ')
		{s=s.substring(1,s.length)}
return s;
}

function isValidDate(optDay, optMonth, optYear){ 
    if (( optMonth == 4 || optMonth == 6 || optMonth == 9 || optMonth == 11) && optDay > 30 ){         
        return false; 
		}
     else if ( optMonth == 2 && optDay > 29 ) {        
        return false; 
		} 
    else if (optMonth == 2 && optYear % 4 > 0 && optDay > 28){         
        return false; 
		}
    else {
		return true;
    	}  		
}

function dorefreshmain() {
	opener.location.reload();
	window.close();
}

function checkform(){

	var temp;
	temp = trim(document.frmLogin.txtUserName.value);
	if (temp.length == 0){
		alert("Please enter your User id");
		document.frmLogin.txtUserName.focus();
		return false;
	}
	temp = document.frmLogin.txtPassword.value;
	if (temp.length == 0){
		alert("Please enter your password");
		document.frmLogin.txtPassword.focus();
		return false;
	}
	
	document.frmLogin.checkscript.value = "true";
//	document.frmLogin.submit();
	return true;
}

function checksearch(){
	var temp;
	temp = trim(document.frmPublicationList.searchtxt.value);
	if (temp.length == 0){
		alert("Please enter a search string");
		document.frmPublicationList.searchtxt.focus();
		return false;
	}
	document.frmPublicationList.submit();
}


//function checkupdate(num){
//	var temp
//	temp = trim(document.frmPublicationList.searchtxt.value);
  	//document.frmPublicationList.recordnum.value=num;
//	if (temp.length == 0){
//		alert("Please enter a search string")
//		document.frm_research_profile.searchtxt.focus();
//		return false;
//	}
//	document.frm_research_profile.submit();
//}


//function doUpdate(num,strYr)
 // {
 //   document.frmPublicationList.recordnum.value=num;
  //  var temp
  //  var str
    //var x
   // x = document.frmPublicationList;
   // str = x.pubyear'+num+'.value;
   // alert (strYr);
	//str = strYr;
    //temp = str;
   // alert (temp);
    //	document.frmPublicationList.recordnum.value=num;
//	if (isNaN(strYr) || parseInt(strYr)<=0 || strYr.length==0 ){
//		alert("Please enter a number for publication year");
//		//document.frmPublicationList.pubyear.focus();
//		return false;
//	}
//
  //  document.frmPublicationList.action = "obr_Publist_Update.asp";
  	
 //   document.frmPublicationList.submit();
 // }
     
function doUpdate(strYr)
  {
    //check for integer for year
	if (isNaN(strYr) || parseInt(strYr)<=0 || strYr.length==0 ){
		alert("Please enter a number for publication year");
		document.frmPublicationList.pubyear.focus();
		return false;
	}
    
    document.frmPublicationList.action = "obr_Publist_Update.asp";
    document.frmPublicationList.submit();
  }
 
function doDelete()
  {
    document.frmPublicationList.action = "obr_Publist_Delete.asp";
    document.frmPublicationList.submit();
  }
     
function doSearch()
  {
    document.frmPublicationList.action = "obr_PublicationSearch.asp";
    document.frmPublicationList.submit();
  }

     
function doList()
  {
    document.frmPublicationList.action = "obr_Publist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     
function ShowPubPage(pageno)
  {
    document.frmPublicationList.action = "obr_Publist_Summary.asp?Alllist=" + document.frmPublicationList.Alllist.value + "&pno=" + pageno;
    document.frmPublicationList.submit();
  }
     
function doOwnList()
  {
    document.frmPublicationList.action = "obr_Publist_Summary.asp?Alllist=Yes&ownlist=Yes";
    document.frmPublicationList.submit();
  }
     
function doSelectList()
  {
	var temp;
      if (( ! document.frmPublicationList.chkinst.checked) && (document.frmPublicationList.chkdept.checked)){
	alert("Please select institution");
	document.frmPublicationList.chkinst.focus();
	return false;
        }
      if (document.frmPublicationList.chkyr.checked){
	temp = trim(document.frmPublicationList.txtyr.value);
	if (isNaN(temp)){
		alert("Please enter digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (parseInt(temp) <= 0){
		alert("Please do not enter negative digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (temp.length != 4){
		alert("Please enter 4 digits year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
         }		

    document.frmPublicationList.action = "obr_Publist_Summary.asp";
    document.frmPublicationList.submit();

  }
     
function doEdit(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'PubSum';
//    document.frmPublicationList.action = "obr_Publist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + document.frmPublicationList.pubtotal.value;
    window.open("obr_Publist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + document.frmPublicationList.pubtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&pubid=" + eval('document.frmPublicationList.pub_id' + num + '.value')  
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
//    document.frmPublicationList.submit();
  }

function doView(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'PubSum';
//    document.frmPublicationList.action = "obr_Publist.asp?viewedit=view&recnum=" + num + "&totalrec=" + document.frmPublicationList.pubtotal.value;
    window.open("obr_Publist.asp?viewedit=view&recnum=" + num + "&totalrec=" + document.frmPublicationList.pubtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&pubid=" + eval('document.frmPublicationList.pub_id' + num + '.value') 
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
//    document.frmPublicationList.submit();
  }

function doNext()
  {
    if (opener.frmpagecheck.pagename.value == 'PubSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
	    	  document.frmPublicationList.action = "obr_Publist.asp?prenext=next&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.pubtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&pubid=" + eval('opener.frmPublicationList.pub_id' + (parseInt(document.frmPublicationList.recnum.value) + 1) + '.value');
	    	  document.frmPublicationList.submit();
		}
	}
  }

function doPrevious()
  {
    if (opener.frmpagecheck.pagename.value == 'PubSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Publist.asp?prenext=pre&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.pubtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&pubid=" + eval('opener.frmPublicationList.pub_id' + (parseInt(document.frmPublicationList.recnum.value) - 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doAddCheck(Actiontype)
  {
// changed from vbs to js

		var temp;
		aryid = new Array();
		aryrole = new Array();
		var obj1;
		var obj2;

		temp = trim(document.frmPublicationList.pubtitle.value);
		if (temp.length == 0){
			alert("Please enter publication title");
			document.frmPublicationList.pubtitle.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.pubyear.value);
		if (isNaN(temp)){
			alert("Please enter digits for publication year");
			document.frmPublicationList.pubyear.focus();
			return false;
    		}
		if (parseInt(temp) <= 0){
			alert("Please do not enter negative digits for publication year");
			document.frmPublicationList.pubyear.focus();
			return false;
    		}
		if (temp.length != 4){
			alert("Please enter 4 digits publication year");
			document.frmPublicationList.pubyear.focus();
			return false;
    		}
		
		temp = trim(document.frmPublicationList.JBtitle.value);
		if (temp.length == 0){
			alert("Please enter journal/book title");
			document.frmPublicationList.JBtitle.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.contributors.value);
		if (temp.length == 0){
			alert("Please enter contributors");
			document.frmPublicationList.contributors.focus();
			return false;
    		}

		aryrole[0] = " ";
		aryid[0] = " ";
		for (i = 1; i <= 7; i++) {
//			obj1 = "document.frmPublicationList.chk" + i
//			if (eval(obj1).checked) {
				obj1 = "document.frmPublicationList.rtype" + i;
				obj2 = "document.frmPublicationList.uid" + i;

				if ((eval(obj1).value != "") || (eval(obj2).value != "")) {
					if (eval(obj1).value == "") {
						alert("Please select the role for researcher - " + i);
						eval(obj1).focus();
						return false;
					}
					aryrole[i] = eval(obj1).value;
				
					if (eval(obj2).value == "") {
						alert("Please select the researcher for " + eval("document.frmPublicationList.rdesc" + eval(obj1).value).value + " role");
						eval(obj2).focus();
						return false;
					}
					aryid[i] = eval(obj2).value;
				}
//			}
		}

		for (i=0; i <= aryid.length; i++) {
			for(j = 0; j <= aryid.length; j++){ 
				if (i != j) {
					if (aryid[i] == aryid[j]) {
						alert("You can not assign multiple roles to the same researcher");
						return false;
					}
					if (aryrole[i] == aryrole[j]) {
						alert("You can not assign multiple researchers to the same role");
						return false;
					}
				} 
			}
		}
	if (Actiontype == 1) {
		document.frmPublicationList.action = "obr_Publist_Add.asp?action=list";
		}
	else if (Actiontype == 2) {
		document.frmPublicationList.action = "obr_Publist_Update.asp";
		}
	 document.frmPublicationList.submit();
  }


function doAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
	document.frmPublicationList.action="obr_Publist_Add.asp?action=list";		
		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		window.open("obr_Publist_Add.asp?action=add" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");		
//		document.frmPublicationList.action="obr_Publist_Add.asp?action=add";		
//	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Publist_Add.asp?action=add";		
	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }


function goConst()
  {
    document.frmPublicationList.action = "obrConstruct.asp";
    document.frmPublicationList.submit();
  }

///************ functions for Award


//function doAddAwardCheck()
//  {
//    var strYr
//    strYr = document.frmPublicationList.awardyear.value;
//    //check for integer for year
//    if (isNaN(strYr) || parseInt(strYr)<=0 || strYr.length==0 ){
//	alert("Please enter a number for award year");
//	document.frmPublicationList.awardyear.focus();
//	return false;
//    }
//    document.frmPublicationList.action = "obr_Awardlist_Add.asp?action=list";
//    document.frmPublicationList.submit();
//  }

function doAddAwardCheck(Actiontype)
  {
		var temp;
		var aryid = new Array();
		var aryrole = new Array();
		var obj1;
		var obj2;

		temp = trim(document.frmPublicationList.awardtitle.value);
		if (temp.length == 0){
			alert("Please enter award title");
			document.frmPublicationList.awardtitle.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.AwardInst.value);
		if (temp.length == 0){
			alert("Please enter awarding institution");
			document.frmPublicationList.AwardInst.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.awardyear.value);
		if (isNaN(temp)){
			alert("Please enter digits for award year");
			document.frmPublicationList.awardyear.focus();
			return false;
    		}
		if (parseInt(temp) <= 0){
			alert("Please do not enter negative digits for award year");
			document.frmPublicationList.awardyear.focus();
			return false;
    		}
		if (temp.length != 4){
			alert("Please enter 4 digits award year");
			document.frmPublicationList.awardyear.focus();
			return false;
    		}

		aryrole[0] = " ";
		aryid[0] = " ";
		for (i = 1; i <= 7; i++) {
//			obj1 = "document.frmPublicationList.chk" + i
//			if (eval(obj1).checked) {
				obj1 = "document.frmPublicationList.rtype" + i;
				obj2 = "document.frmPublicationList.uid" + i;

				if ((eval(obj1).value != "") || (eval(obj2).value != "")) {
					if (eval(obj1).value == "") {
						alert("Please select the role for researcher - " + i);
						eval(obj1).focus();
						return false;
					}
					aryrole[i] = eval(obj1).value;
				
					if (eval(obj2).value == "") {
						alert("Please select the researcher for " + eval("document.frmPublicationList.rdesc" + eval(obj1).value).value + " role");
						eval(obj2).focus();
						return false;
					}
					aryid[i] = eval(obj2).value;
				}
//			}
		}

		for (i=0; i <= aryid.length; i++) {
			for(j = 0; j <= aryid.length; j++){ 
				if (i != j) {
					if (aryid[i] == aryid[j]) {
						alert("You can not assign multiple roles to the same researcher");
						return false;
					}
//					if (aryrole[i] == aryrole[j]) {
//						alert("You can not assign multiple researchers to the same role");
//						return false;
//					}
				} 
			}
		}

	if (Actiontype == 1) {
		document.frmPublicationList.action = "obr_Awardlist_Add.asp?action=list";
		}
	else if (Actiontype == 2) {
		document.frmPublicationList.action = "obr_Awardlist_Update.asp";
		}
	document.frmPublicationList.submit();
  }


function doAwardAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
		document.frmPublicationList.action="obr_Awardlist_Add.asp?action=list";
		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		window.open("obr_Awardlist_Add.asp?action=add" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
	 	    //document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Awardlist_Add.asp?action=add";
	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }

//function doAwardUpdate(strYr)
//  {
//    //check for integer for year
//	if (isNaN(strYr) || parseInt(strYr)<=0 || strYr.length==0 ){
//		alert("Please enter a number for award year");
//		document.frmPublicationList.awardyear.focus();
//		return false;
//	}
//    
//    document.frmPublicationList.action = "obr_Awardlist_Update.asp";
//    document.frmPublicationList.submit();
//  }
 
function doAwardDelete()
  {
    document.frmPublicationList.action = "obr_Awardlist_Delete.asp";
    document.frmPublicationList.submit();
  }
     
function doAwardSearch()
  {
    document.frmPublicationList.action = "obr_awardsearch.asp";
    document.frmPublicationList.submit();
  }
     
function doAwardList()
  {
    document.frmPublicationList.action = "obr_Awardlist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     
function ShowAwdPage(pageno)
  {
    document.frmPublicationList.action = "obr_Awardlist_Summary.asp?Alllist=" + document.frmPublicationList.Alllist.value + "&pno=" + pageno;
    document.frmPublicationList.submit();
  }
     
function doAwardSelectList()
  {
	var temp;
      if (( ! document.frmPublicationList.chkinst.checked) && (document.frmPublicationList.chkdept.checked)){
	alert("Please select institution");
	document.frmPublicationList.chkinst.focus();
	return false;
        }
      if (document.frmPublicationList.chkyr.checked){
	temp = trim(document.frmPublicationList.txtyr.value);
	if (isNaN(temp)){
		alert("Please enter digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (parseInt(temp) <= 0){
		alert("Please do not enter negative digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (temp.length != 4){
		alert("Please enter 4 digits year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
         }		

    document.frmPublicationList.action = "obr_Awardlist_Summary.asp";
    document.frmPublicationList.submit();
  }
     
function doAwardEdit(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'AwdSum';
    window.open("obr_Awardlist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + document.frmPublicationList.awdtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&awdid=" + eval('document.frmPublicationList.award_id' + num + '.value') 
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
    //document.frmPublicationList.action = "obr_Awardlist.asp?viewedit=edit";
    //document.frmPublicationList.submit();
  }

function doAwardView(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'AwdSum';
    window.open("obr_Awardlist.asp?viewedit=view&recnum=" + num + "&totalrec=" + document.frmPublicationList.awdtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&awdid=" + eval('document.frmPublicationList.award_id' + num + '.value') 
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
    //document.frmPublicationList.action = "obr_Awardlist.asp?viewedit=view";
    //document.frmPublicationList.submit();
  }

function doAwdNext()
  {
    if (opener.frmpagecheck.pagename.value == 'AwdSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Awardlist.asp?prenext=next&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.awdtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&awdid=" + eval('opener.frmPublicationList.award_id' + (parseInt(document.frmPublicationList.recnum.value) + 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doAwdPrevious()
  {
    if (opener.frmpagecheck.pagename.value == 'AwdSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Awardlist.asp?prenext=pre&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.awdtotal.value + "&pno=" + document.frmPublicationList.pno.value + "&awdid=" + eval('opener.frmPublicationList.award_id' + (parseInt(document.frmPublicationList.recnum.value) - 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }



///************ functions for Patent


function doAddPatentCheck(Actiontype)
  {
		var temp;
		var temp1;
		aryid = new Array();
		aryrole = new Array();
		var obj1;
		var obj2;

		temp = trim(document.frmPublicationList.Patenttitle.value);
		if (temp.length == 0){
			alert("Please enter Patent title");
			document.frmPublicationList.Patenttitle.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.Country.value);
		if (temp.length == 0){
			alert("Please enter country");
			document.frmPublicationList.Country.focus();
			return false;
    		}

		if ((document.frmPublicationList.Pgranted(0).checked) && (document.frmPublicationList.Pgranteddateyy.value == "9999")){
         			alert("Please change patent granted date");
			document.frmPublicationList.Pgranteddatemm.focus();
			return false;
    		}

		if (Math.abs(document.frmPublicationList.Pgranteddateyy.value) < Math.abs(document.frmPublicationList.Pfileddateyy.value)){
			alert("Patent granted date cannot be less than filed date");
			document.frmPublicationList.Pgranteddatemm.focus();
			return false;
		}
		if (Math.abs(document.frmPublicationList.Pgranteddateyy.value) == Math.abs(document.frmPublicationList.Pfileddateyy.value)){
			if (Math.abs(document.frmPublicationList.Pgranteddatemm.value) < Math.abs(document.frmPublicationList.Pfileddatemm.value)){
				alert("Patent granted date cannot be less than filed date");
				document.frmPublicationList.Pgranteddatemm.focus();
				return false;
			}
		}

		aryrole[0] = " ";
		aryid[0] = " ";
		for (i = 1; i <= 7; i++) {
//			obj1 = "document.frmPublicationList.chk" + i
//			if (eval(obj1).checked) {
				obj1 = "document.frmPublicationList.rtype" + i;
				obj2 = "document.frmPublicationList.uid" + i;

				if ((eval(obj1).value != "") || (eval(obj2).value != "")) {
					if (eval(obj1).value == "") {
						alert("Please select the role for researcher - " + i);
						eval(obj1).focus();
						return false;
					}
					aryrole[i] = eval(obj1).value;
				
					if (eval(obj2).value == "") {
						alert("Please select the researcher for " + eval("document.frmPublicationList.rdesc" + eval(obj1).value).value + " role");
						eval(obj2).focus();
						return false;
					}
					aryid[i] = eval(obj2).value;
				}
//			}
		}

		for (i=0; i <= aryid.length; i++) {
			for(j = 0; j <= aryid.length; j++){ 
				if (i != j) {
					if (aryid[i] == aryid[j]) {
						alert("You can not assign multiple roles to the same researcher");
						return false;
					}
//					if (aryrole[i] == aryrole[j]) {
//						alert("You can not assign multiple researchers to the same role");
//						return false;
//					}
				} 
			}
		}

	if (Actiontype == 1) {
		document.frmPublicationList.action = "obr_Patentlist_Add.asp?action=list";
		}
	else if (Actiontype == 2) {
		document.frmPublicationList.action = "obr_Patentlist_Update.asp";
		}
	 document.frmPublicationList.submit();
  }


function doPatentSearch()
  {
    document.frmPublicationList.action = "obr_patentsearch.asp";
    document.frmPublicationList.submit();
  }
     
function doPatentList()
  {
    document.frmPublicationList.action = "obr_Patentlist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     
function ShowPatPage(pageno)
  {
    document.frmPublicationList.action = "obr_Patentlist_Summary.asp?Alllist=" + document.frmPublicationList.Alllist.value + "&pno=" + pageno;
    document.frmPublicationList.submit();
  }
     
function doPromptDate()
  {
    if (document.frmPublicationList.Pgranteddateyy.value == "9999"){
         alert("Please change patent granted date");
    }
  }
     
function doPatentSelectList()
  {
	var temp;
      if (document.frmPublicationList.userrole.value == "A"){
      	if (( ! document.frmPublicationList.chkinst.checked) && (document.frmPublicationList.chkdept.checked)){
		alert("Please select institution");
		document.frmPublicationList.chkinst.focus();
		return false;
        	}
        }
      if (document.frmPublicationList.chkyr.checked){
	temp = trim(document.frmPublicationList.txtyr.value);
	if (isNaN(temp)){
		alert("Please enter digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (parseInt(temp) <= 0){
		alert("Please do not enter negative digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (temp.length != 4){
		alert("Please enter 4 digits year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
         }		

    document.frmPublicationList.action = "obr_Patentlist_Summary.asp";
    document.frmPublicationList.submit();
  }
     

function doPatentEdit(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'PatSum';
//    document.frmPublicationList.action = "obr_Patentlist.asp";
    window.open("obr_Patentlist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + document.frmPublicationList.pattotal.value + "&pno=" + document.frmPublicationList.pno.value + "&patid=" + eval('document.frmPublicationList.patent_id' + num + '.value')
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
//    document.frmPublicationList.submit();
  }

function doPatNext()
  {
    if (opener.frmpagecheck.pagename.value == 'PatSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Patentlist.asp?prenext=next&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.pattotal.value + "&pno=" + document.frmPublicationList.pno.value + "&patid=" + eval('opener.frmPublicationList.patent_id' + (parseInt(document.frmPublicationList.recnum.value) + 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doPatPrevious()
  {
    if (opener.frmpagecheck.pagename.value == 'PatSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Patentlist.asp?prenext=pre&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.pattotal.value + "&pno=" + document.frmPublicationList.pno.value + "&patid=" + eval('opener.frmPublicationList.patent_id' + (parseInt(document.frmPublicationList.recnum.value) - 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doPatentAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
		document.frmPublicationList.action="obr_Patentlist_Add.asp?action=list";
		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		window.open("obr_Patentlist_Add.asp?action=add" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
//	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Patentlist_Add.asp?action=add";
	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }

function doPatentDelete()
  {
    document.frmPublicationList.action = "obr_Patentlist_Delete.asp";
    document.frmPublicationList.submit();
  }
     

///************ functions for Academic

function doAddAcademicCheck(Actiontype)
  {
		var temp;
		var temp1;
		aryid = new Array();
		aryrole = new Array();
		var obj1;
		var obj2;

		temp = trim(document.frmPublicationList.desc.value);
		if (temp.length == 0){
			alert("Please enter description");
			document.frmPublicationList.desc.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.academicYr.value);
		if (temp.length != 0){
			if (isNaN(temp)){
				alert("Please enter digits for year");
				document.frmPublicationList.academicYr.focus();
				return false;
    			}
			if (parseInt(temp) <= 0){
				alert("Please do not enter negative digits for year");
				document.frmPublicationList.academicYr.focus();
				return false;
	    		}
			if (temp.length != 4){
				alert("Please enter 4 digits year");
				document.frmPublicationList.academicYr.focus();
				return false;
    			}
		}
		//temp = trim(document.frmPublicationList.academicInst.value);
		//if (temp.length == 0){
		//	alert("Please enter institution");
		//	document.frmPublicationList.academicInst.focus();
		//	return false;
    		//}

		//temp = trim(document.frmPublicationList.Country.value);
		//if (temp.length == 0){
		//	alert("Please enter location");
		//	document.frmPublicationList.Country.focus();
		//	return false;
    		//}

	if (Actiontype == 1) {
		document.frmPublicationList.action = "obr_Academiclist_Add.asp?action=list";
		}
	else if (Actiontype == 2) {
		document.frmPublicationList.action = "obr_Academiclist_Update.asp";
		}
	 document.frmPublicationList.submit();
  }


function doAcademicSearch()
  {
    document.frmPublicationList.action = "obr_Academicsearch.asp";
    document.frmPublicationList.submit();
  }
     
function doAcademicList()
  {
    document.frmPublicationList.action = "obr_Academiclist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     
function doAcademicSelectList()
  {
	var temp;
      if (( ! document.frmPublicationList.chkinst.checked) && (document.frmPublicationList.chkdept.checked)){
	alert("Please select institution");
	document.frmPublicationList.chkinst.focus();
	return false;
        }
      if (document.frmPublicationList.chkyr.checked){
	temp = trim(document.frmPublicationList.txtyr.value);
	if (isNaN(temp)){
		alert("Please enter digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (parseInt(temp) <= 0){
		alert("Please do not enter negative digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (temp.length != 4){
		alert("Please enter 4 digits year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
         }		

    document.frmPublicationList.action = "obr_Academiclist_Summary.asp";
    document.frmPublicationList.submit();
  }
     
function doAcademicEdit(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'AcadSum';
    window.open("obr_Academiclist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + document.frmPublicationList.acadtotal.value + "&acadid=" + eval('document.frmPublicationList.academic_id' + num + '.value')
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
    //document.frmPublicationList.action = "obr_Academiclist.asp?viewedit=edit";
    //document.frmPublicationList.submit();
  }

function doAcademicView(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'AcadSum';
    window.open("obr_Academiclist.asp?viewedit=view&recnum=" + num + "&totalrec=" + document.frmPublicationList.acadtotal.value + "&acadid=" + eval('document.frmPublicationList.academic_id' + num + '.value')
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
    //document.frmPublicationList.action = "obr_Academiclist.asp?viewedit=view";
    //document.frmPublicationList.submit();
  }

function doAcadNext()
  {
    if (opener.frmpagecheck.pagename.value == 'AcadSum')
	{
	    document.frmPublicationList.action = "obr_Academiclist.asp?prenext=next&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.acadtotal.value + "&acadid=" + eval('opener.frmPublicationList.academic_id' + (parseInt(document.frmPublicationList.recnum.value) + 1) + '.value');
	    document.frmPublicationList.submit();
	}
  }

function doAcadPrevious()
  {
    if (opener.frmpagecheck.pagename.value == 'AcadSum')
	{
	    document.frmPublicationList.action = "obr_Academiclist.asp?prenext=pre&viewedit="+ document.frmPublicationList.viewedit.value +"&recnum=" + document.frmPublicationList.recnum.value + "&totalrec=" + document.frmPublicationList.acadtotal.value + "&acadid=" + eval('opener.frmPublicationList.academic_id' + (parseInt(document.frmPublicationList.recnum.value) - 1) + '.value');
	    document.frmPublicationList.submit();
	}
  }

function doAcademicAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
		document.frmPublicationList.action="obr_Academiclist_Add.asp?action=list";
		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		window.open("obr_Academiclist_Add.asp?action=add" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
		//document.frmPublicationList.action="obr_Academiclist_Add.asp?action=add";
	 	    //document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Academiclist_Add.asp?action=add";
	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }

function doAcademicDelete()
  {
    document.frmPublicationList.action = "obr_Academiclist_Delete.asp";
    document.frmPublicationList.submit();
  }
     

///************ functions for Project


function doAddProjectCheck(Actiontype)
  {
		var temp;
		var temp1;
		aryid = new Array();
		aryrole = new Array();
		var obj1;
		var obj2;

		temp = trim(document.frmPublicationList.title.value);
		if (temp.length == 0){
			alert("Please enter title");
			document.frmPublicationList.title.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.agency1.value);
		if (temp.length == 0){
			alert("Please enter funding agency 1");
			document.frmPublicationList.agency1.focus();
			return false;
    		}

		if (trim(document.frmPublicationList.agency1.value) == "9999" && trim(document.frmPublicationList.pharma1.value) == ""){
			alert("Please enter company's name 1");
			document.frmPublicationList.pharma1.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.amount1.value);
		if ((isNaN(temp) || parseInt(temp) <= 0) && temp.length != 0 ){
			alert("Please enter digits for funding amount 1");
			document.frmPublicationList.amount1.focus();
			return false;
    		}
		
		if (trim(document.frmPublicationList.agency2.value) == "9999" && trim(document.frmPublicationList.pharma2.value) == ""){
			alert("Please enter company's name 2");
			document.frmPublicationList.pharma2.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.amount2.value);
		if ((isNaN(temp) || parseInt(temp) <= 0) && temp.length != 0 ){
			alert("Please enter digits for funding amount 2");
			document.frmPublicationList.amount2.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.sdatemm.value);
		temp1 = trim(document.frmPublicationList.sdateyy.value);
		if (temp1.length != 0 && temp.length == 0){
			alert("Please enter month of start date");
			document.frmPublicationList.sdatemm.focus();
			return false;
    		}
		if (temp.length != 0 && temp1.length == 0){
			alert("Please enter year of start date");
			document.frmPublicationList.sdateyy.focus();
			return false;
    		}

		temp = trim(document.frmPublicationList.edatemm.value);
		temp1 = trim(document.frmPublicationList.edateyy.value);
		if (temp1.length != 0 && temp.length == 0){
			alert("Please enter month of end date");
			document.frmPublicationList.edatemm.focus();
			return false;
    		}
		if (temp.length != 0 && temp1.length == 0){
			alert("Please enter year of end date");
			document.frmPublicationList.edateyy.focus();
			return false;
    		}

		aryrole[0] = " ";
		aryid[0] = " ";
		for (i = 1; i <= 7; i++) {
//			obj1 = "document.frmPublicationList.chk" + i
//			if (eval(obj1).checked) {
				obj1 = "document.frmPublicationList.rtype" + i;
				obj2 = "document.frmPublicationList.uid" + i;

				if ((eval(obj1).value != "") || (eval(obj2).value != "")) {
					if (eval(obj1).value == "") {
						alert("Please select the role for researcher - " + i);
						eval(obj1).focus();
						return false;
					}
					aryrole[i] = eval(obj1).value;
				
					if (eval(obj2).value == "") {
						alert("Please select the researcher for " + eval("document.frmPublicationList.rdesc" + eval(obj1).value).value + " role");
						eval(obj2).focus();
						return false;
					}
					aryid[i] = eval(obj2).value;
				}
//			}
		}

		for (i=0; i <= aryid.length; i++) {
			for(j = 0; j <= aryid.length; j++){ 
				if (i != j) {
					if (aryid[i] == aryid[j]) {
						alert("You can not assign multiple roles to the same researcher");
						return false;
					}
//					if (aryrole[i] == aryrole[j]) {
//						alert("You can not assign multiple researchers to the same role");
//						return false;
//					}
				} 
			}
		}

		
	if (Actiontype == 1) {
		document.frmPublicationList.action = "obr_Projectlist_Add.asp?action=list";
		}
	else if (Actiontype == 2) {
		document.frmPublicationList.action = "obr_Projectlist_Update.asp";
		}
	 document.frmPublicationList.submit();
  }

function doProjectSearch()
  {
    document.frmPublicationList.action = "obr_Projectsearch.asp";
    document.frmPublicationList.submit();
  }
     
function doProjectList()
  {
    document.frmPublicationList.action = "obr_Projectlist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     
function ShowProPage(pageno)
  {
    document.frmPublicationList.action = "obr_Projectlist_Summary.asp?Alllist=" + document.frmPublicationList.Alllist.value + "&pno=" + pageno;
    document.frmPublicationList.submit();
  }
     
function doProjectSelectList()
  {
	var temp;
      if (document.frmPublicationList.userrole.value == "A"){
      	if (( ! document.frmPublicationList.chkinst.checked) && (document.frmPublicationList.chkdept.checked)){
		alert("Please select institution");
		document.frmPublicationList.chkinst.focus();
		return false;
        	}
        }
      if (document.frmPublicationList.chkyr.checked){
	temp = trim(document.frmPublicationList.txtyr.value);
	if (isNaN(temp)){
		alert("Please enter digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (parseInt(temp) <= 0){
		alert("Please do not enter negative digits for year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
	if (temp.length != 4){
		alert("Please enter 4 digits year");
		document.frmPublicationList.txtyr.focus();
		return false;
	}
         }		

    document.frmPublicationList.action = "obr_Projectlist_Summary.asp";
    document.frmPublicationList.submit();
  }
     

function doProjectEdit(num,totrec,ptype)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmpagecheck.pagename.value = 'ProSum';
    //document.frmPublicationList.action = "obr_Projectlist.asp";
    window.open("obr_Projectlist.asp?viewedit=edit&recnum=" + num + "&totalrec=" + eval('document.frmPublicationList.' + ptype + 'prototal.value') + "&ptype=" + ptype + "&pno=" + document.frmPublicationList.pno.value + "&proid=" + eval('document.frmPublicationList.' + ptype + 'project_id' + num + '.value')
    	          ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
    //document.frmPublicationList.submit();
  }

function doProNext(num,totrec,ptype)
  {
    if (opener.frmpagecheck.pagename.value == 'ProSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Projectlist.asp?prenext=next&recnum=" + num + "&totalrec=" + totrec + "&ptype=" + ptype + "&pno=" + document.frmPublicationList.pno.value + "&proid=" + eval('opener.frmPublicationList.' + ptype + 'project_id' + (parseInt(document.frmPublicationList.recnum.value) + 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doProPrevious(num,totrec,ptype)
  {
    if (opener.frmpagecheck.pagename.value == 'ProSum')
	{
	    if (opener.frmPublicationList.pno.value == document.frmPublicationList.pno.value)
		{
		    document.frmPublicationList.action = "obr_Projectlist.asp?prenext=pre&recnum=" + num + "&totalrec=" + totrec + "&ptype=" + ptype + "&pno=" + document.frmPublicationList.pno.value + "&proid=" + eval('opener.frmPublicationList.' + ptype + 'project_id' + (parseInt(document.frmPublicationList.recnum.value) - 1) + '.value');
		    document.frmPublicationList.submit();
		}
	}
  }

function doProjectAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
		document.frmPublicationList.action="obr_Projectlist_Add.asp?action=list";
		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		window.open("obr_Projectlist_Add.asp?action=add&ptype=" +  document.frmPublicationList.ptype.value
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
		    //document.frmPublicationList.action="obr_Projectlist_Add.asp?action=add";
	 	    //document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 3 : {
		window.open("obr_Projectlist_Add.asp?action=add&ptype=R" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
	 	    //document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 4 : {
		window.open("obr_Projectlist_Add.asp?action=add&ptype=C" 
    		                  ,"subwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");	
	 	    //document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Projectlist_Add.asp?action=add";
	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }

function doProjectDelete()
  {
    document.frmPublicationList.action = "obr_Projectlist_Delete.asp";
    document.frmPublicationList.submit();
  }
     
function doEnablefield(incode){
	switch (incode){
		case 3 : {
			if (trim(document.frmPublicationList.agency1.value) != ""){
				document.frmPublicationList.amount1.disabled = false;
				}
			else{
				document.frmPublicationList.amount1.value = "";
				document.frmPublicationList.amount1.disabled = true;
			}
			if (trim(document.frmPublicationList.agency1.value) == "9999"){
				document.frmPublicationList.pharma1.disabled = false;
				}
			else{
				document.frmPublicationList.pharma1.value = "";
				document.frmPublicationList.pharma1.disabled = true;
			}
			break
		}
		case 4 : {
			if (trim(document.frmPublicationList.agency2.value) != ""){
				document.frmPublicationList.amount2.disabled = false;
				}
			else{
				document.frmPublicationList.amount2.value = "";
				document.frmPublicationList.amount2.disabled = true;
			}
			if (trim(document.frmPublicationList.agency2.value) == "9999"){
				document.frmPublicationList.pharma2.disabled = false;
				}
			else{
				document.frmPublicationList.pharma2.value = "";
				document.frmPublicationList.pharma2.disabled = true;
			}
			break
		}
	}
}

///************ functions for Clinical trial


function doClinicalSearch()
  {
    document.frmPublicationList.action = "obr_Clinicalsearch.asp";
    document.frmPublicationList.submit();
  }
     
function doClinicalList()
  {
    document.frmPublicationList.action = "obr_Clinicallist_Summary.asp?Alllist=Yes";
    document.frmPublicationList.submit();
  }
     

function doClinicalEdit(num)
  {
    document.frmPublicationList.recordnum.value=num;
    document.frmPublicationList.action = "obr_Clinicallist.asp";
//    document.frmPublicationList.submit();
  }

function doClinicalAdd(choice)
  {
     switch (choice)
     {	
	case 1 : {  
		document.frmPublicationList.action="obr_Clinicallist_Add.asp?action=list";
//		    document.frmPublicationList.submit(); 
		    break; 
		 }
     	case 2 : {
		document.frmPublicationList.action="obr_Clinicallist_Add.asp?action=add";
//	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
	default: {  
		document.frmPublicationList.action="obr_Clinicallist_Add.asp?action=add";
//	 	    document.frmPublicationList.submit(); 
		    break; 
		 }
      }
  }

function doClinicalDelete()
  {
    document.frmPublicationList.action = "obr_Clinicallist_Delete.asp";
    document.frmPublicationList.submit();
  }
     
///  ************ Profile

function doProfileEdit()
  {
    document.frmPublicationList.guserid.value = document.frmPublicationList.cboguserid.value;
    document.frmPublicationList.action = "obr_RProfile.asp?viewedit=edit";
    document.frmPublicationList.submit();
  }

function doOwnProfileEdit()
  {
    document.frmPublicationList.guserid.value = document.frmPublicationList.ownid.value;
    document.frmPublicationList.action = "obr_RProfile.asp?viewedit=edit";
    document.frmPublicationList.submit();
  }

function doProfileView()
  {
    document.frmPublicationList.guserid.value = document.frmPublicationList.cboguserid.value;
    document.frmPublicationList.action = "obr_RProfile.asp?viewedit=view";
    document.frmPublicationList.submit();
  }

function doProView(gid)
  {
    document.frmPublicationList.guserid.value=gid;
    document.frmPublicationList.action = "obr_RProfile.asp?viewedit=view";
    document.frmPublicationList.submit();
  }

function GotoProfilesearch()
  {
    document.frmPublicationList.action = "obr_RProfile_search.asp";
    document.frmPublicationList.submit();
  }

function doProfileSearch()
  {
    document.frmPublicationList.action = "obr_RProfile_summary.asp";
    document.frmPublicationList.submit();
  }

function doSubmit()
  {
    document.frmPublicationList.action = "obr_RProfile.asp?action=Open";
    document.frmPublicationList.submit();
  }

function doProfileDetail(Evno,Uid)
  {
    if (Evno == 1)
       {document.frmPublicationList.action = 'obr_RProfile.asp?viewedit=edit'; }
    else
       {document.frmPublicationList.action = 'obr_RProfile.asp?viewedit=view'; }
    
    document.frmPublicationList.guserid.value = Uid;
    document.frmPublicationList.submit();
  }

function doChangeToEdit()
  {
    document.frmPublicationList.action = 'obr_RProfile.asp?viewedit=edit'; 
    document.frmPublicationList.submit();
  }

function doChangeToView()
  {
    document.frmPublicationList.action = 'obr_RProfile.asp?viewedit=view'; 
    document.frmPublicationList.submit();
  }

function doProfileUpdate(){
	var temp;

	temp = trim(document.frmPublicationList.Fname.value);
	if (temp.length == 0){
		alert("Please enter full name");
		document.frmPublicationList.Fname.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Sname.value);
	if (temp.length == 0){
		alert("Please select salutation");
		document.frmPublicationList.Sname.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Pappt.value);
	if (temp.length == 0){
		alert("Please enter present appointment");
		document.frmPublicationList.Pappt.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Institution.value);
	if (temp.length == 0){
		alert("Please select institution");
		document.frmPublicationList.Institution.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Dept.value);
	if (temp.length == 0){
		alert("Please select department");
		document.frmPublicationList.Dept.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Specialities.value);
	if (temp.length == 0){
		alert("Please select specialities");
		document.frmPublicationList.Specialities.focus();
		return false;
   	}

	if (document.frmPublicationList.Cappt(0).checked) {
		temp = trim(document.frmPublicationList.Nusdept.value);
		if (temp.length == 0){
			alert("Please select NUS's department");
			document.frmPublicationList.Nusdept.focus();
			return false;
   		}
	}

	temp = trim(document.frmPublicationList.Ophone.value);
	if (temp.length == 0){
		alert("Please enter office telephone");
		document.frmPublicationList.Ophone.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Pemail.value);
	if (temp.length == 0){
		alert("Please enter preferred email");
		document.frmPublicationList.Pemail.focus();
		return false;
   	}

	temp = trim(document.frmPublicationList.Area.value);
	if (temp.length == 0){
		alert("Please enter area of active research");
		document.frmPublicationList.Area.focus();
		return false;
   	}

    	document.frmPublicationList.action = "obr_RProfile.asp?action=Update";
    	document.frmPublicationList.submit();
  }


