
  function validateDateInput(dateInput) {
    var regExp =/^\d\d\/\d\d\/\d\d\d\d$/;
    alert(dateInput.match(regExp));
    if (dateInput.match(regExp) == null)  {
      alert("invalid");
      return false;
    }
    alert("yes valid");
    return true;    
  }
  
  function validatePastDate(dealLineDateStr) {
    var deadLineMM = dealLineDateStr.substr(0,2);
    var deadLineDD = dealLineDateStr.substr(3,2);
    var deadLineYY = dealLineDateStr.substr(6,4);
    var deadLineDate = new Date(deadLineYY, deadLineMM - 1, deadLineDD);
    var currentDate = new Date();
    
    if(deadLineDate.getYear() == currentDate.getYear() && deadLineDate.getMonth() == currentDate.getMonth() && 
      deadLineDate.getDate() == currentDate.getDate()) {
        return true;
	} else if(deadLineDate < currentDate) {
      return false;
    }
    return true;
  }

  function validateDateRange(fromDateStr, toDateStr) {
    var fromMM = fromDateStr.substr(0,2);
    var fromDD = fromDateStr.substr(3,2);
    var fromYY = fromDateStr.substr(6,4);
    var toMM = toDateStr.substr(0,2);
    var toDD = toDateStr.substr(3,2);
    var toYY = toDateStr.substr(6,4);
    var fromDate = new Date(fromYY, fromMM - 1, fromDD);
    var toDate = new Date(toYY, toMM - 1, toDD);
    
    if(fromDate > toDate) {
      return false;
    }
    return true;
  }
  
  function validateStartEndDateValidRangeForDateBoundry(beginDateStr, endDateStr, 
          boundryBeginDateStr, boundryEndDateStr) {
    var beginMM = beginDateStr.substr(0,2);
    var beginDD = beginDateStr.substr(3,2);
    var beginYY = beginDateStr.substr(6,4);
    var endMM = endDateStr.substr(0,2);
    var endDD = endDateStr.substr(3,2);
    var endYY = endDateStr.substr(6,4);

    var boundryBeginMM = boundryBeginDateStr.substr(0,2);
    var boundryBeginDD = boundryBeginDateStr.substr(3,2);
    var boundryBeginYY = boundryBeginDateStr.substr(6,4);
    var boundryEndMM = boundryEndDateStr.substr(0,2);
    var boundryEndDD = boundryEndDateStr.substr(3,2);
    var boundryEndYY = boundryEndDateStr.substr(6,4);

    var beginDate = new Date(beginYY, beginMM - 1, beginDD);
    var endDate = new Date(endYY, endMM - 1, endDD);
    
    var bndryBeginDate = new Date(boundryBeginYY, boundryBeginMM - 1, boundryBeginDD);
    var bndryEndDate = new Date(boundryEndYY, boundryEndMM - 1, boundryEndDD);
    
    if(beginDate < bndryBeginDate || beginDate > bndryEndDate ||
        endDate < bndryBeginDate || endDate > bndryEndDate) {
        return false;
    } else {
        return true;
    }
  }
  
  function rowHover(row) {
    row.oldClassName = row.className;
    row.className = "rowHover";
    row.onmouseout = function() {
        this.className = this.oldClassName;
    }
  }
  
  function rowHoverWhline(row) {
    row.oldClassName = row.className;
    row.className = "rowHoverWhline";
    row.onmouseout = function() {
        this.className = this.oldClassName;
    }
  }
  
  function validateDateRangeWithIndex(fromDateStr, toDateStr, index) {
    var fromMM = fromDateStr.substr(0,2);
    var fromDD = fromDateStr.substr(3,2);
    var fromYY = fromDateStr.substr(6,4);
    var toMM = toDateStr.substr(0,2);
    var toDD = toDateStr.substr(3,2);
    var toYY = toDateStr.substr(6,4);
    var fromDate = new Date(fromYY, fromMM - 1, fromDD);
    var toDate = new Date(toYY, toMM - 1, toDD);
    
    if(fromDate > toDate) {
      alert(index+" <bean:message key='EPM_WARNING_0026' />");
      return false;
    }
    return true;
  }  

  function validateDescriptionMaxLength(description, length) {
    if(description.length > length) {
      alert("Description specified is too large");
      return false;
    }
    return true;
  }
  
  function validateDescriptionMaxLengthWithIndex(description, length, index) {
    if(description.length > length) {
      alert(index+" <bean:message key='EPM_WARNING_0025'/>");
      return false;
    }
    return true;
  }  
  
  function isDateOverlaps(startDate1, endDate1, startDate2, endDate2) {
    var startMM1 = startDate1.substr(0,2);
    var startDD1 = startDate1.substr(3,2);
    var startYY1 = startDate1.substr(6,4);
    var endMM1 = endDate1.substr(0,2);
    var endDD1 = endDate1.substr(3,2);
    var endYY1 = endDate1.substr(6,4);
    
    var startMM2 = startDate2.substr(0,2);
    var startDD2 = startDate2.substr(3,2);
    var startYY2 = startDate2.substr(6,4);
    var endMM2 = endDate2.substr(0,2);
    var endDD2 = endDate2.substr(3,2);
    var endYY2 = endDate2.substr(6,4);
    
    var s1 = new Date(startYY1, startMM1 -1, startDD1);
    var e1 = new Date(endYY1, endMM1 - 1, endDD1);
    var s2 = new Date(startYY2, startMM2 -1, startDD2);
    var e2 = new Date(endYY2, endMM2 - 1, endDD2);
    if((s2>= s1 && s2 <= e1) || (e2 >= s1 && e2 <= e1)) {
      return true;
    } else if (s1 >= s2 && e1 <= e2) {
      return true;
    } else {
      return false;
    }
  }
  
function isValidCharacters(inputText) {
  var regExp_1 = new RegExp("[^-_.@ A-Za-z0-9\\P{ASCII}\u0080-\uFFFD]");
  var regExp_2 = new RegExp("[\{\}]+");
  if (inputText.length == 0 || inputText.match(regExp_1)
      || inputText.match(regExp_2)) {
    return false;
  }
  return true;
}

	function validateMaxLength(inputText, maxLen) {
	  var count = 0;
	  for (var n = 0; n < inputText.length; n++) {
	    var c = inputText.charCodeAt(n);
	    if (c == 13) {
	    } else if (c < 128) {
	      count++;
	    } else if(c < 2048) {
	      count += 2;
	    } else if(c < 65536) {
	      count +=3;
	    } else {
	      count +=4;
	    }
	  }
	  if (count > maxLen) {
	    return false;
	  } else {
	    return true;
	  }
	}

	// checks whether the given cost is valid or not. 
   function checkCost(cost) {
		 var st = "";
		 for(var i = 0; i < cost.length; i++) {
		   if(!(cost.charAt(i) == '$' || cost.charAt(i) == ',')) {
		     st += cost.charAt(i);
		   } 
		 }
		 cost = st;
        
        
    	var realPart;
    	var decimalPart = "0";
    	// just check whether the user has entered realPart or decimalPart.
		if(cost.indexOf('.') == -1) {
			// User has entered only realPart.
			realPart = cost;
	    } else {
	    	realPart = cost.substring(0,cost.indexOf('.'));
	    	decimalPart  = cost.substring(cost.indexOf('.')+1);
	    	if(decimalPart.length == 1)
	    		decimalPart = decimalPart + 0;
	    }
		if(isdigit(realPart) == false || isdigit(decimalPart) == false) {
			alert("Please enter the Cost");
	    	return false;
	    } else if((parseInt(decimalPart) <0) || (parseInt(decimalPart)>99)) {
	    	alert("DecimalPart of the Cost is Invalid");
	    	return false;
	    }
	    return true;
	}     	
	
	// checks whether the given amount is valid or not. 
   function checkAmount(amount) {
   		var st = "";
		 for(var i = 0; i < amount.length; i++) {
		   if(!(amount.charAt(i) == '$' || amount.charAt(i) == ',')) {
		     st += amount.charAt(i);
		   } 
		 }
		amount = st;
		
    	var realPart;
    	var decimalPart = "0";
    	// just check whether the user has entered realPart or decimalPart.
		if(amount.indexOf('.') == -1) {
			// User has entered only realPart.
			realPart = amount;
	    } else {
	    	realPart = amount.substring(0,amount.indexOf('.'));
	    	decimalPart  = amount.substring(amount.indexOf('.')+1);
	    	if(decimalPart.length == 1)
	    		decimalPart = decimalPart + 0;
	    }
		if(isdigit(realPart) == false || isdigit(decimalPart) == false) {
			alert("Please enter the valid Amount");
	    	return false;
	    } else if((parseInt(decimalPart) <0) || (parseInt(decimalPart)>99)) {
	    	alert("DecimalPart of the Amount is Invalid");
	    	return false;
	    }
	    return true;
	}     	
	
   // checks whether the given percentage is valid or not. it expects user would give
   // time as hh.mm for example 10.30
   function checkPercentage(percentage) {
    	var realPart;
    	var decimalPart = "0";
    	if(percentage.length<=0) {
    	    alert("Please enter the valid Percentage");
	    	return false;
	    }
    	// just check whether the user has entered realPart or decimalPart.
		if(percentage.indexOf('.') == -1) {
			// User has entered only realPart.
			realPart = percentage;
	    } else {
	    	realPart = percentage.substring(0,percentage.indexOf('.'));
	    	decimalPart  = percentage.substring(percentage.indexOf('.')+1);
	    	if(decimalPart.length == 1)
	    		decimalPart = decimalPart + 0;
	    }
		if(isdigit(realPart)==false || isdigit(decimalPart)==false) {
			alert("Please enter the valid Percentage");
	    	return false;
	    } else if((parseInt(realPart) ==0) && (parseInt(decimalPart) ==0)) {
	        alert("Percentage cannot be 0.0");
	        return false;
	    } else if((parseInt(realPart) ==100) && (parseInt(decimalPart) >0)) {
	        alert("Percentage should not exceed 100");
	        return false;
	    } else if((parseInt(realPart) <0) || (parseInt(realPart)>100)) {
	    	alert("Percentage should not be less than 0 or greater than 100");
	    	return false;
	    } else if((parseInt(decimalPart) <0) || (parseInt(decimalPart)>99)) {
	    	alert("Please enter the valid Percentage");
	    	return false;
	    }
	    return true;
	}     	
	
   // checks whether the given time is valid or not. it expects user would give
   // time as hh.mm for example 10.30
   // If the format is 12 the max.hour is 12
   // If the format is 24 the max.hour is 24
   // If the format is 0 the max.hour can be more than above 24 
   function checkValidTime(time,format,label) {
    	var hour;
    	var min = "0";
    	if(time.length<=0) {
    		alert("Please enter the valid" + " " + label);
	    	return false;
	    }
    	// just check whether the user has entered minute or not.
		if(time.indexOf('.') == -1) {
			// User has entered only hour.
			hour = time;
	    } else {
	    	hour = time.substring(0,time.indexOf('.'));
	    	min  = time.substring(time.indexOf('.')+1);
	    	if(min.length == 1)
	    		min = min + 0;
	    }
		if(isdigit(hour)==false || isdigit(min)==false) {
			alert("Please enter the valid" + " " + label);
	    	return false;
	    } else if((parseInt(min) <0) || (parseInt(min)>=60)) {
	     	alert("Minute value should not be less than 0 or should not exceed 59" + " for " +label);
	      	return false;
	    }
	    if(format==12) {
	    	if((parseInt(hour)<1) || (parseInt(hour)>12)) {
	      		alert("Hour value should not be less than 1 or should not exceed 12"  + " for " +label);
	     		return false;
	    	} 
	    }
	    if(format==24) {
	    	if((parseInt(hour)<0) || (parseInt(hour)>=24)) {
	      		alert("Hour value should not be less than 0 or should not exceed 24"  + " for " +label);
	      		return false;
			}
		}
		if(format==0) {
			if((parseInt(hour)<0)) {
				alert("Please enter the valid" + " " + label);
				return false;
			}
	    }
	    return true;
	}
	
	// checks whether the 'digits' string contains only numbers.
	function isdigit(digits) {
		var digitExp=/^\d{0,}$/;
	    if(digits.search(digitExp)==-1) {
	    	return false;
	    }
	    return true;
	}
	
	function getMinute(time) {
		var min;
		if(time.indexOf('.') == -1) {
			// User has entered only hour.
			min = 0;
	    } else {
	    	min  = parseInt(time.substring(time.indexOf('.')+1));
	    }
	    return min;
	}
	
	function getHour(time) {
		var hour;
		if(time.indexOf('.') == -1) {
			// User has entered only hour.
			hour = parseInt(time);
	    } else {
	    	hour  = parseInt(time.substring(0,time.indexOf('.')));
	    }
	    return hour;
	}
	
	// checks whether the start time is greater than end time.
	function isStartTimeGreater(startTime, endTime) {
		var startHour = getHour(startTime);
    	var startMin = getMinute(startTime);
    	var endHour = getHour(endTime);
    	var endMin = getMinute(endTime);
    	if(startHour == 12) {
    		startHour = 0;
    	}
    	if (endHour == 12) {
    		endHour = 0;
    	}
    	
	    if((startHour > endHour) || 
	       ((startHour == endHour)&& (startMin > endMin))) {
	    	return true;
	    }
	    return false;
	}
	
	// checks whether the entered time data's are correct or not. 
	// this function requires four parameters.
	// @Param1 StartTime -- hh.mm
	// @Param2 EndTime  -- hh.mm
	// @Param3 startSuffix -- "AM" or "PM"
	// @Param 4 endSuffix  -- "AM" or "PM"
	function checkTime(startTime, endTime, startSuffix, endSuffix, startLabel, endLabel) {
        if(checkValidTime(startTime,12,startLabel) && checkValidTime(endTime,12,endLabel)) {
	    	if(endSuffix == "AM" && startSuffix =="PM") {
	    		alert(startLabel+" should not be greater than "+endLabel);
		    	return false;
		    } else if(startSuffix == endSuffix) {
		    	if(startTime == endTime) {
		    		alert(startLabel+" and "+endLabel+" should not be same ");
		    	    return false;
		    	}
		    	if(isStartTimeGreater(startTime,endTime)) {
		    	    alert(startLabel+" should not be greater than "+endLabel);
		    	    return false;
		    	}
		    }
	    } else {
	    	return false;
	    }
	    return true;		
	}
	
	function refreshParent() {
      if(parent.opener != null && !parent.opener.closed) {
        var mainFrame = window.opener.top.mainFrame;
        if (mainFrame.refreshTaskList) {
          mainFrame.refreshTaskList();
        }
      }
    }
    
    function checkAllMessages(chkBoxID, buttonID) {
      var element = document.getElementById("checkAll");
      var checks= document.getElementsByName(chkBoxID);
      var btn = document.getElementById(buttonID);
      var selectedFlag = false;
      for(i=0;i<checks.length;i++) {
        if(checks[i].type=="checkbox" && (checks[i].disabled == false)) {
          selectedFlag = true;
          if(element.checked) {
            checks[i].checked = true;
          }else {
            checks[i].checked = false;
          }
        }
      }
      if(selectedFlag == true && checks.length > 0) {
      	btn.disabled = !element.checked;
      }
    }
    function selectAllMessages(chkBoxID, buttonID) {
      var element = document.getElementById("checkAll");
      var checks= document.getElementsByName(chkBoxID);
      var btn = document.getElementById(buttonID);	  
      var selectedFlag = false;
      for(i=0;i<checks.length;i++) {
        if(checks[i].type=="checkbox" && (checks[i].disabled == false)) {
          selectedFlag = true;
		  element.checked = true;
          checks[i].checked = true;         
        }
      }
      if(selectedFlag == true && checks.length > 0) {
      	btn.disabled = !element.checked;
      }
    }
    function setDeleteBtnStatus(chkBoxID, buttonID) {
      var elements = document.getElementsByName(chkBoxID);
      var selectedFlag = false;
      var element = document.getElementById("checkAll");
      if(element!=null)
      	element.checked = false;
      if(elements == null) {
        return false;
      }
      for(var i = 0; i < elements.length; i++) {
        if(elements[i].checked) {
          selectedFlag = true;
          break;
        }
      }
      var btn = document.getElementById(buttonID);
      if(btn == null) {
        return false;
      }
      if(selectedFlag) {
        btn.disabled = false;  
      } else {
        btn.disabled = true;
      }
    }
	
    function setReminderBtnStatus(chkBoxID, buttonID) {
      var elements = document.getElementsByName(chkBoxID);
      var selectedFlag = false;
      var element = document.getElementById("checkAll");
      var resourceElement = document.getElementById("resourceID");
      
      if(element!=null)
      	element.checked = false;
      if(elements == null) {
        return false;
      }
      for(var i = 0; i < elements.length; i++) {
        if(elements[i].checked) {
          selectedFlag = true;
          break;
        }
      }
      var btn = document.getElementById(buttonID);
      if(btn == null) {
        return false;
      }
      if(selectedFlag) {
        btn.disabled = false;  
      } else {
        btn.disabled = true;
      }
    }
	
    function disableChkBoxs() {
	    var eltArray = new Array();
    	eltArray[0] = document.getElementById("projectFavoriteChkEltId");
    	eltArray[1] = document.getElementById("projectIncludeAllEltId");
    	eltArray[2] = document.getElementById("resourceFavoriteChkEltId");
    	eltArray[3] = document.getElementById("resourceIncludeAllEltId");
    	for(var index=0;index<4;index++) {
    	  	if(eltArray[index]!=null) {
    			eltArray[index].disabled = true;
    		}
    	}
    }
    
    function enableChkBoxs() {
	    var eltArray = new Array();
    	eltArray[0] = document.getElementById("projectFavoriteChkEltId");
    	eltArray[1] = document.getElementById("projectIncludeAllEltId");
    	eltArray[2] = document.getElementById("resourceFavoriteChkEltId");
    	eltArray[3] = document.getElementById("resourceIncludeAllEltId");
    	for(var index=0;index<4;index++) {
    	  	if(eltArray[index]!=null) {
    			eltArray[index].disabled = false;
    		}
    	}
    }
    
    function check(e) {
       if (document.all) {        
        if (event.keyCode =='127'||event.keyCode=='8') 
        return true;
        else
        return false;
       }
      else
       {
		if(e.charCode=="0")		
		return true;
        else        
        return false;		
	   } 
    }
    
    function checkDateFormat(value, label) {
      if(value != "" && value.length != 10) {
      	 alert("Please enter the valid Date format for "+ label);
      	 return false;
      }
      return true;
    }
    
   function openPrivacyPolicy()
   {
   var win = window.open('/<%= ApplicationConstants.APPLICATION_NAME %>/jsp/privacyPolicy.htm','_blank','width=900,height=700,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
   return win;
   }
   
   function openContactUs()
   {
   var win = window.open('http://confii.com/About_Confluence/Contact_Us/body_contact_us.html','_blank','width=900,height=700,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
   return win;
   }   
   
   function openQuickStartGuide()
   {
   var win = window.open('/<%= ApplicationConstants.APPLICATION_NAME %>/doc/ProSymUsermanualV4.0.pdf','_blank','width=900,height=700,resizable=yes,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
   return win;
   }   
   
   function openPricing() {
   var win = window.open('/<%= ApplicationConstants.APPLICATION_NAME %>/doc/ProjectSymphonyPricing.gif','_blank','width=900,height=700,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
   return win;
   }
    
	// Scripts for days between dates
	// The Javascript Date object is buggy, so a custom date object is included.
	
	var df = 1; //date format mm/dd/yyyy
	    
	//<<**Custom Date object
	//Thanks to Claus T?ndering for the Julian day algorithm
	
	var GREGORIAN = 0;
	var JULIAN = 1;
	var year = 0;
	var month = 0;
	var day = 0;
	var julianday = 0.0;
	var modifiedjulianday = 0.0;
	
	function ipart(r){ return Math.round(r - 0.5) }
	function getJulianDay(){ return this.julianday } 
	function getModifiedJulianDay(){ return this.modifiedjulianday }
	
	function CustomDate(yr, mo, da, type){
	  year = yr * 1.0;  //convert string to float
	  if (year < -4713 || year > 3268){
	    alert("Year out of range");
		document.datainput.dateerr.value="??"
	    return;
	  }
	  month = mo * 1.0;
	  day = da * 1.0;
	  if (year == 1582 && month == 10 && day > 4 && day < 15){
	    alert("Invalid date: 15 Oct immediately followed 4 Oct in the year 1582")
		document.datainput.dateerr.value="??"
	    return;
	  }
	  if (year < 0) year = year + 1; //B.C. date correction
	  var a = ipart((14 - month) / 12);
	  var y = year + 4800 -a;
	  var m = month + 12 * a - 3;
	  if (type == GREGORIAN) {
	    julianday = day + ipart((153*m + 2)/5) + y*365 + ipart(y/4) - ipart(y/100) + ipart(y/400) - 32045;
	  }
	  if (type == JULIAN) {
	    julianday = day + ipart((153*m + 2)/5) + y*365 + ipart(y/4) - 32083;
	  }
	  modifiedjulianday = julianday - 2400000.5; //Zero at 17 Nov 1858 00:00:00 UTC
	  this.getJulianDay = getJulianDay();
	  this.getModifiedJulianDay = getModifiedJulianDay();
	}
	//CustomDate**>>
	
	function fix2DigitDate(dateval){
	  var date = dateval + "" //dateval must be a string
	  if (date.length < 3){ 
	    date = 1900 + date * 1.0
		date = date + ""  //to string
	  }
	  return date
	}
	
	function parseDate(dateval){
		//split is a Javascript 1.2 function
		var dary=dateval.split("/")
	   
		var y = fix2DigitDate(dary[2]) 
		
		  m = dary[0];
		  d = dary[1]  // mm/dd/yyyy
		  
		
		var calendar
		if (y > 1582) calendar = GREGORIAN
		  else if (y < 1582) calendar = JULIAN
		     else if (m < 10 | (m == 10 && d < 15)) calendar = JULIAN
		        else calendar = GREGORIAN 
		i=new CustomDate(y,m,d,calendar)
		return i
		}//dateval
	
	//Calculate days between dates	
	function calcDBD(scheduledStartDateStr, scheduledEndDateStr,bufferedDays){	
		
		var date1 = scheduledStartDateStr;
		var date2 = scheduledEndDateStr;
		var days = bufferedDays;
		
		firstdate=parseDate(date1)
		seconddate=parseDate(date2)
		dbd = seconddate.getJulianDay-firstdate.getJulianDay
		dbd=dbd+1;		
		if(bufferedDays > dbd){
		 alert("buffered days should not exceed project duration days");
		 return false;
		}		
		return true;
	 }//calcDBD	
	
	function validateBufferedDays(bufferedDays,projectScheduleStartDate, 
			projectScheduleEndDate, boundryBeginDateStr, boundryEndDateStr ) {
	  
	  var bufferedDays = bufferedDays;
	  var EnteredMonth = projectScheduleEndDate.substr(0,2) - 1;
      var EnteredDay = projectScheduleEndDate.substr(3,2);
      var EnteredYear = projectScheduleEndDate.substr(6,4);
      // Create a new date object with the entered month, day and year
      var EnteredDate = new Date(EnteredYear, EnteredMonth, EnteredDay, 0, 0, 0);
      // Determine the milliseconds in the timespan selected
      // Set the default (1 day)
      var MilliSecondsBase = 86400000
      // If the span selected is weeks, multiply the default by 7
      
      // Multiply the millisecons by the period entered
      MilliSecondsToAdd  = MilliSecondsBase * bufferedDays ;
      // Create the new date using the correct operation     
      
         var NewDateAsNumber = EnteredDate.getTime() - MilliSecondsToAdd;
      
      // Create the new date object
      var NewDate = new Date(NewDateAsNumber);
      // Get the month, day and year values from the new date object
      // Set the month and day to two digits if they are less than 10
      var NewMonth = NewDate.getMonth() + 1;
      if (NewMonth < 10) {
         NewMonth = "0" + NewMonth;
      }
      var NewDay = NewDate.getDate();
      if (NewDay < 10) {
         NewDay = "0" + NewDay;
      }
      var NewYear = NewDate.getFullYear();
      // Display the new date in the form
      var projectBufferedStartDate;
      var projectBufferedEndDate = projectScheduleEndDate;
      projectBufferedStartDate = NewMonth + "/" + NewDay + "/" + NewYear;          
	    var beginMMM = projectBufferedStartDate.substr(0,2);
	    var beginDDD = projectBufferedStartDate.substr(3,2);
	    var beginYYY = projectBufferedStartDate.substr(6,4);
	    var endMMM = projectBufferedEndDate.substr(0,2);
	    var endDDD = projectBufferedEndDate.substr(3,2);
	    var endYYY = projectBufferedEndDate.substr(6,4);
	
	    var boundryBeginMMM = boundryBeginDateStr.substr(0,2);
	    var boundryBeginDDD = boundryBeginDateStr.substr(3,2);
	    var boundryBeginYYY = boundryBeginDateStr.substr(6,4);
	    var boundryEndMMM = boundryEndDateStr.substr(0,2);
	    var boundryEndDDD = boundryEndDateStr.substr(3,2);
	    var boundryEndYYY = boundryEndDateStr.substr(6,4);
	
	    var bufferStartDate	 = new Date(beginYYY, beginMMM - 1, beginDDD);
	    var projectEndDatee = new Date(endYYY, endMMM - 1, endDDD);
	    
	    var scheduleBeginDatee = new Date(boundryBeginYYY, boundryBeginMMM - 1, boundryBeginDDD);
	    var scheduleEndDatee = new Date(boundryEndYYY, boundryEndMMM - 1, boundryEndDDD);
	    if(scheduleEndDatee > bufferStartDate) {
	    	return false;
	    }  else {
	        return true;
	    }
   }
   
   function budgetedCostStringCheck(e) {
	 var formObj = document.projectForm;
	 var budgetedCostString = formObj.budgetedCostString.value; 
       if (document.all) {        
        if(budgetedCostString.length <= 12)
	   return true;
	   else
	   return false;
	   }
      else
       {
			if(budgetedCostString.length <= 12){		  
			  return true;
			}
			else {	        
					if(e.charCode=="0")			
					return true;
					else
					return false;
		         } 	
	   }
    }
   function checkPortfolioStartDate(fYear,fromDateStr) {         
        var portfolioYear = fYear - 1;
		toDateStr = "07" + "/" + "01" + "/" + portfolioYear;		
		var fromMM = fromDateStr.substr(0,2);
		var fromDD = fromDateStr.substr(3,2);
		var fromYY = fromDateStr.substr(6,4);
		var toMM = toDateStr.substr(0,2);
		var toDD = toDateStr.substr(3,2);
		var toYY = toDateStr.substr(6,4);
		var fromDate = new Date(fromYY, fromMM - 1, fromDD);
		var toDate = new Date(toYY, toMM - 1, toDD);
		
		if(fromDate < toDate){		    
		return false;
		}
        else        
		return true;
}
