var CK = function(){
}
var navInt;

CK.prototype.init = function(){
    $('#menuOpen').click(function(){ $('#ddnav').slideDown('fast');});
    //$('#menuOpen').mouseover(function(){setTimeout(function(){ $('#ddnav').show();}, 500);});
    $('#menuClose').click(function(){$('#ddnav').hide();});
    $('#menuOpen').mouseover(function(){$('img.arrow').attr('src','/images/arrow_black.gif')});
    $('#menuOpen').mouseout(function(){$('img.arrow').attr('src','/images/arrow.gif')});
    CK.prototype.setupNav();
    CK.prototype.reposition();//initial reposition
    $(window).resize(function() { CK.prototype.reposition();});
}

CK.prototype.setupNav = function(){
    $('#ddnav').hide();
    $('div.ddblk li.hNav').hide();
    $('div.ddblk').mouseover(function(){
        $(this).css({ color: "#FFFFFF", background: "#eeeeee" }); 
        $(this).children().children('li.hNav').show(); 
        window.clearTimeout(navInt);
        });
    $('div.ddblk').mouseout(function(){
        $(this).css({ color: "#a8a8a8", background: "#FFFFFF" });   
        $(this).children().children('li.hNav').hide(); 
        navInt = setTimeout(function(){ $('#ddnav').slideUp('fast');}, 500);
        });
    $('div.ddblkact').mouseover(function(){
        $(this).css({ color: "#FFFFFF", background: "#eeeeee" }); 
        window.clearTimeout(navInt);
        });
    $('div.ddblkact').mouseout(function(){
        $(this).css({ color: "#a8a8a8", background: "#FFFFFF" });   
        navInt = setTimeout(function(){ $('#ddnav').slideUp('fast');}, 500);
        });
    $('#ddnav a').click(function(){ 
        $('#ddnav').slideUp(100);
        $('img.arrow').attr('src','/images/arrow.gif');
    });
}

CK.prototype.reposition = function(){
    var left = ($(window).width() - 900)/2;
    
    var top = ($(window).height() - 600)/2;
    
    if((top > 0)&&(left>0)){
        $('#hor').css({ "top": "50%"}); 
        $('#wrap').css({ "top": "-303px"}); 
    }else
    {
        $('#wrap').css({ "top": "3px"}); 
        $('#hor').css({ "top": "3px"});
    }
    if(left > 0){
        $('#wrap').css({ "left": "50%"}).css({ "margin-left": "-453px"}); 
    }
    else
    {
        $('#wrap').css({ "left": "0"}).css({ "margin-left": "5px"}); 
    }
}

var ck = new CK();