(function($) {
	$(document).ready(function () {
		$('#loginForm input').each(function () {
			if ($(this).val() == '') {
				$(this).val($(this).attr('defaultvalue'));
			}
		}).focus(function () {
			if ($(this).val() == $(this).attr('defaultvalue')) {
				$(this).val('');
			}
		}).blur(function () {
			if ($(this).val() == '') {
				$(this).val($(this).attr('defaultvalue'));
			}
		});
		
		$('ul.switch-group li').hover(function() {
		 $(this).children().css('color', '#f0f0f0');
		 $(this).children('.site').css('text-decoration', 'underline');
		 $(this).children('.about').css('cursor', 'pointer');
		}, function() {
		 $(this).children().css('color', '');
		 $(this).children('.site').css('text-decoration', 'none');
		}).click(function() {
		 document.location = $(this).children('.site')[0].href;
		});
		
		// labelling logic for images and videos
		
		$('label[for=video_ref]').hide();
		$('select#design_category_id > option').click(function() {
			if ($(this).attr('is_video') == 1) {
				$('label[for=main_image]').fadeOut(function() {
					$('label[for=main_image] input').val("");
					$('label[for=video_ref]').fadeIn();
				});
			} else {
				$('label[for=video_ref]').fadeOut(function() {
					$('label[for=video_ref] input').val("");
					$('label[for=main_image]').fadeIn();
				});
			}
		});
		
		// fancybox
		
		$("a.tips").fancybox();
	});
})(jQuery);