$(function()
{
  //Если ?sm=producer, то "Поиск по производителю"
  var url = getUrlVars();
  if (url["sm"]=="producer")
  {
    $("div#page_title").html("ПОИСК ПО ПРОИЗВОДИТЕЛЮ");
  }














  var form = $("#search_form_5");
  var img = form.find("input.submit_image");
  img.attr("src","http://med-express.spb.ru/images/search/sb.1233275210.blue.png");
  
  
  //поттягиваем каталог везде кроме главной
  var loc = window.location.toString();
  loc = loc.split('/');
  loc = loc[loc.length-1];
  loc = loc.split('#');
  loc = loc[0];
  if (loc != "index.php" && loc != "")
  {
    $("div.catalog_title").css("position","relative");
    $("div.catalog_title").css("top","-15px");
  
    $($("div.catalog_title").parent().parent().parent().children()[1]).children("td").children("table").css("position","relative");
    $($("div.catalog_title").parent().parent().parent().children()[1]).children("td").children("table").css("top","-15px");
  
  }
  
  
  
  var divfon = $("#divfon");
  
  var delta = $(window).width() - 988;
  
  if (divfon.length>0 && delta>0)
  {
    divfon.css("height","356px");
    divfon.css("left","988px");
    divfon.css("top","0px");
    divfon.css("width",delta+"px");
    divfon.css("background","URL('/images/top_fon.jpg') repeat-x");
  }
  
});



function getUrlVars()
{
  var vars = [], hash;
  var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  for(var i = 0; i < hashes.length; i++)
  {
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
  }
  return vars;
}
