function $qsa(selector) {
    return content.document.querySelectorAll(selector);
}

function awo_open_popup(opac) {                                                                      
    $.blockUI({
        message: $('#awo_main'),
        fadeIn: 200,
        fadeOut: 200,
        css: {
            border: 'none',     
            background: 'none',     
            top: ( $(window).height() - $('#awo_main').height() ) / 2 + "px", 
            left: ( $(window).width() - $('#awo_main').width() ) / 2+$(window).scrollLeft() + "px", 
            padding: '0px',
            opacity: .99,
            cursor: null,
            color: '#fff'
        }, 
        overlayCSS:  { 
            backgroundColor: '#000', 
            opacity: opac, 
            cursor: 'default'
        } 
    });
    
    if ($('#awo_product_image').width()  > 240 ) $('#awo_product_image').width(  240 );
    if ($('#awo_product_image').height() > 240 ) $('#awo_product_image').height( 240 );
    
    if (awo_absolute == 1) {
        $('#awo_close').css('display', 'block');
        $('#awo_close').css('z-index', '9999');
        $('#awo_close').css('position', 'absolute');
        $('#awo_close').css('top', ( $(window).height() - $('#awo_main').height() ) / 2 - 20 + "px");
                           
        $('#awo_close').css('left', ( $(window).width() - $('#awo_main').width() ) / 2 + $(window).scrollLeft() + $('#awo_main').width() - 10 + "px");
        
        
    }

}

function awo_close_popup() {
    awo_set_cookie('awo_hidden', 'hide', awo_hide_time);
    $.unblockUI();
    if (awo_absolute == 1) {
        $('#awo_close').css('display', 'none');
    }
}

function awo_responder_submit() {
    $('#awo_responder_form').submit();                      
}


function awo_set_cookie(name,value,thetime) {
    if (thetime) {
        var date = new Date();
        date.setTime(date.getTime()+thetime);
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function awo_get_cookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function awo_delete_cookie(name) {
    awo_set_cookie(name,"",-1);
}




