function psetCookie(c_name,value,expiredays)    
{
var exdate=new Date();                        
exdate.setDate(exdate.getDate()+expiredays)  ;
document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate)+";path=/";
}


function pgetCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; 

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		
		a_temp_cookie = a_all_cookies[i].split( '=' );


		
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
		
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

	
	
//$.fx.speeds._default = 500;

$(function() {
     
       
		$( "#dialog" ).dialog({
			autoOpen: false,
			show: "blind",
			hide: "blind",
               width:600,
modal: true               
		});
          
          
          

		$( "#opener" ).click(function() {
			$( "#dialog" ).dialog( "open" );
			return false;
		});
	});




		$(function(){
	// 幫 #menu li 加上 hover 事件
	$('#menu li').hover(function(){
		// 先找到 li 中的子選單
		var _this = $(this),
			_subnav = _this.children('div');
 
		// 變更目前母選項的背景顏色
		// 同時顯示子選單(如果有的話)
		_this.css('backgroundColor', '#2c2c2c');
		_subnav.css('display', 'block');
	} , function(){
		// 變更目前母選項的背景顏色
		// 同時隱藏子選單(如果有的話)
		// 也可以把整句拆成上面的寫法
		$(this).css('backgroundColor', '#2c2c2c').children('div').css('display', 'none');
	});
	// 取消超連結的虛線框
	$('a').focus(function(){
		this.blur();
	});
});


