function forum_swap(obj){
	
	//alert (obj.id)
	
	if (obj.id == 'hotest_forum_post_href'){
		//alert ('熱門');
		document.getElementById('latest_forum_post_image').src = 'images/p014.gif';
		document.getElementById('hotest_forum_post_image').src = 'images/p013.gif';
		document.getElementById('hotest_forum_post').style.display='block';
		document.getElementById('latest_forum_post').style.display='none';
		
	}
	else{
		//alert ('最新');
		document.getElementById('latest_forum_post_image').src = 'images/p014v.gif';
		document.getElementById('hotest_forum_post_image').src = 'images/p013v.gif';
		document.getElementById('hotest_forum_post').style.display='none';
		document.getElementById('latest_forum_post').style.display='block';
		
	}
	
	
}

function search_swap(obj){
	
	
	
	if (obj.id == 'fast_search_href'){		
		document.getElementById('fast_search_image').src = 'images/centerv_02.gif';
		document.getElementById('advanced_search_image').src = 'images/center_03.gif';
		document.getElementById('keyword_search_image').src = 'images/center_04.gif';		
		document.getElementById('fast_search').style.display='block';
		document.getElementById('advanced_search').style.display='none';
		document.getElementById('keyword_search').style.display='none';
		
	}
	
	if (obj.id == 'advanced_search_href'){		
		document.getElementById('fast_search_image').src = 'images/center_02.gif';
		document.getElementById('advanced_search_image').src = 'images/centerv_03.gif';
		document.getElementById('keyword_search_image').src = 'images/center_04.gif';		
		document.getElementById('fast_search').style.display='none';
		document.getElementById('advanced_search').style.display='block';
		document.getElementById('keyword_search').style.display='none';
		
	}
	
	if (obj.id == 'keyword_search_href'){		
		document.getElementById('fast_search_image').src = 'images/center_02.gif';
		document.getElementById('advanced_search_image').src = 'images/center_03.gif';
		document.getElementById('keyword_search_image').src = 'images/centerv_04.gif';		
		document.getElementById('fast_search').style.display='none';
		document.getElementById('advanced_search').style.display='none';
		document.getElementById('keyword_search').style.display='block';
		
	}
	
	
}

function reload_page(script){	
	window.location = script;
}

function get_select_value(select_obj){	
	var the_select = select_obj;
	var the_index = the_select.selectedIndex;
	var the_selected = the_select.options[the_index].text;
	var the_selected_value = the_select.options[the_index].value;
	return the_selected_value;
}

function check_radio_button(obj,radio_name){
	var btn_checked = false;
	var len = obj.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = obj.elements[i];
	    if (e.name == radio_name && e.checked){
	    	btn_checked = true;
	    	break;
	    }
	}
	return btn_checked;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// #############################################################################
// get left position of elm
function confirm_action(msg,action)
{
	if (confirm(msg))
		window.location = action;
}

// Calendar
function selectHandler(cal, date)
{
  cal.sel.value = date;
  if (cal.dateClicked)
    cal.callCloseHandler();
}

function closeHandler(cal)
{
  cal.hide();
  calendar = null;
}

function showCalendar(obj)
{
 	var calendar = new Calendar(0, null, selectHandler, closeHandler); 	
  calendar.showsTime = false;
  calendar.showsOtherMonths = true; 
  calendar.create();
  calendar.setDateFormat('%Y-%m-%d');
  calendar.parseDate(obj.value);
  calendar.sel = obj;
  calendar.showAtElement(obj.nextSibling, "Br");
}

function calendar(){
	var mdays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);	
	var now = new Date();
	var year = now.getFullYear();
	var today = now.getDate();
	
	if (((year % 4 ==0) && (year%100!=0)) || (year % 400==0)) mdays[1] = 29;
	ndays = mdays[now.getMonth()];
	firstDay = now;
	firstDay.setDate(1);
	startDay = firstDay.getDay();
	
	document.write("<center><table border cellspacing=0>");
	document.write("<tr><th colspan = 7>" + year + " 年 " + (now.getMonth()+1)+" 月<tr><th>" + "<font color=red> 週日"+
		"</font><th>週一<th>週二<th>週三<th>週四<th>週五<th>"+
		"<font color=blue>週六</font></tr><tr>");
	var column = 0;
	for (i=0; i<startDay; i++){
		document.write("<td>&nbsp;</td>");
		column++;
	}
	for(i=1; i<=ndays;i++){
		if (column==7){
			document.write("</tr><tr>");
			column = 0;
		}
		
		if (i==today)
			document.write("<td align='center' bgcolor='pink'>");
		else
			document.write("<td align=center>");
		document.write(i);
		column++;
	}
	document.write("</tr></table></center>");
}
