

// uniTip - written by Nathan Ford for Unit Interactive
//
// uniTip is based on qTip:
// qTip - CSS Tool Tips - by Craig Erskine
// http://qrayg.com

var uniTipTag = "a,img,div,input"; //Which tag do you want to uniTip-ize? Keep it lowercase. No spaces around commas.//
var uniTipClass = "tip"; //Which classes do you want to uniTip-ize? If you leave this blank, then all the tags designated above will get uniTip-ized. Match case. No spaces around commas.

var uniTipX = 0; // X offset from cursor//
var uniTipY = 15; // Y offset from cursor//

//______________________________________________There's no need to edit anything below this line//

var offsetX = uniTipX, offsetY = uniTipY, elewidth = null, eleheight = null, tipid = null, tiptop = null, tipbot = null, tipcapin=null, tippointin=null, altText=false;

var x=0, y=0, WinWidth=0, WinHeight=0, TipWidth=0, TipHeight=0, CapHeight=0, PointHeight=0;

// first, find all the correct elements
init = function () {
	var elementList = uniTipTag.split(",");
	for(var j = 0; j < elementList.length; j++) {	
		var elements = document.getElementsByTagName(elementList[j]);
		
		if(elements) {
			for (var i = 0; i < elements.length; i ++) {
				if (uniTipClass != '') {
				
					var elClass = elements[i].className;
					var elClassList = uniTipClass.split(",");
					
					for (var h=0; h < elClassList.length; h++) { if (elClass.match(elClassList[h])) unitipize(elements[i]); }
					
				} else unitipize(elements[i]);
			}
		}
	}
}

// next, add the tooltip function to those elements
unitipize = function (element) {
	var a = element;
	altText = (a.alt && a.getAttribute("alt") != '' ) ? true : false;
	var sTitle = (altText == true) ? a.getAttribute("alt") : a.getAttribute("title");				
	if(sTitle) {
		a.onmouseover = function() {build(a, sTitle);};
		a.onmouseout = function() {hide(a, sTitle);};
	}
}

// now, we build the tooltip
build = function (a, sTitle) {
	
	if (a.title) a.title = "";
	if (altText==true) a.alt = "";
	
	var tipContainer = document.createElement("div");
	tipContainer.setAttribute("id", "unitip");
	document.body.appendChild(tipContainer);
	
	var tipContainerTop = document.createElement("div");
	tipContainerTop.setAttribute("id", "unitippoint");
	tipContainer.appendChild(tipContainerTop);
	
	var tipContainerMid = document.createElement("div");
	tipContainerMid.setAttribute("id", "unitipmid");
	tipContainer.appendChild(tipContainerMid);
	
	var tipContainerBot = document.createElement("div");
	tipContainerBot.setAttribute("id", "unitipcap");
	tipContainer.appendChild(tipContainerBot);

	tipid = document.getElementById("unitip");
	tippoint = document.getElementById("unitippoint");
	tipmid = document.getElementById("unitipmid");
	tipcap = document.getElementById("unitipcap");
	
	document.getElementById("unitipmid").innerHTML = sTitle;
	tipid.style.display = "block";
	
	elewidth = document.getElementById("unitipmid").offsetWidth;
	eleheight = document.getElementById("unitip").offsetHeight;
	
	WinWidth = document.body.offsetWidth;
	WinHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
	
	CapHeight = document.getElementById('unitipcap').offsetHeight;
	PointHeight = document.getElementById('unitippoint').offsetHeight;
	
	if (typeof pngfix=="function") { // if IE, rebuilds wraps unitippoint and unitipcap in outer div
		if (tippoint.currentStyle.backgroundImage.match(/\.png/gi)) {
			var tipP = tippoint.innerHTML;
			
			tippoint.id = 'unitipP'; // switch unitippoint to outer div
			
			tippoint.style.overflow = "hidden";
			tippoint.style.height = PointHeight + "px";
			tippoint.style.width = elewidth + "px";
			tippoint.style.position = "relative";
			tippoint.style.display = "block";
			
			tippoint.innerHTML = '<div id="unitippoint">' + tipP + '</div>'; // inject unitippoint
			
			tippointin = document.getElementById("unitippoint");  // redefine styles for unitippoint to fit filter image
			tippointin.style.width = (elewidth * 2) + "px";
			tippointin.style.height = (PointHeight * 2) + "px";
			tippointin.style.backgroundImage = tippoint.style.backgroundImage;
			tippointin.style.position = "absolute";
			
			tippoint.style.backgroundImage = "none";
		}
		if (tipcap.currentStyle.backgroundImage.match(/\.png/gi)) {
			var tipC = tipcap.innerHTML;
			
			tipcap.id = 'unitipC';
			
			tipcap.style.overflow = "hidden";
			tipcap.style.height = CapHeight + "px";
			tipcap.style.width = elewidth + "px";
			tipcap.style.position = "relative";
			tipcap.style.display = "block";
			
			tipcap.innerHTML = '<div id="unitipcap">' + tipP + '</div>';
			
			tipcapin = document.getElementById("unitipcap");
			tipcapin.style.height = (CapHeight * 2) + "px";
			tipcapin.style.backgroundImage = tipcap.style.backgroundImage;
			tipcapin.style.position = "absolute";
			
			tipcap.style.backgroundImage = "none";
		}
		
		pngfix(); // png fix
		
	}
	
	document.onmousemove = function (evt) {move (evt)};
}

// now, we track the mouse and make the tooltip follow
move = function (evt) {
	
	if (window.event) {
		x = window.event.clientX;
		y = window.event.clientY;
		
		if (document.documentElement.scrollLeft) tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.documentElement.scrollLeft) + "px" :  (x + offsetX + document.documentElement.scrollLeft) + "px";
		else tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.body.scrollLeft) + "px" :  (x + offsetX + document.body.scrollLeft) + "px";
		
		if (document.documentElement.scrollTop) tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.documentElement.scrollTop) + "px" : (y + offsetY + document.documentElement.scrollTop) + "px";
		else tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.body.scrollTop) + "px" : (y + offsetY + document.body.scrollTop) + "px";
		
	} else {
		x = evt.clientX;
		y = evt.clientY;	
		
		tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + window.scrollX) + "px" :  (x + offsetX + window.scrollX) + "px";
		tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + window.scrollY) + "px" : (y + offsetY + window.scrollY) + "px";
	}
	
	TipWidth = x + elewidth + 20;
	TipHeight = y + eleheight + 20;
	
	if (TipHeight >= WinHeight ) { // rearrange the inner divs [123 to 321]
		tipid.removeChild(tippoint);
		tipid.removeChild(tipmid);
		tipid.removeChild(tipcap);
		tipid.appendChild(tipcap);
		tipid.appendChild(tipmid);
		tipid.appendChild(tippoint);
	} else {  // rearrange the inner divs [321 to 123]
		tipid.removeChild(tippoint);
		tipid.removeChild(tipmid);
		tipid.removeChild(tipcap);
		tipid.appendChild(tippoint);
		tipid.appendChild(tipmid);
		tipid.appendChild(tipcap);
	}
	
	if (TipHeight >= WinHeight) {
		
		if (document.getElementById('uniTipP')) {
			tippointin.style.left = (TipWidth >= WinWidth ) ? "-" + elewidth + "px" : "0px";
			tippointin.style.top = "-" + PointHeight + "px";
		} else tippoint.style.backgroundPosition = (TipWidth >= WinWidth ) ? "right bottom" : "left bottom";
		
		if (document.getElementById('uniTipC')) tipcapin.style.top = "-" + CapHeight + "px";
		else tipcap.style.backgroundPosition = "0 -" + CapHeight + "px";
		
	} else {
		
		if (document.getElementById('uniTipP')) {
			tippointin.style.left = (TipWidth >= WinWidth ) ? "-" + elewidth + "px" : "0px";
			tippointin.style.top = "0px";
		} else tippoint.style.backgroundPosition = (TipWidth >= WinWidth ) ? "right top" : "left top";
		
		if (document.getElementById('uniTipC')) tipcapin.style.top = "0px";
		else tipcap.style.backgroundPosition = "0 0";
		
	}
}

// lastly, hide the tooltip
hide = function (a, sTitle) {
	document.getElementById("unitipmid").innerHTML = "";
	document.onmousemove = '';
	document.body.removeChild(tipid);
	tipid.style.display = "none";
	if (altText==false) a.setAttribute("title", sTitle);
	else a.setAttribute("alt", sTitle);
	altText=false;
}

// add the event to the page
if (window.addEventListener) window.addEventListener("load", init, false);
if (window.attachEvent) window.attachEvent("onload", init);




/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/*
 * jQuery 1.2.3 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008/05/29 00:54:05 $
 * $Rev: 4663 $
 */
(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
selector=[];}}else
return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
 
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-07-21 18:44:59 -0500 (Sat, 21 Jul 2007) $
 * $Rev: 2446 $
 *
 * Version 2.1.1 bgiframe
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b($){$.m.E=$.m.g=b(s){h($.x.10&&/6.0/.I(D.B)){s=$.w({c:\'3\',5:\'3\',8:\'3\',d:\'3\',k:M,e:\'F:i;\'},s||{});C a=b(n){f n&&n.t==r?n+\'4\':n},p=\'<o Y="g"W="0"R="-1"e="\'+s.e+\'"\'+\'Q="P:O;N:L;z-H:-1;\'+(s.k!==i?\'G:J(K=\\\'0\\\');\':\'\')+\'c:\'+(s.c==\'3\'?\'7(((l(2.9.j.A)||0)*-1)+\\\'4\\\')\':a(s.c))+\';\'+\'5:\'+(s.5==\'3\'?\'7(((l(2.9.j.y)||0)*-1)+\\\'4\\\')\':a(s.5))+\';\'+\'8:\'+(s.8==\'3\'?\'7(2.9.S+\\\'4\\\')\':a(s.8))+\';\'+\'d:\'+(s.d==\'3\'?\'7(2.9.v+\\\'4\\\')\':a(s.d))+\';\'+\'"/>\';f 2.T(b(){h($(\'> o.g\',2).U==0)2.V(q.X(p),2.u)})}f 2}})(Z);',62,63,'||this|auto|px|left||expression|width|parentNode||function|top|height|src|return|bgiframe|if|false|currentStyle|opacity|parseInt|fn||iframe|html|document|Number||constructor|firstChild|offsetHeight|extend|browser|borderLeftWidth||borderTopWidth|userAgent|var|navigator|bgIframe|javascript|filter|index|test|Alpha|Opacity|absolute|true|position|block|display|style|tabindex|offsetWidth|each|length|insertBefore|frameborder|createElement|class|jQuery|msie'.split('|'),0,{}))
 
 
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('r.5=w(k,d,a){4(m d!=\'H\'){a=a||{};4(d===p){d=\'\';a.3=-1}2 g=\'\';4(a.3&&(m a.3==\'n\'||a.3.u)){2 f;4(m a.3==\'n\'){f=G E();f.C(f.B()+(a.3*z*s*s*v))}o{f=a.3}g=\'; 3=\'+f.u()}2 b=a.7?\'; 7=\'+(a.7):\'\';2 e=a.9?\'; 9=\'+(a.9):\'\';2 l=a.t?\'; t\':\'\';6.5=[k,\'=\',K(d),g,b,e,l].I(\'\')}o{2 h=p;4(6.5&&6.5!=\'\'){2 c=6.5.F(\';\');D(2 i=0;i<c.8;i++){2 j=r.A(c[i]);4(j.q(0,k.8+1)==(k+\'=\')){h=y(j.q(k.8+1));x}}}J h}};',47,47,'||var|expires|if|cookie|document|path|length|domain|||||||||||||typeof|number|else|null|substring|jQuery|60|secure|toUTCString|1000|function|break|decodeURIComponent|24|trim|getTime|setTime|for|Date|split|new|undefined|join|return|encodeURIComponent'.split('|'),0,{}))
 
 
/*
Popupwindow plugin for jQuery.
by: Tony Petruzzi
homepage: http://rip747.wordpress.com
plugin download: http://rip747.wordpress.com/2007/03/02/the-return-of-popupwindow-jquery-plugin/
  
Takes a link and will create a popupwindow based on the href of the link. You can
over ride the default setting by passing your own settings using the REL attribute
of the link. You can have different setting for each link if you'd like.
   
To use just include the plugin in the HEAD section of the page AFTER calling jQuery.
After that, use jQuery to find the links you want and pass any parameters you want
 
04/04/2007:
 
1) added profiles so you don't have to pass the settings for each link anymore.
2) remove resize as a setting and add the correct setting resizable
3) removed example text from this file and made an index.htm files to house example.
4) add example of using profiles to the new examples page.
5) example pulls the latest jquery library from jquery.com.
 
05/14/2007
 
1) removed trailing comma in settings that was causing IE to bottom out with an error.
 
*/
jQuery.fn.popupwindow = function(p)
{
 
	var profiles = p || {};
 
	return this.each(function(index){
		var setting, parameters, mysettings, b, a;
		
		// for overrideing the default settings
		mysettings = (jQuery(this).attr("rel") || "").split(",");
 
		
		settings = {
			height:600, // sets the height in pixels of the window.
			width:600, // sets the width in pixels of the window.
			toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			left:0, // left position when the window appears.
			top:0, // top position when the window appears.
			center:0 // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
		};
 
		// if mysettings length is 1 and not a value pair then assume it is a profile declaration
		// and see if the profile settings exists
 
 
		if(mysettings.length == 1 && mysettings[0].split(":").length == 1)
		{
			a = mysettings[0];
			// see if a profile has been defined
			if(typeof profiles[a] != "undefined")
			{
				settings = jQuery.extend(settings, profiles[a]);
			}
		}
		else
		{
			// overrides the settings with parameter passed in using the rel tag.
			for(var i=0; i < mysettings.length; i++)
			{
				b = mysettings[i].split(":");
				if(typeof settings[b[0]] != "undefined" && b.length == 2)
				{
					settings[b[0]] = b[1];
				}
			}
		}
 
		// center the window
		if (settings.center == 1)
		{
			settings.top = (screen.height-settings.height)/2;
			settings.left = (screen.width-settings.width)/2;
		}
		
		parameters = "height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars  + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left  + ",screenX=" + settings.left + ",top=" + settings.top  + ",screenY=" + settings.top;
		
		jQuery(this).bind("click", function(){
			var name = "PopUpWindow" + index;
			window.open(this.href, name, parameters).focus();
			return false;
		});
	});
 
};
 
 
/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 2.0  (04/11/2007)
 * @requires jQuery v1.1.3 or above
 *
 * Examples at: http://jquery.khurshid.com
 * Copyright (c) 2007 Kush M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 
 /**
  *
  * @example
  *
  * optional if location of pixel.gif if different to default which is images/pixel.gif
  * $.ifixpng('media/pixel.gif');
  *
  * $('img[@src$=.png], #panel').ifixpng();
  *
  * @apply hack to all png images and #panel which icluded png img in its css
  *
  * @name ifixpng
  * @type jQuery
  * @cat Plugins/Image
  * @return jQuery
  * @author jQuery Community
  */
(function($) {
 
	/**
	 * helper variables and function
	 */
	$.ifixpng = function(customPixel) {
		$.ifixpng.pixel = customPixel;
	};
	
	$.ifixpng.getPixel = function() {
		return $.ifixpng.pixel || '/wcsstore/ConsumerDirectStorefrontAssetStore/images/en_US/pixel.gif';
	};
	
	var hack = {
		ltie7  : $.browser.msie && $.browser.version < 7,
		filter : function(src) {
			return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
		}
	};
	
	/**
	 * Applies ie png hack to selected dom elements
	 *
	 * $('img[@src$=.png]').ifixpng();
	 * @desc apply hack to all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').ifixpng();
	 * @desc apply hack to element #panel and all images with png extensions
	 *
	 * @name ifixpng
	 */
	 
	$.fn.ifixpng = hack.ltie7 ? function() {
    	return this.each(function() {
			var $$ = $(this);
			var base = $('base').attr('href'); // need to use this in case you are using rewriting urls
			if ($$.is('img') || $$.is('input')) { // hack image tags present in dom
				if ($$.attr('src')) {
					if ($$.attr('src').match(/.*\.png([?].*)?$/i)) { // make sure it is png image
						// use source tag value if set 
						var source = (base && $$.attr('src').substring(0,1)!='/') ? base + $$.attr('src') : $$.attr('src');
						// apply filter
						$$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()})
						  .attr({src:$.ifixpng.getPixel()})
						  .positionFix();
					}
				}
			} else { // hack png css properties present inside css
				var image = $$.css('backgroundImage');
				if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
					image = RegExp.$1;
					$$.css({backgroundImage:'none', filter:hack.filter(image)})
					  .children().children().positionFix();
				}
			}
		});
	} : function() { return this; };
	
	/**
	 * Removes any png hack that may have been applied previously
	 *
	 * $('img[@src$=.png]').iunfixpng();
	 * @desc revert hack on all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').iunfixpng();
	 * @desc revert hack on element #panel and all images with png extensions
	 *
	 * @name iunfixpng
	 */
	 
	$.fn.iunfixpng = hack.ltie7 ? function() {
    	return this.each(function() {
			var $$ = $(this);
			var src = $$.css('filter');
			if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) { // get img source from filter
				src = RegExp.$1;
				if ($$.is('img') || $$.is('input')) {
					$$.attr({src:src}).css({filter:''});
				} else {
					$$.css({filter:'', background:'url('+src+')'});
				}
			}
		});
	} : function() { return this; };
	
	/**
	 * positions selected item relatively
	 */
	 
	$.fn.positionFix = function() {
		return this.each(function() {
			var $$ = $(this);
			var position = $$.css('position');
			if (position != 'absolute' && position != 'relative') {
				$$.css({position:'relative'});
			}
		});
	};
 
})(jQuery);
 
/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
*	interval: 50,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 100,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @return    The object (aka "this") that called hoverIntent, and the event object
* @author    Brian Cherne <brian@cherne.net>
*/
 
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
 
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate$
 * $Rev$
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */
 
(function($){
	
$.dimensions = {
	version: '@VERSION'
};
 
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		var val = this.is(':visible') ? 
				this[0]['offset' + name] : 
				num( this, name.toLowerCase() )
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
		
		return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});
 
// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});
 
$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});
 
function num(el, prop) {
	return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};
 
})(jQuery);
 
/*
 * DOMWindow
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
 
var DOMWindow_pathToImage = "/images/blank.gif"; 
 
//on page load call DOMWindow_init
$(document).ready(function(){   
	DOMWindow_init('a.DOMWindow, area.DOMWindow, input.DOMWindow, button.DOMWindow');//pass where to apply DOMWindow
	imgLoader = new Image();// preload image
	imgLoader.src = DOMWindow_pathToImage;
});
 
//add DOMWindow to href, area, input, and button elements that have a class of .DOMWindow
function DOMWindow_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || null;
	var a = this.href || this.name;
	var g = this.rel || false;
	DOMWindow_show(t,a,g);
	this.blur();
	return false;
	});
}
 
function DOMWindow_show(caption, url, rel) {//function called when the user clicks on a thickbox link
 
	var viewPortHeight = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	//var scrollOffsetHeight = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
	var scrollOffsetHeight = $('#allContent').scrollTop();
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
		if (document.getElementById("DOMWindow_HideSelect") === null) {//iframe to hide select elements in ie6
			$("#allContent").append("<iframe id='DOMWindow_HideSelect'></iframe><div id='DOMWindow_overlay'></div><div id='DOMWindow_window'></div>");
		}
	}else{//all others
		if(document.getElementById("DOMWindow_overlay") === null){
			$("#allContent").append("<div id='DOMWindow_overlay'></div><div id='DOMWindow_window'></div>");
		}
	}
	
	$("#DOMWindow_overlay").click(DOMWindow_remove);
	
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	DOMWindow_toggleMagnifiers(false);
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	var baseURL;
	if(url.indexOf("?")!==-1){ //if there is a query string involved
		baseURL = url.substr(0, url.indexOf("?")); //remove query string from URL
	}else{ 
		baseURL = url;
	}
	
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	var queryOnly = url.replace(/^[^\?]+\??/,''); //get query string
	//alert(queryOnly);
	var breakOffDOMWindowQuery = queryOnly.split('startDOMWindow'); //break query string into array at &startDOMWindow
	//alert(breakOffDOMWindowQuery);
	var paramsDOMWindow = DOMWindow_parseQuery( breakOffDOMWindowQuery[1] ); //place query into an object
	var paramsQuery = DOMWindow_parseQuery( breakOffDOMWindowQuery[0].slice(0,-1) ); //place query into an object
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
	DOMWindow_resizeOverlay(); //resize overlay
	
	if(paramsDOMWindow['overlay'] != "false"){
		if(DOMWindow_detectMacXFF()){
			//use png overlay so hide flash in FF Mac
			$("#DOMWindow_overlay").addClass("DOMWindow_overlayMacFFBGHack");
		}else{
			$("#DOMWindow_overlay").addClass("DOMWindow_overlayBG");//use background and opacity
		}
	}
	
///////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	if(rel){
		caption= rel;
	}else{
		if(caption===null){caption="";}
	}
	
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	$("body").append("<div id='DOMWindow_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
	$('#DOMWindow_load').show();//show loader
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	DOMWindow_WIDTH = (paramsDOMWindow['width']*1) + 20 || 630; //defaults to 630 if no paramaters were added to URL
	DOMWindow_HEIGHT = (paramsDOMWindow['height']*1) + 20 || 440; //defaults to 440 if no paramaters were added to URL
	ajaxContentW = DOMWindow_WIDTH - 20;
	ajaxContentH = DOMWindow_HEIGHT - 20;
	
	$('#DOMWindow_window').css("width",DOMWindow_WIDTH + 'px');
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	if(paramsDOMWindow['iframeDOMWindow'] == "true"){// either iframe or ajax window		
			$("#DOMWindow_iframeContent").remove();
			if(paramsDOMWindow['modal'] != "true"){//iframe no modal
				$("#DOMWindow_window").append("<div id='DOMWindow_title'><div id='DOMWindow_ajaxWindowTitle'>"+caption+"</div><div id='DOMWindow_closeAjaxWindow'><a href='#' id='DOMWindow_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+baseURL + '?' + breakOffDOMWindowQuery[0].slice(0,-1) +"' id='DOMWindow_iframeContent' name='DOMWindow_iframeContent"+Math.round(Math.random()*1000)+"' onload='DOMWindow_showIframe()' style='width:"+(ajaxContentW + 19)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
			}else{//iframe modal
				//$("#DOMWindow_overlay").unbind();
					$("#DOMWindow_window").append("<iframe frameborder='0' hspace='0' src='"+baseURL + '?' + breakOffDOMWindowQuery[0].slice(0,-1) +"' id='DOMWindow_iframeContent' name='DOMWindow_iframeContent"+Math.round(Math.random()*1000)+"' onload='DOMWindow_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
			}
	}else{// not an iframe, ajax
			if($("#DOMWindow_window").css("visibility") != "visible"){//if DOMWindow is not showing
				if(paramsDOMWindow['modal'] != "true"){//ajax no modal
				$("#DOMWindow_window").append("<div id='DOMWindow_title'><div id='DOMWindow_ajaxWindowTitle'>"+caption+"</div><div id='DOMWindow_closeAjaxWindow'><a href='#' id='DOMWindow_closeWindowButton'>close</a></div></div><div id='DOMWindow_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
				}else{//ajax modal
				//$("#DOMWindow_overlay").unbind();
				$("#DOMWindow_window").append("<div id='DOMWindow_ajaxContent' class='DOMWindow_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
				}
			}else{//this means the window is already up, and load new content via ajax
				if(paramsDOMWindow['modal'] == "true"){//ajax modal
					$('#DOMWindow_title').hide();
				}else{
					$('#DOMWindow_title').show();
				}
				var DOMWindowCurrentWidth = $("#DOMWindow_ajaxContent")[0].style.width;
				var DOMWindowCurrentHeight = $("#DOMWindow_ajaxContent")[0].style.height;
				if(DOMWindowCurrentWidth != ajaxContentW || DOMWindowCurrentHeight != ajaxContentH){
					$("#DOMWindow_window").css('visibility','hidden');
					$("#DOMWindow_ajaxContent")[0].style.width = ajaxContentW +"px";
					$("#DOMWindow_ajaxContent")[0].style.height = ajaxContentH +"px";
				}
				$("#DOMWindow_ajaxContent")[0].scrollTop = 0;
				$("#DOMWindow_ajaxWindowTitle").html(caption);
			}
	}
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	$("#DOMWindow_closeWindowButton").click(DOMWindow_remove);
	
	if(paramsDOMWindow['inlineDOMWindow'] == "true"){
		$("#DOMWindow_ajaxContent").append($('#' + paramsDOMWindow['inlineId']).children());
		$("#DOMWindow_window").unload(function () {
			// move elements back when you're finished
			$('#' + paramsDOMWindow['inlineId']).append( $("#DOMWindow_ajaxContent").children() );				
		});
		DOMWindow_position();
		$("#DOMWindow_load").remove();
		$("#DOMWindow_window").css('visibility','visible');
	}else if(paramsDOMWindow['iframeDOMWindow'] == "true"){
		DOMWindow_position();
		if($.browser.safari){//safari needs help because it will not fire iframe onload
			$("#DOMWindow_load").remove();
			$("#DOMWindow_window").css('visibility','visible');
		}
	}else{
		if(paramsDOMWindow['get'] == "true"){
			$("#DOMWindow_ajaxContent").load(baseURL + '?' + breakOffDOMWindowQuery[0] + "&random=" + (new Date().getTime()),function(){
			DOMWindow_position();
			$("#DOMWindow_load").remove();
			DOMWindow_init("#DOMWindow_ajaxContent a.DOMWindow,#DOMWindow_ajaxContent area.DOMWindow,#DOMWindow_ajaxContent button.DOMWindow,#DOMWindow_ajaxContent input.DOMWindow");
			$("#DOMWindow_window").css('visibility','visible');
			});
		}else{
			$("#DOMWindow_ajaxContent").load(url,paramsQuery,function(){
			DOMWindow_position();
			$("#DOMWindow_load").remove();
			DOMWindow_init("#DOMWindow_ajaxContent a.DOMWindow,#DOMWindow_ajaxContent area.DOMWindow,#DOMWindow_ajaxContent button.DOMWindow,#DOMWindow_ajaxContent input.DOMWindow");
			$("#DOMWindow_window").css('visibility','visible');
			});
		}
	}
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
	if(DOMWindow_HEIGHT + 50 > viewPortHeight){// if the DOMWindow is bigger than the viewport make the DOMWindow static
	var DOMWindowTopOffset = paramsDOMWindow['offset'] ? paramsDOMWindow['offset']*1 : 20;
		$('#DOMWindow_window')[0].style.top = (DOMWindowTopOffset + scrollOffsetHeight) + 'px';
	}
 
	$("#allContent").scroll(function(){
		DOMWindow_position();
	});
	
	$(window).bind('resize.DOMW',function(){
		if($("#DOMWindow_window")[0]){
		DOMWindow_position();
		}
	});
	
	//if(!paramsDOMWindow['modal']){//if not a modal add the keyevent to close DOMWindow using ESC key
		document.onkeyup = function(e){ 	
			if (e == null) { // ie
				keycode = event.keyCode;
			} else { // mozilla
				keycode = e.which;
			}
			if(keycode == 27){ // ESC key
				DOMWindow_remove();
			}	
		}
	//}
	
}//end DOMWindow_show()
 
//helper functions below
 
function DOMWindow_showIframe(){
	$("#DOMWindow_load").remove();
	$("#DOMWindow_window").css('visibility','visible');
}
 
function DOMWindow_remove() {
	if($('#DOMWindow_HideSelect')[0]){ 
		$('select').css('visibility','visible'); 
	} 
	$(window).unbind(".DOMW");
	$("#allContent").unbind("scroll");
	$("#DOMWindow_closeWindowButton").unbind('click');
	$("#DOMWindow_overlay").unbind('click');
	$("#DOMWindow_window").fadeOut("fast",function(){$('#DOMWindow_window,#DOMWindow_overlay').trigger("unload").unbind().remove();});
	$("#DOMWindow_load").remove();
	$("#DOMWindow_HideSelect").remove();
	DOMWindow_toggleMagnifiers(true);
	return false;
}
 
function openOnlineDealersFromDomWindow(nameURL){
	var theURL = nameURL;
	DOMWindow_remove();
	setTimeout(function(){DOMWindow_show('Online Dealers',theURL + ';startDOMWindow&amp;iframeDOMWindow=true&amp;height=525&amp;width=540',null);},1000);
}
	
 
function DOMWindow_position() {
	var viewPortHeight = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	var viewPortWidth = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	var scrollOffsetHeight = $('#allContent').scrollTop();
	var scrollOffsetWidth = $('#allContent').scrollLeft();
	
	if(DOMWindow_HEIGHT  + 50 > viewPortHeight){//added 50 to be safe
		$('#DOMWindow_window').css("left",Math.round(viewPortWidth/2) + scrollOffsetWidth - Math.round((DOMWindow_WIDTH+30)/2));
	}else{
		$('#DOMWindow_window').css("left",Math.round(viewPortWidth/2) + scrollOffsetWidth - Math.round((DOMWindow_WIDTH+15)/2));
		$('#DOMWindow_window').css("top",Math.round(viewPortHeight/2) + scrollOffsetHeight - Math.round((DOMWindow_HEIGHT+30)/2));
	}
}
 
function DOMWindow_parseQuery ( query ) {
	var Params = {};
	if ( ! query ) {return Params;}// return empty object
	var Pairs = query.split(/[;&]/);
	for ( var i = 0; i < Pairs.length; i++ ) {
	  var KeyVal = Pairs[i].split('=');
	  if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
	  var key = unescape( KeyVal[0] );
	  var val = unescape( KeyVal[1] );
	  val = val.replace(/\+/g, ' ');
	  Params[key] = val;
	}
	return Params;
}
 
function DOMWindow_resizeOverlay(){
	var h = $("#allContent")[0].scrollHeight > $("#allContent").height() ? $("#allContent")[0].scrollHeight : $("#allContent").height();
	if($.browser.safari){
		var w = $("#allContent").width();
		$("#DOMWindow_overlay").css({'width':w - 15 +'px'});
	}
	$("#DOMWindow_overlay").css({'height':h +'px'});
	if($('#DOMWindow_HideSelect')[0]){ 
		$('#DOMWindow_HideSelect').css({'height':h +'px'}); 
			$('select').css('visibility','hidden'); 
	} 
	
}
 
function DOMWindow_detectMacXFF() {
	var userAgent = navigator.userAgent.toLowerCase();
	if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
		return true;
	}
}
 
function DOMWindow_toggleMagnifiers(enable){
	if(window.fluid){
	   var pmr = fluid.application;
	   var presentations = pmr.presentations;
	   for(var id in presentations){
		  if(id.indexOf("zoom") == 0){
			 var zoom = presentations[id];
			 zoom.enabled = enable;
		  }
	   }
	}
}
 
/**
 *
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */
 
(function($) {
	/**
	 * attaches a character counter to each textarea element in the jQuery object
	 * usage: $("#myTextArea").charCounter(max, settings);
	 */
	
	$.fn.charCounter = function(max, settings) {
		max = max || 100;
		settings = $.extend({
			container: "<span>",
			classname: "charcounter",
			format: "%1&nbsp;",
			pulse: true
		}, settings);
		var p;
		
		function count(el, container) {
			el = $(el);
			if (el.val().length > max) {
			    el.val(el.val().substring(0, max));
			    if (settings.pulse && !p) {
			    	pulse(container, true);
			    };
			};
			container.html(settings.format.replace(/%1/, (max - el.val().length)));
		};
		
		function pulse(el, again) {
			if (p) {
				window.clearTimeout(p);
				p = null;
			};
			el.animate({ opacity: 0.1 }, 100, function() {
				$(this).animate({ opacity: 1.0 }, 100);
			});
			if (again) {
				p = window.setTimeout(function() { pulse(el) }, 200);
			};
		};
		
		return this.each(function() {
			var container = (!settings.container.match(/^<.+>$/)) 
				? $(settings.container) 
				: $(settings.container)
					.insertAfter(this)
					.addClass(settings.classname);
			$(this)
				.bind("keydown", function() { count(this, container); })
				.bind("keypress", function() { count(this, container); })
				.bind("keyup", function() { count(this, container); })
				.bind("focus", function() { count(this, container); })
				.bind("mouseover", function() { count(this, container); })
				.bind("mouseout", function() { count(this, container); })
				.bind("paste", function() { 
					var me = this;
					setTimeout(function() { count(me, container); }, 10);
				});
			if (this.addEventListener) {
				this.addEventListener('input', function() { count(this, container); }, false);
			};
			count(this, container);
		});
	};
 
})(jQuery);
 
 
/*
 * Tabs 3 - New Wave Tabs
 *
 * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 */
(function($){$.ui=$.ui||{};$.fn.tabs=function(){var method=typeof arguments[0]=='string'&&arguments[0];var args=method&&Array.prototype.slice.call(arguments,1)||arguments;return method=='length'?$.data(this[0],'tabs').$tabs.length:this.each(function(){if(method){var tabs=$.data(this,'tabs');if(tabs)tabs[method].apply(tabs,args);}else
new $.ui.tabs(this,args[0]||{});});};$.ui.tabs=function(el,options){var self=this;this.options=$.extend({},$.ui.tabs.defaults,options);this.element=el;if(options.selected===null)this.options.selected=null;this.options.event+='.tabs';$(el).bind('setData.tabs',function(event,key,value){if((/^selected/).test(key))self.select(value);else{self.options[key]=value;self.tabify();}}).bind('getData.tabs',function(event,key){return self.options[key];});$.data(el,'tabs',this);this.tabify(true);};$.ui.tabs.defaults={selected:0,unselect:false,event:'click',disabled:[],cookie:null,spinner:'Loading&#8230;',cache:false,idPrefix:'ui-tabs-',ajaxOptions:{},fx:null,tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>',panelTemplate:'<div></div>',navClass:'ui-tabs-nav',selectedClass:'ui-tabs-selected',unselectClass:'ui-tabs-unselect',disabledClass:'ui-tabs-disabled',panelClass:'ui-tabs-panel',hideClass:'ui-tabs-hide',loadingClass:'ui-tabs-loading'};$.extend($.ui.tabs.prototype,{tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},ui:function(tab,panel){return{instance:this,options:this.options,tab:tab,panel:panel};},tabify:function(init){this.$lis=$('li:has(a[href])',this.element);this.$tabs=this.$lis.map(function(){return $('a',this)[0];});this.$panels=$([]);var self=this,o=this.options;this.$tabs.each(function(i,a){if(a.hash&&a.hash.replace('#',''))self.$panels=self.$panels.add(a.hash);else if($(a).attr('href')!='#'){$.data(a,'href.tabs',a.href);$.data(a,'load.tabs',a.href);var id=self.tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.panelClass).insertAfter(self.$panels[i-1]||self.element);$panel.data('destroy.tabs',true);}self.$panels=self.$panels.add($panel);}else
o.disabled.push(i+1);});if(init){$(this.element).hasClass(o.navClass)||$(this.element).addClass(o.navClass);this.$panels.each(function(){var $this=$(this);$this.hasClass(o.panelClass)||$this.addClass(o.panelClass);});this.$tabs.each(function(i,a){if(location.hash){if(a.hash==location.hash){o.selected=i;if($.browser.msie||$.browser.opera){var $toShow=$(location.hash),toShowId=$toShow.attr('id');$toShow.attr('id','');setTimeout(function(){$toShow.attr('id',toShowId);},500);}scrollTo(0,0);return false;}}else if(o.cookie){var index=parseInt($.cookie('ui-tabs'+$.data(self.element)),10);if(index&&self.$tabs[index]){o.selected=index;return false;}}else if(self.$lis.eq(i).hasClass(o.selectedClass)){o.selected=i;return false;}});this.$panels.addClass(o.hideClass);this.$lis.removeClass(o.selectedClass);if(o.selected!==null){this.$panels.eq(o.selected).show().removeClass(o.hideClass);this.$lis.eq(o.selected).addClass(o.selectedClass);}var href=o.selected!==null&&$.data(this.$tabs[o.selected],'load.tabs');if(href)this.load(o.selected);o.disabled=$.unique(o.disabled.concat($.map(this.$lis.filter('.'+o.disabledClass),function(n,i){return self.$lis.index(n);}))).sort();$(window).bind('unload',function(){self.$tabs.unbind('.tabs');self.$lis=self.$tabs=self.$panels=null;});}for(var i=0,li;li=this.$lis[i];i++)$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass(o.selectedClass)?'addClass':'removeClass'](o.disabledClass);if(o.cache===false)this.$tabs.removeData('cache.tabs');var hideFx,showFx,baseFx={'min-width':0,duration:1},baseDuration='normal';if(o.fx&&o.fx.constructor==Array)hideFx=o.fx[0]||baseFx,showFx=o.fx[1]||baseFx;else
hideFx=showFx=o.fx||baseFx;var resetCSS={display:'',overflow:'',height:''};if(!$.browser.msie)resetCSS.opacity='';function hideTab(clicked,$hide,$show){$hide.animate(hideFx,hideFx.duration||baseDuration,function(){$hide.addClass(o.hideClass).css(resetCSS);if($.browser.msie&&hideFx.opacity)$hide[0].style.filter='';if($show)showTab(clicked,$show,$hide);});}function showTab(clicked,$show,$hide){if(showFx===baseFx)$show.css('display','block');$show.animate(showFx,showFx.duration||baseDuration,function(){$show.removeClass(o.hideClass).css(resetCSS);if($.browser.msie&&showFx.opacity)$show[0].style.filter='';$(self.element).triggerHandler('tabsshow',[self.ui(clicked,$show[0])],o.show);});}function switchTab(clicked,$li,$hide,$show){$li.addClass(o.selectedClass).siblings().removeClass(o.selectedClass);hideTab(clicked,$hide,$show);}this.$tabs.unbind('.tabs').bind(o.event,function(){var $li=$(this).parents('li:eq(0)'),$hide=self.$panels.filter(':visible'),$show=$(this.hash);if(($li.hasClass(o.selectedClass)&&!o.unselect)||$li.hasClass(o.disabledClass)||$(this).hasClass(o.loadingClass)||$(self.element).triggerHandler('tabsselect',[self.ui(this,$show[0])],o.select)===false){this.blur();return false;}self.options.selected=self.$tabs.index(this);if(o.unselect){if($li.hasClass(o.selectedClass)){self.options.selected=null;$li.removeClass(o.selectedClass);self.$panels.stop();hideTab(this,$hide);this.blur();return false;}else if(!$hide.length){self.$panels.stop();var a=this;self.load(self.$tabs.index(this),function(){$li.addClass(o.selectedClass).addClass(o.unselectClass);showTab(a,$show);});this.blur();return false;}}if(o.cookie)$.cookie('ui-tabs'+$.data(self.element),self.options.selected,o.cookie);self.$panels.stop();if($show.length){var a=this;self.load(self.$tabs.index(this),$hide.length?function(){switchTab(a,$li,$hide,$show);}:function(){$li.addClass(o.selectedClass);showTab(a,$show);});}else
throw'jQuery UI Tabs: Mismatching fragment identifier.';if($.browser.msie)this.blur();return false;});if(!(/^click/).test(o.event))this.$tabs.bind('click.tabs',function(){return false;});},add:function(url,label,index){if(index==undefined)index=this.$tabs.length;var o=this.options;var $li=$(o.tabTemplate.replace(/#\{href\}/,url).replace(/#\{label\}/,label));$li.data('destroy.tabs',true);var id=url.indexOf('#')==0?url.replace('#',''):this.tabId($('a:first-child',$li)[0]);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.panelClass).addClass(o.hideClass);$panel.data('destroy.tabs',true);}if(index>=this.$lis.length){$li.appendTo(this.element);$panel.appendTo(this.element.parentNode);}else{$li.insertBefore(this.$lis[index]);$panel.insertBefore(this.$panels[index]);}o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this.tabify();if(this.$tabs.length==1){$li.addClass(o.selectedClass);$panel.removeClass(o.hideClass);var href=$.data(this.$tabs[0],'load.tabs');if(href)this.load(index,href);}$(this.element).triggerHandler('tabsadd',[this.ui(this.$tabs[index],this.$panels[index])],o.add);},remove:function(index){var o=this.options,$li=this.$lis.eq(index).remove(),$panel=this.$panels.eq(index).remove();if($li.hasClass(o.selectedClass)&&this.$tabs.length>1)this.select(index+(index+1<this.$tabs.length?1:-1));o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n});this.tabify();$(this.element).triggerHandler('tabsremove',[this.ui($li.find('a')[0],$panel[0])],o.remove);},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1)return;var $li=this.$lis.eq(index).removeClass(o.disabledClass);if($.browser.safari){$li.css('display','inline-block');setTimeout(function(){$li.css('display','block');},0);}o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});$(this.element).triggerHandler('tabsenable',[this.ui(this.$tabs[index],this.$panels[index])],o.enable);},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.$lis.eq(index).addClass(o.disabledClass);o.disabled.push(index);o.disabled.sort();$(this.element).triggerHandler('tabsdisable',[this.ui(this.$tabs[index],this.$panels[index])],o.disable);}},select:function(index){if(typeof index=='string')index=this.$tabs.index(this.$tabs.filter('[href$='+index+']')[0]);this.$tabs.eq(index).trigger(this.options.event);},load:function(index,callback){var self=this,o=this.options,$a=this.$tabs.eq(index),a=$a[0],bypassCache=callback==undefined||callback===false,url=$a.data('load.tabs');callback=callback||function(){};if(!url||($.data(a,'cache.tabs')&&!bypassCache)){callback();return;}if(o.spinner){var $span=$('span',a);$span.data('label.tabs',$span.html()).html('<em>'+o.spinner+'</em>');}var finish=function(){self.$tabs.filter('.'+o.loadingClass).each(function(){$(this).removeClass(o.loadingClass);if(o.spinner){var $span=$('span',this);$span.html($span.data('label.tabs')).removeData('label.tabs');}});self.xhr=null;};var ajaxOptions=$.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(a.hash).html(r);finish();callback();if(o.cache)$.data(a,'cache.tabs',true);$(self.element).triggerHandler('tabsload',[self.ui(self.$tabs[index],self.$panels[index])],o.load);o.ajaxOptions.success&&o.ajaxOptions.success(r,s);}});if(this.xhr){this.xhr.abort();finish();}$a.addClass(o.loadingClass);setTimeout(function(){self.xhr=$.ajax(ajaxOptions);},0);},url:function(index,url){this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs',url);},destroy:function(){var o=this.options;$(this.element).unbind('.tabs').removeClass(o.navClass).removeData('tabs');this.$tabs.each(function(){var href=$.data(this,'href.tabs');if(href)this.href=href;var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.$lis.add(this.$panels).each(function(){if($.data(this,'destroy.tabs'))$(this).remove();else
$(this).removeClass([o.selectedClass,o.unselectClass,o.disabledClass,o.panelClass,o.hideClass].join(' '));});}});})(jQuery);
 
//print page plugin
(function($){
	$.fn.onclickPrintPage = function(){
		return this.each(function(){
			$(this).click(function(){window.print(); return false;})
		});
	}
})(jQuery);
 
//Image Preloader
jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++){
		jQuery('<img>').attr('src', arguments[i]);
	}
}
 
 
$(function(){//jquery short cut for document.ready(), all code will execute when the DOM is ready
//Background
var resizeBg = function(){ 
	var h = $(window).height();
	var w = $(window).width();
	var elem = $('#background img');
	var prop = elem.width() / elem.height();
	if(w > h){
		prop = elem.height() / elem.width();
		elem.width(w);
		elem.height(w*prop);
	}else{
		elem.height(h);
		elem.width(h*prop);
	}
	
}
 
resizeBg();
$(window).resize(function(){resizeBg();});						   
 
//for ie 6 and 7							   
if ($.browser.msie) {	
	$('#allContent').before('<div id="mouseScrollHack"></div>')//hack to get IE to use mouse wheel
}
 
//Back To Top
 $('a.backToTop').click(function(){	
 	$('#allContent')[0].scrollTop = 0;
	return false;
 });
 
 
//Global/Main Nav
if ($('#mainSiteNav')[0]) {
	$(".level1 li").hoverIntent(
		function(){
			$(this).find(".level2").slideDown();
			$(this).addClass("currentSectionActive");
		},
		function(){
			$(this).find(".level2").slideUp();
			$(this).removeClass("currentSectionActive");
		}
	);
	
	
	$(".level2 li").hover(
		function(){
			$(this).find(".level3").show();
			$(this).addClass("navActive");
		},
		function(){
			$(this).find(".level3").hide();
			$(this).removeClass("navActive");
		}
	);
}
 
//Links in New Window when rel="external" is added to a tag
$('a[rel="external"]').click(function(){this.target = "_blank";});
 
//IE 6 Fixes
if ($.browser.msie && $.browser.version < 7) {
	
	//if($("#allContent")[0]){
	if($("#allContent:visible").length){
		$("#allContent")[0].focus();
	}	
	
	//PNG Fix
	$('img[@src$=.png],#searchBoxBg,h1 a').ifixpng();
	
	//Wraps content in iFrame to hide select boxes : Fluid Zoom Window, Share Tooltip
	$('.fluid-zoom,.shareList').bgiframe();
	
	//Tabs Fix
	$('#productTabs').children('div').removeClass('bgWhite').addClass('bgWhiteSolid');
		
	//Button Roll-Overs
	$('button.button').hover(
		function () {
			if(!$(this).hasClass('addToCart')){//don't work on add to cart
			$(this).css('background-position','0 -16px').css('cursor','pointer');
			}
			//$('button.checkoutMC').css('background-position','0 -20px').css('cursor','pointer');	
		}, 
		function () {
			if(!$(this).hasClass('addToCart')){//don't work on add to cart
			$(this).css('background-position','0 0').css('cursor','default');
			}
		}
	);
	
	
	$('button.searchButton').hover(
		function () {
			$(this).css('background-position','0 -17px').css('cursor','pointer');
		}, 
		function () {
			$(this).css('background-position','0 0').css('cursor','default');
		}
	);
	
}
 
// Show Quick View Button
$('.productBlock a img').not('.colorSwatches a').hover(function(){
		$(this).parent().parent().children('a.quickView').css('visibility','visible');
	},
	function(){
		$(this).parent().parent().children('a.quickView').css('visibility','hidden');
	}
)
 
// Prevent Quick View Button from Flickering on Hover
$('a.quickView').hover(function(){
		$(this).css('visibility','visible');
	},
	function(){
		$(this).css('visibility','hidden');
	}
)
 
// Parametric Nav & Menu List Striping
//$('.menu ul li:nth-child(odd),ul.filterCategories li:nth-child(odd)').addClass('stripe');
$('.menu ul li:nth-child(odd), .filterCategories > li:nth-child(odd)').addClass('stripe');
 
// Parametric Nav Menu Show/Hide
$('.parametricNav .menu h3 a').click(function(){	
	var categoryMenu = $(this).parent().parent().children('ul');
	if ( categoryMenu.is(':hidden') ) {
		categoryMenu.show();
		$(this).addClass('selected');
		return false;}
	else {
		categoryMenu.hide();
		$(this).removeClass('selected');
		return false;}
});
 
// Color Swatch Alignment
if ($('.productBlock')) {
	$('.colorSwatches').each(function(){
		setSwatchAlignment($(this));
	});
}
 
//header footer navigation dropshadow & roll-over
var headerNavDropTop = $("#headerNavDropTop");
headerNavDropTop.wrap('<div style="position:relative"></div>');
headerNavDropTop.after('<ul class="dropShadow" id="headerNavDropBottom"></ul>');
$("#headerNavDropTop > *").clone().appendTo("#headerNavDropBottom");
var footerNavDropTop = $("#footerNavDropTop");
footerNavDropTop.wrap('<div style="position:relative"></div>');
footerNavDropTop.after('<ul class="dropShadow" id="footerNavDropBottom"></ul>');
$("#footerNavDropTop > *").clone().appendTo("#footerNavDropBottom");
var localeNavDropTop = $("#localeNavDropTop");
localeNavDropTop.wrap('<div style="position:relative"></div>')
localeNavDropTop.after('<ul class="dropShadow" id="localeNavDropBottom"></ul>')
$("#localeNavDropTop > *").clone().appendTo("#localeNavDropBottom");
 
 
//add search text to search box
if($("#searchBox")[0]){
	$("#searchBox").val($('#searchBox').attr('title')).focus(function(){
		if($("#searchBox")[0].value == $('#searchBox').attr('title')){
			$(this).val("");
		}
	}).blur(function(){
		var elem = $("#searchBox")[0];
		elem.value = jQuery.trim(elem.value);
		if(elem.value.length == "0" || elem === null){																			
				$(this).val("").val($('#searchBox').attr('title'));
		}
	});
}
 
//remove all content and show bg
$('#bgCredits a').attr('title',$("#background img").attr('title'));
$("#bgCredits a").hoverIntent(
	function () {
		$("#footerNav,#localeNav,#siteHeader,#mainContent,#footerNavDropBottom a,#headerNavDropBottom a,#localeNavDropBottom a, object").css('visibility','hidden');
		$("h2").removeClass('sIFR-flash').addClass('sIFR-unloading');
	}, 
	function () {
		$("#footerNav,#localeNav,#siteHeader,#mainContent,#footerNavDropBottom a,#headerNavDropBottom a,#localeNavDropBottom a, object").css('visibility','visible');
		$("h2").removeClass('sIFR-unloading').addClass('sIFR-flash');
	}
);
 
/*
How to use this validation
-Forms to be validated should have class="validate"
-Inputs that are required should have class="required" (works on: input (type=text), select, textarea)
-All fields should use labels and the for attribute (for="" must = id="")
-The form id attribute value must match the id attribute of the form error message (id='' + Form) Ex. myFormErrorIdForm
-the code below assumes the class names .error and .errorLabel
*/
 
var validateInput = {
	isWhiteSpace:function(str){
		var checkSpaces = /^\s+$/
		if (checkSpaces.test(str)) return false;
		return true;
	},
	validate:function(elm){
		
		var error = false;
		var el = $(elm); //this is the element, now abuse it
		var elmType = el[0].type.toLowerCase();
		
		// required fields
		if (el.attr("class").indexOf("required") != -1 && el.is(":enabled")) {
			
			switch(elmType){
				case 'text':
					if (!el.val().length || !this.isWhiteSpace(el.val()) /*|| el.val() == el[0].defaultValue*/){error = true;}
				break;
				case 'textarea':
					if (!el.val().length || !this.isWhiteSpace(el.val()) /*|| el.val() == el[0].defaultValue*/){error = true;}
				break;
				case 'password':
					if (!el.val().length /*|| el.val() == el[0].defaultValue*/){error = true;}
				break;
				case 'select-one':
					if(!el[0].selectedIndex && el[0].selectedIndex==0){error = true;}
				break;
				case 'checkbox':
					if(!$('input[name="' + el[0].name + '"]').is(":checked")){error = true;};
				break;
				case 'radio':
					if(!$('input[name="' + el[0].name + '"]').is(":checked")){error = true;};
				break;
			}
		}
 
		//display/hide error in interface
		var hook;
		if(elmType == 'radio' || elmType == 'checkbox'){hook = el[0].name}else{hook = el[0].id};
		if (error){
			$('label[for="'+hook+'"]').addClass('errorLabel');//make label red
			$('.'+hook+':hidden').show();//show field error
			$('#'+el.parents('form')[0].id+'Form').css('display','block');//show form error message
		}else{
			$('label[for="'+hook+'"]').removeClass('errorLabel');//undo label red
			$('.'+hook+':visible').hide();//hide field error
			if(!$('#'+el.parents('form')[0].id).find('.error:visible').length){//hide error message if no errors are visible
				$('#'+el.parents('form')[0].id+'Form').css('display','none');
			}
		}
		
		return !error;
	}
};
 
 
$('form[class*="validate"]').each(function(){//get all forms class = validate
	$(this).submit(function(){
		var validationError = false;
		$("input[class*='required'], select[class*='required'], textarea[class*='required']", this).each(function(){//get all form elements in this form
			if($(this).attr('class')){
				if(!validateInput.validate(this)){
					validationError = true;
				}
			}
		});
		return !validationError;//cancel form submission if there are errors
	});
	/*$("input[class*='required'], select[class*='required'], textarea[class*='required']", this).each(function(){
			if ($(this).attr("class")){
				$(this).blur( function(){validateInput.validate(this)});
    		}
	});*/
});
	
 
//Mini-Cart
if ($('#miniCart')) {
	
	var miniCartBlock = $("#miniCartBlock");
	
	if ($.browser.msie && $.browser.version < 7) {
		miniCartBlock.bgiframe();
	}
	
	
	$('.showMiniCart').click(function() {
		sendMinicartRequest();
		return false;
	});
	
	
	$('.closeMiniCart').click(function(){
			if ($.browser.msie && $.browser.version < 7) {
				miniCartBlock.show();
			}else{
				miniCartBlock.slideUp('fast');
			}
			$('#miniCart a').removeClass('open').addClass('active');
			$('#miniCart a').blur();
			return false;
	});
	
	$('.showMiniCart').blur(function(){
			setTimeout(function(){
				if($("#miniCartBlock:visible")[0]){
					if ($.browser.msie && $.browser.version < 7) {
						miniCartBlock.hide();
					}else{
						miniCartBlock.slideUp('fast');
					}
					$('#miniCart a').removeClass('open').addClass('active');
				}
				},500);
	});
}
 
//uses class to add click event to close domWindows from iframe
$('.closeDOMWindowFromIframe').click(function(){window.parent.DOMWindow_remove();return false});
 
//use class to change the parent window URL from an iframe
$('.changeParentWindowURL').click(function(){
	window.parent.location.href = $(this).attr('href');
})
 
//share menu
$('.shareButton').mouseover(function(){
$('.shareList').show();
$('.shareButton').addClass('active');
}).mouseout(function(){
	$('.shareList').hide();
	$('.shareButton').removeClass('active');					  
});
 
$('.shareList').mouseover(function(){
	$('.shareList').show();
	$('.shareButton').addClass('active');	
}).mouseout(function(){
	$('.shareList').hide();
	$('.shareButton').removeClass('active');							  
});
 
//add click func to facebook, digg, and delicious share links
$('li.facebook a,li.digg a,li.delicious a').click(function(){
	articleShare($(this).parent().attr('class'));
	return false;
})
 
//works for share, and really anywhere you want to pop a window
$(".popUpWindow").popupwindow();
$('.closePopUpWindow').click(function(){window.close();return false;})
 
	///// PRODUCT READY CODE //////////////////////////////////////////////////////////
	
	$('button.addToCart').hover(
		function () {
			var normalBuyOnlineBtn = $(this).hasClass('buyOnline') || $(this).hasClass('processing') || $(this).hasClass('update') || $(this).hasClass('outOfStock');
			
			if($(this).hasClass('buyOnline')){
			$(this).css('background-position','0 -80px').css('cursor','pointer');
			}
			
			if($(this).hasClass('update')){
			$(this).css('background-position','0 -112px').css('cursor','pointer');
			}
			
			if($(this).hasClass('processing')){
			$(this).css('background-position','0 -32px').css('cursor','pointer');
			}
			
			if($(this).hasClass('outOfStock')){
			$(this).css('background-position','0 -48px').css('cursor','pointer');
			}
			
			if(!normalBuyOnlineBtn){
			$(this).css('background-position','0 -16px').css('cursor','pointer');
			}
		}, 
		function () {
			var normalBuyOnlineBtn = $(this).hasClass('buyOnline') || $(this).hasClass('processing') || $(this).hasClass('update') || $(this).hasClass('outOfStock');
			
			if($(this).hasClass('buyOnline')){
			$(this).css('background-position','0 -64px').css('cursor','pointer');
			}
			
			if($(this).hasClass('update')){
			$(this).css('background-position','0 -96px').css('cursor','pointer');
			}
			
			if($(this).hasClass('processing')){
			$(this).css('background-position','0 -32px').css('cursor','default');
			}
			
			if($(this).hasClass('outOfStock')){
			$(this).css('background-position','0 -48px').css('cursor','pointer');
			}
			
			if(!normalBuyOnlineBtn){
			$(this).css('background-position','0 0').css('cursor','pointer');
			}
		}
	);
	
	//Handliers COLORS section
	if ($('li.productColors')) {
			
		//Add & Remove Selected Class on Clicked Thumbnail
		$('.productColors a').click(function(){
			//anchors in .productColors can have a class of selected
			var productId = $(this).parent().parent().attr("id");
			if ( $(this).children().children('span.innerBorder').children().is('span') ) {
				var colorName = $(this).children().children('span.innerBorder').children("span:first-child").html();
				}
				else {
				var colorName = $(this).children().children("span.innerBorder").html();
			}		
			$('#' + productId + ' .productColors a').removeClass('selected');
			$(this).addClass('selected');
			$(this).parent().children().children('span.selected').text(colorName);
			var product = products.getProduct(productId);
			product.selectedColor = colorName;
		});
		
		$('.productColors a').mouseover(function(){					
				if ( $(this).children().children('span.innerBorder').children().is('span') ) {
					var colorName = $(this).children().children('span.innerBorder').children("span:first-child").html();
					}
				else {
					var colorName = $(this).children().children("span.innerBorder").html();
				}
				$(this).parent().children().children('span.selected').text(colorName);
				var productId = $(this).parent().parent().attr("id");
				showColorInfo(colorName,productId);
		}).mouseout(function(){
				var productId = $(this).parent().parent().attr("id");
				var product = products.getProduct(productId);
				$(this).parent().children().children('span.selected').text(product.selectedColor);	
				$('#' + productId + ' #message').hide();
				//set back to the current color's corresponding states and message
				showColorInfo(product.selectedColor, productId);
	    });
		
	}
 
	// Size handlers
	if ($('.productSize')) {
		//Add & Remove Selected Class on Clicked Thumbnail
		$('.productSize a').click(function(){			
			if ($(this).hasClass('sizingChart')) {
				return false;
			};
			var productId = $(this).parent().parent().attr("id");
			$('#' + productId + ' .productSize a').removeClass('selected');
			$(this).not('.sizingChart').addClass('selected');
			var size = $(this).html();		
			$(this).not('.sizingChart').parent().children().children('span').text(size);
			var product = products.getProduct(productId);
			product.selectedSize = size;
			//A.N.: need to call historyContextUtil.js to persist size so do not return false
			//return false;
		});
	
		//Display Product Size Text
		$('.productSize a').mouseover(function(){		
			var productSize = $(this).html();	
			$(this).not('.sizingChart').parent().children().children('span').text(productSize);
			if (!$(this).hasClass('sizingChart')) {
				var productId = $(this).parent().parent().attr("id");
				showSizeInfo(productSize, productId);
			}
		}).mouseout(function(){
				var productId = $(this).parent().parent().attr("id");
				var product = products.getProduct(productId);
	      		$(this).parent().children().children('span').text(product.selectedSize);
				showSizeInfo(product.selectedSize,productId);
	    });	
	}
	
	// Length handlers
	if ($('.productLength')) {
		//Add & Remove Selected Class on Clicked Thumbnail
		$('.productLength a').click(function(){			
			var productId = $(this).parent().parent().attr("id");
			$('#' + productId + ' .productLength a').removeClass('selected');
			$(this).addClass('selected');
			var Length = $(this).html();		
			var product = products.getProduct(productId);
			product.selectedLength = Length;
      		$(this).parent().children().children('span').text(product.selectedLength);
			//A.N.: Need to call historyContextUtil.js to persist length so do not return false
			//return false;
		});
		
		//Display Product Length Text
		$('.productLength a').mouseover(function(){		
			var productLength = $(this).html();
				$(this).parent().children().children('span').text(productLength);
				var productId = $(this).parent().parent().attr("id");
				var product = products.getProduct(productId);
				showLengthInfo(productLength,productId);
			}).mouseout(function(){
				var productId = $(this).parent().parent().attr("id");
				var product = products.getProduct(productId);
	      		$(this).parent().children().children('span').text(product.selectedLength);
				showLengthInfo(product.selectedLength,productId);
	    });	
	}
	// Share Options Pop-Up
	if ($('ul.shareOptions')) {
		if ($.browser.msie && $.browser.version < 7) {
			$('ul.shareOptions').bgiframe();
		}
		$('.showShareOptions').click(function () {
			$('ul.shareOptions').toggle();
			return false;
		})
	}
	
	if ($('.addToCart')) {
		$('.addToCart').click(function() {
		    var qty=0;
			if ($(this).hasClass('processing'))
				return;
			if ($(this).hasClass('outOfStock')) 
				return;
			if ($(this).hasClass('update')) {
			    qty = $(this).parent().parent().parent().parent().parent().find('select').val();
				var productId = $(this).parent().parent().attr("id");
				var product = products.getProduct(productId);
				var variation = product.getProductVariation(product.selectedColor,product.selectedSize,product.selectedLength)
				var queryString = getProductQueryParms(variation.catEntryId,qty,product.selectedColor,product.selectedSize,product.selectedLength);	
				window.location= $(this).attr("name") + queryString;
				return false;
			} else {
				if ($(this).hasClass('redirect') && (!$(this).hasClass('buyOnline'))) {
				    var url = "";
					qty = $(this).parent().parent().parent().find('.quantitySelect').val();
                    if ($(this).attr("name").indexOf(CAT_ENTRY_ID)<=0) { //NO catalog entry id embedded in the name attribute look it up
                        var productId = $(this).parent().parent().attr("id");
			            var url = $(this).attr("name") + getProductQueryParmsByProductId(productId,qty);
			        } else
    				    url = $(this).attr("name") + "&quantity_1="+qty;//catentryid contained in the name attribute which contains the URL
					//alert("url:"+url);
					window.location = url ;//+ "&quantity_1=" + qty
					return false;
				}
				else {
				    if ($(this).hasClass('buyOnline')) {
					    var qty = $(this).parent().parent().parent().find('.quantitySelect').val();
                        var queryString = "";
                        if ($(this).attr("name").indexOf(CAT_ENTRY_ID)<=0) { //NO catalog entry id embedded in the name attribute so look it up
                            var productId = $(this).parent().parent().attr("id");
			                var url = $(this).attr("name") + getProductQueryParmsByProductId(productId,qty);
			            } else
    				        url = $(this).attr("name") + "&quantity_1="+qty;//catentryid contained in the name attribute which contains the URL
						if($('body#DOMWindowiframe')[0]){
							window.parent.openOnlineDealersFromDomWindow(url);
						}else{
		                DOMWindow_show('Online Dealers',url + ';startDOMWindow&amp;iframeDOMWindow=true&amp;height=525&amp;width=540',null);
						}
    	                return false;
				    } else {
					    var productId = $(this).parent().parent().attr("id");
					    var prod = products.getProduct(productId);
					    if ($("body").attr("id")=="shopCart") {
					        //this page needs to rebuild itself, no ajax
	                        var productId = $(this).parent().parent().attr("id");
					        var url = $(this).attr("name") + getProductQueryParmsByProductId(productId);
					        window.location = url;
					    } else
					        sendAddToCartRequest(prod);
					    return false;
					}
				}
			}
		});		
	}
 
/*    
    // Buy Online Button - Open Online Dealers DOM
	$('button.buyOnline').click(function(){			
	    //all buy online button elements should have a value attribute set to the url for shopCartOnlineDealersDomWindow with query parameter specifiying catalog entry id
        var url = $(this).attr("value");
		DOMWindow_show('Online Dealers',url + ';startDOMWindow&amp;iframeDOMWindow=true&amp;height=525&amp;width=540',null);
    	return false;
	});
*/	
	
	// Add To Wishlist Pop-Up
	if ($('.wishListBlock')) {
		$('.showWishListPop').click(function(){
			var productId = $(this).parent().parent().attr("id");
			var product = products.getProduct(productId);
			sendAddToWishlistRequest(product);
			return false;
			
		});
	
		$('.wishListBlock .closeX').click(function(){
			$('.wishListBlock').hide();
			return false;
		});
	}
 
	// Compare Pop-Up
	if ($('.compare')) {
		$('.productButtons').find('.compare').click(function(){
			var productId = $(this).parent().parent().attr("id");
			var product = products.getProduct(productId);
	        var queryString = "";
	        var cid = "";
	        var v = product.getProductVariation(product.selectedColor, product.selectedSize, product.selectedLength);
            if($('#giftCardAmt').length > 0) {
                queryString =  
        		        CAT_ENTRY_ID+'='+product.productId 
                        + "&giftCardAmount="+$('#giftCardAmt').attr("value") + '&quantity_1=' + getQuantity(product);
            } else {
                cid = v.catEntryId;
                queryString = queryString + getProductQueryParms(cid,getQuantity(product),product.selectedColor,product.selectedSize,product.selectedLength);
	        }
 
            var url= URL_COMPARE_PREFIX + queryString + URL_COMPARE_SUFFIX;
            DOMWindow_show('Compare', url, null);
 
			return false;
			
		});
	
		//$('.wishListBlock .closeX').click(function(){
		//	$('.wishListBlock').hide();
		//	return false;
		//});
	}
 
	//safety code just in case the html has not properly defined these globals
	if (typeof(window['userCurrentColor']) == "undefined")
		userCurrentColor="";
	if (typeof(window['userCurrentSize']) == "undefined")
		userCurrentSize="";
	if (typeof(window['userCurrentLength']) == "undefined")
		userCurrentLength="";
 
	//// INITIALIZE Product control states ////
 
	//select the correct color,size,length - first check the URL, if no specific product color specified then check personalization, if none specified then take 1st available
	$(".productColors").each( function() {
	    //$(this).find("a:first").click();
		if (document.URL.indexOf('color=')>0) {
			//TODO:select the color and size and length specified in URL
			//need to understand URL query parameters before completing
		} else {
			var productId = $(this).parent().attr("id");
			var product = products.getProduct(productId);
			//variation = product.getFirstAvailableVariation(userCurrentColor, userCurrentSize, userCurrentLength);
			variation = product.getFirstAvailableVariation(product.selectedColor,product.selectedSize,product.selectedLength);
						
			if (variation == null && product.variations.length > 0) { //if no variations with a qty, just set to first
				variation = product.variations[0];
			}
			
			$('#'+ productId + ' .productColors a').each(function(n){
				if ($(this).find('span.innerBorder').text()==variation.colorName) {
					product.selectedColor = variation.colorName;
					$(this).click();	
					return;
				} else {
				    if ($(this).find('span.innerBorder').children('.color1').text()==variation.colorName) {
					    product.selectedColor = variation.colorName;
					    $(this).click();	
					    return;
					}
				}
			})
			
			$('#'+ productId + ' .productSize a').each(function(n){
				if ($(this).text()==variation.size) {
					product.selectedSize = variation.size;
					$(this).click();	
					return;
				}
			})
				
			
			$('#'+ productId + ' .productLength a').each(function(n){
				if ($(this).text()==variation.length) {
					product.selectedLength = variation.length;
					$(this).click();	
					return;
				}
			})
				
			showColorInfo(variation.colorName, productId);
			showSizeInfo(variation.size,productId);
			showLengthInfo(variation.length,productId);
			
		}
	});
 
});//end DOM ready code
 
//social share product
function articleShare(site) {
	var popUpUrl = encodeURIComponent(window.location.href);
	var title = "The North Face";
	switch (site) {
	case "facebook":
		window.open('http://www.facebook.com/sharer.php?u=' + popUpUrl + '&t=' + title, 'facebook', 'height=400,width=600,scrollbars=1,status=1,resizable=1');
		break;
		
	case "digg":
		window.open('http://digg.com/remote-submit?phase=2&url=' + popUpUrl + '&title=' + title, 'digg', 'height=400,width=600,scrollbars=1,status=1,resizable=1');
		break;
		
	case "delicious":
		window.open('http://del.icio.us/post?v=4&partner=nyt&noui&jump=close&url=' + popUpUrl + '&title=' + title, 'delicious', 'height=400,width=650,scrollbars=1,status=1,resizable=1');
		break;			
	}
}
 
 
function setSwatchAlignment(swatches) {
	var firstSwatch = swatches.children('span.swatch:first-child');
	var totalSwatches = swatches.children('span.swatch').length;
	
	// Set First Swatch
	$(firstSwatch).addClass('first');
	
	if (totalSwatches == 1) {
	$(firstSwatch).css('margin-left','75px');
	}
	if (totalSwatches == 2) {
		$(firstSwatch).css('margin-left','62px');
	}
	if (totalSwatches == 3) {
		$(firstSwatch).css('margin-left','50px');
	}
	if (totalSwatches == 4) {
		$(firstSwatch).css('margin-left','37px');
	}
	if (totalSwatches == 5) {
		$(firstSwatch).css('margin-left','25px');
	}
	if (totalSwatches == 6) {
		$(firstSwatch).css('margin-left','12px');
	}
	if (totalSwatches == 7) {
		$(firstSwatch).css('margin-left','0px');
	}
}
 
 
 
 
//this function displays the minicart,
//it should NEVER be called directly - call sendMinicartRequest()
function showMiniCart(){
		var miniCartBlock = $("#miniCartBlock");	
		
		if ($.browser.msie && $.browser.version < 7) {
			miniCartBlock.show();
		}else{
			miniCartBlock.slideDown('fast');
		}
		$('#miniCart a').removeClass('active').addClass('open');
		$('#miniCart a').focus();
		return false;
};
 
///////// PRODUCT CODE ///////////
 
//show????Info methods are called by handlers to call all actions
//required when a color/size/length is moused over or selected
function showColorInfo(inColor, inProductId) {
		var product = products.getProduct(inProductId);
		showAvailabilityLength(product, inColor, product.selectedSize);
		showAvailabilitySize(product, inColor, product.selectedLength);
		showMessage(product, inColor, product.selectedSize, product.selectedLength);
}
	
function showSizeInfo(inSize, inProductId) {
		var product = products.getProduct(inProductId);
		showAvailabilityLength(product, product.selectedColor, inSize);
		showAvailabilityColor(product, inSize, product.selectedLength);
		showMessage(product, product.selectedColor, inSize, product.selectedLength);
}
 
function showLengthInfo(inLength, inProductId) {
		var product = products.getProduct(inProductId);
		showAvailabilitySize(product, product.selectedColor, inLength);
		showAvailabilityColor(product, product.selectedSize, inLength);
		showMessage(product, product.selectedColor, product.selectedSize, inLength);
}
 
//Display text message for particular situations that require more explanation
function showMessage(product, inColor, inSize, inLength) {
	productVariation = product.getProductVariation(inColor, inSize, inLength);
	
	var addToCartInstance = $('#' + product.productId + ' #addToCart');
	var normalBuyOnlineBtn = addToCartInstance.hasClass('buyOnline') || addToCartInstance.hasClass('processing') || addToCartInstance.hasClass('update');
	
	if ((productVariation==null)
		|| (productVariation.qtyTotal() < 1)) {
		$('#' + product.productId + ' #msgTnfOutOfStock').hide();
		var msg = inColor + MSG_OUT_OF_STOCK + inSize + " " + inLength;
		$('#' + product.productId + ' #msgCustom').html(msg).show();
 
		//if(!addToCartInstance.hasClass('buyOnline')){
		addToCartInstance.css('background-position','0 -48px').addClass('outOfStock').css('cursor','pointer');
		//}
		
	} else {
		
		addToCartInstance.removeClass('outOfStock');
			
		if(addToCartInstance.hasClass('buyOnline')){
		    addToCartInstance.css('background-position','0 -64px').css('cursor','pointer');
		}
		
		if(addToCartInstance.hasClass('update')){
		    addToCartInstance.css('background-position','0 -96px').css('cursor','pointer');
		}
		
		if(addToCartInstance.hasClass('processing')){
		    addToCartInstance.css('background-position','0 -32px').css('cursor','pointer');
		}
		
		if(!normalBuyOnlineBtn){
		    addToCartInstance.css('background-position','0 0').css('cursor','pointer');
		}
			
		if ((productVariation.qtyTNF < 1)
		&& (productVariation.qtyDealer > 0)) {
			$('#' + product.productId + ' #msgTnfOutOfStock').show();
			$('#' + product.productId + ' #msgCustom').hide();
		} else {
			$('#' + product.productId + ' #msgTnfOutOfStock').hide();
			$('#' + product.productId + ' #msgCustom').hide();
		}
	}
}				
 
//color selected/moused over, show which sizes and lengths are available
function showAvailabilityColor(product, aSize, aLength)
{
	//go through the colors and decide whether to make x image visible
	$('#'+ product.productId + ' .productColors a span.swatch').each(function(n){
		if ( $(this).children('span.innerBorder').children().is('span') ) 
			var colorName = $(this).children().children("span:first-child").text();
		else
    		var colorName = $(this).find('span.innerBorder').text();
		var productVariation = product.getProductVariation(colorName,aSize,aLength);
 
		if ((productVariation != null)
		&& (productVariation.qtyTotal() > 0))
		{
			$(this).children("img").hide();
			$(this).removeClass('unavailable')
		} else
		{
			$(this).children("img").show();
			$(this).addClass('unavailable');
		}
	});
}
 
//size selected/moused over, show which sizes and colors are available
function showAvailabilitySize(product, aColor, aLength){
	//var allSizes = $('#'+ product.productId + ' .productSize a ');
	//for (j = 0; j < allSizes.length; j++) {
	$('#'+ product.productId + ' .productSize a ').each(function(n){
		//var size = allSizes[j];
		if (!$(this).hasClass('sizingChart')) {
			var sizeName = $(this).text();
			//alert(sizeName);
			//alert('sizename:'+sizeName);
			var productVariation = product.getProductVariation(aColor, sizeName, aLength);
			
			if ((productVariation != null) &&
			(productVariation.qtyTotal() > 0)) {
				$(this).removeClass('unavailable');
			}
			else {
				$(this).addClass('unavailable');
			}
		}		
	});
}
 
//length selected/moused over, show which sizes and colors are available
function showAvailabilityLength (product, aColor,aSize)
{
	//go through the lengths and set state
	$('#'+ product.productId + ' .productLength a ').each(function(n){
		//var alength = allLengths[j];
		var lengthName = $(this).text();
		
		var productVariation = product.getProductVariation(aColor,aSize,lengthName);
 
		if ((productVariation != null)
		&& (productVariation.qtyTotal() > 0))
		{
			$(this).removeClass('unavailable');
		} else
		{
			$(this).addClass('unavailable');
		}
	});
}
 
//getter to dig up the quantity from the control
function getQuantity(product) {
	return $('#'+ product.productId + ' .quantitySelect').val();
}
/////// SHOW MINICART ////////
 
function sendMinicartRequest() {
	//$('#' + product.productId + ' #addToCart').addClass('processing');
	$.ajax({
   		type: "GET",
   		url:  URL_GET_MINICART,
   		data: "",
		cache: "false",
		dataType: "html",
   		success: function(data, textStatus){
     		//alert( "Succes! data: " + data + "   textStatus: " + textStatus  );
			sendMinicartResponseHandler(data);
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
          alert('ERROR retrieving minicart:'+textStatus+errorThrown);
  		  this; // the options for this ajax request
		  //$('#' + product.productId + ' #addToCart').removeClass('processing');
		}
    });
}
 
function sendMinicartResponseHandler(inResponse) {
	//alert( "sendMinicartREsponse handler:"+inResponse  );
	ERROR_INDICATOR = "error";
	if (inResponse.indexOf(ERROR_INDICATOR)>0) {
		//$('#' + productId + ' #msgCustom').html(addResponse).show();
	} else {
		$('#miniCartBlock').html(inResponse);
		var qty = $('#itemQty').text();
		$('#headerItemQty').html(qty);
		showMiniCart();
	}
//TODO:needs to check if there is a dom window?
	DOMWindow_remove();
}
 
function getProductQueryParmsByProductId(inProductId, qty) {
        var product = products.getProduct(inProductId);
        var variation = product.getProductVariation(product.selectedColor,product.selectedSize,product.selectedLength)
		var qty = getQuantity(product);
        var query = getProductQueryParms(variation.catEntryId,qty,product.selectedColor,product.selectedSize,product.selectedLength);	
        return query;			        
}
 
 
function getProductQueryParms(inCatEntryId, inQty) { //, inColor, inSize, inLength) {
        var queryString = 
		CAT_ENTRY_ID +'='+ inCatEntryId + '&'
		+'quantity_1='+ inQty ;
		
		return queryString;
}
 
/////// ADD TO CART //////////
 
function sendAddToCartRequest(inProduct) {
    $('#' + inProduct.productId + ' .addToCartAnimation').show();
	if (window.parent) 
		parent.curProductId = inProduct.productId;//hack to set a global so that the response handler knows what product this is for.  maybe move to the response?
	else
		curProductId = inProduct.productId;//hack to set a global so that the response handler knows what product this is for.  maybe move to the response?
	$('#' + inProduct.productId + ' #addToCart').css('background-position','0 -32px').addClass('processing');
	var queryString = "";
	var cid = "";
	var v = inProduct.getProductVariation(inProduct.selectedColor, inProduct.selectedSize, inProduct.selectedLength);
    if($('#giftCardAmt').length > 0) {
        queryString =  
        		CAT_ENTRY_ID+'='+inProduct.productId 
                + "&giftCardAmount="+$('#giftCardAmt').attr("value") + '&quantity_1=' + getQuantity(inProduct);
    } else {
        cid = v.catEntryId;
        queryString = queryString + getProductQueryParms(cid,getQuantity(inProduct),inProduct.selectedColor,inProduct.selectedSize,inProduct.selectedLength);
	}
    
    //alert("AJAX AddToCart, queryString: "+queryString);
	
	$.ajax({
   		type: "POST",
   		url:  URL_ADD_TO_CART,
   		data: queryString,
		cache: "false",
		dataType: "text",
   		success: function(data, textStatus){
     		//alert( "Succes! data: " + data + "   textStatus: " + textStatus  );
			if (window.parent) 
				parent.addToCartResponseHandler(data);
			else
				addToCartResponseHandler(data);
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
          $('#' + curProductId + ' #msgCustom').html('ERROR:'+textStatus+errorThrown).show();
  		  this; // the options for this ajax request
		  $('#' + product.productId + ' #addToCart').css('background-position','0 0').removeClass('processing');;
	      $('.addToCartAnimation').hide();
		}
    });
}
 
 
 
function addToCartResponseHandler(addResponse) {
//alert('add to cart in doc:'+document.title)
    $('#' + curProductId + ' #addToCart').css('background-position','0 0').removeClass('processing');;
	ERROR_INDICATOR = "error";
	if (addResponse.indexOf(ERROR_INDICATOR) > 0) {
		$('#' + productId + ' #msgCustom').html(addResponse).show();
	}
	else {
		//show minicart
		if (window.parent) {
			window.parent.sendMinicartRequest();
		}
		else 
			sendMinicartRequest();
	}
    $('.addToCartAnimation').hide();
}
 
