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_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_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];}
}

// CSS ToolTips
// position of the tooltip relative to the mouse in pixel //
var offsetx = 12;
var offsety =  -25;

function newelement(newid){ 
    if(document.createElement){ 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style){ 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e){
    if(document.getElementById){
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('tooltip');
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
    }
}
function tooltip(tip){
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
	switch(tip){
	case 1:
		tiptxt='<b>Difficulty Rating - 1</b><br/>Installation of this product is relatively straightforward and can be performed by the majority of individuals.';
		break;    
	case 2:
		tiptxt='<b>Difficulty Rating - 2</b><br/>Installation of this product is relatively straightforward and can be performed by individuals harboring a basic knowledge of the product and minor skill sets.';
		break;
	case 3:
		tiptxt='<b>Difficulty Rating - 3</b><br/>Installation of this product may require some technical expertise.';
		break;
	case 4:
		tiptxt='<b>Difficulty Rating - 4</b><br/>Installation of this product requires some technical expertise.  This expertise may be related to electical, mechanical or fluid properties.';
		break;
	case 5:
		tiptxt='<b>Difficulty Rating - 5</b><br/>Installation of this product requires a highly <b>advanced</b> skill set and professional or technical experience to install.  This product may require a distributor to be installed properly.';
		break;
	default:
		tiptxt=tip;
	}
	lixlpixel_tooltip.innerHTML = tiptxt;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit(){
    document.getElementById('tooltip').style.display = 'none';
}
function distSelect(){
	window.open('distselector.asp','DistSelector','directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,width=620,height=635','');
}
function buildIt(prodID){
	window.open('builder.asp?pID='+prodID+'','DistSelector','directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,width=950,height=550','');
}
function CheckNumber(field) {
	var numberfield = field;
	if(isNaN(field.value)){
		alert("Please enter a valid number.");
		field.focus();		
		return(false)
	}
	return(true);
}
function intOnly(x) {
	if(x.value.length>0) {
		x.value = x.value.replace(/[^\d]+/g, ''); 
	}
}
function forceValid(x) {
	if(x.value.length>0) {
		x.value = x.value.replace(new RegExp("n/a","gi"), '');
		x.value = x.value.replace(new RegExp("none","gi"), '');
		x.value = x.value.replace(new RegExp("blank","gi"), '');
	}
}
function returnOBJbyID(id) { 
	if (document.getElementById){
		var returnVar = document.getElementById(id); 
	}else if (document.all){
		var returnVar = document.all[id]; 
	}else if (document.layers){
		var returnVar = document.layers[id];
	}
	//window.onerror=Error(id);
	function Error(id) {
		error="____________________________________________________<br><br>";
		error+="ID with tag " + id + " does not exist.";
		document.getElementById('err').innerHTML= error;
		self.scroll(0,0);
	}
	if(returnVar == null) alert(id+" does not exist!");
	return returnVar;
}
function change(id, newClass) {
	identity=returnOBJbyID(id);
	if(!identity.disabled){
		identity.className=newClass;
	}
}
function disableRow(inputID, trID) {
	returnOBJbyID(trID).className="DisabledRow";
	returnOBJbyID(inputID).disabled=true;
	returnOBJbyID(inputID).checked=false;
}
function enableRow(id, trID) {
	returnOBJbyID(trID).className="";
	returnOBJbyID(id).disabled=false;
}
function ShowItem(obj,id){
	(obj.checked) ? document.getElementById(id).style.visibility = 'visible' : document.getElementById(id).style.visibility = 'hidden';
}
function HideItem(obj,id){
	(obj.checked) ? document.getElementById(id).style.visibility = 'hidden' : document.getElementById(id).style.visibility = 'visible';
}