/*	mediaboxAdvanced v1.3.4b - The ultimate extension of Slimbox and Mediabox; an all-media script	updated 2010.09.21		(c) 2007-2010 John Einselen <http://iaian7.com>	based on Slimbox v1.64 - The ultimate lightweight Lightbox clone		(c) 2007-2008 Christophe Beyls <http://www.digitalia.be>	MIT-style license.*/var Mediabox;(function() {	// Global variables, accessible to Mediabox only	var options, images, activeImage, prevImage, nextImage, top, mTop, left, mLeft, winWidth, winHeight, fx, preload, preloadPrev = new Image(), preloadNext = new Image(), foxfix = false, iefix = false,	// DOM elements	overlay, center, image, bottom, captionSplit, title, caption, prevLink, number, nextLink,	// Mediabox specific vars	URL, WH, WHL, elrel, mediaWidth, mediaHeight, mediaType = "none", mediaSplit, mediaId = "mediaBox", mediaFmt, margin;	/*	Initialization	*/	window.addEvent("domready", function() {		// Create and append the Mediabox HTML code at the bottom of the document		document.id(document.body).adopt(			$$([				overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),				center = new Element("div", {id: "mbCenter"})			]).setStyle("display", "none")		);		image = new Element("div", {id: "mbImage"}).injectInside(center);		bottom = new Element("div", {id: "mbBottom"}).injectInside(center).adopt(			closeLink = new Element("a", {id: "mbCloseLink", href: "#"}).addEvent("click", close),			nextLink = new Element("a", {id: "mbNextLink", href: "#"}).addEvent("click", next),			prevLink = new Element("a", {id: "mbPrevLink", href: "#"}).addEvent("click", previous),			title = new Element("div", {id: "mbTitle"}),			number = new Element("div", {id: "mbNumber"}),			caption = new Element("div", {id: "mbCaption"})		);		fx = {			overlay: new Fx.Tween(overlay, {property: "opacity", duration: 360}).set(0),			image: new Fx.Tween(image, {property: "opacity", duration: 360, onComplete: captionAnimate}),			bottom: new Fx.Tween(bottom, {property: "opacity", duration: 240}).set(0)		};	});	/*	API		*/	Mediabox = {		close: function(){			close();	// Thanks to Yosha on the google group for fixing the close function API!		},		open: function(_images, startImage, _options) {			options = $extend({				text: ['<big>&laquo;</big>','<big>&raquo;</big>','<big>&times;</big>'],		// Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)//				text: ['<big>«</big>','<big>»</big>','<big>×</big>'],		// Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)//	example		text: ['<b>P</b>rev','<b>N</b>ext','<b>C</b>lose'],				loop: false,					// Allows to navigate between first and last images				keyboard: true,					// Enables keyboard control; escape key, left arrow, and right arrow				alpha: true,					// Adds 'x', 'c', 'p', and 'n' when keyboard control is also set to true				stopKey: false,					// Stops all default keyboard actions while overlay is open (such as up/down arrows)													// Does not apply to iFrame content, does not affect mouse scrolling				overlayOpacity: 0.7,			// 1 is opaque, 0 is completely transparent (change the color in the CSS file)				resizeOpening: true,			// Determines if box opens small and grows (true) or starts at larger size (false)				resizeDuration: 240,			// Duration of each of the box resize animations (in milliseconds)				resizeTransition: false,		// Mootools transition effect (false leaves it at the default)				initialWidth: 320,				// Initial width of the box (in pixels)				initialHeight: 180,				// Initial height of the box (in pixels)				defaultWidth: 640,				// Default width of the box (in pixels) for undefined media (MP4, FLV, etc.)				defaultHeight: 360,				// Default height of the box (in pixels) for undefined media (MP4, FLV, etc.)				showCaption: true,				// Display the title and caption, true / false				showCounter: true,				// If true, a counter will only be shown if there is more than 1 image to display				counterText: '({x} of {y})',	// Translate or change as you wish//			Image options				imgBackground: false,		// Embed images as CSS background (true) or <img> tag (false)											// CSS background is naturally non-clickable, preventing downloads											// IMG tag allows automatic scaling for smaller screens											// (all images have no-click code applied, albeit not Opera compatible. To remove, comment lines 212 and 822)				imgPadding: 100,			// Clearance necessary for images larger than the window size (only used when imgBackground is false)											// Change this number only if the CSS style is significantly divergent from the original, and requires different sizes//			Inline options//				overflow: 'auto',			// If set, overides CSS settings for inline content only//			Global media options				html5: 'true',				// HTML5 settings for YouTube and Vimeo, false = off, true = on				scriptaccess: 'true',		// Allow script access to flash files				fullscreen: 'true',			// Use fullscreen				fullscreenNum: '1',			// 1 = true				autoplay: 'true',			// Plays the video as soon as it's opened				autoplayNum: '1',			// 1 = true				autoplayYes: 'yes',			// yes = true				volume: '100',				// 0-100, used for NonverBlaster and Quicktime players				medialoop: 'false',			// Loop video playback, true / false, used for NonverBlaster and Quicktime players				bgcolor: '#000000',			// Background color, used for flash and QT media				wmode: 'opaque',			// Background setting for Adobe Flash ('opaque' and 'transparent' are most common)//			NonverBlaster				useNB: true,				// use NonverBlaster (true) or JW Media Player (false) for .flv and .mp4 files				playerpath: '/static/NonverBlaster.swf',	// Path to NonverBlaster.swf				controlColor: '0xFFFFFF',	// set the controlbar color				controlBackColor: '0x000000',	// set the controlbar color				showTimecode: 'false',		// turn timecode display off or on//			JW Media Player settings and options				JWplayerpath: '/js/player.swf',	// Path to the mediaplayer.swf or flvplayer.swf file				backcolor:	'000000',		// Base color for the controller, color name / hex value (0x000000)				frontcolor: '999999',		// Text and button color for the controller, color name / hex value (0x000000)				lightcolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)				screencolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)				controlbar: 'over',			// bottom, over, none (this setting is ignored when playing audio files)//			Quicktime options				controller: 'true',			// Show controller, true / false//			Flickr options				flInfo: 'true',				// Show title and info at video start//			Revver options				revverID: '187866',			// Revver affiliate ID, required for ad revinue sharing				revverFullscreen: 'true',	// Fullscreen option				revverBack: '000000',		// Background color				revverFront: 'ffffff',		// Foreground color				revverGrad: '000000',		// Gradation color//			Ustream options				usViewers: 'true',				// Show online viewer count (true/false)//			Youtube options				ytBorder: '0',				// Outline				(1=true, 0=false)				ytColor1: '000000',			// Outline color				ytColor2: '333333',			// Base interface color (highlight colors stay consistent)				ytQuality: '&ap=%2526fmt%3D18', // Leave empty for standard quality, use '&ap=%2526fmt%3D18' for high quality, and '&ap=%2526fmt%3D22' for HD (note that not all videos are availible in high quality, and very few in HD)				ytRel: '0',					// Show related videos	(1=true, 0=false)				ytInfo: '1',				// Show video info		(1=true, 0=false)				ytSearch: '0',				// Show search field	(1=true, 0=false)//			Viddyou options				vuPlayer: 'basic',			// Use 'full' or 'basic' players//			Vimeo options				vmTitle: '1',				// Show video title				vmByline: '1',				// Show byline				vmPortrait: '1',			// Show author portrait				vmColor: 'ffffff'			// Custom controller colors, hex value minus the # sign, defult is 5ca0b5			}, _options || {});			prevLink.set('html', options.text[0]);			nextLink.set('html', options.text[1]);			closeLink.set('html', options.text[2]);			margin = center.getStyle('padding-left').toInt()+image.getStyle('margin-left').toInt()+image.getStyle('padding-left').toInt();			if ((Browser.Engine.gecko) && (Browser.Engine.version<19)) {	// Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash				foxfix = true;				options.overlayOpacity = 1;				overlay.className = 'mbOverlayFF';			}			if ((Browser.Engine.trident) && (Browser.Engine.version<5)) {	// Fixes IE 6 and earlier incompatibilities with CSS position: fixed;				iefix = true;				overlay.className = 'mbOverlayIE';				overlay.setStyle("position", "absolute");				position();			}			if (typeof _images == "string") {	// Used for single images only, with URL and Title as first two arguments				_images = [[_images,startImage,_options]];				startImage = 0;			}			images = _images;			options.loop = options.loop && (images.length > 1);			size();			setup(true);			top = window.getScrollTop() + (window.getHeight()/2);			left = window.getScrollLeft() + (window.getWidth()/2);			fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: imageAnimate}, options.resizeTransition ? {transition: options.resizeTransition} : {}));			center.setStyles({top: top, left: left, width: options.initialWidth, height: options.initialHeight, marginTop: -(options.initialHeight/2)-margin, marginLeft: -(options.initialWidth/2)-margin, display: ""});			fx.overlay.start(options.overlayOpacity);			return changeImage(startImage);		}	};	Element.implement({		mediabox: function(_options, linkMapper) {			$$(this).mediabox(_options, linkMapper);	// The processing of a single element is similar to the processing of a collection with a single element			return this;		}	});	Elements.implement({		/*			options:	Optional options object, see Mediabox.open()			linkMapper:	Optional function taking a link DOM element and an index as arguments and returning an array containing 3 elements:						the image URL and the image caption (may contain HTML)			linksFilter:Optional function taking a link DOM element and an index as arguments and returning true if the element is part of						the image collection that will be shown on click, false if not. "this" refers to the element that was clicked.						This function must always return true when the DOM element argument is "this".		*/		mediabox: function(_options, linkMapper, linksFilter) {			linkMapper = linkMapper || function(el) {				elrel = el.rel.split(/[\[\]]/);				elrel = elrel[1];				return [el.href, el.title, elrel];			};			linksFilter = linksFilter || function() {				return true;			};			var links = this;			links.addEvent('contextmenu', function(e){				if (this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)) e.stop();			});			links.removeEvents("click").addEvent("click", function() {				// Build the list of images that will be displayed				var filteredArray = links.filter(linksFilter, this);				var filteredLinks = [];				var filteredHrefs = [];				filteredArray.each(function(item, index){					if(filteredHrefs.indexOf(item.toString()) < 0) {						filteredLinks.include(filteredArray[index]);						filteredHrefs.include(filteredArray[index].toString());					};				});				return Mediabox.open(filteredLinks.map(linkMapper), filteredHrefs.indexOf(this.toString()), _options);			});			return links;		}	});	/*	Internal functions	*/	function position() {		overlay.setStyles({top: window.getScrollTop(), left: window.getScrollLeft()});	}	function size() {		winWidth = window.getWidth();		winHeight = window.getHeight();		overlay.setStyles({width: winWidth, height: winHeight});	}	function setup(open) {		// Hides on-page objects and embeds while the overlay is open, nessesary to counteract Firefox stupidity		//if (Browser.Engine.gecko) {			["object", window.ie ? "select" : "embed"].forEach(function(tag) {				Array.forEach(document.getElementsByTagName(tag), function(el) {					if (open) el._mediabox = el.style.visibility;					el.style.visibility = open ? "hidden" : el._mediabox;				});			});		//}		overlay.style.display = open ? "" : "none";		var fn = open ? "addEvent" : "removeEvent";		if (iefix) window[fn]("scroll", position);		window[fn]("resize", size);		if (options.keyboard) document[fn]("keydown", keyDown);	}	function keyDown(event) {		if (options.alpha) {			switch(event.code) {				case 27:	// Esc				case 88:	// 'x'				case 67:	// 'c'					close();					break;				case 37:	// Left arrow				case 80:	// 'p'					previous();					break;				case 39:	// Right arrow				case 78:	// 'n'					next();			}		} else {			switch(event.code) {				case 27:	// Esc					close();					break;				case 37:	// Left arrow					previous();					break;				case 39:	// Right arrow					next();			}		}		if (options.stopKey) { return false; };	}	function previous() {		return changeImage(prevImage);	}	function next() {		return changeImage(nextImage);	}	function changeImage(imageIndex) {		if (imageIndex >= 0) {			image.set('html', '');			activeImage = imageIndex;			prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1;			nextImage = activeImage + 1;			if (nextImage == images.length) nextImage = options.loop ? 0 : -1;			stop();			center.className = "mbLoading";	/*	mediaboxAdvanced link formatting and media support	*/			if (!images[imageIndex][2]) images[imageIndex][2] = '';	// Thanks to Leo Feyer for offering this fix			WH = images[imageIndex][2].split(' ');			WHL = WH.length;			if (WHL>1) {				mediaWidth = (WH[WHL-2].match("%")) ? (window.getWidth()*((WH[WHL-2].replace("%", ""))*0.01))+"px" : WH[WHL-2]+"px";				mediaHeight = (WH[WHL-1].match("%")) ? (window.getHeight()*((WH[WHL-1].replace("%", ""))*0.01))+"px" : WH[WHL-1]+"px";			} else {				mediaWidth = "";				mediaHeight = "";			}			URL = images[imageIndex][0];			URL = encodeURI(URL).replace("(","%28").replace(")","%29");			captionSplit = images[activeImage][1].split('::');// Quietube and yFrog support			if (URL.match(/quietube\.com/i)) {				mediaSplit = URL.split('v.php/');				URL = mediaSplit[1];			} else if (URL.match(/\/\/yfrog/i)) {				mediaType = (URL.substring(URL.length-1));				if (mediaType.match(/b|g|j|p|t/i)) mediaType = 'image';				if (mediaType == 's') mediaType = 'flash';				if (mediaType.match(/f|z/i)) mediaType = 'video';				URL = URL+":iphone";			}	/*	Specific Media Types	*/// GIF, JPG, PNG			if (URL.match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i) || mediaType == 'image') {				mediaType = 'img';				URL = URL.replace(/twitpic\.com/i, "twitpic.com/show/full");				preload = new Image();				preload.onload = startEffect;				preload.src = URL;// FLV, MP4			} else if (URL.match(/\.flv|\.mp4/i) || mediaType == 'video') {				mediaType = 'obj';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = mediaHeight || options.defaultHeight;				if (options.useNB) {				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {					id: 'MediaboxSWF',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				} else {				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar, {					id: 'MediaboxSWF',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				}				startEffect();// MP3, AAC			} else if (URL.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i) || mediaType == 'audio') {				mediaType = 'obj';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = mediaHeight || "20px";				if (URL.match(/tweetmic\.com|tmic\.fm/i)) {					URL = URL.split('/');					URL[4] = URL[4] || URL[3];					URL = "http://media4.fjarnet.net/tweet/tweetmicapp-"+URL[4]+'.mp3';				}				if (options.useNB) {				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {					id: 'MediaboxSWF',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				} else {				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay, {					id: 'MediaboxSWF',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				}				startEffect();// SWF			} else if (URL.match(/\.swf/i) || mediaType == 'flash') {				mediaType = 'obj';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = mediaHeight || options.defaultHeight;				preload = new Swiff(URL, {					id: 'MediaboxSWF',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// MOV, M4V, M4A, MP4, AIFF, etc.			} else if (URL.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i) || mediaType == 'qt') {				mediaType = 'qt';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = (parseInt(mediaHeight)+16)+"px" || options.defaultHeight;				preload = new Quickie(URL, {					id: 'MediaboxQT',					width: mediaWidth,					height: mediaHeight,					container: 'mbImage',					attributes: {controller: options.controller, autoplay: options.autoplay, volume: options.volume, loop: options.medialoop, bgcolor: options.bgcolor}					});				startEffect();	/*	Social Media Sites	*/// Blip.tv			} else if (URL.match(/blip\.tv/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "640px";				mediaHeight = mediaHeight || "390px";				preload = new Swiff(URL, {					src: URL,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Break.com			} else if (URL.match(/break\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "464px";				mediaHeight = mediaHeight || "376px";				mediaId = URL.match(/\d{6}/g);				preload = new Swiff('http://embed.break.com/'+mediaId, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// DailyMotion			} else if (URL.match(/dailymotion\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "480px";				mediaHeight = mediaHeight || "381px";				preload = new Swiff(URL, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Facebook			} else if (URL.match(/facebook\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "320px";				mediaHeight = mediaHeight || "240px";				mediaSplit = URL.split('v=');				mediaSplit = mediaSplit[1].split('&');				mediaId = mediaSplit[0];				preload = new Swiff('http://www.facebook.com/v/'+mediaId, {					movie: 'http://www.facebook.com/v/'+mediaId,					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Flickr			} else if (URL.match(/flickr\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "500px";				mediaHeight = mediaHeight || "375px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[5];				preload = new Swiff('http://www.flickr.com/apps/video/stewart.swf', {					id: mediaId,					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',					width: mediaWidth,					height: mediaHeight,					params: {flashvars: 'photo_id='+mediaId+'&amp;show_info_box='+options.flInfo, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// GameTrailers Video			} else if (URL.match(/gametrailers\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "480px";				mediaHeight = mediaHeight || "392px";				mediaId = URL.match(/\d{5}/g);				preload = new Swiff('http://www.gametrailers.com/remote_wrap.php?mid='+mediaId, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Google Video			} else if (URL.match(/google\.com\/videoplay/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "400px";				mediaHeight = mediaHeight || "326px";				mediaSplit = URL.split('=');				mediaId = mediaSplit[1];				preload = new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Megavideo - Thanks to Robert Jandreu for suggesting this code!			} else if (URL.match(/megavideo\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "640px";				mediaHeight = mediaHeight || "360px";				mediaSplit = URL.split('=');				mediaId = mediaSplit[1];				preload = new Swiff('http://wwwstatic.megavideo.com/mv_player.swf?v='+mediaId, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Metacafe			} else if (URL.match(/metacafe\.com\/watch/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "400px";				mediaHeight = mediaHeight || "345px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[4];				preload = new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf?playerVars=autoPlay='+options.autoplayYes, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Myspace			} else if (URL.match(/vids\.myspace\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "425px";				mediaHeight = mediaHeight || "360px";				preload = new Swiff(URL, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Revver			} else if (URL.match(/revver\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "480px";				mediaHeight = mediaHeight || "392px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[4];				preload = new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&autoStart='+options.autoplay+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver', {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Rutube			} else if (URL.match(/rutube\.ru/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "470px";				mediaHeight = mediaHeight || "353px";				mediaSplit = URL.split('=');				mediaId = mediaSplit[1];				preload = new Swiff('http://video.rutube.ru/'+mediaId, {					movie: 'http://video.rutube.ru/'+mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Seesmic			} else if (URL.match(/seesmic\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "435px";				mediaHeight = mediaHeight || "355px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[5];				preload = new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Tudou			} else if (URL.match(/tudou\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "400px";				mediaHeight = mediaHeight || "340px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[5];				preload = new Swiff('http://www.tudou.com/v/'+mediaId, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Twitvcam			} else if (URL.match(/twitcam\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "320px";				mediaHeight = mediaHeight || "265px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[3];				preload = new Swiff('http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash='+mediaId, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Twiturm			} else if (URL.match(/twiturm\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "402px";				mediaHeight = mediaHeight || "48px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[3];				preload = new Swiff('http://twiturm.com/flash/twiturm_mp3.swf?playerID=0&sf='+mediaId, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Twitvid			} else if (URL.match(/twitvid\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "600px";				mediaHeight = mediaHeight || "338px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[3];				preload = new Swiff('http://www.twitvid.com/player/'+mediaId, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Ustream.tv			} else if (URL.match(/ustream\.tv/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "400px";				mediaHeight = mediaHeight || "326px";				preload = new Swiff(URL+'&amp;viewcount='+options.usViewers+'&amp;autoplay='+options.autoplay, {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// YouKu			} else if (URL.match(/youku\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "480px";				mediaHeight = mediaHeight || "400px";				mediaSplit = URL.split('id_');				mediaId = mediaSplit[1];				preload = new Swiff('http://player.youku.com/player.php/sid/'+mediaId+'=/v.swf', {					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// YouTube Video (now includes HTML5 option)			} else if (URL.match(/youtube\.com\/watch/i)) {				mediaSplit = URL.split('v=');				if (options.html5) {					mediaType = 'url';					mediaWidth = mediaWidth || "640px";					mediaHeight = mediaHeight || "385px";					mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.					preload = new Element('iframe', {						'src': 'http://www.youtube.com/embed/'+mediaSplit[1],						'id': mediaId,						'width': mediaWidth,						'height': mediaHeight,						'frameborder': 0						});					startEffect();				} else {					mediaType = 'obj';					mediaId = mediaSplit[1];					if (mediaId.match(/fmt=22/i)) {						mediaFmt = '&ap=%2526fmt%3D22';						mediaWidth = mediaWidth || "640px";						mediaHeight = mediaHeight || "385px";					} else if (mediaId.match(/fmt=18/i)) {						mediaFmt = '&ap=%2526fmt%3D18';						mediaWidth = mediaWidth || "560px";						mediaHeight = mediaHeight || "345px";					} else {						mediaFmt = options.ytQuality;						mediaWidth = mediaWidth || "480px";						mediaHeight = mediaHeight || "295px";					}					preload = new Swiff('http://www.youtube.com/v/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {						id: mediaId,						width: mediaWidth,						height: mediaHeight,						params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}						});					startEffect();				}// YouTube Playlist			} else if (URL.match(/youtube\.com\/view/i)) {				mediaType = 'obj';				mediaSplit = URL.split('p=');				mediaId = mediaSplit[1];				mediaWidth = mediaWidth || "480px";				mediaHeight = mediaHeight || "385px";				preload = new Swiff('http://www.youtube.com/p/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Veoh			} else if (URL.match(/veoh\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "410px";				mediaHeight = mediaHeight || "341px";				URL = URL.replace('%3D','/');				mediaSplit = URL.split('watch/');				mediaId = mediaSplit[1];				preload = new Swiff('http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId='+mediaId+'&player=videodetailsembedded&videoAutoPlay='+options.AutoplayNum+'&id=anonymous', {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Viddler			} else if (URL.match(/viddler\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "437px";				mediaHeight = mediaHeight || "370px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[4];				preload = new Swiff(URL, {					id: 'viddler_'+mediaId,					movie: URL,					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen, id: 'viddler_'+mediaId, movie: URL}					});				startEffect();// Viddyou			} else if (URL.match(/viddyou\.com/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "416px";				mediaHeight = mediaHeight || "312px";				mediaSplit = URL.split('=');				mediaId = mediaSplit[1];				preload = new Swiff('http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', {					id: mediaId,					movie: 'http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf',					width: mediaWidth,					height: mediaHeight,					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();// Vimeo (now includes HTML5 option)			} else if (URL.match(/vimeo\.com/i)) {				mediaWidth = mediaWidth || "640px";		// site defualt: 400px				mediaHeight = mediaHeight || "360px";	// site defualt: 225px				mediaSplit = URL.split('/');				mediaId = mediaSplit[3];				if (options.html5) {					mediaType = 'url';					mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.					preload = new Element('iframe', {						'src': 'http://player.vimeo.com/video/'+mediaSplit[3]+'?portrait='+options.vmPortrait,						'id': mediaId,						'width': mediaWidth,						'height': mediaHeight,						'frameborder': 0						});					startEffect();				} else {					mediaType = 'obj';					preload = new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&amp;server=www.vimeo.com&amp;fullscreen='+options.fullscreenNum+'&amp;autoplay='+options.autoplayNum+'&amp;show_title='+options.vmTitle+'&amp;show_byline='+options.vmByline+'&amp;show_portrait='+options.vmPortrait+'&amp;color='+options.vmColor, {						id: mediaId,						width: mediaWidth,						height: mediaHeight,						params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}						});					startEffect();				}// 12seconds			} else if (URL.match(/12seconds\.tv/i)) {				mediaType = 'obj';				mediaWidth = mediaWidth || "430px";				mediaHeight = mediaHeight || "360px";				mediaSplit = URL.split('/');				mediaId = mediaSplit[5];				preload = new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf', {					id: mediaId,					width: mediaWidth,					height: mediaHeight,					params: {flashvars: 'vid='+mediaId+'', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}					});				startEffect();	/*	Specific Content Types	*/// INLINE			} else if (URL.match(/\#mb_/i)) {				mediaType = 'inline';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = mediaHeight || options.defaultHeight;				URLsplit = URL.split('#');				preload = document.id(URLsplit[1]).get('html');				startEffect();// HTML			} else {				mediaType = 'url';				mediaWidth = mediaWidth || options.defaultWidth;				mediaHeight = mediaHeight || options.defaultHeight;				mediaId = "mediaId_"+new Date().getTime();	// Safari may not update iframe content with a static id.				preload = new Element('iframe', {					'src': URL,					'id': mediaId,					'width': mediaWidth,					'height': mediaHeight,					'frameborder': 0					});				startEffect();			}		}		return false;	}	function startEffect() {		if (mediaType == "img"){			mediaWidth = preload.width;			mediaHeight = preload.height;			if (options.imgBackground) {				image.setStyles({backgroundImage: "url("+URL+")", display: ""});			} else {	// Thanks to Dusan Medlin for fixing large 16x9 image errors in a 4x3 browser				if (mediaHeight >= winHeight-options.imgPadding && (mediaHeight / winHeight) >= (mediaWidth / winWidth)) {					mediaHeight = winHeight-options.imgPadding;					mediaWidth = preload.width = parseInt((mediaHeight/preload.height)*mediaWidth);					preload.height = mediaHeight;				} else if (mediaWidth >= winWidth-options.imgPadding && (mediaHeight / winHeight) < (mediaWidth / winWidth)) {					mediaWidth = winWidth-options.imgPadding;					mediaHeight = preload.height = parseInt((mediaWidth/preload.width)*mediaHeight);					preload.width = mediaWidth;				}				if (Browser.Engine.trident) preload = document.id(preload);				preload.addEvent('mousedown', function(e){ e.stop(); }).addEvent('contextmenu', function(e){ e.stop(); });				image.setStyles({backgroundImage: "none", display: ""});				preload.inject(image);			}		} else if (mediaType == "obj") {			if (Browser.Plugins.Flash.version<8) {				image.setStyles({backgroundImage: "none", display: ""});				image.set('html', '<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');				mediaWidth = options.DefaultWidth;				mediaHeight = options.DefaultHeight;			} else {				image.setStyles({backgroundImage: "none", display: ""});				preload.inject(image);			}		} else if (mediaType == "qt") {			image.setStyles({backgroundImage: "none", display: ""});			preload;		} else if (mediaType == "inline") {//			if (options.overflow) image.setStyles({overflow: options.overflow});			image.setStyles({backgroundImage: "none", display: ""});			image.set('html', preload);		} else if (mediaType == "url") {			image.setStyles({backgroundImage: "none", display: ""});			preload.inject(image);		} else {			image.setStyles({backgroundImage: "none", display: ""});			image.set('html', '<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');			mediaWidth = options.defaultWidth;			mediaHeight = options.defaultHeight;		}		image.setStyles({width: mediaWidth, height: mediaHeight});		caption.setStyles({width: mediaWidth});		title.set('html', (options.showCaption) ? captionSplit[0] : "");		caption.set('html', (options.showCaption && (captionSplit.length > 1)) ? captionSplit[1] : "");		number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : "");		if ((prevImage >= 0) && (images[prevImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadPrev.src = images[prevImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");		if ((nextImage >= 0) && (images[nextImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadNext.src = images[nextImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");		mediaWidth = image.offsetWidth;		mediaHeight = image.offsetHeight+bottom.offsetHeight;		if (mediaHeight >= top+top) { mTop = -top } else { mTop = -(mediaHeight/2) };		if (mediaWidth >= left+left) { mLeft = -left } else { mLeft = -(mediaWidth/2) };		if (options.resizeOpening) { fx.resize.start({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin});		} else { center.setStyles({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin}); imageAnimate(); }	}	function imageAnimate() {		fx.image.start(1);	}	function captionAnimate() {		center.className = "";		if (prevImage >= 0) prevLink.style.display = "";		if (nextImage >= 0) nextLink.style.display = "";		fx.bottom.start(1);	}	function stop() {		if (preload) preload.onload = $empty;		fx.resize.cancel();		fx.image.cancel().set(0);		fx.bottom.cancel().set(0);		$$(prevLink, nextLink).setStyle("display", "none");	}	function close() {		if (activeImage >= 0) {			preload.onload = $empty;			image.set('html', '');			for (var f in fx) fx[f].cancel();			center.setStyle("display", "none");			fx.overlay.chain(setup).start(0);		}		return false;	}})();	/*	Autoload code block	*/Mediabox.scanPage = function() {//	$$('#mb_').each(function(hide) { hide.set('display', 'none'); });	var links = $$("a").filter(function(el) {		return el.rel && el.rel.test(/^lightbox/i);	});	$$(links).mediabox({/* Put custom options here */}, null, function(el) {		var rel0 = this.rel.replace(/[[]|]/gi," ");		var relsize = rel0.split(" ");		return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1]));	});};window.addEvent("domready", Mediabox.scanPage);/** * datepicker.js - MooTools Datepicker class * @version 1.16 *  * by MonkeyPhysics.com * * Source/Documentation available at: * http://www.monkeyphysics.com/mootools/script/2/datepicker *  * -- *  * Smoothly animating, very configurable and easy to install. * No Ajax, pure Javascript. 4 skins available out of the box. *  * -- * * Some Rights Reserved * http://creativecommons.org/licenses/by-sa/3.0/ *  */var DatePicker = new Class({		Implements: Options,		// working date, which we will keep modifying to render the calendars	d: '',		// just so that we need not request it over and over	today: '',		// current user-choice in date object format	choice: {}, 		// size of body, used to animate the sliding	bodysize: {}, 		// to check availability of next/previous buttons	limit: {}, 		// element references:	attachTo: null,    // selector for target inputs	picker: null,      // main datepicker container	slider: null,      // slider that contains both oldContents and newContents, used to animate between 2 different views	oldContents: null, // used in animating from-view to new-view	newContents: null, // used in animating from-view to new-view	input: null,       // original input element (used for input/output)	visual: null,      // visible input (used for rendering)		options: { 		pickerClass: 'datepicker',		days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],		months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],		dayShort: 2,		monthShort: 3,		startDay: 1, // Sunday (0) through Saturday (6) - be aware that this may affect your layout, since the days on the right might have a different margin		timePicker: false,		timePickerOnly: false,		yearPicker: true,		yearsPerPage: 20,		format: 'd-m-Y',		allowEmpty: false,		inputOutputFormat: 'U', // default to unix timestamp		animationDuration: 400,		useFadeInOut: !Browser.Engine.trident, // dont animate fade-in/fade-out for IE		startView: 'month', // allowed values: {time, month, year, decades}		positionOffset: { x: 0, y: 0 },		minDate: null, // { date: '[date-string]', format: '[date-string-interpretation-format]' }		maxDate: null, // same as minDate		debug: false,		toggleElements: null,				// and some event hooks:		onShow: $empty,   // triggered when the datepicker pops up		onClose: $empty,  // triggered after the datepicker is closed (destroyed)		onSelect: $empty  // triggered when a date is selected	},		initialize: function(attachTo, options) {		this.attachTo = attachTo;		this.setOptions(options).attach();		if (this.options.timePickerOnly) {			this.options.timePicker = true;			this.options.startView = 'time';		}		this.formatMinMaxDates();		document.addEvent('mousedown', this.close.bind(this));	},		formatMinMaxDates: function() {		if (this.options.minDate && this.options.minDate.format) {			this.options.minDate = this.unformat(this.options.minDate.date, this.options.minDate.format);		}		if (this.options.maxDate && this.options.maxDate.format) {			this.options.maxDate = this.unformat(this.options.maxDate.date, this.options.maxDate.format);			this.options.maxDate.setHours(23);			this.options.maxDate.setMinutes(59);			this.options.maxDate.setSeconds(59);		}	},		attach: function() {		// toggle the datepicker through a separate element?		if ($chk(this.options.toggleElements)) {			var togglers = $$(this.options.toggleElements);			document.addEvents({				'keydown': function(e) {					if (e.key == "tab") {						this.close(null, true);					}				}.bind(this)			});		};				// attach functionality to the inputs				$$(this.attachTo).each(function(item, index) {						// never double attach			if (item.retrieve('datepicker')) return;						// determine starting value(s)			if ($chk(item.get('value'))) {				var init_clone_val = this.format(new Date(this.unformat(item.get('value'), this.options.inputOutputFormat)), this.options.format);			} else if (!this.options.allowEmpty) {				var init_clone_val = this.format(new Date(), this.options.format);			} else {				var init_clone_val = '';			}						// create clone			var display = item.getStyle('display');			var clone = item			.setStyle('display', this.options.debug ? display : 'none')			.store('datepicker', true) // to prevent double attachment...			.clone()			.store('datepicker', true) // ...even for the clone (!)			.removeProperty('name')    // secure clean (form)submission			.setStyle('display', display)			.set('value', init_clone_val)			.inject(item, 'after');						// events			if ($chk(this.options.toggleElements)) {				togglers[index]					.setStyle('cursor', 'pointer')					.addEvents({						'click': function(e) {							this.onFocus(item, clone);						}.bind(this)					});				clone.addEvents({					'blur': function() {						item.set('value', clone.get('value'));					}				});			} else {				clone.addEvents({					'keydown': function(e) {						if (this.options.allowEmpty && (e.key == "delete" || e.key == "backspace")) {							item.set('value', '');							e.target.set('value', '');							this.close(null, true);						} else if (e.key == "tab") {							this.close(null, true);						} else {							e.stop();						}					}.bind(this),					'focus': function(e) {						this.onFocus(item, clone);					}.bind(this)				});			}		}.bind(this));	},		onFocus: function(original_input, visual_input) {		var init_visual_date, d = visual_input.getCoordinates();				if ($chk(original_input.get('value'))) {			init_visual_date = this.unformat(original_input.get('value'), this.options.inputOutputFormat).valueOf();		} else {			init_visual_date = new Date();			if ($chk(this.options.maxDate) && init_visual_date.valueOf() > this.options.maxDate.valueOf()) {				init_visual_date = new Date(this.options.maxDate.valueOf());			}			if ($chk(this.options.minDate) && init_visual_date.valueOf() < this.options.minDate.valueOf()) {				init_visual_date = new Date(this.options.minDate.valueOf());			}		}				this.show({ left: d.left + this.options.positionOffset.x, top: d.top + d.height + this.options.positionOffset.y }, init_visual_date);		this.input = original_input;		this.visual = visual_input;		this.options.onShow();	},		dateToObject: function(d) {		return {			year: d.getFullYear(),			month: d.getMonth(),			day: d.getDate(),			hours: d.getHours(),			minutes: d.getMinutes(),			seconds: d.getSeconds()		};	},		dateFromObject: function(values) {		var d = new Date();		d.setDate(1);		['year', 'month', 'day', 'hours', 'minutes', 'seconds'].each(function(type) {			var v = values[type];			if (!$chk(v)) return;			switch (type) {				case 'day': d.setDate(v); break;				case 'month': d.setMonth(v); break;				case 'year': d.setFullYear(v); break;				case 'hours': d.setHours(v); break;				case 'minutes': d.setMinutes(v); break;				case 'seconds': d.setSeconds(v); break;			}		});		return d;	},		show: function(position, timestamp) {		this.formatMinMaxDates();		if ($chk(timestamp)) {			this.d = new Date(timestamp);		} else {			this.d = new Date();		}		this.today = new Date();		this.choice = this.dateToObject(this.d);		this.mode = (this.options.startView == 'time' && !this.options.timePicker) ? 'month' : this.options.startView;		this.render();		this.picker.setStyles(position);	},		render: function(fx) {		if (!$chk(this.picker)) {			this.constructPicker();		} else {			// swap contents so we can fill the newContents again and animate			var o = this.oldContents;			this.oldContents = this.newContents;			this.newContents = o;			this.newContents.empty();		}				// remember current working date		var startDate = new Date(this.d.getTime());				// intially assume both left and right are allowed		this.limit = { right: false, left: false };				// render! booty!		if (this.mode == 'decades') {			this.renderDecades();		} else if (this.mode == 'year') {			this.renderYear();		} else if (this.mode == 'time') {			this.renderTime();			this.limit = { right: true, left: true }; // no left/right in timeview		} else {			this.renderMonth();		}				this.picker.getElement('.previous').setStyle('visibility', this.limit.left ? 'hidden' : 'visible');		this.picker.getElement('.next').setStyle('visibility', this.limit.right ? 'hidden' : 'visible');		this.picker.getElement('.titleText').setStyle('cursor', this.allowZoomOut() ? 'pointer' : 'default');				// restore working date		this.d = startDate;				// if ever the opacity is set to '0' it was only to have us fade it in here		// refer to the constructPicker() function, which instantiates the picker at opacity 0 when fading is desired		if (this.picker.getStyle('opacity') == 0) {			this.picker.tween('opacity', 0, 1);		}				// animate		if ($chk(fx)) this.fx(fx);	},		fx: function(fx) {		if (fx == 'right') {			this.oldContents.setStyles({ left: 0, opacity: 1 });			this.newContents.setStyles({ left: this.bodysize.x, opacity: 1 });			this.slider.setStyle('left', 0).tween('left', 0, -this.bodysize.x);		} else if (fx == 'left') {			this.oldContents.setStyles({ left: this.bodysize.x, opacity: 1 });			this.newContents.setStyles({ left: 0, opacity: 1 });			this.slider.setStyle('left', -this.bodysize.x).tween('left', -this.bodysize.x, 0);		} else if (fx == 'fade') {			this.slider.setStyle('left', 0);			this.oldContents.setStyle('left', 0).set('tween', { duration: this.options.animationDuration / 2 }).tween('opacity', 1, 0);			this.newContents.setStyles({ opacity: 0, left: 0}).set('tween', { duration: this.options.animationDuration }).tween('opacity', 0, 1);		}	},		constructPicker: function() {		this.picker = new Element('div', { 'class': this.options.pickerClass }).inject(document.body);		if (this.options.useFadeInOut) {			this.picker.setStyle('opacity', 0).set('tween', { duration: this.options.animationDuration });		}				var h = new Element('div', { 'class': 'header' }).inject(this.picker);		var titlecontainer = new Element('div', { 'class': 'title' }).inject(h);		new Element('div', { 'class': 'previous' }).addEvent('click', this.previous.bind(this)).set('text', '«').inject(h);		new Element('div', { 'class': 'next' }).addEvent('click', this.next.bind(this)).set('text', '»').inject(h);		new Element('div', { 'class': 'closeButton' }).addEvent('click', this.close.bindWithEvent(this, true)).set('text', 'x').inject(h);		new Element('span', { 'class': 'titleText' }).addEvent('click', this.zoomOut.bind(this)).inject(titlecontainer);				var b = new Element('div', { 'class': 'body' }).inject(this.picker);		this.bodysize = b.getSize();		this.slider = new Element('div', { styles: { position: 'absolute', top: 0, left: 0, width: 2 * this.bodysize.x, height: this.bodysize.y }})					.set('tween', { duration: this.options.animationDuration, transition: Fx.Transitions.Quad.easeInOut }).inject(b);		this.oldContents = new Element('div', { styles: { position: 'absolute', top: 0, left: this.bodysize.x, width: this.bodysize.x, height: this.bodysize.y }}).inject(this.slider);		this.newContents = new Element('div', { styles: { position: 'absolute', top: 0, left: 0, width: this.bodysize.x, height: this.bodysize.y }}).inject(this.slider);	},		renderTime: function() {		var container = new Element('div', { 'class': 'time' }).inject(this.newContents);				if (this.options.timePickerOnly) {			this.picker.getElement('.titleText').set('text', 'Select a time');		} else {			this.picker.getElement('.titleText').set('text', this.format(this.d, 'j M, Y'));		}				new Element('input', { type: 'text', 'class': 'hour' })			.set('value', this.leadZero(this.d.getHours()))			.addEvents({				mousewheel: function(e) {					var i = e.target, v = i.get('value').toInt();					i.focus();					if (e.wheel > 0) {						v = (v < 23) ? v + 1 : 0;					} else {						v = (v > 0) ? v - 1 : 23;					}					i.set('value', this.leadZero(v));					e.stop();				}.bind(this)			})			.set('maxlength', 2)			.inject(container);					new Element('input', { type: 'text', 'class': 'minutes' })			.set('value', this.leadZero(this.d.getMinutes()))			.addEvents({				mousewheel: function(e) {					var i = e.target, v = i.get('value').toInt();					i.focus();					if (e.wheel > 0) {						v = (v < 59) ? v + 1 : 0;					} else {						v = (v > 0) ? v - 1 : 59;					}					i.set('value', this.leadZero(v));					e.stop();				}.bind(this)			})			.set('maxlength', 2)			.inject(container);				new Element('div', { 'class': 'separator' }).set('text', ':').inject(container);				new Element('input', { type: 'submit', value: 'OK', 'class': 'ok' })			.addEvents({				click: function(e) {					e.stop();					this.select($merge(this.dateToObject(this.d), { hours: this.picker.getElement('.hour').get('value').toInt(), minutes: this.picker.getElement('.minutes').get('value').toInt() }));				}.bind(this)			})			.set('maxlength', 2)			.inject(container);	},		renderMonth: function() {		var month = this.d.getMonth();				this.picker.getElement('.titleText').set('text', this.options.months[month] + ' ' + this.d.getFullYear());				this.d.setDate(1);		while (this.d.getDay() != this.options.startDay) {			this.d.setDate(this.d.getDate() - 1);		}				var container = new Element('div', { 'class': 'days' }).inject(this.newContents);		var titles = new Element('div', { 'class': 'titles' }).inject(container);		var d, i, classes, e, weekcontainer;		for (d = this.options.startDay; d < (this.options.startDay + 7); d++) {			new Element('div', { 'class': 'title day day' + (d % 7) }).set('text', this.options.days[(d % 7)].substring(0,this.options.dayShort)).inject(titles);		}				var available = false;		var t = this.today.toDateString();		var currentChoice = this.dateFromObject(this.choice).toDateString();				for (i = 0; i < 42; i++) {			classes = [];			classes.push('day');			classes.push('day'+this.d.getDay());			if (this.d.toDateString() == t) classes.push('today');			if (this.d.toDateString() == currentChoice) classes.push('selected');			if (this.d.getMonth() != month) classes.push('otherMonth');						if (i % 7 == 0) {				weekcontainer = new Element('div', { 'class': 'week week'+(Math.floor(i/7)) }).inject(container);			}						e = new Element('div', { 'class': classes.join(' ') }).set('text', this.d.getDate()).inject(weekcontainer);			if (this.limited('date')) {				e.addClass('unavailable');				if (available) {					this.limit.right = true;				} else if (this.d.getMonth() == month) {					this.limit.left = true;				}			} else {				available = true;				e.addEvent('click', function(e, d) {					if (this.options.timePicker) {						this.d.setDate(d.day);						this.d.setMonth(d.month);						this.mode = 'time';						this.render('fade');					} else {						this.select(d);					}				}.bindWithEvent(this, { day: this.d.getDate(), month: this.d.getMonth(), year: this.d.getFullYear() }));			}			this.d.setDate(this.d.getDate() + 1);		}		if (!available) this.limit.right = true;	},		renderYear: function() {		var month = this.today.getMonth();		var thisyear = this.d.getFullYear() == this.today.getFullYear();		var selectedyear = this.d.getFullYear() == this.choice.year;				this.picker.getElement('.titleText').set('text', this.d.getFullYear());		this.d.setMonth(0);				var i, e;		var available = false;		var container = new Element('div', { 'class': 'months' }).inject(this.newContents);				for (i = 0; i <= 11; i++) {			e = new Element('div', { 'class': 'month month'+(i+1)+(i == month && thisyear ? ' today' : '')+(i == this.choice.month && selectedyear ? ' selected' : '') })			.set('text', this.options.monthShort ? this.options.months[i].substring(0, this.options.monthShort) : this.options.months[i]).inject(container);						if (this.limited('month')) {				e.addClass('unavailable');				if (available) {					this.limit.right = true;				} else {					this.limit.left = true;				}			} else {				available = true;				e.addEvent('click', function(e, d) {					this.d.setDate(1);					this.d.setMonth(d);					this.mode = 'month';					this.render('fade');				}.bindWithEvent(this, i));			}			this.d.setMonth(i);		}		if (!available) this.limit.right = true;	},		renderDecades: function() {		// start neatly at interval (eg. 1980 instead of 1987)		while (this.d.getFullYear() % this.options.yearsPerPage > 0) {			this.d.setFullYear(this.d.getFullYear() - 1);		}		this.picker.getElement('.titleText').set('text', this.d.getFullYear() + '-' + (this.d.getFullYear() + this.options.yearsPerPage - 1));				var i, y, e;		var available = false;		var container = new Element('div', { 'class': 'years' }).inject(this.newContents);				if ($chk(this.options.minDate) && this.d.getFullYear() <= this.options.minDate.getFullYear()) {			this.limit.left = true;		}				for (i = 0; i < this.options.yearsPerPage; i++) {			y = this.d.getFullYear();			e = new Element('div', { 'class': 'year year' + i + (y == this.today.getFullYear() ? ' today' : '') + (y == this.choice.year ? ' selected' : '') }).set('text', y).inject(container);						if (this.limited('year')) {				e.addClass('unavailable');				if (available) {					this.limit.right = true;				} else {					this.limit.left = true;				}			} else {				available = true;				e.addEvent('click', function(e, d) {					this.d.setFullYear(d);					this.mode = 'year';					this.render('fade');				}.bindWithEvent(this, y));			}			this.d.setFullYear(this.d.getFullYear() + 1);		}		if (!available) {			this.limit.right = true;		}		if ($chk(this.options.maxDate) && this.d.getFullYear() >= this.options.maxDate.getFullYear()) {			this.limit.right = true;		}	},		limited: function(type) {		var cs = $chk(this.options.minDate);		var ce = $chk(this.options.maxDate);		if (!cs && !ce) return false;				switch (type) {			case 'year':				return (cs && this.d.getFullYear() < this.options.minDate.getFullYear()) || (ce && this.d.getFullYear() > this.options.maxDate.getFullYear());							case 'month':				// todo: there has got to be an easier way...?				var ms = ('' + this.d.getFullYear() + this.leadZero(this.d.getMonth())).toInt();				return cs && ms < ('' + this.options.minDate.getFullYear() + this.leadZero(this.options.minDate.getMonth())).toInt()					|| ce && ms > ('' + this.options.maxDate.getFullYear() + this.leadZero(this.options.maxDate.getMonth())).toInt()							case 'date':				return (cs && this.d < this.options.minDate) || (ce && this.d > this.options.maxDate);		}	},		allowZoomOut: function() {		if (this.mode == 'time' && this.options.timePickerOnly) return false;		if (this.mode == 'decades') return false;		if (this.mode == 'year' && !this.options.yearPicker) return false;		return true;	},		zoomOut: function() {		if (!this.allowZoomOut()) return;		if (this.mode == 'year') {			this.mode = 'decades';		} else if (this.mode == 'time') {			this.mode = 'month';		} else {			this.mode = 'year';		}		this.render('fade');	},		previous: function() {		if (this.mode == 'decades') {			this.d.setFullYear(this.d.getFullYear() - this.options.yearsPerPage);		} else if (this.mode == 'year') {			this.d.setFullYear(this.d.getFullYear() - 1);		} else if (this.mode == 'month') {			this.d.setMonth(this.d.getMonth() - 1);		}		this.render('left');	},		next: function() {		if (this.mode == 'decades') {			this.d.setFullYear(this.d.getFullYear() + this.options.yearsPerPage);		} else if (this.mode == 'year') {			this.d.setFullYear(this.d.getFullYear() + 1);		} else if (this.mode == 'month') {			this.d.setMonth(this.d.getMonth() + 1);		}		this.render('right');	},		close: function(e, force) {		if (!$(this.picker)) return;		var clickOutside = ($chk(e) && e.target != this.picker && !this.picker.hasChild(e.target) && e.target != this.visual);		if (force || clickOutside) {			if (this.options.useFadeInOut) {				this.picker.set('tween', { duration: this.options.animationDuration / 2, onComplete: this.destroy.bind(this) }).tween('opacity', 1, 0);			} else {				this.destroy();			}		}	},		destroy: function() {		this.picker.destroy();		this.picker = null;		this.options.onClose();	},		select: function(values) {		this.choice = $merge(this.choice, values);		var d = this.dateFromObject(this.choice);		this.input.set('value', this.format(d, this.options.inputOutputFormat));		this.visual.set('value', this.format(d, this.options.format));		this.options.onSelect(d);		this.close(null, true);	},		leadZero: function(v) {		return v < 10 ? '0'+v : v;	},		format: function(t, format) {		var f = '';		var h = t.getHours();		var m = t.getMonth();				for (var i = 0; i < format.length; i++) {			switch(format.charAt(i)) {				case '\\': i++; f+= format.charAt(i); break;				case 'y': f += (100 + t.getYear() + '').substring(1); break				case 'Y': f += t.getFullYear(); break;				case 'm': f += this.leadZero(m + 1); break;				case 'n': f += (m + 1); break;				case 'M': f += this.options.months[m].substring(0,this.options.monthShort); break;				case 'F': f += this.options.months[m]; break;				case 'd': f += this.leadZero(t.getDate()); break;				case 'j': f += t.getDate(); break;				case 'D': f += this.options.days[t.getDay()].substring(0,this.options.dayShort); break;				case 'l': f += this.options.days[t.getDay()]; break;				case 'G': f += h; break;				case 'H': f += this.leadZero(h); break;				case 'g': f += (h % 12 ? h % 12 : 12); break;				case 'h': f += this.leadZero(h % 12 ? h % 12 : 12); break;				case 'a': f += (h > 11 ? 'pm' : 'am'); break;				case 'A': f += (h > 11 ? 'PM' : 'AM'); break;				case 'i': f += this.leadZero(t.getMinutes()); break;				case 's': f += this.leadZero(t.getSeconds()); break;				case 'U': f += Math.floor(t.valueOf() / 1000); break;				default:  f += format.charAt(i);			}		}		return f;	},		unformat: function(t, format) {		var d = new Date();		var a = {};		var c, m;		t = t.toString();				for (var i = 0; i < format.length; i++) {			c = format.charAt(i);			switch(c) {				case '\\': r = null; i++; break;				case 'y': r = '[0-9]{2}'; break;				case 'Y': r = '[0-9]{4}'; break;				case 'm': r = '0[1-9]|1[012]'; break;				case 'n': r = '[1-9]|1[012]'; break;				case 'M': r = '[A-Za-z]{'+this.options.monthShort+'}'; break;				case 'F': r = '[A-Za-z]+'; break;				case 'd': r = '0[1-9]|[12][0-9]|3[01]'; break;				case 'j': r = '[1-9]|[12][0-9]|3[01]'; break;				case 'D': r = '[A-Za-z]{'+this.options.dayShort+'}'; break;				case 'l': r = '[A-Za-z]+'; break;				case 'G': 				case 'H': 				case 'g': 				case 'h': r = '[0-9]{1,2}'; break;				case 'a': r = '(am|pm)'; break;				case 'A': r = '(AM|PM)'; break;				case 'i': 				case 's': r = '[012345][0-9]'; break;				case 'U': r = '-?[0-9]+$'; break;				default:  r = null;			}						if ($chk(r)) {				m = t.match('^'+r);				if ($chk(m)) {					a[c] = m[0];					t = t.substring(a[c].length);				} else {					if (this.options.debug) alert("Fatal Error in DatePicker\n\nUnexpected format at: '"+t+"' expected format character '"+c+"' (pattern '"+r+"')");					return d;				}			} else {				t = t.substring(1);			}		}				for (c in a) {			var v = a[c];			switch(c) {				case 'y': d.setFullYear(v < 30 ? 2000 + v.toInt() : 1900 + v.toInt()); break; // assume between 1930 - 2029				case 'Y': d.setFullYear(v); break;				case 'm':				case 'n': d.setMonth(v - 1); break;				// FALL THROUGH NOTICE! "M" has no break, because "v" now is the full month (eg. 'February'), which will work with the next format "F":				case 'M': v = this.options.months.filter(function(item, index) { return item.substring(0,this.options.monthShort) == v }.bind(this))[0];				case 'F': d.setMonth(this.options.months.indexOf(v)); break;				case 'd':				case 'j': d.setDate(v); break;				case 'G': 				case 'H': d.setHours(v); break;				case 'g': 				case 'h': if (a['a'] == 'pm' || a['A'] == 'PM') { d.setHours(v == 12 ? 0 : v.toInt() + 12); } else { d.setHours(v); } break;				case 'i': d.setMinutes(v); break;				case 's': d.setSeconds(v); break;				case 'U': d = new Date(v.toInt() * 1000);			}		};				return d;	}});window.addEvent('domready', function() {	// Preload images for the hover effects	var myImages = new Asset.images(			['/images/email_hover.jpg', 			'/images/facebook_hover.jpg', 			'/images/more_hover.jpg', 			'/images/more_top_hover.jpg', 			'/images/odeslat_hover.jpg', 			'/images/pages_hover.jpg', 			'/images/pages_next_hover.jpg', 			'/images/pages_previous_hover.jpg', 			'/images/twitter_hover.jpg', 			'/images/upresnit_hover.jpg', 			'/images/vyhledat_hover.jpg',			'/images/play_small_hover.png',			'/images/play_small_close_hover.png',			'/images/play_big2_hover.png',			'/images/play_big2_close_hover.png',			'/images/play_big_hover.png',			'/images/mapa_sk.jpg',			'/images/mapa_de.jpg',			'/images/mapa_at.jpg',			'/images/mapa_pl.jpg',			'/images/mapa_03.jpg',			'/images/mapa_04.jpg',			'/images/mapa_05.jpg',			'/images/mapa_06.jpg',			'/images/mapa_07.jpg',			'/images/mapa_08.jpg',			'/images/mapa_09.jpg',			'/images/mapa_10.jpg'], {}	);	// Make swapable inputs	var swap = [];	$$('input.swap, textarea.swap').each(function(el){		swap[el.id] = $(el).value;		el.addEvents({			'focus' : function(){ this.value = "" },			'blur' : function(){ if (this.value == ''){ this.value = swap[this.id] } }		});	});			// External anchors in valid XHTML strict	$$('a[rel=external]', 'a.external').each(function(el){		if (el.href) el.target = "_blank";	});			// Thumbs switcher	if ($('pictures'))    {		$$('.trigger_image_thumb').addEvent(			'click', function() {				var id = this.id;				id_parent = id.substring(0,7);								if ($(id_parent).hasClass('hidden'))				{					voclose();					$$('#image div').each(function(el){						if (el.id != 'play_small' && !el.hasClass('frame'))						{							el.setProperty('class', 'hidden');						}					});					$(id_parent).toggleClass('hidden');				}				$$('#pictures img.frame').each(function(el){					if (el.id == id_parent+'_frame')					{						el.setProperty('src', '/images/foto_small_sipka.png');					}					else					{						el.setProperty('src', '/images/foto_small.png');					}				});								$$('#pictures img').each(function(el){					el.setStyle('opacity', 1);				});				this.getElement('img').setStyle('opacity', 0.7);			}		);	}			// Close video overlay	var voclose = function () {		if ($('play_small'))		{		if ($('play_small').hasClass('hidden'))		{			$('play').setStyle('display', 'none');			$('play_small').toggleClass('hidden');			$('play_small').addClass('displayb');		}		}	}		if ($('play'))    {		$$('#close').addEvent('click', voclose);	}			// Rating	var hodnoceni = [];	$$('#hodnoceni a').each(function(el){        el.addEvents({			'mouseenter': function(){				var rel = this.rel;				for (i=1;i<=rel;i=i+1)				{					var children = $('hodnoceni_'+i).getElement('img');					hodnoceni['hodnoceni_'+i] = children.getProperty('src');					children.setProperty('src', '/images/star_full.jpg');				}			},			'mouseleave': function(){				var rel = this.rel;				for (i=1;i<=rel;i=i+1)				{					var children = $('hodnoceni_'+i).getElement('img');					children.setProperty('src', hodnoceni['hodnoceni_'+i]);				}			}		});	});			// Hovers	if ($$('img.hover_more_top'))	{		$$('img.hover_more_top').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/more_top_hover.jpg');				},				'mouseleave': function(){					this.setProperty ('src', '/images/more_top.jpg');				}			});		});	}		if ($$('img.hover_more'))	{		$$('img.hover_more').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/more_hover.jpg');				},				'mouseleave': function(){					this.setProperty ('src', '/images/more.jpg');				}			});		});	}		if ($$('img.hover_prev'))	{		$$('img.hover_prev').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/pages_previous_hover.jpg');				},				'mouseleave': function(){					this.setProperty ('src', '/images/pages_previous.jpg');				}			});		});	}		if ($$('img.hover_next'))	{		$$('img.hover_next').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/pages_next_hover.jpg');				},				'mouseleave': function(){					this.setProperty ('src', '/images/pages_next.jpg');				}			});		});	}		if ($$('#play_small img'))	{		$$('#play_small img').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/play_small_hover.png');				},				'mouseleave': function(){					this.setProperty ('src', '/images/play_small.png');				}			});		});	}		if ($$('img.play_small'))	{		$$('img.play_small').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/play_small_hover.png');					if ($('play_big_image2'))					{						$('play_big_image2').setProperty ('src', '/images/play_big2_hover.png');					}					else					{						$$('img.play_big_image').each(function(el){							el.setProperty ('src', '/images/play_big_hover.png');						});					}				},				'mouseleave': function(){					this.setProperty ('src', '/images/play_small.png');					if ($('play_big_image2'))					{						$('play_big_image2').setProperty ('src', '/images/play_big2.png');					}					else					{						$$('img.play_big_image').each(function(el){							el.setProperty ('src', '/images/play_big.png');						});					}				}			});		});	}		if ($('play_big_image2'))	{		$('play_big_image2').addEvents({			'mouseenter': function(){				this.setProperty ('src', '/images/play_big2_hover.png');				$$('img.play_small').each(function(el){					el.setProperty ('src', '/images/play_small_hover.png');				});			},			'mouseleave': function(){				this.setProperty ('src', '/images/play_big2.png');				$$('img.play_small').each(function(el){					el.setProperty ('src', '/images/play_small.png');				});			}		});	}		if ($('close'))	{		$('close').addEvents({			'mouseenter': function(){				$('play_big_image2').setProperty ('src', '/images/play_big2_close_hover.png');				$$('img.play_small').each(function(el){					el.setProperty ('src', '/images/play_small_close_hover.png');				});			},			'mouseleave': function(){				$('play_big_image2').setProperty ('src', '/images/play_big2.png');				$$('img.play_small').each(function(el){					el.setProperty ('src', '/images/play_small.png');				});			}		});	}		if ($$('img.play_big_image'))	{		$$('img.play_big_image').each(function(el){			el.addEvents({				'mouseenter': function(){					this.setProperty ('src', '/images/play_big_hover.png');					$$('img.play_small').each(function(el){						el.setProperty ('src', '/images/play_small_hover.png');					});				},				'mouseleave': function(){					this.setProperty ('src', '/images/play_big.png');					$$('img.play_small').each(function(el){						el.setProperty ('src', '/images/play_small.png');					});				}			});		});	}			// Validate form	if ($('diskuze'))    {		var submit = new Element('button', {type: 'submit', title: 'Odeslat', value: 'Odeslat'});		submit.setProperty('class', 'submit');		submit.inject($('comment-send'));		$('comment_title').setStyle('display', 'none');		$$('#comment-send .submit').addEvent('click', function(event){			event.stop();			if ($('diskuze_message_error')) { $('diskuze_message_error').dispose(); }			var error = 0;			var error_message = [];			if ($('diskuze_post').value == '' || $('diskuze_post').value == "váš názor, připomínka nebo komentář")			{				error += 1;				error_message[error] = "nebyl zadán váš názor, připomínka nebo komentář";			}			if ($('diskuze_name').value == '' || $('diskuze_name').value == "vaše jméno")			{				error += 1;				error_message[error] = "nebylo zadáno vaše jméno";			}			if ($('id_title').value != '')			{				error += 1;				error_message[error] = "vyplněno i pole, které z důvodu ochrany před roboty není určené k vyplňování";			}			if (error != 0)			{				var error_element = new Element('div', {id: 'diskuze_message_error'});				error_element.appendText("Při přidání Vašeho příspěvku do diskuze došlo k následující chybě:");				var error_list = new Element('ul');				for (i=1;i<=error;i=i+1)				{					var error_list_item = new Element('li');					error_list_item.appendText(error_message[i]);					error_list_item.inject(error_list);				}				error_element.inject($('diskuze_nadpis'), 'after');				error_list.inject(error_element);			}			else			{				$('comment-send').submit();			}		});	}			// First page search form	if ($('search'))	{		var check_selected = function () {			$('step_fine').removeClass('hidden');			$('step_1').setStyle('min-height', '125px');			$('buttons').setStyle('background-position', '0 -85px');			$$('#search_bottom ul li').each(function(el){				if (el.hasClass('selected'))				{					el.removeClass('selected');					el.addClass('checked');				}			});		}				if (!$('subpage'))		{			$('step_fine').toggleClass('hidden');			$('step_1_2').toggleClass('hidden');			$('step_2').toggleClass('hidden');			$('step_2_2').toggleClass('hidden');			$('step_3').toggleClass('hidden');			$('step_3_2').toggleClass('hidden');			$('step_4').toggleClass('hidden');					$('step_1_trigger').addEvent('click', function(){				check_selected();				$('step_1_trigger').addClass('selected');				var scroll = new Fx.Scroll(window).toElement('step_1');			});			$('step_2_trigger').addEvent('click', function(){				check_selected();				$('step_2_trigger').addClass('selected');				$('step_2').removeClass('hidden');				var scroll = new Fx.Scroll(window).toElement('step_2');			});			$('step_3_trigger').addEvent('click', function(){				check_selected();				$('step_3_trigger').addClass('selected');				$('step_3').removeClass('hidden');				var scroll = new Fx.Scroll(window).toElement('step_3');			});			$('step_4_trigger').addEvent('click', function(){				check_selected();				$('step_4_trigger').addClass('selected');				$('step_4').removeClass('hidden');				var scroll = new Fx.Scroll(window).toElement('step_4');			});		}		$('search_location').addEvent('change', function(){			mapa_select (this.value);		});		saved_options_type = [];		$('search_type').addEvent('change', function(){			if (saved_options_type.length > 0)			{				saved_options_type.each(function(el){					el.inject($('search_type2'));				});				saved_options_type = [];			}			$('step_2_2').removeClass('hidden');			$$('#search_type2 option').each(function(el){				if (!el.hasClass($('search_type').value) && $('search_type').value != 0 && el.get('value') != 0)				{					saved_options_type[el.get('value')] = el.dispose();				}			});		});		saved_options_act = [];		$('search_activity').addEvent('change', function(){			if (saved_options_act.length > 0)			{				saved_options_act.each(function(el){					el.inject($('search_activity2'));				});				saved_options_act = [];			}			$('step_3_2').removeClass('hidden');			$$('#search_activity2 option').each(function(el){				if (!el.hasClass($('search_activity').value) && $('search_activity').value != 0 && el.get('value') != 0)				{					saved_options_act[el.get('value')] = el.dispose();				}			});		});						$$('#step_fine button').addEvent('click', function(){			var next_id = "";			$$('#search_bottom ul .selected').each(function(el){				next_id = parseInt(el.id.substr(5,1));			});			next_id += 1;			if (next_id < 5)			{				check_selected();				$('step_'+next_id+'_trigger').addClass('selected');				$('step_'+next_id).removeClass('hidden');				var scroll = new Fx.Scroll(window).toElement('step_'+next_id);				if (next_id == 4)				{					$('step_fine').toggleClass('hidden');				}			}		});				if (!$('subpage'))		{			$('date_datepicker').addEvent('click', function(){				$('search_date_datepicker').toggleClass('hidden');				$('search_date_period').toggleClass('hidden');			});						$('date_period').addEvent('click', function(){				$('search_date_datepicker').toggleClass('hidden');				$('search_date_period').toggleClass('hidden');			});		}				new DatePicker('.input_datepicker1', {			positionOffset: { x: 0, y: 5 },			days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],			months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],			format: 'd.m.Y',			yearPicker: true,			inputOutputFormat: 'd.m.Y',			startday: 1		});		new DatePicker('.input_datepicker2', {			positionOffset: { x: 0, y: 5 },			days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],			months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],			format: 'd.m.Y',			yearPicker: true,			inputOutputFormat: 'd.m.Y',			startday: 1		});	}			// Dodelat	if ($('search_narrow'))	{		saved_options_loc = [];		if (saved_options_loc.length > 0)		{			saved_options_loc.each(function(el){				el.inject($('search_location2'));			});			saved_options_loc = [];		}		$$('#search_location2 option').each(function(el){			if (!el.hasClass($('search_location').value) && $('search_location').value != 0 && el.get('value') != 0)			{				saved_options_loc[el.get('value')] = el.dispose();			}		});		$('search_location').addEvent('change', function(){			if (saved_options_loc.length > 0)			{				saved_options_loc.each(function(el){					el.inject($('search_location2'));				});				saved_options_loc = [];			}			$$('#search_location2 option').each(function(el){				if (!el.hasClass($('search_location').value) && $('search_location').value != 0 && el.get('value') != 0)				{					saved_options_loc[el.get('value')] = el.dispose();				}			});		});		saved_options_type = [];		if (saved_options_type.length > 0)		{			saved_options_type.each(function(el){				el.inject($('search_type2'));			});			saved_options_type = [];		}		$$('#search_type2 option').each(function(el){			if (!el.hasClass($('search_type').value) && $('search_type').value != 0 && el.get('value') != 0)			{				saved_options_type[el.get('value')] = el.dispose();			}		});		$('search_type').addEvent('change', function(){			if (saved_options_type.length > 0)			{				saved_options_type.each(function(el){					el.inject($('search_type2'));				});				saved_options_type = [];			}			$$('#search_type2 option').each(function(el){				if (!el.hasClass($('search_type').value) && $('search_type').value != 0 && el.get('value') != 0)				{					saved_options_type[el.get('value')] = el.dispose();				}			});		});		saved_options_act = [];		if (saved_options_act.length > 0)		{			saved_options_act.each(function(el){				el.inject($('search_activity2'));			});			saved_options_act = [];		}		$$('#search_activity2 option').each(function(el){			if (!el.hasClass($('search_activity').value) && $('search_activity').value != 0 && el.get('value') != 0)			{				saved_options_act[el.get('value')] = el.dispose();			}		});		$('search_activity').addEvent('change', function(){			if (saved_options_act.length > 0)			{				saved_options_act.each(function(el){					el.inject($('search_activity2'));				});				saved_options_act = [];			}			$$('#search_activity2 option').each(function(el){				if (!el.hasClass($('search_activity').value) && $('search_activity').value != 0 && el.get('value') != 0)				{					saved_options_act[el.get('value')] = el.dispose();				}			});		});	}			// Slideshow	if ($('slideshow'))    {		var islideshow = $$('#slideshow div.make_slide');		var id         = 0;		slide          = 0;		var slideshow      = "";				slideshow = function() {			slide = $clear(slide);			// Get through all elements			for (i = 0; i < islideshow.length; i++) {				// Show the five from all				if (i == id)				{					$(islideshow[i]).removeClass('hidden');				}				// Other hide				else				{					$(islideshow[i]).addClass('hidden');				}			}									var islideshow_triggers = $$('#slideshow_counter li');			for (i = 0; i < islideshow_triggers.length; i++) {				if (i == id)				{					$(islideshow_triggers[i]).addClass('selected');				}				else				{					$(islideshow_triggers[i]).removeClass('selected');				}			}							// At the end null the counter			if (id < (islideshow.length - 1))			{				id += 1;			}			else			{				id = 0;			}							// And start again in 5 seconds			slide = slideshow.delay(3000);		};		slideshow();				$('slideshow').addEvents({			'mouseenter': function() {				slide = $clear(slide);			},			'mouseleave': function() {				slide = $clear(slide);				slide = slideshow.delay(3000);			}		});				$('mbOverlay').addEvents({			'mouseenter': function() {				slide = $clear(slide);			},			'mouseleave': function() {				slide = $clear(slide);				slide = slideshow.delay(3000);			}		});				$('mbCenter').addEvents({			'mouseenter': function() {				slide = $clear(slide);			},			'mouseleave': function() {				slide = $clear(slide);				slide = slideshow.delay(3000);			}		});				$$('#slideshow_counter li').each(function(el){			el.addEvent('click', function(e){				e.stop();				slide = $clear(slide);				var i = this.id;				i = i.substring(18);				id = (i-1);				slideshow();			});		});	}			// FB a Twitter	if ($('facebook'))    {		$('facebook').addEvent('click', function(e){			e.stop();			share_on_fb ();		});	}	if ($('twitter'))    {		$('twitter').addEvent('click', function(e){			e.stop();			share_on_tw ();		});	}});function mapa_change (num) {	var mapa_stavy = new Array();	mapa_stavy[0] = '/images/mapa.jpg';	mapa_stavy[1] = '/images/mapa_1.jpg';	mapa_stavy[2] = '/images/mapa_2.jpg';	mapa_stavy[3] = '/images/mapa_3.jpg';	mapa_stavy[4] = '/images/mapa_4.jpg';	mapa_stavy[5] = '/images/mapa_5.jpg';	mapa_stavy[6] = '/images/mapa_6.jpg';	mapa_stavy[7] = '/images/mapa_7.jpg';	mapa_stavy[8] = '/images/mapa_8.jpg';	mapa_stavy[150] = '/images/mapa_pl.jpg';	mapa_stavy[153] = '/images/mapa_de.jpg';	mapa_stavy[155] = '/images/mapa_at.jpg';	mapa_stavy[163] = '/images/mapa_163.jpg';	mapa_stavy[164] = '/images/mapa_164.jpg';	mapa_stavy[165] = '/images/mapa_165.jpg';	mapa_stavy[166] = '/images/mapa_166.jpg';	mapa_stavy[167] = '/images/mapa_hu.jpg';	mapa_stavy[168] = '/images/mapa_uk.jpg';	$('mapa_front').setProperty('src', mapa_stavy[num]);}function mapa_change_back (num) {	if ($('search_location').value != 0)	{		mapa_change ($('search_location').value);	}	else	{		mapa_change (0);	}}saved_options_loc = [];function mapa_select (num) {	if (saved_options_loc.length > 0)	{		saved_options_loc.each(function(el){			el.inject($('search_location2'));		});		saved_options_loc = [];	}	$$('#search_location option').each(function(el){		if (el.value == num)		{			el.setProperty('selected', 'selected');		}	});	mapa_change(num);	if (!$('subpage'))	{		$('step_fine').removeClass('hidden');		$('step_1_2').removeClass('hidden');	}	$$('#search_location2 option').each(function(el){		if (!el.hasClass($('search_location').value) && $('search_location').value != 0 && el.get('value') != 0)		{			saved_options_loc[el.get('value')] = el.dispose();		}	});}function share_on_fb () {	u = location.href;	t = document.title;	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');	return false;}function share_on_tw () {	u = location.href;	t = document.title;	window.open('http://twitter.com/share?url='+u+'&text='+t,'','personalbar=0,toolbar=0,status=0,scrollbars=1,resizable=1,width=550,height=450,');	return false;}
