//*********************************************************************************************************************************
//头部搜索
	var suggestStock_0;
	var suggestFund_0;
	function setText(){	
		document.getElementById("suggestInput_0").value="新闻内容";
	}
	function setRedio(sel){
		 if(sel=="2"){
			suggestStock_0 = new Suggest("suggestInput_0", "代码/名称/拼音", stock_suggest, null, StockSuggestConfiguration, toSearch);
			suggestStock_0.options[12] = false;
		}else if(sel=="3"){
		  	suggestFund_0 = new Suggest("suggestInput_0", "代码/名称/拼音", fund_suggest, null, FundSuggestConfiguration, toSearch);
			suggestFund_0.options[12] = false;
		}else if(sel=="4"){
		    suggestStock_0 = new Suggest("suggestInput_0", "代码/名称/拼音", stock_suggest, null, StockSuggestConfiguration, toSearch);
		    suggestStock_0.options[12] = false; 
		}	
	}	

	function toSearch(){
			var searchType1 = document.getElementById("searchtype1");
			var searchType2 = document.getElementById("searchtype2");
			var searchType3 = document.getElementById("searchtype3");
			var searchType4 = document.getElementById("searchtype4");
			var value2=document.getElementById('suggestInput_0').value;
			var sc="sh"
			if(value2.substring(0,1)=='0' || value2.substring(0,1)=='2' ||value2.substring(0,1)=='3'){
				sc="sz";
			}			
			if(searchType1.checked){
				
				//var myform=document.getElementById("newssearchform");
				//myform.keyword.value=value2;
				//myform.submit();	
				
				var searchURL="http://newsearch.stcn.com/fly/search.jsp?searchText="+value2;
				searchURL=encodeURI(searchURL)
				window.open(searchURL);
			}else {
				if (value2 != "代码/名称/拼音" && value2 != "") {
					//var stringUrl = "http://www2.secutimes.com/static/final/@COUNTRY@/@CODE@/";
					if(searchType2.checked){
						var stringUrl = "http://stock.stcn.com/"+sc+"/@CODE@/";
						window.open(stringUrl.replace("@CODE@", value2));
					}else if(searchType3.checked){
						var stringUrl = "http://fund.stcn.com/final/@CODE@/";
						window.open(stringUrl.replace("@CODE@", value2));
					}else if(searchType4.checked){
					    var stringUrl="http://guba.stcn.com/guba,@CODE@.html";
						window.open(stringUrl.replace("@CODE@",value2));
					}
		  		}
			}	
	}

	function changeViewInputs(key, index) {
		var searchType2 = document.getElementById("searchtype2");
	    var searchType3 = document.getElementById("searchtype3");
		if(searchType2.checked){					
				suggestStock_0 = new Suggest("suggestInput_0", "代码/名称/拼音", stock_suggest, null, StockSuggestConfiguration, toSearch);
				suggestStock_0.options[12] = false;
		}
		if(searchType3.checked){	
				suggestFund_0 = new Suggest("suggestInput_0", "代码/名称/拼音", fund_suggest, null, FundSuggestConfiguration, toSearch);
				suggestFund_0.options[12] = false;
		}
	}
	function gotoLookupN_0() {
		var value = document.getElementById('suggestInput_0').value;
		var searchType2 = document.getElementById("searchtype2");
	    var searchType3 = document.getElementById("searchtype3");
		if (value != "代码/名称/拼音" && value != "") {
			var stringUrl = "http://www2.stcn.com/static/final/@COUNTRY@/@CODE@/";
				if(searchType2.checked){
					window.open(stringUrl.replace("@CODE@", value).replace("@COUNTRY@", "stock"));
				}else if(searchType3.checked){
					window.open(stringUrl.replace("@CODE@", value).replace("@COUNTRY@", "fund"));
				}
		}
	}
//****************************************************************************************************************************
//头
function getChinnalName()
{
	var url;
	try{
	 	url =document.location.href;
	 }catch(e){
		return "blanklogo1.png";
	 }
	if(url.indexOf("/stock") != -1){//票
	 	return "stocklogo.png";
	 }else {
	 	return "blanklogo2.png";
	 }
}

function getListAndFinalPageTop()
{
	//样式
	var picname
	document.writeln("<style type='text/css'>");
	document.writeln(".top_zz_head { position:relative; width:1000px; height:90px; margin:0 auto; background:url(/common/images/head_bg.png) no-repeat;}");
	document.writeln(".top_zz_head .top_innerwrap { width:980px; margin:0 auto;}");	
	document.writeln(".top_topnav { height:27px; background:url(/common/images/nav_bg.png) repeat-x;}");
	document.writeln(".top_topnav li { float:left; margin-left:18px; padding-top:6px; display:inline;}");	
	document.writeln(".top_topnav li.top_first { margin-left:10px;}");	
	document.writeln(".top_topnav li a { color:#fff;}");	
	document.writeln(".top_zz_logo { float:left; width:130px; height:37px; margin:10px; text-indent:-9999px; background:url(/common/images/logo.png) no-repeat;}");	
	document.writeln(".top_zz_sublogo { float:left; width:54px; height:30px; margin-top:20px; text-indent:-9999px; background:url(/common/images/"+getChinnalName()+") no-repeat;}");		
	document.writeln(".top_zz_search .top_search_btn { position:relative; left:3px; vertical-align:middle;}");	
	document.writeln(".top_innerwrap iframe { float:right; margin:35px 10px 0 0; display:inline;}");
	document.writeln(".top_zz_search label { margin-right:10px;}")
	document.writeln(".top_zz_search .top_text { width:180px; height:17px;}")
	document.writeln(".top_zz_search { margin-bottom:8px;}")
	document.writeln(".top_zz_search,.top_zz_search * { vertical-align:middle;}")	
	document.writeln("#searchtype1,#searchtype2,#searchtype3,#searchtype4 { width:13px;}")
	document.writeln("</style>");
	//内容
	document.writeln("<div class='top_zz_search'>");
	document.writeln("<label><input type='radio' name='searchtype' id='searchtype1' value='1' style='margin-left:0px;' checked='checked' onclick='setText();' />&nbsp;新闻</label>");
	document.writeln("<label><input type='radio' name='searchtype' id='searchtype2' value='2'  onclick=\"setRedio('2');\" />&nbsp;股票</label>");
	document.writeln("<label><input type='radio' name='searchtype' id='searchtype3' value='3'  onclick=\"setRedio('3');\" />&nbsp;基金</label>");
	document.writeln("<label><input type='radio' name='searchtype' id='searchtype4' value='4'  onclick=\"setRedio('4');\" />&nbsp;股吧</label>");
	document.writeln("<input type='text' class='top_text' id='suggestInput_0' onKeyDown='javascript:if(event.keyCode==13){toSearch();}' onclick=\"if(this.value=='新闻内容')this.value=''\" value='新闻内容' />");
	document.writeln("<img type='image' class='top_search_btn' id='suggestMain_input_submit_0' onclick='toSearch();' src='/common/images/btn.gif' />");
	document.writeln("</div>");
	
	//document.writeln("<div style='display: none;'>");
	//document.writeln("<form id='newssearchform' name='newssearchform' method='get' target='_blank' action='http://www2.stcn.com/searchaction.do'>  <input id='method' name='method' type='hidden' value='getNewsSearchInfo' > <input id='encoding' name='encoding' type='hidden' value='utf-8' > <input id='keyword' name='keyword' type='hidden' value='' ></form>");
	//document.writeln("</div>");
}
