
function trim_facet(facet_string) {
	var temp = new Array();
	temp = facet_string.split(" ");
	if (temp.length == 1) {
		document.write(temp[0]);
	} else {
		if (temp.length == 2) {
			document.write(temp[0] + " " + temp[1]);
		} else {
			if (temp.length > 2) {
				document.write(temp[0] + " " + temp[1] + " " + temp[2] + "..");
			}
		}
	}
}
function trim_abs(abs) {
	var junk = abs.substring(0, 600);
	alert(">>" + junk + "<<");
	document.getElementById("abstractDis").innerHTML = junk;

//return abs.substring(0,600);
}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g, "");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/, "");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/, "");
}
function so_getText(obj) {
    // return the data of obj if its a text node
	if (obj.nodeType == 3) {
		return obj.nodeValue;
	}
	var txt = new Array(), i = 0;
    // loop over the children of obj and recursively pass them back to this function
	while (obj.childNodes[i]) {
		txt[txt.length] = so_getText(obj.childNodes[i]);
		i++;
	}
    // return the array as a string
	return txt.join("");
}
function init() {
}
var stripe = function () {
	var tables = document.getElementsByTagName("table");
	for (var x = 0; x != tables.length; x++) {
		var table = tables[x];
		if (!table) {
			return;
		}
		var tbodies = table.getElementsByTagName("tbody");
		for (var h = 0; h < tbodies.length; h++) {
			var even = true;
			var trs = tbodies[h].getElementsByTagName("tr");
			for (var i = 0; i < trs.length; i++) {
				trs[i].onmouseover = function () {
					this.className += " ruled";
					return false;
				};
				trs[i].onmouseout = function () {
					this.className = this.className.replace("ruled", "");
					return false;
				};
				if (even) {
					trs[i].className += " even";
				}
				even = !even;
			}
		}
	}
};
function openSCWindow(url, windowName) {
	if (!window.focus) {
		return;
	}
	if(windowName != "relevance.html"){		
		var myWin = window.open("", windowName, "height=500,width=750,toolbar=yes,menubar=no,location=yes,scrollbars=yes,resizable=yes");
		myWin.focus();
		}
	else{	
	
		var myWinRel = window.open("../relevance.html", windowName, "left=20,top=570,height=200,width=525,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
		myWinRel.focus();
		}
		url.target = windowName;
}

function displayDiv(data) {
	if (data == "View this page in FGDC") {
		document.getElementById("classicContent").style.display = "none";
		document.getElementById("fgdcContent").style.display = "block";
		document.getElementById("divdisplaybutton").value = "Classic view";
	}
	if (data == "Classic view") {
		document.getElementById("fgdcContent").style.display = "none";
		document.getElementById("classicContent").style.display = "block";
		document.getElementById("divdisplaybutton").value = "View this page in FGDC";
	}
}

function survey(form){
var popunder="http://mercury.ornl.gov/mercury/survey1B.jsp?instance=ocean(NEW)";

//specify popunder window features
//set 1 to enable a particular feature, 0 to disable
var winfeatures="width=800,height=510,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"

//Pop-under only once per browser session? (0=no, 1=yes)
//Specifying 0 will cause popunder to load every time page is loaded
var once_per_session=1;

///No editing beyond here required/////

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}

function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
}

if (once_per_session==0)
loadpopunder()
else
loadornot()
window.focus();
}


