

function isIE()
{

	if(navigator.userAgent.toLowerCase().indexOf('msie') > -1)
	{
		return true;
	}
	else
	{
		return false;
	}		
}

function doCheckBankAccount(source, arguments)
{
   var IsCorrect = false;
   var TextboxValue = arguments.Value;
   var intTotalValue = 0;
   var intMultiPlyArray = new Array("9","8","7","6","5","4","3","2","1");

   if(TextboxValue.length > 8 && TextboxValue.length < 11)
   {

      if(TextboxValue.length == 9 || TextboxValue.length == 10)
      {
         if(!isNaN(TextboxValue))
         {
            for(var i=0; i<9; i++)
            {
               intTotalValue = parseInt(intTotalValue + parseInt(TextboxValue.substr(i,1) * intMultiPlyArray[i]));
            }
            if(parseInt(intTotalValue % 11) == parseInt(TextboxValue.substr(TextboxValue.length-1,1)))
            {
               IsCorrect = true;
            }
         }
      }

   }
   else
   {
      if(TextboxValue.length < 9)
      {
         //POSTBANK
         IsCorrect = true;
      }
      else
      {
         IsCorrect = false;
      }
   }
   arguments.IsValid = IsCorrect;
}

function doCheckEmail(strTextBoxId){
   var returnvalue = false;
   Email = document.getElementById(strTextBoxId).value;
   if(Email != "")
   {
	   var re = new RegExp("^[A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)*[@][A-Za-z0-9-][A-Za-z0-9-]+([.-][A-Za-z0-9-]+)*[.]([A-Za-z]){2,6}$");
		if (re.test(Email)) 
		{
		   returnvalue = true;
		}
	}
	return returnvalue
}

function doCheckPostalCode(postalcode){
   var returnvalue = false;
   if(postalcode != "")
   {
	   var re = new RegExp("^([1-9]{1}[0-9]{3}[ ]?[A-Za-z]{2})$");
		if (re.test(postalcode)) 
		{
			returnvalue = true;
		}
	}
	return returnvalue
}

function doCheckActionCode(actioncode)
{
   var returnvalue = false;
   if(actioncode != "")
   {
	   var re = new RegExp("^([0-9]{9})$");
		if (re.test(actioncode))
		{
			returnvalue = true;
		}
	}
	return returnvalue
}

function EnterPressed(objEvent, controlToPostBack)
{

    if((objEvent.which && objEvent.which == 13) || (objEvent.keyCode && objEvent.keyCode == 13))
    {
      __doPostBack(controlToPostBack, '');
      return false;
    } else
    {
      return true;
    }
}  



function openWindow(strUrl, strWindowName, astrValues, strOptions, strType)
{
	switch(strType)
	{
		case "modal"	:	window.showModalDialog(strUrl, astrValues, strOptions);
							break;
		case "modeless"	:	window.showModelessDialog(strUrl, astrValues, strOptions);
							break;
		case "normal"	:	window.open(strUrl, strWindowName, strOptions);
							break;
		default			:	window.open(strUrl, strWindowName, strOptions);
							break;
	}
}



function insertFile(strFileLink, strFileName, strIcon)
{
	strImage = "<span>" +
	"<img src=\"" + strIcon + "\" border=\"0\">&nbsp;" +
	"<a href='" + strFileLink + "'><span>" + strFileName + "</span></a></span>";
	window.opener.document.idEdit.document.body.innerHTML = window.opener.document.idEdit.document.body.innerHTML + strImage;
	window.close();
}

function toggleDiv(strDivID)
{
	if(document.getElementById(strDivID).style.display=='none')
	{
		document.getElementById(strDivID).style.display='block';
	}
	else
	{
		document.getElementById(strDivID).style.display='none';
	}
}

function showDiv(strDivID)
{
	document.getElementById(strDivID).style.display='block';
}

function hideDiv(strDivID)
{
	document.getElementById(strDivID).style.display='none';
}
