function loadThis(e) {
	tmp = $(e).attr("class").split("|");
	
	mes = tmp[0];
	dia = tmp[1];
	
	
	
	$.ajax({
		type: "GET",
  		url: "ajax_localizarDigital.php/" + dia + "/" + mes + "/" + $("select[@name='ano']").val(),
		dataType: 'xml',
		success: function(xml){
			
			// Criando o titulo...			
			var h3 		= document.createElement('h3');
			var h3Txt 	= document.createTextNode('Produto');
			h3.appendChild( h3Txt );
			
			// Criando a lista...
			var ul = document.createElement('ul');
			
			$(xml).find('publicacao').each(function(e) {
				var li 		= document.createElement('li');
				var a 		= document.createElement('a');
				var aTxt 	= document.createTextNode( $(this).find('editoria').text()  );
				

				var url =  $(this).find('url').text();
				
				
				//a.setAttribute('onclick' , 'return loadDigital(this);' );
				a.setAttribute('href', url );
				a.setAttribute('class', ( Boolean($(this).find('odiario').text()) == true ? 'digital' : 'suplemento' ) );
				
				if ( url.indexOf('html') != -1 ) {
					a.setAttribute('target', '_blank' );
				}
				
				
				a.appendChild( aTxt );
				li.appendChild( a );
				ul.appendChild( li );
			});
			
			$("div.resultado").empty();			// Limpa o conteudo atual..
			$("div.resultado").append( h3 ); 	// Acrescenta o titulo...
			$("div.resultado").append( ul );  	// Apenas acrescenta a lista..
			//$("div.resultado").append( '<a href="javascript:void(0);" class="menu">Mostrar Menu</a>' );
		}
	});
	
	
	return false;
}

function loadDigital(e) {
	
	//alert( $(e).attr("href").substr(-4)  );
	//return false;
	//if ( $(e).attr("href").substr(-4) == "html" ) {
	//	window.open( $(e).attr("href") ,'digital','width=800,height=600,top='+(window.screen.height/2-600/2)+',left='+(window.screen.width/2-800/2)+',scrollbars=no,toolbar=no,menubar=no,status=no,location=no,resizable=no');
		
	//	return false;
	//}
	//event.returnValue = false; 
	//return false;
}


// JavaScript Document
window.onload = function(){
	navigate("","");
	$('div.menuInterativo').blindToggle('fast');
}

jQuery.fn.blindToggle = function(speed, easing, callback) {
  var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom'));
  return this.animate({marginTop: parseInt(this.css('marginTop')) < 0 ? 0 : -h}, speed, easing, callback);  
};



$(document).ready(function() {

	$("select[@name='mes']").change(function(e) {
		navigate( $(this).val() , $("select[@name='ano']").val() );
	});
	
	$("select[@name='ano']").change(function(e) {
		navigate( $("select[@name='mes']").val() , $(this).val() );
	});
	
	
	var menu = true;
	$("a.menu").click(function(e) {

		$('div.menuInterativo').blindToggle('slow', function (e) {
			if ( menu ) {
				$("a.menu").text("Esconder Menu");
				menu = false;
			} else {
				$("a.menu").text("Mostrar Menu");							
				menu = true;
			}
		});
	});
	
  flippingBook.settings.firstPageNumber = primeiraPagina;
  flippingBook.create();
  
});