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) 
{
	///20070424Snehal
	//Updated: if pageName is not set  then call the custom
	//javascript method defined in local jsp page
	//:Reason: It is possible to execute customized set of
	//actions through local method instead of default
	if (pageName == null || pageName == "")
	{
		customizedNavigation(pageNum,numresultsPerPage,prevPage);
		return;
	}
	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)
		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)
	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;
	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);
}

//20061123Snehal Added
//Check whether user has deselected both option
//Site conserved across and minSpecies required
//If both option have been deselected then display
//message that all sites will be selected
function checkAllSites()
{
	var conservedSites = document.getElementById("conservedSpeciesId");
	
	if (conservedSites == null)
	{
		//alert("Error: Conserved across species option not found");
		return;
	}
	
	var minSpecies = document.getElementById("minSpeciesReqdId");
	if (minSpecies == null)
	{
		//alert("Error: Min Species option not found");
		return;
	}
	
	var allSitesConserved = document.getElementById("allSitesConservedId");
	if (allSitesConserved == null)
	{
		//alert("Error: All Sites container not found");
		return;
	}

	//Both option selected then display message that
	//all sites will be considered
	if (conservedSites.checked == false
			&& minSpecies.checked == false)
	{
		allSitesConserved.style.display="block";
	}
	else
	{
		allSitesConserved.style.display="none";
	}
			
}


//Check that from given list atleast one element is selected
//if not selected then it will selects the first element in
//the list.
function selectElement(elementList)
{
	//Make sure that argument is selection list
	if (elementList == null
		|| elementList.length == null
		|| elementList.length == 0)
	{
		return;
	}
	
	var isElementSelected = false;
	for(var i = 0; i < elementList.length; i++)
	{
		if (elementList.options[i].selected == true)
		{
			isElementSelected = true;
			break;
		}
	}//end for loop
	
	//If not a single element selected then select the first
	if (!isElementSelected)
	{
		elementList.options[0].selected = true;
	}
}

//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;
}

//20070322Snehal Added
//In firefox when button is disabled text does not grayed
//out (when using css class for button that includes color
//attribute):
//Following function changes the text-color of the
//given element to grayed out (similiar to disabled element)
//only if the element supports the disabled property and which
//is set to true.
function disableElement(element)
{
	if (element != null
			&& element.disabled != null
			&& element.disabled == true)
	{
		element.style.color="#aca899";
		element.style.backgroundColor="#D9D99F";
	}		
}

//20070323Snehal Added
//Update the minSpecies selection list:
//1. If minSpecies check-box is checked
//2. Updation take place on conserved in species
//list or minSpecies selection changes
//================Arguments=================
//conservedSpeciesList --> Conserved Species list
//minSpeciesList --> Required Species list
//displayMsg --> Boolean flag indicates whether to display alert
//message incase required species are less than conservedSpecies.
function updateMinSpecies(conservedSpeciesList, minSpeciesList, displayMsg)
{
	if (conservedSpeciesList == null || minSpeciesList == null)
	{
		return;
	}
	
	//Check whether conservedSpecies checkbox is present
	var conservedSites = document.getElementById("conservedSpeciesId");
	if (conservedSites == null)
	{
		return;
	}

	//Check whether minSpecies checkbox is present
	var minSpecies = document.getElementById("minSpeciesReqdId");
	if (minSpecies == null)
	{
		return;
	}
	
	//Makes sure that MinSpecies & Conserved species
	//checkboxes are checked
	if (minSpecies.checked == false || conservedSites.checked == false)
	{
		return;
	}
	
	//Check whether minSpecies are greater than or equal to
	//number of species in the coservedSpecies list
	if (minSpeciesList.value < conservedSpeciesList.length)
	{
		//Display alert only if flag is set.
		if (displayMsg)
		{
			alert("Species count must be greater than or equal to conserved"
				+ " species in \"Selected\" box");
		}
		//Update the minSpecies 
		//Iterate the minSpecies list
		for(var i = 0; i < minSpeciesList.length; i++)
		{
			if (minSpeciesList.options[i].value
					== conservedSpeciesList.length)
			{
				minSpeciesList.options[i].selected = true;
			}
			else
			{
				minSpeciesList.options[i].selected = false;
			}
		}//end for loop
	}//end  if
}