var sampImage;
var fontFamily1="Monotype Corsiva";
function resizeCompany(){
var windowWidth, windowHeight, allResized;
	
	windowWidth=getWindowWidth();	
	windowHeight=getWindowHeight();
	myBorder=Math.round(windowWidth/1000)+"px solid #BF617E";
    myBorderWidth = Math.round(windowWidth/1000);
	myMargin=Math.round(windowWidth/150);
	
	if (!myCompany.appendChild(homePic1)) { return false; }
	if (!scaleToWidth(homePic1, mainDiv.offsetWidth)) { return false; }
	homePic1.style.position="absolute";
	homePic1.style.visibility="hidden";
	
//	greenPic.style.height=Math.round(homePic1.offsetHeight) + "px";
	
	//for the title text
	titleFontSize = Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myCompany.appendChild(comTitle)) { return false; }
	comTitle.style.top=myMargin*2.7 + "px";
	comTitle.style.left=Math.round(mainDiv.offsetWidth/42) + "px";
	comTitle.style.fontSize=titleFontSize;
	comTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	comTitle.style.position="absolute";
	
	//for the text of company profile
	fontSize=Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myCompany.appendChild(comTxt)) { return false; }
	comTxt.style.top=Math.round(homePic1.offsetHeight/6.5) + "px";
	comTxt.style.left=Math.round(homePic1.offsetWidth/6.5) + "px";
	comTxt.style.fontSize=fontSize;
	comTxt.style.position="absolute";
	
	if (!myCompany.appendChild(comTxt1)) { return false; }
	comTxt1.style.top=Math.round(homePic1.offsetHeight/4.8) + "px";
	comTxt1.style.left=Math.round(homePic1.offsetWidth/4.95) + "px";
	comTxt1.style.fontSize=fontSize;
	comTxt1.style.position="absolute";
	
	if (!myCompany.appendChild(comTxt2)) { return false; }
	comTxt2.style.top=Math.round(homePic1.offsetHeight/3.8) + "px";
	comTxt2.style.left=Math.round(homePic1.offsetWidth/4.2) + "px";
	comTxt2.style.fontSize=fontSize;
	comTxt2.style.position="absolute";
	
	if (!myCompany.appendChild(comTxt3)) { return false; }
	comTxt3.style.top=Math.round(homePic1.offsetHeight/3.2) + "px";
	comTxt3.style.left=Math.round(homePic1.offsetWidth/6.2) + "px";
	comTxt3.style.fontSize=fontSize;
	comTxt3.style.position="absolute";
	
	if (!myCompany.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 (!myCompany.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 (!myCompany.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 (!myCompany.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 (!myCompany.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 (!myCompany.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";
	myCompany.style.height = Math.round(homePic1.offsetHeight) + "px";

	myCompany.style.visibility="hidden";
	
	return true;
}

function createcompanyPage(){
	//create home page
	myCompany = createDiv();
	myCompany.style.position="absolute";
	clearMargins(myCompany);
	
	loading=displayText("Please wait Loading...");
	loading.style.visibility="hidden";
	loading.style.fontFamily="Trebuchet MS";
	mainDiv.appendChild(loading);
	
	//for the detection of the browser in our main picture
	if (browserInfo().browserShortName=="Firefox") {
		
		//alert("Firefox")				
		homePic1 = xImage("images/avp_bg3.jpg");
		homePic1.oncontextmenu=protectImage;
		
	} else { 
		if (browserInfo().browserShortName=="IE") {
			//alert("IE")
			homePic1 = xImage("images/avp_bg2.jpg");
			homePic1.style.height="620px";
			homePic1.oncontextmenu=protectImage;		
		}
		else {
			homePic1 = xImage("images/avp_bg2.jpg");
			homePic1.style.height="620px";
			homePic1.oncontextmenu=protectImage;
		}
	}
	//end of our browser detection
	
	comTitle = document.createElement("p");
	comTitle.innerHTML="Contact";
	comTitle.style.fontFamily="Trebuchet MS";
	comTitle.style.fontWeight="bolder";	
	comTitle.style.color = "#8E7070";
	clearMargins(comTitle);
	
	comTxt = document.createElement("p");
	comTxt.innerHTML="Office Address Baloy, Cagayan de Oro City";
	comTxt.style.fontFamily="Trebuchet MS";
	comTxt.style.fontWeight="bolder";
	comTxt.style.position = "absolute";
	comTxt.style.color = "#787274";
	clearMargins(comTxt);
	
	comTxt1 = document.createElement("p");
	comTxt1.innerHTML="Telephone No. 08822-732878";
	comTxt1.style.fontFamily="Trebuchet MS";
	comTxt1.style.fontWeight="bolder";
	comTxt1.style.position = "absolute";
	comTxt1.style.color = "#787274";
	clearMargins(comTxt1);
	
	comTxt2 = document.createElement("p");
	comTxt2.innerHTML="Fax No. 088-8552686";
	comTxt2.style.fontFamily="Trebuchet MS";
	comTxt2.style.fontWeight="bolder";
	comTxt2.style.position = "absolute";
	comTxt2.style.color = "#787274";
	clearMargins(comTxt2);
	
	comTxt3 = document.createElement("p");
	comTxt3.innerHTML="Email Address:<a href=\"mailto:info@avpconstruction.com\" style=text-decoration:none> info@avpconstruction.com";
	comTxt3.style.fontFamily="Trebuchet MS";
	comTxt3.style.fontWeight="bolder";
	comTxt3.style.position = "absolute";
	comTxt3.style.color = "#787274";
	clearMargins(comTxt3);
	
	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);
					
	myCompany.resize=resizeCompany;
		
return myCompany;
}	
