$(document).ready(
    function(){
        images_ajax2();
        acilis2();        
    }
);

function acilis2(){
    
    //var length = $("div#index_center_news img").length;
    
    //$("div#index_center_news img").css("margin-left", "-30px");
    
    //---------------------------------------------------------
    var opslag2 = new Array();
    
    $.ajax({
        url: "includes/js/fotos_bestanden.xml",
        type: "POST",
        async: false, 
        success: function(data){
            for(i=0; i<56; i++){
                opslag2[i]=$(data).find("bestand").eq(i).text();
            }
        }
    });
    //---------------------------------------------------------
    
    $("div#index_center_news img").each(
        function(index){
            
            var abc = (7-index) * 180;
            
            if( $(this).index() == 1 ){
                $(this).css("border-radius", "25px 0px 0px 0px");
            }
            
            if( $(this).index() == 2 ){
                $(this).css("border-radius", "0px 25px 0px 0px");
            }
            
            if( $(this).index() == 7 ){
                $(this).css("border-radius", "0px 0px 0px 25px");
            }
            
            if( $(this).index() == 8 ){
                $(this).css("border-radius", "0px 0px 25px 0px");
            }
            
            
            $(this).mouseover(
                function(){
                    
                    $(this).attr("width", "431");
                    $(this).attr("height", "276");
                    $(this).css("margin", "0 0 0 -200px");
                    $("div#olusandiv2").show();
                    
                    
                    if( $(this).index() == 1 || $(this).index() == 2    ){
                        $("div#olusandiv2").css("margin-top", "-470px" );
                    }
                    
                    if( $(this).index() == 3 || $(this).index() == 4    ){
                        $("div#olusandiv2").css("margin-top", "-285px" );
                    }
                    
                    if( $(this).index() == 5 || $(this).index() == 6    ){
                        $("div#olusandiv2").css("margin-top", "-100px" );
                    }
                    
                    if( $(this).index() == 7 || $(this).index() == 8    ){
                        $("div#olusandiv2").css("margin-top", "80px" );
                    }
                    
                    
                    
                    //---------------------------------------------------------
                    $.ajax({
                        url: opslag2[index+8],
                        type: "POST",
                        async: false, 
                        success: function(data){
                            $("div#olusandiv2").append($(data).find("div#rightmid").text());
                        }
                    });
                    //---------------------------------------------------------
                    
                }
            );
            
            $(this).mouseout(
                function(){
                    $(this).attr("width", "285px");
                    $(this).attr("height", "180px");
                    $(this).css("margin", "0px 0px 0px 0px");
                    $("div#olusandiv2").empty();
                    $("div#olusandiv2").hide();
                    
                    if( $(this).index() == 1    ){
                        $("div#olusandiv2").css("margin", "0px 0px 0px 0px" );
                    }
                    
                }
            );
            
            $(this).click(
                function(){
                    window.location.href = opslag2[index+8];
                }
            );
            
            
        }
    );
    
    
    
    
}//einde acilis functie



function images_ajax2(){
    
    
    $.ajax({
        url: "includes/js/fotos_bestanden.xml",
        type: "POST",
        async: false, 
        success: function(data){
            for(i=8; i<16; i++){
                $("div#index_center_news").append('<img src="'+$(data).find("foto").eq(i).text()+'" width="285px" height="180px" />');
            }
        }
    });
    
    
    
    
}




