
function sizeAd(source,target) {
    try {
    	sdiv = jQuery("#" + source);
    	tdiv = jQuery("#" + target);

    	w = 0; w = sdiv.width();
    	h = 0; h = sdiv.height();
       
	    tdiv.css("width", w + "px");
	    tdiv.css("height", h + "px");
    } catch (e) {}
}

function placeAd(source,target) {
	try {
		sdiv = jQuery("#" + source);
        tdiv = jQuery("#" + target);
        x = getX(tdiv);
        y = getY(tdiv);
        sdiv.css("left", x + "px");
        sdiv.css("top", y + "px");
        sdiv.css("visibility", "visible");
    } catch (e) { }
}

function getX(oElement) {
	var iReturnValue = 0;
	try {
		if (oElement.length > 0) {
			var offset = oElement.offset();
			iReturnValue += offset.left;
			oElement = oElement.offsetParent();
		}
	} catch (e) {}
	return iReturnValue;
}

function getY(oElement) {
	var iReturnValue = 0;
	try	{
	    if (oElement.length > 0)	{
	    	var offset = oElement.offset();
		    iReturnValue += offset.top;
		    oElement = oElement.offsetParent();		    
	    }
	} catch (e) { }
	return iReturnValue;
}

wxOAS_query1 = '?RM_Exclude=Airlines,Alcohol,Automobiles,Banking,BizDev,Careers';
wxOAS_query1 = wxOAS_query1 + wxOAS_targetparams;
wxOAS_query = 'RM_Exclude=Airlines,Alcohol,Automobiles,Banking,BizDev,Careers';
wxOAS_query = 'dummy=1' + wxOAS_targetparams + wxOAS_creativeparams + '&' + wxOAS_query;
wxOAS_target = '_blank';
wxOAS_version = 10;
wxOAS_rn = '001234567890'; 
wxOAS_rns = '1234567890';
wxOAS_rn = new String(Math.random()); wxOAS_rns = wxOAS_rn.substring(2, 11);

function wxOAS_NORMAL(pos) {

    if (wxOAS_isnewOAS == "1") {

        switch (pos) {
            case "cds1":
                pos = "x12";
                break;
            case "cds2":
                pos = "x13";
                break;
            case "cds3":
                pos = "x14";
                break;
            case "cds4":
                pos = "x15";
                break;
            case "cds5":
                pos = "cds5";
                break;
            case "cds6":
                pos = "cds6";
                break;
            case "cds9":
                pos = "x03";
                break;
            case "cdsspons1":
                pos = "x59";
                break;
            case "ssn1":
                pos = "x19";
                break;
            case "ssn2":
                pos = "Left";
                break;
            case "cds12":
                pos = "x24";
                break;
        }

    }

	try {

	    //alert('Pos: ' + wxOAS_listpos);
		document.write('<A HREF="' + wxOAS_url + 'click_nx.ads/' + wxOAS_sitepage + '/1' + wxOAS_rns + '@' + wxOAS_listpos + '!' + pos + '?' + wxOAS_query + '" TARGET=' + wxOAS_target + '>');
		document.write('<IMG SRC="' + wxOAS_url + 'adstream_nx.ads/' + wxOAS_sitepage + '/1' + wxOAS_rns + '@' + wxOAS_listpos + '!' + pos + '?' + wxOAS_query + '" BORDER=0></A>');
	}
    catch (e) {
        //alert(e.Message);
    }
}
//2
wxOAS_version = 11;
try
{
	if ((navigator.userAgent.indexOf('Mozilla/3') != -1) || (navigator.userAgent.indexOf('Mozilla/4.0 WebTV') != -1)) wxOAS_version = 10;
}
catch (e) {}
if (wxOAS_version >= 11)
{
	try 
	{
		document.write('<SCR' + 'IPT LANGUAGE=JavaScript1.1 SRC="' + wxOAS_url + 'adstream_mjx.ads/' + wxOAS_sitepage + '/1' + wxOAS_rns + '@' + wxOAS_listpos + '?' + wxOAS_query + '"><\/SCRIPT>');
	}
	catch (e) 
	{
		wxOAS_version = 10;
	}
}
//3
document.write('');




function wxOAS_AD(pos) {

    try {

        if (wxOAS_isnewOAS == "1") {

            switch (pos) {
                case "cds1":
                    pos = "x12";
                    break;
                case "cds2":
                    pos = "x13";
                    break;
                case "cds3":
                    pos = "x14";
                    break;
                case "cds4":
                    pos = "x15";
                    break;
                case "cds5":
                    pos = "cds5";
                    break;
                case "cds6":
                    pos = "cds6";
                    break;
                case "cds9":
                    pos = "x03";
                    break;
                case "cdsspons1":
                    pos = "x59";
                    break;
                case "ssn1":
                    pos = "x19";
                    break;
                case "ssn2":
                    pos = "Left";
                    break;
                case "cds12":
                    pos = "x24";
                    break;
            }

        }


        
		if (wxOAS_version >= 11)
		{
			if (window.OAS_url)
			{
				wxOAS_NORMAL(pos);
			}
			else
			{
				OAS_RICH(pos);
			}
		}
		else
		{
			wxOAS_NORMAL(pos);
		}
	}
	catch (e) 
	{
		wxOAS_NORMAL(pos);
	}
}
var lightBoxAdIsOpen = false;
var wXcdsPOS = false;
var lightBoxAdUnit = false;
var adUnitOriginalParent = false;
var newLightBoxAdUnit = false;

function querySt(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) return ft[1];
    }
}

function openLightBoxAd(POS, STYLE, ADWIDTH, ADHEIGHT, ADCAPTION, ADCLOSETEXT) {
	if (!POS) POS = 3;
	if (!STYLE) {
		var style = false;
		style = querySt("style");
		if (style && style.length > 0) STYLE = style;
		else STYLE = "tblue";
	}
	//STYLE = "bluestripes";

	wXcdsPOS = jQuery("#wXcds" + POS);

	if (POS == 3) {
		ADWIDTH = wXcdsPOS.width();
		ADHEIGHT = wXcdsPOS.height();
    }

    if (!ADWIDTH || !ADHEIGHT) {
        if (!ADWIDTH) ADWIDTH = jQuery("#OAS_RMF_x14_LAYER").width();
        if (!ADHEIGHT) ADHEIGHT = jQuery("#OAS_RMF_x14_LAYER").height();

        if (ADHEIGHT && ADWIDTH) {
            wXcdsPOS = jQuery("#OAS_RMF_x14_LAYER");
        }
    }


	if (!ADWIDTH) ADWIDTH = 640;
	if (!ADHEIGHT) ADHEIGHT = 480;
	if (!ADCAPTION) ADCAPTION = "Advertisement";
	if (!ADCLOSETEXT) ADCLOSETEXT = "Skip Intro";
	try {
		if (!lightBoxAdIsOpen) {
			if (jQuery("#lightboxOverlay").length == 0) {
				var lightBoxHTML = '';
				lightBoxHTML += '<div id="lightboxOverlay" class="' + STYLE + '">';
				lightBoxHTML += '<div id="lightboxHeaderWrap">';
				lightBoxHTML += '<div id="lightboxHeader"></div>';
				lightBoxHTML += '</div>';
				lightBoxHTML += '<div id="lightboxContentsWrap">';
				lightBoxHTML += '<div id="lightboxClose">';
				lightBoxHTML += '<a href="#" onclick="closeLightBoxAd(); return(false);">' + ADCLOSETEXT + '</a>';
				lightBoxHTML += '</div>';
				lightBoxHTML += '<div id="lightboxContents" style="width:' + ADWIDTH + 'px; height:' + ADHEIGHT + 'px;"></div>';
				lightBoxHTML += '<div id="lightboxCaption">' + ADCAPTION + '</div>'
				lightBoxHTML += '</div>';
				lightBoxHTML += '</div>'
				jQuery("body").append(lightBoxHTML);
			}
			wXcdsPOS.css("position", "static");
			adUnitOriginalParent = wXcdsPOS.parent();

			if (wXcdsPOS.length == 0) return (false); // ad position has no contents, exit
			if ((wXcdsPOS.width() <= 1) && (wXcdsPOS.height() <= 1)) {
				// ad unit has no height/width - look through it's child elements
				// for the likely ad content container
				wXcdsPOS.children().each(function () {
					var thisChild = jQuery(this);
					if (thisChild.css("visibility") == "visible") {
						// if it's visible and has an ID, it's probably the ad content
						if (jQuery(this).attr("id").length > 0) {
							lightBoxAdUnit = thisChild;
							lightBoxAdUnit.css("position", "static");
						}
					}
				});
			} 
			// center the ad container within the browser viewport
			var lightBoxContentsWrap = jQuery("#lightboxContentsWrap");
			lightBoxContentsWrap.css("top", jQuery(window).height() / 2 - lightBoxContentsWrap.outerHeight() / 2);
			lightBoxContentsWrap.css("left", jQuery(window).width() / 2 - lightBoxContentsWrap.outerWidth() / 2);
			lightBoxContentsWrap.css("z-index", 99999999);

			newLightBoxAdUnit = wXcdsPOS.clone(true); // copy ad unit
			var newLightBoxAdUnitHTML = wXcdsPOS.html();
			
			wXcdsPOS.remove(); // remove original ad unit
			newLightBoxAdUnit.css("width", ADWIDTH + "px"); // set width 
			newLightBoxAdUnit.css("height", ADHEIGHT + "px"); // and height

			// seems like a jQuery bug with appending elements containing EMBED/OBJECT code...
			// see the last post in this forum topic: http://forum.jquery.com/topic/appendto-behaviour
			// instead of appending the ad object, we'll update the lightbox contents
			// the  "old fashioned" way
			document.getElementById("lightboxContents").innerHTML = newLightBoxAdUnitHTML;

			if (jQuery("#ie6root").length > 0) {
				jQuery("body").css("height", "100%");
				jQuery("#lightboxOverlay").css("position", "absolute");
				// IE6 needs style tweaks
			}
			lightBoxAdIsOpen = true;
			//if (document.domain.search(/weatherbug\.com/) == -1) {
				//closeLightBoxAd(POS);
				//eval("OAS_RMF_cds" + POS + "_autoCloser()");
			//}
			return (false);
		}
	} catch (e) { }
}

function closeLightBoxAd(POS) {
	if (!POS) POS = 3;
	try {
		if (lightBoxAdIsOpen) {
			newLightBoxAdUnit.remove(); // remove copy of ad
			adUnitOriginalParent.append(lightBoxAdUnit); // put original ad back in place
			try {
				placeAds();
			} catch (e) { } // place the ads in their original spots
			jQuery("#lightboxOverlay").hide();
			lightBoxAdIsOpen = false;
			if (jQuery("#ie6root").length > 0) {
				jQuery("body").css("height", "");
				jQuery("#lightboxOverlay").css("position", "");
			}

		}
	} catch (e) { }
}

function getHttpObj() {
    var httpObj = null;
    try {
        httpObj = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (error) {
        try {
            httpObj = new XMLHttpRequest();
        }
        catch (error) {
            httpObj = null;
        }
    }
    return httpObj;
}


// Modal Dialog Box
// copyright 8th July 2006 by Stephen Chapman
// http://javascript.about.com/
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
function pageWidth() { return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; } function pageHeight() { return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null; } function posLeft() { return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0; } function posTop() { return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0; } function scrollFix() { var obol = document.getElementById('ol'); obol.style.top = posTop() + 'px'; obol.style.left = posLeft() + 'px' } function sizeFix() { var obol = document.getElementById('ol'); obol.style.height = pageHeight() + 'px'; obol.style.width = pageWidth() + 'px'; placeAds(); } function kp(e) { ky = e ? e.which : event.keyCode; if (ky == 88 || ky == 120) hm(); return false } function inf(h) { tag = document.getElementsByTagName('select'); for (i = tag.length - 1; i >= 0; i--) tag[i].style.visibility = h; tag = document.getElementsByTagName('iframe'); for (i = tag.length - 1; i >= 0; i--) tag[i].style.visibility = h; tag = document.getElementsByTagName('object'); for (i = tag.length - 1; i >= 0; i--) tag[i].style.visibility = h; } function sm(obl, wd, ht) { var h = 'hidden'; var b = 'block'; var p = 'px'; var obol = document.getElementById('ol'); var obbxd = document.getElementById('mbd'); obbxd.innerHTML = document.getElementById(obl).innerHTML; obol.style.height = pageHeight() + p; obol.style.width = pageWidth() + p; obol.style.top = posTop() + p; obol.style.left = posLeft() + p; obol.style.display = b; var tp = posTop() + ((pageHeight() - ht) / 2) - 12; var lt = posLeft() + ((pageWidth() - wd) / 2) - 12; var obbx = document.getElementById('mbox'); obbx.style.top = (tp < 0 ? 0 : tp) + p; obbx.style.left = (lt < 0 ? 0 : lt) + p; obbx.style.width = wd + p; obbx.style.height = ht + p; inf(h); obbx.style.display = b; return false; } function hm() { var v = 'visible'; var n = 'none'; document.getElementById('ol').style.display = n; document.getElementById('mbox').style.display = n; inf(v); document.onkeypress = '' } function initmb() {
    var ab = 'absolute'; var n = 'none'; var obody = document.getElementsByTagName('body')[0]; var frag = document.createDocumentFragment(); var obol = document.createElement('div'); obol.setAttribute('id', 'ol'); obol.style.display = n; obol.style.position = ab; obol.style.top = 0; obol.style.left = 0; obol.style.zIndex = 998; obol.style.width = '100%'; frag.appendChild(obol); var obbx = document.createElement('div'); obbx.setAttribute('id', 'mbox'); obbx.style.display = n; obbx.style.position = ab; obbx.style.zIndex = 999; var obl = document.createElement('span'); obbx.appendChild(obl); var obbxd = document.createElement('div'); obbxd.setAttribute('id', 'mbd'); obl.appendChild(obbxd); frag.insertBefore(obbx, obol.nextSibling); obody.insertBefore(frag, obody.firstChild);
    window.onscroll = scrollFix; window.onresize = sizeFix;
}

window.onload = initmb;

function showFeedback(pos) {
    //try {
        document.getElementById("adHtmlSrc").value = document.getElementById(pos).innerHTML;
        sm('box', 200, 300);
        //eval(pos + "antiSpam()");
    //}
    //catch (e) { hideFeedback(); }
    return false;
}

function hideFeedback(POS) {
	hm('box');
	try {
		//eval(POS + "stopAntiSpam()");
	} catch (e) { }
}

function submitAdFeedback() {
    try {

        var adLike, emailAddress, adFeedbackComment;
        adLike = jQuery("input[@name='adLike']:checked").val();
        emailAddress = jQuery("input[@name='adFeedbackEmailAdd']").val();
        adFeedbackComment = document.getElementById("adFeedbackComment").value;
        if ((adLike === undefined) || (adLike.length == 0)) {
            alert("Error: Please let us know whether you like or dislike this ad");
            return (false);
        }
        var cgi; var url;
        var httpReq = getHttpObj();
        var response = null;
        url = adFeedbackUrl;
        cgi = "adFeedbackEmailAdd=" + document.getElementById("adFeedbackEmailAdd").value;
        cgi += "&adFeedbackComment=" + adFeedbackComment;
        cgi += "&adDivPos=" + document.getElementById("adDivPos").value;
        cgi += "&adLike=" + adLike;
        cgi += "&adHtmlSrc=" + escape(escape(document.getElementById("adHtmlSrc").value));
        cgi += "&antiSpam=" + document.getElementById(document.getElementById("adDivPos").value + "-antiSpam").value;
        if (null != httpReq) {
            httpReq.open("POST", url, false);
            httpReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            httpReq.setRequestHeader("Content-length", cgi.length);
            httpReq.setRequestHeader("Connection", "close");
            httpReq.onreadystatechange = function() {//Call a function when the state changes.
                if (httpReq.readyState == 4 && httpReq.status == 200) {
                	submitComplete(document.getElementById("adDivPos").value);
                }
            }
            httpReq.send(cgi);
        }
    } catch (e) { hideFeedback(document.getElementById("adDivPos").value); }
}

function submitComplete(POS) {
    alert("Thank you for your feedback!");
    hideFeedback(POS);
}

