function openInfoWin(URL) {
    aWindow=window.open(URL,'Large','toolbar=no,width=450,height=280,status=no,scrollbars=yes,resize=no,menubars=no');
    aWindow.focus();
}

var scrstp=0;
function vscroller(ulId, speed) {
    this.container = document.getElementById(ulId);
    this.container.Scroller = this;
    this.speed = speed;
    this.scroll = function() {
        var c = this.container.firstChild;
        var first = null;
        while (c) {
            if (c.tagName == 'LI') {
                first = c;
                break;
            }
            c = c.nextSibling;
        }
        var nodeSize = 78;	// Default
        var px = 0;
        nodeSize = first.clientWidth;
        if (first.style.marginLeft != '') {
            px = parseInt(first.style.marginLeft);
        }
        first.style.marginLeft = ( px - 1 ) + 'px';
        if ( parseInt(first.style.marginLeft) <= -(nodeSize) ) {
            first.style.marginLeft = '0px';
            this.container.removeChild(first);
            this.container.appendChild(first);
        }
        if (scrstp != 1) {
            setTimeout('document.getElementById(\'' + this.container.id + '\').Scroller.scroll()', this.speed);
        }
    }
    setTimeout('document.getElementById(\'' + ulId + '\').Scroller.scroll()', this.speed);
}

function vscrAction(state) {
    if (state == "1") {
        scrstp=1;
    }
    else {
        scrstp=0;
        vscroller('scroller', 50, 'horizontal');
    }
}

function openWin(image,title) {
    aWindow=window.open("img_large.php?img="+image+"&title="+title,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resize=no,menubars=no");
    aWindow.focus();
}

function openBookmark(aURL) {
    aWindow=window.open(aURL,"","toolbar=no,width=400,height=100,status=no,scrollbars=no,resize=no,menubars=no");
    aWindow.focus();
}

function openVideo(aURL) {
    aWindow=window.open(aURL,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resize=no,menubars=no");
    aWindow.focus();
}

function openMatchUs(aURL) {
    aWindow=window.open(aURL,"","toolbar=no,width=400,height=200,status=no,scrollbars=no,resize=no,menubars=no");
    aWindow.focus();
}

function submitFormTA() {
    updateRTE('ta');
    return true;
}

function setImage(string) {
    document.getElementById('previewImage').src = 'File:\/\/' + string;
}

function openRulesWin(image,title) {
    aWindow=window.open("img_large.php?img="+image+"&title="+title,"","toolbar=no,width=400,height=400,status=no,scrollbars=yes,resize=no,menubars=no");
    aWindow.focus();
}

function round(x, multi) {
    var k = (Math.round(x*Math.pow(10,multi))/Math.pow(10,multi)).toString();
    var extend = "";
    for (i=0;i<multi;i++) {
        extend = extend + "0";
    }
    k += (k.indexOf('.') == -1)? '.' + extend : extend;
    return k.substring(0, k.indexOf('.') + 1+multi);
}
