$(document).ready(
    function(){
        images_ajax();
        acilis();        
    }
);

function acilis(){
    
    var length = $("div#righternews img").length;
    
    $("div#righternews img").css("margin-left", "-30px");
    
    //---------------------------------------------------------
    var opslag = new Array();
    
    $.ajax({
        url: "includes/js/fotos_bestanden.xml",
        type: "POST",
        async: false, 
        success: function(data){
            for(i=0; i<56; i++){
                opslag[i]=$(data).find("bestand").eq(i).text();
            }
        }
    });
    //---------------------------------------------------------
    
    $("div#righternews img").each(
        function(index){
            
            var abc = (7-index) * 180;
            
            if( $(this).index() == 0 ){
                $(this).css("border-radius", "25px 25px 0px 0px");
            }
            
            if( $(this).index() == 6 ){
                $(this).css("border-radius", "0px 0px 25px 25px");
            }
            
            
            $(this).mouseover(
                function(){
                    
                    $(this).attr("width", "431");
                    $(this).attr("height", "276");
                    $(this).css("margin", "0 0 0 -200px");
                    $("div#olusandiv").show();
                    $("div#olusandiv").css("margin", "-"+abc+"px 0px 0px -610px" );
                    
                    
                    
                    //---------------------------------------------------------
                    $.ajax({
                        url: opslag[index+1],
                        type: "POST",
                        async: false, 
                        success: function(data){
                            $("div#olusandiv").append($(data).find("div#rightmid").text());
                        }
                    });
                    //---------------------------------------------------------
                    
                }
            );
            
            $(this).mouseout(
                function(){
                    $(this).attr("width", "190%");
                    $(this).attr("height", "180px");
                    $(this).css("margin", "0 0 0 -30px");
                    $("div#olusandiv").empty();
                    $("div#olusandiv").hide();
                }
            );
            
            $(this).click(
                function(){
                    window.location.href = opslag[index+1];
                }
            );
            
            
        }
    );
    
    
    
    
}//einde acilis functie



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




