$(document).ready(function(){
	/* efeito para retirar os valores default dos campos input e textarea ao dar foto*/
	$('input[type=text],input[type=password],textarea').each(function(){
		var input = $(this);
		if(input.attr('testDV') == 'true'){
			$(this).focus(function(){
				if(this.value === this.defaultValue){
					if((this.type == 'text') && (this.id.indexOf('_PW') > -1)){
						input.css('display','none');
						var elms = document.getElementsByName(this.name.substr(0,this.name.length-1));
						if(elms.length == 1){
							$(elms[0]).css('display','').focus();
						}
					} else {
						this.value = '';
					}
				}
			});
			$(this).blur(function(){
				if(this.value == ''){
					if((this.type == 'password') && (this.id.indexOf('_PW') > -1)){
						input.css('display','none');
						var elms = document.getElementsByName(this.name+'2');
						if(elms.length == 1){
							$(elms[0]).css('display','');
						}
					} else {
						this.value = this.defaultValue;
					}
				}
			});
		}
	});
	$('select').each(function(){
		var atual = $(this);
		var atualDiv = $('#'+atual.attr('id')+'_div');
		if(atualDiv.length == 1){
			atual.removeClass('aberto').addClass('fechado');
			atual.css('z-index','10');

			atual.click(function(){
				atual.removeClass('fechado').addClass('aberto');
			}).focus(function(){
				atual.removeClass('fechado').addClass('aberto');
			}).change(function(){
				atual.css('z-index','10');
				atual.removeClass('aberto').addClass('fechado');
				atualDiv.html(this.options[this.selectedIndex].text+'<span class="sbaixo"><span></span></span>');
			});
		}
	});
	
	
	
	$('.menu li').each(function(){
		var li = $(this);
		var a = li.children('a.m');		
		var sel = true;
		var show = li.children('.show');
		
		li.hover(function(){
			sel = true;
			if(a.hasClass('sel')){
				sel = false;
			}else{
				a.addClass('sel');
			}
			show.css({'display':'block'});
		},function(){
			if(sel){
				 a.removeClass('sel');
			}					
			li.children('.show').css({'display':'none'});			
		});		
	});
	
	
	var conteudoheihgt = $('#conteudo').height();
	var rightmenu = $('#rightmenu').height();
	var pheight = conteudoheihgt - (rightmenu + 28) - 50;
	
	$('#pontilhado').height(pheight);
	
});
