var speed=-1;
var exspeed=speed;
var cs;

$(document).ready(function()
{
	$('.gal[rel=gal]').colorbox();
	$(".iframe").colorbox({iframe:true, innerWidth:900, innerHeight:700});

	$(".fiframe").colorbox({iframe:true, innerWidth:600, innerHeight:300});
	
	$('#submenu div').eq($('#menu a.sel').index()).show();
	
	$('#menu a').hover(function()
	{
		$('#submenu div').stop().hide();
		var $div=$('#submenu div').eq($(this).index());
		$div.show();
		$('#menu a').removeClass('sel');
		$(this).addClass('sel');
	},function()
	{
	});
	
	
	cs=setInterval("marquee()",100);
});

function marquee()
{
	if (speed!=0)
	{
		var top=parseInt($('#ikincieller').css('top'));var height=$('#ikincieller').height();	
		if (top==1)
		{
			speed=-1;exspeed=-1;clearInterval(cs);setTimeout('cs=setInterval("marquee()",100);',1000);
		}else if (top==126-height)
		{
			speed=1;exspeed=1;clearInterval(cs);setTimeout('cs=setInterval("marquee()",100);',1000);
		}
		fx='+=1';if (speed==-1){fx='-=1';}
		$('#ikincieller').css("top",fx);
	}
}

//BANNER

var bt=0;
var fs=0;
var ct=0;
var btimer;

$(document).ready(function()
{
	ct=$('#banner a').size();
	banner();
});

function banner()
{
	if (fs==0)
	{
		fs=1;
		for(i=0; i<ct; i++)
		{
			$('#numbers').append('<a href="#" rel="'+i+'">'+(i+1)+'</a>');
		}
		
		$('#numbers a').each(function()
		{
			$(this).click(function()
			{
				chbanner($(this).attr('rel'));
			});
		});
		
		$('#numbers a').eq(0).addClass('sel');
		
	}else
	{
		if ((bt+1)<ct)
		{
			bt++;
		}else
		{
			bt=0;
		}
		
		h=bt*-304;
		$('#numbers a').removeClass('sel');
		$('#numbers a').eq(bt).addClass('sel');
		$('#slides a').stop();
		$('#slides a').animate({'top':h+'px'});
	}
	
	clearTimeout(btimer);
	btimer=setTimeout('banner()',6000);
}

function chbanner(x)
{
	bt=x-1;
	clearTimeout(btimer);
	banner();
}
