$(function(){
	$('#menu ul li').hover(function(){
		$(this).addClass('hover');
		//$(this).find('.colmenu').slideDown('fast');
		$(this).find('.colmenu').show();
	},function(){
		$(this).removeClass('hover');
		//$(this).find('.colmenu').slideUp(70);
		$(this).find('.colmenu').hide();
	});
	
	
	$('input').click(function(){
		var valor = $(this).val();
		var title = $(this).attr('title');
		if(valor == title){
			$(this).val('');
		}
	});
	
	$('input').blur(function(){
		var valor = $(this).val();
		var title = $(this).attr('title');
		if(valor == ''){
			$(this).val(title);
		}
	});
});

function del(HREF){
	var confirma = confirm('Deseja realmente excluir este registro?');
	if(confirma){
		window.location = HREF;
	}
}
function openDiv(cID){
	if($('#evento'+cID).css('display') == 'none'){
		$('#evento'+cID).show();
		$('#link'+cID).removeClass('mais');
		$('#link'+cID).addClass('menos');
	}else{
		$('#evento'+cID).hide();
		$('#link'+cID).removeClass('menos');
		$('#link'+cID).addClass('mais');
	}
}

function novoPalestrante(){
	var id = $.find('.palestranteli').length;
	id = id + parseInt(1);

	var input = '';
	input += '<li id="palestranteli'+id+'" class="palestranteli">';
		input += '<a href="javascript: openDiv('+id+')" id="link'+id+'" class="mais">Palestrante '+id+'</a>';
		input += '<div id="evento'+id+'" class="views" style="display:none">';
			input += '<div class="blockLinguasAgenda">';
				input += '<div class="input text">';
					input += '<label for="FormPalestrantePtbr'+id+'">Nome do Palestrante - Português</label>';
					input += '<input type="text" value="" class="required" id="FormPalestrantePtbr'+id+'" name="palestrante['+id+'][palestrante_ptbr]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormPalestranteCargoPtbr'+id+'">Cargo do Palestrante - Português</label>';
					input += '<input type="text" value="" class="required" id="FormPalestranteCargoPtbr'+id+'" name="palestrante['+id+'][palestrante_cargo_ptbr]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormInformacaoPtbr'+id+'">Informação - Português</label>';
					input += '<textarea class="" id="FormInformacaoPtbr'+id+'" type="textarea" name="palestrante['+id+'][informacao_ptbr]"></textarea>'
				input += '</div>';
			input += '</div>';
			
			
			input += '<div class="blockLinguasAgenda">';
				input += '<div class="input text">';
					input += '<label for="FormPalestranteEn'+id+'">Nome do Palestrante - Inglês</label>';
					input += '<input type="text" value="" class="required" id="FormPalestranteEn'+id+'" name="palestrante['+id+'][palestrante_en]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormPalestranteCargoEn'+id+'">Cargo do Palestrante - Inglês</label>';
					input += '<input type="text" value="" class="required" id="FormPalestranteCargoEn'+id+'" name="palestrante['+id+'][palestrante_cargo_en]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormInformacaoEn'+id+'">Informação - Inglês</label>';
					input += '<textarea class="" id="FormInformacaoEn'+id+'" type="textarea" name="palestrante['+id+'][informacao_en]"></textarea>'
				input += '</div>';
			input += '</div>';
			
			input += '<div class="blockLinguasAgenda last">';
				input += '<div class="input text">';
					input += '<label for="FormPalestrantePtbr'+id+'">Nome do Palestrante - Espanhol</label>';
					input += '<input type="text" value="" class="required" id="FormPalestrantePtbr'+id+'" name="palestrante['+id+'][palestrante_es]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormPalestranteCargoPtbr'+id+'">Cargo do Palestrante - Espanhol</label>';
					input += '<input type="text" value="" class="required" id="FormPalestranteCargoPtbr'+id+'" name="palestrante['+id+'][palestrante_cargo_es]">'
				input += '</div>';
				input += '<div class="input text">';
					input += '<label for="FormInformacaoPtbr'+id+'">Informação - Espanhol</label>';
					input += '<textarea class="" id="FormInformacaoPtbr'+id+'" type="textarea" name="palestrante['+id+'][informacao_es]"></textarea>'
				input += '</div>';
			input += '</div>';
			
			input += '<a href="javascript: removePalestrante('+id+')">remover palestrante</a>';
		input += '</div>';
	input += '</li>';
	
	$('#PalestrantesAgenda').append(input);
}

function removePalestrante(cId){
	$('#palestranteli'+cId).remove();
}
