function openPlugIn(sURL, sFeatures)
{
  window.open(sURL, "", sFeatures, "");
  return false;
}

function showAndHide ( id, link ){
    if ( document.getElementById(id).style.display!="none" ) {
      document.getElementById(id).style.display="none";
      if (link != null)
          link.className="closed";
    }
    else {
      document.getElementById(id).style.display="block";
      if (link!= null)
          link.className="opened";
    }
}
  
function selectAll(formid, link, text, text2){
    var formular = document.getElementById(formid);
    for( var i=0; i < formular.elements.length-1; i++){
      formular.elements[i].checked = true;
    }
    link.innerHTML = text;
     if (navigator.appName=="Microsoft Internet Explorer"){
        link.onclick = function(){unselectAll(formid,this, text2, text);}
    }
     else{
        link.setAttribute("onclick", "unselectAll(\""+formid+"\",this, \""+text2+"\", \""+text+"\")", 0);
    }
}
  
function unselectAll(formid, link, text, text2){
    var formular = document.getElementById(formid);
    for( var i=0; i < formular.elements.length-1; i++){
      formular.elements[i].checked = false;
    }
    link.innerHTML = text;
    if (navigator.appName=="Microsoft Internet Explorer"){
        link.onclick = function(){selectAll(formid,this, text2, text);}
    }
    else{
        link.setAttribute("onclick", "selectAll(\""+formid+"\", this, \""+text2+"\", \""+text+"\")", 0);    
    }
}

var form = "false";
 
// Search input
function clearField (thisfield, placeholder) {
    if (thisfield.value == placeholder) { thisfield.value = ''}
}


// DROPDOWN MENU
function openPageBySelect( formID ) {
    tmpForm = document.getElementById(formID);
    tmpSelect = tmpForm.elements[0];
    selectedValue = selectedValue = tmpSelect.options[ tmpSelect.options.selectedIndex ].value;
    if ( selectedValue != 'nothing' ) {
        tmpSelect.options.selectedIndex = 0;
        tmpSelect.disabled = 'yes';
        tmpForm.action = selectedValue;
        tmpForm.submit();
    }
    tmpSelect.options.selectedIndex = 0;
}

// URL
function gotoCategory() {
    var page = document.category.links.options[document.category.links.selectedIndex].value;
    parent.location.href = page;
}

// URL
function goToURL(selectID){
    var gotoVal=$('#'+selectID).attr('value');
    if (gotoVal!='' & gotoVal!=null){
        document.location.href=gotoVal;
    }
    return false;
}

function zipDownload(boxId){
    if ($('#'+boxId+' input:checked').length > 0) {
        $('#'+boxId+' input:checked').each(function(){
            downloadTrack(breadcrumb+$(this).attr('value'));
        });
        $('#'+boxId+'_error').css('display','none');
        eval('document.forms.'+boxId+'.submit()');
    } else{
        $('#'+boxId+'_error').css('display','block');
    }
}


 
function OpenPrintPopup () {  
  myPrintwindow = window.open(window.location.pathname, "Print", "width=900,height=700,left=10,top=10,scrollbars=yes,dependent=yes,toolbar=yes,resizable=yes,status=yes");
}


function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      if(a.getAttribute("title") == title) a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}


function CheckIfPrintPopup() {
  if (window.name == "Print") {
    setActiveStyleSheet('print');    
  }
}

