$(document).ready(function() {

	$('input[type=checkbox], input[type=radio]').css('width', 'auto');

	$('#paket-bilgi-kurumsal').click(function() {
		$('#paket-bilgi-kurumsal').find('div').toggle();
	});
	
	$('#paket-bilgi-bayi').click(function() {
		$('#paket-bilgi-bayi').find('div').toggle();
	});
	
	$(".deps").hover(function(){
		$(this).addClass('depshover');
	}, function(){
		$(this).removeClass('depshover');
	});

	$("#menu li").hover(function(){
		$(this).find('div').fadeIn();
	}, function(){
		$(this).find('div').fadeOut();
	});

	$("select").selectBox();
	
	$('.trup').bind('keyup', function() { $(this).val(upperChars($(this).val())); } );	
	$('.trup').bind('blur', function() { $(this).val(upperChars($(this).val())); } );	
	$('.trup').bind('focus', function() { $(this).val(upperChars($(this).val())); } );	

	
//	$($('#emrrotator img')[0]).addClass('emrrotator_show'));
	var emrRotatorTime = 5000;
	autoPlayTimer = setInterval("showEmrRotator('.')", emrRotatorTime);
	$($('#emrrotator div.emrrotator_content')[0]).addClass('emrrotator_show');
	var total_emrrotators = $('#emrrotator div.emrrotator_content').length;

	var emrrotator_controls = '<div id="emrrotator_controls">';
	for(i = 1; i <= total_emrrotators; i++)
	{
		emrrotator_controls += '<a href="javascript:void(0)" onclick="showEmrRotator(' + (i-1) + ')">' + i + '</a>';
	}
	emrrotator_controls += '</div>';
	$('#emrrotator').prepend(emrrotator_controls);
	$($('#emrrotator_controls a')[0]).addClass('emrrotator_controls_selected');

	$('#emrrotator div').each(function(index) {
		$(this).mouseover(function() {
			clearInterval(autoPlayTimer);
		});
		$(this).mouseout(function() {
			autoPlayTimer = setInterval(showEmrRotator, emrRotatorTime);
		});
	});


    jQuery("#duyuru-bg ul").jcarousel({
        scroll: 1,
		auto: 3,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });


});

emrrotator_index = 0;
function showEmrRotator(index)
{
	var first_image = emrrotator_index;
	var second_image = emrrotator_index+1;
	if(typeof(index) !== 'string')
	{
		second_image = index;
		emrrotator_index = index-1;
	}

	if(typeof($('#emrrotator div.emrrotator_content')[second_image]) === 'undefined')
	{
		emrrotator_index = -1;
		second_image = 0;
	}

	$($('#emrrotator div.emrrotator_content')[first_image]).fadeOut('slow');
	$($('#emrrotator div.emrrotator_content')[second_image]).fadeIn('slow');
	$('#emrrotator_controls a').removeClass('emrrotator_controls_selected');
	$($('#emrrotator_controls a')[second_image]).addClass('emrrotator_controls_selected');

	emrrotator_index++;
}



function mycarousel_initCallback(carousel)
{
    jQuery('#ileri').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#geri').bind('click', function() {
        carousel.prev();
        return false;
    });
}


function showPaket(id, id2)
{
	$('.hostingpaketleri').hide();
	$(id).fadeIn();
	$('#paket-menu ul li').removeClass('selected');
	$(id2).addClass('selected');
	return false;
}
function showHosting(id, id2)
{
	$('.hostingmenu').hide();
	$(id).fadeIn();
	$('#hosting-menu ul li a').removeClass('current');
	$(id2 + ' a').addClass('current');
	$('#paket-menu ul li').removeClass('selected');
	$('#paket1-eko').addClass('selected');
	$('#paket2-eko').addClass('selected');
	$('#paket3-eko').addClass('selected');
	$('#deditr0').addClass('selected');
	$('#dedial0').addClass('selected');
	$('#dedihol0').addClass('selected');

	$('.hostingpaketleri').hide();
	$('#webhosting-eko').show();
	$('#bayihosting-eko').show();
	$('#vpshosting-tr').show();
	$('#deditralt0').show();
	$('#dedialalt0').show();
	$('#dediholalt0').show();

	
	return false;
}

function upperChars(o)
{
	return o.replace("ı","I").replace("ç","C").replace("Ç","C").replace("ö","O").replace("Ö","O").replace("ü","U").replace("Ü","U").replace("ş","S").replace("Ş","S").replace("ğ","G").replace("Ğ","G").toUpperCase();
}

