 function deals(main){
  var p = '265px';
  var o = '40px';
  var obj1 = '#content';
  var obj2 = '#deals_conteiner';
  var h = 400+$(obj2).height()+'px';
  if($(obj1).css('paddingRight')==o){
    $('#site_conteiner').animate({height:h,minHeight:h},'fast');
    $('#deals_raz').hide('slow');
    $(obj2).show('slow');
    $(obj1).animate({paddingRight:p},'slow');
    var deals = "1";
    var date = new Date();
    date.setTime(date.getTime()+(30*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    if(main!='1'){
      document.cookie = "deals="+deals+expires+"; path=/;";
    }else{
      document.cookie = "dealsMain="+deals+expires+"; path=/;";
    }
  }else{
    $(obj2).hide('slow');
    $('#deals_raz').show('slow');
    $(obj1).animate({paddingRight:o},'slow');
    $('#site_conteiner').animate({height:'100%',minHeight:'100%'},'fast');
    var deals = "0";
    var date = new Date();
    date.setTime(date.getTime()+(30*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    if(main!='1'){
      document.cookie = "deals="+deals+expires+"; path=/;";
    }else{
      document.cookie = "dealsMain="+deals+expires+"; path=/;";
    }
  }
 }

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function varFltr(type, var1, var2){
    if(type=='price'){
        typeClass = 'price';
        $('#variation .line .price').each(function(n){
            $(this).parent('tr').css('display', 'table-row');
            price = parseInt($(this).text().replace(' ', ''));
            if(var1>0 && var2>0){ //от до
                if(price<var1 || price>var2)
                    $(this).parent('tr').css('display', 'none');
            }else if(var1>0){     //от
                if(price<var1)
                    $(this).parent('tr').css('display', 'none');
            }else if(var2>0){     //до
                if(price>var2)
                    $(this).parent('tr').css('display', 'none');
            }else
                return false;                           
        });
    }else
        return false;
}