/*  Prototype JavaScript framework
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/


//note: this is a stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).

var Class = {
  create: function() {
    return function() { 
      this.initialize.apply(this, arguments);
    }
  }
}

Object.extend = function(destination, source) {
  for (property in source) {
    destination[property] = source[property];
  }
  return destination;
}

Function.prototype.bind = function(object) {
  var __method = this;
  return function() {
    return __method.apply(object, arguments);
  }
}

function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}

//-------------------------

document.getElementsByClassName = function(className) {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();
  
  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements.push(child);
        break;
      }
    }
  }
  
  return elements;
}

//-------------------------

if (!window.Element) {
  var Element = new Object();
}

Object.extend(Element, {
  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
  },

  hasClassName: function(element, className) {
    element = $(element);
    if (!element)
      return;
    var a = element.className.split(' ');
    for (var i = 0; i < a.length; i++) {
      if (a[i] == className)
        return true;
    }
    return false;
  },

  addClassName: function(element, className) {
    element = $(element);
    Element.removeClassName(element, className);
    element.className += ' ' + className;
  },
  
  removeClassName: function(element, className) {
    element = $(element);
    if (!element)
      return;
    var newClassName = '';
    var a = element.className.split(' ');
    for (var i = 0; i < a.length; i++) {
      if (a[i] != className) {
        if (i > 0)
          newClassName += ' ';
        newClassName += a[i];
      }
    }
    element.className = newClassName;
  },
  
  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    for (var i = 0; i < element.childNodes.length; i++) {
      var node = element.childNodes[i];
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
        Element.remove(node);
    }
  }
});
/*	sIFR 2.0.1
	Copyright 2004 - 2005 Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben

	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.charAt(b.indexOf(".")-1))>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("\\b"+k[1]+"\\b")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("\\b"+f[3]+"\\b")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m)f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d)f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a)f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.charAt(aj.indexOf(".")-1))}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<124)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312)||f.n;return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&f.p))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||(al.body==null||al.getElementsByTagName("body").length==0))return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();

if (
	typeof sIFR == "function" && !sIFR.UA.bIsIEMac && !((navigator.userAgent.toLowerCase().indexOf("opera") != -1 || window.opera) && navigator.userAgent.toLowerCase().indexOf("mac") != -1) && !(navigator.userAgent.toLowerCase().indexOf("omniweb") != -1)) {
		sIFR.setup();
};

// Flexible JavaScript Events - John Resig
// http://ejohn.org/projects/flexible-javascript-events/

// Ammended to rewrite window.onload as window.DOMContentLoaded where available (Firefox/Gecko)

function addEvent( obj, type, fn )
{	
	if (obj == window && type == "load" && window.addEventListener) {
		window.addEventListener("DOMContentLoaded", function(e) {
			fn(e);
			fn.done = true;
		}, false);
	}
	
	if (obj.addEventListener) {
		if (obj == window && type == "load") {
			obj.addEventListener( type, function(e) {
				if (!fn.done) {
					fn(e);
				}
			}, false );			
		} else {
			obj.addEventListener(type, fn, false);
		}
	} else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

// Fix Array.push() for IE 5.0
// from sIFR - http://www.mikeindustries.com/sifr/

/* IE 5.0 does not support the push method, so here goes */
if(Array.prototype.push == null){
	Array.prototype.push = function(){
		var i = 0, index = this.length, limit = arguments.length;
		while(i < limit){
			this[index++] = arguments[i++];
		};
		return this.length;
	};
};	

// Slices lists into smaller lists, mainly to be used as visual columns
// Dependent on Prototype.lite or greater
function slice_list(original_list, options) {
	// Setup the default options
	default_options = {
		max_lists: null,
		min_lists: 1,
		max_items: null, // unimplemented
		min_items: 1//,
	};
	
	// We return an array of the generated lists.
	var generated_lists = [];
	
	// Find original list(s) (parameter can be an HTML id string, an HtmlElement object, or an array of either.)
	original_list = $(original_list);
	
	if (!original_list) {
		return generated_lists; // empty array
	} else if (original_list.length) {
		// If original_list is an array, we recurse, making sure to collect the returned arrays
		var original_list_length = original_list.length; // optimization
		
		for (var i = 0; i < original_list_length; i++) {
			generated_lists.push(slice_list(original_list[i], options));
		}
		
		return generated_lists; // nested array of generated lists
	}
	
	// Merge default options into the passed options
	for (var i in default_options) {
		if (typeof options[i] == "undefined") {
			options[i] = default_options[i];
		}
	}
	
	// Grab the children list items
	var all_list_items = original_list.getElementsByTagName("li");
	
	// Grab only the immediate children of the original list
	var list_items = [];
	var all_list_items_length = all_list_items.length; // optimization
	
	for (var i = 0; i < all_list_items_length; i++) {
		if (all_list_items[i].parentNode == original_list) {
			list_items.push(all_list_items[i]);
		}
	}
	
	// Check to make sure we still have list items to work with.
	if (!list_items.length) {
		return generated_lists; // empty array
	}
	
	var list_items_length = list_items.length; // optimization

	// If the list is bigger than max_items, we'll need to page.
	// get_num_lists accounts for paging too.
	var	num_lists = get_num_lists(list_items_length, options);
	
	// Calculate the number of items per list
	var items_per_list   = Math.floor(list_items_length / num_lists);
	var items_remainder  = list_items_length % num_lists;
	var items_additional = 0;
	var items_counter    = 0;

	// Do paging
	var paging = options.max_items && options.max_items < list_items_length;
	var pages = (paging)?Math.ceil(list_items_length / options.max_items):1;
	var list_per_page = Math.floor((paging)?num_lists/pages:num_lists);

	// Generate lists
	for (var i = 0; i < num_lists; i++) {
		generated_lists[i] = original_list.parentNode.insertBefore(document.createElement("ul"), original_list);
		Element.addClassName(generated_lists[i], "sliced-list");
		if (i >= list_per_page) {
			// hide everything beyond the first page.
			generated_lists[i].style.display = "none";
		}
		
		if (items_remainder) {
			items_additional = 1;
			items_remainder--;
		} else {
			items_additional = 0;
		}
		
		for (var j = 0; j < (items_per_list + items_additional); j++) {
			generated_lists[i].appendChild(list_items[items_counter]);
			items_counter++;
		}
	}

	var pager = null;
	if (paging) {
		pager = document.createElement("p");
		pager.style.width = "100%";
		pager.style.textAlign = "right";
		pager.page = 1;
		
		
		// Paging links.
		var next = document.createElement("a");
		next.href = "#";
		var prev = document.createElement("a");
		prev.href = "#";
		var sep = document.createElement("span");
		sep.appendChild(document.createTextNode(" | "));
		sep.style.display = "none";
		
		// This function does the paging of lists.
		var turnPage = function (page) {
			var min_list = (page - 1) * list_per_page;
			var max_list = (page * list_per_page);
			max_list = (max_list > num_lists)?num_lists:max_list;
			for (var i = 0; i < generated_lists.length; i++) {
				if (i < min_list || i >= max_list) {
					generated_lists[i].style.display = "none";
				} else {
					generated_lists[i].style.display = "";
				}
			}
			
			if (page > 1) { prev.style.display = "inline";	} else { prev.style.display = "none"; }
			if (page < pages) {	next.style.display = "inline"; } else {	next.style.display = "none"; }
			if (page > 1 && page < pages) { sep.style.display = "inline"; } else { sep.style.display = "none"; }
		};
		
		next.onclick = function() {
			pager.page++;
			turnPage(pager.page);
			return false;
		} 
		
		prev.onclick = function() {
			pager.page--;
			turnPage(pager.page);
			return false;
		}
		
		next.innerHTML=("next");
		prev.innerHTML=("previous");
		prev.style.display = "none";
		pager.appendChild(prev);
		pager.appendChild(sep);
		pager.appendChild(next);
		original_list.parentNode.insertBefore(pager, original_list);
	}
	
	// Remove original list
	Element.remove(original_list);
	
	// Return an array of the generated lists
	return generated_lists;
}

function get_num_lists(list_items_length, options) {
	// Calculate the number of lists we'll need to generate.
	var paging = options.max_items && options.max_items < list_items_length;
	var pages = (paging)?Math.ceil(list_items_length / options.max_items):1;
	options.max_lists *= pages;
	options.min_lists *= pages;
	if (options.max_lists) {
		if (list_items_length < options.min_items) {
			return 1;
		} else if (list_items_length > (options.max_lists * options.min_items)) {
			return options.max_lists;
		} else {
			if (list_items_length < options.min_lists) {
				return list_items_length;
			} else {
				return Math.floor(list_items_length / options.min_items);
			}
		}
	} else {
		if (list_items_length < (options.min_lists * options.min_items)) {
			if (list_items_length < options.min_lists) {
				return list_items_length;
			} else {
				return options.min_lists;
			}
		} else if (list_items_length < options.min_items) {
			return 1;
		} else {
			return Math.floor(list_items_length / options.min_items);
		}
	}
}

// This function is called when the filmstrip finishes animating
function updateFilmstripNav(currentStop) {
	var pageItems = pagination.getElementsByTagName("li");

	for (var i = 0; i < pageItems.length; i++) {
		Element.removeClassName(pageItems[i], "filmstrip-current");

		if (i == currentStop) {
			Element.addClassName(pageItems[i], "filmstrip-current");
		}
	}
}

/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
10/24/2005
v(1.0.2)
*/

//base
var fx = new Object();
fx.Base = function(){};
fx.Base.prototype = {
	setOptions: function(options) {
	this.options = {
		duration: 500,
		onComplete: ''
	}
	Object.extend(this.options, options || {});
	},

	go: function() {
		this.duration = this.options.duration;
		this.startTime = (new Date).getTime();
		this.timer = setInterval (this.step.bind(this), 13);
	},

	step: function() {
		var time  = (new Date).getTime();
		var Tpos   = (time - this.startTime) / (this.duration);
		if (time >= this.duration+this.startTime) {
			this.now = this.to;
			clearInterval (this.timer);
			this.timer = null;
			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
		}
		else {
			this.now = ((-Math.cos(Tpos*Math.PI)/2) + 0.5) * (this.to-this.from) + this.from;
			//this time-position, sinoidal transition thing is from script.aculo.us
		}
		this.increase();
	},

	custom: function(from, to) {
		if (this.timer != null) return;
		this.from = from;
		this.to = to;
		this.go();
	},

	hide: function() {
		this.now = 0;
		this.increase();
	},

	clearTimer: function() {
		clearInterval(this.timer);
		this.timer = null;
	}
}

//stretchers
fx.Layout = Class.create();
fx.Layout.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.el.style.overflow = "hidden";
		this.el.iniWidth = this.el.offsetWidth;
		this.el.iniHeight = this.el.offsetHeight;
		this.setOptions(options);
	}
});

fx.Height = Class.create();
Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.height = this.now + "px";
	},

	toggle: function() {
		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
		else this.custom(0, this.el.scrollHeight);
	}
});

fx.Width = Class.create();
Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.width = this.now + "px";
	},

	toggle: function(){
		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
		else this.custom(0, this.el.iniWidth);
	}
});

//fader
fx.Opacity = Class.create();
fx.Opacity.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.now = 1;
		this.increase();
		this.setOptions(options);
	},

	increase: function() {
		if (this.now == 1) this.now = 0.9999;
		if (this.now > 0 && this.el.style.visibility == "hidden") this.el.style.visibility = "visible";
		if (this.now == 0) this.el.style.visibility = "hidden";
		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + this.now*100 + ")";
		this.el.style.opacity = this.now;
	},

	toggle: function() {
		if (this.now > 0) this.custom(1, 0);
		else this.custom(0, 1);
	}
});
fx.Filmstrip = Class.create();
fx.Filmstrip.prototype = Object.extend(new fx.Base(), {
	
	initialize: function(element, options) {
		this.now     = 0;
		this.nowStop = 0;
		this.element = $(element);
		this.setOptions(options);
	},
	
	increase: function() {
		this.element.style.left = this.now + "px";
	},
	
	scrollPrevious: function() {
		if (this.timer != null) return;
		
		toStep = this.nowStop <= 1
			? 1
			: this.nowStop--;

		this.scroll(toStep);
	},
	
	scrollNext: function(stepNbr) {
		if (this.timer != null) return;
		
		toStep = (this.nowStop + 1) >= stepNbr
			? stepNbr
			: this.nowStop + 2;

		this.scroll(toStep);
	},
	
	scroll: function(toStep) {
		if (this.timer != null) return;
		
		
		this.nowStop = toStep - 1;
		
		this.from = this.now;
		this.to   = -(this.nowStop * this.options.stepSize);
		
		if (this.from == this.to) return;
		this.go();
	}
	
});
// Set <div id="page-container" class="javascript-enabled"> ===========

// This will allow CSS to be tweaked for javascript enabled and disabled users independently
addEvent(window, "load", function() {
	if ($("page-container"))
		Element.addClassName($("page-container"), "javascript-enabled");
});

// Set <div id="page-container" class="mac-platform"> =================

// This will allow CSS to be tweaked for all Mac browsers independently
addEvent(window, "load", function() {
	if ($("page-container"))
		if (navigator.userAgent.toLowerCase().indexOf("mac") != -1) {
			Element.addClassName($("page-container"), "mac-platform");
		}
});

// Trigger a reflow in Gecko (Mozilla, Firefox, Netscape, etc.) =============

// This forces the rendering engine to double-check it's CSS rendering after the page is loaded
// Specifically, this fixes extraneous scrolling in Firefox 1.0 on the Destinations Things To Do and Places pages.
addEvent(window, "load", function() {
	var body = document.getElementsByTagName("body")[0];
	var bodyClass = body.className;
	body.className = "forceReflow";
	body.className = bodyClass;
});

// sIFR Rules ===============================================================

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac){
	
/*	// 800-Number in Header
	sIFR.replaceElement("div#topnav-tabs div.number800", named({
		sFlashSrc:  "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:     "#336699",
		sBgColor:   "#FFFFFF",
		sWmode:     "transparent",
		sFlashVars: "textalign=center"}
	));
*/	
	// Page Title
	sIFR.replaceElement("div#page div#hero-shot h1 span,div#page div#seo-default h1 span", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#FFFFFF",
		sBgColor:       "#25598F",
		sWmode:         "transparent"}
	));
	
	// Content Subtitle
	sIFR.replaceElement("div#page h2 span", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#003366",
		sBgColor:       "#B8E0FD",
		sWmode:         "transparent"}
	));
	
	// Hero Shot Overlay text
	sIFR.replaceElement("div#page div#hero-shot p#hero-shot-overlay span", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#FFFFFF",
		sBgColor:       "#000000",
		sWmode:         "transparent",
		sFlashVars:     "textalign=right"//,		
	}));

	// Hero Shot Aux title
	sIFR.replaceElement("div#page div#hero-shot div#hero-shot-aux h3", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#FFFFFF",
		sBgColor:       "#1A4D80",
		sWmode:         "transparent",
		nPaddingTop:    "6",
		nPaddingBottom: "6"}
	));
	
	// Marketing Message A Property Listing
	sIFR.replaceElement("div#marketing-messages div#marketing-message-a dl.property-listing dt", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#003366",
		sBgColor:       "#CFE4F5",
		sWmode:         "transparent"}
	));
}

if (document.getElementById)
{
	// World Regions Show/Hide ==============================================
	
	addEvent(window, "load", function() {
		// World Regions List in Hero Shot Aux map
		if ($("regions-list"))
		{
			// Hide List
			regions_hide();

			// Build Button DOM
			var regionsLink   = document.createElement("a");
			regionsLink.href  = "#"; // Needs to become the link to the root-level of Geo-Jump?
			regionsLink.id    = "regions-button"

			var regionsButton = document.createElement("img");
			regionsButton.alt = "Show Regions";
			regionsButton.src = "/images/promotions/hero-shot/img-map_worldregions.gif";
			
			regionsLink.appendChild(regionsButton);
			
			// Place Button
			$("regions-list").parentNode.insertBefore(regionsLink, $("regions-list"));
			addEvent($("regions-button"), "click", regions_show);
			$("regions-button").onclick = function() { return false; };
			
			// Preload "Hide Regions" button
			//document.createElement("img").src = "./images/hero-shot/img-map_hideregions.gif";
			var hideRegionsImg = new Image();
			hideRegionsImg.src = "/images/promotions/hero-shot/img-map_hideregions.gif";
			
			if (Element.hasClassName($("regions-list"), "regions-list-open")) {
				regions_show();
			}
		}		
	});
	
	function regions_show() {
		if ($("regions-list"))
		{
			$("regions-list").style.visibility = "visible";
		}
		
		if ($("regions-button"))
		{
			removeEvent($("regions-button"), "click", regions_show);
			$("regions-button").childNodes[0].src = "/images/promotions/hero-shot/img-map_hideregions.gif";
			$("regions-button").childNodes[0].alt = "Hide Regions";
			addEvent($("regions-button"), "click", regions_hide);
		}
		
		return false;
	}
	
	function regions_hide() {
		if ($("regions-list"))
		{
			$("regions-list").style.visibility = "hidden";
		}

		if ($("regions-button"))
		{
			removeEvent($("regions-button"), "click", regions_hide);
			$("regions-button").childNodes[0].src = "/images/promotions/hero-shot/img-map_worldregions.gif";
			$("regions-button").childNodes[0].alt = "Show Regions";
			addEvent($("regions-button"), "click", regions_show);
		}
		
		return false;
	}
	
	// Hide/Show Maps =======================================================
	
	addEvent(window, "load", function() {
		if (typeof hideshow_initialize == "function") {
			hideshow_initialize();
		}
	});
	
	// Slice Geo-Jump Lists ================================================
	
	addEvent(window, "load", function() {
		// Get the list
		var contentDiv = $("content");
		
		if (contentDiv && Element.hasClassName(contentDiv, "geojump-listing")) {
			slice_list(contentDiv.getElementsByTagName("ol")[0], {
				max_lists: 5,
				min_items: 2,
				max_items: 75//,
			});
		}
	});
	
	// Filmstrip ============================================================
	
	// Create Filmstrip for Destinations Landing page
	addEvent(window, "load", function() {
		if ($("destinations-landing-filmstrip")) {
			// Setup element for updateFilmstripNav
			pagination = null;
			var lists = $("destinations-landing-filmstrip").parentNode.parentNode.getElementsByTagName("ol");

			for (var i = 0; i < lists.length; i++) {
				if (Element.hasClassName(lists[i], "filmstrip-pagination")) {
					pagination = lists[i];
					break;
				}
			}

			myFilmstrip = new fx.Filmstrip("destinations-landing-filmstrip", {
				duration: 1000,
				stepNum: 5,
				stepSize: 725,
				onComplete: function() {
					updateFilmstripNav(this.nowStop);
				}}
			);
		}
	});

	// Create Filmstrip for Destinations Highlights page
	addEvent(window, "load", function() {
		if ($("destinations-highlights-filmstrip")) {
			// Setup element for updateFilmstripNav
			pagination = null;
			var lists = $("destinations-highlights-filmstrip").parentNode.parentNode.getElementsByTagName("ol");

			for (var i = 0; i < lists.length; i++) {
				if (Element.hasClassName(lists[i], "filmstrip-pagination")) {
					pagination = lists[i];
					break;
				}
			}

			myFilmstrip = new fx.Filmstrip("destinations-highlights-filmstrip", {
				duration: 600,
				stepNum: 5,
				stepSize: 426,
				onComplete: function() {
					updateFilmstripNav(this.nowStop);
				}}
			);
		}
	});
}

// sIFR Rules ===============================================================

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac) {
		
	// Tab Content headers
	sIFR.replaceElement("div#page div#tab-content h4 span", named({
		sFlashSrc:      "/images/promotions/sifr/trade-gothic-lt-bold.swf",
		sColor:         "#003366",
		sBgColor:       "#B8E0FD",
		sWmode:         "transparent"}
	));
}

// Used for Fireclick Tracking from Flash SWF
function call_fc_flash(arg1, arg2) {
    if (typeof(fc_flash) == "function") {
        fc_flash(arg1, arg2);
    }
}

function hideInterstitial() {
    document.write('</div>');
    if (document.getElementById) {
    	document.getElementById('interstitial-box').style.display = 'none';
    	document.getElementById('loading-container').style.display = 'block';

        if (document.body) {
            document.body.style.backgroundImage = "url(/images/promotions/bg_tile.gif)";
        }
        if (document.documentElement) {
            document.documentElement.style.backgroundImage = "url(/images/promotions/bg_tile.gif)";
        }
    }
}

function hideInterstitial2() {
    if (document.getElementById) {
    	document.getElementById('interstitial-box').style.display = 'none';
    	document.getElementById('loading-container').style.display = 'block';

        if (document.body) {
            document.body.style.backgroundImage = "url(/images/promotions/bg_tile.gif)";
        }
        if (document.documentElement) {
            document.documentElement.style.backgroundImage = "url(/images/promotions/bg_tile.gif)";
        }
    }
}

function showInterstitialFlash() {
    document.write('<object type="application/x-shockwave-flash" data="/images/chrysalis/interstitial/searching.swf" width="250" height="160">\n');
    document.write('  <param name="movie" value="/images/chrysalis/interstitial/searching.swf" />\n');
    document.write('  <img src="/images/chrysalis/interstitial/searching.png" width="250" height="160" alt="Loading" />\n');
    document.write('</object>\n');
}

function hideWaitScreen() {
	var oWait = null, elemWait = null;
	if (document.getElementById) { // IE 5+/NS6
		elemWait = document.getElementById('waitScreen');
		if (elemWait != null) {
			oWait = elemWait.style;
		}
	} else if (document.layers) {
		oWait = document.layers['waitScreen'];
	} else if (document.all) {
		elemWait = document.all['waitScreen'];
		if (elemWait != null) {
			oWait = elemWait.style;
		}
	}
	if (oWait != null) {
		oWait.visibility = 'hidden';
	}
}


function popupBook(url) {
	var w=window.open(url, "myWindow", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=503,height=250');
	w.focus();
}


function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}

function openNewWindow(fileName,windowName,theWidth,theHeight) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function openMapWindow(mapUrl,windowName,width,height) {
	window.open(mapUrl,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height)
}
function openMapWithPropInfo(mapUrl,propInfo,propInfoString,windowName,width,height) {
	var newUrl;
	if (isNN3 || isNN4 || isNN6) {
		newUrl = mapUrl + propInfo + propInfoString;
	} else {
		newUrl = mapUrl + propInfo + escape(propInfoString);
	}	
	window.open(newUrl,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height)	
}

function openNewWindowEscape(fileName,windowName,theWidth,theHeight,to) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	var encoded = escape(to);
	encoded = fileName + encoded;
	window.open(encoded,windowName,"toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function openNewWindowReturnFalse(fileName,windowName,theWidth,theHeight) {
	if (windowName == "newWindow") {
		 windowName = new String(Math.round(Math.random() * 100000));
	}
	var w = window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight);
	return false;
}

function openPopup(url, to, windowName, theWidth, theHeight) {
	var newURL;
	if (isNN3 || isNN4) {
		newURL = url + to;
	} else {
		newURL = url + escape(to);
	}
	window.open(newURL,windowName,"toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight)
}

function openPopup3(url, name1, param1, name2, param2, name3, param3, windowName, theWidth, theHeight) {
	var wSettings = 'toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1';
	openPopupWin(url, name1, param1, name2, param2, name3, param3, windowName, wSettings, theWidth, theHeight);
}

function openMapNetscape(url, name1, param1, name2, param2, name3, param3, windowName, theWidth, theHeight) {
	var wSettings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1';
	openPopupWin(url, name1, param1, name2, param2, name3, param3, windowName, wSettings, theWidth, theHeight);
}

function openPopupWin(url, name1, param1, name2, param2, name3, param3, windowName, windowSettings, theWidth, theHeight) {
	var newURL;
	windowSettings += ',width='+theWidth+',height='+theHeight;
	if (isNN3 || isNN4) {
		newURL = url + name1 + param1 + name2 + param2 + name3 + param3;
	} else {
		newURL = url + name1 + escape(param1) + name2 + escape(param2) + name3 + escape(param3);
	}
	window.open(newURL,windowName,windowSettings);
}

function open_calendar(strType) {
	document.myform.inout.value = strType;
	new_window=window.open("calendar.htm","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=300,height=200");
}

function popup(url, name, width, height) {
	settings="toolbar=yes,location=yes,directories=yes,"+"status=no,menubar=no,scrollbars=yes,"+"resizable=yes,width="+width+",height="+height;
	MyNewWindow=window.open("http://"+url,name,settings);
}

function getMousePos(e) {
    xPos = 0;
    yPos = 0;
    if (!e) var e = window.event;
    if (e.pageX || e.pageY)
    {
        xPos = e.screenX;
        yPos = e.screenY;
    }
    else if (e.clientX || e.clientY)
    {
        xPos = e.screenX;
        yPos = e.screenY;
    }
}

function openPopWindow(pageLocation,winName, pgW, pgH) {
	winStats='toolbar=no,location=no,directories=no,menubar=no,';
	winStats+='scrollbars=no,width=' + pgW + ',height=' + pgH ;

	if (navigator.appName.indexOf("Microsoft")>=0) {
		winStats+=',left=' + (xPos) + ',top=' + (-200 + yPos);
	} else {
		winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos - 300);
	}

	floater=window.open(pageLocation,winName,winStats);
	if (floater!=null) { if (floater.focus) { floater.focus() } };
}

function openCalWindow(thisPage, strType, CalLocation) {
	document.myform.inout.value = strType;

	// Switch to JSP, this is a catch-all for old code.  Should be removed eventually
	if (thisPage=='popcal.html') { thisPage = 'popcal.jsp'; }

	if ( strType == 'out') {
		thisPage = thisPage + '?' + new String(document.myform.COMonth.value -1) + ',' + document.myform.COYear.value
	} else {
		thisPage = thisPage + '?' + new String(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value -1) + ',' + document.myform.CIYear.value
	}

	winStats='toolbar=no,location=no,directories=no,menubar=no,'

	//IE/NS
	if (navigator.appName.indexOf("Microsoft")>=0) {winStats+='scrollbars=no,width=160,height=180'}
	else {winStats+='scrollbars=no,width=160,height=170'}

	//IE leftnav area
	if (navigator.appName.indexOf("Microsoft")>=0) {
			if(CalLocation == 'leftNavArea')
				{winStats+=',left=' + (xPos) + ',top=' + (yPos)
				 }//IE content area
			else if (CalLocation == 'contentArea')
				{winStats+=',left=' + (-200 + xPos) + ',top=' + (-160 + yPos)
				}
			else if (CalLocation == 'calendarArea')
				{winStats+=',left=' + (-150 + xPos) + ',top=' + (yPos + 20)
				}	
    } else {
		//Netscape leftnav area
		if(CalLocation == 'leftNavArea')
				{winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos)
				 }//Netscape content area
			else if (CalLocation == 'contentArea')
				{winStats+=',screenX='+ (-150 + xPos) + ',screenY=' + (-230 + yPos)
				}
			else if (CalLocation == 'calendarArea')
				{winStats+=',screenX='+ (-150 + xPos) + ',screenY=' + (yPos + 20)
				}	
    }
	floater=window.open(thisPage,"myform",winStats)
	if (floater!=null) { if (floater.focus) { floater.focus() } };
}

function openCalWindowDo(thisPage, strType, CalLocation, year, month, day) {
    if (document.forms[0].name == "myform") {
        document.forms[0].inout.value = strType;
    } else {
        document.forms[1].inout.value = strType;
    }
    
    // Switch to JSP, this is a catch-all for old code.  Should be removed eventually
    if (thisPage=='popcal.html') { 
        thisPage = 'popcal.jsp'
    }
    if (thisPage=='popcal.jsp') {
        thisPage = '/popCalendar.do'
    }

    var formDay;
    var formMonth;
    var formYear;
    
    if (document.forms[0].name == "myform") {
    
        if ( strType == 'out') {
            formDay = document.forms[0].CODay[document.forms[0].CODay.selectedIndex];
            formMonth = document.forms[0].COMonth[document.forms[0].COMonth.selectedIndex];
            formYear = document.forms[0].COYear.value;
        } else {
            formDay = document.forms[0].CIDay[document.forms[0].CIDay.selectedIndex];
            formMonth = document.forms[0].CIMonth[document.forms[0].CIMonth.selectedIndex];
            formYear = document.forms[0].CIYear.value;
        }
    } else {
        if ( strType == 'out') {
            formDay = document.forms[1].CODay[document.forms[1].CODay.selectedIndex];
            formMonth = document.forms[1].COMonth[document.forms[1].COMonth.selectedIndex];
            formYear = document.forms[1].COYear.value;
        } else {
            formDay = document.forms[1].CIDay[document.forms[1].CIDay.selectedIndex];
            formMonth = document.forms[1].CIMonth[document.forms[1].CIMonth.selectedIndex];
            formYear = document.forms[1].CIYear.value;
        }
    }
    
    var currDay = formDay.value;
    var currMonth = formMonth.value;
    if (currMonth > 1 && currDay == -1) {
    	currDay = 0;
    }else if (currMonth < 1 || currDay < 1) {
        currDay = day;
        currMonth = month;
        formYear = year;
    }
    else {
        var monthText = formMonth.text;
        if (monthText.length > 5 && monthText.charAt(monthText.length - 5) == ' ') {
            formYear = monthText.substr(monthText.length - 4);
        }
    }
    thisPage = thisPage 
        + '?' + currMonth // cal month
        + ',' + formYear  // cal year
        + ',' + formYear  // form year (or today)
        + ',' + currMonth // form month (or today)
        + ',' + currDay   // form day (or today)

    winStats='toolbar=no,location=no,directories=no,menubar=no,'

    //IE/NS
    if (navigator.appName.indexOf("Microsoft")>=0) {winStats+='scrollbars=no,width=160,height=180'}
    else {winStats+='scrollbars=no,width=160,height=170'}

    //IE leftnav area
    if (navigator.appName.indexOf("Microsoft")>=0) {
            if(CalLocation == 'leftNavArea')
                {winStats+=',left=' + (xPos) + ',top=' + (yPos)
                 }//IE content area
            else if (CalLocation == 'contentArea')
                {winStats+=',left=' + (-200 + xPos) + ',top=' + (-160 + yPos)
                }
            else if (CalLocation == 'calendarArea')
                {winStats+=',left=' + (-150 + xPos) + ',top=' + (yPos + 20)
                }   
    } else {
        //Netscape leftnav area
        if(CalLocation == 'leftNavArea')
                {winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos)
                 }//Netscape content area
            else if (CalLocation == 'contentArea')
                {winStats+=',screenX='+ (-150 + xPos) + ',screenY=' + (-230 + yPos)
                }
            else if (CalLocation == 'calendarArea')
                {winStats+=',screenX='+ (-150 + xPos) + ',screenY=' + (yPos + 20)
                }   
    }
    floater=window.open(thisPage,"myform",winStats)
    if (floater!=null) { if (floater.focus) { floater.focus() } };
}

function openWindow(thisPage, strType) {
	document.myform.inout.value = strType;
	thisPage = thisPage + '?' + new String(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value -1) + ',' + document.myform.CIYear.value

	if ( strType == 'out') {
		thisPage = thisPage + '?' + new String(document.myform.COMonth.value -1) + ',' + document.myform.COYear.value
	}
	winStats='toolbar=no,location=no,directories=no,menubar=no,'
	winStats+='scrollbars=no,width=160,height=140'
	if (navigator.appName.indexOf("Microsoft")>=0) {
     	  winStats+=',left=' + (xPos) + ',top=' + (yPos)
	} else {
	winStats+=',screenX='+ (xPos) + ',screenY=' + (yPos)
	}
	floater=window.open(thisPage,"myform",winStats)
	if (floater!=null) { if (floater.focus) { floater.focus() } };

}
function initializeDates()
{
	var thisdate = new Date();
	var thismonth = thisdate.getMonth();
	var thisday = thisdate.getDate();
	var thisyear = thisdate.getFullYear();

	document.myform.CIMonth.value = thismonth+1;
	document.myform.CIYear.value = thisyear;
	document.myform.CIDay.value = thisday+7;

	document.myform.COMonth.value = thismonth+1
	document.myform.COYear.value = thisyear;
	document.myform.CODay.value = thisday+7+1;
}

function doSelectOptions(theValue,theField) {

	var objForm = document.myform;
	for (i=0; i< objForm[theField].options.length; i++)
		if (objForm[theField].options[i].value == theValue) {
			objForm[theField].options[i].selected = true;
		}
}

function updateBothDates(theForm)
{
	var worker	= new Date();
	calcBothDates(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcBothDates(theForm, ty, tm, td)
{
	calcBothDates2(theForm, ty, tm, td, 2);
}

function calcBothDates2(theForm, ty, tm, td, daysInAdvance)
{
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var inDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, document.myform.CIDay[document.myform.CIDay.selectedIndex].value, 0,0,0);
	
	//When calculating inDate value for next year months, the value 'ty' is not representing the 
	//forth coming year but the current year.
	//Since in our site we will show only current month and the months after.. 	
	if(inDate.getMonth() < today.getMonth()){
		ty = ty+1;
		inDate = new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, document.myform.CIDay[document.myform.CIDay.selectedIndex].value, 0,0,0);
	}
	
	var outDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, parseInt(document.myform.CIDay[document.myform.CIDay.selectedIndex].value)+daysInAdvance, 0,0,0);

	if (inDate.getTime()  < today.getTime()) { // Crossed the newyear boundary
		inDate.setYear((today.getYear()%1900+1900)+1);
		outDate.setYear((today.getYear()%1900+1900)+1);
	}

	theForm.CIYear.value	= (inDate.getYear()%1900) + 1900;
	doSelectOptions(inDate.getMonth()+1, 'CIMonth');
	doSelectOptions(inDate.getDate(), 'CIDay');

	theForm.COYear.value	= (outDate.getYear()%1900) + 1900;
	doSelectOptions(outDate.getMonth()+1, 'COMonth');
	doSelectOptions(outDate.getDate(), 'CODay');
}

function updateCIDate(theForm)
{
	var worker	= new Date();
	calcCIDate(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcCIDate(theForm, ty, tm, td)
{
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var inDate	= new Date((ty%1900+1900), parseInt(document.myform.CIMonth[document.myform.CIMonth.selectedIndex].value)-1, document.myform.CIDay[document.myform.CIDay.selectedIndex].value, 0,0,0);

	if (inDate.getTime()  < today.getTime()) { // Crossed the newyear boundary
		inDate. setYear((today.getYear()%1900+1900)+1);
	}

	theForm.CIYear.value	= (inDate.getYear()%1900) + 1900;
	doSelectOptions(inDate.getMonth()+1, 'CIMonth');
	doSelectOptions(inDate.getDate(), 'CIDay');
}

function updateCODate(theForm)
{
	var worker	= new Date();
	calcCODate(theForm, (worker.getYear()%1900+1900), worker.getMonth()+1, worker.getDate());
}
function calcCODate(theForm, ty, tm, td)
{
	var today	= new Date((ty%1900+1900), tm-1, td, 0,0,0);
	var outDate	= new Date((ty%1900+1900), parseInt(document.myform.COMonth[document.myform.COMonth.selectedIndex].value)-1, parseInt(document.myform.CODay[document.myform.CODay.selectedIndex].value), 0,0,0);

	if( (parseInt(theForm.CIYear.value)%1900) >(today.getYear()%1900) || (outDate.getTime() < today.getTime()) ){
		outDate	= new Date((ty%1900+1900)+1, parseInt(document.myform.COMonth[document.myform.COMonth.selectedIndex].value)-1, parseInt(document.myform.CODay[document.myform.CODay.selectedIndex].value), 0,0,0);
	}

	theForm.COYear.value	= (outDate.getYear()%1900) + 1900;
	doSelectOptions(outDate.getMonth()+1, 'COMonth');
	doSelectOptions(outDate.getDate(), 'CODay');
}

function searchDebug() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }
function changeRezDebug() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }
function debugRefineLeftnav() { alert('CIYear='+myform.CIYear.value+', COYear='+myform.COYear.value); }

function focusOnSecTwo(destNum) {
    if (isIE) {
	if (document.forms.myform.usertypedcity.value != "") {
	    document.forms.myform.destination[0].checked = true;
	} else {
	    if (destNum > 1) {
		destNumAry = new Array(
		    2, 5, 8, 11, 14, 
		    3, 6, 9, 12, 15, 
		    4, 7, 10, 13, 16);
		eval('document.forms.myform.destination[' + destNumAry[destNum] + '].checked = true;');
	    }
	}
	window.setTimeout('document.forms.myform.CIMonth.focus()', 200);
    } else {
	document.forms.myform.CIMonth.focus();
    }
}
function selectUserTyped() {
    if (isIE) {
	if (document.forms.myform.usertypedcity.value != "") {
	    document.forms.myform.destination[0].checked = true;
	}
    }
}

function setCookie(name, value, expires, path, domain, secure) {
  document.cookie= name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else {
    begin += 2;
  }
  var end = document.cookie.indexOf(";", begin);
  if (end == -1) {
    end = dc.length;
  }
  return unescape(dc.substring(begin + prefix.length, end));
}

function getRequestedPage(currentPage, direction){
	alert(direction);
	var requestedPage = document.getElementById("requestedPage");
	if(direction == "next")
		requestedPage.value = currentPage + 1;
	if(direction == "previous")
		requestedPage.value = currentPage - 1;
		
	alert("after being set :: "+requestedPage.value);	
}

function setCurrentTab(tab, anchor) {
	var target = anchor.href;
    if (target.indexOf('?') > 0) {
        target += '&tab=' + tab;
    } else {
        target += '?tab=' + tab;
    }
    if (isSafari) {
    	anchor.href = target;
    } else {
    	window.location = target;
    }
}
function setCurrency(currency) {
        
    var target = window.location.href;
    var curIndex = target.indexOf('currency');
	var anchorIndex = target.indexOf('#');
	
	var trailer = '';

    if ( curIndex > 0) 
    {
        if (curIndex + 12 < target.length) {
                trailer = target.substring(curIndex+12);
        }
        target = target.substr(0, curIndex-1);
    } else if ( anchorIndex > 0 ) {
    	trailer = target.substr(anchorIndex);
    	target = target.substr(0, anchorIndex);
    }
    if (target.indexOf('?') > 0) {
        target += '&currency=' + currency;
    } else {
        target += '?currency=' + currency;
    }
    target += trailer;
    window.location = target;
}

function setCountry(country) {

	if (country == null || country.length < 0) {
		return false;
	}        
    var target = window.location.protocol + '//' + window.location.hostname;
    if (window.location.port != null) {
    	target += ':' + window.location.port;
    }
    target += '/?requestedCountry=' + country; 
    window.location = target;
    return true;
}


function showCurrentTab (currentTab) {
	if (currentTab) {
		var elem = document.getElementById(currentTab + "Link");
		elem.onmouseover=function(evt){};
		elem.onmouseout=function(evt){};

		var img = document.images[currentTab];
		img.src = "/images/header/tab-" + currentTab + "_on.gif";
	}
}

// Browser Detection
var isAOL=false, isIE6=false, isIE55=false, isIE5=false, isIE4=false, isIE3=false, isIE=false
var isNN6=false, isNN5=false, isNN4=false, isNN3=false
var isMac=false, isWB5=false, isWB4=false, isWB3=false, isSafari=false
var browser_name = navigator.appName;
var browser_version = parseFloat(navigator.appVersion);
if (navigator.appVersion.indexOf('AOL') > -1) {
	isAOL = true;
}
if (navigator.appVersion.indexOf('Mac') > -1) {
	isMac = true;
}
if (navigator.appVersion.indexOf('Safari') > -1) {
	isSafari = true;
}
if (navigator.appName.indexOf('Netscape') > -1) {
	if(navigator.userAgent.indexOf('6.') > -1) {
		isNN6 = true;
	} else if (browser_version >= 5) {
		isNN5 = true;
	} else if (browser_version >= 4) {
		isNN4 = true;
	} else if (browser_version >= 3) {
		isNN3 = true;
	}
} else if (navigator.appName.indexOf('Microsoft Internet Explorer') > -1) {
	isIE = true;
	isIE7 = false;
	if (navigator.appVersion.indexOf('MSIE 7') > -1) {
		isIE7 = true;
	} else if (navigator.appVersion.indexOf('MSIE 6.0') > -1) {
		isIE6 = true;
	} else if (navigator.appVersion.indexOf('MSIE 5.5') > -1) {
		isIE55 = true;
	} else if (navigator.appVersion.indexOf('MSIE 5.0') > -1) {
		isIE5 = true;
	} else if (navigator.appVersion.indexOf('MSIE 4.') > -1) {
		isIE4 = true;
	} else {
		isIE3 = true;
	}
} else {
	if (browser_version >= 5) {
		isWB5 = true;
	} else if (browser_version >= 4) {
		isWB4 = true;
	} else if (browser_version >= 3) {
		isWB3 = true;
	}
}

/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var menuLayers = {
  timer: null,
  activeMenuID: null,
  offX: -235,   // horizontal offset 
  offY: -60,   // vertical offset 
  show: function(id, e) {
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.position(mnu,e);
  },
  
  show2: function(id, e, xOffset, yOffset) {
    this.offX = xOffset;
    this.offY = yOffset;
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.position(mnu,e);
  },
  
  showUsingTimer: function(id) {
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.showItem(mnu);
  },

  hide: function() {
    this.clearTimer();
    if (this.activeMenuID && document.getElementById) 
      this.timer = setTimeout("document.getElementById('"+menuLayers.activeMenuID+"').style.visibility = 'hidden'", 200);
  },
  
  position: function(mnu, e) {
    var x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
    var y = e.pageY? e.pageY: e.clientY + viewport.scrollY;
    
    if ( x + mnu.offsetWidth + this.offX > viewport.width + viewport.scrollX )
      x = x - mnu.offsetWidth - this.offX;
    else x = x + this.offX;
  
    if ( y + mnu.offsetHeight + this.offY > viewport.height + viewport.scrollY )
      y = ( y - mnu.offsetHeight - this.offY > viewport.scrollY )? y - mnu.offsetHeight - this.offY : viewport.height + viewport.scrollY - mnu.offsetHeight;
    else y = y + this.offY;
    
    mnu.style.left = x + "px"; mnu.style.top = y + "px";
    this.timer = setTimeout("document.getElementById('" + menuLayers.activeMenuID + "').style.visibility = 'visible'", 200);
  },
  
  showItem: function(mnu) {
    this.timer = setTimeout("document.getElementById('" + menuLayers.activeMenuID + "').style.visibility = 'visible'", 200);
  },
  
  mouseoutCheck: function(e) {
    e = e? e: window.event;
    // is element moused into contained by menu? or is it menu (ul or li or a to menu div)?
    var mnu = document.getElementById(menuLayers.activeMenuID);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
    if ( mnu != toEl && !menuLayers.contained(toEl, mnu) ) menuLayers.hide();
  },
  
  // returns true of oNode is contained by oCont (container)
  contained: function(oNode, oCont) {
    if (!oNode) return; // in case alt-tab away while hovering (prevent error)
    while ( oNode = oNode.parentNode ) 
      if ( oNode == oCont ) return true;
    return false;
  },

  clearTimer: function() {
    if (menuLayers.timer) clearTimeout(menuLayers.timer);
  }
  
}

/*************************************************************************

  dw_viewport.js
  version date Nov 2003
  
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!

*************************************************************************/  
  
var viewport = {
  getWinWidth: function () {
    this.width = 0;
    if (window.innerWidth) this.width = window.innerWidth - 18;
    else if (document.documentElement && document.documentElement.clientWidth) 
  		this.width = document.documentElement.clientWidth;
    else if (document.body && document.body.clientWidth) 
  		this.width = document.body.clientWidth;
  },
  
  getWinHeight: function () {
    this.height = 0;
    if (window.innerHeight) this.height = window.innerHeight - 18;
  	else if (document.documentElement && document.documentElement.clientHeight) 
  		this.height = document.documentElement.clientHeight;
  	else if (document.body && document.body.clientHeight) 
  		this.height = document.body.clientHeight;
  },
  
  getScrollX: function () {
    this.scrollX = 0;
  	if (typeof window.pageXOffset == "number") this.scrollX = window.pageXOffset;
  	else if (document.documentElement && document.documentElement.scrollLeft)
  		this.scrollX = document.documentElement.scrollLeft;
  	else if (document.body && document.body.scrollLeft) 
  		this.scrollX = document.body.scrollLeft; 
  	else if (window.scrollX) this.scrollX = window.scrollX;
  },
  
  getScrollY: function () {
    this.scrollY = 0;    
    if (typeof window.pageYOffset == "number") this.scrollY = window.pageYOffset;
    else if (document.documentElement && document.documentElement.scrollTop)
  		this.scrollY = document.documentElement.scrollTop;
  	else if (document.body && document.body.scrollTop) 
  		this.scrollY = document.body.scrollTop; 
  	else if (window.scrollY) this.scrollY = window.scrollY;
  },
  
  getAll: function () {
    this.getWinWidth(); this.getWinHeight();
    this.getScrollX();  this.getScrollY();
  }
  
}

