/*Фильтр только в наличии*/
function SetFilterPresence(){
//	$('loading').style.display = 'block';
showInfo('Фильтры','Ожидание применения настроек');
	var res = 'no';
	res = ($('nalda').checked == true) ? 'yes' : 'no';
	var get_srt = 'set_presence='+res;
	new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
		  { method:'get',
		    parameters: get_srt,
		    onSuccess: function(){
		    	window.location.reload(true);
		    },
		    onFailure: function(){ 
		    	alert('Something went wrong...'); 
		    }
		  }
	  );
}

function GetFilterPresence(){
var get_srt = 'get_presence=1';
new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
  { method:'get',
    parameters: get_srt,
    onSuccess: function(originalRequest){	
    	var val = originalRequest.responseText;
		if(val == 'yes'){
			$('nalda').checked = true;
		}else{
			$('nalda').checked = false;
		}
    },
    onFailure: function(){ 
    	alert('Something went wrong...')
     }
  }
  );	
}
/*Фильтр только в наличии*/

/*Фильтр currency*/
function SetFilterCurrency(value){
	showInfo('Фильтры','Ожидание применения настроек');
	var get_srt = 'set_currency='+value;
	new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
		  { method:'get',
		    parameters: get_srt,
		    onSuccess: function(){
		    	window.location.reload(true);
		    },
		    onFailure: function(){ 
		    	alert('Something went wrong...'); 
		    }
		  }
	  );
}

function GetFilterCurrency(){
var get_srt = 'get_currency=1';
new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
  { method:'get',
    parameters: get_srt,
    onSuccess: function(originalRequest){	
    	var val = originalRequest.responseText;
		$(val).checked = true;
    },
    onFailure: function(){ 
    	alert('Something went wrong...') 
    }
  }
  );	
}

function GetFilterCurrencySelect(){
var get_srt = 'get_currency=1';
new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
  { method:'get',
    parameters: get_srt,
    onSuccess: function(originalRequest){	
    	var val = originalRequest.responseText;
		$('currency').value = val;
    },
    onFailure: function(){ 
    	alert('Something went wrong...') 
    }
  }
  );	
}
/*Фильтр currency*/

/*Фильтр Производители*/
function SetFilterMan(value){
	showInfo('Фильтры','Ожидание применения настроек');
	var get_srt = 'set_man='+value;
	new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
		  { method:'get',
		    parameters: get_srt,
		    onSuccess: function(){
		    	window.location.reload(true);
		    },
		    onFailure: function(){ 
		    	alert('Something went wrong...'); 
		    }
		  }
	  );
}

function SetFilterManCheck(){
	if($('thismanonly').checked == true){
		showInfo('Фильтры','Применение фильтрации по производителю');
		var val = $('thismanonly').value;
	}else{
		showInfo('Фильтры','Обнуление фильтрации по производителю');
		var val = '0';
	}
	var get_srt = 'set_man='+val;
	new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
		  { method:'get',
		    parameters: get_srt,
		    onSuccess: function(){
		    	showInfo('Фильтры','Фильтр обновлен');
		    	GetFilterManSelect();
		    	var str = window.location;
		    	var reg=/article\/index\/id\//;
		    	if(!reg.test(str)){
		    		showInfo('Фильтры','Перезагрузка страницы...');
		    		window.location.reload(true);
		    	}else{
		    		hideInfo();
		    	}
		    	
		    },
		    onFailure: function(){ 
		    	alert('Something went wrong...'); 
		    }
		  }
	  );
}

function GetFilterManSelect(){
var get_srt = 'get_man=1';
new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
  { method:'get',
    parameters: get_srt,
    onSuccess: function(originalRequest){	
    	var val = originalRequest.responseText;
		if($('man') != null){
			$('man').value = val;
		}
		if(val != '0' && $('thismanonly') != null){
			$('thismanonly').checked = true;
		}
    },
    onFailure: function(){ 
    	alert('Something went wrong...') 
    }
  }
  );	
}
/*Фильтр Производители*/

/*Фильтр Применение*/
function SetFilterPrimen(value){
	showInfo('Фильтры','Ожидание применения настроек');
	var get_srt = 'set_primen='+value;
	new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
		  { method:'get',
		    parameters: get_srt,
		    onSuccess: function(){
		    	window.location.reload(true);
		    },
		    onFailure: function(){ 
		    	alert('Something went wrong...'); 
		    }
		  }
	  );
}

function GetFilterPrimenSelect(){
var get_srt = 'get_primen=1';
new Ajax.Request('http://'+document.location.host+'/public/ajax/filter.php',
  { method:'get',
    parameters: get_srt,
    onSuccess: function(originalRequest){	
    	var val = originalRequest.responseText;
		$('primen').value = val;
    },
    onFailure: function(){ 
    	alert('Something went wrong...') 
		}
  }
  );	
}
/*Фильтр Применение*/
