 // 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.addClass('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;');
 }
};
/* 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;
	}
}); /*
This license text has to stay intact at all times:
fleXcroll Public License Version
Cross Browser Custom Scroll Bar Script by Hesido.
Public version - Free for non-commercial uses.

This script cannot be used in any commercially built
web sites, or in sites that relates to commercial
activities. This script is not for re-distribution.
For licensing options:
Contact Emrah BASKAYA @ www.hesido.com

Derivative works are only allowed for personal uses,
and they cannot be redistributed.

FleXcroll Public Key Code: 20050907122003339
MD5 hash for this license: 9ada3be4d7496200ab2665160807745d

End of license text---
*/
//fleXcroll v1.9.5
var fleXenv={

fleXcrollInit:function(){this.addTrggr(window,'load',this.globalInit);},

fleXcrollMain:function(dDv){
//Main code beg
var dC=document,wD=window,nV=navigator;
if(!dC.getElementById||!dC.createElement)return;
if (typeof(dDv)=='string')dDv=document.getElementById(dDv);
if(dDv==null||nV.userAgent.indexOf('OmniWeb')!=-1||((nV.userAgent.indexOf('AppleWebKit')!=-1||nV.userAgent.indexOf('Safari')!=-1)&&!(typeof(HTMLElement)!="undefined"&&HTMLElement.prototype))||nV.vendor=='KDE'||(nV.platform.indexOf('Mac')!=-1&&nV.userAgent.indexOf('MSIE')!=-1))return;
if(dDv.scrollUpdate){dDv.scrollUpdate();return;};
if(!dDv.id||dDv.id==''){var sTid="flex__",c=1;while(document.getElementById(sTid+c)!=null){c++};dDv.id=sTid+c;}
var targetId=dDv.id;
dDv.fleXdata=new Object();var sC=dDv.fleXdata;
sC.keyAct={_37:['-1s',0],_38:[0,'-1s'],_39:['1s',0],_40:[0,'1s'],_33:[0,'-1p'],_34:[0,'1p'],_36:[0,'-100p'],_35:[0,'+100p']};
sC.wheelAct=["-2s","2s"];
sC.baseAct=["-2s","2s"];
var cDv=createDiv('contentwrapper',true),mDv=createDiv('mcontentwrapper',true),tDv=createDiv('scrollwrapper',true),pDv=createDiv('copyholder',true);
var iDv=createDiv('domfixdiv',true),fDv=createDiv('zoomdetectdiv',true),stdMode=false;
pDv.sY.border='1px solid blue';pDv.fHide();
dDv.style.overflow='hidden';
fDv.sY.fontSize="12px";fDv.sY.height="1em";fDv.sY.width="1em";fDv.sY.position="absolute";fDv.sY.zIndex="-999";fDv.fHide();
var brdHeight=dDv.offsetHeight,brdWidth=dDv.offsetWidth;
copyStyles(dDv,pDv,'0px',['border-left-width','border-right-width','border-top-width','border-bottom-width']);
var intlHeight=dDv.offsetHeight,intlWidth=dDv.offsetWidth,brdWidthLoss=brdWidth-intlWidth,brdHeightLoss=brdHeight-intlHeight;
var oScrollY=(dDv.scrollTop)?dDv.scrollTop:0,oScrollX=(dDv.scrollLeft)?dDv.scrollLeft:0;
var urlBase=document.location.href,uReg=/#([^#.]*)$/;
var focusProtectList=['textarea','input','select'];
sC.scroller=[];sC.forcedBar=[];sC.containerSize=sC.cntRSize=[];sC.contentSize=sC.cntSize=[];sC.edge=[false,false];
sC.reqS=[];sC.barSpace=[0,0];sC.forcedHide=[];sC.forcedPos=[];sC.paddings=[];
while (dDv.firstChild) {cDv.appendChild(dDv.firstChild)};
cDv.appendChild(iDv);dDv.appendChild(mDv);dDv.appendChild(pDv);
if(getStyle(dDv,'position')!='absolute') dDv.style.position="relative";

var dAlign=getStyle(dDv,'text-align');dDv.style.textAlign='left';
mDv.sY.width="100px";mDv.sY.height="100px";mDv.sY.top="0px";mDv.sY.left="0px";
copyStyles(dDv,pDv,"0px",['padding-left','padding-top','padding-right','padding-bottom']);
var postWidth=dDv.offsetWidth,postHeight=dDv.offsetHeight,mHeight;
mHeight=mDv.offsetHeight;mDv.sY.borderBottom="2px solid black";
if(mDv.offsetHeight>mHeight)stdMode=true;mDv.sY.borderBottomWidth="0px";
copyStyles(pDv,dDv,false,['padding-left','padding-top','padding-right','padding-bottom']);
findPos(mDv);findPos(dDv);
sC.paddings[0]=mDv.yPos-dDv.yPos;sC.paddings[2]=mDv.xPos-dDv.xPos;
dDv.style.paddingTop=getStyle(dDv,"padding-bottom");dDv.style.paddingLeft=getStyle(dDv,"padding-right");
findPos(mDv);findPos(dDv);
sC.paddings[1]=mDv.yPos-dDv.yPos;sC.paddings[3]=mDv.xPos-dDv.xPos;
dDv.style.paddingTop=getStyle(pDv,"padding-top");dDv.style.paddingLeft=getStyle(pDv,"padding-left");
var padWidthComp=sC.paddings[2]+sC.paddings[3],padHeightComp=sC.paddings[0]+sC.paddings[1];

mDv.style.textAlign=dAlign;
copyStyles(dDv,mDv,false,['padding-left','padding-right','padding-top','padding-bottom']);
tDv.sY.width=dDv.offsetWidth+'px';tDv.sY.height=dDv.offsetHeight+'px';
mDv.sY.width=postWidth+'px'; mDv.sY.height=postHeight+'px';
tDv.sY.position='absolute';tDv.sY.top='0px';tDv.sY.left='0px';
tDv.fHide();

mDv.appendChild(cDv);dDv.appendChild(tDv);tDv.appendChild(fDv);

cDv.sY.position='relative';mDv.sY.position='relative';
cDv.sY.top="0";cDv.sY.width="100%";//fix IE7
mDv.sY.overflow='hidden';
mDv.sY.left="-"+sC.paddings[2]+"px";
mDv.sY.top="-"+sC.paddings[0]+"px";
sC.zTHeight=fDv.offsetHeight;

sC.getContentWidth=function(){
	var cChilds=cDv.childNodes,maxCWidth=compPad=0;
	for(var i=0;i<cChilds.length;i++){if(cChilds[i].offsetWidth){maxCWidth=Math.max(cChilds[i].offsetWidth,maxCWidth)}};
	sC.cntRSize[0]=((sC.reqS[1]&&!sC.forcedHide[1])||sC.forcedBar[1])?dDv.offsetWidth-sC.barSpace[0]:dDv.offsetWidth;
	sC.cntSize[0]=maxCWidth+padWidthComp;
	return sC.cntSize[0];
	};
sC.getContentHeight=function(){
	sC.cntRSize[1]=((sC.reqS[0]&&!sC.forcedHide[0])||sC.forcedBar[0])?dDv.offsetHeight-sC.barSpace[1]:dDv.offsetHeight;
	sC.cntSize[1]=cDv.offsetHeight+padHeightComp-2;
	return sC.cntSize[1];
	};

sC.fixIEDispBug=function(){cDv.sY.display='none';cDv.sY.display='block';};
sC.setWidth=function(){mDv.sY.width=(stdMode)?(sC.cntRSize[0]-padWidthComp-brdWidthLoss)+'px':sC.cntRSize[0]+'px';};
sC.setHeight=function(){mDv.sY.height=(stdMode)?(sC.cntRSize[1]-padHeightComp-brdHeightLoss)+'px':sC.cntRSize[1]+'px';};

sC.createScrollBars=function(){
	sC.getContentWidth();sC.getContentHeight();
	//vert
	tDv.vrt=new Array();var vrT=tDv.vrt;
	createScrollBars(vrT,'vscroller');
	vrT.barPadding=[parseInt(getStyle(vrT.sBr,'padding-top')),parseInt(getStyle(vrT.sBr,'padding-bottom'))];
	vrT.sBr.sY.padding='0px';vrT.sBr.curPos=0;vrT.sBr.vertical=true;
	vrT.sBr.indx=1; cDv.vBar=vrT.sBr;
	prepareScroll(vrT,0);sC.barSpace[0]=vrT.sDv.offsetWidth;sC.setWidth();
	//horiz
	tDv.hrz=new Array();var hrZ=tDv.hrz;
	createScrollBars(hrZ,'hscroller');
	hrZ.barPadding=[parseInt(getStyle(hrZ.sBr,'padding-left')),parseInt(getStyle(hrZ.sBr,'padding-right'))];
	hrZ.sBr.sY.padding='0px';hrZ.sBr.curPos=0;hrZ.sBr.vertical=false;
	hrZ.sBr.indx=0; cDv.hBar=hrZ.sBr;
	if(wD.opera) hrZ.sBr.sY.position='relative';
	prepareScroll(hrZ,0);
	sC.barSpace[1]=hrZ.sDv.offsetHeight;sC.setHeight();
	tDv.sY.height=dDv.offsetHeight+'px';
	// jog
	hrZ.jBox=createDiv('scrollerjogbox');
	tDv.appendChild(hrZ.jBox);hrZ.jBox.onmousedown=function(){
		hrZ.sBr.scrollBoth=true;sC.goScroll=hrZ.sBr;hrZ.sBr.clicked=true;
		hrZ.sBr.moved=false;tDv.vrt.sBr.moved=false;
		fleXenv.addTrggr(dC,'selectstart',retFalse);fleXenv.addTrggr(dC,'mousemove',mMoveBar);fleXenv.addTrggr(dC,'mouseup',mMouseUp);
		return false;
	};
};

sC.goScroll=null;
sC.createScrollBars();
cDv.removeChild(iDv);

if(!this.addChckTrggr(dDv,'mousewheel',mWheelProc)||!this.addChckTrggr(dDv,'DOMMouseScroll',mWheelProc)){dDv.onmousewheel=mWheelProc;};
this.addChckTrggr(dDv,'mousewheel',mWheelProc);
this.addChckTrggr(dDv,'DOMMouseScroll',mWheelProc);
dDv.setAttribute('tabIndex','0');

this.addTrggr(dDv,'keydown',function(e){
	if(dDv.focusProtect) return;
	if(!e){var e=wD.event;};var pK=e.keyCode; sC.pkeY=pK;
	sC.mDPosFix();
	if(sC.keyAct['_'+pK]&&!window.opera){dDv.contentScroll(sC.keyAct['_'+pK][0],sC.keyAct['_'+pK][1],true);if(e.preventDefault) e.preventDefault();return false;};
	});
this.addTrggr(dDv,'keypress',function(e){//make Opera Happy
	if(dDv.focusProtect) return;
	if(!e){var e=wD.event;};var pK=e.keyCode;
	if(sC.keyAct['_'+pK]){dDv.contentScroll(sC.keyAct['_'+pK][0],sC.keyAct['_'+pK][1],true);if(e.preventDefault) e.preventDefault();return false;};
});

this.addTrggr(dDv,'keyup',function(){sC.pkeY=false});

this.addTrggr(dC,'mouseup',intClear);
this.addTrggr(dDv,'mousedown',function(e){
	if(!e) e=wD.event;
	var cTrgt=(e.target)?e.target:(e.srcElement)?e.srcElement:false;
	if(!cTrgt||(cTrgt.className&&cTrgt.className.match(RegExp("\\bscrollgeneric\\b")))) return;
	sC.inMposX=e.clientX;sC.inMposY=e.clientY;
	pageScrolled();findPos(dDv);intClear();
	fleXenv.addTrggr(dC,'mousemove',tSelectMouse);
	sC.mTBox=[dDv.xPos+10,dDv.xPos+sC.cntRSize[0]-10,dDv.yPos+10,dDv.yPos+sC.cntRSize[1]-10];
});

function tSelectMouse(e){if(!e) e=wD.event;
	var mX=e.clientX,mY=e.clientY,mdX=mX+sC.xScrld,mdY=mY+sC.yScrld;
	sC.mOnXEdge=(mdX<sC.mTBox[0]||mdX>sC.mTBox[1])?1:0;
	sC.mOnYEdge=(mdY<sC.mTBox[2]||mdY>sC.mTBox[3])?1:0;
	sC.xAw=mX-sC.inMposX;sC.yAw=mY-sC.inMposY;
	sC.sXdir=(sC.xAw>40)?1:(sC.xAw<-40)?-1:0;sC.sYdir=(sC.yAw>40)?1:(sC.yAw<-40)?-1:0;
	if((sC.sXdir!=0||sC.sYdir!=0)&&!sC.tSelectFunc) sC.tSelectFunc=wD.setInterval(function(){
		if(sC.sXdir==0&&sC.sYdir==0){wD.clearInterval(sC.tSelectFunc);sC.tSelectFunc=false;return;};pageScrolled();
		if(sC.mOnXEdge==1||sC.mOnYEdge==1) dDv.contentScroll((sC.sXdir*sC.mOnXEdge)+"s",(sC.sYdir*sC.mOnYEdge)+"s",true);
	},45)
}
function intClear(){
	fleXenv.remTrggr(dC,'mousemove',tSelectMouse);if(sC.tSelectFunc) wD.clearInterval(sC.tSelectFunc);sC.tSelectFunc=false;
	if(sC.barClickRetard) wD.clearTimeout(sC.barClickRetard); if(sC.barClickScroll) wD.clearInterval(sC.barClickScroll);
}
function pageScrolled(){
	sC.xScrld=(wD.pageXOffset)?wD.pageXOffset:(dC.documentElement&&dC.documentElement.scrollLeft)?dC.documentElement.scrollLeft:0;
	sC.yScrld=(wD.pageYOffset)?wD.pageYOffset:(dC.documentElement&&dC.documentElement.scrollTop)?dC.documentElement.scrollTop:0;
}

dDv.scrollUpdate=function(recurse){
	if(tDv.getSize[1]()===0||tDv.getSize[0]()===0) return;
	cDv.sY.padding='1px';var reqH=sC.reqS[0],reqV=sC.reqS[1],vBr=tDv.vrt,hBr=tDv.hrz,vUpReq,hUpReq,cPSize=[];
	tDv.sY.width=dDv.offsetWidth-brdWidthLoss+'px';tDv.sY.height=dDv.offsetHeight-brdHeightLoss+'px';
	cPSize[0]=sC.cntRSize[0];cPSize[1]=sC.cntRSize[1];
	sC.reqS[0]=sC.getContentWidth()>sC.cntRSize[0];
	sC.reqS[1]=sC.getContentHeight()>sC.cntRSize[1];
	var stateChange=(reqH!=sC.reqS[0]||reqV!=sC.reqS[1]||cPSize[0]!=sC.cntRSize[0]||cPSize[1]!=sC.cntRSize[1])?true:false;
	vBr.sDv.setVisibility(sC.reqS[1]);hBr.sDv.setVisibility(sC.reqS[0]);
	vUpReq=(sC.reqS[1]||sC.forcedBar[1]);hUpReq=(sC.reqS[0]||sC.forcedBar[0]);
	sC.getContentWidth();sC.getContentHeight();sC.setHeight();sC.setWidth();
	if(!sC.reqS[0]||!sC.reqS[1]||sC.forcedHide[0]||sC.forcedHide[1]) hBr.jBox.fHide();
	else hBr.jBox.fShow();
	if(vUpReq) updateScroll(vBr,(hUpReq&&!sC.forcedHide[0])?sC.barSpace[1]:0);else cDv.sY.top="0";
	if(hUpReq) updateScroll(hBr,(vUpReq&&!sC.forcedHide[1])?sC.barSpace[0]:0);else cDv.sY.left="0";
	if(stateChange&&!recurse) dDv.scrollUpdate(true);
	cDv.sY.padding='0px';
	sC.edge[0]=sC.edge[1]=false;
};

dDv.commitScroll=dDv.contentScroll=function(xPos,yPos,relative){
	var reT=[[false,false],[false,false]],Bar;
	if((xPos||xPos===0)&&sC.scroller[0]){xPos=calcCScrollVal(xPos,0);Bar=tDv.hrz.sBr;Bar.trgtScrll=(relative)?Math.min(Math.max(Bar.mxScroll,Bar.trgtScrll-xPos),0):-xPos;Bar.contentScrollPos();reT[0]=[-Bar.trgtScrll-Bar.targetSkew,-Bar.mxScroll]}
	if((yPos||yPos===0)&&sC.scroller[1]){yPos=calcCScrollVal(yPos,1);Bar=tDv.vrt.sBr;Bar.trgtScrll=(relative)?Math.min(Math.max(Bar.mxScroll,Bar.trgtScrll-yPos),0):-yPos;Bar.contentScrollPos();reT[1]=[-Bar.trgtScrll-Bar.targetSkew,-Bar.mxScroll]}
	if(!relative) sC.edge[0]=sC.edge[1]=false;
	return reT;
};

dDv.scrollToElement=function(tEM){
if(tEM==null||!isddvChild(tEM)) return;
var sPos=findRCpos(tEM);
dDv.contentScroll(sPos[0]+sC.paddings[2],sPos[1]+sC.paddings[0],false);
dDv.contentScroll(0,0,true);
};

copyStyles(pDv,dDv,'0px',['border-left-width','border-right-width','border-top-width','border-bottom-width']);

dDv.removeChild(pDv);
dDv.scrollTop=0;dDv.scrollLeft=0;
dDv.fleXcroll=true;
classChange(dDv,'flexcrollactive',false);
dDv.scrollUpdate();
dDv.contentScroll(oScrollX,oScrollY,true);
if(urlBase.match(uReg)) {dDv.scrollToElement(dC.getElementById(urlBase.match(uReg)[1]));}
tDv.fShow();

sC.sizeChangeDetect=wD.setInterval(function(){
var n=fDv.offsetHeight;if(n!=sC.zTHeight){dDv.scrollUpdate();sC.zTHeight=n};
},2500);

function calcCScrollVal(v,i){
	var stR=v.toString();v=parseFloat(stR);
	return parseInt((stR.match(/p$/))?v*sC.cntRSize[i]*0.9:(stR.match(/s$/))?v*sC.cntRSize[i]*0.1:v);
}
function camelConv(spL){
	var spL=spL.split('-'),reT=spL[0],i;
	for(i=1;parT=spL[i];i++) {reT +=parT.charAt(0).toUpperCase()+parT.substr(1);}
	return reT;
}
function getStyle(elem,style){
	if(wD.getComputedStyle) return wD.getComputedStyle(elem,null).getPropertyValue(style);
	if(elem.currentStyle) return elem.currentStyle[camelConv(style)];
	return false;
};

function copyStyles(src,dest,replaceStr,sList){
	var camelList = new Array();
	for (var i=0;i<sList.length;i++){
		camelList[i]=camelConv(sList[i]);
		dest.style[camelList[i]] = getStyle(src,sList[i],camelList[i]);
		if(replaceStr) src.style[camelList[i]] = replaceStr;
	}
};
function createDiv(typeName,noGenericClass){
	var nDiv=dC.createElement('div')//,pTx=dC.createTextNode('\u00a0');
	nDiv.id=targetId+'_'+typeName;
	nDiv.className=(noGenericClass)?typeName:typeName+' scrollgeneric';
	nDiv.getSize=[function(){return nDiv.offsetWidth;},function(){return nDiv.offsetHeight;}];
	nDiv.setSize=[function(sVal){nDiv.sY.width=sVal;},function(sVal){nDiv.sY.height=sVal;}];
	nDiv.getPos=[function(){return getStyle(nDiv,"left");},function(){return getStyle(nDiv,"top");}];
	nDiv.setPos=[function(sVal){nDiv.sY.left=sVal;},function(sVal){nDiv.sY.top=sVal;}];
	nDiv.fHide=function(){nDiv.sY.visibility="hidden"};
	nDiv.fShow=function(coPy){nDiv.sY.visibility=(coPy)?getStyle(coPy,'visibility'):"visible"};
	nDiv.sY=nDiv.style;
//	if(!noGenericClass) nDiv.appendChild(pTx);
	return nDiv;
	
};
function createScrollBars(ary,bse){
	ary.sDv=createDiv(bse+'base');ary.sFDv=createDiv(bse+'basebeg');
	ary.sSDv=createDiv(bse+'baseend');ary.sBr=createDiv(bse+'bar');
	ary.sFBr=createDiv(bse+'barbeg');ary.sSBr=createDiv(bse+'barend');
	tDv.appendChild(ary.sDv);ary.sDv.appendChild(ary.sBr);
	ary.sDv.appendChild(ary.sFDv);ary.sDv.appendChild(ary.sSDv);
	ary.sBr.appendChild(ary.sFBr);ary.sBr.appendChild(ary.sSBr);
};
function prepareScroll(bAr,reqSpace){
	var sDv=bAr.sDv,sBr=bAr.sBr,i=sBr.indx;
	sBr.minPos=bAr.barPadding[0];
	sBr.ofstParent=sDv;
	sBr.mDv=mDv;
	sBr.scrlTrgt=cDv;
	sBr.targetSkew=0;
	updateScroll(bAr,reqSpace,true);
	
	sBr.doScrollPos=function(){
		sBr.curPos=(Math.min(Math.max(sBr.curPos,0),sBr.maxPos));
		sBr.trgtScrll=parseInt((sBr.curPos/sBr.sRange)*sBr.mxScroll);
		sBr.targetSkew=(sBr.curPos==0)?0:(sBr.curPos==sBr.maxPos)?0:sBr.targetSkew;
		sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
		cDv.setPos[i](sBr.trgtScrll+sBr.targetSkew+"px");
	};
	
	sBr.contentScrollPos=function(){
		sBr.curPos=parseInt((sBr.trgtScrll*sBr.sRange)/sBr.mxScroll);
		sBr.targetSkew=sBr.trgtScrll-parseInt((sBr.curPos/sBr.sRange)*sBr.mxScroll);
		sBr.curPos=(Math.min(Math.max(sBr.curPos,0),sBr.maxPos));
		sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
		sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
		cDv.setPos[i](sBr.trgtScrll+"px");
	};
	
	sC.barZ=getStyle(sBr,'z-index');
	sBr.sY.zIndex=(sC.barZ=="auto"||sC.barZ=="0"||sC.barZ=='normal')?2:sC.barZ;
	mDv.sY.zIndex=getStyle(sBr,'z-index');

	sBr.onmousedown=function(){
		sBr.clicked=true;sC.goScroll=sBr;sBr.scrollBoth=false;sBr.moved=false;
		fleXenv.addTrggr(dC,'selectstart',retFalse);
		fleXenv.addTrggr(dC,'mousemove',mMoveBar);
		fleXenv.addTrggr(dC,'mouseup',mMouseUp);
		return false;
		};
	
	sBr.onmouseover=intClear;
	
	 sDv.onmousedown=sDv.ondblclick=function(e){
		if(!e){var e=wD.event;}
		if(e.target&&(e.target==bAr.sFBr||e.target==bAr.sSBr||e.target==bAr.sBr)) return;
		if(e.srcElement&&(e.srcElement==bAr.sFBr||e.srcElement==bAr.sSBr||e.srcElement==bAr.sBr)) return;
		var relPos,mV=[];pageScrolled();
		sC.mDPosFix();
		findPos(sBr);
		relPos=(sBr.vertical)?e.clientY+sC.yScrld-sBr.yPos:e.clientX+sC.xScrld-sBr.xPos;
		mV[sBr.indx]=(relPos<0)?sC.baseAct[0]:sC.baseAct[1];mV[1-sBr.indx]=0;
		dDv.contentScroll(mV[0],mV[1],true);
		if(e.type!="dblclick") {
		intClear();
		sC.barClickRetard=wD.setTimeout(function(){
		sC.barClickScroll=wD.setInterval(function(){
		dDv.contentScroll(mV[0],mV[1],true);},80)},425);
		}
		return false;
	};
	sDv.setVisibility=function(r){
		if(r){sDv.fShow(dDv);
		sC.forcedHide[i]=(getStyle(sDv,"visibility")=="hidden")?true:false;
		if(!sC.forcedHide[i]) sBr.fShow(dDv); else sBr.fHide();
		sC.scroller[i]=true;classChange(sDv,"","flexinactive");
		}
		else{sDv.fHide();sBr.fHide();
		sC.forcedBar[i]=(getStyle(sDv,"visibility")!="hidden")?true:false;
		sC.scroller[i]=false;sBr.curPos=0;cDv.setPos[i]('0px');
		classChange(sDv,"flexinactive","");}
		mDv.setPos[1-i]((sC.forcedPos[i]&&(r||sC.forcedBar[i])&&!sC.forcedHide[i])?sC.barSpace[1-i]-sC.paddings[i*2]+"px":"-"+sC.paddings[i*2]+"px");
	};
	sDv.onmouseclick = retFalse;
};

function updateScroll(bAr,reqSpace,firstRun){
	var sDv=bAr.sDv,sBr=bAr.sBr,sFDv=bAr.sFDv,sFBr=bAr.sFBr,sSDv=bAr.sSDv,sSBr=bAr.sSBr,i=sBr.indx;
	sDv.setSize[i](tDv.getSize[i]()-reqSpace+'px');sDv.setPos[1-i](tDv.getSize[1-i]()-sDv.getSize[1-i]()+'px');
	sC.forcedPos[i]=(parseInt(sDv.getPos[1-i]())===0)?true:false;
	bAr.padLoss=bAr.barPadding[0]+bAr.barPadding[1];bAr.baseProp=parseInt((sDv.getSize[i]()-bAr.padLoss)*0.75);
	sBr.aSize=Math.min(Math.max(Math.min(parseInt(sC.cntRSize[i]/sC.cntSize[i]*sDv.getSize[i]()),bAr.baseProp),45),bAr.baseProp);
	sBr.setSize[i](sBr.aSize+'px');sBr.maxPos=sDv.getSize[i]()-sBr.getSize[i]()-bAr.padLoss;
	sBr.curPos=Math.min(Math.max(0,sBr.curPos),sBr.maxPos);
	sBr.setPos[i](sBr.curPos+sBr.minPos+'px');sBr.mxScroll=mDv.getSize[i]()-sC.cntSize[i];
	sBr.sRange=sBr.maxPos;
	sFDv.setSize[i](sDv.getSize[i]()-sSDv.getSize[i]()+'px');
	sFBr.setSize[i](sBr.getSize[i]()-sSBr.getSize[i]()+'px');
	sSBr.setPos[i](sBr.getSize[i]()-sSBr.getSize[i]()+'px');
	sSDv.setPos[i](sDv.getSize[i]()-sSDv.getSize[i]()+'px');
	if(!firstRun) sBr.doScrollPos();
	sC.fixIEDispBug();
};

sC.mDPosFix=function(){mDv.scrollTop=0;mDv.scrollLeft=0;dDv.scrollTop=0;dDv.scrollLeft=0;};

this.addTrggr(wD,'load',function(){if(dDv.fleXcroll) dDv.scrollUpdate();});
this.addTrggr(wD,'resize',function(){
if(dDv.refreshTimeout) wD.clearTimeout(dDv.refreshTimeout);
dDv.refreshTimeout=wD.setTimeout(function(){if(dDv.fleXcroll) dDv.scrollUpdate();},80);
});

for(var j=0,inputName;inputName=focusProtectList[j];j++){
	var inputList=dDv.getElementsByTagName(inputName);
	for(var i=0,formItem;formItem=inputList[i];i++){
	fleXenv.addTrggr(formItem,'focus',function(){dDv.focusProtect=true;});
	fleXenv.addTrggr(formItem,'blur',onblur=function(){dDv.focusProtect=false;});
}};

function retFalse(){return false;};
function mMoveBar(e){
if(!e){var e=wD.event;};
var FCBar=sC.goScroll,movBr,maxx,xScroll,yScroll;
if(FCBar==null) return;
if(!fleXenv.w3events&&!e.button) mMouseUp();
maxx=(FCBar.scrollBoth)?2:1;
for (var i=0;i<maxx;i++){
	movBr=(i==1)?FCBar.scrlTrgt.vBar:FCBar;
	if(FCBar.clicked){
	if(!movBr.moved){
	sC.mDPosFix();
	findPos(movBr);findPos(movBr.ofstParent);movBr.pointerOffsetY=e.clientY-movBr.yPos;
	movBr.pointerOffsetX=e.clientX-movBr.xPos;movBr.inCurPos=movBr.curPos;movBr.moved=true;
	};
	movBr.curPos=(movBr.vertical)?e.clientY-movBr.pointerOffsetY-movBr.ofstParent.yPos-movBr.minPos:e.clientX-movBr.pointerOffsetX-movBr.ofstParent.xPos-movBr.minPos;
	if(FCBar.scrollBoth) movBr.curPos=movBr.curPos+(movBr.curPos-movBr.inCurPos);
	movBr.doScrollPos();
	} else movBr.moved=false;
	};
};

function mMouseUp(){
	if(sC.goScroll!=null){sC.goScroll.clicked=false;}
	sC.goScroll=null;
	fleXenv.remTrggr(dC,'selectstart',retFalse);
	fleXenv.remTrggr(dC,'mousemove',mMoveBar);
	fleXenv.remTrggr(dC,'mouseup',mMouseUp);
};

function mWheelProc(e){
	if(!e) e=wD.event;
	if(!this.fleXcroll) return;
	var scrDv=this,vEdge,hEdge,hoverH=false,delta=0,iNDx;
	sC.mDPosFix();
	hElem=(e.target)?e.target:(e.srcElement)?e.srcElement:this;
	if(hElem.id&&hElem.id.match(/_hscroller/)) hoverH=true;
	if(e.wheelDelta) delta=-e.wheelDelta;if(e.detail) delta=e.detail;
	delta=(delta<0)?-1:+1;iNDx=(delta<0)?0:1;sC.edge[1-iNDx]=false;
	if((sC.edge[iNDx]&&!hoverH)||(!sC.scroller[0]&&!sC.scroller[1])) return;
	if(sC.scroller[1]&&!hoverH) scrollState=dDv.contentScroll(false,sC.wheelAct[iNDx],true);
	vEdge=!sC.scroller[1]||hoverH||(sC.scroller[1]&&((scrollState[1][0]==scrollState[1][1]&&delta>0)||(scrollState[1][0]==0&&delta<0)));
	if(sC.scroller[0]&&(!sC.scroller[1]||hoverH)) scrollState=dDv.contentScroll(sC.wheelAct[iNDx],false,true);
	hEdge=!sC.scroller[0]||(sC.scroller[0]&&sC.scroller[1]&&vEdge&&!hoverH)||(sC.scroller[0]&&((scrollState[0][0]==scrollState[0][1]&&delta>0)||(scrollState[0][0]==0&&delta<0)));
	if(vEdge&&hEdge&&!hoverH) sC.edge[iNDx]=true; else sC.edge[iNDx]=false;
	if(e.preventDefault) e.preventDefault();
	return false;
};

function isddvChild(elem){while(elem.parentNode){elem=elem.parentNode;if(elem==dDv) return true;}	return false;};

function findPos(elem){ 
//modified from firetree.net
	var obj=elem,curleft=curtop=0;
	var monc="";
	if(obj.offsetParent){while(obj){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;obj=obj.offsetParent; monc+=curtop+" ";}}
	else if(obj.x){curleft+=obj.x;curtop+=obj.y;}
	elem.xPos=curleft;elem.yPos=curtop;
};

function findRCpos(elem){
	var obj=elem;curleft=curtop=0;
	while(!obj.offsetHeight&&obj.parentNode&&obj!=cDv&&getStyle(obj,'display')=="inline"){obj=obj.parentNode;}
	if(obj.offsetParent){while(obj!=cDv){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;obj=obj.offsetParent;}}
	return [curleft,curtop];
};

function classChange(elem,addClass,remClass) {
	if (!elem.className) elem.className = '';
	var clsnm = elem.className;
	if (addClass && !clsnm.match(RegExp("(^|\\s)"+addClass+"($|\\s)"))) clsnm = clsnm.replace(/(\S$)/,'$1 ')+addClass;
	if (remClass) clsnm = clsnm.replace(RegExp("((^|\\s)+"+remClass+")+($|\\s)","g"),'$2').replace(/\s$/,'');
	elem.className=clsnm;
	};
},
//main code end
globalInit:function(){
if(fleXenv.catchFastInit) window.clearInterval(fleXenv.catchFastInit);
var regg=/#([^#.]*)$/,urlExt=/(.*)#.*$/,matcH,i,anchoR,anchorList=document.getElementsByTagName("a"),urlBase=document.location.href;
if(urlBase.match(urlExt)) urlBase=urlBase.match(urlExt)[1];
for(i=0;anchoR=anchorList[i];i++){
if(anchoR.href&&anchoR.href.match(regg)&&anchoR.href.match(urlExt)&&urlBase===anchoR.href.match(urlExt)[1]) {
	anchoR.fleXanchor=true;
	fleXenv.addTrggr(anchoR,'click',function(e){
		if(!e) e=window.event;
		var clickeD=(e.srcElement)?e.srcElement:this;
		while(!clickeD.fleXanchor&&clickeD.parentNode){clickeD=clickeD.parentNode};
		if(!clickeD.fleXanchor) return;
		var tEL=document.getElementById(clickeD.href.match(regg)[1]),eScroll=false;
		if(tEL==null) tEL=(tEL=document.getElementsByName(clickeD.href.match(regg)[1])[0])?tEL:null;
		if(tEL!=null){
		var elem=tEL;
		while(elem.parentNode){
			elem=elem.parentNode;if(elem.scrollToElement){
				elem.scrollToElement(tEL);eScroll=elem;
				};
			};
		if(eScroll) {if(e.preventDefault) e.preventDefault();document.location.href="#"+clickeD.href.match(regg)[1];eScroll.fleXdata.mDPosFix();return false;}
		};
		});
	};
};
fleXenv.initByClass();
if(window.onfleXcrollRun) window.onfleXcrollRun();
},

initByClass:function(){
if(fleXenv.initialized) return;
fleXenv.initialized=true;
var fleXlist=fleXenv.getByClassName(document.getElementsByTagName("body")[0],"div",'flexcroll');
for (var i=0,tgDiv;tgDiv=fleXlist[i];i++) fleXenv.fleXcrollMain(tgDiv);
},

getByClassName:function(elem,elType,classString){
//v1.1fleX
	if(typeof(elem)=='string') elem=document.getElementById(elem);
	if(elem==null)return false;
	var regExer=new RegExp("(^|\\s)"+classString+"($|\\s)"),clsnm,retArray=[],key=0;
	var elems=elem.getElementsByTagName(elType);
	for(var i=0,pusher;pusher=elems[i];i++){
	if(pusher.className && pusher.className.match(regExer)){
		retArray[key]=pusher;key++;
		}
	}
return retArray;
},

catchFastInit:window.setInterval(function(){
	var dElem=document.getElementById('flexcroll-init');
	if(dElem!=null) {fleXenv.initByClass();window.clearInterval(fleXenv.catchFastInit);}
	},100),

addTrggr:function(elm,eventname,func){if(!fleXenv.addChckTrggr(elm,eventname,func)&&elm.attachEvent) {elm.attachEvent('on'+eventname,func);}},

addChckTrggr:function(elm,eventname,func){if(elm.addEventListener){elm.addEventListener(eventname,func,false);fleXenv.w3events=true;window.addEventListener("unload",function(){fleXenv.remTrggr(elm,eventname,func)},false);return true;} else return false;},

remTrggr:function(elm,eventname,func){if(!fleXenv.remChckTrggr(elm,eventname,func)&&elm.detachEvent) elm.detachEvent('on'+eventname,func);},

remChckTrggr:function(elm,eventname,func){if(elm.removeEventListener){elm.removeEventListener(eventname,func,false);return true;} else return false;}

};

function CSBfleXcroll(targetId){fleXenv.fleXcrollMain(targetId)};
fleXenv.fleXcrollInit(); 