$j(document).ready(function(){
    $j('#article_img_container').click(function(){
        open_aawindow();
    });

    /*
    $j(this).keyup(function(e) {
        if (e.keyCode == 27) {
            close_aawindow();
        }
    });

    $j('#AAFLVPlayer').keyup(function(e) {
        if (e.keyCode == 27) {
            close_aawindow();
        }
    });
    */
});

function create_aa_lightwindow(id, width, height, title)
{
    var str_window = '';
    str_window += '<div id="BGImageTransparent" class="BGImageTransparent"></div>';
    //str_window += '<div id="AALightWindow_bg" class="AALightWindow_bg"></div>';
    str_window += '<div id="AALightWindow" class="AALightWindow">';
    str_window += '<div class="AALightWindow_container" style="width:'+ width +'px; height:'+ height + 'px;">'; 
    str_window += '<div class="v_p" id="' + id + '">';
    str_window += '</div>';
    str_window += '<div class="AALightWindow_topbar" style="width:'+ width +'px">';
    str_window += '<table border="0" cellpadding="0" cellspacing="0"><tr>';
    str_window += '<td width="66"><div class="AALightWindow_close_button" onclick="close_aawindow();">&nbsp;</div></td>';
    //str_window += '<td width="40"><input type="button" value="إغلاق" onclick="close_aawindow();" /></td>';
    str_window += '<td width="auto"><h3 id="AALightWindow_title" style="direction:rtl;">' + title + '</h3></td>';
    str_window += '</tr></table>';
    str_window += '</div>';
    
    //str_window += '<div class="AALightWindow_controls" style="position:absolute;">';
    //str_window += '<input name="Maximize" type="button" value="ملء الشاشة" onclick="stopVideoPlayer();" />';
    //str_window += '<input name="Close" type="button" value="إغلاق" onclick="close_aawindow();" />';
    str_window += '</div>';
    str_window += '</div>';
    str_window += '</div>';
    
    document.write(str_window);
}

function close_aawindow(){
    close_window_effects();
    stopVideoPlayer();
}


function open_aawindow() {
    open_window_effects();
    playVideoPlayer();
}

function open_window_effects() {
    $j('#AALightWindow').show();
}

function close_window_effects() {
    $j('#AALightWindow').hide();
}
