function reloadThumbs(Offset,PromoId){
		opacity("galleryNavArea", 100, 0, 500,"ajaxReloadThumbs("+Offset+","+PromoId+")");
//changeOpac(30, "galleryNavArea");
}

function ajaxReloadThumbs(Offset,PromoId){
	changeOpac(100, "galleryNavArea");
	document.getElementById('galleryNavArea').innerHTML="<center><img src='images/ajax-loader-big.gif' style='margin-top:60px;margin-left:274px'/></center>";
	
	var xmlhttp2 = null
	
	if (typeof window.ActiveXObject != 'undefined' )
	{
   		xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
	}	
	else
	{
   		xmlhttp2 = new XMLHttpRequest();
	}
	
		

	var str="gallery_dash.php?Offset="+Offset+"&promo="+PromoId;
	xmlhttp2.open("GET",str,true);		
	xmlhttp2.onreadystatechange= function () {
		if (xmlhttp2.readyState==4) {
			if(xmlhttp2.status==200){
				changeOpac(0, "galleryNavArea");
				document.getElementById('galleryNavArea').innerHTML=xmlhttp2.responseText;
				opacity("galleryNavArea", 0, 100, 500);
			}
		}
	}
	xmlhttp2.send(null);
}

function showDash(){
	alert("complete!");
	//opacity("galleryNavArea", 0, 100, 500);
}

function showPic(Id){
		opacity("galleryPhoto", 100, 0, 500,"AjaxshowPic("+Id+")");
}



function fadeIn(DivID,Time){
	opacity(DivID, 0, 100, Time);
	PngFix();

}


function AjaxshowPic(Id){
		//changeOpac(100, "galleryPhoto");
		//document.getElementById('galleryPhoto').innerHTML="<div style='position:relative;top:100px;width:550px;'><center><p><img src='images/ajax-loader-3.gif' style='margin-bottom:10px'/></p><p style='font-size:14px'>Cargando Fotograf&iacute;a. Por favor, espere.</p></center></div>";

		var str="gallery_pic.php?PicId="+Id;	
		xmlhttp.open("GET",str,true);		
		xmlhttp.onreadystatechange= function () {
			if (xmlhttp.readyState==4) {
				//changeOpac(0, "galleryPhoto");
				if(xmlhttp.status==200){
					document.getElementById('galleryPhoto').innerHTML=xmlhttp.responseText;
					//opacity("galleryPhoto", 0, 100, 500);
				}
			}
		}
		xmlhttp.send(null);
}

function opacity(id, opacStart, opacEnd, millisec,functionToRun) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            if(i>opacEnd){
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            	timer++; 
			}else{
				if(functionToRun){
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
					setTimeout(functionToRun,(timer*speed));
            		timer++; 
				}
			}
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) { 
			if(i<opacEnd){
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
				timer++; 
			}else{
				if(functionToRun){
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
					setTimeout(functionToRun,(timer*speed));
					timer++; 
				}
			}
        } 
    } 

} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	fademaxvalues=opacity;
}

function checktimerout(){
 		//opacity("NavBody", 0, 100, 500);
	if (document.getElementById("NavBody").style.opacity=0){
		finished=true;
		clearInterval(intervalo);
	}
	
	if(document.getElementById("NavBody").style.opacity=256){
		finished=true;
		clearInterval(intervalo);
	}

}