var SiteClass = new Class({

	initialize: function(){
	
	}, // initialize
	
	activeNews: null, 
	
	fadeDuration: 1000,
	delayDuration: 5000,
	
	domReady: function() {
		
		sIFR.replaceElement(named({sSelector:"h1.slogan", sFlashSrc:"public/flash/sifr2.swf", sColor:"#545454", sLinkColor:"#545454", sBgColor:"#FFFFFF", sHoverColor:"#545454", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"h2.orange", sFlashSrc:"public/flash/sifr2.swf", sColor:"#FF7200", sLinkColor:"#FF7200", sBgColor:"#FFFFFF", sHoverColor:"#FF7200", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));
		sIFR.replaceElement(named({sSelector:"h2.blue", sFlashSrc:"public/flash/sifr2.swf", sColor:"#0f6aa4", sLinkColor:"#0f6aa4", sBgColor:"#FFFFFF", sHoverColor:"#0f6aa4", nPaddingTop:0, nPaddingBottom:0, sWmode:"transparent", sFlashVars:"textalign=left&offsetTop=0"}));

		if(Browser.Engine.trident4) { $$('div#columns div.column').each(function(elem){ elem.addEvents({'mouseenter': function(){ this.toggleClass('hover'); }, 'mouseleave': function(){ this.toggleClass('hover'); } }); }); }
		if($('news')) {
			this.activeNews = $('news').getFirst().get('id');
			$$('ul#news li').each(function(li, k){ if(k) li.setStyle('opacity', 0); });
			$$('div#column-center div.pager a').each(function(a){
				a.addEvent('click', function(){
					this.blur();
					var rel = this.get('rel');
					if(Site.activeNews != rel) {
						$$('div#column-center div.pager a').each(function(a){ a.removeClass('active'); });
						this.addClass('active');
						$(Site.activeNews).fade(0);
						$(rel).fade(1);
						Site.activeNews = rel;
					}
					return false;
				});
			});		
		}

		if($('customers')) {
			$$('ul#customers li').each(function(li, i) { li.setStyle('opacity', 0); if(i == 0) li.addClass('active'); });
			new Fx.Tween($('customers').getFirst(), {duration: Site.fadeDuration}).start('opacity', 0, 1);
			
			if($$('ul#customers li').length > 1) {
				var nextLogo = function() {
					var lis = $$('ul#customers li.active');
					new Fx.Tween(lis[0], {
						duration: Site.fadeDuration, 
						onComplete: function(li){
							li.removeClass('active');
							var next = (li.getNext()) ? li.getNext() : li.getParent().getFirst();
							next.addClass('active');
							new Fx.Tween(next, {
								duration: Site.fadeDuration
							}).start('opacity', 0, 1);
						}
					}).start('opacity', 1, 0);
				}
				var periodical = nextLogo.periodical(2 * Site.fadeDuration + Site.delayDuration);
			}
		}

	}, // domReady

	showMail: function(user, domain, contry, attr, no_text) {
		var start = "<a href=\"mailto:" + user + "@" + domain + "." + contry + "\"" + attr + ">";
		var end = "</a>";
		if(no_text == false) { document.write(start + user + "@" + domain + "." + contry + end); }
			else { document.write(start + end); }
		return false;
	} // showMail
	
});

var Site = new SiteClass();
window.addEvent('domready', function(){ Site.domReady(); });
