function guide_show(tag,id){
	if (id){
		document.getElementById("c_"+tag+'1').style.display='none';
		if('hot_menu_'!=tag){
			document.getElementById("c_"+tag+'2').style.display='none';
			document.getElementById("c_"+tag+'4').style.display='none';
			document.getElementById("c_"+tag+'5').style.display='none';
		}
		document.getElementById("c_"+tag+'3').style.display='none';
	
		var showid = tag+id;
		var showidd = "c_"+tag+id;		
		document.getElementById(tag+'1').className='act';
		if('hot_menu_'!=tag){
			document.getElementById(tag+'2').className='act';
			document.getElementById(tag+'4').className='act';
			document.getElementById(tag+'5').className='act';
		}
		document.getElementById(tag+'3').className='act';
		document.getElementById(showid).className='nor';
		document.getElementById(showidd).style.display='';
	}
}

function check_search_form(obj_frm) {
    var code_str = document.all[obj_frm].code_str.value;
	var type_id = document.all[obj_frm].type_id.value;
    if (code_str=="股票基金代码/拼音" || code_str=="") {
		return false;
	}
}

function jump_guba(obj_frm){	
	var code_str = document.all[obj_frm].code_str.value;
	var type_id = document.all[obj_frm].type_id.value;
    if (code_str=="代码/拼音" || code_str=="") {
    	window.open("http://guba.wolun.com.cn/");
		return false;
	}
	window.open("http://www.wolun.com.cn/search.php?url_type=2&type_id=" +type_id+ "&code_str=" + code_str);
}

function get_now_date(){
	var x= new Date(); 
	var y=x.getFullYear();// 年 
	var m=x.getMonth()+1;//月 
	var d=x.getDay();//星期 
	var ds=x.getDate();//日 
	var warr = new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
	return y+"年"+m+"月"+ds+"日 "+warr[d];
}

function set_favorite(){
	window.external.AddFavorite(window.location.href, document.title);
}

function get_cookie(varname){
	var tmp_ary = new Array();
	if (varname){
		a = document.cookie.indexOf(varname+"=");
		if (a != -1){
			b = document.cookie.substring((a+varname.length+1),document.cookie.length);
			c = b.split(";");
			d = c[0];
			return d;
		}
	}
}

function check_login(frm){
	if (document.flogin.username.value.length<1) {
		alert("用户ID不能为空");
		document.flogin.username.focus();
		return false;
	} else if (document.flogin.password.value.length<1) {
		alert("密码不能为空");
		document.flogin.password.focus();
		return false;
	}
	
	document.flogin.action = "http://guba.wolun.com.cn/logging.php?action=login&referer="+document.URL;
	return true;
}

//json ajax 处理
//ajax config 
var delay_time = 10000;

function json_index_refresh(){
	$.ajax({
 		type: "GET",
 		url: "get_data/get_indexnum.php",
 		dataType: "json" ,
 		data: "t="+Math.random(),
 		success: get_index_num
	});
}

function get_index_num(data_arr){
	var code_type1 = '&nbsp;'+data_arr['HSI'];
	var code_type2 = '&nbsp;'+data_arr['HSCEI'];
	var code_type3 = '&nbsp;'+data_arr['HSCCI'];
	//更新指数的值
	$("#code_HSI").html(code_type1);
	$("#code_HSCEI").html(code_type2);
	$("#code_HSCCI").html(code_type3);
	
}

function set_img_refresh(){
	var img_type1 = "http://image.wolun.com.cn/index_pic/HSI.gif?"+Math.random();
	var img_type2 = "http://image.wolun.com.cn/index_pic/HSCCI.gif?"+Math.random();
	var img_type3 = "http://image.wolun.com.cn/index_pic/HSCEI.gif?"+Math.random();
	var img_type4 = "http://image.wolun.com.cn/index_pic/sh000001.gif?"+Math.random();
	var img_type5 = "http://image.wolun.com.cn/index_pic/sz399001.gif?"+Math.random();
	$("#img_HSI").attr("src",img_type1);
	$("#img_HSCEI").attr("src",img_type3);
	$("#img_HSCCI").attr("src",img_type2);
	$("#img_HSSH").attr("src",img_type4);
	$("#img_HSSZ").attr("src",img_type5);
}

function get_index_num(){
	$.ajax({
 		type: "GET",
 		url: "/get_data/get_a_index.php",
 		dataType: "json" ,
 		data:   "rand="+Math.random(),
 		success: set_index_num
	});
}

function set_index_num(data_arr){
	$("#HSSH1").html("&nbsp;"+data_arr['sh000001']);
	$("#HSSZ1").html("&nbsp;"+data_arr['sz399001']);
 	$("#HSSS1").html("&nbsp;"+data_arr['sh000300']);
 	$("#HSSH2").html("&nbsp;"+data_arr['sh000001']);
	$("#HSSZ2").html("&nbsp;"+data_arr['sz399001']);
 	$("#HSSS2").html("&nbsp;"+data_arr['sh000300']);
}

function nxz_search(){
  var obj = document.forms["nxz_frm"];
  for(i=0;i<3;i++){
    if(obj.key_id[i].checked){
      var index_v = obj.key_id[i].value;
      eval("obj.keyword.value = obj.key_w"+index_v+".value");
      break;
    }
  }
  obj.submit();
}
