function wait(msecs)
{
    var start = new Date().getTime();
    var cur = start;
    while(cur - start < msecs)
    {
        cur = new Date().getTime();
    } 
}

function img_setthumbnail(imageuid)
{
    refresh_post('db/db_processimage.php?operation=setthumbnail&imageuid='+imageuid,'','img_opresult');
    wait(500);
    refresh_post('lib_php/ad_images.php','','img_editplace');
}

function img_delete(imageuid) 
{
    refresh_post('db/db_processimage.php?operation=delete&imageuid='+imageuid,'','img_opresult');
    wait(500);
    refresh_post('lib_php/ad_images.php','','img_editplace');
    
}
function wait_e(msecs)
{
    var start = new Date().getTime();
    var cur = start;
    while(cur - start < msecs)
    {
        cur = new Date().getTime();
    } 
}
function img_setthumbnail_e(imageuid)
{
    refresh_post('db/db_processimage.php?operation=setthumbnail&imageuid='+imageuid,'','img_opresult');
    wait_e(500);
    refresh_post('lib_php/edit_images.php','','img_editplace');
}

function img_delete_e(imageuid) 
{
    refresh_post('db/db_processimage.php?operation=delete&imageuid='+imageuid,'','img_opresult');
    wait_e(500);
    refresh_post('lib_php/edit_images.php','','img_editplace');
}


function cb_to_hidden(cb_id,hid_id,value)
{
    var hid_el = $(hid_id);
    var cb_el = $(cb_id);
    var replaceable = hid_el.value;
    
    if (cb_el.checked)
    {
        hid_el.value = hid_el.value + '#' + value;
    }
    else
    {
        hid_el.value = replaceable.replace ('#' + value,'');
    }
    // alert(hid_id + ' : ' + hid_el.value);
}


function test_httpreq()
{
     alert ("try");
}

function copy_div2div(source,destination)
{
    _source = $(source);
    _dest = $(destination);
    _dest.innerHTML = _source.innerHTML;
}



function surfout()
{
    getout = confirm("You are about to leave ACTIV24 web page.\nPlease Confirm !");

    if (getout == true)
    {
        history.back();           
    }
    else
    {
       if (navigator.appName == 'Netscape') 
       {
               window.location = window.location;  
       }else{
            location.href = location.href;
       }
    }
}




