$(document).ready(function(){
		//Парение
		$(".pur").hover(function(){
			$(this).css({'position':'relative'}).animate({top: "-=9"}, "slow")
			for(i=0;i<100;i++){
				$(this).animate({top: "+=5"}, "slow")
					   .animate({top: "-=5"}, "slow")
			}
			return false;
		}, function(){
			$(this).stop(true);
			$(this).animate({top: "0"}, "slow").css({'position':'auto'});
		});
        //ХЗ
		$('.pur a').hover(function() {
			$(this).css({'text-decoration': 'none'});
		}, function() {
		   	$(this).css({'text-decoration': 'underline'});
		});

		//Карусель
        $("a[class^=carClo]").click(function(){        	$("#actBot").css({'left':''+$(this).attr('rel2')+'px'});            $('div[id^=block_]').fadeOut('200');
            $('#'+$(this).attr('rel')).delay('300').fadeIn('400');
            /*if(!$(".carClo"+curr).attr('rel')){
                curr++;
			}
			else
				curr = 2;
			clearTimeout(t);   console.log(curr);
         	t = setTimeout(carousel,6000);  */        });

		//Подсветка якорей в сервисах
		$('.servList li a').click(function(){
			$($(this).attr('href')).css({'color':'#318bd1'}).delay(500).animate({'color':'#000'}, 3000);
			$($(this).attr('href')).next().css({'color':'#318bd1'}).delay(500).animate({'color':'#000'}, 3000); //.effect('highlight', {color: '#318bd1'}, 1500)
		});

});

function carousel(){	if($(".carClo"+curr).attr('rel')){		$("#actBot").css({'left':''+$(".carClo"+curr).attr('rel2')+'px'});
	    $('div[id^=block_]').fadeOut('200');
	    $('#'+$(".carClo"+curr).attr('rel')).delay('300').fadeIn('400');	}
	else
		curr = 0;
    curr++;   //console.log(curr);
    t = setTimeout(carousel,6000);}

function tweet(){		$.get('/scripts/twitter.php', function(data){
			$("#innerTwit p").html(data);
		});}


function str_replace(haystack, needle, replacement) {
	var temp = haystack.split(needle);
	return temp.join(replacement);
}


function screenSize() {
    var w, h;
    w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
    h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
    return {w:w, h:h};
}

function set_left_bound(elementID, bound) {
     document.getElementById(elementID).style.left = bound+"px";
}
/*
$(document).ready(function(){
		$("#promo_left").click(function(){
            if(left=='left' && center=='center'){
            	$("#promo_center").animate({width: "160", left: "4%", top:"290"}, "slow", "swing");
	            $("#center_image").animate({width: "150"}, "slow", "swing");
				$("#left_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_left").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'left';
        	    left = 'center';
        	}
        	if(left=='right' && center=='center'){
        		$("#promo_center").animate({width: "160", left: bound_r, top:"290"}, "slow", "swing");
	            $("#center_image").animate({width: "150"}, "slow", "swing");
				$("#left_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_left").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'right';
        	    left = 'center';
        	}
        	if(left=='left' && right=='center'){
        		$("#promo_right").animate({width: "160", left: "4%", top:"290"}, "slow", "swing");
	            $("#right_image").animate({width: "150"}, "slow", "swing");
				$("#left_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_left").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    right = 'left';
        	    left = 'center';
        	}
        	if(left=='right' && right=='center'){
        		$("#promo_right").animate({width: "160", left: bound_r, top:"290"}, "slow", "swing");
	            $("#right_image").animate({width: "150"}, "slow", "swing");
				$("#left_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_left").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    right = 'right';
        	    left = 'center';
        	}
			return false;
		});

		$("#promo_right").click(function(){
		    if(right=='right' && center=='center'){
	            $("#promo_right").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
	            $("#right_image").animate({width: "600"}, "slow", "swing");
	            $("#promo_center").animate({width: "160", left: bound_r, top:"290"}, "slow", "swing");
	            $("#center_image").animate({width: "150"}, "slow", "swing");
        	    center = 'right';
        	    right = 'center';
        	}
        	if(right=='left' && center=='center'){
	            $("#right_image").animate({width: "600"}, "slow", "swing");
	            $("#promo_right").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
	            $("#promo_center").animate({width: "160", left: "4%", top:"290"}, "slow", "swing");
	            $("#center_image").animate({width: "150"}, "slow", "swing");
        	    center = 'left';
        	    right = 'center';
        	}
        	if(right=='left' && left=='center'){
        		$("#promo_right").animate({width: "600", left: bound, top:"210"}, "slow", "swing");
	            $("#right_image").animate({width: "600"}, "slow", "swing");
				$("#left_image").animate({width: "150"}, "slow", "swing");
        	    $("#promo_left").animate({width: "150", left: "4%", top: "290"}, "slow", "swing");
        	    right = 'center';
        	    left = 'left';
        	}
        	if(right=='right' && left=='center'){
	            $("#right_image").animate({width: "600"}, "slow", "swing");
	            $("#promo_right").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
				$("#left_image").animate({width: "150"}, "slow", "swing");
        	    $("#promo_left").animate({width: "150", left: bound_r, top: "290"}, "slow", "swing");
        	    right = 'center';
        	    left = 'right';
        	}
			return false;
		});

		 $("#promo_center").click(function(){
            if(left=='center' && center=='left'){
            	$("#promo_left").animate({width: "160", left: "4%", top:"290"}, "slow", "swing");
	            $("#left_image").animate({width: "150"}, "slow", "swing");
				$("#center_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_center").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'center';
        	    left = 'left';
        	}
        	if(right=='center' && center=='right'){
        		$("#promo_right").animate({width: "160", left: bound_r, top:"290"}, "slow", "swing");
	            $("#right_image").animate({width: "150"}, "slow", "swing");
				$("#center_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_center").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'center';
        	    right = 'right';
        	}
        	if(left=='center' && center=='right'){
            	$("#promo_left").animate({width: "160", left: bound_r, top:"290"}, "slow", "swing");
	            $("#left_image").animate({width: "150"}, "slow", "swing");
				$("#center_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_center").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'center';
        	    left = 'right';
        	}
        	if(right=='center' && center=='left'){
        		$("#promo_right").animate({width: "160", left: "4%", top:"290"}, "slow", "swing");
	            $("#right_image").animate({width: "150"}, "slow", "swing");
				$("#center_image").animate({width: "600"}, "slow", "swing");
        	    $("#promo_center").animate({width: "600", left: bound, top: "210"}, "slow", "swing");
        	    center = 'center';
        	    right = 'left';
        	}

			return false;
		});
}); */
