﻿///Automatic iFrame resize
function adjustIFrameSize (iframeWindow) {
document.getElementById('banner_ad').style.width = 468 + 'px';
  if (iframeWindow.document.height) 
  {
    var iframeElement = document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
    iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 'px';
  }
  else if (document.all)
   {
    var iframeElement = document.all[iframeWindow.name];
    
    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
    {
        iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 1 + 'px';
        iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 1 + 'px';
    }
    else
    {
        iframeElement.style.width=document.body.clientWidth;
        iframeElement.style.height = iframeWindow.document.body.scrollHeight + 1 + 'px';
        iframeElement.style.width = iframeWindow.document.body.scrollWidth + 1 + 'px';
    }
  }
}

function calcHeight()
	{
	
	var the_height=document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;//find the height of the internal page
	document.getElementById('the_iframe').style.width = 468 + 'px';
	var the_width;
	if(window.document.height)
	{
	    the_width=document.getElementById('the_iframe').contentWindow.document.documentElement.scrollWidth;//find the width of the internal page
	}
	else
	{
	    the_width=document.getElementById('the_iframe').contentWindow.document.body.scrollWidth;//find the width of the internal page
	}

				document.getElementById('the_iframe').style.height= the_height + 'px';//change the height of the iframe
				document.getElementById('the_iframe').style.width=the_width + 'px';//change the width of the iframe
	}


function LoadContent(id, url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id + 
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);

    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
}




function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}