//DropdownList.js
$(document).ready(function () {
    $('#wedding-navigation li').hover(function () {
        $(this).addClass('over');
    }, function () {
        $(this).removeClass('over');
    });
});//googlecse.js
$(function() {  
var q = $("#q");
var qSubmit = $("#qSubmit");
q.keypress(function (e) {  
	if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
            qSubmit.trigger("click");
		return false;  
	} else {
		return true;  
	}
});
    var qBlur = function () {
	if (q.val() == '') {
		q.addClass("search-watermark");
        }
};
    q.bind("focus", function () {
	q.removeClass("search-watermark");
});
    q.bind("blur", qBlur);
    qSubmit.bind("click", function (e) {
        location.href = "/search/index.aspx?q=" + q.val();
    });
    qBlur();
});/*
 * jQuery UI 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/*
 * jQuery UI Tabs 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	ui.core.js
 */
(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header");this.lis.addClass("ui-state-default");this.panels.addClass("ui-tabs-panel ui-widget-content");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);;//Common.Map.Settings
var maxZoom = 13;

function DefaultHitchedMapIcon() {
    var icon = new google.maps.MarkerImage('http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png',
	    new google.maps.Size(32, 32),
	    new google.maps.Point(0, 0),
	    new google.maps.Point(16, 30));
    return icon;
}

function EliteHitchedMapIcon() {
    var icon = new google.maps.MarkerImage('http://maps.google.com/mapfiles/ms/micons/purple-dot.png',
	    new google.maps.Size(32, 32),
	    new google.maps.Point(0, 0),
	    new google.maps.Point(16, 30));
    return icon;
}

function DefaultHitchedMapIconShadow() {
    var shadowIcon = new google.maps.MarkerImage('http://maps.gstatic.com/intl/en_ALL/mapfiles/shadow50.png',
	    new google.maps.Size(59, 32),
	    new google.maps.Point(0, 0),
	    new google.maps.Point(12, 30));
    return shadowIcon;
}

function SmallHitchedMapIcon() {
    var icon = new google.maps.MarkerImage('/images/small-map-dot.png',
	    new google.maps.Size(10, 10),
	    new google.maps.Point(0, 0),
	    new google.maps.Point(4, 5));
    return icon;
}

function DefaultDetailMapSize() {
    return new GSize(400, 400);
}
function FitGoogleMap(){
	//Sets the google map to fit all the points on the screen, but have a max zoom of 16.
	var bounds = new google.maps.LatLngBounds();
	if (points != undefined) {
		for (var i = 0; i < points.length; i++) {
			bounds.extend(points[i]);
		}
		if (points.length > 1) {
			googleMap.fitBounds(bounds);
		} else {
			googleMap.setCenter(bounds.getCenter());
			googleMap.setZoom(maxZoom);
		}
	}
	if (googleMap.getZoom() > maxZoom) {
		googleMap.setZoom(maxZoom);
	}
}

/*
* jQuery Expander plugin
* Version 0.5.1  (February 23, 2010)
* @requires jQuery v1.1.1+
* @author Karl Swedberg
* @author Adam Hall
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/


(function ($) {

    $.fn.expander = function (options) {

        var opts = $.extend({}, $.fn.expander.defaults, options),
            rSlash = /\//,
            delayedCollapse;

        this.each(function () {
            var thisEl = this,
                $this = $(this);
            var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
            var cleanedTag, startTags, endTags;
            var allText = $this.html();
            var startText = allText.slice(0, o.slicePoint).replace(/(&([^;]+;)?|\w+)$/, '');

            startTags = startText.match(/<\w[^>]*>/g);

            if (startTags) {
                startText = allText.slice(0, o.slicePoint + startTags.join('').length).replace(/(&([^;]+;)?|\w+)$/, '');
            }

            if (startText.lastIndexOf('<') > startText.lastIndexOf('>')) {
                startText = startText.slice(0, startText.lastIndexOf('<'));
            }

            var defined = {};
            $.each(['onSlice', 'beforeExpand', 'afterExpand', 'onCollapse'], function (index, val) {
                defined[val] = $.isFunction(o[val]);
            });

            var endText = allText.slice(startText.length);
            // create necessary expand/collapse elements if they don't already exist
            if (!$('span.details', this).length) {
                // end script if text length isn't long enough.
                if (endText.replace(/\s+$/, '').split(' ').length < o.widow) {
                    return;
                }
                // otherwise, continue...
                if (defined.onSlice) {
                    o.onSlice.call(thisEl);
                }
                if (endText.indexOf('</') > -1) {
                    endTags = endText.match(/<(\/)?[^>]*>/g);
                    for (var i = 0; i < endTags.length; i++) {

                        if (endTags[i].indexOf('</') > -1) {
                            var startTag, startTagExists = false;
                            for (var j = 0; j < i; j++) {
                                startTag = endTags[j].slice(0, endTags[j].indexOf(' ')).replace(/\w$/, '$1>');
                                if (startTag == endTags[i].replace(rSlash, '')) {
                                    startTagExists = true;
                                }
                            }
                            if (!startTagExists) {
                                startText = startText + endTags[i];
                                var matched = false;
                                for (var s = startTags.length - 1; s >= 0; s--) {
                                    if (startTags[s].slice(0, startTags[s].indexOf(' ')).replace(/(\w)$/, '$1>') == endTags[i].replace(rSlash, '') && matched == false) {
                                        cleanedTag = cleanedTag ? startTags[s] + cleanedTag : startTags[s];
                                        matched = true;
                                    }
                                };
                            }
                        }
                    }

                    endText = cleanedTag && cleanedTag + endText || endText;
                }
                $this.data("originalHTML", allText);
                $this.data("compressedHTML", [
                    startText,
                    '<span class="read-more">',
                      o.expandPrefix,
                      '<a href="#">',
                        o.expandText,
                      '</a>',
                    '</span>',
                    '<div class="details">',
                      endText,
                    '</div>'
                    ].join(''));
                $this.html($this.data("compressedHTML"));
                $this.bind("ReBindClicks", function () {
                    var $thisDetails = $('.details', this),
                        $readMore = $('span.read-more', this);

                    $thisDetails.hide();
                    $readMore.find('a').click(function () {
                        $readMore.hide();
                        if (o.expandEffect === 'show' && !o.expandSpeed) {
                            if (defined.beforeExpand) {
                                o.beforeExpand.call(thisEl);
                            }
                            $thisDetails.show();
                            if (defined.afterExpand) {
                                o.afterExpand.call(thisEl);
                            }
                            delayCollapse(o, $thisDetails, thisEl);
                            completedExpand();
                        } else {
                            if (defined.beforeExpand) {
                                o.beforeExpand.call(thisEl);
                            }
                            $thisDetails[o.expandEffect](o.expandSpeed, function () {
                                $thisDetails.css({
                                    zoom: ''
                                });
                                if (defined.beforeExpand) {
                                    o.afterExpand.call(thisEl);
                                }
                                delayCollapse(o, $thisDetails, thisEl);
                                if (o.userCollapse) {
                                    $this.html($this.data("originalHTML"));
                                    $this.append('<span class="re-collapse">' + o.userCollapsePrefix + '<a href="#">' + o.userCollapseText + '</a></span>');


                                    $this.find('span.re-collapse a').click(function () {

                                        clearTimeout(delayedCollapse);
                                        $para = $(this).parent().parent();
                                        $para.html($para.data("compressedHTML"));
                                        $para.trigger("ReBindClicks");
                                        //reCollapse($para);
                                        if (defined.onCollapse) {
                                            o.onCollapse.call(thisEl, true);
                                        }
                                        return false;
                                    });
                                }
                            });
                        }

                        return false;
                    });


                });
                $this.trigger("ReBindClicks");
            };

        });

        function delayCollapse(option, $collapseEl, thisEl) {
            if (option.collapseTimer) {
                delayedCollapse = setTimeout(function () {
                    reCollapse($collapseEl);
                    if ($.isFunction(option.onCollapse)) {
                        option.onCollapse.call(thisEl, false);
                    }
                }, option.collapseTimer);
            }
        }

        return this;
    };
    // plugin defaults
    $.fn.expander.defaults = {
        slicePoint: 100,
        // the number of characters at which the contents will be sliced into two parts.
        // Note: any tag names in the HTML that appear inside the sliced element before
        // the slicePoint will be counted along with the text characters.
        widow: 4,
        // a threshold of sorts for whether to initially hide/collapse part of the element's contents.
        // If after slicing the contents in two there are fewer words in the second part than
        // the value set by widow, we won't bother hiding/collapsing anything.
        expandText: '( read more... )',
        // text displayed in a link instead of the hidden part of the element.
        // clicking this will expand/show the hidden/collapsed text
        expandPrefix: '',
        collapseTimer: 0,
        // number of milliseconds after text has been expanded at which to collapse the text again
        expandEffect: 'slideDown',
        expandSpeed: '300',
        // speed in milliseconds of the animation effect for expanding the text
        userCollapse: true,
        // allow the user to re-collapse the expanded text.
        userCollapseText: '( ...less )',
        // text to use for the link to re-collapse the text
        userCollapsePrefix: ' ',

        /* CALLBACK FUNCTIONS
        ** all functions have the this keyword mapped to the element that called .expander()
        */
        onSlice: null,
        // function() {}
        beforeExpand: null,
        // function() {},
        afterExpand: null,
        // function() {},
        onCollapse: null // function(byUser) {}
    };
})(jQuery);(function ($) {
    $.fn.hitchedCarouselLite = function (options) {
var settings = $.extend({
            circular: false,
            pageNo: 0,
            item: "li",
            button: {
                next: ".nextBtn",
                prev: ".prevBtn"
            }
        }, options);
function showPage() {
			settings = $(this).data("dc-conf");
             $(this).find(settings.item).slideUp();
             $($(this).find(settings.item)[settings.pageNo]).slideDown();


        }
    function clickNext() {
            $this = $($(this).data("area"));
            $this.data("dc-conf").pageNo++;
            if ($this.data("dc-conf").pageNo == $this.find(settings.item).length) {
            	$($this.find(settings.item)[$this.find(settings.item).length-1]).after($($this.find(settings.item)[0]));
				$this.data("dc-conf").pageNo--;
            }
            $this.trigger("showPage");
        }
    function clickBack() {
            $this = $($(this).data("area"));
            $this.data("dc-conf").pageNo--;
            if ($this.data("dc-conf").pageNo == -1) {
                $($this.find(settings.item)[0]).before($($this.find(settings.item)[$this.find(settings.item).length-1]));
				$this.data("dc-conf").pageNo++;
            }
            $this.trigger("showPage");
        }
 this.each(function () {

            var $this = $(this);
            $this.data("dc-conf", settings);
            $this.bind("showPage", showPage);
            if ($this.find(settings.item).length <= 1) {
                $(settings.button.next + "," + settings.button.prev).hide();
            }
            $(this).find(settings.item).hide();
            $(settings.button.next).bind("click", clickNext).data("area", $this);
            $(settings.button.prev).bind("click", clickBack).data("area", $this);
            $this.trigger("showPage");
        });
}
})(jQuery);/* =========================================================

// jquery.innerfade.js

// Datum: 2008-02-14
// Firma: Medienfreunde Hofmann & Baldes GbR
// Author: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/
// and Ralf S. Engelschall http://trainofthoughts.org/

 *
 *  <ul id="news"> 
 *      <li>content 1</li>
 *      <li>content 2</li>
 *      <li>content 3</li>
 *  </ul>
 *  
 *  $('#news').innerfade({ 
 *	  animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
 *	  speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
 *	  timeout: Time between the fades in milliseconds (Default: '2000'), 
 *	  type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
 * 		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
 *	  runningclass: CSS-Class which the container getâ€™s applied (Default: 'innerfade'),
 *	  children: optional children selector (Default: null)
 *  }); 
 *

// ========================================================= */


(function($) {

    $.fn.innerfade = function(options) {
        return this.each(function() {   
            $.innerfade(this, options);
        });
    };

    $.innerfade = function(container, options) {
        var settings = {
        		'animationtype':    'fade',
            'speed':            'normal',
            'type':             'sequence',
            'timeout':          2000,
            'containerheight':  'auto',
            'runningclass':     'innerfade',
            'children':         null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null || settings.children === undefined)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.innerfade.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
            		var last = Math.floor ( Math.random () * ( elements.length ) );
                setTimeout(function() {
                    do { 
												current = Math.floor ( Math.random ( ) * ( elements.length ) );
										} while (last == current );             
										$.innerfade.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
						} else if ( settings.type == 'random_start' ) {
								settings.type = 'sequence';
								var current = Math.floor ( Math.random () * ( elements.length ) );
								setTimeout(function(){
									$.innerfade.next(elements, settings, (current + 1) %  elements.length, current);
								}, settings.timeout);
								$(elements[current]).show();
						}	else {
							alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
						}
				}
    };

    $.innerfade.next = function(elements, settings, current, last) {
        if (settings.animationtype == 'slide') {
            $(elements[last]).slideUp(settings.speed);
            $(elements[current]).slideDown(settings.speed);
        } else if (settings.animationtype == 'fade') {
            $(elements[last]).fadeOut(settings.speed);
            $(elements[current]).fadeIn(settings.speed, function() {
							removeFilter($(this)[0]);
						});
        } else
            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
        if (settings.type == "sequence") {
            if ((current + 1) < elements.length) {
                current = current + 1;
                last = current - 1;
            } else {
                current = 0;
                last = elements.length - 1;
            }
        } else if (settings.type == "random") {
            last = current;
            while (current == last)
                current = Math.floor(Math.random() * elements.length);
        } else
            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
	if(element.style.removeAttribute){
		element.style.removeAttribute('filter');
	}
}
// JScript File
var websiteName;
$(document).ready(function () {
    websiteName = $("#hddnWebsiteName").val();
});
var ukCenterLat = "54.0710320549604";
var ukCenterLong = "-2.78397635451732";
var points=[];
var index=-1;
var googleMap;
var WeddingEventgoogleMap;
var divData;
var circle;
var SearchRange;

function CreateRatingImage(imageName)
{
	var ratingImage = [];
	ratingImage[0] = '<img src="';
	ratingImage[1] = websiteName;
	ratingImage[2] = '/images/';
	ratingImage[3] = imageName;
	ratingImage[4] = '" ></img>';
	return ratingImage.join('');
}

function CreateRatingDiv(text , ratingCount)
{

	var ratingArray = [];   
	ratingArray[0] = '<span>';
	ratingArray[1] = text;
	ratingArray[2] = " : ";
	var i = 1;
	if(ratingCount > 0)
	{
			for(i=1;i<=Math.floor(ratingCount);i++)
			{
			ratingArray[2+i] =CreateRatingImage("heart_shape.png");
		}
		temp = ratingCount - Math.floor(ratingCount);

		if(temp == 0.5){
			ratingArray[2+i] = CreateRatingImage("half_heart.png");
		} else if(temp > 0.5 ){
			ratingArray[2+i] = CreateRatingImage("half_heart.png");
		} else if(temp < 0.5 &&  ratingCount != 5 ){ 
			ratingArray[2+i] = CreateRatingImage("blank_heart.png");
		}
	} else {
		for(i=1;i<=5;i++)
		{
			ratingArray[2+i] = CreateRatingImage("blank_heart.png");
		}
	} 
	ratingArray[2+i] = "</span>";
	return ratingArray.join('');
}

function CreateMarkerHtmlForFeaturedListing(name,previewimage,address,phoneNumber,venueRating,detailLink,requestLink,description,totalReview,reviewLink,eliteStatus  )
{
	var tab = $('#'+ IDMainContent() + 'hiddenDisplayTab').val();

	var textToInsert = [];   
	textToInsert[0] = '<span class="mainHeading">';
	textToInsert[1] = name;
	textToInsert[2] = '</span><div><div class="popup_left"> <a href="';
	textToInsert[3] = detailLink;
	textToInsert[4] = '"><img src="';
	textToInsert[5] = previewimage;
	if(tab == "Venue" || tab == "LateAvailability") {
		textToInsert[6] = '"/></a> </div><div class="popup_right"><div class="popup_left">';   
	}else{
		textToInsert[6] = '"/></a> </div><div class="popup_right"><div class="popup_left hide">';
	}
	textToInsert[7] = CreateRatingDiv("Venue Rating", venueRating);
	if(tab == "Venue" || tab == "LateAvailability")
	{
		textToInsert[8] = '</div><div class="popup_right">from <a href="';
	}else{
		textToInsert[8] = '</div><div class="popup_right hide">from <a href="';
	}
	textToInsert[9] = reviewLink;
	textToInsert[10] = '">';
	textToInsert[11] = totalReview;
	textToInsert[12] = ' reviews</a> </div><div class="clear"/><div>'  ;
	textToInsert[13] = description;
	textToInsert[14] = '</div>';
	if (eliteStatus != "1") {
	    textToInsert[15] = '<div class="popup_left"><a href="';
	    textToInsert[16] = requestLink;
	    textToInsert[17] = '"><img src="';
	    textToInsert[18] = websiteName;
	    if(tab == "Venue" || tab == "LateAvailability")
	    {
		    textToInsert[19] = '/images/contact_venue.jpg"/></a></div>';
	    }
	    else
	    {
	        textToInsert[19] = '/images/contact_accommodation.jpg"/></a></div>';
	    }
	
	} else {
	    textToInsert[15] = '';
	    textToInsert[16] = '';
	    textToInsert[17] = '';
	    textToInsert[18] = '';
	    textToInsert[19] = '';
	}
	textToInsert[20] = '<div class="popup_right"><a href="'
    textToInsert[21] = detailLink;
    textToInsert[22] = '">';
	textToInsert[23] = '<img src="';
	textToInsert[24] = websiteName;
	textToInsert[25] = '/images/i_icon.png"/></a><a href="';
	textToInsert[26] = detailLink;
	textToInsert[27] = '"> More Details</a></div><div class="clear"/></div><div class="clear"/></div>';

	this.$OuterDiv =  $('<div></div>').addClass("popup-featured").append(textToInsert.join(''));
	return this.$OuterDiv.html() ;
}
function SetGoogleMap(){
	var myLatlng = new google.maps.LatLng(ukCenterLat, ukCenterLong);
	var myOptions =
		{
			zoom: 8,
			center: myLatlng,
			bouncy: false,
			mapTypeControl: true,
			mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR },
			navigationControl: true,
			navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN },
			mapTypeId: google.maps.MapTypeId.ROADMAP
		};
	googleMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	DrawSpericalMap();
}
function SetWeddingEventGoogleMap(id){

	var myLatlng = new google.maps.LatLng(ukCenterLat, ukCenterLong);
	var myOptions =
		{
			zoom: 8,
			center: myLatlng,
			bouncy: false,
			mapTypeControl: true,
			mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR },
			navigationControl: true,
			navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN },
			mapTypeId: google.maps.MapTypeId.ROADMAP
		};
	WeddingEventgoogleMap = new google.maps.Map(document.getElementById(id), myOptions);
	DrawSpericalMap();
}
 

function DrawSpericalMap(){
	var myLatlng = new google.maps.LatLng(GetValueFromHiddenField("hidSearchLat"), GetValueFromHiddenField("hidSearchLong"));
	SearchRange = GetValueFromHiddenField("hidRange")

	if (SearchRange !== null  && SearchRange !== "" && SearchRange !== "0") {
	    var radius = (parseInt(GetValueFromHiddenField("hidRange"), 10) + 0.49) * 1609.344; // The radius in meters on the Earth's surface
		circle = new google.maps.Circle({
			map: googleMap,
			center: myLatlng,
			fillOpacity: 0.2,
			fillColor: "#C5C5B0",
			strokeWeight: 1,
			strokeColor: "#737373",
			radius: radius
		});
	}
}
function CreateMarkers(pt, ic, divData) {
	var myLatlng = new google.maps.LatLng(ukCenterLat, ukCenterLong);
	var myOptions = {
		zoom: 4,
		center: myLatlng,
		bouncy: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	var marker = new google.maps.Marker({
		position: pt,
		googleMap: googleMap,
		icon: ic
	});

	google.maps.event.addListener(marker, "mouseup", function() {
		marker.closeInfoWindow();
		marker.openInfoWindowHtml(divData);
	});
	return marker;
}
    

function SetGoogleMarker(latitude, longitude, html, eliteStatus) {
	if (latitude !== null && longitude !== null && latitude !== "" && longitude !== "" && latitude !== "0" && longitude !== "0") {
		var myLatlng = new google.maps.LatLng(latitude, longitude);
		index = index + 1;
		if (points != undefined)
			points[index] = myLatlng;

		var shadow;
		var i;
    
		switch (eliteStatus) 
		{
			case "3":
				i = EliteHitchedMapIcon()
				shadow = DefaultHitchedMapIconShadow();
				break;
			case "1":
				i = SmallHitchedMapIcon();
				break;
			default:
				i = DefaultHitchedMapIcon();
				shadow = DefaultHitchedMapIconShadow();
				break;
		
		}          

		var marker = new google.maps.Marker({
		position: myLatlng,
		bouncy: false,
		icon: i,
		shadow: shadow,
		map: googleMap
		});


		var contentString = html;
		infowindow = new google.maps.InfoWindow({ content: contentString });
		google.maps.event.addListener(marker, 'mouseup', function() {
			infowindow.close();
			infowindow.setContent(contentString);
			infowindow.open(googleMap, marker);
		});

		
}
}

function AddGoogleMarker(latitude, longitude, name, image, address, phoneNumber, serviceRating, venueRating, detailLink, requestLink, description, totalReview, reviewLink, eliteStatus) 
{
    divData = CreateMarkerHtmlForFeaturedListing(name, image, address, phoneNumber, venueRating, detailLink, requestLink, description, totalReview, reviewLink, eliteStatus);
	SetGoogleMarker(latitude, longitude, divData, eliteStatus);
}

function DrawGoogeMapData(retValue , type){
	index = -1;
	points = [];
	SetGoogleMap();
	for (var i = 0; i < retValue.length; i++) 
	
	{
	
		AddGoogleMarker(retValue[i].VenueLatitude,retValue[i].VenueLongitude,retValue[i].VenueName,retValue[i].VenueImgPath,retValue[i].VenueAddress1,retValue[i].VenuePhoneNumber,retValue[i].ServiceRating,retValue[i].VenueRating,retValue[i].DetailPageLink,retValue[i].RequestPageLink,retValue[i].VenueDescription,retValue[i].VenueRatingCount,retValue[i].ReviewPageLink , retValue[i].EliteStatus);
	}
	FitGoogleMap();
}

function CreateMap(lati, longi){
	var icon = DefaultHitchedMapIcon();
	var shadowImage = DefaultHitchedMapIconShadow();
	var myLatlng = new google.maps.LatLng(lati, longi);
	var myOptions =
	{
		zoom: 4,
		center: myLatlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};

	googleMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	
	//var myLatlng = new google.maps.LatLng(lati, longi);
	index = index + 1;
	if (points != undefined && points.length != 1) {
		points[index] = myLatlng;
	}
	var marker = new google.maps.Marker({
		position: myLatlng,
		bouncy: false,
		map: googleMap,
		icon: icon,
		shadow: shadowImage
	});
	
	FitGoogleMap();
}
function CreateGoogleMapForVenueDetail()
{

	var lati = $("#" + IDMainContent() + "hddnLatitude").val();
	
	
	var longi = $("#" + IDMainContent() + "ctl00_hddnLongitude").val();
		
	CreateMap(lati,longi); 
	

}
function CreateGoogleMapForVenueEventDetail(id,longi,lati)
{	
      
	var icon = DefaultHitchedMapIcon();
	var shadowImage = DefaultHitchedMapIconShadow();
	var myLatlng = new google.maps.LatLng(lati,longi);
	
	var myOptions =
	{
		zoom: 4,
		center: myLatlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	WeddingEventgoogleMap = new google.maps.Map(document.getElementById(id), myOptions);
	
	//var myLatlng = new google.maps.LatLng(lati, longi);
	index = index + 1;
	
	if (points != undefined && points.length != 1)
		points[index] = myLatlng;
		
	var marker = new google.maps.Marker({
		position: myLatlng,
		bouncy: false,
		
		map: WeddingEventgoogleMap,
		icon: icon,
		shadow: shadowImage
	});
	
	var bounds = new google.maps.LatLngBounds();
	
	if (points != undefined) {
	
		for (var i = 0; i < points.length; i++) {
		    
			bounds.extend(myLatlng);
						
		}		
		if (points.length > 1) {
			WeddingEventgoogleMap.fitBounds(bounds);
		} else {
		
			WeddingEventgoogleMap.setCenter(bounds.getCenter());
			WeddingEventgoogleMap.setZoom(maxZoom);
		}
	}
	if (WeddingEventgoogleMap.getZoom() > maxZoom) {
		WeddingEventgoogleMap.setZoom(maxZoom);
	}
	
}

function FillVenueGMap()
{
	var $gmap = $('#pop-win');
	$gmap.show();
	CreateGoogleMapForVenueDetail();
}
function HideMap()
{
	var gmap = $('#pop-win');
	gmap.hide();
}
// JScript File
//Starting of  VenuesDetails.js

var mosx;
var mosy;
var prevMonthId=0;
 
var asmxCommon = "/API/Venues/JSWSCommon.asmx/";
var $HitchedAjaxOptions = {
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "text",
dataFilter: function (data, type) {
    return $.parseJSON(data);
      },
      error: function(result) {
          if (this.console && typeof console.log != "undefined")
              console.log("Error in server:" + result.status + ' ' + result.statusText);
      }};

 

function GenerateLADescriptionPopup(desc)
{
    //var websiteName= $("#hddnWebsiteName").val();
    var textToDispaly = [];   
    textToDispaly[0]="<li class='ulLADesc'>";
    textToDispaly[1]="<div class='la-descriptionTitle'>Description</div>";
    textToDispaly[2]="</li>";
    textToDispaly[3]="<li class='ulLADesc'>";
    textToDispaly[4]="<span>";
    textToDispaly[5]=desc;
    textToDispaly[6]="</span>";
    textToDispaly[7]="</li>";
    this.$OuterDiv =  $('<ul></ul>').append(textToDispaly.join(''));
    return this.$OuterDiv.html()  ;
}
function CallBackFillLateAvailability(result)
{    
    $('#late').html(GenerateLADescriptionPopup(result.d));    
}

function Show(monthID)
{
   var q = $HitchedAjaxOptions; 
   q.url = asmxCommon + "FillLateAvailability";                 
   q.data = "{monthId:" + monthID + "}";                        
   q.success = CallBackFillLateAvailability;  
   $.ajax(q);          
}


 $(document).ready(function() { 
     var isPreview;
     if ($('.divAdvertDetails').attr('id')) {
         var clientID = '#' + $('.divAdvertDetails').attr('id').replace('divAdvertDetails', '');
          isPreview = $( clientID + 'hddnIsPreview').val();
     }
     if (isPreview === '1') {
         $('.divAdvertDetails').css("top", "0px");
         $('.divAdvertDetails').show();
         $(window).scroll(function() {
             var docHeight = $(document.body).height();
             var divHeight = $('.divAdvertDetails').height();
             if ($(window).scrollTop() + divHeight < docHeight){             
                 $('.divAdvertDetails').animate({ top: $(window).scrollTop() + "px" }, { queue: false, duration: 350 });
                 }
         });
     }
     else { $('.divAdvertDetails').hide(); }

     $("*[id$='divLateAvailability']").find('a').mouseover(function(e) {
         var lateId = this.id;
         lateId = lateId.split('_');
         $(this).css("color", "#93148c");
         $('#href_' + prevMonthId).css("color", "#380063");
         prevMonthId = lateId[1];
         Show(lateId[1]);
         $('#late').show();
     });

     $("*[id$='divLateAvailability']").find('a').click(function(e) {
         return false;
     });
     SetupTooltips();
 });



function showlocationlist()
{
    var objLocationList;
    objLocationList=$("*[id$='hddLocationList']").val();
    if(objLocationList){ 
        if (objLocationList=="False"){
            $("#divLocationlist").css({"display":"none","width":"0px"});
            $("#map_canvas").css("width","800px");
        }else{
            $("#divLocationlist").css({"display":"block","width":"200px"});
            $("#map_canvas").css("width","600px");
        } 
    } 
}

ShowTooltip = function(e){
	var text = $(this).next('.show-tooltip-text');
	if (text.attr('class') != 'show-tooltip-text'){
		return false;
		}
	text.fadeIn().css('top', e.pageY + "px").css('left', (e.pageX+10) + "px");
	return false;
};
HideTooltip = function(e)
{
	var text = $(this).next('.show-tooltip-text');
	if (text.attr('class') !== 'show-tooltip-text'){
		return false;    }
	text.fadeOut();
	return false;
};

SetupTooltips = function()
{
	$('.show-tooltip').each(function(){
			$(this).after($('<span/>').attr('class', 'show-tooltip-text').html($(this).attr('title'))).attr('title', '');}).hover(ShowTooltip, HideTooltip);
};

//End of  VenuesDetails.js/* Extra links */
var divHeight;
var oldHeight;


var asmxPosition = "/API/Venues/JSWSVenuesSearch.asmx/";
var $HitchedAjaxOptions = {
    type: "POST",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function (result, status) {
        if (status !== "abort")
            if (this.console && typeof console.log != "undefined")
                console.log("Error in server:" + result.status + ' ' + result.statusText);
    }
};


function toggleUMapLocationList(Id){
	if($('#slideeffect_' + Id).is(":hidden")){$('#slideeffect_' + Id).slideDown('slow');  
	}else{$('#slideeffect_' + Id).slideUp('slow');}}


	$(document).ready(function () {
	    $("div .umap_headingbg").click(function () {
	        var listId = this.id;
	        toggleUMapLocationList(listId);
	        var websiteName = $("#hddnWebsiteName").val();
	        if ($('#slideeffect_' + Id).is(":hidden")) {
	            $(this).css({ backgroundImage: "url(" + websiteName + "/Images/bullet-up.gif)" });
	        }
	        else {
	            $(this).css({ backgroundImage: "url(" + websiteName + "/Images/bullet-down.gif)" });
	        }
	    });

	    //Resize on show/hide
	    $('span.more-text-holder:eq(0)> a').click(function () {
	        //var newHeight =$("#" + IDMainContent() + "ctl00_lblDescription").height(); 
	        return false;
	    });

	    SaveAndUpdatePostionIndex();
	    OpenVenueDetailPageSpecificTab();
	    AddHashToExistingLinks();
	});


  
function ViewGoogleMap(tabId)
	{var $tabs = $('#tabs').tabs();$tabs.tabs('select', "maps");}
  
    function DisplayGoogleMap(tabId )
    {   
    		var $tabs = $('#tabs').tabs();
        var selected = $tabs.tabs('option', 'selected');         
        if(selected == tabId ){
					CreateGoogleMapForVenueDetail();
				}
    }  
                   
    function AdjustTabHeight()
    {
        var accommodationHeight = $(' .accommodation-listing').height();
        var topHeight=$('#divTop').height();
        if(topHeight < 280){topHeight = 280;}
        var newHeight = $('#tabs').height();
        $('#rightHandNavDiv').css({height:"auto"});
        ReAssignHieght('rightHandNavDiv',topHeight,newHeight + 120 + accommodationHeight );
        AdjustHeight();
        divHeight = $('#rightHandNavDiv').height();oldHeight = $("#" + IDMainContent() + "ctl00_lblDescription").height();
     }
   
function ViewReviewTab(){
	$('#tabs').tabs({
		selected : 1,fxFade: true,fxSpeed: 'fast',show: function(event, ui) {               
		AdjustTabHeight();DisplayGoogleMap(0);isChangeHeight =true;}
	});	      
}

function GetSelectedSubTab(){
    var monthName=$("#" + IDMainContent() + "hddnLateAvailabilityMonth").val();	
    var getTabIndex=1;
    $('#tabs-2 ul').find('li').each(function(i){
        if(this.id == 'li_' + monthName){
            getTabIndex=i;    
            }
    });
    $("#tabs-2").tabs('select',getTabIndex-1);

}
    
function ToggleAttributes(collectionId){
    if (
        $('#slideeffectVenues' + collectionId).is(":hidden")) {
            $('#slideeffectVenues' + collectionId).slideDown("slow");
            $('#slideOutVenue' + collectionId).show();
            $('#slideInVenue' + collectionId).hide();
            $('#slideeffectVenues' + collectionId).prev().addClass('open');
        } else {
            $('#slideeffectVenues' + collectionId).slideUp("slow");
            $('#slideOutVenue' + collectionId).hide();
            $('#slideInVenue' + collectionId).show();
            $('#slideeffectVenues' + collectionId).prev().removeClass('open');
        }
        AdjustHeight();
    }

function ShowFirstCollectionList(collectionId){
    ToggleAttributes($('#'+collectionId).val());
}

function SaveAndUpdatePostionIndex() {

    var positionIndex = $.getHashVar("pos");
    var searchType = $.getHashVar("type");
    var locationHierarchyID = $.getHashVar("lhid");
    if(locationHierarchyID == undefined || locationHierarchyID == null)
        locationHierarchyID = 0;

    if (positionIndex != undefined && positionIndex > 0) {
        if ($('.hddnPositionIndex').length > 0) {
            $('.hddnPositionIndex').val(positionIndex);
        }

        if ($('.hddnSearchType').length > 0)
            $('.hddnSearchType').val(searchType);

        if ($('.hddnlocationHierarchyID').length > 0)
            $('.hddnlocationHierarchyID').val(locationHierarchyID);

        
        if ($('.hddnVenueViewID').length > 0) {
            var venueViewID = $('.hddnVenueViewID').val();
            var q = $HitchedAjaxOptions;            
            q.url = asmxPosition + "UpdateVenueViewPostionIndex";
            q.data = "{venueViewID:" + venueViewID + ",positionIndex:" + positionIndex + ",searchType:" + searchType + ",locationHierarchyID:" + locationHierarchyID + "}";
            q.success = function () { };
            $.ajax(q);
        }
    }    
}
function OpenVenueDetailPageSpecificTab() {
    var tabName = $.getHashVar("tab");    
    if (tabName != undefined) {
        var $tabs;
        if ($('#tabs')) { $tabs = $('#tabs').tabs(); } if ($tabs) { $tabs.tabs('select', tabName); }
    }
}

function AddHashToExistingLinks() {
    var positionIndex = $.getHashVar("pos");

    if (positionIndex != undefined && positionIndex > 0) {
        var addHierarchyID = "";
         var searchType = $.getHashVar("type");         
         var locationHierarchyID = $.getHashVar("lhid");
         if (locationHierarchyID != undefined && locationHierarchyID > 0)
             addHierarchyID = "&lhid=" + locationHierarchyID;

        if($('#ancVenueRFI').length > 0 ){
            var existingUrl = $('#ancVenueRFI').attr("href");
            $('#ancVenueRFI').attr("href", existingUrl + "#pos=" + positionIndex + "&type=" + searchType + addHierarchyID);
        }
        if ($('.ancVenueRFI').length > 0) {
            var existingUrl = $('.ancVenueRFI').attr("href");
            $('.ancVenueRFI').attr("href", existingUrl + "#pos=" + positionIndex + "&type=" + searchType + addHierarchyID);
        }
        if($('#ancViewVenueWebsite').length > 0 ) {
          var existingUrl = $('#ancViewVenueWebsite').attr("href");
          $('#ancViewVenueWebsite').attr("href", existingUrl + "&pos=" + positionIndex + "&type=" + searchType + addHierarchyID);
        }
     }
}

$.extend({
    getHashVars: function () {
        var vars = [], hash;        
        if (window.location.hash) {
            var hashes = window.location.hash.slice(1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
        }
        return vars;
    },
    getHashVar: function (name) {
        return $.getHashVars()[name];
    }
}
);// Listing.JS
//Used for LHN?

$(document).ready(function(){   
        
    $('div .toggle-list-head').click(function(){
            var listingId=this.id;
            listingId=listingId.split('_');
           ToggleHeader(listingId[1]);
        });
 });

function checkListing(title)
{
   var headerId=$("*[id$='hddnFirstHeaderId']").val();
   //alert(headerId);
   if(headerId !== null || headerId !== 'undefined' || headerId !== '' || headerId !== undefined)
   {
			$('#slideeffectRegion' + headerId).slideDown('slow');  
			if(title=='Venues')
			{
				$('#lblHeaderName_' + headerId).attr("style","display:none");
				$('#lblHeaderName_00').attr("style","display:none");
				$('#slideeffectRegion00').attr("style","display:none");
			}
   }
   AdjustHeight();
}
 
function ToggleHeader(HeaderId)
{
    var websiteName= $("#hddnWebsiteName").val();
    if($('#slideeffectRegion' + HeaderId).is(":hidden"))
    {       
         $("#lblHeaderName_" + HeaderId).css({backgroundImage :"url(" + websiteName + "/Images/down_arrow.gif)"});
         $('#slideeffectRegion' + HeaderId).slideDown('slow');  
    }   
    else
    { 
        $("#lblHeaderName_" + HeaderId).css({backgroundImage :"url(" + websiteName + "/Images/left_arrow.gif)"});
        $('#slideeffectRegion' + HeaderId).slideUp('slow');          
    }
    /*AdjustHeight(); */
} 
    
  /*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
* Requires: jQuery v1.3+
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*/

; (function ($) {
    var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,

		selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],

		ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,

		loadingTimer, loadingFrame = 1,

		titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),

		isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,

    /*
    * Private methods 
    */

		_abort = function () {
		    loading.hide();

		    imgPreloader.onerror = imgPreloader.onload = null;

		    if (ajaxLoader) {
		        ajaxLoader.abort();
        } 

		    tmp.empty();
		},

		_error = function () {
		    if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
		        loading.hide();
		        busy = false;
		        return;
		    }

		    selectedOpts.titleShow = false;

		    selectedOpts.width = 'auto';
		    selectedOpts.height = 'auto';

		    tmp.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');

		    _process_inline();
		},

		_start = function () {
		    var obj = selectedArray[selectedIndex],
				href,
				type,
				title,
				str,
				emb,
				ret;

		    _abort();

		    selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));

		    ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);

		    if (ret === false) {
		        busy = false;
		        return;
		    } else if (typeof ret == 'object') {
		        selectedOpts = $.extend(selectedOpts, ret);
		    }

		    title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';

		    if (obj.nodeName && !selectedOpts.orig) {
		        selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
		    }

		    if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
		        title = selectedOpts.orig.attr('alt');
		    }

		    href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;

		    if ((/^(?:javascript)/i).test(href) || href == '#') {
		        href = null;
		    }

		    if (selectedOpts.type) {
		        type = selectedOpts.type;

		        if (!href) {
		            href = selectedOpts.content;
		        }

		    } else if (selectedOpts.content) {
		        type = 'html';

		    } else if (href) {
		        if (href.match(imgRegExp)) {
		            type = 'image';

		        } else if (href.match(swfRegExp)) {
		            type = 'swf';

		        } else if ($(obj).hasClass("iframe")) {
		            type = 'iframe';

		        } else if (href.indexOf("#") === 0) {
		            type = 'inline';

        } else {
		            type = 'ajax';
        } 
        } 

		    if (!type) {
		        _error();
		        return;
            } 

		    if (type == 'inline') {
		        obj = href.substr(href.indexOf("#"));
		        type = $(obj).length > 0 ? 'inline' : 'ajax';
        } 

		    selectedOpts.type = type;
		    selectedOpts.href = href;
		    selectedOpts.title = title;

		    if (selectedOpts.autoDimensions) {
		        if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
		            selectedOpts.width = 'auto';
		            selectedOpts.height = 'auto';
		        } else {
		            selectedOpts.autoDimensions = false;
        } 
    }

		    if (selectedOpts.modal) {
		        selectedOpts.overlayShow = true;
		        selectedOpts.hideOnOverlayClick = false;
		        selectedOpts.hideOnContentClick = false;
		        selectedOpts.enableEscapeButton = false;
		        selectedOpts.showCloseButton = false;
            } 

		    selectedOpts.padding = parseInt(selectedOpts.padding, 10);
		    selectedOpts.margin = parseInt(selectedOpts.margin, 10);

		    tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));

		    $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function () {
		        $(this).replaceWith(content.children());
		    });

		    switch (type) {
		        case 'html':
		            tmp.html(selectedOpts.content);
		            _process_inline();
		            break;

		        case 'inline':
		            if ($(obj).parent().is('#fancybox-content') === true) {
		                busy = false;
		                return;
		            }

		            $('<div class="fancybox-inline-tmp" />')
						.hide()
						.insertBefore($(obj))
						.bind('fancybox-cleanup', function () {
						    $(this).replaceWith(content.children());
						}).bind('fancybox-cancel', function () {
						    $(this).replaceWith(tmp.children());
						});

		            $(obj).appendTo(tmp);

		            _process_inline();
		            break;

		        case 'image':
		            busy = false;

		            $.fancybox.showActivity();

		            imgPreloader = new Image();

		            imgPreloader.onerror = function () {
		                _error();
		            };

		            imgPreloader.onload = function () {
		                busy = true;

		                imgPreloader.onerror = imgPreloader.onload = null;

		                _process_image();
		            };

		            imgPreloader.src = href;
		            break;

		        case 'swf':
		            selectedOpts.scrolling = 'no';

		            str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
		            emb = '';

		            $.each(selectedOpts.swf, function (name, val) {
		                str += '<param name="' + name + '" value="' + val + '"></param>';
		                emb += ' ' + name + '="' + val + '"';
		            });

		            str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';

		            tmp.html(str);

		            _process_inline();
		            break;

		        case 'ajax':
		            busy = false;

		            $.fancybox.showActivity();

		            selectedOpts.ajax.win = selectedOpts.ajax.success;

		            ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
		                url: href,
		                data: selectedOpts.ajax.data || {},
		                error: function (XMLHttpRequest, textStatus, errorThrown) {
		                    if (XMLHttpRequest.status > 0) {
		                        _error();
		                    }
		                },
		                success: function (data, textStatus, XMLHttpRequest) {
		                    var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
		                    if (o.status == 200) {
		                        if (typeof selectedOpts.ajax.win == 'function') {
		                            ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);

		                            if (ret === false) {
		                                loading.hide();
		                                return;
		                            } else if (typeof ret == 'string' || typeof ret == 'object') {
		                                data = ret;
		                            }
		                        }

		                        tmp.html(data);
		                        _process_inline();
		                    }
		                }
		            }));

		            break;

		        case 'iframe':
		            _show();
		            break;
		    }
		},

		_process_inline = function () {
		    var 
				w = selectedOpts.width,
				h = selectedOpts.height;

		    if (w.toString().indexOf('%') > -1) {
		        w = parseInt(($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';

		    } else {
		        w = w == 'auto' ? 'auto' : w + 'px';
		    }

		    if (h.toString().indexOf('%') > -1) {
		        h = parseInt(($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';

		    } else {
		        h = h == 'auto' ? 'auto' : h + 'px';
		    }

		    tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');

		    selectedOpts.width = tmp.width();
		    selectedOpts.height = tmp.height();

		    _show();
		},

		_process_image = function () {
		    selectedOpts.width = imgPreloader.width;
		    selectedOpts.height = imgPreloader.height;

		    $("<img />").attr({
		        'id': 'fancybox-img',
		        'src': imgPreloader.src,
		        'alt': selectedOpts.title
		    }).appendTo(tmp);

		    _show();
		},

		_show = function () {
		    var pos, equal;

		    loading.hide();

		    if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
		        $.event.trigger('fancybox-cancel');

		        busy = false;
		        return;
		    }

		    busy = true;

		    $(content.add(overlay)).unbind();

		    $(window).unbind("resize.fb scroll.fb");
		    $(document).unbind('keydown.fb');

		    if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
		        wrap.css('height', wrap.height());
		    }

		    currentArray = selectedArray;
		    currentIndex = selectedIndex;
		    currentOpts = selectedOpts;

		    if (currentOpts.overlayShow) {
		        overlay.css({
		            'background-color': currentOpts.overlayColor,
		            'opacity': currentOpts.overlayOpacity,
		            'cursor': currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
		            'height': $(document).height()
		        });

		        if (!overlay.is(':visible')) {
		            if (isIE6) {
		                $('select:not(#fancybox-tmp select)').filter(function () {
		                    return this.style.visibility !== 'hidden';
		                }).css({ 'visibility': 'hidden' }).one('fancybox-cleanup', function () {
		                    this.style.visibility = 'inherit';
		                });
		            }

		            overlay.show();
		        }
		    } else {
		        overlay.hide();
		    }

		    final_pos = _get_zoom_to();

		    _process_title();

		    if (wrap.is(":visible")) {
		        $(close.add(nav_left).add(nav_right)).hide();

		        pos = wrap.position(),

				start_pos = {
				    top: pos.top,
				    left: pos.left,
				    width: wrap.width(),
				    height: wrap.height()
				};

		        equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);

		        content.fadeTo(currentOpts.changeFade, 0.3, function () {
		            var finish_resizing = function () {
		                content.html(tmp.contents()).fadeTo(currentOpts.changeFade, 1, _finish);
		            };

		            $.event.trigger('fancybox-change');

		            content
						.empty()
						.removeAttr('filter')
						.css({
						    'border-width': currentOpts.padding,
						    'width': final_pos.width - currentOpts.padding * 2,
						    'height': selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
						});

		            if (equal) {
		                finish_resizing();

		            } else {
		                fx.prop = 0;

		                $(fx).animate({ prop: 1 }, {
		                    duration: currentOpts.changeSpeed,
		                    easing: currentOpts.easingChange,
		                    step: _draw,
		                    complete: finish_resizing
		                });
		            }
		        });

		        return;
		    }

		    wrap.removeAttr("style");

		    content.css('border-width', currentOpts.padding);

		    if (currentOpts.transitionIn == 'elastic') {
		        start_pos = _get_zoom_from();

		        content.html(tmp.contents());

		        wrap.show();

		        if (currentOpts.opacity) {
		            final_pos.opacity = 0;
		        }

		        fx.prop = 0;

		        $(fx).animate({ prop: 1 }, {
		            duration: currentOpts.speedIn,
		            easing: currentOpts.easingIn,
		            step: _draw,
		            complete: _finish
		        });

		        return;
		    }

		    if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
		        title.show();
		    }

		    content
				.css({
				    'width': final_pos.width - currentOpts.padding * 2,
				    'height': selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
        })
				.html(tmp.contents());

		    wrap
				.css(final_pos)
				.fadeIn(currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish);
		},

		_format_title = function (title) {
		    if (title && title.length) {
		        if (currentOpts.titlePosition == 'float') {
		            return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
            } 

		        return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
        } 

		    return false;
		},

		_process_title = function () {
		    titleStr = currentOpts.title || '';
		    titleHeight = 0;

		    title
				.empty()
				.removeAttr('style')
				.removeClass();

		    if (currentOpts.titleShow === false) {
		        title.hide();
		        return;
		    }

		    titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);

		    if (!titleStr || titleStr === '') {
		        title.hide();
		        return;
		    }

		    title
				.addClass('fancybox-title-' + currentOpts.titlePosition)
				.html(titleStr)
				.appendTo('body')
				.show();

		    switch (currentOpts.titlePosition) {
		        case 'inside':
		            title
						.css({
						    'width': final_pos.width - (currentOpts.padding * 2),
						    'marginLeft': currentOpts.padding,
						    'marginRight': currentOpts.padding
						});

		            titleHeight = title.outerHeight(true);

		            title.appendTo(outer);

		            final_pos.height += titleHeight;
		            break;

		        case 'over':
		            title
						.css({
						    'marginLeft': currentOpts.padding,
						    'width': final_pos.width - (currentOpts.padding * 2),
						    'bottom': currentOpts.padding
						})
						.appendTo(outer);
		            break;

		        case 'float':
		            title
						.css('left', parseInt((title.width() - final_pos.width - 40) / 2, 10) * -1)
						.appendTo(wrap);
		            break;

		        default:
		            title
						.css({
						    'width': final_pos.width - (currentOpts.padding * 2),
						    'paddingLeft': currentOpts.padding,
						    'paddingRight': currentOpts.padding
						})
						.appendTo(wrap);
		            break;
		    }

		    title.hide();
		},

		_set_navigation = function () {
		    if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
		        $(document).bind('keydown.fb', function (e) {
		            if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
		                e.preventDefault();
		                $.fancybox.close();

		            } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
		                e.preventDefault();
		                $.fancybox[e.keyCode == 37 ? 'prev' : 'next']();
		            }
		        });
		    }

		    if (!currentOpts.showNavArrows) {
		        nav_left.hide();
		        nav_right.hide();
		        return;
		    }

		    if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
		        nav_left.show();
		    }

		    if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length - 1)) {
		        nav_right.show();
		    }
		},

		_finish = function () {
		    if (!$.support.opacity) {
		        content.get(0).style.removeAttribute('filter');
		        wrap.get(0).style.removeAttribute('filter');
		    }

		    if (selectedOpts.autoDimensions) {
		        content.css('height', 'auto');
		    }

		    wrap.css('height', 'auto');

		    if (titleStr && titleStr.length) {
		        title.show();
		    }

		    if (currentOpts.showCloseButton) {
		        close.show();
		    }

		    _set_navigation();

		    if (currentOpts.hideOnContentClick) {
		        content.bind('click', $.fancybox.close);
		    }

		    if (currentOpts.hideOnOverlayClick) {
		        overlay.bind('click', $.fancybox.close);
		    }

		    $(window).bind("resize.fb", $.fancybox.resize);

		    if (currentOpts.centerOnScroll) {
		        $(window).bind("scroll.fb", $.fancybox.center);
		    }

		    if (currentOpts.type == 'iframe') {
		        $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
		    }

		    wrap.show();

		    busy = false;

		    $.fancybox.center();

		    currentOpts.onComplete(currentArray, currentIndex, currentOpts);

		    _preload_images();
		},

		_preload_images = function () {
		    var href,
				objNext;

		    if ((currentArray.length - 1) > currentIndex) {
		        href = currentArray[currentIndex + 1].href;

		        if (typeof href !== 'undefined' && href.match(imgRegExp)) {
		            objNext = new Image();
		            objNext.src = href;
		        }
		    }

		    if (currentIndex > 0) {
		        href = currentArray[currentIndex - 1].href;

		        if (typeof href !== 'undefined' && href.match(imgRegExp)) {
		            objNext = new Image();
		            objNext.src = href;
		        }
		    }
		},

		_draw = function (pos) {
		    var dim = {
		        width: parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
		        height: parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),

		        top: parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
		        left: parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
		    };

		    if (typeof final_pos.opacity !== 'undefined') {
		        dim.opacity = pos < 0.5 ? 0.5 : pos;
		    }

		    wrap.css(dim);

		    content.css({
		        'width': dim.width - currentOpts.padding * 2,
		        'height': dim.height - (titleHeight * pos) - currentOpts.padding * 2
		    });
		},

		_get_viewport = function () {
		    return [
				$(window).width() - (currentOpts.margin * 2),
				$(window).height() - (currentOpts.margin * 2),
				$(document).scrollLeft() + currentOpts.margin,
				$(document).scrollTop() + currentOpts.margin
			];
		},

		_get_zoom_to = function () {
		    var view = _get_viewport(),
				to = {},
				resize = currentOpts.autoScale,
				double_padding = currentOpts.padding * 2,
				ratio;

		    if (currentOpts.width.toString().indexOf('%') > -1) {
		        to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
		    } else {
		        to.width = currentOpts.width + double_padding;
		    }

		    if (currentOpts.height.toString().indexOf('%') > -1) {
		        to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
		    } else {
		        to.height = currentOpts.height + double_padding;
		    }

		    if (resize && (to.width > view[0] || to.height > view[1])) {
		        if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
		            ratio = (currentOpts.width) / (currentOpts.height);

		            if ((to.width) > view[0]) {
		                to.width = view[0];
		                to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
		            }

		            if ((to.height) > view[1]) {
		                to.height = view[1];
		                to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
		            }

		        } else {
		            to.width = Math.min(to.width, view[0]);
		            to.height = Math.min(to.height, view[1]);
		        }
		    }

		    to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
		    to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);

		    return to;
		},

		_get_obj_pos = function (obj) {
		    var pos = obj.offset();

		    pos.top += parseInt(obj.css('paddingTop'), 10) || 0;
		    pos.left += parseInt(obj.css('paddingLeft'), 10) || 0;

		    pos.top += parseInt(obj.css('border-top-width'), 10) || 0;
		    pos.left += parseInt(obj.css('border-left-width'), 10) || 0;

		    pos.width = obj.width();
		    pos.height = obj.height();

		    return pos;
		},

		_get_zoom_from = function () {
		    var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
				from = {},
				pos,
				view;

		    if (orig && orig.length) {
		        pos = _get_obj_pos(orig);

		        from = {
		            width: pos.width + (currentOpts.padding * 2),
		            height: pos.height + (currentOpts.padding * 2),
		            top: pos.top - currentOpts.padding - 20,
		            left: pos.left - currentOpts.padding - 20
		        };

		    } else {
		        view = _get_viewport();

		        from = {
		            width: currentOpts.padding * 2,
		            height: currentOpts.padding * 2,
		            top: parseInt(view[3] + view[1] * 0.5, 10),
		            left: parseInt(view[2] + view[0] * 0.5, 10)
		        };
		    }

		    return from;
		},

		_animate_loading = function () {
		    if (!loading.is(':visible')) {
		        clearInterval(loadingTimer);
		        return;
		    }

		    $('div', loading).css('top', (loadingFrame * -40) + 'px');

		    loadingFrame = (loadingFrame + 1) % 12;
		};

    /*
    * Public methods 
    */

    $.fn.fancybox = function (options) {
        if (!$(this).length) {
            return this;
        }

        $(this)
			.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
			.unbind('click.fb')
			.bind('click.fb', function (e) {
			    e.preventDefault();

			    if (busy) {
			        return;
			    }

			    busy = true;

			    $(this).blur();

			    selectedArray = [];
			    selectedIndex = 0;

			    var rel = $(this).attr('rel') || '';

			    if (!rel || rel == '' || rel === 'nofollow') {
			        selectedArray.push(this);

			    } else {
			        selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
			        selectedIndex = selectedArray.index(this);
			    }

			    _start();

			    return;
			});

        return this;
    };

    $.fancybox = function (obj) {
        var opts;

        if (busy) {
            return;
        }

        busy = true;
        opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};

        selectedArray = [];
        selectedIndex = parseInt(opts.index, 10) || 0;

        if ($.isArray(obj)) {
            for (var i = 0, j = obj.length; i < j; i++) {
                if (typeof obj[i] == 'object') {
                    $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
                } else {
                    obj[i] = $({}).data('fancybox', $.extend({ content: obj[i] }, opts));
                }
            }

            selectedArray = jQuery.merge(selectedArray, obj);

        } else {
            if (typeof obj == 'object') {
                $(obj).data('fancybox', $.extend({}, opts, obj));
            } else {
                obj = $({}).data('fancybox', $.extend({ content: obj }, opts));
            }

            selectedArray.push(obj);
        }

        if (selectedIndex > selectedArray.length || selectedIndex < 0) {
            selectedIndex = 0;
        }

        _start();
    };

    $.fancybox.showActivity = function () {
        clearInterval(loadingTimer);

        loading.show();
        loadingTimer = setInterval(_animate_loading, 66);
    };

    $.fancybox.hideActivity = function () {
        loading.hide();
    };

    $.fancybox.next = function () {
        return $.fancybox.pos(currentIndex + 1);
    };

    $.fancybox.prev = function () {
        return $.fancybox.pos(currentIndex - 1);
    };

    $.fancybox.pos = function (pos) {
        if (busy) {
            return;
        }

        pos = parseInt(pos);

        selectedArray = currentArray;

        if (pos > -1 && pos < currentArray.length) {
            selectedIndex = pos;
            _start();

        } else if (currentOpts.cyclic && currentArray.length > 1) {
            selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
            _start();
        }

        return;
    };

    $.fancybox.cancel = function () {
        if (busy) {
            return;
        }

        busy = true;

        $.event.trigger('fancybox-cancel');

        _abort();

        selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);

        busy = false;
    };

    // Note: within an iframe use - parent.$.fancybox.close();
    $.fancybox.close = function () {
        if (busy || wrap.is(':hidden')) {
            return;
        }

        busy = true;

        if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
            busy = false;
            return;
        }

        _abort();

        $(close.add(nav_left).add(nav_right)).hide();

        $(content.add(overlay)).unbind();

        $(window).unbind("resize.fb scroll.fb");
        $(document).unbind('keydown.fb');

        content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');

        if (currentOpts.titlePosition !== 'inside') {
            title.empty();
        }

        wrap.stop();

        function _cleanup() {
            overlay.fadeOut('fast');

            title.empty().hide();
            wrap.hide();

            $.event.trigger('fancybox-cleanup');

            content.empty();

            currentOpts.onClosed(currentArray, currentIndex, currentOpts);

            currentArray = selectedOpts = [];
            currentIndex = selectedIndex = 0;
            currentOpts = selectedOpts = {};

            busy = false;
        }

        if (currentOpts.transitionOut == 'elastic') {
            start_pos = _get_zoom_from();

            var pos = wrap.position();

            final_pos = {
                top: pos.top,
                left: pos.left,
                width: wrap.width(),
                height: wrap.height()
            };

            if (currentOpts.opacity) {
                final_pos.opacity = 1;
            }

            title.empty().hide();

            fx.prop = 1;

            $(fx).animate({ prop: 0 }, {
                duration: currentOpts.speedOut,
                easing: currentOpts.easingOut,
                step: _draw,
                complete: _cleanup
            });

        } else {
            wrap.fadeOut(currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
        }
    };

    $.fancybox.resize = function () {
        if (overlay.is(':visible')) {
            overlay.css('height', $(document).height());
        }

        $.fancybox.center(true);
    };

    $.fancybox.center = function () {
        var view, align;

        if (busy) {
            return;
        }

        align = arguments[0] === true ? 1 : 0;
        view = _get_viewport();

        if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
            return;
        }

        wrap
			.stop()
			.animate({
			    'top': parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
			    'left': parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
			}, typeof arguments[0] == 'number' ? arguments[0] : 200);
    };

    $.fancybox.init = function () {
        if ($("#fancybox-wrap").length) {
            return;
        }

        $('body').append(
			tmp = $('<div id="fancybox-tmp"></div>'),
			loading = $('<div id="fancybox-loading"><div></div></div>'),
			overlay = $('<div id="fancybox-overlay"></div>'),
			wrap = $('<div id="fancybox-wrap"></div>')
		);

        outer = $('<div id="fancybox-outer"></div>')
			.append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
			.appendTo(wrap);

        outer.append(
			content = $('<div id="fancybox-content"></div>'),
			close = $('<a id="fancybox-close"></a>'),
			title = $('<div id="fancybox-title"></div>'),

			nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
			nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
		);

        close.click($.fancybox.close);
        loading.click($.fancybox.cancel);

        nav_left.click(function (e) {
            e.preventDefault();
            $.fancybox.prev();
        });

        nav_right.click(function (e) {
            e.preventDefault();
            $.fancybox.next();
        });

        if ($.fn.mousewheel) {
            wrap.bind('mousewheel.fb', function (e, delta) {
                if (busy) {
                    e.preventDefault();

                } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
                    e.preventDefault();
                    $.fancybox[delta > 0 ? 'prev' : 'next']();
                }
            });
        }

        if (!$.support.opacity) {
            wrap.addClass('fancybox-ie');
        }

        if (isIE6) {
            loading.addClass('fancybox-ie6');
            wrap.addClass('fancybox-ie6');

            $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank') + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
        }
    };

    $.fn.fancybox.defaults = {
        padding: 10,
        margin: 40,
        opacity: false,
        modal: false,
        cyclic: false,
        scrolling: 'auto', // 'auto', 'yes' or 'no'

        width: 560,
        height: 340,

        autoScale: true,
        autoDimensions: true,
        centerOnScroll: false,

        ajax: {},
        swf: { wmode: 'transparent' },

        hideOnOverlayClick: true,
        hideOnContentClick: false,

        overlayShow: true,
        overlayOpacity: 0.7,
        overlayColor: '#777',

        titleShow: true,
        titlePosition: 'float', // 'float', 'outside', 'inside' or 'over'
        titleFormat: null,
        titleFromAlt: false,

        transitionIn: 'fade', // 'elastic', 'fade' or 'none'
        transitionOut: 'fade', // 'elastic', 'fade' or 'none'

        speedIn: 300,
        speedOut: 300,

        changeSpeed: 300,
        changeFade: 'fast',

        easingIn: 'swing',
        easingOut: 'swing',

        showCloseButton: true,
        showNavArrows: true,
        enableEscapeButton: true,
        enableKeyboardNav: true,

        onStart: function () { },
        onCancel: function () { },
        onComplete: function () { },
        onCleanup: function () { },
        onClosed: function () { },
        onError: function () { }
    };

    $(document).ready(function () {
        $.fancybox.init();
    });

})(jQuery);// JScript File
//start Venues.accomodation.js

function GetDirections()
{

    var sourceAddress = $('#txtPostCode').val();
    var googleUrl = "http://maps.google.co.uk/maps?saddr=ab10&daddr=GU15+3DW&hl=en";
    var destinationAddress = $('#hddnPostcode').val();    
    var link =  googleUrl + "&saddr=" +sourceAddress + "&daddr=" +  destinationAddress + "&hl=en";       
    //window.location  =  googleUrl + "&saddr=" +sourceAddress + "&daddr=" +  destinationAddress + "&hl=en";    
    window.open(link,'resizable=yes ,scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes');
}

$(document).ready(function(){   

    $("#txtPostCode").keypress(function(e) {       
          if((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
          {
               GetDirections();            
               return false;  
           }    
     });
    $("#btnGetdirection").click(function(){GetDirections();});
});

function AdjustAccommodationHeight()
{
     var accommodationLeft = $(' .accommodation-detail-left').height();        
     var accommodationRight = $(' .accommodation-detail-right').height();        
     var topHeight;
     if(accommodationLeft > accommodationRight){
        topHeight = accommodationLeft;
        }
     else{
        topHeight = accommodationRight;
        }
     
}
//end of Venues.accomodation.js


// JScript File
// starting of Venues.MediaGallery.js
//Areas used venues admin

var pageNumber = 1;
var IsAdmin =0;
var asmxMediaGallery = "/API/Venues/JSWSMediaGallery.asmx/";
var $HitchedAjaxOptions = {
type: "POST",
contentType: "application/json; charset=utf-8",
      dataType: "text",dataFilter: function (data, type) {return $.parseJSON(data);},
      error: function(result) {
          if (this.console && typeof console.log != "undefined")
              console.log("Error in server:" + result.status + ' ' + result.statusText);
      }};

 	




function EnabledDisableMediaLink(isEnabled, element) {
    if (isEnabled) {
        $(element).css("color", "#380062");
        $(element).css("textDecoration", 'underline');
        $(element).css("cursor", "pointer");

    }
    else {
        $(element).css("color", "#696969");
        $(element).css("textDecoration", 'none');
        $(element).css("cursor", "text");
    }

}


function enableALL(clientID) {
    var firstLink = $(clientID + "lnkFirst");
    var nextLink = $(clientID + "lnkNext");
    var lastLink = $(clientID + "lnkLast");
    var prevtLink = $(clientID + "lnkPrevious");
    EnabledDisableMediaLink(true, firstLink);
    EnabledDisableMediaLink(true, nextLink);
    EnabledDisableMediaLink(true, lastLink);
    EnabledDisableMediaLink(true, prevtLink);
}

function setPageCount(clientID) {
    var lastPageIndex = $(clientID + "lblLastPageindex");
    var lblCounts = $(clientID + "lblCounts");
    lblCounts.text("Page " + pageNumber + " of " + lastPageIndex.text());
}

function CallBackDeletePost(result)
{
    $('.btnDeleteMediaGalleryPost').click()
    //window.location = "MediaGallery.aspx?msg=delete&rid=" + $("span.lblRecordID").text() + "&type=" + $("span.lblGalleryType").text();
}
function DeleteMediaGalleryPost() {
    $('a.deletePhoto').click(function() {
        if (confirm('Are you sure you want to delete this record?')) {
            $("#loader_media").show();
            $("#loader_media").height($("#divMediaDetailsMain").height());            
            var q = $HitchedAjaxOptions; 
            q.url = asmxMediaGallery + "DeletePost";  
            q.data = "{postID:" + $(this).attr("title") + "}";                        
            q.success = CallBackDeletePost;  
            $.ajax(q);              
            return false;
        }
        else {
            return false;
        }
    });
}


$(document).ready(function () {
    var hasMediaGal = ($('.lblRecordID').attr("id"))
    if (hasMediaGal) {

        var clientID = '#' + $('.lblRecordID').attr("id").replace("lblRecordID", "");
        IsAdmin = $(clientID + "lblIsAdmin").text();
        $("#loader_media").show();
        $("#loader_media").height($("#divMediaDetailsMain").height());

        var RecordID = $(clientID + "lblRecordID").text();
        var GalleryType = $(clientID + "lblGalleryType").text();
        var RecordCount = 50;
        var pageNo = 1;

        var q = $HitchedAjaxOptions;
        q.url = asmxMediaGallery + "GetMediaGalleryHTML";
        q.data = "{recordID:" + RecordID + ",galleryType:" + GalleryType + ",PageNumber:" + pageNo + ",RecordCount:" + RecordCount + ",isAdmin:" + IsAdmin + "}";
        q.success = CallBackGetMediaGalleryHTML;
        $.ajax(q);
    }
})

function CallBackGetMediaGalleryHTML(result)
{
    var countOfImages = 0;
    if (IsAdmin == 1) {
        $('#gallery').html(result.d);
        HideSpecialAreaImages()
        InitilizeDragDrop();
    }else {
        $('#divMediaGallery').html(result.d);
        countOfImages = $('#divMediaGallery').find("img.img_media").length;
        $(".lblTotalListed").html(countOfImages);
      
        $("#divMediaGallery").hitchedCarouselLite();

     
    }
    DeleteMediaGalleryPost();
    $("a.thickbox").fancybox({ 'overlayOpacity': 0.7, cyclic: true });
    $("#loader_media").hide();
        
}

function getMediaGallery(pageNo, clientID) {
    $("#loader_media").show();
    $("#loader_media").height($("#divMediaDetailsMain").height());
    setTimeout(function() {        
        var RecordID = $(clientID + "lblRecordID").text();
        var GalleryType = $(clientID + "lblGalleryType").text();
        var RecordCount = $(clientID + "lblTotalListed").text();
        IsAdmin = $(clientID + "lblIsAdmin").text();            
        
        var q = $HitchedAjaxOptions; 
        q.url = asmxMediaGallery + "GetMediaGalleryHTML";                 
        q.data = "{recordID:" + RecordID + ",galleryType:" + GalleryType + ",PageNumber:" + pageNo + ",RecordCount:" + RecordCount + ",isAdmin:" + IsAdmin + "}";                        
        q.success = CallBackGetMediaGalleryHTML;  
        $.ajax(q);  
    }, 1);
    setTimeout(function() {  }, 1);
}

function InitializeMediaGallery() {
    var clientID = '';
    if ($('.lblRecordID').attr("id")) {
        clientID = '#' + $('.lblRecordID').attr("id").replace("lblRecordID", "");
    }
    $(clientID + "lnkNext").click(function() {
        var lastPageIndex = $(clientID + 'lblLastPageindex').text();
        if (pageNumber < parseInt(lastPageIndex,10)) {
            enableALL(clientID);
            pageNumber = pageNumber + 1;
            getMediaGallery(pageNumber, clientID);
        }
        if (pageNumber == parseInt(lastPageIndex,10)) {
            var lastLink = $(clientID + "lnkLast");
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, lastLink);
        }
        
        setPageCount(clientID);
        return false;
    });

    $(clientID + "lnkPrevious").click(function() {
        if (pageNumber > 1) {
            enableALL(clientID);
            pageNumber = pageNumber - 1;
            getMediaGallery(pageNumber, clientID);
        }
        if (pageNumber == 1) {
            var lnkFirst = $(clientID + "lnkFirst");
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, lnkFirst);
        }
        setPageCount(clientID);
        return false;
    });

    $(clientID + "lnkLast").click(function() {
        enableALL(clientID);
        var lastPageIndex = $(clientID + 'lblLastPageindex').text();
        var nextLink = $(clientID + "lnkNext");
        if (pageNumber != lastPageIndex) {
            pageNumber = lastPageIndex;
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, nextLink);
            getMediaGallery(pageNumber, clientID);
            setPageCount(clientID);
        }
        else {
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, nextLink);
        }
        return false;
    });

    $(clientID + "lnkFirst").click(function() {
        enableALL(clientID);
        var prevtLink = $(clientID + "lnkPrevious");
        if (pageNumber != 1) {
            pageNumber = 1;
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, prevtLink);
            getMediaGallery(pageNumber, clientID);
            setPageCount(clientID);
        }
        else {
            EnabledDisableMediaLink(false, this);
            EnabledDisableMediaLink(false, prevtLink);
        }
        return false;
    });
}


$(document).ready(function() {
    
    InitializeMediaGallery();
    return DeleteMediaGalleryPost();
    
});

// end of Venues.MediaGallery.js//Adjust Height
//A shared file that allows client side updates of the heigh across broswers.

var offSetHeight = 10;
function FixHeight(one,two) 
{ 
    if($('#'+one))
    {
        var lh= $('#' +one).height();
        var rh = $('#' +two).height();
        var nh = Math.max(lh, rh);  
        $('#'+one).height(nh + offSetHeight);
        $('#'+two).height(nh + offSetHeight);
    }
}

function AdjustHeight()
{   
    //some of the functions from FashionListing.js and FashionNavigation.js
    //are accesing this function  so not removed 
}

function IsIE6Browser()
{
    return ($.browser.msie && $.browser.version.substr(0,1)<7);
}

function ReAssignHieght(id,orginalHeight,value)
{   
     //some of the functions from FashionListing.js and FashionNavigation.js
    //are accesing this function so not removed 
}

