	// function ValidateElement expects the following parameters:
	//	LabelName, FormNumber, ElementNumber, ElementValue,
	//  ElementType (stringAndNum, string, integer, real, date, email,time,stringDDL,zip),
	//	CanBeBlank, MinimumLength, MaximumLength, LessThan, EqualTo, GreaterThan,
	//	AllowSpaces, GreaterThanToday'sDate, DisplayMessage
	//*****************************************************************
		
				
		function closeFrm(closeType, navigateToUrl,validationFx)
		{
			var caption = document.mainForm.cmdClose.value;
			if (caption=="Cancel")
			{
				var retval = confirm("Do you want to save changes to this record?");
				if (retval == false) 
				{
					window.document.mainForm.reset();
					document.mainForm.cmdClose.value = "Close";
					return false;
				}
				else
				{
				
					if (parent.parent.treeFrame != null)
					{				    
						var retval = eval(validationFx);
						if (retval==true)
						{
							if (parent.parent.treeFrame.treeForm != null) 
							{
								//parent.parent.treeFrame.treeForm.txtRedirect.value  = 1;
								//parent.parent.treeFrame.treeForm.txtPageName.value = navigateToUrl;
								mainForm.cmdSave.fireEvent("onClick");
								document.mainForm.cmdClose.name = "cmdSave";
								document.mainForm.cmdClose.id =  "cmdSave";
							}
						}
						return retval;
					}	
					else
					{
						mainForm.cmdSave.fireEvent("onClick");
						document.mainForm.cmdClose.name = "cmdSave";
						document.mainForm.cmdClose.id =  "cmdSave";
						return retval;
					}
				}
			}
			else
			{
			    if (parent.parent.treeFrame == null)
				 {
					window.close();
				 }
				 else
				 {
					if (closeType==1)
					{
						window.navigate(navigateToUrl);
						//window.open(navigateToUrl,"replace");
					}
					else
					{
						window.open(navigateToUrl,"_parent");
					}
					return false;
				}	
			}
		}	
		
		 function disableRightClick(disableBtn)
		{
			ErrMsg = "Please wait while page is loading!";
			if (disableALL == false)
				return;
			if (navigator.appName == "Netscape" ) // check for netscape and right click
			{ 
				alert(ErrMsg);
				return false;
			}
			else if (navigator.appName =="Microsoft Internet Explorer" ) // for IE and Right Click
			{
				alert(ErrMsg);
				return false;
			}
		}
	
		function TrapKeyDown()
		{	
			if (disableALL == false)
				return;
			else	
				event.returnValue=false;
		}
		
		function CloseCancel()
		{
			if (mainForm.cmdClose != null) {
					mainForm.cmdClose.value = "Cancel";
				}	
		}
		
	function clickNext(pageUrl,validationFx)
		{ 	
		    var caption = document.mainForm.cmdClose.value;
			if (caption=="Cancel")
			{
				var retval = confirm("Do you want to save changes to this record?");
				if (retval == false) 
				{
					window.open(pageUrl,"_parent");
					return false;
				}
				else
				{
					var retval = true;
					if(validationFx!="") retval = eval(validationFx);
					if (retval==true)
					{
						//parent.parent.treeFrame.treeForm.txtRedirect.value  = 1;
						//parent.parent.treeFrame.treeForm.txtPageName.value = pageUrl;
						mainForm.cmdSave.fireEvent("onClick");
						if (document.mainForm.cmdNextP!=null)
						{
							document.mainForm.cmdNextP.name = "cmdSave"
							document.mainForm.cmdNextP.id =  "cmdSave"
						}
					}
					return retval;
				}
			}
			else
			{
				window.open(pageUrl,"_parent");
				return false;
			}
			return false;
		}
		
		function clickBack(pageUrl,validationFx)
		{
		
			 var caption = document.mainForm.cmdClose.value;
			if (caption=="Cancel")
			{
				var retval = confirm("Do you want to save changes to this record?");
				if (retval == false) 
				{
					window.open(pageUrl,"_parent");
					return false;
				}
				else
				{
					var retval = true;
					if(validationFx!="") retval = eval(validationFx);
					if (retval==true)
					{
						//parent.parent.treeFrame.treeForm.txtRedirect.value  = 1;
						//parent.parent.treeFrame.treeForm.txtPageName.value = pageUrl;
						mainForm.cmdSave.fireEvent("onClick");
						if (document.mainForm.cmdBackP!=null)
						{
							document.mainForm.cmdBackP.name = "cmdSave"
							document.mainForm.cmdBackP.id =  "cmdSave"
						}
					}
					return retval;
				}
			}
			else
			{
				window.open(pageUrl,"_parent");
				return false;
			}
			return false;
			
		}
	
	function onClickPageBase(badd,bsave,bdelete,bclose)
	{
		if (badd==1 )
		{
			resetSaveButton();
		}
		
		/*
			if (bsave=="True" || bsave=="true")
			{
			
			}
			if (bdelete=="True" || bdelete=="true")
			{
			
			}
		*/
		
		if (bclose==1)
		{
			CloseCancel();			
		}
		
	}

	//*****************************************************************


var strFormat;

function ValidateElement (	strLabelValue, intFormNumber, intElementNumber, strElementValue,
							strElementType, boolCanBeBlank,intMinLength, intMaxLength, 
							strLessThanValue, strEqualToValue, strGreaterThanValue,
							boolAllowSpaces, boolFutureDate, boolDisplayMessage)

{
	strInvalidChars = "<>\"";

	//If it's okay for the field to be blank and it is blank, it is validated
	if ((boolCanBeBlank  == "T") && (strElementValue.length == 0))
		return true;

	//Validate Element Length
	if (! IsValidLength(strElementValue, intMinLength, intMaxLength))
	{
		if ((strElementValue.length == 0) && (boolCanBeBlank != "T"))
			strErrorMsg = "The " + strLabelValue + " cannot be left blank.";
		else
			if (intMinLength == intMaxLength)
				strErrorMsg = "The " + strLabelValue + " must be " + intMinLength +" characters long.";
			else
				strErrorMsg = "'" + strElementValue + "' The " + strLabelValue + " requires a length between " + intMinLength + " and " + intMaxLength + " characters.";
		if (boolDisplayMessage =="T")
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
		return false;
	}			

	//Validate Element Type
	if (! IsValidType(strElementValue, strElementType, strInvalidChars, boolAllowSpaces, boolFutureDate))
	{
		if (boolAllowSpaces == "F")
			if (boolFutureDate == "T")
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "] with no spaces.  This date must also be greater than today's date.";			
			else
				strErrorMsg = "The " + strLabelValue +" must be a valid " + strElementType + " in the following format [" + strFormat + "]"+" with no spaces.";
		else
			if (boolFutureDate == "T")
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "].  This date must also be greater than today's date.";			
			else
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "]";
		if (boolDisplayMessage =="T")				
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
		return false;
	}
	
	//If provided, validate whether element is less than another value
	if (strLessThanValue != "NULL")
		{
		if (! IsLessThan(strElementValue, strLessThanValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " cannot be greater than " + strLessThanValue;		
			if (boolDisplayMessage =="T")			
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
			return false;
		}
		}
	//If provided, validate whether element is equal to another value
	if (strEqualToValue != "NULL")
		if (! IsEqualTo(strElementValue, strEqualToValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " must be equal to " + strEqualToValue;		
			if (boolDisplayMessage =="T")
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
			return false;
		}

	//If provided, validate whether element is greater than another value
	if (strGreaterThanValue != "NULL")
		if (! IsGreaterThan(strElementValue, strGreaterThanValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " must be greater than " + strGreaterThanValue;		
			if (boolDisplayMessage =="T")			
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
			return false;
		}

	// if the validation was successful, then just return the true value.  this line won't be called if it failed anywhere during the
	// way because it will have returned already.
	return true;
}


//this function is a reworked version of the master function above.  The main difference is that this function
//accepts a string of invalid characters that can be used in validating strings
function IsValidElement(	strLabelValue, intFormNumber, intElementNumber, strElementValue, strElementType,
							strInvalidChars, boolCanBeBlank,intMinLength, intMaxLength, strLessThanValue, strEqualToValue, strGreaterThanValue,
							boolAllowSpaces, boolFutureDate, boolDisplayMessage)

{
	//If it's okay for the field to be blank and it is blank, it is validated
	if ((boolCanBeBlank  == "T") && (strElementValue.length == 0))
		return true;

	//Validate Element Length
	if (! IsValidLength(strElementValue, intMinLength, intMaxLength))
	{
		if ((strElementValue.length == 0) && (boolCanBeBlank != "T"))
			strErrorMsg = "The " + strLabelValue + " cannot be left blank.";
		else
			if (intMinLength == intMaxLength)
				strErrorMsg = "The " + strLabelValue + " must be " + intMinLength +" characters long.";
			else
				strErrorMsg = "The " + strLabelValue + " requires a length between " + intMinLength + " and " + intMaxLength + " characters.";
		if (boolDisplayMessage =="T")
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
		return false;
	}			

	//Validate Element Type
	if (! IsValidType(strElementValue, strElementType, strInvalidChars, boolAllowSpaces, boolFutureDate))
	{
		if (boolAllowSpaces == "F")
			if (boolFutureDate == "T")
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "] with no spaces.  This date must also be greater than today's date.";			
			else
				strErrorMsg = "The " + strLabelValue +" must be a valid " + strElementType + " in the following format [" + strFormat + "]"+" with no spaces.";
		else
			if (boolFutureDate == "T")
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "].  This date must also be greater than today's date.";			
			else
				strErrorMsg = "The " + strLabelValue +  " must be a valid " + strElementType + " in the following format [" + strFormat + "]";
		if (boolDisplayMessage =="T")				
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
		return false;
	}
	
	//If provided, validate whether element is less than another value
	if (strLessThanValue != "NULL")
		{
		if (! IsLessThan(strElementValue, strLessThanValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " cannot be greater than " + strLessThanValue;		
			if (boolDisplayMessage =="T")			
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber,strElementType)
			return false;
		}
		}
	//If provided, validate whether element is equal to another value
	if (strEqualToValue != "NULL")
		if (! IsEqualTo(strElementValue, strEqualToValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " must be equal to " + strEqualToValue;		
			if (boolDisplayMessage =="T")
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, strElementType)
			return false;
		}

	//If provided, validate whether element is greater than another value
	if (strGreaterThanValue != "NULL")
		if (! IsGreaterThan(strElementValue, strGreaterThanValue, strElementType))
		{
			strErrorMsg = "The " + strLabelValue + " must be greater than " + strGreaterThanValue;		
			if (boolDisplayMessage =="T")			
				ValidationFailed(strErrorMsg, intFormNumber, intElementNumber,strElementType)
			return false;
		}

	// if the validation was successful, then just return the true value.  this line won't be called if it failed anywhere during the
	// way because it will have returned already.
	return true;
}


// **************************************************************************************
// 	This routine will print out the appropriate error message for the corresponding error and
//	then put focus on the box being validated.
function ValidationFailed(strErrorMessage, intFormNumber, intElementNumber, strElementType)
{
	
	alert(strErrorMessage);
	if (document.forms[intFormNumber].elements[intElementNumber]!=null)
		document.forms[intFormNumber].elements[intElementNumber].focus();
	if (strElementType != "stringDDL")
	{
	 if (document.forms[intFormNumber].elements[intElementNumber]!=null)
		document.forms[intFormNumber].elements[intElementNumber].select();
	}
}

// **************************************************************************************
// 	This routine is used to ensure that the Element is of a certain type and meets
//	that type's requirements
function IsValidType(strElementValue, strElementType, strInvalidChars, boolAllowSpaces, boolFutureDate)
{
	// define element types
	// string, integer, real, date, email
	
//	if ((strElementType == "string") || (strElementType == "stringDDL"))
	if ((strElementType == "stringAndNum"))
		return IsValidString(strElementValue, "'`~!@#$%^&*()=+[]{}|;,.<>?:", boolAllowSpaces);
	if ((strElementType == "string"))
		return IsValidString(strElementValue, strInvalidChars, boolAllowSpaces);
	if ((strElementType == "name"))
		return IsValidName(strElementValue, strInvalidChars, boolAllowSpaces);
	if (strElementType == "integer")
		return IsValidInteger(strElementValue);
	if (strElementType == "real")
		return IsValidReal(strElementValue);
	if (strElementType == "currency")
		return IsCurr(strElementValue);		
	if (strElementType == "date")
		return IsValidDate(strElementValue, boolFutureDate);
	if (strElementType == "time")
		return IsValidTime(strElementValue);
	if (strElementType == "SSN")
		 return IsValidSSN(strElementValue);
	if (strElementType == "TaxId")
		 return IsValidTaxId(strElementValue);		  
	if (strElementType == "phone")
		 return IsValidPhoneNumber(strElementValue);
	if (strElementType == "shortdate")
		return IsValidShortDate(strElementValue);
/*	if (strElementType == "phoneno")
		return IsValidPhoneNo(strElementValue);
*/	if (strElementType == "zipcode")
		return IsValidZipCode(strElementValue);
	if (strElementType == "email")
		return IsValidEmail(strElementValue);
		
	return true;	
}

// **************************************************************************************
// 	This routine is used to ensure that the Element is a valid string by checking for 
//	invalid characters and blank spaces
function IsValidString(strElementValue, strInvalidChars, boolAllowSpaces)
{
	var boolAllSpaces;
	boolAllSpaces = true;
	strInvalidChars = strInvalidChars
	if (boolAllowSpaces == "F")
		strInvalidChars = strInvalidChars + " " ;

	strFormat = "does not contain any of the following characters:  " + strInvalidChars + " and cannot consist entirely of spaces";
			
	for (i=0; i < strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		if (strInvalidChars.indexOf(chrElementChar, 0) != -1)
				return false;
		if (chrElementChar != " ")
			boolAllSpaces = false;
	}
	
	if (boolAllSpaces)
		return false;
		
	return true;
}

// **************************************************************************************
// 	This routine is used to ensure that the Element is a valid string by checking for 
//	invalid characters and blank spaces
function IsValidName(strElementValue, strInvalidChars, boolAllowSpaces)
{
	var boolAllSpaces;
	
	boolAllSpaces = true;
	strInvalidChars = strInvalidChars + "0123456789" 
	if (boolAllowSpaces == "F")
		strInvalidChars = strInvalidChars + " " ;

	strFormat = "does not contain any of the following characters:  " + strInvalidChars + " and cannot consist entirely of spaces";
			
	for (i=0; i < strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		if (strInvalidChars.indexOf(chrElementChar, 0) != -1)
				return false;
		if (chrElementChar != " ")
			boolAllSpaces = false;
	}
	
	if (boolAllSpaces)
		return false;
		
	return true;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is a valid integer
function IsValidInteger(strElementValue)
{
	strFormat = "contains only digits 0-9";

	for (i=0; i < strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		if ((chrElementChar < "0") || (chrElementChar > "9"))
			return false;
	}
	return true;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is a valid real number
function IsValidReal(strElementValue)
{
	strFormat = "xxx.xx";

	intPeriodsFound=0;
	for (i=0; i < strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		if (((chrElementChar < "0") || (chrElementChar > "9")) && (chrElementChar != "."))
			return false;
		if (chrElementChar == ".")
			intPeriodsFound=intPeriodsFound+1;
	}
	if (intPeriodsFound > 1)
		return false;
	return true;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is a valid real number
function IsCurr(strElementValue)
{
	strFormat = "-xxx.xx";
    dec=0
	intPeriodsFound=0;
	
	
	for (i=0; i < strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		
		if (i==0)
		   {
		   if (((chrElementChar < "0") || (chrElementChar > "9" )) &&  (chrElementChar != ".")) 
		      {
		      if (chrElementChar != "-") 
		         {
		          return false;
		         } 
		      } 
		   }
		else 
		   {   			
		    if (((chrElementChar < "0") || (chrElementChar > "9")) && (chrElementChar != "."))
			    return false;
		
		    if (intPeriodsFound > 0)
		       {
		       dec++  
	    	   }
            if (chrElementChar == ".")
		        intPeriodsFound=intPeriodsFound+1;	
		   }
	}
	if (intPeriodsFound > 1)
		return false;
	if (dec > 2)
		return false;
			
	return true;
}


function containsSpecialCharacter( val)
{

 var disallowedSpecialCharacters = new Array("\\", ":", "*", "?","!",  "<", ">", "|", "#", "+", "&", "%","^","\"","'",";");

	//if (isWhitespace(val))
	//{
	//	return false;
	//}

  var foundError = 0;

  for( var i=0; (i < disallowedSpecialCharacters.length) && !foundError; i++)
  {
    if ( val.indexOf( disallowedSpecialCharacters[i], 0 ) >= 0 )
		 return 0;
  }
  	
  return 1;
}


// **************************************************************************************
//	This routine is used to ensure that the Element is a valid date
function IsValidDate(strElementValue, boolFutureDate)
{


	strFormat = "mm/dd/yyyy";

	strInvalidChars="`~!@#$%^&*()=+[]{}|;,.<>?:";
	strValidChars="0123456789/";
	strValidNumbers="0123456789";
	
	if (strElementValue.indexOf(strInvalidChars) != -1) {
	strDateArray = strMyDate.split("/");
		if (strDateArray.length != 3) {
			return false;
		}
		else {
			strDate = strDateArray[0];
			strMonth = strDateArray[1];
			strYear = strDateArray[2];
		}
	
		if (strDate.length==1){
			strDate  = "0" + strDate ;
		}
		if (strMonth.length==1){
			strMonth  = "0" + strMonth ;
		}
		if (strYear.length==1){
			strYear  = "200" + strYear ;
		}
		if (strYear.length==2){
			strYear  = "20" + strYear ;
		}
  
		strElementValue = strMonth + "/" + strDate + "/" + strYear
	}
	/*
	if (strElementValue.length == 8){
		for (i = 0;i < strElementValue.length ;i++)
		{
			chrElementChar= strElementValue.substring(i,i+1);
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 	
		}	
		var newVar = strElementValue.substring(0,2) + "/" ;
		newVar  = newVar + strElementValue.substring(2,4) + "/";
		newVar = newVar + strElementValue.substring(4);
		strElementValue = newVar;
	}
	
	*/	
	//if (strElementValue.indexOf("-",0) == -1)
		chrSep = "/";
	//else
	//	chrSep = "-";
	
	intFirstSep=strElementValue.indexOf(chrSep);
	if ((intFirstSep == 0) || (intFirstSep > 2) || (intFirstSep == -1))
		return false;
		intMonth=strElementValue.substring(0,intFirstSep);
	for (i=0; i < intMonth.length; i++)
	{
		chrElementChar = intMonth.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
	if ((intMonth > 12) || (intMonth < 1))
		return false;


	strElementValue=strElementValue.substring(intFirstSep+1,strElementValue.length);
	intSecondSep = strElementValue.indexOf(chrSep);	
	if ((intSecondSep == 0) || (intSecondSep > 2) || (intSecondSep == -1))
		return false;
	intDay=strElementValue.substring(0,intSecondSep);	
	for (i=0; i < intDay.length; i++)
	{
		chrElementChar = intDay.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}

	strElementValue=strElementValue.substring(intSecondSep+1,strElementValue.length);
	intYear=strElementValue.substring(0,strElementValue.length);
//	if ((strElementValue.length != 2) && (strElementValue.length != 4))
//		return false;
	
	if (strElementValue.length != 4)
		return false;
/*
	if (strElementValue.length != 2)
		return false;
*/

	if(intYear<1)
	 return false;
	if(intMonth<1)
	 return false;
	if(intDay<1)
	 return false;
	   
	for (i=0; i < intYear.length; i++)
	{
		chrElementChar = intYear.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
/*	
	if (intYear > 2999)
		return false;

        if (intYear < 1900)
		return false;
*/
/*
	if (intYear > 70)
		intYear = "19" + intYear;
	else
		intYear = "20" + intYear;	

*/

	if ((intMonth == 1) || (intMonth == 3) || (intMonth == 5) || (intMonth == 7) || (intMonth == 8) || (intMonth == 10) || (intMonth == 12))
		if ((intDay > 31) || (intDay < 1))
			return false;

	if ((intMonth == 4) || (intMonth == 6) || (intMonth == 9) || (intMonth == 11))
		if ((intDay > 30) || (intDay < 1))
			return false;

	if (intMonth == 2) 
		if ((intYear % 4) != 0)
		{
			if ((intDay > 28) || (intDay < 1))
				return false;
		}
		else
		{
			if ((intDay > 29) || (intDay < 1))
				return false;
		}
		
	if (boolFutureDate == "T")
	{
		strCurrentDate = new Date();
		intCurrentYear = strCurrentDate.getYear() * 1;
		intCurrentMonth = (strCurrentDate.getMonth() * 1) + 1;
		intCurrentDay = strCurrentDate.getDate() * 1;
		if (intCurrentYear < 100)
			intCurrentYear = intCurrentYear + 1900;

		if (intYear < intCurrentYear)
			return false;

		if ((intYear == intCurrentYear) && (intMonth < intCurrentMonth))
			return false;

		if ((intYear == intCurrentYear) && (intMonth == intCurrentMonth) && (intDay <= intCurrentDay))
			return false;
	}
		
	return true;
	
}

// **************************************************************************************
//	This routine is used to ensure that the Element is a valid date
function IsValidShortDate(strElementValue)
{

	strFormat = "mm/yy";

	strInvalidChars="`~!@#$%^&*()=+[]{}|;,.<>?:";
	strValidChars="0123456789-/";
	strValidNumbers="0123456789";
	
	if (strElementValue.indexOf("-",0) == -1)
		chrSep = "/";
	else
		chrSep = "-";
	
	intFirstSep=strElementValue.indexOf(chrSep);
	if ((intFirstSep == 0) || (intFirstSep > 2) || (intFirstSep == -1))
		return false;
	intMonth=strElementValue.substring(0,intFirstSep);
	for (i=0; i < intMonth.length; i++)
	{
		chrElementChar = intMonth.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
	if ((intMonth > 12) || (intMonth < 1))
		return false;

	strElementValue=strElementValue.substring(intFirstSep+1,strElementValue.length);
	intYear=strElementValue.substring(0,strElementValue.length);
	if (strElementValue.length != 2)
		return false;

	for (i=0; i < intYear.length; i++)
	{
		chrElementChar = intYear.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
	if ((intYear < 98) && (intYear > 50))
		return false;

	strCurrentDate = new Date();
	intCurrentMonth = (strCurrentDate.getMonth() * 1) + 1;	
	
	if ((intYear == 98) && (intMonth < intCurrentMonth))
		return false;

	return true;
}

/*Function to check for a valid time
*/

function IsValidTime(strElementValue)
{

	strFormat = "hh:mm:ss";

	strInvalidChars="`~!@#$%^&*()=+[]{}|;,.<>?";
	strValidChars="0123456789-/";
	strValidNumbers="0123456789";
	
/*	if (strElementValue.indexOf("-",0) == -1)
		chrSep = "/";
	else
		chrSep = "-";
*/		
	chrSep = ":";	
	
	intFirstSep=strElementValue.indexOf(chrSep);
	if ((intFirstSep == 0) || (intFirstSep > 2) || (intFirstSep == -1))
		return false;
		
		intHour=strElementValue.substring(0,intFirstSep);
	for (i=0; i < intHour.length; i++)
	{
		chrElementChar = intHour.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
	if ((intHour > 24) || (intHour < 0))
		return false;


	strElementValue=strElementValue.substring(intFirstSep+1,strElementValue.length);
	intSecondSep = strElementValue.indexOf(chrSep);	
	if ((intSecondSep == 0) || (intSecondSep > 2) || (intSecondSep == -1))
		return false;
	intMinutes=strElementValue.substring(0,intSecondSep);	
	for (i=0; i < intMinutes.length; i++)
	{
		chrElementChar = intMinutes.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}

	if (intMinutes > 60) 
		return false;
		
	if (intMinutes < 0)
		return false;	

	strElementValue=strElementValue.substring(intSecondSep+1,strElementValue.length);
	intSeconds=strElementValue.substring(0,strElementValue.length);
//	if ((strElementValue.length != 2) && (strElementValue.length != 4))
//		return false;
	if (strElementValue.length != 2)
		return false;

	for (i=0; i < intSeconds.length; i++)
	{
		chrElementChar = intSeconds.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
		else
			if (strValidNumbers.indexOf(chrElementChar) == -1)
				return false; 
	}
	
	if (intSeconds > 60)
		return false;

    if (intSeconds < 0)
		return false;

	return true;
	
}

/*Check for validity of Tax ID Number*/
function IsValidTaxId(strElementValue)
{

	strFormat = "XX-XXXXXXX";

	strInvalidChars="`~!@#$%^&*()=+[]{}|;,.<>?:";
	strValidChars="0123456789-";
	strValidNumbers="0123456789";
	
	if (strElementValue.length == 9){
		if (strElementValue.search("-") == -1)
			return true;
	}
		
	chrSep = "-";
	
	if (strElementValue.length !=  10)
		return false;

	for (i = 0;i < strElementValue.length ;i++)
	{
		chrElementChar= strElementValue.substring(i,i+1);
		if (strValidChars.indexOf(chrElementChar) == -1)
			return false; 	
	}	
	
	if ((strElementValue.substring(2,3))!= "-")
		return false;
		
	return true;
}

/*Check for validity of SSN*/
function IsValidSSN(strElementValue)
{

	strFormat = "XXX-XX-XXXX";

	strInvalidChars="`~!@#$%^&*()=+[]{}|;,.<>?:";
	strValidChars="0123456789-";
	strValidNumbers="0123456789";
	
	if (strElementValue.length == 9){
		if (strElementValue.search("-") == -1)
			return true;
	}
		
	chrSep = "-";
	
	if (strElementValue.length !=  11)
		return false;

	for (i = 0;i < strElementValue.length ;i++)
	{
		chrElementChar= strElementValue.substring(i,i+1);
		if (strValidChars.indexOf(chrElementChar) == -1)
			return false; 	
	}	
	
	if ((strElementValue.substring(3,4) != "-") || (strElementValue.substring(6,7) != "-"))
		return false;
		
	return true;
	
}

/*Check for validity of Phone Number. This accepts a 10 digit phone number
seperated either by ()or - or spaces*/
function IsValidPhoneNumber(strElementValue)
{
//strFormat = "10-Digit Phone Number";
strValidNums="0123456789";
//strInvalidChars = strInvalidChars + " " ;

//strFormat = "does not contain any of the following characters:  " + strInvalidChars + " and cannot consist entirely of spaces";
  
  if (strElementValue.length == 0) 
    return false;
     
		
  	strElementValue = strElementValue.replace(" ",""); 
  if (((IsValidInteger(strElementValue)) &&   strElementValue.indexOf("-") == -1) )
    return true;
 
 if (strElementValue.length < 15)
   {
		strFormat = "10-Digit Phone Number";				
		return false;
		
	}
  var i;
  var returnString = "";

  for (i = 0; i < strElementValue.length; i++)
    {   
    // Check that current character isn't blank
    var c = strElementValue.charAt(i);
    if (strValidNums.indexOf(c) != -1) 
      returnString += c;
    }
  
  if (returnString.length != 10)
	return false;


//strFormat = "##### or #####-####";
	var c = strElementValue.charAt(0);
	if (c == "("){
		c = strElementValue.charAt(4);
		if (c != ")")
		return false;
		c = strElementValue.charAt(8);
	if (c != "-")
		return false ;  
	}
	else{
		c = strElementValue.charAt(3)	
		if (c != "-")
			return false;
		c = strElementValue.charAt(7);
		if (c != "-")
			return false ;  
	}
	
     
  return true;		

}

// **************************************************************************************
//	This routine is used to ensure that the Element is a valid Zip Code

function IsValidZipCode(s)
{
	strFormat = "##### or ###### or #####-####";
	strValidNums = "0123456789";
	returnString = "";

  if ((IsValidInteger(s)) && (s.indexOf("-") == -1) && (s.length == 5))
    return true;
    
  if ((IsValidInteger(s)) && (s.indexOf("-") == -1) && (s.length == 6))
    return true;

strFormat = "##### or #####-####";
  if ((s.indexOf("-") != 5)&&(s.indexOf("-") != 6)&&(s.indexOf("-") != -1))  // - in wrong place
    return false;

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character isn't blank
    var c = s.charAt(i);
    if (strValidNums.indexOf(c) != -1) 
      returnString += c;
    }

  if ((returnString.length == 9)||(returnString.length == 5)||(returnString.length == 6))
    return true;   // #####-####
  else
    return false;  // not #####-####
  
}
// **************************************************************************************
//	This routine is used to ensure that the Element is a valid Email Address
function IsValidEmail(strElementValue)
{
	strFormat = "name@domainname.com";
	
	strInvalidChars="`~!#$%^&@*()=+[]{}|;,<>?:";
	strInvalidBodyChars="`~!#$%^&@*()=+[]{}|;,<>.?:";	

	intFirstSep=strElementValue.indexOf("@");
	if ((intFirstSep == 0) || (intFirstSep == -1))
		return false;
		
	strName=strElementValue.substring(0,intFirstSep);
	for (i=0; i < strName.length; i++)
	{
		chrElementChar = strName.substring(i, i+1);
		if (strInvalidChars.indexOf(chrElementChar) != -1)
				return false;
	}

	strElementValue=strElementValue.substring(intFirstSep+1,strElementValue.length);
	intSecondSep = -1;
	for (i=0; i< strElementValue.length; i++)
	{
		chrElementChar = strElementValue.substring(i, i+1);
		if (chrElementChar == ".")
			intSecondSep = i;
	}

	if ((intSecondSep == 0) || (intSecondSep == -1))
		return false;
	strLocation=strElementValue.substring(0,intSecondSep);	
	for (i=0; i < strLocation.length; i++)
	{
		chrElementChar = strLocation.substring(i, i+1);
		if ((strInvalidChars.indexOf(chrElementChar) != -1))
				return false;
	}

	strElementValue=strElementValue.substring(intSecondSep+1,strElementValue.length);
	strExtension=strElementValue.substring(0,strElementValue.length);
	if (strExtension.length != 3)
		return false;
	for (i=0; i < strExtension.length; i++)
	{
		chrElementChar = strExtension.substring(i, i+1);
		if ((strInvalidBodyChars.indexOf(chrElementChar) != -1))
				return false;
	}
	return true;
}


// **************************************************************************************
//	This routine is used to ensure that the Element is of a valid length.  This checks
//	minimum and maximum parameters
function IsValidLength(strElementValue, intMinLength, intMaxLength)
{
	if ((strElementValue.length <= intMaxLength) && (strElementValue.length >= intMinLength))
		return true;
	else
		return false;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is less than a passed value
function IsLessThan(strElementValue, strLessThanValue, strElementType)
{
	if (strElementType == "integer")
	{
		strElementValue=strElementValue*1;
		strLessThanValue=strLessThanValue*1;
	}	
	if (strElementType == "real")
	{
		strElementValue=strElementValue*1.0;
		strLessThanValue=strLessThanValue*1.0;
	}			
	
	if (strElementValue <= strLessThanValue)
		return true;
	else
		return false;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is equal to a passed value
function IsEqualTo(strElementValue, strEqualToValue, strElementType)
{
	if (strElementType == "integer")
	{
		strElementValue=strElementValue*1;
		strEqualToValue=strEqualToValue*1;
	}	
	if (strElementType == "real")
	{
		strElementValue=strElementValue*1.0;
		strEqualToValue=strEqualToValue*1.0;
	}			

	if (strElementValue == strEqualToValue)
		return true;
	else
		return false;
}

// **************************************************************************************
//	This routine is used to ensure that the Element is greater than a passed value
function IsGreaterThan(strElementValue, strGreaterThanValue, strElementType)
{
	if (strElementType == "integer")
	{
		strElementValue=strElementValue*1;
		strGreaterThanValue=strGreaterThanValue*1;
	}	
	if (strElementType == "real")
	{
		strElementValue=strElementValue*1.0;
		strGreaterThanValue=strGreaterThanValue*1.0;
	}			
	
	if (strElementValue > strGreaterThanValue)
		return true;
	else
		return false;
}

function deleteConfirm()
{
 if (confirm("Are you sure you want to delete?"))
	return true
else
	return false	
}
//Function to compare two dates.Checks if the start date is lower than end date.If end date is null current date
//is taken as end date.dates should be in mm/dd/yy format

function compareDates(startDate,endDate,intFormNumber,intElementNumber,Field1,Field2)
{
		strErrorMsg = Field1 + " cannot be Greater than " + Field2; 

        var intStartYear;
		var intStartMonth;
		var intStartDay;
 		
 		var intEndYear;
		var intEndMonth;
		var intEndDay;
		
		var strStartDate = startDate;
		var strEndDate;
		intStartMonth = strStartDate.substring(0,2);
		intStartDay = strStartDate.substring(3,5);
		intStartYear = strStartDate.substring(6,10);
	/*	
		if (intStartYear > 50)
			intStartYear = "19" + intStartYear ;
		else
			intStartYear = "20" + intStartYear ;

	*/	
		if (endDate.length == 0) {
			strEndDate = new Date();
			intEndYear = strEndDate.getYear() * 1;
			intEndMonth = (strEndDate.getMonth() * 1) + 1;
			intEndDay = strEndDate.getDate() * 1;
		} else{
			strEndDate = endDate;
			intEndMonth = strEndDate.substring(0,2);
			intEndDay = strEndDate.substring(3,5);
			intEndYear = strEndDate.substring(6,10);
/*			
			if (intEndYear > 50)
				intEndYear = "19" + intEndYear;
			else
				intEndYear = "20" + intEndYear;
*/				
		}	
			
		if (intEndYear < intStartYear){
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, "date");
			return false;
		}
		if ((intEndYear == intStartYear) && (intEndMonth < intStartMonth)){
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, "date");
			return false;
		}	

		if ((intEndYear == intStartYear) && (intEndMonth == intStartMonth) && (intEndDay < intStartDay)){
			ValidationFailed(strErrorMsg, intFormNumber, intElementNumber, "date");
			return false;
		}
		return true;
}

	function resetDateFields(field){
		setDateField(field);top.newWin = window.open('../ValidationComponent/calendar.html','cal','dependent=yes,width=210,height=230,screenX=600,screenY=300,titlebar=yes');
		resetSaveButton();
}	

	function evaluateKeyDown() {
	
		if ((event.keyCode == 46) || (event.keyCode == 8)){
			resetSaveButton();
		}
		
	}

	function resetSaveButton() {
			if (mainForm.cmdSave != null) {
				mainForm.cmdSave.disabled = false;
				//mainForm.cmdSave.style.backgroundColor = '#ffffcc' ;	
			}
			if (mainForm.cmdAdd != null) {
				mainForm.cmdAdd.value = "Reset";
			}
			
	}
	function resetForm(){
		if (mainForm.cmdAdd.value == "Reset"){
			mainForm.reset();
			mainForm.cmdSave.disabled = true;
			//mainForm.cmdSave.style.backgroundColor = '#ffffcc' ;
			mainForm.cmdAdd.value = "Add";	
			return false;
		}else {
			return true;	
		}
	
	}

	function evaluateQuotes(){
		
			for (i = 0;i<mainForm.length;i++){
				if ((mainForm.item(i).type == "text") || (mainForm.item(i).type == "textarea")){
					strVal = mainForm.item(i).value;
				ind = 0;
				newVal = "";
				while (ind != -1)	{
				  ind =	strVal.indexOf("'",0);
				  if (ind != -1){
				  	if (strVal.charAt(ind + 1) != "'"){
				  		newVal = newVal + strVal.substring(0,ind +1) + "'";
				  		strVal = strVal.substring(ind + 1);
					}else {
						newVal = newVal + strVal.substring(0,ind + 2);
				  		strVal = strVal.substring(ind + 2);
					}
					
				  } else {
					newVal = newVal + strVal;
				  }		
				}
				mainForm.item(i).value = newVal;
			   }
			}	
		return true;	
	}
	
	
	function saveForm() {
			
			if (parent.mainFrame.mainForm.cmdSave == null) {
				return true;
				}
			else {
				if (parent.mainFrame.mainForm.cmdSave.disabled) {
					return true;
				}
				else{
					if (confirm("Do You want to save your changes")) {
						parent.mainFrame.mainForm.cmdSave.click();
						return false;
					}
					else {
						return true;
					}
				}
			}
		}
	
	function formatField(strLabelValue, intElementNumber, strElementValue,strElementType){
			var ElmntLen  = 13
			if (strElementType=="email") ElmntLen = 100;

			if (ValidateElement(strLabelValue,0,intElementNumber,strElementValue.value,strElementType,"T",1,ElmntLen,"NULL","NULL","NULL","T","F","T")){
				var x = strElementValue.value;
				if (strElementType == "phone"){
					if (x.length > 9){
						x = x.replace("(","");
						x = x.replace(")","");
						while (x.search("-") != -1){
							x = x.replace("-","");
						}	
						var y = x.substring(0,3) + "-";					
						y = y + x.substring(3,6) + "-";
						y = y + x.substring(6);
						strElementValue.value = y;
					}
				}
				
				if (strElementType == "SSN"){
					if (x.length == 9){
						var y = x.substring(0,3) + "-";					
						y = y + x.substring(3,5) + "-";
						y = y + x.substring(5);
						strElementValue.value = y;
					}
				}

				if (strElementType == "date"){
				
					strDateArray = x.split("/");
					if (strDateArray.length != 3) {
						return false;
					}
					else {
						strDate = strDateArray[0];
						strMonth = strDateArray[1];
						strYear = strDateArray[2];
					}
				
					if (strDate.length==1)
						strDate  = "0" + strDate ;
					if (strMonth.length==1)
						strMonth  = "0" + strMonth ;
					if (strYear.length==1)
						strYear  = "200" + strYear ;
					if (strYear.length==2)
						strYear  = "20" + strYear ;
					x = strMonth + "/" + strDate + "/" + strYear
					if (x.length == 8){
						var y = x.substring(0,2) + "/";					
						y = y + x.substring(2,4) + "/";
						y = y + x.substring(4);
						strElementValue.value = y;
					}
				}
				if (strElementType == "zipcode"){
					if (x.length <= 10){
						while (x.search("-") != -1){
							x = x.replace("-","");
						}	
						if (x.length == 5)
							var y = x.substring(0,5);
						else{
							var y = x.substring(0,5) + "-";
							y = y + x.substring(5,9);
							}
						strElementValue.value = y;
					}
				}
			}
		}	
		
// Added by Ranjan for changes in Phone format		
function formatFieldNew(strLabelValue,intFormNumber, intElementNumber, strElementValue,strElementType){
	
			if (ValidateElement(strLabelValue,intFormNumber,intElementNumber,strElementValue,strElementType,"T",1,14,"NULL","NULL","NULL","T","F","T")){
				var x = strElementValue.replace(" ","");
				if (strElementType == "phone"){
					if (x.length > 9){
						x = x.replace("(","");
						x = x.replace(")","");
						while (x.search("-") != -1){
							x = x.replace("-","");
						}
						var y = "(" + x.substring(0,3) ;	
						y = y  + ") " ;				
						y = y + x.substring(3,6) + "-";
						y = y + x.substring(6);
						document.forms[intFormNumber].elements[intElementNumber].value=y;
						
					}
				}
				else return false;
							
				if (strElementType == "SSN"){
					var x = strElementValue;
					
					if (x.length == 9){
						var y = x.substring(0,3) + "-";					
						y = y + x.substring(3,5) + "-";
						y = y + x.substring(5);
						document.forms[intFormNumber].elements[intElementNumber].value=y;
					}
				}

				if (strElementType == "date"){
				 var x = strElementValue;
	
					if (x.length == 8){
						var y = x.substring(0,2) + "/";					
						y = y + x.substring(2,4) + "/";
						y = y + x.substring(4);
					y = y.replace("-","/");
						document.forms[intFormNumber].elements[intElementNumber].value=y;
					//	strElementValue.value = y;
					}
				}
				if (strElementType == "zipcode"){
				var x = strElementValue;
					if (x.length <= 10){
						while (x.search("-") != -1){
							x = x.replace("-","");
						}	
						if (x.length == 5)
							var y = x.substring(0,5);
						else{
							var y = x.substring(0,5) + "-";
							y = y + x.substring(5,9);
							}
							document.forms[intFormNumber].elements[intElementNumber].value=y;
						//strElementValue.value = y;
					}
				}
			}
			
		}	

	function closeProvider(){
	//		window.open("http://localhost/socialsoft/provider/frmSrcProvider.aspx","_parent")
			window.open("frmSrcProvider.aspx","_parent")
			return false
		}

	function closeConsumer(){
	//		window.open("http://localhost/socialsoft/provider/frmSrcProvider.aspx","_parent")
			window.open("frmSrcConsumer.aspx","_parent")
			return false
		}
	
	function navigateURL(){

		if (mainForm.cmdAdd.value == "Reset"){
			mainForm.reset();
			mainForm.cmdSave.disabled = true;
			//mainForm.cmdSave.style.backgroundColor = '#ffffcc' ;
			mainForm.cmdAdd.value = "Add";	
			return false;
		}else {
			//window.open("http://localhost/socialsoft/provider/tabs.aspx?Source=Add","_parent")
			window.open("tabs.aspx?Source=Add","_parent")
			if (parent.parent.treeFrame != null) {
			 //if (parent.parent.treeFrame.treeForm != null) {
			//	parent.parent.treeFrame.treeForm.txtKeyId.value = '';
			//	parent.parent.treeFrame.treeForm.txtKeyYear.value = '';
			// }	
			}
			
			return false
		}

	
}

          function OpenSearchWindow()   
            {
			  		 var returnValue = open("../Provider/frmFindProvider.aspx","","height=400px,width=675px,menubar=no,status=no,toolbar=no,location=no");
				 return false;
			}
			
		 function OpenFindConsumer()   
		   {
					var returnValue = open("../Consumer/frmFindConsumer.aspx","","height=350px,width=675px,menubar=no,status=no,toolbar=no,location=no");
					return false;
			}	
			
			 function OpenFindProvider()   
			    {							
					var returnValue = open("../Provider/frmFindProvider.aspx","","height=350px,width=675px,menubar=no,status=no,toolbar=no,location=no");
					return false;
						
				}
function GetProviderInfo()  {
	
	GetMenuInfo();
	
	if (mainForm.txtProvId.value == '') {
		alert('A Valid Provider Id is needed to view the screen');
		parent.parent.mainFrame.navigate('../provider/tabs.aspx');
	}
}

function SpreadUnitCost()  
{
	if (mainForm.txtUnitCost.value > 0) 
	{
		if (confirm("Okay to Distribute Unit Cost remaining periods?")) 
		{
			mainForm.txthndBoolUnitCost.value = 1;
			//return true;
		}
		else
		{
			mainForm.txthndBoolUnitCost.value = 0;
			//return false;	
		}
	}
	else
		return false;
}

function SpreadBudgetAmt()  
{
	if (mainForm.txtBudgetAmt.value > 0) 
	{
		if (confirm("Okay to Distribute Budget Amount across remaining periods?")) 
		{
			mainForm.txthndBoolBudgetAmt.value = 1;
			//return true;
		}
		else
		{
			mainForm.txthndBoolBudgetAmt.value = 0;
			//return false;	
		}
	}
	else
		return false;
}

function Trim(strValue)
	{
		strValue =  RightTrim(strValue);
		strValue =  LeftTrim(strValue);
		return strValue;
	}
	function RightTrim(strValue)
	{
		strTemp = new String(strValue)
		strFinal = new String(strValue)
		for (i = strValue.length; i >=0 && strTemp.charAt(i-1) ==  " "; i--)
		{
			strFinal = strTemp.substring(0, i-1)	
		}
		return strFinal	
	}
	function LeftTrim(strValue)
	{
		strTemp = new String(strValue)
		strFinal = new String(strValue)
		for (i = 0; i<=strTemp.length && strTemp.charAt(i) ==  " "; i++)
		{		// <A HREF="http://localhost/TextileCreations/HomePage.aspx">http://localhost/TextileCreations/HomePage.aspx</A>
			strFinal = strTemp.substring((i+1), strTemp.length)	
		}
		return strFinal	
	}
	
	function OpenClient(BrowserType)   
	{
		var returnValue = OpenModelWindow(BrowserType,'Client Search',"../Consumer/frmFindConsumer.aspx",385,650 )
		if (returnValue!=null)
		{
			window.document.mainForm.txtCnsmrId.value = returnValue;
			window.document.mainForm.submit();
		}
		//var returnValue = open("../Consumer/frmFindConsumer.aspx","","height=350px,width=675px,menubar=no,status=no,toolbar=no,location=no");
		return false;
	}	
			
	function OpenProvider(BrowserType)   
	{							
		var returnValue = OpenModelWindow(BrowserType,'Provider Search',"../Provider/frmFindProvider.aspx",360,650)
		if (returnValue!=null)
		{
			window.document.mainForm.txtProvId.value = returnValue;
			window.document.mainForm.submit();
		}	
		//var returnValue = open("../Consumer/frmFindConsumer.aspx","","height=350px,width=675px,menubar=no,status=no,toolbar=no,location=no");
		return false;
			
	}
	
	function OpenModelWindow(BrowserType, WindowName,encodedURL, dialogHeight, dialogWidth,SBV,SBH )
	{
	
		var retWindow 
		var addSum;
		var whtUNeed;
		if (BrowserType == "IE") 
		{
			//retWindow = window.showModalDialog("../aspx/loadModelwindow.aspx?NAME=" + WindowName + "&URL=" + encodedURL ,whtUNeed,"dialogHeight: " + dialogHeight + "px; dialogWidth: " + dialogWidth + "px; dialogTop: 50px; dialogLeft: 100px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No; scroll: No;");
				retWindow = window.showModalDialog("/TextileCreations/Admin/loadModelwindow.aspx?NAME=" + WindowName + "&URL=" + encodedURL + "&SBV=" + SBV + "&SBH=" + SBH ,whtUNeed,"dialogHeight: " + dialogHeight + "px; dialogWidth: " + dialogWidth + "px; dialogTop: 50px; dialogLeft: 100px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No; scroll: No;");
			}		
		else
		{		
				//retWindow  = window.open("/TextileCreations/Admin/loadModelwindow.aspx?NAME=" + WindowName + "&URL=" + encodedURL + "&SBV=" + SBV + "&SBH=" + SBH,WindowName,'width=' + dialogWidth + 'px,height=' + dialogWidth +  ',top=100,left=100');
				retWindow  = window.open(encodedURL,WindowName,'width=' + dialogWidth + 'px,height=' + dialogWidth +  ',top=100,left=100');
		}
		return retWindow;
	}
	
	
	function OpenModelWindowNCOA(BrowserType, WindowName,encodedURL, dialogHeight, dialogWidth,SBV,SBH )
	{
	    var retWindow 
		var addSum;
		var whtUNeed;
		if (BrowserType == "IE") 
		{
			//retWindow = window.showModalDialog("../aspx/loadModelwindow.aspx?NAME=" + WindowName + "&URL=" + encodedURL ,whtUNeed,"dialogHeight: " + dialogHeight + "px; dialogWidth: " + dialogWidth + "px; dialogTop: 50px; dialogLeft: 100px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No; scroll: No;");
			retWindow = window.showModalDialog("../Maintenance/loadModelwindow.aspx?NAME=" + WindowName + "&URL=" + encodedURL + "&SBV=" + SBV + "&SBH=" + SBH ,whtUNeed,"dialogHeight: " + dialogHeight + "px; dialogWidth: " + dialogWidth + "px; dialogTop: 50px; dialogLeft: 100px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No; scroll: No;");
			}		
		else
		{
				retWindow  = window.open(encodedURL,WindowName,'width=' + dialogWidth + 'px,height=' + dialogWidth +  ',top=100,left=100');
		}
		return retWindow;
	}	
//	End of routines

