window.addEvent('domready', function()
{
  if((Browser.Engine.trident && Browser.Engine.version != 4) || !Browser.Engine.trident)
  {
    if($('flow'))
    {
    	var flow = new Slideshow('flow', ['flow_1.jpg','flow_2.jpg','flow_3.jpg','flow_4.jpg','flow_5.jpg','flow_6.jpg','flow_7.jpg','flow_8.jpg','flow_9.jpg','flow_10.jpg','flow_11.jpg','flow_12.jpg','flow_13.jpg','flow_14.jpg','flow_15.jpg','flow_16.jpg','flow_17.jpg','flow_18.jpg','flow_19.jpg','flow_20.jpg','flow_21.jpg'],
        {
          'controller': false,
          'height': 214,
          'hu': '/images/animationsvacances/flow/',
          'thumbnails': false,
          'width': 776,
          'delay': 1500
        }
      );
    }
  }

/*
    if($('frm_add_exhibition')){
        $('div_add_exhibition').setStyle('display', 'none');
    }
    if($('show_frm_add_exhibition')){
            $('show_frm_add_exhibition').addEvent('click', function() {
                $('div_add_exhibition').setStyle('display', 'block');
            return false;
        });
    }
    patch_forms();
*/    
});
function patch_forms(){
    if($('frm_add_exhibition')){
    	$('frm_add_exhibition').removeEvents('submit');
        $('frm_add_exhibition').addEvent('submit', function(){
            var myHTMLRequest = new Request.HTML({url:$('frm_add_exhibition').action,update:$('div_add_exhibition'),evalScript:true}).post($('frm_add_exhibition'));
            return false;
        });
    }
    if($('frm_add_exhibition2')){
    	$('frm_add_exhibition2').removeEvents('submit');
        $('frm_add_exhibition2').addEvent('submit', function(){
            var myHTMLRequest = new Request.HTML({url:$('frm_add_exhibition2').action,update:$('div_add_exhibition'),evalScript:true}).post($('frm_add_exhibition2'));
            return false;
        });
    }
    if($('frm_add_exhibition3')){
    	$('frm_add_exhibition3').removeEvents('submit');
        $('frm_add_exhibition3').addEvent('submit', function(){
            var myHTMLRequest = new Request.HTML({url:$('frm_add_exhibition3').action,update:$('div_add_exhibition'),evalScript:true}).post($('frm_add_exhibition3'));
            return false;
        });
    }    
    $$('#caddy td.action a').each(function(element){
    	element.removeEvents('click');
        element.addEvent('click', function() {
            var myHTMLRequest = new Request.HTML({url:element.href,update:$('caddy'),evalScript:true}).get(); 
            return false;   
        });
    });
    $$('#caddy form select').each(function(element){        
		element.removeEvents('change');
        element.addEvent('change', function() {
            isEmpty = true;
            isFull = true;
            form = element.getParent('form');
            form.getElements('td.date select').each(function(formSelect){
                if(formSelect.value != '')
                {
                    isEmpty = false;   
                } 
                if(formSelect.value == '')
                {
                    isFull = false;   
                }  
            });
            if(isEmpty || isFull)
            {
                var myHTMLRequest = new
                Request.HTML({url:element.getParent('form').action,update:$('caddy'),evalScript:true}).post(element.getParent('form'));

                element.getParent('form').addEvent('submit', function(){
                    return false;     
                });     
            }          
        });
    });
}
function displayDescription(el)
{
	var child = el.getFirst('.img_promo_txt');
	child.setStyle('display', 'block');
}
function hideDescription(el)
{
	var child = el.getFirst('.img_promo_txt');
	child.setStyle('display', 'none');
}
