// -----------------------------
// Add a new image for roll over
// Args:
//  - prefix  : the prefix of key in roll_img array
//  - path_off: the path to roll 'off' image
//  - path_on: the path to roll 'on' image
function new_roll(prefix,path_off,path_on) {
    if(prefix && path_off && path_on) {
        roll_img[prefix+'_off'] = new Image(0,0);
        roll_img[prefix+'_off'].src = path_off;
        roll_img[prefix+'_on']  = new Image(0,0);
        roll_img[prefix+'_on'].src  = path_on;
    }
    return;
}
// -----------------------------
// Do roll
// Args:
//  - img_name : the prefix of the key of roll_img
//  - dest_name: the name of destination image
//  - type     : 'on' or 'off'
function do_roll (img_name, dest_name, type) {
    if((type != 'off') && (type != "on")) {
        type = 'off';
    }

    if(img_name && dest_name && document.images[dest_name]) {
        document.images[dest_name].src = roll_img[img_name +"_"+ type].src;
    }

    return;
}

function pop_img(pic,width,height,title) {
    var win = window.open('','pop_img_win','scrollbars=0,width='+width+',height='+height+','+
        'menubar=0,resizable=0,titlebar=0,toolbar=0,status=0');
    win.document.write('<html>\n'+
        '<head>'+
        '<title>TesMed::'+title+'</title>'+
        '<style type="text/css">\n'+
        '<!--\n'+
        'body {\n'+
        '\tmargin:0px 0px 0px 0px;\n'+
        '}\n'+
        '-->\n'+
        '</style>\n'+
        '</head>\n'+
        '<body>'+
        '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">'+
        '<tr>'+
        '<td align="center" valign="middle">'+
        '<img align="center" src="../static/img/'+pic+'" border="0">'+
        '</td>'+
        '</tr>'+
        '</table>'+
        '</body>\n'+
        '</html>');
}

function pop_page(name,url,width,height) {
    if(name && url && width && height) {
        window.open(url,name,'height='+height+',width='+width+',menubar=0,resizable=0,'+
                     'scrollbars=0,status=0,titlebar=0,toolbar=0');
    }
}


