﻿var doneloading = 0;
var curArea = "";
function loadnav() {
  if (document.images) {

    nav_images = new Array("nav_home", "nav_aboutus", "nav_forsale", "nav_floorplans", "nav_features", "nav_testimonials", "nav_contactus"
    );
    for(i=0;i<nav_images.length;i++) {
      newimg = new Image();
      newimg.src = "/images/"+nav_images[i]+".gif";
      newimg = new Image();
      newimg.src = "/images/"+nav_images[i]+"_r.gif";
    }
    return 1;
  }
  return 0;
}
function setCurrent(img, doneloading) {
  var loaddone = typeof(doneloading);
  if (document.images && loaddone!= "undefined") {
    var typeofImg = eval("typeof(document.images['"+img+"'])");
    if(typeofImg!="undefined") {
      if(doneloading==1)
        eval("document."+img+".src = '/images/"+img+"_r.gif'");
    }
  }
}
function rollOn(img, doneloading) {
  if(img!=curArea) {
    var loaddone = typeof(doneloading);
    if (document.images && loaddone!= "undefined") {
      var typeofImg = eval("typeof(document.images['"+img+"'])");
      if(typeofImg!="undefined") {
        if(doneloading==1)
          eval("document."+img+".src = '/images/"+img+"_r.gif'");
      }
    }
  }
}
function rollOff(img, doneloading) {
  if(img!=curArea) {
    var typeofImg = eval("typeof(document.images['"+img+"'])");
    if(typeofImg!="undefined") {
      var loaddone = typeof(doneloading);
      if (document.images && loaddone!= "undefined") {
        if(doneloading==1)
          eval("document."+img+".src = '/images/"+img+".gif'");
      }
    }
  }
}

function setCss() {
  if (document.getElementById) {
    if(document.getElementById('panel_col1_inner') && document.getElementById('panel_col2_inner')) {
      //document.getElementById('panel_col1_inner').style.height = "auto";
      //document.getElementById('panel_col2_inner').style.height = "auto";
      if(document.getElementById('panel_col1_inner').offsetHeight > document.getElementById('panel_col2_inner').offsetHeight) {
        document.getElementById('panel_col2_inner').style.height = document.getElementById('panel_col1_inner').offsetHeight + "px";
        //alert("1");
      } else if(document.getElementById('panel_col1_inner').offsetHeight < document.getElementById('panel_col2_inner').offsetHeight) {
        document.getElementById('panel_col1_inner').style.height = document.getElementById('panel_col2_inner').offsetHeight + "px";
        //alert("2");
      }
    }
  }
}
function win(url, winname, winwidth, winheight) {
  offset=0;
  if (winwidth > screen.width) {
    winwidth = parseInt(screen.width)-200;
  }
  if (winheight > screen.height) {
    winheight = parseInt(screen.height)-200;
  }
  if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1) {
    eval(winname+"=window.open('"+url+"','"+winname+"','titlebar=yes,left='+(((parseInt(screen.width)/2)-parseInt(winwidth/2))+offset)+',top='+(((parseInt(screen.height)/2)-parseInt(winheight/2))+offset)+',status=yes,resizable=no,toolbar=no,scrollbars=no,menubar=no,Width='+winwidth+',Height='+winheight);");
  } else {
    eval(winname+"=window.open('"+url+"','"+winname+"','titlebar=yes,screenX='+(((parseInt(screen.width)/2)-parseInt(winwidth/2))+offset)+',screenY='+(((parseInt(screen.height)/2)-parseInt(winheight/2))+offset)+',status=yes,resizable=no,toolbar=no,scrollbars=no,menubar=no,Width='+winwidth+',Height='+winheight);");
  }
  eval(winname+".focus();");
}

var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;
var isIE4 = 0;
if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
if (withStyle == 1) {
    if (isID && document.getElementById(objectID)) { return (document.getElementById(objectID).style); }
else {
if (isAll) { return (document.all[objectID].style); }
else {
if (isLayers) { return (document.layers[objectID]); }
};}
}
else {
    if (isID && document.getElementById(objectID)) { return (document.getElementById(objectID)); }
else {
if (isAll) { return (document.all[objectID]); }
else {
if (isLayers) { return (document.layers[objectID]); }
};}
}
}

if ((navigator.userAgent.indexOf('MSIE') != -1)&&(navigator.userAgent.indexOf("4.") == -1))
  isIE4=1;

function setVisible(objectID) {
  var domNew = findDOM(objectID,1);
  if(domNew)
    domNew.display = "block";
}

function setHidden(objectID) {
  var domNew = findDOM(objectID,1);
  if(domNew)
    domNew.display = "none";
}

$(window).ready(function() {
    doneloading = loadnav();
    setCss();
    if (typeof (afterLoad) == "function") {
        afterLoad();
    }
    $("img[@src$=.png]").css('behavior', 'url("/include/pngbehavior.htc")');
});

//window.onload = function() {
//  doneloading = loadnav();
//  setCss();
//  if(typeof(afterLoad)=="function") {
//    afterLoad();
//  }
//}