var timeout;

function getScrollTop() {
if ( document.documentElement.scrollTop ) return document.documentElement.scrollTop;

return document.body.scrollTop;
}

function scrollHandler() {
var e = document.getElementById('rc_notify');
e.style.top = getScrollTop();
}

function showNotify( str ) {
var elem = document.getElementById('rc_notify');
if (elem) {
elem.style.display = 'block';
elem.style.visibility = 'visible';

if ( elem.currentStyle &&
elem.currentStyle.position == 'absolute' ) { elem.style.top = getScrollTop(); window.onscroll = scrollHandler; }

elem.innerHTML = str;
}
}

function hideNotify() {
var elem = document.getElementById('rc_notify');
if (elem) {
elem.style.display = 'none';
elem.style.visibility = 'hidden';
window.onscroll = null;
}
}

function handleHttpResponse() {
   if (http.readyState == 1) {
      clearInterval(timeout);
      // spit info out
      //text = 'Starting toLoad Please Wait....';
      //document.getElementById('viewcontent').innerHTML = text;
      //document.getElementById('viewtariff').innerHTML = '';
     // timeout = setTimeout("showNotify('<strong>Loading Please Wait....</strong>')",200);
   }

   if (http.readyState == 4) {
      // spit info out
      var text =  http.responseText;
      document.getElementById('banner_content').innerHTML = text;
    //  window.location.hash = 'pimage';
     // clearInterval(timeout);
    //  hideNotify();
   }

}


function swapbanner(bannerid) {
   var friendurl = '/index_banner_rotate.php?id='+bannerid;
   http.open('GET', friendurl , true);
   http.onreadystatechange = handleHttpResponse;
   http.send('null');
}

function swapbannerstart() {
   var friendurl = '/index_banner_rotate.php';
   http.open('GET', friendurl , true);
   http.onreadystatechange = handleHttpResponse;
   http.send('null');
}

function getHTTPObject() {
   var xmlhttp;
   /*@cc_on
   @if (@_jscript_version >= 5)
   try {
   xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
   } catch (e) {
   try {
   xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
   } catch (E) {
   xmlhttp = false;
   }
   }
   @else
   xmlhttp = false;
   @end @*/
   if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
      try {
         xmlhttp = new XMLHttpRequest();
      } catch (e) {
         xmlhttp = false;
      }
   }
   return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
