/*#################  NEW WINDOW SCRIPT ############################## */

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Updated by: Mike Weiner :: http://www.wearebent.com 
Original author: Eric King (eric_andrew_king@hotmail.com)
Last Updated: May 2006

Changes: Added parameters for optional scrollbars, resizablility,
menubar, toolbar, addressbar, statusbar, fullscreen. Also tweaked the
implementation a bit - links will now give the user a popup window
even if JavaScript is disabled.

Notes: Some parameters are not cross-browser capable (e.g. fullscreen).
Browsers that do not support these abilities will ignore them.

Usage: The link is written as follows: 
onclick="newWindow(this.href, 'popup', 600, 500, 1, 1, 0, 0, 0, 1, 0); return false;"

Usage Description:
"this.href" refers to the URL given in the "a" tag; "'popup'" is the name of the popup window;
600 is the width of the popup window; 500 is the height of the popup window; the numbers that
follow designate whether a property is turned on ("1") or off ("0"), in this order:
scrollbars, resizable, menubar, toolbar, addressbar, statusbar, fullscreen
*/

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}

/*#################  END OF NEW WINDOW SCRIPT ######################## */
// 
// To close an intermediary popup after opening a pdf in main window
//
//-- call the func like this
// <a href="#" onclick="openLinkClosePopup(this.href, 800, 800); return false;">Open another annoying popup</a>

function openLinkClosePopup(url, wdth, hght) {
    newWindow(url, 'popup', wdth, hght, 1, 1, 0, 0, 0, 1, 0);
    self.close()
  }

/*#################  OLD WINDOW SCRIPT ############################## */

/* This script will close open a link the parent of a child window and then close the child */

function oldWindow(windowURL)
{
	opener.location=windowURL;
	self.close();
}
// JavaScript Document
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
Displays "original" image. On yr/m/d, it switches to "replacement" image */
//Cameron Mann, October 2008 to make it do the right thing :)

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function change_on_date(yr,m,d,original,originallink,replacement,replacementlink){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)

if (difference>0){
  document.write("<a href=\""+originallink+"\"> <img src=\""+original+"\" border=0></a>"); //original image
   }
 else{
  document.write("<a href=\""+replacementlink+"\"> <img src=\""+replacement+"\" border=0></a>"); //on and after change date
   } 
}
//enter the count down date using the format year/month/day

