// JavaScript Document

var currentpos_anteriores=0;
var current_imgid_anteriores=0;
var moving_anteriores = false;
var finishedsizing_anteriores=0;
var preloadimg_anteriores="no"//Preload images ("yes" or "no"):
var myloadedimage_anteriores = new Array();
     myloadedimage_anteriores[0]=1;
var imggallery_anteriores=new Array()
var firstimagestart_anteriores=1;
var nextorprev_anteriores=0;
var fadeout_anteriores=1;

function areweready_anteriores(loadarea, imgindex, img_id){
	if ( finishedsizing_anteriores++ ) { 
		modifyimage_anteriores(loadarea, imgindex, img_id);
		finishedsizing_anteriores = 0;
	}
}

function modifyimage_anteriores(loadarea, imgindex, img_id ){
	function loadimagenow(){
		if (document.getElementById) {
			
				if(current_imgid_anteriores!=img_id){
					
					var imgobj=document.getElementById(loadarea);
					var phototitle=document.getElementById('desc_anteriores')
					
					imgobj.innerHTML=returnimgcode_anteriores(imggallery_anteriores[imgindex]);
					phototitle.innerHTML="<strong style='text-transform:uppercase'>"+ tempgallery_anteriores[imgindex][5] +"</strong> <br />"+ tempgallery_anteriores[imgindex][6];
					initImage_anteriores(loadarea);
					current_imgid_anteriores=img_id;
					myloadedimage_anteriores[imgindex]=1;
				}
			}
		return false
	}
	if(myloadedimage_anteriores[imgindex]==null){	
		new Asset.image(imggallery_anteriores[imgindex][0], {onload: loadimagenow});
		
	}else{
		loadimagenow();
	}
	
}

function returnimgcode_anteriores(theimg){
	var imghtml=""
	if (theimg[1]!="")
		imghtml=''
	imghtml+='<a href="'+theimg[7]+'" target="_self"><img src="'+theimg[0]+'" border="0" id="'+theimg[8]+'" /></a>'
	if (theimg[1]!="")
		imghtml+=''
	return imghtml
}


function initImage_anteriores(imageId) {
	
	var fader = new Fx.Style(imageId,'opacity', {duration:fadespeed});
	fader.set(0);
	fader.start(0,1);
	
	var titlefade = new Fx.Style('desc_anteriores','opacity', {duration:transspeed });
		titlefade.set(0);
		titlefade.start(0,1);
}

function addposition_anteriores(addwidth){
	if ( !moving_anteriores ) {
		 // if animagic is still moving_anteriores the image..don't update the current position till it's done
		if(addwidth=="minus"){
			currentpos_anteriores-=1;
		}else if(addwidth=="plus"){
			currentpos_anteriores+=1;
		}
	}
	return currentpos_anteriores;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

	
function timedMsg_anteriores()
{
	if (window.t_bool_anteriores) {
		if (tempgallery_anteriores.length > 1) { 
			if (current_imgid_anteriores + 1 >= tempgallery_anteriores.length ) {
				current_imgid_anteriores = 1;
				previmageAnteriores(current_imgid_anteriores);
			} 
			else nextimageAnteriores(current_imgid_anteriores);
		}
	}
}

function cleartimedMsg_anteriores(reload_trans) {
	window.t_bool_anteriores = false;
	var x = window.setTimeout("reloadtimedMsg_anteriores();", reload_trans);
}

function reloadtimedMsg_anteriores() {
	window.t_bool_anteriores = true;
}

