//var PosDivFoto;

function makeRequest(){
		
	var http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
            // See note below about this line
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
		
    if (!http_request) {
        return false;
    }
    
    //alert(http_request);
    return http_request;

}//fim da function

function ajaxRespost(DivID,URLparam){
    var xmlhttp=makeRequest();
	
	//teste para back button

	if(DivID!=""){
      // ajax(URLparam +  "@" + DivID);
     //  alert(URLparam + "@" + DivID);
    }
	
    if(xmlhttp===false){
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    //alert("antes do loading ... " + DivID );
    //document.getElementById(DivID).innerHTML="<img src='../imagens/loading3.gif' border='0' />Carregando ...";

    //alert("depois do loading ...  " + DivID );

    xmlhttp.open('GET',URLparam, true);
    xmlhttp.onreadystatechange = function(){
	    if (xmlhttp.readyState == 4) {
	       document.getElementById(DivID).innerHTML = xmlhttp.responseText;
	    }
	}
	// alert(DivID + " " + URLparam);
  	xmlhttp.send(null);
}//fim da function 

function limpar_div(DivID){
	document.getElementById(DivID).innerHTML='';
}

function reload_item(){
	history.go(0);
}

function startClock(){
	if((document.getElementById('dicastxt').style.top == "200px")||(document.getElementById('dicastxt').style.top == "130px"))
		ajaxRespost('dicastxt','bodysite.php?menu=dica_capa');

	setTimeout("startClock()", 15000)
}

function EnterSubmit(event){
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    alert(keyCode);
    if ( keyCode == 13 ) {
       // document.getElementByID('validateuser').submit();
    }
}


function movescroll(DivID,Mve){
	var Timer;
	var i = 1;
	var e = document.getElementById(DivID);
	
	for(var x=1; x<100; x++){
		
		Timer = setInterval("", 5 * x);//apenas um delay
		e.scrollLeft = e.scrollLeft + Mve;
	}
}


var Timer;

function ScrollLeft(obj) {
	Timer = setInterval("document.getElementById('" + obj + "').scrollLeft -= 2", 10);
}

function ScrollRight(obj) {
	Timer = setInterval("document.getElementById('" + obj + "').scrollLeft += 2", 10);
}

function pop_cartaz(url, nome, dados) {
	window.open(url, nome, dados);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function pop_foto(url, nome, dados) {
  window.open(url, nome, dados);
}