                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
 function changeImage(id,img) {
	document.getElementById(id).src = img;
}

function changeStyle(id,styleSelector,value){
	eval("document.getElementById(id).style."+styleSelector+"='"+value+"';");
}

function jsSupportedHTML(html) {
	if (document.getElementById) {
		document.write(html);
	}
}

function getValue(field) {
	var val;
	if (field.type == "text") {
		val = field.value;
	}
	else if (field.type == "select-one") {
		val = field.options[field.options.selectedIndex].value;
	}
	else if (field[0].type == "radio") {
		for (var i = 0; i < field.length; i ++) {
			if (field[i].checked) {
				val = field[i].value;
			}
		}
	}
	return val;
}

function getNumValue(field) {
		return parseFloat(getValue(field));
}

function setValue(field,val) {
	if (field.type == "select-one") {
		for (var v = 0; v < field.options.length; v++) {
			if (field.options[v].value == val) {
				field.selectedIndex = field.options[v].index;
			}
		}
	}
	if (field[0].type == "radio") {
		for (var i = 0; i < field.length; i ++) {
			if (field[i].value == val) {
				field[i].checked = true;
			}
		}
	}
}
 
function showElement(id) {
	if(document.getElementById(id))
		document.getElementById(id).style.display = "block";
}

function showElements() {
	var a = showElements.arguments;
	for (var i = 0; i < a.length; i ++) {
		if (typeof a[i] == 'string') {
			if (document.getElementById(a[i]) != null) {
				t = document.getElementById(a[i]).tagName;
				d = (t == 'A' || t == 'SPAN' || t == 'IMG') ? 'inline' : 'block';
				document.getElementById(a[i]).style.display = d;
			}
		} else {
			for (var j = 0; j < a[i].length; j ++) {
				showElements(a[i][j]);
			}
		}
	}
}

function hideElement(id) {
if (id != ""&&document.getElementById(id)) {
	document.getElementById(id).style.display = "none";
	}
}

function hideElements() {
	var a = hideElements.arguments;
	for (var i = 0; i < a.length; i ++) {
		if (typeof a[i] == 'string') {
			if (document.getElementById(a[i]) != null) {
				document.getElementById(a[i]).style.display = "none";
			}
		} else {
			for (var j = 0; j < a[i].length; j ++) {
				hideElements(a[i][j]);
			}
		}
	}
}

function openElement(id,html) {
	parent.document.getElementById(id).innerHTML = html;
	showElement(id);
} 

function closeElement(id) {
	if (id != "") {
		parent.document.getElementById(id).innerHTML = "";
		hideElement(id);
	}
}

function writeElement(id,html) {
	window.frames[id].document.open();
	window.frames[id].document.write(html);
	window.frames[id].document.close();
	showElement(id);
}

function changeCss(id,theClass) {
	document.getElementById(id).className = theClass;
}

function getElementPosition(elem) {
    var offsetTrail = elem;
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 &&
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}

function setElementPosition(layerEl,fixedEl,xOffset,yOffset) {

    layerEl.style.position = "absolute";
    layerEl.style.top = parseFloat(getElementPosition(fixedEl).top + yOffset) + "px";
    layerEl.style.left = parseFloat(getElementPosition(fixedEl).left + xOffset) + "px";
}

