/*-------------------------------------------------------------------------
 *  Validation.js - Common validation like date, email and so on.
 *  Version:	$Name:  $
 *  Module:	
 *
 *  Purpose:	To Do Common validation like date, email, numeric, 
 *              alphanumeric, compare with currrent date.
 *  See:	
 *
 *  Author:	B.Jayakumar  (jayakumar@kuruvi.ooty.tenet.res.in)
 *
 *  Created:        Wed 11-Jul-2007 13:12:49
 *  Last modified:  Tue 25-Sep-2007 08:42:19 by jayakumar
 *  $Id: Validation.js,v 1.1 2009/07/14 04:29:43 vinoth Exp $
 *
 *  Bugs:	
 *
 *  Change Log:	<Date> <Author>
 *  		<Changes>
 -------------------------------------------------------------------------*/

var testWin = new Array();
var newWindowName = "newWindowName";
var htmlEditorWin = "";
var htmlEditorWinMod = "";
var myProfileWin = "";
var searchKBaseWin = "";
var customerReport = "";
var modifyKBaseWinSup = "";
var modifyKBaseWin = "";
var openKBaseDesc = "";
var openDescriptionView = "";

/*-------------------------------------------------------------------------
*    inArray -- Check if the given values in present in the given array
*    Args:
*    Returns:
-------------------------------------------------------------------------*/
function inArray(argArray,argValue)
{
    for(var tmpI = 0;tmpI < argArray.length;tmpI++)
    {
        if(argArray[tmpI] == argValue)
          {
            return true;
          }
    }
    return false;
}

/*-------------------------------------------------------------------------
 *  isDate -- To validate the given date
 *    Args:	argDate
 *    Returns:	True on success and False on failure.
 * -------------------------------------------------------------------------*/

function isDate(argDate)
{
  var regDateFormate = /^[0-9]{1,2}[-]{1}[0-9]{1,2}[-]{1}[0-9]{4}$/;
  if(!regDateFormate.test(argDate))
    {
      return false;
    }

  var tmpDate   = argDate.split('-');
  var tmpMonthStr = tmpDate[1] - 1;
  var myDate = new Date();
  myDate.setFullYear( tmpDate[2], tmpMonthStr, tmpDate[0]);

  if ( myDate.getMonth() != tmpMonthStr ) 
  {
    return false;
  } 
  return true;
}	/*  End of isDate		End of isDate   */

/*-------------------------------------------------------------------------
 *  isDateLessThanCurrentDate -- Check the given date is less than current
 *                               Date
 *    Args:	argDate - Date must be in the format (DD-MM-YYYY)
 *    Returns:	false if the given date is greater else true.
 -------------------------------------------------------------------------*/
function isDateLessThanCurrentDate(argDate)
{
  var today     = new Date;
  var checkDate = new Date;
  var tmpDate   = argDate.split('-');

  checkDate.setDate(tmpDate[0]);
  checkDate.setMonth(tmpDate[1] - 1);
  checkDate.setFullYear(tmpDate[2]);

  if (checkDate > today)
    {
      return false;
    }
  return true;
}	/*  End of isDateLessThanCurrentDate		End of isDateLessThanCurrentDate   */

/*-------------------------------------------------------------------------
 *  isDateLessThanEqualCurrentDate -- Check the given date is less than current
 *                               Date
 *    Args:	argDate - Date must be in the format (DD-MM-YYYY)
 *    Returns:	false if the given date is greater else true.
 -------------------------------------------------------------------------*/
function isDateLessThanEqualCurrentDate(argDate)
{
  var today     = new Date;
  var checkDate = new Date;
  var tmpDate   = argDate.split('-');

  checkDate.setDate(tmpDate[0]);
  checkDate.setMonth(tmpDate[1] - 1);
  checkDate.setFullYear(tmpDate[2]);

  if (checkDate >= today)
    {
      return false;
    }
  return true;
}	/*  End of isDateLessThanEqualCurrentDate		End of isDateLessThanEqualCurrentDate   */

/*-------------------------------------------------------------------------
 *  isDateGreaterThanCurrentDate -- Check the given date is greater than 
 *                                  current date
 *    Args:	argDate - Date must be in the format (DD-MM-YYYY)
 *    Returns:	true is greater else false
 -------------------------------------------------------------------------*/
function isDateGreaterThanCurrentDate(argDate)
{
  var today     = new Date;
  var checkDate = new Date;
  var tmpDate   = argDate.split('-');

  checkDate.setDate(tmpDate[0]);
  checkDate.setMonth(tmpDate[1] - 1);
  checkDate.setFullYear(tmpDate[2]);

  if (checkDate < today)
    {
      return false;
    }
  return true;
}	/*  End of isDateGreaterThanCurrentDate		End of isDateGreaterThanCurrentDate   */

/*-------------------------------------------------------------------------
 *  compareGivenDates -- Compare between two dates.
 *    Args:	startDate 
 *    Args:	endDate
 *    Returns:	
 -------------------------------------------------------------------------*/
function compareGivenDates(startDate,endDate)
{
  var startDateArray = startDate.split(/s*-s*/);
  var endDateArray = endDate.split(/s*-s*/);
  if(endDateArray[2] < startDateArray[2])
    {
      return false;
    }

  if(endDateArray[2] == startDateArray[2])
    {
      if(endDateArray[1] < startDateArray[1])
        {
          return false;
        }
    }

  if(endDateArray[2] == startDateArray[2])
    {
      if(endDateArray[1] == startDateArray[1])
        { 
           if(endDateArray[0] < startDateArray[0])
            {
              return false;
            }
        }
    }
  return true;
}

/*-------------------------------------------------------------------------
 *  isEmail -- Check if the given email address is valid
 *    Args:	argEmailValue - email address 
 *    Returns:	If valid email address return true else false
 -------------------------------------------------------------------------*/
function isEmail(argEmailValue)
{
  if(/^[a-zA-Z0-9]+([\.]?[a-zA-Z0-9]+)*([_]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([\.]{1}[a-zA-Z0-9]+)*(\.[a-zA-Z]{2,3})+$/.test(argEmailValue))
    {	
      return true;
    }
  return false;
}	/*  End of isEmail		End of isEmail   */

/*-------------------------------------------------------------------------
 *  isAlphaNumeric -- To find whether the given value is alphanumeric or not.
 *    Args:	argValue - value to be checked.
 *    Returns:	true if alpha numeric else false.
 -------------------------------------------------------------------------*/
function isAlphaNumeric(argValue)
{
  var regAlphaNumeric = /^[a-zA-Z]+[a-zA-Z0-9]*$/;
  if(!regAlphaNumeric.test(argValue))
    {
      return false;
    }
  return true;
}	/*  End of isAlphaNumeric		End of isAlphaNumeric   */

/*-------------------------------------------------------------------------
 *  isNumeric -- To find whether the given value is numeric or not
 *    Args:	argValue - value to be checked.
 *    Returns:	true if numeric else false
 -------------------------------------------------------------------------*/
function isNumeric(argValue)
{
  var regNumeric = /^[0-9]+$/;
  if(!regNumeric.test(argValue))
    {
      return false;
    }
  return true;
}	/*  End of isNumeric		End of isNumeric   */

/*-------------------------------------------------------------------------
 *  isPhoneNo -- To find whether the given value is valid phone no.
 *    Args:	argValue - value to be checked
 *    Returns:	true if valid phone no else false.
 -------------------------------------------------------------------------*/
function isPhoneNo(argValue)
{
  var reg = /^[\+]{0,1}[0-9]+[\-0-9]+[0-9]+$/;
  if(!reg.test(argValue))
    {
      return false;
    }
  return true;
}	/*  End of isPhoneNo		End of isPhoneNo   */

/*-------------------------------------------------------------------------
 *  isAlphabet -- To find whether the given value is alphabet.
 *    Args:	argVal - value to be checked.
 *    Returns:	true if the value is alphabet else false
 -------------------------------------------------------------------------*/
function isAlphabet(argVal)
{
  var reg = /^[A-Za-z]+$/;
  if(!reg.test(argVal))
    {
      return false;
    }
  return true;
}	/*  End of isAlphabet		End of isAlphabet   */

/*-------------------------------------------------------------------------
 *  isSpaceAlphabet -- To find whether the given value is alphabet.
 *    Args:	argVal - value to be checked.
 *    Returns:	true if the value is alphabet else false
 -------------------------------------------------------------------------*/
function isSpaceAlphabet(argVal)
{
  var reg = /^[A-Za-z]+[A-Za-z\s]*[A-Za-z]+$/;
  if(!reg.test(argVal))
    {
      return false;
    }
  return true;
}	/*  End of isAlphabet		End of isAlphabet   */

/*-------------------------------------------------------------------------
 *  isAmount -- To find whether the given value is amount.
 *    Args:	argVal - value to be checked.
 *    Returns:	true if the value is amount else false.
 -------------------------------------------------------------------------*/
function isAmount(argVal)
{

  var reg = /^[0-9,]+[0-9]*$/;
  if(!reg.test(argVal))
    {
      return false;
    }
  else
    {
      return true; 
    }
}

/*
function isAmount(argVal)
{

  var reg = /^[0-9]+[.0-9]*$/;
  if(!reg.test(argVal))
    {
      return false;
    }
  else
    {
      var tmpDotCount = 0;
      for (i = 0;i < argVal.length;i++)
	{
	  if(argVal.charAt(i) == ".")
	    {
	      tmpDotCount++;
	    }
	}
      if(tmpDotCount > 1)
	{
	  return false;
	}
      if(tmpDotCount == 1)
	{
	  var tmpSplitArgVal = argVal.split(".");
	  if(tmpSplitArgVal[1] == "")
	    {
	      return false;
	    }
	}
    }
  return true;
}	
*/

/*-------------------------------------------------------------------------
 *  isSame -- Check if the given values are same.
 *    Args:	argValueA - First value
 *    Args:	argValueB - Second value
 *    Returns:	true if both the values are same else false.
 -------------------------------------------------------------------------*/
function isSame(argValueA,argValueB)
{
  if(argValueA != argValueB)
    {
      return false;
    }
  return true;
}	/*  End of isSame		End of isSame   */

/*-------------------------------------------------------------------------
 *  isIP -- Check if the given ip is valid
 *    Args:	argIP - IP to be checked 
 *    Returns:	true if IP is valid else false
 -------------------------------------------------------------------------*/
function isIP(argIP)
{
  
  if(argIP == "localhost")
  {
     return true;
  }

  var ipVal    = argIP.split('.');
  var tmpIPVal = new Array();

  //Check whether the length is 4.
  if(ipVal.length != 4)
    {
      return false;
    }

  var regAlpha = /^[0-9\.]*$/;
  if(!regAlpha.test(argIP))
    {
      return false;
    }
  for(i = 0;i < 4;i++)
    {
      //Check for empty data.
      if(ipVal[i] == '')
        {
          return false;
        }
      //Check whether the data is less than 0 and greaterthan 255
      if((ipVal[i] < 0) || (ipVal[i]) > 255)
        {
          return false;
        }
      else
        {
          tmpIPVal[i] = parseInt(ipVal[i]);
	  var tmpVal      = tmpIPVal[i].toString();
	  //Check whether the data starts with 0 if so return false
	  if(tmpVal.length != ipVal[i].length)
	    {
	      return false;
	    }
        }
    }
  //Check whether the first and the last data is less than 1 if so return false
  if(tmpIPVal[0] < 1 || tmpIPVal[3] < 1)
    {
      return false;
    }

  return true;
}	/*  End of isIP		End of isIP   */

/*-------------------------------------------------------------------------
 *  isMacId -- Check the given value is valid mac ID.
 *    Args:
 *    Returns:  true on success else false
 *    Throws:
 *    See:
 *    Bugs:
 -------------------------------------------------------------------------*/
function isMacId(argVal)
{
  var regAlphaNumeric = /^[A-F0-9]+$/;
  if(!regAlphaNumeric.test(argVal))
    {
      return false;
    }

  if(argVal.length != 2)
    {
      return false;
    }
  return true;
}       /*  End of isMacId              End of isMacId   */

/*-------------------------------------------------------------------------
 *  passwordValidation -- Validate the password.
 *    Args: Login name and password.
 *    Returns:  String
 -------------------------------------------------------------------------*/
function passwordValidation(argUserName,argPassword)
{
  var errorMsg = "";
  var tmpUserName = argUserName.substr(0,4);
  var tmpPassword = argPassword.substr(0,4);
  // Ckeck of the password contains atleast 8 letters.
  if(argPassword.length < 8)
    {
      errorMsg = errorMsg + "Password field must contain atleast 8 letters\n";
    }
  // Check for the first four characters of 'login name' and 'password' is the same.
  if(tmpUserName == tmpPassword)
    {
      errorMsg = errorMsg + "First 4 characters of 'Login name' and 'Password' cannot be the same\n";
    }
  // Check for the password which should contain '@' of '_'.
  var regPassword = /^[a-zA-Z0-9]+[_@]+/;
  if(!regPassword.test(argPassword))
    {
      errorMsg = errorMsg + "Password field must contain any one of these (@ or _)\n";
    }
  /*
   * To check consecutive character in user name
   * should not appear in the password
   */
  var res = consecutiveCharCheck(argUserName,argPassword);
  if(res)
    {
      errorMsg = errorMsg + "Consecutive four characters in login name should not appear in password\n";
    }
  return errorMsg;
}

/*-------------------------------------------------------------------------
 * purpose : To check for the consecutive character in password against username
 * syntax  : consecutiveCharCheck(userName, passwd)
 * @param  : userName - userName of the sub user
 * @param  : passwd - password of the sub user
 * @return : true if consecutive character occurs else false
 -------------------------------------------------------------------------*/
function consecutiveCharCheck(userName, passwd)
{
  var userNameLen = userName.length;
  var passwdLen   = passwd.length;
  var j = 4;
  for(i = 0;i < passwdLen;i++)
    {
      if(j>passwdLen)
        {
          break;
        }
      var tempPasswd = passwd.substring(i,j);
      var matchStr   = userName.match(tempPasswd);
      if(matchStr != null)
        {
          return true;
        }
      j = j+1;
    }
  return false;
}

/*-------------------------------------------------------------------------
 *  isDuration -- To find whether the given value is duration (HH:MM).
 *    Args:	argVal - value to be checked.
 *    Returns:	true if the value is duration else false.
 -------------------------------------------------------------------------*/
function isDuration(argVal)
{
  var reg = /^[0-9]{2}[:]{1}[0-9]{2}$/;
  if(!reg.test(argVal))
    {
      return false;
    }
  else
    {
      var tmpVal = argVal.split(":");
      if(parseInt(tmpVal[0]) > 23 || parseInt(tmpVal[1]) > 59)
	{
	  return false;
	}
    }
  return true;
}



/*-------------------------------------------------------------------------
 *  ShowUserDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserDetailsAdd()
{
  document.getElementById("userDetailsAdd").style.height = "70%";
  document.getElementById("userDetailsAdd").style.visibility = "visible";

}

/*-------------------------------------------------------------------------
 *  HideUserDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserDetailsAdd()
{
  document.getElementById("userDetailsAdd").style.height = "0%";
  document.getElementById("userDetailsAdd").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowSecondaryUserDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowSecondaryUserDetailsAdd()
{
  document.getElementById("secUserDetailsAdd").style.height = "70%";
  document.getElementById("secUserDetailsAdd").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideSecondaryUserDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideSecondaryUserDetailsAdd()
{
  document.getElementById("secUserDetailsAdd").style.height = "0%";
  document.getElementById("secUserDetailsAdd").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowUserProfileDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserProfileDetailsAdd()
{
  document.getElementById("userProfileDetailsAdd").style.height = "30%";
  document.getElementById("userProfileDetailsAdd").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideUserProfileDetailsAdd -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserProfileDetailsAdd()
{
  document.getElementById("userProfileDetailsAdd").style.height = "0%";
  document.getElementById("userProfileDetailsAdd").style.visibility = "hidden";
  document.getElementById("passwdAddID1").style.visibility = "hidden";
  document.getElementById("passwdAddID2").style.visibility = "hidden";
}
 
/*-------------------------------------------------------------------------
 *  ShowUserDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserDetailsMod()
{
  document.getElementById("userDetailsMod").style.height = "70%";
  document.getElementById("userDetailsMod").style.visibility = "visible";

}

/*-------------------------------------------------------------------------
 *  HideUserDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserDetailsMod()
{
  document.getElementById("userDetailsMod").style.height = "0%";
  document.getElementById("userDetailsMod").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowSecondaryUserDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowSecondaryUserDetailsMod()
{
  document.getElementById("secUserDetailsMod").style.height = "70%";
  document.getElementById("secUserDetailsMod").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideSecondaryUserDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideSecondaryUserDetailsMod()
{
  document.getElementById("secUserDetailsMod").style.height = "0%";
  document.getElementById("secUserDetailsMod").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowUserProfileDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserProfileDetailsMod()
{
  document.getElementById("userProfileDetailsMod").style.height = "30%";
  document.getElementById("userProfileDetailsMod").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideUserProfileDetailsMod -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserProfileDetailsMod()
{
  document.getElementById("userProfileDetailsMod").style.height = "0%";
  document.getElementById("userProfileDetailsMod").style.visibility = "hidden";
}
 
/*-------------------------------------------------------------------------
 *  ShowUserDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserDetailsDel()
{
  document.getElementById("userDetailsDel").style.height = "70%";
  document.getElementById("userDetailsDel").style.visibility = "visible";

}

/*-------------------------------------------------------------------------
 *  HideUserDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserDetailsDel()
{
  document.getElementById("userDetailsDel").style.height = "0%";
  document.getElementById("userDetailsDel").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowSecondaryUserDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowSecondaryUserDetailsDel()
{
  document.getElementById("secUserDetailsDel").style.height = "70%";
  document.getElementById("secUserDetailsDel").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideSecondaryUserDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideSecondaryUserDetailsDel()
{
  document.getElementById("secUserDetailsDel").style.height = "0%";
  document.getElementById("secUserDetailsDel").style.visibility = "hidden";
}

/*-------------------------------------------------------------------------
 *  ShowUserProfileDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function ShowUserProfileDetailsDel()
{
  document.getElementById("userProfileDetailsDel").style.height = "30%";
  document.getElementById("userProfileDetailsDel").style.visibility = "visible";
}

/*-------------------------------------------------------------------------
 *  HideUserProfileDetailsDel -- Display the user details
 *    Args: Nothing
 *    Returns: Display the user details
 -------------------------------------------------------------------------*/
function HideUserProfileDetailsDel()
{
  document.getElementById("userProfileDetailsDel").style.height = "0%";
  document.getElementById("userProfileDetailsDel").style.visibility = "hidden";
}



/*-------------------------------------------------------------------------
 *  ValidateCustomerAdd -- To validate the customer add screen.
 *    Args:	Nothing
 *    Returns:	true if the add screen is valid else alert the message.
 -------------------------------------------------------------------------*/
function ValidateCustomerAdd()
{
  var loginNameAdd = document.getElementById("loginNameAdd").value;
  var customerNameAdd = document.getElementById("customerNameAdd").value;
  var joinDateAdd = document.getElementById("joinDateAdd").value;
  var expiryDateAdd = document.getElementById("expiryDateAdd").value;
  var titleSelectAdd = document.getElementById("titleSelectAdd").value;
  var firstNameAdd = document.getElementById("firstNameAdd").value;
  var lastNameAdd = document.getElementById("lastNameAdd").value;
  var emailIDAdd = document.getElementById("emailIDAdd").value;
  var officePhNoAdd = document.getElementById("officePhNoAdd").value;
  var homePhNoAdd = document.getElementById("homePhNoAdd").value;
  var mobileAdd = document.getElementById("mobileAdd").value;
  var addressAdd = document.getElementById("addressAdd").value;
  var cityAdd = document.getElementById("cityAdd").value;
  var stateAdd = document.getElementById("stateAdd").value;
  var countryAdd = document.getElementById("countryAdd").value;
  var pincodeAdd = document.getElementById("pincodeAdd").value;
  var secTitleSelectAdd = document.getElementById("secTitleSelectAdd").value;
  var secFirstNameAdd = document.getElementById("secFirstNameAdd").value;
  var secLastNameAdd = document.getElementById("secLastNameAdd").value;
  var secEmailIDAdd = document.getElementById("secEmailIDAdd").value;
  var secOfficePhNoAdd = document.getElementById("secOfficePhNoAdd").value;
  var secHomePhNoAdd = document.getElementById("secHomePhNoAdd").value;
  var secMobileAdd = document.getElementById("secMobileAdd").value;
  var secAddressAdd = document.getElementById("secAddressAdd").value;
  var secCityAdd = document.getElementById("secCityAdd").value;
  var secStateAdd = document.getElementById("secStateAdd").value;
  var secCountryAdd = document.getElementById("secCountryAdd").value;
  var secPincodeAdd = document.getElementById("secPincodeAdd").value;
  var userProfileAdd = document.getElementById("userProfileAdd").value;
  //var reportProfileAdd = document.getElementById("reportProfileAdd").value;
  //var KBasedResticAdd = document.getElementById("KBasedResticAdd").value;
  var managerContactDisplayTot = getManagerContactDisplayCount();
  var totServiceRole = getServiceRoleCount();
  var errorMsg = "";

  /******************************** Check for the mandatory fields block ********************************/

  /*
   * Check valid login name.
   */
  if(loginNameAdd == "")
    {
      errorMsg = errorMsg + "Login name field cannot be empty.\n";
    }
  else
    {
      if(!/^[a-zA-Z0-9]+([\.]?[a-zA-Z0-9]+)*([_]?[a-zA-Z0-9]+)*[@]{0,}[a-zA-Z0-9]+([\.]{0,}[a-zA-Z0-9]+)*([\.]{0,}[a-zA-Z]+)+$/.test(loginNameAdd))
        {
          errorMsg = errorMsg + "Please enter valid login name.\n";
        }
    }

  /*
   * Check valid login name.
   */
  if(customerNameAdd == "")
    {
      errorMsg = errorMsg + "Customer name field cannot be empty..\n";
    }

  /*
   * Check Join date is not empty.
   */
  if(joinDateAdd == "")
    {
      errorMsg = errorMsg + "Join date field cannot be empty.\n";
    }
  else	
    {
      if(!isDateGreaterThanCurrentDate(joinDateAdd))
	{
	  errorMsg = errorMsg + "Join date field should be greater than or equal to the current date.\n";
	}
    }

  /*
   * Check expiry date is not empty.
   */
  if(expiryDateAdd == "")
    {
      errorMsg = errorMsg + "Expiry date field cannot be empty.\n";
    }

    if(!compareGivenDates(joinDateAdd,expiryDateAdd))
    {
        errorMsg = errorMsg + "Join date should be less than or equal to the expiry date.\n";
    }

   /*
   * Check valid first name.
   */
  if(firstNameAdd != "")
    {
      if(!isAlphabet(firstNameAdd))
	{
	  errorMsg = errorMsg + "Enter valid first name in user details.\n";
	}
    }
  else
    {
      errorMsg = errorMsg + "First name field cannot be empty in user details.\n";
    }

   /*
   * Check valid first name.
   */
  if(secFirstNameAdd != "")
    {
      if(!isAlphabet(secFirstNameAdd))
	{
	  errorMsg = errorMsg + "Enter valid first name in secondary contact details.\n";
	}
    }
  else
    {
      errorMsg = errorMsg + "First name field cannot be empty in secondary contact details.\n";
    }

  /*
   * Check valid last name.
   */
  if(lastNameAdd != "")
    {
      if(!isAlphabet(lastNameAdd))
	{
	  errorMsg = errorMsg + "Enter valid last name in user details..\n";
	}
    }
  else
    {
      errorMsg = errorMsg + "Last name field cannot be empty in user details.\n";
    }

  /*
   * Check valid last name.
   */
  if(secLastNameAdd != "")
    {
      if(!isAlphabet(secLastNameAdd))
	{
	  errorMsg = errorMsg + "Enter valid last name in secondary contact details.\n";
	}
    }
  else
    {
      errorMsg = errorMsg + "Last name field cannot be empty in secondary contact details.\n";
    }

  /*
   * Check valid email ID.
   */
  if(emailIDAdd != "")
    {
      if(!isEmail(emailIDAdd))
        {
          errorMsg = errorMsg + "Enter valid email ID in user details.\n";
        }
    }
    else
    {
      errorMsg = errorMsg + "Email ID field cannot be empty in user details.\n";
    }

  /*
   * Check valid email ID.
   */
  if(secEmailIDAdd != "")
    {
      if(!isEmail(secEmailIDAdd))
        {
          errorMsg = errorMsg + "Enter valid email ID in secondary contact details.\n";
        }
    }
    else
    {
      errorMsg = errorMsg + "Email ID field cannot be empty in secondary contact details.\n";
    }

  /*
   * Check valid address.
   */
  if(addressAdd == "")
    {
      errorMsg = errorMsg + "Address field cannot be empty in user details.\n";
    }

  /*
   * Check valid address.
   */
  if(secAddressAdd == "")
    {
      errorMsg = errorMsg + "Address field cannot be empty in secondary contact details.\n";
    }

  /*
   * Check valid user profile.
   */
  if(userProfileAdd == "")
    {
      errorMsg = errorMsg + "Please select the profile.\n";
    }

  /*
   * Check valid report profile.
   *
  if(reportProfileAdd == "")
    {
      errorMsg = errorMsg + "Select valid report profile in profile management.\n";
    }

   *
   * Check valid knowledge based.
   *
  if(KBasedResticAdd == "")
    {
      errorMsg = errorMsg + "Select valid Knowledge Based Restriction in profile management.\n";
    }
  */

   /*
    * Check for the service details
    */
   for(var incManContact = 0; incManContact < managerContactDisplayTot; incManContact++)
   {
      var userServiceName = "userServiceName" + incManContact;
      userServiceName = document.getElementById(userServiceName).innerHTML;
      for(var incSerRole = 0; incSerRole < totServiceRole; incSerRole++)
      {
          var managerContactNameAdd = "managerContactNameAdd" + incManContact + incSerRole;
          managerContactNameAdd = document.getElementById(managerContactNameAdd).value;
          var managerContactEmailIDAdd = "managerContactEmailIDAdd" + incManContact + incSerRole;
          managerContactEmailIDAdd = document.getElementById(managerContactEmailIDAdd).value;
          var managerContactMobileAdd = "managerContactMobileAdd" + incManContact + incSerRole;
          managerContactMobileAdd = document.getElementById(managerContactMobileAdd).value;
          var managerContactTypeAdd = "managerContactTypeAdd" + incManContact + incSerRole;
          managerContactTypeAdd = document.getElementById(managerContactTypeAdd).innerHTML;

          /*
           * Check valid manager contact name.
           */
          if(managerContactNameAdd != "")
            {
              if(!isSpaceAlphabet(managerContactNameAdd))
                {
                  errorMsg = errorMsg + "Enter valid name in service mapping details in Manager type " + managerContactTypeAdd + " in " + userServiceName + " Service.\n";
                }
            }

          /*
           * Check valid manager contact email ID.
           */
          if(managerContactEmailIDAdd != "")
            {
              if(!isEmail(managerContactEmailIDAdd))
                {
                  errorMsg = errorMsg + "Enter valid email ID in service mapping details in Manager type " + managerContactTypeAdd + " in " + userServiceName + " Service.\n";
                }
            }

            /*
             * Check valid mobile number, if not null.
             */
            if(managerContactMobileAdd != "")
            {
                if(!isPhoneNo(managerContactMobileAdd))
                {
                    errorMsg = errorMsg + "Enter valid mobile number in service mapping details in Manager type " + managerContactTypeAdd + " in " + userServiceName + " Service.\n";
                }
            }
      }
      var managerCustomerIDAdd = "managerCustomerIDAdd" + incManContact;
      managerCustomerIDAdd = document.getElementById(managerCustomerIDAdd).value;

      /*
       * Check valid manager contact email ID.
       */
      if(managerCustomerIDAdd != "")
        {
          if(!isNumeric(managerCustomerIDAdd))
            {
              errorMsg = errorMsg + "Enter valid customer ID in service mapping details in " + userServiceName + " Service.\n";
            }
        }
        else
        {
          errorMsg = errorMsg + "Customer ID field cannot be empty in service mapping details in " + userServiceName + " Service.\n";
        }
   }
   
  /******************************** End of mandatory fields block ********************************/


  /******************************** Non mandatory fields ********************************/

  /*
   * Check valid office phone number, if not null.
   */
  if(officePhNoAdd != "")
    {
      if(!isPhoneNo(officePhNoAdd))
	{
	  errorMsg = errorMsg + "Enter valid office phone number in user details.\n";
	}
    }

  /*
   * Check valid office phone number, if not null.
   */
  if(secOfficePhNoAdd != "")
    {
      if(!isPhoneNo(secOfficePhNoAdd))
	{
	  errorMsg = errorMsg + "Enter valid office phone number in secondary contact details.\n";
	}
    }

  /*
   * Check valid house phone number, if not null.
   */
  if(homePhNoAdd != "")
    {
      if(!isPhoneNo(homePhNoAdd))
	{
	  errorMsg = errorMsg + "Enter valid house phone number in user details.\n";
	}
    }

  /*
   * Check valid house phone number, if not null.
   */
  if(secHomePhNoAdd != "")
    {
      if(!isPhoneNo(secHomePhNoAdd))
	{
	  errorMsg = errorMsg + "Enter valid house phone number in secondary contact details.\n";
	}
    }

  /*
   * Check valid mobile number, if not null.
   */
  if(mobileAdd != "")
    {
      if(!isPhoneNo(mobileAdd))
	{
	  errorMsg = errorMsg + "Enter valid mobile number in user details.\n";
	}
    }

  /*
   * Check valid mobile number, if not null.
   */
  if(secMobileAdd != "")
    {
      if(!isPhoneNo(secMobileAdd))
	{
	  errorMsg = errorMsg + "Enter valid mobile number in secondary contact details.\n";
	}
    }

  /*
   * Check valid city.
   */
  if(cityAdd != "")
    {
      if(!isSpaceAlphabet(cityAdd))
        {
          errorMsg = errorMsg + "Enter valid city in user details.\n";
        }
    }

  /*
   * Check valid city.
   */
  if(secCityAdd != "")
    {
      if(!isSpaceAlphabet(secCityAdd))
        {
          errorMsg = errorMsg + "Enter valid city in secondary contact details.\n";
        }
    }

  /*
   * Check valid state, if not null.
   */
  if(stateAdd != "")
    {
      if(!isSpaceAlphabet(stateAdd))
	{
	  errorMsg = errorMsg + "Enter valid state in user details.\n";
	}
    }

  /*
   * Check valid state, if not null.
   */
  if(secStateAdd != "")
    {
      if(!isSpaceAlphabet(secStateAdd))
	{
	  errorMsg = errorMsg + "Enter valid state in secondary contact details.\n";
	}
    }

  /*
   * Check valid country, if not null.
   */
  if(countryAdd != "")
    {
      if(!isSpaceAlphabet(countryAdd))
	{
	  errorMsg = errorMsg + "Enter valid country in user details.\n";
	}
    }

  /*
   * Check valid country, if not null.
   */
  if(secCountryAdd != "")
    {
      if(!isSpaceAlphabet(secCountryAdd))
	{
	  errorMsg = errorMsg + "Enter valid country in secondary contact details.\n";
	}
    }

  /*
   * Check valid pincode, if not null.
   */
  if(pincodeAdd != "")
    {
      if(!isNumeric(pincodeAdd))
	{
	  errorMsg = errorMsg + "Enter valid pincode in user details.\n";
	}
    }

  /*
   * Check valid pincode, if not null.
   */
  if(secPincodeAdd != "")
    {
      if(!isNumeric(secPincodeAdd))
	{
	  errorMsg = errorMsg + "Enter valid pincode in secondary details.\n";
	}
    }

  if(document.getElementById("passwdAddID2").style.visibility == "visible")
  {
    if(document.getElementById("passwordAdd").value == "")
    {
        errorMsg = errorMsg + "Enter valid password in user details.\n";
    }
  }
  

  /******************************** End of non mandatory fields block ********************************/

  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
	return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}

/*-------------------------------------------------------------------------
 *  ValidateCustomerMod -- To validate the customer modify screen.
 *    Args:	Nothing
 *    Returns:	true if the add screen is valid else alert the message.
 -------------------------------------------------------------------------*/
function ValidateCustomerMod()
{

  var loginNameMod = document.getElementById("loginNameMod").value;
  var customerNameMod = document.getElementById("customerNameMod").value;
  var joinDateMod = document.getElementById("joinDateMod").value;
  var expiryDateMod = document.getElementById("expiryDateMod").value;
  var titleSelectMod = document.getElementById("titleSelectMod").value;
  var firstNameMod = document.getElementById("firstNameMod").value;
  var lastNameMod = document.getElementById("lastNameMod").value;
  var emailIDMod = document.getElementById("emailIDMod").value;
  var officePhNoMod = document.getElementById("officePhNoMod").value;
  var homePhNoMod = document.getElementById("homePhNoMod").value;
  var mobileMod = document.getElementById("mobileMod").value;
  var addressMod = document.getElementById("addressMod").value;
  var cityMod = document.getElementById("cityMod").value;
  var stateMod = document.getElementById("stateMod").value;
  var countryMod = document.getElementById("countryMod").value;
  var pincodeMod = document.getElementById("pincodeMod").value;
  var secTitleSelectMod = document.getElementById("secTitleSelectMod").value;
  var secFirstNameMod = document.getElementById("secFirstNameMod").value;
  var secLastNameMod = document.getElementById("secLastNameMod").value;
  var secEmailIDMod = document.getElementById("secEmailIDMod").value;
  var secOfficePhNoMod = document.getElementById("secOfficePhNoMod").value;
  var secHomePhNoMod = document.getElementById("secHomePhNoMod").value;
  var secMobileMod = document.getElementById("secMobileMod").value;
  var secAddressMod = document.getElementById("secAddressMod").value;
  var secCityMod = document.getElementById("secCityMod").value;
  var secStateMod = document.getElementById("secStateMod").value;
  var secCountryMod = document.getElementById("secCountryMod").value;
  var secPincodeMod = document.getElementById("secPincodeMod").value;
  var userProfileMod = document.getElementById("userProfileMod").value;
  //var reportProfileMod = document.getElementById("reportProfileMod").value;
  //var KBasedResticMod = document.getElementById("KBasedResticMod").value;
  var errorMsg = "";
  var tmpManCount = 0;

  /**************************** Check for the mandatory fields block ********************************/

 
  /*
   * Check if the login name is selected.
   */
  if(loginNameMod == "")
    {
      errorMsg = errorMsg + "Select a login name.\n";
    }
  else
    {
        var managerContactDisplayModTot = getManagerContactDisplayModCount();
        var totServiceRole = getServiceRoleModCount();
      /*
       * Check Join date is not empty.
       */
      if(customerNameMod == "")
	{
	  errorMsg = errorMsg + "Customer name field cannot be empty.\n";
	}

      /*
       * Check Join date is not empty.
       */
      if(joinDateMod == "")
	{
	  errorMsg = errorMsg + "Join date field cannot be empty.\n";
	}

      /*
       * Check expiry date is not empty.
       */
      if(expiryDateMod == "")
	{
	  errorMsg = errorMsg + "Expiry date field cannot be empty.\n";
	}
      else 
	{
	  var today     = new Date;
	  var checkDate = new Date;
	  var tmpDate   = expiryDateMod.split('-');
	  
	  checkDate.setDate(tmpDate[0]);
	  checkDate.setMonth(tmpDate[1] - 1);
	  checkDate.setFullYear(tmpDate[2]);
	  
	  if(checkDate < today)
	    {
	      errorMsg = errorMsg + "Expiry date should be greater than or equal to current date.\n";
	    }
	}

      /*
       * Check valid first name.
       */
      if(firstNameMod != "")
	{
	  if(!isAlphabet(firstNameMod))
	    {
	      errorMsg = errorMsg + "Enter valid first name in user details.\n";
	    }
	}
      else
	{
	  errorMsg = errorMsg + "First name field cannot be empty in user details.\n";
	}

      /*
       * Check valid first name.
       */
      if(secFirstNameMod != "")
	{
	  if(!isAlphabet(secFirstNameMod))
	    {
	      errorMsg = errorMsg + "Enter valid first name in secondary contact details.\n";
	    }
	}
      else
	{
	  errorMsg = errorMsg + "First name field cannot be empty in secondary contact details.\n";
	}

      /*
       * Check valid last name.
       */
      if(lastNameMod != "")
	{
	  if(!isAlphabet(lastNameMod))
	    {
	      errorMsg = errorMsg + "Enter valid last name in user details.\n";
	    }
	}
      else
	{
	  errorMsg = errorMsg + "Last name field cannot be empty in user details.\n";
	}

      /*
       * Check valid last name.
       */
      if(secLastNameMod != "")
	{
	  if(!isAlphabet(secLastNameMod))
	    {
	      errorMsg = errorMsg + "Enter valid last name in secondary contact details.\n";
	    }
	}
      else
	{
	  errorMsg = errorMsg + "Last name field cannot be empty in secondary contact details.\n";
	}

      /*
       * Check valid email ID.
       */
      if(emailIDMod != "")
	{
          if(!isEmail(emailIDMod))
            {
              errorMsg = errorMsg + "Enter valid email ID in user details.\n";
            }
        }
      else
	{
	  errorMsg = errorMsg + "Email ID field cannot be empty in user details.\n";
	}

      /*
       * Check valid email ID.
       */
      if(secEmailIDMod != "")
	{
          if(!isEmail(secEmailIDMod))
            {
              errorMsg = errorMsg + "Enter valid email ID in secondary contact details.\n";
            }
        }
      else
	{
	  errorMsg = errorMsg + "Email ID field cannot be empty in secondary contact details.\n";
	}

      /*
       * Check valid address.
       */
      if(addressMod == "")
	{
	  errorMsg = errorMsg + "Address field cannot be empty in user details.\n";
	}

      /*
       * Check valid address.
       */
      if(secAddressMod == "")
	{
	  errorMsg = errorMsg + "Address field cannot be empty in secondary contact details.\n";
	}

      /*
       * Check valid user profile.
       */
      if(userProfileMod == "")
        {
          errorMsg = errorMsg + "Please select the profile.\n";
        }

      /*
       * Check valid report profile.
       *
      if(reportProfileMod == "")
        {
          errorMsg = errorMsg + "Select valid report profile in profile management.\n";
        }

       *
       * Check valid knowledge based.
       *
      if(KBasedResticMod == "")
        {
          errorMsg = errorMsg + "Select valid knowledge based restriction in profile management.\n";
        }
       */

       /*
        * Check for the service details
        */
       for(var incManContact = 0; incManContact < managerContactDisplayModTot; incManContact++)
       {
          var userServiceName = "userServiceName" + incManContact;
          userServiceName = document.getElementById(userServiceName).innerHTML;

          for(var incSerRole = 0; incSerRole < totServiceRole; incSerRole++)
          {
              var managerContactNameMod = "managerContactNameMod" + incManContact + incSerRole;
              managerContactNameMod = document.getElementById(managerContactNameMod).value;
              var managerContactEmailIDMod = "managerContactEmailIDMod" + incManContact + incSerRole;
              managerContactEmailIDMod = document.getElementById(managerContactEmailIDMod).value;
              var managerContactMobileMod = "managerContactMobileMod" + incManContact + incSerRole;
              managerContactMobileMod = document.getElementById(managerContactMobileMod).value;
              var managerContactTypeMod = "managerContactTypeMod" + incManContact + incSerRole;
              managerContactTypeMod = document.getElementById(managerContactTypeMod).innerHTML;

              /*
               * Check valid manager contact name.
               */
              if(managerContactNameMod != "")
                {
                  if(!isSpaceAlphabet(managerContactNameMod))
                    {
                      errorMsg = errorMsg + "Enter valid name in service mapping details in Manager type " + managerContactTypeMod + " in " + userServiceName + " Service.\n";
                    }
                }

              /*
               * Check valid manager contact email ID.
               */
              if(managerContactEmailIDMod != "")
                {
                  if(!isEmail(managerContactEmailIDMod))
                    {
                      errorMsg = errorMsg + "Enter valid email ID in service mapping details in Manager type " + managerContactTypeMod + " in " + userServiceName + " Service.\n";
                    }
                }

                /*
                 * Check valid mobile number, if not null.
                 */
                if(managerContactMobileMod != "")
                {
                    if(!isPhoneNo(managerContactMobileMod))
                    {
                        errorMsg = errorMsg + "Enter valid mobile number in service mapping details in Manager type " + managerContactTypeMod + " in " + userServiceName + " Service.\n";
                    }
                }
          }
          var managerCustomerIDMod = "managerCustomerIDMod" + incManContact;
          managerCustomerIDMod = document.getElementById(managerCustomerIDMod).value;

          /*
           * Check valid manager contact email ID.
           */
          if(managerCustomerIDMod != "")
            {
              if(!isNumeric(managerCustomerIDMod))
                {
                  errorMsg = errorMsg + "Enter valid customer ID in service mapping details in " + userServiceName + " Service.\n";
                }
            }
            else
            {
              errorMsg = errorMsg + "Customer ID field cannot be empty in service mapping details in " + userServiceName + " Service.\n";
            }
       }

      /******************************** End of mandatory fields block ********************************/


      /******************************** Non mandatory fields ********************************/

      /*
       * Check valid office phone number, if not null.
       */
      if(officePhNoMod != "")
	{
	  if(!isPhoneNo(officePhNoMod))
	    {
	      errorMsg = errorMsg + "Enter valid office phone number in user details.\n";
	    }
	}

      /*
       * Check valid office phone number, if not null.
       */
      if(secOfficePhNoMod != "")
	{
	  if(!isPhoneNo(secOfficePhNoMod))
	    {
	      errorMsg = errorMsg + "Enter valid office phone number in secondary contact details.\n";
	    }
	}

      /*
       * Check valid house phone number, if not null.
       */
      if(homePhNoMod != "")
	{
	  if(!isPhoneNo(homePhNoMod))
	    {
	      errorMsg = errorMsg + "Enter valid house phone number in user details.\n";
	    }
	}

      /*
       * Check valid house phone number, if not null.
       */
      if(secHomePhNoMod != "")
	{
	  if(!isPhoneNo(secHomePhNoMod))
	    {
	      errorMsg = errorMsg + "Enter valid house phone number in secondary contact details.\n";
	    }
	}

      /*
       * Check valid mobile number, if not null.
       */
      if(mobileMod != "")
	{
	  if(!isPhoneNo(mobileMod))
	    {
	      errorMsg = errorMsg + "Enter valid mobile number in user details.\n";
	    }
	}

      /*
       * Check valid mobile number, if not null.
       */
      if(secMobileMod != "")
	{
	  if(!isPhoneNo(secMobileMod))
	    {
	      errorMsg = errorMsg + "Enter valid mobile number in secondary contact details.\n";
	    }
	}

      /*
       * Check valid city.
       */
      if(cityMod != "")
	{
	  if(!isSpaceAlphabet(cityMod))
	    {
	      errorMsg = errorMsg + "Enter valid city in user details.\n";
	    }
	}

      /*
       * Check valid city.
       */
      if(secCityMod != "")
	{
	  if(!isSpaceAlphabet(secCityMod))
	    {
	      errorMsg = errorMsg + "Enter valid city in secondary contact details.\n";
	    }
	}

      /*
       * Check valid state, if not null.
       */
      if(stateMod != "")
	{
	  if(!isSpaceAlphabet(stateMod))
	    {
	      errorMsg = errorMsg + "Enter valid state in user details.\n";
	    }
	}

      /*
       * Check valid state, if not null.
       */
      if(secStateMod != "")
	{
	  if(!isSpaceAlphabet(secStateMod))
	    {
	      errorMsg = errorMsg + "Enter valid state in secondary contact details.\n";
	    }
	}

      /*
       * Check valid country, if not null.
       */
      if(countryMod != "")
	{
	  if(!isSpaceAlphabet(countryMod))
	    {
	      errorMsg = errorMsg + "Enter valid country in user details.\n";
	    }
	}

      /*
       * Check valid country, if not null.
       */
      if(secCountryMod != "")
	{
	  if(!isSpaceAlphabet(secCountryMod))
	    {
	      errorMsg = errorMsg + "Enter valid country in secondary contact details.\n";
	    }
	}

      /*
       * Check valid pincode, if not null.
       */
      if(pincodeMod != "")
	{
	  if(!isNumeric(pincodeMod))
	    {
	      errorMsg = errorMsg + "Enter valid pincode in user details.\n";
	    }
	}

      /*
       * Check valid pincode, if not null.
       */
      if(secPincodeMod != "")
	{
	  if(!isNumeric(secPincodeMod))
	    {
	      errorMsg = errorMsg + "Enter valid pincode in secondary contact details.\n";
	    }
	}

      /******************************** End of non mandatory fields block ********************************/
    }
  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
        return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}

/*-------------------------------------------------------------------------
 *  ValidateCustomerDel -- To confirm the user to be terminated.
 *    Args:	Nothing
 *    Returns:	If true the customer will be deleted else not.
 -------------------------------------------------------------------------*/
function ValidateCustomerDel()
{
  var loginNameDel = document.getElementById("loginNameDel").value;
  if(loginNameDel == "")
    {
      alert("Select valid customer.");
      return false;
    }

  if(window.confirm("Are you sure, you want to terminate the customer ?"))
    {
      return true;
    }
  else
    {
      return false;
    }
}



/*-------------------------------------------------------------------------
 *  durationFormat -- Format the given duration as (HH:MM)
 *    Args:	argVal
 *    Returns:	formated value
 -------------------------------------------------------------------------*/
function durationFormat(argVal)
{
    var tmpRetHr  = 0;
    var tmpRetMin = 0;
    var retVal    = 0;
    var durationArray = argVal.split(":");
    if(durationArray[0].length == 1)
    {
        tmpRetHr = "0" + durationArray[0];
    }
    else
    {
        tmpRetHr = durationArray[0];
    }

    if(durationArray[1].length == 1)
    {
        tmpRetMin = durationArray[1] + "0";
    }
    else
    {
        tmpRetMin = durationArray[1];
    }

    retVal = tmpRetHr + ":" + tmpRetMin;
    return retVal;
}

/*-------------------------------------------------------------------------
 *  textCounter -- To get the count of the text and return false if it exceeds
 *                 the given limit.
 *    Args: fieldName - name of the field
 *    Args: field - name of the field
 *    Args: maxlimit - maximum limit of characters.
 *    Returns:
 -------------------------------------------------------------------------*/
function textCounter(fieldName, field, maxlimit)
{
  if (field.value.length > maxlimit)
    {
      alert(fieldName + " field cannot be more than " + maxlimit + " characters. \nGiven data is truncated to " + maxlimit + " characters.");
      field.value = field.value.substring(0, maxlimit);
    }
}

function validateURL()
{
    return /^(ftp|https?):\/\/+(www\.)?[a-z0-9\-\.]{3,}\./.test(validateURL.arguments[0]);
}

/*-------------------------------------------------------------------------
 *  menuConfiguratorAdd -- Validate Menu Configurator Add screen
 *    Args: Nothing
 *    Returns: True if the screen is valid else false
 -------------------------------------------------------------------------*/
function menuConfiguratorAdd()
{
  var errorMsg = "";
  var displayNameAdd = document.getElementById("displayNameAddID").value;
  var menuSelAdd = document.getElementById("menuSelAddID").value;
  var URLAdd = document.getElementById("URLAddID").value;
  var parameterAdd = document.getElementById("parameterAddID").value;
  var profileOpt = document.getElementById("profileOptID").value;
  var profileName = document.getElementById("profileNamesID").value;
  var menuTypeAdd = document.getElementById("menuTypeAddID").value;
  var serviceAdd = document.getElementById("serviceAddID").value;

  /*
   * Check if the display name field is empty
   */
  if(displayNameAdd == "")
    {
      errorMsg = errorMsg + "Display name field cannot be empty.\n";
    }
  else
    {
      if(!isSpaceAlphabet(displayNameAdd))
	{
	  errorMsg = errorMsg + "Enter valid Display name.\n";
	}
    }

  /*
   * Check if the display name field is empty
   */
  if(menuTypeAdd == "")
    {
      errorMsg = errorMsg + "Please select the menu type.\n";
    }

  /*
   * Check if the menu field is selected
   */
  if(menuSelAdd == "")
    {
      errorMsg = errorMsg + "Please select the parent Name.\n";
    }

  /*
   * Check if the display name field is empty
   */
  if(serviceAdd == "")
    {
      errorMsg = errorMsg + "Please select the service Name.\n";
    }


  if(menuSelAdd != "0")
    {
      /*
       * Check if the URL/Filename field is selected
       */
      if(URLAdd == "" && document.getElementById("fileSelAddID").value == "")
        {
            if(document.getElementById("URLAddID").disabled == true)
            {
                errorMsg = errorMsg + "Please select the file name.\n";
            }
            else
            {
                errorMsg = errorMsg + "Please enter the URL.\n";
            }
        }
      else
	{
	  if(document.getElementById("fileSelAddID").value == "")
	    {
	      if(serviceAdd != 1)
		{
		  if(!validateURL(URLAdd))
		    {
		      errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
		    }
		}
	    }
	  else if(document.getElementById("fileSelAddID").value == "REDIRECT-URL")
	    {
	      if(serviceAdd != 1)
		{
		  if(!validateURL(URLAdd))
		    {
		      errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
		    }
		}
	    }
	}
    }
  else
    {
      if(URLAdd != "")
        {
            if(document.getElementById("fileSelAddID").value == "REDIRECT-URL")
            {
                if(!validateURL(URLAdd))
                  {
                    errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
                  }
             }
	}

        if(URLAdd != "")
        {
            var tmpCheck = /^[tinymce]/;
            if(!tmpCheck.test(URLAdd))
            {
                if(!validateURL(URLAdd))
                  {
                    errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
                  }
            }
        }
    }
           
  if(profileOpt == "")
    { 
      errorMsg = errorMsg + "Please select 'Assign Profile' to assign the menu to profile\n";
    }

  if(profileOpt == "profile")
    {
      if(profileName == "")
	{ 
	  errorMsg = errorMsg + "Please select a profile\n";
	} 
    }

  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
      return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}

/*-------------------------------------------------------------------------
 *  menuConfiguratorMod -- Validate Menu Configurator Modify screen
 *    Args: Nothing
 *    Returns: True if the screen is valid else false
 -------------------------------------------------------------------------*/
function menuConfiguratorMod()
{
  var errorMsg = "";
  var displayNameSelMod = document.getElementById("displayNameSelModID").value;
  var displayNameMod = document.getElementById("displayNameModID").value;
  var menuSelMod = document.getElementById("menuSelModID").value;
  var URLMod = document.getElementById("URLModID").value;
  var parameterMod = document.getElementById("parameterModID").value;
  var menuTypeMod = document.getElementById("menuTypeModID").value;
  var serviceMod = document.getElementById("serviceModID").value;

   /*
    * Check if the menu field is selected
    */
      
    if(displayNameMod == "")
      {
	errorMsg = errorMsg + "Display name field cannot be empty.\n";
      }
    else
      {
	if(!isSpaceAlphabet(displayNameMod))
	  {
	    errorMsg = errorMsg + "Enter valid Display name.\n";
	  }
      }

  /*
   * Check if the display name field is empty
   */
  if(menuTypeMod == "")
    {
      errorMsg = errorMsg + "Please select the menu type.\n";
    }

   /*
    * Check if the menu field is selected
    */
    if(menuSelMod == "")
     {
	 errorMsg = errorMsg + "Please select the parent name.\n";
     }
     
   /*
    * Check if the menu field is selected
    */
    if(serviceMod == "")
     {
	 errorMsg = errorMsg + "Please select the service name.\n";
     }

    if(menuSelMod != "0")
      {
	/*
	 * Check if the URL/Filename field is selected
	 */
	if(URLMod == "" && document.getElementById("fileSelModID").value == "")
	  {
              if(document.getElementById("URLModID").disabled == true)
              {
                  errorMsg = errorMsg + "Please select the file name.\n";
              }
              else
              {
                  errorMsg = errorMsg + "Please enter the URL.\n";
              }
	  }
	else
	  {
	    if(document.getElementById("fileSelModID").value == "")
	      {
		if(serviceMod != 1)
		  {
		    if(!validateURL(URLMod))
		      {
			errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
		      }
		  }
	      }
	  }
      }
    else
      {
          if(URLMod != "")
            {
              if(document.getElementById("fileSelAddID").value == "REDIRECT-URL")
              {
                  if(!validateURL(URLMod))
                    {
                      errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
                    }
               }
            }

          if(URLMod != "")
          {
              var tmpFileCheck = /[\.jsp]$/;
              if(!tmpFileCheck.test(URLMod))
              {
                  var tmpCheck = /^[tinymce]/;
                  if(!tmpCheck.test(URLMod))
                  {
                      if(!validateURL(URLMod))
                        {
                          errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
                        }
                  }
              }
          }
      }


    if(document.getElementById("URLModID").disabled != true)
    {
        document.getElementById("displayTypeModID").disabled = true;
        document.getElementById("displayTypeModID").checked = true;
    }

  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
      return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}


/*-------------------------------------------------------------------------
 *  menuConfiguratorDel -- Confirmation message asked before deleting the menu
 *    Args: Nothing
 *    Returns: True if ok else false
 -------------------------------------------------------------------------*/
function menuConfiguratorDel()
{
  var displayNameSelDel = document.getElementById("displayNameSelDelID").value;

  if(displayNameSelDel == "")
    {
      alert("Please select the menu.\n");
      return false;
    }
  else
    {
      if(confirm("Are you sure, you want to delete the menu ?"))
	{
	  return true;
	}
      else
	{
	  return false;
	}
    }
}

/*-------------------------------------------------------------------------
 *  checkRootNode -- If the root node is checked in the screen MenuConfiguratorAdd
 *                   the menu item should be disables else viceversa.
 *    Args: Nothing
 *    Returns: Nothing
 -------------------------------------------------------------------------*/
function checkRootNode()
{
    if(document.getElementById("rootNodeID").checked)
    {
        document.getElementById("URLID").disabled = false;
        document.getElementById("parameterID").disabled = false;
    }
    else
    {
        document.getElementById("URLID").disabled = true;
        document.getElementById("parameterID").disabled = true;
        document.getElementById("URLID").value = "";
        document.getElementById("parameterID").value = "";
    }
}


function addServiceMenu()
{
  var errorMsg = "";
  var displayNameAdd = document.getElementById("serDisplayAdd").value;
  var menuSelAdd = document.getElementById("serMenuSelAdd").value;
  var serviceSelAdd=document.getElementById("serviceAdd").value;
  var URLAdd = document.getElementById("serURLAdd").value;
  var parameterAdd = document.getElementById("serParameterAdd").value;

  /*
   * Check if the display name field is empty
   */
  if(displayNameAdd == "")
    {
      errorMsg = errorMsg + "Display name field cannot be empty.\n";
    }

  /*
   * Check if the menu field is selected
   */
  if(menuSelAdd == "")
    {
      errorMsg = errorMsg + "Please select the Parent Name.\n";
    }


  /*
   * Check if the service field is selected
   */
  if(serviceSelAdd == "")
    {
      errorMsg = errorMsg + "Please select the Service.\n";
    }

  if(URLAdd == "")
    {
      errorMsg = errorMsg + "Please enter the URL.\n";
    }
     else
    {
        
      if(!validateURL(URLAdd))
       {
          errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
       }
       
    }

   var profileOpt = document.getElementById("profileOptID").value;
   if(profileOpt == "")
     { 
       errorMsg = errorMsg + "Please select 'Assign Profile' to assign the menu to profile\n";
     }
   if(profileOpt == "profile")
     {
       var profileName = document.getElementById("profileNamesID").value;
       if(profileName == "")
	 { 
	   errorMsg = errorMsg + "Please select a profile\n";
	 } 
     }

  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
      return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}

function modServiceMenu()
{
  var errorMsg = "";
  var serviceName=document.getElementById("serviceNameMod").value;
  
  /*
   * Check if the display name field is empty
   */
  if(serviceName == "")
    {
      errorMsg = errorMsg + "Service name field cannot be empty.\n";
    }

   reg = /^[A-Za-z]+$/;
  if(!reg.test(document.getElementById("serviceNameMod").value))
    {
      errorMsg=errorMsg+"Please enter valid service name\n";
    }


  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
      return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}


function modMenuDisplay()
{
  var errorMsg    = "";
  var displayName = document.getElementById("displayNameMod").value;
  var menuSelItem = document.getElementById("menuSelMod").value;
  var URLModMenu  = document.getElementById("URLMod").value;
  
  /*
   * Check if the display name field is empty
   */
  if(displayName == "")
    {
      errorMsg = errorMsg + "Parent Name field cannot be empty\n";
    }

    if(menuSelItem == "")
    {
      errorMsg = errorMsg + "Please select Display name\n";
    }

   if(URLModMenu == "")
    {
      errorMsg = errorMsg + "URL field cannot be empty\n";
    }
    else
    {
      if(!validateURL(URLModMenu))
       {
          errorMsg = errorMsg + "Please enter a valid URL, eg: (http://<web site address>)\n";
       }
    }
   
  /*
   * Check if there is no error message return true 
   * else alert the message and return false.
   */
  if(errorMsg == "")
    {
      return true;
    }
  else
    {
      alert(errorMsg);
      return false;
    }
}

function callPanels()
{ 
  hideLoading();
  setupPanes('container1', 'tab1');
  
}
 
function redirectUrl(urlName,displayType,menuID)
{
  var checkIsRedirect = /^[Redirect.jsp]/;
  if(checkIsRedirect.test(urlName))
   {
       var splitURL = urlName.split("?");
       if(splitURL.size() == 1)
       {
          var tmpUrl = urlName + "?menuID=" + menuID;
       }
       else
       {
          var tmpUrl = urlName + "&menuID=" + menuID;
       }
       urlName = tmpUrl;
    }

  if(urlName == "RedirectToReport.jsp")
   {
     var searchUrl = $F('reportURL')+"?user="+$F('loginName')+"&profileName="+$F('profileName');
     newWindowName += testWin.length;
     testWin[testWin.length] = window.open(searchUrl,newWindowName);
     newWindowName = "newWindowName";
   }

  if(urlName == "tinymce/HTMLEditor.jsp")
  {
    
    var newWindow = window.open('tinymce/HTMLEditor.jsp','mywindow','left=200,top=100,width=700,height=550,resizable=yes');
  }
  else
  {
   if(urlName != "")
   {
      showLoading();
      if(displayType == "FRAME")
      {
        var myAjax = new Ajax.Updater(
                                 'contentDiv',
                                 urlName,
       {
         method: 'POST',
         onComplete:callPanels
       });
        
      }
      else
      {
        hideLoading();
	newWindowName += testWin.length;
	testWin[testWin.length] = window.open(urlName,newWindowName);
	newWindowName = "newWindowName";
      }
   }
  }
}

/*
 *purpose : To open the HTML Editor window
 *syntax  : openHTMLWindow()
 *@param  : argParam
 *@return : Nil
 */
function openHTMLWindow(argParam)
{
    htmlEditorWinMod = window.open("tinymce/HTMLEditor.jsp?param=" + escape(argParam),"htmlEditorWinMod","left=200,top=80,width=700,height=680,resizable=yes");
}

/*
 *purpose : To open the HTML Editor window
 *syntax  : openHtmlEditor()
 *@param  : Nil
 *@return : Nil
 */
function openHtmlEditor()
{
    htmlEditorWin=window.open('tinymce/HTMLEditor.jsp?param=','htmlEditorWin','left=200,top=80,width=700,height=680,resizable=yes');
}

/*
 *purpose : To open the MyProfile window
 *syntax  : openProfile(loggedUser)
 *@param  : loggedUser - name of the user
 *@return : Nil
 */
function openProfile(loggedUser)
{
    myProfileURL="MyProfile.jsp?loginUser="+loggedUser;

    /*
    *Commented by ragu[26/06/2008]
    *This prevents myprofile opening in a new window
    */
    //myProfileWin=window.open(myProfileURL,'myProfileWin','left=300,top=220,width=620,height=400,scrollbars=yes');

    /*
    *Included by ragu[26/06/2008]
    *This enables myprofile to be loaded in the same page instead of
    *new pop-up window
    */
    showLoading();
    var myAjax = new Ajax.Updater(
                                'contentDiv',
                                myProfileURL,
      {
        method: 'get',
        onComplete:hideLoading
      });
}

       
/*
 *purpose : Open a new window for serarch.
 *syntax  : searchKBase()
 *@param  : Nil
 *@return : Nil
 */
function searchKBase()
{
  var value = document.forms[0].search.value;
  if(value=="Search FAQs" || value=="")
    {
      alert('Please enter valid keywords');
    }
  else
    {
      //searchKBaseWin = window.open("SearchKBase.jsp?keyword="+value,'searchKBaseWin','left=150,top=100,width=700,height=500,scrollbars=yes,resizable=yes');
    searchKBaseWin="SearchKBase.jsp?keyword="+value;

    /*
    *Included by ragu[26/06/2008]
    *This enables myprofile to be loaded in the same page instead of
    *new pop-up window
    */
    var myAjax = new Ajax.Updater(
                                'contentDiv',
                                searchKBaseWin,
      {
        method: 'get',
        onComplete:callFaqDetails
      });
    }
}

function callFaqDetails()
{
  getFaqsForSearch('0');
  
}

/*
 *purpose : To close the windows opened in new window
 *syntax  : closeWindows()
 */
function closeWindows()
{
  for(var closeTestWin = 0; closeTestWin < testWin.length; closeTestWin++)
    {
      if(testWin[closeTestWin]!=""&&!testWin[closeTestWin].closed)
        {
          testWin[closeTestWin].close();
        }
    }
}

/*
 *purpose : On logout close all the child windows
 *syntax  : logoutUser()
 *@param  : Nil
 *@return : Nil
 */
function logoutUser()
{
  var winOpen = false;
  if(testWin.length > 0)
    {
      winOpen = true;
    }

  if(modifyKBaseWin!=""&&!modifyKBaseWin.closed)
    {
      winOpen = true;
    }

  if(modifyKBaseWinSup!=""&&!modifyKBaseWinSup.closed)
    {
      winOpen = true;
    }

  if(openKBaseDesc!=""&&!openKBaseDesc.closed)
    {
      winOpen = true;
    }

  if(customerReport!=""&&!customerReport.closed)
    {
      winOpen = true;
    }

  if(htmlEditorWin!=""&&!htmlEditorWin.closed)
    {
      winOpen = true;
    }

  if(htmlEditorWinMod!=""&&!htmlEditorWinMod.closed)
    {
      winOpen = true;
    }

  if(openDescriptionView!=""&&!openDescriptionView.closed)
    {
      winOpen = true;
    }

  if(winOpen)
    {
      if(window.confirm("Some of the child windows are open, do you like to close them?"))
	{
	  if(modifyKBaseWin!=""&&!modifyKBaseWin.closed)
	    {
	      modifyKBaseWin.close();
	    }

	  if(modifyKBaseWinSup!=""&&!modifyKBaseWinSup.closed)
	    {
	      modifyKBaseWinSup.close();
	    }

          if(openDescriptionView!=""&&!openDescriptionView.closed)
            {
              openDescriptionView.close();
            }

	  if(openKBaseDesc!=""&&!openKBaseDesc.closed)
	    {
	      openKBaseDesc.close();
	    }

	  if(customerReport!=""&&!customerReport.closed)
	    {
	      customerReport.close();
	    }

	  if(htmlEditorWin!=""&&!htmlEditorWin.closed)
	    {
	      htmlEditorWin.close();
	    }

	  if(htmlEditorWinMod!=""&&!htmlEditorWinMod.closed)
	    {
	      htmlEditorWinMod.close();
	    }

	  closeWindows();
	}
    }

  /*
    if(myProfileWin!=""&&!myProfileWin.closed)
    {
    myProfileWin.close();
    }
  */
  /*
    if(searchKBaseWin!=""&&!searchKBaseWin.closed)
    {
    searchKBaseWin.close();
    }
  */
}

/*
 *purpose : On logout close all the child windows when session 
 *          expiry
 *syntax  : logoutExpiry()
 *@param  : Nil
 *@return : Nil
 */
function logoutExpiry()
{
  if(modifyKBaseWin!=""&&!modifyKBaseWin.closed)
    {
      modifyKBaseWin.close();
    }

  if(modifyKBaseWinSup!=""&&!modifyKBaseWinSup.closed)
    {
      modifyKBaseWinSup.close();
    }

  if(openDescriptionView!=""&&!openDescriptionView.closed)
    {
      openDescriptionView.close();
    }

  if(openKBaseDesc!=""&&!openKBaseDesc.closed)
    {
      openKBaseDesc.close();
    }

  if(customerReport!=""&&!customerReport.closed)
    {
      customerReport.close();
    }

  if(htmlEditorWin!=""&&!htmlEditorWin.closed)
    {
      htmlEditorWin.close();
    }

  if(htmlEditorWinMod!=""&&!htmlEditorWinMod.closed)
    {
      htmlEditorWinMod.close();
    }

  closeWindows();
}

function submitCustName()
{
  alert(1);
  var custName = document.SelectCustomer.customer.value;
  alert(custName);
  if(custName != "Select Customer Name")
    {
      document.SelectCustomer.action="SelectCustomerParams.jsp";
      document.SelectCustomer.submit();
    }
  else
    {
      alert("Please select a Customer Name");
    }
}

function changeServices()
{
  var custName = document.SelectCustomer.customer.value;
  if(custName == "Select Customer Name")
    {
      alert("Select The Customer Name.");
      return;
    }
  var urlvalue = 'SelectCustomerAJAX.jsp?cNAJAX='+custName;
  var http;
  var browser = navigator.appName;
  if (window.XMLHttpRequest){
    http = new XMLHttpRequest()
      }
  else{
    if (window.ActiveXObject){
      http = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  http.open('Post',urlvalue ,true);
  http.onreadystatechange = function(){
    if(http.readyState == 4 && http.status == 200) {
      var res = http.responseText;
      if(res){
	document.getElementById("showservice").innerHTML = res;
      }
    }
  }
  http.send(null);
}

function openNewWindow()
{
  var error = "";
  var customerName=document.SelectCustomer.customer.value;
  var service=document.SelectCustomer.service.value;
  var month=document.SelectCustomer.month.value;
  var year=document.SelectCustomer.year.value;

  if(customerName=="Select Customer Name")
    error+="Select Customer Name.\n";
  if(service=="Select Service")
    error+="Select Service.\n";
  if(month=="Select Month")
    error+="Select Month.\n";
  if(year=="Select Year")
    error+="Select Year.\n";
  if(error.length>0)
    {
      alert(error);
      return false;
    }
  else
    {
      customerReport = window.open('/CygNetBIS/CustomerReport.jsp?customer='+customerName+'&service='+service+'&month='+month+'&year='+year,'mywindow','left=200,top=100,width=700,height=550,resizable=yes,scrollbars=yes');
      return true;
    }
}

/*-------------------------------------------------------------------------
*    treeHighlightReset -- highlight only the currently selected option
*    Args:
*    Returns:
-------------------------------------------------------------------------*/
function treeHighlightReset(currentId) {
     var totalMenus = ntreeHandler.totalItemCount+1;
    for(var count=2; count <= totalMenus+1; count++) {
       var str = 'webfx-tree-object-'+count+'-anchor';
       document.getElementById(str).style.color='black';
    }
    var str1 = currentId+'-anchor';
    document.getElementById(str1).style.color='#1693D6';
}


   /*---------------------------------------------------------------------------
   *    displayDescription -- This function is used to display the kbase description
                              deatils.
   *    Args: val
   *    Returns: Nothing
   ---------------------------------------------------------------------------*/
  function displayDescription(val)
  {
  
  modifyKBaseWinSup = window.open("DisplayDescription.jsp?desc="+val,'modifyKBaseWinSup','left=500,top=410,width=380,height=150,scrollbars=yes');
     
      descTable ="<table width='75%' border='1' align='center' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>"+
                  "<tr bgcolor='#E6F1F2'> <td height='70' colspan='2' valign='top' class='tableLable'><div align='center'> " +
                  "<p class='tableheader'>"+val+"</p>" +
                  "</div></td>" +
                  "</tr>" +
                  "</table>";
      
  }

  /*---------------------------------------------------------------------------
   *    modifyDetails -- This function is used to modify the kbase deatils by
                         sending the response to the server
   *    Args: Nothing
   *    Returns: Nothing
   ---------------------------------------------------------------------------*/
  function modifyDetails(val)
  {
    
   document.getElementById('faqTable').style.visibility="hidden";
   modifyKBaseWin = window.open("ModifyKBaseDetails.jsp?faqId="+val,'modifyKBaseWin','left=150,top=100,width=700,height=550,scrollbar=yes,resizable=yes');
  }

function openInWindow(fileName)
{
  openKBaseDesc = window.open("SupportingFiles/"+fileName,'openKBaseDesc','left=250,top=300,width=700,height=300,scrollbars=yes,resizable=yes');
}

  /*------------------------------------------------------------------------------------
   *    displayDescriptionView -- This function is used to display the FAQ description.
   *    Args: indexVal
   *    Returns: Nothing
   --------------------------------------------------------------------------------------*/ 
  function displayDescriptionView(val)
  {
   
    openDescriptionView = window.open("DisplayDescription.jsp?desc="+val,'openDescriptionView','left=500,top=410,width=380,height=150,scrollbars=yes');
     /* document.getElementById('floatDesc').value = val;
     
     document.getElementById('alertView').style.visibility="visible";
     JSFX_FloatDiv("alertView",100,90).floatIt();
     */
      
  }


/*-------------------------------------------------------------------------
 * $Log: Validation.js,v $
 * Revision 1.1  2009/07/14 04:29:43  vinoth
 * Initial commit on July 14
 *
 *
 * Local Variables:
 * time-stamp-active: t
 * time-stamp-line-limit: 20
 * time-stamp-start: "Last modified:[ 	]+"
 * time-stamp-format: "%3a %02d-%3b-%:y %02H:%02M:%02S by %u"
 * time-stamp-end: "$"
 * End:
 *                        End of Validation.js
 -------------------------------------------------------------------------*/

