// http://davidwalsh.name/dwclickable-entire-block-clickable-mootools-12
// dwClickable: Entire Block Clickable Using MooTools 1.2

var dwClickables = new Class({
	
	//implements
	Implements: [Options],

	//options
	options: {
		elements: $$('div'),
		selectClass: '',
		anchorToSpan: false
	},
	
	//initialization
	initialize: function(options) {
		//set options
		this.setOptions(options);
		//set clickable
		this.doClickables();
	},
	
	//a method that does whatever you want
	doClickables: function() {
		
		//for all of the elements
		this.options.elements.each(function(el) {
			
			//get the href
			var anchor = el.getElements('a' + (this.options.selectClass ? '.' + this.options.selectClass : ''))[0];
			
			//if we found one
			if($defined(anchor)) {
				
				//add a click event to the item so it goes there when clicked. 
				this.setClick(el,anchor.get('href'));
				
				//modify anchor to span if necesssary
				if(this.options.anchorToSpan) {
					var span = new Element('span',{
						text: anchor.get('text')
					}).replaces(anchor);
				}
			}
			
		},this);
	},
	
	//ads the click event
	setClick: function(element,href) {
		
		element.addEvent('click', function() {
			window.location = href;
		});
	}
	
});

window.addEvent('domready', function() {
	
	var clix = new dwClickables({
		elements: $$('.clickable'),
		anchorToSpan: false
	});
	
});


// remooz
window.addEvent('load', function() {
 
	/**
	 * Some options for the large photos.
	 *
	 * The first argument is the argument for $$ (can be an array of elements or a selector)
	 */
 
	ReMooz.assign('.photogallery a', {
		'origin': 'img',
		'shadow': 'onOpenEnd', // fx is faster because shadow appears after resize animation
		'resizeFactor': 0.8, // resize to maximum 80% of screen size
		'cutOut': false, // don't hide the original
		'opacityResize': 0.4, // opaque resize
		'dragging': false, // disable dragging
		'centered': true // resize to center of the screen, not relative to the source element
	});
 
	/**
	 * Note on "shadow": value can be true, onOpenEnd (appear after resize) and false, to disable shadow
	 * WebKit (Safari 3) uses (great looking) CSS shadows, so it ignores this option.
	 */
 
});

//slide v kontaktech
window.addEvent('domready', function(){
//list of target elements
var list = $$('#right-column div.slide');
//list elements to be clicked on
var headings = $$('#right-column a.toggler');
//array to store all of the collapsibles
var collapsibles = new Array();

headings.each( function(heading, i) {

        //for each element create a slide effect
        var collapsible = new Fx.Slide(list[i], {
                duration: 200,
                transition: Fx.Transitions.linear
        });

        //and store it in the array
        collapsibles[i] = collapsible;

        //add event listener
        heading.onclick = function(){
                collapsible.toggle();
                return false;
        }

        //collapse all of the list items
        collapsible.hide();

});

});
