$(document).ready(function(){
    
    //$("#header").addClass("guy_and_bag");
    //$("#header").html( $('<div></div>').hide().addClass("guy_and_bag").fadeIn("slow") );
    //console.log( window.location.pathname );
    
    var CurrentLocation = window.location.pathname;
    var HeaderItems = {
        "/" : 'guy_and_bag',
        "/hakkimizda/" : 'two_plus_two',
        "/hizmetlerimiz/" : 'hand_shake',
        "/muhendislik/" : 'engineering',
        "/egitimler/" : 'talking',
        "/referanslar/" : 'refs',
        "/tesvikler/" : 'supports',
        "/ucretsiz-danismanlik/" : 'pum',
        "/iletisim/" : 'pencil'
    };
    
    if (HeaderItems[CurrentLocation]) {
        $("#header").addClass(HeaderItems[CurrentLocation]);
    } else{
        $("#header").addClass('any_sub_page');
    };
    
    // if (CurrentLocation === '/') {
    //     $("#header").html( $("<h1>İnnovasyonla<br/>Geleceği<br/>Görün</h1>").fadeIn("slow") );
    // };
    
    if (CurrentLocation === '/') {
        $("#news_area").load('/datas/news/',[],function(){
            // console.log( "ok" );
        });
        // console.log( "running" );
        // $.getJSON('/json/news/',function(data){
        //     $.each(data,function(i,item){
        //         var Url = item['fields'][ 'url' ];
        //         var Pdf = item['fields'][ 'pdf' ];
        //         var Title = item['fields'][ 'title' ];
        //         var UpdatedAt = item['fields'][ 'updated_at' ];
        //         console.log( Title );
        //     });
        // });
    }
    
    $("#menu a[href='" + CurrentLocation + "']").addClass("link_selected").parent().addClass("menu_selected");

    //$(".triple_images img:first").css("margin-right","19px");
    //$(".triple_images img:last").css("margin-left","19px");

	if ($(".triple_images")) {
		$(".triple_images img").each(function(i,image){
			switch( i % 3 ){
				case 0:
					$(image).css("margin-right","19px");
				break;
				case 2:
					$(image).css("margin-left","19px");
				break;
			}
		});
	};
	

});
