
	function switchStyleDisplay(obj_name)
	{
		if (typeof(obj_name) == 'string')
			var obj = document.getElementById(obj_name);
		else
			var obj = obj_name;
		
		obj.style.display = (obj.style.display == '') ? 'none' : '';
	}
	
	function getRadioValue(name) 
	{
		var radioObj = document.getElementsByName(name);
		var radioLength = radioObj.length;
		if (radioLength == undefined) {
			if (radioObj.checked)
				return radioObj.value;
			else
				return "";
		}
		else {
			for (var i = 0; i < radioLength; i++) {
				if (radioObj[i].checked) {
					return radioObj[i].value;
				}
			}
			return "";
		}
	}
	
	function isInt(str) 
	{
		var objRegExp  = /(^-?\d\d*$)/; 
		return objRegExp.test(str);
	}
	
	function setSelect(select_id, value)
	{
        if (typeof(select_id) == 'string')
            var object = document.getElementById(select_id);
        else
            var object = select_id;

		for (var i=0; i<object.options.length; i++) {
			if (object.options[i].value == value) {
				object.options[i].selected = true;
			}
		}
	}
	
	function getSelect(select_id)
	{
		if (typeof(select_id) == 'string')
			var object = document.getElementById(select_id);
		else
			var object = select_id;
	
		if (object)
			return object.options[object.selectedIndex].value;
		else
			return '';
	}
	
	function getSelectText(select_id)
	{
	        var object = document.getElementById(select_id);
	        if (object)
	                return object.options[object.selectedIndex].text;
	        else
	                return '';
	}
	
	function isBlank(val) {
	    if(val==null){return true;}
	    for(var i=0;i<val.length;i++) {
	        if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
	    }
	    return true;
	}
	
	function ajaxFramework(method, action, params, callback)
	{
		var xmlhttp;
		
		// code for IE7+, Firefox, Chrome, Opera, Safari
		if (window.XMLHttpRequest) {
		  	xmlhttp = new XMLHttpRequest();
		}
		// code for IE6, IE5
		else if (window.ActiveXObject) {
		  	xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
		}
		else {
		  	alert('Your browser does not support XMLHTTP!');
		}
		
		// handler for PHP response
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				if (callback != null && callback != undefined) {
					callback(xmlhttp.responseText);
				}
			}
		}
		
		// call PHP now
		if (method == 'post' || method == 'POST') {
			xmlhttp.open(method, action, true);
			xmlhttp.setRequestHeader("If-Modified-Since","0");
			xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			xmlhttp.setRequestHeader('Content-length', params.length);
			xmlhttp.setRequestHeader('Connection', 'close');
			xmlhttp.send(params);
		}
		else {
			xmlhttp.open(method, action+'?'+params, true);
			xmlhttp.setRequestHeader("If-Modified-Since","0");
			xmlhttp.send(null);
		}
	}
	
	function popupwin(url, w, h, id) {

		if (w==0 || w==null) w = 725;
		if (h==0 || h==null) h = 500;

		if (id == null) id = 'popupwin';

		window.open(url, id, 'height='+h+',width='+w+',scrollbars=yes,resizable=1,status=yes,toolbar=no,menubar=no,location=no,directories=no');
	}

	function getWindowSize() 
	{
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		}
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		
		var size = new Array();
		size[0] = myWidth;
		size[1] = myHeight;
		return size;
	}
	
	function getScrollY() {
		var scrOfX = 0, scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		} 
		else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		} 
		else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
		return scrOfY;
	}
	
	function showFullScreenLayer(content)
	{
		var layer_object = document.getElementById('fullscreen_outer_layer');

		if (content != null)
			document.getElementById('fullscreen_inner_layer').innerHTML = content;
		
		var size = getWindowSize();
		layer_object.style.top = getScrollY();
		layer_object.style.width = size[0];
		layer_object.style.height = size[1];
		layer_object.style.display = '';
	}

