	var http_request = false;
	var tempTxt;
	function makeRequest(url,txt) {  
	//alert('ok'); return false;
//	alert(url+txt)
		http_request = false;
		tempTxt=txt;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
			}
		} else if (window.ActiveXObject) { // IE
			try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	
	if (!http_request) {
	alert('Giving up :( Cannot create an XMLHTTP instance');
	return false;
	}
	
	http_request.onreadystatechange = alertContents;
	http_request.open('GET', url, true);
	http_request.send(null);
	
	}
	
function allowInteger(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode;
	if (unicode!=8)
	{ //if the key isn't the backspace key (which we should allow)
		if (unicode<48||unicode>57) //if not a number
			return false; //disable key press
	}
}

function alertContents() 
{
	if (http_request.readyState == 4) 
	{
		//alert(http_request.status);
		if (http_request.status == 200) 
		{
//			alert(http_request.responseText);
			var resul = http_request.responseText;
			document.getElementById(tempTxt).innerHTML=resul;
		} 
		else 
		{
			alert('There was a problem with the request.');
		}
	}
	else if (http_request.readyState == 1)// && (tempTxt == 'bCode' || tempTxt == 'scan_qty' || tempTxt == 'showDetail'))
	{ 
//		document.getElementById(tempTxt).innerHTML = "<img src='images/loading.gif' border=0>";
		document.getElementById(tempTxt).innerHTML = "";
	}
}

function setImage(pid,imgID, cat, number, img_type)
{
	if(img_type=="main_img")
		wheretowrite = "main_img";
	else
		wheretowrite = "combo_img";
	if(pid > 0 && imgID > 0)
	{   //alert('Hello')	
		var strVariables ='action=setNewImage&proID='+pid+'&imgID='+imgID+'&cat='+cat+'&number='+number;
		//alert('strVar'+strVariables)
		makeRequest("include/ajax_function.php?"+strVariables, wheretowrite);
		
	}
}

function get_pruduct_search(value)
{
//	alert(value)
//makeRequest("include/select_search.php?action="+value, 'product_search');
	document.getElementById('product_search').style.display="none";
	document.getElementById('product_search1').style.display="none";
	document.getElementById('product_search2').style.display="none";
	document.getElementById('product_search3').style.display="none";
	document.getElementById('product_search4').style.display="none";
	
	if(value == 'product'){
		document.getElementById('product_search').style.display="block";
	}else if(value == 'category'){
		document.getElementById('product_search1').style.display="block";
	}else if(value == 'color'){
		document.getElementById('product_search2').style.display="block";
	}else if(value == 'priceSearch'){
		document.getElementById('product_search3').style.display="block";
	}else if(value == 'lookSearch'){
		document.getElementById('product_search4').style.display="block";
	}else{
		document.getElementById('product_search').style.display="block";
	}
}
