function js_select(obj,itemvalue){

	for(var i=0;i<$(obj).options.length;i++)
{
 if($(obj).options[i].value == itemvalue)
 {
	 $(obj).options[i].selected = true;
	 break;
 }
}

}

function isEmail(str) {   
        var re = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;   
        return re.test(str);   
    } 
	function isEmailSpan(id) {   
        var val = document.getElementById(id);   
        if (!this.isEmail(val.value)) {   
            val.select();   
            var str = "Please enter a valid email address!";   
           	alert(str);  
            return false;   
        } else {    
            return true;   
        }   
    }   
	
price_search_errormsg="";
function cate_price_search_test(){
patrn1=/^\d*$/;
patrn2=/^[1-9][0-9]*$/;
if ($('pfrom').value!=""){
	if (!patrn1.test($('pfrom').value)){
		price_search_errormsg= price_search_errormsg + "pfrom not price! \n"
	}
}

if ($('pto').value!="") { 
	if (!patrn2.test($('pto').value)){
		price_search_errormsg = price_search_errormsg + "pto not price! \n"
	}
}

if(($('pfrom').value=="") && ($('pto').value=="")){
 price_search_errormsg+=" you must input at least one price"
}

if (($('pfrom').value!="") && ($('pto').value!="")){
	if(($('pfrom').value-$('pto').value)>0){
		price_search_errormsg+="pfrom above pto!";
	}
}

			
if (price_search_errormsg!=""){
	alert(price_search_errormsg);
	}else{
	document.search_price.submit();
	}
	price_search_errormsg="";
}
