var popups = new Array();
$(function(){
	
	$("a[rel=external]").live("click", function(){this.target="_blank"});
	$('#gnav li, #lnav li').css('cursor','pointer').click(function(e){e.stopPropagation(); if(this.firstChild.href)window.location=this.firstChild.href;});
	$(".IE6 li, .IE6 li").hover(function(){$(this).addClass('hover');}, function(){$(this).removeClass('hover');});
	$(".IE6 li:first-child").addClass('first-child'); 
	$('a').each(function(){if(this.href==window.location) $(this).parents("li").addClass('indicator');});
	
	$("a[rel=popup]").each(function(){ popups.push(new Image());popups[popups.length-1].src=this.href;}).live("click", function(){
		pic1= new Image();pic1.src=this.href;
		try{popup.close();} catch(e){}
		popup = window.open("","popup","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+pic1.width+", height="+pic1.height);
		$(popup.document.body).html("<img src='"+this.href+"' alt=''/>").css("margin",0);
		return false;
	}); 
	
	$(".showing").show();
	rotate();
 
});
function rotate(){
	$(".showing").fadeTo(3000,1,function(){
		var next = $(".showing").next().length>0?$(".showing").next(): $("#imag img").eq(0);
		$(".showing").fadeOut(1000);
		$(".showing").removeClass("showing");
		next.addClass("showing");
		next.fadeIn(1000,rotate);
	});
}

