/*
// +----------------------------------------------------------------------+
// | jamroom_javascript.inc.js - Jamroom Misc Javascript functions        |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003-2004 by Brian Johnson                             |
// +----------------------------------------------------------------------+
// | Miscellaneous javascript functions file                              |
// +----------------------------------------------------------------------+
// | Author: Brian Johnson <bigguy@jamroom.net>                           |
// +----------------------------------------------------------------------+
// $Id: jamroom_javascript.inc.js,v 1.1.1.1 2005/10/15 14:41:47 bigguy Exp $
*/

function updateForm(picked) {
    opener.document.form.image_import.value = picked;
    self.close();
    return false;
}

function popwin (mypage,myname,w,h,scroll) {
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
    win = window.open(mypage,myname,settings)
    if (win.opener == null) {
        win.opener = self;
    }
}

function lockFormSubmit (lock) {
    if (document.all || document.getElementById) {
        for ( i=0 ; i < lock.length ; i++ ) {
            var tempobj=lock.elements[i];
            if (tempobj.type.toLowerCase()=="submit" || tempobj.type.toLowerCase()=="reset" || tempobj.type.toLowerCase()=="button") {
                tempobj.disabled=true;
            }
        }
    }
}

function move(index,to) {
    var list = document.form.list;
    var total = list.options.length-1;
    if (index == -1) {
        return false;
    }
    if (to == +1 && index == total) {
        return false;
    }
    if (to == -1 && index == 0) {
        return false;
    }
    var items = new Array;
    var values = new Array;
    for (i = total; i >= 0; i--) {
        items[i] = list.options[i].text;
        values[i] = list.options[i].value;
    }
    for (i = total; i >= 0; i--) {
        if (index == i) {
            list.options[i + to] = new Option(items[i],values[i + to], 0, 1);
            list.options[i] = new Option(items[i + to], values[i]);
            i--;
        }
        else {
            list.options[i] = new Option(items[i], values[i]);
        }
    }
    list.focus();
}

