 // JavaScript Document


PageTurner = Class.create();
Object.extend(PageTurner.prototype, {
	element: 'pageturner'
	,buttonPrefix: 'page'
	,totalItems: 1
	,currentItem: 1
	,viewSize: 1
	,duration: .7
	,pauseLength: 5000
	,timer: 0
	,transition: Effect.Transitions.sinoidal
	,direction: 1  //1 for horizontal, 2 for vertical
	,offset: 0 //in pixels
	,inactiveCssClass: ''
	,activeCssClass: 'active'
	,isAutoscroll: false
	,isStopped: false
	,isMoving: false
	,isPagesWrapped: true
	,debug: false
	,noNumbers: false 
	
	,initialize: function() {
		this.options = Object.extend({
			element: 'pageturner'
			,buttonPrefix: 'page'
			,totalItems: 1
			,viewSize: 1
			,duration: .7
			,pauseLength: 5000
			,timer:0
			,transition: Effect.Transitions.sinoidal
			,direction: 1
			,offset: 0
			,inactiveCssClass: ''
			,activeCssClass: 'active'
			,isAutoscroll: false
			,isPagesWrapped: true
			,debug: false
			,noNumbers: false 
		}, arguments[0] || {});
		
		this.element = this.options.element;
		this.buttonPrefix = this.options.buttonPrefix
		this.totalItems = this.options.totalItems; 
		this.viewSize = this.options.viewSize;
		this.duration = this.options.duration;
		this.pauseLength = this.options.pauseLength;
		this.timer = this.options.timer;
		this.transition = this.options.transition;
		this.direction = this.options.direction;
		this.offset = this.options.offset;
		this.inactiveCssClass = this.options.inactiveCssClass;
		this.activeCssClass = this.options.activeCssClass;
		this.isAutoscroll = this.options.isAutoscroll;
		this.isPagesWrapped = this.options.isPagesWrapped;
		this.debug = this.options.debug;
		this.noNumbers = this.options.noNumbers;
		
		if(this.isAutoscroll){
			this.start();
		}
	}
	
	,start: function() {
		this.isStopped = false;
		this.interval = setInterval(function(){ this.showNext(true) }.bind(this), this.pauseLength);
	}
	
	,stop: function() {
		this.isStopped = true;
		clearInterval(this.interval);
	}
	
	,reset: function(){
		this.stop();
		this.start();
	}

	,showPrevious: function(isAuto) 
	{	
		if (this.currentItem > 1) 
		{
			var x,y;
			(this.direction == 1) ? x = this.offset : x = 0;
			(this.direction == 2) ? y = this.offset : y = 0;
			
			if(this.debug){ alert("Showing Previous | Current Item: " + this.currentItem + " x: " + x + " y:" + y)}
			new Effect.Move(this.element, { 
				x: x
				,y: y
				,duration: this.duration
				,beforeStart: function() {
					if(!this.isMoving){
						if (!this.noNumbers)
						{
							$(this.buttonPrefix + this.currentItem).className = this.inactiveCssClass;	
							$(this.buttonPrefix + (this.currentItem-1)).className = this.activeCssClass;
						}
						this.isMoving = true;
					}
					if(!isAuto){ this.stop(); }
				}.bind(this)
				,afterFinish: function(e) { 
					this.currentItem--;
					this.isMoving = false;
					if(this.isAutoscroll && !this.isStopped){ this.reset(); }
				}.bind(this)
				,transition: this.transition
				,queue: { 
					position: 'end'
					,scope: this.element
					,limit: 1 
				}
			});
		}
		else{
			if(this.isPagesWrapped){
				this.showPage(this.totalItems);
			}
		}
	}
	,showNext: function(isAuto) 
	{	
		if (this.currentItem < this.totalItems) 
		{
			var x,y;
			(this.direction == 1) ? x = -1*this.offset : x = 0;
			(this.direction == 2) ? y = -1*this.offset : y = 0;
			if(this.debug){ alert("Showing Next | Current Item: " + this.currentItem + " x: " + x + " y:" + y)}
			new Effect.Move(this.element, { 
				x: x
				,y: y
				,duration: this.duration
				,beforeStart: function() {
					if(!this.isMoving){
						if (!this.noNumbers)
						{
							$(this.buttonPrefix + this.currentItem).className = this.inactiveCssClass;	
							$(this.buttonPrefix + (this.currentItem+1)).className = this.activeCssClass;
						}
						this.isMoving = true;
					}
					if(!isAuto){ this.stop(); }
				}.bind(this)
				,afterFinish: function(e) { 
					this.currentItem++;
					this.isMoving = false;
					if(this.isAutoscroll && !this.isStopped){ this.reset(); }
				}.bind(this)
				,transition: this.transition
				,queue: { 
					position: 'end'
					,scope: this.element
					,limit: 1 
				}
			});
		}
		else{
			if(!isAuto){ var isAuto = false; }
			if(this.isPagesWrapped){
				this.showPage(1, isAuto);
			}
		}
	}
	,showPage: function(num, isAuto)
	{		
		var x,y;
		(this.direction == 1) ? x = ((num - this.currentItem)*(-1 * this.offset)) : x = 0;
		(this.direction == 2) ? y = ((num - this.currentItem)*(-1 * this.offset)) : y = 0;
		if(this.debug){ alert("Showing Page " + num + " | Current Item: " + this.currentItem + " x: " + x + " y:" + y)}
		new Effect.Move(this.element, { 
			x: x
			,y: y
			,duration: this.duration
			,beforeStart: function() {
				if(!this.isMoving){
					if (!this.noNumbers)
					{
						$(this.buttonPrefix + this.currentItem).className = this.inactiveCssClass;
						$(this.buttonPrefix + num).className = this.activeCssClass;
					}
					this.isMoving = true;
				}
				if(!isAuto){ this.stop(); }
			}.bind(this)
			,afterFinish: function(e) { 
				this.currentItem = num;
				this.isMoving = false;
				if(this.isAutoscroll && !this.isStopped){ this.reset(); }
			}.bind(this)
			,transition: this.transition
			,queue: { 
				position: 'end'
				,scope: this.element
				,limit: 1 
			}
		});
	}
}); //common to all popups - rewrite all abc and other stuff to match with this
function popup(url,w,h){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	
	childWindow=open(url, "", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left ="+LeftPosition+",top="+TopPosition+"");
	if (childWindow.opener == null) childWindow.opener = self;	
}

//used only for player so we can change player vars later without having to change the player itself
function popupplayer(url){
	w=980;
	h=510;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	childWindow=open(url, "", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left ="+LeftPosition+",top="+TopPosition+"");
	if (childWindow.opener == null) childWindow.opener = self;	
}

//used only for player so we can change player vars later without having to change the player itself
function playVideo(video_id,zone_id){
	w=980;
	h=596;
	url = "/player/?video_id="+video_id+"&zone="+zone_id+"&categories="+zone_id;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	childWindow = open(url, "","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left ="+LeftPosition+",top="+TopPosition+"");
	if (childWindow.opener == null) childWindow.opener = self;	
}


function popupUpload(type,id){
	w = 500;
	h= 750;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if(type == 'video'){
	childWindow=open("/widgets/videogallery/form.cfm?gallery_id="+id, "", "toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left ="+LeftPosition+",top="+TopPosition+"");
	}
	else{
		childWindow=open("/widgets/imagegallery/form.cfm?gallery_id="+id, "", "toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left ="+LeftPosition+",top="+TopPosition+"");
	}
	if (childWindow.opener == null) childWindow.opener = self;	
}

//check to see if any radio button is checked in a family
function chkRadio(btn,msg) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1){
		return true;
	}else{ 
		alert(msg);
		btn[0].focus();
		return false;
	}
}


//prototype function to trim strings
String.prototype.trim = function() {
	return this.replace(/^\s*|\s*$/g, "");
}

//alert and focus in validations
function chkEmpty(el,msg){
	if(el.value.trim() == ""){
		message(el,msg);
		return false;
	}else{
		el.className = 'frmreq';
		return true;
	}
}

function chkSelect(el,msg) {
	if (el.options[el.selectedIndex].value=="") {
		message(el,msg);
		return false;	
	} else {
		el.className =  'text';
		return true;
	}
}

function chkMultiSelect(el,msg) {
	var i=0
	var isSelected=false
	for (i=0;i<el.options.length;i++) {
		if (el.options[i].selected == true && el.options[i].value != "" ) {
			isSelected=true;
			break;
		}
	}
	if (!isSelected) {
		message(el,msg);
		return false;
	} else {
		el.clasName = 'text';
		return true;
	}
}

//alert msg which is called by chkEmpty
function message(el,msg){
	alert(msg);
	if(el.type != 'radio' && el.type != 'checkbox')
		el.className = 'required';
	el.focus();
	return;
}

function form_validate(id,verify){
	var f = document.getElementById(id);
	var els = f.elements;
	for(i=0;i<els.length;i++){
		if($(els[i]).is('.required') || $(els[i]).is('.frmreq')){
			switch(els[i].type){
				case "text":
					if(chkEmpty(els[i],'This field is required and cannot be empty') == false) return false;
					break;
				case "textarea":
					if(chkEmpty(els[i],'This field is required and cannot be empty') == false) return false;
					break;
				case "select":
					if(chkEmpty(els[i],'This field is required and cannot be empty') == false) return false;
					break;
				case "select-multiple":
					if(chkEmpty(els[i],'This field is required and cannot be empty') == false) return false;
					break;
				case "radio":
					if(chkRadio(f.elements[els[i].name],'This field is required. Please select atleast one option') == false) return false;
					break;
				case "checkbox":
					if(chkRadio(f.elements[els[i].name],'This field is required. Please select atleast one option') == false) return false;
					break;
			}
		}
		/*
		else{
			if($(els[i]).is('.captcha')){
				if(els[i].value != verify){
					alert('The verification text you entered does not match the image');	
					return false;
				}
			}
		}
		*/
	}
	return true;
}

function show_form_response(id, response){
	document.getElementById(id).innerHTML = response; 
}


function comments_selectTab(tab, guid, value){
	if(tab == 'new'){
		$('#comments_form_'+guid+' ul li a').removeClass('selected');
		$('#new_'+guid).addClass('selected');
		$('#register_'+guid).show();
		$('#login_'+guid).hide();
		$('#forgot_password_'+guid).hide();
		$('#comments_form_'+guid).find('input[name=subaction]').each(function(){ $(this).attr('value',value); });
	}
	else if(tab == 'forgot'){ 
		$('#comments_form_'+guid+' ul li a').removeClass('selected');
		$('#forgot_'+guid).addClass('selected');
		$('#forgot_password_'+guid).show();
		$('#login_'+guid).hide();
		$('#register_'+guid).hide();
		$('#comments_form_'+guid).find('input[name=subaction]').each(function(){ $(this).attr('value',value); });
	}
	else{ 
		$('#comments_form_'+guid+' ul li a').removeClass('selected');
		$('#registered_'+guid).addClass('selected');
		$('#login_'+guid).show();
		$('#register_'+guid).hide();
		$('#forgot_password_'+guid).hide();
		$('#comments_form_'+guid).find('input[name=subaction]').each(function(){ $(this).attr('value',value); });
	}
}
	
function comments_submit(guid){
	//Validate comments.
	if($('#comments_form_'+guid+ ' input[name=subaction]').attr('value') == 'register'){
		if($('#comments_form_'+guid+ ' input[name=authorName]').attr('value').length == 0){
			$('#comments_form_'+guid+ ' input[name=authorName]').focus();
			$('#message_'+guid).addClass('error').removeClass('success').html('<strong>Error:</strong> You must enter a Name.').show();
			return false;
		}
		var ereg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var address = $('#comments_form_'+guid+ ' input[name=authorEmail]').attr('value');
		if(address.length == 0 || ereg.test(address) == false){
			$('#comments_form_'+guid+ ' input[name=authorEmail]').focus();
			$('#message_'+guid).addClass('error').removeClass('success').html('<strong>Error:</strong> You must a valid E-mail Address.').show();
			return false;
		}
	}
	else if($('#comments_form_'+guid+ ' input[name=subaction]').attr('value') == 'login'){
		if($('#comments_form_'+guid+ ' input[name=authorLogin]').attr('value').length == 0){
			$('#comments_form_'+guid+ ' input[name=authorLogin]').focus();
			$('#message_'+guid).addClass('error').removeClass('success').html('<strong>Error:</strong> Please enter the E-mail Address your registered with to login.').show();
			return false;
		}
	}
	
	if($('#comments_form_'+guid+ ' textarea[name=comments]').attr('value').length == 0){
		$('#comments_form_'+guid+ ' textarea[name=comments]').focus();
		$('#message_'+guid).addClass('error').removeClass('success').html('<strong>Error:</strong> You forgot to enter comments.').show();
		return false;
	}
	
	$('#comments_form_'+guid+' button[name=submitComment]').hide();
	values = $('#comments_form_'+guid).serializeArray();
	$.post('/widgets/comments/ajax.cfm',values,function(data){
		if(data.error){
			$('#message_'+guid).addClass('error').removeClass('success').html(data.message).show();
			$('#comments_form_'+guid+' button[name=submitComment]').show();
		}
		else{
			$('#message_'+guid).addClass('success').removeClass('error').html(data.message).show();
		}
	},'json');
}

function comments_setReplyTo(name, cguid, fguid){
	$('#replyTo_'+fguid).html('<strong>Reply To:</strong> '+name+' <span>[<a href="#comments_'+fguid+'" onclick="comments_clearReplyTo(\''+fguid+'\');">clear</a>]</span>');
	$('#replyTo_'+fguid).show();
	
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: $('#comments_form_'+fguid).offset().top }, 500);

	$('#comments_form_'+fguid).find('input[name=reply_to]').each(function(){ $(this).attr('value',cguid); });
}

function comments_clearReplyTo(guid){
	$('#replyTo_'+guid).hide();
	$('#comments_form_'+guid).find('input[name=reply_to]').each(function(){ $(this).attr('value',''); });
}

function comments_vote(direction,guid){
	$.post('/widgets/comments/ajax.cfm',{ 
		action: 'submitvote'
		,direction: direction
		,guid: guid
	},function(){
		$('#rater_'+guid.replace(/-/g,'')).html('Voted!');
	});
}

function comments_report(guid){
	$.post('/widgets/comments/ajax.cfm',{ 
		action: 'report'
		,guid: guid
	},function(data){
		$('#rater_'+guid.replace(/-/g,'')).html('Reported!');
	},'json');
}

function comments_sendPassword(guid){	
	var ereg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = $('#forgot_password_'+guid+ ' input[name=forgotEmail]').attr('value');
	
	if(address.length == 0 || ereg.test(address) == false){
		$('#forgot_password_'+guid+ ' input[name=forgotEmail]').focus();
		$('#message_'+guid).addClass('error').removeClass('success').html('<strong>Error:</strong> You must a valid E-mail Address.').show();
		return false;
	}
	
	$('#forgot_password_'+guid+' button[name=submitComment]').hide();
	$.post('/widgets/comments/ajax.cfm',{ 
		action: 'forgotpassword'
		,email_address: address
		,guid: guid
	},function(data){
		if(data.error){
			$('#message_'+guid).addClass('error').removeClass('success').html(data.message).show();
			$('#forgot_password_'+guid+' button[name=submitComment]').show();
		}
		else{
			$('#message_'+guid).addClass('success').removeClass('error').html(data.message).show();
		}
	},'json');
	
	return false;
}

function searchBy(type){
	if (type == 'site') {
		$('#search_type_site_label').attr('class', 'active');
		$('#search_type_keyword_label').attr('class', '');
		$('#search_type_site').attr('checked', 'checked');
		$('#search_type_keyword').attr('checked', '');
	} else {
		$('#search_type_site_label').attr('class', '');
		$('#search_type_keyword_label').attr('class', 'active');
		$('#search_type_site').attr('checked', '');
		$('#search_type_keyword').attr('checked', 'checked');
	}
	/*$('search_type_site_label').className = (type == 'site') ? 'active' : '';  
	$('search_type_keyword_label').className = (type == 'keyword') ? 'active' : '';  
	$('search_type_site').checked = (type == 'site') ? true : false;  
	$('search_type_keyword').checked = (type == 'keyword') ? true : false;*/
}

/* Media */

$.fn.mediaViewer = function(options){
	var settings = {
		speed: 350,
		easing: '',		
		animActive: {opacity: 1, left: 0},
		animStart: {opacity: 1, left: 250},
		animStartAlt: {opacity: 1, left: -250},
		animEnd: {opacity: 1, left: -250},
		animEndAlt: {opacity: 1, left: 250},
		thumbView: 5,
		tabs: '',
		mouseWheel: false
	};	
	var options = $.extend(settings, options);
	
	return this.each(function(){
		var speed = settings.speed;
		var easing = settings.easing;
		var animActive = settings.animActive;
		var animStart = settings.animStart;	
		var animStartAlt = settings.animStartAlt;
		var animEnd = settings.animEnd;	
		var animEndAlt = settings.animEndAlt;
		var thumbView = settings.thumbView;
		var tabs = settings.tabs;
		var mouseWheel = settings.mouseWheel;
		var last = 0;
		var current = 0;
		var $this = $(this);
		var photos = $(this).find('.media-photos');
		var photos_list = photos.find('li');
		var thumbs = $(this).find('.media-thumbnails');
		var thumbs_list = thumbs.find('li a');
		var captions = $(this).find('.media-captions');
		var captions_list = captions.find('li');
		var count = photos_list.length;
		var prevBtn = $(this).find('.media-thumbnails-nav-prev');
		var nextBtn = $(this).find('.media-thumbnails-nav-next');	
		var thumbWidth = (thumbs_list.length > 0) ? thumbs_list.eq(0).outerWidth() + (thumbs_list.eq(0).css('marginLeft').replace('px', '') - 0) + (thumbs_list.eq(0).css('marginRight').replace('px', '') - 0) : 0;	
		
		init();
		
		// Attach Events
		thumbs_list.click(function(e){
			cycle(thumbs_list.index(this));
			return false;
		});
		
		prevBtn.click(function(e){
			cycle('prev');
			return false;
		});
		
		nextBtn.click(function(e){
			cycle('next');
			return false;
		});
		
		photos.find('.prev').hover(function(e){
			if (current - 1 >= 0){
				$(this).removeClass('inactive');
				$(this).attr('title', 'Previous');
				$(this).click(function(){
					cycle('prev');
				});
			}
		}, function(e){
			$(this).addClass('inactive');
			$(this).attr('title', '');
			$(this).unbind('click');
		});
		
		photos.find('.next').hover(function(e){
			if (current + 1 < count && count > 1){
				$(this).removeClass('inactive');
				$(this).attr('title', 'Next');
				$(this).click(function(){
					cycle('next');
				});
			}
		}, function(e){
			$(this).addClass('inactive');
			$(this).attr('title', '');
			$(this).unbind('click');
		});
		
		photos_list.hover(function(e){
			$(this).find('.caption').stop().animate({top: $(this).find('img').height() - $(this).find('.caption span').outerHeight()}, {duration: speed, easing: easing});
		}, function(e){
			$(this).find('.caption').stop().animate({top: $(this).find('img').height()}, {duration: speed, easing: easing});
		});
		
		photos.bind('mousewheel', function(event, delta){
			if (mouseWheel){
				var val = (delta < 0) ? current + 1 : current - 1;
				cycle(val);			
				return false;
			}
		});
		
		// Tabs
		if (tabs != ''){
			$(tabs + ' li a').click(function(){
				var index = $(this).parent().parent().find('li').index($(this).parent());
				var tabs = $(this).parent().parent();
				var panel = $(this).parent().parent().parent().parent().find('.media-tabs-panel');
				
				tabs.find('li').attr('class', '');
				tabs.find('li').eq(index).attr('class', 'active');
				panel.find('li.media').css('display', 'none');
				panel.find('li.media').eq(index).css('display', 'block');
				
				init();
				return false;
			});
		}
		
		// Methods		
		function init(){
			var hidden = false;
			if ($this.css('display') == 'none'){
				$this.css('display', 'block');
				hidden = true;
			}
			photos.addClass('loading');			
			if (photos.find('.dir').length === 0){
				photos.append('<span class="dir prev inactive"/>');
				photos.append('<span class="dir next inactive"/>');	
			}
			if (current + 1 < count && count > 1){
				nextBtn.find('a').attr('class', '');
			}
			photos_list.css(animStart);
			photos_list.eq(0).css(animActive);
			photos_list.each(function(e){
				var img = $(this).find('img');
				loadImg(this, img.attr('src'), img.attr('alt'), e);
			});
			if (hidden) $this.css('display', 'none');
		}
		
		function cycle(val){		
			if (val == 'next'){
				if (current + 1 < count) current++;
			} else if (val == 'prev'){
				if (current - 1 >= 0) current--;
			} else {
				var reg=/^\d$/;
				if (reg.test(val) && val >= 0 && val < count) current = val;
			}
			
			if (last == current) return false;
			
			if (current > 0){
				prevBtn.find('a').attr('class', '');
				photos.find('.prev').removeClass('inactive');
			} else {
				prevBtn.find('a').attr('class', 'inactive');
				photos.find('.prev').addClass('inactive');
			}
			if (current < count - 1){
				nextBtn.find('a').attr('class', '');
				photos.find('.next').removeClass('inactive');
			} else {
				nextBtn.find('a').attr('class', 'inactive');
				photos.find('.next').addClass('inactive');
			}
			
			if (current > last){
				photos_list.eq(current).css(animStart).stop().animate(animActive, {duration: speed, easing: easing});
				photos_list.eq(last).stop().animate(animEnd, {duration: speed, easing: easing});
			} else {
				photos_list.eq(current).css(animStartAlt).stop().animate(animActive, {duration: speed, easing: easing});
				photos_list.eq(last).stop().animate(animEndAlt, {duration: speed, easing: easing});
			}
			
			// Resize height for content
			photos.stop().animate({height: photos_list.eq(current).height()}, {duration: speed, easing: easing});
			
			if (count > thumbView){
				if ((current + 1) > Math.floor(thumbView / 2)){					
					var offset = -(thumbWidth * ((current + 1) - Math.floor(thumbView / 2) - 1));																						   
					if (Math.abs(offset) >= (thumbWidth * count) - (Math.floor(thumbView / 2) * thumbWidth * 2)) {						
						offset = -((count * thumbWidth) - ((Math.floor(thumbView / 2) * thumbWidth * 2) + thumbWidth));
					}
					thumbs.find('ul').stop().animate({left: offset}, {duration: speed, easing: easing});
				} else {
					thumbs.find('ul').stop().animate({left: 0}, {duration: speed, easing: easing});
				}
			}
			// Carousel effect
			//thumbs.find('ul').animate({left: -(current * 250)}, {duration: speed, easing: easing});
			
			captions_list.attr('class', '');
			captions_list.eq(current).attr('class', 'active');
			
			thumbs_list.parent().attr('class', '');
			thumbs_list.eq(current).parent().attr('class', 'active');
			
			last = current;
			
			return false;
		}
		
		function loadImg(el, src, alt, pos){
			if ($(el).find('img').length > 0){
				$(el).find('img').remove();
				$(el).find('.caption').css('display', 'none');
				
				var img = new Image();			
				$(img).load(function(){
					$(this).css('display', 'none');				
					photos.removeClass('loading');
					if ($(el).find('a').length > 0){
						$(el).find('a').prepend(this);
					} else {
						$(el).prepend(this);
					}				
					if ($(el).find('.caption span').length < 1) $(el).find('.caption').wrapInner('<span/>');
					$(el).find('.caption').css({top: $(this).height()});
					$(el).find('.caption').css('display', 'block');
					if (pos === 0) photos.css('height', $(this).height());
					$(this).fadeIn();
				}).error(function(){
					// error here
				}).attr('src', src).attr('alt', alt);
			}
		}
	});
};


/* Common items to go in document ready */
$(document).ready(function(){
						   
	//Used to toggle captions on news images
	$('div.credit a').click(function(){
		$(this).parent().parent().find('.caption').toggle();
		
		if ($(this).html() != 'Hide caption') {
			$(this).html('Hide caption');
		} else {
			$(this).html('Show caption <span>&darr;</span>');
		}
		
		return false;
	});
	
}); /**
 * DatePicker widget using Prototype and Scriptaculous.
 * (c) 2007 Mathieu Jondet <mathieu@eulerian.com>
 * Eulerian Technologies
 *
 * DatePicker is freely distributable under the same terms as Prototype.
 *
 */

/**
 * DatePickerFormatter class for matching and stringifying dates.
 *
 * By Arturas Slajus <x11@arturaz.net>.
 */
var DatePickerFormatter = Class.create();
DatePickerFormatter.prototype = {
    /**
     * Create a DatePickerFormatter.
     *
     * format: specify a format by passing 3 value array consisting of
     *   "yyyy", "mm", "dd". Default: ["yyyy", "mm", "dd"].
     *
     * separator: string for splitting the values. Default: "-".
     *
     * Use it like this:
     *   var df = new DatePickerFormatter(["dd", "mm", "yyyy"], "/");
     *   df.current_date();
     *   df.match("7/7/2007");
     */
    initialize: function(format, separator) {
        if (Object.isUndefined(format))
	 format = ["yyyy", "mm", "dd"];
        if (Object.isUndefined(separator))
	 separator = "-";

        this._format 	= format;
        this.separator	= separator;
                
        this._format_year_index	= format.indexOf("yyyy");
        this._format_month_index= format.indexOf("mm");
        this._format_day_index	= format.indexOf("dd");
                
        this._year_regexp	= /^\d{4}$/;
        this._month_regexp 	= /^0\d|1[012]|\d$/;
        this._day_regexp 	= /^0\d|[12]\d|3[01]|\d$/;
    },
    
    /**
     * Match a string against date format.
     * Returns: [year, month, day]
     */
    match: function(str) {
        var d = str.split(this.separator);
        
        if (d.length < 3)
	 return false;
        
        var year = d[this._format_year_index].match(this._year_regexp);
        if (year) { year = year[0] } else { return false }
        var month = d[this._format_month_index].match(this._month_regexp);
        if (month) { month = month[0] } else { return false }
        var day = d[this._format_day_index].match(this._day_regexp);
        if (day) { day = day[0] } else { return false }
        
        return [year, month, day];
    },
    
    /**
     * Return current date according to format.
     */
    current_date: function() {
        var d = new Date;
        return this.date_to_string(
            d.getFullYear(),
            d.getMonth() + 1,
            d.getDate()
       );
    },
    
    /**
     * Return a stringified date accordint to format.
     */
    date_to_string: function(year, month, day, separator) {
        if (Object.isUndefined(separator))
	 separator = this.separator;

        var a = [0, 0, 0];
        a[this._format_year_index]	= year;
        a[this._format_month_index] 	= month.toPaddedString(2);
        a[this._format_day_index] 	= day.toPaddedString(2);
        
        return a.join(separator);
    }
}; 


/**
 * DatePicker
 */

var DatePicker	= Class.create();

DatePicker.prototype	= {
 Version	: '0.9.4',
 _relative	: null,
 _div		: null,
 _zindex	: 1,
 _keepFieldEmpty: false,
 _daysInMonth	: [31,28,31,30,31,30,31,31,30,31,30,31],
 _dateFormat	: [ ["mm", "dd", "yyyy"], "/" ],
 /* language */
 _language	: 'en',
 _language_month	: $H({
  'fr'	: [ 'Janvier', 'F&#233;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 
   'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'D&#233;cembre' ],
  'en'	: [ 'January', 'February', 'March', 'April', 'May',
   'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
  'sp'	: [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 
   'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],
  'it'	: [ 'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno',
   'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre' ],
  'de'	: [ 'Januar', 'Februar', 'M&#228;rz', 'April', 'Mai', 'Juni',
   'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
  'pt'	: [ 'Janeiro', 'Fevereiro', 'Mar&#231;o', 'Abril', 'Maio', 'Junho',
   'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ],
  'hu'	: [ 'Janu&#225;r', 'Febru&#225;r', 'M&#225;rcius', '&#193;prilis', 
   'M&#225;jus', 'J&#250;nius', 'J&#250;lius', 'Augusztus', 'Szeptember', 
   'Okt&#243;ber', 'November', 'December' ],
  'lt'  : [ 'Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Gegu&#382;&#279;',
   'Bir&#382;elis', 'Liepa', 'Rugj&#363;tis', 'Rus&#279;jis', 'Spalis', 
   'Lapkritis', 'Gruodis' ],
  'nl'	: [ 'januari', 'februari', 'maart', 'april', 'mei', 'juni',
   'juli', 'augustus', 'september', 'oktober', 'november', 'december' ],
  'dk'	: [ 'Januar', 'Februar', 'Marts', 'April', 'Maj',
   'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December' ],
  'no'	: [ 'Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni',
   'Juli', 'August', 'September', 'Oktober', 'November', 'Desember' ],
  'lv'	: [ 'Janv&#257;ris', 'Febru&#257;ris', 'Marts', 'Apr&#299;lis', 'Maijs',
   'J&#363;nijs', 'J&#363;lijs', 'Augusts', 'Septembris', 'Oktobris', 
   'Novembris', 'Decemberis' ],
  'ja'	: [ '1&#26376;', '2&#26376;', '3&#26376;', '4&#26376;', '5&#26376;',
   '6&#26376;', '7&#26376;', '8&#26376;', '9&#26376;', '10&#26376;', 
   '11&#26376;', '12&#26376;' ],
  'fi'	: [ 'Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu', 'Toukokuu',
   'Kes&#228;kuu', 'Hein&#228;kuu', 'Elokuu', 'Syyskuu', 'Lokakuu', 
   'Marraskuu', 'Joulukuu' ],
  'ro'	: [ 'Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Junie',
   'Julie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie' ],
  'zh'	: [ '1&#32;&#26376;', '2&#32;&#26376;', '3&#32;&#26376;', 
   '4&#32;&#26376;', '5&#32;&#26376;', '6&#32;&#26376;', '7&#32;&#26376;', 
   '8&#32;&#26376;', '9&#32;&#26376;', '10&#26376;', '11&#26376;', '12&#26376;'],
  'sv'	: [ 'Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni',
   'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December' ]
 }),
 _language_day	: $H({
  'fr'	: [ 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim' ],
  'en'	: [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ],
  'sp'	: [ 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'S&#224;b', 'Dom' ],
  'it'	: [ 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab', 'Dom' ],
  'de'	: [ 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam', 'Son' ],
  'pt'	: [ 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&#225;', 'Dom' ],
  'hu'	: [ 'H&#233;', 'Ke', 'Sze', 'Cs&#252;', 'P&#233;', 'Szo', 'Vas' ],
  'lt'  : [ 'Pir', 'Ant', 'Tre', 'Ket', 'Pen', '&Scaron;e&scaron;', 'Sek' ],
  'nl'	: [ 'ma', 'di', 'wo', 'do', 'vr', 'za', 'zo' ],
  'dk'	: [ 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#248;r', 'S&#248;n' ],
  'no'	: [ 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#248;r', 'Sun' ],
  'lv'	: [ 'P', 'O', 'T', 'C', 'Pk', 'S', 'Sv' ],
  'ja'	: [ '&#26376;', '&#28779;', '&#27700;', '&#26408;', '&#37329;', 
   '&#22303;', '&#26085;' ],
  'fi'	: [ 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La', 'Su' ],
  'ro'	: [ 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam', 'Dum' ],
  'zh'	: [ '&#21608;&#19968;', '&#21608;&#20108;', '&#21608;&#19977;', 
   '&#21608;&#22235;', '&#21608;&#20116;', '&#21608;&#20845;', 
   '&#21608;&#26085;' ],
  'sv'	: [ 'M&#229;n', 'Tis', 'Ons', 'Tor', 'Fre', 'L&#246;r', 
   'S&#246;n' ]
 }),
 _language_close	: $H({
  'fr'	: 'fermer',
  'en'	: 'Close',
  'sp'	: 'cierre',
  'it'	: 'fine',
  'de'	: 'schliessen',
  'pt'	: 'fim',
  'hu'	: 'bez&#225;r',
  'lt'  : 'udaryti',
  'nl'	: 'sluiten',
  'dk'	: 'luk',
  'no'	: 'lukk',
  'lv'	: 'aizv&#275;rt',
  'ja'	: '&#38281;&#12376;&#12427;',
  'fi'	: 'sulje',
  'ro'	: 'inchide',
  'zh'	: '&#20851;&#32;&#38381',
  'sv'	: 'st&#228;ng'
 }),
 /* date manipulation */
 _todayDate		: new Date(),
 _current_date		: null,
 _clickCallback		: Prototype.emptyFunction,
 _cellCallback		: Prototype.emptyFunction,
 _id_datepicker		: null,
 _disablePastDate	: false,
 _disableFutureDate	: true,
 _oneDayInMs		: 24 * 3600 * 1000,
 /* positionning */
 _topOffset		: 30,
 _leftOffset		: 0,
 _isPositionned		: false,
 _relativePosition 	: true,
 _setPositionTop 	: 0,
 _setPositionLeft	: 0,
 _bodyAppend		: false,
 /* Effects Adjustment */
 _showEffect		: "appear", 
 _showDuration		: 1,
 _enableShowEffect 	: true,
 _closeEffect		: "fade", 
 _closeEffectDuration	: 0.3,
 _enableCloseEffect 	: true,
 _closeTimer		: null,
 _enableCloseOnBlur	: false,
 /* afterClose : called when the close function is executed */
 _afterClose	: Prototype.emptyFunction,
 /* return the name of current month in appropriate language */
 getMonthLocale	: function ( month ) {
  return	this._language_month.get(this._language)[month];
 },
 getLocaleClose	: function () {
  return	this._language_close.get(this._language);
 },
 _initCurrentDate : function () {
  /* Create the DateFormatter */
  this._df = new DatePickerFormatter(this._dateFormat[0], this._dateFormat[1]);
  /* check if value in field is proper, if not set to today */
  this._current_date = $F(this._relative);
  if (! this._df.match(this._current_date)) {
    this._current_date = this._df.current_date();
   /* set the field value ? */
   if (!this._keepFieldEmpty)
    $(this._relative).value = this._current_date;
  }
  var a_date = this._df.match(this._current_date);
  this._current_year 	= Number(a_date[0]);
  this._current_mon	= Number(a_date[1]) - 1;
  this._current_day	= Number(a_date[2]);
 },
 /* init */
 initialize	: function ( h_p ) {
  /* arguments */
  this._relative= h_p["relative"];
  if (h_p["language"])
   this._language = h_p["language"];
  this._zindex	= ( h_p["zindex"] ) ? parseInt(Number(h_p["zindex"])) : 1;
  if (!Object.isUndefined(h_p["keepFieldEmpty"]))
   this._keepFieldEmpty	= h_p["keepFieldEmpty"];
  if (Object.isFunction(h_p["clickCallback"])) 
   this._clickCallback	= h_p["clickCallback"];
  if (!Object.isUndefined(h_p["leftOffset"]))
   this._leftOffset	= parseInt(h_p["leftOffset"]);
  if (!Object.isUndefined(h_p["topOffset"]))
   this._topOffset	= parseInt(h_p["topOffset"]);
  if (!Object.isUndefined(h_p["relativePosition"]))
   this._relativePosition = h_p["relativePosition"];
  if (!Object.isUndefined(h_p["showEffect"]))
   this._showEffect 	= h_p["showEffect"];
  if (!Object.isUndefined(h_p["enableShowEffect"]))
   this._enableShowEffect	= h_p["enableShowEffect"];
  if (!Object.isUndefined(h_p["showDuration"]))
   this._showDuration 	= h_p["showDuration"];
  if (!Object.isUndefined(h_p["closeEffect"]))
   this._closeEffect 	= h_p["closeEffect"];
  if (!Object.isUndefined(h_p["enableCloseEffect"]))
   this._enableCloseEffect	= h_p["enableCloseEffect"];
  if (!Object.isUndefined(h_p["closeEffectDuration"]))
   this._closeEffectDuration = h_p["closeEffectDuration"];
  if (Object.isFunction(h_p["afterClose"]))
   this._afterClose	= h_p["afterClose"];
  if (!Object.isUndefined(h_p["externalControl"]))
   this._externalControl= h_p["externalControl"];
  if (!Object.isUndefined(h_p["dateFormat"])) 
   this._dateFormat	= h_p["dateFormat"];
  if (Object.isFunction(h_p["cellCallback"]))
   this._cellCallback	= h_p["cellCallback"];
  this._setPositionTop	= ( h_p["setPositionTop"] ) ? 
   parseInt(Number(h_p["setPositionTop"])) : 0;
  this._setPositionLeft	= ( h_p["setPositionLeft"] ) ? 
   parseInt(Number(h_p["setPositionLeft"])) : 0;
  if (!Object.isUndefined(h_p["enableCloseOnBlur"]) && h_p["enableCloseOnBlur"])
   this._enableCloseOnBlur	= true;
  if (!Object.isUndefined(h_p["disablePastDate"]) && h_p["disablePastDate"])
   this._disablePastDate	= true;
  if (!Object.isUndefined(h_p["disableFutureDate"]) && 
   !h_p["disableFutureDate"])
   this._disableFutureDate	= false;
  this._id_datepicker		= 'datepicker-'+this._relative;
  this._id_datepicker_prev	= this._id_datepicker+'-prev';
  this._id_datepicker_next	= this._id_datepicker+'-next';
  this._id_datepicker_hdr	= this._id_datepicker+'-header';
  this._id_datepicker_ftr	= this._id_datepicker+'-footer';

  /* build up calendar skel */
  this._div = new Element('div', { 
   id : this._id_datepicker,
   className : 'datepicker',
   style : 'display: none; z-index:'+this._zindex });
  this._div.innerHTML = '<table><thead><tr><th width="10px" id="'+this._id_datepicker_prev+'" style="cursor: pointer;">&nbsp;&laquo;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="5"></th><th width="10px" id="'+this._id_datepicker_next+'" style="cursor: pointer;">&nbsp;&raquo;&nbsp;</th></tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tfoot></table>';
  /* finally declare the event listener on input field */
  Event.observe(this._relative, 
    'click', this.click.bindAsEventListener(this), false);
  /* need to append on body when doc is loaded for IE */
  document.observe('dom:loaded', this.load.bindAsEventListener(this), false);
  /* automatically close when blur event is triggered */
  if ( this._enableCloseOnBlur ) {
   Event.observe(this._relative, 'blur', function (e) { 
    this._closeTimer = this.close.bind(this).delay(1); 
   }.bindAsEventListener(this));
   Event.observe(this._div, 'click', function (e) { 
    if (this._closeTimer) { 
     window.clearTimeout(this._closeTimer); 
     this._closeTimer = null; 
    } 
   });
  }
 },
 /**
  * load	: called when document is fully-loaded to append datepicker
  *		  to main object.
  */
 load		: function () {
  /* if externalControl defined set the observer on it */
  if (this._externalControl) 
   Event.observe(this._externalControl, 'click',
    this.click.bindAsEventListener(this), false);
  /* append to page */
  if (this._relativeAppend) {
   /* append to parent node */
   if ($(this._relative).parentNode) {
    this._div.innerHTML = this._wrap_in_iframe(this._div.innerHTML);
    $(this._relative).parentNode.appendChild( this._div );
   }
  } else {
   /* append to body */
   var body	= document.getElementsByTagName("body").item(0);
   if (body) {
    this._div.innerHTML = this._wrap_in_iframe(this._div.innerHTML);
    body.appendChild(this._div);
   }
   if ( this._relativePosition ) {
     var a_pos = Element.cumulativeOffset($(this._relative));
     this.setPosition(a_pos[1], a_pos[0]);
   } else {
    if (this._setPositionTop || this._setPositionLeft)
     this.setPosition(this._setPositionTop, this._setPositionLeft);
   }
  }
  /* init the date in field if needed */
  this._initCurrentDate();
  /* set the close locale content */
  $(this._id_datepicker_ftr).innerHTML = this.getLocaleClose();
  /* declare the observers for UI control */
  Event.observe($(this._id_datepicker_prev), 
    'click', this.prevMonth.bindAsEventListener(this), false);
  Event.observe($(this._id_datepicker_next), 
    'click', this.nextMonth.bindAsEventListener(this), false);
  Event.observe($(this._id_datepicker_ftr), 
    'click', this.close.bindAsEventListener(this), false);
 },
 /* hack for buggy form elements layering in IE */
 _wrap_in_iframe	: function ( content ) {
  return	( Prototype.Browser.IE ) ?
   "<div style='height:167px;width:185px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;width:180px'>" + content + "</div></div>" : content;
 },
 /**
  * visible	: return the visibility status of the datepicker.
  */
 visible	: function () {
  return	$(this._id_datepicker).visible();
 },
 /**
  * click	: called when input element is clicked
  */
 click		: function () {
  /* init the datepicker if it doesn't exists */
  if ( $(this._id_datepicker) == null ) this.load();
  if (!this._isPositionned && this._relativePosition) {
   /* position the datepicker relatively to element */
   var a_lt = Element.positionedOffset($(this._relative));
   $(this._id_datepicker).setStyle({
    'left'	: Number(a_lt[0]+this._leftOffset)+'px',
    'top'	: Number(a_lt[1]+this._topOffset)+'px'
   });
   this._isPositionned	= true;
  }
  if (!this.visible()) {
   this._initCurrentDate();
   this._redrawCalendar();
  }
  /* eval the clickCallback function */
  eval(this._clickCallback());
  /* Effect toggle to fade-in / fade-out the datepicker */
  if ( this._enableShowEffect ) {
   new Effect.toggle(this._id_datepicker, 
     this._showEffect, { duration: this._showDuration });
  } else {
   $(this._id_datepicker).show();
  }
 },
 /**
  * close	: called when the datepicker is closed
  */
 close		: function () {
  if ( this._enableCloseEffect ) {
   switch(this._closeEffect) {
    case 'puff': 
     new Effect.Puff(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
    case 'blindUp': 
     new Effect.BlindUp(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
    case 'dropOut': 
     new Effect.DropOut(this._id_datepicker, { 
      duration : this._closeEffectDuration }); 
     break;
    case 'switchOff': 
     new Effect.SwitchOff(this._id_datepicker, { 
      duration : this._closeEffectDuration }); 
     break;
    case 'squish': 
     new Effect.Squish(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
    case 'fold': 
     new Effect.Fold(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
    case 'shrink': 
     new Effect.Shrink(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
    default: 
     new Effect.Fade(this._id_datepicker, { 
      duration : this._closeEffectDuration });
     break;
   };
  } else {
   $(this._id_datepicker).hide();
  }
  eval(this._afterClose());
 },
 /**
  * setDateFormat
  */
 setDateFormat	: function ( format, separator ) {
  if (Object.isUndefined(format))
   format	= this._dateFormat[0];
  if (Object.isUndefined(separator))
   separator	= this._dateFormat[1];
  this._dateFormat	= [ format, separator ];
 },
 /**
  * setPosition	: set the position of the datepicker.
  *  param : t=top | l=left
  */
 setPosition	: function ( t, l ) {
  var h_pos	= { 'top' : '0px', 'left' : '0px' };
  if (!Object.isUndefined(t))
   h_pos['top']	= Number(t)+this._topOffset+'px';
  if (!Object.isUndefined(l))
   h_pos['left']= Number(l)+this._leftOffset+'px';
  $(this._id_datepicker).setStyle(h_pos);
  this._isPositionned	= true;
 },
 /**
  * _getMonthDays : given the year and month find the number of days.
  */
 _getMonthDays	: function ( year, month ) {
  if (((0 == (year%4)) && 
   ( (0 != (year%100)) || (0 == (year%400)))) && (month == 1))
   return 29;
  return this._daysInMonth[month];
 },
 /**
  * _buildCalendar	: draw the days array for current date
  */
 _buildCalendar		: function () {
  var _self	= this;
  var tbody	= $(this._id_datepicker+'-tbody');
  try {
   while ( tbody.hasChildNodes() )
    tbody.removeChild(tbody.childNodes[0]);
  } catch ( e ) {};
  /* generate day headers */
  var trDay	= new Element('tr');
  this._language_day.get(this._language).each( function ( item ) {
   var td	= new Element('td');
   td.innerHTML	= item;
   td.className	= 'wday';
   trDay.appendChild( td );
  });
  tbody.appendChild( trDay );
  /* generate the content of days */
  
  /* build-up days matrix */
  var a_d	= [ [ 0, 0, 0, 0, 0, 0, 0 ] ,[ 0, 0, 0, 0, 0, 0, 0 ]
   ,[ 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0 ]
   ,[ 0, 0, 0, 0, 0, 0, 0 ]
  ];
  /* set date at beginning of month to display */
  var d		= new Date(this._current_year, this._current_mon, 1, 12);
  /* start the day list on monday */
  var startIndex	= ( !d.getDay() ) ? 6 : d.getDay() - 1;
  var nbDaysInMonth	= this._getMonthDays(
    this._current_year, this._current_mon);
  var daysIndex		= 1;
  for ( var j = startIndex; j < 7; j++ ) {
   a_d[0][j]	= { 
     d : daysIndex
    ,m : this._current_mon
    ,y : this._current_year 
   };
   daysIndex++;
  }
  var a_prevMY	= this._prevMonthYear();
  var nbDaysInMonthPrev	= this._getMonthDays(a_prevMY[1], a_prevMY[0]);
  for ( var j = 0; j < startIndex; j++ ) {
   a_d[0][j]	= { 
     d : Number(nbDaysInMonthPrev - startIndex + j + 1) 
    ,m : Number(a_prevMY[0])
    ,y : a_prevMY[1]
    ,c : 'outbound'
   };
  }
  var switchNextMonth	= false;
  var currentMonth	= this._current_mon;
  var currentYear	= this._current_year;
  for ( var i = 1; i < 6; i++ ) {
   for ( var j = 0; j < 7; j++ ) {
    a_d[i][j]	= { 
      d : daysIndex
     ,m : currentMonth
     ,y : currentYear
     ,c : ( switchNextMonth ) ? 'outbound' : ( 
      ((daysIndex == this._todayDate.getDate()) &&
        (this._current_mon  == this._todayDate.getMonth()) &&
        (this._current_year == this._todayDate.getFullYear())) ? 'today' : null)
    };
    daysIndex++;
    /* if at the end of the month : reset counter */
    if (daysIndex > nbDaysInMonth ) {
     daysIndex	= 1;
     switchNextMonth = true;
     if (this._current_mon + 1 > 11 ) {
      currentMonth = 0;
      currentYear += 1;
     } else {
      currentMonth += 1;
     }
    }
   }
  }
  /* generate days for current date */
  for ( var i = 0; i < 6; i++ ) {
   var tr	= new Element('tr');
   for ( var j = 0; j < 7; j++ ) {
    var h_ij	= a_d[i][j];
    var td	= new Element('td');
    /* id is : datepicker-day-mon-year or depending on language other way */
    /* don't forget to add 1 on month for proper formmatting */
    var id	= $A([
     this._relative,
     this._df.date_to_string(h_ij["y"], h_ij["m"]+1, h_ij["d"], '-')
    ]).join('-');
    /* set id and classname for cell if exists */
    td.setAttribute('id', id);
    if (h_ij["c"])
     td.className	= h_ij["c"];
    /* on onclick : rebuild date value from id of current cell */
    var _curDate	= new Date();
    _curDate.setFullYear(h_ij["y"], h_ij["m"], h_ij["d"]);
    if ( this._disablePastDate || this._disableFutureDate ) {
     if ( this._disablePastDate ) {
      var _res	= ( _curDate >= this._todayDate ) ? true : false;
      this._bindCellOnClick( td, true, _res, h_ij["c"] );
     }
     if ( this._disableFutureDate ) {
      var _res	= ( this._todayDate.getTime() + this._oneDayInMs > _curDate.getTime() ) ? true : false;
      this._bindCellOnClick( td, true, _res,  h_ij["c"] );
     }
    } else {
     this._bindCellOnClick( td, false );
    }
    td.innerHTML= h_ij["d"];
    tr.appendChild( td );
   }
   tbody.appendChild( tr );
  }
  return	tbody;
 },
 /**
  * _bindCellOnClick	: bind the cell onclick depending on status.
  */
 _bindCellOnClick	: function ( td, wcompare, compareresult, h_ij_c ) {
  var doBind	= false;
  if ( wcompare ) {
   if ( compareresult ) {
    doBind	= true;
   } else {
    td.className= ( h_ij_c ) ? 'nclick_outbound' : 'nclick';
   }
  } else {
   doBind	= true;
  }
  if ( doBind ) {
   var _self	= this;
   td.onclick	= function () { 
    $(_self._relative).value = String($(this).readAttribute('id')
      ).replace(_self._relative+'-','').replace(/-/g, _self._df.separator);
    /* if we have a cellCallback defined call it and pass it the cell */
    if (_self._cellCallback)
     _self._cellCallback(this);
    _self.close(); 
   };
  }
 },
 /**
  * nextMonth	: redraw the calendar content for next month.
  */
 _nextMonthYear	: function () {
  var c_mon	= this._current_mon;
  var c_year	= this._current_year;
  if (c_mon + 1 > 11) {
   c_mon	= 0;
   c_year	+= 1;
  } else {
   c_mon	+= 1;
  }
  return	[ c_mon, c_year ];
 },
 nextMonth	: function () {
  var a_next	= this._nextMonthYear();
  var _nextMon	= a_next[0];
  var _nextYear	= a_next[1];
  var _curDate	= new Date(); _curDate.setFullYear(_nextYear, _nextMon, 1);
  var _res	= ( this._todayDate.getTime() + this._oneDayInMs > _curDate.getTime() ) ? true : false;
  if ( this._disableFutureDate && !_res )
   return;
  this._current_mon	= _nextMon;
  this._current_year 	= _nextYear;
  this._redrawCalendar();
 },
 /**
  * prevMonth	: redraw the calendar content for previous month.
  */
 _prevMonthYear	: function () {
  var c_mon	= this._current_mon;
  var c_year	= this._current_year;
  if (c_mon - 1 < 0) {
   c_mon	= 11;
   c_year	-= 1;
  } else {
   c_mon	-= 1;
  }
  return	[ c_mon, c_year ];
 },
 prevMonth	: function () {
  var a_prev	= this._prevMonthYear();
  var _prevMon	= a_prev[0];
  var _prevYear	= a_prev[1];
  var _curDate	= new Date(); _curDate.setFullYear(_prevYear, _prevMon, 1);
  var _res	= ( _curDate >= this._todayDate ) ? true : false;
  if ( this._disablePastDate && !_res )
   return;
  this._current_mon	= _prevMon;
  this._current_year	= _prevYear;
  this._redrawCalendar();
 },
 _redrawCalendar	: function () {
  this._setLocaleHdr(); this._buildCalendar();
 },
 _setLocaleHdr	: function () {
  /* next link */
  var a_next	= this._nextMonthYear();
  $(this._id_datepicker_next).setAttribute('title',
   this.getMonthLocale(a_next[0])+' '+a_next[1]);
  /* prev link */
  var a_prev	= this._prevMonthYear();
  $(this._id_datepicker_prev).setAttribute('title',
   this.getMonthLocale(a_prev[0])+' '+a_prev[1]);
  /* header */
  $(this._id_datepicker_hdr).update('&nbsp;&nbsp;&nbsp;'+this.getMonthLocale(this._current_mon)+'&nbsp;'+this._current_year+'&nbsp;&nbsp;&nbsp;');
 }
};
//  Lightview 2.2.9.2 - 21-05-2008//  Copyright (c) 2008 Nick Stakenburg (http://www.nickstakenburg.com)////  Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License//  http://creativecommons.org/licenses/by-nc-nd/3.0///  More information on this project://  http://www.nickstakenburg.com/projects/lightview/var Lightview = {  Version: '2.2.9.2',  // Configuration  options: {    backgroundColor: '#ffffff',                            // Background color of the view    border: 12,                                            // Size of the border    buttons: {      opacity: {                                           // Opacity of inner buttons        disabled: 0.4,        normal: 0.75,        hover: 1      },      side: { display: true },                             // show side buttons      innerPreviousNext: { display: true },                // show the inner previous and next button      slideshow: { display: true }                         // show slideshow button    },    cyclic: false,                                         // Makes galleries cyclic, no end/begin.    images: '../images/lightview/',                        // The directory of the images, relative to this file or an absolute url    imgNumberTemplate: 'Image #{position} of #{total}',    // Want a different language? change it here    keyboard: { enabled: true },                           // Enabled the keyboard buttons    overlay: {                                             // Overlay      background: '#000',                                  // Background color, Mac Firefox & Safari use overlay.png      close: true,                                         // Overlay click closes the view      opacity: 0.3,      display: true    },    preloadHover: true,                                    // Preload images on mouseover    radius: 12,                                            // Corner radius of the border    removeTitles: true,                                    // Set to false if you want to keep title attributes intact    resizeDuration: 0.9,                                   // When effects are used, the duration of resizing in seconds    slideshowDelay: 5,                                     // Seconds to wait before showing the next slide in slideshow    titleSplit: '::',                                      // The characters you want to split title with    transition: function(pos) {                            // Or your own transition      return ((pos/=0.5) < 1 ? 0.5 * Math.pow(pos, 4) :        -0.5 * ((pos-=2) * Math.pow(pos,3) - 2));    },    viewport: true,                                        // Stay within the viewport, true is recommended    zIndex: 5000,                                          // zIndex of #lightview, #overlay is this -1    // Optional    closeDimensions: {                                     // If you've changed the close button you can change these      large: { width: 85, height: 22 },                    // not required but it speeds things up.      small: { width: 32, height: 22 },      innertop: { width: 22, height: 22 },      topclose: { width: 22, height: 18 }                  // when topclose option is used    },    defaultOptions : {                                     // Default open dimensions for each type      ajax:   { width: 400, height: 300 },      iframe: { width: 400, height: 300, scrolling: true },      inline: { width: 400, height: 300 },      flash:  { width: 400, height: 300 },      quicktime: { width: 480, height: 220, autoplay: true, controls: true, topclose: true }    },    sideDimensions: { width: 16, height: 22 }              // see closeDimensions  },  classids: {    quicktime: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',    flash: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  },  codebases: {    quicktime: 'http://www.apple.com/qtactivex/qtplugin.cab#version=7,3,0,0',    flash: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'  },  errors: {    requiresPlugin: "<div class='message'>The content your are attempting to view requires the <span class='type'>#{type}</span> plugin.</div><div class='pluginspage'><p>Please download and install the required plugin from:</p><a href='#{pluginspage}' target='_blank'>#{pluginspage}</a></div>"  },  mimetypes: {    quicktime: 'video/quicktime',    flash: 'application/x-shockwave-flash'  },  pluginspages: {    quicktime: 'http://www.apple.com/quicktime/download',    flash: 'http://www.adobe.com/go/getflashplayer'  },  // used with auto detection  typeExtensions: {    flash: 'swf',    image: 'bmp gif jpeg jpg png',    iframe: 'asp aspx cgi cfm htm html jsp php pl php3 php4 php5 phtml rb rhtml shtml txt',    quicktime: 'avi mov mpg mpeg movie'  }};eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1d.4s=(h(B){q A=k 4Y("8J ([\\\\d.]+)").81(B);S A?7A(A[1]):-1})(2N.57);10.1h(W.13,{2u:W.13.2w&&(1d.4s>=6&&1d.4s<7),2t:(W.13.3r&&!1f.4h)});10.1h(1d,{7g:"1.6.0.2",9V:"1.8.1",X:{1i:"4R",3j:"12"},6d:!!2N.57.3L(/6b/i),4C:!!2N.57.3L(/6b/i)&&(W.13.3r||W.13.2k),4w:h(A){f((80 2b[A]=="7Q")||(9.4k(2b[A].7H)<9.4k(9["5D"+A]))){7C("1d 7z "+A+" >= "+9["5D"+A]);}},4k:h(A){q B=A.2D(/5u.*|\\./g,"");B=49(B+"0".7b(4-B.21));S A.22("5u")>-1?B-1:B},6X:h(){9.4w("W");f(!!2b.11&&!2b.6R){9.4w("6R")}f(9.m.1g.6D("://")){9.1g=9.m.1g}Z{q A=/12(?:-[\\w\\d.]+)?\\.9g(.*)/;9.1g=(($$("9a 93[1v]").6l(h(B){S B.1v.3L(A)})||{}).1v||"").2D(A,"")+9.m.1g}f(W.13.2w&&!1f.6k.v){1f.6k.6e("v","8F:8D-8A-8z:8v");1f.19("4E:4B",h(){1f.8l().8k("v\\\\:*","8i: 3d(#61#88);")})}},4J:h(){9.2H=9.m.2H;9.1b=(9.2H>9.m.1b)?9.2H:9.m.1b;9.1E=9.m.1E;9.1D=9.m.1D;9.5R();9.5P();9.5M()},5R:h(){q B,I,D=9.1V(9.1D);$(1f.41).z(9.1F=k y("Y",{2T:"1F"}).r({3p:9.m.3p-1,1i:(!(W.13.2k||W.13.2u))?"4c":"3q",2y:9.4C?"3d("+9.1g+"1F.1J) 1k 1p 2G":9.m.1F.2y}).1t((W.13.2k)?1:9.m.1F.1B).15()).z(9.12=k y("Y",{2T:"12"}).r({3p:9.m.3p,1k:"-3o",1p:"-3o"}).1t(0).z(9.5m=k y("Y",{V:"75"}).z(9.43=k y("3m",{V:"a0"}).z(9.6V=k y("1K",{V:"9S"}).r(I=10.1h({1w:-1*9.1D.o+"u"},D)).z(9.3X=k y("Y",{V:"4O"}).r(10.1h({1w:9.1D.o+"u"},D)).z(k y("Y",{V:"23"})))).z(9.6E=k y("1K",{V:"9s"}).r(10.1h({6x:-1*9.1D.o+"u"},D)).z(9.3T=k y("Y",{V:"4O"}).r(I).z(k y("Y",{V:"23"}))))).z(9.4X=k y("Y",{V:"9j"}).z(9.51=k y("Y",{V:"4O 9d"}).z(9.4N=k y("Y",{V:"23"})))).z(k y("3m",{V:"96"}).z(k y("1K",{V:"6P 8Z"}).z(B=k y("Y",{V:"8W"}).r({n:9.1b+"u"}).z(k y("3m",{V:"6m 8N"}).z(k y("1K",{V:"6j"}).z(k y("Y",{V:"40"})).z(k y("Y",{V:"2Y"}).r({1p:9.1b+"u"})))).z(k y("Y",{V:"6h"})).z(k y("3m",{V:"6m 8I"}).z(k y("1K",{V:"6j"}).r("3f-1k: "+(-1*9.1b)+"u").z(k y("Y",{V:"40"})).z(k y("Y",{V:"2Y"}).r("1p: "+(-1*9.1b)+"u")))))).z(9.3O=k y("1K",{V:"8E"}).r("n: "+(8C-9.1b)+"u").z(k y("Y",{V:"8B"}).z(k y("Y",{V:"6c"}).r("3f-1k: "+9.1b+"u").z(9.2s=k y("Y",{V:"8y"}).1t(0).r("3G: 0 "+9.1b+"u").z(9.2c=k y("Y",{V:"8t 2Y"})).z(9.1R=k y("Y",{V:"8q"}).z(9.2F=k y("Y",{V:"23 8n"}).r(9.1V(9.m.1E.3E)).r({2y:9.m.17}).1t(9.m.1I.1B.2v)).z(9.3B=k y("3m",{V:"8j"}).z(9.4z=k y("1K",{V:"8h"}).z(9.1u=k y("Y",{V:"8f"})).z(9.1Q=k y("Y",{V:"8b"}))).z(9.3z=k y("1K",{V:"87"}).z(k y("Y"))).z(9.4v=k y("1K",{V:"82"}).z(9.7Z=k y("Y",{V:"23"}).1t(9.m.1I.1B.2v).r({17:9.m.17}).2f(9.1g+"7X.1J",{17:9.m.17})).z(9.7W=k y("Y",{V:"23"}).1t(9.m.1I.1B.2v).r({17:9.m.17}).2f(9.1g+"7V.1J",{17:9.m.17}))).z(9.2n=k y("1K",{V:"7S"}).z(9.2x=k y("Y",{V:"23"}).1t(9.m.1I.1B.2v).r({17:9.m.17}).2f(9.1g+"4n.1J",{17:9.m.17}))))).z(9.1L=k y("Y",{V:"7M"}))))).z(9.2V=k y("Y",{V:"7L"}).z(9.6O=k y("Y",{V:"23"}).r("2y: 3d("+9.1g+"2V.4l) 1k 1p 3W-2G")))).z(k y("1K",{V:"6P 7J"}).z(B.7I(1T))).z(9.1G=k y("1K",{V:"7G"}).15().r("3f-1k: "+9.1b+"u; 2y: 3d("+9.1g+"7E.4l) 1k 1p 2G"))))).z(k y("Y",{2T:"36"}).15());q H=k 2j();H.1s=h(){H.1s=W.26;9.1D={o:H.o,n:H.n};q K=9.1V(9.1D),C;9.43.r({1O:0-(H.n/2).2m()+"u",n:H.n+"u"});9.6V.r(C=10.1h({1w:-1*9.1D.o+"u"},K));9.3X.r(10.1h({1w:K.o},K));9.6E.r(10.1h({6x:-1*9.1D.o+"u"},K));9.3T.r(C)}.U(9);H.1v=9.1g+"28.1J";$w("2s 1u 1Q 3z").1a(h(C){9[C].r({17:9.m.17})}.U(9));q G=9.5m.31(".40");$w("7t 7q 7p 5w").1a(h(K,C){f(9.2H>0){9.5t(G[C],K)}Z{G[C].z(k y("Y",{V:"2Y"}))}G[C].r({o:9.1b+"u",n:9.1b+"u"}).7m("40"+K.24())}.U(9));9.12.31(".6h",".2Y",".6c").3w("r",{17:9.m.17});q E={};$w("28 1e 2o").1a(h(K){9[K+"2U"].2Z=K;q C=9.1g+K+".1J";f(K=="2o"){E[K]=k 2j();E[K].1s=h(){E[K].1s=W.26;9.1E[K]={o:E[K].o,n:E[K].n};q L=9.6d?"1p":"7e",M=10.1h({"7a":L,1O:9.1E[K].n+"u"},9.1V(9.1E[K]));M["3G"+L.24()]=9.1b+"u";9[K+"2U"].r(M);9.4X.r({n:E[K].n+"u",1k:-1*9.1E[K].n+"u"});9[K+"2U"].5W().2f(C).r(9.1V(9.1E[K]))}.U(9);E[K].1v=9.1g+K+".1J"}Z{9[K+"2U"].2f(C)}}.U(9));q A={};$w("3E 48 47").1a(h(C){A[C]=k 2j();A[C].1s=h(){A[C].1s=W.26;9.1E[C]={o:A[C].o,n:A[C].n}}.U(9);A[C].1v=9.1g+"5o"+C+".1J"}.U(9));q J=k 2j();J.1s=h(){J.1s=W.26;9.2V.r({o:J.o+"u",n:J.n+"u",1O:-0.5*J.n+0.5*9.1b+"u",1w:-0.5*J.o+"u"})}.U(9);J.1v=9.1g+"2V.4l";q F=k 2j();F.1s=h(){F.1s=W.26;q C={o:F.o+"u",n:F.n+"u"};9.2n.r(C);9.2x.r(C)}.U(9);F.1v=9.1g+"4n.1J";$w("28 1e").1a(h(L){q K=L.24(),C=k 2j();C.1s=h(){C.1s=W.26;9["2J"+K+"2z"].r({o:C.o+"u",n:C.n+"u"})}.U(9);C.1v=9.1g+"74"+L+".1J";9["2J"+K+"2z"].1G=L}.U(9))},5i:h(){11.2K.2Q("12").1a(h(A){A.6Y()});9.1x=1o;9.5f();9.1j=1o},5f:h(){f(!9.3c||!9.3k){S}9.3k.z({9U:9.3c.r({1N:9.3c.6S})});9.3k.1Y();9.3k=1o},18:h(B){9.1q=1o;f(10.6Q(B)||10.6N(B)){9.1q=$(B);f(!9.1q){S}9.1q.9y();9.j=9.1q.1U}Z{f(B.1c){9.1q=$(1f.41);9.j=k 1d.55(B)}Z{f(10.6G(B)){9.1q=9.54(9.j.1n).4S[B];9.j=9.1q.1U}}}f(!9.j.1c){S}9.5i();9.4P();9.6p();9.6z();9.3g();9.6w();f(9.j.1c!="#36"&&10.6u(1d.4W).6s(" ").22(9.j.14)>=0){f(!1d.4W[9.j.14]){$("36").1C(k 6q(9.9e.9c).4h({14:9.j.14.24(),59:9.56[9.j.14]}));q C=$("36").2S();9.18({1c:"#36",1u:9.j.14.24()+" 95 94",m:C});S 2l}}f(9.j.1A()){9.1j=9.j.1A()?9.5d(9.j.1n):[9.j]}q A=10.1h({1R:1T,2o:2l,5c:"8V",4M:9.j.1A()&&9.m.1I.4M.1N,2n:9.j.1A()&&9.m.1I.2n.1N},9.m.8S[9.j.14]||{});9.j.m=10.1h(A,9.j.m);f(!(9.j.1u||9.j.1Q||(9.1j&&9.1j.21>1))&&9.j.m.2o){9.j.m.1R=2l}f(9.j.2O()){f(9.j.1A()){9.1i=9.1j.22(9.j);9.6T()}9.1y=9.j.3Z;f(9.1y){9.3Q()}Z{9.4L();q D=k 2j();D.1s=h(){D.1s=W.26;9.3R();9.1y={o:D.o,n:D.n};9.3Q()}.U(9);D.1v=9.j.1c}}Z{9.1y=9.j.m.4K?1f.2I.2S():{o:9.j.m.o,n:9.j.m.n};9.3Q()}},4I:h(){q D=9.6i(9.j.1c),A=9.1x||9.1y;f(9.j.2O()){q B=9.1V(A);9.2c.r(B).1C(k y("6g",{2T:"29",1v:9.j.1c,8H:"",8G:"3W"}).r(B))}Z{f(9.j.3P()){f(9.1x&&9.j.m.4K){A.n-=9.3e.n}3N(9.j.14){2h"32":q F=10.3M(9.j.m.32)||{};q E=h(){9.3R();f(9.j.m.4G){9.1L.r({o:"3K",n:"3K"});9.1y=9.3J(9.1L)}k 11.1m({X:9.X,1r:9.3I.U(9)})}.U(9);f(F.3H){F.3H=F.3H.1S(h(N,M){E();N(M)})}Z{F.3H=E}9.4L();k 8x.8w(9.1L,9.j.1c,F);2e;2h"1Z":9.1L.1C(9.1Z=k y("1Z",{8u:0,8s:0,1v:9.j.1c,2T:"29",1P:"8r"+(6a.8p()*8o).2m(),69:(9.j.m&&9.j.m.69)?"3K":"3W"}).r(10.1h({1b:0,3f:0,3G:0},9.1V(A))));2e;2h"3F":q C=9.j.1c,H=$(C.68(C.22("#")+1));f(!H||!H.4D){S}q L=k y(9.j.m.8m||"Y"),G=H.1M("1H"),J=H.1M("1N");H.1S(L);H.r({1H:"3D"}).18();q I=9.3J(L);H.r({1H:G,1N:J});L.z({67:H}).1Y();H.z({67:9.3k=k y(H.4D)});H.6S=H.1M("1N");9.3c=H.18();9.1L.1C(9.3c);9.1L.31("31, 3a, 66").1a(h(M){9.3C.1a(h(N){f(N.1q==M){M.r({1H:N.1H})}})}.U(9));f(9.j.m.4G){9.1y=I;k 11.1m({X:9.X,1r:9.3I.U(9)})}2e}}Z{q K={1z:"3a",2T:"29",o:A.o,n:A.n};3N(9.j.14){2h"2M":10.1h(K,{59:9.56[9.j.14],2L:[{1z:"1W",1P:"64",2g:9.j.m.64},{1z:"1W",1P:"63",2g:"8g"},{1z:"1W",1P:"4y",2g:9.j.m.4x},{1z:"1W",1P:"8e",2g:1T},{1z:"1W",1P:"1v",2g:9.j.1c},{1z:"1W",1P:"62",2g:9.j.m.62||2l}]});10.1h(K,W.13.2w?{8d:9.8c[9.j.14],8a:9.89[9.j.14]}:{3B:9.j.1c,14:9.5Z[9.j.14]});2e;2h"3l":10.1h(K,{3B:9.j.1c,14:9.5Z[9.j.14],86:"85",5c:9.j.m.5c,59:9.56[9.j.14],2L:[{1z:"1W",1P:"84",2g:9.j.1c},{1z:"1W",1P:"83",2g:"1T"}]});f(9.j.m.5Y){K.2L.2P({1z:"1W",1P:"7Y",2g:9.j.m.5Y})}2e}9.2c.r(9.1V(A)).18();9.2c.1C(9.4u(K));f(9.j.4t()&&$("29")){(h(){3V{f("5V"5U $("29")){$("29").5V(9.j.m.4x)}}3U(M){}}.U(9)).2R(0.4)}}}},3J:h(B){B=$(B);q A=B.7U(),C=[],E=[];A.2P(B);A.1a(h(F){f(F!=B&&F.3y()){S}C.2P(F);E.2P({1N:F.1M("1N"),1i:F.1M("1i"),1H:F.1M("1H")});F.r({1N:"5T",1i:"3q",1H:"3y"})});q D={o:B.7T,n:B.7R};C.1a(h(G,F){G.r(E[F])});S D},4p:h(){q A=$("29");f(A){3N(A.4D.4o()){2h"3a":f(W.13.3r&&9.j.4t()){3V{A.5S()}3U(B){}A.7P=""}f(A.7O){A.1Y()}Z{A=W.26}2e;2h"1Z":A.1Y();f(W.13.2k){4Z 2b.7N.29}2e;61:A.1Y();2e}}},5Q:h(){q A=9.1x||9.1y;f(9.j.m.4x){3N(9.j.14){2h"2M":A.n+=16;2e}}9[(9.1x?"5O":"i")+"6K"]=A},3Q:h(){k 11.1m({X:9.X,1r:h(){9.3x()}.U(9)})},3x:h(){9.3i();f(!9.j.5L()){9.3R()}f(!((9.j.m.4G&&9.j.7K())||9.j.5L())){9.3I()}f(!9.j.3Y()){k 11.1m({X:9.X,1r:9.4I.U(9)})}},5K:h(){k 11.1m({X:9.X,1r:9.5J.U(9)});f(9.j.3Y()){k 11.1m({2R:0.2,X:9.X,1r:9.4I.U(9)})}f(9.2W){k 11.1m({X:9.X,1r:9.5H.U(9)})}},2q:h(){9.18(9.2p().2q)},1e:h(){9.18(9.2p().1e)},3I:h(){9.5Q();q B=9.4j(),D=9.5G();f(9.m.2I&&(B.o>D.o||B.n>D.n)){f(!9.j.m.4K){q E=10.3M(9.5F()),A=D,C=10.3M(E);f(C.o>A.o){C.n*=A.o/C.o;C.o=A.o;f(C.n>A.n){C.o*=A.n/C.n;C.n=A.n}}Z{f(C.n>A.n){C.o*=A.n/C.n;C.n=A.n;f(C.o>A.o){C.n*=A.o/C.o;C.o=A.o}}}q F=(C.o%1>0?C.n/E.n:C.n%1>0?C.o/E.o:1);9.1x={o:(9.1y.o*F).2m(),n:(9.1y.n*F).2m()};9.3i();B={o:9.1x.o,n:9.1x.n+9.3e.n}}Z{9.1x=D;9.3i();B=D}}Z{9.3i();9.1x=1o}9.44(B)},44:h(B){q F=9.12.2S(),I=2*9.1b,D=B.o+I,M=B.n+I;9.4i();q L=h(){9.3g();9.4g=1o;9.5K()};f(F.o==D&&F.n==M){L.U(9)();S}q C={o:D+"u",n:M+"u"};f(!W.13.2u){10.1h(C,{1w:0-D/2+"u",1O:0-M/2+"u"})}q G=D-F.o,K=M-F.n,J=49(9.12.1M("1w").2D("u","")),E=49(9.12.1M("1O").2D("u",""));f(!W.13.2u){q A=(0-D/2)-J,H=(0-M/2)-E}9.4g=k 11.7F(9.12,0,1,{1X:9.m.7D,X:9.X,5E:9.m.5E,1r:L.U(9)},h(Q){q N=(F.o+Q*G).34(0),P=(F.n+Q*K).34(0);f(W.13.2u){9.12.r({o:(F.o+Q*G).34(0)+"u",n:(F.n+Q*K).34(0)+"u"});9.3O.r({n:P-1*9.1b+"u"})}Z{f(W.13.2w){9.12.r({1i:"4c",o:N+"u",n:P+"u",1w:((0-N)/2).2m()+"u",1O:((0-P)/2).2m()+"u"});9.3O.r({n:P-1*9.1b+"u"})}Z{q O=9.3v(),R=1f.2I.5C();9.12.r({1i:"3q",1w:0,1O:0,o:N+"u",n:P+"u",1p:(R[0]+(O.o/2)-(N/2)).33()+"u",1k:(R[1]+(O.n/2)-(P/2)).33()+"u"});9.3O.r({n:P-1*9.1b+"u"})}}}.U(9))},5J:h(){k 11.1m({X:9.X,1r:y.18.U(9,9[9.j.3u()?"2c":"1L"])});k 11.1m({X:9.X,1r:9.4i.U(9)});k 11.5B([k 11.3t(9.2s,{3s:1T,2A:0,2E:1}),k 11.4f(9.43,{3s:1T})],{X:9.X,1X:0.45,1r:h(){f(9.1q){9.1q.5A("12:7B")}}.U(9)});f(9.j.1A()){k 11.1m({X:9.X,1r:9.5z.U(9)})}},6z:h(){f(!9.12.3y()){S}k 11.5B([k 11.3t(9.43,{3s:1T,2A:1,2E:0}),k 11.3t(9.2s,{3s:1T,2A:1,2E:0})],{X:9.X,1X:0.35});k 11.1m({X:9.X,1r:h(){9.4p();9.2c.1C("").15();9.1L.1C("").15();9.51.r({1O:9.1E.2o.n+"u"})}.U(9)})},5x:h(){9.4z.15();9.1u.15();9.1Q.15();9.3z.15();9.4v.15();9.2n.15()},3i:h(){9.5x();f(!9.j.m.1R){9.3e={o:0,n:0};9.4e=0;9.1R.15();S 2l}Z{9.1R.18()}9.1R[(9.j.3P()?"6e":"1Y")+"7y"]("7x");f(9.j.1u||9.j.1Q){9.4z.18()}f(9.j.1u){9.1u.1C(9.j.1u).18()}f(9.j.1Q){9.1Q.1C(9.j.1Q).18()}f(9.1j&&9.1j.21>1){9.3z.18().5W().1C(k 6q(9.m.7v).4h({1i:9.1i+1,7u:9.1j.21}));f(9.j.m.2n){9.2x.18();9.2n.18()}}f(9.j.m.4M&&9.1j.21>1){q A={28:(9.m.2i||9.1i!=0),1e:(9.m.2i||(9.j.1A()&&9.2p().1e!=0))};$w("28 1e").1a(h(B){9["2J"+B.24()+"2z"].r({7s:(A[B]?"7r":"3K")}).1t(A[B]?9.m.1I.1B.2v:9.m.1I.1B.7w)}.U(9));9.4v.18()}9.5v();9.5y()},5v:h(){q E=9.1E.48.o,D=9.1E.3E.o,G=9.1E.47.o,A=9.1x?9.1x.o:9.1y.o,F=7o,C=0,B=9.m.7n;f(9.j.m.2o){B=1o}Z{f(!9.j.3u()){B="47";C=G}Z{f(A>=F+E&&A<F+D){B="48";C=E}Z{f(A>=F+D){B="3E";C=D}}}}f(C>0){9.2F.r({o:C+"u"}).18()}Z{9.2F.15()}f(B){9.2F.2f(9.1g+"5o"+B+".1J",{17:9.m.17})}9.4e=C},4L:h(){9.4d=k 11.4f(9.2V,{1X:0.3,2A:0,2E:1,X:9.X})},3R:h(){f(9.4d){11.2K.2Q("12").1Y(9.4d)}k 11.5I(9.2V,{1X:1,X:9.X})},5s:h(){f(!9.j.2O()){S}q D=(9.m.2i||9.1i!=0),B=(9.m.2i||(9.j.1A()&&9.2p().1e!=0));9.3X[D?"18":"15"]();9.3T[B?"18":"15"]();q C=9.1x||9.1y;9.1G.r({n:C.n+"u"});q A=((C.o/2-1)+9.1b).33();f(D){9.1G.z(9.2B=k y("Y",{V:"23 7l"}).r({o:A+"u"}));9.2B.2Z="28"}f(B){9.1G.z(9.2C=k y("Y",{V:"23 7k"}).r({o:A+"u"}));9.2C.2Z="1e"}f(D||B){9.1G.18()}},5z:h(){f(!9.m.1I.2Z.1N||!9.j.2O()){S}9.5s();9.1G.18()},4i:h(){9.1G.1C("").15();9.3X.15().r({1w:9.1D.o+"u"});9.3T.15().r({1w:-1*9.1D.o+"u"})},6w:h(){f(9.12.1M("1B")!=0){S}q A=h(){f(!W.13.2t){9.12.18()}9.12.1t(1)}.U(9);f(9.m.1F.1N){k 11.4f(9.1F,{1X:0.4,2A:0,2E:9.4C?1:9.m.1F.1B,X:9.X,7j:9.4b.U(9),1r:A})}Z{A()}},15:h(){f(W.13.2w&&9.1Z&&9.j.3Y()){9.1Z.1Y()}f(W.13.2t&&9.j.4t()){q A=$$("3a#29")[0];f(A){3V{A.5S()}3U(B){}}}f(9.12.1M("1B")==0){S}9.2r();9.1G.15();f(!W.13.2w||!9.j.3Y()){9.2s.15()}f(11.2K.2Q("4a").7i.21>0){S}11.2K.2Q("12").1a(h(C){C.6Y()});k 11.1m({X:9.X,1r:9.5f.U(9)});k 11.3t(9.12,{1X:0.1,2A:1,2E:0,X:{1i:"4R",3j:"4a"}});k 11.5I(9.1F,{1X:0.4,X:{1i:"4R",3j:"4a"},1r:9.5r.U(9)})},5r:h(){f(!W.13.2t){9.12.15()}Z{9.12.r({1w:"-3o",1O:"-3o"})}9.2s.1t(0).18();9.1G.1C("").15();9.4p();9.2c.1C("").15();9.1L.1C("").15();9.4P();9.5N();f(9.1q){9.1q.5A("12:3D")}9.1q=1o;9.1j=1o;9.j=1o;9.1x=1o},5y:h(){q B={},A=9[(9.1x?"5O":"i")+"6K"].o;9.1R.r({o:A+"u"});9.3B.r({o:A-9.4e-1+"u"});B=9.3J(9.1R);9.1R.r({o:"7h%"});9.3e=9.j.m.1R?B:{o:B.o,n:0}},3g:h(){q B=9.12.2S();f(W.13.2u){9.12.r({1k:"50%",1p:"50%"})}Z{f(W.13.2t||W.13.2k){q A=9.3v(),C=1f.2I.5C();9.12.r({1w:0,1O:0,1p:(C[0]+(A.o/2)-(B.o/2)).33()+"u",1k:(C[1]+(A.n/2)-(B.n/2)).33()+"u"})}Z{9.12.r({1i:"4c",1p:"50%",1k:"50%",1w:(0-B.o/2).2m()+"u",1O:(0-B.n/2).2m()+"u"})}}},5q:h(){9.2r();9.2W=1T;9.1e.U(9).2R(0.25);9.2x.2f(9.1g+"7f.1J",{17:9.m.17}).15()},2r:h(){f(9.2W){9.2W=2l}f(9.4m){7d(9.4m)}9.2x.2f(9.1g+"4n.1J",{17:9.m.17})},5X:h(){9[(9.2W?"4r":"4J")+"7c"]()},5H:h(){f(9.2W){9.4m=9.1e.U(9).2R(9.m.79)}},5P:h(){9.4q=[];q A=$$("a[78~=12]");A.1a(h(B){B.5p();k 1d.55(B);B.19("2X",9.18.4H(B).1S(h(E,D){D.4r();E(D)}).1l(9));f(B.1U.2O()){f(9.m.77){B.19("27",9.5n.U(9,B.1U))}q C=A.76(h(D){S D.1n==B.1n});f(C[0].21){9.4q.2P({1n:B.1U.1n,4S:C[0]});A=C[1]}}}.U(9))},54:h(A){S 9.4q.6l(h(B){S B.1n==A})},5d:h(A){S 9.54(A).4S.5l("1U")},5M:h(){$(1f.41).19("2X",9.60.1l(9));$w("27 2a").1a(h(C){9.1G.19(C,h(D){q E=D.5k("Y");f(!E){S}f(9.2B&&9.2B==E||9.2C&&9.2C==E){9.3n(D)}}.1l(9))}.U(9));9.1G.19("2X",h(D){q E=D.5k("Y");f(!E){S}q C=(9.2B&&9.2B==E)?"2q":(9.2C&&9.2C==E)?"1e":1o;f(C){9[C].1S(h(G,F){9.2r();G(F)}).U(9)()}}.1l(9));$w("28 1e").1a(h(F){q E=F.24(),C=h(H,G){9.2r();H(G)},D=h(I,H){q G=H.1q().1G;f((G=="28"&&(9.m.2i||9.1i!=0))||(G=="1e"&&(9.m.2i||(9.j.1A()&&9.2p().1e!=0)))){I(H)}};9[F+"2U"].19("27",9.3n.1l(9)).19("2a",9.3n.1l(9)).19("2X",9[F=="1e"?F:"2q"].1S(C).1l(9));9["2J"+E+"2z"].19("2X",9[F=="1e"?F:"2q"].1S(D).1l(9)).19("27",y.1t.4H(9["2J"+E+"2z"],9.m.1I.1B.5j).1S(D).1l(9)).19("2a",y.1t.4H(9["2J"+E+"2z"],9.m.1I.1B.2v).1S(D).1l(9))}.U(9));q B=[9.2F,9.2x];f(!W.13.2t){B.1a(h(C){C.19("27",y.1t.U(9,C,9.m.1I.1B.5j)).19("2a",y.1t.U(9,C,9.m.1I.1B.2v))}.U(9))}Z{B.3w("1t",1)}9.2x.19("2X",9.5X.1l(9));f(W.13.2t||W.13.2k){q A=h(D,C){f(9.12.1M("1k").46(0)=="-"){S}D(C)};1m.19(2b,"3A",9.3g.1S(A).1l(9));1m.19(2b,"44",9.3g.1S(A).1l(9))}f(W.13.2k){1m.19(2b,"44",9.4b.1l(9))}9.12.19("27",9.38.1l(9)).19("2a",9.38.1l(9));9.4N.19("27",9.38.1l(9)).19("2a",9.38.1l(9))},38:h(C){q B=C.14;f(!9.j){B="2a"}Z{f(!(9.j&&9.j.m&&9.j.m.2o&&(9.2s.73()==1))){S}}f(9.4A){11.2K.2Q("65").1Y(9.4A)}q A={1O:((B=="27")?0:9.1E.2o.n)+"u"};9.4A=k 11.72(9.51,{71:A,1X:0.2,X:{3j:"65",70:1},2R:(B=="2a"?0.3:0)})},6Z:h(){q A={};$w("o n").1a(h(E){q C=E.24();q B=1f.a3;A[E]=W.13.2w?[B["a2"+C],B["3A"+C]].a1():W.13.3r?1f.41["3A"+C]:B["3A"+C]});S A},4b:h(){f(!W.13.2k){S}9.1F.r(9.1V(1f.2I.2S()));9.1F.r(9.1V(9.6Z()))},60:h(A){f(!9.42){9.42=[9.2F,9.4X,9.6O,9.4N];f(9.m.1F.9Z){9.42.2P(9.1F)}}f(A.5g&&(9.42.6D(A.5g))){9.15()}},3n:h(E){q C=E.5g,B=C.2Z,A=9.1D.o,F=(E.14=="27")?0:B=="28"?A:-1*A,D={1w:F+"u"};f(!9.3b){9.3b={}}f(9.3b[B]){11.2K.2Q("6W"+B).1Y(9.3b[B])}9.3b[B]=k 11.72(9[B+"2U"],{71:D,1X:0.2,X:{3j:"6W"+B,70:1},2R:(E.14=="2a"?0.1:0)})},2p:h(){f(!9.1j){S}q D=9.1i,C=9.1j.21;q B=(D<=0)?C-1:D-1,A=(D>=C-1)?0:D+1;S{2q:B,1e:A}},5t:h(G,H){q F=6U[2]||9.m,B=F.2H,E=F.1b,D=k y("9X",{V:"9W"+H.24(),o:E+"u",n:E+"u"}),A={1k:(H.46(0)=="t"),1p:(H.46(1)=="l")};f(D&&D.5e&&D.5e("2d")){G.z(D);q C=D.5e("2d");C.9T=F.17;C.9R((A.1p?B:E-B),(A.1k?B:E-B),B,0,6a.9Q*2,1T);C.9P();C.6f((A.1p?B:0),0,E-B,E);C.6f(0,(A.1k?B:0),E,E-B)}Z{G.z(k y("Y").r({o:E+"u",n:E+"u",3f:0,3G:0,1N:"5T",1i:"9O",9N:"3D"}).z(k y("v:9M",{9K:F.17,9J:"9I",9G:F.17,9F:(B/E*0.5).34(2)}).r({o:2*E-1+"u",n:2*E-1+"u",1i:"3q",1p:(A.1p?0:(-1*E))+"u",1k:(A.1k?0:(-1*E))+"u"})))}},6p:h(){f(9.58){S}q A=$$("31","66","3a");9.3C=A.9z(h(B){S{1q:B,1H:B.1M("1H")}});A.3w("r","1H:3D");9.58=1T},5N:h(){9.3C.1a(h(B,A){B.1q.r("1H: "+B.1H)});4Z 9.3C;9.58=2l},1V:h(A){q B={};10.6u(A).1a(h(C){B[C]=A[C]+"u"});S B},4j:h(){S{o:9.1y.o,n:9.1y.n+9.3e.n}},5F:h(){q B=9.4j(),A=2*9.1b;S{o:B.o+A,n:B.n+A}},5G:h(){q C=20,A=2*9.1D.n+C,B=9.3v();S{o:B.o-A,n:B.n-A}},3v:h(){q A=1f.2I.2S();f(9.4y&&9.4y.3y()){A.n-=9.9x}S A}});10.1h(1d,{6M:h(){f(!9.m.6L.6J){S}9.3S=9.6I.1l(9);1f.19("6H",9.3S)},4P:h(){f(!9.m.6L.6J){S}f(9.3S){1f.5p("6H",9.3S)}},6I:h(C){q B=9w.9t(C.6F).4o(),E=C.6F,F=9.j.1A()&&!9.4g,A=9.j.m.2n,D;f(9.j.3u()){C.4r();D=(E==1m.6o||["x","c"].52(B))?"15":(E==37&&F&&(9.m.2i||9.1i!=0))?"2q":(E==39&&F&&(9.m.2i||9.2p().1e!=0))?"1e":(B=="p"&&A&&9.j.1A())?"5q":(B=="s"&&A&&9.j.1A())?"2r":1o;f(B!="s"){9.2r()}}Z{D=(E==1m.6o)?"15":1o}f(D){9[D]()}f(F){f(E==1m.9r&&9.1j.6A()!=9.j){9.18(9.1j.6A())}f(E==1m.9q&&9.1j.6y()!=9.j){9.18(9.1j.6y())}}}});1d.3x=1d.3x.1S(h(B,A){9.6M();B(A)});10.1h(1d,{6T:h(){f(9.1j.21==0){S}q A=9.2p();9.4U([A.1e,A.2q])},4U:h(C){q A=(9.1j&&9.1j.52(C)||10.9p(C))?9.1j:C.1n?9.5d(C.1n):1o;f(!A){S}q B=$A(10.6G(C)?[C]:C.14?[A.22(C)]:C).9o();B.1a(h(F){q D=A[F],E=D.1c;f(D.3Z||D.4T||!E){S}q G=k 2j();G.1s=h(){G.1s=W.26;D.4T=1o;9.6v(D,G)}.U(9);G.1v=E}.U(9))},6v:h(A,B){A.3Z={o:B.o,n:B.n}},5n:h(A){f(A.3Z||A.4T){S}9.4U(A)}});y.9n({2f:h(C,B){C=$(C);q A=10.1h({6t:"1k 1p",2G:"3W-2G",4V:"63",17:""},6U[2]||{});C.r(W.13.2u?{9m:"9l:9k.9i.9h(1v=\'"+B+"\'\', 4V=\'"+A.4V+"\')"}:{2y:A.17+" 3d("+B+") "+A.6t+" "+A.2G});S C}});10.1h(1d,{6r:h(A){q B;$w("3l 3h 1Z 2M").1a(h(C){f(k 4Y("\\\\.("+9.9f[C].2D(/\\s+/g,"|")+")(\\\\?.*)?","i").6C(A)){B=C}}.U(9));f(B){S B}f(A.4Q("#")){S"3F"}f(1f.6B&&1f.6B!=(A).2D(/(^.*\\/\\/)|(:.*)|(\\/.*)/g,"")){S"1Z"}S"3h"},6i:h(A){q B=A.9u(/\\?.*/,"").3L(/\\.([^.]{3,4})$/);S B?B[1]:1o},4u:h(B){q C="<"+B.1z;9v(q A 5U B){f(!["2L","53","1z"].52(A)){C+=" "+A+\'="\'+B[A]+\'"\'}}f(k 4Y("^(?:9b|99|98|5w|97|9A|9B|6g|9C|9D|9E|92|1W|91|90|9H)$","i").6C(B.1z)){C+="/>"}Z{C+=">";f(B.2L){B.2L.1a(h(D){C+=9.4u(D)}.U(9))}f(B.53){C+=B.53}C+="</"+B.1z+">"}S C}});(h(){1f.19("4E:4B",h(){q B=(2N.5h&&2N.5h.21),A=h(D){q C=2l;f(B){C=($A(2N.5h).5l("1P").6s(",").22(D)>=0)}Z{3V{C=k 8Y(D)}3U(E){}}S!!C};2b.1d.4W=(B)?{3l:A("8X 9L"),2M:A("5a")}:{3l:A("6n.6n"),2M:A("5a.5a")}})})();1d.55=8U.8T({8R:h(b){q c=10.6Q(b);f(c&&!b.1U){b.1U=9;f(b.1u){b.1U.5b=b.1u;f(1d.m.8Q){b.1u=""}}}9.1c=c?b.8P("1c"):b.1c;f(9.1c.22("#")>=0){9.1c=9.1c.68(9.1c.22("#"))}f(b.1n&&b.1n.4Q("30")){9.14="30";9.1n=b.1n}Z{f(b.1n){9.14=b.1n;9.1n=b.1n}Z{9.14=1d.6r(9.1c);9.1n=9.14}}$w("32 3l 30 1Z 3h 3F 2M 1L 2c").1a(h(a){q T=a.24(),t=a.4o();f("3h 30 2c 1L".22(a)<0){9["8O"+T]=h(){S 9.14==t}.U(9)}}.U(9));f(c&&b.1U.5b){q d=b.1U.5b.8M(1d.m.9Y).3w("8L");f(d[0]){9.1u=d[0]}f(d[1]){9.1Q=d[1]}q e=d[2];9.m=(e&&10.6N(e))?8K("({"+e+"})"):{}}Z{9.1u=b.1u;9.1Q=b.1Q;9.m=b.m||{}}f(9.m.4F){9.m.32=10.3M(9.m.4F);4Z 9.m.4F}},1A:h(){S 9.14.4Q("30")},2O:h(){S(9.1A()||9.14=="3h")},3P:h(){S"1Z 3F 32".22(9.14)>=0},3u:h(){S!9.3P()}});1d.6X();1f.19("4E:4B",1d.4J.U(1d));',62,624,'|||||||||this||||||if||function||view|new||options|height|width||var|setStyle|||px||||Element|insert|||||||||||||||||||return||bind|className|Prototype|queue|div|else|Object|Effect|lightview|Browser|type|hide||backgroundColor|show|observe|each|border|href|Lightview|next|document|images|extend|position|views|top|bindAsEventListener|Event|rel|null|left|element|afterFinish|onload|setOpacity|title|src|marginLeft|scaledInnerDimensions|innerDimensions|tag|isGallery|opacity|update|sideDimensions|closeDimensions|overlay|prevnext|visibility|buttons|png|li|external|getStyle|display|marginTop|name|caption|menubar|wrap|true|_view|pixelClone|param|duration|remove|iframe||length|indexOf|lv_Button|capitalize||emptyFunction|mouseover|prev|lightviewContent|mouseout|window|media||break|setPngBackground|value|case|cyclic|Image|Gecko|false|round|slideshow|topclose|getSurroundingIndexes|previous|stopSlideshow|center|WebKit419|IE6|normal|IE|slideshowButton|background|Button|from|prevButton|nextButton|replace|to|closeButton|repeat|radius|viewport|inner|Queues|children|quicktime|navigator|isImage|push|get|delay|getDimensions|id|ButtonImage|loading|sliding|click|lv_Fill|side|gallery|select|ajax|floor|toFixed||lightviewError||toggleTopClose||object|sideEffect|inlineContent|url|menuBarDimensions|margin|restoreCenter|image|fillMenuBar|scope|inlineMarker|flash|ul|toggleSideButton|10000px|zIndex|absolute|WebKit|sync|Opacity|isMedia|getViewportDimensions|invoke|afterShow|visible|imgNumber|scroll|data|overlappingRestore|hidden|large|inline|padding|onComplete|resizeWithinViewport|getHiddenDimensions|auto|match|clone|switch|resizeCenter|isExternal|afterEffect|stopLoading|keyboardEvent|nextButtonImage|catch|try|no|prevButtonImage|isIframe|preloadedDimensions|lv_Corner|body|delegateCloseElements|sideButtons|resize||charAt|innertop|small|parseInt|lightview_hide|maxOverlay|fixed|loadingEffect|closeButtonWidth|Appear|resizing|evaluate|hidePrevNext|getInnerDimensions|convertVersionString|gif|slideTimer|inner_slideshow_play|toLowerCase|clearContent|sets|stop|IEVersion|isQuicktime|createHTML|innerPrevNext|require|controls|controller|dataText|topCloseEffect|loaded|pngOverlay|tagName|dom|ajaxOptions|autosize|curry|insertContent|start|fullscreen|startLoading|innerPreviousNext|topcloseButton|lv_Wrapper|disableKeyboardNavigation|startsWith|end|elements|isPreloading|preloadFromSet|sizingMethod|Plugin|topButtons|RegExp|delete||topcloseButtonImage|member|html|getSet|View|pluginspages|userAgent|preventingOverlap|pluginspage|QuickTime|_title|wmode|getViews|getContext|restoreInlineContent|target|plugins|prepare|hover|findElement|pluck|container|preloadImageHover|close_|stopObserving|startSlideshow|afterHide|setPrevNext|createCorner|_|setCloseButtons|br|hideData|setMenuBarDimensions|showPrevNext|fire|Parallel|getScrollOffsets|REQUIRED_|transition|getOuterDimensions|getBounds|nextSlide|Fade|showContent|finishShow|isAjax|addObservers|showOverlapping|scaledI|updateViews|adjustDimensionsToView|build|Stop|block|in|SetControllerVisible|down|toggleSlideshow|flashvars|mimetypes|delegateClose|default|loop|scale|autoplay|lightview_topCloseEffect|embed|before|substr|scrolling|Math|mac|lv_WrapDown|isMac|add|fillRect|img|lv_Filler|detectExtension|lv_CornerWrapper|namespaces|find|lv_Half|ShockwaveFlash|KEY_ESC|hideOverlapping|Template|detectType|join|align|keys|setPreloadedDimensions|appear|marginRight|last|hideContent|first|domain|test|include|nextSide|keyCode|isNumber|keydown|keyboardDown|enabled|nnerDimensions|keyboard|enableKeyboardNavigation|isString|loadingButton|lv_Frame|isElement|Scriptaculous|_inlineDisplayRestore|preloadSurroundingImages|arguments|prevSide|lightview_side|load|cancel|getScrollDimensions|limit|style|Morph|getOpacity|inner_|lv_Container|partition|preloadHover|class|slideshowDelay|float|times|Slideshow|clearTimeout|right|inner_slideshow_stop|REQUIRED_Prototype|100|effects|beforeStart|lv_NextButton|lv_PrevButton|addClassName|borderColor|180|bl|tr|pointer|cursor|tl|total|imgNumberTemplate|disabled|lv_MenuTop|ClassName|requires|parseFloat|opened|throw|resizeDuration|blank|Tween|lv_PrevNext|Version|cloneNode|lv_FrameBottom|isInline|lv_Loading|lv_External|frames|parentNode|innerHTML|undefined|clientHeight|lv_Slideshow|clientWidth|ancestors|inner_next|innerNextButton|inner_prev|FlashVars|innerPrevButton|typeof|exec|lv_innerPrevNext|allowFullScreen|movie|high|quality|lv_ImgNumber|VML|classids|classid|lv_Caption|codebases|codebase|enablejavascript|lv_Title|tofit|lv_DataText|behavior|lv_Data|addRule|createStyleSheet|wrapperTag|lv_Close|99999|random|lv_MenuBar|lightviewContent_|hspace|lv_Media|frameBorder|vml|Updater|Ajax|lv_WrapCenter|com|microsoft|lv_WrapUp|150|schemas|lv_Center|urn|galleryimg|alt|lv_HalfRight|MSIE|eval|strip|split|lv_HalfLeft|is|getAttribute|removeTitles|initialize|defaultOptions|create|Class|transparent|lv_Liquid|Shockwave|ActiveXObject|lv_FrameTop|spacer|range|meta|script|required|plugin|lv_Frames|col|basefont|base|head|area|requiresPlugin|lv_topcloseButtonImage|errors|typeExtensions|js|AlphaImageLoader|Microsoft|lv_topButtons|DXImageTransform|progid|filter|addMethods|uniq|isArray|KEY_END|KEY_HOME|lv_NextSide|fromCharCode|gsub|for|String|controllerOffset|blur|map|frame|hr|input|link|isindex|arcSize|strokeColor|wbr|1px|strokeWeight|fillcolor|Flash|roundrect|overflow|relative|fill|PI|arc|lv_PrevSide|fillStyle|after|REQUIRED_Scriptaculous|cornerCanvas|canvas|titleSplit|close|lv_Sides|max|offset|documentElement'.split('|'),0,{})); /* Copyright (c) 2006 Patrick Fitzgerald */

function tabberObj(argsObj)
{var arg;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault="tabbertabdefault";this.classNav="tabbernav";this.classTabHide="tabbertabhide";this.classNavActive="tabberactive";this.titleElements=['h2','h3','h4','h5','h6'];this.titleElementsStripHTML=true;this.removeTitle=true;this.addLinkId=false;this.linkIdFormat='<tabberid>nav<tabnumberone>';for(arg in argsObj){this[arg]=argsObj[arg];}
this.REclassMain=new RegExp('\\b'+this.classMain+'\\b','gi');this.REclassMainLive=new RegExp('\\b'+this.classMainLive+'\\b','gi');this.REclassTab=new RegExp('\\b'+this.classTab+'\\b','gi');this.REclassTabDefault=new RegExp('\\b'+this.classTabDefault+'\\b','gi');this.REclassTabHide=new RegExp('\\b'+this.classTabHide+'\\b','gi');this.tabs=new Array();if(this.div){this.init(this.div);this.div=null;}}
tabberObj.prototype.init=function(e)
{var
childNodes,i,i2,t,defaultTab=0,DOM_ul,DOM_li,DOM_a,aId,headingElement;if(!document.getElementsByTagName){return false;}
if(e.id){this.id=e.id;}
this.tabs.length=0;childNodes=e.childNodes;for(i=0;i<childNodes.length;i++){if(childNodes[i].className&&childNodes[i].className.match(this.REclassTab)){t=new Object();t.div=childNodes[i];this.tabs[this.tabs.length]=t;if(childNodes[i].className.match(this.REclassTabDefault)){defaultTab=this.tabs.length-1;}}}
DOM_ul=document.createElement("ul");DOM_ul.className=this.classNav;for(i=0;i<this.tabs.length;i++){t=this.tabs[i];t.headingText=t.div.title;if(this.removeTitle){t.div.title='';}
if(!t.headingText){for(i2=0;i2<this.titleElements.length;i2++){headingElement=t.div.getElementsByTagName(this.titleElements[i2])[0];if(headingElement){t.headingText=headingElement.innerHTML;if(this.titleElementsStripHTML){t.headingText.replace(/<br>/gi," ");t.headingText=t.headingText.replace(/<[^>]+>/g,"");}
break;}}}
if(!t.headingText){t.headingText=i+1;}
DOM_li=document.createElement("li");t.li=DOM_li;DOM_a=document.createElement("a");DOM_a.appendChild(document.createTextNode(t.headingText));DOM_a.href="javascript:void(null);";DOM_a.title=t.headingText;DOM_a.onclick=this.navClick;DOM_a.tabber=this;DOM_a.tabberIndex=i;if(this.addLinkId&&this.linkIdFormat){aId=this.linkIdFormat;aId=aId.replace(/<tabberid>/gi,this.id);aId=aId.replace(/<tabnumberzero>/gi,i);aId=aId.replace(/<tabnumberone>/gi,i+1);aId=aId.replace(/<tabtitle>/gi,t.headingText.replace(/[^a-zA-Z0-9\-]/gi,''));DOM_a.id=aId;}
DOM_li.appendChild(DOM_a);DOM_ul.appendChild(DOM_li);}
e.insertBefore(DOM_ul,e.firstChild);e.className=e.className.replace(this.REclassMain,this.classMainLive);this.tabShow(defaultTab);if(typeof this.onLoad=='function'){this.onLoad({tabber:this});}
return this;};tabberObj.prototype.navClick=function(event)
{var
rVal,a,self,tabberIndex,onClickArgs;a=this;if(!a.tabber){return false;}
self=a.tabber;tabberIndex=a.tabberIndex;a.blur();if(typeof self.onClick=='function'){onClickArgs={'tabber':self,'index':tabberIndex,'event':event};if(!event){onClickArgs.event=window.event;}
rVal=self.onClick(onClickArgs);if(rVal===false){return false;}}
self.tabShow(tabberIndex);return false;};tabberObj.prototype.tabHideAll=function()
{var i;for(i=0;i<this.tabs.length;i++){this.tabHide(i);}};tabberObj.prototype.tabHide=function(tabberIndex)
{var div;if(!this.tabs[tabberIndex]){return false;}
div=this.tabs[tabberIndex].div;if(!div.className.match(this.REclassTabHide)){div.className+=' '+this.classTabHide;}
this.navClearActive(tabberIndex);return this;};tabberObj.prototype.tabShow=function(tabberIndex)
{var div;if(!this.tabs[tabberIndex]){return false;}
this.tabHideAll();div=this.tabs[tabberIndex].div;div.className=div.className.replace(this.REclassTabHide,'');this.navSetActive(tabberIndex);if(typeof this.onTabDisplay=='function'){this.onTabDisplay({'tabber':this,'index':tabberIndex});}
return this;};tabberObj.prototype.navSetActive=function(tabberIndex)
{this.tabs[tabberIndex].li.className=this.classNavActive;return this;};tabberObj.prototype.navClearActive=function(tabberIndex)
{this.tabs[tabberIndex].li.className='';return this;};function tabberAutomatic(tabberArgs)
{var
tempObj,divs,i;if(!tabberArgs){tabberArgs={};}
tempObj=new tabberObj(tabberArgs);divs=document.getElementsByTagName("div");for(i=0;i<divs.length;i++){if(divs[i].className&&divs[i].className.match(tempObj.REclassMain)){tabberArgs.div=divs[i];divs[i].tabber=new tabberObj(tabberArgs);}}
return this;}

document.observe("dom:loaded",function(){tabberAutomatic();});/*{var oldOnLoad;if(!tabberArgs){tabberArgs={};}
oldOnLoad=window.onload;if(typeof window.onload!='function'){window.onload=function(){tabberAutomatic(tabberArgs);};}else{window.onload=function(){oldOnLoad();tabberAutomatic(tabberArgs);};}}
if(typeof tabberOptions=='undefined'){tabberAutomaticOnLoad();}else{if(!tabberOptions['manualStartup']){tabberAutomaticOnLoad(tabberOptions);}*/ FeedMenu = Class.create();
Object.extend(FeedMenu.prototype, {
	element: ''
	,feedList: '' 
	,label: 'RSS Feeds'
	,feeds: null
	,feedListHTML: null
	,cssClass: 'feedMenu'
	
	,initialize: function() {
		this.element = arguments[0];
		this.feedList = arguments[1];
		
		this.build();
	}
	
	,build: function(){
		this.feedListHTML = '<span style="display:none;" id="'+this.element+'_feedMenu" class="'+this.cssClass+'"><select id="'+this.element+'_SelFeedMenu"><optgroup label="'+this.label+'"/>'; 
		var optionTemplate = new Template('<option value="#{href}">#{title}</option>');
		this.feedList.each(function(i){
			this.feedListHTML += optionTemplate.evaluate({
				href: i.href
				,title: i.title
			});
		}.bind(this));
		this.feedListHTML += '</select></span>';
		$(this.element).insert(this.feedListHTML);
		$(this.element).observe('click', this.show.bind(this)); 
		//$(this.element).observe('mouseout', this.hide.bind(this));
		$(this.element+'_SelFeedMenu').observe('change', this.selectItem.bind(this));
	}
	
	,hide: function(){
		$(this.element+'_feedMenu').setStyle({
			display: 'none'
		});
	}
	
	,show: function(){
		$(this.element+'_feedMenu').setStyle({
			display: 'block'
		});
	}
	
	,selectItem: function(){
		window.location = $(this.element+'_SelFeedMenu').options[$(this.element+'_SelFeedMenu').selectedIndex].value;
	}
}); 