$(document).ready(function(){


if($.browser.msie){
	$('#home-tabs .contents #ie').show();
	$('#home-tabs .contents #mozilla').hide();
	$('#home-tabs .contents #safari').hide();
	}
if($.browser.mozilla){
	$('#home-tabs .contents #mozilla').show();
	$('#home-tabs .contents #ie').hide();
	$('#home-tabs .contents #safari').hide();
}
if($.browser.safari){
	$('#home-tabs .contents #safari').show();
	$('#home-tabs .contents #ie').hide();
	$('#home-tabs .contents #mozilla').hide();
}

//-----------------------------------------------------------

$('.png-fix').pngfix();

//-----------------------------------------------------------

//-----------------------------------------------------------

$("#top-menu ul.topnav li").hover(
    function(){ 
     $(this).find("ul.subnav").slideDown('fast').show();
    }, 
    function(){
     $(this).find("ul.subnav").slideUp('fast');
    }
 );
 


//-----------------------------------------------------------


//-----------------------------------------------------------

      /*
      $('#home-tabs .contents a').hover(
      	function(){
      		$(this).css({
      		'font-family':'Georgia',
      		'padding': '2px',
			'font-size': '18px',
			'font-style':'italic',
			'background': '#68a13e',
			'color': 'white'
			});
		},
		function(){
			$(this).css({
			'font-family':'Arial',
			'padding': '0px',
			'font-size':'15px',
			'font-style':'normal',
			'background': 'none',
			'color': '#444'
			});
		});
		*/


//-----------------------------------------------------------


//------------------------------------------------------------

	$('#drop-down-panel').hide();
	$('#drop-down-button a').click(function(){
		$('#drop-down-panel').slideToggle(1000);
	});


//------------------------------------------------------------


//------------------------------------------------------------

	$('#top-menu ul li a').click(function(){
		$('#top-menu ul li a').removeClass('li-selected');
		$(this).addClass('li-selected');
	});


//------------------------------------------------------------


//------------------------------------------------------------
	
	var tabContainers = $('#home-tabs > div');
	$('#home-tabs #crisi-center-building').show();
	
	$('#home-tabs ul a').click(function(){
		//tabContainers.hide().filter(this.hash).show();
		var divheight = $(this.hash).height();
		//$('#home-tabs').height(divheight+60);
		$('#home-tabs').height(520);
		$(".contents:visible").stop().animate({     	
        	width: "0", 
        	opacity: "0"
        }, {duration:400
        });
        $(this.hash).stop().animate({
        	height: "460",
        	width: "630",
        	opacity: "1"},
        	{duration:1000
        });
        
        $('#home-tabs ul a').removeClass('selected');
        $(this).addClass('selected');
        
        //$(this.hash).stop().fadeIn(1000);
		return false;
		}).filter(':first').click();
		
	var anotherdivheight = $('#container-box').height();
	$('#main-content').height(anotherdivheight+20);
		
//------------------------------------------------------------

//------------------------------------------------------------

	$('#pic-box').cycle({fx: 'fade', speed: 1000, timeout: 5000});
	//$('#crisis-center-building').cycle({fx: 'fade', speed: 1000, timeout: 5000});
	
	//$('#pic-box').s3Slider({
      //timeOut: 4000
   //});
	
	$('#close').click(function(){
		$('#popup-box').fadeOut('slow');
	});
	
	
	
	 var ticker = $("#news-scroll ul");  
             
   //wrap dt:dd pairs in divs  
   /*ticker.children().filter("dt").each(function() {  
             
     var dt = $(this),  
       container = $("<div>");  
     
     dt.next().appendTo(container);  
     dt.prependTo(container);            
     container.appendTo(ticker);  
   }); */ 
                   
   //hide the scrollbar  
   $('#news-scroll').css("overflow", "hidden");  
           
   //animator function  
   function animator(currentItem) {  
               
     //work out new anim duration  
     var distance = currentItem.height(),  
     duration = (distance - Math.abs(parseInt(currentItem.css("marginTop")))) / 0.025;  
     //animate the first child of the ticker  
     currentItem.animate({ marginTop: (-distance-10) }, duration, "linear", function() {  
               
       //move current item to the bottom     
       currentItem.appendTo(currentItem.parent()).css("marginTop", 0);  
   
     //recurse  
     animator(currentItem.parent().children(":first"));  
     });   
   };  
           
   //start the ticker  
   animator(ticker.children(":first"));
   
   
    //set mouseenter  
 ticker.mouseenter(function() {  
             
   //stop current animation  
   ticker.children().stop();  
             
 });  
           
 //set mouseleave  
 ticker.mouseleave(function() {  
                     
   //resume animation  
   animator(ticker.children(":first"));  
 }); 
   
   
   var list_width = $('ul.topnav li ul.subnav').width();
   list_width = list_width - 30;
	
	$('ul.topnav li ul.subnav li a').width(list_width);
	
	
	//-------------------------
	
	
	
	
});


	



