$('li:not(.section-title)').css('display', 'none');

$(document).ready(function() {
    if (location.href.indexOf("/contact/")==-1) {
        $('#back').css({"margin-top": $('.text').height()+90, "position": 'fixed'});
    }
    
    
    $("#content a:not(#backlink)").attr('target', '_blank');
    
    $('#nav li:not(.section-title)').hide();
    $('#nav li.section-title').css('cursor', 'pointer').click(function() {
        $('#nav li:not(.section-title)').hide();
        $(this).parent('ul').children('li:not(.section-title)').slideDown('fast');
    });
    
    if (location.href.indexOf("/landscape/")!=-1) {
        $('.text').css('top', '140px');
        $('#bighead').after('<div id="filters"><a href="#" id="process">PROCESS</a>, <a href="#" id="portrait">PORTRAIT</a>, <a href="#" id="photography">CLIENT PHOTOGRAPHY</a>, <a href="#" class="on" id="all">VIEW ALL</a></div>');
        $('#process').click(function() {
            $('#filters a').removeClass('on');
            $(this).addClass('on');
            filter('process');
            return false;
        });
        $('#portrait').click(function() {
            $('#filters a').removeClass('on');
            $(this).addClass('on');
            filter('portrait');
            return false;
        });
        $('#photography').click(function() {
            $('#filters a').removeClass('on');
            $(this).addClass('on');
            filter('photo');
            return false;
        });
        $('#all').click(function() {
            $('#filters a').removeClass('on');
            $(this).addClass('on');
            filter('all');
            return false;
        });
        
        
        
    }
    
    
    
});

function iframer() {}

function filter (filter) {
    switch (filter){
        case "process":
        $('.grow .thumb').show();
        $('.grow .thumb img:not(.process)').parent('.thumb-img').parent('.thumb-it').parent('.thumb').hide();
        
        $('.yahmon .backgrounded').show();
        $('.yahmon img:not(.process)').parent('a').parent('span .backgrounded').hide();
        
        $('.deux a').show();
        $('.deux a:not(.process)').hide();
        
        $('.nothumb').show();
        $('.nothumb:not(.process)').hide();
        
        $('.overover p').show();
        $('.overover p:not(.process)').hide();
        
        $('#s1 div').remove();
        $('#s1').html($('#repository').html());
        $('#s1 div:not(.process)').remove();
        reCycle();
        
        unBox();
        $('.thick a').show().addClass('thickbox');
        $('.thick a:not(.process)').hide().removeClass('thickbox');
        TB_init();
        
        break;
        case "portrait":
        $('.grow .thumb').show();
        $('.grow .thumb img:not(.portrait)').parent('.thumb-img').parent('.thumb-it').parent('.thumb').hide();
        
        $('.yahmon .backgrounded').show();
        $('.yahmon img:not(.portrait)').parent('a').parent('span .backgrounded').hide();
        
        $('.deux a').show();
        $('.deux a:not(.portrait)').hide();
        
        $('.nothumb').show();
        $('.nothumb:not(.portrait)').hide();
        
        $('.overover p').show();
        $('.overover p:not(.portrait)').hide();
        
        $('#s1 div').remove();
        $('#s1').html($('#repository').html());
        $('#s1 div:not(.portrait)').remove();
        reCycle();
        
        unBox();
        $('.thick a').show().addClass('thickbox');
        $('.thick a:not(.portrait)').hide().removeClass('thickbox');
        TB_init();
        
        break;
        case "photo":
        $('.grow .thumb').show();
        $('.grow .thumb img:not(.photo, .photography)').parent('.thumb-img').parent('.thumb-it').parent('.thumb').hide();
        
        $('.yahmon .backgrounded').show();
        $('.yahmon img:not(.photo, .photography)').parent('a').parent('span .backgrounded').hide();
        
        $('.deux a').show();
        $('.deux a:not(.photo, .photography)').hide();
        
        $('.nothumb').show();
        $('.nothumb:not(.photo, .photography)').hide();
        
        $('.overover p').show();
        $('.overover p:not(.photo, .photography)').hide();
        
        $('#s1 div').remove();
        $('#s1').html($('#repository').html());
        $('#s1 div:not(.photo, .photography)').remove();
        reCycle();
        
        unBox();
        $('.thick a').show().addClass('thickbox');
        $('.thick a:not(.photo, .photography)').hide().removeClass('thickbox');
        TB_init();
        
        break;
        default:
        $('.thumb').show();
        $('.yahmon .backgrounded').show();
        $('.deux a').show();
        $('.nothumb').show();
        $('.overover p').show();
        $('#s1').html($('#repository').html());
        reCycle();
        
        unBox();
        $('.thick a').show();
        $('.thick a').show().addClass('thickbox');
        TB_init();
        break;
    }
}

function reCycle() {}
function TB_remove () {}
function TB_init () {}

function unBox () {
    TB_remove();
    $("a.thickbox").unbind('click').removeClass('thickbox');
    $('#TB_HideSelect').remove();
    $('#TB_overlay').remove();
    $('#TB_load').remove();
    $('#TB_window').remove();
    $('#TB_closeWindowButton').remove();
    $('#TB_prev').remove();
    $('#TB_next').remove();
    $('#TB_ImageOff').remove();
    $('#TB_bg').remove();
    $('#TB_prev').remove();
    $('#TB_next').remove();
    imgPreloader = null;
}
function do_hover (img) {
    
    if(window.location!="http://ro-lu.com/exhibit/index.php?/contact/blog/" && window.location!="http://www.ro-lu.com/exhibit/index.php?/contact/blog/"){
        if (img!="") {
            var xrand = 280;//Math.random()*200+150;
            var yrand = 100;//Math.random()*200+150;
            $('#preview').html('<img src="http://ro-lu.com/exhibit/files/gimgs/'+img+'">').css({top: yrand+'px', left: xrand+'px'});
        } else {
            $('#preview').html('');
        }
    }else {
        $('#preview').html('');
    }
    
}