$(document).ready(function(){
						   
							 var showAccordion=function(){ 
						   	   $(".service").hide();  
							   $(".ver_accordion").show();
							   $(".ver_accordion").find("li").css('width','auto').show();
							   $(".ver_accordion").find(".in").hide();
							   $(".ver_accordion").find(".title").show();
							   var ID=$(this).attr("href");
							   $("#"+ID).find(".title").hide();
							   $("#"+ID).show();
							   $("#"+ID).css('width','484px');
							   $("#"+ID).find(".in").animate({width:'show'},
															   1000,
															   function(){
																	$("#"+ID).find(".right").show();
																	}
														      ); 
							    $("#"+ID).find(".right").hide();
							   $("#"+ID).find(".dog").show('scale',{'origin':['top','left']},1000);
							    
							   return false;
							   };
							 var hideAccordion=function(){ 
							       $(this).parents("li").find(".right").hide();
							       //$(this).parents("li").find(".dog").hide('scale',{'origin':['top','left']},1000);
								   $(this).parents("li").find(".dog").animate(
																			 {width:'45%',height:'45%'},
																			 1000,
																			 function(){
																				 $(this).parents("li").find(".dog").css({'width':'auto','height':'auto'});
																				 }
																			 );
								   $(this).parents("li").find(".in").animate(
																			 {width:'25%'},
																			 1000,
																			 function(){
																				 $(this).parent("li").css('width','484px').hide();
																				 $(".ver_accordion").find(".in").css('width','484px').hide();
																				 }
																			 );
								   
								   setTimeout(showService,900);
								   return false;
								   };
						      var showService=function(){ 
								   $(".ver_accordion").hide();
								   $(".service").show();
								 };
							 var accordionAction=function(){ 
							        $(".ver_accordion li").css('width','auto');
								 	$(".ver_accordion").find(".in").hide();
									$(".ver_accordion").find(".title").show();
									$(this).parents("li").css("width","484px");
									$(this).parents("li").find(".in,.dog,.right").show();
									$(this).parents("li").find(".title").hide();
									return false;
								 };
								 
							 $(".ver_accordion li").find(".title").mouseover(function(){
													        var id=$(this).parent('li').attr('id');
															var path='/images/switching_console/'+id+'_hover.png';
															$(this).find("img").attr('src',path);												  
									});
							 $(".ver_accordion li").find(".title").mouseout(function(){
													        var id=$(this).parent('li').attr('id');
															var path='/images/switching_console/'+id+'.png';
															$(this).find("img").attr('src',path);												  
									});
							 //click more button to execute showAccordion function
						     $("#topModule").find(".more").click(showAccordion);
							 
							 //click collapse button to execute hideAccordion function
						     $("#topModule").find(".collapse").click(hideAccordion);
							 
							 //click bluebar to execute accordionAction function
							 $(".ver_accordion .title").click(accordionAction);
							
							/*this function makes photo gallery scroll automatically when page first load,
							   speed:for change the scrolling speed,
							   timeout:intervals between each scroll action
							*/
							$(".gallery").after('<div id="nav">').cycle({fx: 'scrollLeft',speed:1500,timeout:7000,pager:"#nav"}); 
							
							//when click the stop button to stop auto scrolling
							$('#stop').click(function() { 
								$('.gallery').cycle('pause');
							});
});
