function MM_preloadImages() { //v3.0
    // adapted from Macromedia
    navRollovers = new Array('aboutalicias_f2.jpg',
							 'portraitures_f2.jpg',
							 'packagess_f2.jpg', 
							 'weddings_f2.jpg', 
							 'fashions_f2.jpg',
							 'abstracts_f2.jpg');
	
	if (!window.imagePaths) {
		window.imagePaths = "";
	}
	
	a = navRollovers.concat(imagePaths);

	for(var i=0; i<a.length; i++) {
		a[i] = "images/" + a[i];
	}
	
   if(!document.imageArray){ 
       document.imageArray=new Array();
   }
   
    var j=document.imageArray.length; 
	for(var i=0; i<a.length; i++){
		if (a[i].indexOf("#")!=0){ 
			document.imageArray[j]=new Image; 
			document.imageArray[j++].src=a[i];
		}
	}
}

function swapBack() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage(a,b) { 
 // adapted from Macromedia swapImage v3.0
  var i,j=0,x; 
  document.MM_sr=new Array; 
   if ((x=MM_findObj(a))!=null){
	   document.MM_sr[j++]=x; 
	   if(!x.oSrc) x.oSrc=x.src;
	   if(!b) {
		   x.src="images/"+a+"_f2.jpg";
	   } else {
		   x.src="images/"+a+b;
	   }
	   
   }
}

function setText(theText, leftMargin) {
	 trevor = document.getElementById("rollovertext");
	 trevor.innerHTML = theText;
	 trevor.style.marginLeft = leftMargin + "px";
}
	 
function valignContent(contentheight) {
	// vertical align
	var topnavbarheight = 55; // includes next button
	var bottomfilmheight = 145;
	var middlespace = document.body.clientHeight - (bottomfilmheight + topnavbarheight);

	if (middlespace < (contentheight + 100) ) {
	    document.getElementById("footer").style.position = "static";
		document.getElementById("content").style.position = "static";
	} else {
		document.getElementById("footer").style.position = "absolute";
		document.getElementById("content").style.position = "absolute";
		 document.getElementById("content").style.marginTop = "0px";
		var contentPos = topnavbarheight + (middlespace - contentheight)/ 2;
		document.getElementById("content").style.top = contentPos + "px";
	}
}

var numShown = 0;
var lastScroll = 0;
function showImage(me, imageWidth) {
	
	if (numShown == 0){
		contentWidth = Math.max(imageWidths[0], document.body.clientWidth);
	} 

	numShown ++;
    document.images[numShown].src = "images/" + imagePaths[numShown];
	document.images[numShown].alt = imagePaths[numShown].substring(0, imagePaths[numShown].length-4);
    var me = "image" + (numShown+1);
    var gap = document.body.clientWidth - imageWidths[numShown];
	
	 leftWidths = 0;
	 for(j=0; j<numShown; j++){
		 leftWidths += imageWidths[j] + 60;
	 }
	 scrollDist = 30 + leftWidths - gap/2;
	 var adjust = Math.abs(Math.min(0, gap));
	 var fullWidth = 30 + scrollDist + document.body.clientWidth + adjust; 
	 
	 document.getElementById("content").style.width = (fullWidth + 30) + "px";
	 document.getElementById("content").style.textAlign = "left";
	 document.getElementById(me).style.display = "inline";

	 startScroll =  window.setInterval(scrollPix, 20, scrollDist);
	 
	 // disable button while scrolling
	 document.getElementById("next").childNodes[0].removeAttribute("href")
	 document.getElementById("next").childNodes[0].style.color = "#666666";
	 
	 // hide button when all images shown
	 if (numShown + 1 == imageWidths.length) {
		 document.getElementById("next").style.display = "none";
	 }
}

function scrollPix() {
	window.scrollBy(20,0);
    
	if (document.body.parentNode.scrollLeft >= scrollDist) {
		clearInterval(startScroll);
		// enable next button now scrolling has stopped
	    document.getElementById("next").childNodes[0].href = "javascript:showImage();";
	    document.getElementById("next").childNodes[0].style.color = "#FFFFFF";
		
		// forces reposition of next button at end of scroll for ie6 
		document.getElementById("next").style.left = "10px";
		document.getElementById("next").style.left = "";
	}
	lastScroll = window.scrollX;
}