<!--//
function switchClass(o,c) {
	o.className = c;
}
function isValidEmail(email) {
	ok = true;
	len = email.length;

	if (email.indexOf('@') == -1 || email.indexOf('@') == 0)
		ok = false;
	if (email.indexOf('@') == len)
		ok = false;

	if (email.indexOf('.') == -1 || email.indexOf('.') == 0)
		ok = false;
	if (email.indexOf('.') == len)
		ok = false;
	
	return ok;
}
function makeRequest(url_href) {
	url_href += "&rnd=" + Math.random();
	if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	http_request.onreadystatechange = getResult;
	http_request.open('GET', url_href, true);
	http_request.send(null);
}
function getResult() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			res = http_request.responseText.split(":");
			parseResults(res);
		} else {
			//alert("Impossible to connect to the server. Please check your internet connection."); 
		}
	}
}
function makeiRequest(url_href) {
	url_href += "&rnd=" + Math.random();
	if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	http_request.onreadystatechange = getiResult;
	http_request.open('GET', url_href, true);
	http_request.send(null);
}
function getiResult() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			res = http_request.responseText.split(":");
			parseiResults(res);
		} else {
			//alert("Impossible to connect to the server. Please check your internet connection."); 
		}
	}
}
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
function trim(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
function goTo(url) {
	window.location = url;
}
function showUp(url,width,height) {
	if (width == 'undefined' && height == 'undefined') {
		width = screen.width;
		height = screen.height;
	}
	eval("page_open = window.open('" + url + "','','scrollbars=1,width=" + width + ",height=" + height + "');");
}
function isOk(msg) {
	goOn = confirm(msg);
	return goOn;
}
function refreshPage() {
	window.location.reload(true);
}
function importJS(jsFile) {
	var js = document.createElement('script');
	js.type = 'text/javascript';
	js.src = jsFile;
	document.getElementsByTagName('head')[0].appendChild(js);
}
function selectIndexForValue(val,sel) {
	if (val != '' && sel) {
		for (i=0;i<sel.options.length;i++) {
			if (sel.options[i].value == val) {
				sel.selectedIndex = i;
			}
		}
	}
}
function fillSelect(arr,sel) {
	if (arr[0] && sel) {
		sel.options.length = arr.length;
		for (i=0;i<arr.length;i++) {
			val = arr[i].split(',,');
			sel.options[i] = new Option(val[0],val[1]);
		}
	}
}
function clearPasswords() {
	objs = document.getElementsByTagName('input');
	for (i=0;i<objs.length;i++) {
		obj = objs[i];
		if (obj.type == 'password') {
			obj.value = "";
		}
	}
}
function utf8_encode(string) {
	// http://kevin.vanzonneveld.net
	// +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: sowberry
	// +	tweaked by: Jack
	// +   bugfixed by: Onno Marsman
	// +   improved by: Yves Sucaet
	// +   bugfixed by: Onno Marsman
	// *	 example 1: utf8_encode('Kevin van Zonneveld');
	// *	 returns 1: 'Kevin van Zonneveld'
 
	string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");
 
	var utftext = "";
	var start, end;
	var stringl = 0;
 
	start = end = 0;
	stringl = string.length;
	for (var n = 0; n < stringl; n++) {
		var c1 = string.charCodeAt(n);
		var enc = null;
 
		if (c1 < 128) {
			end++;
		} else if((c1 > 127) && (c1 < 2048)) {
			enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
		} else {
			enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
		}
		if (enc != null) {
			if (end > start) {
				utftext += string.substring(start, end);
			}
			utftext += enc;
			start = end = n+1;
		}
	}
 
	if (end > start) {
		utftext += string.substring(start, string.length);
	}
 
	return utftext;
}
function utf8_decode(str_data) {
	// http://kevin.vanzonneveld.net
	// +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
	// +	  input by: Aman Gupta
	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: Norman "zEh" Fuchs
	// +   bugfixed by: hitwork
	// +   bugfixed by: Onno Marsman
	// *	 example 1: utf8_decode('Kevin van Zonneveld');
	// *	 returns 1: 'Kevin van Zonneveld'
 
	var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;
 
	str_data += '';
 
	while ( i < str_data.length ) {
		c1 = str_data.charCodeAt(i);
		if (c1 < 128) {
			tmp_arr[ac++] = String.fromCharCode(c1);
			i++;
		} else if ((c1 > 191) && (c1 < 224)) {
			c2 = str_data.charCodeAt(i+1);
			tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
			i += 2;
		} else {
			c2 = str_data.charCodeAt(i+1);
			c3 = str_data.charCodeAt(i+2);
			tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
			i += 3;
		}
	}
 
	return tmp_arr.join('');
}
function strtolower( str ) {
	// http://kevin.vanzonneveld.net
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: Onno Marsman
	// *     example 1: strtolower('Kevin van Zonneveld');
	// *     returns 1: 'kevin van zonneveld'

	return (str+'').toLowerCase();
}
function showHideObj(obj_id) {
	if (document.getElementById(obj_id)) {
		obj = document.getElementById(obj_id);
		if (obj.style.visibility == 'visible') {
			obj.style.visibility = 'hidden';
			obj.style.display = 'none';
		} else {
			obj.style.visibility = 'visible';
			obj.style.display = 'block';
		}
	}
}
//-->