function printPopup(mID, sID, w)  {
  url = 'index_print.asp?mainID=' + mID + '&subID=' + sID;
  var printWindow = window.open(url, '', 'resizable=1,menubar=yes,scrollbars=1,location=no,toolbar=1,directories=no,width=' + w);
}

var ie, ns, ns6;

ns6 = (document.getElementById);
ns = (document.layers);
ie = (document.all);

function showObj(obj) {
  if(ie)document.all[obj].style.visibility='visible'
  if(ns)document.layers[obj].visibility='visible'
  if(ns6)document.getElementById(obj).style.visibility = "visible";
}

function hideObj(obj) {
  if(ie)document.all[obj].style.visibility='hidden'
  if(ns)document.layers[obj].visibility='hidden'
  if(ns6)document.getElementById(obj).style.visibility = "hidden";
}

function createPopup(filename, w, h, scroll)  {
	window.open(filename, '', 'resizable=0,menubar=no,scrollbars=' + scroll + ',location=no,toolbar=0,status=0,directories=no,width=' + w + ',height=' + h);	
}

function overlay() {
	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {
		yScroll = window.innerHeight + window.scrollMaxY;
		xScroll = window.innerWidth + window.scrollMaxX;
		var deff = document.documentElement;
		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		xScroll -= (window.innerWidth - wff);
		yScroll -= (window.innerHeight - hff);
	}
  else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
		xScroll = document.body.scrollWidth;
	}
  else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
		xScroll = document.body.offsetWidth;
  }
 return "<div style=position:absolute; left:0; top:0; height:" + yScroll + "; width:100%; background-color: #FFFFFF; z-index: 100; opacity: .9; filter: alpha(opacity=80);></div>";
}

function showDiv(divName) {
  document.getElementById(divName).style.visibility='visible';
}

 function hideDiv(divName) {
  document.getElementById(divName).style.visibility='hidden';
}



var xmlHttp

function showHint(str) {
	
	if (str.length==0) {
		document.getElementById("txtHint").innerHTML="";
		return;
	}

	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null) {
		alert ("Your browser does not support AJAX!");
		return;
	}

	var url="gethint.asp";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}


function stateChanged() {

	if (xmlHttp.readyState==4) {
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}

}


function GetXmlHttpObject() {

	var xmlHttp=null;

	try {

		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();

	}

	catch (e) {

		// Internet Explorer 
		try {
		
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

		}

		catch (e) {
		
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

		}

	}

	return xmlHttp;

} 



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
