// JavaScript Document

var currentpos_vistos=0;
var current_imgid_vistos=0;
var moving_vistos = false;
var finishedsizing_vistos=0;
var preloadimg_vistos="no"//Preload images ("yes" or "no"):
var myloadedimage_vistos = new Array();
     myloadedimage_vistos[0]=1;
var imggallery_vistos=new Array()
var firstimagestart_vistos=1;
var nextorprev_vistos=0;
var fadeout_vistos=1;

function areweready_vistos(loadarea, imgindex, img_id){
	if ( finishedsizing_vistos++ ) { 
		modifyimage_vistos(loadarea, imgindex, img_id);
		finishedsizing_vistos = 0;
	}
}

function modifyimage_vistos(loadarea, imgindex, img_id ){
	function loadimagenow(){
		if (document.getElementById) {
			
				if(current_imgid_vistos!=img_id){
					
					var imgobj=document.getElementById(loadarea);
					var phototitle=document.getElementById('desc_vistos')
					
					imgobj.innerHTML=returnimgcode_vistos(imggallery_vistos[imgindex]);
					phototitle.innerHTML="<strong style='text-transform:uppercase'>"+ tempgallery_vistos[imgindex][5] +"</strong> <br /> "+ tempgallery_vistos[imgindex][6];
					initImage_vistos(loadarea);
					current_imgid_vistos=img_id;
					myloadedimage_vistos[imgindex]=1;
				}
			}
		return false
	}
	if(myloadedimage_vistos[imgindex]==null){	
		new Asset.image(imggallery_vistos[imgindex][0], {onload: loadimagenow});
		
	}else{
		loadimagenow();
	}
	
}

function returnimgcode_vistos(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_vistos(imageId) {
	
	var fader = new Fx.Style(imageId,'opacity', {duration:fadespeed});
	fader.set(0);
	fader.start(0,1);
	
	var titlefade = new Fx.Style('desc_vistos','opacity', {duration:transspeed });
		titlefade.set(0);
		titlefade.start(0,1);
}

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

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

	
function timedMsg_vistos()
{
	if (window.t_bool_vistos) {
		if (tempgallery_vistos.length > 1) { 
			if (current_imgid_vistos + 1 >= tempgallery_vistos.length ) {
				current_imgid_vistos = 1;
				previmageVistos(current_imgid_vistos);
			} 
			else nextimageVistos(current_imgid_vistos);
		}
	}
}

function cleartimedMsg_vistos(reload_trans) {
	window.t_bool_vistos = false;
	var x = window.setTimeout("reloadtimedMsg_vistos();", reload_trans);
}

function reloadtimedMsg_vistos() {
	window.t_bool_vistos = true;
}

