function hide_show_element(ID,action) { 
	if(action == 'hide') { 
		document.getElementById(ID).style.display = 'none';
	} else if(action == 'show') { 
		document.getElementById(ID).style.display = '';
	}
}

function preload_image(IMG) {
	objImage = new Image();
	objImage.src=IMG;
	objImage.onLoad=imageLoaded(IMG);
}

function imageLoaded(IMG) { 
	// do nothing!
}

function val_contact_form() { 

}

function set_iframe_height(H) {
	i = parent.document.getElementById('mainframe');
	if(i != null) { 
		i.style.height = H + "px";
	}
}

var quotei=0;
// var quotes = new Array(
// 					"Amy was able to effectively interpret what we wanted and was very good at incorporating our personal interests into the details of her design.<br /><span class='from'>- Wayne and Fran Kirkpatrick (Rustic Elegant Creole)</span>",
// 					"Amy has created a little something unexpected in every design project...which makes her work truly stand out.<br /><span class='from'>- Susan Masie (Grand European Manor)</span>",
// 					"She took my own style and brought it out in my home. When you walk in, you really get a sense of who I am.<br /><span class='from'>- Anna Ortiz (Thoughtful Bohemian Modern)</span>"
// );

var quotes = new Array(
					"Amy was anxious to hear and understand our vision.  We love the work she did for us.  She is great to work with!<br /><span class='from'>- Michael W. Smith (Refined Western Retreat)</span>",
					"Amy took the time to get to know us, our location and our  customers.  She truly listened to our goals and far exceeded our expectations.<br /><span class='from'>Nashville Convention & Visitors Bureau (Music City Pop Modern)</span>"
);

function fade_in_quote() { // swaps the content to the next quote in the array, then fades in the content
	if(quotei == quotes.length) { // reset the counter if we have reached the end
		quotei = 0;
	}
	document.getElementById('quote').innerHTML = quotes[quotei]; // swap the html content
	$('p.quote').fadeIn('slow'); // then fade in the new quote
	setTimeout("fade_out_quote()",20000);
}

function fade_out_quote() { // fades out the current quote
	$('p.quote').fadeOut('slow'); // fade out the current quote
	quotei = quotei + 1;
	setTimeout("fade_in_quote()",1000);
}


function sniff() {
   var ua = navigator.userAgent;

   this.isSafari = function() {
      return /Safari/.test(ua);
   }
   
   this.getVersion = function(){
       if(this.isSafari()) {
         return Number(ua.match(/[0-9.]+$/));
      }
   }
}

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName]; 
	} else {
		return document.getElementById(movieName);
	}
}

function StopFlashMovie() {
	var flashMovie=getFlashMovieObject("header_audio");
	flashMovie.flashPause();
}

function PlayFlashMovie() {
	var flashMovie=getFlashMovieObject("header_audio");
	flashMovie.flashPlay();
}


$(document).ready(function() {
	
	// Set all the anchors to a hash
	$('#folio-thumb-listing li a').each(function() {
		$(this).attr('href','#');
	});
	
	$('#folio-thumb-listing li a').click(function() {
		var relRaw = $(this).attr('rel');
		var rel = relRaw.split('||');
		var ID = rel[1];
		var SRC = rel[0];
		$('#main-folio-img').attr('src','/photos/lg_'+SRC);
		$('#photo_caption').html(image_captions[ID]);
		$('#photo_descr').html(image_descrs[ID]);
		return false;
	});
});