// JavaScript Document
var sampImage;
var fontFamily1="Monotype Corsiva";
smallPics4 = new Array();
bigPics = new Array();
imagesPic = new Array();
var obj1 = new Object();
obj1.image1 = new Array();
obj1.id = new Array();

function resizeVista(){
var windowWidth, windowHeight, allResized;
	
	windowWidth=getWindowWidth();	
	windowHeight=getWindowHeight();
	myBorder=Math.round(windowWidth/1000)+"px solid #BF617E";
    myBorderWidth = Math.round(windowWidth/1000);
	
	myVista.style.height=Math.round(mainDiv.offsetHeight) + "px";
	myVista.style.width=Math.round(mainDiv.offsetWidth) + "px";
	
	if (!myVista.appendChild(homePic4)) { return false; }
	if (!scaleToWidth(homePic4, mainDiv.offsetWidth*0.8)) { return false; }
	homePic4.style.position="absolute";
	homePic4.style.visibility="hidden";
//	greenPic.style.height=Math.round(homePic4.offsetHeight) + "px";
	
	if (!scaleToWidth(whitePic, mainDiv.offsetWidth)) { return false; }
	if (!myVista.appendChild(whitePic)) { return false; }
	whitePic.style.height=Math.round(homePic4.offsetHeight) + "px";
	whitePic.style.position="absolute";
	whitePic.style.visibility="hidden";	
	
	//for the title text
	fontSize=Math.round(bodyDiv.offsetWidth/30) + "px";
	if (!myVista.appendChild(vistaTitle)) { return false; }
	vistaTitle.style.top=myMargin*3 + "px";
	vistaTitle.style.left=myMargin*1.5 + "px";
	vistaTitle.style.margin=myMargin + "px";
	vistaTitle.style.fontSize=fontSize;
	vistaTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	vistaTitle.style.position="absolute";
	
	//for the sub title
	fontSize=Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myVista.appendChild(vistasubTitle)) { return false; }
	vistasubTitle.style.top=myMargin*8 + "px";
	vistasubTitle.style.left=Math.round(mainDiv.offsetWidth/8) + "px";
	vistasubTitle.style.margin=myMargin + "px";
	vistasubTitle.style.fontSize=fontSize;
	vistasubTitle.style.width=Math.round(mainDiv.offsetWidth*0.5) + "px";
	vistasubTitle.style.position="absolute";
	
	//for the text 
	fontSize=Math.round(bodyDiv.offsetWidth/40) + "px";
	if (!myVista.appendChild(vistaTxt)) { return false; }
	vistaTxt.style.top=Math.round(homePic4.offsetHeight/5) + "px";
	vistaTxt.style.left=Math.round(mainDiv.offsetWidth/11) + "px";
	vistaTxt.style.fontSize=fontSize;
	vistaTxt.style.position="absolute";
	
	fontSize=Math.round(bodyDiv.offsetWidth/70) + "px";
	if (!myVista.appendChild(vistaTxt1)) { return false; }
	vistaTxt1.style.top=Math.round(homePic4.offsetHeight/3.5) + "px";
	vistaTxt1.style.left=Math.round(mainDiv.offsetWidth/6.5) + "px";
	vistaTxt1.style.width=Math.round(mainDiv.offsetWidth/1.5) + "px";
	vistaTxt1.style.fontSize=fontSize;
	vistaTxt1.style.position="absolute";
	
	//alert(a);
	if (!myVista.appendChild(vistaDiv1)) { return false; }	
	vistaDiv1.style.position="absolute";
	vistaDiv1.style.top=Math.round(vistasubTitle.offsetTop + vistasubTitle.offsetHeight + myMargin*3) + "px";
	vistaDiv1.style.left=Math.round(mainDiv.offsetWidth*0.02) + "px";
	
	if (!myVista.appendChild(vistaDiv)) { return false; }
	vistaDiv.style.width=Math.round(mainDiv.offsetWidth*0.9) + "px";	
	vistaDiv.style.left=Math.round((mainDiv.offsetWidth - vistaDiv.offsetWidth)/2) + "px";
	vistaDiv.style.position="absolute";
	
	if (!vistaDiv1.appendChild(a)) { return false; }
	if (!scaleToWidth(a, mainDiv.offsetWidth*0.951)) { return false; }
	a.style.position="absolute";
	
	vistaDiv1.style.height=Math.round(a.offsetHeight + myMargin*2) + "px";
	
	//for the top of our thumbpics
	if(a.style.visibility =="hidden") {
		vistaDiv.style.top=Math.round(homePic4.offsetHeight*0.44) + "px";
	} else {
		//alert(a.offsetTop + " " + a.offsetHeight);
		vistaDiv.style.top=Math.round(vistaDiv1.offsetTop + vistaDiv1.offsetHeight + myMargin*3) + "px";
	}
	
	i=0;
	for (i=0; i<smallPics4.length; i++) { 
			if (!vistaDiv.appendChild(smallPics4[i])) { return false; }
			if (!scaleToWidth(smallPics4[i], mainDiv.offsetWidth*0.066)) { return false; }
			smallPics4[i].style.position="absolute";
			smallPics4[i].style.visibility="visible";
			
		if (i==0) {	
			smallPics4[i].style.bottom="0px";
			smallPics4[i].style.left=Math.round(vistaDiv.offsetWidth*0.02) + "px";
		
		} else if (i>0) {
			smallPics4[i].style.top=Math.round(smallPics4[i-1].offsetTop) + "px";
			smallPics4[i].style.left=Math.round(smallPics4[i-1].offsetLeft + smallPics4[i-1].offsetWidth + myMargin*1.5) + "px"; 
		}	
	
	vistaDiv.style.height=Math.round(smallPics4[i].offsetHeight) + "px";
	}
	
	//for the height of the vistaDiv1 division
	vistaDiv1.style.width=Math.round(a.offsetWidth) + "px";
	
	//for the name of the building
	fontSize=Math.round(bodyDiv.offsetWidth/80) + "px";
	txt2.style.top=Math.round(a.offsetTop + a.offsetHeight + myMargin) + "px";
	txt2.style.right="0px";
	txt2.style.fontSize=fontSize;
	txt2.style.margin=myMargin + "px";
					
	myVista.style.height = Math.round(homePic4.offsetHeight) + "px";

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

function createvistaPage(){
	//create home page
	myVista = createDiv();
	myVista.style.position="absolute";
	clearMargins(myVista);
	
	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")				
		homePic4 = xImage("images/vista_bg2.jpg");
		homePic4.oncontextmenu=protectImage;
		
	} else { if (browserInfo().browserShortName=="IE") {
	
		//alert("IE")
		homePic4 = xImage("images/vista_bg1.jpg");
		homePic4.oncontextmenu=protectImage;
		homePic4.style.height="620px";		
		}
		homePic4 = xImage("images/vista_bg1.jpg");
		homePic4.oncontextmenu=protectImage;
		homePic4.style.height="620px";	
		//clearMargins(homePic4);
	}
	//end of our browser detection
	
	whitePic = xImage("images/white.jpg");
	whitePic.style.visibility="hidden";	
	
	//for the title of the page
	vistaTitle= document.createElement("p");
	vistaTitle.innerHTML="Vista Verde Village";
	vistaTitle.style.fontFamily="monotype corsiva";
	vistaTitle.style.textDecoration="underline";
	vistaTitle.style.fontWeight="bold";
	
	vistasubTitle= document.createElement("p");
	vistasubTitle.innerHTML="Pueblo de Oro Township, Cagayan de Oro City";
	vistasubTitle.style.fontFamily="verdana";
	vistasubTitle.style.fontWeight="bold";
	
	vistaTxt= document.createElement("p");
	vistaTxt.innerHTML="Mission&nbsp;Statement";
	vistaTxt.style.fontFamily="verdana";
	
	vistaTxt1= document.createElement("p");
	vistaTxt1.innerHTML="We are committed to be highly competitive and profitable in all business operations in the field of construction, environmental, engineering and management.";
	vistaTxt1.style.textAlign="justify";
	vistaTxt1.style.fontFamily="verdana";
	
	arrPrev = new Array("images/bigThumb1.jpg", "images/bigThumb2.jpg", "images/bigThumb3.jpg", "images/bigThumb4.jpg", "images/bigThumb5.jpg", "images/bigThumb6.jpg", "images/bigThumb7.jpg");
	
	for(i = 0; i < arrPrev.length; i++) {
		bigPics[i] = xImage(arrPrev[i]);
		bigPics[i].oncontextmenu=protectImage;
		bigPics[i].style.position="absolute";
	}
	
	vistaDiv1 = createDiv();
	vistaDiv1.style.visibility="hidden";
	
	vistaDiv = createDiv();
	
	obj1.image1[0]="images/thumb1.jpg";
	obj1.id[0]="Club House";
	obj1.image1[1]="images/thumb2.jpg";
	obj1.id[1]="Club House";	
	obj1.image1[2]="images/thumb3.jpg";
	obj1.id[2]="Club House";
	obj1.image1[3]="images/thumb4.jpg";
	obj1.id[3]="Club House";
	obj1.image1[4]="images/thumb5.jpg";
	obj1.id[4]="Entrance Gate";
	obj1.image1[5]="images/thumb6.jpg";
	obj1.id[5]="Club House";
	obj1.image1[6]="images/thumb7.jpg";
	obj1.id[6]="Club House";
			
	for(i = 0; i < obj1.image1.length; i++) {
		smallPics4[i] = xImage(obj1.image1[i]);
		smallPics4[i].oncontextmenu=protectImage;
		smallPics4[i].onclick=thumbClick;
		smallPics4[i].id=arrPrev[i];
		smallPics4[i].nameId2=obj1.id[i];
		smallPics4[i].onmouseover=onMouseOver;
		smallPics4[i].style.visibility="hidden";
		vistaDiv.appendChild(smallPics4[i]);
	}
	
	a = xImage("images/bigThumb1.jpg");
	a.oncontextmenu=protectImage;
	a.style.visibility="hidden";
	
	txt2 = createP("Club House");
	txt2.style.position="absolute";
	txt2.style.visibility="hidden";
	vistaDiv1.appendChild(txt2);	
			
	myVista.resize=resizeVista;
		
return myVista;
}

function thumbClick() {
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
	}
	
vistaTxt.style.visibility="hidden";
vistaTxt1.style.visibility="hidden";
homePic4.style.visibility="hidden";
vistaDiv1.style.visibility="visible";
//whitePic.style.visibility="visible";
a.style.visibility="visible";
txt2.style.visibility="visible";
vistaDiv.style.top=Math.round(vistaDiv1.offsetTop + vistaDiv1.offsetHeight + myMargin*3) + "px";

	//alert(this.id);
	a.src=this.id;
	
	txt2.innerHTML=this.nameId2;
		 	
	//alert("width " + a.offsetWidth);
	//alert("height " + a.offsetHeight);						
}	
