window.addEvent('domready', function domreadyFunctions(){
	var requestQueue = new Request.Queue();
	////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////
	//patch for IE6
	if((Browser.Engine.version==4&&Browser.Engine.trident)){
		$$("#mainMenu>ul>li").each(function(el){
			el.addEvents({
				'mouseenter': function(){
					this.addClass('ie-hover');
					if(this.getElement('ul')){
						this.getElement('ul').setStyles({
							'background': '#313030'
						});
					}
				}
				,'mouseleave': function(){
					this.removeClass('ie-hover');
				}
			});
		});
	}
	$$("#mainMenu>ul>li").each(function(el, i){
		if(el.getElement('ul')){
			var width = el.getSize().x;
			if(i==2){
				width=width+(false ? 44 : 10);
			}
			el.getElement('ul').setStyle('width', width);
			el.getElement('a').set('href', el.getElement('ul>li:first-child>a').get('href'));
		}
	});
	////////////////////////////////////////////////////////////////////////////
	new Swiff('http://baltijascelam20.lv/design/flash/bcelscounter.swf', {
		'container': $('flashCounter')
		, 'width': 207
		, 'height': 72
	});
	////////////////////////////////////////////////////////////////////////////
	new Swiff('http://baltijascelam20.lv/design/flash/sirds.swf', {
		'container': $('logoFlash')
		, 'width': 161
		, 'height': 189
		, 'vars': {
			'ClickTag': $('logoFlash').getElement('a').get('href')
		}
	});
	////////////////////////////////////////////////////////////////////////////
	//anti bot
	$$('input.formAction').each(function(el){
		var rep = el.get('class').split(' ').getLast().split('@');
		el.set(rep[0], rep[1]);
	});
	////////////////////////////////////////////////////////////////////////////
	//image popups
	var startPageMultiBox = new MultiBox('mbNoNumber', {
		useOverlay: true
		, showControls: false
		, lng: {
			'of': 'no'
		}
	});
	var startPoint = false;
	if(startPoint&&$$('a.mbNoNumber')[0]){
		var el = $$('a.mbNoNumber')[0];
		$$('a.mbNoNumber').set('href', el.get('href')+'&start_point='+startPoint);
		startPageMultiBox.open(el);
	}
	var box = new MultiBox('mb', {
		useOverlay: true
		, lng: {
			'of': 'no'
		}
	});
	////////////////////////////////////////////////////////////////////////////
	$$('.windowPopup').each(function(el){
		el.addEvent('click', function(e){
			e.stop();
			var link = this.get('href');
			var w = 400;
			var h = 300;
			var wi = w;
			window.open(link,'win2','status=no,toolbar=no,scrollbars=no,titlebar=no,menubar=no,resizable=yes,width=' + w + ',height=' + h + ',directories=no,location=no,left='+(screen.availWidth/2-w/2)+',top='+(screen.availHeight/2-h/2)+'');
		});
	});
	////////////////////////////////////////////////////////////////////////////
});
function transparent(im) {
   if (!im.transparented && (/\.png/.test(im.src))){
      im.transparented = 1;
      var picture = im.src; var w = im.width; var h = im.height;
      im.src = "http://baltijascelam20.lv/design/image/empty.gif";
      im.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='crop', src='"+picture+"');";
      im.width = w; im.height = h;
//	  alert(picture+' = '+w+'x'+h);
   }
   return "transparent";
}
function d(v){
	if(Browser.Engine.gecko){
		console.info(v);
	}
}