﻿var sampImage;
var fontFamily1="Monotype Corsiva";
var docImage = new Array();
var imageVis = new Array();
var docPic = new Array();
var obj = new Object();
obj.image = new Array();
obj.id = new Array();

function resizeCompanyDoc(){
var windowWidth, windowHeight, allResized;
	
	windowWidth=getWindowWidth();	
	windowHeight=getWindowHeight();

	myBorder=Math.round(bodyDiv.offsetWidth/600) + "px solid #000000";
    myBorderWidth = Math.round(windowWidth/1000);
	
	if (!myProjectVisual.appendChild(ProjectVisualPic)) { return false; }
	if (!scaleToWidth(ProjectVisualPic, mainDiv.offsetWidth)) { return false; }
	ProjectVisualPic.style.position="absolute";
	ProjectVisualPic.style.visibility="hidden";
	
//	greenPic.style.height=Math.round(ProjectVisualPic.offsetHeight) + "px";
	
	titleFontSize = Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myProjectVisual.appendChild(docTitle)) { return false; }
	docTitle.style.top=myMargin*2.7 + "px";
	docTitle.style.left=Math.round(mainDiv.offsetWidth/42) + "px";
	docTitle.style.fontSize=titleFontSize;
	docTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	docTitle.style.position="absolute";
	
	fontSizeTxt=Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myProjectVisual.appendChild(ProjectVisualTxt)) { return false; }
	ProjectVisualTxt.style.top = myMargin*7.8 + "px";
	ProjectVisualTxt.style.left = myMargin*7 + "px";
	ProjectVisualTxt.style.fontSize = fontSizeTxt;
	ProjectVisualTxt.style.width = Math.round(mainDiv.offsetWidth*0.7) + "px";
	ProjectVisualTxt.style.position = "absolute";
	
	if (!myProjectVisual.appendChild(docTxtDiv)) { return false; }
	docTxtDiv.style.width = Math.round(ProjectVisualPic.offsetWidth) + "px";
	docTxtDiv.style.height = Math.round(ProjectVisualPic.offsetHeight/2.3) + "px";
	docTxtDiv.style.top = Math.round((ProjectVisualPic.offsetHeight - docTxtDiv.offsetHeight)/6) + "px";
	docTxtDiv.style.position = "absolute";
	//docTxtDiv.style.visibility = "hidden";

	//for the thumbpics documents
	i=0;
	for (i=0; i<7; i++) {
		if (!docTxtDiv.appendChild(docPic[i])) { return false; }
		if (!scaleToWidth(docPic[i], bodyDiv.offsetWidth*0.13)) { return false; }
		//if (!scaleToHeight(docPic[i], bodyDiv.offsetHeight*0.13)) { return false; }
		docPic[i].style.position = "absolute";
		docPic[i].style.border = "1px solid orange";	
		
		if ( i==0) {
		
			docPic[i].style.top=Math.round((docTxtDiv.offsetHeight - docPic[i].offsetHeight)/2) + "px";
			docPic[i].style.left=Math.round(docTxtDiv.offsetWidth/15) + "px";
			
		}else if (i>0 && i %4== 0) {
		
			docPic[i].style.top=Math.round(docPic[i-1].offsetTop + docPic[i-1].offsetHeight + myMargin*5.5) + "px";
			docPic[i].style.left=Math.round(docPic[0].offsetLeft) + "px";
			
		}else if (i>0 && i<4) {
		
			docPic[i].style.top=Math.round((docTxtDiv.offsetHeight - docPic[i].offsetHeight)/2) + "px";
			docPic[i].style.left=Math.round(docPic[i-1].offsetLeft + docPic[i-1].offsetWidth + myMargin*5) + "px";
			
		}else if (i>0 && i>4) {
		
			docPic[i].style.top=Math.round(docPic[i-1].offsetTop) + "px";
			docPic[i].style.left=Math.round(docPic[i-1].offsetLeft + docPic[i-1].offsetWidth + myMargin*5) + "px";
			
		}
	}
	
	myProjectVisual.style.height = Math.round(ProjectVisualPic.offsetHeight) + "px";
	
	return true;
}
	
function createprojectVisualPage() {
	//create company Docs page
	myProjectVisual = createDiv();
	myProjectVisual.style.position="absolute";
	clearMargins(myProjectVisual);
	
	loading=displayText("Please wait Loading...");
	loading.style.visibility="hidden";
	loading.style.fontFamily="verdana";
	mainDiv.appendChild(loading);
	
	if (browserInfo().browserShortName=="Firefox") {
		
		//alert("Firefox")				
		ProjectVisualPic = xImage("images/avp_bg3.jpg");
		ProjectVisualPic.oncontextmenu=protectImage;
		
	} else if (browserInfo().browserShortName=="IE") {
	
		//alert("IE")
		ProjectVisualPic = xImage("images/avp_bg2.jpg");
		ProjectVisualPic.oncontextmenu=protectImage;
		ProjectVisualPic.style.height="620px";	
	}
	else {
		//alert("IE")
		ProjectVisualPic = xImage("images/avp_bg2.jpg");
		ProjectVisualPic.oncontextmenu=protectImage;
		ProjectVisualPic.style.height="620px";	
	}
	
	ProjectVisualTxt = document.createElement("p");
	ProjectVisualTxt.innerHTML="AVP Construction has been part of more than 50 major projects.<br/>Click on the image thumb to view its full-size.";
	ProjectVisualTxt.style.fontFamily="Trebuchet MS";
	ProjectVisualTxt.style.width="90%";
	ProjectVisualTxt.style.fontWeight="bolder";
	ProjectVisualTxt.style.position = "absolute";
	ProjectVisualTxt.style.color = "#787274";
	clearMargins(ProjectVisualTxt);
	
	//image[0] = "images/businessPermit.jpg";
	imageVis[0] = "images/bohol_plaza_visual.jpg";
	imageVis[1] = "images/davao_bloomfields.jpg";
	imageVis[2] = "images/koresco_condominium.jpg";
	imageVis[3] = "images/koresco_dormitory.jpg";
	imageVis[4] = "images/vista_verde.jpg";
	imageVis[5] = "images/richmond.jpg";
	imageVis[6] = "images/boheco_bohol.jpg";
	
	/*
	image[5] = "images/Big1.jpg";
	image[6] = "images/Big2.jpg";
	image[7] = "images/Big3.jpg";
	image[8] = "images/Big4.jpg";
	image[9] = "images/Big5.jpg";
	*/
	for(i = 0; i < imageVis.length; i++) {
		docImage[i] = xImage(imageVis[i]);
		docImage[i].oncontextmenu=protectImage;
		docImage[i].style.position = "absolute";
	}

	//for the title text
	docTitle = document.createElement("p");
	docTitle.innerHTML="Projects Visual";
	docTitle.style.fontFamily="Trebuchet MS";
	docTitle.style.fontWeight="bolder";	
	docTitle.style.color = "#8E7070";
	clearMargins(docTitle);
	
	docTxtDiv = createDiv();
	
	docTxtDiv1 = createDiv();
	docTxtDiv1.style.position = "absolute";
	docTxtDiv.appendChild(docTxtDiv1);
	
	obj.image[0] = "images/bohol_plaza_visual_thumb.jpg";
	obj.id[0] = "Bohol Plaza";
	
	obj.image[1] = "images/davao_bloomfields_thumb.jpg";
	obj.id[1] = "Davao Bloomfields";
	
	obj.image[2] = "images/koresco_condominium_thumb.jpg";
	obj.id[2] = "Koresco Condominium";
	
	obj.image[3] = "images/koresco_dormitory_thumb.jpg";
	obj.id[3] = "Koresco Dormitory";
	
	obj.image[4] = "images/vista_verde_thumb.jpg";
	obj.id[4] = "Vista Verde Village";
	
	obj.image[5] = "images/richmond_thumb.jpg";
	obj.id[5] = "Richmond Gate and Guardhouse";
	
	obj.image[6] = "images/boheco_bohol_thumb.jpg";
	obj.id[6] = "Boheco Bohol";

	/*
	obj.image[5] = "images/6.jpg";
	obj.id[5] = "Robinson's Homes Inc.<br>Certificate of Completion";
	obj.image[6] = "images/7.jpg";
	obj.id[6] = "LOPEZ JAENA<br>Certificate of Completion";
	obj.image[7] = "images/8.jpg";
	obj.id[7] = "BOHECO 1<br>Certificate of Completion";
	obj.image[8] = "images/9.jpg";
	obj.id[8] = "Robinson's Homes Inc.<br>Certificate of Completion";
	obj.image[9] = "images/10.jpg";
	obj.id[9] = "Bubunawan Power Company<br>Certificate of Completion"; 
	*/

	for(i = 0; i < obj.image.length; i++) {
		docPic[i] = xImage(obj.image[i]);
		docPic[i].oncontextmenu=protectImage;
		docPic[i].id = obj.id[i];
		//Attribute "alt" and "title" added
		docPic[i].alt = obj.id[i];
		docPic[i].title = obj.id[i];
		//docPic[i].style.border = "1px solid #DDC460";
		docPic[i].onmouseover=docOverProjectVis;
		docPic[i].onmouseout=docOutProjectVis;
		docPic[i].xname=imageVis[i];
		docPic[i].onclick=eventListener1;
	}
		//docPic[3].onclick=eventListener;
		//docPic[4].onclick=eventListener;
		
	myProjectVisual.resize=resizeCompanyDoc;

return myProjectVisual;
}

function eventListener1(){
var windowWidth, windowHeight;
        windowWidth=getWindowWidth();
        windowHeight=getWindowHeight();
		
        if(typeof(this.xname)!="undefined"){
                height=Math.round(windowHeight*.8);
            	width=Math.round(windowWidth*.4);
                window.status="Width"+width+" Height"+height;
                window.imageName=this.xname
                //createCookie("Popup", this.xname, 0);
                openWindow("pop1.htm", 100, 100, width, height);
        }
        else{
                width=Math.round(windowWidth*.5);
                height=Math.round(windowHeight*.5);
                window.imageName=this.id;
                //createCookie("Popup", this.xname, 0);
                openWindow("pop1.htm", 100, 100, width, height);
        }
}

function eventListener(){
var windowWidth, windowHeight;
        windowWidth=getWindowWidth();
        windowHeight=getWindowHeight();
        if(typeof(this.xname)!="undefined"){
                  height=Math.round(windowHeight*.6);
            width=Math.round(windowWidth*.5);
                window.status="Width"+width+" Height"+height;
                window.imageName=this.xname
                //createCookie("Popup", this.xname, 0);
                openWindow("pop.htm", 100, 100, width, height);
        }
        else {
                width=Math.round(windowWidth*.5);
                height=Math.round(windowHeight*.5);
                window.imageName=this.id;
                //createCookie("Popup", this.xname, 0);
                openWindow("pop.htm", 100, 100, width, height);
        }
}

function docOverProjectVis(evt) {
var windowWidth, windowHeight;
var srcElement, evtptr;

	if (typeof(evt)=="object") {		//--- Firefox
		evtptr=evt;
	}
	else {
		evtptr=window.event;			//----Internet Explorer
	}
	if (typeof(evtptr.target)=="object") {		//--- Firefox
		srcElement=evtptr.target;
	}
	else {
		srcElement=evtptr.srcElement;			//--- Internet Explorer
	}
	
	this.style.border = "1px solid yellow";	
	
	changeCursor(this);
	a = createP(this.id);
	docTxtDiv1.appendChild(a);
	docTxtDiv1.style.visibility="hidden";
					
	docTxtDiv1.style.top=Math.round(docTxtDiv.offsetTop - myMargin*4) + "px";
	docTxtDiv1.style.width=Math.round(mainDiv.offsetWidth*0.3) + "px";
	docTxtDiv1.style.left=Math.round((myProjectVisual.offsetWidth - docTxtDiv1.offsetWidth)/2) + "px";
	
	fontSize=Math.round(bodyDiv.offsetWidth/80) + "px";
	a.style.fontSize=fontSize;
	a.style.margin=myMargin + "px";
}

function docOutProjectVis(evt) {
	var srcElement, evtptr;
	
	if (typeof(evt)=="object") {		//--- Firefox
		evtptr=evt;
	}
	else {
		evtptr=window.event;			//----Internet Explorer
	}
	if (typeof(evtptr.target)=="object") {		//--- Firefox
		srcElement=evtptr.target;
	}
	else {
		srcElement=evtptr.srcElement;			//--- Internet Explorer
	}
		docTxtDiv1.style.visibility="hidden";
		if (docTxtDiv1.appendChild(a)) 
		docTxtDiv1.removeChild(a);		
	
	this.style.border = "1px solid orange";
	
}// JavaScript Document
