//-------------IMSearch Common
var arrService = new Array("all","VIDEO","ALBUM","MP3","BLOG","RSS");
var arrServiceName = new Array("全部","影音","圖片","音樂","部落格","其它");
var SelectedStyle = "text-decoration: underline;";

function SettingSearchService(s){
  if(s=="web" || s=="VOD" || s=="FORUM"){
		alert("即將推出");
	}else{
		document.forms["searchform"].elements["stype"].value=s;
		for(t=0;t<arrService.length;t++){
		  if(arrService[t]==s){
				document.getElementById("ss_"+arrService[t]).style.color="#f03";
			}else{
				document.getElementById("ss_"+arrService[t]).style.color="";
			}
		}
		//if(document.forms["searchform"].elements["q"].value.length>0 && window.top.location.href.indexOf("search_result")>0){
		if(document.forms["searchform"].elements["q"].value.length>0){
		  DoSearch(document.forms["searchform"]);
		  document.forms["searchform"].submit();
		}
	}
}
function ShowSearchService(){
	//alert(thisService);
  //ts = (ts=="")?"VLOG":ts;
	for(s=0;s<arrService.length;s++){
    stylestr = ""
    stitle = arrServiceName[s];
    if(s>0) document.write(" │ ")
		if(arrService[s]==thisService){
			document.write('<a href="#" style="'+SelectedStyle+'" id="ss_'+arrService[s]+'">'+stitle+'</a>')
		}else{
			document.write('<a href="#" onClick="SettingSearchService(\''+arrService[s]+'\')" id="ss_'+arrService[s]+'">'+stitle+'</a>')
		}
	}
}
function DoSearch(f){
  var surl = "http://www.im.tv/IMsearch/";
	if(f.stype.value=="all" || f.stype.value==""){
		f.action=surl+"search_result_all.aspx";
	}else{
		f.action=surl+"search_result.aspx";
	}
	return true;
}
