$(document).ready(function(){
    /* Big Links */
	$('.select').each(function(){
		$(this).hover(function(){
			$(this).find('a').addClass('goClass');
			status=$(this).find('a').attr('href');
		}, function(){
			$(this).find('a').removeClass('goClass');
			status='';
		});
		$(this).click(function(){
			location = $(this).find('a').attr('href');
		});
		$(this).css('cursor', 'pointer');
	});
	/* gallery lightbox */
	var lbOptions = {
		imageBtnClose: '/media/images/lightbox-btn-close.gif',
		imageBtnPrev: '/media/images/lightbox-btn-prev.gif',
		imageBtnNext: '/media/images/lightbox-btn-next.gif',
		imageLoading: '/media/images/lightbox-ico-loading.gif',
		imageBlank:'/media/images/lightbox-blank.gif'
	}
	$('#galleryImages a').lightBox(lbOptions);
	$('#galleryImages img').each(function(){
		$(this).hover(function(){
			$(this).addClass('rollover');
		}, function(){
			$(this).removeClass('rollover');
		});
	});
	/* Order images */
	$('.sortable li').each(function(){
		$(this).hide();
	});
	$('.sortable').sortable({
		update : function () {
			var order = [];
			$('.sortable input').each(function(){
				order.push($(this).attr('id'));
			});
			for (i=0; i<order.length; i++) {
				var orderTarget = '#' + order[i];
				$(orderTarget).val(i+1);
			}
		}
	});
	$('.sortable').disableSelection();
	/* Order galleries*/
	$('.order').each(function(){
		$(this).hover(function(){
			$(this).addClass(goClass);
		}, function(){
			$(this).removeClass(goClass);
		});
		$(this).css('cursor', 'pointer');
	});
	/* navigation */
	$('.nav_contact a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom left",
	    offset: [4, 145],
	    delay: 100,
	    tip: ".ctooltip"
		});
	});
	$('.nav_about a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom center",
	    offset: [4, 62],
	    delay: 100,
	    tip: ".atooltip",
		});
	});
	$('.nav_video a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom center",
	    offset: [4, 62],
	    delay: 100,
	    tip: ".vtooltip"
		});
	});
	$('.nav_photo a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom center",
	    offset: [4, 59],
	    delay: 100,
	    tip: ".ptooltip"
		});
	});
	$('.nav_review a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom center",
	    offset: [4, 52],
	    delay: 100,
	    tip: ".rtooltip"
		});
	});
	
	$('.nav_blog a').each(function(){
		$(this).click(function(){
			return false;
		});
		$(this).css('cursor', 'default');
		$(this).tooltip({ 
	    position: "bottom center",
	    offset: [4, 67],
	    delay: 100,
	    tip: ".btooltip"
		});
	});
	$('.btooltip').hover(function(){
			$('.nav_blog a').css('color', '#2786C2');
		}, function(){
			$('.nav_blog a').css('color', '#CCCCCC');
	});
	$('.rtooltip').hover(function(){
			$('.nav_review a').css('color', '#2786C2');
		}, function(){
			$('.nav_review a').css('color', '#CCCCCC');
	});
	$('.ptooltip').hover(function(){
			$('.nav_photo a').css('color', '#2786C2');
		}, function(){
			$('.nav_photo a').css('color', '#CCCCCC');
	});
	$('.vtooltip').hover(function(){
			$('.nav_video a').css('color', '#2786C2');
		}, function(){
			$('.nav_video a').css('color', '#CCCCCC');
	});
	$('.atooltip').hover(function(){
			$('.nav_about a').css('color', '#2786C2');
		}, function(){
			$('.nav_about a').css('color', '#CCCCCC');
	});
	$('.ctooltip').hover(function(){
			$('.nav_contact a').css('color', '#2786C2');
		}, function(){
			$('.nav_contact a').css('color', '#CCCCCC');
	});		
	$('#nav li.main a').each(function(){
		$(this).css('color', '#CCCCCC');
	});
	/* contact form */
	$('#contact_form').validate();
	/* table */
	$('table').tablesorter();
});