addLoadEvent(goSetHeight);

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

function dynmenu(x,y)
{

	if(document.getElementById)
	{
		if(document.getElementById(x).style.display == "none")
		{
			document.getElementById(x).style.display = "block";
			source = "http://www.eastriding.gov.uk/sewerby/javascript/images/nav_neg3.gif"
			//document.getElementById(x).focus();
		}else{
			document.getElementById(x).style.display = "none";
			source = "http://www.eastriding.gov.uk/sewerby/javascript/images/nav_plus3.gif"
		}
	}
	if(y)document.images[y].src = source;
	//return false;
}


var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elasticNT") 
   strOptions="scrollbars,"+ 
     "resizable,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}


// obsolete funtion - Need to remove attributes that call it at some point.
function iFrameHeight()
	{
return;
	}


// obsolete funtion - Need to remove attributes that call it at some point.
function heightNoReturn()
	{
return;
}

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName) : null;
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
	iframeEl.scrolling = "no";
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (docHt) iframeEl.style.height = docHt + 30 + "px";
  }
}

function goSetHeight() {
	if (parent == window) { return; }
		var iframeId = ["dynamicbox","dynamicbox2"];
		for (i=0; i<iframeId.length; i++) {
			if (document.getElementById && document.getElementById(iframeId[i]) != -1) {
				parent.setIframeHeight(iframeId[i]);
			}
		}
}