// JavaScript Document

$(document).ready(function() {

	// Brutal
	$('a:has(img)').css('background-image','none');

	BODY=$('body');
    if ( $(document).height() > 1500) {$('.footer-up').show();}
	// Header Elastic & Right Sidebar & Copyright
	HE=$('.header-elastic');
	RS=$('.right-sidebar');
	CR=$('#footer .copyright');

	// Width
	HE.width(BODY.width()*0.85-270);
	RS.width(BODY.width()*0.85-270);

	// 3% padding
	HE.css('padding-left',BODY.width()*0.03);
	RS.css('padding-left',BODY.width()*0.03);
	CR.css('padding-left',BODY.width()*0.03);

	// ie f/uck
	if ( $.browser.msie ) {
		if ($.browser.version=='7.0');
			{
				HE.width(BODY.width()*0.83-354);
				RS.width(BODY.width()*0.83-354);
			}
	}

	// Body search
	BS=$('.body-search .search-field');
	BS.width(RS.width()*0.666-100);

	// Skin
	SK=$('.skined-block');
	//SK.css('margin-top',(-RS.height()-HE.height()-125));
	//SK.css('margin-top',-($('#header').height()+$('#content').height()+$('#footer').height()+75));
	if($('#content').width()==1000){
		$(SK).css('right','auto');
		$(SK).css('left','840px');
	}
	else {
		$(SK).css('left','auto');
		$(SK).css('right','0');
	}

	// ZAD
	ZAD=$('.skin-changed.colored-skin');
	ZAD.css('background-position',BODY.width()*0.03+251+'px 0px');

	// On window resize
	$(window).resize(function() {

		// Width
		HE.width(BODY.width()*0.85-270);
		RS.width(BODY.width()*0.85-270);

		// 3% padding
		HE.css('padding-left',BODY.width()*0.03);
		RS.css('padding-left',BODY.width()*0.03);
		CR.css('padding-left',BODY.width()*0.03);

		// ie f/uck
		if ( $.browser.msie ) {
			if ($.browser.version=='7.0');
				{
					HE.width(BODY.width()*0.83-354);
					RS.width(BODY.width()*0.83-354);
				}
		}

		// Body search
		BS.width(RS.width()*0.666-100);

		// Skin
		//SK.css('margin-top',-RS.height()-HE.height()-125);
		//SK.css('margin-top',-($('#header').height()+$('#content').height()+$('#footer').height()+75));
		if($('#content').width()==1000){
			$(SK).css('right','auto');
			$(SK).css('left','840px');
		}
		else {
			$(SK).css('left','auto');
			$(SK).css('right','0');
		}

		// ZAD
		ZAD.css('background-position',BODY.width()*0.03+251+'px 0px');
	});

	// Table zebra
	$('table tr:odd').addClass('zebra');








	/* INDEX PAGE */


	// Fu*ing lamp
	lampcord = 'right ' + ($('.index-promo').height()+29) + 'px';
	$('#index .index-lamp').css('background-position',lampcord);

	// Fu*ing index page logo
	if ($('body').hasClass('index-page')) {
		Body=$('body');
		if (Body.width()<1000) {
			//$('#index .column').css('padding-right',Body.width()-1000);
			//$('#index').css('background-position','-139px top');

			// and our fu*ing lump crying here, so...
			lampcord = '-140px ' + ($('.index-promo').height()+29) + 'px';
			$('#index .index-lamp').css('background-position',lampcord);
		}
	}
	$(window).resize(function() {
		Body=$('body');
		if (Body.width()<1000) {
			//$('#index .column').css('padding-right',Body.width()-1000);
			//$('#index').css('background-position','-139px top');

			// and our fu*ing lump crying here, so...
			lampcord = '-140px ' + ($('.index-promo').height()+29) + 'px';
			$('#index .index-lamp').css('background-position',lampcord);
		}
		else {
			//$('#index .column').css('padding-right',60);
			//$('#index').css('background-position','right top');

			// and again this sh*t, our fu*ing lump crying here
			lampcord = 'right ' + ($('.index-promo').height()+29) + 'px';
			$('#index .index-lamp').css('background-position',lampcord);
		}
	});
});
