function doOutputPhone(s)
{
	for(var i = 0; i < s.length; i++)
	{
		document.write('<img border=0 height=12 align=absmiddle src="phone/' + s.charCodeAt(i) + '.gif">');
	}
}

function fix_string(s)
{
	s = s.replace(/\|/ig, "<br>");
	s = s.replace(/%22/ig, "\"");
	s = s.replace(/%27/ig, "'");
	s = s.replace(/%5c/ig, "\\");
	return s;
}

function doOutputChinese(s)
{
	s=fix_string(s);
	document.write(s);
}

function show(what)
{
	for(var i=1; i<6; i++)
	{
		if( what==i )
		{
			document.all('word_table'+i).style.display='block';
			document.all('td'+i).style.backgroundColor="#0033cc";
			document.all('lnk'+i).style.color='white';
		}
		else
		{
			document.all('word_table'+i).style.display='none';
			document.all('td'+i).style.backgroundColor="powderblue";
			document.all('lnk'+i).style.color='black';
		}
	}
	
}

function doSearch(t)
{
	w = document.MainForm.Word.value.replace(/^\s+/, "").replace(/\s+$/, "");
	if( w=='' )
		search.location = "first.htm";
	else
	{
		if( t==1 )
			search.location = "http://study.hongen.com/dict/ndsearch.aspx?word=" + escape(w);
		else
			search.location = "http://study.hongen.com/dict/ndsearchchengyu.aspx?type=exact&word=" + escape(w);
	}		
	document.MainForm.Word.focus();
	return false;
}

function cutString( str, len )
{
	var str1 = str;
	if( str1.length>len )
	{
		str1 = str1.substring(0,len-1)+"...";
	}
	return str1;
}

function setFocus()
{
	if(parent.document.MainForm) { setTimeout("parent.document.MainForm.Word.focus();",200); }
}

function searchCY(w)
{
	if(w!="")
		document.write("<a href=http://study.hongen.com/dict/ndsearchchengyu.aspx?type=exact&amp;word="+escape(w)+" title='" + w + "'>"+cutString(w,9)+"</a>");
}

function adv_show(gURL,nID,sALT,w,h)
{
	if( nID == -1 ) return "";
//gURL:图或flsh地址或文字，nID广告id, sALT注释, w宽, h高
	try{
		var strTmp="";
		if( gURL.substring(gURL.length-3) == "swf" ){
			strTmp += "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' WIDTH=" + w + " HEIGHT=" + h + ">";
			strTmp += "<PARAM NAME=movie VALUE='"+gURL+"'>";
			strTmp += "<PARAM NAME=quality VALUE=high>";
			strTmp += "<PARAM NAME=wmode VALUE=transparent>";
			strTmp += "<PARAM NAME=bgcolor VALUE=#FFFFFF>";
			strTmp += "</OBJECT>";
		}else if(gURL.substring(gURL.length-3)=="txt"){
			strTmp += "<a href=http://ad.hongen.com/link.pl?id="+nID+" target=_blank>" + sALT + "</a>";
		}else{
			strTmp += "<a href=http://ad.hongen.com/link.pl?id="+nID+" target=_blank>";
			strTmp += "<img src='"+gURL+"' border=0 alt='" + sALT +"' width=" + w + " HEIGHT=" + h + " border=0></a>";
		}
		return strTmp;
	}catch(e){
		return "";	
	}
}
	
