﻿function ById(id) {return document.getElementById(id);}
//标签切换
var setH=false;
var webURL=document.location.href;
function showList(idLP,idCP,n,sum,idLchclass,idLunchclass,idCchclass,idCunchclass) {
//	idListPrefix,idContentPrefix,n,sum,idListchclass,idListunchclass,idContentchclass,idContentunchclass
	if(!idLunchclass)idLunchclass='';
	if(!idCchclass)idCchclass='dis';
	if(!idCunchclass)idCunchclass='undis';
	for(i=1;i<=sum;i++) {
		ById(idLP+i).className=idLunchclass;
		ById(idCP+i).className=idCunchclass;
	}
	ById(idLP+n).className=idLchclass;
	ById(idCP+n).className=idCchclass;
	if(setH==true){setObjHeight();}
}

function showL(idListPrefix,idContentPrefix,n,sum,idListchclass,idListunchclass,idContentchclass,idContentunchclass){	
	for(i=1;i<=sum;i++) {
		ById(idListPrefix+'0'+i).className='undis';
	}
	ById(idListPrefix+'0'+n).className=idContentchclass;
	showList(idListPrefix,idContentPrefix,n,sum,idListchclass,idListunchclass,idContentchclass,idContentunchclass);
}

//基金诊断流程
function showFlowChart(idLP,idCP,n,text1,text2) {
	var showLabel=ById(idLP+n);
	if(!showLabel)
	return ;
	if(showLabel.innerHTML==text1) {
		showLabel.innerHTML=text2;
		ById(idCP+n).className="dis";
	} else {
		showLabel.innerHTML=text1;
		ById(idCP+n).className="undis";
	}
}

function switchLetter(id,idC1,idC2,text1,text2) {
	var showLabel=ById(id);
	if(!showLabel)
	return ;
	if(showLabel.innerHTML==text1) {
		showLabel.innerHTML=text2;
		ById(idC2).className="dis";
		ById(idC1).className="undis";
	} else {
		showLabel.innerHTML=text1;
		ById(idC2).className="undis";
		ById(idC1).className="dis";
	}
}

//加入收藏夹
function addCookie(url,title){
	if(!url) url='http://www.howbuy.com'
	if(!title) title='好买理财-专业的基金投资顾问'
	if (document.all) {
		window.external.addFavorite(url,title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	}
}

//设首页
function setHomepage(){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.howbuy.com');
		}else if (window.sidebar){
			if(window.netscape){
				try{
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}catch (e){
						alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值改为true" );  
				}
			} 
   var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
   prefs.setCharPref('browser.startup.homepage','http://www.howbuy.com');
   }
}

//加入收藏夹
function addCookie1(url,name){
	if (document.all){
		window.external.addFavorite(url,name);
	} else if (window.sidebar){
		 window.sidebar.addPanel(name,url, "");
	}
}

//设首页
function setHomepage1(url){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
	}else if (window.sidebar){
		if(window.netscape){
			try{  
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
		}catch (e){
			alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
		}
	} 
   var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
   prefs.setCharPref('browser.startup.homepage',url);
   }
}

//加入收藏夹
function addFavorite(title) {
	var url = document.URL;
	addCookie(url,title);
}

//字体选择
function T(n) {
	ById("ArticleCnt").style.fontSize=n+"px";
	if(n==12) {
		ById("ArticleCnt").style.lineHeight="20px";
	}else if(n==14) {
		ById("ArticleCnt").style.lineHeight="24px";
	}else {
		ById("ArticleCnt").style.lineHeight="28px";
	}
}

//复制网页地址到剪切板
function copyLink(text2copy,msg) {
	var Url=document.URL;
	if(window.clipboardData) {
		window.clipboardData.setData("Text",Url);
	}
	alert(msg);
}

//改变表格背景颜色
function changeTrBg(tbodies) {
	var even=true;
	var trs=tbodies.rows;
	for(var i=0;i<trs.length;i++) {
		trs[i].onmouseover=function () {
			if(this.className=='hl_attention'){
				return;
			}else{
				this.className+=" trBg";
			}
		}
		trs[i].onmouseout=function () {
			if(this.className=='hl_attention'){
				return;
			}else{
				this.className=this.className.replace("trBg","");
				return false;
			}
		}
		if(even)
		trs[i].className+="";
		even=!even;
	}
}

function changeFettle(idLP,idCP,n,text1,text2) {
	var showLabel=ById(idLP+n);
	if(!showLabel)	return ;
	if(showLabel.title==text1) {
		showLabel.title=text2;
		ById(idLP+n).className="h2 open";
		ById(idCP+n).className="dis";
	}else{
		showLabel.title=text1;
		ById(idLP+n).className="h2 close";
		ById(idCP+n).className="undis";
	}
}

function mediaMeun(obj,idCP,text1,text2) {
	if(obj.title==text1) {
		obj.title=text2;
		obj.className=obj.className.replace("close","open");
		ById(idCP).className="dis";
	}else{
		obj.title=text1;
		obj.className=obj.className.replace("open","close");
		ById(idCP).className="undis";
	}
}

//基金学院 改变浏览模式
function changeBrowseMode(idLP,idCP,n,text1,text2) {
	var showLabel=ById(idLP+n);
	if(!showLabel)	return ;
	if(showLabel.innerHTML==text1) {
		showLabel.innerHTML=text2;
		ById(idLP+n).className="mode1";
		ById(idCP+n).className="content1";
		ById(idLP+n).title="当前为平铺显示模式，点击切换到滚屏显示模式";
	}else{
		showLabel.innerHTML=text1;
		ById(idLP+n).className="mode2";
		ById(idCP+n).className="content2";
		ById(idLP+n).title="当前为滚屏显示模式，点击切换到平铺显示模式";
	}
}

function fundBarMenuTree(imgObj,id) {
	//if(imgObj.src.indexOf("../images/fundBar/close.gif")>0) {
	if(imgObj.alt=="关闭") {
		imgObj.src="../images/fundBar/close.gif";
		imgObj.alt="展开"
		ById(id).className="undis"
	}else{
		imgObj.src="../images/fundBar/open.gif";
		imgObj.alt="关闭"
		ById(id).className="dis"
	}
}

/*
* begin title info function
用法： onmouseover="divMousemove(this,'好买基金排名趋势图以三个月为基数做平均移动','','400')" 
支持html代码
*/
var MM_found=true; //定义变量是否创建对象（元素)

//创建对象（元素)
function MM_foundObj(){
	tipsBox = document.createElement('div');
	tipsBox.setAttribute('id','tips');
	tipsHead = document.createElement('div');
	tipsHead.setAttribute('id','tipsHead');
	tipsInfo = document.createElement('div');
	tipsInfo.setAttribute('id','tipsInfo');
	tipsBox.appendChild(tipsHead);
	tipsBox.appendChild(tipsInfo);
	document.body.appendChild(tipsBox);
}

//查找对象（元素)
function MM_findObj(n, d){
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}

var ie=document.all;
var ns6=document.getElementById && !document.all;
var safari=isSafari();
var enabletip=false;

//显示详细提示信息内容
function showTitle(titleInfo,headTxt,setWidth){
	if(MM_found==true){MM_foundObj();MM_found=false;}
	if(!headTxt) var headTxt="详细说明信息";
	if(!setWidth) var setWidth='300';
	ById('tips').style.width = setWidth+'px';
	var tipsInfoObject = MM_findObj('tipsInfo');
	tipsInfoObject.innerHTML = titleInfo;
	var tipsHeadObject = MM_findObj('tipsHead');
	tipsHeadObject.innerHTML = headTxt;
	enabletip = true;
	return false;
}

//隐藏详细提示信息内容
function hideTitle(){	
	var tipObject = MM_findObj('tips');	
	var tipsInfoObject = MM_findObj('tipsInfo');
	var tipsHeadObject = MM_findObj('tipsHead');
	enabletip = false;
	tipObject.style.visibility = "hidden";
}

function ieTrueBody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function isSafari(){
	return navigator.userAgent.toLowerCase().indexOf("safari") + 1;
}

function positionTip(e){	
	var offsetxpoint=10;
	var offsetypoint=10;
	if (enabletip){
		var tipobj = MM_findObj('tips');		
		var curX=(ns6)?e.pageX : event.clientX+ieTrueBody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ieTrueBody().scrollTop;
		var rightedge=ie&&!window.opera? ieTrueBody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
		var bottomedge=ie&&!window.opera? ieTrueBody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
		
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;		
		if (rightedge<tipobj.offsetWidth){
			tipobj.style.left=ie? ieTrueBody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		}else if (curX<leftedge){
			tipobj.style.left="5px";
		}else{
			tipobj.style.left=curX+offsetxpoint+"px";
		}

		if(safari){
			tipobj.style.top=curY+offsetypoint+"px";
		}else{
			if (bottomedge<tipobj.offsetHeight){
				tipobj.style.top=ie? ieTrueBody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
			}else{
				tipobj.style.top=curY+offsetypoint+"px";
			}
		}
		tipobj.style.visibility="visible";
	}
}

function divMousemove(obj,titleInfo,headTxt,setWidth){
	obj.onmousemove=positionTip; 
	obj.onmouseout=hideTitle;
	obj.style.cursor='help';
	showTitle(titleInfo,headTxt,setWidth);
}
/*
* end title info function
*/

//取得页面的高度和宽度
function getBodySize(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
}

function onoverLine(obj) {	return obj.style.backgroundColor='#eee'; }
function onoutLine(obj) { return obj.style.backgroundColor='#fff'; }

/*/锁定表头功能 bengin/*/
function getScroll() {
	var t,l,w,h,ch,oh;
	if(document.documentElement&&document.documentElement.scrollTop) {
		t=document.documentElement.scrollTop;
		l=document.documentElement.scrollLeft;
		w=document.documentElement.scrollWidth;
		h=document.documentElement.scrollHeight;
		ch=document.documentElement.clientHeight;
		oh=document.documentElement.offsetHeight;
	}else if(document.body) {
		t=document.body.scrollTop;
		l=document.body.scrollLeft;
		w=document.body.scrollWidth;
		h=document.body.scrollHeight;
		ch=document.body.clientHeight;
		oh=document.body.offsetHeight;
	}
	return {
		t:t,l:l,w:w,h:h,ch:ch,oh:oh
	};
}

function getCurrPos(e){
	var offset=e.offsetTop;
	if(e.offsetParent!=null)offset+=getCurrPos(e.offsetParent);
	return offset;
}

//var rollListHeadY=getCurrPos(ById('rollListHead'));
function rollListHead(){
	var ListHead=ById('rollListHead');
	var fundList=ById('fundList');
		ListHead.style.position='relative';
	var s=getScroll();
	//if(s.t>=rollListHeadY&&s.t<fundList.clientHeight+rollListHeadY){
	if(s.t>=rollListHeadY&&s.t<fundList.offsetHeight+rollListHeadY){
		ListHead.style.top=(s.t-rollListHeadY)+"px";
		//ListHead.style.background='#e6f0f7';
	}
	
	if(s.t<rollListHeadY){
		ListHead.style.top="0px";
		//ListHead.style.background='#eee';
	}
}
/*/锁定表头功能 end/*/

/*
* 账簿展开关闭功能
*/
function showTradeAnnal(imgObj,id) {
	//if(imgObj.src.indexOf("../images/iocn/close.gif")>0) {
	if(imgObj.alt=="关闭") {
		imgObj.src="../images/iocn/closeTree.gif";
		imgObj.alt="展开"
		ById(id).className="undis"
	}else{
		imgObj.src="../images/iocn/openTree.gif";
		imgObj.alt="关闭"
		ById(id).className=""
	}
}

// JavaScript Ddocument
//document.write("<div id=\"bestrowDiv\" class='undis'><iframe id=\"zIframe\" frameborder=\"0\"><\/iframe><\/div>");

/*
取得屏幕正中央位置
*/
var PopTips;
var wbeTop;

function leoscreenCC(id){	
	var PopTips=ById(id);
	PopTips.style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-PopTips.offsetHeight)/2)+"px";
	PopTips.style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-PopTips.offsetWidth)/2)+"px";
}

//window.onresize=screenCC;

function showLcTips (id){
	var PopTips=ById(id);
	var bodySize = getBodySize();
	ById("bestrowDiv").style.width=bodySize[0] + 'px';
	ById("bestrowDiv").style.height=bodySize[1] + 'px';
	ById("zIframe").style.width=bodySize[0] + 'px';
	ById("zIframe").style.height=bodySize[1] + 'px';
	ById("bestrowDiv").className="dis";	
	PopTips.className='showTips';
	//alert(document.documentElement.scrollTop);
	wbeTop=document.documentElement.scrollTop;
	leoscreenCC(id);
}

function hideLcTips (id){
	var PopTips=ById(id);
	ById("bestrowDiv").className="undis";	
	PopTips.className='undis';
	window.scroll(0,wbeTop);
}
 
// scrollShow('scrollMgPic',3,5,180,5000);
function scrollShow(objId,count,speed,ht,delay,errorValue){//滚动对象id，需要滚动的条数，滚动速度，切换一次的高度，停留时间，偏差
	var obj=ById(objId);
	if(!errorValue){errorValue=0;}
	if(document.all){ht=ht-errorValue;}//处理ie与ff的偏差
	var end=(count*2-1)*ht;		
	var offset=0;
	var state=false;
	obj.innerHTML+=obj.innerHTML;
	obj.onmouseover=function (){state=true;	};
	obj.onmouseout=function (){state=false;	};
	function scrollStart(){
		if(!state){
			if(offset>=end){obj.scrollTop=offset=(count-1)*ht;}
			obj.scrollTop=offset;
			offset+=speed;//offset++;			
		}
		if(offset%ht==speed){
			setTimeout(scrollStart,delay);
			return false;
		}
		setTimeout(scrollStart,5);
	}
	setTimeout(scrollStart,delay);
}

function scrollShow1(id, delay, speed, lineHeight,tag) {//滚动对象id，停留时间，滚动速度，切换一次的高度，标签
	if(!tag){tag="dt"}
	var slideBox = (typeof id == 'string')?document.getElementById(id):id;
	var delay = delay||1000;
	var speed = speed||20;
	var lineHeight = lineHeight||20;
	//alert("id:"+id+";delay:"+delay+";speed:"+speed+";lineHeight:"+lineHeight+";");
	var tid = null, pause = false;
	var start = function() {
		   tid=setInterval(slide, speed);
	}
	var slide = function() {
		   if (pause) return;
		   slideBox.scrollTop += 2;
		   if ( slideBox.scrollTop % lineHeight == 0 ) {
				  clearInterval(tid);
				  slideBox.appendChild(slideBox.getElementsByTagName(tag)[0]);
				  slideBox.scrollTop = 0;
				  setTimeout(start, delay);
		   }
	}
	slideBox.onmouseover=function(){pause=true;}
	slideBox.onmouseout=function(){pause=false;}
	setTimeout(start, delay);
}
 
//iframe加载loading效果 begin
//	<div id="load1" align="center" style="height:200px; line-height:200px;">
//		<img src="/images/iocn/loading.gif" /> loading...
//	</div> 
//	<iframe id="zhlcRight"  src="/common/zhlcRight.html" width="100%" style="display:none;visibility:hidden" scrolling="no" frameborder="0" onreadystatechange="stateChangeIE(this,'load1')" onload="stateChangeFirefox(this,'load1');dyniframesize('zhlcRight');"></iframe>

function stateChangeIE(_frame,loadId){
	if(_frame.readyState=="interactive"){//state: loading ,interactive,   complete    
		var loader = document.getElementById(loadId); 
        loader.innerHTML = "";    
        loader.style.display = "none";  
        _frame.style.visibility = "visible";   
        _frame.style.display = "block"; 
    }   
}

function stateChangeFirefox(_frame,loadId){
	var loader = document.getElementById(loadId);
	loader.innerHTML = "";
	loader.style.display = "none";
	_frame.style.visibility = "visible";   
    _frame.style.display = "block"; 
}

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0;
function dyniframesize(iframename){
	var pTar = null;
	if (document.getElementById){
		pTar = document.getElementById(iframename);
	}else{
		eval('pTar = ' + iframename + ';');
	}
	if (pTar && !window.opera){
		//begin resizing iframe
		pTar.style.display="block";
		if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
			//ns6 syntax
			pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight + 10;
		}else if (pTar.Document && pTar.Document.body.scrollHeight){
			//ie5+ syntax
			pTar.height = pTar.Document.body.scrollHeight + 10;
		}
	}
}
//iframe加载loading效果 end

//基金学院菜单
function changtree(obj,className1,className2,obj1,className3,className4){
	if(obj.className==className1){
		obj.className=className2;
		ById(obj1).className=className4;
	}else{
		obj.className=className1;
		ById(obj1).className=className3;
	}
}

//好买的服务左侧菜单
function aboutHowbuy_meun(obj){
	var obj=ById(obj);
	if(obj.className.indexOf("close")>=0){
		obj.className=obj.className.replace("close","open");
		obj.getElementsByTagName("dl")[0].className="";
	}else{
		obj.className=obj.className.replace("open","close");
		obj.getElementsByTagName("dl")[0].className="undis";
	}
}

var setRSW=0;//setRightSpaceWidth
function setObjHeight(){
	ById("leftPart").style.height=ById("rightPart").style.height="";
	var h1 = ById("leftPart").offsetHeight;//scrollHeight;
	var h2 = ById("rightPart").offsetHeight;
	var h;
	(h1>=h2)?h=h1:h=h2;
	ById("leftPart").style.height=ById("rightPart").style.height=h+"px";
	if(setRSW<=2){
		var w0=ById("nav").offsetWidth,w1=0,div=ById("nav").getElementsByTagName('div');
		div[div.length-1].style.width="0px";
		for(i=0;i<div.length;i++){w1+=div[i].offsetWidth;}
		div[div.length-1].style.width=w0-w1+'px';
		setRSW+=1;
	}
}

/*function allowcopy(){
	if(ById('allowcopy').innerHTML.indexOf('116.236.213.130')>=0){
	document.oncontextmenu=function(){return false;}
	document.onselectstart=function(){return false;}	
	document.oncopy=function(){return false;}
	document.oncut=function(){return false;}
	}
}*/
if(webURL.indexOf("simu.howbuy")>=0&&webURL.indexOf("board")>=0){
	//document.oncontextmenu=function(){return false;}
	//document.onselectstart=function(){return false;}	
	//document.oncopy=function(){return false;}
	//document.oncut=function(){return false;}
}

//基金比较
var arrCompareFund=new Array();
var aryFunds = new Array();
var dst1,dst2,scrolltime1,scrolltime2;
function addCompareFund(obj){
	dst1=document.documentElement.scrollTop;
	var inp=ById("C1").getElementsByTagName("input");
	var idx =-1;
	var fundName=obj.parentNode.parentNode.getElementsByTagName("a")[0].innerHTML;
	var fundCode=obj.value;
	if(inp.length){
		for (var i=0;i<inp.length;i++){
			if (inp[i].value==fundCode) idx=i;
			//break;
		}
	}
	if(obj.checked==true){
		if(arrCompareFund.length>=5){ 
			//alert("您最多只能比较5只基金！");			
			var popup = popups.createPopup("AlertError","您最多只能比较5只基金！");
			popup.titleIcon.innerHTML="错误提示";
			popup.show();
			obj.checked=false; 
			return;
		}
		arrCompareFund.push(fundName+"[<font class=bule>"+fundCode+"</font>]");
		aryFunds.push(fundCode);
		ById("fundCompare").className="";
		dst2=getCurrPos(ById('fundCompare'));
		ById("fundc").innerHTML="<font class=red>"+arrCompareFund.length+"</font>只基金："+arrCompareFund.join(" 、");	
		for(var j=1;j<=5;j++){
			ById("C"+j).getElementsByTagName("input")[idx].checked=true;
		}		
		//scroll1();
		//scrolltime1=window.setInterval('scroll1()',1);
	}else{
		for(i=0;i<arrCompareFund.length;i++){
			if(arrCompareFund[i]==fundName+"[<font class=bule>"+fundCode+"</font>]"){arrCompareFund.splice(i,1);aryFunds.splice(i,1);}			
		}		
		for(var j=1;j<=5;j++){
			ById("C"+j).getElementsByTagName("input")[idx].checked=false;
		}
		if(arrCompareFund.length!=0){
			ById("fundc").innerHTML="<font class=red>"+arrCompareFund.length+"</font>只基金："+arrCompareFund.join(" 、");	
		}else{
			ById("fundc").innerHTML="<font class=red>0</font>只基金!";	
			ById("fundCompare").className="undis";
		}
	}
	ById("leave").innerHTML=5-arrCompareFund.length;
}

function scroll1(){
	if(document.documentElement.scrollTop>dst2){
		window.scroll(0,document.documentElement.scrollTop-30);
	}else{
		window.clearInterval(scrolltime1);	
	}
}
function scroll2(){
	if(document.documentElement.scrollTop<dst1){
		window.scroll(0,document.documentElement.scrollTop+30);
		//scrolltime2=window.setInterval('scroll2()',5);
	}else{
		window.clearInterval(scrolltime2);	
	}
}

function tjform(frm){
	if(arrCompareFund.length=="0"){
		var popup = popups.createPopup("AlertError","您没有选择要比较的基金，请先选择！");
		popup.titleIcon.innerHTML="错误提示";
		popup.show();	
	}else if(arrCompareFund.length=="1"){		
		var popup = popups.createPopup("AlertError","您只选择了一只基金，无法比较，两只以上才可以比较，请先选择！");
		popup.titleIcon.innerHTML="错误提示";
		popup.show();
	}else{
		//document.location.href="http://www.howbuy.com/fundtool/compare.htm";
		/*
		var aryFunds = new Array();
		var re = /\<font .*?\>(.*)\<\/font\>/g;
		for (var i=0;i<arrCompareFund.length;i++){
				var arr = re.exec(arrCompareFund[i]);
				if (arr!=null){
					aryFunds.push(arr[0]);
				}
		}
		*/
		for (var i=0;i<frm.fundcode.length;i++){
				if (i<aryFunds.length){
					frm.fundcode[i].value=aryFunds[i];
				}else{
					frm.fundcode[i].value="";
				}
		}
		frm.submit();
	}
}
