/* jQuery jCarousel */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(9($){$.1v.C=9(o){z 4.1b(9(){3p r(4,o)})};8 q={Z:F,25:1,21:1,u:7,1c:3,15:7,1K:\'2X\',2c:\'2Q\',1q:0,B:7,1j:7,1G:7,2F:7,2B:7,2z:7,2x:7,2v:7,2s:7,2p:7,1S:\'<P></P>\',1Q:\'<P></P>\',2m:\'2l\',2k:\'2l\',1O:7,1L:7};$.C=9(e,o){4.5=$.16({},q,o||{});4.Q=F;4.D=7;4.H=7;4.t=7;4.U=7;4.R=7;4.N=!4.5.Z?\'1H\':\'26\';4.E=!4.5.Z?\'24\':\'23\';8 a=\'\',1e=e.K.1e(\' \');1r(8 i=0;i<1e.I;i++){6(1e[i].2y(\'C-2w\')!=-1){$(e).1E(1e[i]);8 a=1e[i];1p}}6(e.2t==\'3o\'||e.2t==\'3n\'){4.t=$(e);4.D=4.t.19();6(4.D.1o(\'C-H\')){6(!4.D.19().1o(\'C-D\'))4.D=4.D.B(\'<P></P>\');4.D=4.D.19()}10 6(!4.D.1o(\'C-D\'))4.D=4.t.B(\'<P></P>\').19()}10{4.D=$(e);4.t=$(e).3h(\'>2o,>2n,P>2o,P>2n\')}6(a!=\'\'&&4.D.19()[0].K.2y(\'C-2w\')==-1)4.D.B(\'<P 3g=" \'+a+\'"></P>\');4.H=4.t.19();6(!4.H.I||!4.H.1o(\'C-H\'))4.H=4.t.B(\'<P></P>\').19();4.R=$(\'.C-11\',4.D);6(4.R.u()==0&&4.5.1Q!=7)4.R=4.H.1z(4.5.1Q).11();4.R.V(4.K(\'C-11\'));4.U=$(\'.C-17\',4.D);6(4.U.u()==0&&4.5.1S!=7)4.U=4.H.1z(4.5.1S).11();4.U.V(4.K(\'C-17\'));4.H.V(4.K(\'C-H\'));4.t.V(4.K(\'C-t\'));4.D.V(4.K(\'C-D\'));8 b=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 c=4.t.32(\'1F\');8 d=4;6(c.u()>0){8 f=0,i=4.5.21;c.1b(9(){d.1I(4,i++);f+=d.S(4,b)});4.t.y(4.N,f+\'T\');6(!o||o.u===J)4.5.u=c.u()}4.D.y(\'1y\',\'1A\');4.U.y(\'1y\',\'1A\');4.R.y(\'1y\',\'1A\');4.2G=9(){d.17()};4.2b=9(){d.11()};4.1U=9(){d.2q()};6(4.5.1j!=7)4.5.1j(4,\'2a\');6($.2A.28){4.1f(F,F);$(27).1u(\'2I\',9(){d.1t()})}10 4.1t()};8 r=$.C;r.1v=r.2H={C:\'0.2.3\'};r.1v.16=r.16=$.16;r.1v.16({1t:9(){4.A=7;4.G=7;4.X=7;4.13=7;4.14=F;4.1d=7;4.O=7;4.W=F;6(4.Q)z;4.t.y(4.E,4.1s(4.5.21)+\'T\');8 p=4.1s(4.5.25);4.X=4.13=7;4.1i(p,F);$(27).22(\'2E\',4.1U).1u(\'2E\',4.1U)},2D:9(){4.t.2C();4.t.y(4.E,\'3u\');4.t.y(4.N,\'3t\');6(4.5.1j!=7)4.5.1j(4,\'2D\');4.1t()},2q:9(){6(4.O!=7&&4.W)4.t.y(4.E,r.M(4.t.y(4.E))+4.O);4.O=7;4.W=F;6(4.5.1G!=7)4.5.1G(4);6(4.5.15!=7){8 a=4;8 b=1k.1P(4.1m()/4.5.15),N=0,E=0;$(\'1F\',4.t).1b(9(i){N+=a.S(4,b);6(i+1<a.A)E=N});4.t.y(4.N,N+\'T\');4.t.y(4.E,-E+\'T\')}4.1c(4.A,F)},3s:9(){4.Q=1h;4.1f()},3r:9(){4.Q=F;4.1f()},u:9(s){6(s!=J){4.5.u=s;6(!4.Q)4.1f()}z 4.5.u},3q:9(i,a){6(a==J||!a)a=i;6(4.5.u!==7&&a>4.5.u)a=4.5.u;1r(8 j=i;j<=a;j++){8 e=4.L(j);6(!e.I||e.1o(\'C-1a-1D\'))z F}z 1h},L:9(i){z $(\'.C-1a-\'+i,4.t)},2u:9(i,s){8 e=4.L(i),20=0,2u=0;6(e.I==0){8 c,e=4.1B(i),j=r.M(i);1n(c=4.L(--j)){6(j<=0||c.I){j<=0?4.t.2r(e):c.1X(e);1p}}}10 20=4.S(e);e.1E(4.K(\'C-1a-1D\'));1R s==\'3l\'?e.3k(s):e.2C().3j(s);8 a=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 b=4.S(e,a)-20;6(i>0&&i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))-b+\'T\');4.t.y(4.N,r.M(4.t.y(4.N))+b+\'T\');z e},1V:9(i){8 e=4.L(i);6(!e.I||(i>=4.A&&i<=4.G))z;8 d=4.S(e);6(i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))+d+\'T\');e.1V();4.t.y(4.N,r.M(4.t.y(4.N))-d+\'T\')},17:9(){4.1C();6(4.O!=7&&!4.W)4.1T(F);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'G\')&&4.5.u!=7&&4.G==4.5.u)?1:4.A+4.5.1c)},11:9(){4.1C();6(4.O!=7&&4.W)4.1T(1h);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'A\')&&4.5.u!=7&&4.A==1)?4.5.u:4.A-4.5.1c)},1T:9(b){6(4.Q||4.14||!4.O)z;8 a=r.M(4.t.y(4.E));!b?a-=4.O:a+=4.O;4.W=!b;4.X=4.A;4.13=4.G;4.1i(a)},1c:9(i,a){6(4.Q||4.14)z;4.1i(4.1s(i),a)},1s:9(i){6(4.Q||4.14)z;6(4.5.B!=\'18\')i=i<1?1:(4.5.u&&i>4.5.u?4.5.u:i);8 a=4.A>i;8 b=r.M(4.t.y(4.E));8 f=4.5.B!=\'18\'&&4.A<=1?1:4.A;8 c=a?4.L(f):4.L(4.G);8 j=a?f:f-1;8 e=7,l=0,p=F,d=0;1n(a?--j>=i:++j<i){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c[a?\'1z\':\'1X\'](e)}c=e;d=4.S(e);6(p)l+=d;6(4.A!=7&&(4.5.B==\'18\'||(j>=1&&(4.5.u==7||j<=4.5.u))))b=a?b+d:b-d}8 g=4.1m();8 h=[];8 k=0,j=i,v=0;8 c=4.L(i-1);1n(++k){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c.I==0?4.t.2r(e):c[a?\'1z\':\'1X\'](e)}c=e;8 d=4.S(e);6(d==0){3f(\'3e: 3d 1H/26 3c 1r 3b. 3a 39 38 37 36 35. 34...\');z 0}6(4.5.B!=\'18\'&&4.5.u!==7&&j>4.5.u)h.33(e);10 6(p)l+=d;v+=d;6(v>=g)1p;j++}1r(8 x=0;x<h.I;x++)h[x].1V();6(l>0){4.t.y(4.N,4.S(4.t)+l+\'T\');6(a){b-=l;4.t.y(4.E,r.M(4.t.y(4.E))-l+\'T\')}}8 n=i+k-1;6(4.5.B!=\'18\'&&4.5.u&&n>4.5.u)n=4.5.u;6(j>n){k=0,j=n,v=0;1n(++k){8 e=4.L(j--);6(!e.I)1p;v+=4.S(e);6(v>=g)1p}}8 o=n-k+1;6(4.5.B!=\'18\'&&o<1)o=1;6(4.W&&a){b+=4.O;4.W=F}4.O=7;6(4.5.B!=\'18\'&&n==4.5.u&&(n-k+1)>=1){8 m=r.Y(4.L(n),!4.5.Z?\'1l\':\'1N\');6((v-m)>g)4.O=v-g-m}1n(i-->o)b+=4.S(4.L(i));4.X=4.A;4.13=4.G;4.A=o;4.G=n;z b},1i:9(p,a){6(4.Q||4.14)z;4.14=1h;8 b=4;8 c=9(){b.14=F;6(p==0)b.t.y(b.E,0);6(b.5.B==\'1Z\'||b.5.B==\'G\'||b.5.u==7||b.G<b.5.u)b.2j();b.1f();b.1M(\'2i\')};4.1M(\'31\');6(!4.5.1K||a==F){4.t.y(4.E,p+\'T\');c()}10{8 o=!4.5.Z?{\'24\':p}:{\'23\':p};4.t.1i(o,4.5.1K,4.5.2c,c)}},2j:9(s){6(s!=J)4.5.1q=s;6(4.5.1q==0)z 4.1C();6(4.1d!=7)z;8 a=4;4.1d=30(9(){a.17()},4.5.1q*2Z)},1C:9(){6(4.1d==7)z;2Y(4.1d);4.1d=7},1f:9(n,p){6(n==J||n==7){8 n=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'A\')||4.5.u==7||4.G<4.5.u);6(!4.Q&&(!4.5.B||4.5.B==\'A\')&&4.5.u!=7&&4.G>=4.5.u)n=4.O!=7&&!4.W}6(p==J||p==7){8 p=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'G\')||4.A>1);6(!4.Q&&(!4.5.B||4.5.B==\'G\')&&4.5.u!=7&&4.A==1)p=4.O!=7&&4.W}8 a=4;4.U[n?\'1u\':\'22\'](4.5.2m,4.2G)[n?\'1E\':\'V\'](4.K(\'C-17-1w\')).1J(\'1w\',n?F:1h);4.R[p?\'1u\':\'22\'](4.5.2k,4.2b)[p?\'1E\':\'V\'](4.K(\'C-11-1w\')).1J(\'1w\',p?F:1h);6(4.U.I>0&&(4.U[0].1g==J||4.U[0].1g!=n)&&4.5.1O!=7){4.U.1b(9(){a.5.1O(a,4,n)});4.U[0].1g=n}6(4.R.I>0&&(4.R[0].1g==J||4.R[0].1g!=p)&&4.5.1L!=7){4.R.1b(9(){a.5.1L(a,4,p)});4.R[0].1g=p}},1M:9(a){8 b=4.X==7?\'2a\':(4.X<4.A?\'17\':\'11\');4.12(\'2F\',a,b);6(4.X!==4.A){4.12(\'2B\',a,b,4.A);4.12(\'2z\',a,b,4.X)}6(4.13!==4.G){4.12(\'2x\',a,b,4.G);4.12(\'2v\',a,b,4.13)}4.12(\'2s\',a,b,4.A,4.G,4.X,4.13);4.12(\'2p\',a,b,4.X,4.13,4.A,4.G)},12:9(a,b,c,d,e,f,g){6(4.5[a]==J||(1R 4.5[a]!=\'2h\'&&b!=\'2i\'))z;8 h=1R 4.5[a]==\'2h\'?4.5[a][b]:4.5[a];6(!$.2W(h))z;8 j=4;6(d===J)h(j,c,b);10 6(e===J)4.L(d).1b(9(){h(j,4,d,c,b)});10{1r(8 i=d;i<=e;i++)6(i!==7&&!(i>=f&&i<=g))4.L(i).1b(9(){h(j,4,i,c,b)})}},1B:9(i){z 4.1I(\'<1F></1F>\',i)},1I:9(e,i){8 a=$(e).V(4.K(\'C-1a\')).V(4.K(\'C-1a-\'+i));a.1J(\'2V\',i);z a},K:9(c){z c+\' \'+c+(!4.5.Z?\'-2U\':\'-Z\')},S:9(e,d){8 a=e.2g!=J?e[0]:e;8 b=!4.5.Z?a.1x+r.Y(a,\'2f\')+r.Y(a,\'1l\'):a.2e+r.Y(a,\'2d\')+r.Y(a,\'1N\');6(d==J||b==d)z b;8 w=!4.5.Z?d-r.Y(a,\'2f\')-r.Y(a,\'1l\'):d-r.Y(a,\'2d\')-r.Y(a,\'1N\');$(a).y(4.N,w+\'T\');z 4.S(a)},1m:9(){z!4.5.Z?4.H[0].1x-r.M(4.H.y(\'2T\'))-r.M(4.H.y(\'2S\')):4.H[0].2e-r.M(4.H.y(\'2R\'))-r.M(4.H.y(\'3i\'))},2P:9(i,s){6(s==J)s=4.5.u;z 1k.2O((((i-1)/s)-1k.2N((i-1)/s))*s)+1}});r.16({3m:9(d){z $.16(q,d||{})},Y:9(e,p){6(!e)z 0;8 a=e.2g!=J?e[0]:e;6(p==\'1l\'&&$.2A.28){8 b={\'1y\':\'1A\',\'2M\':\'2L\',\'1H\':\'1q\'},1Y,1W;$.29(a,b,9(){1Y=a.1x});b[\'1l\']=0;$.29(a,b,9(){1W=a.1x});z 1W-1Y}z r.M($.y(a,p))},M:9(v){v=2K(v);z 2J(v)?0:v}})})(3v);',62,218,'||||this|options|if|null|var|function||||||||||||||||||||list|size||||css|return|first|wrap|jcarousel|container|lt|false|last|clip|length|undefined|className|get|intval|wh|tail|div|locked|buttonPrev|dimension|px|buttonNext|addClass|inTail|prevFirst|margin|vertical|else|prev|callback|prevLast|animating|visible|extend|next|circular|parent|item|each|scroll|timer|split|buttons|jcarouselstate|true|animate|initCallback|Math|marginRight|clipping|while|hasClass|break|auto|for|pos|setup|bind|fn|disabled|offsetWidth|display|before|block|create|stopAuto|placeholder|removeClass|li|reloadCallback|width|format|attr|animation|buttonPrevCallback|notify|marginBottom|buttonNextCallback|ceil|buttonPrevHTML|typeof|buttonNextHTML|scrollTail|funcResize|remove|oWidth2|after|oWidth|both|old|offset|unbind|top|left|start|height|window|safari|swap|init|funcPrev|easing|marginTop|offsetHeight|marginLeft|jquery|object|onAfterAnimation|startAuto|buttonPrevEvent|click|buttonNextEvent|ol|ul|itemVisibleOutCallback|reload|prepend|itemVisibleInCallback|nodeName|add|itemLastOutCallback|skin|itemLastInCallback|indexOf|itemFirstOutCallback|browser|itemFirstInCallback|empty|reset|resize|itemLoadCallback|funcNext|prototype|load|isNaN|parseInt|none|float|floor|round|index|swing|borderTopWidth|borderRightWidth|borderLeftWidth|horizontal|jcarouselindex|isFunction|normal|clearTimeout|1000|setTimeout|onBeforeAnimation|children|push|Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|alert|class|find|borderBottomWidth|append|html|string|defaults|OL|UL|new|has|unlock|lock|10px|0px|jQuery'.split('|'),0,{}));


// FUNÇÕES COMUNS MOVIDADES DE FUNCTION.JS, IE6_FUNCTION.JS E IE7_FUNCTIONS.JS

var rootURL = SENIOR_BASE_URL;

var browserType;
if (document.layers) {browserType = "nn4";}
if (document.all) {browserType = "ie";}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko";
}

function file_get_contents( url ) {

    var tmp, headers = [], newTmp = [], k=0, i=0, href = '', pathPos = -1;
    var func = function (value) { return value.substring(1) !== ''; };
    var req = this.window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    if (!req) {throw new Error('XMLHttpRequest not supported');}
 
    if (!/^https?:/.test(url)) { 
        href = this.window.location.href;
        pathPos = url.indexOf('/') === 0 ? href.indexOf('/', 8)-1 : href.lastIndexOf('/');
        url = href.slice(0, pathPos+1)+url;
    }
    
    req.open("GET", url, false);
    req.send(null);
 
    tmp = req.getAllResponseHeaders();
    tmp = tmp.split('\n');
    for (k=0; k < tmp.length; k++) {
        if (func(tmp[k])) {
            newTmp.push(tmp[k]);
        }
    }
    tmp = newTmp;
    for (i=0; i < tmp.length; i++) {
        headers[i] = tmp[i];
    }
    this.$http_response_header = headers; 
    
    return req.responseText; 
}

//FUNÃ‡AO PARA CONTROLAR ERROS NO IE 
function stopError() { 
	return true;
	}
window.onerror = stopError;

/* GET- URL */
function urlDecode(string, overwrite){
    if(!string || !string.length){
        return {};
    }
    var obj = {};
    var pairs = string.split('&');
    var pair, name, value;
    var lsRegExp = /\+/g;
    for(var i = 0, len = pairs.length; i < len; i++){
        pair = pairs[i].split('=');
        name = unescape(pair[0]);
        value = unescape(pair[1]).replace(lsRegExp, " ");
        //value = decodeURIComponent(pair[1]).replace(lsRegExp, " ");
        if(overwrite !== true){
            if(typeof obj[name] == "undefined"){
                obj[name] = value;
            }else if(typeof obj[name] == "string"){
                obj[name] = [obj[name]];
                obj[name].push(value);
            }else{
                obj[name].push(value);
            }
        }else{
            obj[name] = value;
        }
    }
    return obj;
}

function jsGet(param){ 
	var wl = window.location.href;
	var params = urlDecode(wl.substring(wl.indexOf("?")+1));
	return(params[param]);
}

/* VALIDAR E-MAIL */
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  // alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		 
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		 
 		 return true					
	}

function fieldWrite(campo, label){ 
	if(document.getElementById(campo).value == ""){
		document.getElementById(campo).value = label;
	}
}

function fieldEmpty(campo, label){
	if(document.getElementById(campo).value == label){
		document.getElementById(campo).value = "";	
  }
}

/* CANCELA CADASTRO */
function cancelaCadastroNews(){
	window.location.reload();
}

/* CADASTRO CONCLUIDO - SUCESSO */
function cadastroConcluido(){ 
   document.getElementById('newsContHTML').innerHTML = "<div class=\"newsFormField\"><strong>Seu cadastro foi realizado com sucesso.</strong><br><br><strong>Em breve voc&ecirc; receber&aacute; nosso informativo.</strong><br><br></div>";	
}

function jaSouCliente(box){ 
	if(box.checked){
		$('#informativoProdutos').show();
	} else {
		$('#informativoProdutos').hide();
	}
}

function confereFormNews(){ 
	 if(checkSendForm() == false){
		 return true;
	 }
}

function gravaNews(){ 
	 if(confereFormNews() == true){
	     cadastroNews(); //CADASTRO LET'S GO!!!!!!!	
	   }
	}

/* GRAVA CADASTRO */
function cadastroNews() { 
		  var newsNome = document.getElementById('newsNome');
		 var newsEmail = document.getElementById('newsEmail');
		var newsCidade = document.getElementById('newsCidade');
		    var newsUF = document.getElementById('newsUF');
	 var newsCheckBox1 = document.getElementById('newsCheckBox1');
	 var newsCheckBox2 = document.getElementById('newsCheckBox2'); 
	 var newsCheckBox3 = document.getElementById('newsCheckBox3');
	 var produtos = '';
	 
	 $('#informativoProdutos').find('input').each(function(){
		 if(this.checked){
			 produtos += '&' + $(this).attr('id')  + '=1';
		 }
	 });
	 
	 if(document.getElementById('newsCheckBox3').checked == true){
	    var newsProduto = document.getElementById('newsProduto'); 
	 }else{
	    var newsProduto = "";
	 }
	 
	var urlData = 'newsEmail='      + newsEmail.value +
	              '&newsNome='      + newsNome.value + 
	              '&newsCidade='    + newsCidade.value + 
	              '&newsUF='        + newsUF.value + 
	              '&newsCheckBox1=' + newsCheckBox1.checked + 
	              '&newsCheckBox2=' + newsCheckBox2.checked +
	              '&newsCheckBox3=' + newsCheckBox3.checked + 
	              produtos;
	document.getElementById('loading').style.visibility = 'visible';

	retrieveData(rootURL+'wp-content/themes/senior/newsCadastroEmail.php','POST', true, urlData, function(){ 
				if (http_request.readyState == 4){
				  //SHOW LOADING
				  
				  if(http_request.status == 200){

						 if(http_request.responseText == "01"){
							cadastroConcluido();
						 }else if(http_request.responseText == "02"){
	 						alert('AVISO: O email informado encontra-se cadastrado em nosso sistema.');
							cancelaCadastroNews();
						 }else{
							alert(http_request.responseText);
						 }
						 //ANALITICS
						 pageTracker._trackPageview("/cachorro_quente");
				   }
				 //HIDE LOADING
				 document.getElementById('loading').style.visibility = "hidden";
				 }
				});
}

function onoff(on, off){
	document.getElementById(on).disabled = false;
	document.getElementById(off).disabled = true;
}

/* TRATA O SELECT CASO FOR "COMERCIAL" */
function confereSel(){
//	if(document.getElementById('faleCom').value == "comercial@senior.com.br"){
	   document.getElementById('fcFalecom').innerHTML = '';
 	   document.getElementById('fcFalecom').style.display = 'none';	   
	if(document.getElementById('faleCom').value == '1'){

	document.getElementById('divComercial').innerHTML = "<div class=\"formLabel\">Comercial: </div> <div class=\"formField\"><select style=\"width: 200px;\" name=\"comercial\" class=\"faleComercial formStyle\" id=\"faleComercial\"><option value=\"Comercial\" selected=\"selected\">Selecione</option><option value=\"SAPIENS\">Sapiens&reg; (ERP)</option><option value=\"VETORH\">Vetorh&reg; (Gest&#259;o de Pessoas)</option><option value=\"RONDA\">Ronda&reg; (Acesso e Seguran&ccedil;a)</option><option value=\"SENIORTI\">Senior TI</option><option value=\"SENIORBI\">Senior BI</option><option value=\"REGENTE(TURISMO)\">Regente (Turismo)</option></select></div>";
	   
	}else{
	   document.getElementById('divComercial').innerHTML = "<!-- there's no spoon -->";	
	}
}

/* VALIDAR FORMULARIO FALE CONOSCO */
function checkFaleConosco(){ 
	$('#fale-conosco-ok').remove();
	$('#resultado').remove();
      var errorForm = false;	

	   var faleNome = document.getElementById('faleNome');
	  var faleEmail = document.getElementById('faleEmail');	
	 var faleCidade = document.getElementById('faleCidade');
	     var faleUF = document.getElementById('faleUF');	
 var faleComentario = document.getElementById('faleComentario');
        var faleCom = document.getElementById('faleCom');
   var faleTelefone = document.getElementById('faleTelefone');
 	if(faleCom.value == '0'){
	  document.getElementById('fcFalecom').style.display = 'inline';
	  document.getElementById('fcFalecom').innerHTML = 'Selecione.';
	  faleCom.focus();
	  errorForm = true;		
	}else{ 
	  document.getElementById('fcFalecom').style.display = 'none';
	  document.getElementById('fcFalecom').innerHTML = '';
	}
    
 	if(faleNome.value.length < 3){
	  document.getElementById('fcNome').style.display = 'inline';		
	  document.getElementById('fcNome').innerHTML = 'Informe seu nome.';		
	  faleNome.focus();
	  errorForm = true;		
	}else{ 
	  document.getElementById('fcNome').style.display = 'none';	
	  document.getElementById('fcNome').innerHTML = '';
	}
	
	if(echeck(faleEmail.value) == false){
	  document.getElementById('fcEmail').style.display = 'inline';		
	  document.getElementById('fcEmail').innerHTML = 'Confira seu e-mail.';		
	  faleEmail.focus();
	  errorForm = true;		
	}else{ 
      document.getElementById('fcEmail').style.display = 'none';			
	  document.getElementById('fcEmail').innerHTML = '';
	}
	
	 if(faleCidade.value.length < 3){
	  document.getElementById('fcCidade').style.display = 'inline';			 
	  document.getElementById('fcCidade').innerHTML = 'Informe a cidade.';		
	  faleCidade.focus();
	  errorForm = true;		
	}else{ 
	  document.getElementById('fcCidade').style.display = 'none';	
	  document.getElementById('fcCidade').innerHTML = '';
	}

	 if(faleUF.value == '0'){
	  document.getElementById('fcUF').style.display = 'inline';		
	  document.getElementById('fcUF').innerHTML = 'Selecione o estado.';		
	  faleUF.focus();
	  errorForm = true;		
	}else{ 
	  document.getElementById('fcUF').style.display = 'none';		
	  document.getElementById('fcUF').innerHTML = '';
	}			
	 if(faleTelefone.value.length < 12){
		 document.getElementById('fcTel').style.display = 'inline';		
		 document.getElementById('fcTel').innerHTML = 'Informe o telefone.';		
	 	 faleTelefone.focus();
	 	 errorForm = true;		
	}else{ 
	  document.getElementById('fcTel').style.display = 'none';		
	  document.getElementById('fcTel').innerHTML = '';
	} 
	
    if(faleComentario.value.length < 3){
      document.getElementById('fcMsg').style.display = 'inline';		
	  document.getElementById('fcMsg').innerHTML = 'Escreva uma mensagem.';		
	  faleComentario.focus();
	  errorForm = true;		
	}else{ 
      document.getElementById('fcMsg').style.display = 'none';	
	  document.getElementById('fcMsg').innerHTML = '';
	}			

   if (errorForm == false){
		faleConosco(); 
		}
}

//STOP IE ERROS
function stopError(){ 
	return true;
	}
window.onerror = stopError;

//ACCORDEON
function pausecomp(millis){ 
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function abreAcord(elemento){ 
	acord(elemento); 
	trocaEstilo(elemento);
}

function txtBoxFormat(objeto, sMask, evtKeyPress) { 
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;


if(document.all) { // Internet Explorer
    nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
    nTecla = evtKeyPress.which;
} else {
    nTecla = evtKeyPress.which;
    if (nTecla == 8 || nTecla == 9) {
        return true;
    }
}

    sValue = objeto.value;

    // Limpa todos os caracteres de formataÃ§Ã£o que jÃ¡ estiverem no campo.
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( " ", "" );
    sValue = sValue.toString().replace( " ", "" );
    fldLen = sValue.length;
    mskLen = sMask.length;

    i = 0;
    nCount = 0;
    sCod = "";
    mskLen = fldLen;

    while (i <= mskLen) {
      bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
      bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

      if (bolMask) {
        sCod += sMask.charAt(i);
        mskLen++; }
      else {
        sCod += sValue.charAt(nCount);
        nCount++;
      }

      i++;
    }

    objeto.value = sCod;

    if (nTecla != 8 || nTecla != 9) { // backspace ou tab
      if (sMask.charAt(i-1) == "9") { // apenas nÃºmeros...
        return (((nTecla > 47) && (nTecla < 58)) || (nTecla == 9)); }
      else { // qualquer caracter...
        return true;
      }
    }
    else {
      return true;
    }
  }

function remove(str, sub) { 
	 i = str.indexOf(sub);
	 r = "";
	 if (i == -1) return str;
	 r += str.substring(0,i) + remove(str.substring(i + sub.length), sub);
	 return r;
}

//COMO FICOU SABENDO
function vsel_comoFicouSabendo(){ 
	var comoFicouSabendo = document.getElementById('sel_comoFicouSabendo');
	var comoFicouSabendoOutros = document.getElementById('ins_informe');
	if(comoFicouSabendo.value == "informe" && comoFicouSabendoOutros.value == ""){
		document.getElementById('eins_comoFicouSabendo').innerHTML = "Informe como ficou sabendo.";
//		document.getElementById("sel_comoFicouSabendo").focus();
		return false;
	}else if(comoFicouSabendo.value == "0"){
		document.getElementById("informeHTML").style.visibility = "hidden";
		document.getElementById('eins_comoFicouSabendo').innerHTML = "Selecione uma opção.";
		comoFicouSabendo.focus();
		return false;
	} else {
		document.getElementById('eins_comoFicouSabendo').innerHTML = "";
		return true
	}
}

function comoFicouSabendoInformeOutros(){ 
	var comoFicouSabendo = document.getElementById('sel_comoFicouSabendo');
	if(comoFicouSabendo.value == "informe"){
		document.getElementById("informeHTML").style.visibility = "visible";
		document.getElementById('eins_comoFicouSabendo').innerHTML = "";
		document.getElementById("ins_informe").value = "";
	} else{
		document.getElementById("informeHTML").style.visibility = "hidden";
	}
}

//CONFERE FORMULARIO
function validaInscricao(){ 
	if(vnome()==true && validarCPF()==true && vemail()==true && vcargo()==true && vtelefone()==true && vnacionalidade()==true && vescolaridade()==true && vempresa()==true && validaCNPJ()==true && vendComercial()==true && vcidade()==true && vuf()==true && vcep()==true && vsel_comoFicouSabendo()==true){
	//if(vnome()==false || validarCPF()==false || vemail()==false || vcargo()==false || vtelefone()==false || vnacionalidade()==false || vescolaridade()==false || vempresa()==false || validaCNPJ()==false || vendComercial()==false || vcidade()==false || vcep()==false || vsel_comoFicouSabendo()==false){
		inscricoes();
	}
}


function validarDataNascimento(){ 
	 var dat = document.getElementById('ins_nasc').value;
	 if(dat.length == 0){
	   document.getElementById('eins_nasc').innerHTML = "Informe a data de nascimento.";
	   //document.getElementById('ins_cpf').focus();
	   return false;
	 }
	  if(dat.length < 10 || 
		 parseInt(dat.substring(0,2)) > 31 || 
		 parseInt(dat.substring(3,2)) > 12 ){
		 document.getElementById('eins_nasc').innerHTML = "Data inválida.";
		 return false
	 } else {
		 document.getElementById('eins_nasc').innerHTML = "";
	 }
}

/* INSCRIÃ‡Ã•ES */
function inscricoes(){ 
     var nome_treinamento = document.getElementById('nomeTreinamento').value; 
  var ins_cod_treinamento = document.getElementById('ins_cod_treinamento');
			 var ins_nome = document.getElementById('ins_nome');
			  var ins_cpf = document.getElementById('ins_cpf');
			var ins_email = document.getElementById('ins_email');	
			var ins_cargo = document.getElementById('ins_cargo');
		 var ins_telefone = document.getElementById('ins_telefone');	
			  var ins_fax = document.getElementById('ins_fax');	
	var ins_nacionalidade = document.getElementById('ins_nacionalidade');	
	 var ins_escolaridade = document.getElementById('ins_escolaridade');
	         var ins_nasc = document.getElementById('ins_nasc');

          var urlDataInsI = 'ins_cod_treinamento='+ins_cod_treinamento.value+'&ins_nome='+ins_nome.value+'&ins_cpf='+ins_cpf.value+'&ins_email='+ins_email.value+'&ins_cargo='+ins_cargo.value+'&ins_telefone='+ins_telefone.value+'&ins_fax='+ins_fax.value+'&ins_nacionalidade='+ins_nacionalidade.value+'&ins_escolaridade='+ins_escolaridade.value+'&ins_nasc='+ins_nasc.value;

		  var ins_empresa = document.getElementById('ins_empresa');
			 var ins_cnpj = document.getElementById('ins_cnpj');
	 var ins_endComercial = document.getElementById('ins_endComercial');			   
	  var ins_complemento = document.getElementById('ins_complemento');
		   var ins_cidade = document.getElementById('ins_cidade');
		   var ins_estado = document.getElementById('ins_estado');			   
			  var ins_cep = document.getElementById('ins_cep');
			
		 var ins_informe  = document.getElementById("ins_informe");
 var ins_comoFicouSabendo = document.getElementById('sel_comoFicouSabendo');
 		var ins_cod_promo = document.getElementById('ins_cod_promo');
	 

	//var ins_comoFicouSabendo = document.getElementById('ins_comoFicouSabendo');
			   
	  	 var urlDataInsII = '&ins_empresa='+ins_empresa.value+'&ins_cnpj='+ins_cnpj.value+'&ins_endComercial='+ins_endComercial.value+'&ins_complemento='+ins_complemento.value+'&ins_cidade='+ins_cidade.value+'&ins_estado='+ins_estado.value+'&ins_cep='+ins_cep.value+'&ins_comoFicouSabendo='+ins_comoFicouSabendo.value+'&ins_informe='+ins_informe.value+'&ins_cod_promo='+ins_cod_promo.value;
		 
	retrieveData(rootURL+'wp-content/themes/senior/inscricaoTreinamentosScript.php','POST', true, urlDataInsI+urlDataInsII, function(){ 
		document.getElementById('loading').style.visibility = 'visible';
				if (http_request.readyState == 4){
				    //SHOW LOADING
				    if(http_request.status == 200){
						 analyticsTreinamentos('inscricao-treinamento-realizada-com-sucesso');
						 document.getElementById('inscricoesHTML').innerHTML = "<div class=\"sub-title-inscricao\" >SUA INSCRIÇÃO FOI REALIZADA COM SUCESSO.</div><div class=\"formLabel-trein\" style=\"width:400px;\">A Senior agradece seu interesse pelos nossos cursos. <br /><strong>Aguarde nosso contato.</strong> <br /><br />Obrigado.</div>";
					}
 				     //HIDE LOADING
				    document.getElementById('loading').style.visibility = "hidden";
				   }
				});
}

function showIndiquePost(linkURL){ 
	var urlData = 'linkURL='+linkURL;
		retrieveData(rootURL+'wp-content/themes/senior/indiquePost.php','POST', true, urlData, function(){ 
			show('janela_wait');
					if (http_request.readyState == 4){
					  if(http_request.status == 200){
						 document.getElementById('compartilhe').innerHTML = http_request.responseText;
					   }
			hide('janela_wait');
					 }
		});
	}

function confereIndiquePost(linkURL){ 
	
    var seuEmail = document.getElementById('seuEmail');
  var emailAmigo = document.getElementById('emailAmigo');
	 var seuNome = document.getElementById('seuNome');
   var nomeAmigo = document.getElementById('nomeAmigo');
         var msg = document.getElementById('msg');   

  if(echeck(seuEmail.value) == true){
	  if(echeck(emailAmigo.value) == true){
		  if(seuNome.value.length < 2 || seuNome.value == 'Seu nome'){
			document.getElementById('errorHTML').innerHTML = 'Informe seu nome.';		
			seuNome.focus();
		  }else{ 
			if(nomeAmigo.value.length < 2 || nomeAmigo.value == 'Nome do amigo'){
			  document.getElementById('errorHTML').innerHTML = 'Informe o nome de seu amigo.';		
			  nomeAmigo.focus();
			}else{ 
			  if(msg.value.length < 3 || msg.value == 'Mensagem'){ 
				document.getElementById('errorHTML').innerHTML = 'Escreva uma mensagem.';		
				msg.focus();
			  }else{
				document.getElementById('errorHTML').innerHTML = '';  
				showIndiquePostMail(linkURL);
				//PASSOU!
			  }
			}
		  }  
	  }else{
		  document.getElementById('errorHTML').innerHTML = 'O e-mail de seu amigo está incorreto';
		  emailAmigo.focus();	
	   }
  }else{
  	  document.getElementById('errorHTML').innerHTML = 'Seu e-mail informado está incorreto';
	  seuEmail.focus();	
  }
}

function showIndiqueWindow(linkURL){ 
	show('janela_fundo');
	show('compartilhe');
	showIndiquePost();
}

/* INDIQUE UM AMIGO - TREINAMENTOS */
function showIndiqueAmigo(tre_id){ 

var urlData = 'tre_id='+tre_id;

	retrieveData(rootURL+'wp-content/themes/senior/indiqueAmigoScript.php','POST', true, urlData, function(){ 
		//document.getElementById('loading').style.visibility = 'visible';
		show('janela_wait');
				if (http_request.readyState == 4){
				  //SHOW LOADING
				  if(http_request.status == 200){
  					   //DONE	
						  document.getElementById('impressao').innerHTML = http_request.responseText;
				   }
				 //HIDE LOADING
		//document.getElementById('loading').style.visibility = "hidden";
		hide('janela_wait');
				 }
				});	
}

/* VERIFICA FORMULARIO INDIQUE UM AMIGO */
function confereIndiqueAmigo(tre_id){ 
	
    var seuEmail = document.getElementById('seuEmail');
  var emailAmigo = document.getElementById('emailAmigo');
	 var seuNome = document.getElementById('seuNome');
   var nomeAmigo = document.getElementById('nomeAmigo');
         var msg = document.getElementById('msg');   

  if(echeck(seuEmail.value) == true){
	  if(echeck(emailAmigo.value) == true){
		  if(seuNome.value.length < 2 || seuNome.value == 'Seu nome'){
			document.getElementById('errorHTML').innerHTML = 'Informe seu nome.';		
			seuNome.focus();
		  }else{ 
			if(nomeAmigo.value.length < 2 || nomeAmigo.value == 'Nome do amigo'){
			  document.getElementById('errorHTML').innerHTML = 'Informe o nome de seu amigo.';		
			  nomeAmigo.focus();
			}else{ 
			  if(msg.value.length < 3 || msg.value == 'Mensagem'){ 
				document.getElementById('errorHTML').innerHTML = 'Escreva uma mensagem.';		
				msg.focus();
			  }else{
				document.getElementById('errorHTML').innerHTML = '';  
				enviaIndiqueAmigo(tre_id);
				//PASSOU!
			  }
			}
		  }  
	  }else{
		  document.getElementById('errorHTML').innerHTML = 'O e-mail de seu amigo está incorreto.';
		  emailAmigo.focus();	
	   }
  }else{
  	  document.getElementById('errorHTML').innerHTML = 'Seu e-mail informado está incorreto.';
	  seuEmail.focus();	
  }
  
}

/* IMPRESSÃƒO - TREINAMENTOS */
function showImpresso(tre_id){ 

  var urlData = 'tre_id='+tre_id;

	retrieveData(rootURL+'wp-content/themes/senior/impressaoScript.php','POST', true, urlData, function(){ 
		//document.getElementById('loading').style.visibility = 'visible';
		show('janela_wait');
				if (http_request.readyState == 4){
				  //SHOW LOADING
				  if(http_request.status == 200){
  					   //DONE	
						  document.getElementById('impressao').innerHTML = http_request.responseText;
				   }
				 //HIDE LOADING
		//document.getElementById('loading').style.visibility = "hidden";
		hide('janela_wait');
				 }
				});
}

//IMPRIMIR PAGINA
function PrintPage(){ 
 document.getElementById('the_contentPRINT').innerHTML = document.getElementById('the_contentHTML').innerHTML;
 PrintElementID('PostToPrint',this);
}

//ENVIA O CONTEÃšDO PARA A IMPRESSORA
function PrintElementID(id, pg) { 
        var oPrint, oJan;
        oPrint  = window.document.getElementById(id).innerHTML;
        oJan    = window.open(pg);
        oJan.document.write(oPrint);
      //  oJan.history.go();
        oJan.window.print();
		
}

/* SINGLE MENU CHILD */
function acordMenu(elemento){ 
	//alert(elemento);
	$(document.getElementById(elemento)).css(/*{backgroundImage:"url(" + SENIOR_BASE_URL + "wp-content/themes/senior/images/minus.png)"}*/).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
   	$(document.getElementById(elemento)).siblings().css(/*{backgroundImage:"url(" + SENIOR_BASE_URL + "wp-content/themes/senior/images/plus.png)"}*/);
}

/* SEARCH */
function showSearch(txtSearch){ 

	var urlData = 'query='+jsGet('s')+'&search=1&results=10&domain='+jsGet('domain')+'&start='+jsGet('start');

	retrieveData(rootURL+'wp-content/themes/senior/sphider/search.php','POST', true, urlData, function(){ 
		document.getElementById('loading').style.visibility = 'visible';
				if (http_request.readyState == 4){
				  //SHOW LOADING
				  if(http_request.status == 200){
  					   //DONE	
						  document.getElementById('searchHTML').innerHTML = http_request.responseText;
				   }
				 //HIDE LOADING
				 document.getElementById('loading').style.visibility = "hidden";
				 }
				});
}

/* ADICIONAR AOS FAVORITOS - RODAPÃ‰ */
function addFav(addthis){ 
    var url      = document.URL;
    var title    = document.title;
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}


// FIM FUNÇÕES COMUNS MOVIDADES DE FUNCTION.JS, IE6_FUNCTION.JS E IE7_FUNCTIONS.JS


/* hoverIntent.js */
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode}catch(e){p=this}}if(p==this){return false}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.mouseover(handleHover).mouseout(handleHover)}})(jQuery);
/* superfish.js */
(function(b){b.fn.superfish=function(k){var g=b.fn.superfish,j=g.c,f=b(['<span class="',j.arrowClass,'"> &#187;</span>'].join("")),i=function(){var c=b(this),l=d(c);clearTimeout(l.sfTimer);c.showSuperfishUl().siblings().hideSuperfishUl()},e=function(){var c=b(this),m=d(c),l=g.op;clearTimeout(m.sfTimer);m.sfTimer=setTimeout(function(){l.retainPath=(b.inArray(c[0],l.$path)>-1);c.hideSuperfishUl();if(l.$path.length&&c.parents(["li.",l.hoverClass].join("")).length<1){i.call(l.$path)}},l.delay)},d=function(c){var l=c.parents(["ul.",j.menuClass,":first"].join(""))[0];g.op=g.o[l.serial];return l},h=function(c){c.addClass(j.anchorClass).append(f.clone())};return this.each(function(){var c=this.serial=g.o.length;var m=b.extend({},g.defaults,k);m.$path=b("li."+m.pathClass,this).slice(0,m.pathLevels).each(function(){b(this).addClass([m.hoverClass,j.bcClass].join(" ")).filter("li:has(ul)").removeClass(m.pathClass)});g.o[c]=g.op=m;b("li:has(ul)",this)[(b.fn.hoverIntent&&!m.disableHI)?"hoverIntent":"hover"](i,e).each(function(){if(m.autoArrows){h(b(">a:first-child",this))}}).not("."+j.bcClass).hideSuperfishUl();var l=b("a",this);l.each(function(n){var o=l.eq(n).parents("li");l.eq(n).focus(function(){i.call(o)}).blur(function(){e.call(o)})});m.onInit.call(this)}).each(function(){var c=[j.menuClass];if(g.op.dropShadows&&!(b.browser.msie&&b.browser.version<7)){c.push(j.shadowClass)}b(this).addClass(c.join(" "))})};var a=b.fn.superfish;a.o=[];a.op={};a.IE7fix=function(){var c=a.op;if(b.browser.msie&&b.browser.version>6&&c.dropShadows&&c.animation.opacity!=undefined){this.toggleClass(a.c.shadowClass+"-off")}};a.c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",arrowClass:"sf-sub-indicator",shadowClass:"sf-shadow"};a.defaults={hoverClass:"sfHover",pathClass:"overideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},speed:"normal",autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};b.fn.extend({hideSuperfishUl:function(){var e=a.op,d=(e.retainPath===true)?e.$path:"";e.retainPath=false;var c=b(["li.",e.hoverClass].join(""),this).add(this).not(d).removeClass(e.hoverClass).find(">ul").hide().css("visibility","hidden");e.onHide.call(c);return this},showSuperfishUl:function(){var e=a.op,d=a.c.shadowClass+"-off",c=this.addClass(e.hoverClass).find(">ul:hidden").css("visibility","visible");a.IE7fix.call(c);e.onBeforeShow.call(c);c.animate(e.animation,e.speed,function(){a.IE7fix.call(c);e.onShow.call(c)});return this}})})(jQuery);
/* supersubs.js */
(function(a){a.fn.supersubs=function(b){var c=a.extend({},a.fn.supersubs.defaults,b);return this.each(function(){var d=a(this);var e=a.meta?a.extend({},c,d.data()):c;var f=a('<li id="menu-fontsize">&#8212;</li>').css({padding:0,position:"absolute",top:"-999em",width:"auto"}).appendTo(d).width();a("#menu-fontsize").remove();$ULs=d.find("ul");$ULs.each(function(l){var k=$ULs.eq(l);var j=k.children();var g=j.children("a");var m=j.css("white-space","nowrap").css("float");var h=k.add(j).add(g).css({"float":"none",width:"auto"}).end().end()[0].clientWidth/f;h+=e.extraWidth;if(h>e.maxWidth){h=e.maxWidth}else{if(h<e.minWidth){h=e.minWidth}}h+="em";k.css("width",h);j.css({"float":m,width:"100%","white-space":"normal"}).each(function(){var n=a(">ul",this);var i=n.css("left")!==undefined?"left":"right";n.css(i,h)})})})};a.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);

urlFlickerAtual = '';
flickrFotosPagina = 0;

bisCadastroAberto = false;

// depoimentos
depAtual = 1;
totDepoimentos = 0;
depSlideshow = true;
depSlideshowTime = 6000;

$(document).ready(function(){
	
	// prepara o  menu colocando classes nos varios niveis
	$('.expandivel').addClass('rootmenu');
	$('.expandivel ul').removeClass('rootmenu').addClass('menu-level-1');
	$('.expandivel ul ul').removeClass('menu-level-1').addClass('menu-level-2');
	$('.expandivel ul ul ul').removeClass('menu-level-2').addClass('menu-level-3');
	
	// pega o url da p�gina
	var pagAtual = document.location;
	
	//abre o menu at� o elemento ativo
	$('.expandivel a').each(function(){
		if($(this).attr('href') == pagAtual){
			$(this).addClass('produto-ativo');
			$(this).next().show();
			switch($(this).parent().parent().attr('class')){
				case 'menu-level-3': 
					$(this).parent().parent().show();
					$(this).parent().parent().parent().parent().show();
					$(this).parent().parent().parent().parent().parent().parent().show();
					break;
				case 'menu-level-2': 
					$(this).parent().parent().show();
					$(this).parent().parent().parent().parent().show();
					break;
				case 'menu-level-1': 
					$(this).parent().parent().show();
					break;
			}
		}
	});
	
	// fun��o para click ou para expans�o do menu
	
	$('.expandivel li a').click(function(){
		if($(this).parent().hasClass('no-content')){
			var countNext = 0;
			$(this).parent().children().each(function(){
				if(this.tagName == "UL"){
					countNext++;
					$(this).parent().siblings().each(function(){
						$(this).find('ul').slideUp();
					});
					$(this).slideDown();
				}
			});
			if(countNext > 0){
				return false
			}
		}
	});
	
	initFlickrFotos();
	
	$('#flickr-next').click(function(){
		flickrFotosNext();
	});
	
	$('#flickr-prev').click(function(){
		flickrFotosPrev();
	});
	
	
    $("ul.sf-menu").supersubs({ 
        minWidth:    12,                                // minimum width of sub-menus in em units 
        maxWidth:    27,                                // maximum width of sub-menus in em units 
        extraWidth:  1                                  // extra width can ensure lines don't sometimes turn over 
                                                        // due to slight rounding differences and font-family 
    }).superfish({ 
        delay:       400,                               // delay on mouseout 
        animation:   {opacity:'show',height:'show'},    // fade-in and slide-down animation 
        speed:       'fast',                            // faster animation speed 
        autoArrows:  false,                             // disable generation of arrow mark-up 
        dropShadows: false                              // disable drop shadows 
    }); 
    
    $('#flickr-next').css('cursor', 'pointer');
	$('#flickr-prev').css('cursor', 'default').css('opacity', '0.5');
	
	$('#bisCadastrar').click(mostraCadastroBis);
	
	$('#commentform').submit(enviarComentarioAjax);
	
	/////////////////////////////////////////// CLIENTES -->
	$('#selProduto').change(alteraSegmentos);
	
	$('#selSegmento').change(showClientes);
	////////////////////////////////////////////// <-- CLIENTES
	
	if($(document).find('.dica-mapa-wrapper')[0]){
		setTimeout(function(){ $('.dica-mapa').fadeIn(); }, 4000);
	}
	
});

/* CLIENTES  */
function showClientes(){
	var seg_id = document.getElementById('selSegmento').value;
	var prod_id = document.getElementById('selProduto').value;
	if(unidadeId != ''){
		unidadeGet = '&unidade=' + unidadeId;
	} else {
		unidadeGet = '';
	}
	var urlData = 'seg_id=' + seg_id + '&prod_id=' + prod_id + unidadeGet;
	retrieveData(rootURL+'wp-content/themes/senior/ajax-clientes.php','POST', true, urlData, function(){ 
		document.getElementById('loading').style.visibility = 'visible';
		if (http_request.readyState == 4){
			//SHOW LOADING
			if(http_request.status == 200){
		        //DONE	
				document.getElementById('clientesHTML').innerHTML = http_request.responseText;
			}
			//HIDE LOADING
			document.getElementById('loading').style.visibility = "hidden";
	    }
	});
}

function alteraSegmentos(){
	var s = "p" + $('#selProduto').val();
	$('#selSegmento').remove();
	var sel = '<select class="selTreinamentos" id="selSegmento" style="width:200px; margin: 10px auto;"><option id="no_seg" value="0" selected="selected">Selecione o segmento&nbsp;&darr;</option><option id="todos_seg" value="0">Todos</option>';
	if(s == "p0"){
		for(i in PsegmentosNomes){
			if(!isNaN(i)){
				sel += '<option id="seg' + i + '" value="' + i + '">' + PsegmentosNomes[i] + '</option>';
			}
		}
	} else {
		$('#selSegmento').children().hide();
		k = 'zzz';
		for(i in Psegmentos[s]){
			if(!isNaN(Psegmentos[s][i]) && Psegmentos[s][i] != k){
				k = Psegmentos[s][i];
				sel += '<option id="seg' + k + '" value="' + k + '">' + PsegmentosNomes[k] + '</option>';
			}
		}
	}
	sel += '</select>';
	$('#selProduto').after(sel);
	$('#selSegmento').val('0');
	showClientes();
	$('#selSegmento').change(showClientes);
}

function initDepoimentosNav(){
	var ch = $('.depoimentos').children();
	totDepoimentos = ch.length;
	$('#dep-nav-next').click(nextDepoimento);
	$('#dep-nav-prev').click(prevDepoimento);
	handleNav();
}

function handleNav(){
	if(depAtual == 1){
		$('#dep-nav-prev').hide();
	} else {
		$('#dep-nav-prev').show();
	}
	if(depAtual == totDepoimentos){
		$('#dep-nav-next').hide();
	} else {
		$('#dep-nav-next').show();
	}
}

function initDepSlideshow(start){
	depAtual = start;
	$('.depoimento').hide();
	$('#dep' + start).show();
	setTimeout(depSlideshowAction, depSlideshowTime);
	initDepoimentosNav();
}

function depSlideshowAction(){
	if(depSlideshow == true){
		$('#dep' + depAtual).fadeOut(500, function(){
			if(depAtual < totDepoimentos){
				depAtual++;
			} else {
				depAtual = 1;
			}
			$('#dep' + depAtual).fadeIn();
			handleNav();
		});
		setTimeout(depSlideshowAction, depSlideshowTime);
	} 
}

function nextDepoimento(){
	depSlideshow = false;
	if(depAtual < totDepoimentos){
		$('#dep-nav-prev').show();
		$('#dep' + depAtual).fadeOut(500, function(){
			depAtual++;
			$('#dep' + depAtual).fadeIn();
			handleNav();
		});
	}
}

function prevDepoimento(){
	depSlideshow = false;
	if(depAtual > 1){
		$('#dep-nav-next').show();
		$('#dep' + depAtual).fadeOut(500, function(){
			depAtual--;
			$('#dep' + depAtual).fadeIn();
			if(depAtual == 1){
				$('#dep-nav-prev').hide();
			}
		});
	}
}

function enviarComentarioAjax(){
	if(validaComentario()){
		var texto = $('#comment').val();
		var nome = '';
		if($('#autorname').val() != ''){
			nome  = $('#autorname').val();
		} else {
			nome  = $('#author').val();
		}
		$('#loading').fadeIn(500, function(){
			var postar = $('#commentform').serialize();
			$.post(
				SENIOR_BASE_URL + 'wp-content/themes/senior/comentario-envio.php',
				postar,
				function(dados){
					$('#comment').val('');
					$('#respond').slideUp();
					$('#loading').fadeOut(500, function(){
						var txt= '';
						txt += 	'<li class="comment newcomment" style="display: none;">';
						txt += 	'<div class="comment-body">'
						txt += 	'<div class="comment-author vcard">'
						txt += 	'<cite class="fn">' + nome + '</cite>' 
						txt += 	'<span class="says">disse:</span></div>'
						txt += 	'<em>O seu comentário está aguardando moderação.</em>'
						txt += 	'<br>'
						txt += 	'<div class="comment-meta commentmetadata"></div>';
						txt += 	'<p>' + texto + '</p>'
						txt += 	'</li>';
						$('.commentlist').append(txt);
						$('.newcomment').slideDown();
					});
				},
				'html'
			);
		});
	}
	return false;
}

function mostraCadastroBis(){
	if(!bisCadastroAberto){
		bisCadastroAberto = true;
		$(this).parent().after('<div id="cadastroBis" style="display:none;"></div>');
		$('#cadastroBis').load(SENIOR_BASE_URL + 'wp-content/themes/senior/restrito-cadastro-bis.php', 
				               function(){ 
									$('#cadastroBis').slideDown();
									$('#cadastroBisForm').submit(enviarCadastroBis);
								});
	} else {
		bisCadastroAberto = false;
		$('#cadastroBis').slideUp(500, function() { $('#cadastroBis').remove() } );
		$('#bis-cadastrar').click(mostraCadastroBis);
	}
	return false;
}

function enviarCadastroBis(){
	var erro = false;
	$('.erroCadastro').hide();
	/*
	if($('#razao').val() == ''){
		erro = true;
		$('#erroRazao').show().html('Informe a Razão Social');
	}
	*/
	if($('#nome').val() == ''){
		erro = true;
		$('#erroNome').show().html('Informe seu nome completo.');
	}
	var emails = $('#emails').val();
	if(emails == ''){
		erro = true;
		$('#erroEmails').show().html('Informe pelo menos um e-mail.');
	} else {
		var emailsArray = emails.split(';');
		for(i=0; i < emailsArray.length; i++){
			if(!echeck(emailsArray[i])){
				erro = true;
				$('#erroEmails').show().html('E-mail(s) inválido(s).');
				break;
			}
		}
	}
	
	if(!erro){
		$('#loading').fadeIn();
		var postar = $('#cadastroBisForm').serialize();
		$.post(
			SENIOR_BASE_URL + 'wp-content/themes/senior/restrito-cadastro-bis.php', 
			postar,
			function(dados){ 
		        $('#loading').fadeOut(500, function(){
					$('#cadastroBis').slideUp(500, function(){ 
						$('#cadastroBis').html(dados).slideDown(); 
					});
		        });
			}, 
			'html'
		);
	}
	return false;
}

function validaComentario(){
	var erro = false;
	$('#authorError').remove();
	$('#emailError').remove();
	$('#commentError').remove();
	if(!$('#commentform').hasClass('logado')){
		if($('#author').val() == ''){
			$('#author').parent().after('<small class="comentarioErro" id="authorError">Digite seu nome.</small>');
			erro = true;
		}
		if($('#email').val() == ''){
			$('#email').parent().after('<small class="comentarioErro" id="emailError">Digite seu e-mail.</small>');
			erro = true;
		} else if(!echeck($('#email').val())){
			$('#email').parent().after('<small class="comentarioErro" id="emailError">Digite um e-mail válido.</small>');
			erro = true;
		}
	}
	if($('#comment').val() == ''){
		$('#comment').parent().after('<small class="comentarioErro" id="commentError">Digite seu comentário.</small>');
		erro = true;
	}
	if(erro) { return false; } else { return true; }
}

function initFlickrFotos(){
	
	$('#photoAlbum a').lightBox({
		overlayOpacity: 0.5,
		imageLoading:  SENIOR_BASE_URL + 'wp-content/themes/senior/images/lightbox/lightbox-ico-loading.gif',
		imageBtnClose: SENIOR_BASE_URL + 'wp-content/themes/senior/images/lightbox/lightbox-btn-close.gif',
		imageBtnPrev:  SENIOR_BASE_URL + 'wp-content/themes/senior/images/lightbox/lightbox-btn-prev.gif',
		imageBtnNext:  SENIOR_BASE_URL + 'wp-content/themes/senior/images/lightbox/lightbox-btn-next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Imagem',
		txtOf: '<div style="width:100px;position: absolute; bottom: 15px; left: 50%; margin-left: -50px;"><a href="javascript:void(0);" onclick="irFotoFlickr()" style="color: #3C5562;">Ir para o Flickr</a></div> de'
	});
	
	$('#photoAlbum a').click(function(){
		urlFlickerAtual = $(this).attr('flickrurl');
	});
}

function irFotoFlickr(img){
	window.open(urlFlickerAtual, '_blank');
}

function showFlicker(img){ 
	document.getElementById('compartilhe').innerHTML = '<img src="'+img+'" />';
}

function flickrFotosNext(){
	//alert(flickrTotPag);
	if(flickrFotosPagina < flickrTotPag - 1){
		flickrFotosPagina++;
		showFlickrFotosPaginaAtual();
		if(flickrFotosPagina == flickrTotPag - 1){
			$('#flickr-next').css('cursor', 'default').css('opacity', '0.5');
		}
	} else {
		return false;
	}
	$('#flickr-prev').css('cursor', 'pointer').css('opacity', '1');
}

function flickrFotosPrev(){
	if(flickrFotosPagina > 0){
		flickrFotosPagina--;
		showFlickrFotosPaginaAtual();
		if(flickrFotosPagina == 0){
			$('#flickr-prev').css('cursor', 'default').css('opacity', '0.5');
		}
	} else {
		return false;
	}
	$('#flickr-next').css('cursor', 'pointer').css('opacity', '1');
}

function showFlickrFotosPaginaAtual(direction){
	//$('#photoAlbum').fadeOut(500, function(){
		$('#photoAlbum').html('');
		for(ii = flickrFotosPagina *6; ii < flickrFotosPagina*6 +6; ii++ ){
			var foto = '<span class="flickrImage">';
			foto    += '<a href="' + flickrFotos[ii] + '" flickrurl="' + flickrUrl[ii] + '">';
			foto    += '<img alt="photo" src="' + flickrFotos[ii] + '" title="'+flickrTitle[ii]+'"/>';
			foto    += '</a></span>';
			$('#photoAlbum').append(foto);
		}
		$('#photoAlbum').show();
		initFlickrFotos();
	//});
}

//VAGAS 
function showVagas(){

	$.post(rootURL + 'wp-content/themes/senior/vagasScript.php', {}, 
		   function(text){ 
				document.getElementById('conteudoVagas').innerHTML = text;
				document.getElementById('loading').style.visibility = "hidden";
			}
	);
	
}

//TREINAMENTOS 

function acord(elemento) {
    setTimeout($(document.getElementById(elemento)).next().slideToggle("fast"), 2000);
    //$(document.getElementById(elemento)).next().slideToggle();
    if(acordeonsAbertos['id' + $(this).parent().attr('id')] == 'n'){
    	$('.accordeon_title_white').children().click(trackAcordeon);
    }
}

acordeonsAbertos = new Array();

function getUrlVars() {
	var vars = {};
	var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
		vars[key] = value;
	});
	return vars;
}

function showTreinamentos(value, permanencia){
	
	var script = "";
	var urlData = "";
	var getData = getUrlVars();
	if(value == "todos"){
		script = "treinamentosScript.php";
		urlData = "tipo=EAD&mes=0&segmento=0&permanencia=" + permanencia;
	}else{
		script = "treinamentoUnico.php";
		urlData = "id=" + getData["treinamento"];
	}
	
	acordeonsAbertos = new Array();

	retrieveData(rootURL + 'wp-content/themes/senior/' + script,'POST', true, urlData, function(){ 
		document.getElementById('loading').style.visibility = 'visible';
		if (http_request.readyState == 4){
		  //SHOW LOADING
		  if(http_request.status == 200){
			   //DONE	
				  
				  document.getElementById('conteudoTreinamentos').innerHTML = http_request.responseText;
				  $('.accordeon_title_white').children().click(trackAcordeon);
				  analyticsTreinamentos('lista-inicial');
				  $('#loading').hide();
		   }
		 //HIDE LOADING
		 
		 }
			initLytebox();
		});

}

function optionType(valor){
	$.post(rootURL+'wp-content/themes/senior/treinamentoRetrieve.php', {tipo:valor}, 
		   function(text){ 
				$('#selMes').remove();
				$('#selectMes').append(text);
			}
	);
}

function confereSelTipo(tipo){
	if(tipo == "EAD"){
		document.getElementById('selSegmento').style.visibility = "visible";	
	}else{
		document.getElementById('selSegmento').style.visibility = "hidden";	
	}
}

//SELECIONA OS TREINAMENTOS 
function selTreinamentos(){
	
	document.getElementById('loading').style.visibility = 'visible';
	
	acordeonsAbertos = new Array();
	
	if(document.getElementById('treinamentoEspecifico') != null){
		document.getElementById('treinamentoEspecifico').style.display = "none";
	}	
	
	//if(s == 'EAD'){
		//document.getElementById('selTipo').options[0].selected = true;	
		//document.getElementById('selSegmento').style.visibility = "visible";
	//}
	/*
	if(s == 'SEW'){
		document.getElementById('selTipo').options[1].selected = true;	
		document.getElementById('selSegmento').style.visibility = "hidden";	
	}
	*/
	
		
	var mes = document.getElementById('selMes');
	var segmento = document.getElementById('selSegmento');
	//var tipo = document.getElementById('selTipo');
	//var tipoTRe = tipo.options[tipo.selectedIndex].text;
	var tipoTre = "EAD";
	
	
	analyticsTreinamentos('selecao/?tipo='+tipoTre+'&mes='+mes.options[mes.selectedIndex].text+'&segmento='+segmento.options[segmento.selectedIndex].text);
	
	var urlData = 'tipo='+tipoTre+'&mes='+mes.value+'&segmento='+segmento.value;
	
	retrieveData(rootURL+'wp-content/themes/senior/treinamentosScript.php','POST', true, urlData, function(){ 
		
			if (http_request.readyState == 4){
			  //SHOW LOADING
			  if(http_request.status == 200){
				   //DONE	
				   document.getElementById('conteudoTreinamentos').innerHTML = http_request.responseText;
				   $('.accordeon_title_white').children().click(trackAcordeon);
			   }
			 //HIDE LOADING
			 document.getElementById('loading').style.visibility = "hidden";
			 document.getElementById('tre_control').style.visibility = "hidden";
			 }
			initLytebox();
	});
}

function selTreinamentosOnly(s){
	
	acordeonsAbertos = new Array();
	
	if(s == 'EAD'){
		document.getElementById('selTipo').options[0].selected = true;	
		document.getElementById('selSegmento').style.visibility = "visible";
	}

	if(s == 'SEW'){
		document.getElementById('selTipo').options[1].selected = true;	
		document.getElementById('selSegmento').style.visibility = "hidden";	
	}

	document.getElementById('selMes').selectedIndex = 0;
	document.getElementById('selSegmento').selectedIndex = 0;

	var tipo = document.getElementById('selTipo');

	var urlData = 'tipo='+tipo.value;

		retrieveData(rootURL+'wp-content/themes/senior/treinamentosScript.php','POST', true, urlData, function(){ 
			document.getElementById('loading').style.visibility = 'visible';
			if (http_request.readyState == 4){
			  //SHOW LOADING
			  if(http_request.status == 200){
				   //DONE	
					  document.getElementById('conteudoTreinamentos').innerHTML = http_request.responseText;
			   }
			 //HIDE LOADING
			 document.getElementById('loading').style.visibility = "hidden";
			 }
			initLytebox();
		});	
}

function analyticsTreinamentos(pag){
	//alert('treinamentos/' + pag);
	try {
		var pageTracker = _gat._getTracker("UA-10764597-2");
		pageTracker._trackPageview('treinamentos/' + pag);
	} catch(err) {}
}

function trackAcordeon(){
	if(acordeonsAbertos['id' + $(this).parent().attr('id')] != 'y'){
		acordeonsAbertos['id' + $(this).parent().attr('id')] = 'y';
		analyticsTreinamentos($(this).parent().find('div').eq('1').find('strong').html());
	} else {
		acordeonsAbertos['id' + $(this).parent().attr('id')] = 'n';
	}
}

function trackConteudoProgramatico(obj, cp){
	window.open(cp, "_blank");
	setTimeout(function(){
					analyticsTreinamentos($(obj).parent().parent().parent().parent().parent().prev().find('div').eq(1).find('strong').html() + '/conteudo-programatico'); 
				},
				1000);
}

function trackInscrevaSe(obj, url){
	analyticsTreinamentos($(obj).parent().parent().parent().parent().parent().prev().find('div').eq(1).find('strong').html() + '/inscreva-se');
	setTimeout(function(){
					window.open(SENIOR_BASE_URL + url, "_self");
				}, 1000);
}