// JavaScript Document

/* Fix for IE to show hover effects for sortable lists */
startList = function() {
	if (document.all&&document.getElementById) {
		sortList = document.getElementById("item_list");
		if (sortList) {
			for (i=0; i<sortList.childNodes.length; i++) {
				node = sortList.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.style.background = "#F0EBDA";
					}
					node.onmouseout=function() {
						if (this.className=="featured") {
							this.style.background = "#EEEEEE";
						} else {
							this.style.background = "#FFFFFF";
						}
					}
				}
			}
		}
	}
}
window.onload=startList;

function updateOrder(key,table,order) {
	var options = {
		method : 'post',
		parameters : Sortable.serialize('item_list')+"&ReOrder=1&TableRowID="+key+"&TableName="+table+"&TableOrder="+order
	};
	new Ajax.Request('http://www.clickstudios.com/clients/prinsloo/admin/process.php', options);
}

function trimLength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "";
	if (obj.getAttribute && obj.value.length>mlength);
	obj.value=obj.value.substring(0,mlength);
}

function previewLayout(menu) {
	var src = previews[menu.options[menu.selectedIndex].value];
	var img = document.getElementById('preview');
	img.src = src;
}