<!--

// PopUp·sµøµ¡-©~¤¤
function newWindow(url, nameW, width, height) {	   
	if (navigator.appVersion.indexOf('4') != -1) {	 

	// Vars for centering the new window on Version 4 Browsers 

	xTop = screen.width/2 - (width/2);	 
	yTop = screen.height/2 - (height/2); 
	
	window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');

	} else {

	window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');

	}

}	

// ·s¥Í°V½m + §r¦Ì¹q¸£½Ò
function classPop(no) {	
if (no == 1) { newWindow("/pop1.htm","pop","500","320"); }
if (no == 2) { newWindow("/pop2.htm","pop","500","320"); }
if (no == 3) { newWindow("/pop3.htm","pop","300","240"); }
}

//²Å¸¹Âà´«
function Converter(src, key, rep)
{
  pre = "";
  while ((index = src.indexOf(key)) != -1)
  {
    pre += src.substring(0, index) + rep;
    src = src.substring(index + key.length, src.length);
  }
  src = pre + src;
  return src;
}

// Âà´«¤å¦r
function ConvertContent(Content)
{
  var cont1=Converter(Content, "&", "%26");
  var cont2=Converter(cont1, "'", "''");
  var cont3=Converter(cont2, "\n", "&lt;br&gt;");
  var cont4=Converter(cont3, "\"", "''");
  return cont4;
}

function ConvertC(Content)
{
  var cont1=Converter(Content, "&", "%26");
  var cont2=Converter(cont1, "\n", "&lt;br&gt;");
  var cont3=Converter(cont2, "\r", "&lt;p&gt;");
  return cont3;
}

// ²M°£ªÅ®æ¥Î
function clearMe(control)
{	  
	control.value = "";  
}

function changeCity(selobj)
{
   //alert(selobj.options[selobj.selectedIndex].value);
   if( selobj.selectedIndex != 0 ){
     window.location.href="./" + selobj.options[selobj.selectedIndex].value + "/Category_list";
   }
}

// logid ³]©w - ¤p¿»¯Z 476
function setLog(id)
{
  var ts = Math.random();
  document.write('<img src="http://tr.yam.com.tw/sp?ts=' + ts + '&t=' + id + '" height=0 width=0>');
}

//³Ì·sXXX, ¿ï³æ
function getFocus(obj) {obj.style.background = '#ffffee';}
function getBlur(obj)  {obj.style.background = '#FBD3B7';}

//ª`·N
function tips(no) {
$tips = "¡·´£¿ô±z¡I±z¥²¶·¬O¤wµn¤Jªº¥»¯Z¦P¾Ç¡A¤~¯à";
if (no == '1') {document.write('<font color="#CC0000" size="2">'+$tips+'[¦^À³¥»½gÁ¿¸q]³á!</font>');}
if (no == '2') {document.write('<font color="#CC0000" size="2">'+$tips+'[µoªí·s¸ÜÃD]³á!</font>');}
if (no == '3') {document.write('<font color="#CC0000" size="2">'+$tips+'[¦^À³¥»½g¤å³¹]³á!</font>');}
if (no == '4') {document.write('<font color="#CC0000" size="2">'+$tips+'[±ÀÂË·s®Ñ]³á!</font>');}
if (no == '5') {document.write('<font color="#CC0000" size="2">'+$tips+'[µoªí§@«~]³á!</font>');}
if (no == '6') {document.write('<font color="#CC0000" size="2">'+$tips+'[¤½§G¨Æ±¡]³á!</font>');}
}

function help() {
document.write('<a href="http://help.yam.com/kids/class/?channel_id=kids&amp;sub_name=¤p¿»¯Z"><img src="/k/i/style1/howtouse.gif" alt="" width="150" height="22" border="0" /></a>');
}
// ­º­¶¶]°¨¿O¥Î
function init() {

//url = document.URL;
//var pop_board = myGetcookie("popyesno");
//if (pop_board == "" || pop_board == null) {	pop_board = 0; }
// alert(url+'+'+pop_board);
//if (pop_board != "1" )
//{
//if ( 
//	url == "http://kid.yam.com/hogwarts/Category_list"	
// url == "http://class.kids.yam.com/hogwarts/Category_list" 
//		)   
//         {
//              classPop(3);
//         }
//}

  var img;
  var x, y;
  img = getImage("placeholder");
  if (img != null){
    x = getImagePageLeft(img);
    y = getImagePageTop(img);
    myScroller1.create();
    myScroller1.hide();
    myScroller1.moveTo(x, y);
    myScroller1.setzIndex(100);
    myScroller1.show();
    if (top.frames.length>1) {
      top.location="./";
    }
  }
}

// DelCookie ³]©w
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = myGetcookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// SetCookie ³]©w
function mySetCookie(name,value,expire)
{
	if (expire == null || expire == "")
	{ exp = 1;  	}  // ³]©w¤Ñ¼Æ
	else 
    { exp = expire; }   


	var defaultexpire=new Date();
  	defaultexpire.setTime(defaultexpire.getTime()+1000*60*60*24*exp);

    var expire=new Date();
  	expire.setTime(expire.getTime()+1000*60*60*24*exp);


	var currentCookie=name+"="+escape(value)+((expire==null)?(";expires="+defaultexpire.toGMTString()):(";expires="+expire.toGMTString()));
			document.cookie=currentCookie;
}

function myGetcookie(name)
{
  var ck = document.cookie;
  var vname = name + "=";
  if (ck.length > 0)
  {
    if ((begin = ck.indexOf(vname)) != -1)
    { 
      begin += vname.length;
      if ((end = ck.indexOf(";", begin)) < 0)
        end = ck.length;
      //   return unescape(ck.substring(begin, end));
      return ck.substring(begin, end);
    }
  }
  return null;
}


function GetUserName(){
  var mem = MEM0;
  if( mem != "" || mem != null ){
        return mem;
  }else{
    return "Guest";
  }
}

function GetUserId(){
  var mem = MEM1;
  if( mem != "" || mem != null ){
	return mem;
  }else{
    return "Guest";
  }  	
}	

function GetUserNick(){
  var mem = MEM2;
  if( mem != "" || mem != null ){
	return mem;
  }else{
    return "Guest";
  }  	
}	

function GetUserPerm(){
  var mem = MEM3;
  if( mem != ""){
	return mem;
  }else{
    return 1;
  }  	
}	

function GetUserGGroup(){
  var mem = MEM4;
  if( mem != ""){
	return mem;
  }else{
    return "no";
  }  	
}	

function GetUserGNormal(){
  var mem = MEM5;
  if( mem != ""){
	return mem;
  }else{
    return "no";
  }  	
}	

function GetUserCID(){
  var mem = MEM6;
  if( mem != ""){
	return mem;
  }else{
    return "no";
  }  	
}	

function GetUserGT(){
  var mem = MEM7;
  if( mem != ""){
	return mem;
  }else{
    return "no";
  }  	
}

function GetUserGTN(){
  var mem = MEM8;
  if( mem != ""){
	return mem;
  }else{
    return "no";
  }  	
}
function GetSubMaster(){
  var mem = submaster;
  if( mem != ""){
  	return mem;
  }else{
    return "no";
  }
}


// ********* Diff ID, Diff Menu ************************
function GoTo()
{
  var yam = myGetcookie("yam");
  var member = myGetcookie("member");

  if( yam == null || member == null){  	alert("½Ð¥ýµn¤J³á!");  }
}


function JoinOrNotGoTo()
{
var yam = myGetcookie("yam");
var member = myGetcookie("member");
var now_time = new Date();
var date_str = now_time.getMinutes()*1000*60+now_time.getSeconds()*1000+now_time.getMilliseconds(); 
var back_url        = document.URL;

if( yam == null || member == null){
answer=confirm("§A­n¥ýµn¤J¤~¯à¥[¤J¥»¯Z³é, ½Ð«ö¡i¨ú®ø¡j, ¨ì¥ª¤W¨¤µn¤J!\n¦pªG§AÁÙ¨S¥[¤J¿»Á¦ÃÃ·|­û, ½Ð«ö¡i½T©w¡j, ²{¦b´N¥h¥Ó½Ð§a!\n");
if (answer == true) 	{ location.href="http://kids.yam.com/login/remind.html?url="+back_url;  }
}
else 
{ window.location="Group_checkMember?"+ date_str;     }

}

function JoinOrNot() {
member1=GetUserId();
member2=GetUserNick();
member3=GetUserPerm();
member4=GetUserGGroup();
member5=GetUserGNormal();
member6=GetUserCID();
member7=GetUserGT();
var now_time = new Date();
var date_str = now_time.getMinutes()*1000*60+now_time.getSeconds()*1000+now_time.getMilliseconds();


//¥»¯Zªº¦Ñ®v
if ( member4 != null && member4.match(member6))
	 { 
      document.write('');
	  return
	 }
//³X«È, ¤£¬O¯Z¯Åªº¾Ç¥Í
else if (member5 == null) 
     {
     document.write('<tr><td colspan="2">¡D<a href="javascript:JoinOrNotGoTo();"><font size="2">§Ú­n³ø¦W¥»¯Z</font></a></td></tr>');
 
	       return
	 }
//¥»¯Zªº¾Ç¥Í
else if ( member5 != null && member5.match(member6)) 
	 { 
     document.write('');
     return
	 }
else 
     {
//³X«È, ¤£¬O¯Z¯Åªº¾Ç¥Í
     document.write('<tr><td colspan="2">¡D<a href="javascript:JoinOrNotGoTo();"><font size="2">§Ú­n³ø¦W¥»¯Z</font></a></td></tr>');
	       return
	 }
}

// ********* Control ************************
function GetParameters(){
  var org_query = location.search;
  var query = org_query.substr(1);
  //alert(query);

  var i;
  var cursor = 0;
  for(i=0; cursor<query.length ;i++){
    //alert("BCuresor=" + cursor);
    cursor = query.indexOf("&",cursor);
    //alert("ACursor=" + cursor);
    if( cursor == -1 ){
	break;
    }
    cursor = cursor +1;
  }
  //alert("COUNT="+i);
  count = i;

  var para = new Array(count);
  var a_cursor;
  var para_str;

  cursor = 0
  for(i=0 ; i<count+1 ;i++){
    para[i] = new Array(2);
    a_cursor = query.indexOf("&",cursor);
    if(a_cursor == -1){
      para_str = query.substr(cursor);
      //alert("para_str="+para_str);
      p_cursor = para_str.indexOf("=");
      if(p_cursor == -1){
	    para[i][0] = para_str;
	    para[i][1] = "";
      }else{
	    para[i][0] = para_str.substring(0,p_cursor);  
	    para[i][1] = para_str.substr(p_cursor+1); 
      }
      //alert(para[i][0] + "="+para[i][1])
      break;
    }
    para_str = query.substring(cursor,a_cursor);
    //alert("para_str="+para_str);
    p_cursor = para_str.indexOf("=");
    if(p_cursor == -1){
      para[i][0] = para_str;
      para[i][1] = "";
    }else{
      para[i][0] = para_str.substring(0,p_cursor);  
      para[i][1] = para_str.substr(p_cursor+1); 
    }
    //alert(para[i][0] + "="+para[i][1]);
    cursor = a_cursor +1;
  }
  /*
  for(i=0;i<para.length;i++){
  	alert(para[i][0] + "="+para[i][1]);
  }
  */
  return para;
}

function GetParameter(para,name){
  for(i=0;i<para.length;i++){
    if(para[i][0] == name){
      return para[i][1];
    }
  }
  return "";
}

function GoPage(url,page){
  var sort = GetParameter(GetParameters(),"sort");
  //alert("sort="+sort);
  if(sort != ""){  	
    window.location.href = url + "?from="+page +"&sort="+sort;
  }else{
    window.location.href = url + "?from="+page;
  }
}

function SearchSort(mySort){
  if( mySort != ""){
  	var sort = GetParameter(GetParameters(),"sort");
  	if(sort == ""){
      window.location.href = location.href +"&sort=" + mySort;
    }else{
      var title = GetParameter(GetParameters(),"title");
      var authorname = GetParameter(GetParameters(),"authorname");
      if( title != ""){
        window.location.href = "Forum_search?title=" + title + "&sort=" + mySort ;
      } else if ( authorname != "") {
      	window.location.href = "Forum_search?authorname=" + authorname + "&sort=" + mySort ;
      }
    }
  }
}

function GoSearchPage(url,page){
  if(page ==""){
    return alert("§A¥¼¿é¤J­¶¼Æ");	
  }		
  var title = GetParameter(GetParameters(),"title");
  var authorname = GetParameter(GetParameters(),"authorname");
  
  if( title != ""){
    window.location.href = url + "?title=" + title  +"&from=" + page;
  } else if ( authorname != "") {
  	window.location.href = url + "?authorname=" + authorname +"&from=" + page;
  }      

}	

function GoSearchSortPage(url,page){
  var title = GetParameter(GetParameters(),"title");
  var authorname = GetParameter(GetParameters(),"authorname");
  var sort = GetParameter(GetParameters(),"sort");
  
  if(sort != ""){  	
    if( title != ""){
      window.location.href = url + "?title=" + title + "&sort=" + sort +"&from=" + page;
    } else if ( authorname != "") {
    	window.location.href = url+"?authorname=" + authorname + "&sort=" + sort +"&from=" + page;
    }    
  }else{
    if( title != ""){
      window.location.href = url+"?title=" + title  +"&from=" + page;
    } else if ( authorname != "") {
    	window.location.href = url + "?authorname=" + authorname +"&from=" + page;
    }      
    
  }  
  
}

function SetPage(input_obj){
  document.ListForm.searchPage.value = input_obj.value;
}	
	
function GoPageJumpA(url){
  var jumpPage = document.ListForm.pnA.value;
  var sort = GetParameter(GetParameters(),"sort");
  //alert("sort="+sort);
  if(sort != ""){  	
    window.location.href = url + "?from="+jumpPage +"&sort="+sort;
  }else{
    window.location.href = url + "?from="+jumpPage;
  }
}

function GoPageJumpB(url){
  var jumpPage = document.ListForm.pnB.value;
  var sort = GetParameter(GetParameters(),"sort");
  //alert("sort="+sort);
  if(sort != ""){  	
    window.location.href = url + "?from="+jumpPage +"&sort="+sort;
  }else{
    window.location.href = url + "?from="+jumpPage;
  }
}


// Ãþ§O§P©w 
//1.»y¤å 2.°·±d»PÅé¨| 3.ªÀ·| 4.ÃÀ³N»P¤H¤å 5.¼Æ¾Ç 6.¦ÛµM»P¬ì§Þ 7.ºî¦X¬¡°Ê 8.¥Í¬¡ 9.¨ä¥¦

function setType(flag)
{
if (flag == '101'){document.write('»y¤å');}
if (flag == '102'){document.write('°·±d»PÅé¨|');}
if (flag == '103'){document.write('ªÀ·|');}
if (flag == '104'){document.write('ÃÀ³N»P¤H¤å');}
if (flag == '105'){document.write('¼Æ¾Ç');}
if (flag == '106'){document.write('¦ÛµM»P¬ì§Þ');}
if (flag == '107'){document.write('ºî¦X¬¡°Ê');}
if (flag == '108'){document.write('¥Í¬¡');}
if (flag == '109'){document.write('¨ä¥¦');}
}

function setMan(man)
{
//0:¾Ç¥Í,1:¦Ñ®v,2:®aªø,3:¤@¯ëºô¤Í4:¯Zªø
if (man == '0'){document.write('¾Ç¥Í');}
if (man == '1'){document.write('¦Ñ®v');}
if (man == '2'){document.write('®aªø');}
if (man == '3'){document.write('¤@¯ëºô¤Í');}
if (man == '4'){document.write('¯Zªø');}
}

function setSex(sex)
{
if (sex == 'M'){document.write('¨k');}
if (sex == 'F'){document.write('¤k');}
}

function setSexImg(sex)
{
if (sex == 'M'){document.write('<img src="/k/i/temper-b.gif" width="39" height="40">');}
if (sex == 'F'){document.write('<img src="/k/i/temper-g.gif" width="39" height="40">');}
}

function setZone(zone)
{
if (zone == '1'){document.write('©yÄõ¿¤');}
if (zone == '2'){document.write('°ò¶©¥«');}
if (zone == '3'){document.write('¥x¥_¥«');}
if (zone == '4'){document.write('¥x¥_¿¤');}
if (zone == '5'){document.write('®ç¶é¿¤');}
if (zone == '6'){document.write('·s¦Ë¿¤');}
if (zone == '7'){document.write('·s¦Ë¥«');}
if (zone == '8'){document.write('­]®ß¿¤');}
if (zone == '9'){document.write('¥x¤¤¿¤');}
if (zone == '10'){document.write('¥x¤¤¥«');}
if (zone == '11'){document.write('«n§ë¿¤');}
if (zone == '12'){document.write('¹ü¤Æ¿¤');}
if (zone == '13'){document.write('¶³ªL¿¤');}
if (zone == '14'){document.write('¹Å¸q¿¤');}
if (zone == '15'){document.write('¹Å¸q¥«');}
if (zone == '16'){document.write('¥x«n¿¤');}
if (zone == '17'){document.write('¥x«n¥«');}
if (zone == '18'){document.write('°ª¶¯¿¤');}
if (zone == '19'){document.write('°ª¶¯¥«');}
if (zone == '20'){document.write('«ÌªF¿¤');}
if (zone == '21'){document.write('¥xªF¿¤');}
if (zone == '22'){document.write('ªá½¬¿¤');}
if (zone == '23'){document.write('¼ê´ò¿¤');}
if (zone == '24'){document.write('ª÷ªù¿¤');}
if (zone == '25'){document.write('³s¦¿¿¤');}
if (zone == '99'){document.write('°ê¥~¦a°Ï');}
}

function setClass(n)
{
if (n == '1'){document.write('¤@¦~¯Å¾É®v');}
if (n == '2'){document.write('¤G¦~¯Å¾É®v');}
if (n == '3'){document.write('¤T¦~¯Å¾É®v');}
if (n == '4'){document.write('¥|¦~¯Å¾É®v');}
if (n == '5'){document.write('¤­¦~¯Å¾É®v');}
if (n == '6'){document.write('¤»¦~¯Å¾É®v');}
if (n == '7'){document.write('¬ì¥ô¦Ñ®v');}
if (n == '8'){document.write('¥D¥ô');}
if (n == '9'){document.write('®Õªø');}
if (n == '31'){document.write('¤@¦~¯Å¾É®v');}
if (n == '32'){document.write('¤G¦~¯Å¾É®v');}
if (n == '33'){document.write('¤T¦~¯Å¾É®v');}
if (n == '37'){document.write('¬ì¥ô¦Ñ®v');}
if (n == '38'){document.write('¥D¥ô');}
if (n == '39'){document.write('®Õªø');}
}
// ***** Forum *******************************

function deleteArticle(id){	
	var yam = myGetcookie("yam");
    var member = myGetcookie("member");
    if( yam == null || member == null){
  	  return alert("Guest ¤£¯à¬å¤å³¹");
    }
    
    var form_obj = window.document.POST_FORM;
	form_obj.action="Forum_delete";
	form_obj.elements[0].name="articleId";
	form_obj.elements[0].value=id;
//	alert("Delete Article ID="+id);
	if( confirm("§A½T©w­n§R°£¶Ü?") ){
		form_obj.submit();	
	}
}

function my_select(is_mark, fmobj) { 
  var i;
  if (is_mark == "add") {
    for (i = 0; i < countinpage; i++) {
      name = "chkb" + i;
      if (!fmobj[name].checked)
        fmobj[name].checked = true;
    }
  } else {  
    for (i = 0; i < countinpage; i++) {
      name = "chkb" + i;
      if (fmobj[name].checked)
        fmobj[name].checked = false;
    }
  }
    
}

// ¦]¬°¤½§GÄæ©Ò»Ý, ¦Ó¼W¥[ªº
function my_select1(is_mark, fmobj) { 
  var i;
  if (is_mark == "add") {
    for (i = 0; i < ccountinpage; i++) {
      name = "chkbb" + i;
      if (!fmobj[name].checked)
        fmobj[name].checked = true;
    }
  } else {  
    for (i = 0; i < ccountinpage; i++) {
      name = "chkbb" + i;
      if (fmobj[name].checked)
        fmobj[name].checked = false;
    }
  }
    
}


function GetSelect(fmobj){  
  var str = "";
  for (var i = 0; i < countinpage; i++) {
    name = "chkb" + i;
    var type = typeof fmobj[name];
    if(type!="undefined")
    {
    	if (fmobj[name].checked){
      	    str += fmobj[name].value + ",";
    	    }
    }
  }
  return str;
}

//¬°¤½§GÄæ·s¼Wªº..
function GetSelect1(fmobj){  
  var str = "";
  for (var i = 0; i < ccountinpage; i++) {
    name = "chkbb" + i;
    if (fmobj[name].checked){
      str += fmobj[name].value + ",";
    }
  }
  return str;
}



function DoAuth(fmobj){
  var uidList = GetSelect(fmobj);
    
  if (uidList.length == 0){
    return alert("±z¥¼¿ï¨ú¾Ç¥Í");
  }
    
  var form_obj = window.document.POST_FORM;
  form_obj.action="Group_mAuth";
  form_obj.elements[0].name="uidList";
  form_obj.elements[0].value=uidList;  
  if( confirm("§A½T©w­n¿ý¨ú¶Ü?") ){	
	form_obj.submit();	  
  }

}

function DoAuthDel(fmobj){

  var uidList = GetSelect(fmobj);
    
  if (uidList.length == 0){
    return alert("±z¥¼¿ï¨ú¾Ç¥Í");
  }
    
  var form_obj = window.document.POST_FORM;
  form_obj.action="Group_mAuthDel";
  form_obj.elements[0].name="uidList";
  form_obj.elements[0].value=uidList;  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){	
	form_obj.submit();	  
  }
}

function DoGroupDel(fmobj){

  var uidList = GetSelect(fmobj);
    
  if (uidList.length == 0){
    return alert("±z¥¼¿ï¨ú¾Ç¥Í");
  }
    
  var form_obj = window.document.POST_FORM;
  form_obj.action="Group_mDel";
  form_obj.elements[0].name="uidList";
  form_obj.elements[0].value=uidList;  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){	
	form_obj.submit();	  
  }

}

function DoLinksDel(fmobj){

  var linksList = GetSelect(fmobj);
  if (linksList.length ==0){
    return alert("±z¥¼¿ï¨ú³sµ²");
  }

  var form_obj = window.document.POST_FORM;
  form_obj.action="Group_delLinks";
  form_obj.elements[0].name="linksList";
  form_obj.elements[0].value=linksList;
  if( confirm("§A½T©w­n§R°£¶Ü?") ){
        form_obj.submit();
  }
}

function DoMatchDel(fmobj){

  var matchList = GetSelect(fmobj);
  if (matchList.length ==0){
    return alert("±z¥¼¿ï¨ú³sµ²");
  }

  var form_obj = window.document.POST_FORM;
  form_obj.action="Group_delMatch";
  form_obj.elements[0].name="matchList";
  form_obj.elements[0].value=matchList;
  if( confirm("§A½T©w­n§R°£¶Ü?") ){
        form_obj.submit();
  }
}


function DoDel(fmobj,service){

  var artList = GetSelect(fmobj);    
  if (artList.length == 0){
    return alert("±z¥¼¿ï¨úÀÉ®×");
  }
  //  if (artList.length != 0){
  //        alert("«ö½T©w«á§Y§R°£²Ä" + GetSelect(fmobj) + "µ§¤å³¹");
  //  }
    
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_mDelete@" + service;
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=artList;  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){	
	form_obj.submit();	  
  }
}


// ¦]¤½§GÄæ¦Ó·s¼Wªº..
function DoDel1(fmobj,service){

  var artList = GetSelect1(fmobj);    
  if (artList.length == 0){
    return alert("±z¥¼¿ï¨úÀÉ®×");
  }
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_mDelete@" + service;
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=artList;  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){	
	form_obj.submit();	  
  }
}

function DoDelArticle(articleId, service){
// Forum_mDelete@Meeting=Forum_adminList@Meeting
if (service == 1 )   // ¯Z·
	{ service = "Meeting";}
if (service == 2 )   // ¹Ï®ÑÀ]
	{ service = "Library";  }
if (service == 3 )  // Á¿¸q
	{ service = "Handout";}
if (service == 4 )  // §@«~
	{ service = "Work"; }
if (service == 5 )  // ¥mÀ{ - ¾Ç¥Í
	{ service = "Bulletin";}
if (service == 6 )  // ¤½§i - ¦Ñ®v
	{ service = "Exhort";}
if (service == 7 )  // ½Òªí 
	{ service = "TimeTable";}

/*
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_mDelete@" + service;
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=articleId;
*/
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_delete@" + service;
  form_obj.elements[0].name="articleId";
  form_obj.elements[0].value=articleId;
  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){
        form_obj.submit();
  }

}


function DoDelAdminArticle(articleId, service){
// Forum_mDelete@Meeting=Forum_adminList@Meeting
if (service == 1 )   // ¯Z·^M
        { service = "Meeting";}
if (service == 2 )   // ¹Ï®ÑÀ]
        { service = "Library";  }
if (service == 3 )  // Á¿¸q
        { service = "Handout";}
if (service == 4 )  // §@«~
        { service = "Work"; }
if (service == 5 )  // ¥mÀ{ - ¾Ç¥Í
        { service = "Bulletin";}
if (service == 6 )  // ¤½§i - ¦Ñ®v
        { service = "Exhort";}
if (service == 7 )  // ½Òªí 
        { service = "TimeTable";}

if(location.href.indexOf(articleId)!=-1)
{
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_mDelete@" + service;
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=articleId;
}
else
{
  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_adminDelete@" + service;
  form_obj.elements[0].name="articleId";
  form_obj.elements[0].value=articleId;
  form_obj.elements[1].name="articleList";
  form_obj.elements[1].value=articleId;
}
  if( confirm("§A½T©w­n§R°£¶Ü?") ){
        form_obj.submit();
  }

}

function DoAdminViewDel(articleId, service){

if (service == 1 )   // ¯Z·
	{ service = "Meeting";}
if (service == 2 )   // ¹Ï®ÑÀ]
	{ service = "Library";  }
if (service == 3 )  // Á¿¸q
	{ service = "Handout";}
if (service == 4 )  // §@«~
	{ service = "Work"; }
if (service == 5 )  // ¥mÀ{ - ¾Ç¥Í
	{ service = "Exhort";}
if (service == 6 )  // ¤½§i - ¦Ñ®v
	{ service = "Bulletin";}
if (service == 7 )  // ½Òªí 
	{ service = "TimeTable";}

  var form_obj = window.document.POST_FORM;
  form_obj.action="Forum_adminDelete@" + service;
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=articleId;  
  if( confirm("§A½T©w­n§R°£¶Ü?") ){	
	form_obj.submit();	  
  }	
	
}	

function DoUpdate(fmobj) {
//  alert("SELECT LIST" + GetSelect(fmobj))
  var artList = GetSelect(fmobj);
  
  if (artList.length == 0) {
        return alert("±z¥¼¿ï¨úÀÉ®×");
  }
    
  var form_obj = window.document.POST_FORM;
//  var selobj = fmobj.selectobj ;  
  
  form_obj.action="Forum_mUpdate";
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=artList;  
  form_obj.elements[1].name="mark";
  form_obj.elements[1].value=fmobj.MarkSelectedIndex.value;
  
    
//  alert("MARK FLAG="+ selobj[0].value );
//  alert("MARK FLAG="+ selobj.options[0].value );
//  alert("SelectedIndex=" + selobj.selectedIndex);
  
  
/*
  var mySelect = selobj;  
  for (var i = 0; i < mySelect.options.length; i++) {   
  	if (mySelect.options[i].selected)      
  		alert(i+" is selected");
  }
*/  
  
  form_obj.submit();	  

}

function MarkOnChange(fmobj,selobj){
//  alert(selobj.selectedIndex);
  fmobj.MarkSelectedIndex.value = selobj.selectedIndex;
}	

function DigestListOnChange(fmobj,selobj){
//  alert("Select Digest ID=" + selobj[selobj.selectedIndex].value);
  fmobj.DigestSelectedIndex.value = selobj[selobj.selectedIndex].value;	
}

function DoAdd(fmobj) {

  var artList = GetSelect(fmobj);
  
  if (artList.length == 0) {
    return alert("±z¥¼¿ï¨úÀÉ®×");
  }
  if (artList.length != 0 && fmobj.DigestSelectedIndex.value=="") {
  	  return alert("±z¥¼¿ï¨úºëµØ°Ï¥Ø¿ý");
  }
  
  if (artList.length != 0 && fmobj.DigestSelectedIndex.value!="") {
//  	  alert("²¾¨ì¤U­±¥Ø¿ý:" + GetSelect(fmobj))
  }
    
  var form_obj = window.document.POST_FORM;
//  var selobj = fmobj.selectobj ;  
  
  form_obj.action="Digest_mAdd";
  form_obj.elements[0].name="articleList";
  form_obj.elements[0].value=artList;  
  form_obj.elements[1].name="digestId";
  form_obj.elements[1].value=fmobj.DigestSelectedIndex.value;
  form_obj.elements[2].name="forumId";
  form_obj.elements[2].value=fmobj.forumId.value;
  
  mySetCookie('D_digestId',fmobj.DigestSelectedIndex.value);
 
//  alert("DigestId="+fmobj.DigestSelectedIndex.value);   
//  alert("ForumId="+fmobj.forumId.value);   
  form_obj.submit();	  

}



function DoPrint(articleId){
	window.location.href='Forum_print?popwin=true&articleId=' + articleId;	
}
	
function getADstr()
{
  return ("\n----------------------------------------------------------\n"
  + "·Q¥Ó½Ð§K¶Oºô¸ôµwºÐ¡A¨É¨ü¿»¼Ö¥Í¬¡!?\n"
  + "ºô¸ôµwºÐ  http://webhd.yam.com\n"
  + "¿»Á¦ÃÃ  http://www.yam.com\n"
  + "----------------------------------------------------------\n")
}

function sendmail(msgform, adstr){
  if(msgform.to.value == ""){
    alert("½Ð¿é¤JªB¤ÍªºEmail¡I");
    return false;
  }
  /*
  if(msgform.FromDesc.value == "" || msgform.FromDesc.value.length<10){
    alert("½Ð¿é¤Jµ¹ªB¤Íªº¸Ü");
    return false;
  }
  */

  var form_obj = document.POST_FORM;
  form_obj.action = "Forum_sendMail";
  form_obj.method="POST";
  
  var article_id =  myGetcookie("F_articleId");
  var atturl = "";
  if ( article_id != "" ){
      var ptr = location.href.lastIndexOf("/");
      atturl = location.href.substring(0,ptr) +"/Forum_print?popwin=true&articleId="+ article_id;
  }
  
  form_obj.elements[0].name = "to";
  form_obj.elements[0].value= msgform.to.value;
  form_obj.elements[1].name="FromDesc";
  form_obj.elements[1].value= msgform.FromDesc.value + adstr;
  form_obj.elements[2].name="title";
  form_obj.elements[2].value= msgform.title.value;  
  form_obj.elements[3].name="atturl";
  form_obj.elements[3].value= atturl;
  
  
        
  
//  alert("to=" + form_obj.elements[0].value);
//  alert("body=" + form_obj.elements[1].value);  
//  alert("title=" + form_obj.elements[2].value);  
//  alert("atturl=" + form_obj.elements[3].value);    

  form_obj.submit();

}


function doMailLogin(type)
{
  tw = window.open("http://mail.yam.com/mail/Login", "MailLogin", "top=100, left=2048");
  //tw.onLoad = doAddressBook();
  if (type == "addfriend")
  {
    timeID = setTimeout("doAddFriend()", 1000);
  }
  else
  {
    timeID = setTimeout("doAddressBook()", 1000);
  }
}

function doAddFriend()
{
  tw2 = window.open("http://mail.yam.com/mail/addressbook/pal", "AddressBook", "scrollbars=yes,width=450,height=400,resizable=yes");
  //tw2.resizeTo(450, 400);
  clearTimeout(timeID);
  tw.close();
}

function doAddressBook()
{
  tw2 = window.open("http://mail.yam.com/mail/addressbook/pladd", "AddressBook", "scrollbars=yes,width=550,height=400,resizable=yes");
  //tw2.resizeTo(550, 400);
  clearTimeout(timeID);
  tw.close();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function Pal(){
  var palwin=window.open('/hogwarts/_AddressBook','palwin','width=400,height=400,scrollbars=1');
  pal=1;
  if ((document.window != null) && (!palwin.opener))
    palwin.opener=document.window;
}

function GetMailForm(){
  var url = location.href; 
/*  
  while( url.indexOf("/") != -1 ){
    url = url.replace("/","%2F"); 
  }
  url = url.replace("?","%3F");
  
//  url = url + "%26popwin=true"; 
  
  alert("URL=" + url);
*/  
  window.location.href="Forum_getMailForm";	
}	

function GetPostForm(){
  var yam = myGetcookie("yam");
  var member = myGetcookie("member");

  if( yam == null || member == null){
  	alert("½Ðµn¤J±b¸¹");
  }else{
  	window.location.href='Forum_getPostForm';
  }
}	

function GetReplyForm(article){
  var yam = myGetcookie("yam");
  var member = myGetcookie("member");
  if( yam == null || member == null){
  	alert("½Ðµn¤J±b¸¹");
  }else{
  	window.location.href='Forum_getReplyForm?articleId='+article;
  }
  	
}	

function GetMailForm(){
  var yam = myGetcookie("yam");
  var member = myGetcookie("member");
  if( yam == null || member == null){
  	alert("½Ðµn¤J±b¸¹");
  }else{
  	window.location.href='Forum_getMailForm';
  }
  	
}

function GetLinksForm(){
        window.location.href='Group_getLinkForm';
}      	

function wpop(win,x,y)
{
  remote = window.open("","remotewin","width="+ x +",height="+ y +",scrollbars=yes,resizable=yes");
  if( win.indexOf("?") == -1 ){ 
        remote.location.href = win + "?popwin=true";
  }else{
    remote.location.href = win + "&popwin=true";
  }
  if (remote.opener == null) remote.opener = window;
    remote.window.focus();
}

function PopAttach(win,x,y){
   var file_array = new Array(".txt",".gif",".pdf",".jpg",".htm",".doc","*.png");
   var flag = false;
   for(i=0;i<file_array.length;i++){
       if( win.toLowerCase().indexOf(file_array[i]) != -1){
           flag = true;
           break;
       }
   }

   if( flag ){
           wpop(win,x,y);
   }else{
       window.location.href = win;
   }
}

function CheckMember(sid,realname){
//	alert("sid length" + sid.length);
/*
	if(sid.length != 10){
	    alert("½Ð½T»{¨­¥÷µý¦r¸¹");	
	}else 
*/
  if( realname.length < 2){
		alert("½Ð½T»{§Aªº¯u¹ê©m¦W");
	}else{
		window.location.href='Group_getCreateForm';
	}
	
}

function isClassTeacher()
{
  MEM1type = typeof MEM1;
  MEM3type = typeof MEM3;
  MEM4type = typeof MEM4;
  MEM6type = typeof MEM6;

  if(MEM1type!="undefined" && MEM1!="" && MEM3type!="undefined" && ( MEM3=="8" || MEM3=="16" ) && MEM4type!="undefined" && MEM6type!="undefined" && MEM4.indexOf(MEM6)!=-1)
  {
	return true;
  }
  else
  {
	return false;
  }
}

function isClassAdmin()
{
  MEM1type = typeof MEM1;
  MEM3type = typeof MEM3;
  MEM4type = typeof MEM4;
  MEM6type = typeof MEM6;

  if(MEM1type!="undefined" && MEM1!="" && MEM3type!="undefined" && ( MEM3=="8" || MEM3=="10" || MEM3=="16") && MEM4type!="undefined" && MEM6type!="undefined" && MEM4.indexOf(MEM6)!=-1)
  {
        return true;
  }
  else
  {
        return false;
  }
}


function isDirectAdminMainPage()
{
  if(isClassAdmin())
  {
	thisUrl = location.href;
        if(thisUrl.indexOf('Forum_adminList@Bulletin')==-1)
	{
            baseUrl = thisUrl.substring(0,thisUrl.lastIndexOf("/"));
	    location.href = baseUrl+'/Forum_adminList@Bulletin';
        }
  }	
}

function GetReplyForm(article, type){
  var yam = myGetcookie("co_member");
  var member = myGetcookie("member");
  if( yam == null && member == null){
        alert("½Ðµn¤J±b¸¹");
  }else{
        window.location.href='Forum_getReplyForm@'+type+'?articleId='+article;
  }
}

function AdminGetReplyForm(article, type){
  var yam = myGetcookie("co_member");
  var member = myGetcookie("member");
  if( yam == null && member == null){
        alert("½Ðµn¤J±b¸¹");
  }else{
        window.location.href='Forum_adminGetReplyForm@'+type+'?articleId='+article;
  }
}

//-->
