/* ---------- Variables ---------- */
var BROWSER_IE6 = $.browser.version.substr(0,1) == 6;
var dialog_option = { 
        autoOpen: true, 
        bgiframe: true, 
        closeOnEscape: false,
        modal: true, 
        resizable: false, 
        draggable: false, 
        width: 550, 
        height: 550,
        buttons: {
                Close: function() {
                    content = $(this).dialog().html();
                    content_id = $(this).find('span.id').attr('name');
                    content_title = $(this).find('span.id').attr('title');

                    title = $(this).dialog().find('.ui-dialog-title').text();
                    $('#' + content_id).append( '<div class="dialog_content content" title="' + content_title + '">' + content + '</div>' );
                    $(this).dialog('close');
                }
            }
    };
var href;
var id;
var content;
var title;                

/* ---------- Functions ---------- */

// All Page Specific JS goes here
function page_specific_js () {
    
    if ($page == 'index') {
        $.elementReady('main', function(){
            
        });

    } else if ($page == 'services') {
        $.elementReady('main', function(){
            
        });

    } else if ($page == 'clients') {
//        $.elementReady('main', function(){
        $(document).ready(function(){
            
            $('#client_menu li').click(function(e){
                href = $(this).find('a').attr('href');
                $(href + ' .dialog_content').dialog( dialog_option );
                e.preventDefault();
            });
            
        });

    } else if ($page == 'portfolio') {
//        $.elementReady('main', function(){
        $(document).ready(function(){
        
            $('#portfolio_menu span').click(function(e){
                trgt = $(this).find('a').attr('name');
                $('#' + trgt + ' .dialog_content').dialog( dialog_option );
                e.preventDefault();
            });
            
        });

    } else if ($page == 'team') {
        $.elementReady('main', function(){
            
        });

    } else if ($page == 'philosophy') {
        $.elementReady('main', function(){
            
        });

    } else if ($page == 'contactus') {
        $.elementReady('main', function(){
            
        });
    }
}

/* ---------- Template Only ---------- */
$.elementReady('template_wrapper', function(){

    
    // Keeps li.logo hover consistant if there's a child link
    $(this).find('li.logo').hover(function(){
        $(this).find('a').addClass('hover');
    },function(){
        $(this).find('a').removeClass('hover');
    });
});


$.elementReady('header', function(){

    
    // IE6 stuff
    if (BROWSER_IE6) { $('#header ul li:last-child').addClass('last-child'); }
    
    
});

page_specific_js();
