function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_home = newImage("images/nav-home-on.gif");
		nav_about_mold = newImage("images/nav-mold-damage-on.gif");
		nav_services = newImage("images/nav-services-on.gif");
		nav_faq = newImage("images/nav-faq-on.gif");
		nav_testimonials = newImage("images/nav-testimonials-on.gif");
		nav_resources = newImage("images/nav-resources-on.gif");
		nav_news = newImage("images/nav-news-on.gif");
		nav_contact = newImage("images/nav-contact-on.gif");
		preloadFlag = true;
	}
}

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.0
  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 && document.getElementById) x=document.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];}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		services_nav = newImage("images/services_on.gif");
		how_it_works_nav = newImage("images/how_it_works_on.gif");
		about_us_nav = newImage("images/about_us_on.gif");
		pros_sign_up_nav = newImage("pros_sign_up_nav");
		preloadFlag = true;
	}
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
  document.getElementById('terms_frame').style.height = myHeight - 100 + 'px';
}

function show_terms() {
alertSize();
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);

document.getElementById('terms_and_conditions').style.visibility = 'visible';
document.getElementById('terms_frame').style.visibility = 'visible';

document.getElementById('terms_and_conditions').style.width = xWithScroll - 20 + 'px';
document.getElementById('terms_and_conditions').style.height = yWithScroll + 'px';

document.getElementById('terms_frame').style.left = xWithScroll/2 - document.getElementById('terms_frame').offsetWidth/2 + 'px';
//alert(document.getElementById('terms_frame').style.left);

//alert(xWithScroll);
}


function user_alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
  document.getElementById('terms_frame2').style.height = myHeight - 100 + 'px';
}

function user_show_terms() {
user_alertSize();
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);

document.getElementById('terms_and_conditions2').style.visibility = 'visible';
document.getElementById('terms_frame2').style.visibility = 'visible';

document.getElementById('terms_and_conditions2').style.width = xWithScroll - 16 + 'px';
document.getElementById('terms_and_conditions2').style.height = yWithScroll + 'px';

document.getElementById('terms_frame2').style.left = xWithScroll/2 - document.getElementById('terms_frame2').offsetWidth/2 + 'px';
}

MM_preloadImages('images/business_services_on.gif','images/personal_services_on.gif','images/home_services_on.gif');

function toggle1(id) {
document.getElementById(id).style.border="solid 1px #f4e232";
document.getElementById(id).style.background="url(images/input_bg2.jpg)";
}
function toggle2(id) {
document.getElementById(id).style.border="solid 1px #0e93d4";
document.getElementById(id).style.background="url(images/input_bg1.jpg)";
}

