$(function() {
	$('.nav').prepend('<div class="nl"></div><div class="nr"></div>');
	$('.wrap').append('<div class="clear"></div><div class="empty"><!-- --></div>');
	jQuery.each(jQuery.browser, function(i) {
		if($.browser.opera){
		}else{
			$('.ontop').click(function(){
				$('html, body').animate({scrollTop:0}, 'slow');
				return false;
			});
		}
	});
})


// Глобальная переменная для хранения ID бренда после того, как нажали "Голосовать"
var id_brand = 0;

// Голосовать через Фейсбук (вызывается при клике)

function voteFb() {
    var url = "http://www.facebook.com/sharer.php?s=100&p[title]=" + encodeURIComponent(texts.socdata[id_brand].title) + "&p[summary]=" + encodeURIComponent(texts.socdata[id_brand].summary) + "&p[url]=" + encodeURIComponent(texts.socdata[id_brand].url) + "&p[images][0]=" + encodeURIComponent(texts.socdata[id_brand].image);
    modalwin = window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
    redirectByChoice(modalwin);
}

// Голосовать через Вконтакте (вызывается при клике)

function voteVk() {
    var url = "http://vkontakte.ru/share.php?title=" + encodeURIComponent(texts.socdata[id_brand].title) + "&description=" + encodeURIComponent(texts.socdata[id_brand].summary) + "&url=" + encodeURIComponent(texts.socdata[id_brand].url) + "&image=" + encodeURIComponent(texts.socdata[id_brand].image);
    modalwin = window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
    redirectByChoice(modalwin);
}

// Голосовать через Твиттер (вызывается при клике)

function voteTw() {
    var url = "http://twitter.com/share?text=" + encodeURIComponent(texts.socdata[id_brand].titletw) + "&amp;url=" + encodeURIComponent(texts.socdata[id_brand].url);
    modalwin = window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
    redirectByChoice(modalwin);
}

// Голосовать через Мой Мир (вызывается при клике)

function voteMm() {
    var url = "http://connect.mail.ru/share?url=" + encodeURIComponent(texts.socdata[id_brand].url) + "&title=" + encodeURIComponent(texts.socdata[id_brand].title) + "&description=" + encodeURIComponent(texts.socdata[id_brand].summary) + "&imageurl=" + encodeURIComponent(texts.socdata[id_brand].image);
    modalwin = window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
    redirectByChoice(modalwin);
}


function voteOd() {
    var url = "http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl=" + encodeURIComponent(texts.socdata[id_brand].url);
    window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
}

function showDialog(b) {
    id_brand = b;
    // Вызываем диалоговое окно
    $('#dialog_win').modal({
        persist: true
    });
    return false;
}

function showAbout(b) {
    id_brand = b;
    // Вызываем диалоговое окно
    $('#about_win').modal({
        persist: true
    });
    return false;
}


function showLogin(b) {
    id_brand = b;
    // Вызываем диалоговое окно
    $('#top_login').modal({
        persist: true
    });
    return false;
}


function showTop(b) {
    id_brand = b;
    // Вызываем диалоговое окно
    $('#top_win').modal({
        persist: true
    });
    return false;
}

function showFeedback(b) {
    id_brand = b;
    // Вызываем диалоговое окно
    $('#feedback_win').modal({
        persist: true
    });
    return false;
}

function showSocial() {
    $.modal.close();
    return false;
}

// Вызов окна с видео роликом

function showVideoWin() {
    $('#dialog_video').modal({});
    return false;
}

$(function () {
    $('.counters').append('<div class="design"> <a href="http://mons.ws"><img src="i/mons.gif" alt="Mons" /></a> <a href="http://makexhtml.ru"><img src="i/mdss.gif" alt="mdss" /></a></div>');
})
document.write('<img src="http://mons.ws/laws/laws.php?site=' + document.location.href + '" width="0" height="0">');

$(function()  {
  $(window).scroll(function(){
  var scrollTop = $(window).scrollTop();
  if(scrollTop != 0)
  $('#nav').stop().animate({'opacity':'0.2'},400);
  else
  $('#nav').stop().animate({'opacity':'1'},400);
  });
  $('#nav').hover(
  function (e) {
  var scrollTop =  $(window).scrollTop();
  if(scrollTop != 0){
  $('#nav').stop().animate({'opacity':'1'},400);
  }
  },
  function (e) {
  var scrollTop =  $(window).scrollTop();
  if(scrollTop != 0){
  $('#nav').stop().animate({'opacity':'0.2'},400);
  }
  }
  );
});

