// JavaScript Document

$(document).ready(function(){
	
	$('.conteudoBloco').mouseover(function(){
		$(this).css('background-color', '#555353');/*'#09A0D9');*/
		$(this).height($(this).parent().height());
	}).mouseout(function(){
		$(this).css('background-color','transparent');
	});
	
	$('.menuItem').click(function(){
		if ($(this).attr('status') == 'off') {
			abaTurnOff($('#menu').find('div[status=on]'));
			abaTurnOn($(this));
		}
	});
	
	$('.inputText').each(function(){
		var inputLeft = $('<div></div>');
		var inputCenter = $('<div></div>');
		var inputRight = $('<div></div>');
		var input = $('<input>');
		
		$(inputLeft).addClass('inputLeft');
		$(inputCenter).addClass('inputCenter');
		$(inputRight).addClass('inputRight');
		$(input).attr('name',$(this).attr('name')).attr('id',$(this).attr('id')).attr('type',$(this).attr('type')).attr('Value',$(this).attr('value')).width($(this).width()-10).css('border','none');
		$(inputCenter).append(input);
		
		$(this).append(inputLeft).append(inputCenter).append(inputRight);
	}	
	);
	
	
	// $('menuItemCenter').mouseover(function(){
		// if ($(this).attr('status') == 'off'){
			// $(this).css('background-color','#FFFFFF');
			// $(this).height($(this).parent().height());
		// }}).mouseout(function(){
			// if ($(this).attr('status') == 'off'){
				// $(this).css('background-color','#8B8B8B');
			// }
		// }
	// )

});

function abaTurnOn(div)
{
	$(div).find('.menuItemLeft,.menuItemRight').css('background-position','0px 0px');
	$(div).find('.menuItemCenter').css({'color':'#FFFFFF','background-color':'#0C95CC'});
	$(div).attr('status','on').css('z-index',10);

}


function abaTurnOff(div)
{
	$(div).find('.menuItemLeft,.menuItemRight').css('background-position','0px -31px');
	$(div).find('.menuItemCenter').css({'color':'#8B8B8B','background-color':'#545353'});
	$(div).attr('status','off').css('z-index',$(div).attr('zindex'));
}


/* Função de carregando de páginas em DIVs

   function loadOnDiv(valor){  
   var url = valor;  
      
   xmlRequest.open("GET",url,true);  
   xmlRequest.onreadystatechange = mudancaEstado;  
   xmlRequest.send(null);  
      
   if (xmlRequest.readyState == 1) {  
   document.getElementById("main").innerHTML = "<img src='loader.gif'>";  
   }  
     
   return url;  
   }  
    
   function mudancaEstado(){  
   if (xmlRequest.readyState == 4){  
   document.getElementById("main").innerHTML = xmlRequest.responseText;  
}  
}

/*  GET XML/HTTP function 
function GetXMLHttp() {  
if(navigator.appName == "Microsoft Internet Explorer") {  
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  
}  
else {  
xmlHttp = new XMLHttpRequest();  
}  
return xmlHttp;  
}  
   
var xmlRequest = GetXMLHttp();*/