/**
 * Function openWindow
 *
 * Makes a popup with defined width/height attributes.
 *
 * @author Adrian Sobotta
 *
 */
function openWindow(URL, size) {
  if(size == 'small'){
    var newWindow = window.open(URL,'','width=300,height=250,scrollbars=yes,resizable=yes');
  }else{
    var newWindow = window.open(URL,'','width=590,height=480,scrollbars=yes,resizable=yes');
  }
}

/**
 * Function printpage
 *
 * spawns the print dialog box on the client.
 *
 * @author Adrian Sobotta
 */
function PrintPage() {
  window.print();
}


/**
 * Function checkRatioForm
 *
 * Just validates that the user has selected atleast one item to graph. If not, then
 * it displays a little error message.
 *
 * @author Adrian Sobotta
 *
 */
function checkRatioForm(formIn) {
  var elArr = formIn.elements;

  var filledIn = false
  for(var i = 0; i < elArr.length; i++) {
    if(elArr[i].checked == true){
      filledIn = true;
    }
  }

  if (filledIn == false){
    alert('You must provide at least one item to graph. Please try again.');
    return false;
  }

  return true;

}

/**
 * Function DownloadScreeningResults
 *
 * Lets the user download the results of a query
 *
 */
function DownloadScreeningResults(){
  location.href+="&download=csv&filetype=csv";
}

