21
| <![CDATA[<script type="text/javascript">
function removeSelectOptions(objId,remove_first){var obj,i,first;if(typeof(remove_first)=='undefined'){remove_first=false;}obj=document.getElementById(objId);if(remove_first){first=0;}else{first=1;}for(i=(obj.length-1);i>=first;i--){obj.remove(i);}}
function addSelectOption(objId,value,text){var obj,op;obj=document.getElementById(objId);op=document.createElement('option');op.value=value;op.text=text;try{obj.add(op,null);}catch(ex){obj.add(op);}/*IESucks*/}
function mudapagina(offset, frmname) {
if (typeof(frmname)=="undefined") {
frmname = "frmPaginacao";
}
if ( frmname.indexOf("#")!=0 ) {
frmname = "#"+frmname;
}
if (typeof(offset)=="undefined") {
offset = $(frmname+" #paginaatual").val();
}
if ( $(frmname).length != 0) {
var a = $(frmname+" #controller").val();
var m = $(frmname+" #method").val();
var target = $(frmname+" #targetelement").val();
load(a,m,$(frmname).serialize()+"&pagina="+offset, target, null, null, null, null, false);
}else{
console.info("not");
}
}
function loadAgendas() {
var municipio = 95;
var div = $("#index_agendas");
$.ajax({
url: 'https://www.sic.cultura.pr.gov.br/service/agendastodas/'+municipio,
type: "GET",
data: null,
dataType: "json",
beforeSend: function() {
div.html('<img src="images/ajax-indicator-transparent.gif">');
},
async: true,
success: function(data){
if ( data.length >0 ) {
addAgendas(data);
}else{
div.html("<div>Não há agendas para o município consultado</div>");
}
}
});
}
function addAgendas(agendas) {
var html = "";
$.each( agendas, function( i, agenda ) {
var target = '#';
if (agenda.codequipamentoagenda) {
target = 'agendadetalhes.php?agenda='+agenda.codequipamentoagenda;
}else{
target = 'agendadetalhesa.php?agenda='+agenda.codatividadeagenda;
}
html+=
'<div class="card">' +
'<div class="evento" style="">' +
'<div class="data">' +
'<div class="dia">' +agenda.diainicio+ '</div>' +
'<div class="mes">' +agenda.mesinicio+ '</div>' +
'</div>' +
'<div class="info">' +
'<div class="titulo">' +agenda.descricaoagenda+ '</div>' +
'<div class="inicio"><b>Inicio:</b> ' +agenda.datainicial+' '+agenda.horario+ '</div>' +
'<div class="local"><b>Local:</b> ' +agenda.nomeequipamento+ '</div>' +
'<a href="'+target+'">saiba mais >></a>' +
'</div>' +
'</div>' +
'</div>'
;
});
$("#index_agendas").html(html);
}
function load(a, m, params, target, beforeSend) {
var error=false;
if (typeof(a)=="undefined") {error = true;}
if (typeof(m)=="undefined") {error = true;}
if (typeof(params)=="undefined") {params = "";}
if (typeof(target)=="undefined") {target = "secondary_content";}
if (typeof(beforeSend)=="undefined") { beforeSend = ""; }
var p = "_a="+a+"&_m="+m;
if (params!="") {
p+="&"+params;
}
if (!error) {
$.ajax({
url: 'https://www.sic.cultura.pr.gov.br/xhandler.php',
type: "POST",
data: p,
dataType: "xml",
beforeSend: function(){
if (beforeSend!="") {
eval(beforeSend);
}
$("#spinner").show();
},
complete: function(){
$("#spinner").hide();
},
async: true,
success: function(xml){
var mensagem, datascript, datahtml, selectoptions_haschild, selectoptions, elementattributes, cleardom_haschild, cleardom;
$(xml).find('handler').each(function(){
mensagem = $(this).find('mensagem').text();
datascript = $(this).find('datascript').text();
datahtml = $(this).find('datahtml').text();
selectoptions_haschild = $(this).find('selectoptions').text();
selectoptions = $(this).find('selectoptions');
elementattributes = $(this).find('elementattributes').text();
cleardom_haschild = $(this).find('cleardom').text();
cleardom = $(this).find('cleardom');
});
if (cleardom_haschild.length>0) {
$(cleardom).find("element").each(function(){
var el;
if ( $(this).text() == "pesquisar" ) { el = "#main_conteudo_"+$(this).text(); }
else if ( $(this).text() == "editar" ) { el = "#main_conteudo_"+$(this).text(); }
else if ( $(this).text() == "mosaico" ) { el = "#main_conteudo_"+$(this).text(); }
else { el = "#"+$(this).text(); }
$(el).empty();
});
}
if (mensagem.length>0) {
$("#main_statusbar").html(mensagem);
}
if (datascript.length>0) {
var script = datascript.replace("<script type='text/javascript'>", "").replace('<\/script>', '');
eval(script);
}
if (selectoptions_haschild.length>0) {
var selectId;
var selectedValue = "";
$(selectoptions).find("element").each(function(){
selectId = $(this).attr("id");
$(this).find("option").each(function(){
addSelectOption(selectId, $(this).find("value").text(), $(this).find("text").text());
if ($(this).find("selected").text()=="1") { selectedValue = $(this).find("value").text(); }
});
if (selectedValue!="") { $("#"+selectId).val(selectedValue); }
});
}
if (elementattributes.length>0) {
$("#main_datascript").html(elementattributes);
}
if (datahtml.length>0) {
if (target=="secondary_content") {
var p = $("#primary_content");
var s = $("#secondary_content");
if (p.is(":visible")) {
p.fadeOut("fast", function() {s.empty().html(datahtml);s.fadeIn("fast");});
}else{
s.empty().html(datahtml);
}
}else{
var tt = $("#"+target);
tt.empty().html(datahtml);
}
}
}
});
}
}
function roulette() {
var i = Math.floor(Math.random() * 28)+1;
var img = 'images/new/roulette/img'+i+'.jpg';
var image = $("#roulette");
image.fadeOut('fast', function () {
image.attr('src', img);
image.fadeIn('slow');
});
setTimeout('roulette()', 5000);
}
</script>]]>
|