var glbCompCD=0;

function openComp(url,th){
if (glbCompCD==0){
	alert("נא לבחור חברה מן הרשימה");
	return false;
}

if (url.substr(url.length-1,1)=='=')
{
	url+=glbCompCD;
}
top.window.resizeTo(screen.availWidth,screen.availHeight);
//self.moveTo(0,0);
th.href=url;
//var compwin = window.open(url, "compdetail", "width=800, height=600, toolbar=no, status=no, menubar=no, scrollbars=yes, location=no, resizable=yes")
//compwin.focus()
}

function OpenCompTASE(url)
{
var compTASEwin = window.open(url, "compTASE", "width=600, height=300, toolbar=yes, status=yes, menubar=yes, scrollbars=yes, location=yes, resizable=yes");
compTASEwin.focus();
}

function OpenPdfURL(t)
{
t.href='http://www.adobe.com/products/acrobat/readstep2_allversions.html';
}

function OpenInetURL(t)
{
t.href='http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/HE/ie6setup.exe';
}

function showtip2(current,e,text){
if (document.all&&document.readyState=="complete"){
	//document.all.tooltiptext.innerHTML='<marquee loop=1 SCROLLDELAY=20 behavior=slide direction=right style="position:absolute; text-align:center; padding-right=15px; padding-left=5px; top:0; left:0">'+text+'</marquee>'
	document.all.tooltiptext.innerHTML='<p style="position:absolute; text-align:center; padding-right=15px; padding-left=20px; top:0; left:0">'+text+'</p>';
	document.all.tooltiptext.style.pixelLeft=event.clientX+document.body.scrollLeft+10;
	document.all.tooltiptext.style.pixelTop=event.clientY+document.body.scrollTop+10;
	document.all.tooltiptext.style.visibility="visible";
}

else if (document.layers){
	document.tooltiptext.document.nstip.document.write('<b>'+text+'</b>');
	document.tooltiptext.document.nstip.document.close();
	document.tooltiptext.document.nstip.left=0;
	document.tooltiptext.left=e.pageX+10;
	document.tooltiptext.top=e.pageY+10;
	document.tooltiptext.visibility="show";
}
}
function hidetip2(){
	if (document.all)
	document.all.tooltiptext.style.visibility="hidden";
	else if (document.layers){
	clearInterval(currentscroll);
	document.tooltiptext.visibility="hidden";
}
}

function check(obj)
{
	if (obj.checked==true)
	{
		if(obj.id=='cbAll')
		frmPrint.cbUrjent.checked=false;
		else
			frmPrint.cbAll.checked=false;
	}
}
	
function ChangeDate(){
	document.all.printPop.style.visibility="hidden";
	frmPrint.GoToPrint.value=false;
	document.frmPrint.submit();
}	

function OpenCompanyNavigate()
{ 
	window.open('CompanyNavigate.asp','Navigation','toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,width=360,height=140');
}

function CheckWin(FWin98,cookExist)
{ 
	if (FWin98 && cookExist)
		 window.open('Win98alert.asp','Windows98','toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,width=310,height=170');
	
}

function PrintReport(Show)
{
	var strReverse='';
	var rep_cd='';
	var str='';
	var THE_COOKIES="REP_CODE=";

	j=0;
	iRepCount=0;

	rep_cd=new String();
	str=new String();
	
	var clen=document.thisForm.chk.length;
	
	if (typeof(clen)=='undefined'){
		var e=document.thisForm.chk;
		if (e.checked) 
		{	j++;
			iRepCount += 1;
			rep_cd+=e.value+',';
		}
	}
	else
	{
	for(i=0;i< document.thisForm.chk.length;i++)
	{
		e=document.thisForm.chk[i];
		if (e.checked) 
		{
			j++;
			iRepCount += 1;
			rep_cd+=e.value+',';
		}
	}
	}
	
	str='';//GetCookie("REP_CODE");
	rep_cd=rep_cd.substr(0,rep_cd.length-1);
	
	THE_COOKIES+=rep_cd;
	document.cookie=THE_COOKIES;
	
	if (j==0)
		alert('לא נבחרו דיווחים להדפסה');
	else if (iRepCount>0)
		NewWindow('PopUpPrint.asp?Show='+Show,'test','350','280','no','center');
	
}

function NewWindow(mypage,myname,w,h,scroll,pos){
var win=null;
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function GetCookie(sName) 
 { 
 var aCookie = window.top.document.cookie.split("; "); 
 for (var i=0; i < aCookie.length; i++) 
 	{ 
 	if (aCookie[i]==sName) return ""; 
 	var aCrumb = aCookie[i].split("="); 
 	if (sName == aCrumb[0]) return unescape(aCrumb[1]); 
 	} 
 return ""; 
 } 

function GetAllCookie(sName) 
 { 
 var aCookie = window.top.document.cookie.split("; "); 
 var aRet='';
 for (var i=0; i < aCookie.length; i++) 
 	{ 
 	if (aCookie[i]==sName) return ""; 
 	var aCrumb = aCookie[i].split("="); 
 	
 	if (sName == aCrumb[0])
 	{
 		intPos=aCookie[i].indexOf('bursa/')+6;
 		aRet=aCookie[i].substr(intPos,aCookie[i].length-intPos-1);
 		
 	return unescape(aRet); 
 	}
 	} 
 return ""; 
 }
 
function CheckedAll(blnChecked)
{
	var iRepCount=0;
	var clen=document.thisForm.chk.length;
	
	if (typeof(clen)=='undefined')
	{
		var e=document.thisForm.chk;
		e.checked=blnChecked;
		if (e.checked)
			iRepCount += 1;
	}
	else
	{
		for (var i=0;i<document.thisForm.chk.length;i++)
		{
			var e = document.thisForm.chk[i];
			e.checked = blnChecked;
			if (blnChecked==true)
				iRepCount += 1;
		}
	}

	if (iRepCount==0)
		document.getElementById("TOTPAGE").innerHTML='';
	else
		document.getElementById("TOTPAGE").innerHTML='נבחרו <b><font color="#CC0033">'+iRepCount+'</font></b> דיווחים';
}
function CheckMe()
{
	var iRepCount=0;
	var strReverse='';
	
	var clen=document.thisForm.chk.length;
	if (typeof(clen)=='undefined'){
		var e=document.thisForm.chk;
		if (e.checked)
			iRepCount += 1;
	}
	else{
	for (var i=0;i<document.thisForm.chk.length;i++)
	{
		e=document.thisForm.chk[i];
		if (e.checked)
			iRepCount += 1;
	
		}
	}

	if (iRepCount==0)
		document.all.TOTPAGE.innerHTML='';
	else
		document.all.TOTPAGE.innerHTML='נבחרו <b><font color="#CC0033">'+iRepCount+'</font></b> דיווחים';

}

function ReverseTotal(sum)
{
	var str='';
	var strReplace='';
	
	str=new String(sum);
	
	for (var i=str.length-1;i>=0;i--)
		strReplace+=str.substr(i,1);
		
	return strReplace;
}

function ChangeShow(str){
	document.getElementById("dToolBar").innerHTML=str;
	for (var i=0;i<document.thisForm.repTotal.value;i++)	
		document.getElementById("checkBoxTools"+i).style.visibility="visible";
	
	CheckedAll(false);
}

function HafaelNtuneMishar(){
	glbCompCD=cmbHavarot.getValue();
	
	sSite = "http://www.tase.co.il/TASE/taseredirect.aspx?type=com&tab=sumall&param=";
	OpenNtuneMishar(sSite);
}

function OpenTradeFund(){

	if(document.thisForm){
		if (!(document.thisForm.kranot_group[document.thisForm.kranot_group.selectedIndex].value=="allFund" || document.thisForm.kranot_group[document.thisForm.kranot_group.selectedIndex].value=="allFundNbr") || cmbHavarot.getValue()==0)
		{
			alert('נא לבחור קרן מהרשימה');
			return;
		}
	}
	if(document.co){
		if (cmbHav.getValue()==0)
		{
			alert('נא לבחור קרן מהרשימה');
			return;
		}
	}

	if (typeof(cmbHav)!='undefined'){ 
		OpenCompTASE("http://www.tase.co.il/TASE/General/trustfund/fundmaindata.htm?FundID=0"+cmbHav.getValue());
		return;
	}
	if (typeof(cmbHavarot)!='undefined') 
		OpenCompTASE("http://www.tase.co.il/TASE/General/trustfund/fundmaindata.htm?FundID=0"+cmbHavarot.getValue());
	return;
}
function OpenNtuneMishar(sSite){
	if(document.thisForm.company_group)
		if (document.thisForm.company_group[document.thisForm.company_group.selectedIndex].value=='deleted')
		{
			alert('אין נתוני מסחר לחברה מחוקה')
			return false;
		}
	document.thisForm.arg_comp.value=glbCompCD;
	if (glbCompCD=='' || isNaN(glbCompCD))
	{
		if (cmbHavarot.getText()=='')
			document.thisForm.srh_company_press.value="1";
		search();
	}
	else
	{
	var COMP_NAME=new String();
	COMP_NAME=BuildString(6,glbCompCD.length);
	COMP_NAME+=glbCompCD;
	
	OpenCompTASE(sSite + COMP_NAME);
	}
}

function BuildString(len,howMany)
{
	var str=new String();
	for (var i=1;i<=len-howMany;i++)
		str+='0';
	return str;
		
}

function DisplayPrintControls(flag)
{
if (flag=='0') OpenPrintMenu();
else
{
//var timerID = null

if (document.getElementById("dpc").accessKey==1 || document.getElementById("dpc").accessKey==1){
	if (document.thisForm.view.value=='imptoday' || document.thisForm.view.value=='today')
		clearTimeout(timerID);
	document.getElementById("dpc").innerHTML='הסתר תפריט';
	strShowToolBar='<table width="100%" dir="rtl" border="0" cellpadding=0 cellspacing=0><tr align=right><td width="10">&nbsp;</td><td valign=bottom align=right width="24"><a href="javascript:void(0);" class="A4" onClick="CheckedAll(false);">נקה</a></td><td width="1"><font color="#BCBDBE">|</font></td><td align=right valign=bottom width="46" style="PADDING-RIGHT:10px"><a href="javascript:void(0);" class="A4" onClick="CheckedAll(true);">בחר הכל</a></td><td width="1"><font color="#BCBDBE">|</font></td><td align=left width="30"><a href="javascript:void(0);" class="A1" onClick="PrintReport(1);"><img src="img/hazeg_lifney_hadpasa.gif" border="0" WIDTH="15" HEIGHT="14"></a></td><td align=right width="80" valign=bottom><a href="javascript:void(0);" class="A4" onClick="PrintReport(1);">הצג לפני הדפסה</a></td><td width="1"><font color="#BCBDBE">|</font></td><td align=left width="30"><!--<a href="javascript:void(0);" class="A1" onClick="PrintReport(0);"><img src="img/print.gif" border="0" WIDTH="16" HEIGHT="14"></a>-->&nbsp;</td><td align=right valign=bottom width="34"><!--<a href="javascript:void(0);" class="A4" onClick="PrintReport(0);">הדפס</a>-->&nbsp;</td><td align=right width="10">&nbsp;</td><td width="1">&nbsp;</td><td align=left width="95"><a href="javascript:void(0);" class="A1" onClick="OpenPrintMenu();"><img src="img/hadpasa_merucezet.gif" border="0" WIDTH="21" HEIGHT="16"></a></td><td width="65" align=left valign=bottom><a href="javascript:void(0);" class="A4" onClick="OpenPrintMenu();">הדפסה&nbsp;מרוכזת</a></td><td width="5">&nbsp;</td></tr></table>';
	
	ChangeShow(strShowToolBar);
	
	document.getElementById("dToolBar").style.visibility="visible";
	document.getElementById("dToolBar").style.display="block";
	
	document.getElementById("dpc").accessKey=2;
	document.getElementById("dpc1").accessKey=2;
}
else
{
	if (document.thisForm.view.value=='imptoday' || document.thisForm.view.value=='today')
		timerID=setTimeout('document.thisForm.submit()', 300000);
	document.getElementById("dpc").innerHTML='תפריט הדפסה';
	
	document.getElementById("dToolBar").innerHTML='<img src="img/spacer.gif" height=1 width="1">';
	document.getElementById("TOTPAGE").innerHTML='';
	document.getElementById("dToolBar").style.display="none";
	document.getElementById("dToolBar").style.visibility="hidden";
	
	for (var i=0;i<document.thisForm.repTotal.value;i++)	
		document.getElementById("checkBoxTools"+i).style.visibility="hidden";
	
	document.getElementById("dpc").accessKey=1;
	document.getElementById("dpc1").accessKey=1;
}
//cross_el=document.getElementById? document.getElementById("dpcDiv"):document.all.descriptions
//cross_el.innerHTML='whichcontent'
}
}

function searchmon()
{
 var blnRivon="0";
 ref_str = 'indexmonrep.asp?view=money';

 
 if (document.thisForm.quarter[0].checked == "1")
	 ref_str += '&quarter='+document.thisForm.quarter[0].value;
 else if (document.thisForm.quarter[1].checked == "1")	
	 ref_str += '&quarter='+document.thisForm.quarter[1].value;
 else if (document.thisForm.quarter[2].checked == "1") 
	 ref_str += '&quarter='+document.thisForm.quarter[2].value;
 else if (document.thisForm.quarter[3].checked == "1")	
	 ref_str += '&quarter='+document.thisForm.quarter[3].value;
 else
	{
	blnRivon="-1";
	alert("בחר רבעון");
	}
	//ref_str += '&quarter=-1';
 ref_str += '&monyear='+document.thisForm.monyear[document.thisForm.monyear.selectedIndex].value;
 
 if (blnRivon=="0") window.location.href = ref_str;
}

function PutNbrInForm()
{
	var iTotal=0;
	var intPos=0;
	var str=new String();
	
	str=GetCookie("REP_CODE");
	Arr=str.split(',');
	iTotal = Arr.length;
	
	if (document.all)
		PageNbr.innerText=iTotal;
	else
		PageNbr.textContent=iTotal;
	frmPrint.ForPrint.value=str;
}

function PrintRep(Show)
{
	if (Pressed==0)
	{
	Pressed=1;
	frmPrint.Show.value=Show;
	frmPrint.GoToPrint.value=true;
	frmPrint.submit();
	}
}

function drawKranotSons(fatherSelected,toReset){
	var fatherIndex;
	var selIdxSon=0;
	
	var arrKranotMessage = new Array()
	arrKranotMessage[0]=":בחר קרן";
	arrKranotMessage[1]=":בחר מנהל";
	arrKranotMessage[2]=":בחר נאמן";
	arrKranotMessage[3]=":בחר סיווג";
	arrKranotMessage[4]=":בחר קרן";
	
	var arrKranotUnderMessage = new Array()
	arrKranotUnderMessage[0]="פרטי קרן";
	arrKranotUnderMessage[1]="נתוני קרנות למנהל";
	arrKranotUnderMessage[2]="נתוני קרנות לנאמן";
	arrKranotUnderMessage[3]="רשימת קרנות";
	arrKranotUnderMessage[4]="פרטי קרן";
	
	var arrKranotIncludeMessage = new Array()
	arrKranotIncludeMessage[0]="רק דיווחים ספיציפים לקרן נאמנות";
	arrKranotIncludeMessage[1]="רק דיווחים ספיציפים למנהל הקרן";
	arrKranotIncludeMessage[2]="רק דיווחים ספיציפים לנאמן";
	arrKranotIncludeMessage[3]="רק דיווחים ספיציפים לקרן נאמנות";
	arrKranotIncludeMessage[4]="רק דיווחים ספיציפים לקרן נאמנות";
	
	var arrKranotTipMessage = new Array()
	arrKranotTipMessage[0]="סמן תיבה זו על מנת להציג רק דיווחים המתייחסים לקרן שבחרת ללא דיווחים כללים של מנהל הקרן או הנאמן";
	arrKranotTipMessage[1]="סמן תיבה זו על מנת להציג רק דיווחים המתייחסים למנהל הקרן שבחרת ללא דיווחים המתייחסים לקרנות מסוימות";
	arrKranotTipMessage[2]="סמן תיבה זו על מנת להציג רק דיווחים המתייחסים לנאמן הקרן שבחרת ללא דיווחים המתייחסים לקרנות מסוימות";
	arrKranotTipMessage[3]="סמן תיבה זו על מנת להציג רק דיווחים המתייחסים לקרן שבחרת ללא דיווחים כללים של מנהל הקרן או הנאמן";
	arrKranotTipMessage[4]="סמן תיבה זו על מנת להציג רק דיווחים המתייחסים לקרן שבחרת ללא דיווחים כללים של מנהל הקרן או הנאמן";
	
	for(i=0; i<document.getElementById("kranotGroup").length;i++){
		if (document.getElementById("kranotGroup").options[i].value==fatherSelected) fatherIndex=i;
	}
	if (document.all)
	{
		txtKranotChange.innerText=arrKranotMessage[fatherIndex];
		txtFundUnderImg.innerText=arrKranotUnderMessage[fatherIndex];		
		txtKranotInclude.innerText=arrKranotIncludeMessage[fatherIndex];		
	}else
	{
		txtKranotChange.textContent=arrKranotMessage[fatherIndex];
		txtFundUnderImg.textContent=arrKranotUnderMessage[fatherIndex];		
		txtKranotInclude.textContent=arrKranotIncludeMessage[fatherIndex];		
	}
	gHelpFund=arrKranotTipMessage[fatherIndex];		
	
	changeKranotSpan(fatherSelected,toReset);
	
	if (toReset)
	{
		document.thisForm.arg_comp.value="";
		cmbHavarot.text.value="";
		cmbHavarot.hidden.value="";
		document.thisForm.srh_sivug.value="-1";
		document.thisForm.srh_comp_cd.value="-1";
	}	
}

function changeKranotSpan(srcNm,toReset)
{
	
	//document.thisForm.srh_anaf.selectedIndex=0;
	document.getElementById("dNetuneMisharText").style.display = "block";
	document.getElementById("dNetuneMisharGif").style.display = "block";
	document.getElementById("dNetuneMisharText").style.visibility="visible";
	document.getElementById("dNetuneMisharGif").style.visibility="visible";
	document.getElementById("b2").style.width="33%";
	document.getElementById("b3").style.width="34%";
	document.getElementById("b33").style.width="34%";
	document.getElementById("b4").style.width="33%";
	document.getElementById("b22").style.align="right";
	
	document.getElementById("txtReportUnderImg").style.left="0px";
	document.getElementById("txtFundUnderImg").style.left="0px";
		
	if (srcNm!="allSivug")
	{
		document.getElementById("cmbH").style.display="block";
		document.getElementById("cmbH").style.visibility="visible";
		document.getElementById("PrintSivugSelect").style.visibility="hidden";
		document.getElementById("PrintSivugSelect").style.display="none";
		cmbHavarot.text.disabled=false
		if (toReset)
		{
			cmbHavarot.text.value="";
			cmbHavarot.hidden.value="";
			document.thisForm.arg_comp.value="";
			cmbHavarot.changeOptions(document.thisForm.kranot_group[document.thisForm.kranot_group.selectedIndex].value);
		}
	}	
	else
	{
		document.getElementById("cmbH").style.visibility="hidden";
		document.getElementById("PrintSivugSelect").style.visibility="visible";
		document.getElementById("PrintSivugSelect").style.display="block";
		document.getElementById("cmbH").style.display="none";
	}
	if (srcNm!="allFund" && srcNm!="allFundNbr")
	{
		document.getElementById("dNetuneMisharText").style.display = "none";
		document.getElementById("dNetuneMisharGif").style.display = "none";
		document.getElementById("dNetuneMisharText").style.visibility="hidden";
		document.getElementById("dNetuneMisharGif").style.visibility="hidden";
		document.getElementById("b3").style.width="0%";
		document.getElementById("b33").style.width="0%";
		document.getElementById("b2").style.width="50%";
		document.getElementById("b4").style.width="50%";
		if (document.all)
		{
			document.getElementById("txtReportUnderImg").style.left="20px";
			document.getElementById("txtFundUnderImg").style.left="20px";
		}
	}
	return false;
}

function change(obj,fatherSelected, sonsSelected) {
	//var initialLength = document.thisForm.fathers.length;
	var fatherIndex, i, selPos=0;
	
	for(i=0; i<document.thisForm.fathers.length;i++){
		if (document.thisForm.fathers[i].value==fatherSelected) document.thisForm.fathers.selectedIndex=i
	}
	fatherIndex = document.thisForm.fathers.selectedIndex;
	document.thisForm.sons.length = sons[fatherIndex].length;	
    
    var firstOption = new Option("כל הארועים");
    firstOption.value = getSelectedValue(obj);
    document.thisForm.sons.options[0] = firstOption;

	for(i = 0; i < sons[fatherIndex].length; i++) {
		  var op = new Option(sons[fatherIndex][i]);
		  op.value = sonsValue[fatherIndex][i];
		  var e=sonsValue[fatherIndex][i];
		  intPos=e.indexOf('-')+1;
		  if (parseInt(sonsSelected)==parseInt(e.substr(intPos,e.length-intPos))) selPos=i+1;
		  document.thisForm.sons.options[i + 1] = op; 
	}
	
	document.thisForm.sons.selectedIndex = selPos;
	assignSonValue(document.thisForm.sons);
}

function assignSonValue(obj) {
	if (NotCompleteState==true)	ScrollToSearch();
	document.thisForm.srh_event.value = getSelectedValue(obj);
}

function assignKranotSonValue(obj) {
	if (NotCompleteState==true)	ScrollToSearch();
	document.thisForm.srh_comp_cd.value = getSelectedValue(obj);
}
// The following function returns the value of a chosen option in a <select>
function getSelectedValue(obj) {
	return obj.options[obj.selectedIndex].value;
}

function change(obj,fatherSelected, sonsSelected) {
	//var initialLength = document.thisForm.fathers.length;
	var fatherIndex, i, selPos=0;
	
	for(i=0; i<document.thisForm.fathers.length;i++){
		if (document.thisForm.fathers[i].value==fatherSelected) document.thisForm.fathers.selectedIndex=i
	}
	fatherIndex = document.thisForm.fathers.selectedIndex;
	document.thisForm.sons.length = sons[fatherIndex].length;	
    
    var firstOption = new Option("כל הארועים");
    firstOption.value = getSelectedValue(obj);
    document.thisForm.sons.options[0] = firstOption;

	for(i = 0; i < sons[fatherIndex].length; i++) {
		  var op = new Option(sons[fatherIndex][i]);
		  op.value = sonsValue[fatherIndex][i];
		  var e=sonsValue[fatherIndex][i];
		  intPos=e.indexOf('-')+1;
		  if (parseInt(sonsSelected)==parseInt(e.substr(intPos,e.length-intPos))) selPos=i+1;
		  document.thisForm.sons.options[i + 1] = op; 
	}
	document.thisForm.sons.selectedIndex = selPos;
	assignSonValue(document.thisForm.sons);
}

function ValidateCheck (FieldName,FormatType_2,FromDay,UntilDay,FromMonth,UntilMonth, FromYear,UntilYear,isNulluble)
{

F_DATE =  "arr = new Array('1','31','28','31','30','31','30','31','31','30','31','30','31');" + "\n" 
F_DATE += "errend = \"\"\n"
F_DATE += "d = document.thisForm." + FieldName + "_day.options[document.thisForm." + FieldName + "_day.selectedIndex].value\n"
F_DATE += "m = document.thisForm." + FieldName + "_mon.options[document.thisForm." + FieldName + "_mon.selectedIndex].value\n"
F_DATE += "y = document.thisForm." + FieldName + "_yr.options[document.thisForm." + FieldName + "_yr.selectedIndex].value\n"
F_DATE += "d++; d--; m++; m--; y++; y--;\n"

F_DATE += "retToNull = 0;\n"
if ( isNulluble == 1)
{ 
	F_DATE += "	if ( d == 0 && m == 0 && y == 0  ){ d=" + FromDay + "; m=" + FromMonth + "; y=" + FromYear + "; retToNull = 0;}\n"
	F_DATE += " if ( d == 0 && m == 0 ){ d=" + FromDay + "; m=" + FromMonth + "; retToNull = 0;}\n"
	F_DATE += "	if ( y == 0 && m == 0 ){ y=" + FromYear + "; m=" + FromMonth + "; retToNull = 0;}\n"
	F_DATE += "	if ( d == 0 && y == 0 ){ d=" + FromDay + "; y=" + FromYear + "; retToNull = 0;}\n"
	
	F_DATE += " if ( retToNull == 0 )\n"
	F_DATE +="{\n"	
	F_DATE += "document.thisForm." + FieldName + "_day.selectedIndex=d;\n" 
	F_DATE += "document.thisForm." + FieldName + "_mon.selectedIndex=m;\n"

	F_DATE += "document.thisForm." + FieldName + "_yr.selectedIndex=0; \n" 
	F_DATE += "while(document.thisForm." + FieldName + "_yr[document.thisForm." + FieldName + "_yr.selectedIndex].value != y)\n" 
	F_DATE += "{\n" 
	F_DATE += "document.thisForm." + FieldName + "_yr.selectedIndex++ \n" 
	F_DATE += "}\n" 
	F_DATE += "}\n"
	
	F_DATE += "	if ( d == 0 || m == 0 || y == 0  ){ retToNull=1;}\n"
}	

F_DATE += "if ( retToNull == 0 )\n"
F_DATE +="{\n"
F_DATE += "if(!((m == 2 && d <= 29 && (y % 4 == 0) ) || ( d <= arr[m] && m < 13))){errend = \"התאריך הנבחר לא קיים\";}\n"
F_DATE +="}\n";


F_DATE_1 = "if ( retToNull == 0 )\n"
F_DATE_1 +="{\n"
F_DATE_1 +=  "dFr =" + FromDay + ";\n" 
F_DATE_1 += "mFr =" + FromMonth + ";\n" 
F_DATE_1 += "yFr =" + FromYear + ";\n" 
F_DATE_1 += "dTo =" + UntilDay + ";\n" 
F_DATE_1 += "mTo =" + UntilMonth + ";\n" 
F_DATE_1 += "yTo =" + UntilYear + ";\n" 
F_DATE_1 += "if(d && m && y && errend) { document.thisForm." + FieldName + "_day.selectedIndex--;"
F_DATE_1 += "ValidateCheck('" + FieldName + "'," + FormatType_2 + "," + FromDay + "," + UntilDay + "," + FromMonth + "," + UntilMonth + "," + FromYear + "," + UntilYear + ")}\n"
F_DATE_1 += "error=0;\n" 
F_DATE_1 += "if(yFr > y || (yFr == y && mFr > m) || (yFr == y && mFr == m && dFr > d) )\n" 
F_DATE_1 += "{\n" 
F_DATE_1 += "document.thisForm." + FieldName + "_day.selectedIndex=dFr-1 \n" 
F_DATE_1 += "document.thisForm." + FieldName + "_mon.selectedIndex=mFr-1 \n" 
F_DATE_1 += "while(document.thisForm." + FieldName + "_yr[document.thisForm." + FieldName + "_yr.selectedIndex].value != yFr)\n" 
F_DATE_1 += "{\n" 
F_DATE_1 += "document.thisForm." + FieldName + "_yr.selectedIndex++ \n" 
F_DATE_1 += "}\n" 
F_DATE_1 += "ValidateCheck('" + FieldName + "'," + FormatType_2 + "," + FromDay + "," + UntilDay + "," + FromMonth + "," + UntilMonth + "," + FromYear + "," + UntilYear + ")}\n" 
F_DATE_1 += "if(yTo < y || (yTo == y && mTo < m) || (yTo == y && mTo == m && dTo < d) )\n" 
F_DATE_1 += "{\n" 
F_DATE_1 += "document.thisForm." + FieldName + "_day.selectedIndex=dTo-1 \n" 
F_DATE_1 += "document.thisForm." + FieldName + "_mon.selectedIndex=mTo-1 \n" 
F_DATE_1 += "while(document.thisForm." + FieldName + "_yr[document.thisForm." + FieldName + "_yr.selectedIndex].value != yTo)\n" 
F_DATE_1 += "{\n" 
F_DATE_1 += "document.thisForm." + FieldName + "_yr.selectedIndex--\n" 
F_DATE_1 += "}" + "\n" 
F_DATE_1 += "ValidateCheck('" + FieldName + "'," + FormatType_2 + "," + FromDay + "," + UntilDay + "," + FromMonth + "," + UntilMonth + "," + FromYear + "," + UntilYear + ")}\n" 
F_DATE_1 +="}\n"
F_DATE_1 +="else\n"
F_DATE_1 +="{\n"
F_DATE_1 +="document.thisForm." + FieldName + "_day.selectedIndex=0;\n"
F_DATE_1 +="document.thisForm." + FieldName + "_mon.selectedIndex=0;\n"
F_DATE_1 +="document.thisForm." + FieldName + "_yr.selectedIndex=0;\n"
F_DATE_1 +="}\n";

IntTime = "_time";
if (FormatType_2 == 18) IntTime = "";

F_TIME = "if ( retToNull == 0 )\n"
F_TIME +="{\n"
F_TIME +=  "d1=document.thisForm." + FieldName + IntTime + ".value.substring(0,1)\n" 
F_TIME += "d2=document.thisForm." + FieldName + IntTime + ".value.substring(1,2)\n" 
F_TIME += "d3=document.thisForm." + FieldName + IntTime + ".value.substring(2,3)\n" 
F_TIME += "d4=document.thisForm." + FieldName + IntTime + ".value.substring(3,4)\n" 
F_TIME += "d5=document.thisForm." + FieldName + IntTime + ".value.substring(4,5)\n" 
F_TIME += "switch (document.thisForm." + FieldName + ".value.length)\n" 
F_TIME += "{\n" 
F_TIME += "case 1:\n" 
F_TIME += "d2=d1; d1=d4=d5=0; break\n" 
F_TIME += "case 2:\n" 
F_TIME += "d4=d5=0; break\n" 
F_TIME += "case 3:\n" 
F_TIME += "d5=d3; d4=d2; d2=d1; d1=0; break\n" 
F_TIME += "case 4:\n" 
F_TIME += "d5=d4; d4=d3;\n" 
F_TIME += "if(d2 == \":\"){ d2=d1; d1=0; }\n" 
F_TIME += "break\n" 
F_TIME += "}\n"  
F_TIME += "if(d1 != \"0\" && d1 != \"1\" && d1 != \"2\") d1=2\n" 
F_TIME += "if(d2 != \"0\" && d2 != \"1\" && d2 != \"2\" && d2 != \"3\" && d2 != \"4\" && d2 != \"5\" && d2 != \"6\" && d2 != \"7\" && d2 != \"8\" && d2 != \"9\") d2=\"0\" \n" 
F_TIME += "if(d3 != \":\") d3=\":\" \n" 
F_TIME += "if(d4 != \"0\" && d4 != \"1\" && d4 != \"2\" && d4 != \"3\" && d4 != \"4\" && d4 != \"5\") d4=\"0\" \n" 
F_TIME += "if(d5 != \"0\" && d5 != \"1\" && d5 != \"2\" && d5 != \"3\" && d5 != \"4\" && d5 != \"5\" && d5 != \"6\" && d5 != \"7\" && d5 != \"8\" && d5 != \"9\") d5=\"0\" \n" 
F_TIME += "if(d1 == \"2\" && (d2 != \"0\" && d2 != \"1\" && d2 != \"2\" && d2 != \"3\")) d1=1 \n" 
F_TIME +="}\n"
F_TIME +="else\n"
F_TIME +="{\n"
F_TIME +="d1=d2=d3=d4=d5='';\n"
F_TIME +="}\n";


RSTR = "";

if(FormatType_2 < 9)
{
 INTERNAL_UPD = "if ( retToNull == 0 )\n"
 INTERNAL_UPD +="{\n"
 INTERNAL_UPD +="document.thisForm." + FieldName + ".value = y + '-' + m  + '-' + d  + ' ' + document.thisForm." + FieldName + "_time.value; " + "\n";
 INTERNAL_UPD +="}\n"
 INTERNAL_UPD +="else\n"
 INTERNAL_UPD +="{\n"
 INTERNAL_UPD +="document.thisForm." + FieldName + ".value = '' + document.thisForm." + FieldName + "_time.value; " + "\n";
 INTERNAL_UPD +="}\n";
 
 
 LAST_UPD = "document.thisForm." + FieldName + "_time.value = d1 + d2 + d3 + d4 + d5" + "\n" ; 
 LAST_UPD += "if ( retToNull == 0 )\n"
 LAST_UPD +="{\n"
 LAST_UPD += "document.thisForm." + FieldName + ".value = y + '-' + m  + '-' + d + ' ' + d1 + d2 + d3 + d4 + d5" + "\n";
 LAST_UPD +="}\n"
 LAST_UPD +="else\n"
 LAST_UPD +="{\n"
 LAST_UPD += "document.thisForm." + FieldName + ".value = '' + d1 + d2 + d3 + d4 + d5" + "\n";
 LAST_UPD +="}\n";
 
 RSTR = F_DATE + INTERNAL_UPD + F_DATE_1 + F_TIME + LAST_UPD;
}
else if(FormatType_2 != 18)
{
 INTERNAL_UPD = "if ( retToNull == 0 )\n"
 INTERNAL_UPD +="{\n" 
 INTERNAL_UPD += "document.thisForm." + FieldName + ".value = y + '-' + m  + '-' + d;\n";
 INTERNAL_UPD +="}\n"
 INTERNAL_UPD +="else\n"
 INTERNAL_UPD +="{\n" 
 INTERNAL_UPD += "document.thisForm." + FieldName + ".value = '';\n";
 INTERNAL_UPD +="}\n";
 LAST_UPD = INTERNAL_UPD;
 
 RSTR = F_DATE + INTERNAL_UPD + F_DATE_1 + LAST_UPD;
}
else
{
 LAST_UPD = "document.thisForm." + FieldName + ".value = d1 + d2 + d3 + d4 + d5" + "\n";
 
 RSTR = F_TIME + LAST_UPD;
}

eval(RSTR);
}

function Dosearch(){
	search();
}

function ClearForm(){

if (typeof(cmbHavarot)!='undefined')
{
document.getElementById("CompanyGroup").value="3000";
cmbHavarot.text.value="";
cmbHavarot.hidden.value="";
}
document.thisForm.srh_txt.value="";
document.thisForm.arg_comp.value="";
//min date
if (document.getElementById("srh_min_day"))
{
	arr=document.thisForm.srh_min_day.value.split("-");
	document.thisForm.srh_from_day.selectedIndex = arr[2]-1;
	document.thisForm.srh_from_mon.selectedIndex = arr[1]-1;
	for(var i=0;i< document.thisForm.srh_from_yr.length;i++)
		if (document.thisForm.srh_from_yr[i].value==arr[0])
			document.thisForm.srh_from_yr.selectedIndex=i;
	document.thisForm.srh_from.value=document.thisForm.srh_min_day.value;
}
//max date
if (document.getElementById("srh_max_day"))
{
	arr=document.thisForm.srh_max_day.value.split("-");
	document.thisForm.srh_until_day.selectedIndex = arr[2]-1;
	document.thisForm.srh_until_mon.selectedIndex = arr[1]-1;
	for(var i=0;i< document.thisForm.srh_until_yr.length;i++)
		if (document.thisForm.srh_until_yr[i].value==arr[0])
			document.thisForm.srh_until_yr.selectedIndex=i;
	document.thisForm.srh_until.value=document.thisForm.srh_max_day.value;
}
if (document.getElementById("srh_anaf")) 
	document.getElementById("srh_anaf").value=-1;

document.thisForm.srh_event.value=9999;

if (document.thisForm.view.value != 'bursa' && document.thisForm.view.value != 'kranot' && document.thisForm.view.value != 'search_b' && document.thisForm.view.value != 'search_k')
{
var id=9999;
	if (lastSelectedItem != null)
		{
			var tRow = document.getElementById(lastSelectedItem);		
			tRow.style.backgroundColor = '';
		}
	var tRow = document.getElementById(id);		
	tRow.style.backgroundColor = "#BDDBEF";
	lastSelectedItem = id;
	refreshTatEvents(9999,'9999');
	changeSpan('3000');	
}
else
{
	document.thisForm.sons.selectedIndex = 0;
	assignSonValue(document.thisForm.sons);
}	
document.thisForm.is_urgent.checked=false;
document.thisForm.is_urgent.value=0;

}

function OpenLastBack(url){
ret_back.href=url;
}

function swapClass(obj, cls) {
  obj.className = cls
}
function refreshCheckTatEvents(id,sonsSelected){
	if (NotCompleteState==true) ScrollToSearch();
	if (lastSelectedItem != null)
		{
			var tRow = document.getElementById(lastSelectedItem)		
			tRow.style.backgroundColor = ''
		}
	var tRow = document.getElementById(id)		
	tRow.style.backgroundColor = "#BDDBEF"
	lastSelectedItem = id
		
	var fatherIndex, i, selPos=0;
	
	fatherIndex = tRow.rowIndex;
	document.thisForm.sons.length = sons[fatherIndex].length;	
    
	var firstOption = new Option("כל הארועים");
	firstOption.value = id;
	document.thisForm.sons.options[0] = firstOption;

	for(i = 0; i < sons[fatherIndex].length; i++) {
		  var op = new Option(sons[fatherIndex][i]);
		  op.value = sonsValue[fatherIndex][i];
		  var e=sonsValue[fatherIndex][i];
		  intPos=e.indexOf('-')+1;
		  if (parseInt(sonsSelected)==parseInt(e.substr(intPos,e.length-intPos))) selPos=i+1;
		  document.thisForm.sons.options[i + 1] = op; 
	}
	document.thisForm.sons.selectedIndex = selPos;
	assignSonValue(document.thisForm.sons);
		
}


function refreshKranotTatEvents(id,sonsSelected){
	if (NotCompleteState==true) ScrollToSearch();
	if (lastSelectedItem != null)
		{
			var tRow = document.getElementById(lastSelectedItem)		
			tRow.style.backgroundColor = ''
		}
	var tRow = document.getElementById(id)		
	tRow.style.backgroundColor = "#BDDBEF"
	lastSelectedItem = id
		
	var fatherIndex, i, selPos=0;
	
	fatherIndex = tRow.rowIndex;
	
	document.thisForm.sons.length = sonsKranotEvents[fatherIndex].length;	
    
	var firstOption = new Option("כל הארועים");
	firstOption.value = id;
	document.thisForm.sons.options[0] = firstOption;

	for(i = 0; i < sonsKranotEvents[fatherIndex].length; i++) {
		  var op = new Option(sonsKranotEvents[fatherIndex][i]);
		  op.value = sonsKranotEventsValue[fatherIndex][i];
		  var e=sonsKranotEventsValue[fatherIndex][i];
		  intPos=e.indexOf('-')+1;
		  if (parseInt(sonsSelected)==parseInt(e.substr(intPos,e.length-intPos))) selPos=i+1;
		  document.thisForm.sons.options[i + 1] = op; 
	}

	document.thisForm.sons.selectedIndex = selPos;
	assignSonValue(document.thisForm.sons);
		
}

function swapTdClass(t,cName){
	t.className=cName;
	if (t.id.length==2)
		eval(t.id+t.id.substr(t.id.length-1,1)+'.className=cName;');
	else
		eval(t.id.substr(t.id.length-3,2)+'.className=cName;');
	return false;
}

function changeSpan(srcNm)
{
	cmbHavarot.text.value="";
	cmbHavarot.hidden.value="";
	document.getElementsByName("arg_comp")[0].value="";
	document.getElementsByName("srh_anaf")[0].selectedIndex=0;
	
	if (srcNm!="anafim")
	{
		if (document.all)
			document.getElementById("txtChange").innerText=":חברה";
		else
			document.getElementById("txtChange").textContent=":חברה";
		
		document.getElementById("cmbH").style.display="block";
		document.getElementById("cmbH").style.visibility="visible";
		document.getElementById("PrintAnafSelect").style.visibility="hidden";
		document.getElementById("PrintAnafSelect").style.display="none";
		cmbHavarot.changeOptions(document.getElementById("CompanyGroup").options[document.getElementById("CompanyGroup").selectedIndex].value);
	}	
	else
	{
		if (document.all)
			document.getElementById("txtChange").innerText=":בחר ענף";
		else
			document.getElementById("txtChange").textContent=":בחר ענף";
		
		document.getElementById("cmbH").style.visibility="hidden";
		document.getElementById("PrintAnafSelect").style.visibility="visible";
		document.getElementById("PrintAnafSelect").style.display="block";
		document.getElementById("cmbH").style.display="none";
	}
	return false;
}

function OpenMayaNew(a)
{ 
	if (a==0)
	{
	var str='';
	var strWeek='';
	
	str=GetCookie("DailyMayaBrowser");
	strWeek=GetCookie("DailyMayaBrowserWeek");
	if (isNaN(strWeek) || strWeek=='') strWeek=0;
	if (str=='1' || strWeek>4) return 0;
	}
	NewWindow('mayaNew.asp?tas='+a,'mayanew','470','270','no','center');
}

function OpenMayaRss(a)
{ 
	NewWindow('mayarss.asp?rss='+a,'mayarss','400','460','no','center');
}
function getCordsElement(obj)
{
//this function set the coordination of the element
	var curObject=obj;
	
	xposition=0;
	yposition=0;
	do
	{
		//if (curObject.tagName != 'INPUT') 
		//{
			//alert(curObject.tagName+'--'+curObject.offsetLeft);
			yposition += curObject.offsetTop;
		//}
		curObject=curObject.offsetParent;
	}
	while(curObject.tagName!='BODY');
	return yposition;
	//if (obj.dir=="rtl")
	//	xposition+=obj.text.offsetWidth-obj.div.offsetWidth;
	//if (obj.form=='thisForm1') yposition -=leftDiv.scrollTop;
	
}

function openMayaMessage(x){
	if (x==0)
	{
	var str='';
	
	str=GetCookie("explorer");
	if (str=='maya') return 0;
	}
	NewWindow('MayaMessage.asp','MayaMessage','220','210','no','center');
}

function showFullPage(blnVisible){
	
	if (!blnVisible)
	{
		RightDiv.innerHTML = RightSide;
		document.all("tdRightSide").style.width=207;
		document.all("tblFotter").height="77%";
		document.all.dFullPage.innerText="פתח מסך מלא";
		divFotter.style.height="77%";
		divFotter.style.top="103px";
		divHeader.style.visibility="visible";
		divHeader.style.height="103px";
	}
	else
	{
		RightDiv.innerHTML = '';
		divHeader.style.visibility="hidden";
		divHeader.style.height="0px";
		document.all("tblFotter").height="100%";
		divFotter.style.height="100%";
		divFotter.style.top="0px";
		document.all("tdRightSide").style.width=0;
		document.all.dFullPage.innerText="הצג מסך רגיל";
	}
	blnShowFullPage=!blnShowFullPage
}
function swapTdPrintClass(s,cName,num){
	var mytab="";
	for (var i=1; i<3; i++)
	{
	mytab="tab"+i;
	if (document.all(mytab)) document.all(mytab).className="PrintNotPress";
	if (i==num) document.all(mytab).className="PrintPress";
	}

	if (eval(s+'.id')=='tab1')
	{
		if (document.all("divPrintNewWin"))	divPrintNewWin.style.visibility="hidden";
		if (document.all("divTop"))	divTop.style.visibility="hidden";
		pFileSize.innerText=vPdfFileSize+'K';
		document.all("tdHtmH").style.height='0%';
		document.all("tdPdfH").style.height='100%';	
	}
	if (eval(s+'.id')=='tab2')
	{
		divPrintNewWin.style.visibility="visible";
		divTop.style.visibility="visible";
		pFileSize.innerText=vHtmFileSize+'K';
		document.all("tdHtmH").style.height='100%';
		document.all("tdPdfH").style.height='0%';	
		document.all("1").src=htmFile;
	}

	return false;	
}

function printPdfOrHtm(){
	if (document.all("tab2").className=="PrintPress")
	{
		//document.domain="tase.co.il"
		window.frames('1').focus();
		window.frames('1').print();
	}
	else
		pdf1.PrintAll();
	return false;
}

function scrollUp(){
	if (document.all("tab2").className=="PrintPress")
	{
		document.domain="tase.co.il"
		window.frames('1').focus();
		window.frames('1').scrollTo(0,0);
	}
	
	return false;
}

function showTipPrintText(){
var printMessage
printMessage='<tr><td align="center">ע"מ להימנע מחיתוך השוליים בהדפסה</td></tr>';
printMessage+='<tr><td align="center">File -> Page Setup בחר בתפריט</td></tr>';
printMessage+='<tr><td align="center">.הקטן שוליים ימניים ושמאלים ל- 3 מ"מ ואשר</td></tr>';
printMessage+='<tr><td align="center">הגדרה זו נשמרת גם לאחר צאתך מהדפדפן</td></tr>';
printMessage+='<tr><td align="center">.ואין צורך להגדירה שוב</td></tr>';
if (document.all&&document.readyState=="complete"){
	document.all.toolTipPrintText.innerHTML='<table cellpadding=0 cellspacing=0 border=0 width="100%" height="100%">'+printMessage+'</table>';
	document.all.toolTipPrintText.style.pixelLeft=event.clientX+document.body.scrollLeft+10;
	document.all.toolTipPrintText.style.pixelTop=event.clientY+document.body.scrollTop+10;
	document.all.toolTipPrintText.style.visibility="visible";
}
}
function hideTipPrintText(){
	if (document.all)
	document.all.toolTipPrintText.style.visibility="hidden";
}
function showTipNilveDescText(s){
var printMessage
printMessage='<tr><td align="center">'+s+'</td></tr>';
if (document.all&&document.readyState=="complete" && s!=''){
	document.all.toolTipPdfDescText.innerHTML='<table cellpadding=0 cellspacing=0 border=0 width="100%" height="100%">'+printMessage+'</table>';
	document.all.toolTipPdfDescText.style.pixelLeft=event.clientX+document.body.scrollLeft+10;
	document.all.toolTipPdfDescText.style.pixelTop=event.clientY+document.body.scrollTop-40;
	document.all.toolTipPdfDescText.style.visibility="visible";
}
}
function hideTipNilveDescText(){
	if (document.all)
	document.all.toolTipPdfDescText.style.visibility="hidden";
}
function BlinkTxt() {
    if(document.getElementById && document.all)
    {
	obj = document.getElementsByTagName("blink");
    	for (var i=0; i<obj.length; i++)
    		if (obj[i].style.visibility=="hidden") 
    		{
			obj[i].style.visibility="visible";
		}
    		else 
			obj[i].style.visibility="hidden";
		}
	setTimeout('BlinkTxt()',750);
}
function showTashlumim(t,flag){
	if (typeof(flag)!='undefined')
		t.href="tashlumim_moadim.asp?view=tashlumim&SecendaryView=TashlumimMoadim&sugim=&sort=3&desc1=asc&desc2=asc&desc3=asc&CompanyNm="+cmbHavarot.getText()+"&CompanyCd=&MainGroupCd=&company_group="+thisForm.company_group[thisForm.company_group.selectedIndex].value;
	else
		window.location.href="tashlumim_moadim.asp?view=tashlumim&SecendaryView=TashlumimMoadim&sugim=&sort=3&desc1=asc&desc2=asc&desc3=asc&CompanyNm="+cmbHavarot.getText()+"&CompanyCd=&MainGroupCd=&company_group="+thisForm.company_group[thisForm.company_group.selectedIndex].value;
}
function OpenReportsSearch(th,comp_nm,comp_cd,dt_from,dt_until){
	var compLink='index.asp?view=search';
	compLink+='&company_group=3000';
	compLink+='&arg_comp=' + comp_nm;
	compLink+='&srh_comp_lb=' + comp_cd;
	compLink+='&srh_from=' + dt_from;
	compLink+='&srh_until=' + dt_until;
	compLink+='&srh_anaf=-1&srh_event=9999&all_reports=1&is_urgent=0';
	th.href=compLink;
}
function OpenFundReportsSearch(th,comp_nm,comp_cd,dt_from,dt_until,s_type){
	var fundLink='indexkrnmsg.asp?view=search_k'
	fundLink+='&kranot_group='+ s_type;
	fundLink+='&arg_comp=' + comp_nm;
	fundLink+='&srh_from=' + dt_from;
	fundLink+='&srh_until=' + dt_until;
	fundLink+='&srh_event=-1';
	fundLink+='&srh_comp_cd=' + comp_cd;
	fundLink+='&include_fund=';
	th.href=fundLink;
}

function showTheBorder(obj_id,action){
	if(action)
        	obj_id.className='inputFocus';
	else
        	obj_id.className='input1';
	
}

function showLoginTheBorder(obj_id,action){
	if(action)
        	obj_id.className='inputFocus2';
	else
        	obj_id.className='input2';
	
}

function showTheBorderA(obj_id,className){
	obj_id.className=className;
}
function openFullScreen(URL){
	window.open(URL,'Full','fullscreen=yes,scrollbars=yes,channelmode=1');
}

function OpenFund(){
	var str;
	
	if ((cmbHavarot.getValue()==0 || cmbHavarot.getValue()==-1) && document.thisForm.kranot_group[document.thisForm.kranot_group.selectedIndex].value!="allSivug"){
		alert('נא לבחור מן הרשימה');
		return false;
	}
	var strVal=cmbHavarot.getValue();	
	
	switch(document.thisForm.kranot_group[document.thisForm.kranot_group.selectedIndex].value) {
		case "allFund":
			str="fundDetails.asp?FundCd="+strVal;
			break;
		case "allManager":
			str="fundList.asp?srh_fund_manager_cd="+strVal;
			break;
		case "allTrustee":
			str="fundList.asp?srh_fund_trustee_cd="+strVal;
			break;
		case "allSivug":
			str="fundList.asp?srh_sivug="+document.all("srh_sivug").value;
			break;
		case "allFundNbr":
			str="fundDetails.asp?FundCd="+strVal;
			break;

	}
	
	if (!isNaN(strVal)) window.location.href=str;
}
function changeFontSize(cSize){
	function CalcFontSize(obj,changeSize,minSize,maxSize,defaultSize){
		var indexFontSize;
		
		if (typeof(obj.item) == 'undefined'){
			indexFontSize = parseInt(obj.currentStyle.fontSize.replace("pt",""));
		}else{
			if (obj.item(0).style.fontSize=="")
				obj.item(0).style.fontSize="8pt";
			indexFontSize = parseInt(obj.item(0).style.fontSize.replace("pt",""));
		}
		indexFontSize = changeSize + (isNaN(indexFontSize) ? defaultSize : indexFontSize);
		indexFontSize = Math.max(minSize,indexFontSize );
		indexFontSize = Math.min(maxSize,indexFontSize );
		if (typeof(obj.item) == 'undefined'){
			obj.style.fontSize = indexFontSize+"pt";		
		}else{
			for(i=0;i< obj.length;i++){
				obj.item(i).style.fontSize = indexFontSize+"pt";
			}
		}	
	}
	CalcFontSize(document.all("CompNmHref"),cSize,8,12,8);
	CalcFontSize(document.all("SubjectHref"),cSize,8,12,8);
	CalcFontSize(document.all("DateHref"),cSize,7,11,7);
	
	return;
}

function refreshTatEvents(id,sonsSelected){
	if (NotCompleteState==true) ScrollToSearch();
	if (lastSelectedItem != null)
		{
			var tRow = document.getElementById(lastSelectedItem)		
			tRow.style.backgroundColor = ''
		}
		
	var tRow = document.getElementById(id)		
	tRow.style.backgroundColor = "#BDDBEF"
	
	lastSelectedItem = id
	
	var fatherIndex, i;
	
	fatherIndex = tRow.rowIndex;

	if (typeof(sonsSelected)!='undefined')
		if (sonsSelected != id)
			TAT_EVENT = '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>כל האירועים<font></td><td align=right><input style="height:12; width:12;" type=checkbox id="chkEvent1" name="chkEvent" onClick="uncheckEvent('+id+');" value="9999"></td></tr>';
		else
			TAT_EVENT = '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>כל האירועים<font></td><td align=right><input style="height:12px; width:12px;" type=checkbox id="chkEvent1" name="chkEvent" onClick="uncheckEvent('+id+');" value="9999" checked></td></tr>';
	else
		TAT_EVENT = '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>כל האירועים<font></td><td align=right><input style="height:12px; width:12px;" type=checkbox id="chkEvent1" name="chkEvent" onClick="uncheckEvent('+id+');" value="9999" checked></td></tr>';
		
	var strEventCd; 

	for(i = 0; i < sons[fatherIndex].length; i++) {
		  isChecked="";
		  var e=sonsValue[fatherIndex][i];
		  intPos=e.indexOf('-')+1;
		  strEventCd = sonsValue[fatherIndex][i] 
		  if (id == 9999)
			strEventCd = strEventCd.replace(strEventCd.substring(0,strEventCd.indexOf("-")),"9999");
		
		  if (typeof(sonsSelected)!='undefined')
			if (isTatEventExist(sonsSelected,e.substr(intPos,e.length-intPos)))
				TAT_EVENT+= '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>'+sons[fatherIndex][i].substring(0,19)+'<font></td><td align=right><input style="height:12px; width:12px;" type=checkbox id="chkEvent1" name="chkEvent" onClick="assignEventValue();" value='+strEventCd+' checked></td></tr>';
			else
				TAT_EVENT+= '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>'+sons[fatherIndex][i].substring(0,19)+'<font></td><td align=right><input style="height:12px; width:12px;" type=checkbox id="chkEvent1" name="chkEvent" onClick="assignEventValue();" value='+strEventCd+'></td></tr>';
		  else
		    TAT_EVENT+= '<tr style="line-height:13px"><td width=110 align=right nowrap><font class=txtTatEvent>'+sons[fatherIndex][i].substring(0,19)+'<font></td><td align=right><input style="height:12px; width:12px;" type=checkbox id="chkEvent1" name="chkEvent" onClick="assignEventValue();" value='+strEventCd+'></td></tr>';
	}
	if (document.all)
		document.getElementById("divEvent").innerHTML = '<table width=118 cellspacing="0" cellpadding="1" border=0 dir=ltr>'+TAT_EVENT+'</table>';
	else
		document.getElementById("divEvent").innerHTML = '<table width=108 cellspacing="0" cellpadding="0" border=0 dir=ltr>'+TAT_EVENT+'</table>';
	if (typeof(sonsSelected)!='undefined' && id != sonsSelected && id != 9999)
		document.thisForm.srh_event.value = id+"-"+sonsSelected;
	else
		document.thisForm.srh_event.value = id;
		
	document.getElementById("divEvent").scrollTop = 0;
}
function isTatEventExist(sonsSelected,valToSearch){
	var arrTatEvent=sonsSelected.split(',');
	for (var i=0;i<arrTatEvent.length;i++){
		if (valToSearch == arrTatEvent[i]) return true;
	}
	return false;
}
function assignEventValue(){
	if (NotCompleteState==true)	ScrollToSearch();
	document.thisForm.srh_event.value = getEventSelectedValue();
}
function getEventSelectedValue(){
	var strRet='';
	var intEvent = 0;
	var objCheckEvent = document.getElementsByName("chkEvent");
	
	for(var i=1;i< objCheckEvent.length;i++){
		var c = objCheckEvent[i];
		
		if (c.checked)
		{
			intEvent+=1;
			if (strRet != '')
				strRet = strRet + c.value.substring(c.value.indexOf('-')+1,c.value.length) +",";
			else
				strRet = strRet + c.value+",";
		}
	}
	
	if (intEvent==0){
		objCheckEvent[0].checked = true;
		strRet = objCheckEvent[1].value.substring(0,objCheckEvent[1].value.indexOf('-'));
	}else{
		objCheckEvent[0].checked = false;
		if (strRet.length>0) strRet = strRet.substring(0,strRet.length-1);
	}
	
	return strRet;
}
function uncheckEvent(id){
	var objCheckEvent = document.getElementsByName("chkEvent");
	
	for(var i=1;i< objCheckEvent.length;i++)
		objCheckEvent[i].checked=false;
	
	objCheckEvent[0].checked=true;
	document.getElementsByName("srh_event").value=id;
}		

function showContinueReport(tImg,myObject)
{
	if (document.all[myObject].style.display == 'none')
	{
		tImg.childNodes(0).src = "imgr/home/minus.png"
		document.all[myObject].style.display = 'block';
	}
	else
	{
		tImg.childNodes(0).src = "imgr/home/plus.png"
		document.all[myObject].style.display = 'none';
	}
}

function getFundSivug(listNm, listType, listParam)
{
	removeFundSivugSelectItem(listNm);
	
	var http = getHTTPObjects();
	http.open("GET","GetFundValues.asp?ListType=" + listType+"&ListParam="+listParam,false);
	http.send(null);
	
	if (http.status==200)
		getFundData(listNm,http.responseText);			
}

function getHTTPObjects() {
    var obj;
	var xml = new Array();
	xml[0] = "Microsoft.XMLHTTP";
	xml[1] = "MSXML2.XMLHTTP.5.0";
	xml[2] = "MSXML2.XMLHTTP.4.0";
	xml[3] = "MSXML2.XMLHTTP.3.0";
	xml[4] = "MSXML2.XMLHTTP";
	xml[5] = "WinHttp.WinHttpRequest.5";
	xml[6] = "WinHttp.WinHttpRequest.5.1";
	if (window.ActiveXObject) {
	for (var i=0; i<xml.length; i++) {
	try {
	obj = new ActiveXObject(xml[i]);
	break;
	} catch(e) {
	obj = null;
	}
	}
	} else if(window.XMLHttpRequest) {
	try {
	obj = new XMLHttpRequest();
	} catch(e) {
	obj = null;
	}
	}
	return obj;
}
function removeFundSivugSelectItem(lstName)
{
	var lst = document.getElementById(lstName);
	lst.options.length = 0;
	
}

function getFundData(listNm,s)
{
	var vals = s.split("~");

	for (var i=0; i<vals.length-1; i++)
	{
		var pair = vals[i].split("|");
		var op = new Option(pair[0], pair[1], false, false);
		var sel = document.getElementById(listNm);
		sel.options[sel.length] = op;
		
	}
	
	if (vals.length>1)
	{
		document.getElementById(listNm).selectedIndex=0;
		if (document.all)
			document.getElementById(listNm).fireEvent('onchange');
		else
		{
			var control = document.getElementById(listNm);
			var changeEvent = window.document.createEvent("MouseEvent"); 
			changeEvent.initEvent("change", false, true); 
			control.dispatchEvent(changeEvent); 
		}
	}
}

function refreshSivugList()
{
	getFundSivug("Sivug1","title1","");
	getFundSivug("FundTax","fund_tax_status","");
	getFundSivug("PHMenayot","ph_menayot","");
	getFundSivug("PHMatach","ph_matach","");
	getFundSivug("YehidotCoin","yehidot_coin","");
}
function findValAndSelect(listNm,sValue)
{
	var lst = document.getElementById(listNm);
	for(i=0; i<lst.length;i++){
		if (lst[i].value==sValue) lst.selectedIndex=i
	}
	
}
function ClearFundForm()
{
	if (typeof(cmbHav)!='undefined')
	{
		cmbHav.text.value="";
		cmbHav.hidden.value="";
	}
	if (typeof(cmbHavL)!='undefined')
	{
		cmbHavL.text.value="";
		cmbHavL.hidden.value="";
	}
	document.all("strSivugCode").value="";		
	document.co.Sivug1.selectedIndex=0;
	document.co.Sivug2.selectedIndex=0;
	document.co.Sivug3.selectedIndex=0;
	fireSivugChange("Sivug1");
	fireSivugChange("Sivug2");
	fireSivugChange("Sivug3");
	document.co.FundTax.selectedIndex=0;
	document.co.PHMenayot.selectedIndex=0;
	document.co.PHMatach.selectedIndex=0;
	document.co.YehidotCoin.selectedIndex=0;
	document.co.YehidotCoin.disabled=true;
	
	for (var i=1; i <= 7; i++) 
		eval("document.co.cb"+i+".checked=false");
}
function fireSivugChange(listNm)
{
	if (document.all)
		document.getElementById(listNm).fireEvent('onchange');
	else
	{
		var control = document.getElementById(listNm);
		var changeEvent = window.document.createEvent("MouseEvent"); 
		changeEvent.initEvent("change", false, true); 
		control.dispatchEvent(changeEvent); 
	}
}
function showHearaText(divi){
if (document.all&&document.readyState=="complete"){
	eval('document.all.'+divi+'.style.display='+"'block'");
	eval('document.all.'+divi+'.style.visibility='+"'visible'");
}
else
{
	document.getElementById(divi).style.display="block";
	document.getElementById(divi).style.visibility="visible";
}
}