function DefNewPath(pfrom) {
	var pto=document.getElementById("AddPath").value;
	var theWin=window.open("Paths.php?pthf="+pfrom+"&ptht="+pto, "Paths");
	theWin.focus();
	alert (pfrom +"xxx " + pto)
}

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 DeleteThePlace(PL_id) {
  	var r=confirm("Are you sure you want to delete this place? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "TripPlaces.php?deleteit=" + PL_id
    }
}	
function DeleteThePath(PT_id) {
  	var r=confirm("Are you sure you want to delete this path? It cannot be recovered if you delete it.")
  	if (r==true) {
       window.location = "Paths.php?deleteit=" + PT_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 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,extra) {
	if (extra=="undefined") {extra="";}
	var win = window.open(href,  name, 'width='+ width + ',height=' + height + ',directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no' + extra);
	win.focus();
	return win.closed;
}
function makePositionedPopup(href, name, width, height, top, left) {

	var win = window.open(href,  name, 'width='+ width + ',height=' + height + ',top=' + top + ',left=' + left +',directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,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;
}


