var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
var key = parms[i].substring(0,pos);
var val = parms[i].substring(pos+1);
qsParm[key] = val;
}
}
} 

//document.write("asdf");
qsParm['code'] = null;
qsParm['id'] = null;
qs();
//document.write(qsParm['id']);
var id = qsParm['id'];
//document.write (id);

var url = "http://myschoolclosures.com/school.php?id=" + id;
//document.write (url);
ajaxinclude(url)



var rootdomain="http://"+window.location.hostname
function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
page_request = new XMLHttpRequest();
if (page_request.overrideMimeType)
page_request.overrideMimeType('text/xml')
}

else if(!xmlhttp) {
     if(   document.createElement
        && document.documentElement
        && (window.opera||navigator.userAgent.indexOf('MSIE 5.0')==-1)) {
         var ifr=document.createElement('iframe');
         ifr.setAttribute('id',iframeID);
         ifr.setAttribute('name',iframeID);
         ifr.style.visibility='hidden';
         ifr.style.position='absolute';
         ifr.style.width=ifr.style.height=ifr.borderWidth='0px';
         iframe=document.getElementsByTagName('body')[0].appendChild(ifr)
     } else if (document.body&&document.body.insertAdjacentHTML) {
       document.body.insertAdjacentHTML('beforeEnd',
           '<iframe name="'+iframeID+'" id="'+iframeID
         + '" style="display:none"></iframe>')
     }
     if(window.frames && window.frames[iframeID])
       iframe=window.frames[iframeID];
     iframe.name=iframeID
   }

else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously 
page_request.send(null)

writecontent(page_request)
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
strong = page_request.responseText;
pos = strong.indexOf("Announce School Closure")
if (pos>=0)
{
pos3 = strong.indexOf("Click to verify the school is open") //else 'verified'

  if (pos3>=0)
        {
	document.write("School is open (not verified)<br /><img style='margin-top:10px;'  src='images/120x120/open-nv.png'>");
	}
	else
	{
        document.write("School is open (confirmed)<br /><img style='margin-top:10px;' src='images/120x120/open.png'>");
	}
//document.write("<br/>School is open");
}
else
{
pos2 = strong.indexOf("Click to verify the school closure")
	if (pos2>=0)
	{
	document.write("School is closed (not verified)<br /><img style='margin-top:10px;' src='images/120x120/closed-nv.png'>");
	}
	else 
	{
	//document.write("<img src=http://myschoolclosures.com/images/120x120/closed.png>"); 
	}
	
pos4 = strong.indexOf("Announce School Re-Opening")	
	if (pos4>=0)
	{
	document.write("School is closed (confirmed)<br /><img style='margin-top:10px;' src='images/120x120/closed.png'>");
	}
	else 
	{
	//document.write("<img src=http://myschoolclosures.com/images/120x120/closed.png>"); 
	}	
}

}

//document.write("asdfzzz");
