
/***********************************************
*************  PRELOAD IMAGES  ****************
************************************************/

	$(document).ready(function(){
		//$("<img>").attr("src", "/images/misc/ajax-loader.gif");
		$("<img>").attr("src", "/images/navigation/navigation.png");
		$("<img>").attr("src", "/images/navigation/bg-dropdown.png");
	});



/***********************************************
************  HOMEPAGE BANNER   ****************
************************************************/

$(document).ready(function() {
		$('.slider').DDSlider({
			trans:'fading',
			waitTime: '5000',
			selector: '.slider_selector'
		});
});

/***********************************************
***  BUTTON ROLLOVER & PRELOAD  ****************
************************************************/

$(document).ready(function() {
	// button rollover
	if ($('.imgBtn') != null) {
		$('.imgBtn').hover(function(){
				if(!$(this).is('.disabled'))
					$(this).attr("src", $(this).attr("src").replace(/^(.*?)(?:-hover)?(\..*?)$/i,'$1-hover$2'));
			},
			function(){
					if(!$(this).is('.disabled'))
						$(this).attr("src", $(this).attr("src").replace(/^(.*)-hover(\..*?)$/i, '$1$2'));
				});
	}
	// preload image rollovers
	if ($("img.imgBtn, img[src^='images/buttons/btn'], input[src^='images/buttons/btn']") != null) {
	    $("img.imgBtn, img[src^='images/buttons/btn'], input[src^='images/buttons/btn']").each(function(){
			    $("<img>").attr("src", $(this).attr("src").replace(/(btn-.*)(\..*?)/i, '$1-hover$2'));
		    });
	}

/***********************************************
***  EXTERNAL LINKS  ***************************
************************************************/

	$("a[rel=external]").each(function() {
		$(this).addClass('external');
		$(this).attr({
			target: "_blank"
		});
	})
});


/***********************************************
********  ANIMATED SCROLLING   *****************
************************************************/

$(document).ready(function(){
		$('.GoTop').click(function(){
				var id = $(this).attr('href');
				if(id.length === 1) return;
				var ele = $(id);
				if(ele.length) {
					var destination = ele.offset().top;
					$('html:not(:animated), body:not(:animated)').animate({
							scrollTop: destination -20
						}, 700, 'easeOutQuint');
				}
			});
});

/***********************************************
***  COMPACT FORM (LABEL OVER INPUT)  **********
************************************************/

$(function(){
	$('form.compact input, form.compact select, form.compact textarea').focus(function(){
			$('label[for=' + $(this).attr('id') + ']').hide();
		});
	$('form.compact input, form.compact select, form.compact textarea').each(function(ele){
			if($(this).val().length > 0)
				$('label[for=' + $(this).attr('id') + ']').css({ display: "none" });
		});
	$('form.compact input, form.compact select, form.compact textarea').blur(function(){
			if($(this).val().length == 0)
				$('label[for=' + $(this).attr('id') + ']').show();
						});
	$('form.compact').removeClass('compact');
});



/***********************************************
******** SMALL ANIMATIONS AND EFFECTS **********
************************************************/  


$(document).ready(function() {


// Navigation


	   jQuery.each(jQuery.browser, function(i) {
	   if($.browser.msie){
		
		// for IE
		
		$('.subMenu').css('display','none');
		$('#miProducts').hover(function(){
		$(this).addClass('hover');
		$('.subMenu').css('display','block');
	 	 },
	 	 function () {
			$(this).removeClass('hover');
			$('.subMenu').css('display','none');
	 		}
		);
		
		
	   }else{
		
			$('.subMenu').css({
					opacity: 0
				});
			$('#miProducts').hover(function(){
					$(this).addClass('hover');
					$('.subMenu').stop().animate({
							opacity: 1
						}, 250);
				}, function () {
						$(this).removeClass('hover');
						$('.subMenu').stop().animate({
								opacity: 0
							}, 75, function(){
									
								});
					});

	   	}
	 });


// Submenu Category Image Change

	$('.subMenu li a').hover(function() {
		var imgId = $(this).attr('id');		
		$('#showImg div').removeClass();
		$('#showImg div').addClass('image');
		$('#showImg div').addClass(imgId);
		$('#showImg div').hide();
		$('#showImg div').fadeIn(75);
	});






// Home Categories

	$('.homeCategoryGrid li, .prodCategoryGrid li').hover(function(){
		$(this).find('a.head').stop().animate({
			backgroundColor: '#004175'
			}, 250, function(){});
	 	 },
	 	 function () {
			$(this).find('a.head').stop().animate({
			backgroundColor: '#017cc6'
			}, 150, function(){});
	 		}
		);
	
	
// Breadcrumbs

	$('.breadcrumbs a').hover(function(){
		$(this).stop().animate({
			color: '#fff'
			}, 200 );
	 	 },
	 	 function () {
			$(this).stop().animate({
			color: '#d0eafa'
			}, 100 );
	 		}
		);	


// What's New
	$('.whatsNew').hover(function(){
		$(this).stop().animate({
			backgroundPosition: '0px 0px'
			}, 150, 'easeInQuint' );
	 	 },
	 	 function () {
			$(this).stop().animate({
			backgroundPosition: '-300px 0px'
			}, 100, 'easeOutQuint' );
			
	 		}
		);
	

// Side Panel & Many Other Button Hovers

	$('#sidePanel a.btn, .videoTile a, #banner .wrapper a, .enquiryTab a.btn').hover(function(){
		$(this).stop().animate({
			opacity: 0.85
			}, 200, function(){});
	 	 },
	 	 function () {
			$(this).stop().animate({
			opacity: 1
			}, 100, function(){});
	 		}
		);
	
	
	// Side Panel Left Menu Links

	$('#sidePanel .leftSubMenu ul li a').hover(function(){
		$(this).stop().animate({
			color: '#00518b',
			backgroundColor: '#9ec6df'
			}, 200 );
	 	 },
	 	 function () {
			$(this).stop().animate({
			color: '#fff',
			backgroundColor: '#4399cd'
			}, 100 );
	 		}
		);


// Product Listing

	$('.pdfDownload').css({
		opacity: 0
		});
	$('.prodBox').hover(function(){
		$(this).find('.slideUp').stop().animate({
			backgroundColor: '#015c9e',
			bottom: 0,
			opacity:0.95
			}, 150, 'easeInQuint' );
		$(this).find('.pdfDownload').stop().animate({
			opacity:0.95
			}, 200, 'easeInQuint' );
	 	 },
	 	 function () {
			$(this).find('.slideUp').stop().animate({
			backgroundColor: '#017cc6',
			bottom: '-96px',
			opacity:1
			}, 100, 'easeOutQuint' );
			$(this).find('.pdfDownload').stop().animate({
			opacity:0
			}, 100, 'easeOutQuint' );

	});	



// PDF download button

	$('.pdfDownload').hover(function(){
		$(this).stop().animate({
			opacity:0.75
			}, 200 );
	 	 },
	 	 function () {
			$(this).stop().animate({
			opacity:1
			}, 100 );

	});
	


// Full Catalogue Download

	$('.catalogueRight .fullCatalogue a span').css('opacity', '0')
	$('.catalogueRight .fullCatalogue a span').hover(function(){
		$(this).stop().animate({
			opacity:1
			}, 200 );
	 	 },
	 	 function () {
			$(this).stop().animate({
			opacity:0
			}, 200 );

	});	
	
	
	
	
/***********************************************
***  TOOLTIPS  *********************************
************************************************/

	$(".tooltipTrigger").hover(function(){
		if($(this).parent().find(".tooltipContent").is(':animated'))
			return;
		$(this).parent().find(".tooltipContent").stop().addClass('open').css({ bottom: '22px' }).animate({
						bottom: 32,
						opacity: 1
					}, 300);
	},
	function(){
			
			$(this).parent().find(".tooltipContent").stop().css({ bottom: '32px' }).animate({
						bottom: 42,
						opacity: 0
					}, 150, function(){
							$(this).removeClass('open');
					});
		});






});






/***********************************************
************** BROWSER CONDITION ***************
************************************************/ 

/*$(document).ready(function() {
	jQuery.each(jQuery.browser, function(i) {
	   if($.browser.msie){
		
		
		
	   }else{
		
		
		
		
		
		
		
	   }
	 });
	 });
*/


