$(document).ready(function(){
	$("#menu-footer-menu > li:first > h3").wrap('<a href="/"></a>');
	if(!$.browser.msie){}
		$("ul.box-list > li > a > span.shadow").hover(function(){
			$(this).stop().animate({'opacity':0.0}, 300);
			$(this).parent().find('strong').css({'background-position':'0 -4px'});
		}, function(){
			if(!$(this).closest('li').is('.active')){
				if($.browser.msie){
					$(this).removeAttr('style');
				}
				else{
					$(this).stop().animate({'opacity':0.6}, 300, function(){ $(this).removeAttr('style'); });
				}
				$(this).parent().find('strong').removeAttr('style');
			}
		});
	
	//$(".banner-thumb-nav > li").hover(function(){
	//	$(this).stop().animate({'opacity':1.0}, 300);
	//}, function(){
	//	if(!$(this).is('.active')){
	//		$(this).stop().animate({'opacity':0.3}, 300, function(){ $(this).removeAttr('style')});
	//	}
	//});
	
	$("ul.box-list > li > a").click(function(){
		_par = $(this).parent().index();
		_id = $(this).attr('id');
		_this = this;
		if(!$(this).parent().hasClass('.active')){
			$("ul.box-list > li.active").find('strong').removeAttr('style');
			if($.browser.msie){
				$("ul.box-list > li.active").removeClass('active').find('.shadow').removeAttr('style');
				$(".ad-holder > .banner.active").css({"display":"none"}).removeClass('active').removeAttr('style').children('.block').removeClass('active').removeAttr('style');
				$(".box-frame.active").stop().css({"display":"none"}).removeClass('active').removeAttr('style').children('.block').removeClass('active').removeAttr('style');
				if((_par == 0))
				{ 
					$(".ban-nav-holder").css({"display":"block"});
					if($(".banner-thumb-nav > li.active").length == 0)
					{
						$(".banner-thumb-nav > li:first").addClass('active');
						$(".box-frame").eq(1).stop().css({"display":"block"}).addClass('active').children('.block:first').stop().css({"display":"block"}).addClass('active');
					}
					
					else
					{
						$(".box-frame").eq(1).stop().css({"display":"block"}).addClass('active').children('.block').eq($(".banner-thumb-nav > li.active").index()).stop().css({"display":"block"}).addClass('active');
					}
						_thumb_ban = $(".banner-thumb-nav > li.active > a").attr('id');
						$(".ad-holder > #"+_thumb_ban+"-bnr").css({"display":"block"}).addClass('active');
				} 
				else
				{
				    if(_par == 1){ _par=_par-1; }
				    $(".ad-holder > #"+_id+"-bnr").css({"display":"block"}).addClass('active');
				    $(".ban-nav-holder").stop().css({"display":"none"}); 
				    $(".box-frame").eq(_par).stop().css({"display":"block"}).addClass('active').children('.block').stop().css({"display":"block"}).addClass('active');
				}
				
			}//if $.browser.msie
			else{
				$("ul.box-list > li.active").removeClass('active').find('.shadow').animate({'opacity':0.6}, 300);
				$(".ad-holder > .banner.active").fadeOut('slow', function(){
					$(this).removeClass('active');
				});
				$(".box-frame.active").stop().fadeOut("slow", function(){
					$(this).removeClass('active').removeAttr('style').children('.block').removeClass('active').removeAttr('style');
					if((_par == 0)){ 
						$(".ban-nav-holder").fadeIn('slow');
						if($(".banner-thumb-nav > li.active").length == 0){
							$(".banner-thumb-nav > li:first").addClass('active');
							$(".box-frame").eq(1).stop().fadeIn('slow').addClass('active').children('.block:first').stop().fadeIn("slow", function(){
								$(this).addClass('active');
							});
						}
						else{
							$(".box-frame").eq(1).stop().fadeIn('slow').addClass('active').children('.block').eq($(".banner-thumb-nav > li.active").index()).stop().fadeIn("slow", function(){
								$(this).addClass('active');
							});
						}
						_thumb_ban = $(".banner-thumb-nav > li.active > a").attr('id');
						$(".ad-holder > #"+_thumb_ban+"-bnr").fadeIn('slow', function(){
						  $(this).addClass('active');
						});
					} 
					else{
						if(_par == 1){ _par=_par-1; }
						$(".ad-holder > #"+_id+"-bnr").fadeIn('slow', function(){
							$(this).addClass('active');
						});
						$(".ban-nav-holder").stop().fadeOut('slow'); 
						$(".box-frame").eq(_par).stop().fadeIn('slow').addClass('active').children('.block').stop().fadeIn("slow", function(){
							$(this).addClass('active');
						});
					}
				});
			}//not IE
			$(this).parent().addClass('active').find('.shadow').animate({'opacity':0.0}, 300);
		}
		return false;
	});
	
	$("ul.banner-thumb-nav > li > a").click(function(){
		_parThumb = $(this).parent().index();
		_idThumb = $(this).attr('id');
		if(!$(this).parent().is('.active')){
			$("ul.banner-thumb-nav > li.active").removeClass('active').removeAttr('style');
			$(this).parent().addClass('active');
			if($.browser.msie)
			{
				$(".ad-holder >.banner.active").css({"display":"none"}).removeClass('active');
				$(".ad-holder > #"+_idThumb+"-bnr").css({"display":"block"}).addClass('active');
				$(".box-frame.active").find('.block.active').stop().css({"display":"none"}).removeClass('active').removeAttr('style');;
				$(".box-frame > .block").eq(_parThumb+1).stop().css({"display":"block"}).addClass('active');			
			}
			
			else
			{
				$(".ad-holder >.banner.active").fadeOut('slow', function(){ $(this).removeClass('active'); });
				$(".ad-holder > #"+_idThumb+"-bnr").fadeIn('slow', function(){ $(this).addClass('active'); });
				$(".box-frame.active").find('.block.active').stop().fadeOut('slow',function(){
					$(this).removeClass('active').removeAttr('style');;
				});
				$(".box-frame > .block").eq(_parThumb+1).stop().fadeIn('slow').addClass('active');
			}
		}
		return false;
	});
});
