$(function() {
   $(".widget-accordion").accordion({
      header: "h3",
      autoHeight: false
   });
   
   $('.b-change-lang select').bind('change', function() {
      location.href = $(this).val();
   });
   
   $('.ajx_item:last-child').addClass('nobrd');
   
   /*$('.show-description-txt')
      .toggle(function() {
         $(this).parent().prev().slideDown();
         $(this).text('Скрыть описание');
         $(this).addClass('open-expert-desc');
         return false;

      }, function() {
         $(this).parent().prev().slideUp();
         $(this).text('Показать описание');
         $(this).removeClass('open-expert-desc');
         return false;
      });*/

	$('.b-soc-vote').dialog({ 
		autoOpen: false,
	});

   $('#voteFacebook, .voteFacebook').click(function() {
   	console.log('!!!!!');
		var url = "http://www.facebook.com/sharer.php?s=100&p[title]="+encodeURIComponent('Sensei Brand Award 2012 ')+"&p[summary]="+encodeURIComponent($(this).attr('title'))+"&p[url]="+encodeURIComponent($(this).attr('href'))+"&p[images][0]="+encodeURIComponent($(this).attr('rel'));
		window.open(url,'','toolbar=0,status=0,width=626,height=436');
		$('.b-soc-vote').dialog('close');
		return false;
   });
      
   $('#voteVkontakte, .voteVkontakte').click(function() {
		var url = "http://vkontakte.ru/share.php?title="+encodeURIComponent('Sensei Brand Award 2012 ')+"&description="+encodeURIComponent($(this).attr('title'))+"&url="+encodeURIComponent($(this).attr('href'));
		window.open(url,'','toolbar=0,status=0,width=626,height=436');
		$('.b-soc-vote').dialog('close');
		return false;
   });

   $('#voteTwitter, .voteTwitter').click(function() {
		var url = "http://twitter.com/share?text="+encodeURIComponent($(this).attr('title'))+"&url="+encodeURIComponent($(this).attr('href'));
		window.open(url,'','toolbar=0,status=0,width=626,height=436');
		$('.b-soc-vote').dialog('close');
		return false;
   });


	/*$('#click').click(function() {
		$('.b-soc-vote').dialog('open');
		return false;
	})0;*/
      
});

function dump(obj, obj_name) {
  var result = ""
  for (var i in obj)
    result += obj_name + "." + i + " = " + obj[i] + "\n"
  alert (result);
}



function setcookie(name, value, expires, path, domain, secure) {    // Send a cookie
    expires instanceof Date ? expires = expires.toGMTString() : typeof(expires) == 'number' && (expires = (new Date(+(new Date) + expires * 1e3)).toGMTString());
    var r = [name + "=" + escape(value)], s, i;
    for(i in s = {expires: expires, path: path, domain: domain}){
        s[i] && r.push(i + "=" + s[i]);
    }
    return secure && r.push("secure"), document.cookie = r.join(";"), true;
}


