var currentPage = 'anasayfa';
var containerWidth = 916;
var _marginLeft = 0;
var solSlideTimeout = 5000;
var sagSlideTimeout = 5000;

var s_anasayfa=0;
var s_okulumuz = 1;
var s_ogretimkadromuz = 2;
var s_anasinifi = 3;
var s_okulailebirligi = 4;
var s_rehberlikservisi = 5;
var s_duyurular = 6;
var s_basarilarimiz = 7;
var s_linkler = 8;
var s_iletisim = 9;
var s_etkinlikler = 10;
var s_ataturkkosemiz = 11;
var s_fotografgalerisi = 12;

var locked = false;
var listIndex = -1;

$(document).ready(function() {
    $(document).pngFix();
});

function GetContent(c1, c2) {
    $(c1).html($(c2).html());
}

function GetHtmlContent(c, h, b) {
    $(c + ' .contentText .baslik').html(b);
    $(c + ' .contentText .loadContent').load('html/' + h + '.htm?id='+Math.random());
    $(c + ' .contentText .geridon').show();
    $(c + ' .contentText ul').hide();
}

function GetGallery(c, id, b) {
    $(c + ' .contentText .baslik').html(b);
    $(c + ' .contentText .loadContent').load('Galeri.aspx?ID=' + id + '&R=' + Math.random(), function() {
        if ($(c + ' .contentText .loadContent .gallery a').length > 0)
            $(c + ' .contentText .loadContent .gallery a').lightBox();
    });
    $(c + ' .contentText .geridon').show();
    $(c + ' .contentText ul').hide();
    $(c + ' .contentText .icerik').hide();
}

function ReturnList(c) {
    $(c + ' .contentText .baslik').html('');
    $(c + ' .contentText .loadContent').html('');
    $(c + ' .contentText .icerik').hide();
    $(c + ' .contentText .geridon').hide();
    if (listIndex == -1)
        $(c + ' .contentText ul').show();
    else
        $(c + ' .contentText ul').eq(listIndex).show();
}

function ShowList(c, index) {
    ReturnList(c);
    $(c + ' .contentText ul').hide();
    $(c + ' .contentText .icerik').hide();
    $(c + ' .contentText ul').eq(index).show();
    listIndex = index;
}

function ShowListContent(c, id) {
    ReturnList(c);
    $(c + ' .contentText ul').hide();
    $(c + ' .contentText .icerik').hide();
    $(c + ' .contentText #'+id).show();
}

function GetPage(id){
	if(currentPage==id)	return;
	if(locked) return;
	locked = true;
	
	var sCurrent=0;
	var sNew=0;
	
	sCurrent = eval('s_'+currentPage);
	sNew = eval('s_'+id);
		
	var content1First = _marginLeft;
	var content1Second = _marginLeft - screen.width;
	var content2First = _marginLeft + screen.width;
	var content2Second = _marginLeft;
	
	if(sCurrent>sNew)
	{
		content1First = _marginLeft; 
		content1Second = _marginLeft + screen.width;
		content2First = _marginLeft - screen.width;
		content2Second = _marginLeft;
	}
	
	$('#'+currentPage).show().css({'marginLeft':content1First+'px'});
	$('#'+id).show().css({'marginLeft':content2First+'px'});
	
	$('#'+currentPage).animate({
		marginLeft: content1Second + "px"
	},800)
	$('#'+id).animate({
		marginLeft:content2Second + "px"
	},800, function() {
		$('#'+currentPage).hide();
		currentPage = id;
		locked = false;
	})

	listIndex = -1;

	if ($('#' + id + ' .contentHeader a').length > 1) {
	    eval($('#' + id + ' .contentHeader a')[0].href.toString().replace('javascript:', '').replace(/%20/gi, ' '));
	}
}