/*!
  Getting started js for getting start html animation
 */
     var timeout=350;
	 var toopacity=0.96;
	 var patt=/^step\d/g;


     function getWebdata(args)
	 {
		 if (args=="gettingstarted")
		 {
			 var data='<font size="+3" color="#7c7c7c">'+g_dataArray[langeBaseNum+0]+'</font>';
		     return  data;
		 }
			 
		 if (args=="mouseEvent")
		 {
			 var action_map={
				 "mousedown":"url(GS_btn_p.png)",
				 "mouseenter":"url(GS_btn_h.png)",
				 "mouseleave":"url(GS_btn_n.png)"
			 }
			 return action_map;
		 }
		 
		 if (args=="step1")
		 {
			 var step_content_map={
				 "step_icon_text":'<font color="#7c7c7c">'+g_dataArray[langeBaseNum+1]+'</font>',
				 "describe_content_part1":'<br><font size="+2" color="#7c7c7c">'+g_dataArray[langeBaseNum+2]+'</font>',
				 "describe_content_part2":'<br><font color="#7c7c7c">'+g_dataArray[langeBaseNum+3]+'</font>',
				 "describe_content_part3":""
			 }
			 return step_content_map;
		 }
		 if (args=="step2")
		 {
			 var step_content_map={
				 "step_icon_text":'<font color="#7c7c7c">'+g_dataArray[langeBaseNum+4]+'</font>',
				 "describe_content_part1":'<br><font size="+2" color="#7c7c7c">'+g_dataArray[langeBaseNum+5]+'</font>',
				 "describe_content_part2":'<br><font color="#7c7c7c">'+g_dataArray[langeBaseNum+6]+'</font>',
				 "describe_content_part3":"url(add.png)"
			 }
			 return step_content_map;
		 }
		 if (args=="step3")
		 {
			 
			 var step_content_map={
				 "step_icon_text":'<font color="#7c7c7c">'+g_dataArray[langeBaseNum+7]+'</font>',
				 "describe_content_part1":'<br><font size="+2" color="#7c7c7c">'+g_dataArray[langeBaseNum+8]+'</font>',
				 "describe_content_part2":'<br><font color="#7c7c7c">'+g_dataArray[langeBaseNum+9]+'</font>',
				 "describe_content_part3":"url(start.png)"
			 }
			 return step_content_map;
		 }
		 
	 }
	 
     function update_dis_content(step)
	 {
		 //fade out the dis_content
	     $("div.dis_content").animate({opacity: 0.0},0);
		 $("div.close").animate({opacity: 0.0},0);
		 
		 //update the content;
		 $("#describe_content_part1").html(getWebdata(step)["describe_content_part1"]);
		 $("#describe_content_part2").html(getWebdata(step)["describe_content_part2"]);
		 $("#describe_content_part3").css('background',getWebdata(step)["describe_content_part3"]);		 
		 $("div.dis_content").animate({opacity: toopacity},timeout);
		 $("div.close").animate({opacity: toopacity},timeout);
	 }
	 
	 function update_step_background(object,status)
	 {
		 step=$(object).attr('id');
		 if ((step.indexOf("step")==0)&& (step.indexOf("_icon")<0))
		 {
			 $(object).css('cursor',"pointer");
			 $(object).css('background',getWebdata("mouseEvent")[status]);
		 }
		 if (step.indexOf("close")==0)
		 {
			 $(object).css('cursor',"pointer");
		 }
	 }
	 
	 function close_dis_content(step)
	 {
		$("div.dis_content").animate({opacity: 0.0},timeout);
		$("div.close").animate({opacity: 0.0},timeout);
	 }

	 
     $(document).ready(function(){
		 
		                    //initial the first the page 
						   $("#dis_content_child").corner("round 5px").parent().css('padding', '2px').corner("round 5px");
						   $("div.dis_content").animate({opacity: 0.0},0);
			               $("div.close").animate({opacity: 0.0},0);
						   $("#title").html(getWebdata("gettingstarted"));
						   $("#step1_icon_text").html(getWebdata("step1")["step_icon_text"]);
						   $("#step2_icon_text").html(getWebdata("step2")["step_icon_text"]);
						   $("#step3_icon_text").html(getWebdata("step3")["step_icon_text"]);
							
							
							//step style change
							$("div").mousedown(function(event){
								update_step_background(this,"mousedown");
							})
							$("div").mouseenter(function(event){
								//click step event
								update_step_background(this,"mouseenter");
							})
							$("div").mouseleave(function(event){
								//click step event
								update_step_background(this,"mouseleave");
							})
							
						    // handle the click 
							$("div").click(function(event){
								//click step event
								 var step=$(this).attr('id');
								
								if ((step.indexOf("step")==0)&& (step.indexOf("_icon")<0))
								 {
									 update_dis_content(step);
								 }
								 else
								 {
									 if (step.indexOf("close")==0)
									 {
										 close_dis_content(step);
									 }
								 }
							})
								
     });
     