<!-- Select Menu Links
function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// End -->

<!-- Newsletter Popup
function openNewsletter() {
	window.open('http://www.masterplumbers.com/newsletter/subscribe.asp', 'Newsletter', 'toolbar=no,width=450,height=250,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no,scrollbars=no');
}
// End -->

<!-- Old Browser Alert
//  function MM_NS4Alert(init) {
//    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
//  	var disclaim=confirm("PLEASE NOTE: You are using an old version of Netscape. It is highly likely that the page you are trying to access will not display correctly. We recommend you upgrade your browser to the latest version. To do so, click CANCEL and we will redirect you to the Netscape download page. To view the page anyway, click OK");
//  	if (disclaim)
//  	document.write("");
//  	else
//  	parent.location=("http://channels.netscape.com/ns/browsers/download.jsp"); }}
//  }
//  MM_NS4Alert(true);
// End -->

<!-- Netscape 4 Resize Fix
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// End -->

<!-- Convert Carriage Returns
var myExpr1 = /&&/gi 
var myExpr2 = /\r\n/gi 
var myCRLF = String.fromCharCode(13)
// Insert this into required position in source code:
// onBlur="this.value=this.value.replace(myExpr2,'&&');this.value=this.value.replace(myExpr3,myExpr4);" onFocus="this.value=this.value.replace(myExpr1,myCRLF);this.value=this.value.replace(myExpr4,myExpr3);"

//  End -->

<!-- Restrict <textarea> characters
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else 
	countfield.value = maxlimit - field.value.length;

// Insert this into required position in source code:
// onKeyDown="textCounter(this.form.this.value,this.form.remLen1,255);" onKeyUp="textCounter(this.form.this.value,this.form.remLen1,255);"
}
// End -->

<!-- Full Screen Popup
function popUpFullScreen(nameOfFile, paramters, anchorName){
	if (anchorName != " ")
	var urlToOpen = nameOfFile + "?" + paramters + "#" + anchorName;
else
	var urlToOpen = nameOfFile + "?" + paramters;
	var popUpWindow = window.open(urlToOpen,"", "width="+(screen.width-10)+",height="+(screen.height-80)+",left=0,top=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no");
}
// End -->

<!-- Begin Loading notification
//document.write('<div id="loading">Please wait while the page loads...</div>');
//window.onload=function(){
//	document.getElementById("loading").style.display="none";
//}
// End -->

<!-- Begin Email Write Script
function writeemail(emailname, emaildomain, emailoption, emailtext, emailstyle) {
	if (emailtext == "" || emailtext == null) {
		emailtext = (emailname + '@' + emaildomain);
	}
	if (emailoption == "" || emailoption == null) {
		emailoption2 = ('');
	} else {
		emailoption2 = ('?' + emailoption);
	}
	if (emailstyle == "" || emailstyle == null) {
		emailstyle2 = ('');
	} else {
		emailstyle2 = (' style="' + emailstyle + '"');
	}
	emailadd=(emailname + '@' + emaildomain + emailoption2);
	return('<a href="mailto:' + emailadd + '"' + emailstyle2 +'>' + emailtext + '</a>');
}
//-->

<!-- Get cookie routine by Shelley Powers 
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
//-->

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["sidebar"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
//-->
