/* Search - toggle divs for spinner/form */

function showSpinner () {
  document.qform.fquery.value.replace(/^\s*|\s*$/g, ""); 
  if(document.qform.fquery.value != ''){
    document.qform.query.value = document.qform.fquery.value;
    document.qform.gquery.value = document.qform.fquery.value;
    document.qform.fquery.value = '';
    document.qform.fquery.blur();
    $('#searchform').hide();
    $('#spinner').show();
    return true;
  }
  else {
    return false;
  }
}
function hideSpinner () {
  document.getElementById('spinner').style.display = 'none';
  document.getElementById('searchform').style.display = 'block';
}

// Nytt fönster i ämnesguider

function openWin( windowURL, windowName, windowFeatures ) { 
  return window.open( windowURL, windowName, windowFeatures ) ; 
} 

// Skicka ett formulär endast en gång, förhindrar långa Enter-nedtryckningar i explorer
// Används inte längre, Explorer 6.0 verkar ha buggen fixad

var counter=0;

function submit_once()
{
	counter++;
	if (counter>1)
	{
    return false;
	}
}

// Support GU used function (Dreamweaver)

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Karta (GU)

function oppna(x,y,karta) {
  // urchinTracker('/javascript/oppnaKartaGU');
  var popup = window.open("http://www.mappetshow.se/gu/fm.asp?stadsId=1480&x="+x+"&y="+y+"&karta="+karta+"", "", "width=810,height=630,resizable=no,left=50,top=50,scrollbars=no"); 
}

// Togglar div:en som visar resten av genvägarna (UB)

function ToggleLibraryShortcuts()
{
  // urchinTracker('/javascript/toggleLibraryShortcuts');
  if (document.layers) {
      current = (document.layers['libraryShortcuts'].display == 'none') ? 'block' : 'none';
      document.layers['libraryShortcuts'].display = current;
  }
  else if (document.all) {
      current = (document.all['libraryShortcuts'].style.display == 'none') ? 'block' : 'none';
      document.all['libraryShortcuts'].style.display = current;
  }
  else if (document.getElementById) {
      vista = (document.getElementById('libraryShortcuts').style.display == 'none') ? 'block' : 'none';
      document.getElementById('libraryShortcuts').style.display = vista;
  }
}


//Samsökflikar och textbyte
function hideandunhide(hide, unhide) 
{
    document.getElementById(hide).style.display = 'none';
    document.getElementById(unhide).style.display = 'block';
}



//Ostindie-publikt
function djvu (id,doc,page) {
  var NewItem=window.open('/samlingar/handskrift/ostindie/bildvisning/djvu.xml?id='+id+"&doc="+doc+"&page="+page,'DjvuWin','top=10,left=10,width=665,height=575,navigation=no,status=yes,scrollbars=yes,resizable=yes');
 }
 function poplist (part) {
  if(part == "sublist"){
   var NewItem=window.open('/samlingar/handskrift/ostindie/amnen/sublist.html','SubWin','top=10,left=10,width=245,height=480,navigation=no,status=no,scrollbars=yes,resizable=yes');
  }
  if(part == "ptitle"){
   var NewItem=window.open('peoplelist.html?p=title','SubWin','top=10,left=10,width=245,height=480,navigation=no,status=no,scrollbars=yes,resizable=yes');
  }
  if(part == "pbirth"){
   var NewItem=window.open('peoplelist.html?p=birth','SubWin','top=10,left=10,width=245,height=480,navigation=no,status=no,scrollbars=yes,resizable=yes');
  }
  if(part == "plive"){
   var NewItem=window.open('peoplelist.html?p=live','SubWin','top=10,left=10,width=245,height=480,navigation=no,status=no,scrollbars=yes,resizable=yes');
  }
 }
 function cform (nr) {
  if(nr == 1){
   document.SearchForm.query.value="";
   document.SearchForm.title_norm.value="";
   document.SearchForm.birth_place.value="";
   document.SearchForm.live_place.value="";
  }
  if(nr == 2){
   document.SearchForm.comment.value="";
   document.SearchForm.words.value="";
  }
 }

