﻿

var myWindow = null;
         
function openWindow(pageHtml, widthPage, heightPage) 
{
          
    if(myWindow == null || myWindow.closed)
    {
        // open window centered 
         var width = widthPage;
         var height = heightPage;
         var left = parseInt((screen.availWidth/2) - (width/2));
         var top = parseInt((screen.availHeight/2) - (height/2));
         var windowFeatures = "width=" + width + ",height=" + height + ",menubar=no,scrollbars=yes,toolbar=no,status=no,close=no,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
         myWindow = window.open(pageHtml, "newCenteredWindow", windowFeatures);
     }
     else
     {
          myWindow.focus();
     } 

         
}


function submitLocation(myLocation)
{
  location = myLocation.options[myLocation.selectedIndex].value;
}


/* Highlight active or current link from the Main Menu with the current style */
function highlight_current_link_main_menu(nav_list) {

          var this_page = document.location.href;
          this_page = this_page.substring(this_page.lastIndexOf("/")+1);
       
          $(nav_list).each(function(){
             
             var page_href =  $(this).attr("href");
             page_href = page_href.substring(page_href.lastIndexOf("/")+1);
                       
             if (this_page == page_href) {
                $(this).addClass("current");
             }
          });
 }

/* Highlight active or current link from Communities Left Menu  with the current style */
function highlight_active_links(nav_list, base_url) {

          $(nav_list).each(function(){
         
            var current_href = $(this).attr("href"); 
            
            if (!$.browser.msie) {
              current_href = base_url + current_href;
             }
            
            if (document.location.href == current_href) {
                $(this).addClass("current");
            }
          });
 }
 
 
/*  Show  Elevations and Floor Plans in Home Design detail  */
    function changeHomePhoto(imgObjName)
    {
        if (document.images)
	     {
	       document.images['imgHome'].src = eval(imgObjName + ".src");
          }
    }
    
   function changeImage(imgName,imgObjName)
   {

    if (document.images)
	 {
       document.images[imgName].src = eval(imgObjName + ".src");	  
     }
   }
 


// Prevent error dialogs from displaying -which is the window's normal
// behavior- by overriding the default event handler for error events that
// go to the window.
function noError(){return true;}
window.onerror = noError;
      
 


