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

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

	myBorder=Math.round(bodyDiv.offsetWidth/600) + "px solid #000000";
    myBorderWidth = Math.round(windowWidth/1000);
	myMargin=Math.round(windowWidth/150);
	
	if (!myProjectsCertificates2.appendChild(certificateProjectsPic)) { return false; }
	if (!scaleToWidth(certificateProjectsPic, mainDiv.offsetWidth)) { return false; }
	certificateProjectsPic.style.position="absolute";
	certificateProjectsPic.style.visibility="hidden";
	
//	greenPic.style.height=Math.round(certificateProjectsPic.offsetHeight) + "px";
	
	titleFontSize = Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myProjectsCertificates2.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 (!myProjectsCertificates2.appendChild(projectsCertificatesTxt)) { return false; }
	projectsCertificatesTxt.style.top = myMargin*7.8 + "px";
	projectsCertificatesTxt.style.left = myMargin*7 + "px";
	projectsCertificatesTxt.style.fontSize = fontSizeTxt;
	projectsCertificatesTxt.style.width = Math.round(mainDiv.offsetWidth*0.7) + "px";
	projectsCertificatesTxt.style.position = "absolute";
	
	if (!myProjectsCertificates2.appendChild(docTxtDiv)) { return false; }
	docTxtDiv.style.width = Math.round(certificateProjectsPic.offsetWidth) + "px";
	docTxtDiv.style.height = Math.round(certificateProjectsPic.offsetHeight/2.3) + "px";
	docTxtDiv.style.top = Math.round((certificateProjectsPic.offsetHeight - docTxtDiv.offsetHeight)/6) + "px";
	docTxtDiv.style.position = "absolute";
	//docTxtDiv.style.visibility = "hidden";

	//for the thumbpics documents
	i=0;
	for (i=0; i<5; 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.7) + "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";
			
		}
	}
	
	if (!myProjectsCertificates2.appendChild(arrow1)) { return false; }	
	if (!scaleToWidth(arrow1, mainDiv.offsetWidth*0.04)) { return false; }
	arrow1.style.top=Math.round(certificateProjectsPic.offsetHeight/1.2) + "px";
	arrow1.style.left=Math.round(mainDiv.offsetWidth/2.18) + "px";
	arrow1.style.position="absolute";
	
	myProjectsCertificates2.style.height = Math.round(certificateProjectsPic.offsetHeight) + "px";
	
	return true;
}
	
function createCertificateProjectPage2() {
	//create company Docs page
	myProjectsCertificates2 = createDiv();
	myProjectsCertificates2.style.position="absolute";
	clearMargins(myProjectsCertificates2);
	
	loading=displayText("Please wait loading...");
	loading.style.visibility="visible";
	loading.style.fontFamily="Trebuchet MS";
	mainDiv.appendChild(loading);
	
	if (browserInfo().browserShortName=="Firefox") {
		
		//alert("Firefox")				
		certificateProjectsPic = xImage("images/avp_bg3.jpg");
		certificateProjectsPic.oncontextmenu=protectImage;
		
	} else if (browserInfo().browserShortName=="IE") {
	
		//alert("IE")
		certificateProjectsPic = xImage("images/avp_bg2.jpg");
		certificateProjectsPic.oncontextmenu=protectImage;
		certificateProjectsPic.style.height="620px";	
	}
	else {
		certificateProjectsPic = xImage("images/avp_bg2.jpg");
		certificateProjectsPic.oncontextmenu=protectImage;
		certificateProjectsPic.style.height="620px";	
	}
	
	projectsCertificatesTxt = document.createElement("p");
	projectsCertificatesTxt.innerHTML="AVP Construction is a certified construction company.<br/>Click on the image thumb to view its full-size.";
	projectsCertificatesTxt.style.fontFamily="Trebuchet MS";
	projectsCertificatesTxt.style.width="90%";
	projectsCertificatesTxt.style.fontWeight="bolder";
	projectsCertificatesTxt.style.position = "absolute";
	projectsCertificatesTxt.style.color = "#787274";
	clearMargins(projectsCertificatesTxt);
	
	image[0] = "images/certificateProject9.jpg";
	image[1] = "images/certificateProject10.jpg";
	image[2] = "images/certificateProject11.jpg";
	image[3] = "images/certificateProject12.jpg";
	image[4] = "images/certificateProject13.jpg";
	
	for(i = 0; i < image.length; i++) {
		docImage[i] = xImage(image[i]);
		docImage[i].oncontextmenu=protectImage;
		docImage[i].style.position = "absolute";
	}

	//for the title text
	docTitle = document.createElement("p");
	docTitle.innerHTML="Certificate of Projects 2-2";
	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/certificateProject9_thumb.jpg";
	obj.id[0] = "Bloomfields Davao - Constructions of Gates and Guardhouse";
	
	obj.image[1] = "images/certificateProject10_thumb.jpg";
	obj.id[1] = "Construction of 2.5 MW Minihydro Power Project at Ewon, Sevilla, Bohol";
	
	obj.image[2] = "images/certificateProject11_thumb.jpg";
	obj.id[2] = "Calamba Water Supply Project";
	
	obj.image[3] = "images/certificateProject12_thumb.jpg";
	obj.id[3] = "Lopez Jaena Water Supply Project";
	
	obj.image[4] = "images/certificateProject13_thumb.jpg";
	obj.id[4] = "Construction of New Municipal Building Phase at Poblacion, Libona, Bukidnon";
	
	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=docOver;
		docPic[i].onmouseout=docOut;
		docPic[i].xname=image[i];
		docPic[i].onclick=eventListener1;
	}
		//docPic[3].onclick=eventListener;
		//docPic[4].onclick=eventListener;
	
	arrow1 = xImage("images/arrow4.gif");
	arrow1.oncontextmenu=protectImage;
	arrow1.id="Certificate of Projects";
	arrow1.onclick=basicMenuClick;
	arrow1.style.cursor="pointer";
	
	myProjectsCertificates2.resize=resizeCertificateProject2;

return myProjectsCertificates2;
}

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 docOver(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
	}

	changeCursor(this);
	a = createP(this.id);
	docTxtDiv1.appendChild(a);
	docTxtDiv1.style.visibility="hidden";
	
	this.style.border = "1px solid yellow";		
					
	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((myProjectsCertificates2.offsetWidth - docTxtDiv1.offsetWidth)/2) + "px";
	
	fontSize=Math.round(bodyDiv.offsetWidth/80) + "px";
	a.style.fontSize=fontSize;
	a.style.margin=myMargin + "px";
}

function docOut(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
