/*
 * version 0.1.1 (bugged)
 * Copyright (c) 2008 Creatida (www.creatida.kz)
 * -------------------------------------------
 */

jQuery(document).ready(function(){


jQuery("#larr").hide();


jQuery("#larr").css({ background: "url(../media/3blockteaser/larr.png) left top no-repeat #EEF1F6" });
jQuery("#rarr").css({ background: "url(../media/3blockteaser/rarr.png) left top no-repeat #EEF1F6" });
jQuery("#teaserLoading").hide();



var defaultPos = 0;
var blocksNum = jQuery("#trx > td").length;
var lSlidebleBlocks = blocksNum - 3;
var rSlidebleBlocks = 0;
var fixedContent = 350;

// default block width
var blockWidth = 100;

// Standart
if (window.innerWidth || window.innerHeight){
docwidth = window.innerWidth;
docheight = window.innerHeight;
}
//IE
if (document.body.clientWidth || document.body.clientHeight){
docwidth = document.body.clientWidth;
docheight = document.body.clientHeight;
}
//alert(docwidth);

blockWidth = (docwidth - fixedContent)/3 - 2;
scrollXValue = blockWidth - 8;
jQuery("#container").css({
		width: blockWidth*3 + 11
	});



	jQuery(".s6 > img").attr("width", blockWidth);






function xsizes(){

jQuery("#slider").animate({"left": "-="+defaultPos}, "normal");
defaultPos = 0;
jQuery("#rarr").show();
jQuery("#larr").hide();
lSlidebleBlocks = blocksNum - 3;
rSlidebleBlocks = 0;


// Standart
if (window.innerWidth || window.innerHeight){
docwidth = window.innerWidth;
docheight = window.innerHeight;
}
//IE
if (document.body.clientWidth || document.body.clientHeight){
docwidth = document.body.clientWidth;
docheight = document.body.clientHeight;
}


blockWidth = (docwidth - fixedContent)/3 - 2;
scrollXValue = blockWidth - 8;
jQuery("#container").css({
		width: blockWidth*3 + 11
	});



	jQuery(".s6 > img").attr("width", blockWidth);



}
//xsizes();


window.onresize = resize;

function resize()
{
 xsizes();
}





var sliderWidth = jQuery("#slider").width();
var contentWidth = jQuery("table", "#slider").width();
var containerWidth = jQuery("#container").width();







function checkArr(){

	if(lSlidebleBlocks > 0){
		jQuery("#rarr").show();
	}else{
		jQuery("#rarr").hide();
	}

	if(rSlidebleBlocks > 0){
		jQuery("#larr").show();
	}else{
		jQuery("#larr").hide();
	}
}



jQuery("#larr").click(function(){
	var scrollValue = jQuery("table", "#s6").width()+5;
	lSlidebleBlocks++;
	rSlidebleBlocks--;

	checkArr();



	jQuery("#slider").animate({"left": "+="+scrollValue}, "slow");
	defaultPos += scrollValue;
});

jQuery("#rarr").click(function(){
	var scrollValue = jQuery("table", "#s6").width()+5;
	lSlidebleBlocks--;
	rSlidebleBlocks++;

	checkArr();

	jQuery("#slider").animate({"left": "-="+scrollValue}, "slow");
	defaultPos -= scrollValue;




});

jQuery("#larr").hover(function(){
	jQuery(this).css(
		"background-position", "-18px 0"
	);
},function(){
	jQuery(this).css(
		"background-position", "0 0"
	);
});
jQuery("#rarr").hover(function(){
	jQuery(this).css(
		"background-position", "-18px 0"
	);
},function(){
	jQuery(this).css(
		"background-position", "0 0"
	);
});




jQuery("#searchi22").focus(function(){
			jQuery(this).css(
					"width", "70%"
				);
			jQuery("#searchsel").show();
});

jQuery(document).bind('click', function(e) {

                var $clicked=jQuery(e.target);

                if($clicked.is('#searchi22') || $clicked.is('#searchsel') || $clicked.parents().is('#searchsel')) {
						return false;
                } else {
                       jQuery("#searchsel").hide();
						jQuery("#searchi22").css(
							"width", "100%"
						);
                }
        });









}); //end



