﻿/* <![CDATA[ */

$(function() {
    $('td.ThreadNameColumn').mouseover(function() {
        $(this).removeClass('ThreadNameColumn');
        $(this).addClass('ThreadNameColumn_Over');
    });
    $('td.ThreadNameColumn').mouseout(function() {
        $(this).removeClass('ThreadNameColumn_Over');
        $(this).addClass('ThreadNameColumn');
    });
    $('td.ForumRow').mouseover(function() {
        $(this).removeClass('ForumRow');
        $(this).addClass('ForumRow_Over');
    });
    $('td.ForumRow').mouseout(function() {
        $(this).removeClass('ForumRow_Over');
        $(this).addClass('ForumRow');
    });
    $('a.nobubble').each(function() {
        $(this).click(function(e) {
            e.stopPropagation();
        });
    });
});

/* Default Page */
function showhelp() {
    var myspan = document.getElementById('spanHelp');
    myspan.innerHTML = 'New posts will display orange icons next to them. After reading all new posts, reset the number of new thread posts by clicking the \'Mark All Forums as Read\' button below.'
}
var gotourl;
gotourl = '';
// This script is used to cancel out nested onclick events
function loadurl(source, url) {
    //alert(source);
//        if (source == 'a') {
//            gotourl = url;
//            window.location.href = gotourl;
//            return false;
//        }
//        if (source == 'td' && gotourl == '') {
        window.location.href = url;
//            return false;
//        }
    return false;
}

/* Thread Page */
function loadquote(quoterownum, myspan) {
    $.ajax({
        type: "POST", contentType: "application/json; charset=utf-8", dataType: "json",
        url: "/code/ScriptService/MessageBoard.asmx/LoadQuote",
        data: "{'QuoteRownum':" + quoterownum + ",'MySpan':'" + myspan + "'}",
        success: function(msg) {
            if (msg.d.ErrorMessage != '') {
                alert('ERROR ' + msg.d.ErrorMessage);
            }
            else {
                var myspan = $get(msg.d.MySpan);
                myspan.innerHTML = msg.d.Message;
            }
        },
        error: function(xhr, ajaxOptions, thrownError) {
            alert('ERROR ' + xhr.statusText + ' ' + thrownError);
        }
    });
}

function uploadmix() {
    window.open('/Members/Modules/Music/UploadMusic.aspx','UploadMusic','top=50,left=50,width=600,height=500,scrollbars=auto');
}

function deleteview(threadid) {
    $.ajax({
        type: "POST", contentType: "application/json; charset=utf-8", dataType: "json",
        url: "/code/ScriptService/MessageBoard.asmx/DeleteView",
        data: "{'ThreadID':" + threadid + "}",
        success: function(msg) {
            //$('div.maincontent').html(msg.d.HTML);
            if (msg.d != '') {
                alert('ERROR ' + msg.d);
            }
            else {
                $('div.CLBoxL' + threadid).html('').hide();
                $('div.OuterBox' + threadid).css('float', 'none').css('margin-right', '0').html('<div class="NEW">NEW</div>');
                //$('div.OuterBox' + threadid).fadeOut(500);
                //$('div.CLBoxL' + threadid).fadeOut(500);
            }
        },
        error: function(xhr, ajaxOptions, thrownError) {
            alert('ERROR ' + xhr.statusText + ' ' + thrownError);
        }
    });
}
    
/* ]]> */