

function showHide(disp,id,id2){
  obj = document.getElementById(id);
  if (obj)
  // trc1 = id + ' display: ' + obj.style.display + '\n';
  obj.style.display = (obj.style.display == 'none') ? disp :'none';
  // trc2 = id + ' display: ' + obj.style.display + '\n';

  if (id2) {
    obj2 = document.getElementById(id2);
    if (obj2)
    // trc1 = trc1 + id2 + ' display: ' + obj2.style.display + '\n';
    obj2.style.display = (obj2.style.display == 'none') ? disp :'none';
    // trc2 = trc2 + id2 + ' display: ' + obj2.style.display;
  }
  // alert(trc1 + trc2);
}

function multiHide(arr,elem,elem2){
  // str = id + '\n' + id2 + '\n' + arr;
  for (id in arr){
    obj = document.getElementById(elem + arr[id]);
    if (obj)
    obj.style.display = 'none';

    if (elem2) {
      obj2 = document.getElementById(elem2 + arr[id]);
      if (obj2)
      obj2.style.display = 'none';
    }
  }
}

function OpenWindow(file,width,height,top,left,scrollbars,resizable) {
  var params = '';
  params = (!width) ? params + 'width=940' : params + 'width=' + width;
  params = (!height) ? params + ',height=510' : params + ',height=' + height;
  if(top) params = params + ',top=' + top;
  if(left) params = params + ',left=' + left;
  if(!scrollbars) params = params + ',scrollbars=yes';
  if(!resizable) params = params + ',resizable=yes';
  popup = window.open(file,'popup',params);
  popup.focus();
}

function OpenDetails(file,width,height,top,left,scrollbars,resizable) {
  var params = '';
  params = (!width) ? params + 'width=940' : params + 'width=' + width;
  params = (!height) ? params + ',height=510' : params + ',height=' + height;
  if(top) params = params + ',top=' + top;
  if(left) params = params + ',left=' + left;
  if(!scrollbars) params = params + ',scrollbars=yes';
  if(!resizable) params = params + ',resizable=yes';
  detailPop = window.open(file,'detailPop',params);
  detailPop.focus();
}

function checkAll(switcher){
  var cb = document.getElementsByName("files[]");
  for (var i=0; i<cb.length; i++)
  if (cb[i].type.indexOf(cb) != 1) cb[i].checked = switcher;
}

function trySubmit(agbErr,gpsErr){
  if (document.forms['gps_files'].elements['agb'].checked == false) {
  alert(unescape(agbErr));
  }else{
    var cb = document.getElementsByName("files[]");
    var found = false;
    for (var i=0; i<cb.length; i++) {
      if (cb[i].type.indexOf(cb) != 1) {
        if (cb[i].checked == true) {
          found = true;
        }
      }
    }
    if (found == false) {
      alert(unescape(gpsErr));
    }else {
      document.gps_files.submit();
    }
  }
}

function bookmark(url,title){

  if (window.sidebar)
    {
    // firefox
    window.sidebar.addPanel(title,url,'');
    }
  else if(window.opera && window.print)
    {
    // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
    }
  else if(document.all)
    {
    // ie
    window.external.AddFavorite(url,title);
    }
}

