//current = 1; //which picture we are showing. for popup window
img = "" ;
info= "";

//////////////////////////////////////////////////////////////////////////////////////

function LoadImages()
{
	/////////////////////////////////////////////////////
	url = String(window.location);

	start = url.indexOf("=");
	
	//alert( String(url.indexOf("+")) );
	
	if (start != -1) 
	{
		end = url.length;
	
		num = url.substring(start+1, end);
	
		//alert( String(start) + " / " + String(end) + " / " + "======>> " + num );
	
		 LoadPicture( num ); 
	}	
	//////////////////////////////////////////////////////
}

function LoadPicture( index ) {
	//alert(index);
	current = index; //which one we are in
	//document.getElementById('link'+current).className = "current";
	var pictureName = 'dummy';
	var captionID = 'pie_foto';
	var imageFileA = eval("img"+index+"A");
	var imageFileB = eval("img"+index+"B");
	var captionTextA = eval("img"+index+"Atxt");
	var captionTextB = eval("img"+index+"Btxt");
	
	//alert(document);
	
	if (document.all) {
		if (document.getElementById(pictureName+2) != null){
			document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
			document.getElementById(pictureName).filters.blendTrans.Apply();
		}
		if (document.getElementById(pictureName+2) != null){
			document.getElementById(pictureName+2).style.filter="blendTrans(duration=1)";
			document.getElementById(pictureName+2).filters.blendTrans.Apply();
		}
	}
	
	if (document.getElementById(pictureName) != null){document.getElementById(pictureName).src = imageFileA;}
	if (document.getElementById(pictureName+2) != null){ document.getElementById(pictureName+2).src = imageFileB; }
	
	if (document.all) {
		if (document.getElementById(pictureName) != null){
			try { 
				document.getElementById(pictureName).filters.blendTrans.Play();
			}			
			catch (err)
			{
    			//app.alert(err.toString());
			}
		}
		if (document.getElementById(pictureName+2) != null){
			try { 
				document.getElementById(pictureName+2).filters.blendTrans.Play(); 
			}
			catch (err)
			{
    			//app.alert(err.toString());
			}
		}
	}
	
	if (document.getElementById(pictureName) != null){document.getElementById(captionID).innerHTML=captionTextA;}
	if (document.getElementById(pictureName+2) != null){ document.getElementById(captionID+2).innerHTML=captionTextB; }
	
}

////////////////////////////////////////////////////////

function OpenBig(which) {
	img = eval( "img"+current +which+"_big") ; // img1A_big or img5B_big
	info= eval( "img"+current+which+"txt" ); // img1Btxt or img4Atxt
	
	//alert(info);
	window.open('bigpict.html', 'popup', 'width=730,height=700, scrollbars=yes')
}

////////////////////////////////////////////////////////

function hilite() {
	
	var currentLocation = document.location.href;
	var targetNode;

	targetNode = document;
	
	// You can speed up this script, by preventing it searching through the entire document
	// Uncomment the line below, and it will only search through the tag with ID 'navigation'
	//targetNode = document.getElementById("navigation");
	
	links = targetNode.getElementsByTagName("a");

	// Search thorugh all links
	for (i=0; i<links.length; i++) {
		linkHref = links[i].href;
		
		if (linkHref==currentLocation) {
			// Set class for different browsers, if link is this link
			links[i].setAttribute("className", "current");
			links[i].setAttribute("class", "current");      
		}
	}
}

////////////////////////////////////////////////////////

// on load hilite //

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(hilite); // **

////////////////////////////////////////////////////////

// random image on main and contact sections //

MyImages=new Array();
MyImages[0]='imgs/expos/expo1.jpg';
MyImages[1]='imgs/expos/expo2.jpg';
MyImages[2]='imgs/expos/expo3.jpg';
MyImages[3]='imgs/expos/expo4.jpg';
MyImages[4]='imgs/expos/expo5.jpg';
MyImages[5]='imgs/expos/expo6.jpg';
//MyImages[6]='imgs/expos/imagenes expo 4.jpg';
//MyImages[7]='imgs/expos/imagenes expo 5.jpg';
//MyImages[8]='imgs/expos/imagenes vista expos.jpg';
//MyImages[9]='imgs/expos/imagen expo6.jpg';
//MyImages[10]='imgs/expos/vista expo.jpg';

function random(){
		var n =  Math.round( Math.random() * (MyImages.length-1) );  // random between 0 and array length - 1
		//alert(n);
		return  MyImages[n];
}
