var timer_ = new Array();
var zIndex = 0;
var tsYon = 0;
$(document).ready(function (){
	$('.logo').animate({'margin-top': '0px'}, 1000, function () {
		$('.sol').fadeIn(1000);
		$('.sag').fadeIn(1000, function () { blink_(); });
		function blink_ () {
			$('.sol').fadeTo(1000, 0.2);
			$('.sag').fadeTo(1000, 0.2, function () {
				$('.sol').fadeTo(1000, 1);
				$('.sag').fadeTo(1000, 1, function () { blink_(); });
			});	
		}
	});
	gosteri(15);
});

function resimGetir (kutuNo) { $.ajax({ type : 'GET', url : 'rndResim.php', success : function (data, position){ resimDose(kutuNo, data); } });  }

function gosteri (limit) {
	for ( x = 1; x <= limit; x++) { timer_[x] = setTimeout('resimGetir(' + x + ')', 1000 * x); }
	var CallBack = setTimeout('gosteri(' + limit + ')', 1000 * (limit));
}

function resimDose (kutuNo, data) {
	var kutu = $('#rC' + kutuNo);
	var onceX = (Math.floor(Math.random() * 1000));
	var onceY = (Math.floor(Math.random() * 400));
	var degre = (Math.floor(Math.random() * 50));
	if ( tsYon == 0 ) { tsYon = 1; } else { tsYon = 0; degre *= -1; }
	zIndex = (( zIndex == 999 ) ? 0 : zIndex + 1);
	kutu.fadeOut(500, function () { 
		kutu.css({
			'background-image'	: 'url(yeni/UpFiles/k_' + data + ')',
			'margin'			: onceY + 'px 0px 0px ' + onceX + 'px',
			'z-index'			: zIndex,
			'width'				: '10px',
			'height'			: '7px',
			'transform'			: 'rotate(' + degre + 'deg)',
			'-ms-transform' 	: 'rotate(' + degre + 'deg)',
			'-moz-transform'	: 'rotate(' + degre + 'deg)',
			'-webkit-transform'	: 'rotate(' + degre + 'deg)',
			'-o-transform'		: 'rotate(' + degre + 'deg)'
		}).fadeIn(500).animate({
			'width'				: '150px',
			'height'			: '120px',
			'margin-top'		: (onceY - 56) + 'px',
			'margin-left'		: (onceX - 70) + 'px',
		}, 500);
	});
}
