
var dpc_location_pathname = location.pathname;
if (dpc_location_pathname) dpc_location_pathname=dpc_location_pathname.toLowerCase();

function dpc_f(c){
	return String.fromCharCode(c);
}
// copiado de:http://www.codigofonte.com.br/codigo/js-dhtml/strings/funcao-replaceall-em-javascript
function dpc_replaceall(de, para){
    var str = this;
    var pos = str.indexOf(de);
    while (pos > -1){
		str = str.replace(de, para);
		pos = str.indexOf(de);
	}
    return (str);
}
//based on tr() from http://obvcode.blogspot.com/2008/05/strtr-for-javascript.html
function dpc_tr(str, from, to) {
	String.prototype.replaceAll = dpc_replaceall;
    var subst;
    for (var i = 0; i < from.length; i++) {
        subst = (to.charAt(i)) ? to.charAt(i) : to.charAt(to.length-1);
        str = str.replaceAll(from.charAt(i), subst);
    }
    return str;
}

function dpc_sanitize_uri(uri){
	var dpc_uri_sanitized;
	var dpc_from_code = dpc_f(192)+dpc_f(193)+dpc_f(194)
	+dpc_f(195)+dpc_f(196)+dpc_f(197)+dpc_f(199)+dpc_f(200)+dpc_f(201)+dpc_f(202)
	+dpc_f(203)+dpc_f(204)+dpc_f(205)+dpc_f(206)+dpc_f(207)+dpc_f(209)+dpc_f(210)
	+dpc_f(211)+dpc_f(212)+dpc_f(213)+dpc_f(214)+dpc_f(216)+dpc_f(217)+dpc_f(218)
	+dpc_f(219)+dpc_f(220)+dpc_f(221)+dpc_f(224)+dpc_f(225)+dpc_f(226)+dpc_f(227)
	+dpc_f(228)+dpc_f(229)+dpc_f(231)+dpc_f(232)+dpc_f(233)+dpc_f(234)+dpc_f(235)
	+dpc_f(236)+dpc_f(237)+dpc_f(238)+dpc_f(239)+dpc_f(241)+dpc_f(242)+dpc_f(243)
	+dpc_f(244)+dpc_f(245)+dpc_f(246)+dpc_f(248)+dpc_f(249)+dpc_f(250)+dpc_f(251)
	+dpc_f(252)+dpc_f(253)+dpc_f(255);	
	var dpc_to = "AAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";	
	dpc_uri_sanitized = dpc_tr(uri,dpc_from_code,dpc_to);
	dpc_uri_sanitized = dpc_uri_sanitized.replace(/\W+/gi,"-");
	dpc_uri_sanitized = escape(dpc_uri_sanitized);
	return 	dpc_uri_sanitized = escape(dpc_uri_sanitized);
}

//botão de curriculo
if (dpc_location_pathname.indexOf("/trabalhe-conosco")>=0){
	jQuery(".wpcf7-response-output").ajaxSuccess(function(e,r,a){
	if (r&&r.responseText&&r.responseText.indexOf("enviada")>=0){
        dpc_pageview(dpc_location_pathname+"/curriculo_enviado");
    }
});
}

//envio de contato
if (dpc_location_pathname.indexOf("/contato")>=0){
	jQuery(".wpcf7-response-output").ajaxSuccess(function(e,r,a){
	if (r&&r.responseText&&r.responseText.indexOf("enviada")>=0){
        dpc_pageview(dpc_location_pathname+"/contato_enviado");
    }
});
	var dpc_form = document.forms[0];
	for(f in dpc_form.elements)
		if (dpc_form.elements[f].type == "submit")				
			dpcAttachEvent(dpc_form.elements[f],"click",function(e){dpc_pageview(dpc_location_pathname+"/contato/enviar");});
}


