$(function(){
	// validate
	$(".validate").each(function(){
		$(this).validate();
	});
	
	$("#menu").superfish({
		hoverClass	: "sfHover",
		currentClass: "overideThisToUse",
		delay		: 800,
		animation	: {opacity:"show"},
		speed		: "normal"
	});
	
  $("a[href*='#register']").click(function(){
    if ($(this).attr("title"))
  		var title = $(this).attr("title");
    else
      var title = $(this).text();

    var url = $('#register_url').val();

		$.ajax({
		  type:'GET',
      url: url,
		  data: 'download='+$(this).attr('href'),
		  success:function(data) {
			  $.openWindow(500, 500, title, data);
		  }
		});
		return false;
  });

 $("a.popup").click(function(e){
	e.preventDefault();
	var janela;
	var url = $(this).attr("href");
	var name = "chat";
	var width = 475;
	var height = 420;
	var top = (screen.availHeight - height) / 2;
	var left = (screen.availWidth - width) / 2;
	var scroll = 'no';
	var resize = 'no';
	pop = window.open(url, name, 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=' + scroll + ', resizable=' +  resize + ', statusbar=no');
	pop.focus();
	return false;
 });
});
