

//used to insert content ads
function getAd(containerID, adID, altText)
{
	var container=document.getElementById(containerID);
	if (container)
	{
		var format="<a href='/Site/Template/Scripts/~Ads/ct.aspx?ID=_ADID_'><img src='/ServerImage/ai.ashx?ID=_ADID_' alt='_ALTTEXT_'></a>";
		format=format.replace(/_ADID_/,adID);
		format=format.replace(/_ADID_/,adID);
		format=format.replace(/_ALTTEXT_/,altText);
		container.innerHTML=format;
	}
}

//image swapping routine
function swapImage(elem, imageSrc)
{
	elem.src=imageSrc;
}

function PopupManager(trackingEnabled)
{
    this.trackingEnabled=trackingEnabled;
}

PopupManager.prototype.trackClick=function(url)
{
    if (this.trackingEnabled && urchinTracker)
    {
        urchinTracker(url);
    }
}

PopupManager.prototype.linkUrl=function(url)
{
    if (this.trackingEnabled && urchinTracker)
    {
        __utmLinker(url);
    }
}

PopupManager.prototype.showPopup=function(url, height, width)
{
    if (height==null)
    {
        height=500;
    }
    if (width==null)
    {
        width=500;
    }
    var options = "height=" + height + ", width=" + width + ", location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no";
    var w=window.open(url, '_blank', options, null);
    return w; 
}

PopupManager.prototype.showUpdateSignup=function()
{
    var w=window.open("https://s.ncta.com/Updates/Forms/CableShow/", "_blank", "height=600, width=475, scrollbars=yes, toolbar=no, titlebar=no, status=no, resizable=no, menubar=no, location=no", null);
    this.trackClick('/Forms/UpdateSingup.aspx');
   return w;
}

PopupManager.prototype.showHotelMap=function()
{
    var w=window.open('/Popups/InteractiveHotelMap.aspx', '_blank', 'height=700, width=850, scrollbars=yes, toolbar=no, status=no, resizable=no, menubar=no, location=no', null);
    return w;
}

PopupManager.prototype.showContactForm=function()
{
    var w=window.open('/Forms/ContactUs.aspx', '_blank', 'height=500, width=500, scrollbars=yes, toolbar=no, status=no, resizable=no, menubar=no, location=no', null);
    return w;
}

PopupManager.prototype.showRegistration=function(pcode)
{
    var regurl='/Register/';
    if (pcode != null)
    {
        regurl = regurl + "?pcode=" + escape(pcode);
    }
    var w=window.open(regurl, '_blank', "height=650, width=750, location=yes, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no", null);
    this.linkUrl('https://www.cteusa.com/ncta2008/');
    return w;
}

PopupManager.prototype.showContent=function(contentId, height, width)
{
    if (contentId!=null)
    {
        var contentUrl='/Popups/ContentPopup.aspx';
        contentUrl+= "?ID=" + contentId;
        if (height==null)
        {
            height=500;
        }
        if (width==null)
        {
            width=500;
        }
        var options = "height=" + height + ", width=" + width + ", location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no";
        var w=window.open(contentUrl, '_blank', options, null);
        return w; 
    }
}

function UrlManager()
{
    this.contentServiceUrlBase='/ContentService/';
    this.serverScriptsUrlBase='/Site/Template/Scripts/';
    this.staticUrlBase='http://static.TheCableShow.com/2008/';
}

UrlManager.prototype.getJSONServiceUrl=function(pageName)
{
    return this.contentServiceUrlBase + 'JSON/' + pageName;    
}

UrlManager.prototype.getStaticUrl=function(pageName)
{
    return this.staticUrlBase + pageName;
}

UrlManager.prototype.getServerScriptsUrl=function(pageName)
{
   return this.serverScriptUrlBase + pageName;
}

var urlManager=new UrlManager();
var popupManager=new PopupManager(true);