var showDate = new Date();
var showYear = showDate.getFullYear();

function mOver(id)
{
	document.images[id].src = 'images/nav_' + id + '_1.gif';
}

function mOut(id)
{
	document.images[id].src = 'images/nav_' + id + '_0.gif';
}

//services functions
function servicesContent(id,amount)
{
	for(i=1;i<=amount;i++)
	{
		if(i != id)
		{
			document.getElementById('navitem_' + i).style.visibility = 'hidden';
			document.getElementById('services_' + i).style.visibility = 'hidden';
			document.getElementById('services_' + i).style.position = 'absolute';
			document.getElementById('services_' + i).style.top = '-1000px';
			document.getElementById('services_' + i).style.left = '-1000px';
			
		}
	}
	document.getElementById('navitem_' + id).style.visibility = 'visible';
	document.getElementById('services_' + id).style.visibility = 'visible';
	document.getElementById('services_' + id).style.position = 'relative';
	document.getElementById('services_' + id).style.top = '0px';
	document.getElementById('services_' + id).style.left = '0px';
}

//portfolio arrays
var portTitleArr = new Array();
portTitleArr[0] = "Central Bucks County";
portTitleArr[1] = "Center City";
portTitleArr[2] = "Bensalem";
portTitleArr[3] = "St. Croix, U.S.V.I.";
portTitleArr[4] = "Virginia, Fairfax";
portTitleArr[5] = "Virginia, Falls Church";
portTitleArr[6] = "Center City Restaurant";
portTitleArr[7] = "Manayunk, PA";
portTitleArr[8] = "Northeast Philadelphia";
portTitleArr[9] = "Philadelphia - Fishtown";
portTitleArr[10] = "Jamaica Bay, NY";
portTitleArr[11] = "Center City";
portTitleArr[12] = "Mt. Airy, PA";
portTitleArr[13] = "Mt. Airy, PA";
portTitleArr[14] = "Evaluations";

var portDescArr = new Array();
portDescArr[0] = "Performed the engineering, design, procurement of materials, labor resources and construction management for this project.";
portDescArr[1] = "Property Condition Assessment Engineering. Developed design specifications for the repair of elevated concrete floors of a 28-story high rise and provided construction support, solutions for leak remediation and condensation issues. We also identified and proposed solutions to restore the existing condensation piping system.";
portDescArr[2] = "Developed design specifications to structurally restore the roof truss system and masonry of 25 8-Bay Units, and provided construction support.";
portDescArr[3] = "Performed engineering and construction support for a 2-story residential mansion.";
portDescArr[4] = "Provided engineering services to remediate façade deficiencies.";
portDescArr[5] = "Provided property condition assessment.";
portDescArr[6] = "Provided engineering procurement and construction services to build out an existing commercial space.";
portDescArr[7] = "Provided engineering, procurement and construction services for the renovation and rehabilitation of an existing standard 3-story structure and converted it into a 3-story luxury home.";
portDescArr[8] = "Provided engineering, procurement and construction services to erect a cantilevered retaining wall – 150 ft. long by 8 ft. high, to stop erosion, contain the soil, and prevent the existing structure from sliding.";
portDescArr[9] = "Demolished and rebuilt exterior load bearing side and rear walls. Designed and constructed supporting wood trusses to support the house while replacing walls.";
portDescArr[10] = "Provided engineering, construction and smoke remediation services to restore an existing Federal Government property that had suffered fire damage.";
portDescArr[11] = "Provided engineering, design and detailing, and structural steel for Marriott Hotel expansion project.";
portDescArr[12] = "Provided engineering, procurement and construction for the partial replacement of existing roof structure and the installation of a new EPDM (Ethylene Propylene Diene Monomer) roofing.";
portDescArr[13] = "Provided architecture, engineering and design for new schist stone addition to existing stone structure.";
portDescArr[14] = "CDCC performs over 100 structural evaluations per year.";

var portImageArr = new Array();
portImageArr[0] = "7";
portImageArr[1] = "0";
portImageArr[2] = "3";
portImageArr[3] = "0";
portImageArr[4] = "0";
portImageArr[5] = "0";
portImageArr[6] = "8";
portImageArr[7] = "3";
portImageArr[8] = "0";
portImageArr[9] = "0";
portImageArr[10] = "0";
portImageArr[11] = "0";
portImageArr[12] = "0";
portImageArr[13] = "0";
portImageArr[14] = "0";

//portfolio functions
function portfolioNav()
{
    var portNavContent = "";

    for (i = 0; i < portTitleArr.length; i++) {
        if (i == 0) {
            linestatus = "visible";
        }
        else {
            linestatus = "hidden";
        }
        portNavContent += "<a href='javascript: portfolioContent(" + i + ");' class='greylink'>" + portTitleArr[i] + "</a><br><div id='navitem_" + i + "' style='width:140px;height:1px;background-color:#0000B1;visibility:" + linestatus + ";'><img src='images/spacer.gif' style='width:140px;height:1px;' border='0'></div><br>";
    }
    return portNavContent;
}

function portfolioContent(id) {

    for (i = 0; i < portTitleArr.length; i++)
	{
	    if (i != id) {
	        document.getElementById('navitem_' + i).style.visibility = 'hidden';
	    }
	    else {
	        var portimageNav = "";
	        if (portImageArr[i] != "0") {
	            for (ii = 0; ii < portImageArr[i]; ii++) {
	                portimageNav = "<div class='portimageNavItem'><a href='javascript: setPortImage(" + i + "," + ii + ");'><img src='images/portfolio/portthumb_" + id + "_" + ii + ".jpg' border='0'></a></div>" + portimageNav;
	            }
	        }
	    }
	}
	document.getElementById('navitem_' + id).style.visibility = 'visible';
	
	var portContent = "";
	portContent += "<img src='images/portfolio/port_" + id + "_0.jpg' align='right' border='0' name='portimage'>";
	portContent += "<span class='blue_head_sm'>" + portTitleArr[id] + "</span><br>";
	portContent += portDescArr[id];
	portContent += "<div class='clear' style='height:5px;'>&nbsp;</div><div class='portimageHolder'>" + portimageNav + "<div class='clear' style='height:1px;'>&nbsp;</div></div>";
	//alert(portContent);
	document.getElementById('portdisplay').innerHTML = portContent;
}

function setPortImage(id,subid) {
    document.images['portimage'].src = "images/portfolio/port_" + id + "_" + subid + ".jpg";
}

//contact functions
var projid = 0;
var optionsArr = new Array();
var mailstat2 = false;

function contactContent(id,amount)
{

	if(id == 1)
	{
		document.getElementById('maincontent').style.height = '700px';
	}
	if(id == 2)
	{
		document.getElementById('maincontent').style.height = '600px';
	}
	
	for(i=1;i<=amount;i++)
	{
		if(i != id)
		{
			document.getElementById('navitem_' + i).style.visibility = 'hidden';
			document.getElementById('content_' + i).style.visibility = 'hidden';
			document.getElementById('mailaddress').style.visibility = 'hidden';
			document.getElementById('content_' + i).style.position = 'absolute';
			document.getElementById('content_' + i).style.top = '0px';
			document.getElementById('content_' + i).style.left = '0px';
		}
		if(id != 2)
		{
			document.getElementById('project_' + i).style.visibility = 'hidden';
			document.getElementById('c_hazmat_text').style.visibility = 'hidden';
			document.getElementById('r_add_rooms_text').style.visibility = 'hidden';
			document.getElementById('r_add_floors_text').style.visibility = 'hidden';		
		}
		else
		{
			if(projid != 0)
			{
				document.getElementById('project_' + projid).style.visibility = 'visible';
			}
			if(projid == 1)
			{
				document.getElementById('maincontent').style.height = '900px';
				for(i=0;i<3;i++)
				{
					if(optionsArr[i] == 'r_add_rooms')
					{
						document.getElementById('r_add_rooms_text').style.visibility = 'visible';
					}
					if(optionsArr[i] == 'r_add_floors')
					{
						document.getElementById('r_add_floors_text').style.visibility = 'visible';
					}
				}
			}
			if(projid == 2)
			{
				document.getElementById('maincontent').style.height = '1000px';
				for(i=0;i<3;i++)
				{
					if(optionsArr[i] == 'c_hazmat')
					{
						document.getElementById('c_hazmat_text').style.visibility = 'visible';
						document.getElementById('maincontent').style.height = '1120px';
					}
				}
				
			}
			
			if(mailstat2 != false)
			{
				document.getElementById('mailaddress').style.visibility = 'visible';
			}
			
		}
	}
	if(id == 2)
	{
		document.getElementById('navitem_' + id).style.visibility = 'visible';
		document.getElementById('content_' + id).style.visibility = 'visible';
		document.getElementById('content_' + id).style.position = 'relative';
		document.getElementById('content_' + id).style.top = '0px';
		document.getElementById('content_' + id).style.left = '0px';	
	}
	else
	{
		document.getElementById('navitem_' + id).style.visibility = 'visible';
		document.getElementById('content_' + id).style.visibility = 'visible';
		document.getElementById('content_' + id).style.position = 'relative';
		document.getElementById('content_' + id).style.top = '0px';
		document.getElementById('content_' + id).style.left = '0px';
	}
}

function showOptions(id)
{
	if(id == 'c_hazmat')
	{
		document.getElementById('maincontent').style.height = '1120px';
	}
	if(document.forms[1][id].checked == true)
	{
		document.getElementById(id + '_text').style.visibility='visible';
		document.getElementById(id + '_text').style.position='relative';
		document.getElementById(id + '_text').style.top='0px';
		document.getElementById(id + '_text').style.left='0px';
		optionsArr.push(id);		
	}
	else
	{
		document.getElementById(id + '_text').style.visibility='hidden';
		document.getElementById(id + '_text').style.position='absolute';
		document.getElementById(id + '_text').style.top='0px';
		document.getElementById(id + '_text').style.left='0px';
		for(i=0;i<optionsArr.length;i++)
		{
			if(optionsArr[i] == id)
			{
				var splicedArr = optionsArr.splice(i,i+1);
			}
		}
	}
}

function showType(id)
{
	var idselected = document.forms[1].project_type.selectedIndex;
	if(idselected != '0')
	{
		for(i=1;i<=2;i++)
		{
			document.getElementById('project_' + i).style.visibility = 'hidden';
			document.getElementById('project_' + i).style.height = '0px';
			document.getElementById('project_' + i).style.position = 'absolute';
		}
		
		document.getElementById('project_' + idselected).style.visibility = 'visible';
		document.getElementById('project_' + idselected).style.position = 'relative';
		document.getElementById('project_' + idselected).style.top = '0px';
		document.getElementById('project_' + idselected).style.left = '0px';
		projid = idselected;

		
			if(projid == '1')
			{
				document.getElementById('maincontent').style.height = '800px';
				for(i=0;i<optionsArr.length;i++)
				{
					if(optionsArr[i] == 'r_add_floors')
					{
						document.getElementById('r_add_floors_text').style.visibility = 'visible';
						document.getElementById('r_add_floors_text').style.position = 'relative';
						document.getElementById('r_add_floors_text').style.top = '0px';
						document.getElementById('r_add_floors_text').style.left = '0px';
					}
					if(optionsArr[i] == 'r_add_rooms')
					{
						document.getElementById('r_add_rooms_text').style.visibility = 'visible';
						document.getElementById('r_add_rooms_text').style.position = 'relative';
						document.getElementById('r_add_rooms_text').style.top = '0px';
						document.getElementById('r_add_rooms_text').style.left = '0px';
					}
					document.getElementById('c_hazmat_text').style.visibility = 'hidden';
				}
			}
			if(projid == '2')
			{
			
				document.getElementById('maincontent').style.height = '1000px';
				for(i=0;i<optionsArr.length;i++)
				{
					if(optionsArr[i] == 'c_hazmat')
					{
						document.getElementById('c_hazmat_text').style.position = 'relative';
						document.getElementById('c_hazmat_text').style.visibility = 'visible';
						document.getElementById('maincontent').style.height = '1500px';	
					}
					document.getElementById('r_add_rooms_text').style.visibility = 'hidden';
					document.getElementById('r_add_floors_text').style.visibility = 'hidden';
				}		
			}
	}
}

function mailShow()
{
	var mailstat1 = document.forms[1].address_same[0].checked;
	mailstat2 = document.forms[1].address_same[1].checked;
	
	if(mailstat1 == true)
	{
		document.getElementById('mailaddress').style.visibility = 'hidden';
		document.getElementById('mailaddress').style.position = 'absolute';	
	}
	if(mailstat2 == true)
	{
		document.getElementById('mailaddress').style.visibility = 'visible';
		document.getElementById('mailaddress').style.position = 'relative';
	}
	
	
}
