
function DeleteTheRecord(id,recName) {
  	var r=confirm("Are you sure you want to delete this " + recName + "? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = document.URL + "&deleteit=" + id
    }
}	
function DeleteTheSection(ts_id) {
  	var r=confirm("Are you sure you want to delete this trail section? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editTrailSections.php?deleteit=" + ts_id
    }
}	
function DeleteTheNotice(tn_id) {
  	var r=confirm("Are you sure you want to delete this notice? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editnotices.php?deleteit=" + tn_id
    }
}	
function DeleteTheLocation(mpid) {
  	var r=confirm("Are you sure you want to delete this location? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editLocation.php?deleteit=" + mpid
    }
}	
function DeleteTheLeader(lid) {
  	var r=confirm("Are you sure you want to delete this person? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editLeader.php?deleteit=" + lid
    }
}	
function DeleteTheSnip(snid) {
  	var r=confirm("Are you sure you want to delete this text snip? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editSnip.php?deleteit=" + snid
    }
}	
function DeleteThePic(pic_path) {
  	var r=confirm("Are you sure you want to delete this picture? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "editPic.php?deleteit=" + pic_path
    }
}	

function makePopup(href, name, width, height) {

	var win = window.open(href,  name, 'width='+ width + ',height=' + height + ',menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=no');
	win.focus()
	return win.closed;
}
function openNewWindow (name, url, lang, left, top, width, height, options) {
	var wTop, wLeft;
	var win;
	
	if (options == null) options = "";
	if (left == null) left = 10;
	if (top == null) top = 10;
	if (width == null) width = 200;
	if (height == null) height = 200;
	if (lang == null) lang = 0;
	
	if (isFinite(window.screenTop)) {
		wTop = window.screenTop + top;
	}
	else {
		wTop = top;
	}
	if (isFinite(window.screenLeft)) {
		wLeft = window.screenLeft + left;
	}
	else {
		wLeft = left;
	}
	//alert(lang);
	if (lang > 0 || parseInt(lang.substring(0,1))>0 ) {
	
		if (/[.]asp/.test(url) > 0) { // make sure we are going to an asp page before adding a lang parameter.
			tmpArray = url.split("?");
			if (tmpArray.length > 1) {
				url = url + "&"
			}
			else {
				url = url + "?"
			}
			url = url + "langId=" + lang
		}
	}
	woptions = 'width=' + width + ',height=' + height + ',top=' + wTop + ',left=' + wLeft
	if (options != null && options.length > 0) {
		woptions = woptions + "," + options
	}
//	window.alert ("Old window at (" + window.screenLeft + "," + window.screenTop + "). Put new window at (" + wLeft + "," + wTop + ")");
//	alert("Open window: " + url);
	done="";
	try {
		win = window.open(url, name, woptions);
		win.focus();
	} catch(error) {
		done = error.description;
	};
	if (done != "") { // Try again.
		try {
			
			win = window.open(url, name, woptions);
			win.focus();
		} catch(error) {
			alert("Error (" + error.number + ") creating window. " + error.description + " After: " + done + " Please try again." );
			done = false;
		};
	}
	return win;
}
function ShowHideLayer(LayerName,HideOrShow) { 
  var lay,HideOrShow;
  HideOrShow=(HideOrShow=='Hide'?'hidden':(HideOrShow=='Show'?'visible':(HideOrShow=='hide'?'hidden':(HideOrShow=='show'?'visible':HideOrShow))));
  lay=document.getElementById(LayerName);
  lay.style.visibility=HideOrShow;
}

