<!--

//DEFAULT POPUP
var common = null;
function popUpCommon(url,parameters) {
  common = window.open(url,'definePopUp',parameters);
}
function obliterate() {
  if (common != null && common.open) common.close();
}
window.onfocus=obliterate;


//AUTOS ENLARGE IMAGE POPUP
var autosEnlange = null;
function popUpAutosEnlange(url) {
  autosEnlange = window.open(url,'imageWindow','width=425,height=293,scrollbars=no,resizable=yes,toolbar=no,left=50,top=50');
}


//AUTOS MORE POPUP
var More = null;
function openWindow(url) {
  More = window.open(url,'imageWindow','width=365,height=170,scrollbars=yes,resizable=yes,toolbar=no,left=50,top=50');
}


//RESOURCES CALCULATOR POPUPS
var Calculator = null;
function popUpCalculator(url) {
  Calculator = window.open(url,'imageWindow','width=620,height=399,scrollbars=no,resizable=yes,toolbar=no,left=50,top=50');
}


//MYBARGAINS SAVED ITEMS POPUP
var savedItems = null;
function popUpSavedItems(url) {
  savedItems = window.open(url,'detailsWindow','width=750,height=400,scrollbars=yes,resizable=yes,toolbar=no,left=50,top=50');
}


//HOMES DETAILS IMAGE POPUP
var detailsImage = null;
function popUpSDetailsImage(url) {
  detailsImage = window.open(url,'imageWindow','width=475,height=330,scrollbars=yes,resizable=yes,toolbar=no,left=50,top=50');
}

function openZipWindow(strField) {
	popupWin = window.open('/fe/zipPopup.aspx?ZipFieldName='+strField, 'remote', 'status,scrollbars=0,width=435,height=185,left=30,top=30')
}
		

//Expand & Collapse, as shown in Propert Reports
function expandCollapse(sId) {
	elem = document.getElementById(sId); 
	elem.style.display = (elem.style.display=='block'?'none':'block');
}

//used to show any element with an ID associated with it
function expandAll(sId) {
	elem = document.getElementById(sId); 
	if (!elem) {
        return false;
    }
    elem.style.display='block';
}

//used to hide any element with an ID associated with it
function collapseAll(sId) {
	elem = document.getElementById(sId);
	if (!elem) {
        return false;
    } 
	elem.style.display='none';
}

//TODAYS DATE AND OTHER DATE RELATED FUNCTIONS

function Now() { // Global Now() function
	return new Date();
}

var JANUARY   = 0; // Global Constants
var FEBRUARY  = 1;
var MARCH     = 2;
var APRIL     = 3;
var MAY       = 4;
var JUNE      = 5;
var JULY      = 6;
var AUGUST    = 7;
var SEPTEMBER = 8;
var OCTOBER   = 9;
var NOVEMBER  = 10;
var DECEMBER  = 11;

// Conversion factors as varants to eliminate all the multiplication
var SECONDS_CF     = 1000;
var MINUTES_CF     = 60000;          // 60 * 1000
var HOURS_CF       = 3600000;        // 60 * 60 * 1000
var DAYS_CF        = 86400000;       // 24 * 60 * 60 * 1000
var WEEKS_CF       = 604800000;      // 7 * 24 * 60 * 60 * 1000
var FORTNIGHTS_CF  = 1209600000;     // 14 * 24 * 60 * 60 * 1000
var MONTHS_CF      = 2592000000;     // 30 * 24 * 60 * 60 * 1000  (approx = 1 month)
var QUARTERS_CF    = 7776000000;     // 90 * 24 * 60 * 60 * 1000  (approx = 3 months)
var YEARS_CF       = 31557600000;    // 365 * 24 * 60 * 60 * 1000 (approx = 1 year)
var DECADES_CF     = 315576000000;   // 10 * 365 * 24 * 60 * 60 * 1000 (approx = 1 decade)
var CENTURIES_CF   = 3155760000000;  // 100 * 365 * 24 * 60 * 60 * 1000 (approx = 1 century)

Date.prototype.addMilliseconds = function(ms) {  // Non-destructive instance methods
  return new Date(new Date().setTime(this.getTime() + (ms)));  
}
Date.prototype.addSeconds = function(s) {
  return this.addMilliseconds(s * SECONDS_CF);
}
Date.prototype.addMinutes = function(m) {
  return this.addMilliseconds(m * MINUTES_CF);
}
Date.prototype.addHours = function(h) {
  return this.addMilliseconds(h * HOURS_CF);
}
Date.prototype.addDays = function(d) {
  return this.addMilliseconds(d * DAYS_CF);  
}
Date.prototype.addWeeks = function(w) {
  return this.addMilliseconds(w * WEEKS_CF);  
}
Date.prototype.getMonthName = function() {
  var index = (0 == arguments.length) ? this.getMonth() : arguments[0];
  switch(index) {
    case JANUARY: 
      return "January";
    case FEBRUARY: 
      return "February";
    case MARCH: 
      return "March";
    case APRIL: 
      return "April";
    case MAY: 
      return "May";
    case JUNE: 
      return "June";
    case JULY: 
      return "July";
    case AUGUST: 
      return "August";
    case SEPTEMBER: 
      return "September";
    case OCTOBER: 
      return "October";
    case NOVEMBER: 
      return "November";
    case DECEMBER: 
      return "December";
    default:
      throw "Invalid month index: " + index.toString();
  }
}
Date.prototype.noon = function() {
  var dt = this.clone();
  dt.setHours(12);
  dt.setMinutes(0);
  dt.setSeconds(0);
  dt.setMilliseconds(0);
  return dt;
}
Date.prototype.clone = function() {
  var dt = new Date();
  dt.setTime(this.getTime());  
  return dt;
}
Date.nextWeek = function() {  
  return new Date().noon().addWeeks(1);
}
//-->