<!--
//window.captureEvents(Event.UNLOAD)

//Generic Drag Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code and terms of usage,
//visit http://www.dynamicdrive.com
var nottoolbar = false
var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

var ie=document.all
var ns6=document.getElementById&&!document.all

var dragapproved=false
var z,x,y

function move(e){

if (dragapproved){
z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.className!="drag"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className=="drag"){
dragapproved=true
z=firedobj
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
//document.onmousedown=drags
//document.onmouseup=new Function("dragapproved=false")
//-->

///////////////////////////////// start windows application//////////////////////////////////


var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? top.document.documentElement : top.document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}

}

function initializedrag(e){

offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height,title){
if (!ie5&&!ns6)
window.open(url,"thepage","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="60px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
document.getElementById("dwindowtitle").innerText = title;
//document.Frames['bottomFrame'].length);

}
function loadHiddenWindow(width,height,title){
if (!ie5&&!ns6)
window.open(url,"thepage","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="60px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
}
document.getElementById("dwindowtitle").innerText = title;
//document.Frames['bottomFrame'].length);

}
function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
//alert(iecompattest().clientWidth+"px")
document.getElementById("maxname").setAttribute("src","imgsrc/restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth-30+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight-12+"px"
parent.document.getElementById('cframe').style.display=''
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","imgsrc/max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
parent.document.getElementById('cframe').style.display=''
}

document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
parent.document.getElementById('cframe').style.display=''
}

function minimize(){
if (minrestore==0){
minrestore=1 //maximize window
//alert(iecompattest().clientWidth+"px")
document.getElementById("maxname").setAttribute("src","imgsrc/restore.gif")
//document.getElementById("dwindow").style.width=ns6? "5px" : "5px"
//document.getElementById("dwindow").style.height=ns6? "0px" : "0px"
//document.getElementById("cframe").style.height=ns6? "0px" : "0px"
document.getElementById("dwindow").style.left=ns6? window.pageXOffset - window.pageXOffset+"px" : iecompattest().scrollLeft - iecompattest().scrollLeft +"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset - window.pageYOffset +"px" : iecompattest().scrollTop - iecompattest().scrollTop +"px"
document.getElementById("dwindow").style.height="1px"
parent.document.getElementById('cframe').style.display='none'

}
else{
minrestore=0 //restore window
//document.getElementById("maxname").setAttribute("src","imgsrc/max.gif")
//document.getElementById("dwindow").style.width=initialwidth
//document.getElementById("dwindow").style.height=initialheight
}

//document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
//document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
document.getElementById("cframe").src = "";
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra

}
////////////finish windows application/////////////////////////////
// function ararnge icons
function reloadicon(){
document.getElementById("iconstu").style.top = "20px";
document.getElementById("iconstu").style.right = "20px";
document.getElementById("iconarea").style.top = "40px";
document.getElementById("iconarea").style.right = "20px";

}
//////////////////// start divs menu////////////////////////////
function openstartmenu(nodeId){
//alert(top.frames[0].document.getElementById(nodeName).innerHTML)
	nodeName = "div_" + nodeId ;
	imgnodeName = "img_" + nodeId ;
	top.frames[0].document.getElementById(nodeName).style.display = (top.frames[0].document.getElementById(nodeName).style.display=="none") ? "block" : "none" ;
	//document.getElementById(imgnodeName).src = (top.frames[0].document.getElementById(nodeName).style.display=="none") ? "http://www.ulpanit.org.il/ev/imgsrc/chatchel.jpg" : "http://www.ulpanit.org.il/ev/imgsrc/hatchelclick.jpg" ;
}

function hidemen(nodeId){
//alert(top.frames[0].document.getElementById(nodeName).innerHTML)
	nodeName =  nodeId ;
	document.getElementById(nodeName).style.display = (document.getElementById(nodeName).style.display=="none") ? "block" : "none" ;
	//top.frames[0].document.getElementById(nodeName).style.display = (top.frames[0].document.getElementById(nodeName).style.display=="none") ? "block" : "none" ;
	//document.getElementById(imgnodeName).src = (top.frames[0].document.getElementById(nodeName).style.display=="none") ? "http://www.ulpanit.org.il/ev/imgsrc/chatchel.jpg" : "http://www.ulpanit.org.il/ev/imgsrc/hatchelclick.jpg" ;
}
// for clear the 
function hidebodyclick(){
//document.getElementById("div_4110").style.display = "none";
}
var mouseX, mouseY;
function trackMouse(evt) {
	mouseX = (ns4||ns5)? evt.pageX: window.event.clientX + document.body.scrollLeft;
	mouseY = (ns4||ns5)? evt.pageY: window.event.clientY + document.body.scrollTop;
	}
function showdivs(nodeId){
  nodeName = "div_" + nodeId ;
  document.getElementById(nodeName).style.visibility="visible";
  document.getElementById(nodeName).style.display="";
 document.getElementById(nodeName).style.top= this.event.y - 553
  document.getElementById(nodeName).style.right=154;
}
function hidedivs(nodeId){
  nodeName = "div_" + nodeId ;
  document.getElementById(nodeName).style.display="none";
}

////////////////////////////////////// function right click/////////////////////////////////////////

function showRightClick()
{
  rightClick.style.visibility="visible";
  rightClick.style.display="";
  rightClick.style.top=this.event.y;
  rightClick.style.right=this.event.x;
  hidebodyclick()
}

function hideRightClick()
{
  rightClick.style.display="none";
}	

//////////////////////// log in ////////////////////////////
function check(){
idnum = document.formlog.idnum.value;
username = document.formlog.username.value;
password = document.formlog.password.value;
	if(idnum.length == 0){
	alert('חובה להזין תעודת זהות');
	document.formlog.idnum.focus();
	return false
	}
	if(username.length == 0){
	alert('חובה להזין שם משתמש');
	document.formlog.username.focus();
	return false
	}
	if(password.length == 0){
	alert('חובה להזין סיסמה');
	document.formlog.password.focus();
	return false
	}
	document.formlog.submit();
}
/////////////////////// autologout ////////////////////////////////
var backnum = 0
///////////////////////////logout///////////////////////////////
function logout(){
	if(confirm('האם אתה בטוח שברצונך להתנתק מהמערכת?')){
	top.window.location.replace('logoutadmin.asp');
	}
}
////////////// back AND farword function///////
function winBack(){
alert(self.window.history.length);
alert(self.window.history.go(-1))
//if(parent.window.history.length > 0){document.getElementById('cframe').src=window.history.back()};
}
function winfarword(){
alert(window.history.length)
}
/////////////////////// function to validated just numbers in forms//////////////
						function justnum(nodeId)
						{
							//nodeName = "form_" + nodeId ;
							var g=document.getElementById(nodeId).value ;
							var anum=/(^\d+$)|(^\d+\.\d+$)/
										if (anum.test(g))
										testresult=true
										else{
										alert("!הזן מספרים בלבד")
										document.getElementById(nodeId).value = "";
										document.getElementById(nodeId).focus();
										return false;
										}
						}
if(plus = null){
var plus = 0;
}


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

/////////////////////////////checking forms all types//////////////


function checkform(FormName){
	//var FormName =  Fn;
	var FormLen = document.getElementById(FormName).length
		for(i=0;i<FormLen;i++){
			var InputName = document.getElementById(FormName).elements[i].name;
			var InputType = document.getElementById(FormName).elements[i].type;
			var InputTitle = document.getElementById(FormName).elements[i].title;
			var InputAlt = document.getElementById(FormName).elements[i].alt;
			if(InputName == null || InputType == null ){
				//alert('i dont knowe what is this...');
				}else{
				if(InputTitle == "email"){
				checkEmail = document.getElementById(FormName).document.getElementById(InputName).value;
					if(checkEmail.length !== 0) {
						if ((checkEmail.indexOf('@') > 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) 
							{alert("כתובת אימייל אינה חוקית אנא נסה שנית או השאר שדה זה ריק מתוכן.");
								document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
								document.getElementById(FormName).document.getElementById(InputName).focus();
							return false;
							}
					} 
				}
				
				if(InputTitle == "must"){
					switch(InputType)
					{
					
					case "select-one":
						//alert("this is a select box" + " "+InputName + " - " + InputType + "-"  + InputTitle);
						select_choose=document.getElementById(FormName).document.getElementById(InputName).selectedIndex
						select_value=document.getElementById(FormName).document.getElementById(InputName)[select_choose].value
							if (select_value=="none")
							{
								if (InputValue.length == 0){
								alert(' חובה לבחור פריט מרשימת ' + InputAlt)
								}else{
								alert('חובה לבחור פריט מרשימה זו')
								}
							//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false;
							}				
					break;
					case "text":
						//alert("this is a Text box" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
						InputValue = document.getElementById(FormName).document.getElementById(InputName).value;
						if(InputValue.length == 0 && InputAlt.length!==0){
						alert('חובה למלא שדה ' + InputAlt);
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						if(InputValue.length == 0 && InputAlt.length==0){
						alert('חובה למלא שדה זה' );
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
						
						
					
					break;
					case "file":
						//alert("this is a Text box" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
						InputValue = document.getElementById(FormName).document.getElementById(InputName).value;
						if(InputValue.length == 0){
						alert('חובה להעלות קובץ באנגלית וללא רווחים בשם הקובץ');
						//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						StrStart = InputValue.lastIndexOf("\\");
						StrEnd = InputValue.length;						
						file_name = InputValue.substring(StrStart+1,StrEnd);
						str = InputValue.toLowerCase()
						var ext=str.substring(str.length-4,str.length)	
						var heb = new RegExp("[א,ב,ג,ד,ה,ו,ז,ח,ט,י,כ,ך,ל,מ,ם,נ,ן,ס,ע,פ,ף,צ,ץ,ק,ר,ש,ת]","g");
						if(!(ext==".gif" || ext==".jpg")){
							alert('קובץ מסוג \n <\"'+ext+'\"> \n אינו מרשה לעלות לשרת');
							document.getElementById(FormName).document.getElementById(InputName).value = "";
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false
						}

						if(heb.test(file_name) == true){
							alert('אין הרשאה להעלות קבצים בעברית לשרת, אנא שנה את שם הקובץ\n <\"'+file_name+'\"> \n לאנגלית ונסה להעלותו שנית');
							document.getElementById(FormName).document.getElementById(InputName).value = '';
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false
						}
					break;
					case "button":
					// ignore this value at that point
						//alert("this is a Botton input" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
					break;
					
					default:
								
						
					}
				}
			}
		
		}
		//alert("שולח טופס")
		this.document.getElementById(FormName).submit();
}
function checkform_no_submit(FormName){
	//var FormName =  Fn;
	var FormLen = document.getElementById(FormName).length
		for(i=0;i<FormLen;i++){
			var InputName = document.getElementById(FormName).elements[i].name;
			var InputType = document.getElementById(FormName).elements[i].type;
			var InputTitle = document.getElementById(FormName).elements[i].title;
			var InputAlt = document.getElementById(FormName).elements[i].alt;
			if(InputName == null || InputType == null ){
				//alert('i dont knowe what is this...');
				}else{
				if(InputTitle == "email"){
				checkEmail = document.getElementById(FormName).document.getElementById(InputName).value;
					if(checkEmail.length !== 0) {
						if ((checkEmail.indexOf('@') > 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) 
							{alert("כתובת אימייל אינה חוקית אנא נסה שנית או השאר שדה זה ריק מתוכן.");
								document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
								document.getElementById(FormName).document.getElementById(InputName).focus();
							return false;
							}
					} 
				}
				
				if(InputTitle == "must"){
					switch(InputType)
					{
					
					case "select-one":
						//alert("this is a select box" + " "+InputName + " - " + InputType + "-"  + InputTitle);
						select_choose=document.getElementById(FormName).document.getElementById(InputName).selectedIndex
						select_value=document.getElementById(FormName).document.getElementById(InputName)[select_choose].value
							if (select_value=="none")
							{
								if (InputValue.length == 0){
								alert(' חובה לבחור פריט מרשימת - ' + InputAlt)
								}else{
								alert('חובה לבחור פריט מרשימה זו')
								}
							//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false;
							}				
					break;
					case "text":
						//alert("this is a Text box" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
						InputValue = document.getElementById(FormName).document.getElementById(InputName).value;
						if(InputValue.length == 0 && InputAlt.length!==0){
						alert('חובה למלא שדה - ' + InputAlt);
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						if(InputValue.length == 0 && InputAlt.length==0){
						alert('חובה למלא שדה זה' );
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
						
						
					
					break;
					case "file":
						//alert("this is a Text box" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
						InputValue = document.getElementById(FormName).document.getElementById(InputName).value;
						if(InputValue.length == 0){
						alert('חובה להעלות קובץ באנגלית וללא רווחים בשם הקובץ');
						//document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = 'red';
						document.getElementById(FormName).document.getElementById(InputName).focus();
						return false
						}
						StrStart = InputValue.lastIndexOf("\\");
						StrEnd = InputValue.length;						
						file_name = InputValue.substring(StrStart+1,StrEnd);
						str = InputValue.toLowerCase()
						var ext=str.substring(str.length-4,str.length)	
						var heb = new RegExp("[א,ב,ג,ד,ה,ו,ז,ח,ט,י,כ,ך,ל,מ,ם,נ,ן,ס,ע,פ,ף,צ,ץ,ק,ר,ש,ת]","g");
						if(!(ext==".gif" || ext==".jpg"  || ext==".bmp" || ext==".tif" || ext==".dwg" || ext==".pdf" || ext==".plt" || ext==".doc" || ext==".rtf" || ext==".txt" || ext==".xls" || ext==".mpp" || ext==".htm" || ext==".html" || ext==".ppt" )){
							alert('קובץ מסוג \n <\"'+ext+'\"> \n אינו מרשה לעלות לשרת');
							document.getElementById(FormName).document.getElementById(InputName).value = "";
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false
						}

						if(heb.test(file_name) == true){
							alert('אין הרשאה להעלות קבצים בעברית לשרת, אנא שנה את שם הקובץ\n <\"'+file_name+'\"> \n לאנגלית ונסה להעלותו שנית');
							document.getElementById(FormName).document.getElementById(InputName).value = '';
							document.getElementById(FormName).document.getElementById(InputName).focus();
							return false
						}
					break;
					case "button":
					// ignore this value at that point
						//alert("this is a Botton input" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
					break;
					
					//case "submit":
					//	document.getElementById(FormName).document.getElementById(InputName).disabled=true;
					//break;
					default:
								
						
					}
				}
			}
		
		}
		//alert("שולח טופס")
return true;
}

function checkMultiform(Fn){
	var FormName =  Fn
	var FormLen = document.getElementById(FormName).length
		for(i=0;i<FormLen;i++){
			var InputName = document.getElementById(FormName).elements[i].name;
			var InputId = document.getElementById(FormName).elements[i].id;
			var InputType = document.getElementById(FormName).elements[i].type;
			var InputTitle = document.getElementById(FormName).elements[i].title;
			if(InputName == null || InputType == null ){
				//alert('i dont knowe what is this...');
				}else{
				if(InputTitle == "must"){
					switch(InputType)
					{
					case "select-one":
						//alert("this is a select box" + " "+InputName + " - " + InputType + "-"  + InputTitle);
						select_choose=document.getElementById(FormName).document.getElementById(InputId).selectedIndex
						select_value=document.getElementById(FormName).document.getElementById(InputId)[select_choose].value
							if (select_value=="none")
							{
							alert('חובה לבחור פריט מרשימה זו')
							document.getElementById(FormName).document.getElementById(InputId).style.backgroundColor = 'red';
							document.getElementById(FormName).document.getElementById(InputId).focus();
							return false;
							}				
					break;
					case "text":
						//alert("this is a Text box" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
						InputValue = document.getElementById(FormName).document.getElementById(InputId).value;
						if(InputValue.length == 0){
						alert('חובה למלא שדה זה');
						document.getElementById(FormName).document.getElementById(InputId).style.backgroundColor = 'red';
						document.getElementById(FormName).document.getElementById(InputId).focus();
						return false
						}
					
					break;
					case "button":
					// ignore this value at that point
						//alert("this is a Botton input" + " "+InputName + " - " + InputType+ "-"  + InputTitle);
					break;
					
					default:
								
						
					}
				}
			}
		
		}
		//alert("שולח טופס")
		this.document.getElementById(FormName).submit();
}


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function clearRedForm(Fn,In){
var FormName =  Fn
var InputName = In
document.getElementById(FormName).document.getElementById(InputName).style.backgroundColor = '';
}
//////////////////////////////// show / hide  function simple /////////////
function show_hide(msg_id){
msg_id.style.display=msg_id.style.display=="none" ? "" : "none"
}
//////////////////////////////// show / hide  function multipile /////////////			  
	lastMess=0;
	lastMess2=0;
	lastMess3=0;
	function clicked(nodeId)
{
	nodeName = "div_" + nodeId ;
	imgnodeName = "img_" + nodeId ;
//	document.getElementById(nodeName).style.display = (document.getElementById(nodeName).style.display=="none") ? "block" : "none" ;
	document.getElementById(imgnodeName).src = (document.getElementById(nodeName).style.display=="none") ? "imgsrc/expand.gif" : "imgsrc/collapse.gif" ;
}
	function clickHelp(nodeId)
{
	nodeName = "div_" + nodeId ;
	imgnodeName = "img_" + nodeId ;
	document.getElementById(nodeName).style.display = (document.getElementById(nodeName).style.display=="none") ? "block" : "none" ;
	document.getElementById(imgnodeName).src = (document.getElementById(nodeName).style.display=="none") ? "imgsrc/help.gif" : "imgsrc/help_o.gif" ;
}
function msg(num){
//clicked(num);
var forum = "";
var cCloseMess = "1";
		var msgID;
		msgID=document.getElementById("div_"+num);
		/*var imgID
		imgID=document.getElementById("img_"+num);*/
		var tdID
		tdID=document.getElementById("td_"+num);
		if((msgID.style.display=="none")&&(lastMess==0)){
			if(cCloseMess)
				lastMess=msgID;
				/*lastIMG = imgID;*/
				lastTD=tdID;
			msgID.style.display="block";
			
			}
		else if((msgID.style.display=="none")&&(lastMess!=0)){
			msgID.style.display="block";
			//imgID.src = "imgsrc/expand.gif"
			if((cCloseMess)&&(lastMess>"")&&(lastMess!=msgID)){
				/*lastIMG.src ="imgsrc/collapse.gif"*/
				lastMess.style.display="none";
				lastTD.style.backgroundColor='';
				lastMess=msgID;
				/*lastIMG=imgID;*/
				lastTD=tdID;
			}
		}
		else
			msgID.style.display="none";
			//imgID.src = (msgID.style.display=='none') ? 'imgsrc/collapse.gif' : "imgsrc/expand.gif";
			tdID.style.backgroundColor = (msgID.style.display=='none') ? "" : "#FFFFFF";
			
	
}
function msg2(num1,num2){
num = num1+""+num2;
var forum = "";
var cCloseMess = "1";
		var msgID;
		msgID = document.getElementById("div_"+num);
		var imgID
		imgID = document.getElementById("img_"+num);
		var tdID
		tdID = document.getElementById("td_"+num);
		if((msgID.style.display=="none")&&(lastMess2==0)){
			if(cCloseMess)
				lastMess2 = msgID;
				lastIMG2 = imgID;
				lastTD2=tdID;
			msgID.style.display="block";
			}
		else if((msgID.style.display=="none")&&(lastMess2!=0)){
			msgID.style.display="block";
			if((cCloseMess)&&(lastMess2>"")&&(lastMess2!=msgID)){
				lastIMG2.src ="imgsrc/collapse.gif"
				lastTD2.style.backgroundColor='';
				lastMess2.style.display="none";
				lastMess2=msgID;
				lastIMG2=imgID;
				lastTD2=tdID;
			}
		}
		else
			msgID.style.display="none";
			imgID.src = (msgID.style.display=='none') ? 'imgsrc/collapse.gif' : "imgsrc/expand.gif"
			tdID.style.backgroundColor = (msgID.style.display=='none') ? "" : "#FFFFFF";
			if(msgID.style.display!=='none'){
				if(nottoolbar == false){
				document.getElementById("editarea").style.display = '';
				document.getElementById("newcompanent").style.display = '';
				}
			document.formsec.ObjectID.value = num1;
			document.formsec.AreaID.value = num2;
			}else{
				if(nottoolbar == false){
				document.getElementById("editarea").style.display = 'none';
				document.getElementById("newcompanent").style.display = 'none';
				document.getElementById("companentedit").style.display = 'none';
				}
			}
}
lastComId = 0
function msg3(num1,num2,num3){
num = "tdcom_"+num3;
var cCloseMess = "1";
		var tdcomID
		tdcomID = document.getElementById(num);
		therange = tdcomID.innerHTML;
		
		//alert(tdcomID.innerHTML)
		if((tdcomID.style.backgroundColor=="")&&(lastComId==0)){
			if(cCloseMess)
				lastComId = tdcomID;
				tdcomID.style.backgroundColor="#FFFFFF";
				}
		else if((tdcomID.style.backgroundColor=="")&&(lastComId!=0)){
			tdcomID.style.backgroundColor="#FFFFFF";
			if((cCloseMess)&&(lastComId>"")&&(lastComId!=tdcomID)){
				lastComId.style.backgroundColor='';
				lastComId=tdcomID;
			}
		}
		else
		tdcomID.style.backgroundColor  = (tdcomID.style.backgroundColor == "") ? '#FFFFFF' : "";
			if(nottoolbar == false){
				document.getElementById("companentedit").style.display = (tdcomID.style.backgroundColor == "") ? 'none' : ""; 
				if (document.getElementById("companentedit").style.display ==''){
				document.form3.AreaID.value = num1;
				document.form3.ComponentID.value = num2;
				}
			}
		}
//iecompattest().clientWidth = top.window.iecompattest().clientWidth
function pick(page,idTo,FindName,Tbl,Just,w,h){
if(w==''){
w = 300;
}
if(h==''){
h=400;
}
//openwin = window.open('pick.asp?page='+page+'&idTo='+idTo+'&FindName='+FindName+'&Tbl='+Tbl+'&Just='+Just,"choose_item","resizable=yes,width="+w+",height="+h+",toolbar=no,scrollbars=yes")
openwin = showModalDialog('pick.php?page='+page+'&idTo='+idTo+'&FindName='+FindName+'&Tbl='+Tbl+'&Just='+Just, window, "dialogWidth:"+w+"px; dialogHeight:"+h+"px; status:no; help:no");
}
function pickValue(page,idTo,FindName,Tbl,Just,el,w,h){
if(w==''){
w = 300;
}
if(h==''){
h=400;
}
//openwin = window.open('pickvalue.asp?page='+page+'&idTo='+idTo+'&FindName='+FindName+'&Tbl='+Tbl+'&Just='+Just+'&el='+el,"choose_item","resizable=yes,width="+w+",height="+h+",toolbar=no,scrollbars=yes")
openwin = showModalDialog('pickvalue.php?page='+page+'&idTo='+idTo+'&FindName='+FindName+'&Tbl='+Tbl+'&Just='+Just+'&el='+el, window, "dialogWidth:"+w+"px; dialogHeight:"+h+"px; status:no; help:no");
}
function openDialog(page,parentpage,action,w,h){
if(w==''){
w = 300;
}
if(h==''){
h=400;
}

//openwin = window.open(page+'&parentpage='+parentpage+'&action='+action,"choose_item","resizable=yes,width="+w+",height="+h+",toolbar=no,scrollbars=yes")
openwin = showModalDialog(page+'&parentpage='+parentpage+'&action='+action, window, "dialogWidth:"+w+"px; dialogHeight:"+h+"px; status:no; help:no");
}

function openFrameDialog(page,w,h){
if(w==''){
w = 300;
}
if(h==''){
h=400;
}

//openwin = window.open(page+'&parentpage='+parentpage+'&action='+action,"choose_item","resizable=yes,width="+w+",height="+h+",toolbar=no,scrollbars=yes")
openwin = showModalDialog('dialog.php?ModalContent='+page, window, "dialogWidth:"+w+"px; dialogHeight:"+h+"px; status:no; help:no");
}

function FromIdToVal(sel,inputTxt,newTxt){
if(sel== 0){
}else{
document.getElementById(inputTxt).value = newTxt
}


//document.formname.id.selectedIndex
//document.getElementById(inputTxt).value = document.formname.id[pick_choose].text
}
//////////////////////// print issue ///////////////////////////////////////////////////
function takeShot(){
  if(event.keyCode!=112){return;}
  var w=document.body.scrollLeft+document.body.offsetWidth;
  var h=document.body.scrollTop+document.body.offsetHeight;
  var t=-document.body.scrollTop;
  var l=-document.body.scrollLeft;

  var win=window.open("","","left=0,top=0,width="+w+",height=" +h+ ",status=no,scroll=no,menubar=yes, toolbar=no,location=no,directories=no,resizable=no");
  win.document.open();
  str = document.getElementById("printable").innerHTML ;
  //document.body.innerHTML
  win.document.write("<div style='overflow:hidden;width:"+w+"px;height:" +h+ "px;position:absolute;top:"+t+";left:"+l+";' dir=rtl>"+str+"<p align=center><input id=printpage  type=button value=print style='display:' onclick='javascript:window.print()'></p></div>");
  win.document.close();
  win.document.body.style.margin=0;
}
//document.onkeypress=takeShot;


//////////////////////// print End //////////////////////////////////////////////////////


function BreakItUp()
{
  //Set the limit for field size.
  var FormLimit = 102399

  //Get the value of the large input object.
  var TempVar = new String
  TempVar = document.form1.preview.value

  //If the length of the object is greater than the limit, break it
  //into multiple objects.
  if (TempVar.length > FormLimit)
  {
    document.form1.preview.value = TempVar.substr(0, FormLimit)
    TempVar = TempVar.substr(FormLimit)

    while (TempVar.length > 0)
    {
      var objTEXTAREA = document.createElement("TEXTAREA")
      objTEXTAREA.name = "preview"
      objTEXTAREA.value = TempVar.substr(0, FormLimit)
      document.form1.appendChild(objTEXTAREA)
      
      TempVar = TempVar.substr(FormLimit)
    }
  }
}
//////////////////////////////////// tab function /////////////////////////

<!--
//=======================================================
     //detect browser settings for showing and hiding DIVs
     isNS4 = (document.layers) ? true : false;
     isIE4 = (document.all && !document.getElementById) ? true : false;
     isIE5 = (document.all && document.getElementById) ? true : false;
     isNS6 = (!document.all && document.getElementById) ? true : false;
//=======================================================

function switchDiv(strBottonName,strDivName,bolVisible){
 //identify the element based on browser type
 if (isNS4) {
   objElement = document.layers[strDivName];
   objElementBotton = document.layers[strBottonName];
 } else if (isIE4) {
   objElement = document.all[strDivName].style;
   objElementBotton = document.all[strBottonName].style;
 } else if (isIE5 || isNS6) {
   objElement = document.getElementById(strDivName).style;
   objElementBotton = document.getElementById(strBottonName).style;
 }
 
 if(isNS4){
     if(!bolVisible) {
       objElement.visibility ="hidden"
	   objElementBotton.borderTop= "1px buttonhighlight outset";
     } else {
       objElement.visibility ="visible"
	   objElementBotton.borderTop= "1px buttonhighlight inset";
     }     
 }else if(isIE4){
     if(!bolVisible) {
       objElement.visibility = "hidden";
	   objElementBotton.borderTop= "1px buttonhighlight outset";
     } else {
       objElement.visibility = "visible";
	   objElementBotton.borderTop= "1px buttonhighlight inset";
     }
 } else if (isIE5 || isNS6) {
      if(!bolVisible){
         objElement.display = "none";
		 //objElementBotton.borderTop= "1px buttonhighlight inset";
		 //objElementBotton.borderRight= "1px buttonhighlight inset";
		 //objElementBotton.borderLeft= "1px buttonhighlight inset";
		 //objElementBotton.borderBottom= "1px buttonhighlight inset";
		 //objElementBotton.backgroundColor = ""
		 objElementBotton.backgroundImage = "";
      } else {
        objElement.display = "";
		 //objElementBotton.borderTop= "1px buttonhighlight outset";
		 //objElementBotton.borderRight= "1px buttonhighlight outset";
		 //objElementBotton.borderLeft= "1px buttonhighlight outset";
		 //objElementBotton.borderBottom= "";
		 //objElementBotton.backgroundColor = "#FFFFFF";
		 objElementBotton.backgroundImage='URL(imgsrc/tabbgsel.gif)';
        }
      }
}

function toggleTabs(intVisible,toggleNum){

     for(i=1;i<toggleNum+1;i++){
          if(i==intVisible){
               switchDiv("BottonTab" +i,"divTab" +i,true);
          }else{
               switchDiv("BottonTab" +i,"divTab" +i,false);
          }
     }
}
var togg = 1;
function nexttogg(){
	if(togg<5){
		togg++;
		toggleTabs(togg)
	}
}
function pretoggle(){
	if(togg>=2){
		togg-- ;
		toggleTabs(togg)
	}
}
//-->
/////////////////////////////////// end tab function //////////////////////
/////////////////////////////////// fast edit 2 feilds tables //////////////
function PlusButtonActivate(fldIdName,fldTextName,tblName,wintext){
document.PlusButton.fldIdName.value = fldIdName;
document.PlusButton.fldTextName.value = fldTextName;
document.PlusButton.tblName.value = tblName;
document.PlusButton.submit()
loadHiddenWindow(450,350,wintext)
}
/////////////////////////////////// End fast edit 2 feilds tables //////////////
function chk(){
str = document.form1.filetoc.value ;
	if(str.length!==0){
		StrStart = str.lastIndexOf("\\")
		StrEnd = str.length
		file_name = str.substring(StrStart+1,StrEnd)
		var heb = new RegExp("[א,ב,ג,ד,ה,ו,ז,ח,ט,י,כ,ך,ל,מ,ם,נ,ן,ס,ע,פ,ף,צ,ץ,ק,ר,ש,ת]","g")
			if(heb.test(file_name) == false){
			checkform('form1');
			}else{
			alert('אין הרשאה להעלות קבצים בעברית לשרת, אנא שנה את שם הקובץ\n <\"'+file_name+'\"> \n לאנגלית ונסה להעלותו שנית')
			return false
			}
	}else{
	checkform('form1');
	}
}
function noheb(dateObj) {
  if(event.keyCode>1487 && event.keyCode<1515) return false;
}
function trimnoheb(dateObj) {
  if(event.keyCode>1487 && event.keyCode<1515 ||  event.keyCode==32) return false;
}
function noletter(dateObj) {
  if(event.keyCode>57 || event.keyCode<48) return false;
}
function confirmdel(confirmstr,reffer){
if (confirm(confirmstr)){document.location.replace(reffer)}
}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWin(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
///////////////////////////////// function calander////////////////////////////
if(plus = null){
var plus = 0;
}


function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function NewTime(plus){

var dt=new Date() 
Thesec=dt.getSeconds()
Thehr= plus
Themin=dt.getMinutes()
return NowIs = Thehr+":"+Themin + ":" + Thesec
//document.getElementById("saytime").value = Thehr+plus+":"+Themin + ":" + Thesec
}

function TheTimeIs(plus){

var dt=new Date() 
Thesec=dt.getSeconds()
Thehr=dt.getHours() + plus
Themin=dt.getMinutes()
return NowIs = Thehr+":"+Themin + ":" + Thesec
document.getElementById("saytime").value = Thehr+plus+":"+Themin + ":" + Thesec
}

var gdCtrl = new Object();
var goSelectTag = new Array();
var gcGray = "#808080";
var gcToggle = "#FFCC00";
var gcBG = "#ffffff";

var gdCurDate = new Date();
var giYear = gdCurDate.getFullYear();
var giMonth = gdCurDate.getMonth()+1;
var giDay = gdCurDate.getDate();

function fSetDate(iYear, iMonth, iDay){
  VicPopCal.style.visibility = "hidden";
  gdCtrl.value = iDay+"-"+iMonth+"-"+iYear; //Here, you could modify the locale as you need !!!!
  for (i in goSelectTag)
  	goSelectTag[i].style.visibility = "visible";
  goSelectTag.length = 0;
}

function fSetSelected(aCell){
  var iOffset = 0;
  var iYear = parseInt(tbSelYear.value);
  var iMonth = parseInt(tbSelMonth.value);

  self.event.cancelBubble = true;
  aCell.bgColor = gcBG;
  with (aCell.children["cellText"]){
  	var iDay = parseInt(innerText);
  	if (color==gcGray)
		iOffset = (Victor<10)?-1:1;
	iMonth += iOffset;
	if (iMonth<1) {
		iYear--;
		iMonth = 12;
	}else if (iMonth>12){
		iYear++;
		iMonth = 1;
	}
  }
  fSetDate(iYear, iMonth, iDay);
}

function Point(iX, iY){
	this.x = iX;
	this.y = iY;
}

function fBuildCal(iYear, iMonth) {
  var aMonth=new Array();
  for(i=1;i<7;i++)
  	aMonth[i]=new Array(i);

  var dCalDate=new Date(iYear, iMonth-1, 1);
  var iDayOfFirst=dCalDate.getDay();
  var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();
  var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
  var iDate = 1;
  var iNext = 1;

  for (d = 0; d < 7; d++)
	aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;
  for (w = 2; w > 7; w++)
  	for (d = 0; d < 7; d++)
		aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
  return aMonth;
}

function fDrawCal(iYear, iMonth, iCellHeight, iDateTextSize) {
  var WeekDay = new Array("ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת");
  var styleTD = " bgcolor='"+gcBG+"'  valign='middle' align='center' height='"+iCellHeight+"' style='font:10px bold"+iDateTextSize+" Courier;";            //Coded by Liming Weng(Victor Won)  email:victorwon@netease.com

  with (document) {
	write("<tr>");
	for(i=0; i<7; i++)
		write("<td "+styleTD+"color:#990099' >" + WeekDay[i] + "</td>");
	write("</tr>");

  	for (w = 1; w < 7; w++) {
		write("<tr>");
		for (d = 0; d < 7; d++) {
			write("<td id=calCell "+styleTD+"cursor:hand;' onMouseOver='this.bgColor=gcToggle' onMouseOut='this.bgColor=gcBG' onclick='fSetSelected(this)'>");
			write("<font id=cellText Victor='Liming Weng'> </font>");
			write("</td>")
		}
		write("</tr>");
	}
  }
}

function fUpdateCal(iYear, iMonth) {
  myMonth = fBuildCal(iYear, iMonth);
  var i = 0;
  for (w = 0; w < 6; w++)
	for (d = 0; d < 7; d++)
		with (cellText[(7*w)+d]) {
			Victor = i++;
			if (myMonth[w+1][d]<0) {
				color = gcGray;
				innerText = -myMonth[w+1][d];
			}else{
				color = ((d==0)||(d==6))?"red":"black";
				innerText = myMonth[w+1][d];
			}
		}
}

function fSetYearMon(iYear, iMon){
  tbSelMonth.options[iMon-1].selected = true;
  for (i = 0; i < tbSelYear.length; i++)
	if (tbSelYear.options[i].value == iYear)
		tbSelYear.options[i].selected = true;
  fUpdateCal(iYear, iMon);
}

function fPrevMonth(){
  var iMon = tbSelMonth.value;
  var iYear = tbSelYear.value;

  if (--iMon<1) {
	  iMon = 12;
	  iYear--;
  }

  fSetYearMon(iYear, iMon);
}

function fNextMonth(){
  var iMon = tbSelMonth.value;
  var iYear = tbSelYear.value;

  if (++iMon>12) {
	  iMon = 1;
	  iYear++;
  }

  fSetYearMon(iYear, iMon);
}

function fToggleTags(){
  with (document.all.tags("SELECT")){
 	for (i=0; i<length; i++)
 		if ((item(i).Victor!="Won")&&fTagInBound(item(i))){
 			item(i).style.visibility = "hidden";
 			goSelectTag[goSelectTag.length] = item(i);
 		}
  }
}

function fTagInBound(aTag){
  with (VicPopCal.style){
  	var l = parseInt(left);
  	var t = parseInt(top);
  	var r = l+parseInt(width);
  	var b = t+parseInt(height);
	var ptLT = fGetXY(aTag);
	return !((ptLT.x>r)||(ptLT.x+aTag.offsetWidth<l)||(ptLT.y>b)||(ptLT.y+aTag.offsetHeight<t));
  }
}

function fGetXY(aTag){
  var oTmp = aTag;
  var pt = new Point(0,0);
  do {
  	pt.x += oTmp.offsetLeft;
  	pt.y += oTmp.offsetTop;
  	oTmp = oTmp.offsetParent;
  } while(oTmp.tagName!="BODY");
  return pt;
}

// Main: popCtrl is the widget beyond which you want this calendar to appear;
//       dateCtrl is the widget into which you want to put the selected date.
// i.e.: >input type="text" name="dc" style="text-align:center" readonly><INPUT type="button" value="V" onclick="fPopCalendar(dc,dc);return false">
function fPopCalendar(popCtrl, dateCtrl){
  gdCtrl = dateCtrl;
  fSetYearMon(giYear, giMonth);
  var point = fGetXY(popCtrl);
  with (VicPopCal.style) {
  	left = point.x;
	top  = point.y+popCtrl.offsetHeight+1;
	width = VicPopCal.offsetWidth;
	height = VicPopCal.offsetHeight;
	fToggleTags(point);
	visibility = 'visible';
  }
  VicPopCal.focus();
}

function fHideCal(){
  var oE = window.event;
  if ((oE.clientX>0)&&(oE.clientY>0)&&(oE.clientX<document.body.clientWidth)&&(oE.clientY>document.body.clientHeight)) {
	var oTmp = document.elementFromPoint(oE.clientX,oE.clientY);
	while ((oTmp.tagName!="BODY") && (oTmp.id!="VicPopCal"))
		oTmp = oTmp.offsetParent;
	if (oTmp.id=="VicPopCal")
		return;
  }
  VicPopCal.style.visibility = 'hidden';
  for (i in goSelectTag)
	goSelectTag[i].style.visibility = "visible";
  goSelectTag.length = 0;
}

var gMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");

 
with (document) {

write("<Div id='VicPopCal' onblur='fHideCal()' onclick='focus()' style='POSITION:absolute;visibility:hidden;border:2px ridge;width:10;z-index:100;'>");
write("<table border='0' bgcolor='menu'>");
write("<TR>");
write("<td valign='middle' align='center'><input type='button' name='PrevMonth' value='<' style='height:20;width:20;FONT:16 Fixedsys' onClick='fPrevMonth()' onblur='fHideCal()'>");
write("&nbsp;&nbsp;<select name='tbSelMonth' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won' onclick='self.event.cancelBubble=true' onblur='fHideCal()'>");
for (i=0; i<12; i++)
	write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>");
write("</SELECT>");
write("&nbsp;&nbsp;<SELECT name='tbSelYear' onChange='fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won' onclick='self.event.cancelBubble=true' onblur='fHideCal()'>");
for(i=1930;i<2015;i++)
	write("<OPTION value='"+i+"'>&nbsp;&nbsp;"+i+"&nbsp;&nbsp;</OPTION>");
write("</SELECT>");
write("&nbsp;&nbsp;<input type='button' name='PrevMonth' value='>' style='height:20;width:20;FONT:16 Fixedsys' onclick='fNextMonth()' onblur='fHideCal()'>");
write("</td>");
write("</TR><TR>");
write("<td align='center'>");
write("<DIV style='background-color:menu;'><table width='100%' border='0'>");
fDrawCal(giYear, giMonth, 18, 16);
write("</table></DIV>");
write("</td>");
write("</TR><TR><TD align='center'>");
write("<B style='cursor:hand' onclick='fSetDate(giYear,giMonth,giDay); self.event.cancelBubble=true' onMouseOver='this.style.color=gcToggle' onMouseOut='this.style.color=0'>היום:&nbsp;&nbsp;"+giDay+"&nbsp;ב"+gMonths[giMonth-1]+",&nbsp;&nbsp;"+giYear+"</B>");
write("</TD></TR>");
write("</TD></TR>");
write("</TABLE></Div>");
}
// End -- Coded by Liming Weng, email: victorwon@netease.com -->
