var environment = "_dev";
var root_path="http://"+window.location.hostname+"/"+environment+"/";

//history.navigationMode = 'compatible';
//$(window).unload( function UnLoad() { $(window).reload(); });
window.onunload = function(){
//	window.location.reload();
	}
	/*
window.onload = function(){
		window.location.reload();

}*/

$(function(){
	
	//if(!check_ff())
//	{
	getPosition();
	init_header_menu();
	init_footer();
	init_side_menu();
	init_center_container();
//	}
//	else{
		// window.location ="../browser_issue";
	//}
})

function check_ff(){
					/*	if($.browser.msie &&)
						{
							if()
							{
								return true;
							}
						}
						*/
				//		alert($.browser.version);
				
				/*
						if($.browser.mozilla && $.browser.version <"1.9")
						{
							window.location="../browser_issue";
						//	alert(99);
						   	return true;
						}
						 
						
						return false;
						*/
}

function getPosition()
{
	 var arr = String(window.location.href.split('#')[0]).split("/");
     
	 var page = arr[arr.length-1];
	 var section=arr[arr.length-2];
	page = String(page.split('.')[0]);
	var now_position = section + "/"+page;
	default_active(page);
	
}

function init_header_menu()
{
	 
	   $(".main_menu_btn a").click(function(){
		$(".main_menu_btn a").removeClass('active');
		$(this).addClass("active");
		 var idx=Number($(this).parent().attr("id").substr(1,1));
		var footer_original_x = $("#footer").css('top').substr(0,$("#footer").css('top').length-2);

	
			
			
	})
	
	$(".main_menu_btn a").mouseenter(function(){
				if(!$(this).hasClass('active'))
				{
				     	$(this).stop().animate({'opacity':'0.8'},300);
				}
	})

	$(".main_menu_btn a").mouseleave(function(){
				
					$(this).stop().animate({'opacity':'1'},300);
				
	})
	
	
}


function init_footer()
{
  //to index button
  $('.tree_index_link').click(function(){
	  window.location=root_path;
	  });
  //to contactus button
  $('#contact_us_btn').click(function(){
	  window.location=root_path+"contact_us";
	  });


  /*init footer position*/	
   
  var height = Number($('#footer_content').height());
  var docHeight = Number($(document).height());
  var windowHeight = Number($(window).height());

  var footer_height = Number($('#footer').height());
  var final_pos=Number(docHeight)-footer_height+200;

  if(String(window.location)==root_path)
  {
						 	final_pos-=260;
  }
  else
  {
	 var cc_height = Number($('#center_container').height());
	
	 if(cc_height<screen.height/1.34)
	 {
		 final_pos-=100;
	 }
}
					   
	var hash = window.location.hash;
	 var arr = String(window.location).split("/");
     
	  var page = arr[arr.length-1];
	 var section=arr[arr.length-2];
	page = String(page.split('.')[0]);
	var now_position = section + "/"+page;
	/*
	 var page = arr[arr.length-2];
	 var section=arr[arr.length-3];
	 var now_position = section + "/"+page;
	 */
	 
	 
	 if(page=="news")
	{
				     			window.onload=function(){
					var news_height= $('#center_container #center_container_inside .center_container_content .mcenter').height()+240;
		
		if(news_height<screen.height/1.34)
		{
			//alert(screen.height/1.34);
			var top_x= screen.height/1.34+70;
		$("#footer").css({'top': top_x+"px",'display':'block'});
		}
		else
		{
		$("#footer").css({'top': news_height+"px",'display':'block'});
		}
		
	
	$("#f_tab").unbind("click");
	var footer_open=false;
	var rlinks_open=false;
	var footer_original_x = Number($("#footer").css('top').substr(0,$("#footer").css('top').length-2));
	var dx=Number(footer_original_x)-389;
	
	//f_tab start
	$("#f_tab").click(function() {
	var footer_height = footer_open ? 95 : 483  ;
	var footer_move_distance = footer_open ? footer_original_x: dx;
	//alert(footer_move_distance);
    $('#footer').animate({'top':footer_move_distance+'px','height':footer_height+'px'},700,'easeInOutQuart',function(){
					footer_moving=false;
				    footer_open=!footer_open;
							if(footer_open)
						{
							$("#map_word").css({'background-position':'0 -16px'});
						}
						else
						{
								$('html, body').scrollTop( $(document).height());
							$("#map_word").css({'background-position':'0 top'});
						}
						   });
			});
			
	//related link start
	$("#related_links_btn").unbind("click");
	 var footer_top=Number($("#footer").css('top').substr(0,$("#footer").css('top').length-2));
	 var rlinks_height= 50;
	var rlinks_moved_top=footer_top-rlinks_height;
	$("#related_links_btn").click(function(){
		
		if(!footer_moving && !footer_open)
		{
			footer_moving=true;	
		
			$("#footer").animate({'top':rlinks_moved_top+'px','height':footer_height+rlinks_height+'px'},350,'easeInOutQuart',function(){
				footer_moving=false;
			    rlinks_open=!rlinks_open;

			});		
		}
		
		if(rlinks_open)
		{
			
			footer_moving=true;	

			$("#footer").animate({'top':footer_top+'px','height':footer_height+'px'},350,'easeInOutQuart',function(){
				footer_moving=false;
			    rlinks_open=!rlinks_open;
			});
			 rlinks_open=!rlinks_open;
		}
		
	});
	/////		
			}

	}
	else
	{

		   final_pos=788;

			switch(page)
			{
			//***探索寶礦力水特***//     
			case "background"://寶礦力水特的研發背景
			final_pos=814;
			break;
			//開發小故事
			case "story":
			final_pos=812;
			break;
			//商標意思
			case "logo":
			final_pos=812;
			break;
			//演變歴程
			case "history":
			final_pos=997;
			break;
			//遍佈全球
			case "spread":
			final_pos=1013;
			break;
			//***獨特點***//     
			case "about"://成份解構
			final_pos=843;
			break;
			case "application"://應用
			final_pos=923;
			break;
			case "characteristic"://成份特點
			final_pos=1984;
			break;
			case "production_steps"://生產過程
			final_pos=1247;
			break;
			case "common_issue"://常見問題
			final_pos=1824;
			if($.browser.version =="7.0" && $.browser.msie)
			{
			final_pos=1924;		
			}
			
			break;
			/***特備飲用時刻***/
			case "timing":
			final_pos=871;
			break;
			/***健康特集***/
			case "water_info"://伴你成長的水
			final_pos=1092;
			break;   
			case "sweat"://汗，為何是鹹的？
			final_pos=930;
			break;
			case "lost_water"://你平均一天失去多少水分？
			final_pos=954;
			break;
			case "how_lost_water"://身體缺水會怎樣？
			final_pos=1019;
			break;
			case "lost_water_sick"://脫水引發的病症
			final_pos=1300;
			break;
			case "cu_water_report"://中大補水研究報告
			final_pos=712;
			break;
			case "heat_stroke"://預防熱病
			final_pos=2731;
			break;
			case "plane_sick"://經濟客艙候群症
			final_pos=1213;
			break;
			case "flu_knowledge"://流感知識
			final_pos=1782;
			break;
			//***特選分享***// 
			case "tvc"://TVC
			final_pos=1062;
			break;
			case "printad"://平面廣告
			final_pos=968;
			break;
			case "sponge_boy"://Sponge Boy
			final_pos=1422;
			break;
			case "special_item"://潮物館
			final_pos=853;
			break;
			case "download"://壁紙下載
			final_pos=1303;
			break;
			//***會員登記***// 
			case "membership":
			final_pos=1201;
			break; 
			//***友達特輯***// 
			case "friend":
			final_pos=2104;
			break; 
			
			//***聯絡我們***// 
			case "contact_us":
			final_pos=817;
			break; 
			
			}

	
		
	   
	    $("#footer").css({'top': final_pos+"px",'display':'block'});
		var blue_bg_height=screen.height-$(document).height();

		$("#blue_bg").css({'top': final_pos+40+"px",'display':'block','height':blue_bg_height+'px'});
		
		//alert($(document).height());
		//alert(screen.height);
//	#blue_bg
	
	
	
	}
 
   //dummy container under footer
   
   
   
   var f_h=$("#footer").css('top');
   if(!f_h)
   {
	   f_h="1000px";
   }
	var g_h=Number(f_h.substr(0,f_h.length-2))+95;
	
	
									
     if(page=="news")
	 {
		 // var f_t=$("#footer").css('top');
		 // alert(f_t);
		 $('#grey_bg').css({'height':'100%'});
	 }
	 else
	 {
		 $('#grey_bg').css({'height':g_h+'px'});
			
			window.onload=function(){
				 $('body').css({'background':'#007DC6'})
			};
			 
	 }
   //$('body').css({'background':'#007DC6'});
	/*moving*/
	var footer_open=false;
	var rlinks_open=false;
	var to_bottom=false;
    var footer_height=Number($("#footer").css('height').substr(0,$("#footer").css('height').length-2));
	 var footer_top=Number($("#footer").css('top').substr(0,$("#footer").css('top').length-2));
	var rlinks_height= 50;//Number($("#rlinks").css('height').substr(0,$("#rlinks").css('height').length-2));
	var footer_moving=false;
	var footer_original_x = Number($("#footer").css('top').substr(0,$("#footer").css('top').length-2));
	var dx=Number(footer_original_x)-389;

	
	var rlinks_moved_top=footer_top-rlinks_height;
	
	//initial footer active 
	$("#related_links_btn").click(function(){
		
		if(!footer_moving && !footer_open)
		{
			footer_moving=true;	
		
			var footer_move_distance = footer_open ? footer_original_x : dx;
			
			$("#footer").animate({'top':rlinks_moved_top+'px','height':footer_height+rlinks_height+'px'},350,'easeInOutQuart',function(){
				footer_moving=false;
			    rlinks_open=!rlinks_open;

			});		
		}
		
		if(rlinks_open)
		{
			footer_moving=true;	
			
			
			$("#footer").animate({'top':footer_top+'px','height':footer_height+'px'},350,'easeInOutQuart',function(){
				footer_moving=false;
			    rlinks_open=!rlinks_open;
			});
			 rlinks_open=!rlinks_open;
		}
		
	});
	
	$("#f_tab").click(function() {
		if(!footer_moving)
		{
			footer_moving=true;
			
			var footer_move_distance = footer_open ? footer_original_x: dx;
			var footer_height = footer_open ? 95 : 483  ;

				$("#footer").animate({'height':footer_height+'px','top': footer_move_distance+'px'},700,'easeInOutQuart',function(){
					footer_moving=false;
				    footer_open=!footer_open;
							if(footer_open)
						{
							$("#map_word").css({'background-position':'0 -16px'});
					//			$('html, body').scrollTop( $(document).height());
						}
						else
						{
								$('html, body').scrollTop( $(document).height());
							$("#map_word").css({'background-position':'0 top'});
						}
					});
					
		}
	});
	
	/*mouseover footer*/
	$(".tree_branch , .tree_index_link , .tree_top").mouseover(function() {
			
		   		if(!$(this).parent().hasClass("active"))
				{				
					$(this).css({'opacity':'0.6'});
				}
		});
		
		//tree_index_link
		$(".tree_branch, .tree_index_link , .tree_top").mouseout(function() {
		   		if(!$(this).parent().hasClass("active"))
				{
					$(this).css({'opacity':'1'});
				}
		});
		
		
		$(".tree_branch").click(function() {
		
		});
		
		
		$(".tree_top").click(function() {
			
		})
		
		
		
		/*footer main menu*/
         	$(".footer_menu_btn").click(function() {
					$(".footer_menu_btn").css({'opacity':'1'});
				/*$(this).addClass("active");
				$(this).css({'opacity':'0.8'});
				*/
				if($(this).attr("id")!="related_links_btn")
				{
					  goToPage();
				}
			});
			
			function goToPage(changeSection,section,page)
			{
				section = Number(section);
				page = Number(page);
	
				setTimeout(
						function(){
						$("#footer").animate({'bottom': footer_original_x+'px'},700,'easeInOutQuart',function(){
		    			 footer_moving=false;
						 footer_open=false;	
						// turnPage(changeSection,section,page)
						});
					}
				,200);
			}
			


}

function init_side_menu(){
 
 if(window.location.hash=="#move")
 {
	 var menu_obj = $("#center_container #center_container_inside .side_menu");
	 
	 menu_obj.fadeIn(1000);
 }

  	$('.clickTag_level1').mouseenter(function() {
				if(!$(this).hasClass("active"))
					{	
							$(this).children(".m_level1").animate({'opacity':'0.8'},300);
				      		 $(this).children(".m_arrow").animate({'margin-right':'16px'},300,'easeInOutQuart',function(){
		        	  		 $(this).css({'margin-right':'21px'});
		 					 });
					}
		});
		
  	$('.clickTag_level1').mouseleave(function() {
			     			if(!$(this).hasClass("active"))
							{
								$(this).children(".m_level1").animate({'opacity':'1'},300);	
							   $(this).children(".m_arrow").css({'margin-right':'21px'});
							}
				 });
				 
				 
	$('.clickTag_level2').mouseenter(function() {
				if(!$(this).hasClass("active"))
					{	
						$(this).children(".m_level2 , .m_arrow_s").animate({'opacity':'0.8'},300);			
					}
		});
		
  	$('.clickTag_level2').mouseleave(function() {
						if(!$(this).hasClass("active"))
						{	
							$(this).children(".m_level2 , .m_arrow_s").animate({'opacity':'1'},300);
						}
				});
				 
	$('.clickTag_level2').click(function() {
			    	        if(!$(this).hasClass("active"))
							{	
						 	$('.clickTag_level1').removeClass("active");
			  			    $('.clickTag_level2').removeClass("active");
						    $(this).addClass("active");
	//					  	alert($(this).attr('id'));
							var str=$(this).attr('id');
					
							var section=Number(str.substr(str.length-5,1));
							var page=Number(str.substr(str.length-3,1)); 
							var subpage=Number(str.substr(str.length-1,1));
							
								$('.title_img,.fade_element_static,.fade_element_up,.fade_element_down,.fade_element_left,.fade_element_right').fadeOut(1,function(){
									
								//	turnPage(false,section,page,subpage);	 
								});
								
							
							
								
								
							$(this).children(".m_level2 , .m_arrow_s").animate({'opacity':'1'},300);
							}
				});
				
		$('.clickTag_level1').click(function() {
			 
			 if(!$(this).hasClass("active"))
					{	
							 $('.clickTag_level1').removeClass("active");
							 $('.clickTag_level2').removeClass("active"); 
							if($(this).hasClass("have_level"))
							{
		$(this).siblings("ul").children("li:first-child").children(".clickTag_level2").addClass("active");
							}
							else
							 {
								  $(this).addClass("active");
								  	$(this).children(".m_level1").animate({'opacity':'1'},300);	
										var str=$(this).attr('id');
										var section=Number(str.substr(str.length-3,1));
										
										 var arr = str.split("_");
									      var page = Number(arr[1]);
								
								$('.title_img,.fade_element_static,.fade_element_up,.fade_element_down,.fade_element_left,.fade_element_right').fadeOut(1,function(){
									
									//turnPage(false,section,page);	 
								});
							
							 }
					}
			 
			 
		});
				
}


function default_active(position)
{
	$(".tree_column ul li, .tree_column ul li.active").removeClass("active");

	switch(position)
	{
		/*news*/
		
		case  "news":
		$("#c1").addClass("active");
		$("#m1 a").addClass("active");
		//$("#c4_1").addClass("active");
		//$("#ma1_1").addClass("active");
		break;	
		
		/*explore*/
		case  "background":
		$("#c2").addClass("active");
		$("#m2 a").addClass("active");
		$("#c2_1_1").addClass("active");
		$("#ma2_1_1").addClass("active");
		break;
		
		case  "story":
		$("#c2").addClass("active");
		$("#m2 a").addClass("active");
		$("#c2_1_2").addClass("active");
		$("#ma2_1_2").addClass("active");
		break;
		
		case  "logo":
		$("#c2").addClass("active");
		$("#m2 a").addClass("active");
		$("#c2_1_3").addClass("active");
		$("#ma2_1_3").addClass("active");
		
		
		break;
		
		case  "spread":
		$("#c2").addClass("active");
		$("#m2 a").addClass("active");
		$("#c2_3").addClass("active");
		$("#ma2_3").addClass("active");
		break;
		
		case  "history":
		$("#m2 a").addClass("active");
		$("#c2_2").addClass("active");
		$("#ma2_2").addClass("active");
		break;
		
		/*special*/
		case  "about":
		$("#c3").addClass("active");
		$("#m3 a").addClass("active");
		$("#c3_1_1").addClass("active");
		$("#ma3_1_1").addClass("active");
		break;
		
		case  "application":
		$("#c3").addClass("active");
		$("#m3 a").addClass("active");
		$("#c3_1_2").addClass("active");
		$("#ma3_1_2").addClass("active");
		break;
		
		case  "characteristic":
		$("#c3").addClass("active");
		$("#m3 a").addClass("active");
		$("#c3_1_3").addClass("active");
		$("#ma3_1_3").addClass("active");
		break;
		/*
		case "ingredient":
		$("#m3 a").addClass("active");
		$("#c3_2").addClass("active");
		$("#ma3_2").addClass("active");
		break;
		*/
		case  "production_steps":
		$("#c3").addClass("active");
		$("#m3 a").addClass("active");
		$("#c3_2").addClass("active");
		$("#ma3_2").addClass("active");
		break;
		
		case  "common_issue":
		$("#c3").addClass("active");
		$("#m3 a").addClass("active");
		$("#c3_3").addClass("active");
		$("#ma3_3").addClass("active");
		break;
		
		//special/common_issue
		/*timing*/
		case  "timing":
		$("#c4").addClass("active");
		$("#m4 a").addClass("active");
		//$("#c4_1").addClass("active");
		$("#ma4_1").addClass("active");
		break;	
		
		/*gallery*/
		case  "water_info":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_1").addClass("active");
		$("#ma5_1").addClass("active");
		break;
		
		case  "sweat":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_2").addClass("active");
		$("#ma5_2").addClass("active");
		break;
		
		case  "lost_water":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_3").addClass("active");
		$("#ma5_3").addClass("active");
		break;
		
		case  "how_lost_water":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_4").addClass("active");
		$("#ma5_4").addClass("active");
		break;
		
		case  "lost_water_sick":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_5").addClass("active");
		$("#ma5_5").addClass("active");
		break;
		
		case  "cu_water_report":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_6").addClass("active");
		$("#ma5_6").addClass("active");
		break;
		
		case  "heat_stroke":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_7").addClass("active");
		$("#ma5_7").addClass("active");
		break;
		
		case  "plane_sick":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_8").addClass("active");
		$("#ma5_8").addClass("active");
		break;
		
		case  "flu_knowledge":
		$("#c5").addClass("active");
		$("#m5 a").addClass("active");
		$("#c5_9").addClass("active");
		$("#ma5_9").addClass("active");
		break;
		
		
		
		/*fun*/
		case  "tvc":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_1_1").addClass("active");
		$("#ma6_1_1").addClass("active");
		break;
		
		case  "printad":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_1_2").addClass("active");
		$("#ma6_1_2").addClass("active");
		break;
		
		
		case  "printad":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_1_2").addClass("active");
		$("#ma6_1_2").addClass("active");
		break;
		
		
		case  "sponge_boy":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_2").addClass("active");
		$("#ma6_2").addClass("active");
		break;
		
		
		case  "special_item":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_3").addClass("active");
		$("#ma6_3").addClass("active");
		break;
		
		case  "download":
		$("#c6").addClass("active");
		$("#m6 a").addClass("active");
		$("#c6_4").addClass("active");
		$("#ma6_4").addClass("active");
		break;
		
		
		case  "membership":
		$("#c7").addClass("active");
		$("#m7 a").addClass("active");
		break;


		case  "friend":
		$("#c8").addClass("active");
		$("#m8 a").addClass("active");
		break;

		default:
	
	}
	
}

function init_center_container()
{
	//alert(9);
	var hash = window.location.hash;
	 var arr = String(window.location).split("/");
     var page = arr[arr.length-2];
	 var section=arr[arr.length-3];
	 var now_position = section + "/"+page;
	 
	if(hash=="")
	{
		hash="#move";
	}
	else
	{
		hash="#fade";
	}

	if(page=="news")
	{
			hash="#fade";
	}
	
		 if(hash=="#move")
		 {
			 var container_obj = $("#center_container #center_container_inside .center_container_content");
		
			 container_obj.css({'margin':'3000px 0 0 20px','opacity':'1'}); 	
            var no_animate=false;

	 		if($.browser.msie)
						 {
							 if($.browser.version =="6.0" ||$.browser.version =="7.0" ||$.browser.version =="8.0" )
							 {
								 no_animate=true;
							 }
							 else
							 {
								  no_animate=false;
							 }
						 }
			if(!no_animate)
			{
			//	make_info_transparent();
			}
					
			 container_obj.animate({'margin-top': '18px'},1000,'easeInOutQuart',function(){
	
				appear_info();
	
			 		
				 });
		 }
		 else if(hash=="#fade")
		 { 
	
			 
			  var container_obj = $("#center_container #center_container_inside .center_container_content");
			 container_obj.css({'margin':'18px 0 0 20px','opacity':'1'}); 	
			 //margin: 18px 0 0 20px;
	 var sidemenu_obj= $("#center_container #center_container_inside .side_menu");
			  sidemenu_obj.css({'display':'block'}); 
			 
			 make_info_transparent();
			 appear_info();
		 }
}

	 function make_info_transparent()
				 {
					 
					 	//title_img
				//	$('.title_img').css({'opacity':'0'});
					//fade_element_static
	//				$('.fade_element_static').css({'opacity':'0'}); 
					//fade_element_up  
					
					$('.fade_element_up').animate({'margin-top':'+=10px'},0);
					//fade_element_down
					$('.fade_element_down').animate({'margin-top':'-=10px'},0);
					//fade_element_left
					$('.fade_element_left').animate({'margin-left':'+=10px'},0);
					//fade_element_right
					$('.fade_element_right').animate({'margin-left':'-=10px'},0);
					
					
						$('.title_img,.fade_element_static,.fade_element_up,.fade_element_down,.fade_element_left,.fade_element_right').fadeOut(0);
					
				 }
	
	
	
				 var moved=false;
				 function appear_info()
				 {
					 
			
					var status =window.location.hash;
				//	alert(99);
					$('.title_img').fadeIn(0);
				  
				  if(moved ==false || status=="#fade" )
				  {
				//	  alert(99);
	///				  	$('.fade_element_static)
					  for(i=0;i<=$('.fade_element_static').length;i++)
					  {
						  	$('.fade_element_static:eq('+i+')').css({'opacity':'0','display':'block'});
							$('.fade_element_static:eq('+i+')').delay(200).animate({'opacity':'1'},{queue:false, duration:1000, easing:"easeInOutQuart"});
					  }
					  
					  for(i=0;i<=$('.fade_element_up').length;i++)
					  {
				
					  	$('.fade_element_up:eq('+i+')').css({'opacity':'0','display':'block'});
				     	$('.fade_element_up:eq('+i+')').delay(200).animate({'margin-top':'-=20px','opacity':'1'},{queue:false, duration:1000, easing:"easeInOutQuart"});
					  }
				
					   for(i=0;i<=$('.fade_element_down').length;i++)
					  {
					  	$('.fade_element_down:eq('+i+')').css({'opacity':'0','display':'block'});
						$('.fade_element_down:eq('+i+')').delay(200).animate({'margin-top':'+=20px','opacity':'1'},{queue:false, duration:1000, easing:"easeInOutQuart"});
					  }
					  
					  for(i=0;i<=$('.fade_element_left').length;i++)
					  {
						$('.fade_element_left:eq('+i+')').css({'opacity':'0','display':'block'});
						$('.fade_element_left:eq('+i+')').delay(200).animate({'margin-left':'-=10px','opacity':'1'},{queue:false, duration:1000, easing:"easeInOutQuart"});
				  	  }

					  for(i=0;i<=$('.fade_element_right').length;i++)
					  {
						
					  	$('.fade_element_right:eq('+i+')').css({'opacity':'0','display':'block'});
						$('.fade_element_right:eq('+i+')').delay(200).animate({'opacity':'1','margin-left':'+=10px'},{queue:false, duration:1000, easing:"easeInOutQuart"});
					  }
				  }
					moved=true;
					
					
				$('.product_info').css({'display':'none'});
				$('.product_info:eq(0)').fadeIn(500);
					
					 $('html').css({'overflow-y':'scroll'});
					// 	 $('html').css({'overflow-x':'hidden'});
					 
					 
					 
					 
					 
				//	 $('#bg1').fadeOut(0);
					//  $('#bg1').fadeIn(1000);
	//				$('.bg1c') 
				 /*$('.bg1c').delay(200).animate({'opacity':'1'},{queue:false, duration:1000, easing:"easeInOutQuart"});*/
							
					 
				 }
