// JavaScript Document
var sampImage;
var fontFamily1="Trebuchet MS";
//var equipmentList = new Array();
var list = new Array();

function resizeEquipment(){ 
var windowWidth, windowHeight, allResized;
	
	windowWidth=getWindowWidth();	
	windowHeight=getWindowHeight();
	myMargin=Math.round(windowWidth/150);
	myBorder=Math.round(windowWidth/1000)+"px solid #BF617E";
    myBorderWidth = Math.round(windowWidth/1000);
	
	if (!myEquipment.appendChild(equipmentPic)) { return false; }
	if (!scaleToWidth(equipmentPic, mainDiv.offsetWidth)) { return false; }
	equipmentPic.style.position="absolute";
	equipmentPic.style.visibility="hidden";
	
	//for the title text
	titleFontSize = Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myEquipment.appendChild(equipmentTitle)) { return false; }
	equipmentTitle.style.top=myMargin*2.7 + "px";
	equipmentTitle.style.left=Math.round(mainDiv.offsetWidth/42) + "px";
	equipmentTitle.style.fontSize=titleFontSize;
	equipmentTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	equipmentTitle.style.position="absolute";
	
	fontSize=Math.round(bodyDiv.offsetWidth/70) + "px"; 
	
	for(i=0;i<list.length; i++) {
		if (!myEquipment.appendChild(list[i])) { return false; }
		list[i].style.position="absolute";
		if(i==0) {
			list[i].style.top=myMargin*6 + "px";
		}
		else {
			list[i].style.top = Math.round(list[i-1].offsetTop + list[i-1].offsetHeight + list[i-1].offsetHeight * 0.35) + "px";
		}
		list[i].style.fontSize=fontSize;
		list[i].style.left=Math.round(mainDiv.offsetWidth/8) + "px";
	}
	
	if (!myEquipment.appendChild(newsBg)) { return false; }
	if (!scaleToWidth(newsBg, mainDiv.offsetWidth*0.32)) { return false; }
	newsBg.style.left = Math.round(mainDiv.offsetWidth/1.55) + "px";
	newsBg.style.top = myMargin*6.5 + "px"; //verticalLine.offsetTop + "px";
	
	if (!myEquipment.appendChild(news1)) { return false; }
	news1.style.left = Math.round(mainDiv.offsetWidth/1.43) + "px";
	news1.style.top = newsBg.offsetTop + newsBg.offsetHeight*3.8 + "px";
	news1.style.fontSize = fontSizeTxt;
	
	if (!myEquipment.appendChild(verticalLine)) { return false; }
	verticalLine.style.left = Math.round(mainDiv.offsetWidth/1.55) + "px";
	verticalLine.style.top = newsBg.offsetHeight + newsBg.offsetTop + "px";
	if(!scaleToWidth(verticalLine, mainDiv.offsetWidth*0.002)) { return false; }
	
	if (!myEquipment.appendChild(latestProjects)) { return false; }
	if (!scaleToWidth(latestProjects, mainDiv.offsetWidth*0.32)) { return false; }
	latestProjects.style.left = newsBg.offsetLeft + "px";
	latestProjects.style.top = myMargin*25.8 + "px";
	
	if (!myEquipment.appendChild(latestProjects1)) { return false; }
	if (!scaleToWidth(latestProjects1, mainDiv.offsetWidth*0.21)) { return false; }
	latestProjects1.style.left = latestProjects.offsetLeft*1.12 + "px";
	latestProjects1.style.top = myMargin*32.7 + "px";
	latestProjects1.style.border = "1px solid orange";
	
	if (!myEquipment.appendChild(latestProjects2)) { return false; }
	if (!scaleToWidth(latestProjects2, mainDiv.offsetWidth*0.21)) { return false; }
	latestProjects2.style.left = latestProjects1.offsetLeft + "px";
	latestProjects2.style.top = latestProjects1.offsetTop + latestProjects1.offsetHeight*1.2 + "px";
	latestProjects2.style.border = "1px solid orange";
	myEquipment.style.height = Math.round(equipmentPic.offsetHeight) + "px";
	
	myEquipment.style.height = Math.round(equipmentPic.offsetHeight) + "px";
				
	myEquipment.style.visibility="hidden";
	
	return true;
}

function createEquipmentPage(){
	//create home page
	myEquipment = createDiv();
	myEquipment.style.position="absolute";
	clearMargins(myEquipment);
	
	loading=displayText("Please wait Loading...");
	loading.style.visibility="hidden";
	loading.style.fontFamily="verdana";
	mainDiv.appendChild(loading);

	//for the detection of the browser in our main picture
	if (browserInfo().browserShortName=="Firefox") {
		
		//alert("Firefox")				
		equipmentPic = xImage("images/avp_bg3.jpg");
		equipmentPic.oncontextmenu=protectImage;
		
	} else { 
		if (browserInfo().browserShortName=="IE") {
			//alert("IE")
			equipmentPic = xImage("images/contentphotobg.png");
			equipmentPic.oncontextmenu=protectImage;
			equipmentPic.style.height="620px";		
		}
		else {
			equipmentPic = xImage("images/contentphotobg.png");
			equipmentPic.oncontextmenu=protectImage;
			equipmentPic.style.height="620px";
		}
	}
	//end of our browser detection
	
	//for the title 
	equipmentTitle = document.createElement("p");
	equipmentTitle.innerHTML="Equipments";
	equipmentTitle.style.fontFamily="Trebuchet MS";
	equipmentTitle.style.fontWeight="bolder";	
	equipmentTitle.style.color = "#8E7070";
	clearMargins(equipmentTitle);
	
	equipmentList = new Array(   '10 Units Dump Truck',
								 '5 Units Bulldozer',
								 '6 Units Road Grader',
								 '6 Units Payloader',
								 '4 Units Road Roller (10 Tonner)',
								 '5 Units Vibratory Roller',
								 '15 Units Backhoe',
								 '5 Units Isuzu Elf / Canter',
								 '2 Units Isuzu Pick-up',
								 '1 Unit Nissan Power Pick-up',
								 '1 Unit Toyota Pick-up',
								 '6 Units Transit Mixer',
								 '2 Units 10 Wheeler Water Truck',
								 '1 Unit Nissan Patrol',
								 '1 Unit Toyota Grandia',
								 '1 Unit Toyota Prado',
								 '2 Units Air Compressor',
								 'Batching Plant',
								 '7 Units (1 Bagger) Concrete Mixer',
								 '8 Units Concrete Vibrator',
								 '2 Units Plate Compactor',
								 '6 Units Water Pump',
								 '4 Units Engine Driven Welding Machine',
								 '14 Units Electric Welding Machine');
								
	for(i=0;i<equipmentList.length; i++) {
		equipments = document.createElement("p");
		equipments.innerHTML = equipmentList[i];
		equipments.style.fontFamily="Trebuchet MS";
		equipments.style.fontWeight="bolder";
		equipments.style.position = "absolute";
		equipments.style.color = "#787274";
		clearMargins(equipments);
		list[i]=equipments;
	}
	
	verticalLine = xImage("images/verticalLine.gif");
	verticalLine.style.position="absolute";
	clearMargins(verticalLine);
	
	newsBg = xImage("images/newsbg.jpg");
	newsBg.alt="AVP Construction News";
	newsBg.title="AVP Construction News";
	newsBg.style.position = "absolute";
	clearMargins(newsBg);
	
	news1 = createP("No news at the moment...");
	news1.style.position = "absolute";
	news1.style.fontFamily="Trebuchet MS";
	news1.style.fontWeight="bolder";
	news1.style.color = "#787274";
	clearMargins(news1);
	
	latestProjects = xImage("images/featuredprojectsbg.jpg");
	latestProjects.style.position = "absolute";
	clearMargins(latestProjects);
	
	latestProject1Big = xImage("images/bohol_plaza_visual.jpg");
	latestProject1Big.style.position = "absolute";
	clearMargins(latestProject1Big);
	
	latestProjects1 = xImage("images/bohol_plaza_visual_thumb.jpg");
	latestProjects1.style.position = "absolute";
	latestProjects1.alt = "Bohol Plaza Resort and Restaurant";
	latestProjects1.title = "Bohol Plaza Resort and Restaurant";
	latestProjects1.xname="images/bohol_plaza_visual.jpg";
	latestProjects1.onclick=eventListener1;
	latestProjects1.onmouseover=function() { this.style.cursor="pointer"; this.style.border="1px solid yellow" };
	latestProjects1.onmouseout=function() { this.style.border="1px solid orange" };
	//latestProjects1.onmouseover = function() { onMouseOver3(latestProject1Big); };
	//latestProjects1.onmouseout = function() { onMouseOut3(latestProject1Big); };
	clearMargins(latestProjects1);
	
	latestProject2Big = xImage("images/boheco_bohol.jpg");
	latestProject2Big.style.position = "absolute";
	clearMargins(latestProject2Big);
	
	latestProjects2 = xImage("images/boheco_bohol_thumb.jpg");
	latestProjects2.style.position = "absolute";
	latestProjects2.alt = "BOHECO Bohol";
	latestProjects2.title = "BOHECO Bohol";
	latestProjects2.xname="images/boheco_bohol.jpg";
	latestProjects2.onclick=eventListener1;
	latestProjects2.onmouseover=function() { this.style.cursor="pointer"; this.style.border="1px solid yellow" };
	latestProjects2.onmouseout=function() { this.style.border="1px solid orange" };
	clearMargins(latestProjects2);
	
	myEquipment.resize=resizeEquipment;
		
return myEquipment;
}	
