function add_search(key){
	url="ajax_req.php?add_search="+key;
	send_req(get_req(),url);
}

function quick_search(e,key){

if(key && !get_return_key(e)) return;

k = document.getElementById('qs').value;
//alert(k);   

if(!k||k==lang['enter_words']){alert(lang['enter_keyword']);return;}
//alert(keywords);
add_search(k);
get_content('ajax_index.php?full_page=1&keywords='+k,'cont');

}

function try_search(e,k){

if(k && !get_return_key(e)) return;
//alert(k);


key = document.adv.key.value;
m = document.adv.matery_id.options[document.adv.matery_id.selectedIndex].value;
t = document.adv.texture_id.options[document.adv.texture_id.selectedIndex].value;
c = document.adv.color_id.options[document.adv.color_id.selectedIndex].value;
f = document.adv.flags.options[document.adv.flags.selectedIndex].value;
mcat = document.adv.main_cat.options[document.adv.main_cat.selectedIndex].value;
scat = document.adv.sub_cat.options[document.adv.sub_cat.selectedIndex].value;

p1 = parseInt(document.adv.price1.value);
p2 = parseInt(document.adv.price2.value);

//if(!key){alert(lang['enter_keyword']); document.adv.key.focus(); return;}

if(p1==0&&p2==0){alert(lang['null_price']); document.adv.price1.focus(); return;}

if(p1>p2){alert(lang['small_price']); document.adv.price2.focus(); return;}

var url;

url = "ajax_search.php?search=1&full_page=1";
url+= "&p1="+p1;
url+= "&p2="+p2;

if(key)url+= "&key="+key;
if(m) url+= "&m="+m;
if(t) url+= "&t="+t;
if(c) url+= "&c="+c;
if(f) url+="&f="+f;
if(scat&&scat>0) url+="&scat="+scat;
else if(mcat&&mcat>0)url+="&mcat="+mcat;

//alert(url);

add_search(key);
get_content(url,'result');

}

function inc_a(id,val){


p =document.getElementById(id);

v = parseInt(p.value);

v+=val;

if(v>999999)v=999999;
p.value=v;

}

function dec_a(id,val){
p =document.getElementById(id);

v = parseInt(p.value);

v-=val;

if(v<0)v=0;
p.value=v;

}