function quest_bubble() {
	var quest_bubble_close  = $.Storage.get('quest_bubble_close');
	if ( quest_bubble_close == "1" ) {
		$(".quest_bubble").hide();
	}
}

$(document).ready(function(){

/* исходящие ссылки */

$(".external").each(function() {
var ext = $(this).attr("title");
if (ext) {
	$(this).attr("href","http://" + ext);
	$(this).attr("target", "_blank");
}
});

/* универсальная кнопка */

$(".view_bl").click(function(){
	var bl_nm = $(this).attr("viewid");
	if ( $("#"+bl_nm).is(":visible") ) {
		$("#"+bl_nm).fadeOut("fast"); 
	} else {
		$("#"+bl_nm).fadeIn("fast");
	}
});

/* вывод текстом "купить товар" */

$(".text_buy").live("mouseover", function(){
	//$(this).addClass("text_buy_hover");
	$(this).css("background-position","0 100%");
}).live("mouseleave", function(){
	//$(this).removeClass("text_buy_hover");
	$(this).css("background-position","0 0");
}).live("click", function(){
	var pr_url = $(this).attr("rel");
	window.location = "/product/" + pr_url;
});

/* кнопки */

$(".small_submit").live("mouseover", function(){
	$(this).attr("class", "small_submit_hover");
});

$(".small_submit_hover").live("mouseleave", function(){
	$(this).attr("class", "small_submit");
});

$(".big_submit").mouseover(function() {
	$(this).attr("class", "big_submit_hover");
}).mouseleave(function() {
	$(this).attr("class", "big_submit");
});

/* link for online chat */

$("#online_chat").attr("href", "/online/client.php?locale=ru");

/* показываем/прячем */

/* details request: показ/прячем форму */

$(".quest_close").click(function(){
	var prnt = $(this).attr("rel");
	var hrf  = $(this).attr("hrf");
	
	if (hrf) {
		window.location.href = hrf;
	}
	
	if (prnt == "2") {	
		$(this).parent().parent().fadeOut("fast");
	} else {
		$(this).parent().fadeOut("fast");	
	}
	
	$.Storage.set('quest_bubble_close', '1');
}).mouseover(function(){
	$(this).css("background-position", "bottom left");
}).mouseout(function(){
	$(this).css("background-position", "top left");
});


$("#product_help a").click(function(){
	$("#quest_close .quest_close").click();
	if ( $("#req_form").is(":visible") ) {
		$("#req_form").fadeOut("fast"); 
	} else {
		$("#req_form").fadeIn("fast");
	}
	return false;
});

});
