ord=Math.random()*10000000000000000;

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}
}

/*** prints out web page ***/
function printOutPage()  {

	var adDiv = 'not_there';

	if(!(document.getElementById('adsR') == null) ) {
		adDiv = document.getElementById('adsR');
		var the_parent = adDiv.parentNode;
		adDiv.parentNode.removeChild(adDiv);
	}
	
	var previousInnerHTML = new String();
	previousInnerHTML = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'><head><title>";
	previousInnerHTML += document.title;
	previousInnerHTML += "</title><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/><link rel='stylesheet' type='text/css' href='http://insideschools.org/includes/printed_page.css' /></head><body bgcolor='#ffffff'>";
	previousInnerHTML += "<div id='toolbarActionBox'><a href='javascript:window.print();'><img src='/images/toolbar/print.gif' alt='' border='0'><img src='/images/spacer.gif' width='5' height='1' border='0'>Click here to print</a></div>"

	if(!(document.getElementById('fiframe') == null) ) {
		the_frame_html = document.getElementById('fiframe').contentWindow.document.body.innerHTML;  
		//alert ("frame not null! inner: " + the_frame_html);
		previousInnerHTML += the_frame_html;
	}
	else {
		if(!(document.getElementById('topText') == null) ) 
			previousInnerHTML += document.getElementById('topText').innerHTML;
		if(!(document.getElementById('fullText') == null) ) 
			previousInnerHTML += document.getElementById('fullText').innerHTML;
		if(!(document.getElementById('bottomText') == null) ) 
			previousInnerHTML += document.getElementById('bottomText').innerHTML;	
		if(!(document.getElementById('schoolText') == null) ) 
				previousInnerHTML += document.getElementById('schoolText').innerHTML;	
		if(!(document.getElementById('districtText') == null) ) 
				previousInnerHTML += document.getElementById('districtText').innerHTML;		
		/*if(!(document.getElementById('schoolProfileBox') == null) ) 
				previousInnerHTML += document.getElementById('schoolProfileBox').innerHTML;		
		if(!(document.getElementById('schoolProfileBoxGray') == null) ) 
				previousInnerHTML += document.getElementById('schoolProfileBoxGray').innerHTML;	
		if(!(document.getElementById('schoolReviewBox') == null) ) 
				previousInnerHTML += document.getElementById('schoolReviewBox').innerHTML;	
		if(!(document.getElementById('schoolActionBox') == null) ) 
				previousInnerHTML += document.getElementById('schoolActionBox').innerHTML;	
		if(!(document.getElementById('schoolCommentBox') == null) ) 
				previousInnerHTML += document.getElementById('schoolCommentBox').innerHTML;	
		if(!(document.getElementById('schoolFeedbackBox') == null) ) 
				previousInnerHTML += document.getElementById('schoolFeedbackBox').innerHTML;	*/
	}
	//document.getElementById('topText').innerHTML = previousInnerHTML;
	var win = window.open(document.title, '_blank', config='toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=yes, status=yes');
	previousInnerHTML += "</body></html>";
	
	if(adDiv != 'not_there') {
		the_parent.appendChild(adDiv);
	}

	
	//variable name of window must be included for all three of the following methods so that
	//javascript knows not to write the string to this window, but instead to the new window
	win.document.open();
	win.document.write(previousInnerHTML);
	win.document.close();
}

/*** Open outside link window (not within Insideschools.org) ***/
function openOutsideLink(url) {
	var win = window.open(url, '_blank', config='height=700,width=900, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=yes, status=yes');
	if (win == null)
		document.location = url;
}

/*** Google toolbar yellow textbox fix SCRIPT ***/
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }
  
  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }