// JavaScript for the whole site

// have to put this in because of the media/photos file uses lightbox!!
// now you have to use $j anywhere you would normally use $
var $j = jQuery.noConflict();


// rollover images and swap
$j(document).ready(function() {
	$j("img.rollover").hover(
		function() { this.src = this.src.replace("_off", "_on"); },
		function() { this.src = this.src.replace("_on", "_off"); }
	);
});

// show product drop down
$j(document).ready(function(){
	$j("img[id='nav_products']").hover(function() {
		$j('#nav_product_dropdown').css("visibility", "visible");
	},
	function() {
		$j('#nav_product_dropdown').css("visibility", "hidden");
	});
});

$j(document).ready(function(){
	$j('#nav_product_dropdown').hover(function() {
		$j('#nav_product_dropdown').css("visibility", "visible");
	},
	function() {
		$j('#nav_product_dropdown').css("visibility", "hidden");
	});
});

// show product drop down
$j(document).ready(function(){
	$j("img[id='nav_media']").hover(function() {
		$j('#nav_media_dropdown').css("visibility", "visible");
	},
	function() {
		$j('#nav_media_dropdown').css("visibility", "hidden");
	});
});

$j(document).ready(function(){
	$j('#nav_media_dropdown').hover(function() {
		$j('#nav_media_dropdown').css("visibility", "visible");
	},
	function() {
		$j('#nav_media_dropdown').css("visibility", "hidden");
	});
});

/* products functions*/

// javascript:ShowSection('tab-description');
// for showing the product tabs
function ShowSection(SectionName) {
	HideSections();
	document.getElementById(SectionName).style.display = 'inline';
}

function HideSections() {
	document.getElementById('product_info').style.display = 'none';
	document.getElementById('product_features').style.display = 'none';
	document.getElementById('product_videos').style.display = 'none';
	document.getElementById('product_colors').style.display = 'none';		
}

function ShowProductPhoto(PhotoURL) {
	var fullURL = '/products/images/' +PhotoURL;
	// alert("passed" + fullURL);
	$j("#productPhoto").attr("src", fullURL);
}

// windrange rollovers
$j(document).ready(function() {
	$j("#windrange_twintip").hover(
		function() { this.src = this.src.replace("_off", "_on"); 
		var wrPath = $j("#windrange").attr("src");
		var newwrPath = wrPath.replace("_surf","_twintip");
		$j("#windrange").attr("src", newwrPath);
		var surfPath = $j("#windrange_surf").attr("src");
		var newSurfPath = surfPath.replace("_on", "_off");
		$j("#windrange_surf").attr("src", newSurfPath); 
		}, 
		function() { return 0;} // this.src = this.src.replace("_on", "_off"); 
	);
});

$j(document).ready(function() {
	$j("#windrange_surf").hover(
		function() { this.src = this.src.replace("_off", "_on"); 
		var wrPath = $j("#windrange").attr("src");
		var newwrPath = wrPath.replace("_twintip","_surf");
		$j("#windrange").attr("src", newwrPath);
		var ttPath = $j("#windrange_twintip").attr("src");
		var newttPath = ttPath.replace("_on", "_off");
		$j("#windrange_twintip").attr("src", newttPath); 
		}, 
		function() { return 0;} // this.src = this.src.replace("_on", "_off"); $j("img#windrange").src = $j("img#windrange").src.replace("_surf", "_twintip"); 
	);
});

