function show(divName)
 {
   var divObject=document.getElementById(divName);
   if(divObject==null){
	    return;
	}
   divObject.style.display="block";
   divObject.style.visibility="visible";
 }
 
 
function hide(divName)
 {
   var divObject=document.getElementById(divName);
   divObject.style.display="none";
 }
 
jQuery(document).ready(function() {

//alert($.client.os+"|"+$.client.browser);
var os=$.client.os;
var browser=$.client.browser;
if(browser=="Explorer")
{
  $(".menulist").css("padding-left","10px");
  $(".menulist").css("padding-right","10px");
}
});



//menu
$(document).ready(function(){	
  $("#mdl1").mouseleave(function(){
	   hide('mdl1');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl2").mouseleave(function(){
	   hide('mdl2');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl3").mouseleave(function(){
	   hide('mdl3');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl4").mouseleave(function(){
	   hide('mdl4');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl5").mouseleave(function(){
	   hide('mdl5');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl6").mouseleave(function(){
	   hide('mdl6');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
  $("#mdl7").mouseleave(function(){
	   hide('mdl7');  
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
    $("#menu").mouseleave(function(){
  $(".menudownlistcase").hide();
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
  });
});

function hideother(obj){
	$(".menudownlistcase").hide();
	$(".menulistchild").remove();
	$(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
	$(obj).append("<div class='menulistchild'></div>");
	$(obj).css({"color": "#d31280",
	"background":"#ffffff"});
}

function hideall(){
	$(".menudownlistcase").hide();
  $(".menulistchild").remove();
  $(".menulist").css({"color": "#ffffff",
	"background":"#d31280"});
}



function hidemaptxt(point){
	$(".maptxt").hide();
	$(".mappoint").find("img").attr("src", "images/map-point.png");
	$("#"+point).find("img").attr("src", "images/map-point2.png");
}




	var api2;
	$(function(){
		$("#trigger2").switchable("#panel2 > div > .imgitem", {
			triggerType: "click",
			effect: "scroll",
			steps: 1,
			delay: .1,
			speed:.7,
			visible: 1
		}).carousel();
		
		 api2 = $("#trigger2").switchable();
		$("#next2").click(function(){
			AutoMediaMoveRight();
		});
		$("#prev2").click(function(){
			AutoMediaMoveLeft();
		});
		AutoMediaMoveLeft();
	});
	
	function AutoMediaMoveLeft(){
		$('body').stopTime ('moveToLeft');
		$('body').stopTime ('moveToRight');
		api2.next();
    	$('body').everyTime('10s','moveToLeft',function(){
														api2.next();
														//$("#prev2").click();
														$("#animation").css("visibility","visible");
														$("#animation").animate({
														left: '930px'
														}, 700,null,function(){
														   $("#animation").css("left","0px");
														   $("#animation").css("visibility","hidden");
														 });
														});
	}
	function AutoMediaMoveRight(){
		$('body').stopTime ('moveToLeft');
		$('body').stopTime ('moveToRight');
		api2.prev();
    	$('body').everyTime('10s','moveToRight',function(){
														api2.prev();
														//$("#prev2").click();
														$("#animation").css("visibility","visible");
														$("#animation").animate({
														left: '930px'
														}, 700,null,function(){
														   $("#animation").css("left","0px");
														   $("#animation").css("visibility","hidden");
														 });
														});
	}
	

function isEmail (s){
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return true;
	}
	else{
		return false;
	}
}

function alertMeg(info){
	var styleType = "";
	if(typeof(info.styleType)!='undefined'){
		if(info.styleType=="2"){
			styleType = "2";
		}
	}
	$("#msgtitle"+styleType).html(info.title);
	$("#msgdetail"+styleType).html(info.detail);
	if(info.okbtnshow==true){
		$("#msgokbtn"+styleType).css('display','inline');
		$("#msgokbtn"+styleType).unbind('click');
		$("#msgokbtn"+styleType).bind('click', function() {
			$("#popbg").hide();
			$("#alertMsg"+styleType).hide();
			if(typeof(info.okact)=='function') (info.okact)(info.okact_data);
			$("#msgokbtn"+styleType).css('display','none');
			
		});
	}
	$("#msgcancelbtn"+styleType).unbind('click');
	if(info.okbtnshow!==false){
		
	}else{
		$("#msgcancelbtn"+styleType).css('display','none');
	}
	
	$("#popbg").show();
	$("#alertMsg"+styleType).show();
}

function hideMeg(){
	$("#popbg").hide();
	$(".alertMsg").hide();
}

function check_version(id,vs,dir,family_static_id,event_static_id,shop_static_id,page_New_Id)
{  
	var params = "static_id="+id+"&version="+vs+"&family_static_id="+family_static_id+"&event_static_id="+event_static_id+"&shop_static_id="+shop_static_id+"&page_New_Id="+page_New_Id;
	$.ajax({
       url: dir+'check_version.php', 
       type:'post',         
       dataType:'string',     
       data:params,         
       success:check_result 
     });   
}

function check_result (htmlurl)
{
	htmlurl = htmlurl.toString();
	var getArr=htmlurl.split("|");
	htmlurl=getArr[1];
	if(htmlurl!="no"&&typeof(htmlurl)!="undefined")
	{
	   window.location.href=htmlurl;
	}
}

function hidearrow(data){
	var divObject=document.getElementById('menu_arrow_id1');
	if(divObject==null){
	    return;
	}
	if(data == '1'){
		divObject.style.display="none";
	}
}
function showarrow(data){
	var divObject=document.getElementById('menu_arrow_id1');
	if(divObject==null){
	    return;
	}
	if(data == '1'){
		divObject.style.display="inline";
	}
}

$(function(){ 
	 VideoJS.setupAllWhenReady();

});
	
