var server = location.protocol + "//" + location.host + (location.port != "" ? ":" + location.port: "")
var debug = false;

$().ajaxError(function(ev,xhr,o,err) {
/*    if (window.console && window.console.log)  {
		if(xhr.status==0){
			alert('You are offline!!\n Please Check Your Network.');
		}else if(xhr.status==404){
			alert('Requested URL not found.');
		}else if(xhr.status==500){
			alert('Internel Server Error.');
		}else if(err=='parsererror'){
			alert('Error.\nParsing JSON Request failed.');
		}else if(err=='timeout'){
			alert('Request Time out.');
		}else {
//			alert('Unknow Error.\n'+xhr.responseText);
		}
		if (window.console.log) {
			path = location.protocol + "//" + location.host + (location.port != "" ? ":" + location.port: "") + "" + o.url 
			console.log("erro : " + err + " url:\n"  + path + "\n" + ev + ":" + xhr + ":" + xhr.status + ":" + xhr.responseText);
		}
	}
*/	
});

$.ajaxSetup({
   type: "GET",
   contentType: "text/html; charset=iso-8859-1",
   beforeSend: function(xhr,req){
	if (debug) { console.log(req.url) }
   },
   complete: function(xhr){
//     if (window.console.log) { console.log(xhr.responseText) }
   }
});

function insereConteudo(path) {
	var file = server + path
	$.ajax({
		url: file,
		cache: false,
		resetForm: true,
		success: exibeConteudo,
		timeout: 2000
	});
}

function exibeConteudo(responseText, statusText) {
	var conteudo = $('#conteudo2')
	conteudo.html(responseText.replace("<link","<!link"))
	conteudo.css('width','750px')
	conteudo.css('height','480px')
	conteudo.css('overflow','auto')
	conteudo.css('padding','10px')
	montaFaq()
}

function abrirJanela(caminho) {
	window.open(caminho)
}


function abrirPDF(path) {
	var file = server + path
	var conteudo = $('#conteudo2')
	conteudo.html('<iframe id=pdf name=pdf src="' + file + '" border=0 width=750px height=480px allowtransparency="yes" frameborder="0" scrolling="no"></iframe>')
	conteudo.css('width','750px')
	conteudo.css('height','480px')
	conteudo.css('overflow','auto')
	conteudo.css('padding','10px')
}


function abrirPag(path) {
	var file = path
	var conteudo = $('#conteudo2')
	conteudo.html('<iframe src="' + file + '" border=0 width=750px height=480px allowtransparency="yes" frameborder="0" scrolling="no" ></iframe>')
	conteudo.css('width','750px')
	conteudo.css('height','480px')
	conteudo.css('overflow','auto')
	conteudo.css('padding','10px')
}

jQuery(document).ready(function(){	
	insereConteudo('/eleicoes/2010/paginas/OrdemVotacao.html')
	montaFaq()
})
			  
function montaFaq() {
	$('span.pergunta').css('cursor','hand');
	$('span.pergunta').click(
	  function(){  
	  	$('span.resposta').hide('fast')
	  	$(this).next().show('fast')
     }  
     );		
}
			   
function exibeResposta(obj) {
	alert(obj)		
}