/******************************************************************************************
**版型排程功能(測試)
******************************************************************************************/
var year = String(new Date().getFullYear());
var month = new Date().getMonth()+1>9 ? String(new Date().getMonth()+1) : "0"+String(new Date().getMonth()+1);
var date = new Date().getDate()>9 ? String(new Date().getDate()) : "0"+String(new Date().getDate());
var now = Number(year+month+date);
function getXML(){
jQuery.get("themeXml.xml",function(data){
	for(i=0;i<$("theme",data).length;i++){
		var ondate=$("ondate:eq("+i+")",data).text();
		var offdate=$("offdate:eq("+i+")",data).text();
		if(ondate<=now && offdate>=now){
			var themebanner=$("topbanner:eq("+i+")",data).text();
			if(themebanner){insertSwf(themebanner,"topbanner");}
			var themecss=$("css:eq("+i+")",data).text();
			if(themecss){$("link:last").after("<link href=\""+themecss+"\" rel=\"stylesheet\" type=\"text/css\">");	}
		}
	}
});
}

function insertSwf(swf,targetDiv){
var swfobj = new SWFObject(swf, "topbanner_swf", "950", "180", "9,0,47,0", "#ffffff");
swfobj.addParam("quality", "high");
swfobj.addParam("wmode", "transparent");
swfobj.addParam("menu", "false");
swfobj.addParam("play", "true");
swfobj.write(targetDiv);
}

/******************************************************************************************
**首頁大廣告功能
******************************************************************************************/
/*
var bulletinFunc = false;
$(document).ready(function(){
	if(buletinFunc){
		$('#newBody').css({position:'relative'});
		$('#bulletin').click(function(){$(this).fadeOut();}).prepend('<img src="picture/banner_m6m7.png" title="休診公告" />');
		if(document.cookie.length>0){
			if(document.cookie.indexOf('bulletinFlag')==-1){
			showBulletin();
			//create cookie
			var exdate=new Date();
			exdate.setDate(exdate.getDate()+365);
			document.cookie="bulletinFlag=true"+";expires="+exdate.toGMTString();
			}
		}
	}
});
function showBulletin(){
	$('#bulletin').fadeIn();
	setTimeout(function(){$('#bulletin').fadeOut();},5000);
}
*/

/******************************************************************************************
**我的最愛視窗開合
******************************************************************************************/
$(document).ready(function(){
	$("#favoriteSetting").click(function(){
		$("#favoriteSetScreen").toggle();
	});
	$("span#close").click(function(){
		$("#favoriteSetScreen").hide();
	});
});

/******************************************************************************************
**電子病歷視窗開合
******************************************************************************************/
var ePaperFrame=426;
function show_ePaper_window(){
	WinOnAndOff("examwindow","on");
}
function hidden_ePaper_window(){
	WinOnAndOff("examwindow","off");	
}
function getTAG(TAGname) {
	return document.getElementById(TAGname);
}
function WinOnAndOff(winName, status) {
	if (status == "on") {
		getTAG(winName).style.display = "block";
	} else {
		getTAG(winName).style.display = "none";
	}
}

/******************************************************************************************
**電子病歷頁框捲動
******************************************************************************************/
var scroUP = 0;
var scroflag = 0;
function scrollUP(){
   scroUP=0;
   window.frames[0].scroll(0,0);
}
function scrollDOWN(){
	if (scroflag>=20) {
		scroflag=0;
		return;
	}  
	window.frames[0].scroll(0,scroUP);
	scroUP+=2;
	setTimeout("scrollDOWN()",1); 
	scroflag++;
}