// Pops up a new window
// leave all values blank ('') unless otherwise required
// if you're too lazy to type out the address again, then pass in "this" when calling
function popupWindow(url, winname, w, h, child, position, scrollbars, resize, status, toolbar, dependent, alwaysRaised, menubar)
{
  // Specify width and height, make it 1/2 of screen if it is not already specified
  var width  = ((screen.width) / 2);
  var height = ((screen.width) / 2);
  if (w != width) {width = w;}
  if (h != height) {height = h;}

  // Use these values to center the window on-screen
  var winl   = (screen.width - w) / 2;
  var wint   = (screen.height - h) / 2;

  // If we want the window centered, use this. Could extend
  // in future to use some of kind of offest
  if (position == 'center') {
    position = 'top='+wint+',left='+winl+',';
  }

  // if nothing is specified, then change it to the defaults
  if (!scrollbars) {scrollbars = 'no';}
  if (!status) {status = 'no';}
  if (!toolbar) {toolbar = 'no';}
  if (!dependent) {dependent = 'no';}
  if (!alwaysRaised) {alwaysRaised = 'no';}
  if (!menubar) {menubar = 'no';}
  if (resize == 'yes') {resizesetting = ',resizable';}

  // check whether we passed in the "a" node for url
  if (url.href) {url = url.href;}

  // Define the window properties line
  winprops = 'height='+height+',width='+width+','+position+'scrollbars='+scrollbars
            +',toolbar='+toolbar+',status='+status+',dependent='+dependent
            +',alwaysRaised='+alwaysRaised+',menubar='+menubar+''+resize;

  // Decide whether we're opening a dependant or normal window
  if (child == 'yes') {
    // Dependant, closes when focus is moved away from its parent
    win = open(url, winname, winprops);
  } else {
    // Normal window, stays open until shut
    win = window.open(url, winname, winprops);
  }
}

function validateSearch(form) 
{
  if(document.getElementById('nameid')) {
    namefield = document.getElementById('nameid');
    if(namefield.value == 'Enter keyword or domain' || namefield.value.length < 2) {
      namefield.style.background = '#fcc'
      return false;
    } else {
      return true;
    } 
  }
}
