function doCenter(obj){
   //Get screen size from browser
   screenHeight = document.body.clientHeight;
   screenWidth = document.body.clientWidth;
      
   //Check or set object position to be absolute
	if(obj.style.position != "absolute")
		obj.style.position = "absolute";
       
	//Set to object to be in the center of screeen
	height = obj.style.pixelHeight;
	width = obj.style.pixelWidth;
	obj.style.top = parseInt((screenHeight/2)-(height/2))+"px";
	obj.style.left = parseInt((screenWidth/2)-(width/2))+"px";		
	
	obj.style.display = '';
}

function doOverOutButton() {
	(this.className == 'buttonNormal') ? this.className = 'buttonMouseOver' : this.className = 'buttonNormal';
}

function doOverButtonLong() {
	(this.className == 'buttonNormalLong') ? this.className = 'buttonMouseOverLong' : this.className = 'buttonNormalLong';
}

function doOverOutInput() {
	(this.className == 'inputNormal') ? this.className = 'inputMouseOver' : this.className = 'inputNormal';
}

function doOverOutInputShort()
{
	(this.className == 'inputNormalShort') ? this.className = 'inputMouseOverShort' : this.className = 'inputNormalShort';
}

function doInitElements(readonly) {
	var buttons = document.all.tags('BUTTON');
	for (var i=0; i<buttons.length; i++){
	  if (buttons[i].className == 'buttonNormal') {
	  	buttons[i].onmouseover = doOverOutButton;
		  buttons[i].onmouseout = doOverOutButton;
		  buttons[i].hidefocus = true;
	  }
	  if(buttons[i].className == 'buttonNormalLong'){
	  	buttons[i].onmouseover = doOverButtonLong;
		buttons[i].onmouseout = doOverButtonLong;
		buttons[i].hidefocus = true;
	  }
	}

	var inputs = document.all.tags('INPUT');
	for (var i=0; i<inputs.length; i++)
	{
	  if (inputs[i].className == 'inputNormal') {
			inputs[i].blur();
	  	inputs[i].onfocus = doOverOutInput;
		  inputs[i].onblur = doOverOutInput;
			if (readonly)
			  inputs[i].readOnly = true;
	  }
	  if(inputs[i].className == 'inputNormalShort')
	  {
	  	inputs[i].blur();
	  	inputs[i].onfocus = doOverOutInputShort;
		  inputs[i].onblur = doOverOutInputShort;
			if (readonly)
			  inputs[i].readOnly = true;
	  }
	}
}

function doPageTransfer(pageURL) {
	if (pageURL.toLowerCase() != currentPage.toLowerCase())
	  window.location = pageURL;
}

function showMsg(messageText, showButtons, showTitle) {
  var params = new Array();
  params[0] = messageText;
  params[1] = showButtons;
	params[2] = showTitle;
  res = window.showModalDialog('MsgBox.html', params,  'dialogHeight: 213px; dialogWidth: 258px; center: Yes; help: No; resizable: No; status: No; scroll: No;');
  return(res);
}

function doError(errorText) {
	showMsg(errorText, 'onlyok');
}

function doCheckForNull(formName) {
	var inputs = formName.all;
	var rslt = '';
	for (var i=0; i<inputs.length; i++)
	{
		if ((inputs[i].notNull && inputs[i].value.length < 1) || (inputs[i].dependField && inputs[i].value.length < 1 && formName.all[inputs[i].dependField].value.length > 0))
		{
		  rslt += (rslt == '') ? inputs[i].fieldName : ('; ' + inputs[i].fieldName);
		}
	}
	if (rslt != '')
		rslt = 'אנא מלא את השדה(ות): ' + rslt + '.';
	return rslt;
}

function doCheckForValidity(formName) {
	var inputs = formName.all;
	var rslt = '';
	for (var i=0; i<inputs.length; i++)
    {
		if (inputs[i].validInput && inputs[i].inputType)
		{  
		  switch (inputs[i].inputType.toLowerCase()) 
		  {
				case 'numeric':
					if (isNaN(inputs[i].value) || inputs[i].value.indexOf(' ') > -1 || inputs[i].value.indexOf('.') > -1 || (inputs[i].exactSize && inputs[i].value.length > 0 && (parseInt(inputs[i].value.length) != parseInt(inputs[i].maxLength))))
				    rslt += (rslt == '') ? inputs[i].fieldName : ('; ' + inputs[i].fieldName);
					break;
				case 'telephone':
					break;
				case 'email':
					if (!/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/.test(inputs[i].value))
						rslt += (rslt == '') ? inputs[i].fieldName : ('; ' + inputs[i].fieldName);
					break;
				case 'money':
					if (isNaN(inputs[i].value) || inputs[i].value.indexOf(' ') > -1)
						rslt += (rslt == '') ? inputs[i].fieldName : ('; ' + inputs[i].fieldName);
					break;
			}
		}
	}
	
	if (rslt != '')
		rslt = 'אנא בדוק את תקינות השדה(ות): ' + rslt + '.';
	return rslt;
}

function getComboText(comboObject) {
	return comboObject.options[comboObject.selectedIndex].text;
}


