// JavaScript Document
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		}
	],
	dataOS : []
};

function roundElems(){
BrowserDetect.init();
if(BrowserDetect.browser == 'Safari'){
	var oldonload = window.onload;
	window.onload = function(){
		if(oldonload)oldonload();

Nifty("div#cat_advproduct_search","");



	}
	
}else{

Nifty("div#cat_advproduct_search","");

}
}

$(document).ready(function(){
  
	$(".hide_desc").click(function(){$(".pane2, .pane3, .pane4, .pane5").animate({ opacity: "hide" }, "slow");
	id = setTimeout("$('.pane1').animate({ opacity: 'show' }, 'slow')",500);});
	$(".hide_adv").click(function(){$(".pane1, .pane3, .pane4, .pane5").animate({ opacity: "hide" }, "slow");
	id = setTimeout("$('.pane2').animate({ opacity: 'show' }, 'slow')",500);});
	$(".hide_image").click(function(){$(".pane1, .pane2, .pane4, .pane5").animate({ opacity: "hide" }, "slow");
	id = setTimeout("$('.pane3').animate({ opacity: 'show' }, 'slow')",500);});
	$(".hide_discus").click(function(){$(".pane1, .pane2, .pane3, .pane5").animate({ opacity: "hide" }, "slow");
	id = setTimeout("$('.pane4').animate({ opacity: 'show' }, 'slow')",500);});
	$(".hide_askq").click(function(){$(".pane2, .pane1, .pane3, .pane4").animate({ opacity: "hide" }, "slow");
	id = setTimeout("$('.pane5').animate({ opacity: 'show' }, 'slow')",500);});

});



function theRotator() {
	//Set the opacity of all images to 0
	$('div#rotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div#rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',6000);
	
}

function rotate() {	
	//Get the first image
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

$(document).ready(function() {		
	//Load the slideshow
	theRotator();
});

$(document).ready(function(){
        $('ul#nav').NavDropDown({
            duration:300, 
            hoverElement:'li',
            hoverClass:'hover',
            dropHolder:'div',
            showEffect:'fade' // slide, fade, slide&fade
        });                
    });


  