
 var regexpNoScript = /NoScript/;
 var regexpShowNotStarted = /ShowNotStarted/;
 var regexpShowsOver = /ShowsOver/;
 
 var previousOnAirItemHTML = '';
 var matchPreviousOnAirItem = 0;
 
 
function onair() {

	var VideoFeed = "standard";
	if ($('videoFeed') != null)
	{
		var VideoFeed = $('videoFeed').value;
	}

	if (VideoFeed == "standard")
	{
		var url = "/OnAir/Product.aspx?type=onair&item=onair";
		new Ajax(url, {
				    method: 'get',
				    onComplete: function( response ){
				    	ajaxComplete_OnAirItem(response) 
				    	}
				}).request();
	}
	else if (VideoFeed == "alternate")
	{
		var url = "/OnAir/Product.aspx?type=secondlivefeed&item=onair";
		new Ajax(url, {
				    method: 'get',
				    onComplete: function( response ){
				    	ajaxComplete_OnAirItem(response)
				    	}
			    }).request();
			    
		//Check to see if the script is coming back. If not we redirect to the Error page
				 
		 if($('onairitem').innerHTML.match(regexpNoScript))
		 {		   
		    window.location = "http://www.qvc.com/OnAir/LiveShow.aspx?config=VideoUnavailable";		    
		 }
		 else if($('onairitem').innerHTML.match(regexpShowNotStarted))
		 {		    
		    //They are hear early
		    window.location = "http://www.qvc.com/OnAir/LiveShow.aspx?config=ShowNotStarted"; 
		 }
		 else if($('onairitem').innerHTML.match(regexpShowsOver))
		 {		   
		    window.location = "http://www.qvc.com/OnAir/LiveShow.aspx?config=ShowOver";		    
		 }		 
	}
}

function ajaxComplete_OnAirItem(response)
{
	// if we have an onair item loaded, and the new onair item loaded isn't the same as the
	// one we're currently displaying, and the new onair item isn't the same as the previous
	// one that we had onair (unless it matches four times in a row)...
	
	if( $('onairitemloaded') == null )
	{
		var my_element = new Element( 'div', { 'id':'onairitemloaded', 'style':'display:none' } ).injectAfter( $('onairitem') );
	}
	
	$('onairitemloaded').innerHTML = response;	
	
	// can't compare against 'response' because response includes \r\n, but .innerHTML is just \n.
	if( $('onairitemloaded').innerHTML != $('onairitem').innerHTML )
	{	
		// we received different data than what is currently being displayed
		// does the new data match the previous item?
		if( previousOnAirItemHTML == $('onairitemloaded').innerHTML )
		{
			matchPreviousOnAirItem++;
		}
		else
		{
			previousOnAirItemHTML = $('onairitem').innerHTML;
			matchPreviousOnAirItem = 0;
		}
		if( ( matchPreviousOnAirItem == 0 ) || ( matchPreviousOnAirItem >= 4 ) )
		{
			matchPreviousOnAirItem = 0;
			$('onairitem').innerHTML = $('onairitemloaded').innerHTML;
		}
	}
	else
	{
		matchPreviousOnAirItem = 0;
	}
}

function refresh() {
	var url = "/OnAir/ShowTitleRefresh.aspx";
	var request = new Json.Remote(url, 
		{
			method: 'get',
			onComplete: function(myJSONObject) 
			{
				$('ctl00_cphHead_liveshow_ShowTitle').setHTML(myJSONObject.showTitle);
				$('ctl00_cphHead_liveshow_RemindMe').setAttribute("href",myJSONObject.showHyperlink);
			}
		}).send();
}
	
window.addEvent('load', function()
{
	onair.periodical(5000);
	
	var RefreshShowTitle = null;
	if ($('refreshShowTitle') != null)
	{
		var RefreshShowTitle = $('refreshShowTitle').value;
	}
	
	if ((RefreshShowTitle == null) || (RefreshShowTitle == true))
	{
		refresh.periodical(60000);
	}
}
);

<!-- Begin Monetate tag. Place before end of document body. DO NOT ALTER. -->
var monetateT = new Date().getTime();
(function() {
    var p = document.location.protocol;
    if (p == "http:" || p == "https:") {
        var m = document.createElement('script'); m.type = 'text/javascript'; m.src = (p == "https:" ? "https://s" : "http://") + "b.monetate.net/js/1/a-986a6ec9/p/qvc.com/" + Math.floor(monetateT / 3600000) + "/g";
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(m, s);
    }
})();
<!-- End Monetate tag. -->

