function AddCart(strStock, objCart) {
	var cartBox = objCart.parentNode.getElementsByTagName('input')[0];
	if(cartBox.value > 0) {
		location.href='cart.php?Stock=' + strStock + '&qty=' + cartBox.value;
	} else {
		location.href='cart.php?Stock=' + strStock + '&qty=1';
	}
}

function submitonce(theform) {
	if (document.all||document.getElementById){
		for (i=0;i<theform.length;i++) {
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=true
			}
	}
}

function showResult(str) {
	if (str.length==0) {
		document.getElementById("livesearch").innerHTML="";
		document.getElementById("livesearch").style.border="0px";
		return;
	}

	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else {// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			if(xmlhttp.responseText != '') {
				document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
				document.getElementById("livesearch").className="suggestionBox";
				document.getElementById("livesearch").style.border = '1px solid #808080';		
			}
		}
	}
	xmlhttp.open("GET","livesearch.php?q="+str,true);
	xmlhttp.send();
}

function redisplayResult(strVal) {
	if(strVal.value != 'Search') {
		showResult(strVal.value);
	} else {
		strValue.value = '';
	}
}
