function search()
{		
	var fprice=document.getElementById('txtPriceFrom').value;
	var tprice=document.getElementById('txtPriceTo').value;
	if(isNaN(fprice)) 
	{
		alert("Enter valid price range");
		document.getElementById('txtPriceFrom').focus();
		return false;
	}
	if(fprice.charAt(0)=='-')
	{
		alert("Price should not be negative");		
		document.getElementById('txtPriceFrom').focus();
		return false;
	}
	if(isNaN(tprice)) 
	{
		alert("Enter valid price range");
		document.getElementById('txtPriceTo').focus();
		return false;
	}	
	if(tprice.charAt(0)=='-')
	{
		alert("Price should not be negative");
		document.getElementById('txtPriceTo').focus();
		return false;
	}
	var temp=document.forms[0];
	temp.action='index.php?action=search';
	temp.submit();
}
function lastposted(val)
{
	document.forms[0].pastday.value=val;
	var temp=document.forms[0];
	temp.action='index.php?action=pastindex';
	temp.submit();
}
function tellfriend(id,url)
{
	document.forms[0].productid.value=id;
	document.forms[0].producturl.value=url;
	var temp=document.forms[0];
	temp.action='sendmail.php?action=send';
	temp.submit();
}
function popup(id)
{
	 var branchid = id;
	 var url='branchview.php?sellerid='+branchid+'';
	 var width  = 500;
	 var height = 180;
	 var left   = (screen.width  - width)/2;
	 var top    = (screen.height - height)/2;
	 var params = 'width='+width+', height='+height;
	 params += ', top='+top+', left='+left;
	 params += ', directories=no';
	 params += ', location=yes';
	 params += ', menubar=no';
	 params += ', resizable=no';
	 params += ', scrollbars=yes';
	 params += ', status=no';
	 params += ', toolbar=no';
	 newwin=window.open(url,'windowname5', params);
	 if (window.focus) {newwin.focus()}
	 return false;
}
function submitenter(myfield,e)
{
var keycode;

if (window.event) {
  keycode = window.event.keyCode;
}
else if (e) {
  keycode = e.which;
}    
else {
  return true;
}

if (keycode == 13)
   { 	 
     search();
   }
else
   return true;
}


