
if(jQuery)
{
	(function($){
		if($.InFieldLabels)
		{
			$.InFieldLabels.defaultOptions.fadeOpacity=0.3;
			$(function(){$('label.makeOver').removeClass('makeOver').inFieldLabels().addClass('over');});
		}
	})(jQuery);

	(function($){
		if($.fancybox)
		{
			function init(el)
			{
				$(el).find('a[rel="lightbox"]').fancybox({
					'type'					: 'image',
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic',
					'easingIn'			: 'easeOutBack',
					'easingOut'			: 'easeInBack',
					'centerOnScroll': true,
					_:0
				});
			}

			$(function(){init(document);});
			if(window.pluginTool)pluginTool.plugins.fancybox={onDocumentChange:function(el){return init(el);}};

			jQuery(document).ready(function()
			{
				$(".video").click(function()
				{
					$.fancybox({
						'padding'      : 0,
						'autoScale'    : false,
						'transitionIn' : 'none',
						'transitionOut': 'none',
						'title'        : this.title,
						'width'        : 640,
						'height'       : 385,
						'href'         : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
						'type'         : 'swf',
						'swf'          :
						{
							'wmode'             : 'transparent',
							'allowfullscreen'   : 'true'
						}
					});
					return false;
				});
			});
		}

	})(jQuery);
}

if(document.id)
{
	(function($)
	{

	   window.addEvent('domready', function()
	   {
		   var elements = $$('.video');

		   var length = elements.length;
		   for(i=0; i<length; i++)
		   {
		      var e   = elements[i];
		      var img = e.getElement('img');

		      e.setStyles(
				{
				   display: 'block',
					float: 'left',
					position: 'relative',
					width: img.width,
					height: img.height,
					margin: '4px 3px'
				});

		      e.adopt(new Element('span',
		      {
		         styles:
		         {
		            position: 'absolute',
		            top: -1,
		            right: -1,
						display: 'block',
						width: 41,
						height: 19,
						background: 'url("/img/video-youtube.png") no-repeat 0 0'
		         }
		      }));
		   }

		   if(length)
				elements[length-1].getParent().adopt(new Element('div', {'class': 'clearer'}));
		});


	})(document.id);
}

function addBookmark()
{
	bookmarkurl = window.location;
	bookmarktitle=window.title;
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
	else if ( window.sidebar ) {
		window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
	}
}

