// JavaScript Document





	// Cross Browser DOM
// copyright Stephen Chapman, 4th Jan 2005
// you may copy this code but please keep the copyright notice as well
var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
if (stdDOM) aDOM = 1; else {ieDOM = document.all; if (ieDOM) aDOM = 1; else {
var nsDOM = ((navigator.appName.indexOf('Netscape') != -1)
&& (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1;}}
function xDOM(objectId, wS) {
if (stdDOM) return wS ? document.getElementById(objectId).style:
document.getElementById(objectId);
if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId];
if (nsDOM) return document.layers[objectId];
}
// More Object Functions
// copyright Stephen Chapman, 18th Jan 2005
// you may copy these functions but please keep the copyright notice as well
function setObjVis(objectID,vis) {var objs = xDOM(objectID,1); objs.visibility = vis;}
function toggleObjVis(objectID) {var objs = xDOM(objectID,1); var vis = objs.visibility; objs.visibility = (vis == "visible" || vis == "show") ? 'hidden' : 'visible';}
function moveObjTo(objectID,x,y) {var objs = xDOM(objectID,1); objs.left = x; objs.top = y;}
function moveObjBy(objectID,x,y) {var obj = xDOM(objectID,0);var objs = xDOM(objectID,1); if (obj.offsetLeft != null) {var l = obj.offsetLeft; var t = obj.offsetTop; objs.left = l+x; objs.top = t+y;} else if (objs.pixelLeft != null) {objs.pixelLeft += x; objs.pixelTop += y;} else obj.moveBy(x,y);}
function getObjLeft(objectID) {
var obj = xDOM(objectID,0);
var objs = xDOM(objectID,1);
 if (obj.offsetLeft != null) {
 return obj.offsetLeft; 
 } else if (objs.pixelLeft != null) {
 return objs.pixelLeft; 
 }}
 function getObjTop(objectID) {
var obj = xDOM(objectID,0);
var objs = xDOM(objectID,1);
 if (obj.offsetTop != null) {
 return obj.offsetTop; 
 } else if (objs.pixelTop != null) {
 return objs.pixelTop; 
 }}
  function getObjHeight(objectID) {
var obj = xDOM(objectID,0);
var objs = xDOM(objectID,1);
 if (obj.offsetHeight != null) {
 return obj.offsetHeight; 
 } else if (objs.pixelHeight != null) {
 return objs.pixelHeight; 
 }}
function moveObjLayer(objectID,z) {var objs = xDOM(objectID,1); objs.zIndex = z;}


function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject


var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}

function blogtoggle(id,lastid) {
//document.savesale.STZip.value=xmlhttp.readyState;
var h = getObjHeight("commentsdiv");
document.getElementById("commentsdiv").innerHTML='<div style="height:' + h + 'px; text-align:center; display:block;"><img src="loading.gif" width="48" height="48" alt="" style="margin:50px 0 0 0;" /></div>';

  if (xmlhttp.readyState==1 || xmlhttp.readyState==2 || xmlhttp.readyState==3) {
     //nothing;
  }else{
      xmlhttp.open("GET", "getBlogPanel2.asp?id="+id+"&lastid="+lastid,true);
      xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {
        var div_style = document.getElementById("commentsdiv").style;
		

    document.getElementById("commentsdiv").innerHTML=xmlhttp.responseText;

        //moveObjTo("customers",box_left,box_top);

   
       
   
      } //readystate=4
      } //onreadystatechange function
      xmlhttp.send(null)
	  if (id==1) {document.getElementById("rightheader").innerHTML="stats and recent posts";}
	  if (id==2) {document.getElementById("rightheader").innerHTML="stats and comments";}
	  if (id==3) {document.getElementById("rightheader").innerHTML="stats and archives";}
 } //}else{
} //getCustomers
function getRecent() {
//document.savesale.STZip.value=xmlhttp.readyState;
var h = getObjHeight("commentsdiv");
document.getElementById("recentdiv").innerHTML='<div style="height:' + h + 'px; text-align:center; display:block;"><img src="loading.gif" width="48" height="48" alt="" style="margin:50px 0 0 0;" /></div>';

  if (xmlhttp.readyState==1 || xmlhttp.readyState==2 || xmlhttp.readyState==3) {
     //nothing;
  }else{
      xmlhttp.open("GET", "getBlogPanel.asp?id=1",true);
      xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {
        var div_style = document.getElementById("recentdiv").style;
		

    document.getElementById("recentdiv").innerHTML=xmlhttp.responseText;

        //moveObjTo("customers",box_left,box_top);

   
       
   
      } //readystate=4
      } //onreadystatechange function
      xmlhttp.send(null)
 } //}else{
} //getCustomers

function showLoader() {
document.getElementById("loadresults").innerHTML='<img src="loading.gif" width="16" height="16" alt="" />';
}

var keyPressDelay = null;
function delay()
{
if (keyPressDelay)
		{
		window.clearTimeout(keyPressDelay);
		}
		keyPressDelay = window.setTimeout('doLiveSearch()', 400);
		}
		
		function popup( obj, L, T ) {
with( obj.style ) {
display = "block";
position = "absolute";
left = L;
top = T;
}
}
function unpop( obj ) { obj.style.display = "none"; }


//findPos function is from http://www.quirksmode.org/js/findpos.html;
//where its workings are explained in more detail.
function findPos(obj) {
	var curleft = curtop = 0;
	//if (obj.offsetParent) {
	//	curleft = obj.offsetLeft
	//	curtop = obj.offsetTop
	//	while (obj = obj.offsetParent) {
	//		curleft += obj.offsetLeft
	//		curtop += obj.offsetTop
	//	}
	//}
	//return [curleft,curtop];
	return [getObjLeft(obj),getObjTop(obj)+24];
}

//Display a named menu, at the position of another object
function display_menu(parent,named)
{
	//get the named menu
	var menu_element = document.getElementById(named);
	//override the 'display:none;' style attribute
	menu_element.style.display = "";
	//get the placement of the element that invoked the menu...
	var placement = findPos(parent);
	//...and put the menu there
	menu_element.style.left = placement[0] + "px";
	menu_element.style.top = placement[1] + "px";
}

//Hide a named menu
function hide_menu(named)
{
	//get the named menu
	var menu_element = document.getElementById(named);
	//hide it with a style attribute
	menu_element.style.display = "none";
}




function doLiveSearch() {
//document.savesale.STZip.value=xmlhttp.readyState;
document.getElementById("searchresults").innerHTML=' ';
//document.getElementById("loadresults").innerHTML='<img src="loading.gif" width="16" height="16" alt="" style="margin:50px 0 0 0;" />';

  if (xmlhttp.readyState==1 || xmlhttp.readyState==2 || xmlhttp.readyState==3) {
     //nothing;
  }else{
      query=document.getElementById("query").value;
      xmlhttp.open("GET", "find2.asp?query=" + query,true);
      xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {
        var div_style = document.getElementById("searchresults").style;
	   display_menu('search','searchresults');
	
    document.getElementById("loadresults").innerHTML=' ';
    document.getElementById("searchresults").innerHTML=xmlhttp.responseText;
	rcleft=getObjLeft("rightcolumn");
    


   
       
   
      } //readystate=4
      } //onreadystatechange function
      xmlhttp.send(null)
 } //}else{
} //getCustomers