// default.js v1.0.8, Tue Nov 25 13:30:58 +0100 2009
var Default = {
	
	GET: {},
	_Promos: undefined,
	
	initialize: function( )
	{
		document.viewport.getWidth() > 1024 ? false : document.getElementsByClassName('body')[0].style.backgroundPosition = '-320px bottom';
		document.location.toString().match( /^((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}\/?$/ ) ? this.runHomepage() : false;
	},
	
	init: function( )
	{
		
	},
	
	redirect: function( url )
	{
		url = url.toString().replace( /&amp;/g , '&' );
		
		window.location = url;
	},
	
	serachRun: function( el )
	{
		//this.ts( false , 'Trwa wyszukiwanie...' , true , 1000 );
		
		el.action = el.action + el.down('input').value.urlencode() + '/0.xml'; 
		el.down('fieldset').remove();
	},
	
	runHomepage: function( )
	{
		this.runPromos();
	},
	
	runPromos: function( )
	{
		this._Promos = new PeriodicalExecuter( function( pe ){ Default.nextPromo(); } , 4 );
	},
	
	setPromo: function( el )
	{
		$('pident').innerHTML = el.id.replace('promo_','' );
		$('pimage').onclick = function(event){ Default.redirect( el.down('a').href ); };
		$('pimage').style.backgroundImage = 'url(\''+ el.down('img').src +'\')';		
	},
	
	nextPromo: function( )
	{
		curre = $('pident').innerHTML;
		check = $('promo_' + curre ).next('div .promo');
		check ? check : check = $('promo_0');
		
		$('pident').innerHTML = check.id.replace('promo_','' );
		$('pimage').onclick = function(event){ Default.redirect( el.down('a').href ); };
		$('pimage').style.backgroundImage = 'url(\''+ check.down('img').src +'\')';
	}
	
	/* EoF */
};

Event.observe( document , 'dom:loaded' , function(event){ Default.initialize(); });