
$(document).ready(function(){
	
	//add clear div
	$("#content").append("<div class='clear'></div>");
	
	//top link
	$("#footerNav li:first-child a").addClass("first");
	$('a[href=#top]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
    });

	//menu last item margin fix
	$("#nav li:last-child a").addClass("last");

	//drop down menu
	$('.children').each(function () {
		$(this).parent().hover(function () {
			$(this).find("a:first").addClass("hover");
			$('.children:eq(0)', this).show();
		}, function () {
			$(this).find("a:first").removeClass("hover");
			$('.children:eq(0)', this).hide();
		});
	});
	
	//normal rollovers
	$("#nav li:not(:has(ul))").hover(function() {
		$(this).find("a").addClass("hover");
	}, function() {
		$(this).find("a").removeClass("hover");
	});
	
	//ie7 dropdown absolute padding
	if ($.browser.msie && $.browser.version.substr(0,1) == 7) {
		$('.children > li').each(function () {
			pad = $('li', $(this).parent()).index(this)*30;
			pad -= 1;
			$(this).css("marginTop",pad+"px");
		});
	};
	
	//kill broken transition on IE
	if ($.browser.msie) {
		slideSpeed = 0;
	} else {
		slideSpeed = 1000;
		
		//no ie, preload css images
		//$.preloadCssImages();
	}
	
	myTimeout = 10000;
	
	//set ie6 warning images source
	if ($.browser.msie && $.browser.version.substr(0,1) == 6) {
		e("images/warning/");
		myTimeout = 0;
	}
	
	//slideshow
	$('#rotator').cycle({ 
	    timeout: myTimeout,
		speed: slideSpeed,
	    next: '#next',
	    prev: '#prev',
		pause: 1
	});
	
});
