// JavaScript Document
var sampImage;
var fontFamily1="Monotype Corsiva";
var obj2 = new Object();
obj2.image2 = new Array();
obj2.id = new Array();
smallPics5 = new Array();
bigPics1 = new Array();
var obj3 = new Object();
obj3.image3 = new Array();
obj3.id = new Array();
smallPics6 = new Array();
bigPics2 = new Array();

function resizePueblo(){
var windowWidth, windowHeight, allResized;
	
	windowWidth=getWindowWidth();	
	windowHeight=getWindowHeight();
	myBorder=Math.round(windowWidth/1000)+"px solid #BF617E";
    myBorderWidth = Math.round(windowWidth/1000);
	
	if (!myPueblo.appendChild(homePic10)) { return false; }
	if (!scaleToWidth(homePic10, mainDiv.offsetWidth)) { return false; }
	homePic10.style.position="absolute";
	homePic10.style.visibility="hidden";
//	greenPic.style.height=Math.round(homePic10.offsetHeight) + "px";
	
	if (!myPueblo.appendChild(whitePic1)) { return false; }
	if (!scaleToWidth(whitePic1, mainDiv.offsetWidth)) { return false; }
	whitePic1.style.height=Math.round(homePic10.offsetHeight) + "px";
	whitePic1.style.position="absolute";
	whitePic1.style.visibility="hidden";
	
	//for the title text
	fontSize=Math.round(bodyDiv.offsetWidth/30) + "px";
	if (!myPueblo.appendChild(puebloTitle)) { return false; }
	puebloTitle.style.top=myMargin*3 + "px";
	puebloTitle.style.left=myMargin*1.5 + "px";
	puebloTitle.style.margin=myMargin + "px";
	puebloTitle.style.fontSize=fontSize;
	puebloTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	puebloTitle.style.position="absolute";
	
	//for the sub title
	fontSize=Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myPueblo.appendChild(pueblosubTitle)) { return false; }
	pueblosubTitle.style.top=myMargin*8 + "px";
	pueblosubTitle.style.left=Math.round(mainDiv.offsetWidth/8) + "px";
	pueblosubTitle.style.margin=myMargin + "px";
	pueblosubTitle.style.fontSize=fontSize;
	pueblosubTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	pueblosubTitle.style.position="absolute";
	
	//alert(a);
	if (!myPueblo.appendChild(puebloDiv1)) { return false; }	
	puebloDiv1.style.position="absolute";
	puebloDiv1.style.top=Math.round(pueblosubTitle.offsetTop + pueblosubTitle.offsetHeight + myMargin) + "px";
	puebloDiv1.style.left=Math.round(mainDiv.offsetWidth*0.02) + "px";
	
	if (!myPueblo.appendChild(puebloDiv)) { return false; }
	puebloDiv.style.width=Math.round(mainDiv.offsetWidth*0.9) + "px";
	puebloDiv.style.left=Math.round(mainDiv.offsetWidth*0.015) + "px";
	puebloDiv.style.position="absolute";
	//for the left of our Division
	if(c.style.visibility =="hidden" && bd.style.visibility =="hidden") {
		puebloDiv.style.left=Math.round(mainDiv.offsetWidth*0.1) + "px";
	} else {
		//alert(a.offsetTop + " " + a.offsetHeight);
		puebloDiv.style.left=Math.round(mainDiv.offsetWidth*0.015) + "px";
	}
	
	//for the thumbpiscs
	x=0;
	for (x=0; x<smallPics5.length; x++) { 
			if (!puebloDiv.appendChild(smallPics5[x])) { return false; }
			if (!scaleToWidth(smallPics5[x], mainDiv.offsetWidth*0.066)) { return false; }
			smallPics5[x].style.position="absolute";
			smallPics5[x].style.visibility="visible";
			
		if (x==0) {	

			smallPics5[x].style.bottom="0px";
			smallPics5[x].style.left=Math.round(puebloDiv.offsetWidth*0.002) + "px";
		
		} else if (x>0) {
			smallPics5[x].style.top=Math.round(smallPics5[x-1].offsetTop) + "px";
			smallPics5[x].style.left=Math.round(smallPics5[x-1].offsetLeft + smallPics5[x-1].offsetWidth + myMargin*1.5) + "px"; 
		}
	puebloDiv.style.height=Math.round(smallPics5[x].offsetHeight) + "px";		
	}
	
	if (!puebloDiv1.appendChild(bd)) { return false; }
	if (!scaleToWidth(bd, bodyDiv.offsetWidth*0.496)) { return false; }
	bd.style.position="absolute";
	bd.style.right="0px";
	bd.style.height=Math.round(homePic10.offsetHeight*0.664) + "px";
	
	//for the name of the building
	fontSize=Math.round(bodyDiv.offsetWidth/80) + "px";
	txt.style.top=Math.round(bd.offsetTop + bd.offsetHeight + myMargin) + "px";
	txt.style.right="0px";
	txt.style.fontSize=fontSize;
	txt.style.margin=myMargin + "px";
	
	//for the thumbpics
	i=0;
	for (i=0; i<smallPics6.length; i++) { 
			if (!puebloDiv.appendChild(smallPics6[i])) { return false; }
			if (!scaleToWidth(smallPics6[i], mainDiv.offsetWidth*0.066)) { return false; }
			smallPics6[i].style.position="absolute";
			smallPics6[i].style.visibility="visible";
			
		if (i==0) {	
	
			smallPics6[i].style.bottom="0px";
			smallPics6[i].style.left=Math.round(smallPics5[1].offsetLeft + smallPics5[1].offsetWidth + myMargin*1.5) + "px";
		
		} else if (i>0) {
			smallPics6[i].style.top=Math.round(smallPics6[i-1].offsetTop) + "px";
			smallPics6[i].style.left=Math.round(smallPics6[i-1].offsetLeft + smallPics6[i-1].offsetWidth + myMargin*1.5) + "px"; 
		}		
	}
	
	if (!puebloDiv1.appendChild(c)) { return false; }
	if (!scaleToWidth(c, bodyDiv.offsetWidth*0.74)) { return false; }
	c.style.position="absolute";
	c.style.height=Math.round(homePic10.offsetHeight*0.45) + "px";
	
	puebloDiv1.style.width=Math.round(c.offsetWidth + myMargin) + "px";
	
	puebloDiv1.style.height=Math.round(c.offsetHeight) + "px";
	
	//for the top of our thumbpics
	if(c.style.visibility =="hidden" && bd.style.visibility =="hidden") {
		puebloDiv.style.top=Math.round(homePic10.offsetHeight*0.35) + "px";
	} else {
		//alert(a.offsetTop + " " + a.offsetHeight);
		puebloDiv.style.top=Math.round(puebloDiv1.offsetTop + puebloDiv1.offsetHeight + myMargin*3) + "px";
	}
	
	//for the name of the building
	fontSize=Math.round(bodyDiv.offsetWidth/80) + "px";
	txt1.style.top=Math.round(c.offsetTop + c.offsetHeight + myMargin) + "px";
	txt1.style.right="0px";
	txt1.style.fontSize=fontSize;
	txt1.style.margin=myMargin + "px";
				
	myPueblo.style.height = Math.round(homePic10.offsetHeight) + "px";

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

function createpuebloPage(){
	//create home page
	myPueblo = createDiv();
	myPueblo.style.position="absolute";
	clearMargins(myPueblo);
	
	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")				
		homePic10 = xImage("images/vista_bg2.jpg");
		homePic10.oncontextmenu=protectImage;
		
	} else { if (browserInfo().browserShortName=="IE") {
	
		//alert("IE")
		homePic10 = xImage("images/vista_bg1.jpg");
		homePic10.oncontextmenu=protectImage;
		homePic10.style.height="620px";		
		}
		else{
		
		homePic10 = xImage("images/vista_bg1.jpg");
		homePic10.oncontextmenu=protectImage;
		homePic10.style.height="620px";	
		}
	}
	//end of our browser detection
	
	whitePic1 = xImage("images/white.jpg");
	//whitePic1.src="images/white.jpg";
	whitePic1.style.visibility="hidden";
	
	//for the title of the page
	puebloTitle= document.createElement("p");
	puebloTitle.innerHTML="Pueblo de Oro Projects";
	puebloTitle.style.fontFamily="monotype corsiva";
	puebloTitle.style.textDecoration="underline";
	puebloTitle.style.fontWeight="bold";
	
	pueblosubTitle= document.createElement("p");
	pueblosubTitle.innerHTML="Pueblo de Oro Township, Cagayan de Oro City";
	pueblosubTitle.style.fontFamily="verdana";
	pueblosubTitle.style.fontWeight="bold";
	
	arrPrev1 = new Array("images/bigThumb9.jpg", "images/bigThumb11.jpg");
	arrPrev2 = new Array("images/bigThumb8.jpg", "images/bigThumb10.jpg");
	
	for(x = 0; x < arrPrev1.length; x++) {
		bigPics1[x] = xImage(arrPrev1[x]);
		bigPics1[x].oncontextmenu=protectImage;
		bigPics1[x].style.position="absolute";
	}
	
	for(i = 0; i < arrPrev1.length; i++) {
		bigPics2[i] = xImage(arrPrev2[i]);
		bigPics2[i].oncontextmenu=protectImage;
		bigPics2[i].style.position="absolute";
	}
	
	puebloDiv1 = createDiv();
	puebloDiv1.style.visibility="hidden";
	
	puebloDiv = createDiv();

	obj2.image2[0]="images/thumb9.jpg";
	obj2.id[0]="Koresco Condominium";
	obj2.image2[1]="images/thumb11.jpg";
	obj2.id[1]="Hillsborough";
	
			
	for(x = 0; x < obj2.image2.length; x++) {
		smallPics5[x] = xImage(obj2.image2[x]);
		smallPics5[x].oncontextmenu=protectImage;
		smallPics5[x].onclick=thumbClick1;
		smallPics5[x].id1=arrPrev1[x];
		smallPics5[x].nameId=obj2.id[x];
		smallPics5[x].onmouseover=onMouseOver;
		smallPics5[x].style.visibility="hidden";
		puebloDiv.appendChild(smallPics5[x]);
	}
	
	obj3.image3[0]="images/thumb8.jpg";
	obj3.id[0]="Koresco Dormitory";
	obj3.image3[1]="images/thumb10.jpg";
	obj3.id[1]="Hillsborough";
			
	for(i = 0; i < obj3.image3.length; i++) {
		smallPics6[i] = xImage(obj3.image3[i]);
		smallPics6[i].oncontextmenu=protectImage;
		smallPics6[i].onclick=thumbClick2;
		smallPics6[i].id2=arrPrev2[i];
		smallPics6[i].nameId1=obj3.id[i];
		smallPics6[i].onmouseover=onMouseOver;
		smallPics6[i].style.visibility="hidden";
		puebloDiv.appendChild(smallPics6[i]);
	}
	
	bd = xImage("images/bigThumb9.jpg");
	bd.oncontextmenu=protectImage;
	bd.style.visibility="hidden";
//alert(b);	
	txt = createP("Koresco Condominium");
	txt.style.position="absolute";
	txt.style.visibility="hidden";
	puebloDiv1.appendChild(txt);
	
	c = xImage("images/bigThumb8.jpg");
	c.oncontextmenu=protectImage;
	c.style.visibility="hidden";
	
	txt1 = createP("Koresco Dormitory");
	txt1.style.position="absolute";
	txt1.style.visibility="hidden";
	puebloDiv1.appendChild(txt1);
				
	myPueblo.resize=resizePueblo;
		
return myPueblo;
}	

function thumbClick1() {
var windowWidth, windowHeight;
var srcElement, evtptr;
	windowWidth=getWindowWidth();
	windowHeight=getWindowHeight();

	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
	}
	
homePic10.style.visibility="hidden";
puebloDiv1.style.visibility="visible";
whitePic1.style.visibility="hidden";
bd.style.visibility="visible";
c.style.visibility="hidden";
txt.style.visibility="visible";
txt1.style.visibility="hidden";
puebloDiv.style.top=Math.round(puebloDiv1.offsetTop + puebloDiv1.offsetHeight + myMargin*3) + "px";
puebloDiv.style.left=Math.round(mainDiv.offsetWidth*0.015) + "px";

	//alert(this.id1);
	bd.src=this.id1;
	
	txt.innerHTML=this.nameId;
	//alert(this.nameId);	
		 	
	//alert("width " + b.offsetWidth);
	//alert("height " + b.offsetHeight);						
}	

function thumbClick2() {
var windowWidth, windowHeight;
var srcElement, evtptr;
	windowWidth=getWindowWidth();
	windowHeight=getWindowHeight();

	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
	}
	
homePic10.style.visibility="hidden";
puebloDiv1.style.visibility="visible";
whitePic1.style.visibility="visible";
c.style.visibility="visible";
bd.style.visibility="hidden";
txt.style.visibility="hidden";
txt1.style.visibility="visible";
puebloDiv.style.top=Math.round(puebloDiv1.offsetTop + puebloDiv1.offsetHeight + myMargin*3) + "px";
puebloDiv.style.left=Math.round(mainDiv.offsetWidth*0.015) + "px";

	//alert(this.id1);
	c.src=this.id2;
	
	txt1.innerHTML=this.nameId1;
	//alert(this.nameId1);	
	 	
	//alert("width " + b.offsetWidth);
	//alert("height " + b.offsetHeight);						
}	
