function busqueda()
{
	var search=document.all("txtSearch").value;

    if (search=="Search by keyword/code#") {search="";document.all("txtSearch").value="";}

	if (search=="")
	{
		alert("text enters");
		document.all("txtSearch").focus();
		return;
	}	
	//alert("sddsafsd");
	window.location.href="http://www.architecturalsalvagenewyork.com/search.aspx?id="+document.all("txtSearch").value; 
} 

function busquedaEnter(e){
	if(e && e.which){
	 e = e
	 characterCode = e.which
	 }
	 else{
	 e = event
	 characterCode = e.keyCode
	 }	
	
	//var x=event.keyCode;
	if (characterCode==13)
	{
	busqueda()
	}
}

function search_dimensions()
{
	if (document.all("txtWidthD").value == "" || document.all("txtWidthH").value == "" || document.all("txtHeightD").value == "" || document.all("txtHeightH").value == "")
	{ 
	alert ("The value by must numeric"); 
	} else {
	window.location.href="search-by-dimensions-results.aspx?category=" + document.all("ddlSubCategorias").value + "&w_min=" + document.all("txtWidthD").value + "&w_max=" + document.all("txtWidthH").value + "&h_min=" + document.all("txtHeightD").value + "&h_max=" + document.all("txtHeightH").value;
} }

function search_price()
{
	if (document.all("txtPrice1").value == "" || document.all("txtPrice2").value == "")
	{ alert ("The value by must numeric"); } else {
//-----funcion para que reconozca el value del radiobutton-----\\
	   var radios = document.getElementsByName("orden");
	   var sel_value = null;
	   for(i=0; i<radios.length; i++)
	   {
		  if(radios[i].checked)
			 sel_value = radios[i].value;
	   }
//-----fin funcion para que reconozca el value del radiobutton-----\\
		window.location.href="search-by-price-results.aspx?category=" + document.all("ddlSubCategorias").value + "&price_min=" + document.all("txtPrice1").value + "&price_max=" + document.all("txtPrice2").value + "&order=" + sel_value;
	}
}
var sumar = 0;
function Sumar(obj)
{
    var identificador=obj.name;
		if (obj.checked == true)
		{	
			if (sumar < 5)
				{
				sumar++
				document.form1.txtCodigos.value=document.form1.txtCodigos.value + identificador + '-';
				} else {
				obj.checked = false;
				alert ("You only can select five items "+sumar);
				}
		} else {
			sumar--
			document.form1.txtCodigos.value=document.form1.txtCodigos.value.replace(identificador+'-',"");
		}
}
function Enviar()
{
	var total = document.form1.txtCodigos.value.length;
	var cadena = document.form1.txtCodigos.value.substring(total-1,total);
	//alert (cadena);
	if (cadena == "-")
	{
		document.form1.txtCodigos.value = document.form1.txtCodigos.value.substring(0,total-1);
	}
	if (document.form1.txtCodigos.value != "")
	{
		window.location.href="compare.aspx?id="+document.form1.txtCodigos.value;
	} else {
		alert ("You must select items to Compare");
	}
}