try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


sfHover = function() {
	var sfEls = document.getElementById("nav1").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+="sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function popupPostcard(href,width,height,scroll)
	{
		postCard= window.open(href,'myPostcard','resizable=no,toolbar=no,left=200,top=200,status=no,location=no,height=' + height + ',width=' + width + ',scrollbars=' + scroll + "'");
	};

var hs_portalid=40477; 
var hs_salog_version = "2.00";
var hs_ppa = "joyaspa.demo.hubspot.com"
document.write(unescape("%3Cscript src='" + document.location.protocol + "//" + hs_ppa + "/salog.js.aspx' type='text/javascript'%3E%3C/script%3E"));

init = function(){
	
$(document).ready(function(){
	$(document.body).append('<div id="feedbackButton"></div>');
	var createForm = function(){
		if ($('#feedbackContainer').length==0){
			$(document.body).append('<div id="feedbackContainer"></div>');
			$('#feedbackContainer').css({
				top:		($(window).height()-295+$(document).scrollTop())+'px',
				left:		($(window).width()-435+$(document).scrollLeft())+'px',
				background:	'#512726',
				border:		'1px solid #604520',
				height:		'250px',
				width:		'395px',
				position:	'absolute'
			}).html('<form id="feedbackForm"><table style="margin:5px" class="copy txt"><tr><td>Name:</td><td><input id="nameField"></td></tr><tr><td>Phone:</td><td><input id="phoneField"></td></tr><tr><td>Email:</td><td><input id="emailField"></td></tr><tr><td colspan="2">Comments:<br><textarea id="commentsField" style="height:85px;margin-left:20px;width:335px;" /></td></tr><tr><td colspan="2"><input type="checkbox" id="optinField"><font style="font-size:.75em;"> Yes, I would like to receive exclusive offers, promotions and updates via email.</font></td></tr><tr><td colspan="2" align="right"><input type="button" value="Cancel" id="cancelButton">&nbsp;<input type="submit" value="Submit"></td></tr></table></form>').hide().fadeIn(400);
		}else{
			$('#feedbackContainer').fadeIn(400);
		}
		var removeForm = function(e){
			if (
				($(e.target).parents('#feedbackContainer').length == 0 || e.target.id == 'cancelButton')
				&& $(e.target).parents('#feedbackButton').length == 0
				&& e.target.id != 'feedbackContainer'
				&& e.target.id != 'feedbackButton'
			){
				$('#feedbackContainer').fadeOut(400);
				$(document).unbind('click',removeForm);
				$('#feedbackButton').bind('click',createForm);
			}
		};
		$('#feedbackForm').submit(function(){
			$.soap.request({
				url: '/cfcs/feedbackform.cfc',
				method: 'submitFeedbackForm', 
				params: {
					Name:	$('#nameField')[0].value,
					Email:	$('#emailField')[0].value,
					Phone:	$('#phoneField')[0].value,
					Comments:	$('#commentsField')[0].value,
					OptIn:	($('#optinField')[0].checked?1:0)
				},
				callback: function(r){
				}
			});
			$('#feedbackContainer').fadeOut(400);
			$('#feedbackButton').fadeOut(400);
			return false;
		});
		$(document).bind('click',removeForm);
		$('#feedbackButton').unbind('click',createForm);
	};
	$('#feedbackButton').css({
		position:'absolute',
		cursor:'pointer',
		top:	Math.round(($(window).height()-40+$(document).scrollTop())/2)+'px',
		left:	($(window).width()-100+$(document).scrollLeft())+'px'
	}).html('<img src="/i/SITE_080625_14134671_2NYU1/templates/btn_feedback.gif">').click(createForm);
	var rePos = function(){
		$('#feedbackButton').stop({clearQueue: true, gotoEnd:true}).animate({
			top:	($(window).height()-40+$(document).scrollTop())+'px',
			left:	($(window).width()-100+$(document).scrollLeft())+'px'
		},250);
		$('#feedbackContainer').stop({clearQueue: true, gotoEnd:true}).animate({
			top:		($(window).height()-295+$(document).scrollTop())+'px',
			left:		($(window).width()-435+$(document).scrollLeft())+'px'
		},250);
	};
	rePos();
	$(window).bind('scroll resize',rePos);
});




/* 
 * 
 * Generic Soap Function for JQuery for calling CFC's for JavaScript
 * 
 * Derek Bredensteiner 11/23/2008
 * 
 */
 
jQuery.soap = {
	// Our static wsdlCache which will be used and referenced later
	wsdlCache: {},
	translateNode : function (node, types){
		if (node == null)
			return null;
		// In some cases, empty spaces end up as nodes, Over here we don't care much for wide open spaces
		if (node.nodeType == 3
			&& typeof(node.nodeValue)=='string' 
			&& node.nodeValue.match(/^[\n 	]{1,}$/) )
				return null;
		if (node.nodeType == 3 || node.nodeType == 4){
			var v = node.nodeValue;
			switch((types[node.nodeName]+"").replace(/^[^:]*:/,"")){
				default:
					var t = v + "";
					// See if we can make it a valid Date/Time
					t = t.replace(/\.\d*/gi,"");
					t = t.replace(/T/gi," ");
					t = t.replace(/-/gi,"/");
					t = t.replace(/ \/(\d\d\d\d)$/gi," -$1");
					t = t.replace(/\/(\d\d):(\d\d)$/gi," -$1$2");
					var d = new Date();
					d.setTime(Date.parse(t));
					if(d!='Invalid Date'&&d!='NaN') return d;
					// And if not, just set it to whatever it is literally
					return (v != null) ? v + "" : "";
				case "string":
					return (v != null) ? v + "" : "";
				case "boolean":
					// If it's "true" or "1" and the type is boolean
					return (v + "").match(/^(true|1)$/i) ? true : false;
				case "int":
				case "long":
					return (v != null) ? parseInt(v + "", 10) : 0;
				case "double":
					return (v != null) ? parseFloat(v + "") : 0;
			}
		}
		if (node.childNodes.length == 1 && (node.childNodes[0].nodeType == 3 || node.childNodes[0].nodeType == 4))
			return this.translateNode(node.childNodes[0], types);
		// If the type has "arrayof" in it, we know *for sure* that it's an array
		if (types[node.nodeName] && types[node.nodeName].match(/(arrayof)/i)){
			var l = new Array();
			for (var i = 0; i < node.childNodes.length; i++){
				var p = this.translateNode(node.childNodes[i], types);
				if (p) l[l.length] = p;
			}
			return l;
		}else{
			// But down here we are less sure that it's an array or an object or ... whatever
			var obj = null;
			if (node.hasChildNodes())
				obj = new Object();
			for (var i = 0; i < node.childNodes.length; i++){
				var p = this.translateNode(node.childNodes[i], types);
				var nodeName = node.childNodes[i].nodeName.replace(/^[^:]*:/,'');
				if (p){
					if(!obj[nodeName]&&!obj.length)
						obj[nodeName] = p;
					else if (obj.length)
						obj[obj.length] = p;
					else{
						// This means we have repeated nodes with the same name, so it's probably supposed to be an array
						var l = new Array;
						l[l.length]=obj[nodeName];
						obj=l;
						obj[obj.length] = p;
					}
				}
			}
			return obj;
		}
		return null;
	},
	getElementsByTagName : function(wsdl,tagName){
		if(typeof(tagName)!='object')
			tagName = [tagName];
		var tags = [];
		var reg = "<([^ <]*)("+tagName[0];
		for(var i = 1; i < tagName.length; i++){
			reg+="|"+tagName[i];
		}
		reg+=")";
		var tag = wsdl.responseText.match(new RegExp(reg,"i"));
		if(tag&&tag.length>1){
			tags = wsdl.responseXML.getElementsByTagName(tag[1]+tag[2]);
			if (tags.length==0)
				tags = wsdl.responseXML.getElementsByTagName(tag[2]);
		}
		return tags;
	},
	translateType : function(node,wsdl,depth){
		if (!depth) var depth = 0;
		if (depth>10)return null;
		if (node.hasChildNodes()){		
			var obj = {};
			for(var i = 0; i < node.childNodes.length; i++){
				var p = this.translateType(node.childNodes[i],wsdl,depth+1);
				if(p){
					if (node.childNodes[i].attributes && node.childNodes[i].attributes.getNamedItem("name"))
						obj[node.childNodes[i].attributes.getNamedItem("name").nodeValue] = p;
					else if (node.childNodes[i].attributes.length>0)
						obj[node.childNodes[i].nodeName] = p;
					else
						obj = p;
					
				}
			}
			return obj;
		}else if (node.attributes){
			var nodeType = (
				node.attributes.getNamedItem("message") ? 
				node.attributes.getNamedItem("message").nodeValue.replace(/^[^:]*:/,"") :
				(node.attributes.getNamedItem("type") ? 
				node.attributes.getNamedItem("type").nodeValue.replace(/^[^:]*:/,"") :
				(node.attributes.getNamedItem("element") ? 
				node.attributes.getNamedItem("element").nodeValue.replace(/^[^:]*:/,"") :
				''))
			);
			var merge = function(args1,args2){
				for (var i = 0; i < args2.length; i++){
					args1.push(args2[i]);
				}
				return args1;
			};
			var tags = merge(merge(merge([],
				this.getElementsByTagName(wsdl,'message')),
				this.getElementsByTagName(wsdl,'complexType')),
				this.getElementsByTagName(wsdl,'element'));
			
			for(var i = 0; i < tags.length; i++){
				if (tags[i].attributes.getNamedItem("name")
					&& tags[i].attributes.getNamedItem("name").nodeValue == nodeType)
					return this.translateType(tags[i],wsdl,depth+1);
			}
			return nodeType;
		}else{
			return null;
		}
		
	},
	getOperations : function(o){
		// Check the availibility of a Cache of the specified wsdl from url
		if(this.wsdlCache[o.url]){
			var wsdl = this.wsdlCache[o.url];
			var operations = {};
			var tags = this.getElementsByTagName(wsdl,'operation');
			for(var i = 0; i < tags.length; i++){
				if(tags[i].attributes.getNamedItem("name") != null
					&& !operations[tags[i].attributes.getNamedItem("name").nodeValue]
					)
						operations[tags[i].attributes.getNamedItem("name").nodeValue] = this.translateType(tags[i],wsdl);
			}
			if(o.callback) o.callback(operations);
		}else{
			// Get the wsdl and Cache it, then continue with the request
			// passThis because this changes once we get to the callback
			var passThis = this;
			$.ajax({
			  type: "GET",
			  url: o.url.replace(/^http:/,'services/proxy.php?http:').replace(/([^?][^w][^s][^d][^l])$/i,"$1?wsdl"),
			  complete: function(r){
					passThis.wsdlCache[o.url]=r;
					passThis.getOperations(o);
			  }
			});
		}
	},
        getTypes : function(wsdl){
		var types = [];
		var tags = this.getElementsByTagName(wsdl,['element','part']);
		for(var i = 0; i < tags.length; i++){
			if(tags[i].attributes.getNamedItem("name") != null && tags[i].attributes.getNamedItem("type") != null) 
				types[tags[i].attributes.getNamedItem("name").nodeValue] = tags[i].attributes.getNamedItem("type").nodeValue;
		}
		return types;
	},
        serialize : function(o){
		var s = "";
		switch(typeof(o)){
			case "string":
				s += o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
				break;
			case "number":
			case "boolean":
				s += o.toString();
				break;
			case "object":
				if (o!=null){
					if(typeof(o)=='object' && typeof(o.dateFormat)=='function'){
						s += o.dateFormat('Y-m-d\\TH:i:sO');
					}else if(typeof(o)=='object' && typeof(o.length)=='number'){
						for(var p=0;p<o.length;p++)
							s += "<" + p + ">" + this.serialize(o[p]) + "</" + p + ">";
					}else
						for(var p in o)
							s += "<" + p + ">" + this.serialize(o[p]) + "</" + p + ">";
					}
				break;
			default:
				break;
		}
		return s;
	},
	request : function (o){
		// Check the availibility of a Cache of the specified wsdl from url
		if(this.wsdlCache[o.url]){
			var wsdl = this.wsdlCache[o.url];
			// Get our NameSpace
			var ns = wsdl.responseXML.documentElement.attributes.getNamedItem("targetNamespace").nodeValue;
			if(this.defaultHeaders&&!o.headers) o.headers = this.defaultHeaders;
			// passThis because this changes once we get to the callback
			var passThis = this;
			 $.ajax({
			    type: "POST",
			    url: this.getElementsByTagName(wsdl,"address")[0].attributes.getNamedItem("location").nodeValue,
				complete: function(r){
					r=passThis.translateNode(r.responseXML.lastChild,passThis.getTypes(wsdl));
					if (typeof(r)=='object'&&r['return']) r=r['return'];
					
					// Specifics for Coldfusion Body/Response/Return
					if(typeof(r)=='object'&&typeof(r.Body)=='object'&&typeof(r.Body[o.method+'Response'])=='object'&&typeof(r.Body[o.method+'Response'][o.method+'Return'])=='object')
						var r = r.Body[o.method+'Response'][o.method+'Return'];
					
					// Specifics for converting a coldfusion query response into something more usable
					if (typeof(r)=='object'&&typeof(r.columnList)=='object'){
						var allRows = [];
						if(typeof(r.data[0])!='object')r.data=[r.data]; // Fix for only one record returned in different format
						for(var i = 0; i< r.data.length; i++){
							var thisRow = {};
							for( var j = 0; j < r.columnList.length; j++){
								thisRow[r.columnList[j]] = r.data[i][j];
							}
							allRows.push(thisRow);
						}
						r=allRows;
					}
					
					
					
					// Specifics for converting a coldfusion object response into something more usable
					if (typeof(r)=='object'&&typeof(r.length)=='number'&&typeof(r[0])=='object'&&typeof(r[0].key)!='undefined'){
						var allRows = {};
						for(var i = 0; i< r.length; i++){
							if (typeof(r[i])=='object')
								allRows[r[i].key] = r[i].value;
						}
						r=allRows;
					}
					
					if(o.callback) o.callback(r);
				},
				beforeSend: function(req) {
					req.setRequestHeader("SOAPAction",ns.replace(/([^\/]$)/,"$1/")+o.method);
				},
				data: "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope "
				+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
				+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
				+ "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
				+ (o.headers?"<soap:Header>"+this.serialize(o.headers)+"</soap:Header>":"")
				+ "<soap:Body>"
				+ "<" + o.method + " xmlns=\"" + ns + "\">"
				+ this.serialize(o.params)
				+ "</" + o.method + "></soap:Body></soap:Envelope>",
				processData: false
			});
		}else{
			// Get the wsdl and Cache it, then continue with the request
			// passThis because this changes once we get to the callback
			var passThis = this;
			$.ajax({
			  	type: "GET",
				url: o.url.replace(/^http:/,'services/proxy.php?http:').replace(/([^?][^w][^s][^d][^l])$/i,"$1?wsdl"),
				complete: function(r){
					passThis.wsdlCache[o.url]=r;
					passThis.request(o);
				}
			});
		}
	}
};

}

window.onload = init;


