$(document).ready(function() {
	$(".framed").hover(function() {
		$(this).find('img').stop(true, true).fadeTo(250, 0.7);
	} , function() { //On hover out...
		$(this).find('img').stop(true, true).fadeTo(250, 1);
	});
	$("#gallery li .thumbnail a").hover(function() {
		$(this).find('img').stop(true, true).fadeTo(250, 0.7);
	} , function() { //On hover out...
		$(this).find('img').stop(true, true).fadeTo(250, 1);
	});
	$('a[href*=#]').click(function(){
		if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname)
		{
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if($target.length)
			{
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 1000, 'easeInOutSine');
				return false;
			}
		}
	});
	$('.close span.cross').click(function(){
		$(this).parent('.close').slideUp(100,'easeInOutSine');
	});
	$("a[rel^='zoom']").prettyPhoto({
		theme: 'light_square', 			/* light_rounded / dark_rounded / light_square / dark_square / facebook */
		animation_speed: 'slow', 		/* fast/slow/normal */
		slideshow: false, 				/* false OR interval time in ms */
		autoplay_slideshow: false,		/* true/false */
		opacity: 0.70, 					/* Value between 0 and 1 */
		show_title: true, 				/* true/false */
		allow_resize: true, 			/* Resize the photos bigger than viewport. true/false */
		counter_separator_label: '/', 	/* The separator for the gallery counter 1 "of" 2 */
		hideflash: true, 				/* Hides all the flash object on a page if set to TRUE */
		wmode: 'opaque', 				/* Set the flash wmode attribute */
		autoplay: false, 				/* Automatically start videos: True/False */
		modal: false, 					/* If set to true, only the close button will close the window */
		overlay_gallery: true, 			/* If set to true, a gallery will overlay the fullscreen image on mouse over */
		keyboard_shortcuts: true, 		/* Set to false if you open forms inside prettyPhoto */
		default_width: 500,
		default_height: 344
	});
	$("#form").validate();
	$("#login-form").validate();
	$('#workshop-start-date, #workshop-end-date, #conference-start-date, #conference-end-date, #course-start-date, #course-end-date, #journal-start-date, #journal-end-date').datepicker({
    	duration: '',
        showTime: false,
        constrainInput: false,
		dateFormat: 'yy-mm-dd'
    });
	$('#session-date').datepicker({
    	duration: '',
        constrainInput: false,
		dateFormat: 'yy-mm-dd',
		showTime: true,
		time24h: true
    });
	getTwitters('latest-tweet', { 
	  id: 'spelt_', 
	  count: 1, 
	  enableLinks: true, 
	  newwindow: true,
	  ignoreReplies: true,
	  clearContents: true,
	  template: '<p>%text% - %time%</p>'
	});
	$('#google-map-info').css('display', 'block');
	$('#google-map').googleMaps({
		latitude: 24.830990,
		longitude: 67.074535,
		depth: 16,
		scroll: false,
		markers:
		{
			latitude: 24.830990,
			longitude: 67.074535,
			icon: {
                image: '../images/map-spelt-marker.png',
                shadow: '../images/map-spelt-marker-shadow.png',
                iconSize: '32, 32',
                shadowSize: '32, 32'
            },
			info:
			{
				layer: '#google-map-info'
			}
		}
	});
	$("#logo a span.home, #logo a:hover span.home").css('display', 'none');
	$("#logo a").hover(function() {
		$(this).find('span.home').stop(true, true).fadeTo(200, 1);
	} , function() { //On hover out...
		$(this).find('span.home').stop(true, true).fadeTo(200, 0);
		$("#logo a span.home, #logo a:hover span.home").css('display', 'none');
	});
	$("#menu li a span, #menu li a span:hover").css('display', 'none');
	$("#menu li a").hover(function() {
		$(this).find('span').stop(true, true).fadeTo(200, 1);
	} , function() { //On hover out...
		$(this).find('span').stop(true, true).fadeTo(200, 0);
		$("#menu li a span, #menu li a span:hover").css('display', 'none');
	});
	$("#social li a span, #social li a span:hover").css('display', 'none');
	$("#social li a").hover(function() {
		$(this).find('span').stop(true, true).fadeTo(200, 1);
	} , function() { //On hover out...
		$(this).find('span').stop(true, true).fadeTo(200, 0);
		$("#social li a span, #social li a span:hover").css('display', 'none');
	});
	$("#share li").hover(function() {
		$(this).find('a').stop(true, true).fadeTo(200, 0.6);
	} , function() { //On hover out...
		$(this).find('a').stop(true, true).fadeTo(200, 1);
	});
	$('.show-sub-list').click(function(){
		$(this).parent('li').find('> ul').stop(true, true).slideToggle(250,'easeInOutSine');
	});
	$('.show-sub-sub-list').click(function(){
		$(this).parent('li').find('> ul').stop(true, true).slideToggle(250,'easeInOutSine');
	});
});
