$(document).ready(function(){
	
		//var images = new Array(new Array(), new Array());	/* Opera fix */
		var allAnchors = $('a.link');

		//var i = 0;
		allAnchors.each(function(anchor){
			$(this).bind('mouseover', function(){
				var element = $(this).find('img');
				var src = element.attr('class');
				var target = src.split(" ");
				var newimg = target[0]+"_over.png";

				if($.browser.version <= 6.0 && $.browser.msie) {
					element.attr('src', 'blank.gif');
					element.css('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + newimg+", sizingMethod='scale')");
				}
				else {
					element.attr('src', newimg);
				}
			});

			$(this).bind('mouseout', function(){
				var element = $(this).find('img');
				var target = element.attr('class').split(" ");
				var src = target[0]+".png";

				if(target[1] == "_over") {
					src = target[0]+"_over.png";
				}

				if($.browser.version <= 6.0 && $.browser.msie) {

					element.css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + src+ ", sizingMethod='scale')");
				}
				else {
					element.attr('src', src);
				}
				
			});
		});

		if($.browser.mozilla) {   
			$('body').css('overflow', 'hidden');
			$('html').css('overflow', 'hidden');
		}
		
		onWindowResize();
	});
	
	$(window).bind('resize', function() {
		onWindowResize();
	});
	
	function onWindowResize() {
		
		var max_height = 900;
		var min_height = $('#menu').height();
		var height = $(window).height()-15;
		
		var true_height = (height > max_height ? max_height: height );
		true_height = (true_height < min_height ? min_height: true_height );
		
		$('#container').css('height', true_height+'px');
		$('#content_inner').css('height', true_height+'px');
		$('table.setheight').css('height', true_height+'px');
		$('#scrollDiv').css('height', true_height-50+'px');
		
		var max_width = 1050;
		var min_width = 522;
		var width = $(window).width()-216;
		
		
		var true_width = (width > max_width ? max_width: width );
		
		true_width = (true_width < min_width ? min_width: true_width );
		
		
		$('#container').css('width', true_width+216-5+'px');
		$('#right_col').css('width', true_width+'px');
		
		var skirtumas = parseInt($('#container').offset().left+(($('#container').width()-1280)/2)+1);
		
		var skirtumash = parseInt($('#container').offset().top-7);
		
		if($(window).height() < 900) skirtumash -= 3;
	
		
		$('#TOP').css('left', skirtumas+"px");
		
		$('#TOP').css('top', skirtumash+"px");
		$('#TOP').css('width', $('#container').width()+Math.abs(skirtumas)+"px");
		
		var bskirtumash = $('#container').offset().top+$('#container').height()-80+8; 
		if($(window).height() > 900) {
			bskirtumash -= 3;
			
		}
		$('#BOTTOM').css('left', skirtumas+"px");
		$('#BOTTOM').css('top', bskirtumash+"px");
		$('#BOTTOM').css('width', $('#container').width()+Math.abs(skirtumas)+"px");
				
	}


function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
