function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}

jQuery(function($) {
    jQuery.datepicker.regional['tr'] = {
        closeText: 'kapat',
        prevText: '&#x3c;geri',
        nextText: 'ileri&#x3e',
        currentText: 'bug&uuml;n',
        monthNames: ['Ocak', '&#350;ubat', 'Mart', 'Nisan', 'May&#305;s', 'Haziran',
		'Temmuz', 'A&#287;ustos', 'Eyl&uuml;l', 'Ekim', 'Kas&#305;m', 'Aral&#305;k'],
        monthNamesShort: ['Oca', '&#350;ub', 'Mar', 'Nis', 'May', 'Haz',
		'Tem', 'A&#287;u', 'Eyl', 'Eki', 'Kas', 'Ara'],
        dayNames: ['Pazar', 'Pazartesi', 'Sal&#305;', '&Ccedil;ar&#351;amba', 'Per&#351;embe', 'Cuma', 'Cumartesi'],
        dayNamesShort: ['Pz', 'Pt', 'Sa', '&Ccedil;a', 'Pe', 'Cu', 'Ct'],
        dayNamesMin: ['Pz', 'Pt', 'Sa', '&Ccedil;a', 'Pe', 'Cu', 'Ct'],
        dateFormat: 'dd.mm.yy', firstDay: 1,
        isRTL: false
    };
    jQuery.datepicker.setDefaults($.datepicker.regional['tr']);
});

function addTakvimButtons() {
    jQuery('#btnSonBaski').remove();
    jQuery('#btnDateKapat').remove();
    jQuery('#uiOrj').append('<a id="btnSonBaski" style="float:left;" href="#">Son Bask&#305;ya D&ouml;n</a> <a id="btnDateKapat" style="float:right" href="#">Kapat</a><span style="clear:both;" />');
    jQuery('#btnSonBaski').click(function(ev) { ev.preventDefault(); document.location = '/Ascx/Ajax/AnasayfaContent.aspx?SonBaski=1'; return false; });
    jQuery('#btnDateKapat').click(function(ev) { ev.preventDefault(); $('.commonTakvim').hide(); return false; });
}

function addLoader(el) {
    //el.css('position', 'relative');
    el.prepend('<img id="ajax-loader-absolute" src="/images/ajax-loader.gif" alt="Yükleniyor" />');
}


function RemoveTurkishCharecter(text) {
    var temptext = text.toString().toLowerCase().replace("", "-").replace("ı", "i").replace("ö", "o").replace("ş", "s").replace("ç", "c").toString().replace("ü", "u").replace("ğ", "g");
    return temptext;
}

function droplariGetir(that, dropUrl) {
    var parent = $('#spanDropControlDetayWAjax');
    parent.html('<img src="/img/ajax-loaderUzun.gif" alt="Yukleniyor" />');
    $.ajax({
        type: "get",
        url: dropUrl,
        'complete': function(msg) {
            parent.html(msg.responseText);
            // bind the objects event handler
            $('#dropControlDetayWAjax').change(function(event) {
            window.open("/yazar/" + RemoveTurkishCharecter($('#dropControlDetayWAjax option:selected').text()) + "/" + $(this).val() + ".aspx", "_top");
       
            });
        }
    });
}

function fb_loggedOut() {
    alert("cikis yapildi");
}

$(document).ready(function() {

    $('.btnCikis').click(function(e) {

        FB.init("7d561b09d030e738d450f102b8d1bb3e");
        FB.Connect.logout();

    });

    $('#dropControlDetayWAjax').change(function(event) {
    window.open("/yazar/" + RemoveTurkishCharecter($('#dropControlDetayWAjax option:selected').text()) + "/" + $(this).val() + ".aspx", "_top");
       
    });

    /*$('a').click(function(e) {
    var q = getQuerystring("Tarih");
    if(q){
    $(this).attr('href',$(this).attr('href') + '?Tarih=' + q);
    });*/

    $('.paylasLink').click(function(e) {
        e.preventDefault();
        $('#paylasPopup').toggle();
        return false;
    });

    $('.btnClose').click(function(e) {
        $(this).parent().hide();
    });

    jQuery(".commonTakvim").datepicker({
        maxDate: 0,
        minDate: -365,
        showButtonPanel: false,
        gotoCurrent: false,

        onChangeMonthYear: function(year, month, inst) {
            //addTakvimButtons(); 
        },
        onSelect: function(dateText, inst) {
            $('#divListYazar').fadeTo("slow", 0.5);
            addLoader($('#divListYazar'));
            $('.commonTakvim').hide();

            var queryString = getQuerystring("GazeteID");
            var qs = "";
            if (queryString) qs = "&GazeteID=" + queryString;

            $.ajax({
                type: "get",
                url: '/Ascx/Ajax/AnasayfaContent.aspx?Tarih=' + dateText + qs,
                'complete': function(msg) {
                    $('#divListYazar').html(msg.responseText);
                    $('#divListYazar').fadeTo("fast", 1);
                    $('#ajax-loader-absolute').remove();
                    $('.calendatTextU').text(dateText);

                }
            });
            //document.location = '/Anasayfa.aspx?Tarih=' + dateText
        }
    });

    jQuery('.btnTakvim').click(function(e) {
        addTakvimButtons();
    });


    $('#btnSiteneEkle').click(function(e) {
        e.preventDefault();
        window.open('/Ascx/SiteneEkle/Default.aspx', '', 'height=170,width=600,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
        return false;
    });

});



function CreateBookmarkLink(title, url) {
    if (window.sidebar) {
        // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url, "");
    } else if (window.external) { // IE Favorite
        window.external.AddFavorite(url, title);
    }
    else if (window.opera && window.print) { // Opera Hotlist
        return true;
    }
}

function hideModal(divID) {
    document.getElementById(divID).style.display = 'none';
}

function NesneGizle(nesne) {
    document.getElementById(nesne).style.display = 'none';
}

function NesneGoster(nesne) {
    document.getElementById(nesne).style.display = 'block';
}

// JScript File sy
var sy_conter = 1;
var sy_timerCount;
var sy_maxHeaderlineCount = 7;
sy_maxHeaderlineCount = sy_maxHeaderlineCount + 1;

function sy_ShowArticle(sy_selectedItemIndex) {
    sy_stopTimer();
    for (i = 1; i < sy_maxHeaderlineCount; i++) {
        if (i != sy_selectedItemIndex) {
            document.getElementById('sy_HeaderTable_' + i).style.display = 'none';
            document.getElementById('sy_img' + i).src = 'img/manset/alt_' + i + '.png';
        }
        else {
            document.getElementById('sy_HeaderTable_' + i).style.display = 'block';
            document.getElementById('sy_img' + i).src = 'img/manset/alt_' + i + '_on.png';
        }
    }

}

function sy_timerStart(sy_conterNum) {
    if (sy_conterNum != -1)
        sy_conter = sy_conterNum;
    if (sy_conter == sy_maxHeaderlineCount) sy_conter = 1;
    for (i = 1; i < sy_maxHeaderlineCount; i++) {
        if (i != sy_conter) {
            document.getElementById('sy_HeaderTable_' + i).style.display = 'none';
            document.getElementById('sy_img' + i).src = 'img/manset/alt_' + i + '.png';
        }
        else {
            document.getElementById('sy_HeaderTable_' + i).style.display = 'block';
            document.getElementById('sy_img' + i).src = 'img/manset/alt_' + i + '_on.png';
        }
    }
    sy_conter = sy_conter + 1;
    sy_timerCount = setTimeout("sy_timerStart(-1)", 5000);
}

function sy_stopTimer() {
    clearTimeout(sy_timerCount);
}


var yazarx_conter = 1;
var yazarx_timerCount;
var yazarx_maxHeaderlineCount = 7;
yazarx_maxHeaderlineCount = yazarx_maxHeaderlineCount + 1;

function yazarx_ShowArticle(yazarx_selectedItemIndex) {
    yazarx_stopTimer();
    for (i = 1; i < yazarx_maxHeaderlineCount; i++) {
        if (i != yazarx_selectedItemIndex) {
            document.getElementById('yazarx_HeaderTable_' + i).style.display = 'none';
            document.getElementById('yazarx_img_' + i).src = 'img/manset/alt_' + i + '.png';
        }
        else {
            document.getElementById('yazarx_HeaderTable_' + i).style.display = 'block';
            document.getElementById('yazarx_img_' + i).src = 'img/manset/alt_' + i + '_on.png';
        }
    }

}

function yazarx_timerStart(yazarx_conterNum) {
    if (yazarx_conterNum != -1)
        yazarx_conter = yazarx_conterNum;
    if (yazarx_conter == yazarx_maxHeaderlineCount) yazarx_conter = 1;
    for (i = 1; i < yazarx_maxHeaderlineCount; i++) {
        if (i != yazarx_conter) {
            document.getElementById('yazarx_HeaderTable_' + i).style.display = 'none';
            document.getElementById('yazarx_img_' + i).src = 'img/manset/alt_' + i + '.png';
        }
        else {
            document.getElementById('yazarx_HeaderTable_' + i).style.display = 'block';
            document.getElementById('yazarx_img_' + i).src = 'img/manset/alt_' + i + '_on.png';
        }
    }
    yazarx_conter = yazarx_conter + 1;
    yazarx_timerCount = setTimeout("yazarx_timerStart(-1)", 5000);
}

function yazarx_stopTimer() {
    clearTimeout(yazarx_timerCount);
}

function start() {
    yazarx_ShowArticle(1);
    yazarx_timerStart(1);
    sy_ShowArticle(1);
    sy_timerStart(1);
}

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX = 12 //Customize x offset of tooltip
var offsetfromcursorY = 10 //Customize y offset of tooltip

var offsetdivfrompointerX = 10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY = 14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV 

document.write('<img id="dhtmlpointer" src="images/arrow2.gif">') //write out pointer image

var ie = document.all
var ns6 = document.getElementById && !document.all
var enabletip = false
if (ie || ns6)
    var tipobj = document.all ? document.all["dhtmltooltip"] : document.getElementById ? document.getElementById("dhtmltooltip") : ""

var pointerobj = document.all ? document.all["dhtmlpointer"] : document.getElementById ? document.getElementById("dhtmlpointer") : ""

function ietruebody() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor) {
    if (ns6 || ie) {
        if (typeof thewidth != "undefined") tipobj.style.width = thewidth + "px"
        if (typeof thecolor != "undefined" && thecolor != "") tipobj.style.backgroundColor = thecolor
        tipobj.innerHTML = thetext
        enabletip = true
        return false
    }
}

function positiontip(e) {
    if (enabletip) {
        var nondefaultpos = false
        var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
        var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
        //Find out how close the mouse is to the corner of the window
        var winwidth = ie && !window.opera ? ietruebody().clientWidth : window.innerWidth - 20
        var winheight = ie && !window.opera ? ietruebody().clientHeight : window.innerHeight - 20

        var rightedge = ie && !window.opera ? winwidth - event.clientX - offsetfromcursorX : winwidth - e.clientX - offsetfromcursorX
        var bottomedge = ie && !window.opera ? winheight - event.clientY - offsetfromcursorY : winheight - e.clientY - offsetfromcursorY

        var leftedge = (offsetfromcursorX < 0) ? offsetfromcursorX * (-1) : -1000

        //if the horizontal distance isn't enough to accomodate the width of the context menu
        if (rightedge < tipobj.offsetWidth) {
            //move the horizontal position of the menu to the left by it's width
            tipobj.style.left = curX - tipobj.offsetWidth + "px"
            nondefaultpos = true
        }
        else if (curX < leftedge)
            tipobj.style.left = "5px"
        else {
            //position the horizontal position of the menu where the mouse is positioned
            tipobj.style.left = curX + offsetfromcursorX - offsetdivfrompointerX + "px"
            pointerobj.style.left = curX + offsetfromcursorX + "px"
        }

        //same concept with the vertical position
        if (bottomedge < tipobj.offsetHeight) {
            tipobj.style.top = curY - tipobj.offsetHeight - offsetfromcursorY + "px"
            nondefaultpos = true
        }
        else {
            tipobj.style.top = curY + offsetfromcursorY + offsetdivfrompointerY + "px"
            pointerobj.style.top = curY + offsetfromcursorY + "px"
        }
        tipobj.style.visibility = "visible"
        if (!nondefaultpos)
            pointerobj.style.visibility = "visible"
        else
            pointerobj.style.visibility = "hidden"
    }
}

function hideddrivetip() {
    if (ns6 || ie) {
        enabletip = false
        tipobj.style.visibility = "hidden"
        pointerobj.style.visibility = "hidden"
        tipobj.style.left = "-1000px"
        tipobj.style.backgroundColor = ''
        tipobj.style.width = ''
    }
}

document.onmousemove = positiontip

function blinkIt() {
    if (!document.all) return;

    else {
        for (i = 0; i < document.all.tags('blink').length; i++) {
            s = document.all.tags('blink')[i];
            s.style.visibility = (s.style.visibility == 'visible') ? 'hidden' : 'visible';
        }
    }
}

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}



/* SHARE URL */
var ShareUrl = {
    facebook: function() {
        window.open('http://www.facebook.com/sharer.php?title=' + encodeURIComponent(document.title) + '&u=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    google: function() {
        window.open('http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(document.title) + '&bkmk=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    yahoo: function() {
        window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t=' + encodeURIComponent(document.title) + '&u=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    myspace: function() {
        window.open('http://www.myspace.com/index.cfm?fuseaction=postto&t=' + encodeURIComponent(document.title) + '&u=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    friendFeed: function() {
        window.open('http://friendfeed.com/share/bookmarklet/frame?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    mixx: function() {
        window.open('http://www.mixx.com/submit/story?title=' + encodeURIComponent(document.title) + '&page_url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    digg: function() {
        window.open('http://digg.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    stumpleUpon: function() {
        window.open('http://www.stumbleupon.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    delicious: function() {
        window.open('http://del.icio.us/post?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    reddit: function() {
        window.open('http://reddit.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    twitter: function() {
        window.open('http://twshot.com/share.aspx?title=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(document.location), '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    }
}

var ShareUrl2 = {
    facebook: function(location) {
        window.open('http://www.facebook.com/sharer.php?title=' + encodeURIComponent(document.title) + '&u=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    google: function(location) {
        window.open('http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(document.title) + '&bkmk=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    yahoo: function(location) {
        window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t=' + encodeURIComponent(document.title) + '&u=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    myspace: function(location) {
        window.open('http://www.myspace.com/index.cfm?fuseaction=postto&t=' + encodeURIComponent(document.title) + '&u=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    friendFeed: function(location) {
        window.open('http://friendfeed.com/share/bookmarklet/frame?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    mixx: function(location) {
        window.open('http://www.mixx.com/submit/story?title=' + encodeURIComponent(document.title) + '&page_url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    digg: function(location) {
        window.open('http://digg.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    stumpleUpon: function(location) {
        window.open('http://www.stumbleupon.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    delicious: function(location) {
        window.open('http://del.icio.us/post?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    reddit: function(location) {
        window.open('http://reddit.com/submit?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    twitter: function(location) {
        window.open('http://twshot.com/share.aspx?title=' + encodeURIComponent(document.title) + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    }
}
var ShareUrl3 = {
    facebook: function(title, location) {
        window.open('http://www.facebook.com/sharer.php?title=' + title + '&u=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    digg: function(title, location) {
        window.open('http://digg.com/submit?title=' + title + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    },
    twitter: function(title, location) {
        window.open('http://twshot.com/share.aspx?title=' + title + '&url=' + location, '', 'height=650,width=910,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1');
    }
}

$(function() {
    $("#manset").tabs({ spinner: 'Yukleniyor...' });

    $('#carousel1').jcarousel({
        scroll: 1,
        visible: 1,
        auto: 2,
        buttonNextHTML: '<span>ileri ></span>',
        buttonPrevHTML: '<span>< geri</span>',
        initCallback: mycarousel_initCallback,
        itemLoadCallback: itemLoadCallbackFunction,
        wrap: 'last'
    });

    $('#manset').bind('tabsshow', function(event, ui) {
        if (ui.panel.id == "tab-1") {
            $('#tab-2').html('');
            $('#tab-3').html('');
            $('#carousel1').jcarousel({
                scroll: 1,
                visible: 1,
                auto: 2,
                buttonNextHTML: '<span>ileri ></span>',
                buttonPrevHTML: '<span>< geri</span>',
                initCallback: mycarousel_initCallback,
                itemLoadCallback: itemLoadCallbackFunction,
                wrap: 'last'
            });
        } else if (ui.panel.id == "tab-2") {
            $('#tab-1').html('');
            $('#tab-3').html('');
            $('#carousel2').jcarousel({
                scroll: 1,
                visible: 1,
                auto: 2,
                buttonNextHTML: '<span>ileri ></span>',
                buttonPrevHTML: '<span>< geri</span>',
                initCallback: mycarousel_initCallback,
                itemLoadCallback: itemLoadCallbackFunction,
                wrap: 'last'
            });
        } else if (ui.panel.id == "tab-3") {
            $('#tab-1').html('');
            $('#tab-2').html('');
            $('#carousel3').jcarousel({
                scroll: 1,
                visible: 1,
                auto: 2,
                buttonNextHTML: '<span>ileri ></span>',
                buttonPrevHTML: '<span>< geri</span>',
                initCallback: mycarousel_initCallback,
                itemLoadCallback: itemLoadCallbackFunction,
                wrap: 'last'
            });
        }
    });




});

function itemLoadCallbackFunction(carousel, state) {
    // get the current tab
    var tab = carousel.container.parent().parent();

    $('#' + tab.attr('id') + ' .manset-items').removeClass('manset-item-selected');
    $('#' + tab.attr('id') + ' .manset-item-' + carousel.first).addClass('manset-item-selected');
};

function mycarousel_initCallback(carousel) {
    // get the current tab
    var tab = carousel.container.parent().parent();

    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });

    //prepare numbers

    var mansetNumbers = $('#' + tab.attr('id') + ' .manset-numbers');
    var liMansetItem = $('#' + tab.attr('id') + ' .li-manset-item');
    mansetNumbers.empty();
    var items = liMansetItem;
    for (var i = 1; i <= items.length; i++) {
        mansetNumbers.append('<a class="manset-items manset-item-' + i + '" href="#">' + i + '</a>');
        jQuery('#' + tab.attr('id') + ' .manset-numbers a').bind('click', function() {
            carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
            carousel.startAuto(0);
            return false;
        });
    }

};
