// <![CDATA[
$(document).ready(function() {
						   
/* main menu with submenus /**/
$('#nav>li').each(function(){
	//var id_text = $(this).attr('code');
	//var name_text = $(this).find('item').text();
	//alert($(this).attr('class'));
	//alert($(this).text());
	
	$(this).hover(
		function () {
			$(this).addClass('sfhover');
		},
		function () {
			$(this).removeClass('sfhover');
		}
	);
});

/* toggle 2nd level submenus /**/
$('#nav>li>ul>li:has(ul)').each(function(){
	//alert($(this).text());
	$(this).hover(
		function () {
			$(this).children("ul").css("visibility", "visible");
		},
		function () {
			$(this).children("ul").css("visibility", "hidden");
		}
	);
});

/*
$("#nav>li:first").addClass("first");
$("#nav>li:last").addClass("last");
/**/

$('#nav>li:has(ul)>a:first-child').each(function(){
	//alert($(this).text());
	$(this).addClass('mainfoldericon');
});

$('#nav>li:has(ul)>ul>li:has(ul)>a:first-child').each(function(){
	//alert($(this).text());
	$(this).addClass('subfoldericon');
});
/**/
						   
/* scrollers /**
	$("div.scrollable").scrollable({
		vertical: true, 
		size: 1,
		loop: true
	}).mousewheel().circular().autoscroll({
		autoplay: true,
		autopause: true,
		interval: 7000,
		api: true
	}); 
/**/
	
	
/* scrollers /**/
	//.mousewheel(400)
	$("#flowpanes").scrollable({
		size:1,
		circular: true
	}).autoscroll({
		autoplay:true,
		autopause:true,
		interval:7000
	});
/**/

/* table row color strips /**/
	$('table.sortable tbody tr:not([th]):nth-child(odd)').addClass('odd');
	$('table.sortable tbody tr:not([th]):nth-child(even)').addClass('even');
/**/

/* overlays /**/
	$("*[rel^=#]").overlay({
		mask: {
			color: '#fff',
			// load mask a little faster
			loadSpeed: 200,
			opacity: 0.4
		},
		fixed: false,
		closeOnClick: true,
		closeOnEsc: true,
		load: false
	});
/**/
/* Flickr Set Overlays /**/
$("a[href^=http://www.flickr.com/photos/][href$=/show/][rel~=lightbox]").click(function() {
	if ( window.flickr_id === undefined ){
		window.flickr_id = 'flickr' + Math.floor(Math.random()*10000);
		while( $(window.flickr_id).length != 0 ) {
			// element with this id exists
			window.flickr_id = 'flickr' + Math.floor(Math.random()*10000);
			//alert( window.flickr_id );
		}
		$('body').append('<div class="simple_overlay" id="' + window.flickr_id + '"><div class="inner-div"></div></div>');
		$('#'+window.flickr_id ).css('width', '855px');
		$('#'+window.flickr_id ).css('padding', '15px');
		$('#'+window.flickr_id ).css('background-color', 'black');
		
	}
	//alert( window.flickr_id );
	//alert( $(window.flickr_id) );
	
	var flickr_url_array = $(this).attr("href").split('/');
	//alert( flickr_url_array[6] );
	
	var flickr_user_id = flickr_url_array[4];
	var flickr_set_id = flickr_url_array[6];
	
	$( '#'+window.flickr_id + ' .inner-div' ).html('<object width="855" height="641"> <param name="flashvars" value="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F' + flickr_url_array[4] + '%2Fsets%2F' + flickr_url_array[6] + '%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F' + flickr_url_array[4] + '%2Fsets%2F' + flickr_url_array[6] + '%2F&amp;set_id=' + flickr_url_array[6] + '&amp;jump_to="></param> <param name="movie" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649"></param> <param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" allowFullScreen="true" flashvars="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F' + flickr_url_array[4] + '%2Fsets%2F' + flickr_url_array[6] + '%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F' + flickr_url_array[4] + '%2Fsets%2F' + flickr_url_array[6] + '%2F&amp;set_id=' + flickr_url_array[6] + '&amp;jump_to=" width="855" height="641"></embed></object>');
	//alert( $('#'+window.flickr_id).html() );
	
	$(this).removeData('overlay');

//$( '#'+window.flickr_id ).overlay({
	$(this).overlay({
		mask: {
			color: '#fff',
			// load mask a little faster
			loadSpeed: 200,
			opacity: 0.4
		},
		fixed: false,
		closeOnClick: true,
		closeOnEsc: true,
		load: true,
		target: '#'+window.flickr_id
	});
	
	
	/*
	alert( $(this).attr("href") );
	/**/
	return false;
});
/**/

/* flash files /**/
	$('div[class^=flash]').each(function(index) {
		//alert($(this).attr('id'));
		//alert($(this).attr('title'));
		flashembed($(this).attr('id'), {
			src: $(this).attr('title'), 
			//bgcolor: 'transparent',
			wmode: 'transparent',
			version: [8, 0]
		});

	});

/**/

});

/* OUTSIDE DOCUMENT READY /**/

/* Google Analytics for theeasterbunny.com /**/
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1892705-16']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
/**/

//--><!]]>
