$(document).ready(function(){
	
	//Hide Form
	
	//clear values
	$("form#login-form input").each( function() {
		this.initial = this.value;
		if(this.type!='submit') {
			this.onfocus = function() {
				if(this.value == this.initial) {
					this.value = '';
				}
			}
			this.onblur = function() {
				if(this.value == '') {
					this.value = this.initial;
				}
			}
			
		}
	});

	$("form#login-form").hide();
	$("form#login-form").fadeTo("1", 0.0);

	/*$("a#customer-login").toggle(
	      function () {
			$("form#login-form").slideDown("slow");
			$("form#login-form").fadeTo("slow", 1.0);
			
			if($.browser.msie && $.browser.version.substr(0,3)=="6.0") {
				//alert($(this).css("background-image"));
				$(this).css({ backgroundImage:"url(images/customer-login-up.gif)" })
			} else {
		    	$(this).removeClass("arrow-down");
	        	$(this).addClass("arrow-up");	
			}
	      },
	      function () {
			$("form#login-form").fadeTo("slow", 0.0);
			$("form#login-form").slideUp("slow");
			if($.browser.msie && $.browser.version.substr(0,3)=="6.0") {
				//alert($(this).css("background-image"));
				$(this).css({ backgroundImage:"url(images/customer-login-down.gif)" })
			} else {
		    	$(this).removeClass("arrow-up");
		        $(this).addClass("arrow-down");	
			}
		    
	      }
	    );*/





	// IE6 fix's
	jQuery.each(jQuery.browser, function(i, val) {
	  if(i=="msie" && jQuery.browser.version.substr(0,3)=="6.0")
		
		// products hover
		$("div.product-area").hover(
		  function () {
		    $(this).addClass("hover");
		  },
		  function () {
		    $(this).removeClass("hover");
		  }
		);
		
		// display list
		$("li.headlink").hover(
		  function () {
		    $("li.headlink ul").addClass("hover");
		  },
		  function () {
		    $("li.headlink ul").removeClass("hover");
		  }
		);
		
		// product main nav
		$("li.headlink ").hover(
		  function () {
		    $("li.headlink").addClass("hover");
		  },
		  function () {
		    $("li.headlink").removeClass("hover");
		  }
		);
	});
	
	
	//Front Page Tabs System 
	
		//Show Menu - its not needed if there's no javascript
			$("ul#banner-nav").show();
	
	$(function () {
		var tabContainers = $('div#banner-wrapper > div');
		tabContainers.hide();
		$('#intro').show();
		
		$('div#banner-wrapper ul#banner-nav a').click(function () {
			tabContainers.hide();
			tabContainers.filter(this.hash).show();
			
						sIFR.replace(intro, {
						  	selector: 'div.banner h2 span.normal ',
						  	css: '.sIFR-root { color: #ffffff }'
						  	,wmode: 'transparent'
							,tuneWidth: 2
							,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
						});
				
						sIFR.replace(intro, {
						  	selector: 'div.banner h2 span.normal-orange',
						  	css: '.sIFR-root { color: #febd14 }'
						  	,wmode: 'transparent'
							,tuneWidth: 2
							,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
						});
						
						sIFR.replace(cad, {
						  	selector: 'div.banner h2 span.cad ',
						  	css: '.sIFR-root { color: #ffffff }'
						  	,wmode: 'transparent'
							,tuneHeight: -1
							,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
						});
				
				
						sIFR.replace(cad, {
						  	selector: 'div.banner h2 span.orange, div.product-area h2 span.orange, div.product-title h2 span.orange ',
						  	css: '.sIFR-root { color: #febd14 }'
						  	,wmode: 'transparent'
							,tuneHeight: -1
							,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
						});	
			
			$('div#banner-wrapper ul#banner-nav a').removeClass('selected');
			$(this).addClass('selected');
			return false;
		}).filter(':first').click()
	});
	
	

				
	//Slideshow 
	
	// Clients Fading Images
	if($("ul#banner-slideshow")) {
		setInterval(
		function() {
			var $active = $('ul#banner-slideshow li.active');

			if ( $active.length == 0 ) $active = $('ul#banner-slideshow li:last');

			var $next =  $active.next().length ? $active.next() : $('ul#banner-slideshow li:first');

			$active.addClass('last-active');

			$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); });

		}	
		, 3000 );
	}
	
	if($("ul#partner-slideshow")) {
		setInterval(
		function() {
			var $active = $('ul#partner-slideshow li.active');

			if ( $active.length == 0 ) $active = $('ul#partner-slideshow li:last');

			var $next =  $active.next().length ? $active.next() : $('ul#partner-slideshow li:first');

			$active.addClass('last-active');

			$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); });

		}	
		, 3000 );
	}
	
});