// JavaScript Document



// Insere flash sem borda



function swf(url, w, h, bg, vars, id) {



	



	if(bg) {



		ie_bg = '<param name="bgcolor" value="'+ bg +'" />';



		ff_bg = 'bgcolor="'+ bg +'"';			



	}else {



		ie_bg = '<param name="wmode" value="transparent" />';



		ff_bg = 'wmode="transparent"';



	}



	



	if(vars) {



		ie_vars = '<param name="flashvars" value="'+ vars +'" />';



		ff_vars = 'flashvars="'+ vars +'"';			



	}else {



		ie_vars =



		ff_vars = '';



	}



	



	cd_flash  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';



	cd_flash += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';



	cd_flash += 'width="' + w + '" ';



	cd_flash += 'height="'+ h + '" ';



	cd_flash += 'id="'+ id +'" ';



	cd_flash += 'name="'+ id +'">';



	cd_flash += '<param name="movie" value="' + url + '" />';



	cd_flash += '<param name="menu" value="false" />';



	cd_flash += '<param name="quality" value="high" />';



	cd_flash += '<param name="salign" value="tl" />';



	cd_flash += '<param name="scale" value="noscale" />';



	cd_flash += ie_bg;



	cd_flash += ie_vars;



	cd_flash += '<embed src="' + url + '" type="application/x-shockwave-flash" ';



	cd_flash += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';



	cd_flash += 'menu="false" quality="high" salign="tl" scale="noscale" ';



	cd_flash += 'width="' + w + '" ';



	cd_flash += 'height="'+ h + '" ';



	cd_flash += 'id="'+ id +'" ';



	cd_flash += ff_bg;



	cd_flash += ff_vars;



	cd_flash += '></embed>';



	cd_flash += '</object>';



	



	document.write(cd_flash);



	



}







<!--



function Exibe(valor){



    if (valor == 'Dia'){



        document.getElementById('Dia').style.display = 'block';



        document.getElementById('Cíclico').style.display = 'none';



		



    }else if (valor == 'Cíclico (diário)' || valor == 'Cíclico (mensal)' || valor == 'Cíclico (semanal)' ){



        document.getElementById('Dia').style.display = 'none';



        document.getElementById('Cíclico').style.display = 'block';



		



    }else{



		document.getElementById('Dia').style.display = 'none';



        document.getElementById('Cíclico').style.display = 'none';



	}



}

function mascara(o,f){

    v_obj=o

    v_fun=f

    setTimeout("execmascara()",1)

}



function execmascara(){

    v_obj.value=v_fun(v_obj.value)

}



function cpfr(v){

    v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito

    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos

    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos

                                             //de novo (para o segundo bloco de números)

    v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos

    return v

}

function sonum(v){

    v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito

    return v

}



//-->

function replaceChars(entry) {

out = "."; // se digitar está letra

add = ","; // troca por essa

temp = "" + entry;



while (temp.indexOf(out)>-1) {

pos= temp.indexOf(out);

temp = "" + (temp.substring(0, pos) + add +

temp.substring((pos + out.length), temp.length));

}

return temp;

}



function formatAsMoney(mnt) {

    mnt -= 0;

    mnt = (Math.round(mnt*100))/100;

    return (mnt == Math.floor(mnt)) ? mnt + ',00' 

              : ( (mnt*10 == Math.floor(mnt*10)) ? 

                       mnt + '0' : mnt);

}



function simulador(form) {

	cpm = eval(form.sp_cpm.value)

	preco = eval(form.preco.value)

	form.cpmSIM.value = cpm

	form.visuSIM.value = cpm * 1000

	form.realSIM.value = formatAsMoney(preco * cpm)

	 

	

}



function seo_url(btn, img, txt)
{
	if ($(txt).val() == "")
	{
		alert("A url do perfil não foi preenchida.");
		return;
	}
	var er = /^[0-9a-zA-Z-]+$/;
	if (!er.test($(txt).val()))
	{
		alert("A url do perfil não é válida. Os caracteres aceitos são letras (a-z ou A-Z), números (0-9) e hífen (-).");
		return;
	}
	$(img).toggle();
	$(btn).attr("disabled", true);
	$(txt).attr("readonly", "readonly");
	$.get("/seo_url.php", { "a" : "seo_url_promoter_disponibilidade", "q" : $(txt).val() },
		function(data) {
			if (data != '')
			{
				if ($(txt).val() == data)
				{
					alert("O nome escolhido para a url do seu perfil está disponível.");
				}
				else
				{
					alert("O nome escolhido para a url do seu perfil pertence a outra pessoa e não poderá ser utilizado.");
				}
			}
			else
			{
				alert("Ocorreu um erro na consulta. Por favor, tente novamente.");
			}
			$(img).toggle();
			$(btn).attr("disabled", false);
			$(txt).attr("readonly", "");
			}
	);
}

