/**
 * @author jleeder
 */

function closeDropdown(){
	$('#share .dropdown').slideUp('fast');
	clearTimeout(timeout);
}
var timeout;

$(document).ready( function(){
	$('#shareBtn').bind('click', function(){
		//make sure only one timeout is active at a time
		clearTimeout(timeout);
		$('#share .dropdown').stop().hide().attr('style','');
		$('#share .dropdown').stop().slideDown('fast');
		timeout = setTimeout("closeDropdown()", 1500);
		return false;
	});

	$('#share .dropdown').hover(	
		function(){
			clearTimeout(timeout);
			$('#share .dropdown').stop().attr('style','').show();
		},
		function(){
			timeout = setTimeout("closeDropdown()", 5);
		}
	);
	//old
	/*$('#pdfSelector').change(function(){
		var loc = $('#pdfSelector option:selected').val();
		if (loc != 'default'){
			window.open(loc);
			$('#default').attr('selected',true);	
		}
	});*/
	
	//new (R.Huber)
	
	/*$('.download').click(function(event){
		event.preventDefault();
		window.alert('please select an option to download');
	});*/
	$('.download').click(function(event){
		event.preventDefault();
		var loc = $('#pdfSelector option:selected').val();
		if (loc != 'default'){
			window.open(loc);
		}
	});
	/*$('#pdfSelector').change(function(){
		var loc = $('#pdfSelector option:selected').val();
		if (loc != 'default'){
			$('.download').click(function(event){
			event.preventDefault();
			window.open(loc);
			$('#default').attr('selected',true);
			});
		}
		*/
		/*else {
			$('.download').click(function(event){
			event.preventDefault();
			window.alert('please select an option to download');
			});
		}*/
			
			

/*	
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=24925022@N00&lang=en-us&format=json&jsoncallback=?", function(data){
		$.each(data.items, function(i,item){
    		var thumbnail = item.media.m.replace(/_m.jpg/,'_t.jpg');
			$("<img/>").attr("src", thumbnail).appendTo("<div />").appendTo("#images").wrap("<a class='imageLink' target='_blank' href='" + item.link + "'></a>");
			if (i == 9) return false;
  		});
	});

	$('.scrollable').scrollable({
		items: '#images',
		size: 2
	});
*/
});
