$(document).observe('dom:loaded', function() {

	var qty;
	
	qty = $$('div.photo_thumbs p a');
	if(qty.length > 0)
	{
		$$('div.photo_thumbs p a').each( function(el) 
		{
			new FancyZoom(el); 
		});
	}
	
	qty = $$('.news_hider_link');
	if(qty.length > 0)
	{
		$$('.news_hider_link').each( function(el)
		{
			el.observe('click', function(e)
			{
				e.target.up().previous().appear();
				e.target.hide();
				e.target.up().next().down().appear();
			});
			
		});
		
		$$('.news_hider_link_hide').each( function(el)
		{
			el.observe('click', function(e)
			{
				e.target.up().previous(1).hide();
				e.target.hide();
				e.target.up().previous().down().appear();
			});
			
		});
	}
	
	/*
new Ajax.Updater('quotes_container', 'quotes.htm', {
  		insertion: Insertion.Bottom
	});
*/


});

var newHeight;

function getSubBgHeight(){	
	var imageUrl = $('sub_photo').style.background.match(/url\((.+?)\)/i);
	var newImg = new Element('img', {src: imageUrl[1]}).observe('load', function(e){
		//console.log(e.target.width, e.target.height);
		newHeight = e.target.height;
	});
}

function revealSubPhoto(action)
{
	if(action == 'show')
	{
		$('sub_photo').morph('height: 500px;', {duration: 0.8});
		Effect.toggle('expander_link', 'appear');
		//Effect.toggle('collapser_link', 'appear', { queue: 'end'});
		Effect.toggle('buy_photo_info', 'appear', { queue: 'end'});
	}
	else if(action == 'hide')
	{
		$('sub_photo').morph('height: 200px;', {duration: 0.8});
		//Effect.toggle('collapser_link', 'appear');
		Effect.toggle('buy_photo_info', 'appear');
		Effect.toggle('expander_link', 'appear', { queue: 'end'});
	}
}