
function GoUpdateCarMakes(brand_id,selectid,old_make_id){
if(brand_id<=0){
upd_sel=document.getElementById(selectid);
upd_sel.options.length = 0;
upd_sel.options[0]=new Option('Не вибрано','-1');
return;
}
upd_sel=document.getElementById(selectid);
upd_sel.options.length = 0;
upd_sel.options[0]=new Option('Завантаження...','-1');

upd_sel.disabled=true;
xajax_UpdateCarMakes( brand_id,selectid,old_make_id);

}

function GoUpdateCarMakesByID(brand_field_id,selectid,old_make_id){
//alert('d');
brand_id=document.getElementById(brand_field_id).value;
if(brand_id<=0){
upd_sel=document.getElementById(selectid);
upd_sel.options.length = 0;
upd_sel.options[0]=new Option('Не вибрано','-1');
return;
}
upd_sel=document.getElementById(selectid);
upd_sel.options.length = 0;
upd_sel.options[0]=new Option('Завантаження...','-1');

upd_sel.disabled=true;
xajax_UpdateCarMakes( brand_id,selectid,old_make_id);

}
function SelectRegionFilter(url){
reg_id=document.getElementById('filter_region').value;
location.href=url+reg_id+'/';
}

function getRadioGroupValue(radioGroupObj)
{
  for (var i=0; i < radioGroupObj.length; i++)
    if (radioGroupObj[i].checked) return radioGroupObj[i].value;

  return null;
}

function PutOnMainChk(ch_box,fld_id){
 if (ch_box.checked){
  document.getElementById(fld_id).style.display='block';
 }else{
     document.getElementById(fld_id).style.display='none';
 
 }
 CalkPaySum();
}

function all_sites_click(){
if(document.getElementById('all_sites').checked==true){
	for(i=0;i<all_sites_arr.length;i++)
	{
		site_input=document.getElementById('car_site_'+all_sites_arr[i]);
		site_input.checked=true;
		
	}
}
CalkPaySum();	
}

function sites_checked(){
var cnt=0;
for(i=0;i<all_sites_arr.length;i++)
	{
		site_input=document.getElementById('car_site_'+all_sites_arr[i]);
		if(site_input.checked==true)
		{
			cnt++;	
		}
		
	}
return cnt;
}

function car_site_click(site_input){
if((site_input.checked==false)&&(document.getElementById('all_sites').checked==true)){
	document.getElementById('all_sites').checked=false;
}


CalkPaySum();	
}
function webmoneyenable(dsc){
	if(dsc.value=='wmzopen'){
	document.getElementById('pay_method2').disabled=false;
	document.getElementById('pay_on_main_method2').disabled=false;
	}
alert(getRadioGroupValue(document.advertform.pay_kind)	)
	
}

function UpdateCaptcha(imgid,img_url){
var timevar = new Date();
$('#'+imgid).attr('src',FULL_URL+img_url+"&link="+timevar.getTime());
}

