$(document).ready(function() {
//setting up the modal window attributes

// loading iframe in modal window
	$('.instructProfileDialog').dialog({
		bgiframe: true,
		autoOpen: false,
		width: 579, // Add width for instructor Profile Window Anuj Rastogi artf993263
		height: 550,
		modal: true,
		resizable: false,
		position: 'center',
		closeOnEscape: true,
		close: function(){
			$('#profileDataLoad').attr("src", "about:blank");
		}
	});
	
	$('.openInstructProfile').click(function(event) {
		
		event.preventDefault();
		
		var urlContent = $(this).attr('href');
		$('#profileDataLoad').attr('src',urlContent).attr('width','100%').attr('height','100%').attr('scrolling','auto').addClass("modalNoResize"); // Add scrolling auto and class modelNoResize for instructor Profile Window artf993263
		$('.instructProfileDialog').dialog('open');
	});
	
	});
var map;
var point;
var baseIcon;
var arrMerchants=new Array();
var arrMarkers=new Array();
var _mapInited=false;
var bounds;
var _featuredCount=0;
function buildBaseIcon(){baseIcon=new GIcon();
baseIcon.iconSize=new GSize(36,36);
baseIcon.iconAnchor=new GPoint(18,36);
baseIcon.infoWindowAnchor=new GPoint(18,18);
baseIcon.infoShadowAnchor=new GPoint(18,36)
}function createInfoWindow(merchant){var detailsHTML="";
detailsHTML+="<div";
if(merchant.picture||merchant.picturesLink||merchant.videosLink){detailsHTML+=" style='width:140px; float:left;'"
}detailsHTML+=">";
detailsHTML+=" <a class='bulletted' href="+merchant.url+">"+merchant.title+"</a><p><br />";
detailsHTML+=merchant.address+"<br />"+merchant.phone;
detailsHTML+="<br /></p></div>";
detailsHTML+="<div>";
if(merchant.picture){detailsHTML+="<br /><img src="+merchant.picture+">"
}if(merchant.picturesLink){detailsHTML+="<br /><a href='"+merchant.picturesLink+"'>Pictures</a>"
}if(merchant.videosLink){detailsHTML+="<br /><a href='"+merchant.videosLink+"'>Videos</a>"
}detailsHTML+="</div>";
return detailsHTML
}function createMarker(point,merchant){markerOptions={icon:merchant.icon};
var marker=new GMarker(point,markerOptions);
marker.bindInfoWindowHtml(merchant.infoWindowHtml);
merchant.marker=marker;
return marker
}function initMap(){if(document.getElementById("map_canvas")&&GBrowserIsCompatible()){buildBaseIcon();
var opts={size:new GSize(_width,_height)};
map=new GMap2(document.getElementById("map_canvas"),opts);
map.addMapType(G_NORMAL_MAP);
map.addMapType(G_SATELLITE_MAP);
map.addMapType(G_HYBRID_MAP);
map.setMapType(G_NORMAL_MAP);
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(39.642445723383396,-106.37838363647461),14);
map.addControl(new GSmallMapControl());
bounds=new GLatLngBounds();
arrMerchants=new Array();
var domElementToInspect;
if(document.getElementById("restaurantList")){domElementToInspect=$("ul[@id=restaurantList] > li")
}else{if(document.getElementById("storeList")){domElementToInspect=$("ul#storeList > li")
}else{if(document.getElementById("activityList")){domElementToInspect=$("ul[@id=activityList] > li")
}}}domElementToInspect.each(function(i){var icon=new GIcon(baseIcon);
icon.image="/VailResorts/sites/snow/assets/img/dining/bullets/"+(i+1)+".png";
title=$(this).find("div.mapTitle").text();
address=$(this).find("div.mapAddress").text();
phone=$(this).find("div.mapPhone").text();
picture=$(this).attr("Picture");
picturesLink=$(this).attr("PicsLink");
videosLink=$(this).attr("VideosLink");
url=$(this).find("div.mapUrl").text();
featured=$(this).find("div.mapFeatured").text();
var lat=$(this).attr("lat");
var lng=$(this).attr("lng");
if(isNaN(parseFloat(lat))==false&&isNaN(parseFloat(lng))==false&&lat!="0"&&lng!="0"&&lat!=""&&lng!=""&&lat!="-1"&&lng!="-1"){var latlng=new GLatLng(parseFloat(lat),parseFloat(lng));
bounds.extend(latlng);
var merchantObj={icon:icon,title:title,address:address,phone:phone,picture:picture,picturesLink:picturesLink,videosLink:videosLink,infoWindowHtml:"",url:url};
merchantObj.infoWindowHtml=createInfoWindow(merchantObj);
arrMerchants.push(merchantObj);
var mkr=createMarker(latlng,merchantObj);
map.addOverlay(mkr);
arrMarkers.push(mkr);
if(featured==true||featured=="true"){_featuredCount++
}}else{arrMarkers.push("");
arrMerchants.push("")
}});
_mapInited=true;
if(_zoom!=""){map.setZoom(_zoom)
}else{map.setZoom(map.getBoundsZoomLevel(bounds))
}map.setCenter(bounds.getCenter());
if(arrMarkers.length==1&&arrMarkers[0]==""){arrMarkers.length=0
}if(arrMarkers.length==0){document.getElementById("map_canvas").style.display="none";
document.getElementById("map_noresults").style.display="block"
}if(_featuredCount==0){if(document.getElementById("mapListFeaturedHeader")){document.getElementById("mapListFeaturedHeader").style.display="none"
}}}}function openInfoWindow(x){arrMarkers[x].openInfoWindowHtml(arrMerchants[x].infoWindowHtml)
}function xreplace(checkMe,toberep,repwith){var temp=checkMe;
var i=temp.indexOf(toberep);
while(i>-1){temp=temp.replace(toberep,repwith);
i=temp.indexOf(toberep,i+repwith.length+1)
}return temp
};
$(document).ready(function(){$(".emailAFriend").dialog({bgiframe:true,autoOpen:false,width:470,height:380,modal:true,resizable:false,position:"center",closeOnEscape:true,draggable:false});
$(".emailAFriendopenModal").click(function(e){e.preventDefault();
var urlContent=$(this).attr("href");
$(".emailAFriend").dialog("close");
$(".emailAFriend iframe").attr("src",urlContent).attr("width","100%").attr("height","100%").attr("scrolling","no").attr("frameborder","no");
$(".emailAFriend iframe").bind("load",function(){bindFocus()
});
$(".emailAFriend").dialog("open");
return false
});
function bindFocus(){$("input.emailInputContent").each(function(){$(this).bind("focus",function(){var defaultText="";
defaultText=$(this).val();
if(defaultText=="Email address"||defaultText=="Name"){$(this).val("")
}$(this).blur(function(){var userInput=$(this).val();
if(userInput==""){var targetText=$(this).prev().text();
if(targetText=="To"){$(this).val("Email address")
}if(targetText=="From"){$(this).val("Name")
}if(targetText==""){$(this).val("Email address")
}}})
})
})
}});
(function($){jQuery.fn.pngFix=function(settings){settings=jQuery.extend({blankgif:"blank.gif"},settings);
var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);
var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);
if(jQuery.browser.msie&&(ie55||ie6)){jQuery(this).find("img[src$=.png]").each(function(){jQuery(this).attr("width",jQuery(this).width());
jQuery(this).attr("height",jQuery(this).height());
var prevStyle="";
var strNewHTML="";
var imgId=(jQuery(this).attr("id"))?'id="'+jQuery(this).attr("id")+'" ':"";
var imgClass=(jQuery(this).attr("class"))?'class="'+jQuery(this).attr("class")+'" ':"";
var imgTitle=(jQuery(this).attr("title"))?'title="'+jQuery(this).attr("title")+'" ':"";
var imgAlt=(jQuery(this).attr("alt"))?'alt="'+jQuery(this).attr("alt")+'" ':"";
var imgAlign=(jQuery(this).attr("align"))?"float:"+jQuery(this).attr("align")+";":"";
var imgHand=(jQuery(this).parent().attr("href"))?"cursor:hand;":"";
if(this.style.border){prevStyle+="border:"+this.style.border+";";
this.style.border=""
}if(this.style.padding){prevStyle+="padding:"+this.style.padding+";";
this.style.padding=""
}if(this.style.margin){prevStyle+="margin:"+this.style.margin+";";
this.style.margin=""
}var imgStyle=(this.style.cssText);
strNewHTML+="<span "+imgId+imgClass+imgTitle+imgAlt;
strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
strNewHTML+="width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+"px;";
strNewHTML+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+jQuery(this).attr("src")+"', sizingMethod='scale');";
strNewHTML+=imgStyle+'"></span>';
if(prevStyle!=""){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+"width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+'px;">'+strNewHTML+"</span>"
}jQuery(this).hide();
jQuery(this).after(strNewHTML)
});
jQuery(this).find("*").each(function(){var bgIMG=jQuery(this).css("background-image");
if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];
jQuery(this).css("background-image","none");
jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')"
}});
jQuery(this).find("input[src$=.png]").each(function(){var bgIMG=jQuery(this).attr("src");
jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bgIMG+"', sizingMethod='scale');";
jQuery(this).attr("src",settings.blankgif)
})
}return jQuery
}
})(jQuery);
(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"
}(this.options.addClasses&&this.element.addClass("ui-draggable"));
(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));
this._mouseInit()
},destroy:function(){if(!this.element.data("draggable")){return 
}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");
this._mouseDestroy()
},_mouseCapture:function(event){var o=this.options;
if(this.helper||o.disabled||$(event.target).is(".ui-resizable-handle")){return false
}this.handle=this._getHandle(event);
if(!this.handle){return false
}return true
},_mouseStart:function(event){var o=this.options;
this.helper=this._createHelper(event);
this._cacheHelperProportions();
if($.ui.ddmanager){$.ui.ddmanager.current=this
}this._cacheMargins();
this.cssPosition=this.helper.css("position");
this.scrollParent=this.helper.scrollParent();
this.offset=this.element.offset();
this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};
$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this._generatePosition(event);
this.originalPageX=event.pageX;
this.originalPageY=event.pageY;
if(o.cursorAt){this._adjustOffsetFromHelper(o.cursorAt)
}if(o.containment){this._setContainment()
}this._trigger("start",event);
this._cacheHelperProportions();
if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)
}this.helper.addClass("ui-draggable-dragging");
this._mouseDrag(event,true);
return true
},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);
this.positionAbs=this._convertPositionTo("absolute");
if(!noPropagation){var ui=this._uiHash();
this._trigger("drag",event,ui);
this.position=ui.position
}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"
}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"
}if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)
}return false
},_mouseStop:function(event){var dropped=false;
if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)
}if(this.dropped){dropped=this.dropped;
this.dropped=false
}if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;
$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){self._trigger("stop",event);
self._clear()
})
}else{this._trigger("stop",event);
this._clear()
}return false
},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;
$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target){handle=true
}});
return handle
},_createHelper:function(event){var o=this.options;
var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=="clone"?this.element.clone():this.element);
if(!helper.parents("body").length){helper.appendTo((o.appendTo=="parent"?this.element[0].parentNode:o.appendTo))
}if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))){helper.css("position","absolute")
}return helper
},_adjustOffsetFromHelper:function(obj){if(obj.left!=undefined){this.offset.click.left=obj.left+this.margins.left
}if(obj.right!=undefined){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left
}if(obj.top!=undefined){this.offset.click.top=obj.top+this.margins.top
}if(obj.bottom!=undefined){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top
}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();
var po=this.offsetParent.offset();
if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();
po.top+=this.scrollParent.scrollTop()
}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&$.browser.msie)){po={top:0,left:0}
}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}
},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();
return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}
}else{return{top:0,left:0}
}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}
},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}
},_setContainment:function(){var o=this.options;
if(o.containment=="parent"){o.containment=this.helper[0].parentNode
}if(o.containment=="document"||o.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]
}if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];
if(!ce){return 
}var co=$(o.containment).offset();
var over=($(ce).css("overflow")!="hidden");
this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]
}else{if(o.containment.constructor==Array){this.containment=o.containment
}}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position
}var mod=d=="absolute"?1:-1;
var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);
return{top:(pos.top+this.offset.relative.top*mod+this.offset.parent.top*mod-($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left+this.offset.relative.left*mod+this.offset.parent.left*mod-($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))}
},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);
if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()
}var pageX=event.pageX;
var pageY=event.pageY;
if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left
}if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top
}if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left
}if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top
}}if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];
pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;
var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];
pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left
}}return{top:(pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+($.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))}
},_clear:function(){this.helper.removeClass("ui-draggable-dragging");
if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()
}this.helper=null;
this.cancelHelperRemoval=false
},_trigger:function(type,event,ui){ui=ui||this._uiHash();
$.ui.plugin.call(this,type,[event,ui]);
if(type=="drag"){this.positionAbs=this._convertPositionTo("absolute")
}return $.widget.prototype._trigger.call(this,type,event,ui)
},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}
}}));
$.extend($.ui.draggable,{version:"1.7.1",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});
$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});
inst.sortables=[];
$(o.connectToSortable).each(function(){var sortable=$.data(this,"sortable");
if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});
sortable._refreshItems();
sortable._trigger("activate",event,uiSortable)
}})
},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});
$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;
inst.cancelHelperRemoval=true;
this.instance.cancelHelperRemoval=false;
if(this.shouldRevert){this.instance.options.revert=true
}this.instance._mouseStop(event);
this.instance.options.helper=this.instance.options._helper;
if(inst.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})
}}else{this.instance.cancelHelperRemoval=false;
this.instance._trigger("deactivate",event,uiSortable)
}})
},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;
var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;
var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;
var itemHeight=o.height,itemWidth=o.width;
var itemTop=o.top,itemLeft=o.left;
return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth)
};
$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;
this.instance.helperProportions=inst.helperProportions;
this.instance.offset.click=inst.offset.click;
if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;
this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);
this.instance.options._helper=this.instance.options.helper;
this.instance.options.helper=function(){return ui.helper[0]
};
event.target=this.instance.currentItem[0];
this.instance._mouseCapture(event,true);
this.instance._mouseStart(event,true,true);
this.instance.offset.click.top=inst.offset.click.top;
this.instance.offset.click.left=inst.offset.click.left;
this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;
this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;
inst._trigger("toSortable",event);
inst.dropped=this.instance.element;
inst.currentItem=inst.element;
this.instance.fromOutside=inst
}if(this.instance.currentItem){this.instance._mouseDrag(event)
}}else{if(this.instance.isOver){this.instance.isOver=0;
this.instance.cancelHelperRemoval=true;
this.instance.options.revert=false;
this.instance._trigger("out",event,this.instance._uiHash(this.instance));
this.instance._mouseStop(event,true);
this.instance.options.helper=this.instance.options._helper;
this.instance.currentItem.remove();
if(this.instance.placeholder){this.instance.placeholder.remove()
}inst._trigger("fromSortable",event);
inst.dropped=false
}}})
}});
$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$("body"),o=$(this).data("draggable").options;
if(t.css("cursor")){o._cursor=t.css("cursor")
}t.css("cursor",o.cursor)
},stop:function(event,ui){var o=$(this).data("draggable").options;
if(o._cursor){$("body").css("cursor",o._cursor)
}}});
$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data("draggable").options;
$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body")
})
},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)
})
}});
$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;
if(t.css("opacity")){o._opacity=t.css("opacity")
}t.css("opacity",o.opacity)
},stop:function(event,ui){var o=$(this).data("draggable").options;
if(o._opacity){$(ui.helper).css("opacity",o._opacity)
}}});
$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");
if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!="HTML"){i.overflowOffset=i.scrollParent.offset()
}},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;
if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!="HTML"){if(!o.axis||o.axis!="x"){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed
}else{if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed
}}}if(!o.axis||o.axis!="y"){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed
}else{if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed
}}}}else{if(!o.axis||o.axis!="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)
}else{if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)
}}}if(!o.axis||o.axis!="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)
}else{if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)
}}}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event)
}}});
$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;
i.snapElements=[];
$(o.snap.constructor!=String?(o.snap.items||":data(draggable)"):o.snap).each(function(){var $t=$(this);
var $o=$t.offset();
if(this!=i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})
}})
},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;
var d=o.snapTolerance;
var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;
for(var i=inst.snapElements.length-1;
i>=0;
i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;
if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d))){if(inst.snapElements[i].snapping){(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})))
}inst.snapElements[i].snapping=false;
continue
}if(o.snapMode!="inner"){var ts=Math.abs(t-y2)<=d;
var bs=Math.abs(b-y1)<=d;
var ls=Math.abs(l-x2)<=d;
var rs=Math.abs(r-x1)<=d;
if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top
}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top
}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left
}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left
}}var first=(ts||bs||ls||rs);
if(o.snapMode!="outer"){var ts=Math.abs(t-y1)<=d;
var bs=Math.abs(b-y2)<=d;
var ls=Math.abs(l-x1)<=d;
var rs=Math.abs(r-x2)<=d;
if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top
}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top
}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left
}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left
}}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})))
}inst.snapElements[i].snapping=(ts||bs||ls||rs||first)
}}});
$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;
var group=$.makeArray($(o.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||o.stack.min)-(parseInt($(b).css("zIndex"),10)||o.stack.min)
});
$(group).each(function(i){this.style.zIndex=o.stack.min+i
});
this[0].style.zIndex=o.stack.min+group.length
}});
$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;
if(t.css("zIndex")){o._zIndex=t.css("zIndex")
}t.css("zIndex",o.zIndex)
},stop:function(event,ui){var o=$(this).data("draggable").options;
if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex)
}}})
})(jQuery);
(function($){$.widget("ui.droppable",{_init:function(){var o=this.options,accept=o.accept;
this.isover=0;
this.isout=1;
this.options.accept=this.options.accept&&$.isFunction(this.options.accept)?this.options.accept:function(d){return d.is(accept)
};
this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};
$.ui.ddmanager.droppables[this.options.scope]=$.ui.ddmanager.droppables[this.options.scope]||[];
$.ui.ddmanager.droppables[this.options.scope].push(this);
(this.options.addClasses&&this.element.addClass("ui-droppable"))
},destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];
for(var i=0;
i<drop.length;
i++){if(drop[i]==this){drop.splice(i,1)
}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")
},_setData:function(key,value){if(key=="accept"){this.options.accept=value&&$.isFunction(value)?value:function(d){return d.is(value)
}
}else{$.widget.prototype._setData.apply(this,arguments)
}},_activate:function(event){var draggable=$.ui.ddmanager.current;
if(this.options.activeClass){this.element.addClass(this.options.activeClass)
}(draggable&&this._trigger("activate",event,this.ui(draggable)))
},_deactivate:function(event){var draggable=$.ui.ddmanager.current;
if(this.options.activeClass){this.element.removeClass(this.options.activeClass)
}(draggable&&this._trigger("deactivate",event,this.ui(draggable)))
},_over:function(event){var draggable=$.ui.ddmanager.current;
if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0]){return 
}if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)
}this._trigger("over",event,this.ui(draggable))
}},_out:function(event){var draggable=$.ui.ddmanager.current;
if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0]){return 
}if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)
}this._trigger("out",event,this.ui(draggable))
}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current;
if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0]){return false
}var childrenIntersection=false;
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,"droppable");
if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;
return false
}});
if(childrenIntersection){return false
}if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)
}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)
}this._trigger("drop",event,this.ui(draggable));
return this.element
}return false
},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,absolutePosition:c.positionAbs,offset:c.positionAbs}
}});
$.extend($.ui.droppable,{version:"1.7.1",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});
$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset){return false
}var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;
var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;
switch(toleranceMode){case"fit":return(l<x1&&x2<r&&t<y1&&y2<b);
break;
case"intersect":return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);
break;
case"pointer":var draggableLeft=((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left),draggableTop=((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top),isOver=$.ui.isOver(draggableTop,draggableLeft,t,l,droppable.proportions.height,droppable.proportions.width);
return isOver;
break;
case"touch":return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));
break;
default:return false;
break
}};
$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope];
var type=event?event.type:null;
var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();
droppablesLoop:for(var i=0;
i<m.length;
i++){if(m[i].options.disabled||(t&&!m[i].options.accept.call(m[i].element[0],(t.currentItem||t.element)))){continue
}for(var j=0;
j<list.length;
j++){if(list[j]==m[i].element[0]){m[i].proportions.height=0;
continue droppablesLoop
}}m[i].visible=m[i].element.css("display")!="none";
if(!m[i].visible){continue
}m[i].offset=m[i].element.offset();
m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};
if(type=="mousedown"){m[i]._activate.call(m[i],event)
}}},drop:function(draggable,event){var dropped=false;
$.each($.ui.ddmanager.droppables[draggable.options.scope],function(){if(!this.options){return 
}if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance)){dropped=this._drop.call(this,event)
}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=1;
this.isover=0;
this._deactivate.call(this,event)
}});
return dropped
},drag:function(draggable,event){if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)
}$.each($.ui.ddmanager.droppables[draggable.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return 
}var intersects=$.ui.intersect(draggable,this,this.options.tolerance);
var c=!intersects&&this.isover==1?"isout":(intersects&&this.isover==0?"isover":null);
if(!c){return 
}var parentInstance;
if(this.options.greedy){var parent=this.element.parents(":data(droppable):eq(0)");
if(parent.length){parentInstance=$.data(parent[0],"droppable");
parentInstance.greedyChild=(c=="isover"?1:0)
}}if(parentInstance&&c=="isover"){parentInstance.isover=0;
parentInstance.isout=1;
parentInstance._out.call(parentInstance,event)
}this[c]=1;
this[c=="isout"?"isover":"isout"]=0;
this[c=="isover"?"_over":"_out"].call(this,event);
if(parentInstance&&c=="isout"){parentInstance.isout=0;
parentInstance.isover=1;
parentInstance._over.call(parentInstance,event)
}})
}}
})(jQuery);
(function($){$.widget("ui.slider",$.extend({},$.ui.mouse,{_init:function(){var self=this,o=this.options;
this._keySliding=false;
this._handleIndex=null;
this._detectOrientation();
this._mouseInit();
this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");
this.range=$([]);
if(o.range){if(o.range===true){this.range=$("<div></div>");
if(!o.values){o.values=[this._valueMin(),this._valueMin()]
}if(o.values.length&&o.values.length!=2){o.values=[o.values[0],o.values[0]]
}}else{this.range=$("<div></div>")
}this.range.appendTo(this.element).addClass("ui-slider-range");
if(o.range=="min"||o.range=="max"){this.range.addClass("ui-slider-range-"+o.range)
}this.range.addClass("ui-widget-header")
}if($(".ui-slider-handle",this.element).length==0){$('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}if(o.values&&o.values.length){while($(".ui-slider-handle",this.element).length<o.values.length){$('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}}this.handles=$(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");
this.handle=this.handles.eq(0);
this.handles.add(this.range).filter("a").click(function(event){event.preventDefault()
}).hover(function(){$(this).addClass("ui-state-hover")
},function(){$(this).removeClass("ui-state-hover")
}).focus(function(){$(".ui-slider .ui-state-focus").removeClass("ui-state-focus");
$(this).addClass("ui-state-focus")
}).blur(function(){$(this).removeClass("ui-state-focus")
});
this.handles.each(function(i){$(this).data("index.ui-slider-handle",i)
});
this.handles.keydown(function(event){var ret=true;
var index=$(this).data("index.ui-slider-handle");
if(self.options.disabled){return 
}switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:ret=false;
if(!self._keySliding){self._keySliding=true;
$(this).addClass("ui-state-active");
self._start(event,index)
}break
}var curVal,newVal,step=self._step();
if(self.options.values&&self.options.values.length){curVal=newVal=self.values(index)
}else{curVal=newVal=self.value()
}switch(event.keyCode){case $.ui.keyCode.HOME:newVal=self._valueMin();
break;
case $.ui.keyCode.END:newVal=self._valueMax();
break;
case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal==self._valueMax()){return 
}newVal=curVal+step;
break;
case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal==self._valueMin()){return 
}newVal=curVal-step;
break
}self._slide(event,index,newVal);
return ret
}).keyup(function(event){var index=$(this).data("index.ui-slider-handle");
if(self._keySliding){self._stop(event,index);
self._change(event,index);
self._keySliding=false;
$(this).removeClass("ui-state-active")
}});
this._refreshValue()
},destroy:function(){this.handles.remove();
this.range.remove();
this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy()
},_mouseCapture:function(event){var o=this.options;
if(o.disabled){return false
}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};
this.elementOffset=this.element.offset();
var position={x:event.pageX,y:event.pageY};
var normValue=this._normValueFromMouse(position);
var distance=this._valueMax()-this._valueMin()+1,closestHandle;
var self=this,index;
this.handles.each(function(i){var thisDistance=Math.abs(normValue-self.values(i));
if(distance>thisDistance){distance=thisDistance;
closestHandle=$(this);
index=i
}});
if(o.range==true&&this.values(1)==o.min){closestHandle=$(this.handles[++index])
}this._start(event,index);
self._handleIndex=index;
closestHandle.addClass("ui-state-active").focus();
var offset=closestHandle.offset();
var mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");
this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-(closestHandle.height()/2)-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};
normValue=this._normValueFromMouse(position);
this._slide(event,index,normValue);
return true
},_mouseStart:function(event){return true
},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY};
var normValue=this._normValueFromMouse(position);
this._slide(event,this._handleIndex,normValue);
return false
},_mouseStop:function(event){this.handles.removeClass("ui-state-active");
this._stop(event,this._handleIndex);
this._change(event,this._handleIndex);
this._handleIndex=null;
this._clickOffset=null;
return false
},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"
},_normValueFromMouse:function(position){var pixelTotal,pixelMouse;
if("horizontal"==this.orientation){pixelTotal=this.elementSize.width;
pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)
}else{pixelTotal=this.elementSize.height;
pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)
}var percentMouse=(pixelMouse/pixelTotal);
if(percentMouse>1){percentMouse=1
}if(percentMouse<0){percentMouse=0
}if("vertical"==this.orientation){percentMouse=1-percentMouse
}var valueTotal=this._valueMax()-this._valueMin(),valueMouse=percentMouse*valueTotal,valueMouseModStep=valueMouse%this.options.step,normValue=this._valueMin()+valueMouse-valueMouseModStep;
if(valueMouseModStep>(this.options.step/2)){normValue+=this.options.step
}return parseFloat(normValue.toFixed(5))
},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};
if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);
uiHash.values=this.values()
}this._trigger("start",event,uiHash)
},_slide:function(event,index,newVal){var handle=this.handles[index];
if(this.options.values&&this.options.values.length){var otherVal=this.values(index?0:1);
if((index==0&&newVal>=otherVal)||(index==1&&newVal<=otherVal)){newVal=otherVal
}if(newVal!=this.values(index)){var newValues=this.values();
newValues[index]=newVal;
var allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});
var otherVal=this.values(index?0:1);
if(allowed!==false){this.values(index,newVal,(event.type=="mousedown"&&this.options.animate),true)
}}}else{if(newVal!=this.value()){var allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});
if(allowed!==false){this._setData("value",newVal,(event.type=="mousedown"&&this.options.animate))
}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};
if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);
uiHash.values=this.values()
}this._trigger("stop",event,uiHash)
},_change:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};
if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);
uiHash.values=this.values()
}this._trigger("change",event,uiHash)
},value:function(newValue){if(arguments.length){this._setData("value",newValue);
this._change(null,0)
}return this._value()
},values:function(index,newValue,animated,noPropagation){if(arguments.length>1){this.options.values[index]=newValue;
this._refreshValue(animated);
if(!noPropagation){this._change(null,index)
}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(index)
}else{return this.value()
}}else{return this._values()
}},_setData:function(key,value,animated){$.widget.prototype._setData.apply(this,arguments);
switch(key){case"orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);
this._refreshValue(animated);
break;
case"value":this._refreshValue(animated);
break
}},_step:function(){var step=this.options.step;
return step
},_value:function(){var val=this.options.value;
if(val<this._valueMin()){val=this._valueMin()
}if(val>this._valueMax()){val=this._valueMax()
}return val
},_values:function(index){if(arguments.length){var val=this.options.values[index];
if(val<this._valueMin()){val=this._valueMin()
}if(val>this._valueMax()){val=this._valueMax()
}return val
}else{return this.options.values
}},_valueMin:function(){var valueMin=this.options.min;
return valueMin
},_valueMax:function(){var valueMax=this.options.max;
return valueMax
},_refreshValue:function(animate){var oRange=this.options.range,o=this.options,self=this;
if(this.options.values&&this.options.values.length){var vp0,vp1;
this.handles.each(function(i,j){var valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;
var _set={};
_set[self.orientation=="horizontal"?"left":"bottom"]=valPercent+"%";
$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);
if(self.options.range===true){if(self.orientation=="horizontal"){(i==0)&&self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate);
(i==1)&&self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})
}else{(i==0)&&self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate);
(i==1)&&self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate})
}}lastValPercent=valPercent
})
}else{var value=this.value(),valueMin=this._valueMin(),valueMax=this._valueMax(),valPercent=valueMax!=valueMin?(value-valueMin)/(valueMax-valueMin)*100:0;
var _set={};
_set[self.orientation=="horizontal"?"left":"bottom"]=valPercent+"%";
this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);
(oRange=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate);
(oRange=="max")&&(this.orientation=="horizontal")&&this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate});
(oRange=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate);
(oRange=="max")&&(this.orientation=="vertical")&&this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate})
}}}));
$.extend($.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})
})(jQuery);
(function($){$.fn.showLoading=function(options){var defaults={callback:function(){},autoFocus:true,loadingStr:""};
var options=$.extend(defaults,options);
return this.each(function(){var loading=$(this).find(".loadingPlaceholder");
if(loading.length==0){$(this).prepend("<div class='loadingPlaceholder'>"+options.loadingStr+"</div>");
loading=$(this).find(".loadingPlaceholder")
}$(this).children().hide();
loading.slideDown(function(){options.callback();
if(options.autoFocus){window.scrollTo(0,loading.offset().top)
}})
})
};
$.fn.hideLoading=function(options){var defaults={callback:function(){}};
var options=$.extend(defaults,options);
return this.each(function(){var loading=$(this).find(".loadingPlaceholder");
if(loading.length>0){loading.slideUp(function(){$(this).children().show();
options.callback()
})
}})
}
})(jQuery);
﻿var isSeasonPasses = false;
$(function() {
	$(".BuildMyTripForm input:radio").bind("click", function(){
	    var Heavenly        = "94b93799-3a60-4a59-b715-f010640e0fb8";
	    var Vail            = "b83de25a-2851-4c0c-a140-f1e9d025234c";
	    var Keystone        = "fbac9f42-158c-44af-92f0-c25a54047393";
	    var Beavercreek     = "5350cedf-9d41-4f1a-b388-517affdbbdb4";
	    var Breckenridge    = "f1adaa57-af9e-4cb3-8a3f-4a12a4a41c03";
	    
	    switch ($(this).val()){
	        case Heavenly:
	        case Vail:
	        case Keystone:
	        case Beavercreek:
	        case Breckenridge:
			    $("fieldset.datesAndTravellers").hide();
			    isSeasonPasses = true;
	            break;
	        default:
			    $("fieldset.datesAndTravellers").show();
			    isSeasonPasses = false;
	        break;
	    }
	});
    $('[id$=txtCheckInDate]').bind("change", function() {
        if($('[id$=txtCheckInDate]').val() != '' && IsDateMMDDYYYY($('[id$=txtCheckInDate]').val())) {
            var NewDate = new Date($('[id$=txtCheckInDate]').val());
            NewDate.setDate(NewDate.getDate() + 1);
            $('[id$=txtCheckOutDate]').datepicker('option', 'minDate', NewDate);
            $('[id$=txtCheckOutDate]').datepicker('setDate', NewDate);            
        }
    });
    $('[id$=txtCheckInDate]').datepicker("option", "onClose", function() {
        if($('[id$=txtCheckInDate]').val() != '' && IsDateMMDDYYYY($('[id$=txtCheckInDate]').val())) {
            var NewDate = new Date($('[id$=txtCheckInDate]').val());
            NewDate.setDate(NewDate.getDate() + 1);
            $('[id$=txtCheckOutDate]').datepicker('option', 'minDate', NewDate);
            $('[id$=txtCheckOutDate]').datepicker('setDate', NewDate);            
        }
    });
    $("#selProductTopLeftGrey").removeClass("topLeftLightGrey");
    $("#selProductMiddleLeftGrey").removeClass("middleLeftLightGrey");
    $("#selProductLightGreyBox").removeClass("lightGreyBox");
    $("#selProductBottomLeftGrey").removeClass("bottomLeftLightGrey");
    //$("#selProductBottomLeftGrey ul").removeClass("item_itinerary");
    $(".buildMyTripContent .item_itinerary").removeClass("item_itinerary");
    $("[id$=noProductSelectedErrorMessage]").addClass("hide");
    $(".buildMyTripContent .itineraryBtn").addClass("hide");
    $(".buildMyTripContent .itineraryBox h4").addClass("hide");

    $("[id$=kidsNoAdded]").unbind("change").bind("change", function() {
        if ($("[id$=kidsNoAdded]").val() > 0) {
            $("#" + 'howOldAreChildrenText').removeClass("hideDiv");
        }
        else {
            $("#" + 'howOldAreChildrenText').attr("class", "hideDiv");
        }
        $("ul#addDropBox li").addClass("hideDiv");
        $("ul#addDropBox li:lt(" + $(this).val() + ")").removeClass("hideDiv");
    });

    $("input[id $= 'txtCheckInDate']").change(function() {
        var enteredDateValue = $("input[id $= 'txtCheckInDate']").val();

        // RegEx Pattern for validating date syntax
        var RegExPattern = /^\d{1,2}\/\d{1,2}\/\d{1,4}$/;
        if ((enteredDateValue.match(RegExPattern)) && (enteredDateValue != '')) {
            var str = enteredDateValue.split('/');

            if (str[2].length == 2) {
                var enteredDate = new Date(enteredDateValue);
                if (enteredDate.getFullYear() < 2000) {
                    enteredDate = new Date(Math.round(enteredDate.getMonth() + 1) + '/' + enteredDate.getDate() + '/' + Math.round(enteredDate.getFullYear() + 100));
                    $("input[id $= 'txtCheckInDate']").val(Math.round(enteredDate.getMonth() + 1) + '/' + enteredDate.getDate() + '/' + enteredDate.getFullYear());
                }
            }
        }
    });

    $("input[id $= 'txtCheckOutDate']").change(function() {
        var enteredDateValue = $("input[id $= 'txtCheckOutDate']").val();

        // RegEx Pattern for validating date syntax
        var RegExPattern = /^\d{1,2}\/\d{1,2}\/\d{1,4}$/;
        if ((enteredDateValue.match(RegExPattern)) && (enteredDateValue != '')) {
            var str = enteredDateValue.split('/');
            if (str[2].length == 2) {
                var enteredDate = new Date(enteredDateValue);
                if (enteredDate.getFullYear() < 2000) {
                    enteredDate = new Date(Math.round(enteredDate.getMonth() + 1) + '/' + enteredDate.getDate() + '/' + Math.round(enteredDate.getFullYear() + 100));
                    $("input[id $= 'txtCheckOutDate']").val(Math.round(enteredDate.getMonth() + 1) + '/' + enteredDate.getDate() + '/' + enteredDate.getFullYear());
                }
            }
        }
    });

/* added to fix - artf1015888 : K | Book A Vacation | Color of Continue button is incorrect [SA] */
if("#keystone".length>0){
    $("#keystone .buildMyTrip .buildMyTripContent ul.datesTravelers li.btnContainer span").removeClass("btnGrey");
    }

if("#vail".length>0){
    $("#vail .buildMyTrip .buildMyTripContent ul.datesTravelers li.btnContainer input").removeClass("activeBtnVacation");
    }    
/* end of fix - artf1015888 [SA]*/

});

//This function validates if total number of travelers is greater than 19.
function ValidateTotalNumberOfTravelers(val, args) {
    var totalTravelers = Number($("#" + val.controltovalidate).val()) + Number($("[id$=kidsNoAdded]").val());
    
    if (totalTravelers > 19) {
        args.IsValid = false;
    } else {
        args.IsValid = true;
    }
    return args.IsValid;
}

//This function checks if user has selected any product or not.
function HasUserSelectedAnyProduct(val, args) {
    if ($(".BuildMyTripForm input:radio:checked").length > 0) {
        args.IsValid = true;
    }
    else {
        args.IsValid = false;
    }
    return (args.IsValid);
}


//This function calculates difference between two dates
function DateDiff(strDate1,strDate2) {
    var one_day = 1000 * 60 * 60 * 24;
    date1 = new Date(strDate1.split('/')[2], (strDate1.split('/')[0] - 1), strDate1.split('/')[1]);
    date2 = new Date(strDate2.split('/')[2], (strDate2.split('/')[0] - 1), strDate2.split('/')[1]);

    var difference = Math.ceil((date1.getTime() - date2.getTime()) / (one_day));
    return (difference);
}

//The function fires the checkout date range validator if check out date is 
//entered in correct format.
function validateGeneralInfo(productSelectionValidator, reqdCheckInDateValidator, checkInDateRegularExpressionValidator, reqdCheckOutDateValidator, checkOutDateRegularExpressionValidator, datesComparer, checkoutDateRangeValidator, checkInDateRangeValidator, checkoutDateLessThanCurValidator, checkInDateWithinYearValidator, reqdadultTravelersRequiredValidator, totalNumberOfTravelersValidator) {
    var doValidation = false;
    var validationResult = false;
    var requiredValidatorsFailed = false;
    var regExValidatorsFailed = false;
    var checkInDateMissing = false;
    var checkOutDateMissing = false;
    var checkInDateIsNotLessThanEqualToCurrent = false;
    var checkOutDateIsNotLessThanEqualToCurrent = false;
    var checkInDateFormatIsCorrect = false;
    var adultTravelersSelected = true;
    var isProductSelected = false;
    var areDatesFine = false;
    var totalTraverlersExceededTheLimit = false;
    var checkInDateIsWithinAYear = false;
    var validatorIDs = new Array();

    var checkInDateFormatErrorMessage = 'Check In Date - Check In Date format must be MM/DD/YYYY.<br/>';
    var checkOutDateFormatErrorMessage = 'Check Out Date - Check Out Date format must be MM/DD/YYYY.<br/>';
    
    var requiredFieldMissingErrorMessage = '<li>Please complete the following required fields:<br/>';
    var regExValidationErrorMessage = '<li>You have entered the following invalid data:<br/>';

    //if season passes is selected then don't do any validation - prateek artf996898 
    if(isSeasonPasses)
    {
        return true;
    }
    else
    {
        $("[id$='requiredErrorMessageSummary']").addClass("errorMessage");
        $("[id$='regularExpressionValidationSummary']").addClass("errorMessage");
        $("[id$='requiredErrorMessageSummary']").html("");
        $("[id$='regularExpressionValidationSummary']").html("");

        for (var i = 0; i < Page_Validators.length; i++) {
            var key = Page_Validators[i].id;
            var value = i;
            validatorIDs[key] = value;
        }

        ValidatorValidate(Page_Validators[validatorIDs[productSelectionValidator]]);

        if (Page_Validators[validatorIDs[productSelectionValidator]].isvalid == true) {
            isProductSelected = true;
        }

        for (validator in validatorIDs) {
            if (validator.indexOf('reqd') > -1) {
                ValidatorValidate(Page_Validators[validatorIDs[validator]]);
                if (Page_Validators[validatorIDs[validator]].isvalid == false) {

                    $("#" + Page_Validators[validatorIDs[validator]].controltovalidate).closest("li").find("label").addClass("required");

                    requiredFieldMissingErrorMessage += "" + $("#" + Page_Validators[validatorIDs[validator]].controltovalidate).closest("li").find("label").text().replace(/:/, '') + "<br/>";

                    $("[id$='requiredErrorMessageSummary']").html(requiredFieldMissingErrorMessage);

                    requiredValidatorsFailed = true;

                    if (Page_Validators[validatorIDs[validator]].controltovalidate.indexOf('txtCheckInDate') > -1) {
                        checkInDateMissing = true;
                    }

                    if (Page_Validators[validatorIDs[validator]].controltovalidate.indexOf('txtCheckOutDate') > -1) {
                        checkOutDateMissing = true;
                    }

                    if (Page_Validators[validatorIDs[validator]].controltovalidate.indexOf('adultNo') > -1) {
                        adultTravelersSelected = false;
                    }
                }
                else {
                    $("#" + Page_Validators[validatorIDs[validator]].controltovalidate).closest("li").find("label").removeClass("required");
                }
            }
        }

        requiredFieldMissingErrorMessage += "</li>";

        if (checkInDateMissing == false) {
            ValidatorValidate(Page_Validators[validatorIDs[checkInDateRegularExpressionValidator]]);
            if (Page_Validators[validatorIDs[checkInDateRegularExpressionValidator]].isvalid == false) {
                validationResult = false;
                regExValidationErrorMessage += checkInDateFormatErrorMessage;
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
                $("#" + Page_Validators[validatorIDs[checkInDateRegularExpressionValidator]].controltovalidate).closest("li").find("label").addClass("required");
            }
            else {
                validationResult = true;
                checkInDateFormatIsCorrect = true;
                $("#" + Page_Validators[validatorIDs[checkInDateRegularExpressionValidator]].controltovalidate).closest("li").find("label").removeClass("required");
            }
        }

        if (checkOutDateMissing == false) {
            ValidatorValidate(Page_Validators[validatorIDs[checkOutDateRegularExpressionValidator]]);
            if (Page_Validators[validatorIDs[checkOutDateRegularExpressionValidator]].isvalid == false) {
                doValidation = false;
                regExValidationErrorMessage += checkOutDateFormatErrorMessage;
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
                $("#" + Page_Validators[validatorIDs[checkOutDateRegularExpressionValidator]].controltovalidate).closest("li").find("label").addClass("required");
            }
            else {
                doValidation = true;
                $("#" + Page_Validators[validatorIDs[checkOutDateRegularExpressionValidator]].controltovalidate).closest("li").find("label").removeClass("required");
            }
        }
        
        if (isProductSelected == false) {
            requiredFieldMissingErrorMessage += 'Select atleast one product';
            $("[id$='requiredErrorMessageSummary']").html(requiredFieldMissingErrorMessage);
        }
        
        if (validationResult == true) {
            //$("[id$=regularExpressionValidationSummary]").html("");
            ValidatorEnable(Page_Validators[validatorIDs[checkInDateRangeValidator]], true);
            ValidatorValidate(Page_Validators[validatorIDs[checkInDateRangeValidator]]);
            
            if (Page_Validators[validatorIDs[checkInDateRangeValidator]].isvalid == true) {
                checkInDateIsNotLessThanEqualToCurrent = true;
            }
            else {
                regExValidationErrorMessage += 'Check In - Check In date cannot be less than current date + 2-Days.<br/>Please re-enter your data.<br/>';
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
            }
                
            ValidatorEnable(Page_Validators[validatorIDs[checkInDateWithinYearValidator]], true);
            ValidatorValidate(Page_Validators[validatorIDs[checkInDateWithinYearValidator]]);
            
            if (Page_Validators[validatorIDs[checkInDateWithinYearValidator]].isvalid == true) {
                checkInDateIsWithinAYear = true;
            }
            else {
                regExValidationErrorMessage += 'Check In - Check In date cannot be greater than 365 days from current date.<br/>Please re-enter your data.<br/>';
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
            }
        }
        else {
            ValidatorEnable(Page_Validators[validatorIDs[checkInDateRangeValidator]], false);
        }
        
        if (doValidation == true) {
            ValidatorEnable(Page_Validators[validatorIDs[checkoutDateLessThanCurValidator]], true);
            ValidatorValidate(Page_Validators[validatorIDs[checkoutDateLessThanCurValidator]]);
            
            if (Page_Validators[validatorIDs[checkoutDateLessThanCurValidator]].isvalid == false) {
                checkOutDateIsNotLessThanEqualToCurrent = false;
                regExValidationErrorMessage += 'Check Out - Check Out date cannot be less than current date + 2-Days.<br/>Please re-enter your data.<br/>';
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
            }
            else {
                checkOutDateIsNotLessThanEqualToCurrent = true;
                ValidatorEnable(Page_Validators[validatorIDs[checkoutDateLessThanCurValidator]], false);
            }

            if (((checkOutDateIsNotLessThanEqualToCurrent == true) && (checkInDateFormatIsCorrect == false)) || ((checkOutDateIsNotLessThanEqualToCurrent == true) && (checkInDateMissing == true)) || ((checkOutDateIsNotLessThanEqualToCurrent == true) && (checkInDateFormatIsCorrect == true))) {
                ValidatorEnable(Page_Validators[validatorIDs[checkoutDateRangeValidator]], true);
                ValidatorValidate(Page_Validators[validatorIDs[checkoutDateRangeValidator]]);
                if (Page_Validators[validatorIDs[checkoutDateRangeValidator]].isvalid == false) {
                    regExValidationErrorMessage += 'Check Out - Check Out date cannot be greater than 365 days from current date.<br/>Please re-enter your data.<br/>';
                    $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
                }
            }

            if ((checkOutDateIsNotLessThanEqualToCurrent == true) && (checkInDateMissing == false) && (checkInDateIsWithinAYear == true) && (Page_Validators[validatorIDs[checkoutDateRangeValidator]].isvalid == true))
            {
            ValidatorEnable(Page_Validators[validatorIDs[datesComparer]], true);
            ValidatorValidate(Page_Validators[validatorIDs[datesComparer]]);
            if (Page_Validators[validatorIDs[datesComparer]].isvalid == true) {
                regExValidationErrorMessage += 'Check Out - Check Out date cannot be same as check in date.<br/>Please re-enter your data.<br/>';
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
            }
            else {
                var difference = DateDiff(document.getElementById(Page_Validators[validatorIDs[datesComparer]].controltocompare).value, document.getElementById(Page_Validators[validatorIDs[datesComparer]].controltovalidate).value);
                if ((difference >= 1) && (checkInDateIsNotLessThanEqualToCurrent == true)) {
                    areDatesFine = true;
                }
                else if ((checkInDateIsNotLessThanEqualToCurrent == true) && (checkInDateIsWithinAYear == true) && (checkOutDateIsNotLessThanEqualToCurrent == true)) {
                    regExValidationErrorMessage += 'Check Out - Check Out date must be at least 1 day following the check in date.<br/>Please re-enter your data.<br/>';
                    $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
                }
            }
            }
        }
        else {
            ValidatorEnable(Page_Validators[validatorIDs[checkoutDateRangeValidator]], false);
            ValidatorEnable(Page_Validators[validatorIDs[checkoutDateLessThanCurValidator]], false);
            ValidatorEnable(Page_Validators[validatorIDs[datesComparer]], false);
        }
        
        if (adultTravelersSelected == true) {
            ValidatorEnable(Page_Validators[validatorIDs[totalNumberOfTravelersValidator]], true);
            ValidatorValidate(Page_Validators[validatorIDs[totalNumberOfTravelersValidator]]);
            if (Page_Validators[validatorIDs[totalNumberOfTravelersValidator]].isvalid == false) {
                regExValidationErrorMessage += 'Party Size - Party Size cannot exceed 19 travelers. Please contact customer service or re-enter your data.<br/>';
                $("[id$='regularExpressionValidationSummary']").html(regExValidationErrorMessage);
                totalTraverlersExceededTheLimit = true;
            }
        }
        return ((areDatesFine) && (!totalTraverlersExceededTheLimit) && (adultTravelersSelected) && (isProductSelected));
    }
}
(function($){$.fn.gBox=function(options){var defaults={theme:"gradientBox",callback:function(){}};
var options=$.extend(defaults,options);
var gradientBox={};
var whiteBox={};
var whiteBoxNoMargin={};
var lightGreyBox={};
return this.each(function(){})
}
})(jQuery);
$(document).ready(function () {

	/*=== Carousel ===*/
	var myCarousel = $('#myChrome');
	if (myCarousel.length > 0) {
		myCarousel.jcarousel({
			scroll: 1
		});
		var myCarouselWidth = myCarousel.width();
		myCarousel.width(myCarouselWidth + 200);
	}

	/*=== Carousel ===*/
	/*var checkOutChrome = $('#checkOutChrome');
	if (checkOutChrome.length > 0) {
		checkOutChrome.jcarousel({
			scroll: 1
		});
		var myCarouselWidth = checkOutChrome.width();
		checkOutChrome.width(myCarouselWidth + 200);
	}*/

	/*=== Pnb specific tabs ===*/
	$("ul.mainTabsPnB > li:first, ul.mainTabsPnB > li:first > a").addClass("tabs-selected");
	$(".contentContainer").children(":first").addClass("tabs-show");
	$("ul.mainTabsPnB > li > a").click(function (event) {
		event.preventDefault();
		$("ul.mainTabsPnB > li, ul.mainTabsPnB > li > a").removeClass("tabs-selected")
		$(this).addClass("tabs-selected");
		$(this).closest("li").addClass("tabs-selected");
		$(".contentContainer div").removeClass("tabs-show");
		var pickId = $(this).attr("href");
		$(pickId).addClass("tabs-show");
	});

	/*=== buble styles for lodging info detail page ===*/
	$('.roomType').click(function () {
		var getId = $(this).next().attr('id');
		$('#' + getId).slideToggle(350);
	});

	$(".linkClose").click(function () {
		$(".overlayDiv").addClass("hideDiv");
		$(".modalDiv").addClass("hideDiv");
	});

	/*=== Modal window script for avialablity calander ===*/
	$(".availableCalander").click(function () {
		$(".overlayDiv").css("height", $(document).height());
		$(".overlayDiv").css("width", $(document).width());
		$(".overlayDiv").css("opacity", "0.5");
		$("#hideDropDown").css("opacity", "0");
		$(".hoverBubble").css('display', 'none');
		$(".overlayDiv").removeClass("hideDiv");
		$("#availablity").removeClass("hideDiv");
	});

	$(".linkClose").click(function () {
		$(".overlayDiv").addClass("hideDiv");
		$("#availablity").addClass("hideDiv");
	});

	/*=== toggle class name for date selection ===*/
	$("table.calanderDatesPrice td").click(function () {
		if ($(this).attr("class") == "available") {
			$(this).removeClass("available");
		}
		else if (($(this).text() == "") || ($(this).attr("class") == "notAvailable")) {
			$(this).removeClass("available");
		}
		else {
			$(this).addClass("available");
		}
	});

	/*=== color blank div with dark grey ===*/
	$("table.calanderDatesPrice td").each(function () {
		if ($(this).text() == "") {
			$(this).addClass("blankTD");
		}
	});

	if ($("[id$='_coloradoSnow']").is(":checked") == true) {
		$("#coloradoReportOptions").removeClass("hideDiv");
	}
	else {
		$("#coloradoReportOptions").addClass("hideDiv");
	}

	if ($("[id$='_heavenlySnow']").is(":checked") == true) {
		$("#heavenlyReportOptions").removeClass("hideDiv");
	}
	else {
		$("#heavenlyReportOptions").addClass("hideDiv");
	}

	$("[id$='_coloradoSnow']").click(function () {
		var div = $("ul#coloradoReportOptions");
		if ($("[id$='_coloradoSnow']").attr("checked")) {
			$("#coloradoReportOptions").removeClass("hideDiv");
			//div.show();
		} else {
			$("#coloradoReportOptions").addClass("hideDiv");
			//div.hide();
		}
	})

	$("[id$='_heavenlySnow']").click(function () {
		var div = $("ul#heavenlyReportOptions");
		if ($("[id$='_heavenlySnow']").attr("checked")) {
			$("#heavenlyReportOptions").removeClass("hideDiv");
			//div.show();
		} else {
			$("#heavenlyReportOptions").addClass("hideDiv");
			//div.hide();
		}
	})

	/*=== expand collpase right filter for logding list view page ===*/
	$("img.collapsibleLink").click(function () {
		var current = this;
		var container = $(this).parent().next();
		if ($(container).css("display") == "none") {
			$(current).attr('src', '/VailResorts/sites/PlanningAndBooking/assets/img/iconMinus.gif');
			$(container).toggle();
		} else {
			$(current).attr('src', '/VailResorts/sites/PlanningAndBooking/assets/img/iconPlus.gif');
			$(container).toggle();
		}
	});

	/*=== disabled a row in the lodging detail table and lodging offer table ===*/
	$("table.booking tr td.disabledRow, table.booking tr td.disabledRow span, table.booking tr td.disabledRow a").css("color", "#ccc");
	$("table.booking tr td.disabledRow select, table.booking tr td.disabledRow input").attr("disabled", "disabled");

	$(".registerButtonContainer a[id$=hlRegister]").unbind("click").bind("click", function (e) {
		e.preventDefault();

		window.parent.location.href = $(this).attr("href");

		return false;
	});

}); //document ready ends

/*=== Verify whether inputDate is greater the default Date Picker Max date, if yes return true else false ===*/
function IsMaximumDateRange(inputDate) {
	Date1 = new Date(inputDate);
	Date2 = new Date($("[id$=hdMaxDate]").eq(0).val());

	if (Date1 > Date2) return true;
	return false;
}

function getMaximumDateRange() {
	var todaysDt = new Date($("[id$=hdMaxDate]").eq(0).val());
	todaysDt.setDate(todaysDt.getDate() + 1);
	return (todaysDt.getMonth() + 1) + "/" + todaysDt.getDate() + "/" + todaysDt.getFullYear();
}

function showInterstitial(options){
	var defaults = {
		url: "",
		width: 790,
		height: 600,
		bgColor: "#003466",
		maxShowTime: 0,
		minShowTime: 5000,
		callback: function(){}
	};
	var interstitial = $.extend(defaults, options);
	
	if ( !$("body > .iLayer").data("isVisible") ){
	    $("body, html").css("overflow", "hidden");
    	
	    var docWidth = $(window).width();
	    var docHeight = getDocHeight();
	    var viewportHeight = $(window).height();
	    var viewportWidth = $(window).width();
    	
	    var iLayerLeft = ( viewportWidth - interstitial.width ) / 2;
	    iLayerLeft = (iLayerLeft < 0) ? 0 : iLayerLeft;
    	
	    var iLayerTop = ( viewportHeight - interstitial.height ) / 2;
	    iLayerTop = (iLayerTop < 0) ? 0 : iLayerTop;
    	
    	
	    var iOverlay = $("body > .iOverlay").css({
		    width: docWidth + "px",
		    height: docHeight + "px",
		    backgroundColor: interstitial.bgColor
	    });
    	
	    var iLayer = $("body > .iLayer").css({
		    width: interstitial.width + "px",
		    height: interstitial.height + "px",
		    left: iLayerLeft + "px",
		    top: iLayerTop + "px"
	    });
    	
	    var iLayerFrame = $("body > .iLayer iframe");
    	
	    iOverlay.bgiframe();
	    iOverlay.show();
	    iLayer.show();
		if ( iLayerFrame.attr("src").length == 0 ){
			iLayerFrame.attr("src",interstitial.url);
		}
	    window.scroll(0,0);
    	
	    iLayer.data("start", new Date().getTime());
	    iLayer.data("minShowTime", interstitial.minShowTime);
	    iLayer.data("isVisible", true);
    	
	    interstitial.callback();
    	
	    if ( interstitial.maxShowTime > 0 && interstitial.maxShowTime > interstitial.minShowTime ){
		    setTimeout(function(){
			    hideInterstitial();
		    }, interstitial.maxShowTime);
	    } else {
		    interstitial.maxShowTime = 0;
	    }
	    iLayer.data("maxShowTime", interstitial.maxShowTime);
	}
}

function hideInterstitial(options){
	var defaults = {
		callback: function(){}
	};
	var interstitial = $.extend(defaults, options);
	
	var isVisible = $("body > .iLayer").data("isVisible");
	
	if ( isVisible ){
		var iLayer = $("body > .iLayer");
		var iOverlay = $("body > .iOverlay");
		
		if ( iLayer.length > 0 ){
			var minShowTime = iLayer.data("minShowTime");
			
			var start = iLayer.data("start");
			var end = new Date().getTime();
			var elapsed = end - start;
			
			var timeout = (elapsed < minShowTime) ? minShowTime - elapsed : 0;
			
			setTimeout(function(){
				iOverlay.hide();
				iLayer.hide();
				//$("iframe", iLayer).attr("src", "");
				$("body, html").css("overflow", "");
				
				iLayer.data("isVisible", false);
				
				interstitial.callback();
			}, timeout);
		}
	}
}


function initInterstitial(){
	if ( $("[id$=hdninterstitialPageURL]").length > 0 ){
		var iURL = $("[id$=hdninterstitialPageURL]").eq(0).val();
	} else {
		var iURL = "";
	}
	if ( iURL.length > 1 ){
		var minTime = $("[id$=hdninterstitialMinTime]").eq(0).val();
		var maxTime = $("[id$=hdninterstitialMaxTime]").eq(0).val();
		showInterstitial({
			url: iURL,
			minShowTime:minTime,
			maxShowTime:maxTime,
			bgColor:"#003466"
		});
	}
}


﻿/// <reference path="~/jquery-1.3.2-vsdoc.js />

function disableAnchor(objLog, disable)
{
  if(disable)
  {
    var href = objLog.getAttribute("href");
    if(href && href != "" && href != null)
    {
       objLog.setAttribute('href_bak', href);
    }
    objLog.removeAttribute('href');
    objLog.style.color="gray";
  }
  else
  {
    objLog.setAttribute('href', objLog.attributes['href_bak'].nodeValue);
    objLog.style.color="blue";
  }
}

function loadAmenities(linkAmenities)
{
var linkAmenities=document.getElementById(linkAmenities);
$(linkAmenities).next("div").slideToggle(350);
}		
function UpdatePrice(price, dropdown,pricevalue)
{
var price=document.getElementById(price);
var dropdown=document.getElementById(dropdown);
selectedIndex=dropdown.selectedIndex;
selectedValue=dropdown.options[selectedIndex].value
price.innerHTML=selectedValue*pricevalue;
return false;

}
  
 function validate_CheckBoxList() {
 var selected='';
 var foundSelectedValue=false;
 var TotalSelected;
for (var counter=0;counter<document.forms[0].elements.length;counter++) 
{ 
    var Comparision = document.forms[0].elements[counter]; 
    if (Comparision.id == 'chkbox1') 
    { 
    
        if (Comparision.checked==true)
        {
            selected+=Comparision.value +','
            foundSelectedValue=true;
        } 
    }
} 
if (foundSelectedValue==false)
{
    alert('Please selected the Checkbox to compare');
}

}

//This function verifies if date entered is in mm/dd/yyyy format or not.
function IsDateMMDDYYYY(dtStr) {    

    var dtCh = "/"; 

    var minYear = 1900;
    var maxYear = 2100;

    var daysInMonth = DaysArray(12);
    var pos1 = dtStr.indexOf(dtCh);
    var pos2 = dtStr.indexOf(dtCh, pos1 + 1);
    var strMonth = dtStr.substring(0, pos1);
    var strDay = dtStr.substring(pos1 + 1, pos2);
    var strYear = dtStr.substring(pos2 + 1);
    strYr = strYear;
    if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1);
    if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1);
    for (var i = 1; i <= 3; i++) {
        if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1);
    }
    month = parseInt(strMonth);
    day = parseInt(strDay);
    year = parseInt(strYr);
    if (pos1 == -1 || pos2 == -1) {        
        return (false);
    }
    if (strMonth.length < 1 || month < 1 || month > 12) {        
        return (false);
    }
    if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > DaysInFebruary(year)) || day > daysInMonth[month]) {        
        return (false);
    }
    if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear) {        
        return (false);
    }
    if (dtStr.indexOf(dtCh, pos2 + 1) != -1 || isInteger(StripCharsInBag(dtStr, dtCh)) == false) {        
        return (false);
    }
    return (true);
}

function DaysInFebruary(year) {
    // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
}
function DaysArray(n) {
	var days = [];
    for (var i = 1; i <= n; i++) {
        days[i] = 31;
        if (i == 4 || i == 6 || i == 9 || i == 11) { days[i] = 30; }
        if (i == 2) { days[i] = 29; }
    }
    return (days);
}

function isInteger(s) {
    var i;
    for (i = 0; i < s.length; i++) {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return (false);
    }
    // All characters are numbers.
    return (true);
}
function StripCharsInBag(s, bag) {
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return (returnString);
}

﻿$(function() 
{
    //setting up the modal window attributes
	if ( $('.iFrameModalEmail').length > 0 && $('body > .ui-dialog .iFrameModalEmail').length == 0 ){
		$('.iFrameModalEmail').eq(0).dialog({
			bgiframe: true,
			autoOpen: false,
			width: 735,
			height: 500,
			modal: true,
			resizable: false,
			position: 'center',
			closeOnEscape: true,
			draggable:false
		});
	}
	$('.openModal').click(function(e) {
	    e.preventDefault();
	    var urlContent = $(this).attr('href');
		var objDialog = $('body > .ui-dialog .iFrameModalEmail');
		$('iframe', objDialog)
			.attr('src',urlContent)
			.attr('width','100%')
			.attr('height','100%')
			.attr('scrolling','no');
		try { $('.iFrameModalEmail').dialog('open'); } catch (e){}
		return false;
	});	
	
	if ($(".modalWindow").length > 0){
	    var height = $("body").height();
	    $(window.parent.document).find(".iFrameModalEmail").height(height);
	    return false;
	}
});

$(document).ready(function() { 
	//Flight search Result page table alternate color
			$('.flightSearchResult tbody tr:even').css('backgroundColor','#ACB6C5');
			$('.flightSearchResult tbody tr:even').addClass("alternateRow");
			$('.flightDetails tbody tr').css('background','none');
});
(function($){$.fn.headPhotoPager=function(){return this.each(function(){$(this).wrapInner('<div class="images"></div>');
var mainContainer=$(this);
var imageContainer=$(this).find("div.images");
var images=imageContainer.find("img");
var imageCount=images.length;
images.css("display","none");
images.eq(0).css("display","block");
if(imageCount>1){imageContainer.append('<ul class="control"></ul>');
var control=imageContainer.find("ul");
for(var i=0;
i<imageCount;
i++){var className=(i==0)?' class="photoOn"':"";
control.append("<li"+className+'><a href="javascript: void(0)">'+(i+1)+"</a></li>")
}control.find("a").click(function(ev){ev.preventDefault();
var myLi=$(this).parent();
var idx=control.find("li").index(myLi);
control.find("li").removeClass("photoOn");
myLi.addClass("photoOn");
images.css("display","none");
images.eq(idx).css("display","block");
$(".ieFixDiv",mainContainer).remove();
imageContainer.after('<div class="ieFixDiv"></div>');
return false
});
var showSlideShow=$("#hdnTxtShowSlideShow").attr("value");
if(showSlideShow=="True"){setInterval(function(){if(!control.find("li:last").hasClass("photoOn")){control.find("li.photoOn").next().find("a").trigger("click")
}else{control.find("li:first").find("a").trigger("click")
}},3000)
}}})
}
})(jQuery);
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
(function($){$.fn.jcarousel=function(o){return this.each(function(){new $jc(this,o)
})
};
var defaults={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null};
$.jcarousel=function(e,o){this.options=$.extend({},defaults,o||{});
this.locked=false;
this.container=null;
this.clip=null;
this.list=null;
this.buttonNext=null;
this.buttonPrev=null;
this.wh=!this.options.vertical?"width":"height";
this.lt=!this.options.vertical?"left":"top";
var skin="",split=e.className.split(" ");
for(var i=0;
i<split.length;
i++){if(split[i].indexOf("jcarousel-skin")!=-1){$(e).removeClass(split[i]);
var skin=split[i];
break
}}if(e.nodeName=="UL"||e.nodeName=="OL"){this.list=$(e);
this.container=this.list.parent();
if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container")){this.container=this.container.wrap("<div></div>")
}this.container=this.container.parent()
}else{if(!this.container.hasClass("jcarousel-container")){this.container=this.list.wrap("<div></div>").parent()
}}}else{this.container=$(e);
this.list=$(e).find(">ul,>ol,div>ul,div>ol")
}if(skin!=""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1){this.container.wrap('<div class=" '+skin+'"></div>')
}this.clip=this.list.parent();
if(!this.clip.length||!this.clip.hasClass("jcarousel-clip")){this.clip=this.list.wrap("<div></div>").parent()
}this.buttonPrev=$(".jcarousel-prev",this.container);
if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null){this.buttonPrev=this.clip.before(this.options.buttonPrevHTML).prev()
}this.buttonPrev.addClass(this.className("jcarousel-prev"));
this.buttonNext=$(".jcarousel-next",this.container);
if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null){this.buttonNext=this.clip.before(this.options.buttonNextHTML).prev()
}this.buttonNext.addClass(this.className("jcarousel-next"));
this.clip.addClass(this.className("jcarousel-clip"));
this.list.addClass(this.className("jcarousel-list"));
this.container.addClass(this.className("jcarousel-container"));
var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;
var li=this.list.children("li");
var self=this;
if(li.size()>0){var wh=0,i=this.options.offset;
li.each(function(){self.format(this,i++);
wh+=self.dimension(this,di)
});
this.list.css(this.wh,wh+"px");
if(!o||o.size===undefined){this.options.size=li.size()
}}this.container.css("display","block");
this.buttonNext.css("display","block");
this.buttonPrev.css("display","block");
this.funcNext=function(){self.next()
};
this.funcPrev=function(){self.prev()
};
this.funcResize=function(){self.reload()
};
if(this.options.initCallback!=null){this.options.initCallback(this,"init")
}if($.browser.safari){this.buttons(false,false);
$(window).bind("load",function(){self.setup()
})
}else{this.setup()
}};
var $jc=$.jcarousel;
$jc.fn=$jc.prototype={jcarousel:"0.2.3"};
$jc.fn.extend=$jc.extend=$.extend;
$jc.fn.extend({setup:function(){this.first=null;
this.last=null;
this.prevFirst=null;
this.prevLast=null;
this.animating=false;
this.timer=null;
this.tail=null;
this.inTail=false;
if(this.locked){return 
}this.list.css(this.lt,this.pos(this.options.offset)+"px");
var p=this.pos(this.options.start);
this.prevFirst=this.prevLast=null;
this.animate(p,false)
},reset:function(){this.list.empty();
this.list.css(this.lt,"0px");
this.list.css(this.wh,"10px");
if(this.options.initCallback!=null){this.options.initCallback(this,"reset")
}this.setup()
},reload:function(){if(this.tail!=null&&this.inTail){this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+this.tail)
}this.tail=null;
this.inTail=false;
if(this.options.reloadCallback!=null){this.options.reloadCallback(this)
}if(this.options.visible!=null){var self=this;
var di=Math.ceil(this.clipping()/this.options.visible),wh=0,lt=0;
$("li",this.list).each(function(i){wh+=self.dimension(this,di);
if(i+1<self.first){lt=wh
}});
this.list.css(this.wh,wh+"px");
this.list.css(this.lt,-lt+"px")
}this.scroll(this.first,false)
},lock:function(){this.locked=true;
this.buttons()
},unlock:function(){this.locked=false;
this.buttons()
},size:function(s){if(s!=undefined){this.options.size=s;
if(!this.locked){this.buttons()
}}return this.options.size
},has:function(i,i2){if(i2==undefined||!i2){i2=i
}if(this.options.size!==null&&i2>this.options.size){i2=this.options.size
}for(var j=i;
j<=i2;
j++){var e=this.get(j);
if(!e.length||e.hasClass("jcarousel-item-placeholder")){return false
}}return true
},get:function(i){return $(".jcarousel-item-"+i,this.list)
},add:function(i,s){var e=this.get(i),old=0,add=0;
if(e.length==0){var c,e=this.create(i),j=$jc.intval(i);
while(c=this.get(--j)){if(j<=0||c.length){j<=0?this.list.prepend(e):c.after(e);
break
}}}else{old=this.dimension(e)
}e.removeClass(this.className("jcarousel-item-placeholder"));
typeof s=="string"?e.html(s):e.empty().append(s);
var di=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;
var wh=this.dimension(e,di)-old;
if(i>0&&i<this.first){this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-wh+"px")
}this.list.css(this.wh,$jc.intval(this.list.css(this.wh))+wh+"px");
return e
},remove:function(i){var e=this.get(i);
if(!e.length||(i>=this.first&&i<=this.last)){return 
}var d=this.dimension(e);
if(i<this.first){this.list.css(this.lt,$jc.intval(this.list.css(this.lt))+d+"px")
}e.remove();
this.list.css(this.wh,$jc.intval(this.list.css(this.wh))-d+"px")
},next:function(){this.stopAuto();
if(this.tail!=null&&!this.inTail){this.scrollTail(false)
}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll)
}},prev:function(){this.stopAuto();
if(this.tail!=null&&this.inTail){this.scrollTail(true)
}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll)
}},scrollTail:function(b){if(this.locked||this.animating||!this.tail){return 
}var pos=$jc.intval(this.list.css(this.lt));
!b?pos-=this.tail:pos+=this.tail;
this.inTail=!b;
this.prevFirst=this.first;
this.prevLast=this.last;
this.animate(pos)
},scroll:function(i,a){if(this.locked||this.animating){return 
}this.animate(this.pos(i),a)
},pos:function(i){if(this.locked||this.animating){return 
}if(this.options.wrap!="circular"){i=i<1?1:(this.options.size&&i>this.options.size?this.options.size:i)
}var back=this.first>i;
var pos=$jc.intval(this.list.css(this.lt));
var f=this.options.wrap!="circular"&&this.first<=1?1:this.first;
var c=back?this.get(f):this.get(this.last);
var j=back?f:f-1;
var e=null,l=0,p=false,d=0;
while(back?--j>=i:++j<i){e=this.get(j);
p=!e.length;
if(e.length==0){e=this.create(j).addClass(this.className("jcarousel-item-placeholder"));
c[back?"before":"after"](e)
}c=e;
d=this.dimension(e);
if(p){l+=d
}if(this.first!=null&&(this.options.wrap=="circular"||(j>=1&&(this.options.size==null||j<=this.options.size)))){pos=back?pos+d:pos-d
}}var clipping=this.clipping();
var cache=[];
var visible=0,j=i,v=0;
var c=this.get(i-1);
while(++visible){e=this.get(j);
p=!e.length;
if(e.length==0){e=this.create(j).addClass(this.className("jcarousel-item-placeholder"));
c.length==0?this.list.prepend(e):c[back?"before":"after"](e)
}c=e;
var d=this.dimension(e);
if(d==0){return 0
}if(this.options.wrap!="circular"&&this.options.size!==null&&j>this.options.size){cache.push(e)
}else{if(p){l+=d
}}v+=d;
if(v>=clipping){break
}j++
}for(var x=0;
x<cache.length;
x++){cache[x].remove()
}if(l>0){this.list.css(this.wh,this.dimension(this.list)+l+"px");
if(back){pos-=l;
this.list.css(this.lt,$jc.intval(this.list.css(this.lt))-l+"px")
}}var last=i+visible-1;
if(this.options.wrap!="circular"&&this.options.size&&last>this.options.size){last=this.options.size
}if(j>last){visible=0,j=last,v=0;
while(++visible){var e=this.get(j--);
if(!e.length){break
}v+=this.dimension(e);
if(v>=clipping){break
}}}var first=last-visible+1;
if(this.options.wrap!="circular"&&first<1){first=1
}if(this.inTail&&back){pos+=this.tail;
this.inTail=false
}this.tail=null;
if(this.options.wrap!="circular"&&last==this.options.size&&(last-visible+1)>=1){var m=$jc.margin(this.get(last),!this.options.vertical?"marginRight":"marginBottom");
if((v-m)>clipping){this.tail=v-clipping-m
}}while(i-->first){pos+=this.dimension(this.get(i))
}this.prevFirst=this.first;
this.prevLast=this.last;
this.first=first;
this.last=last;
return pos
},animate:function(p,a){if(this.locked||this.animating){return 
}this.animating=true;
var self=this;
var scrolled=function(){self.animating=false;
if(p==0){self.list.css(self.lt,0)
}if(self.options.wrap=="both"||self.options.wrap=="last"||self.options.size==null||self.last<self.options.size){self.startAuto()
}self.buttons();
self.notify("onAfterAnimation")
};
this.notify("onBeforeAnimation");
if(!this.options.animation||a==false){this.list.css(this.lt,p+"px");
scrolled()
}else{var o=!this.options.vertical?{left:p}:{top:p};
this.list.animate(o,this.options.animation,this.options.easing,scrolled)
}},startAuto:function(s){if(s!=undefined){this.options.auto=s
}if(this.options.auto==0){return this.stopAuto()
}if(this.timer!=null){return 
}var self=this;
this.timer=setTimeout(function(){self.next()
},this.options.auto*1000)
},stopAuto:function(){if(this.timer==null){return 
}clearTimeout(this.timer);
this.timer=null
},buttons:function(n,p){if(n==undefined||n==null){var n=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="first")||this.options.size==null||this.last<this.options.size);
if(!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!=null&&this.last>=this.options.size){n=this.tail!=null&&!this.inTail
}}if(p==undefined||p==null){var p=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="last")||this.first>1);
if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!=null&&this.first==1){p=this.tail!=null&&this.inTail
}}var self=this;
this.buttonNext[n?"bind":"unbind"](this.options.buttonNextEvent,this.funcNext)[n?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",n?false:true);
this.buttonPrev[p?"bind":"unbind"](this.options.buttonPrevEvent,this.funcPrev)[p?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",p?false:true);
if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=n)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){self.options.buttonNextCallback(self,this,n)
});
this.buttonNext[0].jcarouselstate=n
}if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=p)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){self.options.buttonPrevCallback(self,this,p)
});
this.buttonPrev[0].jcarouselstate=p
}},notify:function(evt){var state=this.prevFirst==null?"init":(this.prevFirst<this.first?"next":"prev");
this.callback("itemLoadCallback",evt,state);
if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",evt,state,this.first);
this.callback("itemFirstOutCallback",evt,state,this.prevFirst)
}if(this.prevLast!==this.last){this.callback("itemLastInCallback",evt,state,this.last);
this.callback("itemLastOutCallback",evt,state,this.prevLast)
}this.callback("itemVisibleInCallback",evt,state,this.first,this.last,this.prevFirst,this.prevLast);
this.callback("itemVisibleOutCallback",evt,state,this.prevFirst,this.prevLast,this.first,this.last)
},callback:function(cb,evt,state,i1,i2,i3,i4){if(this.options[cb]==undefined||(typeof this.options[cb]!="object"&&evt!="onAfterAnimation")){return 
}var callback=typeof this.options[cb]=="object"?this.options[cb][evt]:this.options[cb];
if(!$.isFunction(callback)){return 
}var self=this;
if(i1===undefined){callback(self,state,evt)
}else{if(i2===undefined){this.get(i1).each(function(){callback(self,this,i1,state,evt)
})
}else{for(var i=i1;
i<=i2;
i++){if(i!==null&&!(i>=i3&&i<=i4)){this.get(i).each(function(){callback(self,this,i,state,evt)
})
}}}}},create:function(i){return this.format("<li></li>",i)
},format:function(e,i){var $e=$(e).addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+i));
$e.attr("jcarouselindex",i);
return $e
},className:function(c){return c+" "+c+(!this.options.vertical?"-horizontal":"-vertical")
},dimension:function(e,d){var el=e.jquery!=undefined?e[0]:e;
var old=!this.options.vertical?el.offsetWidth+$jc.margin(el,"marginLeft")+$jc.margin(el,"marginRight"):el.offsetHeight+$jc.margin(el,"marginTop")+$jc.margin(el,"marginBottom");
if(d==undefined||old==d){return old
}var w=!this.options.vertical?d-$jc.margin(el,"marginLeft")-$jc.margin(el,"marginRight"):d-$jc.margin(el,"marginTop")-$jc.margin(el,"marginBottom");
$(el).css(this.wh,w+"px");
return this.dimension(el)
},clipping:function(){return !this.options.vertical?this.clip[0].offsetWidth-$jc.intval(this.clip.css("borderLeftWidth"))-$jc.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-$jc.intval(this.clip.css("borderTopWidth"))-$jc.intval(this.clip.css("borderBottomWidth"))
},index:function(i,s){if(s==undefined){s=this.options.size
}return Math.round((((i-1)/s)-Math.floor((i-1)/s))*s)+1
}});
$jc.extend({defaults:function(d){return $.extend(defaults,d||{})
},margin:function(e,p){if(!e){return 0
}var el=e.jquery!=undefined?e[0]:e;
if(p=="marginRight"&&$.browser.safari){var old={display:"block","float":"none",width:"auto"},oWidth,oWidth2;
$.swap(el,old,function(){oWidth=el.offsetWidth
});
old.marginRight=0;
$.swap(el,old,function(){oWidth2=el.offsetWidth
});
return oWidth2-oWidth
}return $jc.intval($.css(el,p))
},intval:function(v){v=parseInt(v);
return isNaN(v)?0:v
}})
})(jQuery);
