function hidestatus(){
	window.status='http://www.email-local-agents.com'
return true
}

// function is used for delete confirmation message 
function checkDelete()
{
	if(OneChecked())
	{			
		return ShowConfirmation();
	}
	else
	{
		ShowMessage('Please select a record.');			
		return false;
	}
}
	/* This function is used for confirmartion before delete the data.*/
function ShowConfirmation()
{
	return confirm('Are you sure you want to delete?');
}
function ShowMessage(message)
{
	alert(message);
}

// Set default focus to submit button

function SubmitButton(button, event)
{
	if ((event.which ? event.which : event.keyCode) == 13)
	{
		document.getElementById(button).click(); return false;
	}
}	

// Validate final input
  function ValidateInput(event)
  {
	var retSpecial = ValidateSpecial(event);
	var retQuotes  = ValidateQuoted(event);
	
	var retVal     = retSpecial && retQuotes
	return retVal;
  }
  
  // Validate special characters all
  function ValidateSpecial(event)
  {
	if(!isNetscape){if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) event.returnValue = false;}else{if ((event.which > 32 && event.which < 48) || (event.which > 57 && event.which < 65) || (event.which > 90 && event.which < 97)) return false;}  
  }
  
  // Validate special characters allow comma
  function ValidateSpecialWithComma(event)
  {
	if(!isNetscape){if (event.keyCode==63 || event.keyCode==59 || event.keyCode==44 || event.keyCode==46) event.returnValue = true;}else{if (event.which==63 || event.which==59 || event.which==44 || event.which==46) return true;}  
	if(!isNetscape){if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) event.returnValue = false;}else{if ((event.which > 32 && event.which < 48) || (event.which > 57 && event.which < 65) || (event.which > 90 && event.which < 97)) return false;}  
  }  
  
  // validate quotes
  function ValidateQuoted(event)
  {
    if(!isNetscape){if (event.keyCode==34 || event.keyCode==39) event.returnValue = false;}else{if (event.which==34 || event.which==39) return false;}
  }
  
  function ValidateMaxLength(event, control, maxlimit)
  {
	var objControl = document.getElementById("'" + control + "'");
	
	if(objControl != null && objControl != 'undefined' && objControl != '')
	{
		TextCounter(objControl, maxlimit);
	}	

  }
  function OpenDialog(openFile, varTop, varLeft,varHeight,varWidth, varScroll, winName)
{
	window.open(openFile,winName, "top=" + varTop + ",left=" + varLeft + ",height=" + varHeight + ",width=" + varWidth + ",scroll=" + varScroll + ",toolbar=no,menubar=no,location=no,center=yes,resizable=no,scrollbars=" + varScroll + "");
	return false;
}
  
  function ValidateNumbers(event)
  {
	if(!isNetscape)
	{
		if(event.keyCode < 45 || event.keyCode > 57)
		event.returnValue = false;
	}
	else
	{	
		if(event.which < 45 || event.which > 57) return false;
	}
 }
  
  function TextCounter(objControl, maxlimit)
  {
	objControl.value = StripHTML(objControl.value);

  	if (objControl.value.length > maxlimit)
    {
		objControl.value = objControl.value.substring(0, maxlimit);
	}
  }  
  
  
function StripHTML(html)
{
	return html.replace(/(<([^>]+)>)/ig,"");
}
  
/* Function to validate date mm/dd/yyyy */
  
function IsDate(str)
{
  var re = /^(\d{1,2})[\s\.\/-](\d{1,2})[\s\.\/-](\d{4})$/
  if (!re.test(str)) return false;
  var result = str.match(re);
  var m = parseInt(result[1]);
  var d = parseInt(result[2]);
  var y = parseInt(result[3]);
  if(m < 1 || m > 12 || y < 1900 || y > 2100) return false;
  if(m == 2){
          var days = ((y % 4) == 0) ? 29 : 28;
  }else if(m == 4 || m == 6 || m == 9 || m == 11){
          var days = 30;
  }else{
          var days = 31;
  }
  return (d >= 1 && d <= days);
}
  
  
//check date in in mm/dd/yyyy format ...
			function isValidDate(dateStr) {
			// Checks for the following valid date formats:
			// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
			// Also separates date into month, day, and year variables

			//var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

			// To require a 4 digit year entry, use this line instead:
			var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

			var matchArray = dateStr.match(datePat); // is the format ok?
			if (matchArray == null) {
				return false;
			}
			month = matchArray[1]; // parse date into variables
			day = matchArray[3];
			year = matchArray[4];
			if (month < 1 || month > 12) { // check month range

			return false;
			}
			if (day < 1 || day > 31) {

			return false;
			}
			if ((month==4 || month==6 || month==9 || month==11) && day==31) {

			return false
			}
			if (month == 2) { // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (day>29 || (day==29 && !isleap)) {

			return false;
			}
			}
			return true;  // date is valid
			}	  
  
/* USA phone format start */

function FormatUSPhoneNo(control, event)
{
	var isNS4 = (navigator.appName=="Netscape")?1:0;
	
	if(!isNS4)
	{
	
		if((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 8))
		{
			if ((control.value.length == 1) && ('' != control.value.charAt(0)))
				control.value = "" + control.value;
			if(control.value.length == 0)
				if(event.keyCode != 8)
					control.value = control.value + "";
			if(control.value.length == 3)
				if(event.keyCode != 8)
					control.value = control.value + "-";
			if(control.value.length == 8)
				if(event.keyCode != 8)
					control.value = control.value + "-";
			if(control.value.length == 7)
				if(event.keyCode != 8)
					control.value = control.value + "-";
					
			event.returnValue = true;
		}
		else
		{
			event.returnValue = false;
		}
	}
	else
	{
	
		if((event.which >= 48 && event.which <= 57) || (event.which == 8))
		{		
			if ((control.value.length == 1) && ('' != control.value.charAt(0)))
				control.value = "" + control.value;
			if(control.value.length == 0)
				if(event.which != 8)
					control.value = control.value + "";
			if(control.value.length == 3)
				if(event.which != 8)
					control.value = control.value + "-";
			if(control.value.length == 8)
				if(event.which != 8)
					control.value = control.value + "-";
			if(control.value.length == 7)
				if(event.which != 8)
					control.value = control.value + "-";
					
			event.returnValue = true;
					
			return  true;
		}
		else
		{
			return  false;
		}	
	}
}

function FormatSSNO(control,event)
{
	var isNS4 = (navigator.appName=="Netscape")?1:0;
	
	if(!isNS4)
	{
	
		if((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 8))
		{
			if ((control.value.length == 1) && ('' != control.value.charAt(0)))
				control.value = "" + control.value;
			if(control.value.length == 0)
				if(event.keyCode != 8)
					control.value = control.value + "";
			if(control.value.length == 3)
				if(event.keyCode != 8)
					control.value = control.value + "-";
			if(control.value.length == 6)
				if(event.keyCode != 8)
					control.value = control.value + "-";
			if(control.value.length == 6)
				if(event.keyCode != 8)
					control.value = control.value + "-";
					
			event.returnValue = true;
		}
		else
		{
			event.returnValue = false;
		}
	}
	else
	{
	
		if((event.which >= 48 && event.which <= 57) || (event.which == 8))
		{		
			if ((control.value.length == 1) && ('' != control.value.charAt(0)))
				control.value = "" + control.value;
			if(control.value.length == 0)
				if(event.which != 8)
					control.value = control.value + "";
			if(control.value.length == 3)
				if(event.which != 8)
					control.value = control.value + "-";
			if(control.value.length == 6)
				if(event.which != 8)
					control.value = control.value + "-";
			if(control.value.length == 6)
				if(event.which != 8)
					control.value = control.value + "-";
					
			event.returnValue = true;
					
			return  true;
		}
		else
		{
			return  false;
		}	
	}
}
/* USA Phone format ends */  
  
function TrimText(control)
{
	var s = control.value;
	
	s = s.replace(/^\s*|\s*$/g,"");
	
	control.value = s;
}
  
// Script for validating fields ends


/* This function is used to set the height of the main table to 100% as NS is giveing error*/
function SetWindowHeight()
{
	
	var objTable  = document.getElementById('tblMain');

	if(null != objTable && 'undefined' != objTable)
	{
		objTable.style.height = screen.height - 155;
	}

}

/* Set Focus to the first text box */
function SetFocus1(elementInst)
{
	var obj = document.forms[0].elements[elementInst];
	if(null != obj && 'undefined' != obj)
	{
		document.forms[0].elements[elementInst].focus();
	}	
}
function SetFocus(elementInst)
{
	var obj = document.forms[0].elements[elementInst];
	if(null != obj && 'undefined' != obj)
	{
		document.forms[0].elements[elementInst].focus();
	}	

}




/* END DIV */
/* Display waiting message */

function ShowWait(show)
{
	
	var div = parent.parent.document.getElementById('divWait');
	
	if(div != '' && div != null && div != 'undefined')
	{
	
		if(show == true)
		{
			
			div.style.display = '';
			
			div.style.width = screen.width - 20;
			div.style.height = screen.height - 160;
			div.style.left = 0;
			div.style.top = 0;			


		}
		else
		{
			div.style.display = 'none';
		}
	}
	
	
}


function ShowWaitWindow(show)
{

	var div = parent.parent.document.getElementById('divWait');
	
	if(div != '' && div != null && div != 'undefined')
	{
		if(show == true)
		{
			div.style.display = '';
			div.style.width = screen.width - 20;
			div.style.height = screen.height - 160;
			div.style.left = 0;
			div.style.top = 0;
		}
		else
		{
			div.style.display = 'none';
		}
	}
	
}

/* Display waiting message ends */


function SalesConfirmation( message )
{
	confirm(message);
}	

