// JScript File


	//================================================================================================================//
	function getAbsoluteLeft(object_id) {
		// Get an object left position from the upper left viewport corner
		// Tested with relative and nested objects
		o = document.getElementById(object_id);
		if(o) {
			oLeft = o.offsetLeft;			 // Get left position from the parent object
			while(o.offsetParent!=null) {	 // Parse the parent hierarchy up to the document element
				oParent = o.offsetParent;	 // Get parent object reference
				oLeft += oParent.offsetLeft; // Add parent left position
				o = oParent;
			}
		} else {
			oLeft = -1;
		}
		// Return left postion
		return oLeft
	}
	
	function getAbsoluteTop(object_id) {
		// Get an object top position from the upper left viewport corner
		// Tested with relative and nested objects
		o = document.getElementById(object_id);
		if(o) {
			oTop = o.offsetTop;				// Get top position from the parent object
			while(o.offsetParent!=null) {	// Parse the parent hierarchy up to the document element
				oParent = o.offsetParent;	// Get parent object reference
				oTop += oParent.offsetTop;	// Add parent top position
				o = oParent;
			}
		} else {
			oTop = -1;
		}
		// Return top position
		return oTop
	}
	
	function getAbsoluteWidth(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			oWidth = o.offsetWidth;
		} else {
			oWidth = -1;
		}
		return oWidth;
	}
	
	function getAbsoluteHeight(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			oHeight = o.offsetHeight;
		} else {
			oHeight = -1;
		}
		return oHeight;
	}
	//================================================================================================================//
	
	
	//================================================================================================================//
	function setAbsoluteLeft(object_id, val) {
		// set an object left position
		o = document.getElementById(object_id);
		if(o) {
			if(val == "auto")
				o.style.left = val;
			else
				o.style.left = val + "px";
		}
	}
	
	function setAbsoluteTop(object_id, val) {
		// set an object top position 
		o = document.getElementById(object_id);
		if(o) {
			if(val == "auto")
				o.style.top = val;
			else
				o.style.top = val + "px";
		}
	}
	
	function setAbsoluteWidth(object_id, val) {
		o = document.getElementById(object_id);
		if(o) {
			if(val == "auto")
				o.style.width = val;
			else
				o.style.width = val + "px";
		}
	}
	
	function setAbsoluteHeight(object_id, val) {
		o = document.getElementById(object_id);
		if(o) {
			if(val == "auto")
				o.style.height = val;
			else
				o.style.height = val + "px";
		}
	}
	
	function makeObjectAbsolute(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			o.style.position = "absolute";
		}
	}
	//================================================================================================================//
	
	
	//================================================================================================================//
	function setBackgroundColor(object_id, color) {
		o = document.getElementById(object_id);
		if(o) {
			o.style.background = color;
		}
	}
	
	function setForegroundColor(object_id, color) {
		o = document.getElementById(object_id);
		if(o) {
			o.style.color = color;
		}
	}
	
	function setBackgroundImage(object_id, img_path){
		o = document.getElementById(object_id);
		if(o) {
			o.style.background = "url(" + img_path + ")";
			o.style.backgroundPosition = "center";
		}
	}
	
	function setObjectPosition(object_id, str_pos) {
		o = document.getElementById(object_id);
		if(o) {
			o.style.position = str_pos;
		}
	}
	
	function setCursorAtLastPosition(obj_id) {
		try {
			if(isHTMLObject(obj_id)) {
				if(document.all) {
					var range = document.getElementById(obj_id).createTextRange();
					range.collapse(true);
					range.moveEnd('character', document.getElementById(obj_id).value.length);
					range.moveStart('character', document.getElementById(obj_id).value.length);
					range.select();
				}
			}
		} catch(e) {
		}
	}
	//================================================================================================================//
	
	
	//================================================================================================================//
	function isHTMLObject(object_id) {
		return document.getElementById(object_id);
	}
	
	function setVisible(object_id,flg) {
		if(document.getElementById(object_id)) {
			if(flg) {
				document.getElementById(object_id).style.visibiliy = "visible";
				document.getElementById(object_id).style.display = "inline";
			} else {
				document.getElementById(object_id).style.visibiliy = "Hidden";
				document.getElementById(object_id).style.display = "none";
			}
		}
	}
	function isVisible(object_id) {
		var flg = false;
		if(document.getElementById(object_id)) {
			//alert(object_id + "::" + document.getElementById(object_id).style.visibiliy);
			if(document.getElementById(object_id).style.visibiliy == "visible")
				flg = true;
		}
		//alert(flg);
		return flg;
	}
	
	function showHide(object_id) {
		setVisible(object_id, !isVisible(object_id));
	}
	function hideObjects() {
		var args = hideObjects.arguments;
		for(i=0; i<args.length; i++) {
			setVisible(args[i],false);
		}
	}
	
	function setFocus(object_id) {
	    o = document.getElementById(object_id);
		if(o) {
		    try { o.focus(); } catch(e) { }
		}
	}
	
	
	function setEnabled(object_id, flg) {
		if(document.getElementById(object_id)) {
			try {
				document.getElementById(object_id).disabled = !flg;
			} catch(e) {}
		}
	}
	function isEnabled(object_id, flg) {
		if(document.getElementById(object_id)) {
			try {
				return (!document.getElementById(object_id).disabled);
			} catch(e) {
				return false;
			}
		}
	}
	
	function setReadonly(object_id, flg) {
		if(document.getElementById(object_id)) {
			try {
				document.getElementById(object_id).readonly = flg;
			} catch(e) {}
		}
	}
	function isReadonly(object_id,flg) {
		if(document.getElementById(object_id)) {
			try {
				return document.getElementById(object_id).readonly;
			} catch(e) {
				return true;
			}
		}
	}
	//================================================================================================================//
	
	//================================================================================================================//
	function ClearDivContent() {
		var args = ClearDivContent.arguments;
		var i = 0;
		
		for(i=0; i<args.length; i++)
			ChangeInnerHTML(args[i], "");
	}
	
	function ChangeInnerHTML(object_id, inner_html) {
		o = document.getElementById(object_id);
		if(o) {
			o.innerHTML = inner_html;
		}
	}
	
	function getInnerHTML(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			try {
				return o.innerHTML;
			} catch(e) {
				return "";
			}
		}
	}
	
	function ChangeImage(object_id, alt_img_url) {
		o = document.getElementById(object_id);
		if(o) {
			o.src = alt_img_url;
		}
	}
	
	function ChangeBackgroundImage(object_id, alt_img_url) {
		o = document.getElementById(object_id);
		if(o) {
			o.style.background = "url(" + alt_img_url + ")";
		}
	}
	
	function getValue(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			try {
				return o.value;
			} catch(e) {
				return "";
			}
		}
	}
	function setValue(object_id, val) {
		o = document.getElementById(object_id);
		if(o) {
			try {
				o.value = val;
			}catch(e) {
			}
		}
	}
	
	
	function getClassName(object_id) {
		o = document.getElementById(object_id);
		if(o) {
			try {
				return o.className;
			} catch(e) {
				return "";
			}
		}
	}
	function setClassName(object_id, class_name) {
		o = document.getElementById(object_id);
		if(o) {
			try {
				o.className = class_name;
			}catch(e) {
			}
		}
	}
	//================================================================================================================//
	
	//================================================================================================================//
	function RestrictTextAreaChars(e, obj_txtarea_id, obj_txt_id, num) {
		// This function is used to restrict max chars in textarea
		var key, flg;
		try {
			flg = false;
			if(typeof(e) != "undefined") {
				key = window.event ? e.keyCode : e.which;
				//alert(key);
				if(typeof(key) != "undefined") {
					if(key == 8) {
						flg = true;
					} else if(getValue(obj_txtarea_id).length >= num){
						setValue(obj_txtarea_id, getValue(obj_txtarea_id).substr(0, num));
					}
				}
			}
			setValue(obj_txt_id, num - getValue(obj_txtarea_id).length);
			return flg;
		} catch(ex) {
			//alert(ex);
			return false;
		}
	}
	//================================================================================================================//
	
	//================================================================================================================//
	function MM_preloadImages() { //v3.0
		var d=document;
		if(d.images) {
			if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
			for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0) {
					d.MM_p[j]=new Image;
					d.MM_p[j++].src=a[i];
				}
		}
	}
	//================================================================================================================//
	
	//================================================================================================================//
	function ConvertAsciitoString(ascii_vals) {
		//alert(ascii_vals.length);
		var tmp_data="";
		try {
			var arr_ascii = ascii_vals.split(",");
			//alert(arr_ascii.length);
			if(arr_ascii.length > 1) {
				for(var i=0; i<arr_ascii.length; i++) {
					tmp_data = tmp_data + "" + String.fromCharCode(arr_ascii[i]);
					//if(i==1) { alert(String.fromCharCode(arr_ascii[i])); }
				}
			}
			return tmp_data;
		} catch(e) {
			//alert(e);
		}
	}
	//================================================================================================================//
	
