// JavaScript Document
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HTTP Request para classes em Ajax
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function requestHTTP() {
	
	try { http = new ActiveXObject("Msxml2.XMLHTTP"); }  
	catch (e) { try { http = new ActiveXObject("Microsoft.XMLHTTP"); }  
	catch (e) { try { http = new XMLHttpRequest(); }
	catch (e) { http = false; }}}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PORTFOLIO
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
scrollStep=1

timerLeft=""
timerRight=""

function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function scrollDivLeft(id){
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}

function scrollDivRight(id){
  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function stopMe(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}

function highlightOver(id) { document.getElementById(id).style.borderColor = "#0ea925"; }
function highlightOut(id) { document.getElementById(id).style.borderColor = "#CCCCCC"; }

function showpic(id) {
	
	document.getElementById("containerFoto").innerHTML = "<img src='images/loading.gif' width='32' height='32' border='0' style='margin-top: 120px' />"
	
	requestHTTP();
	http.open('GET', "modules/web/imagePortfolio.php?id="+id+"&cache="+Math.random(), true);
	http.onreadystatechange = AjaxResult;
	http.send(null);	
		
	function AjaxResult()	{
		if (http.readyState == 4) {
			if(http.status == 200) {
				results = http.responseText;
				document.getElementById("containerFoto").innerHTML = results;
			}
		}
	}
}
