function toggleMenu(id){
    $('#subMenu'+id).toggle();
    $('#subArrowDown'+id).toggle();
    $('#subArrow'+id).toggle();
    
}

function edit(div){
    $('#'+div+'Show').hide();
    $('#'+div+'Edit').show();

    return false;
}
function show(div){
    $('#'+div+'Show').show();
    $('#'+div+'Edit').hide();

    return false;
}

function toggle(div){
    $('#'+div+'Show').toggle();
    $('#'+div+'Edit').hide();

    return false;
}

function setLanguage(lang){
    Set_Cookie('lang',lang,24*3600*365,'/');
    location.reload(true);
}

function setCourse(course){
    Set_Cookie('course', course, 24*3600*365,'/');
    location.reload(true);
}

function Set_Cookie( name, value, expires, path, domain, secure )
{
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );

    /*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
    if ( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}

$(function()
{
	var config = {
                resize_minWidth: 620,
                resize_maxWidth: 620,
                contentsCss: '/css/wysiwyg.css',
                font_names: 'Arial/Arial, Helvetica, sans-serif;' +
                           'Verdana; Georgia',
                filebrowserBrowseUrl: '/ckeditor/filemanager/index.html',
                toolbar:
                    [
                        ['Source','-','Preview'],
                        ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'],
                        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
                        '/',
                        ['Bold','Italic','-','Subscript','Superscript'],
                        ['NumberedList','BulletedList'],
                        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
                        ['Link','Unlink'],
                        ['Image','HorizontalRule','SpecialChar'],
                        '/',
                        ['Format','Font','FontSize'],
                        ['TextColor','BGColor'],
                        ['Maximize', 'ShowBlocks']
                    ]
	};
        if($('.wysiwyg').length > 0) {
            $('.wysiwyg').ckeditor(config);
        }
});

