///////////////////////////////////
// SITE SERIDÓ FEST (www.seridofest.com.br)
// TEXT JAVASCRIP - BY LEYDSON
///////////////////////////////////

function tableOver(src, color, linkon) {
	if(linkon == 1){
			src.style.cursor = 'pointer';
	}
			src.bgColor = color;
}

function tableOut(src, color, linkon) {
	if(linkon == 1){
			src.style.cursor = 'default';
	}
			src.bgColor = color;
}

function addFavorite() {
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite ("http://www.seridofest.com.br","Seridó Fest - Os melhores eventos estão aqui.");
	}else {
		window.sidebar.addPanel('Seridó Fest - Os Melhores eventos estão aqui.', 'http://www.seridofest.com.br', '');
	   }
}

function updateHomePage(src) {
src.style.behavior='url(#default#homepage)';
src.setHomePage('www.seridofest.com.br');
}

// Seleciona Tempo da cidade
function selectCityTemp(targ,selObj,restore){ //v3.0
  eval(targ+".location='http://selos.climatempo.com.br/selos/MostraSelo.php?CODCIDADE="+selObj.options[selObj.selectedIndex].value+"&SKIN=preto'");
  if (restore) selObj.selectedIndex=0;
}
function selectCityTemp2(targ,selObj,restore){ //v3.0
  eval(targ+".location='http://tempoagora.uol.com.br/selos/custom/selo_3dias.php?cid="+selObj.options[selObj.selectedIndex].value+"&height=166&cor=000000'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// Selecione o menu que ele vai
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openPopup(theURL, winName, width, height) {
	var screenx=(screen.width/2)-350;
 	var screeny=(screen.height/2)-325;
	var features1 = 'toolbar=0, location=0, status=0, menubar=0, scrollbars=auto, resizable=0, top=10, left=10, width='+width+', height='+height;
	
	//var page1 = window.open('about:blank', winName, features1);
	var page1 = window.open(theURL, winName, features1);
	
 	var HTML="<table width=\"100%\" border=\"0\" cellpadding=\"0\" height=\"100%\" align=\"center\">"+
 	"<tr><td bgcolor=\"#000000\" colspan=\"0\" height=\"59\">"+
	"<div align=\"center\"> <font color=\"#FFFFFF\" size=\"1\"><b><font face=\"Verdana, Arial, Helvetica, sans-serif\">"+ 
	textCenterAjaxLoad +
 	"</font></b></font></div>"+
 	"</td></tr></table>";
	
	page1.document.write(HTML);
	
 	//for (i=0;i<200;i++) {
 	page1.open(theURL, winName, features1);
 	page1.focus();
	//}

}

function compVote(){
document.getElementById('buttonPostPoll').disabled = false;
}

function compVote2(val){
document.getElementById('buttonSend').disabled = false;
document.frmvoteevent.note.value = val;
}

function createSWF(id, file, width, height){
 
	document.writeln('<object type="application/x-shockwave-flash" data= "' + file + '" width="' + width + '" height="' + height + '" id="' + id + '" name="' + id + '">');
	document.writeln('<param name="movie" value="' + file + '" />');
	document.writeln('<param name="wmode" value="transparent" />');
	document.writeln('<param name="menu" value="false" />');
  	document.writeln('</object>');
	
}

function selectEmoticon(image) {
		document.frmmural.emoticon.value = image;
		document.images.openemoticon.src = 'img/emoticons/' + image + '.gif';
		document.getElementById("viewEmoticon").style.display="none";
}

function selectEmoticonComments(image) {
		document.frmcomments.emoticon.value = image;
		document.getElementById("openemoticon").src = '../img/emoticons/' + image + '.gif';
		document.getElementById("viewEmoticon").style.display="none";
}

function addEmoticon() {
		document.getElementById("viewEmoticon").style.display="block";
}


function selectSubject(value){
	if(value == '5'){
		document.getElementById("viewSubject").style.display="block";
	}else{
		document.getElementById("viewSubject").style.display="none";
	}
}



function selectTypeEvent(value){
	if(value == '1'){
		document.getElementById("viewTypeEvent").style.display="block";
	}else{
		document.getElementById("viewTypeEvent").style.display="none";
	}
}

function formatMoney(input ,size, pressKey) {
var key = pressKey.keyCode;
vr = input.value;
vr = vr.replace( "/", "" );
vr = vr.replace( "/", "" );
vr = vr.replace( ",", "" );
vr = vr.replace( ".", "" );
vr = vr.replace( ".", "" );
vr = vr.replace( ".", "" );
vr = vr.replace( ".", "" );
tam = vr.length;
if (tam < size && key != 8){ tam = vr.length + 1; }
if (key == 8 ){ tam = tam - 1; }
if ( key == 8 || key >= 48 && key <= 57 || key >= 96 && key <= 105 ){
if ( tam <= 2 ){ 
input.value = vr; }
if ( (tam > 2) && (tam <= 5) ){
input.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ); }
if ( (tam >= 6) && (tam <= 8) ){
input.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
if ( (tam >= 9) && (tam <= 11) ){
input.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
if ( (tam >= 12) && (tam <= 14) ){
input.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
if ( (tam >= 15) && (tam <= 17) ){
input.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam );}
}
}

function countCharacters(fd, number) {
	(fd.value.length>number) ? fd.value=fd.value.substring(0,number):
	document.getElementById('viewCountCharacters').childNodes[0].data=(number-fd.value.length);
}

// Go sound to index seridofest.com.br
function playSound(sound){
       if(navigator.userAgent.indexOf("MSIE") != -1){
          document.writeln('<bgsound src='+sound+' loop=1 autostart=true>');
       }else{
          document.writeln('<embed classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 src='+sound+' loop=1 autostart=true></embed>');
		  
       }
}
function selecionar_todas(frm) {
    for(i = 1; i < frm.length; i++) {
        if(frm.elements[i].type == "checkbox") {
            frm.elements[i].checked = frm.elements[i].checked ? false : true
        }
     }
}

function check(frm) {  
   frm = (!formulario || frm=="") ? document.forms[0] : frm;  
   with(frm) {  
         for(i=0;i<elements.length;i++) {  
            if(elements[i].type == 'checkbox')  
            elements[i].checked = !elements[i].checked;     
         }  
   }  
}

function selectDoc(obj, frm){
if(obj == "rg"){
layer1.style.display="block";
layer2.style.display="none";
document.frm.cpf.value="";
document.frm.rg.focus();
}
if(obj == "cpf"){
layer1.style.display="none";
layer2.style.display="block";
document.frm.rg.value="";
document.frm.cpf.focus();
}
}

function loadBannerFloater(){
	document.getElementById('bannerFloater').style.display='block';
	window.setTimeout("document.getElementById('bannerFloater').style.display='none'", 15000);
}

function loadBanner468x60() {
window.banner468x60.location.reload();
}

function loadFunctionsBroadCast(idBroadCast){
pageRequest('broadCastStats&idb='+ idBroadCast, 'pagestats');
//loadBanner468x60();
window.setTimeout("loadFunctionsBroadCast("+idBroadCast+");", 40000);
}

function loadFunctions(){
loading_stoptime('6');
pageRequest('reload', 'pagestats');
//loadBanner468x60();
window.setTimeout("loadFunctions();", 40000);
}


function closeBannerFloater(){
	document.getElementById("bannerFloater").style.display="none";
}
function openBannerFloater(){
	document.getElementById("bannerFloater").style.display="block";
}
