﻿/****************************************/
/* widget.php 							*/
/****************************************/

function CheckCSS()
{
	var isIe = (window.ActiveXObject)?true:false; 
	var css;
	if (isIe)
		css = document.getElementById('WgtStyle').value;
	else
		css = document.config_save.WgtStyle.value;

	if (css=='Custom') { //Premium Account Setting Logo 
		answer = prompt("請輸入CSS的所在網址","http://");
		if (isIe) {
			document.getElementById('CustomCSS').value = answer;
			document.getElementById('CustomCSS').style.display = 'inline';
			document.getElementById('iconPrefer').style.display = 'inline';
		}
		else {
			document.config_save.CustomCSS.value = answer;
			document.config_save.CustomCSS.style.display = 'inline';
			document.config_save.iconPrefer.style.display = 'inline';
		}
	}
}

function PreviewLogo(isPremium,index)
{
	var isIe = (window.ActiveXObject)?true:false; 
	if (isIe)
		LogoIndex = document.getElementById('Logo').value;
	else
		LogoIndex = document.config_save.Logo.value;
	if (LogoIndex==99 && isPremium>0) { //Premium Account Setting Logo 
		answer = prompt("請輸入Logo的所在網址","http://");
		goUrl(null,answer);
		if (isIe)
			document.getElementById('LogoCustom').value = answer;
		else
			document.config_save.LogoCustom.value = answer;
	}
	else if (LogoIndex==99 && isPremium<=0) { //Premium Account Setting Logo 
		answer = alert("需要公民證書才能自定Logo唷！");
	}
	else if ((LogoIndex!=0 && LogoIndex!=38) && isPremium<=0) { //Premium Account Setting Logo 
		answer = alert("此Logo需要公民證書才能設定唷！");
		if (isIe)
			document.getElementById('Logo').value = index;
		else
			document.config_save.Logo.value = index;
	} 
	else {
		if (isIe)
			document.getElementById('LogoCustom').value = '';
		else
			document.config_save.LogoCustom.value = '';
	}
	//else if (LogoIndex!='')
		//goUrl(null,'http://www.blog-orbit.com/3rdParty/logo_competition.php?seq='+LogoIndex);
}

function GoReferAction()
{
	var isIe = (window.ActiveXObject)?true:false; 
	if (isIe)
		BlogAddr = document.getElementById('ReferList').value;
	else
		BlogAddr = document.ReferListForm.ReferList.value;
	if (BlogAddr!='')
		goUrl(null,BlogAddr);
}

function BlockAction()
{
	var Action;
	var answer;
	var isIe = (window.ActiveXObject)?true:false; 
	if (isIe)
		Action = document.getElementById('BlockList').value;
	else
		Action = document.BlockForm.BlockList.value;

	if (Action=='')
		return;
	else if (Action=='AddNew') {
		if (isIe) {
			answer = prompt ("請輸入對方的BO帳號","");
			document.getElementById('id_block').value = answer;
			document.getElementById('id_deblock').value = '';
		}
		else {
			answer = prompt ("請輸入對方的BO帳號\n( 欲取得對方的帳號, 請在輪撥區中用滑鼠指向對方的名稱\n  瀏覽器下方的狀態列最後可以看到id=xxxxx\n  xxxxx即為對方的BO帳號 )","");
			document.BlockForm.id_block.value = answer;
			document.BlockForm.id_deblock.value = '';
		}
		if (answer)
			document.BlockForm.submit();
	}
	else {
		answer = confirm ("是否確定再度接受"+Action+"的訪問？");
		if (answer) {
			if (isIe) {
				document.getElementById('id_block').value = '';
				document.getElementById('id_deblock').value = Action;
			}
			else {
				document.BlockForm.id_block.value = '';
				document.BlockForm.id_deblock.value = Action;
			}
			document.BlockForm.submit();
		}
	}
}

function partTime(id_host,id_partTimer,dummyLink,hour)
{
	if (hour==null) var hour = 24;
	var answer = confirm ("您的BO輪撥區第一個位置將打工 "+hour+" 小時～\n\n請注意，打工是無法取消的唷！\n\n是否確定接下這份工作呢？");
	if (answer)
		window.location = "partTime_processPro.php?id_host="+id_host+dummyLink+"&id_partTimer="+id_partTimer;
}

function TravelReq(MyType)
{
	var isIe = (window.ActiveXObject)?true:false; 
	if (isIe)
		document.getElementById('travelType').value = MyType;
	else
		document.travel_req.travelType.value = MyType;
	document.travel_req.submit();
}
function deleteVIP(id_host,id_deleter,index,dummyLink) {
	var answer = confirm ("確定移除此篇VIP留言?");
	if (answer)
		window.location = "goodbyeVIP.php?id="+id_host+dummyLink+"&id_deleter="+id_deleter+"&delete="+index;
}
function deletePCMT(id_host,id_deleter,index,dummyLink) { 
	var answer = confirm ("確定移除這一則話題留言?"); 
	if (answer)
	window.location = "goodbyePCMT.php?id="+id_host+dummyLink+"&id_deleter="+id_deleter+"&delete="+index;
}
function deleteDiary(id_host,index,dummyLink) {
	var answer = confirm ("確定移除這一則軌道日記?");
	if (answer)
		window.location = "goodbyeDiary.php?id="+id_host+dummyLink+"&delete="+index;
}
function LinkingTravel(OrbitName)
{
	var isIe = (window.ActiveXObject)?true:false; 
	
	if (isIe) {
		document.getElementById('travelType').value = 'OrbitSearch';
		document.getElementById('OrbitSearch').value = OrbitName;
	} 
	else {		
		document.travel_req.travelType.value = 'OrbitSearch';
		document.travel_req.OrbitSearch.value = OrbitName;		
	}	
	document.travel_req.submit();
}
function ConfigSave()
{
	document.config_save.submit();
}
function ConfigLogin()
{
	document.config_login.submit();
}
function VipReq()
{
	document.vip_req.submit();
}
function OrbitLogin()
{
	document.vip_login.submit();
}
function WgtToolbarToggle()
{
	if (document.getElementById('WgtToolBar')) {
		var ToolbarStatus = document.getElementById('WgtToolBar').style.display;
		
		if (ToolbarStatus=='inline')
			HideMsg('WgtToolBar');
		else
			FadeInMsg('WgtToolBar', 'WgtToolBar2');
			
		ClearPrompt('widget');			
	}
}
function HideShowToggle(obj,obj2)
{
	if (document.getElementById(obj)) {
		var ToolbarStatus = document.getElementById(obj).style.display;
		
		if (ToolbarStatus=='inline')
			HideMsg(obj);
		else
			FadeInMsg(obj, obj2);
			
		//ClearPrompt('widget');			
	}
}


/****************************************/
/* join.php 							*/
/****************************************/

/* Show "http://" */
function HTTPPrompt(Item)
{
  var isIe=(window.ActiveXObject)?true:false; 

  if (Item=='BlogAddress_note' && (isIe)) {
	  document.poppedLayer = eval('document.getElementById("BlogAddress")');
	  document.poppedLayer.value = "http://"; 
		  
	  /* To the last character */
		var e = event.srcElement;
		var r =e.createTextRange();
		r.moveStart('character',e.value.length);
		r.collapse(true);
		r.select();
  }
}

/****************************************/
/* NO category 							*/
/****************************************/

/* Hide all prompts */
function ClearPrompt(Item)
{
  /* Clear all prompt in join.php */
  if (Item=='join') {
	  HideMsg("ID_note");
	  HideMsg("Passwd_note");
	  HideMsg("Passwd2_note");
	  HideMsg("Email_note");
	  HideMsg("BlogAddress_note");
	  HideMsg("BlogOrbit_note");	  
	  HideMsg("Greeting_note");	 
	  HideMsg("Description_note");	  
  }
  else if (Item=='widget')
  {
	  HideMsg("Tool_Home");
	  HideMsg("Tool_Travel");
	  HideMsg("Tool_vip");	  
	  HideMsg("Tool_People");
	  HideMsg("Tool_Config");	
	  HideMsg("Tool_1_Info");	  
	  HideMsg("Tool_2_Info");	  
	  HideMsg("Tool_3_Info");	  
	  HideMsg("Tool_4_Info");	  
	  HideMsg("Tool_5_Info");	
	  HideMsg("Tool_6_Info");  
  }
  else if (Item=='widget_tool_info')
  {
	  HideMsg("Tool_0_Info");	
	  HideMsg("Tool_1_Info");	  
	  HideMsg("Tool_2_Info");	  
	  HideMsg("Tool_3_Info");	  
	  HideMsg("Tool_4_Info");	  
	  HideMsg("Tool_5_Info");
	  HideMsg("Tool_6_Info");
	  HideMsg("Tool_9_Info");
  }
  
}
