function insert_swf(mc, wd, ht, clr) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+wd+'" height="'+ht+'" id="scroller">\n');
	document.write('<param name="movie" value="'+mc+'">\n');
	document.write('<param name="bgcolor" value="'+clr+'">\n');
	document.write('<embed src="'+mc+'" quality="high" bgcolor="'+clr+'" width="'+wd+'" height="'+ht+'" name="preso" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
	document.write('</embed>\n');
	document.write('</object>\n');
}

function insertWMV(mc) {
	document.write('<object id="MediaPlayer" width="320" height="240" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject">\n');
	document.write('<param name="FileName" value="'+mc+'">\n');
	document.write('<param name="AutoStart" VALUE="1">\n');
	document.write('<param name="ShowControls" VALUE="1">\n');
	document.write('<param name="BufferingTime" VALUE="4">\n');
	document.write('<embed type="application/x-mplayer2" src="'+mc+'" width="320" height="296" autostart="1" showcontrols="1" BufferingTime="4">\n');
	document.write('</embed>\n');
	document.write('</object>\n');
}

function validate(frm){
	if(frm.email.value == ""){
		alert("Please enter your E-Mail");
		frm.email.focus();
		return false;
	}
	if(frm.email.value != ""){
		if(!isEmail(frm.email)) {
			return false;
		}
	}
}

function isEmail(obj){
	str = obj.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if(!filter.test(str)){
		alert("Invalid Email");
		obj.focus();
		return false;
	}
	return true;
}

function autoDrop(){
	var URL = document.selector.dropNav.options[document.selector.dropNav.selectedIndex].value;
	if (URL != 0) {
		window.location.href = URL;
	}
}

/* Homepage tabs */

function changeTab(total,id) {
	for(i=1;i<=total;i++) {
		thisTab = 'tab'+i;
		if(i == id) {
			document.getElementById(thisTab).style.display = 'block';
		}
		else {
			document.getElementById(thisTab).style.display = 'none';
		}
	}	
}

/* Image rollover & preload */

function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue; 
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

function NewWindowTL(mypage, myname, w, h, scroll) {
	var winl = 0;
	var wint = 0;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) {
	win.window.focus();
	}
}


