<!--

//log
var ref=""+escape(document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + "x" + window.screen.height;
var eself = document.location;

// From http://phpbb.com
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1) && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

function resetField(){
	//alert(document.getElementById('h').value);
	//alert(document.getElementById('h').selectedIndex);
//	document.getElementById('h').options[1].selected = true;
	document.getElementById('h').selectedIndex = 8;
//	document.getElementById('h').value='35';
}


//counter to limit max characters in text/textarea field
function limitText(textfield, counterfield, charactercount) {
	if (textfield.value.length > charactercount) {
		textfield.value = textfield.value.substring(0, charactercount);
	} else {
		counterfield.value = charactercount - textfield.value.length;
	}
}


//swap items between two (multiple) select boxes

//theSource			: the source select box from which to move the selected element
//theDestination	: the destination select box from which to move the selected element
//theIdString		: the id string (comma seperated) of the active/enabled fields
//theIdSelect		: the select box from which to read the active/enabled elements after each action

function swapItems (theSource, theDestination, theIdString, theIdSelect)
{
	var source = document.getElementById(theSource);
	var destination = document.getElementById(theDestination);
	var str = '';

	// Add items to the destination
    for (var i = 0; i < source.length; i++)
	{
        if (source.options[i].selected == true)
		{
            //add to box
			destination.options[destination.length] = new Option(source.options[i].text,source.options[i].value);
			//new Option(text, value, defaultSelected, selected)
        }
    }

	// Remove items from the source
    for (var i = (source.length - 1); i >= 0; i--)
	{
        if (source.options[i].selected)
		{
            //remove from box
			source.options[i] = null;
        }
    }
	
	var idSelect = document.getElementById(theIdSelect);
	if(idSelect.length > 0){
		
		// validate the ids list from the destination elements
		for (var i = 0; i < idSelect.length; i++)
		{
			//add to id list
			str += idSelect.options[i].value + ',';
		}
	}
	
	//check id list
	if (str.length == 0) {
		document.getElementById(theIdString).value = '';
	} else {
		document.getElementById(theIdString).value = str;
	}
}

	
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";
	}
}

function jsconfirm(thetext){
	return confirm(thetext);
}

function insertext(str,tagid,display){
	document.getElementById(tagid).value = str;
	if(display){
		document.getElementById(display).style.display='none';
	}
}

function resizeWindow(theurl, windowname, features){
	window.open(theurl, windowname, features);
}

function closeWindow(){
	window.opener.location=window.opener.location;
	window.opener.focus();
	window.close()
}

if(document.getElementById&&!document.all){ns6=1;}else{ns6=0;}
var agtbrw=navigator.userAgent.toLowerCase();
var operaaa=(agtbrw.indexOf('opera')!=-1);
var head="display:''";
var folder='';

function expandit(curobj, hide) {

	var cur_objects = curobj.split(",");
	for(i=0; i<cur_objects.length; i++) {
		cur_objects[i]=cur_objects[i].replace(/^\s*(.*)/, "$1");
		cur_objects[i]=cur_objects[i].replace(/(.*?)\s*$/, "$1");
		if(document.getElementById(cur_objects[i])) {
			folder=document.getElementById(cur_objects[i]).style;
			if(folder.display=="none")
			{
				folder.display="block";
			} else {
				folder.display="none";
			}
		}
	}
		

	if(hide) {
		var hide_objects = hide.split(",");
		for(i=0; i<hide_objects.length; i++) {
			hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1");
			hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1");
			if(document.getElementById(hide_objects[i])) {
				hidden=document.getElementById(hide_objects[i]).style;
				if(hidden.display=="") {
					hidden.display="none";
				}
			}
		}
	}
}

function expandit_vis(curobj, hide) {

	var cur_objects = curobj.split(",");
	for(i=0; i<cur_objects.length; i++) {
		cur_objects[i]=cur_objects[i].replace(/^\s*(.*)/, "$1");
		cur_objects[i]=cur_objects[i].replace(/(.*?)\s*$/, "$1");
		if(document.getElementById(cur_objects[i])) {
			folder=document.getElementById(cur_objects[i]).style;
			if(folder.visibility=="hidden")
			{
				folder.visibility = 'visible';
				folder.height = '100%';
			} else {
				folder.visibility = 'hidden';
				folder.height = '1px';
				folder.overflow = 'hidden';
			}
		}
	}
		

	if(hide) {
		var hide_objects = hide.split(",");
		for(i=0; i<hide_objects.length; i++) {
			hide_objects[i]=hide_objects[i].replace(/^\s*(.*)/, "$1");
			hide_objects[i]=hide_objects[i].replace(/(.*?)\s*$/, "$1");
			if(document.getElementById(hide_objects[i])) {
				hidden=document.getElementById(hide_objects[i]).style;
				if(hidden.visibility=="") {
					hidden.visibility = 'hidden';
					hidden.height = '1px';
					hidden.overflow = 'hidden';
					
				}
			}
		}
	}
}

function setVis(obj, status){
	var folder = document.getElementById(obj).style;

	if(status=='true'){
		folder.visibility = 'visible';
		folder.height = '100%';

	}else if(status=='false'){
		folder.visibility = 'hidden';
		folder.height = '1px';
		folder.overflow = 'hidden';

	//default
	}else{
		if(folder.visibility=='hidden'){
			folder.visibility = 'visible';
			folder.height = '100%';
		}
		else
		{
			folder.visibility = 'hidden';
			folder.height = '1px';
			folder.overflow = 'hidden';
		}
	}
}

function checkbox(id){
	if(document.getElementById(id).checked==true){
		document.getElementById(id).checked=false;
	}else{
		document.getElementById(id).checked=true
	}
}
/*
function openWin(FILE,windowWidth,windowHeight,windowname,toolbar,resizable,location,menubar,directories,scrollbars,status){

	if (!location) {location='no'}else{location='yes'}
	if (!menubar) {menubar='no'}else{menubar='yes'}
	if (!directories) {directories='no'}else{directories='yes'}
	if (!toolbar) {toolbar='no'}else{toolbar='yes'}
	if (!scrollbars) {scrollbars='no'}else{scrollbars='yes'}
	if (!resizable) {resizable='no'}else{resizable='yes'}
	if (!status) {status='no'}else{status='yes'}
	
	if (!windowname){windowname='Vergroot';}
	if ((screen.height-60)<windowHeight){windowHeight=screen.height-60;}
	if ((screen.width-10)<windowWidth){windowWidth=screen.width-10;}

	winprops="width="+windowWidth+",height="+windowHeight+",location="+location+",menubar="+menubar+",directories="+directories+",toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",status="+status+"";

	win=window.open(FILE, windowname,winprops );

	if (parseInt(navigator.appVersion) >= 4){
		var yPos=(screen.height/2)-(windowHeight/2+20);
		if (yPos<10){
			yPos=10;
		}
		win.moveTo((screen.width/2)-(windowWidth/2+10),yPos);
	}

	win.focus();
}
*/

function open_window(url, width, height, windowName) {
	if('full' == width){
		pwindow = window.open(url)
	} else {
		
		//set width
		if (width) {
			windowWidth=width;
		} else {
			windowWidth=600;
		}

		//set height
		if (height) {
			windowHeight=height;
		} else {
			windowHeight=400;
		}
		
		//set window name
		if (!windowName){windowName='Name';}
		
		//adjust window dimensions
		if ((screen.height-60)<windowHeight){windowHeight=screen.height-60;}
		if ((screen.width-10)<windowWidth){windowWidth=screen.width-10;}

		//default window properties
		locat = 'no';
		menubar = 'no';
		directories = 'no';
		toolbar = 'no';
		scrollbars = 'yes';
		status = 'no';
		resizable = 'no';

		//window properties
		winprops = "top=100,left=100,width="+windowWidth+",height="+windowHeight+",location="+locat+",menubar="+menubar+",directories="+directories+",toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",status="+status+"";
	
		pwindow = window.open(url, windowName, winprops);
		
		//center on screen
		if (parseInt(navigator.appVersion) >= 4){
			var yPos=(screen.height/2)-(windowHeight/2+20);
			if (yPos<10){
				yPos=10;
			}
			pwindow.moveTo((screen.width/2)-(windowWidth/2+10),yPos);
		}
	}
	pwindow.focus();
}


//check radio button
function setRadio(the_form, the_name, the_id) {
	
	//the form
	var form = document.forms[the_form];
	
	//the element group
	var group = form[the_name];

	//for(var i = 0; i < group.length; i++){
	//	alert(i+' - '+group[i].value);
	//}
	//alert(the_form+' - '+the_name+' - '+the_id);
	//the element
	var element = group[the_id];
//alert(group[the_id].value);
	//check the element
	element.checked = true;

	return true;
}



//check all / uncheck all
function setCheckboxes(the_form, do_check, the_cb){
	//var elts = (typeof(document.forms[the_form].elements[the_cb]) != 'undefined') ? document.forms[the_form].elements[the_cb] : document.forms[the_form].elements[the_cb];
	var elts = document.forms[the_form].elements[the_cb];

	var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
	if(elts_cnt){
		for(var i = 0; i < elts_cnt; i++){
			elts[i].checked = do_check;
		}
	}else{
		elts.checked = do_check;
	}
	return true;
}

//hideid is the default visible div element
//var hideid = 'stage1';
var hideid = '';
function showhideit(showid, defaulthideid){
	if(hideid==''){
		hideid=defaulthideid;
	}
	if (hideid!=showid){
		show=document.getElementById(showid);
		showel = show.style;
		
		hide=document.getElementById(hideid);
		hideel = hide.style;
		
		showel.display='';
		hideel.display='none';
		
		hideid = showid;
	}
}

//hideid is the default active element
function setstage(seq_name, seq_id){
	
	//total number of stages
	number = 8;
	
	//set these to active
	for(var i = 1; i <= seq_id; i++){
		element = seq_name+''+i;
		document.getElementById(element).className = 'stage_active';
	}
	
	//set these to inactive
	for(var i = seq_id+1; i <= number; i++){
		element = seq_name+''+i;
		document.getElementById(element).className = 'stage_inactive';
	}

}

//image preloader
function ejs_preload(ejs_path, ejs_imageString){
	var ejs_imageArray = ejs_imageString.split(',');
	for(ejs_loadall=0; ejs_loadall<ejs_imageArray.length; ejs_loadall++){
		var ejs_LoadedImage=new Image();
		ejs_LoadedImage.src=ejs_path + ejs_imageArray[ejs_loadall];
	}
}

//-->