function imgRollOver(name,over)
{
	if(window.document.images) 
	{
		if (over) {
			window.document.images[name].src = "images/" + name + "2.gif";
		}
		else {
			window.document.images[name].src =  "images/" + name + ".gif";
		}
	}
}


var slideShowSpeed = 8000
var crossFadeDuration = 3
var Pic = new Array()

Pic[0] = 'Images/Main/1.jpg'
Pic[1] = 'Images/Main/3.jpg'
//Pic[2] = 'Images/Main/2.jpg'

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++)
{
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}

function runSlideShow()
{
	if (document.all){
		document.images.SlideShow.style.filter="blendTrans(duration=2)"
		document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
		document.images.SlideShow.filters.blendTrans.Apply()
	}
	document.images.SlideShow.src = preLoad[j].src
	if (document.all){
		document.images.SlideShow.filters.blendTrans.Play()
	}

	j = j + 1
	if (j > (p-1)) j=0
	t = setTimeout('runSlideShow()', slideShowSpeed)
}


function setNavBar()
{
 varVisible = false;
}

function handleClick() 
{
  if (!varVisible) {
    document.about.src = "images/mb_about3.gif";
    document.nav.src = "images/sub_nav.gif";
    document.sb1.src = "images/sb_profiles.gif";
    document.sb2.src = "images/sb_properties.gif";
    document.sb3.src = "images/sb_people.gif";
    document.sb4.src = "images/sb_history.gif";
    varVisible = true;
  }
  else {
    document.about.src = "images/mb_about.gif";
    document.nav.src = "images/transpace.gif";
    document.sb1.src = "images/transpace.gif";
    document.sb2.src = "images/transpace.gif";
    document.sb3.src = "images/transpace.gif";
    document.sb4.src = "images/transpace.gif";
    varVisible = false;
  }
}

function linkClick(subLink)
{
  if (varVisible) {
   if (subLink == 1) {
    document.location = "profiles.htm";
   } else if (subLink == 2) {
    document.location = "properties.aspx";
   }
     else if (subLink == 3) {
    document.location = "people.htm";
   }
     else if (subLink == 4) {
    document.location = "history.htm";
   }
  }
}

function launchGallery(picName, imgWidth, imgHeight, alt) {
	newWindow = window.open("","newWindow","width="+imgWidth+",height="+imgHeight+",left=" + ((screen.width - imgWidth)/2) + ",top=" + ((screen.height-imgHeight)/2));
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src='+picName+' width='+imgWidth+' height='+imgHeight+' alt='+alt+'>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}		


function disableForm(boolVal)
{
	if (document.all || document.getElementById)
	{
		document.getElementById("cmdSubmit").disabled = boolVal;
	}
}

function CheckMaintainForm()
{		
	disableForm(true);
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;

	if (document.Form1.dropCompany.value == "0") {
		alert ("Please select your company. Be sure to select your building address first.");
		document.Form1.dropAddress.focus();
		disableForm(false);
		return false;
	} else if (document.Form1.txtName.value.length == 0) {
		alert ("Please enter your name.");
		document.Form1.txtName.focus();
		disableForm(false);
		return false;
	} else if (document.Form1.txtEmail.value.length > 0 && !(filter.test(document.Form1.txtEmail.value))) {
		alert ("Please enter a valid email address.");
		document.Form1.txtEmail.focus();
		disableForm(false);
		return false;
	} else if (document.Form1.txtDescription.value.length == 0) {
		alert ("Please enter your maintenance request / problem description.");
		document.Form1.txtDescription.focus();
		disableForm(false);
		return false;
	} else if ((document.Form1.txtEmail.value.length == 0 || !filter.test(document.Form1.txtEmail.value)) && document.Form1.chkNotify.checked) {
		alert ("You must enter a valid email address to use this feature.");
		document.Form1.txtEmail.focus();
		disableForm(false);
		return false;
	} else {
		disableForm(false);
		return true;
	}
}


