window.addEvent('domready',function(e){
	
var subcontainer = new Fx.Morph($('sub-1'),{duration:500,transition: Fx.Transitions.Expo.easeOut,wait:false});
		$$('#mainmenu li a').each(function(el,i){

			if(el.getParent('li').hasClass('current'))
			showSubz(i);	
			
			
	el.addEvent('mouseenter',function(e){
		showSubz(i);
		
		});
			
			
		});
	
	
		
function showSubz(inc)
{
	
	
	var zetop = inc*($('sub-1').getHeight().toInt());
	
		subcontainer.start({'margin-top':-(zetop)});
	
	
}


/* ************************** */

if($('toplatests'))
{
	var latest_curpage=0;
	var latest_maxpage=2;
	var Lsize = 900;
	var topnewslist = $$('#toplatests ul')[0];
		var toplatests = $$('#toplatests ul li');
		var newwidth = (toplatests[0].getWidth().toInt())*toplatests.length;
		topnewslist.setStyle('width',newwidth);

	/*var topnewslistFx = new Fx.Morph(topnewslist,{duration:900,transition: Fx.Transitions.Expo.easeOut,wait:false});*/
		
	$('toplatestsprev').addEvent('click',function(e){
		
		new Event(e).stop();
		
			
			latest_curpage=latest_curpage-1;
			
				if(latest_curpage<0)
				{ 
					latest_curpage = latest_maxpage;
					topnewslist.set('morph', {duration:800,transition: 'back:in'});
				
				}
				else
				{
					topnewslist.set('morph', {duration:800,transition: 'quart:out'});
				}
			
			ShowLastest();
		
		});
		
	$('toplatestsnext').addEvent('click',function(e){
		
		new Event(e).stop();
		
			
			latest_curpage=latest_curpage+1;
			
				if(latest_curpage>latest_maxpage) 
				{
					latest_curpage = 0;
					topnewslist.set('morph', {duration:800,transition: 'back:in'});
				}
				else
				{
					topnewslist.set('morph', {duration:800,transition: 'quart:out'});
					
				}
			ShowLastest();
		
		});
			
		
		
		
function ShowLastest()
{
	
	var marge = (latest_curpage*Lsize);
	topnewslist.morph({'margin-left':-(marge)});
	
	
}		
		
/* fin latest */				
}




if($('photosetcontainer'))
{
	var perpage=9;
	var setpage=0;
	var ulwidth = 0;
	var ulid = [];
	/*var containerwidth = $('photosetcontainer').getWidth();*/
	var fxlist = new Fx.Morph($('photoset'),{duration:900,transition: Fx.Transitions.Expo.easeOut,wait:false});
	$$('ul#photoset li').each(function(el,i)
	{
		
		ulwidth = ulwidth+el.getWidth()+4;
		ulid[i]=el.getProperty('id');
	});
	
	var itemwidth = (ulwidth/$$('ul#photoset li').length);
	var containerwidth = (itemwidth*perpage);
	$('photosetcontainer').setStyle('width',containerwidth);
	var maxpage = Math.floor($$('ul#photoset li').length/(containerwidth/itemwidth));
	
	$('photoset').setStyle('width',(ulwidth));
	

	
	function scrollmenext()
	{
		
		if(setpage>=maxpage)
		return;
		
		setpage=setpage+1;
		fxlist.start({'margin-left':-(setpage*containerwidth)});
			
		
	}	

	function scrollmeprev()
	{
		
		if(setpage<=0)
		return;
		
		setpage=setpage-1;
		fxlist.start({'margin-left':-(setpage*containerwidth)});
			
		
	}		
	
		
	$('setnext').addEvent('click',function(e){
		
		new Event(e).stop();
		
		
		scrollmenext();
		});
		
	$('setprev').addEvent('click',function(e){
		
		new Event(e).stop();
		
		
		scrollmeprev();
		});	
		
		
	
	function loadactivepage(item)
	{
		$(item).addClass('current');
		 setpage =  Math.floor(ulid.indexOf(item)/perpage);
		
		fxlist.start({'margin-left':-(setpage*containerwidth)});
	}	
		/* */	
		
	loadactivepage('list-'+$('currentimg').getProperty('rel'));	
		
}
/* fin photosetcontainer */				


if($('becomesubscriber'))
{
	
$('becomesubscriber').empty().setStyle('text-indent','0');	
var pub_subscribe = new Swiff('/wp-content/themes/whitewall/images/pub_subscribe.swf', {
    id: 'pub_subscribe',
    width: 560,
    height: 130,
    container:$('becomesubscriber'),
    params: {
        wmode: 'transparent',
        bgcolor: '#ffffff'
    }
    
});

}

/* find domready */	
});