function OpenWindow(page, win_width, win_height) {

	window.open("index.php?page=" + page,"_blank","width="+win_width+", height="+win_height+",left=170, top=50, status=no, toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes, resizable=yes");
	
}

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order

    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

$(document).ready(function() {

    $('.open-article').click(function(){
    var articleID = $(this).attr('id');
    articleID = articleID.substr(1);
    $('.show'+articleID).show('fast');
    $(this).hide('normal');
    });

});

$(document).ready(function() {

    $('.open-article-wh').click(function(){
    var articleID = $(this).attr('id');
    articleID = articleID.substr(1);
    $('.show'+articleID).show('fast');
    });

});

$(document).ready(function() {

    $('.open-article-contact').click(function(){
    var articleID = $(this).attr('id');
    articleID = articleID.substr(1);
    $('.show'+articleID).toggle('normal');
    });

});


$(function() {
	$("#datepicker_arrive").datepicker();
	$("#datepicker_departure").datepicker();
	
  $("#datepicker_arrive").datepicker( "option", "dateFormat", 'd.m. yy' );
  $("#datepicker_departure").datepicker( "option", "dateFormat", 'd.m. yy' );

	var datepickerLang = $("#datepicker_arrive").attr("class");

	if(datepickerLang == "sk hasDatepicker") {
	
  	$.datepicker.setDefaults({
     monthNames: ['Január','Február','Marec','Apríl','Máj','Jún','Júl','August','September','Október','November','December'],
     dayNamesMin: ['Po', 'Ut', 'St', 'Št', 'Pi', 'So', 'Ne'],
     dayNamesShort: ['Pon', 'Uto', 'Str', 'Štv', 'Pia', 'Sob', 'Ned']
     });

   }



	if(datepickerLang == "de hasDatepicker") {
  	$.datepicker.setDefaults({
     monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
     dayNamesMin: ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'],
     dayNamesShort: ['Mon', 'Die', 'Mit', 'Don', 'Fra', 'Sam', 'Son']
     });
   }

});


$(function() {

    // if the function argument is given to overlay,
    // it is assumed to be the onBeforeLoad event listener
    $("a[rel]").overlay({

        expose: '#E1DBC8',
        effect: 'apple',

        onBeforeLoad: function() {

            // grab wrapper element inside content
            var wrap = this.getContent().find(".contentWrap");

            // load the page specified in the trigger
            wrap.load(this.getTrigger().attr("href"));
        }

    });
});


  // THICKBOX
  $(function(){
  
    $('.verifyInquiry').click(function(){
    var redirectUrl = $(this.parentNode).attr('href');
    tb_show('<img src="images/content/overenie_poziadavky.png" class="TB_imgTitle" />','TB_inline?height=90&amp;width=250&amp;inlineId=TBcontent');

    $('input#TBcancel').click(function(){
      tb_remove();
    });

    $('input#TBsubmit').click(function(){
      location.replace(redirectUrl);
    });
    
    return false;
    });
    
  });
