
/*
 * Function to swap out tabs.
 * 
 * self = the href tab reference
 * */
function swap_tabs(self) {
	var parent = $(self).parent().parent();
	
	parent.find("a.selected").removeClass("selected");
	
	$(self).addClass("selected");
	
	var tab_link = $(self).attr("href")
	
	tab_link = tab_link.split("#");
	
	$(".tab_content").each(function() { $(this).hide(); });

	section = tab_link[1];
	
	$("#"+section).show();
	
	return false;
}

/*
This function switches the current language for the product descriptions
*/
function switch_language(the_select) {
        nDays = 360;
        var today = new Date();
        var expire = new Date();
        expire.setTime(today.getTime() + 3600000*24*nDays);
        var expire_time = expire.toGMTString();

        var the_index = the_select.selectedIndex;
        var the_selected = the_select.options[the_index].value;
        document.cookie='prod_lang='+the_selected+';expires='+expire_time;
        window.location.href = window.location;;
}

//Setup the fancy box features
$(document).ready(function() {
        //This will grab all of the image groups
        $("@[rel=lightbox]").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true, 'imageScale':false, 'centerOnScroll':false 
        ,'showCloseButton':true	
        
        }); 

        //These are for the authorized dealer popups
        $("#what_is_an_authorized_dealer").fancybox({ 
        'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true, 'imageScale':false, 'centerOnScroll':false ,
        'frameHeight':310 , 
        'frameWidth':630, 
        'hideOnContentClick' : false
        }); 
        $("#what_is_an_authorized_dealer_img").fancybox({ 
        'overlayShow': true, 'imageScale':false, 'centerOnScroll':false ,
        'frameHeight':310 , 
        'frameWidth':630, 
        'hideOnContentClick' : false
        }); 
})




/**********************/
/*                    */
/*  REVIEW FUNCTIONS  */
/*                    */
/**********************/
var RATING_PATHS = new Array();
function hoverRating(id,count,path) {
	for(i = 1; i <= count; i++) {
		RATING_PATHS[id+'_'+i] = $('#'+id+'_star'+i).attr('src');
		$('#'+id+'_star'+i).attr('src', path+'star_hover.gif');
	}
}

function idleRating(id) {
	for(i = 1; i <= 5; i++) {
		if(RATING_PATHS[id+'_'+i]) {
			$('#'+id+'_star'+i).attr('src', RATING_PATHS[id+'_'+i]);
			RATING_PATHS[id+'_'+i] = "";
		}
	}
}
