﻿

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }



function showInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "Inline";
	}
}
function showInline2 (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "block";
	}
}
function hideInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}


function hideDiv(divName){
	tempDiv = document.getElementById(divName);
	if (!tempDiv) {
		return;
	}
	tempDiv.style.display="none";
}

function showDiv(divName){
	tempDiv = document.getElementById(divName);
	if (!tempDiv) {
		return;
	}
	tempDiv.style.display="block";
}



//for the animation conttrol in the ctrlProfile
function SimClick(control) {   
  
  //alert(control);
   document.getElementById(control).click();
   
}

function closeAnimationPanel(control){
    document.getElementById(control).style.visibility="hidden"
}



function blinkIt() {
	if (!document.all) return;
	else {
   for(i=0;i<document.all.tags('blink').length;i++){
      s=document.all.tags('blink')[i];
      s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
      s.style.color = "#009ECE";
      
   }
 }
}



  function textCounter(field, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
		alert("You have reached the maximum limit.")
	}
  }



	function Confirm_Delete () {
	return confirm("?אשר מחיקה");
	}


function Valid_Integer (checkStr) {

  var checkOK = "0123456789";
  var allValid = true;
  var allNum = "";
  
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"T1\" field.");
    theForm.T1.focus();
    return (false);
  }
  return (true);
  
  }
    function PopupWin(URL) { 
//     window.open(baseURL+"popit.html?"+sPicURL);
     window.open(URL, "",  
     "resizable=1, width=0, height=0, titlebar=no, scrollbars=yes, location=no, directories=no, status=no, menubar=no, toolbar=no, TOP=0,LEFT=0"); 
   }  
  
  	function finalize (mySubmit) {
	
	if (confirm ("Click OK to finalize") )
		{
		mySubmit.value = "processing request"
		return true;
		}
		else 
		return false;
	}

	
  function OpenWin(myURL, w, h) {
   window.open( myURL, "",  
     "resizable=1, width="+w+", height="+h+", top=0, left=0, titlebar=no, scrollbars=yes, location=no, directories=no, status=no, menubar=no, toolbar=no"); 
  
   }	
 
   
   function PopupPic(baseURL,sPicURL) { 
//     window.open(baseURL+"popit.html?"+sPicURL);
     window.open(baseURL +  "popit.html?"+sPicURL, "",  
     "resizable=1, width=0, height=0, titlebar=no, scrollbars=yes, location=no, directories=no, status=no, menubar=no, toolbar=no, TOP=0,LEFT=0"); 
   } 
   
   	
   	
   	
   	function HideMe(CheckControl, HiddenControl) {
			//alert();			
			
			if (!document.getElementById(CheckControl).checked) {
				document.getElementById(HiddenControl).style.visibility="hidden";
				document.getElementById(HiddenControl).style.display = 'none';
				}
			
			else
				{
				document.getElementById(HiddenControl).style.visibility="visible";
				document.getElementById(HiddenControl).style.display = 'block';
				}
			
			}
	
   
   
      function HideByRadio(RadioControl, HiddenControl, Items) {
			//alert();			
			
			
			 for (i = 0;  i < Items;  i++)
			 {
				// Hide All Divs
				
				document.getElementById(HiddenControl+ "_" + i).style.visibility="hidden";
				document.getElementById(HiddenControl+ "_" + i).style.display = 'none';
			//alert(i);
			
			 if (document.getElementById(RadioControl+ "_" + i ).checked)
				
					{  // Find Checked Radio Button
				
			
					document.getElementById(HiddenControl+ "_" + i).style.visibility="visible";
					document.getElementById(HiddenControl+ "_" + i).style.display = 'block';
				
				}
			
			
			 }
			
			
			
	
   }
   