Array.prototype.in_array = function ( obj ) {
  var len = this.length;
  for ( var x = 0 ; x <= len ; x++ ) {
    if ( this[x] == obj ) return true;
  }
  return false;
}
function addValidation(oForm){
 // oForm.onsubmit=function(){ return checkform()}
}
function abortValidation(oForm) {
 //   oForm.onsubmit=function(){}
}
function checkform() {
 /* var aSelects=document.getElementsByTagName('select');
  for(var i=0,j=aSelects.length;i<j;i++) {
      if(aSelects[i].options[aSelects[i].selectedIndex].value=="-1") {
        alert("You cannot leave empty Package options.");
        return false;
      }

  }*/
}
function selectTrack(iTrackID,sNamePattern) {
  var aSelected=new Array();
  var aSelects=document.getElementsByTagName('select');
  for(var i=0,j=aSelects.length;i<j;i++) {
    if(aSelects[i].name.indexOf(sNamePattern)==0) {
      if(aSelects[i].options[aSelects[i].selectedIndex].value!="-1")
        aSelected.push(aSelects[i].options[aSelects[i].selectedIndex].value);
    }
  }
  for(var i=0,j=aSelects.length;i<j;i++) {
    if(aSelects[i].name.indexOf(sNamePattern)==0) {
      var aOptions=aSelects[i].getElementsByTagName('option');
      for(var x=0,y=aOptions.length;x<y;x++) {
        if(aSelected.in_array(aOptions[x].value))
          aOptions[x].disabled="disabled";
        else
           aOptions[x].removeAttribute("disabled");
      }
    }
  }
}
