var IFrameObj; 
function callToServer(URL) {
/*  if (!document.createElement) {return true};
  var IFrameDoc;
  if (!IFrameObj && document.createElement) {

    var tempIFrame=document.createElement('iframe');
    tempIFrame.setAttribute('id','RSIFrame');
    tempIFrame.style.border='0px';
    tempIFrame.style.width='0px';
    tempIFrame.style.height='0px';
    IFrameObj = document.body.appendChild(tempIFrame);

    if (document.frames) {

	      IFrameObj = document.frames['RSIFrame'];
    }
  }
*/
  if (!IFrameObj && document.createElement) {
   try {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.style.border='0px';
      tempIFrame.style.width='0px';
      tempIFrame.style.height='0px';
      IFrameObj = document.body.appendChild(tempIFrame);

      if (document.frames) {
        IFrameObj = document.frames['RSIFrame'];
      }
    } catch(exception) {
      iframeHTML='\<iframe id="RSIFrame" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:0px;';
      iframeHTML+='height:0px;';
      iframeHTML+='"><\/iframe>';
      document.body.innerHTML+=iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe =
document.getElementById('RSIFrame');
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
    }
  }


  if (navigator.userAgent.indexOf('Gecko') !=-1
    && !IFrameObj.contentDocument) {

    setTimeout('callToServer()',10);
    return false;
  }

  if (IFrameObj.contentDocument) {

    IFrameDoc = IFrameObj.contentDocument;
  } else if (IFrameObj.contentWindow) {

    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {

    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
  IFrameDoc.location.replace(URL);

  return false;
}

function handleResponseShows(doc) {
if (document.getElementById('showTickerContainer')){
	document.getElementById('showTickerContainer').innerHTML = doc.getElementById('showTickerContainer').innerHTML;
}
}	


function handleResponseShowsHome(doc) {



if(test = document.getElementById("promo")){
document.getElementById('promo').innerHTML = doc.getElementById('promo').innerHTML;

}
	for (i=0; i<3; i++){
var tempId = 'show' + (i+1);
document.getElementById(tempId).innerHTML = doc.getElementById(tempId).innerHTML;
}
document.getElementById("tonightMain").innerHTML = doc.getElementById("tonightMain").innerHTML;
document.getElementById("whatsOnTable").innerHTML = doc.getElementById("whatsOnTable").innerHTML;
}

function handleResponse(doc) {
	/* what's on */

	
	document.getElementById("onTonightCustomize").elements["city"].value = myCity;
	
	document.getElementById('whatsOn').innerHTML = doc.getElementById('whatsOn').innerHTML;
	document.getElementById('whatsOnMain').innerHTML = doc.getElementById('whatsOnMain').innerHMTL;

	/* spotlight */

	document.getElementById("onTonightLocation").innerHTML = myCity + " ";	
	for (i=0; i<7; i++){
	document.getElementById("emptycomingUpGroup" + i).innerHTML = doc.getElementById("spotlight" + i).innerHTML
	
	/* weather */
	document.getElementById("weatherDiv").innerHTML = doc.getElementById("weatherNew").innerHTML;
	
	}
	
	showArea = "emptycomingUpGroup";
	showSpotlight(1,1);

}

function switchMiniArchiveDate(date,archive){
if (document.getElementById("mainTableLeft")){
  callToServer("/mini/"+archive+"/dailyArchive/dailyArchive"+date+".html");
}
}
function switchMiniV2ArchiveDate(date,archive){
if (document.getElementById("mainTableLeft")){
  callToServer("/mini_v2/"+archive+"/dailyArchive/dailyArchive"+date+".html");
}
}
function handleResponseDailyArchive(doc) {

if(document.getElementById("mainTableLeft")){
  document.getElementById('mainTableLeft').innerHTML = doc.getElementById('mainTableLeft').innerHTML;

}
}

