// JavaScript Document
$(function() {
	ddsmoothmenu.init({
		mainmenuid : "menu_list", // menu DIV id
		orientation : 'h', // Horizontal or vertical menu: Set to "h" or "v"
		classname : 'ddsmoothmenu', // class added to menu's outer DIV
		// customtheme: ["#1c5a80", "#18374a"],
		contentsource : "markup" // "markup" or ["container_id",
	// "path_to_menu_file"]
	});
});
/*$(function() {
	function ScrollAction(listObj, listElem, speed, isSeries) {	//listObj为需要滚动的列表，  speed为滚动速度
		var pos, top, aniTop, height;
		var id = '';  //记录setInterval的标记id
		
		pos = listObj.position();	
		top = pos.top;			//列表的top
		aniTop = top;				//记录当前运动时的top
		height = listObj.height();	//列表的高度
		
		var scrollUp = function() {
			aniTop--;
			if(!isSeries) {	//isSeries变量控制是否连续滚动，false不连续，true连续
				if(aniTop == -height) {	//不连续，滚动玩重新滚动
					listObj.css({'top': top});
					aniTop = top;
				};
			} else {
				if(aniTop == -listObj.children().eq(0).height()) {	//连续滚动
					var firstItem = '<' + listElem +'>' + listObj.children().eq(0).html() + '</' + listElem +'>';
					listObj.children().eq(0).remove();
					listObj.append(firstItem);
					aniTop = 4;
				};
			};
			listObj.css({'top': aniTop + 'px'});
		};
		
		var hover = function(id) {
			listObj.hover(function() {
				clearInterval(id);
			}, function() {
				id = setInterval(scrollUp, speed);
			});
		};
		
		this.start = function() {
			id = setInterval(scrollUp, speed);
			hover(id);
		};
		
	};
	var sa = new ScrollAction($('.noticeList'), 'li', 30, true);
	sa.start();
});*/
// Footer function
function positionFooter() {
	$menu_height = ($(window).height() + $(window).scrollTop()
			- $("#index_copyright").height() - 1)
			+ "px";
	if ($(document.body).height() + $("#index_copyright").height() < $(
			window).height()) {
		$("#index_copyright").css({
			position : "absolute",
			top : $menu_height
		});
	} else {
		$("#index_copyright").css({
			position : "static"
		});
	}
}
function datepick() {
	$("#datepicker").datepicker({
		changeMonth: true,
		changeYear: true,
		dateFormat: 'yy/mm/dd',
		showOn: "button",
		buttonImage: "../img/date.png",
		buttonImageOnly: true
		
	});
}
function nowTime(){
	$("#datepicker").val($.format.date(new Date(), 'yyyy/MM/dd'));
}
function deleteNews($id,$url){
	$( "#dialog-confirm" ).html("確定要刪除這一筆資料嗎?");
	$( "#dialog:ui-dialog" ).dialog( "destroy" );
	$( "#dialog-confirm" ).dialog({
		resizable: false,
		height:140,
		modal: true,
		buttons: {
			"Delete": function() {
				window.location = $url+"?id="+$id;
				
				$( this ).dialog( "close" );
			},
			Cancel: function() {
				$( this ).dialog( "close" );
			}
		}
	});
}
function tett() {
	/*$news_date = $(".main_information_news_date");
	$title = $(".main_information_news_title");
	$action = $(".main_information_news_action");
	for($i = 0;$i < $title.length;$i++){
		$news_date[$i].style.height = $title[$i].offsetHeight;
		//$news_date[$i].offsetHeight = $title[$i].offsetHeight;
		//$action[$i].offsetHeight = $title[$i].offsetHeight;
		alert($news_date[$i].style.height);
	}*/
}
function setEditorHeight($h) {
	CKEDITOR.config.height = $h;
}
function myhover($input_class){
	$($input_class).hover(
		function(index){
			var currentIdx = $($input_class).index(this);
			$($input_class).eq(currentIdx).addClass("share_a_hover");
		},
		function(){
			$($input_class).removeClass("share_a_hover");
		}
	);

}
