// FADESHOW

var fadeimages=new Array()
fadeimages[0]=["images/billboard_001.jpg", "", ""]
fadeimages[1]=["images/billboard_002.jpg", "", ""]
fadeimages[2]=["images/billboard_003.jpg", "", ""]
fadeimages[3]=["images/billboard_004.jpg", "", ""]
fadeimages[4]=["images/billboard_005.jpg", "", ""]
fadeimages[5]=["images/billboard_006.jpg", "", ""]
fadeimages[6]=["images/billboard_007.jpg", "", ""]
fadeimages[7]=["images/billboard_008.jpg", "", ""]
fadeimages[8]=["images/billboard_009.jpg", "", ""]
fadeimages[9]=["images/billboard_010.jpg", "", ""]
fadeimages[10]=["images/billboard_011.jpg", "", ""]
fadeimages[11]=["images/billboard_012.jpg", "", ""]
fadeimages[12]=["images/billboard_013.jpg", "", ""]
fadeimages[13]=["images/billboard_014.jpg", "", ""]
fadeimages[14]=["images/billboard_015.jpg", "", ""]
 
var fadebgcolor="#ea5931"

////NO need to edit beyond here/////////////

/***********************************************
* Ultimate Fade-In Slideshow (v1.51): •À? Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'" alt="The Michael Group"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}





// SIDEBAR PICKER
x = Math.round(Math.random()*8);


if (x == '0') {

var text = '<img src="images/sidebar_florencecrittenton.png" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;The Michael Group saved<br />us a bundle of money, and we are truly grateful. The window repairs prevented further damage from leaks, and our hardworking staff now enjoy heated and<br /> air-conditioned offices,<br /> which we had been without for more than a year.&quot;</span></p><p><span class="sidebar_saidby">Ann Shervington Davis, CEO<br />Florence Crittenton Services</span></p>'

}

if (x == '1') {

var text = '<img src="images/sidebar_ric.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;Thanks to The Michael Group, in addition to providing a safe environment for the women, this project has given the community a major face lift and a sense of pride that has prompted conversation about our positive assets and future possibilities.&quot;</span></p><p><span class="sidebar_saidby">Lena Franklin, Executive Director<br />Recovery in Community </span></p>'

}

if (x == '2') {

var text = '<img src="images/sidebar_chevychase.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;Chevy Chase came out beautifully far exceeding our expectations.&quot;</span></p><p><span class="sidebar_saidby">Ted Heflin<br />HOA Construction Manager<br />Chevy Chase Lake Apartments</span></p>'

}


if (x == '3') {

var text = '<img src="images/sidebar_paddington.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;I would like to thank the workers for doing such a neat job in my apartment.&quot;</span></p><p><span class="sidebar_saidby">Yvonne Washington<br />Paddington Square resident</span></p><p><span class="sidebar_quote">&quot;The workers were very nice and worked hard to do a good job. Thanks for making Paddington Square a better place to live.&quot;</span></p><p><span class="sidebar_saidby">Sincerria Carter<br />Paddington Square resident</span></p>'

}

if (x == '3') {

var text = '<img src="images/sidebar_paddington.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;I would like to commend<br />the workers for doing such a neat job in my apartment.&quot;</span></p><p><span class="sidebar_saidby">Yvonne Washington<br />Paddington Square resident</span></p><p><span class="sidebar_quote">&quot;The workers were very<br />nice and worked hard to do a good job. Thanks for making Paddington Square a better place to live.&quot;</span></p><p><span class="sidebar_saidby">Sincerria Carter<br />Paddington Square resident</span></p>'

}


if (x == '4') {

var text = '<img src="images/sidebar_washingtongardens.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;Thank you for a job well done! You have our complete appreciation for the services you provided.&quot;</span></p><p><span class="sidebar_saidby">Pamela Black<br />Manager Washington Gardens Apartments</span></p><p><span class="sidebar_quote">&quot;Thank you for the wonderful job you did here at Washington Gardens.&quot;</span></p><p><span class="sidebar_saidby">Aphary Insley<br />Washington Gardens resident</span></p>'

}


if (x == '5') {

var text = '<img src="images/sidebar_bomuseum.jpg" class="sidebar_image"><br /><p><span class="sidebar_quote">&quot;Sincere appreciation for the excellent restoration work.&quot;</span></p><p><span class="sidebar_saidby">Courtney Wilson<br />B & O Museum Executive Director </span></p>'

}


if (x == '6') {

var text = '<img src="images/sidebar_full_001.jpg" class="sidebar_full">'

}


if (x == '7') {

var text = '<img src="images/sidebar_full_002.jpg" class="sidebar_full">'

}



if (x == '8') {

var text = '<img src="images/sidebar_full_003.jpg" class="sidebar_full">'

}


if (x == '9') {

var text = '<img src="images/sidebar_full_004.jpg" class="sidebar_full">'

}


if (x == '10') {

var text = '<img src="images/sidebar_full_005.jpg" class="sidebar_full">'

}


if (x == '11') {

var text = '<img src="images/sidebar_full_006.jpg" class="sidebar_full">'

}



if (x == '12') {

var text = '<img src="images/sidebar_full_007.jpg" class="sidebar_full">'

}


//script generated by javascriptformvalidator.com

//use errorMode=0 for alert
//use errorMode=1 to write errors to an element
errorMode = 0;

//elementId to write the errors to (if applicable)
errorElementId = '';

//custom js arrays
var reqd_fields = new Array();
reqd_fields[0] = 'first_name';
reqd_fields[1] = 'last_name';
reqd_fields[2] = 'type';
reqd_fields[3] = 'company';
reqd_fields[4] = 'telephone';
reqd_fields[5] = 'email';

var email_fields = new Array();
email_fields[0] = 'email';
	
function dropdownSelected(selectObj) {
	return (selectObj.selectedIndex == 0 || selectObj.value == '')?false:true;
}
function checkboxChecked(checkboxObj) {
	return checkboxObj.checked;
}
function inputFilled(formElem) {
	return (formElem.value == '')?false:true;
}
function isProvided(formElem) {
	switch (formElem.type) {
		case 'select-one':
			return dropdownSelected(formElem);
			break;
		case 'checkbox':
			return checkboxChecked(formElem);
			break;
		default:
			return inputFilled(formElem);
			break;
	}
}
function isEmail(formElem) {
	emailStr = formElem.value;
	atPos = emailStr.indexOf('@');
	dotPos = emailStr.lastIndexOf('.');
	return (atPos > 0 && dotPos > atPos && dotPos < emailStr.length-2);
}
function displayErrors(a) {
	flag = true;
	spacer = (errorMode==0)?"\n":"<br />";
	errStr = "";
	for (var i=0; i < a.length; i++) {
		if (a[i].length > 0) {
			flag = false;
			for (var v=0; v < a[i].length; v++) {
				errStr += a[i][v] + spacer;					
			}		
		}
	}
	if (errStr != "") {
		if (errorMode == 0)
			alert(errStr);
		else {
			document.getElementById(errorElementId).innerHTML = errStr;
			location.href = "#";			
		}
	}
	return flag;
}
//call from onsubmit parameter of form tag like this: return validate(this)
function validate(formObj) {
	req_error = new Array();				email_error = new Array();		error = new Array(
				req_error								,email_error				);
	
	for (var i=0; i < reqd_fields.length; i++) {
		formElem = formObj.elements[reqd_fields[i]];
		if (!isProvided(formElem))
			req_error[req_error.length] = formElem.name + " is a required field.";
	}
	for (var i=0; i < email_fields.length; i++) {
		formElem = formObj.elements[email_fields[i]];
		if (!isEmail(formElem))
			email_error[email_error.length] = "\'" + formElem.value + "\' is not a valid email address.";
	}
	return displayErrors(error);
}