function setPhotoPath(element,newSrc) {
    //$(element).fadeOut("fast");
    $(element).attr({ src: "http://price-list.sopserver.com/img/loading_aqua.gif", alt: "image" }); 
    $(element).attr({ src: newSrc, alt: "image" });
}
function redrawGallery(getPath) {
      $("#galleryTop").animate({opacity: 0.4}, 1000, function() {
          $.get(getPath, function(data) {
          //alert("Data Loaded: " + data); 
              $("#galleryTop").html(data);  
              $("#galleryTop").animate({opacity: 1}, 1000 );      
          });
      });
}

function showBigFoto(path,description) {
    var onScroll = getScrollPos();
    var odskok = 17;
    var sW = screen.width;
    var sH = screen.height;
    var swH = document.documentElement.clientHeight;

    //window.scrollBy(0,-10000);
   $("#imgPrew").css("margin-top",(onScroll-odskok));
   $("#imgPrew").fadeIn("fast");
   $("#imgPrew").html('<img src="' + path + '" id="aPimage" onClick="unloadPhoto();"><div class="krizek" onClick="unloadPhoto();">x</div><br><span class="fotoDesc" style="display:none;">' + description + '</span>');
   document.getElementById('aPimage').height = (winH()-odskok-40);    
}

function getScrollPos() {
var ScrollTop = document.body.scrollTop;
if (ScrollTop == 0)
{
    if (window.pageYOffset)
        ScrollTop = window.pageYOffset;
    else
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
}
    return ScrollTop;
    //window.alert("x:" + ScrollTop + "y:" + ScrollTop);
}
function unloadPhoto() {
   $("#imgPrew").fadeOut("fast");
   $("#imgPrew").html('Image not loaded....'); 
}
function winH() {
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientHeight;
   else
      return null;
}


function unloadPhoto() {
   $("#imgPrew").fadeOut("fast");
   $("#imgPrew").html('Image not loaded....'); 
}

function kontrola(formular) {
    if(formular.password.value == formular.pass_check.value) {
        window.alert('password ok');
        val = true;
    } else {
        window.alert('password mismatch');
        val = false;
    }
    
return val;
}

function syncData() {
    window.alert('Tato funkce je dočasně potlačena');
    //window.alert('Aktualizuji data, stiskněte OK pro pokračování');
    //$.get("xmlaktualizace.php", function(data) {
    //    window.alert("Data byla aktualizovaná, stiskněte OK pro pokračování");
    //    parent.location="page-catalog.html";   
    //});
}

function addToMC(id) {
  var acv = 0;
  acv = get_cookie("myMH_increment");
  acv = parseInt(acv);
  newAcv = (acv+1);
  set_cookie("myMH_" + acv,id);
  set_cookie("myMH_increment",newAcv);
  window.alert('Přídáno do mého výběru');
}

function removeFromMC(id) {
  set_cookie(id,0);
  window.alert('Odebráno z mých oblíbených');
  window.location.reload();
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return 0;
}






