/* opens new window */
function open_window(link,w,h)
{
var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
newWin = window.open(link,'newWin',win);
newWin.focus();
}

/* votes */
function vote(score,id,pname) 
{
var url = window.location.href;
var url = "/index.php?mark="+score+"&productID="+id+"&productName="+pname+"&vote=yes";
window.location = url;
return false;
}

/* развертывание */
$(document).ready(function(){
$("#readmore span:odd").addClass("odd");
$("#readmore span:not(.odd)").hide();
$("#readmore span:first-child").show(); 

$("#readmore span.odd").click(function(){
$(this).next("span").toggle();
});

});

/* табы */
$(function () {
var tabContainers = $('div.tabs > div');
var saved_tab = parseInt($.cookie('saved_tab')) || 0;

tabContainers.hide().filter(':eq('+saved_tab+')').show();
$('div.tabs ul.tabNavigation a').click( function () {

var index = $('div.tabs ul.tabNavigation a').index(this);
$.cookie('saved_tab', index);
tabContainers.hide();
tabContainers.filter(':eq('+index+')').show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':eq('+saved_tab+')').click();
});

/* добавить в избранное */
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;
}
