// JavaScript Document

// miscellaneous Macromedia functions

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.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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_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];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function getArgs() {
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split(",");
	for (var i=0; i<pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}	

// data that's used to generate the 'values' sidebars at the lower left corner of the page
var sidebarData = new Array(5);
sidebarData[0] = {title:"creative", quote:"The creative alternatives and improvements that Vision Builders suggested gave us a building far more attractive and functional than we had anticipated.", attribution:"Pastor Bill Dwyer, Valley Vineyard Church"};
sidebarData[1] = {title:"dependable", quote:"I highly recommend Vision Builders to those who are searching for a general contractor to partner with them in their building project.  They did an outstanding job from design to finish, and definitely went the extra mile for us to solve problems specific to our project.", attribution:"Assistant Pastor Joel Moore, Crown Valley Community Church"};
sidebarData[2] = {title:"imaginative", quote:"Vision Builders has exceeded our expectations in the remodel/building  of our new facility. Their ability to turn a 41,000 sq ft warehouse,  with no utilities, into a showcase of Warner Center was outstanding!", attribution:"Pastor Mel Ayres, In His Presence Church"};
sidebarData[3] = {title:"personal", quote:"Our project had several unique challenges and Vision Builders were able to complete our building safely and efficiently while our pre-school and church remained in operation.", attribution:"Richard Newcomb, Bethelehem Lutheran Church and Preschool"};
sidebarData[4] = {title:"reliable", quote:"I highly recommend Vision Builders to those who are searching for a general contractor to partner with them in their building project.  They did an outstanding job from design to finish, and definitely went the extra mile for us to solve problems specific to our project.", attribution:"Assistant Pastor Joel Moore, Crown Valley Community Church"};

/*-- showRandomValuesSidebar : generates a random 'values' sidebar area --*/
function showRandomValuesSidebar() {
	var theData = sidebarData[Math.floor(Math.random() * sidebarData.length)];
	document.write('<img src="images/sidetitle_'+theData.title+'.gif" alt="'+theData.title+'" /><br />');
	document.write('<img src="images/sidebar_'+theData.title+'.jpg" alt="'+theData.title+' image" />');
	document.write('<p>&quot;'+theData.quote+'&quot;</p>');
	document.write('<p align="right">&mdash;'+theData.attribution+'</p>');
}

/*-- embedHomeFlash : writes embed code for the home page flash movies to avoid active content probs -- */
function embedHomeFlash(swfName,swfWidth,swfHeight) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+swfWidth+'" height="'+swfHeight+'">');
	document.write('<param name="movie" value="'+swfName+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+swfName+'" width="'+swfWidth+'" height="'+swfHeight+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
	document.write('</object>');
}