	$(function() {
			$("#tabs").tabs({ spinner: 'Retrieving data... ',
			cache: true
			 });
	});
	

	$(function(){
	$.superbox();
});




function validate_menu_form(thisform)
{
with (thisform)
  {
  	
  if (validate_required(search,"Search Box is Empty")==false)
  {
  	
	  thisform.search.focus();return false;
  }
 
  }
 
}

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value==""||value=="Search MouseBook"|| value=="Enter Search Term")
    {
    return false;
    }
  else
    {
   	
   	document.forms['menuform'].submit();
    }
  }
}



function validateadvancedform(thisform)
{


	if (thisform.genesearch.value=="" && thisform.identifier.value=="" && thisform.chr.value=="none" && thisform.mutation_type.value=="none" && thisform.strain_type.value=="none"  && thisform.searchpheno.value==""){
	
		return false;
	}
	else{
		return true;	
	}
}

function updateinfo(parentId)
{
var ajaxObjectArray6 = new Array();
var ajaxRequestFile = 'writeNodes.php';
ajaxObjectArray6[ajaxObjectArray6.length] = new sack();
var ajaxIndex = ajaxObjectArray6.length-1;
ajaxObjectArray6[ajaxIndex].requestFile = ajaxRequestFile + '?parentId7=' + parentId;
ajaxObjectArray6[ajaxIndex].onCompletion = function() { 
document.getElementById('contentarea2').innerHTML = ajaxObjectArray6[ajaxIndex].response;
ajaxObjectArray6[ajaxIndex] = false;
 };	// Specify function that will be executed after file has been found					
ajaxObjectArray6[ajaxIndex].runAJAX();		// Execute AJAX function
return;
}	

function toggleDiv(divid){
    if(document.getElementById(divid).style.display == "none"){
      document.getElementById(divid).style.display = "block";
    }else{
      document.getElementById(divid).style.display = "none";
    }
  }
  
  
            /*
             * Fill the contact persons details with the scientists when chosen 'as above'.
             */
            function contactAsAbove (form) {

                var person = new Array ('title','firstname','surname','e_mail','phone','fax');
                var shipping = new Array ('ship_title','ship_firstname','ship_surname','ship_e_mail','ship_phone','ship_fax');
      

                if ( form.con_as_above.checked == true ) {
                    for (var i = 0; i < person.length; i++) {
                    
                        form.elements[shipping[i]].value = form.elements[person[i]].value;
                        
                        
                    }
                }
                
                
            }
            
   
   function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}


   function validate_required2(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

         
 function validate_form(thisform) {



with (thisform)
  {
  	  if (validate_required2(firstname,"First Name must be filled out.")==false)
  {firstname.focus();return false;} 
    
     if (validate_required2(surname,"Last Name must be filled out.")==false)
  {surname.focus();return false;} 
  
  if (validate_required2(e_mail,"Email Address must be filled out.")==false)
  {e_mail.focus();return false;}

  if (validate_email(e_mail,"Not a valid Email address.")==false)
    {e_mail.focus();return false;}
    
      if (validate_required2(phone,"Office Phone must be filled out.")==false)
  {phone.focus();return false;}  
 
     if (validate_required2(ship_firstname,"Shipping First Name must be filled out.")==false)
  {ship_firstname.focus();return false;} 
    
     if (validate_required2(ship_surname,"Shipping Last Name must be filled out.")==false)
  {ship_surname.focus();return false;} 
    
  
  
  if (validate_required2(ship_e_mail,"Shipping Email Address must be filled out.")==false)
  {ship_e_mail.focus();return false;}

  if (validate_email(ship_e_mail,"Not a valid Shipping Email address.")==false)
    {ship_e_mail.focus();return false;}
    
  
    if (validate_required2(ship_phone,"Shipping Office Phone must be filled out.")==false)
  {ship_phone.focus();return false;}  
    
     if (validate_required2(institution,"Company / Affiliation must be filled out.")==false)
  {institution.focus();return false;}  
    
       if (validate_required2(addr,"Address must be filled out.")==false)
  {addr.focus();return false;}  
  
  }



}            
            
