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

//@initialize ajax info loader (on everytime any ajax function is called)
$(document).ready(function() {
    $("#loading").bind("ajaxSend", function(){
           $(this).show();
     }).bind("ajaxComplete", function(){
           $(this).hide();
     });
     
     if($("#ch_p").is(":checked")) {
         $('#lab_p').css("font-weight","bold");
     }
})

//@load flash video presentation
function video() {
    if($('#video').is(':visible')){
        $('#video').fadeOut();
    } else {
        $('#video').fadeIn();
    }
}

//@load flash fotogallery
function foto() {
    if($('#foto').is(':visible')){
        $('#foto').fadeOut();
    } else {
        $('#foto').fadeIn();
    }
}

function advSearch() {
    /*if($('.pnlAdvancedSearch').is(':visible')){
        $('.pnlAdvancedSearch').fadeOut();
    } else {*/
        $('.pnlAdvancedSearch').fadeIn();
		$('.colAdvancedSearch').hide();
    //}
}

function checkDestination(){
    return true;
}

function stopAjax() {
    $('#loading').hide();
    //@tento abort to nejako dojebe
    xhr.abort();
}

function format_number(a,b) {
    
    c=',';
    d=' ';

 a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
 e = a + '';
 f = e.split('.');
 if (!f[0]) {
  f[0] = '0';
 }
 if (!f[1]) {
  f[1] = '';
 }
 if (f[1].length < b) {
  g = f[1];
  for (i=f[1].length + 1; i <= b; i++) {
   g += '0';
  }
  f[1] = g;
 }
 if(d != '' && f[0].length > 3) {
  h = f[0];
  f[0] = '';
  for(j = 3; j < h.length; j+=3) {
   i = h.slice(h.length - j, h.length - j + 3);
   f[0] = d + i +  f[0] + '';
  }
  j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
  f[0] = j + f[0];
 }
 c = (b <= 0) ? '' : c;
 return f[0] + c + f[1];
}
