function getURLProperty(property) {

  var args = location.search;

  var startIndex = args.indexOf(property + "=");
  var subProperties = args.substring(startIndex);
  endIndex = subProperties.indexOf("&");
  var nameValuePair;
  if (endIndex != -1) {
  	nameValuePair = subProperties.substring(0, endIndex);
  } else {
    nameValuePair = subProperties;
  }
  value = (nameValuePair.split("="))[1];
  //alert("Subproperties= " + subProperties + ", NameValuePair=" + nameValuePair);
  return value;

}

function popupWindow(url, width, height, left, top, scrollbars, resizable, 
	                 toolbar, location, menubar, status) {
  if (width == null) {width = 800};
  if (height == null) {height = 600};
  if (left == null) {left = 25};
  if (top == null) {top = 25};
  (scrollbars == null || scrollbars == false) ? scrollbars = 0 : scrollbars = 1;
  (resizable == null || resizable == false) ? resizable = 0 : resizable = 1;
  (toolbar == null || toolbar == false) ? toolbar = 0 : toolbar = 1;
  (location == null || location == false) ? location = 0 : location = 1;
  (menubar == null || menubar == false) ? menubar = 0 : menubar = 1;
  (status == null || status == false) ? status = 0 : status = 1;

  var configString = "scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=" + toolbar + 
  					 ",location=" + location + ",menubar=" + menubar + 
  					 ",status=" + status + ",width=" + width +
  		             ",height=" + height + ",left=" + left + ",top=" + top;

  new_window = window.open(url,'display_window',configString);
}

function getCurrentClipIndex() {
  var checkIndex = getURLProperty("clipIndex");
  if (checkIndex != null) {
    return checkIndex;
  }
  return 0;
}

// these next 4 functions rely on arrays being present somewhere
// on the page
function getClipTitle() {
  return titleArray[getCurrentClipIndex()];
}

function getClipDescription() {
  return descArray[getCurrentClipIndex()];
}

function getClipSubLeft() {
  return subLeftArray[getCurrentClipIndex()];
}

function getClipSubRight() {
  return subRightArray[getCurrentClipIndex()];
}