if(navigator.appName == "Netscape"){
					document.write('<link rel="stylesheet" href="css/nsportal.css" type="text/css">');
				}
				else{
					document.write('<link rel="stylesheet" href="css/ieportal.css" type="text/css">');
				}

function newWindow() {
		passWindow = window.open("pages/ForgotPassword.jsp", "passWin", "width=500,height=150")
	}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function set(target) 
{
document.forms[0].dispatch.value=target;
}

function submit() 
{
document.forms[0].submit();
}

function selectAll(list)
{
	for(i=0;i<list.length;i++)
	{
      list.options[i].selected=true;
	}
	return list;
}

function moveAll(list1,list2)
{
	add(selectAll(list1),list2)
	
}

function deSelectAll(list)
{
	for(i=0;i<list.length;i++)
	{
      list.options[i].selected=false;
	}
	return list;
}


function add(list1,list2)
{
var i=0;
var j=0;
for(i=0;i<list2.length;i++)
{
      list2.options[i].selected=false;
}
for(i=0;i<list1.length;i++)
{
  if(list1.options[i].selected==true)
   {
      var len=list2.length;
	list2.options[len]=new Option();
	list2.options[len].text=list1.options[i].text;
	list2.options[len].value=list1.options[i].value;    
	list1.remove(i);
	i=i-1;
   }
  }
}

function getFile(url)
{
//	var popit = window.open(url,'DisplayWindow1','status,scrollbars,resizable,menubar,width=400,height=400');
   window.location = url;
   return 1;
}


function setDisabled(field,bool)
{
	field.disabled=bool;
}


function send(pageNum,numresultsPerPage,prevPage,pageName) 
{
	document.forms[0].action = pageName+'?pageNum='+pageNum+'&numResult='+numresultsPerPage+'&prevpage='+prevPage;
	document.forms[0].submit();

}

function setValue(param,val) 
{
	param.value = val;
	document.forms[0].submit();
}


function zoom(x,y) 
{
        document.forms[0].zoomFactor.value = x;
        document.forms[0].zoomType.value = y;
        if(y==2)
           document.forms[0].buttonClicked.value = "zoomOut";
        if(y==1)
           document.forms[0].buttonClicked.value = "zoomIn";   
        document.forms[0].submit();
}


function setMoveFactor(x) 
{
        document.forms[0].moveFactor.value = x;
        document.forms[0].submit();
}

 function moveUp(list)
 {
	      flag=1;
	       for(var i=1 ; i< list.length;i++)
		if(list.options(i).selected==true)
		    swap(i,i-1,list);

 }

function moveDown(list)
{
        flag=1;
        for(var i=list.length-2 ; i >= 0;i--)
	if(list.options(i).selected==true)
        swap(i,i+1,list);
}






function swap(i,j,lists)
{
	var status = lists.options(i).isSelected;
	var txt = lists.options(i).text;
	var val = lists.options(i).value;
		lists.options(i).text = lists.options(j).text;
	lists.options(i).value = lists.options(j).value;
		lists.options(j).text = txt;
	lists.options(j).value = val;
	    lists.options(j).selected=true;
	lists.options(i).selected=status;
}

function pop_smallwindow(url) {
  
  var popit = window.open(url,'DisplayWindow2','status,scrollbars,resizable,width=840,height=480');
}

function pop_window(url) {
  var popit = window.open(url);
            
}


//20061012Snehal Added
//Function make sure that, user can not deselect the start species
//Add all elements from list1 to list2, except startSpecies
function moveAllWithConstraint(list1,list2)
{
	if(document==null) {
		alert("Null Document");
		return;
	}
	
	var startSpecies=document.getElementById("startOrganismId");
	if(startSpecies==null) {
		alert("START Species null");
		return;
	}
	if(list1==null||list2==null) {
		alert(list1+"::"+list2);
	}
	
	//If entity and attribute not present return.
	if(startSpecies==null || startSpecies.value==null) {
		return;
	}
	
	//Select all the elements except startSpecies
	for(i=0;i<list1.length;i++)
	{
		if(list1.options[i].value==startSpecies.value) {
			list1.options[i].selected=false;
		} else {
			list1.options[i].selected=true;
	    }
	}//end for loop
	add(list1,list2);
}

//20061012Snehal Added
//Function make sure that, user can not deselect the start species
//Add selected elements from list1 to list2
function addWithConstraint(list1,list2)
{
	var i=0;
	var j=0;
	var startSpecies = document.getElementById("startOrganismId");

	//If entity and/ attribute not present return.
	if(startSpecies == null || startSpecies.value == null) {
		return;
	}

	//Make sure that startSpecies is not selected for move
	for(i=0;i<list1.length;i++)
	{
	  if(list1.options[i].selected==true 
	  			&& list1.options[i].value==startSpecies.value)
	  {
	  	alert("Start Species can not be deselected");
	  	return;
	  }
	}//end for loop
	
	for(i=0;i<list2.length;i++)
	{
	      list2.options[i].selected=false;
	}//end for loop
		
	for(i=0;i<list1.length;i++)
	{
	  if(list1.options[i].selected==true)
	   {
	      var len=list2.length;
		list2.options[len]=new Option();
		list2.options[len].text=list1.options[i].text;
		list2.options[len].value=list1.options[i].value;    
		list1.remove(i);
		i=i-1;
	   }
    }//end for loop
}

//20061012Snehal Added
//While changing the startSpecies for the search operation
//make sure that selcted box contains the startSpcies, if not
//then move startSpecies from available box to selected box.
function startSpeciesChanged(list1, list2) {
	var startSpecies = document.getElementById("startOrganismId");

	//If entity and/ attribute not present return.
	if(startSpecies == null || startSpecies.value == null) {
		return;
	}
	
	//Check whether startSpeices is present in the selected
	//Species box or not.
	var startSpeciesExist = false;
	for (i=0; i<list2.length; i++)
	{
	  if(list2.options[i].value == startSpecies.value)
	  {
	  	startSpeciesExist = true;
	  	break;
	  }
	}//end for loop
	
	if(startSpeciesExist) {
		return;
	}
	
	//Move start species from list1 to list2
	for(i=0; i<list1.length; i++)
	{
	  if(list1.options[i].value == startSpecies.value) {
	  	list1.options[i].selected = true;
	  } else {
	  	list1.options[i].selected = false;
	  }
	}//end for loop
	add(list1,list2);
}

//20070320Snehal Added
//Update the status bar using title attribute of the given element
function updateWindowStatus(element)
{
	var msg='';
	if (element != null)
	{
		var title = element.getAttribute("title");
		if (title != null)
		{
			msg = title;
		}
	}
	window.status=msg;
}