var _wa = "", _lnk, _id, _cost, _stf;

function init(){_wa = "http://"+top.location.host;}

function bsk_id(lnk, id, cost){
_lnk = lnk;
_id = id;
_cost = cost;
$.ajax({url: _wa+"/hide/."+id+".send.html", cache: false, success: function(html){
if(html == "true"){
$("#Basket b").eq(0).html(parseInt($("#Basket b").eq(0).html())+1)
$("#Basket b").eq(1).html(parseInt($("#Basket b").eq(1).html())+_cost)
_lnk.innerText = "Перейти в корзину";
_lnk.href = "/basket/";
_lnk.onclick = "";
}}});
return false;}

function bsk_idx(lnk, id, cost){
_lnk = lnk;
_id = id;
_cost = cost;
$.ajax({url: _wa+"/hide/."+id+".send.html", cache: false, success: function(html){
if(html == "true"){
$("#Basket b").eq(0).html(parseInt($("#Basket b").eq(0).html())+1)
$("#Basket b").eq(1).html(parseInt($("#Basket b").eq(1).html())+_cost)
$("font", _lnk).get(0).innerText = "Перейти в корзину";
_lnk.href = "/basket/";
_lnk.onclick = "";
}}});
return false;}

function m_click(){
$("#sMenu > li").each(function(){
$(this).mouseover(function(){$("ul", this).css("display", "block");});
$(this).mouseleave(function(){$("ul", this).css("display", "none");});
});}

function swap(){if(_stf === this.value) this.value = "";}

function sform(){
var fr = $("#sForm");
_stf = $("input",fr).attr("value");
$("input",fr).focus(swap);
$("input",fr).blur(function(){if(this.value == '') this.value = _stf;});
$("input",fr).click(swap);
$("a",fr).click(function(){
var fr = $("#sForm");
if($("input",fr).attr("value") !== _stf) $(fr).submit();
return false;
});}

$(document).ready(function() {init(); $().piroBox({my_speed: 400, bg_alpha: 0.3, slideShow : true, slideSpeed : 4, close_all : '.piro_close,.piro_overlay'});});
$(window).load(function () {init(); m_click(); sform();});
