$(function() {
	$.ajax({
		type: 'post',
		url: 'http://www.zeremonia.ru/index.php?route=module/cart/callback',
		success: function (html) {
			$('.basket-information').html(html);
		},
		complete: function () {
		}
	});
});
function show_message()
{
    var basket_html = '<div class="pop_menu" id="pop_photo">';
    basket_html += '<div class="pop_head"><span>Корзина</span><a href="javascript:void(0);" id="pop_close"></a></div><ul>';
	basket_html += '<div class="pop_cont">Выбранный товар успешно добавлен в корзину.<br/><br/><table><tr><td><a style="padding-right:20px;" href="javascript:this.focus()" onclick="setTimeout(function a (){$(\'#pop_photo\').fadeOut(500, function () {$(\'#pop_photo\').remove();});}, 50)" class="button"><span>Продолжить покупки</span></a></td><td> <a href="index.php?route=checkout/cart" class="button"><span>Оформить заказ</b></span></td></tr></table></div>';
    basket_html += '</div>';
    $("body").append(basket_html);
    $("#pop_photo").css("top", $(window).scrollTop() + $(window).height()/2);
    $("#pop_photo").fadeIn(300).css("left", Math.round($(window).width()/2) - ($("#pop_photo div.pop_cont").innerWidth()/2));
    $("div.pop_head").width($("div.pop_cont").innerWidth());

	$("#pop_close").click(function(event){
		event.preventDefault();
		$("#pop_photo").remove();
	});
}
function add2cart()
{
	var qty = $('#count').val();
	var id = $('#product_id').val();
	var option_id = $('#fasovka').attr('name');
	var option_value = $('#fasovka').val();
	$.ajax({
		type: 'post',
		url: './index.php?route=module/cart/callback',
		dataType: 'html',
		data: "quantity="+qty+"&product_id="+id+'&'+option_id+'='+option_value,
		success: function (html) {
			$('.basket-information').html(html);
			show_message();
		},
		complete: function () {
		}
	});
}
function a2c(id_info)
{
	var qty = 1;
	var id = id_info.id.split('_')[1];
	var option_id = id_info.id.split('_')[2];
	var option_value = id_info.id.split('_')[3];
	$.ajax({
		type: 'post',
		url: './index.php?route=module/cart/callback',
		dataType: 'html',
		data: "quantity="+qty+"&product_id="+id+'&option['+option_id+']='+option_value,
		success: function (html) {
			$('.basket-information').html(html);
			show_message();
		},
		complete: function () {
		}
	});
}
function bookmark(url, title) {
	if (window.sidebar) { // firefox
    window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if(document.all) {// ie
   		window.external.AddFavorite(url, title);
	}
}

$(document).ready(function(){
  $("#navmenu-h li,#navmenu-v li").hover(
    function() { $(this).addClass("iehover"); },
    function() { $(this).removeClass("iehover"); }
  );
});
