	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	var	version = parseFloat(navigator.appVersion.split("MSIE")[1]);
		$(document).ready(function(){
		$('#case_ul').click(function(){
             
       $('#media_ul').removeClass('active_arch_head');      
       $('#case_ul').addClass('active_arch_head');      
       $('#media_arch').hide();      
       $('#case_arch').show();      
             
        });
     $('#media_ul').click(function(){
       $('#case_ul').removeClass('active_arch_head');      
       $('#media_ul').addClass('active_arch_head');      
       $('#case_arch').hide();      
       $('#media_arch').show();      
             
       });
			$('#pop_div span').click(function(){
					  $("#pop_div").hide();
			});

		$('ul.ban_tab li a').click(function (e) {
				e.preventDefault();
				clearTimeout(timer);  // Since the timeout is assigned to a variable, we can successfully clear it now
		      $('ul.ban_tab li').removeClass('active_tab');
			  if(!is_chrome)
		      $('ul.ban_tab li a').animate({ backgroundColor: "#404040" }, 'fast');
			  $("div#ban_div div").fadeOut(1000);
			  var tabId= $(this).parent().attr('id');
			  var pos = tabId.charAt(tabId.length-1);
			  $("#ban" + pos).fadeIn(1000);
			   $(this).parent().addClass('active_tab');
			  if(!is_chrome)
		      $(this).animate({ backgroundColor: "#ffffff" }, 'slow');
			});
		
			
				$("#team_div > ul img").bind('mouseenter',function(){
					var top = this.parentNode.offsetTop; 
					var left = this.parentNode.offsetLeft; 
					var width = this.parentNode.parentNode.offsetWidth;
					 var right = width - left -103;
					if ((version >= 7) && (version < 8) && (document.body.filters)) {
						 right = width - left -100;
						 top = top +33;
						 
					}
						 
					if ((version >= 6) && (version < 7) && (document.body.filters)){ 
						left= left-10;
						right = width - left -95;
					}
					var img =$(this).attr('src');
					var id =$(this).attr('id');
					$("#pop_img").hide().css({'top': top-4 +'px','right': "",'left': left-3 +'px'}).attr({'src': img,'width': '92'}).show();
					  
				$('#pop_img').bind('click',function(){
					var content = "";
					content = $("#" + id + "p").html();
					var div = $("#pop_div");
					  div.hide().css('top', top-16 +'px');
					  if(left < 550){
						  div.css({'right': "",'left': left-20 +'px'});
						  div.children('img').removeClass('float_right').attr({'src': img,'width': '92'}); 
						  div.children('#pop_content').html(content);	
					  }else{
						  div.css({'left': "",'right': right +'px'});
						  div.children('img').addClass('float_right').attr({'src': img,'width': '92'});
						  div.children('#pop_content').html(content);	
					  }
					  div.show();
				});
					  
				});
				
    });
	
	setTimeout("changeTab()",5000);
	var i = 1;
		var timer = null; 
	var changeTab = function (){
			i = i +1;
			if(i==6)
				i=1;
			  $("div#ban_div div").fadeOut(1000);
			  $("#ban" + i).fadeIn(1000);
		      $('ul.ban_tab li').removeClass('active_tab');
			  if(!is_chrome)
		      $('ul.ban_tab li a').animate({ backgroundColor: "#404040" }, 'fast');
			  $("#tab" + i).addClass('active_tab');
			  if(!is_chrome)
			  $("#tab" + i + " a ").animate({ backgroundColor: "#ffffff" }, 'slow');
		
			timer = setTimeout("changeTab()",5000);
	}
	
	
