	
	var blink_elements	= "";
	
	$(document).ready(function(){
		
		for(var i = 0; i < 165; i++){
			$('#bip').append('<div></div>');
		}
		
		var e = $('#bip div');
		
		var none_elm = new Array(e[6],e[7],e[8],e[14],e[37],e[42],e[43],e[44],e[45],e[46],e[47],e[48],e[49],e[66],e[73],e[76],e[77],e[78],e[80],e[81],e[82],e[83],e[94],e[97],e[110],e[114],e[131],e[132],e[133],e[134],e[135],e[136],e[137],e[141],e[143],e[144],e[145],e[147]);
		
		$( none_elm ).addClass('white');
		
		blink_elements = $('#bip div').not('.white');
		
		oxus_blink();
		
		var blinking = setInterval(function() { oxus_blink() }, 2000);
		
		$("#last-topics-layer").height($("#last-topics").height());
		
		/*
		phone_status(1);
		var phone_1_status = setInterval(function() { phone_status(1) }, 30000);
		phone_status(2);
		var phone_1_status = setInterval(function() { phone_status(2) }, 30000);
		*/
		
	});
	
	function oxus_blink(){
		var rand = Math.round(125*Math.random());
		
		$( $(blink_elements)[rand] ).addClass('blue');
		
		setTimeout(function(){
			$( $(blink_elements)[rand+1] ).addClass('green');
		},500);
		
		setTimeout(function(){
			$( $(blink_elements)[rand] ).removeClass('blue');
		},500);
		
		setTimeout(function(){
			$( $(blink_elements)[rand+1] ).removeClass('green');
		},1000);
		
	}
	
	function phone_status(p){
		
		$.ajax({
			type: "GET",
			url: "/skype-status.php?p=" + p,
			success: function(c){
				
				$('#phone' + p).css('background-position','0px -'+(c*16)+'px');
				
			}
		});
		
	}