// Courtesy Pest Control

function getHeader(isIndex){
	var pagetitle = document.getElementById("pagetitle");
	if(detectBrowser() == "MSIE"){
		pagetitle.setAttribute("className","pagetitleIE");
	}else{
		pagetitle.setAttribute("class","pagetitle");
	}
	if(isIndex == true){
		var title = document.getElementById("headertext").innerHTML;
	}else{
		var title = parent.document.getElementById("headertext").innerHTML;
	}
	pagetitle.innerHTML = title;
//alert("class: "+pagetitle.getAttribute("className")+"\ntitle: "+pagetitle.innerHTML)
	return true;
}

function detectBrowser(){
	var browser = "";
	var klass = "";
	switch(navigator.appName){
		case "Microsoft Internet Explorer":
			browser = "MSIE";
			klass = ""
			break;
		case "Netscape":
			browser = "Firefox";
			break;
		default:
			browser = "Firefox";
			break;
	}
//alert(browser)
	return browser;
}

function dispHeader(title,heading){
	var html = '<center><table><tbody><tr><td>';
	html += '<a href="index.html">';
	html += '<img alt="Courtesy Pest Control" src="logo.jpg" style="border: 0px solid; width: 200px; height: 107px;"><br>';
	html += '</a></td><td>';
	html += '<img style="width: 10px; height: 10px;" alt="" src="images/shim.gif">' ;	
	html += '<br></td><td>';
	html += '<span class="header">'+title+'</span><br><br>';
	html += 'Phone: (623) 979-7000 <br>';
	html += 'Servicing the West Valley (Phoenix, AZ) area';
	html += '</td></tr></tbody></table>';
	html += '<hr width="75%">';
	if(heading){
		html += '<span class="heading">'+heading+'</span>';
		html += '<hr width="75%">';
	}//if
	html += '</center>';
	html += '';

	document.write(html);
}

var txt = " slideshow help";
var s = new Array("Hide", "Show");
var opt = new Boolean(false);
function showIt(){
	var d = document.getElementById("instruct");
	var t = document.getElementById('instructText');
	var ds = d.getAttribute("style").toString();
	var ts = t.innerHTML;
	if(!d){return false;}
//alert("ds: "+ds+"\nts: "+ts+"\nopt: "+opt)
	if(opt == true){
		//d.setAttribute("style","display: block;");
		d.style.display = "block";
		t.innerHTML = s[0] + txt;
		opt = false
	}else{
		//d.setAttribute("style","display: none;");
		d.style.display = "none";
		t.innerHTML = s[1] + txt;
		opt = true;
	}
}

function props(e)
{
  var tmp = "";
	var obj = e;
  if (e === null) {
    alert("props called with null argument");
    return;
  }
  if (e === undefined) {
    alert("props called with undefined argument");
    return;
  }
  var ns = ["Methods", "Fields", "Unreachables"];
  var as = [[], [], []]; // array of (empty) arrays of arrays!
  var p, j, i; // loop variables, several used multiple times
  var protoLevels = 0;
  for (p = e; p; p = p.__proto__)
  {
    for (i=0; i<ns.length; ++i)
      as[i][protoLevels] = [];
    ++protoLevels;
  }
  var c = 0
  for(var a in e){
  tmp += a;
  try{
  tmp += " = "+obj[a] + "\n";
  }catch(x){tmp += "\n";}
  c++;
	//alert(tmp);
	//tmp = "";
	c = 0;
  continue;
    // Shortcoming: doesn't check that VALUES are the same in object and prototype.
    var protoLevel = -1;
    try
    {
      for (p = e; p && (a in p); p = p.__proto__)
        ++protoLevel;
    }
    catch(er) { protoLevel = 0; } // "in" operator throws when param to props() is a string
    var type = 1;
    try
    {
      if ((typeof e[a]) == "function")
        type = 0;
    }
    catch (er) { type = 2; }
    as[type][protoLevel].push(a);
  }
  //alert(tmp);
  
  function times(s, n) { return n ? s + times(s, n-1) : ""; }
  for (j=0; j<protoLevels; ++j)
    for (i=0;i<ns.length;++i)
      if (as[i][j].length) 
        alert(
          ns[i] + times(" of prototype", j), 
          (onePerLine ? "\n\n" : "") + as[i][j].sort().join(onePerLine ? "\n" : ", ") + (onePerLine ? "\n\n" : ""), 
          "propList"
        );
for(var i = 0;i<tmp.length;i += 500){
var x = tmp.substr(i,500);
alert(x)
}
}//props()

function debugPrt(txt){
	var dbg = document.getElementById("debug");
	dbg.innerHTML += txt;
	dbg.scrollIntoView(false);
}

