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,gallery:false,product:false}).addClass('current');
	$('li').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	$('.js_email').each(function(i) {
		text = $(this).attr('rel').split('').reverse().join('');
		$(this).html('<a href="mailto:'+text+'">'+text+'</a>')
	});
	var month = '';
	$('.date_list .date').each(function(i) {
		if ($(this).attr('rel') != month) {
			month = $(this).attr('rel');
			$(this).parent('li').before('<li class="month">'+month+'</li>');
		}
	});
	$('.slideshow .image img').attr('rel', 0);
	$('.slideshow .other_images img').each(function(i) {
		$(this).attr('rel', i).hide();
	});
	$('.pagination a').click(function() {
		var current_rel = $(this).parent().siblings('.image').children('img').eq(0).attr('rel');
		var change_rel = Number(current_rel) + Number($(this).attr('rel'));
		var total = $(this).parent().siblings('.other_images').find('img').size()
		if (change_rel < 0) { change_rel = total - 1; }
		if (change_rel >= total) { change_rel = 0; }
		$(this).parent().siblings('.image').children('img').fadeOut(500, function() {
			$(this).after($(this).parent().siblings('.other_images').find('img').eq(change_rel).clone());
			var new_image = $(this).siblings().eq(0);
			$(this).parents('.panel').find('.caption').html($(this).parent().siblings('.other_images').find('span').eq(change_rel).html());
			$(this).remove();
			$(new_image).fadeIn(500);
		});
	});
	if ($('.slideshow').size() && $('.grid .current').size() == 0) {
		$('.grid .item a').eq(0).addClass('current');
	}
	/*$('.buy_link').each(function(i) {
		href = $(this).attr('href').split('_http')[0];
		url = window.location;
		$(this).attr('href', href + '_' + escape(url));
	});*/
	$('form label').each(function(i) {
		label = this;
		$(this).parent('div').addClass('js_applied');
		$(label).siblings('input').eq(0).each(function(i) {
			$(this).attr('rel', $(label).html());
		});
		$(this).remove();
	});
	$('form input').each(function(i) {
		if ($(this).val() == '' || $(this).val() == $(this).attr('rel')) {
			$(this).addClass('blur').val($(this).attr('rel'));
		}
	}).focus(function(i) {
		$(this).removeClass('blur');
		if ($(this).val() == $(this).attr('rel')) {
			$(this).val('');
		}
	}).blur(function(i) {
		if ($(this).val() == '' || $(this).val() == $(this).attr('rel')) {
			$(this).addClass('blur').val($(this).attr('rel'));
		}
	});
	$('.video_thumbnails .item a').click(function() {
		video = $('.video_list span[data-name="'+$(this).attr('data-name')+'"]');
		$('#video_frame').attr('src',$(video).attr('data-url')).parents('.panel').children('h4').html($(video).attr('data-description'));
		$('.video_thumbnails .item a.current').removeClass('current');
		$(this).addClass('current');
	}).eq(0).click();
}
$(document).ready(function() {
	
});
