/* 
 * Cache $330a9954eabc95e38ed7fdb211270eb8-astro.js$
 * Generated: Tue Jan 24 10:00:10 2012
 * 
 * Contains:
 * - js/product_tabs.js:20110310111843
 * - js/product_slideshow.js:20110310111843
 */

/* File: js/product_tabs.js:20110310111843 */
function activateTab(dom) {

	// Phil: JQuery

	var obj = $(dom);
	

	var item = obj.attr('href').match(/#(\w+)$/);

	// Remove Border, icky icky
	obj.blur();

	// set all tabs to be not active, and all content areas to be hidden
	
	$('.tab_content').addClass('tab_inactive');
	$('#tab_bar').find('li').removeClass('current');

	// Phil: Set current tab to not be hidden after you'v set the others
	
	$('#tab_content_' + item[1]).removeClass('tab_inactive');
	$('#tab_' + item[1]).addClass('current');

	return true;
}

function activateTabId(input) {

	alert(input);
	
	var item = input.match(/#(\w+)$/);

	alert("Item 1"+item[1]);

	// Remove Border, icky icky
	obj.blur();

	// set all tabs to be not active, and all content areas to be hidden
	
	$('.tab_content').addClass('tab_inactive');
	$('#tab_bar').find('li').removeClass('current');

	// Phil: Set current tab to not be hidden after you'v set the others
	
	$('#tab_content_' + item[1]).removeClass('tab_inactive');
	$('#tab_' + item[1]).addClass('current');

	return true;
}

/* End: js/product_tabs.js:20110310111843 */

/* File: js/product_slideshow.js:20110310111843 */
/* Complement of product template product_fading.js */
var container   = null;
var target      = null;
var nextCaption = null;

function startPhoto() {
	if (!document.getElementById) return;
	//set references to container && target ** a href
	container = document.getElementById(containerID);
	target = document.getElementById(targetID);
	switchContainer();
	timeout = window.setTimeout("nextPhoto()", 3000);
}

function nextPhoto() {
	if (!document.getElementById) return;
	//only one transition at a time, please
	clearTimeout(timeout);
	//flip image and container
	switchContainer();
	//load next image
	target.src = imageNames[indexValue];
	if(typeof(imageCaptions) == 'object'){
		nextCaption = unescape(imageCaptions[indexValue]);
	}
	//get new index for the next reveal
	if (indexValue == imageNames.length - 1) {
		indexValue = 0;
	} else {
		indexValue += 1;
	}
	//fade image in
	timeout = window.setTimeout("reveal('0', 0)", 500);
	if(nextCaption !== null){
		window.setTimeout( function(){ 
			$('#image_caption').fadeTo(1500, 0, function(){
				$('#image_caption').html(nextCaption).fadeTo(1300, 1);
			}) 
		}, 500);
	}


}

function switchContainer() {
	if (!document.getElementById) return;
	//make container background current image
	container.style.backgroundImage = 'url(' + target.src + ')';
	//make image 0
	setalpha(0) ;
}

function reveal(opacity, fast) {
	if (!document.getElementById) return;
	if (document.getElementById && opacity <= 100 ) {
		setalpha(opacity);
		if (fast) {
			opacity += 50;
		} else {
			opacity += 2;
		}
		//store globally for restart
		globalOpacity = opacity;
		//fade next step
		if (fast) {
			timeout = window.setTimeout("reveal("+opacity+", 1)", 40);
		} else {
			timeout = window.setTimeout("reveal("+opacity+", 0)", 40);
		}
	} else {
		//we are done ... load next photo in 3 seconds
		timeout = window.setTimeout("nextPhoto()", 3000);
		switchContainer();
	}
}

function setalpha(opacity) {
	if (document.getElementById ) {
		//fade next step based on browser compatibility
		if (target.style.MozOpacity!=null) {
			target.style.MozOpacity = (opacity/100) - 0.001;
		} else if (target.style.opacity!=null) {
			target.style.opacity = opacity/100;
		} else if (target.style.filter!=null) {
			target.style.filter = "alpha(opacity=" + opacity + ")";
		} else if (target.style.KhtmlOpacity!=null) {
			target.style.KhtmlOpacity = opacity/100;
		}
	}
}

/* End: js/product_slideshow.js:20110310111843 */


