// css dropdown menu effect for IE
sfHover = function() {
	var sfEls = document.getElementById("container").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// open page in the new window
var myTWin = window.myTWin;

function OpenMyWin(link) {
   link.target = '_MyWin';
   if (myTWin != null && !myTWin.closed){
     myTWin.focus();
     myTWin.location.href = link.href;
   }
   else {
     myTWin = window.open(link.href,'_MyWin');
     if (myTWin != null)
     myTWin.focus();
   }
return myTWin;
}

// NTAS/PTAS evaluation download form checking
function isEmail(str) {return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);}

function formcheck(form) {
  errors=false;
  success=true;
  errormsg="Please correct the following error(s):\n";

  if(form.realname.value == "") {errors=true; errormsg+="Full Name is missing.\n";}
	if(!isEmail(form.email.value)) {errors=true; errormsg+="Email address is missing or email address is invalid.\n";}
	if(form.company.value == "") {errors=true; errormsg+="Company Name is missing.\n";}
	if(form.address.value == "") {errors=true; errormsg+="Address is missing.\n";}
	if(form.tel.value == "") {errors=true; errormsg+="Telephone No. is missing.\n";}
	if(errors){
	  	alert(errormsg);
	  	success=false;
	}
	else form.submit();
}

// expand or collapse block element
var lastClick = null;

function togle(e,forceOn) {
	if (e && (e=e.style)) e.display = forceOn===undefined ? (e.display == 'none' ? '' : 'none') : forceOn ? '' : 'none';
}

function clk(e) {
	e = e.nextSibling.nextSibling;
	togle(e);
	if (lastClick && lastClick!=e) {
		var n = lastClick, ep = e.parentNode.parentNode;
		do {
			if (n == ep) break;
			n.style.display = 'none';
		} while ((n=n.parentNode.parentNode) && n.className != 'topUL');
	}
	lastClick=e;
}

// image rotation
var time=15000 /* milliseconds */, rotator=0, pref='../../img/intro/', img=['intro3.gif','intro1.gif','intro2.gif'], tmp;
for (var i in img) {
	(tmp=new Image()).src=pref+img[i];
	img[i]=tmp;
}
function rotate() {
	document.getElementById('pic').src = img[++rotator==img.length ? rotator=0 : rotator].src;
	setTimeout('rotate()',time);
}

// conferences tabs calendar
var prevTab=0; prevLi=0;

function tab(e) {
	if (e && e.parentNode) {
		if (prevLi) prevLi.className = '';
		(prevLi = e.parentNode).className = 'activ';
		e=e.innerHTML;
	}
	if (e && (e=document.getElementById(e.toLowerCase())) && prevTab!=e) {
		togle(prevTab,0);
		togle(prevTab=e,1);
	}
}

// Brand new
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
	x = navigator.plugins["Shockwave Flash"];
	if (x)
	{
		flashinstalled = 2;
		if (x.description)
		{
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	}
	else
		flashinstalled = 1;
	if (navigator.plugins["Shockwave Flash 2.0"])
	{
		flashinstalled = 2;
		flashversion = 2;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
	MSDetect = "true";