// JavaScript Document
$(function(){
//zxkc	
    $('.boxdiv h5 a').each(function(i){
	  $(this).click(function(){
			   $(this).parent().nextAll('.boxblk').hide().eq(i).show();
			   $(this).parent().find('a').removeClass('teacherlink').eq(i).addClass('teacherlink');
			    this.blur(); return false;
	  });    
	});
	$('#question h3 a').each(function(i){
	  $(this).click(function(){
			   $(this).parent().nextAll('.boxdiv').hide().eq(i).show();
			   $(this).parent().find('a').removeClass('questionlink').eq(i).addClass('questionlink');
			    this.blur(); return false;
	  });    
	});
//zxkc end
    $('#show_intro h3 a').each(function(i){
	  $(this).click(function(){
	           $(this).click(function(){ this.blur(); return false });
			   $(this).parent().nextAll('.show_introdiv').hide().eq(i).show();
			   $(this).parent().find('a').removeClass('intro_link').eq(i).addClass('intro_link');
			   if(i == 0){$("#ppc1").show();$("#ppc2").show()}else{$("#ppc1").hide();$("#ppc2").hide()}
	  });    
	});
    $('a.movelft').click(function(){
		  this.blur();
		  turnLeft('.picscoll'); 
		  return false;
	});
	$('a.movergt').click(function(){
		 this.blur(); 
		 turnRight('.picscoll');
		 return false;
	});
	var pids = "";
	$('.picscoll a').each(function(i){
	  $(this).click(function(){
			   $(this).parent().parent().parent().find('.bigpic').children('img').hide().eq(i).fadeIn();
			   pids = $(this).parent().parent().parent().find('.bigpic').children('img').get(i).src;
			   $(this).parent().find('a').removeClass('scoll_link').eq(i).addClass('scoll_link');
			   this.blur(); 
			   $('.play2').attr("href",pids);
			   return false;
	  });    
	});
	showbigpic = function()
	{
		alert($('.play2').attr());
	};
	 $('a.movetop').click(function(){
		  this.blur();
		  turnTop('#box_simg'); 
		  return false;
	});
	$('a.movebottom').click(function(){
		 this.blur(); 
		 turnBottom('#box_simg');
		 return false;
	});
	$('#box_simg a').each(function(i){
	  $(this).click(function(){
	           $(this).parent().parent().find('.openbox').hide().eq(0).show();
			   $('#box_open h3').children('a').removeClass('open_h3').eq(0).addClass('open_h3');
			   $(this).parent().parent().find('#box_bimg').children('img').hide().eq(i).fadeIn();
			   $(this).parent().find('a').removeClass('scoll_link').eq(i).addClass('scoll_link');
			   this.blur(); 
			   return false;
	  });    
	});
	$('#box_open h3 a').each(function(i){
	  $(this).click(function(){
			   $(this).parent().parent().find('.box_con').children('.openbox').hide().eq(i).fadeIn();
			   $(this).parent().find('a').removeClass('open_h3').eq(i).addClass('open_h3');
			   this.blur(); 
			   return false;
	  });    
	});
			   //屏蔽窗口	
	 $('.play_video a').each(function(i){
	    $(this).click( function (){
			$('.box_con').find('.openbox').hide().eq(i).show();	
			$('#box_open h3').find('a').removeClass('open_h3').eq(i).addClass('open_h3');	
			$.blockUI({ 
				 message: $('#box_open'),
							centerY: 0, 
							css: { 
									top: '20px', 
									left: ($(window).width() - 990) /2 +200+ 'px', 
									width: '580px',
									textAlign: 'left',
									border:  '0px',
									cursor: 'default' 
								},
							overlayCSS:  { 
											backgroundColor:'#000', 
											opacity:        '0.7' 
										}
				 });
			/*
				players2.url = $('.play1').attr("id");
				players2.src = $('.play1').attr("id");
				//players2.controls.play();
				players2.height = 500;
				players2.width = 500;*/
				nextEvent($('.play1').attr("id"),'showflvs');
			 this.blur(); 
			 return false;
		  });
    }); 				
	$('.box_close').click(function(){ 		 
				  $.unblockUI(); 
				  //players2.controls.stop();
				  });
		//屏蔽窗口;	
//组合推荐滑动门;
   $('#makeup_nav a').each(function(i){
		  $(this).click(function(){				  
				   $(this).parent().nextAll('.navdiv').hide().eq(i).show();
				   $(this).parent().find('a').removeClass('m_active').eq(i).addClass('m_active');
				   $('#makeup_nav1 a').removeClass('m_active').eq(i).addClass('m_active');
				   this.blur(); 
				   return false;
		  });    
	});	
    $('#makeup_nav1 a').each(function(i){
		  $(this).click(function(){
				   $('.navdiv').hide().eq(i).show();
				   $('#makeup_nav a').removeClass('m_active').eq(i).addClass('m_active');	
				   $(this).parent().find('a').removeClass('m_active').eq(i).addClass('m_active');
		  }); 							   
	});	
	$('#intro3 .mp_btn').click(function(){
				$('.navdiv').hide().eq(1).show();
				$('#makeup_nav a').removeClass('m_active').eq(1).addClass('m_active');
	});	
	$('#intro6 .mp_btn,#intro7  h3 span a').click(function(){
				$('.navdiv').hide().eq(2).show();
				$('#makeup_nav a').removeClass('m_active').eq(2).addClass('m_active');
	});									  
	//屏蔽窗口	
	 $('.caseright a').each(function(i){
	    $(this).click( function (){
			$.blockUI({ 
				 message: $('#play_video'),
							centerY: 0, 
							css: { 
									top: '10px', 
									left: ($(window).width() - 990) /2 +300+ 'px', 
									width: '501px',
									textAlign: 'left',
									border:  '0px',
									cursor: 'default' 
								},
							overlayCSS:  { 
											backgroundColor:'#000', 
											opacity:        '0.7' 
										}
				 });			
			/*players.url = $('.caseright a').attr("id");
			players.src = $('.caseright a').attr("id");
			players.controls.play();
			players.height = 500;
			players.width = 500;*/
			nextEvent($('.caseright a').attr("id"),'showflv');
		  });
    }); 				
	$('.play_close').click(function(){ 		 
				  $.unblockUI();
				  //document.getElementById("players").AutoStart = 2;
				 // players.controls.stop();				  
				  });
		//屏蔽窗口;	
});
var _star = 0;
function turnLeft(id){		
		var _obj = $(id);
		if (_star<1) return false;
		_obj.css("marginLeft",-64);
		_obj.animate( {marginLeft:0}, 'fast', '', function(){
			//_obj.find("li:first").appendTo(_obj); 
			//_obj.css("marginLeft",0);			
		if(_star==1) { 
		       $('a:gt('+(_star-1)+')', $(_obj)).show(); 
		       $('a:gt('+(_star+4)+')', $(_obj)).hide();
			   $('a:first',$(_obj)).show();
		}	
		else{
		     $('a:lt('+(_star-1)+')', $(_obj)).hide(); 
		     $('a:gt('+(_star-2)+')', $(_obj)).show();
		     $('a:gt('+(_star+3)+')', $(_obj)).hide();
		}
		  _star-=1;	
		});  
	};
function turnRight(id){
      var _obj = $(id);
	    if (_star>=$('a', $(_obj)).size()-4) {
		   return false;
		}
		  _obj.animate( {marginLeft:-64}, 'fast' ,'', function(){
		  _obj.css("marginLeft",0);
		   _star+=1;     
		   $('a:lt('+(_star+0)+')', $(_obj)).hide();
		   $('a:gt('+(_star-1)+')', $(_obj)).show();
		   $('a:gt('+(_star+3)+')', $(_obj)).hide();    		
		});
};
var _top = 0;
function turnTop(id){		
		var _obj = $(id);
		if (_top<1) return false;
		_obj.css("marginTop",-64);
		_obj.animate( {marginTop:0}, 'fast', '', function(){
			//_obj.find("li:first").appendTo(_obj); 
			//_obj.css("marginLeft",0);			
		if(_top==1) { 
		       $('a:gt('+(_top-1)+')', $(_obj)).show(); 
		       $('a:gt('+(_top+5)+')', $(_obj)).hide();
			   $('a:first',$(_obj)).show();
		}	
		else{
		     $('a:lt('+(_top-1)+')', $(_obj)).hide(); 
		     $('a:gt('+(_top-2)+')', $(_obj)).show();
		     $('a:gt('+(_top+4)+')', $(_obj)).hide();
		}
		  _top-=1;	
		});  
	};
function turnBottom(id){
      var _obj = $(id);
	    if (_top>=$('a', $(_obj)).size()-5) {
		   return false;
		}
		  _obj.animate( {marginTop:-64}, 'fast' ,'', function(){
		  _obj.css("marginTop",0);
		   _top+=1;     
		   $('a:lt('+(_top+0)+')', $(_obj)).hide();
		   $('a:gt('+(_top-1)+')', $(_obj)).show();
		   $('a:gt('+(_top+4)+')', $(_obj)).hide();    		
		});
};	