function changeOption(optionid, value) {
	var select = document.getElementById(optionid);
	if (value!=null&&value!="") {		
		for (i=0;i<select.options.length;i++) {
			if (select.options[i].value == value) {
				select.selectedIndex=i;
			}
		}
	} else {
		value = select.options[select.selectedIndex].value;
	}
	var imgs = document.getElementsByTagName("img");
	for (i=0;i<imgs.length;i++) {
		if (imgs[i].className.substring(0,optionid.length) == optionid) {
			imgs[i].className=imgs[i].className.replace(new RegExp(" selected\\b"), "");	
			if (imgs[i].id == optionid+"_"+value) {
				imgs[i].className+=" selected";				
			}
		}
	}
}
function selectSubCategory(url) {
	$("#productdialog").load(url); 
}
function selectOptionProduct(optionid,productid,productdetailurl) {
	$.modal.close();		
	document.getElementById(optionid).value=productid; //set the id in the form field;
	var id = ""+optionid+"_value"; 
	$("#"+id)
		.hide()
		.load(productdetailurl)
	 	.fadeIn(1500); //show details of the selection via AJAX call
}
