	function DisableImageClick(e) {
		var alertMsg = "\251 1st Responder Network \n For pictures or any other information Email webmaster@1strespondernews.com";

		if (document.all) {

			if (event.button==2||event.button==3) {

				if (event.srcElement.tagName=="IMG"){
					alert(alertMsg);
					return false;
				}

			}

		}
		else if (document.layers) {

			if (e.which == 3) {
				alert(alertMsg);
				return false;
			}

		}
		else if (document.getElementById){

			if (e.which==3&&e.target.tagName=="IMG"){
				alert(alertMsg);
				return false;
			}

		}

	}

	function GetImages(){

		for(i=0;i<document.images.length;i++)
			document.images[i].onmousedown=DisableImageClick;
	}

	function NoImageRClick(){

		if (document.all)
			document.onmousedown=DisableImageClick;
		else if (document.getElementById)
			document.onmouseup=DisableImageClick;
		else if (document.layers)
			GetImages();

	}

//	start of date validation functions

function ValidateDate(dateStr, message){

	if (!isDate(dateStr)){
		alert(message);
		return false;
	}

	return true;
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf("/");
	var pos2=dtStr.indexOf("/",pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);

	strYr=strYear;

	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);

	for (var i = 1; i <= 3; i++){
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}

	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);

	if (pos1==-1 || pos2==-1){
//		alert("The date format should be : mm/dd/yyyy.");
		return false;
	}

	if (strMonth.length<1 || month<1 || month>12){
//		alert("Please enter a valid month.");
		return false;
	}

	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
//		alert("Please enter a valid day.");
		return false;
	}

	return true;
}

function DaysArray(n) {

	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30};
		if (i==2) {this[i] = 29};
	} 

	return this;
}

function daysInFebruary (year){
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.

	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

//	functions for validating date range

	function ValidateDateRange(frm, message){
		var startDate, endDate;

		startDate = new Date();
		endDate = new Date();

		startDate.setYear(frm.drpStartYear.value);
		startDate.setDate(frm.drpStartDate.value);
		startDate.setMonth(frm.drpStartMonth.value - 1);

		endDate.setYear(frm.drpEndYear.value);
		endDate.setDate(frm.drpEndDate.value);
		endDate.setMonth(frm.drpEndMonth.value - 1);

		if (startDate > endDate){
			alert(message);
			return false;
		}

		return true;
	}

	function SelectEndDate(frm){
		frm.drpEndDate.selectedIndex = frm.drpStartDate.selectedIndex;
	}

	function SelectEndMonth(){
		frm.drpEndMonth.selectedIndex = frm.drpStartMonth.selectedIndex;
	}

	function selectEndYear(){
		frm.drpEndYear.selectedIndex = frm.drpStartYear.selectedIndex;
	}

//	end of date validation functions

//	when passed a file name it checks for compatible file types that are allowed

	function checkDocumentFileExtensions(fileObj){
		var ext = getFileExtension(fileObj.value);

		if (ext != ""){

			if (ext.toUpperCase() == 'PDF' || ext.toUpperCase() == 'DOC' || ext.toUpperCase() == 'XLS' || ext.toUpperCase() == 'PPT' || ext.toUpperCase() == 'RTF' || ext.toUpperCase() == 'TXT' || ext.toUpperCase() == 'GIF' || ext.toUpperCase() == 'JPG' || ext.toUpperCase() == 'ZIP'){}
			else{
				alert("Please select PDF, DOC, XLS, PPT, RTF, TXT, GIF or JPG files for upload.");
				fileObj.focus();
				return false;
			}

		}

		return true;
	}

	function CheckFileExtensions(fileObj){
		var ext = getFileExtension(fileObj.value);

		if (ext != ""){

			if (ext.toUpperCase() == 'GIF' || ext.toUpperCase() == 'JPG'){}
			else{
				alert("Please select only jpeg or gif image for upload.");
				fileObj.focus();
				return false;
			}

		}

		return true;
	}

function checkImageFileExtensions(fileObj){
	var ext = getFileExtension(fileObj.value);

	if (ext.toUpperCase() == 'GIF')
	{
		if (confirm("JPEG/JPG image is recommended for uploading.\nDo you want to continue uploading a gif image?"))
		{
			return true;
		}
		else
		{
			fileObj.focus();
			return false;
		}
	}

	if (ext.toUpperCase() != 'JPG' && ext != '')
	{
		alert("Please select only jpeg or gif image for upload.");
		fileObj.focus();
		return false;
	}

	return true;
}

function getFileExtension(filePath) { //v1.0
  fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
  return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}

function OpenNewWindow(imageurl){
var Imagepage = imageurl;var windowheight = 510;var windowwidth = 640;
var windowleft = (screen.width - parseInt(windowwidth)) / 2;
var windowtop = (screen.height - parseInt(windowheight)) / 2;
var windowname = "PopupWindow";
windowproperties = 'resizable=no,status=no,toolbar=no,height='+windowheight+',width='+windowwidth+',top='+windowtop+',left='+windowleft+',scrollbars=yes'
setwindow = window.open(Imagepage, windowname, windowproperties)
	if (CheckNavigatorVersion()==true){
			setwindow.window.focus();}
}  

function popup(url , windowname, width , height){

var top = 100;
var left = 100;
var windowleft = (screen.width - parseInt(width)) / 2;
var windowtop = (screen.height - parseInt(height)) / 2;
var windowname = "PopupWindow";
windowproperties = 'resizable=no,status=no,toolbar=no,height='+height+',width='+width+',top='+top+',left='+left+',scrollbars=yes'

setwindow = window.open(url, windowname, windowproperties)
	if (CheckNavigatorVersion()==true){
			setwindow.window.focus();}
}  

function CheckNavigatorVersion()
{
	if (parseInt(navigator.appVersion) >= 4)
		{
			return true;
		}
    	return false;

}

function EnterURL(fileObj, txtObj, message){

	if (fileObj.value != ""){
		if (!CheckFileExtensions(fileObj)) return false;

		if (txtObj.value == ""){
			alert(message);
			txtObj.focus();
			return false;
		}

	}

	return true;
}

function MustSelect(obj, message)
{
	if (obj.value == "-1"){
		alert(message);
		obj.focus();
		return false;
	}

	return true;
}

function MustUpload(obj, message)
{
	if (obj.value == ""){
		alert(message);
		obj.focus();
		return false;
	}

	return true;
}

function MustEnter(obj, field)
{
	//if (  isObject(obj)  )
	{
		if (obj.value == "") 
		{
			alert("Please enter " + field);
			obj.focus();
			obj.select();
			return false;
		}
	}
	return true;
}

function MustEnterInt(obj, field)
{
//	if (  isObject(obj)  )
	{
		if ( MustEnter(obj, field) )
		{
			if (isNaN(obj.value) )
			{
				alert("Please enter a valid integer for " + field);
				obj.focus();
				obj.select();
				return false;
			}
		}	
		return true;
	}
	
	return false;
}

function validateEmail(field, message){
	var str
	str = field.value;

	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(^\s)/;
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 

	if(str == "") return true;

	if (!reg1.test(str) && reg2.test(str)) { 
		return true;
	}

	alert(message);
	return false;
}