﻿// JavaScript Document

function getMsg(_value)
{
	if(_value == "ok")
	{
		alert('申請成功!');	
	}
	if(_value == "edit_pwd_ok")
	{
		alert('密碼修改成功,請記住新密碼!');	
	}
	if(_value == "edit_pwd_onfit")
	{
		alert('兩次密碼輸入不一致,請重新輸入!');	
	}
	if(_value == "edit_pwd_error")
	{
		alert('原密碼輸入錯誤,請重新輸入!');	
	}
	if(_value == "login")
	{
		alert('請先登錄!');	
	}
	if(_value == "outofs")
	{
		alert('你的會員已到期，已被限制使用該服務,請續期!');	
	}
}

function subCheck()
{
	if(document.orderForm.name.value == "")
	{
		alert('請留下你的姓名!');
		document.orderForm.name.focus();
		return false;
	}
	if(document.orderForm.phone.value == "")
	{
		alert('請留下你的聯絡電話!');
		document.orderForm.phone.focus();
		return false;
	}
}

$(document).ready(function() {
	$(".dropdown img.flag").addClass("flagvisibility");

	$(".dropdown dt a").click(function() {
		$(".dropdown dd ul").toggle();
	});
				
	$(".dropdown dd ul li a").click(function() {
		var text = $(this).html();
		$(".dropdown dt a span").html(text);
		$(".dropdown dd ul").hide();
		//$("#result").html("Selected value is: " + getSelectedValue("sample"));
	});
		
	$        
	function getSelectedValue(id) {
		return $("#" + id).find("dt a span.value").html();
	}

	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (! $clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});
	$(".dropdown img.flag").toggleClass("flagvisibility");
});
