
var NN4 = document.layers? true : false; //Netscape Navigator 4.x.
var IE4 = document.all? true : false; // IE version 4 and above.

function popupProjectPreview(id,height,width,abspath) {

    var myPath = '';
    var winProps = '';
abspath='';
		var name = 'project_preview';
    myPath = abspath+'admin_preview_project.php?project=' + id;
    winProps = 'height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,menubar=no,toolbar=no';
		
	// alert(myPath);
    void window.open(myPath,name,winProps);
    return 0;
}

function popupProjectImage(id,image_type,height,width,admin,abspath) {

    var myPath = '';
    var winProps = '';
		var name = 'project_image_preview';
		if (admin == 1) {
				myPath = 'preview_project_image.php?project=' + id + '&image_type=' + image_type;
		}
		else {
				myPath = 'preview_project_image.php?project=' + id + '&image_type=' + image_type;
		}

		myPath = abspath+myPath;
		// alert(myPath);
		if ((height == 0) && (width == 0)) {
			winProps = 'scrollbars=yes,resizable=yes,menubar=no,toolbar=no';
		}
		else {
			winProps = 'height=' + height + ',width=' + width + ',scrollbars=yes,resizable=yes,menubar=no,toolbar=no';
		}
		
    void window.open(myPath,name,winProps);
    return 0;
}

function hideAllRegionLayers() {
	hideLayer("region_1");
	hideLayer("region_2");
	hideLayer("region_3");
	hideLayer("region_4");
	hideLayer("region_5");
	hideLayer("region_6");
	hideLayer("region_7");
}

function showRegion(id) {

	hideAllRegionLayers();
	showLayer(id);
}


var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}










