function document_complete() {
	jQuery.expr[':'].Contains = function(a,i,m){
		return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
	};
	if (typeof console == "object") log = console.log; else log = function() {};
	Array.prototype.has=function(v,i){
		for (var j=0;j<this.length;j++){
			if (this[j]==v) return (!i ? true : j);
		}
		return false;
	}
	$('a').query({page:true}).addClass('current');
	$('.no_content ul.menu li a').click(function() {
		clicked = $(this);
		$('#header').animate({left: 140}, 800);
		$('#main_area > .content').animate({right: -140}, 800);
		$('#main_area > .image').animate({left: -140}, 800, function() {
			window.location = $(clicked).attr('href');
		});
		return false;
	});
	$('.adjust-property').each(function(i) {
		var main = this;
		var propertyType = typeof (propertyType = $(this).attr('data-adjust-property-type')) == 'string' ? propertyType : false;
		var propertyPosition = typeof (propertyPosition = $(this).attr('data-adjust-property-position')) == 'string' ? propertyPosition.split(' ') : false;
		var propertySelector = typeof (propertySelector = $(this).attr('data-adjust-property-selector')) == 'string' ? propertySelector : false;
		var propertyContainer = typeof (propertyContainer = $(this).attr('data-adjust-property-container')) == 'string' ? $(this).find(propertyContainer) : $(this);
		if (!propertyType || !propertySelector) { return false; }
		$(propertyContainer).each(function(i) {
			divisor = 1;
			container_width = $(this).width();
			item_count = $(this).find(propertySelector).size();
			item_width = container_width / item_count;
			properties = {};
			switch (propertyType) {
				case 'width':
					if (propertyPosition.has('left')) { properties['width'] = item_width / divisor; }
				break;
				case 'padding':
					if (propertyPosition.has('left') && propertyPosition.has('right')) { divisor = 2; }
					if (propertyPosition.has('left')) { properties['padding-left'] = false; }
					if (propertyPosition.has('right')) { properties['padding-right'] = false; }
					total_width = 0;
					$(this).find(propertySelector).each(function(i) {
						total_width += $(this).width();
					});
					this_properties = {};
					$.each(properties, function(k,v) {
						this_properties[k] = (container_width - total_width) / ((item_count - 1) * divisor) - 0.5;
					});
					$(this).find(propertySelector).css(this_properties);
					$(this).find(propertySelector).eq(0).css('padding-left',0).end().eq($(this).find(propertySelector).size()-1).css('padding-right',0);
				break;
			}
		});
	});
}
$(document).ready(function() {
	$('#slideshow').cycle({
		fx: 'fade',
		timeout: 4000,
		speedIn: 1500,
		speedOut: 5000
	});
});
