function updProdView(prodCatValue) {
	var url = "default.php?c=" + prodCatValue;
	window.location.href=url;
}

function validation(obj) {
	if (obj.company_name.value == "") {
		alert("Company Name missing ....");
		obj.company_name.focus();
		return false;
	} else if (obj.contact_person.value == "") {
		alert("Contact Person missing ....");
		obj.contact_person.focus();
		return false;
	} else if (obj.telephone.value == "") {
		alert("Telephone Number missing ....");
		obj.telephone.focus();
		return false;
	} else if (obj.inquiry.value == "") {
		alert("Comments / Enquirys not yet filled ....");
		obj.inquiry.focus();
		return false;
	} else {
		return true;
	}
}

function valid_contactForm() {
	var company_name = (document.getElementById("company_name")).value;
	var contact_name = (document.getElementById("contact_person")).value;
	var telephone    = (document.getElementById("telephone")).value;
	var email  	 = (document.getElementById("email")).value;
	var address	 = (document.getElementById("address")).value;
	var inquiry	 = (document.getElementById("inquiry")).value;
	//
	var alertMessage = new Array();	
	if (inquiry.length == 0) { alertMessage.push("- Inquiries Information\n");}
	if (address.length == 0) { alertMessage.push("- Company Address\n");}
	if (email.length == 0) { alertMessage.push("- Email Address\n");}
	if (telephone.length == 0) { alertMessage.push("- Telephone Number\n");}
	if (contact_name.length == 0) { alertMessage.push("- Contact Name\n");}
	if (company_name.length == 0) { alertMessage.push("- Company Name\n");}
	//
	var alertMsg = "Following information missing, please try again:\n";
	var alertArrayLength = alertMessage.length;
	if (alertArrayLength > 0) {
		for (var x=0;x<alertArrayLength;x++) {
			alertMsg += alertMessage.pop();
		}
		alert(alertMsg);
		return false;
	} else {
		return true;
	}
}

function newWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus(); 
	}
}

function dd_category(obj) {
	var idx = document.getElementById("um_categoryList");
	if (idx.value == 0) {
		window.location.href = 'default.php';
	} else {
		updProdView(idx.value);
	}
}

function MM_openBrWindow(url,winName,features) {
	if (url != "") window.open(url,winName,features);
}
