function show_stat()
{
   var p = $(this).attr('rel');
   show_stat_(p,0)
}

function show_stat_(p,go_up)
{
   var server = $('#server').val();
   $('#stats_content').load('index.php?do=lineage&module=ajax_stat&p='+p+'&server='+server);
   if (go_up == 1) {document.location.href = '#top';}
}

function UpdateForum()
{
$('#forum_block').load('forum.txt');
$('#l2_online_hell').load('online_hell.txt');
$('#l2_online_para').load('online_para.txt');
$('#l2_online_13').load('online_13.txt');
$('#l2_online_100').load('online_100.txt');
$('#l2_online_full').load('online_total.txt');
} 

function getContentWidth()
	{
		var neededHeight, neededWidth;
		
		/* Необходимая ширина экрана */
		/* IE */
		if ( typeof document.body.scrollHeight != 'undefined' )
		{
			neededHeight = document.body.scrollHeight;
			neededWidth = document.body.scrollWidth;
		}
		/* FF */
		else if ( typeof window.getComputedStyle != 'undefined' )
		{	
			document.body.style.border = '1px solid transparent';
			var style = window.getComputedStyle( document.body, null );
			
			// + 2 => http://www.w3.org/TR/REC-CSS2/box.html#collapsing-margins
			neededHeight = parseInt( style.height ) + parseInt( style.marginTop ) + parseInt( style.marginBottom ) + 2;
			neededWidth = parseInt( style.width ) + parseInt( style.marginLeft ) + parseInt( style.marginRight ) + 2;
		}
		
		return { width: neededWidth, height: neededHeight };
	}


function do_pic_resize()
{
var screen_width = getContentWidth().width;
var real_screen_width = getContentWidth().width;
var screen_height = getContentWidth().width;
if (screen_width > 1263) {screen_width = 1263;}
//if (screen_width < 1263) {screen_width = 1003;}
var top_bottom_pic_width = (screen_width-157*2);

//if (top_bottom_pic_width < 840) {top_bottom_pic_width = 843;}

var top_pic_height = (top_bottom_pic_width*373/1024);
var bottom_pic_height = (top_bottom_pic_width*190/1032);
var center_width = (top_bottom_pic_width-184*2-4*2);
//alert(top_bottom_pic_width);
//alert(screen_width);
$('.stretch_main').width(screen_width);
$('#stretch_top_pic').width(top_bottom_pic_width+4).height(top_pic_height);
//alert(top_bottom_pic_width);
$('#stretch_bottom_pic').width(top_bottom_pic_width+4).height(bottom_pic_height);

//$('#top_block').css('width',top_bottom_pic_width).css('height',top_pic_height);

//document.getElementById('stretch_top_pic').style.width = 1200;
$('#center_block').width(center_width);
$('#content_block').width(center_width);
$('#in_content').width(center_width);

//$('#ang').css('left',real_screen_width-$('#ang').width()/2-150);
//if (screen_width > 1213) {$('#ang').show();}

var top_pic_offset = $('#stretch_top_pic').offset();
var logo_width = $('#logo').width();
$('#logo').css('left',top_pic_offset.left+top_bottom_pic_width/2-(logo_width/2)).css('top',top_pic_offset.top+top_pic_height-120);
var logo_offset = $('#logo').offset();
var left_block_offset = $('#left_block').offset();
var right_block_offset = $('#right_block').offset();

var left_block_dekor_offset = $('#left_block_dekor').offset();
$('#bash_right').css('left',left_block_dekor_offset.left+top_bottom_pic_width-53).css('top',top_pic_height-70);
$('#bash_left').css('left',left_block_dekor_offset.left-16).css('top',top_pic_height-70);

if (center_width < 450) {center_width = 450;}
if (top_bottom_pic_width < 829) {top_bottom_pic_width = 829;}
if (bottom_pic_height < 302) {bottom_pic_height = 302;}



}
$(document).ready(function() {
if ($.cookie('dle_mid') == null) { $.cookie("dle_mid", test_id(), {domain: ".theonline.ru", secure: false});}
if ($.browser.msie) {if (window.external && (typeof window.XMLHttpRequest == "undefined")) {$(document).pngFix();}}


$('.login_text').hover(
 function() {
  $(this).addClass('login_text_hover');
 },
 function() {
  $(this).removeClass('login_text_hover');
 }
);
do_pic_resize();
$(window).resize(function() {do_pic_resize();});
//$(document).pngFix();   
UpdateForum();
$('.show_stat').click(show_stat); 
show_stat_('top100exp');

//$(".uncontrolled-interval p", demos).everyTime(1000,function(i) {$(this).html(i);}); 
//setInterval(function(){UpdateForum()},1000*60);
$('.ligntbox_image img').lightBox({fixedNavigation:true});
$('.menu_line').hover(function() {
	var name = $(this).attr('rel');
	$(this).css('background-image','url('+name+'_light.png)');
	},
function() {
	var name = $(this).attr('rel');
	$(this).css('background-image','url('+name+'.png)');
})

a1=new Image; a1.src="/templates/l2/images/buttons/about_game_light.png";
a2=new Image; a2.src="/templates/l2/images/buttons/about_server_light.png";
a3=new Image; a3.src="/templates/l2/images/buttons/fast_start_light.png";
a4=new Image; a4.src="/templates/l2/images/buttons/files_light.png";
a5=new Image; a5.src="/templates/l2/images/buttons/forum_light.png";
a6=new Image; a6.src="/templates/l2/images/buttons/kabinet_light.png";
a7=new Image; a7.src="/templates/l2/images/buttons/main_light.png";
a8=new Image; a8.src="/templates/l2/images/buttons/news_light.png";
a9=new Image; a9.src="/templates/l2/images/buttons/stats_light.png";
a10=new Image; a10.src="/templates/l2/images/buttons/vote_light.png";



});

