﻿function MM_preloadImages() { //v3.0
  var d = document; if (d.images) {
    if (!d.MM_p) d.MM_p = new Array();
    var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
      if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
  }
}

function pop(mypage, myname, w, h, scroll) {
  LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
  TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
  settings = "height=" + h + ",width=" + w + ",top=" + TopPosition + ",left=" + LeftPosition + ",scrollbars=" + scroll + ",resizable";
  win = window.open(mypage, myname, settings)
}

function MaxWords80(src, args) {
  args.IsValid = (document.getElementById(src.controltovalidate).value.split(" ").length <= 80);
}
function MaxWords150(src, args) {
  args.IsValid = (document.getElementById(src.controltovalidate).value.split(" ").length <= 150);
}
function MaxWords250(src, args) {
  args.IsValid = (document.getElementById(src.controltovalidate).value.split(" ").length <= 250);
}

var ocfg; // Old Color For Grid
function hlrowfg(obj, cr) { // Highlight Row For Grid
  obj = trcrow(obj);
  ocfg = obj.style.backgroundColor;
  obj.style.backgroundColor = cr;
}
function dlrowfg(obj) { // Downlight Row For Grid
  obj = trcrow(obj);
  obj.style.backgroundColor = ocfg;
}
function trcrow(obj) { // Find TR of ROW
  if (obj.tagName == "TR") {
    return obj;
  } else {
    return trcrow(obj.parentElement);
  }
}


$(document).ready(function() {
  MM_preloadImages('/images/Header_Logo.jpg'
  , '/images/Home_btn.gif'
  , '/images/Home_btn_over.gif'
  , '/images/BTN_SellAHouse_sml.gif'
  , '/images/BTN_SellAHouse_sml_over.gif'
  , '/images/BTN_BuyAHouse_sml.gif'
  , '/images/BTN_BuyAHouse_sml_over.gif'
  , '/images/BTN_Register_sml.gif'
  , '/images/BTN_Register_sml_over.gif'
  , '/images/BTN_BuyAHouse_Click.gif'
  , '/images/BTN_BuyAHouse_Click_OVR.gif'
  , '/images/BTN_SellAHouse_Click.gif'
  , '/images/BTN_SellAHouse_Click_OVR.gif'
  , '/images/BTN_Register_Click.gif'
  , '/images/BTN_Register_Click_OVR.gif'
  , '/images/BTN_Flag_AU.jpg'
  , '/images/BTN_Flag_NZ.jpg'
  , '/images/BTN_Flag_UK.jpg'
  , '/images/BTN_Flag_US.jpg'
  , '/images/Flag_Large_AU.gif'
  , '/images/Flag_Large_NZ.gif'
  , '/images/Flag_Large_UK.gif'
  , '/images/Flag_Large_US.gif'
  , '/images/ajax-loader-bar.gif'
  , '/images/ajax-loader-circle.gif'
  , '/images/ajax-loader-dot.gif'
  );
  $(".rollover").hover(function() {
    var currentImg = $(this).attr("src");
    $(this).attr("src", $(this).attr("hover"));
    $(this).attr("hover", currentImg);
  }, function() {
    var currentImg = $(this).attr("src");
    $(this).attr("src", $(this).attr("hover"));
    $(this).attr("hover", currentImg);
  });

  $(".jumpmenu").change(function() {
    window.location = $(this).val();
  });
});


