/***************************************************************************************************************************** */
/**/

var vDiv = null;

function fnAjax(url, div){
	vDiv = div;
    if (window.document.getElementById) { //Verifica se o Browser suporta DHTML.
        if (window.XMLHttpRequest) {
            HttpReq = new XMLHttpRequest();
			HttpReq.onreadystatechange = loadConteudo;
            HttpReq.open("GET", url+'?key='+ Math.random(), true);
            HttpReq.send(null);

	} else if (window.ActiveXObject) { 
			try {
                HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {

				}
            }	

			if (HttpReq) {
				HttpReq.onreadystatechange = loadConteudo;
				HttpReq.open("GET", url, true);
				HttpReq.send();
			}
		}
	}
}

function loadConteudo(){
	if (HttpReq.readyState == 4){
		$('.'+vDiv).removeClass('carregando');
		element(vDiv,HttpReq.responseText);
	}else{
		element(vDiv,'');
		$('.'+vDiv).addClass('carregando');			
	}
	
}

function element(campo, valor){
	if(document.getElementById(campo)!=null){
		document.getElementById(campo).innerHTML = valor;
	}
}


/***********************************************************
** Funçãopara colocar a seta em cima da div              **
************************************************************/
function fnAbaOn(obj,div,url){
//	alert(obj+'  '+div+'  '+url);
	if(arguments[1]!=undefined && arguments[2]!=undefined){
		var div = arguments[1];
		var url = arguments[2];	

		//Chamanda o conteúdo da aba
		fnAjax(url,div);
		
	}

}


/*****************************************************************

Função da página: celular_pos_iphone_aparelhos


*****************************************************************/

$(document).ready(function(){
	$(".galeria img").fadeTo(0, 0.5);
	
	$(".galeria img").mouseover(function(){
		$(this).stop().fadeTo("fast", 1);
		$(this).next().addClass("txt_ativo");
	});

	$(".galeria img").mouseout(function(){
		$(this).stop().fadeTo("fast", 0.5);
		$(this).next().removeClass("txt_ativo");
	});

});

/* Inicio - Funçãoscrool de aparelhos */
var newScroller = null;
function Inicia() {
	 newScroller = new eddieScroll();
 }
 
function elemento(v) {
	return document.getElementById(v);
}

function eddieScroll() {
	this.startScroll = function (d) {
		this.stopScroll();
		if(d=='r') {
			this.scrollTimer = window.setInterval(
				function(){ elemento('scrollBar').scrollLeft  += 10; }, 40
			);
		} else {
			this.scrollTimer = window.setInterval(
				function(){ elemento('scrollBar').scrollLeft  -= 10; }, 40
			);		
		}
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.scrollTimer = null;
}
/* Final - Funçãoscrool de aparelhos */
