function StartSrh(k){
  var v_chn=document.getElementById('chn');
  if (''==k)
    k=v_chn.value;
  else
    v_chn.value=k;

  if ('W'==k.substr(0,1)){
    document.getElementById('search_bar_imgyw').src='images/search_yw_01.gif';
    document.getElementById('search_bar_imgweb').src='images/search_all.gif';
    document.getElementById('ydiv').style.display='none';
    document.getElementById('wdiv').style.display='block';
  } else {
    document.getElementById('search_bar_imgyw').src='images/search_yw.gif';
    document.getElementById('search_bar_imgweb').src='images/search_all_01.gif';
    document.getElementById('ydiv').style.display='block';
    document.getElementById('wdiv').style.display='none';
  }

  var s=document.getElementById('kw');
  if (''==s.value || '-請輸入關鍵字-'==s.value){
    document.getElementById('kw').value='';
    document.getElementById('kw').focus();
    document.getElementById('alert_str').innerHTML='<br><font color=red>　請輸入要搜尋的關鍵字</font>';
    return false;
  } else {
    document.getElementById('alert_str').innerHTML='';
    if ('W'==k.substr(0,1) && 'A'!=k.substr(1,1)){
      document.Srhdata.wwhich[0].checked=true;
      var url='http://www.youthwant.com.tw/search/srho?chn='+v_chn.value+'&kw='+s.value;
      window.open(url,'YS_win','');
      return false;
    } else {
      var url='http://www.youthwant.com.tw/search/srh?chn='+v_chn.value+'&kw='+s.value;
      document.Srhdata.action=url;
      location.href=url;
      return false;
    }
  }
}

function StartSrh1(k){
  var v_chn=document.getElementById('chn1');
  if (''==k)
    k=v_chn.value;
  else
    v_chn.value=k;

  if ('W'==k.substr(0,1)){
    document.getElementById('search_bar_imgyw1').src='images/search_yw_01.gif';
    document.getElementById('search_bar_imgweb1').src='images/search_all.gif';
    document.getElementById('ydiv1').style.display='none';
    document.getElementById('wdiv1').style.display='block';
  } else {
    document.getElementById('search_bar_imgyw1').src='images/search_yw.gif';
    document.getElementById('search_bar_imgweb1').src='images/search_all_01.gif';
    document.getElementById('ydiv1').style.display='block';
    document.getElementById('wdiv1').style.display='none';
  }
    
  var s=document.getElementById('kw1');
  if (''==s.value || '-請輸入關鍵字-'==s.value){
    document.getElementById('kw1').value='';
    document.getElementById('kw1').focus();
    document.getElementById('alert_str1').innerHTML='<br><font color=red>　請輸入要搜尋的關鍵字</font>';
    return false;
  } else {
    document.getElementById('alert_str1').innerHTML='';
    if ('W'==k.substr(0,1) && 'A'!=k.substr(1,1)){
      document.Srhdata1.wwhich1[0].checked=true;
      var url='http://www.youthwant.com.tw/search/srho?chn='+v_chn.value+'&kw='+s.value;
      window.open(url,'YS_win','');
      return false;
    } else {
      var url='http://www.youthwant.com.tw/search/srh?chn='+v_chn.value+'&kw='+s.value;
      document.Srhdata1.action=url;
      location.href=url;
      return false;
    }
  }
}

function StartSrh2(){
  var v_chn=document.getElementById('chn');
  var s=document.getElementById('kw');
  if (''==s.value || '-請輸入關鍵字-'==s.value){
    document.getElementById('kw').value='';
    document.getElementById('kw').focus();
    document.getElementById('alert_str').innerHTML='<br><font color=red>●請輸入要搜尋的關鍵字</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p>';
    return false;
  } else {
		if ('ST'==v_chn.options[v_chn.selectedIndex].value){
	    var url='http://share.youthwant.com.tw/sh_search.php?FP=1&Swhich=1&S_title='+s.value+'&SR_date=2&SR_ft=1&SR_ct=1';
			document.Srhdata.action=url;
			location.href=url;
			return false;
		} else {
	    document.getElementById('alert_str').innerHTML='';
	    var url='http://www.youthwant.com.tw/search/srh?chn='+v_chn.value+'&kw='+s.value;
	    document.Srhdata.action=url;
	    location.href=url;
	    return false;
  	}
  }
}

/*
for 校園頻道的search
*/
function StartSrh3(){
  var v_chn=document.getElementById('chn');
  var s=document.getElementById('kw');
  if (''==s.value || '-請輸入關鍵字-'==s.value){
    document.getElementById('kw').value='';
    document.getElementById('kw').focus();
    document.getElementById('alert_str').innerHTML='<br><font color=red>●請輸入要搜尋的關鍵字</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<p>';
    return false;
  } else {
    document.getElementById('alert_str').innerHTML='';
    var url='http://www.youthwant.com.tw/search/srh?chn='+v_chn.value+'&kw='+s.value;
    document.Srhdata.action=url;
    window.open(url,'','');
    return false;
  }
}

