﻿var ListaDeMusicas="";var uri=trim(document.location.toString().replace("\/#\/","/"));var leuhome=0;var links_change=0;var marcareload=0;var entrada_1=0;var urlana="/"+replaceAll(document.location.toString().replace("\/#\/","/"),dom,"");var link_o="";var link_href="";var uri2="";var linkchange=true;var show_ads=true;var num_cl_ads=1;var cont_imp_ads=0;function ReplaceLinks(){$("a").click(function(event){linkchange=false;if($(this).attr("target")!="_blank"){if($(this).attr("href")!=null&&$(this).attr("href")!=""){link_href=$(this).attr("href");link_o=link_href.replace(dom,"").replace("/#","");link=replaceAll("/#/"+link_o,"//","/");uri2=document.location.toString().replace("\/#\/","/");link_href="/"+link_href;uri=trim(dom+link_href.replace("//",""));uri=replaceAll(uri,"/#/","/");link_o=dom+replaceAll(link,"/#/","");if(uri2!=link_o){leitura(link_o);window.location=link;}
event.preventDefault();}}
linkchange=true;});}
function leitura(uri){if(parseInt(uri.indexOf("?l=go"))>-1){uri="/#/"+uri.replace(dom,"").replace("/#","").replace("/?l=go","");window.location=uri;}else{$(document).ready(function(){$(function(){$("#loading").ajaxStart(function(){$(this).show();});$("#loading").ajaxStop(function(){$(this).hide();$("#loading").hide();$("#maincontent").show();});$.post(uri,function(data){$("#loading").hide();$("#maincontent").empty().html(data);adsense_show(false);try{var uri3=document.location.toString().replace("\/#\/","/");urchinTracker("/"+replaceAll(uri3,dom,""));}catch(err){}});window.scrollBy(0,-9999);return false;});});}}
function adsense_show(so_ads){if(so_ads&&show_ads){if(window.adIframe.location.href.length<15){ShowAnuncios("");}}else{var uri2=document.location.toString().replace("\/#\/","/");var verific=uri2.replace("//","/").split('/');var verifica=true;if(links_change==0){verifica=true;links_change=links_change+1;}else{if(links_change>=num_cl_ads){links_change=0;}else{links_change=links_change+1;}
verifica=false;}
if(verific[2]=="usuario"&&verific[4]!="amigos"){links_change=0;window.adIframe.location.href=dom+'listaslateral/amigos/'+verific[3];show_div('ad_block');hide_div("adfiliados");}else if(verific[2].length==0){hide_div("ad_block");show_div("adfiliados");}else{hide_div("adfiliados");if(verifica){if(show_ads){ShowAnuncios("");}else{hide_div("ad_block");}}}}}
function ShowAnuncios(str_entrada){show_div("ad_block");var rnum=Math.floor(Math.random()*3);if(rnum!=1){window.adIframe.location.href="http://www.suaempresa.net/comercializacao-de-banner-e-de-espaco-publicitario/clashclub.aspx"+str_entrada;}else{window.adIframe.location.href=dom+'ad/?c='+escape(window.location)+"-"+escape(document.title)+"-"+getTexto(document.getElementById("maincontent").innerHTML).substring(150,300);}
hide_div("adfiliados");}
function getTexto(str){str=str.replace(/\s+/g," ");str=str.replace(/^ /,"");str=str.replace(/ $/,"");str=str.replace(/<.*?>/g,"");str=str.replace(/^\s+|\s+$/g,"");str=replaceAll(str,"  "," ");return str;}
leitura(uri);function _observeHistory(){var uri2=trim(document.location.toString().replace("\/#\/","/"));if(uri2!=uri&&linkchange){uri=uri2;leitura(uri2);}}
intervalId=setInterval(_observeHistory,300);function setBuscaUsers(){window.location="/#/usuarios/busca?q="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["q"].value,"&","e"))+"&Estados="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["Estados"].value,"&","e"))+"&Cidade="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["Cidade"].value,"&","e"))+"&g="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["g"].value,"&","e"))+"&r="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["r"].value,"&","e"))+"&s="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["s"].value,"&","e"))+"&f="+encodeURI(replaceAll(document.forms["formbuscausers"].elements["f"].value,"&","e"));}
$(document).ready(function(){$("#formbusca").submit(function(){setBusca();return false;});});function setBusca(){var tipo=QueryString(uri.replace(dom,""),"tipo")
if(tipo!=null){tipo="&tipo="+tipo;}else{tipo="";}
leitura(dom+"busca?q="+encodeURI(replaceAll(document.forms["formbusca"].elements["busca"].value,"&","e"))+tipo);window.location="/#/busca?q="+encodeURI(replaceAll(document.forms["formbusca"].elements["busca"].value,"&","e"))+tipo;}
function conta(Divcontador,CampoValue,limitdecaracter){try{document.getElementById(Divcontador).innerHTML=document.getElementById(CampoValue).value.length;if(document.getElementById(CampoValue).value.length>=limitdecaracter){document.getElementById(CampoValue).value=document.getElementById(CampoValue).value.substring(0,limitdecaracter-1);}}
catch(err){}}
function LimparTexto(campo,styleCampo){if(campo.defaultValue==campo.value){campo.value="";}
$(campo).removeClass(styleCampo);}
function AJAX(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();return xmlHttp;}
catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");return xmlHttp;}
catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");return xmlHttp;}
catch(e){alert("Your browser does not support AJAX!");return false;}}}}
function formget(f,url,divid,loadingmessage,idform,divShow){try{var poststr=getFormValues(f);postData(url,poststr,divid,loadingmessage,idform,divShow);var formm=document.getElementById(idform);var divv=document.getElementById(loadingmessage);divv.style.display='block';formm.style.display='none';}catch(e){}}
function postData(url,parameters,divid,loadingmessage,idform,divShow){var xmlHttp=AJAX();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState>0&&xmlHttp.readyState<4){}
if(xmlHttp.readyState==4){if(xmlHttp.status==200){document.getElementById(divid).innerHTML=xmlHttp.responseText+document.getElementById(divid).innerHTML;formsubmitcomment(idform,divShow,loadingmessage);}else{alert('XmlHttpRequest error!');}}}
xmlHttp.open("POST",url,true);xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-length",parameters.length);xmlHttp.setRequestHeader("Connection","close");xmlHttp.send(parameters);}
function getFormValues(fobj){var str="";var valueArr=null;var val="";var cmd="";for(var i=0;i<fobj.elements.length;i++){switch(fobj.elements[i].type){case"text":str+=fobj.elements[i].name+"="+fobj.elements[i].value+"&";fobj.elements[i].value="";break;case"hidden":str+=fobj.elements[i].name+"="+fobj.elements[i].value+"&";break;case"textarea":str+=fobj.elements[i].name+"="+fobj.elements[i].value+"&";fobj.elements[i].value="";break;case"checkbox":if(fobj.elements[i].checked==true){str+=fobj.elements[i].name+"="+fobj.elements[i].value+"&";}
break;case"radio":if(fobj.elements[i].checked==true){str+=fobj.elements[i].name+"="+fobj.elements[i].value+"&";}
break;case"select-one":str+=fobj.elements[i].name+"="+fobj.elements[i].options[fobj.elements[i].selectedIndex].value+"&";break;}}
str=str.substr(0,(str.length-1));return str;}
function formsubmitcomment(idform,divShow,loadingmessage){try{var divv=document.getElementById(divShow);var loadingC=document.getElementById(loadingmessage);divv.style.display='block';loadingC.style.display='none';}catch(err){}}
function formsubmitcommentN(idform,divShow,tks_div){try{var divv=document.getElementById(divShow);var loadingC=document.getElementById("loadingComment");divv.style.display='block';loadingC.style.display='none';var obrig=document.getElementById(tks_div);obrig.style.display='none';}catch(err){}}
function replaceAll(string,token,newtoken){while(string.indexOf(token)!=-1){string=string.replace(token,newtoken);}
return string;}
function ZerarArray(arrayIN){arrayIN.splice(0,arrayIN.length);}
function TimeAddAll(){count=0;tempo=window.setInterval(addAll,40);}
function TimePlayAll(tipo){count=0;tempo=window.setInterval("playAll('"+tipo+"');",40);}
function addAll(){if(count>ListaDeMusicas.length-1){clearInterval(tempo);count=-1;}else{addBoxOut(ListaDeMusicas[count]+"#0#");}
count++;}
function playAll(tipo){var tipo_play="!play!";if(tipo=="c"){tipo_play="1";}
if(count>ListaDeMusicas.length-1){clearInterval(tempo);count=-1;}else if(count==ListaDeMusicas.length-1){addBoxOut(ListaDeMusicas[count]+"#!playy!#");}else if(count==0){addBoxOut(ListaDeMusicas[count]+"#!playc!#");}else{addBoxOut(ListaDeMusicas[count]+"#0#");}
count++;}
function addBoxOut(entrada){if(window.player){window.document["player"].SetVariable("musicain",entrada)};if(document.player){document.player.SetVariable("musicain",entrada)};}
function InsertPlayer(){if(AC_FL_RunContent==0){alert("This page requires AC_RunActiveContent.js.");}else{AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','300','height','380','src','/player/player?dom='+dom+'&v=1.3','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','align','middle','play','true','loop','true','scale','showall','wmode','transparent','devicefont','false','id','player','bgcolor','#000000','name','player','menu','true','allowFullScreen','true','allowScriptAccess','always','movie','/player/player?dom='+dom+'&v=1.3','salign','');}}
function ShowComentarios(uri){try{document.getElementById("side_comments").style.minHeight="500px";var xmlHttp=AJAX();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState>0&&xmlHttp.readyState<4){document.getElementById("content_coments").innerHTML='carregando...';}
if(xmlHttp.readyState==4){if(xmlHttp.status==200){document.getElementById("content_coments").innerHTML=xmlHttp.responseText;}else{alert('XmlHttpRequest error!');}}}
xmlHttp.open("GET",uri,true);xmlHttp.send(null);}catch(e){}}
var janela_state=false;function OpenDados(link,titulo){OpenDadosFlex(link,'740','400');}
function OpenDadosFlex(link,width,height){var janela='<div id="DivIframe" class="ShadowDadosConteudo" style="width:'+width+'px;height:'+height+'px;margin:-'+(height/2)+'px 0px 0px -'+(width/2)+'px;" >';janela=janela+'<a onclick="fecharalertaapenas()" class="ShadowDadosFechar">[ Fechar ]</a>';janela=janela+'<div class="ShadowDadosConteudoInside">';janela=janela+"<iframe src='"+link+"' frameBorder='no' style='width:"+width+"px;height:"+height+"px;' ></iframe>";janela=janela+'</div>';janela=janela+'</div>';document.getElementById('DivIframe').innerHTML=janela;document.getElementById("sombra").style.display='block';document.getElementById("ShadowDados").style.display='block';janela_state=true;}
function fecharalerta(){fecharalertaapenas();leitura(uri);}
function fecharalertaapenas(){document.getElementById("sombra").style.display='none';document.getElementById("ShadowDados").style.display='none';document.getElementById('DivIframe').innerHTML="";janela_state=false;if(marcareload==1){parent.window.location.reload();marcareload=0;}}
function sysmax(){var chars="01234567890123456789abcdefghiklmnopqrstuvwxyz0123456789";var string_length=20;var randomstring='';for(var i=0;i<string_length;i++){var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1);}
return randomstring;}
function trim(str){return str.replace(/^\s+|\s+$/g,"");}
function hide_div(id){if(document.getElementById(id)!=null){document.getElementById(id).style.display='none';}}
function show_div(id){if(document.getElementById(id)!=null){document.getElementById(id).style.display='block';}}
function show_div_hid(id){if(document.getElementById(id)!=null){if(document.getElementById(id).style.display=="none"){document.getElementById(id).style.display='block';}else{document.getElementById(id).style.display='none';}}}
function menuMaster(id){for(i=0;i<8;i++){if(document.getElementById("menu_"+i)!=null){changeClass("menu_"+i,"");}}
changeClass("menu_"+id,"active");}
function abhome(num,qt){for(i=1;i<=qt;i++){changeClass("banner_li_"+i,"");changeClass("novidade_"+i,"puff");}
changeClass("banner_li_"+num,"active");changeClass("novidade_"+num,"novidade_photo");}
function menuGenerico(num){for(i=1;i<=20;i++){if(document.getElementById("menu_li_"+i)!=null){changeClass("menu_li_"+i,"");hide_div("conteundo_"+i);}}
changeClass("menu_li_"+num,"active");$("#conteundo_"+num).fadeIn('slow');}
function changeClass(id,class_name){if(document.getElementById(id)!=null){document.getElementById(id).className=class_name;}}
function QueryString(uri,variavel){qs=new Array()
variaveis=uri.replace(/\x3F/,"").replace(/\x2B/g," ").split("&")
if(variaveis!=""){for(i=0;i<variaveis.length;i++){nvar=variaveis[i].split("=")
qs[nvar[0]]=unescape(nvar[1])}}
return qs[variavel]}
function grito(){m=$("#grito").val();m=replaceAll(m,"#","%23");if(m.length>3){document.getElementById("grito").value="";var xmlHttp=AJAX();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){m=replaceAll(m,"%23","#");var linkx=document.location.toString().replace("\/#\/","/");observeGritos(1);}}}
parameters="m="+m;xmlHttp.open("POST",dom+"grito/inserir/",true);xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-length",parameters.length);xmlHttp.setRequestHeader("Connection","close");xmlHttp.send(parameters);}}
function deletegrito(id){var xmlHttp=AJAX();$('#grito_delete_'+id).fadeOut('slow');$('#grito_load_'+id).fadeIn('slow');xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){for(var i=0;i<15;i++){if(document.getElementById('li_grito'+i+'_'+id)!=null){$('#li_grito'+i+'_'+id).fadeOut('slow');}}}}}
xmlHttp.open("GET",dom+"grito/delete/?idm="+id);xmlHttp.send(null);}
function comentsdelete(id){var xmlHttp=AJAX();$('#coments_delete_'+id).fadeOut('slow');$('#coments_load_'+id).fadeIn('slow');xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var ArrayMessages=xmlHttp.responseText.split('@');if(ArrayMessages.length>0){$('#coments_'+id).fadeOut('slow');}else{$('#coments_erro_'+id).fadeIn('slow');}}}}
xmlHttp.open("GET",dom+"comentarios/delete/?idm="+id);xmlHttp.send(null);}
function observeMessages(){var xmlHttp=AJAX();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var str_msn=xmlHttp.responseText;ArrayMessages=str_msn.split('@');if(ArrayMessages.length>1){document.getElementById("new_messages").innerHTML=ArrayMessages[0];document.getElementById("all_messages").innerHTML=ArrayMessages[1];if(ArrayMessages[0]!="0"){document.getElementById("messages_notifier").className="active";}else{document.getElementById("messages_notifier").className="";}}}}}
xmlHttp.open("GET",dom+"input/messages");xmlHttp.send(null);}
var StrBlockUser="";function bloquear(id){StrBlockUser=StrBlockUser+","+id;$("li.recado."+id).text("");}
function observeGritos(tipo){var xmlHttp=AJAX();xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var ultimo_grito=xmlHttp.responseText;if(ultimo_grito.length>1){ArrayGritos=ultimo_grito.split('|$|');if(ArrayGritos.length>0){for(var i=0;i<ArrayGritos.length-1;i++){if(document.getElementById("gritos_0")!=null){if(ArrayGritos[i].length>1){if(document.getElementById($(ArrayGritos[i]).attr("id"))==null){var arrayblocuser=StrBlockUser.split(",");var idUsers=($(ArrayGritos[i]).attr("id")).split("-");var idUser=idUsers[idUsers.length-1];var ShowGritoUser=true;for(y=1;y<arrayblocuser.length;y++){if(idUser==arrayblocuser[y]){ShowGritoUser=false;}}
if(ShowGritoUser){$('#gritos_0').prepend($(ArrayGritos[i]));if(i==(ArrayGritos.length-2)){$('#last_grito').text($(ArrayGritos[i]).find("p.small.titleid"+i).text());}
if(gritouser!=null){$("a.ablock.user"+gritouser).text("");}}}
$(document).ready(function(){ReplaceLinks();});}}}}}}}}
if(tipo!=5){xmlHttp.open("GET",dom+"grito/Get");}else{xmlHttp.open("GET",dom+"grito/Get/?c=5");}
xmlHttp.send(null);}
function JQslideDown(div_id){if($(div_id).is(":hidden")){$(div_id).slideDown();$("#grito_notifier").fadeOut("slow");}else{$(div_id).slideUp();$("#grito_notifier").fadeIn("slow");}}
try{xmlhttp=new XMLHttpRequest();}
catch(ee){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(E){xmlhttp=false;}}}
function mandaPais(str){if(navigator.userAgent.indexOf("MSIE")!=-1){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}else{xmlHttp=GetXmlHttpObject();}
if(xmlHttp==null){alert("Este browser não suporta HTTP Request")
return}
var url=dom+"input/estados/";url=url+""+str;xmlHttp.open("GET",url);xmlHttp.onreadystatechange=stateChanged;xmlHttp.send(null);}
function stateChanged(){if(xmlHttp.readyState==4){document.getElementById("exibeEstado").innerHTML=xmlHttp.responseText;mandaID(document.getElementById('Estados').value);}}
function mandaID(str){if(navigator.userAgent.indexOf("MSIE")!=-1){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}else{xmlHttp=GetXmlHttpObject();}
if(xmlHttp==null){alert("Este browser não suporta HTTP Request")
return}
var url=dom+"input/cidades/"
url=url+""+str
url=url+"?sid="+Math.random();xmlHttp.onreadystatechange=stateChangedC
xmlHttp.open("GET",url)
xmlHttp.send(null)}
function stateChangedC(){if(xmlHttp.readyState==4){document.getElementById("exibeCidade").innerHTML=xmlHttp.responseText;}}
function GetXmlHttpObject(){var objXMLHttp=null;if(window.XMLHttpRequest){objXMLHttp=new XMLHttpRequest()}
else if(window.ActiveXObject){objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}
return objXMLHttp}