		//Make sure JQuery doesn't interfere with prototype
		jQuery.noConflict(); 


		//This sets the blueswitch link's mouseover
		window.onload = Setup;
		
		var tab_text = new Array();
		tab_text[0] = 'Shop online for all your camera and video needs.';
		tab_text[1] = 'Unique University';
		tab_text[2] = 'Photo Lab';
		tab_text[3] = 'Blog';
		tab_text[4] = 'Events Calendar';
		
		function Setup(){
			SetUpBSLink();
			
			//Set up the tab tooltips
			for(i = 0; i < tab_text.length; i++){
				eval("jQuery('#tab" + (i + 1) + "').mousemove(function(e) {" + 
												   "HideTooltip('tab" + (i + 1) + "_tooltip');" + 
												   "ShowTooltip('" + tab_text[i] + "', e.pageX, e.pageY, 'tab" + (i + 1) + "_tooltip');" +  
													"} );");
				
				eval("jQuery('#tab" + (i + 1) + "').mouseout(function() {HideTooltip('tab" + (i + 1) + "_tooltip');} );");
			}
			
			//Set the wmode of all embeds to transparent
			jQuery('embed').attr('wmode', 'transparent');
			
			//make the font size button fixed
			jQuery('#pageControls').unbind('mouseenter mouseleave');
		}
		
		function SetUpBSLink(){
			jQuery('#blue').mouseover(ChangeLink);
			jQuery('#switch').mouseover(ChangeLink);
			
			jQuery('#blue').mouseout(ChangeLinkOut);
			jQuery('#switch').mouseout(ChangeLinkOut);
		}

        function ChangeLink() {
        	jQuery('#blue').addClass('over');
        	jQuery('#switch').addClass('over');
        }

        function ChangeLinkOut() {
        	jQuery('#blue').removeClass('over');
        	jQuery('#switch').removeClass('over');
        }

        function GetWidth() {
            var x = 0;
            if (self.innerHeight) {
                x = self.innerWidth;
            }
            else if (document.documentElement && document.documentElement.clientHeight) {
                x = document.documentElement.clientWidth;
            }
            else if (document.body) {
                x = document.body.clientWidth;
            }
            return x;
        }

        function GetHeight() {
            var y = 0;
            if (self.innerHeight) {
                y = self.innerHeight;
            }
            else if (document.documentElement && document.documentElement.clientHeight) {
                y = document.documentElement.clientHeight;
            }
            else if (document.body) {
                y = document.body.clientHeight;
            }
            return y;
           }
		   
		   /** -------------------- **/
		   
		   /** Nav Dropdown **/

           function ShowDropdown(id) {
           	jQuery('#' + id).css('display', 'block');
           }

           function ShowDropdownWithPosition(id, left_position) {
           	jQuery('#' + id).css('left', left_position).css('display', 'block');
           }

           function HideDropdown(id) {
           	jQuery('#' + id).css('display', 'none');
           }
		   
		   /** End Nav Dropdown **/		   
		   
		   /** -------------------- **/
		   
		   /** Slideshow **/
		   
		   var current_slide = 0;

           function AddSlideshowElement(img_src, link_url) {
           	current_controls = jQuery('.Control').length;

           	control_class = 'Control';
           	image_css = 'opacity:0;z-index:-' + (current_controls + 1) + ';';
           	
           	//If this is the first slideshow element, set it as selected
           	if (current_controls == 0) {
           		control_class += ' Selected';
           		image_css = 'opacity:1.0;/*z-index:-' + (current_controls + 1) + ';*/';
           	}

           	jQuery('.SlideshowControls').append('<div class="' + control_class +
           	     '" onclick="SetSelectedSlideshow(' + (current_controls + 1) + ');StopSlideshow();RotateSlideshow(' + (current_controls + 1) + ')">' + (current_controls + 1) + '</div> ');


           	jQuery('.Slideshow').append('<a href="' + link_url + '"><img class="SlideshowImage" style="' + image_css + '" src="' + img_src + '" /></a>');
           }

           function SetSelectedSlideshow(element_num) {
           	element_num -= 1;
			
           	jQuery('.SlideshowControls .Control').removeClass('Selected');
           	jQuery(jQuery('.SlideshowControls .Control')[element_num]).addClass('Selected');

			jQuery('.Slideshow .SlideshowImage').css('z-index', '-1');
			jQuery(jQuery('.Slideshow .SlideshowImage')[element_num]).css('z-index', '100');

           	//jQuery('.Slideshow .SlideshowImage').css('opacity', 0).css('display', 'none');			
           	jQuery(jQuery('.Slideshow .SlideshowImage')[current_slide]).animate({opacity: 0.0}, 600);
    
           	//jQuery(jQuery('.Slideshow .SlideshowImage')[element_num]).css('display',  'block');
           	jQuery(jQuery('.Slideshow .SlideshowImage')[element_num]).animate({opacity: 1.0}, 600);
			
			current_slide = element_num;
           }
		   
		   var current_element;
		   var slideshow_interval;
		   
		   function RotateSlideshow(start){
			   current_element = (start == null) ? 1 : start;
			   
			   slideshow_interval = setInterval(function(){
											num_elements = jQuery('.SlideshowControls .Control').length;
											current_element = (current_element == num_elements) ? 1 : current_element + 1;
											SetSelectedSlideshow(current_element);
										}, 4500);
		   }
		   
		   function StopSlideshow(){
			   clearInterval(slideshow_interval);
		   }
		   
		   /** End Slideshow **/

		   /** -------------------- **/
		   
		   /** Brands Scroller **/
			
           var brands_width = 856;
           var moving = false;
			var brand_urls = new Array();
			var brand_imgs = new Array();

		   function AddBrandLogo(img, url){
				brand_imgs.push(img);
				brand_urls.push(url);
				
				AppendBrand(img, url);
		   }
		   
		   function AppendBrand(img, url){
				brand_html = '<td><a href="' + url + '"><img src="' + img + '" alt="" /></a></td>';
				jQuery('.HomeBrandsFilm tr').append(brand_html);			   
		   }
		   
		    function PrependBrand(img, url){
				brand_html = '<td><a href="' + url + '"><img src="' + img + '" alt="" /></a></td>';
				jQuery('.HomeBrandsFilm tr').prepend(brand_html);			   
		   }
			
           function ScrollBrandsLeft() {
           	if (!moving) {
           		if (jQuery('.HomeBrandsFilm').position().left < 0) {
           			jQuery('.HomeBrandsFilm').animate({ left: '+=' + brands_width + '' }, 800, function() { moving = false; });
           			moving = true;
           		}
				else{
					//CreateBrandLoopLeft();
				}
           	}
           }

           function ScrollBrandsRight() {
           	if (!moving) {
           		if (jQuery('.HomeBrandsFilm').position().left > -jQuery('.HomeBrandsFilm').width() && jQuery('.HomeBrandsFilm').width() - (-jQuery('.HomeBrandsFilm').position().left) > brands_width) {
           			jQuery('.HomeBrandsFilm').animate({ left: '-=' + brands_width + '' }, 800, function() { moving = false;CreateBrandLoopRight(); });
           			moving = true;
           		}
				
           	}
           }
		   
		   function CreateBrandLoopLeft(){			   
				//If we're at the left end of the brands carousel, append the begining of the brands so as to make a loop
				if (jQuery('.HomeBrandsFilm').position().left < 0) {
					for(i = 0; i < brand_imgs.length; i++){
						PrependBrand(brand_imgs[i], brand_urls[i]);
					}
				}
		   }
		   
		   
		   function CreateBrandLoopRight(){			   
				//If we're at the right end of the brands carousel, append the begining of the brands so as to make a loop
				if (jQuery('.HomeBrandsFilm').position().left > -jQuery('.HomeBrandsFilm').width() && jQuery('.HomeBrandsFilm').width() - (-jQuery('.HomeBrandsFilm').position().left) > brands_width) {
					for(i = 0; i < brand_imgs.length; i++){
						AppendBrand(brand_imgs[i], brand_urls[i]);
					}
				}
		   }
		   
		   /** End Brands Scroller **/
		   
		   /** -------------------- **/
		   
		   /** Home Carousel **/
		   
		   function SetHomeCarousel(num){		   	
		   	max_tabs = 5;
			
			for(i = 0; i <= max_tabs; i++){
				SetTabOff(jQuery('#home_tab' + i));
			}
			
			SetTabOn(jQuery('#home_tab' + num));
			
			id = 'carousel' + num;
			
			jQuery('#carousel_wrapper').html(jQuery('#' + id).html());
		   }
		   
		   /** End Home Carousel **/
		   
		   /** -------------------- **/
		   
		   /** Tooltip **/
		   
		   function ShowTooltip(text, x, y, id){
			   jQuery('body').append('<div class="Tooltip" id="' + id + '" style="position:fixed;top:' + (y + 15) + 'px;left:' + (x + 10) + 'px"><div class="Inner">' + text + '</div>');
		   }
		   
		   function HideTooltip(id){
			   	jQuery('#' + id).remove();
		   }
		   
		   /** End Toolip **/
		   
		   /** Tab Generator **/
		   
		   function GenerateTab(css_class, text, onclick, attrs){
				//The actual image backgrounds are located in the tabs.css file
				html = '<table cellspacing="0" cellpadding="0" class="Tab ' + css_class +'" onclick="' + onclick + '" ' + attrs + '>';
				html += '<tr><td class="Left">&nbsp;</td>';
				html += '<td class="Center">' + text + '</td>';
				html += '<td class="Right">&nbsp;</td></tr>';
				html += '</table>';
				
				return html;
		   }
		   		   
		   function ToggleTab(element){
			   if(jQuery(element).is('.Over')){
				   	SetTabOff(element)
			   }
			   else{
					SetTabOn(element);
			   }
		   }
		   
		   function SetTabOn(element){
		   	jQuery(element).addClass("Over");
		   }
		   
		   function SetTabOff(element){
			 jQuery(element).removeClass("Over");
		   }
		   
		   /** End Tab Generator **/
		   
		   function ChangeCheckoutImage(section){
			   //get base image url
			   	var image_dir = '';
				
				image_url = jQuery('#checkout_progress_image').attr('src');
				split_url = image_url.split('/');
				
				for(i = 0; i < split_url.length - 1; i++){
					image_dir += split_url[i] + '/';
				}
				
				
				if(section == 'billship'){
					jQuery('#checkout_progress_image').attr('src', image_dir + 'progress_billship.png');
				}
				else if(section == 'review'){
					jQuery('#checkout_progress_image').attr('src', image_dir + 'progress_review.png');					
				}
		   }

