	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
				if (styleObject[property]) {
					return styleObject[ property ];
				}
			}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById(id);
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}

	function switchDisplay(id,formele) {
		thisState = getFormValue(formele);
		if (thisState == 1) {
			setIdProperty(id,"display",'block');
		} else {
			setIdProperty(id,"display",'none');
		}
	}
	
	function switchDisplayHard(id,formele,sta) {
		if (sta == "on") {
			document.getElementById(formele).value = "1";
			setIdProperty(id,"display",'block');
		} else {
			document.getElementById(formele).value = "0";
			setIdProperty(id,"display",'none');
		}
	}

	function getFormValue(id) {
		tempV = document.getElementById(id);
		return tempV.value;
	}
	
	function getCheckValue(id) {
		tempV = document.getElementById(id);
		return tempV.checked;
	}
	
	function getColorValue(id) {
		tempV = document.getElementById(id);
		if (tempV.value == "transparent") {
			return tempV.value;
		} else {
			return "#"+tempV.value;
		}
	}

	function switchMode(val) {
		if (val == 'simple') {
			document.location.href = "index.html";
		} else {
			document.location.href = "index_adv.html";
		}
	}

	function rwt(txt, id) {
		txt += "\n";
		document.all[id].innerHTML = txt;
	}

	vars = new Object();
	vars.which = "nothing";
	vars.num = "0";
	vars.defcolor = "";

	function showColorTable(loc,id,num,defcolor) {
		tableEl = document.getElementById(loc);
		var x = getAbsoluteX(tableEl);
		var y = getAbsoluteY(tableEl);
		var x = x+109;
		var y = y;

		var menuEl = document.getElementById("colorstable");
		menuEl.style.left = x + "px";
		menuEl.style.top = y + "px";
		vars.which = id;
		vars.num = num;
		vars.defcolor = defcolor;
		
		var tempval=document.getElementById("colorstable")
		tempval.style.display = "inline";
	}
	function showColorTableNOIE(loc,id,num,defcolor) {
		tableEl = document.getElementById(loc);
		var x = getAbsoluteX(tableEl);
		var y = getAbsoluteY(tableEl);
		var x = x-202;
		var y = y+25;

		var menuEl = document.getElementById("colorstable");
		menuEl.style.left = x + "px";
		menuEl.style.top = y + "px";
		vars.which = id;
		vars.num = num;
		vars.defcolor = defcolor;
		
		var tempval=document.getElementById("colorstable")
		tempval.style.display = "inline";
	}
	function hideColorTable() {
		setIdProperty('colorstable',"display",'none');
	}
	
	function colorchoose(thisColor) {
		tempV = document.getElementById(vars.which);
		colorObj = document.getElementById("cshow"+vars.num);
		if (thisColor == "transparent") {
			colorObj.style.background = thisColor;
			tempV.value = thisColor;
		} else if (thisColor == "default") {
			colorObj.style.background = vars.defcolor;
			tempV.value = vars.defcolor;
		} else if (thisColor == "nochange") {
			
		} else {
			colorObj.style.background = "#"+thisColor;
			tempV.value = thisColor;
		}
	}
	
	function getAbsoluteX (elm) {
		var x = 0;
		if (elm && typeof elm.offsetParent != "undefined") {
			while (elm && typeof elm.offsetLeft == "number") {
				x += elm.offsetLeft;
				elm = elm.offsetParent;
			}
		}
		return x;
	}
	
	function getAbsoluteY (elm) {
		var y = 0;
		if (elm && typeof elm.offsetParent != "undefined") {
			while (elm && typeof elm.offsetTop == "number") {
				y += elm.offsetTop;
				elm = elm.offsetParent;
			}
		}
		return y;
	}
	
	function autoUpdate(id,num) {
		tempField = document.getElementById(id);
		tempFieldVal = tempField.value;
		colorObj = document.getElementById("cshow"+num);
		if (tempFieldVal == "transparent") {
			colorObj.style.background = tempFieldVal;
		} else {
			colorObj.style.background = "#"+tempFieldVal;
		}
	}	
