
function initSlide(){
	
	var _duration = 500; //in ms
	$('.open-close .container').each(function(){
		var _hold = $(this);
		var _box = _hold.find('form.slide-box');
		var _btn = _hold.find('a.button2');
		var _btn2 = _hold.find('input.submit');
		var _btn3 = _hold.find('a.buttonUtzi');
		var _h = _box.height();
		if(_hold.hasClass('opened')){
			_box.show();		
		}		
		else{
			
			_box.hide();		
		}
			
		
		_btn.click(function(){
			if(_hold.hasClass('opened')){
			
				_hold.removeClass('opened');
				_box.stop().animate({height:0}, _duration, function(){
					$(this).css({display:'none', height:'auto'});
				});
			}
			else{
			
				_hold.addClass('opened');
				$(this).parents('div.section').hide();
				$(this).parents('div.info').find('span.arrow').show();
				if(_box.is(':hidden')){
					_box.show();
					_h = _box.height();
					_box.height(0);
				}
				_box.stop().animate({height: _h}, _duration, function(){ 
					$(this).height('auto');
				})
			}
		
		});
		
		_btn3.click(function(){			
				_hold.removeClass('opened');
				_box.stop().animate({height:0}, _duration, function(){
					$(this).css({display:'none', height:'auto'});					
					$('div.info').find('span.arrow').hide();
					$('div.section').show();
					
				});
			
		
		});
		
		/*
		
		_btn2.click(function(){
			if(_hold.hasClass('opened')){
				_hold.removeClass('opened');
				$('div.info').find('span.arrow').hide();
				$('div.section').show();
				_box.stop().animate({height:0}, _duration, function(){
					$(this).css({display:'none', height:'auto'});
					
					
				});
			}			
			return false;
		});
		
		*/
		
	});
}

function open_form(){	
	
	$('div.section').hide();
	$('div.info').find('span.arrow').show();	
	$('div.container').addClass('opened');
}

$(document).ready(function(){
	initSlide();
});


