/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function test(){
  window.open( 'info.php?name=','Information', 'width=400,height=200,left=0,top=100,screenX=0,screenY=100');
}

function back() {
  history.go(-1);
}

function show_info( sName ){
  
  wnd = window.open( 'info.php?name=' + sName, 'Information', 'width=400, height=225, left=100, top=250, screenX=0, screenY=100' );
  wnd.focus();

}

function download( sName ){

  wnd = window.open( 'download.php?file=' + sName );
  wnd.hide();
  wnd.focus();
  wnd.close();

}

function close_window() {

  self.close();

}

/* ------------------------------------------------------------------
   Funkce prevadi presmerovani na obrazek.
   ------------------------------------------------------------------ */
function prevnext_image ( shref ) {
  //wnd = window.open( sType );
  window.location = shref;
}

/* ------------------------------------------------------------------
   Vraci hodnotu daneho parametru. Jinak prazdny retezec.
   ------------------------------------------------------------------ */
function GetParam( sName ) {
  sName = sName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");

  var regexS = "[\\?&]" + sName + "=([^&#]*)";
  var regex = new RegExp( regexS );

  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

/* ------------------------------------------------------------------
   Funkce vraci pouze cast z aktivni stranky pouze do prvnich parametru.
   ------------------------------------------------------------------ */

function GetOnlyPageString() {

  var i = window.location.toString().indexOf( '?' );
  var sPage;

  //alert( GetParam( 'group' ) );
  //alert( window.location.href );

  if ( i != -1 )
    sPage = window.location.toString().substr( 0, i );
  else
    sPage = window.location;

  /* existuje parametr GROUP -> zachovej ho */
  var sGroup = GetParam( 'group' );
  if ( sGroup != "" ) sPage += "?group=" + sGroup;

  return( sPage );
}

/* ------------------------------------------------------------------
   Metoda generuje nove volani formulace s predanim hodnot z checkboxu.
   ------------------------------------------------------------------ */

function checkbox_color_click() {
 
  var sLastPage = GetOnlyPageString( window.location );

  /* existuje jiz nejaky parametr ? */

  if ( sLastPage.toString().indexOf( '?' ) == -1 )
    sLastPage += "?";
  else
    sLastPage += "&";

  /* vlastni parametry */

  if ( document.getElementById( 'color' ).checked == true )
    sLastPage += "color=true";
  else
    sLastPage += "color=false";
  
  if ( document.getElementById( 'blackWhite' ).checked == true )
    sLastPage += "&blackwhite=true";
  else
    sLastPage += "&blackwhite=false";

  window.location = sLastPage;
}

function nabidka(idex){
  if (idex.style.display == 'none')
    idex.style.display='';
  else
    idex.style.display='none'
}

