
function ShowNotes(notesField,maxLength) 
{
	var retval = window.showModalDialog('Notes.aspx', notesField, "status:no;dialogHeight:300px;dialogWidth:400px");
	if (retval)
		notesField.fireEvent('onchange');
	return false;	
}

function CheckLength(length, $message) {
	alert('in');
  	var abc=window.event.srcElement.value;

	

      if (window.event.srcElement.value.length >= length) {
	  		if ($message == null)
	           alert('You have reached the maximum length of ' + length.toString() + ' characters permitted here.');
			else
			   alert($message);
			   
           window.event.srcElement.value=abc.substring(0,length);
           
           return false;                         
       }

 }

function SetFocus(strObjectId) {
	var obj = document.getElementById(strObjectId);
	
	if (obj != null){
		obj.focus();
	}
	

}

function DisplayCalendar(dateField,mode) {			 
			 // display the calendar pop-up 
			 //alert(mode);
			 var retval= window.showModalDialog('../common/Calendarhost.asp?Mode=' + mode + '&selectedDate=' + encodeURIComponent(dateField.value)
												,null
												,"status:no;dialogHeight:320px;dialogWidth:280px");
			  
			 //set the value returned to the caller
			 if ( retval != null && retval != -1) { 
			    dateField.value = retval;
			    dateField.fireEvent("onchange");		
			    dateField.focus();   
			 }						
			 return false;	
} 

function displayWindow(url, width, height,resizable,scrollbars) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=' + resizable + ',scrollbars=' + scrollbars +',menubar=no,status=no' );
        return false;
}

function email_page( width, height ) {	
	var refer_page_url = document.URL;
	var refer_page_title = escape(document.title);
	var url = '/EmailPage.aspx?url=' + refer_page_url + '&title=' + refer_page_title;
	
	return displayWindow(url, width, height);
}




