/*window.onload=resizefix*/

//window.onload=cycleBan;

var rotatorImg = new Array();
// Enter the names of the images below
rotatorImg[0]="./images/builder/img_1.jpg";
rotatorImg[1]="./images/builder/img_2.jpg";
rotatorImg[2]="./images/builder/img_3.gif";

var newRotator = 0;
var totalBan = rotatorImg.length;

function cycleBan() {
  newRotator++;
  if (newRotator == totalBan) {
    newRotator = 0;
  }
  if(typeof document.rotator != "undefined"){
	document.rotator.src=rotatorImg[newRotator];
  }
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleBan()", 5*1000);
}


window.onResize=resizefix

function resizefix()
{
	var heightBr;
	
	heightBr = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight);
	/*alert("heightBr = " + heightBr);*/
	return heightBr;
}

function CreateTbl(tblHeight)
{
	var theH;
	if(tblHeight <= 600)
	{
		theH = tblHeight + 168;
	}
	else
	{
		theH = tblHeight - 10;
	}
	this.Text = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"980\" height=\"" + theH + "\" align=\"center\" class=\"outer\">";
}


function CreateTR(tblHeight)
{
	var theH;
	if(tblHeight <= 600)
	{
		theH = tblHeight + 24;
	}
	else
	{
		theH = tblHeight - 175;
	}
	this.Text = "<tr height=\"" + theH + "\" >";
}


var winOpener;
function WinOpen(){

	if(winOpener!=null && !winOpener.closed){  
		winOpener.close();
	}
	
	var imgID = GetImgSRC();
	var curURL = location.href;
	//alert("curURL = " + curURL);
	var URL = "tour.aspx?img=" + imgID
	if(curURL.indexOf("_S")!=-1)
		URL += "&pg=rent";
	//alert("URL = " + URL);
	winOpener=window.open(URL, "Tour", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=985,height=660,left=30, top=10");
	
	if (navigator.appName == "Netscape"){ 
		winOpener.window.focus();
	}
	else{
		winOpener.focus();
			
	}
}

function GetImgSRC(){
	return document.previewIMG.src;
}

browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3)) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)))

        if ( browser) {
                thereOff = new MakeImageArray(5)
                thereOn = new MakeImageArray(5)
                
                homeOff = new MakeImageArray(11)
                homeOn = new MakeImageArray(11)
    
                thereOn[1].src = "images/services/consultation.jpg"
                thereOn[2].src = "images/services/plan.jpg"
                thereOn[3].src = "images/services/construction.jpg"
                thereOn[4].src = "images/services/buy.jpg"
                
                homeOn[1].src = "images/home/normal/arapia.jpg"
                homeOn[2].src = "images/home/normal/botanic.jpg"
                homeOn[3].src = "images/home/normal/chocolate.jpg"
                homeOn[4].src = "images/home/normal/perla.jpg"
                homeOn[5].src = "images/home/normal/orchid.jpg"
                homeOn[6].src = "images/home/normal/lily.jpg"
                homeOn[7].src = "images/home/normal/lilac.jpg"
                homeOn[8].src = "images/home/normal/crocus.jpg"
                homeOn[9].src = "images/home/normal/tulip.jpg"
                homeOn[10].src = "images/home/normal/gentian.jpg"
                
                homeOff[1].src = "images/home/small/arapia.jpg"
                homeOff[2].src = "images/home/small/botanic.jpg"
                homeOff[3].src = "images/home/small/chocolate.jpg"
                homeOff[4].src = "images/home/small/perla.jpg" 
                homeOff[5].src = "images/home/small/orchid.jpg"
                homeOff[6].src = "images/home/small/lily.jpg"
                homeOff[7].src = "images/home/small/lilac.jpg"
                homeOff[8].src = "images/home/small/crocus.jpg"
                homeOff[9].src = "images/home/small/tulip.jpg"
                homeOff[10].src = "images/home/small/gentian.jpg"
                }           
//----------------------------------------------------------------------   
       function MakeImageArray(n) {

              this.length = n
              for (var i = 1; i<=n; i++) {
                      this[i] = new Image();
               }
              return this;
      }
      
      function MouseOver (what, num) {
                if ( browser) { 
					document.images[what].src = homeOn[num].src;
					document.images[what].width = 256;
					document.images[what].height = 128;
                }
        }
//----------------------------------------------------------------------   
        function MouseOut (what, num, curNode) {
                 if ( browser) { 
                     document.images[what].src = homeOff[num].src;
                     document.images[what].width = 200;
					document.images[what].height = 100;
                 }                   
        }
//----------------------------------------------------------------------     
        function msover (what, num) {
                if ( browser) { 
					document.images[what].src = thereOn[num].src;
                }
        }
//----------------------------------------------------------------------   
        function msout (what, num, curNode) {
                 if ( browser) { 
					PopulateThereOffImg(curNode);
                     document.images[what].src = thereOff[num].src;
                 }                   
        }
//---------------------------------------------------------------------------------------------------
		function PopulateThereOffImg(curNode) {
			if(curNode == "consultation")
					ThereOffImg("images/services/consultation.jpg");
			else if(curNode == "design")
					ThereOffImg("images/services/plan.jpg");
			else if(curNode == "construction")
					ThereOffImg("images/services/construction.jpg");
			else if(curNode == "buy")
					ThereOffImg("images/services/buy.jpg");
			else
					ThereOffImg("images/services/consultation_2.jpg");
		}
		
		function ThereOffImg(imgPath){
			for(var i = 1; i<=4; i++) {
                     thereOff[i].src = imgPath;
              }
		}
