$(document).ready(function(){

	$.sifrSettings({path:'userfiles/sifr/'});
	
	$(".sifrTitle").sifr({
	    font:'copperplategothicbold',
	    height: 23,
	    lineHeight: 23,
	    absoluteOffsetX: 100,
	    absoluteOffsetY: 100
	});

    $("#main_right .block .row, #aanbod_container .row .block").hover(
        function () {
            $(this).addClass('active');
            $("#aanbod_container .row .block.active .open_huizen_route").html('Deelnemer');
        }, 
        function () {
            $("#aanbod_container .row .block.active .open_huizen_route").html('Open Huizen Route!');
            $(this).removeClass('active');
        }
    );
    $("#main_right .block .row, #aanbod_container .row .block .image").click(function () { 
        if ($(this).attr("title")){
            location.href=sitepath+$(this).attr("title");
        }
    });
    
    if ($("#thumbnails_order").text()){
        $("#thumbnails_order").sortable({ 
            items: ".thumbnail",
            delay: 0,
            distance: 5,
    		change: function(e, ui){
                $.ajax({
                    type: "POST",
                    url: sitepath+"aanbod/photo/order",
                    data: "aanbod_id="+$("#aanbod_id").attr("value")+"&name="+$('#thumbnails_order').sortable('toArray'),
                    success: function(msg){
                        //alert( "Data Saved: " + msg );
                    }
                });
    		}
        });
    }
    
    // aanbod show tabs
    if ($('#aanbod_show_container').text()){
        $('#aanbod_show_container > ul.ui-tabs-nav').tabs({ 
            fx: {
                //height: 'toggle',
                opacity: 'toggle'
            }
        });
        $('#aanbod_show_container > ul.ui-tabs-nav li a').click(function(){
	        if ($(this).attr('rel') != '') {
	            window.open($(this).attr('rel'), '_blank');
	        }
	        return false;
	    });
    }
	// EN uitzondering van tabs
    $(".addCount").click(function(){
    	$.post(sitepath+"aanbod/brochure/count/"+$(this).attr("id"), function(data){
			//alert(data);
		});
    });
    
    
    // lightbox
    if ($('#lightbox').text()){
    	$(function() {
        	$('#lightbox a').lightBox({fixedNavigation:true});
        });
    }
    /*
    $('#crossimages').crossSlide({
    fade: 3
    }, [
      {
        src:  'userfiles/headers/2.jpg',
        from: 'bottom left 1.0x',
        to:   'top right 1.0x',
        time: 4
      }, {
        src:  'userfiles/headers/3.jpg',
        from: 'top left 1.0x',
        to:   'bottom left 1.0x',
        time: 3
      }, {
        src:  'userfiles/headers/1.jpg',
        from: 'top right 1.0x',
        to:   'bottom left 0.5x',
        time: 4
      }
    ]);
    */
});
