var browser_type=navigator.appName;
var browser_version=parseInt(navigator.appVersion);
var is_nav, is_ie, avail_width;


// if IE 4+
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4) {
		is_ie = true;
	}
	// if NS 4+
	else if (browser_type=="Netscape"&&browser_version>=4) {
	is_nav = true;
}

// this needs to be in the body or in a function in the head called from the body
function checkWidth() {
	if (is_ie) { 
		avail_width = document.body.clientWidth; 
	}
	if (is_nav) { 
		avail_width = window.innerWidth;
	}
}

// this function makes the 'Doug & Nancy' smaller if browser window is less than 775px wide
function contactName() {
	if (avail_width > 775) {
		document.write('<div class="dougnancy">Doug & Nancy Bachtel</div>');
	}
	else {
		document.write('<div class="dougnancysmall">Doug & Nancy Bachtel</div>');
	}
}

// this function makes the phone number smaller if browser window is less than 775px wide 
function contactNumber() {
	if (avail_width > 775) {
		document.write('Toll-Free:<span class="red"><span class="bigger">(866)758-5151</span></span><br>');
	}
	else {
		document.write('<span class="smaller">Toll-Free:<span class="red">(866)758-5151</span></span><br>');
	}
}

// this changes table widths in the main body depending on the browser window size
function tableTop() {
	if (avail_width > 775) {
		document.write('<table width="550" cellspacing="0" cellpadding="0" border="0"><tr><td width="100"><img src="images/Spacer.gif" width="100" height="10" border="0"></td>');
	}
	else {
		document.write('<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="25">');
	}
}

//conditional break
function break_logan() {
	if (avail_width > 775) {
		document.write('<span class="logandd">This site was designed and built by<br><a href="http://www.logandigitaldesign.com">Logan Digital Design</a></span>');
	}
	else {
		document.write('<span class="logandd">This site was designed<br>and built by<br><a href="http://www.logandigitaldesign.com">Logan Digital Design</a></span>');
	}
}


/****************************************************
*	        DOM Image rollover:
*		by Chris Poole
*		http://chrispoole.com
*               Script featured on http://www.dynamicdrive.com
*		Keep this notice intact to use it :-)
****************************************************/
// Add hsrc="MyImage.jpg" to <img> tag for rollover image
// need to call this function from onload event
function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}

