function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

function gotoURL(oSelRef)
{
	if (oSelRef.selectedIndex > 0)
	{
		oWin = window.open(oSelRef.options[oSelRef.selectedIndex].value,"oWin","location=1,toolbar=1,scrollbars=1,status=1,resizable=1",menubar="1",directories="1");
		oWin.focus();
		oSelRef.selectedIndex = 0;
	}
}

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function manageTab(id) {
   var theIE;
   var theTab;
   if (document.getElementById) {
      theIE = document.getElementById(id);
   } else if (document.all) {
      theIE = eval(id);
   }
   if (!theIE) return;
	if (theIE.style.display.indexOf("none") >=0){
		theIE.style.display = "";
	}
    else if (theIE.style.display == ""){
		theIE.style.display = "none";
	}
}

function closeTab(id) {
   var theIE;
   var theTab;
   if (document.getElementById) {
      theIE = document.getElementById(id);
   } else if (document.all) {
      theIE = eval(id);
   }
   if (!theIE) return;
	theIE.style.display = "none";
}



function displayTable(val){
 //alert(val);
 if(val=="all"){
	 for(var i=0;i<100;i++){
		 manageTab(i)
	 }
 } else {
	 for(var i=0;i<100;i++){
		closeTab(i);
	 }
	 manageTab(val)
 }
}

function checkContactForm(){
 var email=document.forms['contactForm']["emailAddress"].value;
  var name=document.forms['contactForm']["name"].value;
  var  message = "Please enter:\n";
  var pass= true;
  if(name==""){
 	 pass = false;
	 message+=" - your name\n";
  }
  if(email==""){
 	 pass = false;
	 message+=" - your email\n";
  }
 if(email!=""){
	  if(!validate(email)){
		 pass = false;
		 message+=" - a correct email\n";
	  }
  }
  if(pass){
  	return true;
  }
  else{
   alert(message);
  	return false;
  }
}

function validate(email){
if ((email.indexOf('@',0)==-1) || (email.indexOf('.',0)==-1)) {
	return false;
}
  else {
    return true;
  }
}

