$(document).ready(function () {

	$(window).bind('resize', function(){
		$('#img_container').width($('#application').width());
	});
	
	// background image loader
	$('#bg').hide(); // hide image until its finished loading
	var imgSrc = $('#bg').attr('src');
	$('#bg').load(function(){
		$(this).hide();
		$('#img_container').removeClass('loader').append(this);
		$(this).fadeIn('slow');
	}).error(function(){
		alert('Failed to load image...');
	}).attr('src', imgSrc);
	
	// image zoomer thing
	var options =
	{
		zoomWidth: 250,
		zoomHeight: 400,
		title: false
	}
	$(".jqzoom").jqzoom(options);
	
	// product images
	$('.product_image').hide();
	$('.product_image:first').show();
	$('.pr_img_link:[rel=pd_img_01]').addClass('active');
	$('.pr_img_link').click(function(){
		var elem = $(this).attr('rel');
		$('.pr_img_link').removeClass('active');
		$(this).addClass('active');
		$('.product_image').hide();
		$('#'+elem).fadeIn();
		// had to duplicate this to make sure it worked on hide/show images... weird
		$(".jqzoom").jqzoom(options);
		return false;
	});
	
	// product tabs
	$('.product_tab').hide();
	$('.product_tab:first').show();
	$('.pr_tb_link:[rel=tb_01]').addClass('active');
	$('.pr_tb_link').click(function(){
		var elem = $(this).attr('rel');
		$('.pr_tb_link').removeClass('active');
		$(this).addClass('active');
		$('.product_tab').hide();
		$('#'+elem).fadeIn();
		return false;
	});
	
	// nav drop downs... 
	$('#nav li').mouseover(function(){
		$("#nav li ul").hide();
		$(this).find("ul").show();
	});
	$('#nav li ul').mouseout(function(){
		$(this).hide();
	});
	
});

/*
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;
*/
