/*
This code was developed at DirectPerformance (www.directperformance.com.br) and is distributed under the Creative Commons - Attribution-NonCommercial 3.0. More details: http://creativecommons.org/licenses/by-nc/3.0/legalcode
You can freely share, transmit and adapt, but you must attribute the work to the original author information and can not use for commercial purposes.
Original Author: DirectPerformance - Website: www.directperformance.com.br - E-mail: contato@directperformance.com.br
*/

// Functions
// Le cluster vars do meta que comecem com DPC.CLUSTER.
//XXX: Need Test
function dpc_meta_var(){
	var arrCluster = new Array();
	//Set cluster vars
	jQuery("meta[name^=DPC.CLUSTER.]").each(function(){
		arrCluster.push(this.name.toLowerCase().substring(12), this.content);
	});
	if(arrCluster.length>0) dpc_cluster_array(arrCluster);
}
var dpc_location_pathname = location.pathname;
if (dpc_location_pathname) dpc_location_pathname=dpc_location_pathname.toLowerCase();

//Flash
function dpcOpenSite(url, nome){
	if (dpc_pageview) dpc_pageview(nome);
	if (dpcTracker&&dpcTracker._getLinkerUrl)
		location.href=dpcTracker._getLinkerUrl(url);
	else
		location.href=url;
}

//
jQuery(document).ready(function(){
	dpc_meta_var(); 

	var sUrl = document.location.href.toLowerCase();
	var sReferer = document.referrer.toLowerCase();

	jQuery(".thickbox").click(function (e) {     
    dpc_pageview(dpc_location_pathname+"/"+dpc_encode(jQuery(this).attr('title'))+"/clique");
    });	
//passar os parametros para os outros sites
	jQuery("a[href*='metalifepilates'],[href*='pilatesstudiofit'],[href*='negociopilates'],[href*='classificadospilates'],[href*='metalife']").mousedown(function () {
		var _url = dpcTracker._getLinkerUrl(jQuery(this).attr("href"));
	jQuery(this).attr("href",  _url);
	});
//pega o clique no banner em imagem
	jQuery("img[src*='estudios_brasil.jpg']").click(function () {
		dpc_pageview(dpc_location_pathname+"banner/estudios/click");
	})//fecha o conteudo da funcao
	
	
//Formulários


//Cadastre-se
if (dpc_location_pathname.indexOf("/cadastre-se/")>=0){ 
	var dpc_nome;
	var dpc_email;
	var dpc_telefone;
	if(jQuery('#form1').get(0)){
			dpc_autotag_form(jQuery('#form1').get(0));
		}	
	jQuery("#form1 a").click(function(){
		if (jQuery(this).text().indexOf('Cadastre-se')>=0 || jQuery(this).text().indexOf('Enviar')>=0){ 
			dpc_nome = jQuery("#form1 #nome").val();
			dpc_email = jQuery("#form1 #email").val();
			dpc_telefone = jQuery("#form1 #fone").val();
			if (dpc_location_pathname.indexOf("/cadastre-se/")>=0){ 
				dpc_pageview(dpc_location_pathname+"/cadastro/enviar");
				dpc_cluster_var("cadastro","criado","nome",dpc_nome,"email",dpc_email,"telefone",dpc_telefone);
			}
			
		}	
   });
//Criando o campo hidden para enviar as origens
	if (jQuery("#form1 input[name='dpc_ga_origem']").length==0)
		jQuery("#form1").append("<input type='hidden' name='dpc_ga_origem'>");

	jQuery("#form1 input[name='dpc_ga_origem']").val(dpc_ga_origem());   
}

});//fecha o ready








