// JavaScript Document
// general UI jquery functions

$(document).ready(function(){
	
  var input = document.getElementsByTagName('input');
  for (var a=input.length-1; a >= 0; a--) {
    if (input[a].type != 'text') { continue; } // skips non-text inputs
    input[a].mask = input[a].value;
    input[a].onfocus = function() {
      if (this.value == this.mask) { this.value = ''; }
    };
    input[a].onblur = function() {
      if (this.value == '') { this.value = this.mask; }
    };
  }
  
  
});  



// ACCORDION NAV
	function initMenu() {	
		$('#sidebarleft ul#categoryAccordion').show();
		$('#categoryAccordion ul').hide();
		$('#categoryAccordion ul#on').show();
		$('#categoryAccordion li a').click(
		function() {
			var checkElement = $(this).next();
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			return false;
		}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('#categoryAccordion ul:visible').slideUp('normal');
			checkElement.slideDown('normal');
			return false;
		}
		}
		);
	}
	
$(document).ready(function()
{initMenu();}
);
// END ACCORDION NAV






// series page show more description
$(document).ready(function(){

		$(".expandedDescription").hide();
		$(".showExpanded").toggle(function(){
		$(this).children(".expandedDescription").show();
		//$(this).text($(this).text() == 'Show box' ? 'Hide box' : 'Show box');
		$(this).children(".descLink").text('Less');
		
		}, function(){
		$(this).children(".expandedDescription").hide();
		$(this).children(".descLink").text('More');
		});

});
// series page show more description
	

// image gallery rel link activations
$(document).ready(function(){
				$("a[rel='s1']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s2']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s3']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s4']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s5']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s6']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s7']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s8']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s9']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s10']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s11']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s12']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s13']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s14']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s15']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s16']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s17']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s18']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s19']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s20']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s21']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s22']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s23']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s24']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s25']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s26']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s27']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s28']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s29']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s30']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s31']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s32']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s33']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s34']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s3%']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s36']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s37']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s38']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s39']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
				$("a[rel='s40']").colorbox({transition:"fade", innerWidth:"900px", opacity:"0.7"});
	
				$("a[rel='googlemap1']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap2']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap3']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap4']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap5']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap6']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap7']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap8']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap9']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap10']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap11']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap12']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap13']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap14']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap15']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				$("a[rel='googlemap16']").colorbox({opacity:"0.5", iframe:true, innerWidth:800, innerHeight:450});
				
				$("a[rel='youtube']").colorbox({iframe: true, innerWidth: 480, innerHeight: 385, opacity: 0.6, outerHeight: 435});

});
// image gallery rel link activations




/*
// brands page interactivity
$(document).ready(function(){
			
			
				var activeOpacity   = 1.0,
					inactiveOpacity = 0.3,
					fadeTime = 200,
					brandids = "body.ourbrands #brandsGrid li a",
					categories = "body.ourbrands #categorySelects li";
					
			
				$(categories).fadeTo(1000, inactiveOpacity);
			
				$(brandids).hover(
					function(){
						var brand = $(this).attr("class");
						 $(categories).each(function(i) {
						if($(this).hasClass(brand)){
							$(this).fadeTo(200, activeOpacity);
						}
						//this.hasClass(brand.attr("class")).fadeTo(fadeTime, activeOpacity);						  
							});
					},
					function(){
							$(categories).fadeTo(fadeTime, inactiveOpacity);
					});
				
				
			


			
});						   
// brands page interactivity
*/


/*
// brand detail page show/hide models

$(document).ready(function(){

		$(".modelhide").hide();
		$(".seriesItem").toggle(function(){
		$(this).children(".modelhide").show();
		$(this).find(".download .viewmodels").text('Hide Models');
		
		}, function(){
		$(this).children(".modelhide").hide();
		$(this).find(".download .viewmodels").text('View Models');
		});

});
// brand detail page show/hide models
*/


// brand detail page show/hide models

$(document).ready(function(){

		$(".modelhide").hide();
		
			
		$(".viewmodels").toggle(function() {
		    $(this).parent().parent().parent().find(".modelhide").show();
			$(this).text('Hide Models');
        }, function() {
            $(this).parent().parent().parent().find(".modelhide").hide();
			$(this).text('View Models');
		});

});
// brand detail page show/hide models

// brands page interactivity
$(document).ready(function(){
			
			
				var activeOpacity   = 1.0,
					inactiveOpacity = 0.3,
					fadeTime = 200,
					brandids = "body.ourbrands #brandsGrid li a.branditem"
					brandids2 = "body.ourbrands #brandsGrid li a"
					mouseoutbrands = "body.ourbrands #brandsGrid"
					;
					
			
				//$(brandids).fadeTo(1000, inactiveOpacity);
			
				$(brandids).hover(
					function(){
						$(this).removeClass('branditem');
						$(this).fadeTo(0, activeOpacity);
						$(brandids).fadeTo(0, inactiveOpacity);
						
						 
					},
					function(){
							$(this).addClass('branditem');	
							$(this).fadeTo(0, inactiveOpacity);
							//$(brandids).fadeTo(0, activeOpacity);
							
					});
				
				$(mouseoutbrands).hover(
					function(){
						return false;	 
					},
					function(){	
							$(brandids2).addClass('branditem');
							$(brandids).fadeTo(0, activeOpacity);
					});
		
});						   
// brands page interactivity


// floated and wrapped lists on landing pages		
		$(document).ready(function(){
			//$('ol.categorySelects').makeacolumnlists({cols: 4, colWidth: 190, startN: 1, equalHeight:true});
			$('ol.categorySelects').makeacolumnlists({cols:5,colWidth:180,equalHeight:false,startN:1});			
			$("#categorySelects").show();
		});
// floated and wrapped lists on landing pages



// floated and wrapped lists on landing pages		
		$(document).ready(function(){
			
			$('.twoCol').makeacolumnlists({cols: 2, colWidth: 470,  startN: 1});
			$('.fourCol').makeacolumnlists({cols: 4, colWidth: 180,  startN: 1});
			
		});
// floated and wrapped lists on landing pages




// engine selector effects 
$(document).ready(function(){
		$("div#tableWrapper table").hide();
		$("div#tableWrapper h3").hide();
		$("table.range1").show();
		$("h3.range1").show();
								   
								   
								   
		$(".range1").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range2").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range3").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range4").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range5").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range6").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		$(".range7").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true/*, hover:'cross', click:'cross'*/} );
		
		//$("td:nth-child(6)").addClass('leftalign');
		//$("td:nth-child(7)").addClass('leftalign');
		
		$("a.range1").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range1").show();
				$("h3.range1").show();
		});
		
		$("a.range2").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range2").show();
				$("h3.range2").show();
		});
				
		$("a.range3").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range3").show();
				$("h3.range3").show();
		});
						
		$("a.range4").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range4").show();
				$("h3.range4").show();
		});
								
		$("a.range5").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range5").show();
				$("h3.range5").show();
		});
		
		$("a.range6").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range6").show();
				$("h3.range6").show();
		});
		
		$("a.range7").click(function() {
				$("div#tableWrapper table").hide();
				$("div#tableWrapper h3").hide();
				$("table.range7").show();
				$("h3.range7").show();
		});
		
		$("a.rangeAll").click(function() {
				$("div#tableWrapper table").show();
				$("div#tableWrapper h3").show();
				$("div#tableWrapper table").find('.highlight').removeClass('highlight');
		});
		
}); 

$(document).ready(function(){
		$(".tb1").colorize({ hiliteClass:'highlight', hoverClass:'tablehover', bgColor:'#fefefe', altColor:'#efefef', oneClick:true, hover:'cross', click:'cross', banColumns:[0]} );
		$(".tb1 td:nth-child(1)").addClass('leftalign');
}); 
// engine selector effects 

