document.write("<div id=\"search\" align=\"center\">");
document.write("<form id=\"form1\" name=\"form1\" method=\"get\"  onsubmit=\"search();return false;\" action=\"\/search.php\">");
document.write("  <div id=\"intput1\">");
document.write("    <input type=\"text\" name=\"w\" id=\"w\" value=\"\"\/>");
document.write("  <\/div>");
document.write("  <div id=\"submit1\" ><input name=\"\" type=\"image\" src=\"\/images\/arr.gif\" alt=\"Search Online Dictionary\" align=\"middle\" \/><\/div>");
document.write("  <div style=\"clear:both\"><\/div>");
document.write("  <div id=\"b\">");
document.write("  <label>الرجاء اختيار القاموس:");
document.write("    <select name=\"d\" id=\"d\">");
document.write("<option value=\"517\">English - Arabic<\/option>");
document.write("	  <\/select>");
document.write("    <\/label>  ");
document.write("  <\/div>");
document.write("<\/form><\/div>");
var l_url;
//切开路径斜杆
l_url=location.pathname.split("/");

if (l_url.length >= 4)// 表示是带子词典/love/1/这样目录，
{
	document.getElementById("w").value = decodeURIComponent(l_url[1]);
	var sel = document.getElementById("d");
	for ( var i = 0; i < sel.length; i++) {//循环读取options值
		sel.options[i].selected = false;
		if (sel.options[i].value==l_url[2]) {//修改自动选择当前查找的词典表
			sel.options[i].selected = true;
			break;//跳出循环
		}
	}   
}
else if(l_url.length>=3)//表示是/love/或//dict_1/这样目录，
{
	if(l_url[1].toLowerCase().indexOf("dict_")>=0)//判断是不是列表目录
	{
		var l_url1;
		l_url1=l_url[1].toLowerCase().split("_");
		
		var sel1 = document.getElementById("d");
		for ( var i = 0; i < sel1.length; i++) {//循环读取options值
			sel1.options[i].selected = false;
			if (sel1.options[i].value==l_url1[1]) {//修改自动选择当前查找的词典表
				sel1.options[i].selected = true;
				break;//跳出循环
		}
	} 
	}else{//下面才是真正的词典目录
		document.getElementById("w").value=decodeURIComponent(l_url[1]);
	}
}
document.getElementById("w").focus();