﻿
// Replace text in forum posts
function ForumsReplaceText() {
    $("td.message").each(function(i) {
        // Replace :hr;  with HR HTML for signatures
        var newHTML = $(this).html().replace(":hr;:hr;", ":hr;")
        newHTML = newHTML.replace(":hr; :hr;", ":hr;")
        newHTML = newHTML.replace(":hr;", "<hr />")
        //update content with replaced text
        $(this).html(newHTML);
    })
}

/* LOAD ADJUGGLER INTO PAGE
* <param>adspot</param> String - Fancy number from nate
* <param>dim</param> String - Fancy number from nate
* <param>index</param> Integer - Index of ad on the page. We use this so that identical adspot-dim images don't appear on the page.
* <param>selector</param>jQuery Object - Recipient DOM Element of the AdJugger HTML Code
* <param>width</param> (Optional) Integer - Pixel width of image
* <param>height</param> (Optional) Integer - Pixel height of image
*/
function loadAd(adspot, dim, index, selector, width, height) {
    if (typeof width == "undefined") {
        optional = "728";
    }
    if (typeof height == "undefined") {
        optional = "90";
    }
    
    var protocol = (("https:" == document.location.protocol) ? "https://" : "http://");
    var date = new Date();
    var html = "<a href=\"" + protocol + "rotator.adjuggler.com/servlet/ajrotator/" + adspot + "/0/cc?z=victory&pos=" + index + "\">";
    html += "<img src=\"" + protocol + "rotator.adjuggler.com/servlet/ajrotator/" + adspot + "/0/vc?z=victory&dim=" + dim + "&kw=&pos=" + index + "&click=&cachetime=" + date.getTime() + "\" width=\"" + width + "\" height=\"" + height + "\" border=\"0\">";
    html == "</a>";
    selector.html(selector.html() + html);
}

$(document).ready(function() {

    loadAd("555343", "510360", 0, $(".ad_LeaderBoard"));
    loadAd("555350", "510353", 1, $(".ad_IslandAd"));

});


