var exts = "jpg|jpeg|gif|png|bmp|mp3|mpg|mpeg|avi|rar|zip|7z|gz|txt|avi|mpg";
function StartUpload(f1)
{
    if(f1.file_1.value==""){alert('Select at least one file to upload');return false;};
    if(!checkExt(f1.file_1.value))return false;
    var UID = Math.round(10000*Math.random())+'0'+Math.round(10000*Math.random());
    f1.action = f1.action.split('?')[0]+'?upload_id='+UID;
    if(f1.popup.checked)
    {
      win1 = window.open(f1.action.split('upload.cgi')[0]+'upload_status.cgi?upload_id='+UID,'win1','width=330,height=240,resizable=1');
      win1.window.focus();
    }
    return true;
}

function checkExt(value)
{
    if(value=="")return true;
    var re = new RegExp("^.+\.("+exts+")$","i");
    if(!re.test(value))
    {
        alert("This file extension is not allowed: \n" + value + "\n\nOnly these extensions are allowed: "+exts.replace(/\|/g,',')+" \n\n");
        return false;
    }
    return true;
}
function save_accept(id)
{
window.location = 'save_accept.php?id='+id;
}
function save_order_message(id,message)
{
window.location = 'save_order_message.php?id='+id+'&message='+message;
}
function get_filename(filename)
{
filename = filename.substring(filename.lastIndexOf("/") + 1, filename.length);
return filename;
}
function baby_pic_on()
{
current = 'imgs/img-cloud2.gif';
document.getElementById("babypic").src = current;
} 
function baby_pic_off()
{
current = 'imgs/img-cloud.gif';
document.getElementById("babypic").src = current;
}
function cat_pic(current,which)
{
document.getElementById(which).src = current;
}
function do_login()
{
document.getElementById("login").submit();
}
function do_login2()
{
document.getElementById("log2").submit();
}
function whichkey(e)
{
a = e.keyCode;
if(a == 13)document.getElementById('login').submit();
}
