// $Date: 2007/03/12 21:08:11 $
// $Name: ukconcept_v1_r56 $
// $Revision: 1.9 $
// $State: Exp $


var pageLoaded = false;
var ajaxLoaded = false;


function tvgPageLoadedCallback() {
  pageLoaded = true;
}

function tvgAjaxCallback() {
  ajaxLoaded = true;
  resizeTimeBar(); /* Will only exist in small comp */
}

function tvgAjaxPreback() {
  
  var pickElem = document.getElementById('tvgChannelPopUp');
  
  if (pickElem != null) {
    var parent = pickElem.parentNode;
    parent.removeChild(pickElem);
  }
}

function getTvgQueryVariable(variable) {

    if (tvg_qs != undefined && tvg_qs != "-")
        var query = tvg_qs;
    else
        var query = window.location.search;
        
    var vars = query.substring(1).split("&");
    
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        
        if (pair[0] == variable)
            return pair[1];
    }
    return null;
} 


function resizeTimeBar() {

    var timeBar = getElementsByClassName('tvg_listings_timing_bar', document.body, 'div')[0];
    
    if (timeBar.offsetHeight < 260) { /*If IE has screwed up the timebar height */
        var size = getElementsByClassName('tvg_listings_epg_grid', document.body, 'div')[0].offsetHeight + 40; 
        timeBar.style.height = size + 'px';
    }
    
}

function setCustomOmnitureValues(){
	if ((document.location.href.indexOf('tvgSearchPhrase')>-1))
	{
		var tvgSearchPhrase = document.location.href.split('tvgSearchPhrase=');
		tvgSearchPhrase=tvgSearchPhrase[1].split('&');
		s.prop18=tvgSearchPhrase[0];
	} else if (document.location.href.indexOf('clip-search')>-1)
	{
		var tvgSearchPhrase = document.location.href.split('tvgSearchPhrase=');
		tvgSearchPhrase=tvgSearchPhrase[1].split('&');
		s.prop18=tvgSearchPhrase[0];
	}

}
