// JavaScript Document
$(document).ready(function(){

	$('#hero ul.topten a').each(function(){
		// We make use of the .each() loop to gain access to each element via the "this" keyword...
		$(this).qtip(
		{
			 prerender: true,
			 content: {
				text: '<img src="loader.gif" alt="Loading..." class="gridloader"/>',				 
				ajax: {
               		url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load			
            	},				
			},
			position: {
				at: 'left center', // Position the tooltip
				my: 'right center',
				viewport: $(window), // Keep the tooltip on-screen at all times
				effect: true // Disable positioning animation
			},
			show: {
				event: 'mouseenter',
				solo: true, // Only show one tooltip at a time			
			},
			hide: 'mouseleave',
			style: {
				classes: 'ui-tooltip-wiki ui-tooltip-light ui-tooltip-shadow'
			}
		})
	});

	$('.continuebtn[rel]').qtip({
	   content: {
		  attr: 'rel'			
	   },
	   position:  {
		  my: 'right center', 
		  at: 'left center'
	   },
	   show: 'mouseenter',
	   hide: 'mouseleave',
	   style: { 
		  tip: true,
		  classes: 'ui-tooltip-skicom'
	   }
	});
	
	$('#chatbox').qtip({
	   content: 'Chat live with a Ski.com expert',
	   position:  {
		  my: 'top left', 
		  at: 'bottom left'
	   },
	   show: 'mouseenter',
	   hide: 'mouseleave',
	   style: { 
		  tip: true,
		  classes: 'ui-tooltip-skicom2'
	   }
	});
	
	$('#callbox').qtip({
	   content: 'Leave your number and we will call you',
	   position:  {
		  my: 'top left', 
		  at: 'bottom left'
	   },
	   show: 'mouseenter',
	   hide: 'mouseleave',
	   style: { 
		  tip: true,
		  classes: 'ui-tooltip-skicom2'
	   }
	});
	
	
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	$('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});


    $(".rfq").colorbox({
		width: "800",
		height:"810",
		iframe: true,
		preloading:true,
		slideshow:false,
		slideshowAuto:false,
		previous:"",
		next:"",
		current:"",
		close:"X",
		overlayClose:false
	});
	
	//$(".obermeyer").colorbox({
		//width: "960",
		//height:"800",
		//iframe: true
	//});


	$('#cntwindow04 ul.trailmaps a').colorbox({
		rel:'lightbox',
		preloading:false,
		slideshow:false,
		slideshowAuto:false,
		previous:"",
		next:"",
		current:""
	});
	$('#cntwindow04 ul.cam a').colorbox({
		rel:'lightbox',
		preloading:false,
		slideshow:false,
		slideshowAuto:false,
		previous:"",
		next:"",
		current:""
	});
	

});
