﻿/**
* @author RayLeo
*/
//member const

var bankSearchModel = "from-";//所有理财产品
var bankSearchModel_RMB = "from-companyid-key-wtglq-rgqsje-yqnsyl-rgjsr-tzlx-qdzs-bz-cplx-tzfw-ggdx-jjsj-jjsjd-";
var bankSearchModel_WB = "from-companyid-key-wtglq-bz-yqnsyl-rgjsr-tzlx-";
var bankSearchModel_Card = "from-companyid-key-zl-jb-nf-";
var bankSearchModel_Dk = "from-companyid-key-dkzl-dkqx-";
var insSearchModel_CC = "from-companyid-key-xzlx-bzqx-";
var insSearchModel_RS = "from-companyid-key-lx-minTbnl-maxTbnl-jffs-bzjb-";
var fundSearchModel = "from-companyid-key-jjlx-tzlx-jjgm-jjsj-jjsjd-qdzs-";
var videoSearchModel = "from-type-key-proid-order-";
var professionalSearchModel = "from-province-key-type-";
var newsSearchModel = "from-type-key-ntype-classid-proid-";
var personalprojectSearchModel = "from-type-ppsr-ppzc-ppmb-order-";

var YpSearchCompanyModel = "key-topic-quality-inbeing-letter";

var insRS = new Array("请选择类型","大病险","住院险","意外险","养老险","分红险","少儿险","女性险","定期险","终身险","两全险","万能险");
var insRS1 = new Array("","%e5%a4%a7%e7%97%85%e9%99%a9","%e4%bd%8f%e9%99%a2%e9%99%a9","%e6%84%8f%e5%a4%96%e9%99%a9","%e5%85%bb%e8%80%81%e9%99%a9","%e5%88%86%e7%ba%a2%e9%99%a9","%e5%b0%91%e5%84%bf%e9%99%a9","%e5%a5%b3%e6%80%a7%e9%99%a9","%e5%ae%9a%e6%9c%9f%e9%99%a9","%e7%bb%88%e8%ba%ab%e9%99%a9","%e4%b8%a4%e5%85%a8%e9%99%a9","%e4%b8%87%e8%83%bd%e9%99%a9");

var insCC = new Array("请选择类型","家庭财产险","企业财产险","机动车辆险","建筑工程险","货物运输险","责任险","意外险","船舶保险");
var insCC1 = new Array("","%e5%ae%b6%e5%ba%ad%e8%b4%a2%e4%ba%a7%e9%99%a9","%e4%bc%81%e4%b8%9a%e8%b4%a2%e4%ba%a7%e9%99%a9","%e6%9c%ba%e5%8a%a8%e8%bd%a6%e8%be%86%e9%99%a9","%e5%bb%ba%e7%ad%91%e5%b7%a5%e7%a8%8b%e9%99%a9","%e8%b4%a7%e7%89%a9%e8%bf%90%e8%be%93%e9%99%a9","%e8%b4%a3%e4%bb%bb%e9%99%a9","%e6%84%8f%e5%a4%96%e9%99%a9","%e8%88%b9%e8%88%b6%e4%bf%9d%e9%99%a9");

var bankRMB = new Array("预期年收益率","3%以下","3%--5%","5%--8%","8%以上");
var bankRMB1 = new Array("0","1","2","3","4");

var bankWB = new Array("预期年收益率","3%以下","3%--6%","6%--10%","10%以上");
var bankWB1 = new Array("0","1","2","3","4");

var bankCard = new Array("银行卡种类","贷记卡","借记卡","准贷记卡");
var bankCard1 = new Array("","%e8%b4%b7%e8%ae%b0%e5%8d%a1","%e5%80%9f%e8%ae%b0%e5%8d%a1","%e5%87%86%e8%b4%b7%e8%ae%b0%e5%8d%a1");

var bankDK = new Array("贷款种类","住房贷款","自助贷款","个人质押贷款","个人存单","凭证质押贷款","组合贷款","个人小额短期信用贷款","保证贷款","个人消费贷款","个人耐用消费品贷款","个人旅游度假贷款","汽车贷款","教育贷款");
var bankDK1 = new Array("","%e4%bd%8f%e6%88%bf%e8%b4%b7%e6%ac%be","%e8%87%aa%e5%8a%a9%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e8%b4%a8%e6%8a%bc%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e5%ad%98%e5%8d%95","%e5%87%ad%e8%af%81%e8%b4%a8%e6%8a%bc%e8%b4%b7%e6%ac%be","%e7%bb%84%e5%90%88%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e5%b0%8f%e9%a2%9d%e7%9f%ad%e6%9c%9f%e4%bf%a1%e7%94%a8%e8%b4%b7%e6%ac%be","%e4%bf%9d%e8%af%81%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e6%b6%88%e8%b4%b9%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e8%80%90%e7%94%a8%e6%b6%88%e8%b4%b9%e5%93%81%e8%b4%b7%e6%ac%be","%e4%b8%aa%e4%ba%ba%e6%97%85%e6%b8%b8%e5%ba%a6%e5%81%87%e8%b4%b7%e6%ac%be","%e6%b1%bd%e8%bd%a6%e8%b4%b7%e6%ac%be","%e6%95%99%e8%82%b2%e8%b4%b7%e6%ac%be");

var companySmallType_Bank= new Array("内资","外资");
var companySmallType_Bank_Value= new Array("1","2");

var companySmallType_House= new Array("内资","外资");
var companySmallType_House_Value= new Array("1","2");

var companySmallType_Ins= new Array("寿险","财险");
var companySmallType_Ins_Value= new Array("1","2");

var companySmallType_Fund= new Array("中资","合资");
var companySmallType_Fund_Value= new Array("1","2");

var companySmallType_Stock= new Array("中资","合资");
var companySmallType_Stock_Value= new Array("1","2");

var companySmallType_Other= new Array("中资","合资","外资");
var companySmallType_Other_Value= new Array("1","2","3");

var LocationSearchArgs=null; //save url args
var ArgClass=null; //current url arg class object
//*******************************************************************
//search arg class
//rmb wb
//人民币理财搜索类
function BankProductArg_RMB(searchArgs)
{	
	this.From="";
	this.BankId="";
	this.Key="";
	this.Wtglq="";
	this.Rgqsje="";
	this.Yqnsyl="";
	this.Rgjsr="";
	this.Tzlx="";
	this.Qdzs="0";
	this.Bz="";
	this.Cplx="0";
	this.Tzfw="";
	this.Ggdx="";
	this.Jjsj="0";
	this.Jjsjd="0";
	if(searchArgs!=null)
	{
		this.From=searchArgs[0];
		this.BankId=searchArgs[1];
		this.Key=searchArgs[2];
		this.Wtglq=searchArgs[3];
		this.Rgqsje=searchArgs[4];
		this.Yqnsyl=searchArgs[5];
		this.Rgjsr=searchArgs[6];
		this.Tzlx=searchArgs[7];
		this.Qdzs=searchArgs[8];
		this.Bz=searchArgs[9];
		this.Cplx=searchArgs[10];
		this.Tzfw=searchArgs[11];
		this.Ggdx=searchArgs[12];
		this.Jjsj=searchArgs[13];
		this.Jjsjd=searchArgs[14];
	}
	this.GetSearch = function()
	{
		var result = bankSearchModel_RMB.replace("from",this.From);
		result = result.replace("companyid",this.BankId);
		result = result.replace("key",this.Key);
		result = result.replace("wtglq",this.Wtglq);
		result = result.replace("rgqsje",this.Rgqsje);
		result = result.replace("yqnsyl",this.Yqnsyl);
		result = result.replace("rgjsr",this.Rgjsr);
		result = result.replace("tzlx",this.Tzlx);
		result = result.replace("qdzs",this.Qdzs);
		result = result.replace("bz",this.Bz);
		result = result.replace("cplx",this.Cplx);
		result = result.replace("tzfw",this.Tzfw);
		result = result.replace("ggdx",this.Ggdx);
		result = result.replace("jjsj",this.Jjsj);
		result = result.replace("jjsjd",this.Jjsjd);
		return result;
	}
}


//所有理财搜索类
function BankProductArg(searchArgs)
{	
	this.From="";
	
	if(searchArgs!=null)
	{
		this.From=searchArgs[0];
	}
	this.GetSearch = function()
	{
		var result = bankSearchModel.replace("from",this.From);
	}
}
//外币理财搜索类
function BankProductArg_WB(searchArgs)
{
	this.From="";
	this.BankId="";
	this.Key="";
	this.Wtglq="";
	this.Bz="";
	this.Yqnsyl="";
	this.Rgjsr="";
	this.Tzlx="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.BankId = searchArgs[1];
		this.Key = searchArgs[2];
		this.Wtglq = searchArgs[3];
		this.Bz = searchArgs[4];
		this.Yqnsyl = searchArgs[5];
		this.Rgjsr = searchArgs[6];
		this.Tzlx = searchArgs[7];
	}
	this.GetSearch = function()
	{
		var result = bankSearchModel_WB.replace("from",this.From);
		result = result.replace("companyid",this.BankId);
		result = result.replace("key",this.Key);
		result = result.replace("wtglq",this.Wtglq);
		result = result.replace("bz",this.Bz);
		result = result.replace("yqnsyl",this.Yqnsyl);
		result = result.replace("rgjsr",this.Rgjsr);
		result = result.replace("tzlx",this.Tzlx);
		return result;
	}
}
//银行卡搜索类
function BankCardArg(searchArgs)
{
	this.From="";	
	this.BankId="";
	this.Key="";
	this.Zl="";
	this.Jb="";
	this.Nf="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.BankId = searchArgs[1];
		this.Key = searchArgs[2];
		this.Zl = searchArgs[3];
		this.Jb = searchArgs[4];
	}
	this.GetSearch = function()
	{
		var result = bankSearchModel_Card.replace("from",this.From);
		result = result.replace("companyid",this.BankId);
		result = result.replace("key",this.Key);
		result = result.replace("zl",this.Zl);
		result = result.replace("jb",this.Jb);
		result = result.replace("nf",this.Nf);
		return result;
	}
}
//信贷产品搜索类
function BankDkArg(searchArgs)
{
	this.From="";	
	this.BankId="";
	this.Key="";
	this.Dkzl="";
	this.Dkqx="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.BankId = searchArgs[1];			
		this.Key = searchArgs[2];
		this.Dkzl = searchArgs[3];
		this.Dkqx = searchArgs[4];
	}
	this.GetSearch = function()
	{
		var result = bankSearchModel_Dk.replace("from",this.From);
		result = result.replace("companyid",this.BankId);
		result = result.replace("key",this.Key);
		result = result.replace("dkzl",this.Dkzl);
		result = result.replace("dkqx",this.Dkqx);
		return result;
	}
}
//基金产品搜索类
function FundProductArg(searchArgs)
{
	this.From="";	
	this.Jjglr="";
	this.Key="";
	this.Jjlx="";
	this.Tzlx="";
	this.Jjgm="";
	this.Jjsj="";
	this.Jjsjds="";
	this.Qdzs="";
	
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.Jjglr = searchArgs[1];
		this.Key = searchArgs[2];
		this.Jjlx = searchArgs[3];
		this.Tzlx = searchArgs[4];
		this.Jjgm = searchArgs[5];
		this.Jjsj=searchArgs[6];
		this.Jjsjds=searchArgs[7];
		this.Qdzs=searchArgs[8];
	}
	this.GetSearch = function()
	{
		var result = fundSearchModel.replace("from",this.From);
		result = result.replace("companyid",this.Jjglr);
		result = result.replace("key",this.Key);
		result = result.replace("jjlx",this.Jjlx);
		result = result.replace("tzlx",this.Tzlx);
		result = result.replace("jjgm",this.Jjgm);
		result = result.replace("jjsj",this.Jjsj);
		result = result.replace("jjsjd",this.Jjsjd);
		result = result.replace("qdzs",this.Qdzs);
		
		return result;
	}
}
//财产保险搜索类
function InsProductCC(searchArgs)
{
	this.From="";	
	this.CompanyId="";
	this.Key="";
	this.Xzlx="";
	this.Bzqx="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.CompanyId = searchArgs[1];
		this.Key = searchArgs[2];
		this.Xzlx = searchArgs[3];
		this.Bzqs = searchArgs[4];		
	}
	this.GetSearch = function()
	{
		var result = insSearchModel_CC.replace("from",this.From);
		result = result.replace("companyid",this.CompanyId);
		result = result.replace("key",this.Key);
		result = result.replace("xzlx",this.Xzlx);
		result = result.replace("bzqx",this.Bzqx);
		return result;
	}
}
//人寿保险搜索类
function InsProductRS(searchArgs)
{
	this.From="";	
	this.CompanyId="";
	this.Key="";
	this.Lx="";
	this.MinTbnl="";
	this.MaxTbnl="";
	this.Jffs="";
	this.Bzjb="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.CompanyId = searchArgs[1];
		this.Key = searchArgs[2];
		this.Lx = searchArgs[3];
		this.MinTbnl = searchArgs[4];
		this.MaxTbnl = searchArgs[5];
		this.Jffs = searchArgs[6];
		this.Bzjb = searchArgs[7];
	}
	this.GetSearch = function()
	{
		var result = insSearchModel_RS.replace("from",this.From);
		result = result.replace("companyid",this.CompanyId);
		result = result.replace("key",this.Key);
		result = result.replace("lx",this.Lx);
		result = result.replace("minTbnl",this.MinTbnl);
		result = result.replace("maxTbnl",this.MaxTbnl);
		result = result.replace("jffs",this.Jffs);
		result = result.replace("bzjb",this.Bzjb);
		return result;
	}
}

//视频搜索类
function VideoArg(searchArgs)
{
	this.From="";	
	this.Type="";
	this.Key="";
	this.ProId="";
	this.Order="";	
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.Type = searchArgs[1];
		this.Key = searchArgs[2];
		this.ProId = searchArgs[3];
		this.Order = searchArgs[4];
	}
	this.GetSearch = function()
	{
		var result = videoSearchModel.replace("from",this.From);
		result = result.replace("type",this.Type);
		result = result.replace("key",this.Key);
		result = result.replace("proid",this.ProId);
		result = result.replace("order",this.Order);		
		return result;
	}
}
//专家搜索类
function ProfessionalArg(searchArgs)
{
	this.From="";	
	this.Province="";
	this.Key="";
	this.Type="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.Province = searchArgs[1];
		this.Key = searchArgs[2];
		this.Type = searchArgs[3];
	}
	this.GetSearch = function()
	{
		var result = professionalSearchModel.replace("from",this.From);
		result = result.replace("province",this.Province);
		result = result.replace("key",this.Key);
		result = result.replace("type",this.Type);
		return result;
	}
}
//新闻搜索类
function NewsArg(searchArgs)
{
	this.From="";	
	this.Type="";
	this.Key="";
	this.Ntype="";
	this.ClassId="";
	this.ProId="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.Type = searchArgs[1];
		this.Key = searchArgs[2];
		this.Ntype = searchArgs[3];
		this.ClassId = searchArgs[4];
		this.ProId= searchArgs[5];
	}
	this.GetSearch = function()
	{
		var result = newsSearchModel.replace("from",this.From);
		result = result.replace("type",this.Type);
		result = result.replace("key",this.Key);
		result = result.replace("ntype",this.Ntype);
		result = result.replace("classid",this.ClassId);
		result = result.replace("proid",this.ProId);
		return result;
	}
}
//理财按理搜索类
function PersonalProjectArg(searchArgs)
{
	this.From="";
	this.Type="";
	this.Ppsr="";
	this.Ppzc="";
	this.Ppmb="";
	this.Order="";
	if(searchArgs!=null)
	{
		this.From = searchArgs[0];
		this.Type = searchArgs[1];
		this.Ppsr = searchArgs[2];
		this.Ppzc = searchArgs[3];
		this.Ppmb = searchArgs[4];
		this.Order = searchArgs[5];
	}
	this.GetSearch = function()
	{
		var result = personalprojectSearchModel.replace("from",this.From);
		result = result.replace("type",this.Type);
		result = result.replace("ppsr",this.Ppsr);
		result = result.replace("ppzc",this.Ppzc);
		result = result.replace("ppmb",this.Ppmb);
		result = result.replace("order",this.Order);
		return result;
	}
}

//search arg class end
//******************************
//Header Market Start
function clearOptions(ddl)
{
	var length = ddl.options.length;
	for(var i=0;i<length;i++)
	{

		ddl.options[0]=null;
	}
}

function insChange(ddl)
{
	var opts;
	var opts1;
	
	if(ddl.value=="7")//rs
	{
		opts = insRS;
		opts1 = insRS1;
	}
	else
	{
		opts = insCC;
		opts1 = insRS1;
	}
	clearOptions(document.getElementById("insDDL"));
	for(var i=0;i<opts.length;i++)
	{
		var opt = document.createElement("option");
		opt.value=opts1[i];
		opt.text =opts[i];
		document.getElementById("insDDL").options[i]=opt;
	}
}

function bankChange(ddl)
{
	var index = ddl.selectedIndex;
	var opts;
	var opts1;
	if(index==0)
	{
		opts = bankRMB;
		opts1 = bankRMB1;
	}
	else if(index==1)
	{
		opts = bankWB;
		opts1 = bankWB1;
	}
	else if(index==2)
	{
		opts = bankCard;
		opts1 = bankCard1;
	}
	else if(index==3)
	{
		opts = bankDK;
		opts1 = bankDK1;
	}

	clearOptions(document.getElementById("bankDDL"));

	for(var i=0;i<opts.length;i++)
	{
		var opt = document.createElement("option");
		opt.value=opts1[i];
		opt.text =opts[i];
		document.getElementById("bankDDL").options[i]=opt;
	}

}

function searchDivShow(topic)
{
	document.getElementById("bankMenu").className = "sbn_off";
	document.getElementById("insMenu").className = "sbn_off";
	document.getElementById("fundMenu").className = "sbn_off";
	
	document.getElementById(topic + "Menu").className = "sbn_on";
	
	
	document.getElementById("bankSearch").style.display="none";
	document.getElementById("insSearch").style.display="none";
	document.getElementById("fundSearch").style.display="none";
	
	document.getElementById(topic+"Search").style.display="block";
}

function goSearch(topic)
{
	var search ="";
	if(topic=="bank")
	{
		
		//获得该搜索层的所有子控件
		var childs = document.getElementById("bankSearch").childNodes;
		//从控件中取值		
		var companyId = childs[0].value;
		var key = encodeURI(childs[2].value);
		var bankProductFrom ="";
		//或许要查询哪个表
		bankProductFrom= childs[4].value;
		
		var productType = "";
		
		if(childs[6].selectedIndex>0)
			productType= childs[6].value;
		var argObject;
		//根据产品表的不同选择不同的参数样式		
		if(bankProductFrom==1)
		{
			argObject = new BankProductArg_RMB();
			argObject.From = bankProductFrom;
			argObject.BankId = companyId;
			argObject.Key = key;
			argObject.Yqnsyl = productType;
			search = argObject.GetSearch();
		}
		else if(bankProductFrom==2)
		{
			argObject = new BankProductArg_WB();
			argObject.From = bankProductFrom;
			argObject.BankId = companyId;
			argObject.Key = key;
			argObject.Yqnsyl = productType;
			search = argObject.GetSearch();
		}
		else if(bankProductFrom==3)
		{
			argObject = new BankCardArg();
			argObject.From = bankProductFrom;
			argObject.BankId = companyId;
			argObject.Key = key;
			argObject.Zl = productType;
			search = argObject.GetSearch();
		}
		else if(bankProductFrom==9)
		{
			argObject = new BankDkArg();
			argObject.From = bankProductFrom;
			argObject.BankId = companyId;
			argObject.Key = key;
			argObject.Dkzl = productType;
			search = argObject.GetSearch();
		}
	}
	else if(topic=="ins")
	{
		
		var childs = document.getElementById("insSearch").childNodes;
		
		var companyId = childs[0].value;
		var key = encodeURI(childs[2].value);
		var productFrom ="";
		//或许要查询哪个表
		productFrom= childs[4].value;
	
		var type = "";
		if(childs[6].selectedIndex>0)
			type= childs[6].value; 

		if(productFrom=="7")//rs
		{	
		
			argObject = new InsProductRS();
			argObject.From = productFrom;
			argObject.CompanyId = companyId;
			argObject.Key = key;
			argObject.Lx = type;
			search = argObject.GetSearch();
		}
		else //cc
		{	
			key = encodeURI(childs[6].value);
			argObject = new InsProductCC();
			argObject.From = productFrom;
			argObject.CompanyId = companyId;
			argObject.Key = key;
			argObject.Xzlx = type;
			search = argObject.GetSearch();
		}
	}
	else if(topic=="fund")
	{
		
		var childs = document.getElementById("fundSearch").childNodes;
		var companyId="";
		if(childs[0].value!="0")
			companyId = childs[0].value;
	
		var jjlx ="";

		jjlx= childs[4].value;
		
		var tzlx = "";
		if(childs[6].selectedIndex>0)
			tzlx = childs[6].value;

		argObject = new FundProductArg();
		argObject.From = "5";
		argObject.Jjglr = companyId;
		argObject.Key = key;
		argObject.Jjlx = jjlx;
		argObject.Tzlx = tzlx;
		search = argObject.GetSearch();
	}
		window.location.target="_blank";
	window.location.href="/market/list.aspx?"+search;
}

function defaultSearch(but,topic)
{
	var search="";
	var argObject;
	if(topic=="fund")
	{
		//var key = encodeURI(but.parentElement.childNodes[0].value);		
		var key = encodeURI(document.getElementById("inputjjdm").value);

		argObject = new FundProductArg();
		argObject.From = "5";
		argObject.Key = key;//关键字		
		var tzlx;		
		tzlx= document.getElementById(fund2).value;
		
		argObject.Jjlx = "0";	
		argObject.Tzlx = tzlx;//投资类型
		argObject.Jjglr = document.getElementById(fund4).value;//公司
		argObject.Jjgm = document.getElementById(fund3).value;//规模
		argObject.Jjsj="0";
		argObject.Jjsjd="1";//时间顺序
		argObject.Qdzs = document.getElementById(fund1).value;//星际		
		search = argObject.GetSearch();
	}
	else if (topic=="ins")
	{
		var companyId ="";
		if(document.getElementById(InsCompanyDdlId).value!="0")
			companyId = document.getElementById(InsCompanyDdlId).value;
		var from =  7;//document.getElementById("InsFrom").value;
		
		if(from=="7")//rs
		{
			argObject = new InsProductRS();
			argObject.From = from;
			argObject.CompanyId = companyId;
			var xzlx;
			if(document.getElementById("instype1").value!="0")
			{
				try
				{
					xzlx=encodeURI(document.getElementById("instype1").options[document.getElementById("instype1").selectedIndex].value);
				}
				catch(e)
				{}
				argObject.Lx=xzlx;
			}
			var tbnl = document.getElementById(InsTbnlDDL).value;
			
			if(tbnl=="0")
			{
			argObject.MinTbnl =  "0";
			argObject.MaxTbnl =  "0";
		    }
		    else
		    {
			argObject.MinTbnl = tbnl.split('～')[0];
		    argObject.MaxTbnl = tbnl.split('～')[1];
		    }			
			//argObject.Key=document.getElementById("inskey").value;
			search = argObject.GetSearch();
		}
		else //cc 6
		{
			argObject = new InsProductCC();
			argObject.From = from;
			argObject.CompanyId = companyId;
			var xzlx="";
			if(document.getElementById(instype2).value!="0")
			{
				try
				{
					xzlx=encodeURI(document.getElementById(instype2).options[document.getElementById(instype2).selectedIndex].value);
					argObject.Xzlx=xzlx;
				}
				catch(e)
				{
					
				}
				
				
			}
			argObject.Key=document.getElementById("inskey").value;
			search = argObject.GetSearch();
		}
		
	}
	else if(topic=="bankProduct")
	{
		var from = "1";//document.getElementById("BankFrom").value;
		
		var yqnsyl = document.getElementById(bankArg1).value;
		var tzqx = document.getElementById(bankArg2).value;
		var cplx = document.getElementById(bankArg3).value;
		var companyid = document.getElementById(bankArg4).value;
		var bz = document.getElementById(bankArg5).value;
				
		if(from=="1")
			argObject = new BankProductArg_RMB();
		else		
			argObject = new BankProductArg_WB();
			
		//if(argObject.BankId!=0&&argObject.Yqnsyl==0&&argObject.Wtglq==""&&argObject.Cplx==0&&argObject.Bz=="")
		if(companyid!="0"&&yqnsyl=="0"&&tzqx=="0"&&cplx=="0"&&bz=="")
		{
			argObject.From = 11;//from;
		}else
		{
			argObject.From = from;
		}
		argObject.Yqnsyl = yqnsyl;		
		argObject.Wtglq = tzqx;
		argObject.Cplx = cplx;
		argObject.BankId = companyid;
		argObject.Bz = bz;		
		search = argObject.GetSearch();
	}
	else if(topic=="bankCard")
	{
		// "from/companyid/key/zl///";
		var from="3";
		var companyId = document.getElementById(BankCardCompanyDdlId).value;
		var zl = document.getElementById("BankCardLx").value;
		var key = encodeURI(document.getElementById("BankCardKey").value);
		argObject = new BankCardArg();
		argObject.From = from;
		argObject.BankId = companyId;
		argObject.Key = key;
		argObject.Zl = zl;
		search = argObject.GetSearch();
	}
	window.open("/market/list.aspx?"+search);
}

function defaultSearchBankChange(ddl)
{
	var index = ddl.selectedIndex;
	var opts;
	var opts1;
	if(index==0)
	{
		opts = bankRMB;
		opts1 = bankRMB1;
	}
	else
	{
		opts = bankWB;
		opts1 = bankWB1;
	}
	for(var i=0;i<opts.length;i++)
	{
		var opt = document.createElement("option");
		opt.value=opts1[i];
		opt.text =opts[i];
		document.getElementById("defaultBankDDL").options[i]=opt;
	}
}
//********************************************************************************************
//Load Search Control State Start

function LoadSearcArgClass()
{
	var from = GetProductFrom();
	
	switch(from)
	{
		case "1":
			ArgClass = new BankProductArg_RMB(LocationSearchArgs);
			break;
		case "2":
			ArgClass = new BankProductArg_WB(LocationSearchArgs);
			break;
		case "3":
			ArgClass = new BankCardArg(LocationSearchArgs);
			break;
		case "9":
			ArgClass = new BankDkArg(LocationSearchArgs);
			break;
		case "5":
			ArgClass = new FundProductArg(LocationSearchArgs);
			break;
		case "6":
			ArgClass = new InsProductCC(LocationSearchArgs);
			break;
		case "7":
			ArgClass = new InsProductRS(LocationSearchArgs);
			break;
		case "0":
			ArgClass = new BankProductArg(LocationSearchArgs);
			break;
		default:
			ArgClass =null;
			break;
	}
}
function GetProductFrom()
{
	if(LocationSearchArgs==null)
		LoadLocationSearchArgs();
	if(LocationSearchArgs!=null&&LocationSearchArgs.length>0)
		return LocationSearchArgs[0];
}
function LoadLocationSearchArgs()
{
	LocationSearchArgs = window.location.search.replace("?","").split("-");
}

function LoadHeaderSearchControlState()
{
	LoadSearcArgClass();
	var from = GetProductFrom();
	var currentDiv;
	if(from=="1"||from=="2"||from=="3"||from=="9") //bank
	{
		searchDivShow("bank");
		currentDiv = document.getElementById("bankSearch");
		SelectDropDownListOptions(currentDiv.childNodes[0],ArgClass.BankId,false);
		currentDiv.childNodes[2].value=ArgClass.Key;
		SelectDropDownListOptions(currentDiv.childNodes[4],ArgClass.From,false);
		bankChange(currentDiv.childNodes[4]);
		if(from=="3")//bankCard
			SelectDropDownListOptions(currentDiv.childNodes[6],ArgClass.Zl,false);
		else if(from=="9")
			SelectDropDownListOptions(currentDiv.childNodes[6],ArgClass.Dkzl,false);
		else
			SelectDropDownListOptions(currentDiv.childNodes[6],ArgClass.Yqnsyl,false);
	}
	else if(from=="6"||from=="7")//ins
	{
		searchDivShow("ins");
		currentDiv = document.getElementById("insSearch");
		SelectDropDownListOptions(currentDiv.childNodes[0],ArgClass.CompanyId,false);
		currentDiv.childNodes[2].value=ArgClass.Key;
		SelectDropDownListOptions(currentDiv.childNodes[4],ArgClass.From,false);
		insChange(currentDiv.childNodes[4]);
		if(from=="6")//cc
			SelectDropDownListOptions(currentDiv.childNodes[6],ArgClass.Xzlx,false);
		else
			SelectDropDownListOptions(currentDiv.childNodes[6],ArgClass.Lx,false);
	}
	else if(from=="5")//fund
	{
		searchDivShow("fund");
		currentDiv = document.getElementById("fundSearch");
		SelectDropDownListOptions(currentDiv.childNodes[0],ArgClass.Jjglr,false);
		currentDiv.childNodes[2].value=ArgClass.Key;
		SelectDropDownListOptions(currentDiv.childNodes[4],ArgClass.Jjlx,false);
		
	}
}

//Load Search Control State End
//Header Market End
//********************************************************************************************

//Yellow Page Start


function YpSearchCompany()
{
	var topic = document.getElementById(SearchYellowPageTopicTypeDdlId).value;
	var arr;
	var arrValue;
	if(topic=="1")
	{
		arr = companySmallType_Bank;
		arrValue = companySmallType_Bank_Value
	}
	else if(topic=="2")
	{
		arr = companySmallType_House;
		arrValue = companySmallType_House_Value
	}
	else if(topic=="3")
	{
		arr = companySmallType_Ins;
		arrValue = companySmallType_Ins_Value
	}
	else if(topic=="4")
	{
		arr = companySmallType_Fund;
		arrValue = companySmallType_Fund_Value
	}
	else if(topic=="5")
	{
		arr = companySmallType_Stock;
		arrValue = companySmallType_Stock_Value
	}
	else
	{
		arr = companySmallType_Other;
		arrValue = companySmallType_Other_Value
	}
	
	for(var i=0;i<arr.length;i++)
	{
		var opt = document.createElement("option");
		opt.value=arrValue[i];
		opt.text =arr[i];
		document.getElementById("SearchYellowPageTopicTypeDdlId_Small").options[i]=opt;
	}

}

function YpSearchCompanyOnClick()
{
	var topic = document.getElementById(SearchYellowPageTopicTypeDdlId).value;
	var inbeing = document.getElementById("SearchYellowPageTopicTypeDdlId_Small").value;
	var key =  document.getElementById("SearchYellowPageKeyId").value;
	
	var search = YpSearchCompanyModel.replace("key",key).replace("topic",topic).replace("quality","").replace("inbeing",inbeing).replace("letter","");
	
	window.open("/yellowPage/list.aspx?"+search);
}

function YpSearchCompanyOnLetter(letter)
{
	var search = YpSearchCompanyModel.replace("key","").replace("topic","").replace("quality","").replace("inbeing","").replace("letter",letter);
	
	window.open("/yellowPage/list.aspx?"+search);
}

function get_a()
{
	var h=window.location.href;
		window.location.target="_blank";
	if(h.indexOf("?")>0)
	{	
		if(h.indexOf("order=")>0)
		{
			var t= window.location.href;
//			t=t.substring(0,t.length-1);	
			if(h.indexOf("order=0")>0)
			{
				t=t.replace("order=0","order=1");
			}
			if(h.indexOf("order=1")>0)
			{
				t=t.replace("order=1","order=0");
			}
//			t=t+"0";
			window.location.href=t;
		}
		else
		{
			window.location.href+="&order=0";
		}
	}
	else
	{
		window.location.href+="?order=0";
	}
}
	

function get_b()
{
	var h=window.location.href;
	//&order
	if(h.indexOf("?")>0)
	{	
		if(h.indexOf("order=")>0)
		{
			var t= window.location.href;
//			t=t.substring(0,t.length-1);
			if(h.indexOf("order=0")>0)
			{
				t=t.replace("order=0","order=1");
			}
			if(h.indexOf("order=1")>0)
			{
				t=t.replace("order=1","order=0");
			}
//			t=t+"1";
			window.location.href=t;
		}
		else
		{
			window.location.href+="&order=1";
		}
	}
	else
	{
		window.location.href+="?order=1";
	}
}

//Yellow Page End

//********************************************************************************************
//Expert 
function ExpertSearchclick()
{
	var key=encodeURI(document.getElementById("prosearch").value);
	window.location.href = "/Expert/list.aspx?key="+key+"&topictype=0&provice=&city=";
}

//***************************************************************************************

//网站顶部搜索框字符输入验证
function TopSearch_OnClick(control)
{	
	var bigType = control.childNodes[0].value;
	var productFrom = control.childNodes[2].value;
	var pvType=control.childNodes[3].value;
	var key  = encodeURI(control.childNodes[4].value);
	var pvType=encodeURI(control.childNodes[6].value);
	var search="";
	var argObject ;	
	for(var i=0;i<control.childNodes[6].value.length;i++)
	{
		if(control.childNodes[6].value.charCodeAt(i)>=33&&control.childNodes[6].value.charCodeAt(i)<=47)
		{
			alert("不能输入非法字符");
			return;
		}
		if(control.childNodes[6].value.charCodeAt(i)>=58&&control.childNodes[6].value.charCodeAt(i)<=64)
		{
			alert("不能输入非法字符");
			return;
		}
		if(control.childNodes[6].value.charCodeAt(i)>=91&&control.childNodes[6].value.charCodeAt(i)<=96)
		{
			alert("不能输入非法字符");
			return;
		}
		if(control.childNodes[6].value.charCodeAt(i)>=123&&control.childNodes[6].value.charCodeAt(i)<=125)
		{
			alert("不能输入非法字符");
			return;
		}
	}
	//if(bigType!="产品"&&control.childNodes[6].value.length<2)
	//{
	//	alert("输入请大于2个字符");
	//	return;
	//}
	//if(key==""&&bigType!="产品")
	//{
	//	alert("请输入关键字，以便搜索！");
	//	return;
	//}
	if(bigType=="产品")
	{
		if(productFrom=="1")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new BankProductArg_RMB();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="2")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new BankProductArg_RMB();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="3")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new BankCardArg();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="5")
		{
			
			var f = new FundProductArg();
			f.From = 5;
			f.Jjglr = "";
			key = f.Key = encodeURI(control.childNodes[6].value);
			f.Jjlx = "";
			f.Tzlx = "";
			f.Jjgm = "";
			f.Jjsj = 0;
			f.Jjsjd = 0;
			f.Qdzs = 0;			
			search = f.GetSearch();
			
		}
		else if(productFrom=="6")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new InsProductCC();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="7")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new InsProductRS();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="9")
		{	
			key  = encodeURI(control.childNodes[6].value);
			argObject = new BankDkArg();
			argObject.Key = key;
			argObject.From = productFrom;
			search = argObject.GetSearch();
			
		}
		else if(productFrom=="29")
		{	
			key  = encodeURI(control.childNodes[6].value);			
			search = "29-------------";
		}
		else if(productFrom=="11")
		{
			search ="11--------0--0---0-0-";
		}
		search="/market/list.aspx?"+search+"-&from="+productFrom+"&key="+key;
	}
	else if(bigType=="专家")
	{	
		var subStr=new Array();
		subStr[0]="21";
		subStr[2] = encodeURI(control.childNodes[6].value);
		subStr[1] = "";
		subStr[3]="";
		var subValue=new ProfessionalArg(subStr);
		search = "/Search?" + subValue.GetSearch();
	}
	else if(bigType=="情报")
	{	
		var subStr=encodeURI(control.childNodes[6].value);
		search = "http://chat.cnqsq.com/bchataspx/stock/SacStockCommand.aspx?code=" + subStr;
	}
	else if(bigType=="机构")
	{	
		key  = encodeURI(control.childNodes[6].value);
		
		search= "/yellowPage/list.aspx?"+YpSearchCompanyModel.replace("key",key).replace("topic","0").replace("quality","").replace("inbeing","").replace("letter","").replace("/","-");
		search=search+"&bigType="+bigType+"&key="+key;
	}
	else if(bigType=="资讯")
	{
		var subStr=new Array();
		subStr[0]="24";
		subStr[2] = encodeURI(control.childNodes[6].value);
		subStr[1] = "";
		subStr[3]="";
		subStr[4]="";
		subStr[5]="";
		var subValue=new NewsArg(subStr);
		search = "/Search?" + subValue.GetSearch();	
		
	}
	else if(bigType=="专家视频")
	{		
		var subStr=new Array();
		subStr[0]="22";
		subStr[1]=key;
		subStr[2]=pvType;
		subStr[3]="";	
		subStr[4]="";
		
		var subValue=new VideoArg(subStr);			
		search = "/Search?" + subValue.GetSearch();
	}
	
	//window.location.target="_blank";
	//window.location.href=search;
	
	var obj = document.getElementById("aSearch");
 
	if(obj == null)
	{
		var t=document.createElement("<a>"); 
		t.href=search;	 
		t.target="_blank"; 
		document.insertBefore(t);
		t.click();
	}
	else
	{
		
		obj.href= search;
		obj.click();

	}
	//alert(t);
	//window.open(search,   "_blank")   

}
//网站顶部搜索框状态的改变
function LoadTopSearchState(control)
{
	
	var url = window.location.href.toLowerCase();
	
	control.childNodes[2].options[0] = null;
	if(url.indexOf("/market/")>0) 
	{
		var productFrom = GetProductFrom();

		SelectDropDownListOptions(control.childNodes[0],"产品",true);
		SelectDropDownListOptions(control.childNodes[2],productFrom,false);
		LoadSearcArgClass();
		if(ArgClass!=null)
		{
			alert(ArgClass.Key);
			control.childNodes[4].value = decodeURI(ArgClass.Key);
		}
	}
	else if(url.indexOf("/expert/")>0)
	{
		
		SelectDropDownListOptions(control.childNodes[0],"专家",true);
		TopSearchBigType_OnChange(control.childNodes[0]);
		
		control.childNodes[4].value = decodeURI(QueryString("key"));
	}
	else if(url.indexOf("/yellowpage/")>0)
	{
		SelectDropDownListOptions(control.childNodes[0],"机构",true);
		TopSearchBigType_OnChange(control.childNodes[0]);
		var args = window.location.search.replace("?","").split("-");
		if(args!=null&&args.length>3)
			control.childNodes[4].value = decodeURI(args[0]);
	}
	else if(url.indexOf("/news/")>0)
	{
		SelectDropDownListOptions(control.childNodes[0],"资讯",true);
		TopSearchBigType_OnChange(control.childNodes[0]);
		control.childNodes[4].value = decodeURI(QueryString("key"));
	}
}


