$(document).ready(function(){
    var content = $("ul.prices").html();
    $(".msg_body").html("<u" + "l clas" + "s = 'prices'>" + content + "</u"+ "l>" );
    $(".msg_body").show();
    $(".msg_head").click(function(){
	$(".msg_list").slideToggle(250);
    });
});

$(window).scroll(function(){
    $('.feedback-panel').animate({top:$(window).scrollTop()+200+"px" },{queue: false, duration: 350});  
});
$(function() {
    var feedbackTab = {
            speed:300,
            containerWidth:$('.feedback-panel').outerWidth(),
            containerHeight:$('.feedback-panel').outerHeight(),
            tabWidth:$('.feedback-tab').outerWidth(),
                
            init:function(){
                $('.feedback-panel').css('height',feedbackTab.containerHeight + 'px');
                $('a.feedback-tab').click(function(event){
                    if ($('.feedback-panel').hasClass('open')) {
                        $('.feedback-panel').animate({left:'-' + feedbackTab.containerWidth}, feedbackTab.speed)
                        .removeClass('open');
                    } else {
                        $('.feedback-panel').animate({left:'0'},  feedbackTab.speed)
                        .addClass('open');
                    }
                    event.preventDefault();
                });
                $('a.buy-tab').click(function(event){
                    if ($('.feedback-panel').hasClass('open')) {
                        $('.feedback-panel').animate({left:'-' + feedbackTab.containerWidth}, feedbackTab.speed)
                        .removeClass('open');
                    } else {
                        $('.feedback-panel').animate({left:'0'},  feedbackTab.speed)
                        .addClass('open');
                    }
                    event.preventDefault();
                });                
            }
    };
    feedbackTab.init();
});



function hidestories() {
    var divs=document.getElementById('stories').getElementsByTagName('div');
    for (j=0; j<divs.length; j++) {
	var rE = new RegExp("(^|\\s)" + 'story' + "(\\s|$)");
	if (rE.test(divs[j].className)) {
	    divs[j].style.display="none";
	}
    }
}

function stories(first) {
    var thebuttons=document.getElementById('thebuttons').getElementsByTagName('a');
    for (i=0; i<thebuttons.length; i++) {
	thebuttons[i].onclick=function() {
	    hidestories();
	    var thestory=(this.href).split("#",2)[1];
	    document.getElementById(thestory).style.display="block";
	    return false;
	}
    }
    if (first) {
	var firstone=document.getElementById('stories').firstChild;
	if (firstone.nodeType != 1) {firstone = firstone.nextSibling;}
	firstone.style.display="block";
    }
}

window.onload=function() {
    hidestories(); 
    stories(1);
}

function fromstory(param){
    hidestories();
    document.getElementById(param).style.display="block";
}


// Добавить в Избранное
function add_favorite(a) {
title=document.title;
url=document.location;
try {
// Internet Explorer
window.external.AddFavorite(url, title);
}
catch (e) {
try {
// Mozilla
window.sidebar.addPanel(title, url, "");
}
catch (e) {
// Opera
if (typeof(opera)=="object") {
a.rel="sidebar";
a.title=title;
a.url=url;
return true;
}
else {
// Unknown
alert('Ваш браузер не поддерживает автоматическое добавление закладок. Нажмите Ctrl+D чтобы добавить страницу в закладки.');
}
}
}
return false;
}

