/*CSS Browser Selector v0.4.0*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
////////
/*COLOR-BOX*/
// ColorBox v1.3.18
// Customized-2011-11 by SHAHAB
(function(a,b,c){function Y(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function Z(a){var b=y.length,c=(Q+a)%b;return c<0?b+c:c}function $(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function _(a){return K.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(a)}function ba(){var b;K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.slice(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function bb(b,c){a.event.trigger(b),c&&c.call(P)}function bc(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(W.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function bd(b){if(!U){P=b,ba(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=$(K.initialWidth,"x"),K.h=$(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),bb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}W.load(!0)}}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"&lt;",next:"&gt;",close:"X",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start",slideshowStop:"stop",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X="div";W=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{},W.init();if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}return c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bd(f[0]),f},W.init=function(){if(!r){if(!a("body")[0]){a(W.init);return}z=a(c),r=Y(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y(X,"Overlay",o?"position:absolute":"").hide(),s=Y(X,"Wrapper"),t=Y(X,"Content").append(A=Y(X,"LoadedContent","width:0; height:0; overflow:hidden"),C=Y(X,"LoadingOverlay").add(Y(X,"LoadingGraphic")),D=Y(X,"Title"),E=Y(X,"Current"),G=Y(X,"Next"),H=Y(X,"Previous"),F=Y(X,"Slideshow").bind(h,bc),I=Y(X,"Close")),s.append(Y(X).append(Y(X,"TopLeft"),u=Y(X,"TopCenter"),Y(X,"TopRight")),Y(X,!1,"clear:left").append(v=Y(X,"MiddleLeft"),t,w=Y(X,"MiddleRight")),Y(X,!1,"clear:left").append(Y(X,"BottomLeft"),x=Y(X,"BottomCenter"),Y(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Y(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),J=G.add(H).add(E).add(F),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})}},W.remove=function(){r.add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g)},W.position=function(a,b){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c=0,d=0,e=r.offset();z.unbind("resize."+f),r.css({top:-99999,left:-99999}),K.fixed&&!o?r.css({position:"fixed"}):(c=z.scrollTop(),d=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?d+=Math.max(z.width()-K.w-O-M-$(K.right,"x"),0):K.left!==!1?d+=$(K.left,"x"):d+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?c+=Math.max(z.height()-K.h-N-L-$(K.bottom,"y"),0):K.top!==!1?c+=$(K.top,"y"):c+=Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:e.top,left:e.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:c,left:d},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",b&&b(),setTimeout(function(){z.bind("resize."+f,W.position)},1)},step:function(){g(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=$(a.width,"x")-O-M),a.innerWidth&&(K.w=$(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=$(a.height,"y")-N-L),a.innerHeight&&(K.h=$(a.innerHeight,"y")),!a.innerHeight&&!a.height&&(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position(K.transition==="none"?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(!S)return;var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function q(){n&&r[0].style.removeAttribute("filter")}var b,c,g=y.length,h,i="frameBorder",k="allowTransparency",l,o,p;if(!S)return;l=function(){clearTimeout(V),C.hide(),bb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show();if(g>1){typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||Q<g-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show();if(K.preloading){b=[Z(-1),Z(1)];while(c=y[b.pop()])o=a.data(c,e).href||c.href,a.isFunction(o)&&(o=o.call(c)),_(o)&&(p=new Image,p.src=o)}}else J.hide();K.iframe?(h=Y("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),h.name=f+ +(new Date),K.fastIframe?l():a(h).one("load",l),h.src=K.href,K.scrolling||(h.scrolling="no"),a(h).addClass(f+"Iframe").appendTo(A).one(m,function(){h.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,q):q()},K.transition==="fade"?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||ba(),bb(m),bb(i,K.onLoad),K.h=K.height?$(K.height,"y")-N-L:K.innerHeight&&$(K.innerHeight,"y"),K.w=K.width?$(K.width,"x")-O-M:K.innerWidth&&$(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=$(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=$(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show()},100),K.inline?(Y(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):_(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y(X,"Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y(X,"Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Z(1),W.load())},W.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Z(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,bb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),bb(m),A.remove(),setTimeout(function(){U=!1,bb(l,K.onClosed)},1)}))},W.element=function(){return a(P)},W.settings=d,a("."+g,b).live("click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),bd(this))}),W.init()})(jQuery,document,this);
////////
/*AUTO-COMPLETE*/
jQuery.autocomplete = function (input, options) {
  var me = this;
  var $input = $(input).attr("autocomplete", "off");
  if (options.inputClass) $input.addClass(options.inputClass);
  var results = document.createElement("div");
  var $results = $(results);
  $results.hide().addClass(options.resultsClass).css("position", "absolute");
  if (options.width > 0) $results.css("width", options.width);
  $("body").append(results);
  input.autocompleter = me;
  var timeout = null;
  var prev = "";
  var active = -1;
  var cache = {};
  var keyb = false;
  var hasFocus = false;
  var lastKeyPressCode = null;

  function flushCache() {
    cache = {};
    cache.data = {};
    cache.length = 0;
  };
  flushCache();
  if (options.data != null) {
    var sFirstChar = "",
      stMatchSets = {},
      row = [];
    if (typeof options.url != "string") options.cacheLength = 1;
    for (var i = 0; i < options.data.length; i++) {
      row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);
      if (row[0].length > 0) {
        sFirstChar = row[0].substring(0, 1).toLowerCase();
        if (!stMatchSets[sFirstChar]) stMatchSets[sFirstChar] = [];
        stMatchSets[sFirstChar].push(row);
      }
    }
    for (var k in stMatchSets) {
      options.cacheLength++;
      addToCache(k, stMatchSets[k]);
    }
  }
  $input.keydown(function (e) {
    // track last key pressed
    lastKeyPressCode = e.keyCode;
    switch (e.keyCode) {
    case 38:
      // up
      e.preventDefault();
      moveSelect(-1);
      break;
    case 40:
      // down
      e.preventDefault();
      moveSelect(1);
      break;
    case 9:
      // tab
    case 13:
      // return
      if (selectCurrent()) {
        // make sure to blur off the current field
        $input.get(0).blur();
        $input.get(0).focus();
        $input.get(0).value = $input.get(0).value.replace(" (Event)", "").replace(" (City)", "").replace(" (Venue)", "");
        e.preventDefault();
      }
      break;
    default:
      active = -1;
      if (timeout) clearTimeout(timeout);
      timeout = setTimeout(function () {
        onChange();
      }, options.delay);
      break;
    }
  }).focus(function () {
    hasFocus = true;
  }).blur(function () {
    hasFocus = false;
    hideResults();
  });
  hideResultsNow();

  function onChange() {
    if (lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32)) return $results.hide();
    var v = $input.val();
    if (v == prev) return;
    prev = v;
    if (v.length >= options.minChars) {
      $input.addClass(options.loadingClass);
      requestData(v);
    } else {
      $input.removeClass(options.loadingClass);
      $results.hide();
    }
  };

  function moveSelect(step) {
    var lis = $("li", results);
    if (!lis) return;
    active += step;
    if (active < 0) {
      active = 0;
    } else if (active >= lis.size()) {
      active = lis.size() - 1;
    }
    lis.removeClass("ac_over");
    $(lis[active]).addClass("ac_over");
  };

  function selectCurrent() {
    var li = $("li.ac_over", results)[0];
    if (!li) {
      var $li = $("li", results);
      if (options.selectOnly) {
        if ($li.length == 1) li = $li[0];
      } else if (options.selectFirst) {
        li = $li[0];
      }
    }
    if (li) {
      selectItem(li);
      return true;
    } else {
      return false;
    }
  };

  function selectItem(li) {
    if (!li) {
      li = document.createElement("li");
      li.extra = [];
      li.selectValue = "";
    }
    var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
    input.lastSelected = v;
    prev = v;
    $results.html("");
    $input.val(v);
    hideResultsNow();
    if (options.onItemSelect) setTimeout(function () {
      options.onItemSelect(li)
    }, 1);
  };

  function createSelection(start, end) {
    var field = $input.get(0);
    if (field.createTextRange) {
      var selRange = field.createTextRange();
      selRange.collapse(true);
      selRange.moveStart("character", start);
      selRange.moveEnd("character", end);
      selRange.select();
    } else if (field.setSelectionRange) {
      field.setSelectionRange(start, end);
    } else {
      if (field.selectionStart) {
        field.selectionStart = start;
        field.selectionEnd = end;
      }
    }
    field.focus();
  };

  function autoFill(sValue) {
    if (lastKeyPressCode != 8) {
      $input.val($input.val() + sValue.substring(prev.length));
      createSelection(prev.length, sValue.length);
    }
  };

  function showResults() {
    var pos = findPos(input);
    var iWidth = (options.width > 0) ? options.width : $input.width();
    $results.css({
      width: parseInt(iWidth) + "px",
      top: (pos.y + input.offsetHeight) + "px",
      left: pos.x + "px"
    }).show();
  };

  function hideResults() {
    if (timeout) clearTimeout(timeout);
    timeout = setTimeout(hideResultsNow, 200);
  };

  function hideResultsNow() {
    if (timeout) clearTimeout(timeout);
    $input.removeClass(options.loadingClass);
    if ($results.is(":visible")) {
      $results.hide();
    }
    if (options.mustMatch) {
      var v = $input.val();
      if (v != input.lastSelected) {
        selectItem(null);
      }
    }
  };

  function receiveData(q, data) {
    if (data) {
      $input.removeClass(options.loadingClass);
      results.innerHTML = "";
      if (!hasFocus || data.length == 0) return hideResultsNow();
      if ($.browser.msie) {
        $results.append(document.createElement('iframe'));
      }
      results.appendChild(dataToDom(data));
      if (options.autoFill && ($input.val().toLowerCase() == q.toLowerCase())) autoFill(data[0][0]);
      showResults();
    } else {
      hideResultsNow();
    }
  };

  function parseData(data) {
    if (!data) return null;
    var parsed = [];
    var rows;
    if ($.browser.msie) rows = data.split(',');
    else rows = data.split(',');
    for (var i = 0; i < rows.length; i++) {
      var row = $.trim(rows[i]);
      if (row) {
        parsed[parsed.length] = row.split(options.cellSeparator);
      }
    }
    return parsed;
  };

  function dataToDom(data) {
    var ul = document.createElement("ul");
    var num = data.length;
    if ((options.maxItemsToShow > 0) && (options.maxItemsToShow < num)) num = options.maxItemsToShow;
    for (var i = 0; i < num; i++) {
      var row = data[i];
      if (!row) continue;
      var li = document.createElement("li");
      if (options.formatItem) {
        li.innerHTML = options.formatItem(row, i, num);
        li.selectValue = row[0];
      } else {
        li.innerHTML = row[0];
        li.selectValue = row[0];
      }
      var extra = null;
      if (row.length > 1) {
        extra = [];
        for (var j = 1; j < row.length; j++) {
          extra[extra.length] = row[j];
        }
      }
      li.extra = extra;
      ul.appendChild(li);
      $(li).hover(function () {
        $("li", ul).removeClass("ac_over");
        $(this).addClass("ac_over");
        active = $("li", ul).indexOf($(this).get(0));
      }, function () {
        $(this).removeClass("ac_over");
      }).click(function (e) {
        e.preventDefault();
        e.stopPropagation();
        selectItem(this)
      });
    }
    return ul;
  };

  function requestData(q) {
    if (!options.matchCase) q = q.toLowerCase();
    var data = options.cacheLength ? loadFromCache(q) : null;
    if (data) {
      receiveData(q, data);
    } else if ((typeof options.url == "string") && (options.url.length > 0)) {
      $.get(makeUrl(q), function (data) {
        data = parseData(data);
        addToCache(q, data);
        receiveData(q, data);
      });
    } else {
      $input.removeClass(options.loadingClass);
    }
  };

  function makeUrl(q) {
    var url = options.url + encodeURI(q);
    for (var i in options.extraParams) {
      url += "&" + i + "=" + encodeURI(options.extraParams[i]);
    }
    return url;
  };

  function loadFromCache(q) {
    if (!q) return null;
    if (cache.data[q]) return cache.data[q];
    if (options.matchSubset) {
      for (var i = q.length - 1; i >= options.minChars; i--) {
        var qs = q.substr(0, i);
        var c = cache.data[qs];
        if (c) {
          var csub = [];
          for (var j = 0; j < c.length; j++) {
            var x = c[j];
            var x0 = x[0];
            if (matchSubset(x0, q)) {
              csub[csub.length] = x;
            }
          }
          return csub;
        }
      }
    }
    return null;
  };

  function matchSubset(s, sub) {
    if (!options.matchCase) s = s.toLowerCase();
    var i = s.indexOf(sub);
    if (i == -1) return false;
    return i == 0 || options.matchContains;
  };
  this.flushCache = function () {
    flushCache();
  };
  this.setExtraParams = function (p) {
    options.extraParams = p;
  };
  this.findValue = function () {
    var q = $input.val();
    if (!options.matchCase) q = q.toLowerCase();
    var data = options.cacheLength ? loadFromCache(q) : null;
    if (data) {
      findValueCallback(q, data);
    } else if ((typeof options.url == "string") && (options.url.length > 0)) {
      $.get(makeUrl(q), function (data) {
        data = parseData(data)
        addToCache(q, data);
        findValueCallback(q, data);
      });
    } else {
      findValueCallback(q, null);
    }
  }

  function findValueCallback(q, data) {
    if (data) $input.removeClass(options.loadingClass);
    var num = (data) ? data.length : 0;
    var li = null;
    for (var i = 0; i < num; i++) {
      var row = data[i];
      if (row[0].toLowerCase() == q.toLowerCase()) {
        li = document.createElement("li");
        if (options.formatItem) {
          li.innerHTML = options.formatItem(row, i, num);
          li.selectValue = row[0];
        } else {
          li.innerHTML = row[0];
          li.selectValue = row[0];
        }
        var extra = null;
        if (row.length > 1) {
          extra = [];
          for (var j = 1; j < row.length; j++) {
            extra[extra.length] = row[j];
          }
        }
        li.extra = extra;
      }
    }
    if (options.onFindValue) setTimeout(function () {
      options.onFindValue(li)
    }, 1);
  }

  function addToCache(q, data) {
    if (!data || !q || !options.cacheLength) return;
    if (!cache.length || cache.length > options.cacheLength) {
      flushCache();
      cache.length++;
    } else if (!cache[q]) {
      cache.length++;
    }
    cache.data[q] = data;
  };

  function findPos(obj) {
    var curleft = obj.offsetLeft || 0;
    var curtop = obj.offsetTop || 0;
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
    return {
      x: curleft,
      y: curtop
    };
  }
}
jQuery.fn.autocomplete = function (url, options, data) {
  options = options || {};
  options.url = url;
  options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;
  options.inputClass = options.inputClass || "ac_input";
  options.resultsClass = options.resultsClass || "ac_results";
  options.lineSeparator = options.lineSeparator || "\n";
  options.cellSeparator = options.cellSeparator || "|";
  options.minChars = options.minChars || 1;
  options.delay = options.delay || 400;
  options.matchCase = options.matchCase || 0;
  options.matchSubset = options.matchSubset || 1;
  options.matchContains = options.matchContains || 0;
  options.cacheLength = options.cacheLength || 1;
  options.mustMatch = options.mustMatch || 0;
  options.extraParams = options.extraParams || {};
  options.loadingClass = options.loadingClass || "ac_loading";
  options.selectFirst = options.selectFirst || false;
  options.selectOnly = options.selectOnly || false;
  options.maxItemsToShow = options.maxItemsToShow || -1;
  options.autoFill = options.autoFill || false;
  options.width = parseInt(options.width, 10) || 0;
  this.each(function () {
    var input = this;
    new jQuery.autocomplete(input, options);
  });
  return this;
}
jQuery.fn.autocompleteArray = function (data, options) {
  return this.autocomplete(null, options, data);
}
jQuery.fn.indexOf = function (e) {
  for (var i = 0; i < this.length; i++) {
    if (this[i] == e) return i;
  }
  return -1;
};
/*-------------------------------------------------------------------------------------------------------------*/
function findValueEVC(li) {
	if( li == null ) return alert("No match!");
	// if coming from an AJAX call, let's use the CityId as the value
	if( !!li.extra ) 
	var sValue = li.extra[0];
	// otherwise, let's just display the value in the text box
	else var sValue = li.selectValue.replace(" (Event)","").replace(" (City)","").replace(" (Venue)","");
	//$(this).get(0).value=sValue;
	//alert("The valueEVC: " + sValue);
}
function selectItemEVC(li) {
	findValueEVC(li);
	doSearch();
}
function formatItemEVC(row) {
	return row[0];
}

function findValueE(li) {
	if( li == null ) return alert("No match!");
	// if coming from an AJAX call, let's use the CityId as the value
	if( !!li.extra ) 
	var sValue = li.extra[0];
	//var sValue = li.extra;
	// otherwise, let's just display the value in the text box
	else var sValue = li.selectValue;
	
	//alert("The value you selected was: " + sValueE);
}
function selectItemTextE(li) {
	findValueE(li);
	//alert('a');
	LoadCities('txtEvent','Cities');
}
function formatItemE(row) {
	
	return row[0];
	//return row;
}
/*-------------------------------------------------------------------------------------------------------------*/
$(document).ready(function() {
	$("#text").autocomplete(
		"include/searchquery.php?returnedRecord=50&category=a&searchedWord=",
		{
			delay:10,
			minChars:1,
			matchSubset:0,
			matchContains:0,
			cacheLength:10,
			onItemSelect:selectItemEVC,
			onFindValue:findValueEVC,
			formatItem:formatItemEVC,
			maxItemsToShow:10,
			autoFill:false
		}
	);
	
	$("#txtEvent").autocomplete(
		"include/searchquery.php?returnedRecord=50&category=e&searchedWord=",
		{
			delay:10,
			minChars:1,
			matchSubset:0,
			matchContains:0,
			cacheLength:10,
			onItemSelect:selectItemTextE,
			onFindValue:findValueE,
			formatItem:formatItemE,
			maxItemsToShow:5,
			autoFill:false
		}
	);
});
/*-------------------------------------------------------------------------------------------------------------*/
function doSearch(){
var txtField=document.forms["frmSrch"]["text"];
var txtVal=txtField.value;
if (txtVal=="Type in event, city, venue, date or any combination" || txtVal=="" || txtVal==null){
  txtField.focus();
  return false;
  }
  else{
	//  alert(txtVal);
  var srchAction=LandingURL+"searchresult.php?kwds="+txtVal.replace(" (Event)","").replace(" (City)","").replace(" (Venue)","")+"&category=a&srchtrck="+txtVal.replace(" (Event)","").replace(" (City)","").replace(" (Venue)","");
  //alert(srchAction);
window.location.href=srchAction; 
  }
}
/*-------------------------------------------------------------------------------------------------------------*/
////////
/*NEWSLETTER-SIGNUP*/
function emailvalid(nemailid,nbmsgEr){
	var Email = document.getElementById(nemailid);
	var MsgEr = document.getElementById(nbmsgEr);
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
	if (Email.value.search(emailRegEx) == -1)	{
		//alert('enter valid email');
		MsgEr.className = "nbstatusshow";
		Email.focus();
		return false;
	}
	MsgEr.className = "nbstatushide";
	return true;
}
function signup(nemailid,nbmsgEr,nbmsgWt,nbmsgSu,nsubmit) {
	var Email = document.getElementById(nemailid);
	var MsgEr = document.getElementById(nbmsgEr);
	var MsgWt = document.getElementById(nbmsgWt);
	var MsgSu = document.getElementById(nbmsgSu);
	var BtnSubmit = document.getElementById(nsubmit);
	MsgSu.className = "nbstatushide";
	
	//Email Validation
	if(!emailvalid(nemailid,nbmsgEr))
	return false;
	MsgSu.className = "nbstatushide";
	var xmlhttp;
	if (xmlhttp!=null)
	{
		if (xmlhttp.readyState != 0)
			xmlhttp.abort();
		xmlhttp = null;
	}
	var url="";
	url="include/subscribe.php?emailid="+Email.value;
	MsgWt.className = "nbstatusshow";
	if(window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
		xmlhttp.open("GET",url,false);
		xmlhttp.send(null);
	}
	else if (window.ActiveXObject)	{
		try	{
		  xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
		}	catch(e)	{
			try	{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}	catch(e){}
		}
		if(xmlhttp)	{
			try	{
			xmlhttp.open("GET",url,false);
			xmlhttp.send();
			}	catch(e){}
		}
	}
	MsgWt.className = "nbstatushide";
	MsgSu.className = "nbstatusshow";
	Email.className = "nbdelete"
	BtnSubmit.className = "nbdelete"
	return true; 
}
////////
/*SLIDER*/
(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)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);function removeFilter(element){if(element.style.removeAttribute){element.style.removeAttribute('filter')}}
////////
/*TABLE SORTER*/
(function($){$.extend({tablesorter:new
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addParser({id:"customDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, [0-9]{4}|'?[0-9]{2}$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
////////
/*TABLE-SORTER PAGER*/
(function($){$.extend({tablesorterPager:new function(){function updatePageDisplay(c){var s=$(c.cssPageDisplay,c.container).val((c.page+1)+c.seperator+c.totalPages)}function setPageSize(table,size){var c=table.config;c.size=size;c.totalPages=Math.ceil(c.totalRows/c.size);c.pagerPositionSet=false;moveToPage(table);fixPosition(table)}function fixPosition(table){var c=table.config;if(!c.pagerPositionSet&&c.positionFixed){var c=table.config,o=$(table);if(o.offset){c.container}c.pagerPositionSet=true}}function moveToFirstPage(table){var c=table.config;c.page=0;moveToPage(table)}function moveToLastPage(table){var c=table.config;c.page=(c.totalPages-1);moveToPage(table)}function moveToNextPage(table){var c=table.config;c.page++;if(c.page>=(c.totalPages-1)){c.page=(c.totalPages-1)}moveToPage(table)}function moveToPrevPage(table){var c=table.config;c.page--;if(c.page<=0){c.page=0}moveToPage(table)}function moveToPage(table){var c=table.config;if(c.page<0||c.page>(c.totalPages-1)){c.page=0}renderTable(table,c.rowsCopy)}function renderTable(table,rows){var c=table.config;var l=rows.length;var s=(c.page*c.size);var e=(s+c.size);if(e>rows.length){e=rows.length}var tableBody=$(table.tBodies[0]);$.tablesorter.clearTableBody(table);for(var i=s;i<e;i++){var o=rows[i];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j])}}fixPosition(table,tableBody);$(table).trigger("applyWidgets");if(c.page>=c.totalPages){moveToLastPage(table)}updatePageDisplay(c)}this.appender=function(table,rows){var c=table.config;c.rowsCopy=rows;c.totalRows=rows.length;c.totalPages=Math.ceil(c.totalRows/c.size);renderTable(table,rows)};this.defaults={size:10,offset:0,page:0,totalRows:0,totalPages:0,container:null,cssNext:'.next',cssPrev:'.prev',cssFirst:'.first',cssLast:'.last',cssPageDisplay:'.pagedisplay',cssPageSize:'.pagesize',seperator:"/",positionFixed:true,appender:this.appender};this.construct=function(settings){return this.each(function(){config=$.extend(this.config,$.tablesorterPager.defaults,settings);var table=this,pager=config.container;$(this).trigger("appendCache");config.size=parseInt($(".pagesize",pager).val());$(config.cssFirst,pager).click(function(){moveToFirstPage(table);return false});$(config.cssNext,pager).click(function(){moveToNextPage(table);return false});$(config.cssPrev,pager).click(function(){moveToPrevPage(table);return false});$(config.cssLast,pager).click(function(){moveToLastPage(table);return false});$(config.cssPageSize,pager).change(function(){setPageSize(table,parseInt($(this).val()));return false})})}}});$.fn.extend({tablesorterPager:$.tablesorterPager.construct})})(jQuery);
////////
/*TABBED GRID/ ADVANCEDSEARCH*/


function showData(city, name, tagID, DateFilter) {
	
	
	
	if (DateFilter.length != 0) {
    var mySplitResult = DateFilter.split("|", 2);
    BeginDate = mySplitResult[0];
    EndDate = mySplitResult[1];
  }
  if (city.length == 0) {
    document.getElementById(tagID).innerHTML = "";
    return;
  }
		$("#gridtix").addClass("show");
  $("#context").empty();
  $.get("include/getGrid.php?kw=" + name + "&cityname=" + encodeURIComponent(city) + "&begindate=" + BeginDate + "&enddate=" + EndDate, function (html) {
    $("#context").append(html);
  }).success(function () {
		$("#refine").css('display','block');
		$("#refine").addClass('showData');
    $("#gridtix").removeClass("show");
    $("#gridtable").tablesorter({
      headers: {
        0: {          sorter: false
        },
        2: {
          sorter: false
        },
        1: {
          sorter: 'customDate'
        }
      }
    }).tablesorterPager({
      container: $("#pager")
    });
    $("#gridtableVs").tablesorter({
      headers: {
        0: {
          sorter: false
        },
        2: {
          sorter: 'customDate'
        },
        3: {
          sorter: false
        }
      }
    }).tablesorterPager({
      container: $("#pager")
    });	
				
    var loopCounter = 1;
    $(".more_tabs ul li").each(function () {
      $(this).click(function () {
        if (loopCounter == 1) {
          var tmpHTML = $("#tabs ul li:nth-child(3)").html();
          $("#tabs ul li:nth-child(3)").html($(this).html());
          $(this).html(tmpHTML);
          loopCounter = 2;
        }
      });
    });
				
    $("#tabContainer a").bind('click', function () {
      $(".more_tabs").slideUp('fast');
      $("#gridtix").addClass("show");
    });
    $("#tabs li a").removeClass("selected");
    $(".more_tabs li a").removeClass("selected");
    $("#tabs li a").each(function () {
      var cName = $(this).html();
      if (cName == city) {
        $(this).addClass("selected");
      }
    });
  }).error(function () {
    $("#gridtix").removeClass("show");
    $("#context").append("<div class=\"sorry\"><p>Sorry, there are no tickets for " + city + " based on the filter you selected.</p></div>");
				
    var loopCounter = 1;
    $(".more_tabs ul li").each(function () {
      $(this).click(function () {
        if (loopCounter == 1) {
          var tmpHTML = $("#tabs ul li:nth-child(3)").html();
          $("#tabs ul li:nth-child(3)").html($(this).html());
          $(this).html(tmpHTML);
          loopCounter = 2;
        }
      });
    });
				
    $("#tabs li a").removeClass("selected");
    $(".more_tabs li a").removeClass("selected");
    $("#tabs li a").each(function () {
      var cName = $(this).html();
      if (cName == city) {
        $(this).addClass("selected");
      }
    });
  })
  //.complete(function() { alert("complete"); });
  CityName = city;
  EventName = name;
  
}
function showData_SearchEvent(city,searchTerms, tagID, DateFilter) {
BeginDate="";
EndDate="";

	if (DateFilter.length != 0) {
    var mySplitResult = DateFilter.split("|", 2);
    BeginDate = mySplitResult[0];
    EndDate = mySplitResult[1];
  }

	$("#gridtix").addClass("show");
  $("#context").empty();
  $.get("include/getGrid.php?searchTerms=" + searchTerms + "&cityname=" +encodeURIComponent(city)+ "&scheme=SearchEvents&begindate=" + BeginDate + "&enddate=" + EndDate, function (html) {
    $("#context").append(html);
  }).success(function () {
		$("#refine").css('display','block');
		$("#refine").addClass('showData_SearchEvent');
    $("#gridtix").removeClass("show");
    $("#gridtable").tablesorter({
      headers: {
        0: {
          sorter: false
        },
        2: {
          sorter: false
        },
        1: {
          sorter: 'customDate'
        }
      }
    }).tablesorterPager({
      container: $("#pager")
    });
    $("#gridtableVs").tablesorter({
      headers: {
        0: {
          sorter: false
        },
        2: {
          sorter: 'customDate'
        },
        3: {
          sorter: false
        }
      }
    }).tablesorterPager({
      container: $("#pager")
    });		
				
    var loopCounter = 1;
    $(".more_tabs ul li").each(function () {
      $(this).click(function () {
        if (loopCounter == 1) {
          var tmpHTML = $("#tabs ul li:nth-child(3)").html();
          $("#tabs ul li:nth-child(3)").html($(this).html());
          $(this).html(tmpHTML);
          loopCounter = 2;
        }
      });
    });
				
    $("#tabContainer a").bind('click', function () {
      $(".more_tabs").slideUp('fast');
      $("#gridtix").addClass("show");
    });
    $("#tabs li a").removeClass("selected");
    $(".more_tabs li a").removeClass("selected");
    $("#tabs li a").each(function () {
      var cName = $(this).html();
      if (cName == city) {
        $(this).addClass("selected");
      }
    });
  }).error(function () {
    $("#gridtix").removeClass("show");
    $("#context").append("<div class=\"sorry\"><p>Error Sorry, there are no tickets for " + city + " based on the filter you selected.</p></div>");
				
    var loopCounter = 1;
    $(".more_tabs ul li").each(function () {
      $(this).click(function () {
        if (loopCounter == 1) {
          var tmpHTML = $("#tabs ul li:nth-child(3)").html();
          $("#tabs ul li:nth-child(3)").html($(this).html());
          $(this).html(tmpHTML);
          loopCounter = 2;
        }
      });
    });
				
    $("#tabs li a").removeClass("selected");
    $(".more_tabs li a").removeClass("selected");
    $("#tabs li a").each(function () {
      var cName = $(this).html();
      if (cName == city) {
        $(this).addClass("selected");
      }
    });
  })
  //.complete(function() { alert("complete"); });
 
  _SearchTerms=searchTerms;
  EventName=searchTerms;
   CityName = city;
}

function LoadCities(e,controlID){
	
	
	$("#adwait").removeClass("hide");
	$("#adwait").addClass("show");
	
	//Clear the options
	// your form
    /*for (var loop=0; loop <  document.getElementById(controlID).options.length; loop++) {
		
      document.getElementById(controlID).remove(loop); // remove the option
	 
     alert(loop);
	 }*/
	 document.getElementById(controlID).options.length = 0;
	// alert(document.getElementById(controlID).options.length);
/////////////////////////////
	if (e.length == 0) {
    document.getElementById(controlID).innerHTML = "";
	
    return;
  }
 //alert('i am in else');
	 
	   if (window.XMLHttpRequest) {
    xmlhttp = new XMLHttpRequest();
  } else {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      //document.getElementById(controlID).innerHTML = xmlhttp.responseText;
	  var response= xmlhttp.responseText;
	  
	  //alert(response);
	  var mySplitResult = response.split(",");
	   document.getElementById(controlID).options[0]=new Option("ALL","ALL", true, false);
	  for (i = 1; i <= mySplitResult.length; i++)
		{
			//alert(mySplitResult[i]);
			
			document.getElementById(controlID).options[i]=new Option(mySplitResult[i-1], mySplitResult[i-1], false, false);

		}
		LoadVenues(e,document.getElementById(controlID).options[0],'Venues');
		$("#adwait").removeClass("show");
	    $("#adwait").addClass("hide");
	   } else {
     
      document.getElementById(controlID).options[0]=new Option("", 0, true, false)
    }
  }//end of readystatefunction
//alert("include/searchquery.php?searchedWord=" + document.getElementById(e).value.replace(" (Event)","")+"&category=c");
 xmlhttp.open("GET", "/include/searchquery.php?searchedWord=" + document.getElementById(e).value.replace(" (Event)","")+"&category=c", true);
  xmlhttp.send();
}// end of LoadCities
function LoadVenues(e,c,controlID)
{  

    $("#adwait").removeClass("hide");
	$("#adwait").addClass("show");

  
   if (window.XMLHttpRequest) {
    xmlhttp = new XMLHttpRequest();
  } else {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		
		var response= xmlhttp.responseText;
	  
	  var mySplitResult = response.split(",");
	  
	   document.getElementById(controlID).options[0]=new Option("ALL", "ALL", true, false)
	   
	  for (i = 1; i <= mySplitResult.length; i++)
		{
			//alert(mySplitResult[i]);
			
			document.getElementById(controlID).options[i]=new Option(mySplitResult[i-1], mySplitResult[i-1], false, false)

		}
		
		$("#adwait").removeClass("show");
	$("#adwait").addClass("hide");
	} else {
     document.getElementById(controlID).options[0]=new Option("", 0, true, false)
    }
  }//end of readystatefunction

 xmlhttp.open("GET", "include/searchquery.php?searchedWord=" + document.getElementById(e).value.replace(" (Event)","")+"&searchedCity="+encodeURIComponent(c.text)+"&category=v", true);
  xmlhttp.send();
	
}// end of LoadVenues
function getCityList(name, tagID) {
  if (name.length == 0) {
    document.getElementById(tagID).innerHTML = "";
    return;
  }
  if (window.XMLHttpRequest) {
    xmlhttp = new XMLHttpRequest();
  } else {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      document.getElementById(tagID).innerHTML = xmlhttp.responseText;
      $("#gridtix").removeClass("show");
      $("#tabs li:first-child a").attr('class', 'selected').trigger('click');
      $("#tabs li.more").click(function () {
        $(".more_tabs").slideDown('fast').show();
        $(".more_tabs").parent().hover(function () {}, function () {
          $(".more_tabs").slideUp('slow');
        });
      });
    } else {
      $("#gridtix").addClass("show");
      document.getElementById(tagID).innerHTML = " ";
    }
  }
  xmlhttp.open("GET", "include/getCityList.php?kw=" + name, true);
  xmlhttp.send();
}
function find(dateIndex)
{alert(dateIndex);
	
}
function getCheckedValue(radioObj) {
  if (!radioObj) return "";
  var str = "";
  var StartDate = new Date();
  var EndDate = new Date();
  var radioLength = radioObj.length;
  if (radioLength == undefined) if (radioObj.checked) return radioObj.value;
  else return "";
  for (var i = 0; i < radioLength; i++) {
    if (radioObj[i].checked) {
      str = radioObj[i].value;
    }
  }
  return str;
}

function getDateRange(dRangeid)
{  

var str="";
try{
   
   if(dRangeid == "dRange")
   {
	var dIndex=document.getElementById(dRangeid).selectedIndex;
	str=document.getElementById(dRangeid).options[dIndex].text;
   }
   else if(dRangeid =="dates")
   {
	   
	   str=getCheckedValue(document.forms['radioForm'].elements[dRangeid]);
	  //alert(str);
   }
}// end of try
catch(e){}
	//alert('me here');
  switch (str) {
  case 'All Date':
  {
    StartDate = new Date();
	var sDate="";
    var month1 = parseInt(StartDate.getMonth()) + 1;
	if(month1<10)
	{ month1='0' + month1;
	}
	sDate=StartDate.getDate();	
	if(sDate<10)
	{sDate='0'+sDate;
	}
    return month1 + '/' + sDate  + '/' + StartDate.getFullYear() + '|';
	//return "";
	
    break;
  }
  case 'Today':
    {
      StartDate = new Date();
      EndDate = new Date();
      EndDate.setDate(StartDate.getDate() + 1);
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + StartDate.getDate() + '/' + StartDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();
      break;
	}
  case 'This Week':
   {
	   StartDate = new Date();
      EndDate = new Date();
      var today = new Date();
      var day = today.getDate();
      var month = today.getMonth() + 1;
      var year = today.getYear();
      if (year < 2000) year = year + 1900;
      var offset = today.getDay();
      var week;
      if (offset != 0) {
        day = day - offset;
        if (day < 1) {
          if (month == 1) day = 31 + day;
          if (month == 2) day = 31 + day;
          if (month == 3) {
            if ((year == 00) || (year == 04)) {
              day = 29 + day;
            } else {
              day = 28 + day;
            }
          }
          if (month == 4) day = 31 + day;
          if (month == 5) day = 30 + day;
          if (month == 6) day = 31 + day;
          if (month == 7) day = 30 + day;
          if (month == 8) day = 31 + day;
          if (month == 9) day = 31 + day;
          if (month == 10) day = 30 + day;
          if (month == 11) day = 31 + day;
          if (month == 12) day = 30 + day;
          if (month == 1) {
            month = 12;
            year = year - 1;
          } else {
            month = month - 1;
          }
        }
      }
      week = month + "/" + day + "/" + year; // i.e. 10-31-99
      day = parseInt(day) + 1;
      StartDate = new Date(year, month, day);
      //StartDate.setFullYear(year,month,day);
      EndDate.setDate(StartDate.getDate() + 7);
	  var month1=StartDate.getMonth();
      var month2 = parseInt(EndDate.getMonth()) + 1;
	  if(month1<10)
		{ month1='0' + month1;
		}
		if(month2<10)
		{ month2='0' + month2;
		}
		var sDate=StartDate.getDate();
		var eDate=EndDate.getDate();
		if(sDate<10)
		{sDate='0'+sDate;
		}
		if(eDate<10)
		{eDate='0'+eDate;
		}
      return month1 + '/' +  sDate + '/' + StartDate.getFullYear() + '|' + month2 + '/' + eDate + '/' + EndDate.getFullYear();	 
      break;
   }
	 case 'This Weekend':
   {
	   StartDate = new Date();
      EndDate = new Date();
      var today = new Date();
      var day = today.getDate();
      var month = today.getMonth() + 1;
      var year = today.getYear();
      if (year < 2000) year = year + 1900;
      var offset = today.getDay();
      var week;
      if (offset != 0) {
        day = day - offset;
        if (day < 1) {
          if (month == 1) day = 31 + day;
          if (month == 2) day = 31 + day;
          if (month == 3) {
            if ((year == 00) || (year == 04)) {
              day = 29 + day;
            } else {
              day = 28 + day;
            }
          }
          if (month == 4) day = 31 + day;
          if (month == 5) day = 30 + day;
          if (month == 6) day = 31 + day;
          if (month == 7) day = 30 + day;
          if (month == 8) day = 31 + day;
          if (month == 9) day = 31 + day;
          if (month == 10) day = 30 + day;
          if (month == 11) day = 31 + day;
          if (month == 12) day = 30 + day;
          if (month == 1) {
            month = 12;
            year = year - 1;
          } else {
            month = month - 1;
          }
        }
      }
      week = month + "/" + day + "/" + year; // i.e. 10-31-99
      day = parseInt(day) + 1;
      StartDate = new Date(year, month, day);
      //StartDate.setFullYear(year,month,day);
      EndDate.setDate(StartDate.getDate() + 7);
      var month2 = parseInt(EndDate.getMonth()) + 1;
	  StartDate.setDate(EndDate.getDate() -2);
      return month2 + '/' + StartDate.getDate()+ '/' + EndDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();	 
      break;
   }
   case 'Next 3 Days':
   { 
      StartDate = new Date();
      EndDate = new Date();
	  EndDate.setDate(StartDate.getDate() + 3);
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + StartDate.getDate() + '/' + StartDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();
	   break;
   }
	 case 'Next 7 Days':
   { 
      StartDate = new Date();
      EndDate = new Date();
	  EndDate.setDate(StartDate.getDate() + 8);
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + StartDate.getDate() + '/' + StartDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();
	   break;
   }
    case 'Next 30 Days':
   { 
      StartDate = new Date();
      EndDate = new Date();
	  EndDate.setDate(StartDate.getDate() + 31);
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + StartDate.getDate() + '/' + StartDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();
	   break;
   }
    case 'Next 6 Months':
   { 
      StartDate = new Date();
      EndDate = new Date();
	  EndDate.setDate(StartDate.getDate() + 180);
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + StartDate.getDate() + '/' + StartDate.getFullYear() + '|' + month2 + '/' + EndDate.getDate() + '/' + EndDate.getFullYear();
	   break;
   }
  case 'This Month':
    {
      //var ds = String(StartDate.getMonth()+1)+'/0/'+String(StartDate.getFullYear());
      StartDate = new Date();
      EndDate = new Date();
      var month1 = parseInt(StartDate.getMonth()) + 1;
      var dd = new Date(StartDate.getFullYear(), month1, '0');
      //return dd.getDate();  
	 if(month1<10)
	{ month1='0' + month1;
	}
	EndDate.setDate(StartDate.getDate() + 30);
	var month2 = parseInt(EndDate.getMonth()) + 1;
      return month1 + '/' + '01' + '/' + StartDate.getFullYear() + '|' + month2 + '/' + '01'+ '/' +  EndDate.getFullYear();
      break;
    }
  case 'This Year':
    {
      StartDate = new Date();
      EndDate = new Date();
      return '01' + '/' + '01' + '/' + StartDate.getFullYear() + '|' + 12 + '/' + 31 + '/' + EndDate.getFullYear();
      break;
    }
  default:
    return "";
  } //end of Switch
  return "";
}
