﻿function selectAll(listboxCtl, SelVal) {
    var numItems = 0;
    var indexCount;
    var SelStr = 'SELECTED';
    if (SelVal == 0) {
        SelStr = '';
    }

    numItems = listboxCtl.length;
    for (indexCount = numItems - 1; indexCount >= 0; indexCount--) {
        listboxCtl.options[indexCount].selected = SelStr;
    }
}
function chooseVidRel(newDate) {
    document.Form2.txtVideoRelDate.value = newDate;
    document.Form2.submit();
}
function popupwindow(fileloc, winname, winwidth, winheight) {
    windowbits = "width=" + winwidth + "px,height=" + winheight + "px,left=100px,top=100px,center=yes,border=thin;help=no;status=no;locationbar=no,statusbar=no,location=no,menubar=no,toolbar=no";
    document.open(fileloc, winname, windowbits, false);
}

function popupwindow2(fileloc, winname, winwidth, winheight) {
    windowbits = "width=" + winwidth + "px,height=" + winheight + "px,left=100px,top=100px,center=yes,scrollbars=yes,border=thin;help=no;status=no;locationbar=no,statusbar=no,location=no,menubar=no,toolbar=no";
    document.open(fileloc, winname, windowbits, false);
}
//			"toolbars=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes" 
function popupwindow3(fileloc, winname, winwidth, winheight) {
    windowbits = "width=" + winwidth + "px,height=" + winheight + "px,left=100px,resizable=yes,top=100px,center=yes,border=thin;scrollbars=yes;help=no;status=no;locationbar=no,statusbar=no,location=no,menubar=no,toolbar=no";
    document.open(fileloc, winname, windowbits, false);
}

function ldLetter(Letter) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
        theform = document.VideoList;
    }
    else {
        theform = document.forms["VideoList"];
    }
    theform.sMode.value = "Letter";
    theform.sLetter.value = Letter;
    theform.submit();
}    
function chooseLetter(Letter) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
        theform = document.VideoList;
    }
    else {
        theform = document.forms["VideoList"];
    }
    theform.iYearQS.value = "0";
    theform.iMonthQS.value = "0";
    theform.sMode.value = "Letter";
    theform.sLetter.value = Letter;
    theform.submit();
}
function chooseMonth(iYear, iMonth) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
        theform = document.VideoList;
    }
    else {
        theform = document.forms["VideoList"];
    }
    theform.iYearQS.value = iYear;
    theform.iMonthQS.value = iMonth;
    theform.sMode.value = "Calendar";
    theform.sLetter.value = "";
    theform.submit();
}
function DoSearch(which) {
    if (which == 'RT') {
        document.main.method = 'get';
        document.main.target = '_blank';
        document.main.action = 'http://www.rottentomatoes.com/search/full_search.php';
        document.main.submit();
    }
    if (which == 'IMDB') {
        document.main.method = 'post';
        document.main.target = '_blank';
        document.main.action = 'http://www.imdb.com/Find';
        document.main.submit();
    }
    return;
}
function SearchIMDB(varCtl) {
    var sQuery = varCtl.value;
    varCtl.value = '';
    var strSearch = 'http://www.imdb.com/find?s=all&q=';
    var intIndexOfMatch = sQuery.indexOf(' ');
    // Loop over the string value replacing each space
    while (intIndexOfMatch != -1) {
        // Relace out the current instance.
        sQuery = sQuery.replace(' ', '+')
        // Get the index of any next matching substring.
        intIndexOfMatch = sQuery.indexOf(' ');
    }
    document.main.method = 'post';
    document.main.target = '_blank';
    document.main.action = strSearch + sQuery;
    document.main.submit();
    return;
}

function Left(str, n) {
    if (n <= 0)
        return "";
    else if (n > String(str).length)
        return str;
    else
        return String(str).substring(0, n);
}
function Right(str, n) {
    if (n <= 0)
        return "";
    else if (n > String(str).length)
        return str;
    else {
        var iLen = String(str).length;
        return String(str).substring(iLen, iLen - n);
    }
}


