// force strict to get Firefox/Chrome to see IE errors
//"use strict";

$(document).ready(function() { // As soon as the document loads, do this...
	//doQuickly(); //empty...
	loadScripts();
	$('#tabWrapper').tabs();
});

function doQuickly() {
	//killFrames();
}

function killFrames() {
	// If the page is loaded in a frame, bypass the frame and reload in the top of the browser.
	if (top != self) {
		top.location.href = self.location.href
	}
}

function loadScripts() {
	// Load script files and jQuery plugins separate from the HTML. 
	// http://plugins.jquery.com/project/xLazyLoader
	$.xLazyLoader({
		css: [
			'/resources/.template/includes/calendar/calendar-dcvb.css'
		],
		js: [
//js files for trip planner
                        'http://www.durham-nc.com/resources/.template/includes/video/flowplayer-3.1.0.min.js',
//                        'http://www.durham-nc.com/resources/.template/includes/calendar/calendar.js',
//                        'http://www.durham-nc.com/resources/.template/includes/calendar/calendar-setup.js',
//                        'http://www.durham-nc.com/resources/.template/includes/calendar/calendar-en.js',
//                        'http://www.durham-nc.com/resources/.template/includes/calendar/calendar-extras.js',
                        '/resources/.template/redesign/includes/jquery.ellipsis.js',
                        '/resources/.template/redesign/includes/cookie/jquery.cookie.js',
                        '/resources/.template/redesign/includes/cookie/jquery.json.js',
                        '/resources/.template/redesign/includes/cookie/trip-planner.js',
                        '/resources/.template/includes/swfobject.js',
			'/resources/.template/redesign/includes/jquery.url.packed.js',
//js files for sliders
                        '/resources/.template/redesign/includes/jquery.cycle.all.min.js',
			'/resources/.template/redesign/includes/jquery.tabSlideOut.v1.3.js',
			'/resources/.template/redesign/includes/fancybox/jquery.fancybox-1.3.4.pack.js',
//script to create ellipsis on long lines
			'/resources/.template/redesign/includes/jquery.autoEllipsis.min.js'
			// '/resources/.template/redesign/includes/jquery.ThreeDots.min.js'
		],
		img: [
//			'/resources/.template/images/widget-packages.jpg'
		],
		/*
		name: '',
		*/
		success: function() {
			modifyHtml();
			homepageSlider();
			landingPageSlider();
			accoladesSlider();
			//accoladesEllipsis();
			//eventsEllipsis();
			liveChatDrawer();
			customizeBySection(''); 
			setView('');
			moveReviewContent('');
			showForm(''); 
		},
		error: function(){
     
     if(window.console && window.console.log) {
				window.console.log('There was an error with the $.xLazyLoader() function in scripts-global.js.  Please look into this');
			}
			
		},
		each: function(url){
			
		}
	
	});
}


/*
function accoladesEllipsis() {
	$('.accData p').ThreeDots({
		max_rows: 1,
		ellipsis_string: '<a href="google.com">(click here)</a>'
	});
}

function eventsEllipsis() {
	$('p.item-description').ThreeDots({
		max_rows: 1,
		ellipsis_string: '<a href="google.com">(click here)</a>'
	});
}
*/




/**
 * Modify HTML in document
 *
 * This script is a simple collection of jQuery functions that add
 * helpful classes and other things throughout the document.
 * 
 * @example: adding "first" and "last" classes to list items
 * @example: adding tier classes to embedded lists. 
 *
 */
function modifyHtml() {
	// For each list, mark up the first and last items.
	$('ul,ol,dl').each(function() {
		$(this).children('li:first,dt:first').addClass('first');
		$(this).children('li:last,dt:last').addClass('last');
	});
	$('ul').addClass('tier1');
	$('ul ul').each(function() {
		$(this).removeClass('tier1');
		$(this).addClass('tier2');			//----> ERROR: Obj error
	});
	$('ul ul ul').each(function() {
		$(this).removeClass('tier2');
		$(this).addClass('tier3');
	});
	
	$('#logo').append('<div id="printContacts" class="forPrint"><p>Durham Convention & Visitors Bureau<br />101 East Morgan Street, Durham, NC 27701<br />toll free: (800) 446-8604 | local: (919) 687-0288</p></div>');
	$('#logo').append('<div id="printUrl" class="forPrint"><span class="label">Find this page at: </span><br /><span class="url">' + window.location + '</span></div>');
	
	$('#listings div.item:even').each(function() {
		$(this).addClass('even');
	});
	$('#listings div.item:odd').each(function() {
		$(this).addClass('odd');
	});
	
	// Insert a listing's URL before the description.
	$('#listings .url').each(function() {
		// Add zero-width non-joiner character after each URL slash to allow IE to wrap URLs.
		var orgUrl = $(this).attr('href');
		orgUrl = orgUrl.replace(/\//g,'/&#8203;');
		var $insertionPoint;
		var $itemName = $(this).closest('.item-name');
		var $tel = $itemName.siblings('.tel');
		var $adr = $itemName.siblings('.adr');
		if($tel.length) {
			$insertionPoint = $tel;
		} else if($adr.length) {
			$insertionPoint = $adr;
		} else {
			$insertionPoint = $itemName;
		}
		$insertionPoint.after('<div class="item-url forPrint">' + orgUrl + '</div>');
	});
	
	if($('#start').length) {
		setupCalendar();
	}

	//Check to see if sponsor div is empty
	$('#sponsorFeature:empty').css('display', 'none');
	$('#pageInner #landingSlider:empty').css('display', 'none');
	$('#pageInner #sliderPager:empty').css('display', 'none');
}


function customizeBySection(sectionName) {
	// Mark up the body tag with the section name (top-level directory) to uniquely style child tags.
	// http://plugins.jquery.com/project/url_parser
	if(sectionName.length > 0) {
		$('body').addClass(sectionName);
	} else {
		//$('body').addClass(jQuery.url.segment(0)); //--> simple issue, "jQuery" must be references with "$" in this file for IE to work.
		$('body').addClass($.url.segment(0));
	}
}

//MOVE REVIEW CONTENT INTO TAB DIV
function moveReviewContent() {
//var reviewContentH2 = $('.reviewTab h2').html();
//$('.reviewTabDisplayH2').html(reviewContentH2);
var reviewContent = $('.reviewTab').html();
$('div#tabs-2').html(reviewContent);
}

//SWITCH TABS ON LOCATION PAGES
function switchTabs() {
        //onclick show the appropriate form
        //click on .buttons a, find the child div and change css to display:display
        $('#tabWrapper li').click(function () {
		//remove active class - make all tabs temporarily display:none
                $removeActive = $(this).parent().parent().get(0).tagName;
	      	$($removeActive).removeClass('active');
	//add active class to div that corressponds to the click li
		//find class of click li's anchor
		$classToMatch = $(this).children('a').attr('class');
//		console.log($classToMatch);
		//find div with same class
		//add active class to match	
//                $visibleTab = $(this).parent().parent().children('div');
//		console.log($visibleTab);
		$('#tabWrapper li '+ $classToMatch).addClass('active');
    });
}

function switchTabs2() {
		
}


//SHOW FORM FIELDS ON TRIP PLANNER
function showForm() {
	//onclick show the appropriate form
	//click on .buttons a, find the child div and change css to display:display
	$('.buttons').click(function () {
		$(this + '.tripPlanner .buttons div').removeClass('active');
		$(this).children('div').addClass('active');
    });
}

//SUBMIT BUTTON ON TRIP PLANNER
function setView() {
	//onclick set the view of the hidden input to email or text and submit form
	//if you click email button set the value of the value attribute of the 'view' hidden input to get the class of the email button
	$('.tpButton').click(function () {  
	    //get (and store) id name
             	$viewValue = (this.id);
       	    //set hidden 'value' value to id value	
		$('.viewSetter').attr('value', $viewValue);
		//console.log($('.viewSetter').attr('value'));
		$('.emailForm').submit();
    });  
}


//Dreamweaver Behaviors
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function translate()
   {
   var w = document.langForm.langOptions.selectedIndex;
   var url_add = document.langForm.langOptions.options[w].value;
   window.location.href = url_add;
   }

//HOMEPAGE SLIDER FUNCTION
function createHomePager() {
	/**
	 * Appending <span> elements with the image alts
	 * 
	 * The easy way to do this is simply to add the <span>
	 * directly after the <img> inside the already existing
	 * slider, that way the existing sliders will take care of 
	 * all of the animation.
	 */
	
	// find all of the <a> which will be image parents
	var links = $('#slider').find("a");
	
	// loop the <a> and get the child <img> alt, then add the span
	$(links).each(function() {
		//console.log("this is:" + this); //--> what is "this" in this context?
		var img_alt = $(this).children().attr("alt");
		//console.log("img_alt is: " + img_alt);
		// we don't want undefined
		if(img_alt !== undefined) { 
			// otherwise, add the span
			$(this).append("<span>" + img_alt + "</span>");
		}
	});
	
}
function homepageSlider() {
        createHomePager();
/**
 * Multi-Sliders
 * 
 * This code will create sliders within sliders.  
 * The parent slider will wait for child sliders to finish
 * moving before continuing to slide itself.  
 * 
 */


   // init and stop the inner slideshows  
   var inners = $('.inner-sliders').cycle().cycle('stop');  //--> IE will not handle this condensed version.

   //var inners = $('.inner-sliders').cycle();
   //inners.cycle().cycle('stop');
 
   // test   
   //console.log("inners is instance of: " + inners.constructor.prototype); //--> This will debug, but user defined objects not helpful.
   //console.log("inners again: " + Object.getPrototypeOf(inners)); //--> IE8 does not support this.

 
    // setup the main slideshow
    var slideshow = $('#slider').cycle({
        
        pause: true,
        speed: 300,
        timeout: 3000,
        prev: '#prev',
        next: '#next',
        pauseOnPagerHover: true,
        pager: '#sliderPager',
        pagerEvent: 'mouseover',
		pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#sliderPager li:eq(' + (idx) + ') a';
        },
        before: function() {
            
            // stop all inner slideshows
            // this is important as it will be called frequently
            inners.cycle('stop');
            
            // NOTE:::: due to our appending <span> with text in it, we need to check for 2, not 1 child
            // need more than 1 child.  			
            // we don't want cycles to terminate,
            // and we also don't want to consider text nodes
            if ($(this).children().length > 2) {
	           
	            // start a slideshow based on this 
	            // (which is an html element like a div)
	            $(this).cycle({
	                fx: 'fade',
	                pause: true,
	                timeout: 2000,
	                autostop: true,
	                before: function() {
	                	// pause the parent slider before
	                	// we start this slider
	                	$('#slider').cycle('pause');
	                },
	                end: function() {
	                	// play the parent slider
	                	// once this slider is done
	                	slideshow.cycle('resume');
	                   
	                }
	            });
            	
            } // end if($(this).children().length > 1)
            
        } // end before:
        
    });   // end #("#slider").cycle()

    // Pager links are intercepted by cycle plugin so re-enable links.
    $('#sliderPager a').click(function(){
    	window.location.href = $(this).attr('href');
    });
}	


//INTERIOR SLIDER FUNCTION
function createLandingPager() {
	// Create pager links by creating modified copies of the slider elements. You must create the pager elements before invoking "cycle".
    $('#landingSlider a').each(function() {
		var linkText = $(this).find('img').attr('alt');
    	$(this).clone().html(linkText).appendTo('#sliderPager');
    });
}

function landingPageSlider() {
	createLandingPager();
	// http://jquery.malsup.com/cycle/options.html
    $('#landingSlider p').cycle({
        fx:     'fade',
        speed:  'fast',
        timeout: 3000,
        pager:  '#sliderPager',
		pagerEvent: 'mouseover',
		pauseOnPagerHover: true,
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#sliderPager a:eq(' + (idx) + ')';
        }
    });
    
    // Pager links are intercepted by cycle plugin so re-enable links.
    $('#sliderPager a').click(function(){
    	window.location.href = $(this).attr('href');
    });
}

//ACCOLADES SLIDER FUNCTION
function accoladesSlider() {
	// elipsis must run first for this to work
	//$("#accData p").ellipsis();

	// http://jquery.malsup.com/cycle/options.html
    $('#sliderAccolades').cycle({
        fx:     'fade',
        speed:  'fast',
        timeout: 3000
     });
    $(".ellipsis").ellipsis();

/*   
     //Does Ellipsis exist?
     if(console) {i
	console.log("True! Console exists.");
  	   if($.isFunction($.fn.ellipsis)) {
  	   	console.log("Ellipsis exists.");
        }
     }
*/
}

//ELLIPSIS FUNCTION
(function($) {
        $.fn.ellipsis = function()
        {
                return this.each(function()
                {
                        var el = $(this);
			
			// Moving these up for validation
			// not allowed within if block below
			function height() {return t.height() > el.height();};
			function width() {return t.width() > el.width();};

                        if(el.css("overflow") == "hidden")
                        {
                                var text = el.html();
                                var multiline = el.hasClass('multiline');
                                var t = $(this.cloneNode(true))
                                        .hide()
                                        .css('position', 'absolute')
                                        .css('overflow', 'visible')
                                        .width(multiline ? el.width() : 'auto')
                                        .height(multiline ? 'auto' : el.height())
                                        ;

                                el.after(t);
				
				// NAUGHTY! - not in if block
                                //  function height() { return t.height() > el.height(); };
                                //  function width() { return t.width() > el.width(); };       // ERROR: Can't declare functions within if (strict)

                                var func = multiline ? height : width;

                                while (text.length > 0 && func())
                                {
                                        text = text.substr(0, text.length - 1);
                                        t.html(text + "...");
                                }

                                el.html(t.html());
                                t.remove();
                        }
                });
        };
})(jQuery);

//LIVE CHAT FUNCTION - this function makes a tab appear after "delay" has passed to prompt user to use 'Live Chat'  
function liveChatDrawer() {
	// http://plugins.jquery.com/project/tab-slide-out
	$('.slide-out-div').tabSlideOut({
		tabHandle: '.handle', //class of the element that will be your tab
		pathToTabImage: '/resources/.template/redesign/images/contact-tab.png', //path to the image for the tab (optionaly can be set using css)
		imageHeight: '344px', //height of tab image
		imageWidth: '28px', //width of tab image    
		tabLocation: 'right', //side of screen where tab lives, top, right, bottom, or left
		speed: 300, //speed of animation
		action: 'click', //options: 'click' or 'hover', action to trigger animation
		topPos: '150px', //position from the top
	        //leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
		fixedPosition: true //options: true makes it stick(fixed position) on scroll
	});
	$('.slide-out-div').delay(3000).fadeIn(400);
}
function liveChatPopUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=480,left = 445,top = 185');");
}



// LOTS OF FUNCTIONS THAT WE'RE UNSURE OF THE ORIGINS ??
function templateCalendar() {
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="234" height="136" id="Durhamnc" align="middle" >\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="/resources/calendar/DurhamncCalendar.swf" /><param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#B98A57" />');
    document.write('<param name="wmode" value="transparent" />\n');
	document.write('<embed src="/resources/calendar/DurhamncCalendar.swf" quality="high" bgcolor="#B98A57" wmode="transparent" width="234" height="136" name="Durhamnc" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function backButton() {
	document.write('<a href="javascript:history.go(-1);" onmouseover="self.status=document.referrer;return true;">&lt;&lt; Go Back</a>');
	}

function searchAppliance() {
	document.write('<form method="get" action="http://search.durham-nc.com/search">');
    document.write('<input type="hidden" name="site" value="default_collection" />');
    document.write('<input type="hidden" name="client" value="default_frontend" />');
    document.write('<input type="hidden" name="proxystylesheet" value=" default_frontend" />');
    document.write('<input type="hidden" name="output" value="xml_no_dtd" />');
    document.write('<input name="q" type="text" id="query" value="" />');
	document.write('<input name="btnG" type="image" id="Search" value="Google Search" src="http://www.durham-nc.com/images/template/go-button.gif" alt="Go" />');
    document.write('</form>');
	}

function initDate()
{
	var now = new Date();
	var mth = now.getMonth();
	var dd = now.getDate();
	var yy = now.getFullYear();
	if (mth <10)
	{
		mth == 0 + mth;
	}
	if (dd <10)
	{
		dd == 0 + dd;
	}
	if ((mth==11) && (dd>=29)) {
/*		document.resrvForm.doa_mm.selectedIndex = mth;
		document.resrvForm.doa_dd.selectedIndex = dd - 1;
		document.resrvForm.dod_yy.value= yy;
		document.resrvForm.dod_dd.selectedIndex = dd - dd;
		document.resrvForm.dod_mm.selectedIndex = mth-mth;
		document.resrvForm.dod_yy.value= yy+1;*/
		document.getElementById('CB_frommonth').selectedIndex = mth;
		document.getElementById('CB_fromdate').selectedIndex = dd - 1;
		document.getElementById('CB_todate').selectedIndex = dd - dd;
		document.getElementById('CB_tomonth').selectedIndex = mth-mth;
		document.getElementById('AIR_frommonth').selectedIndex = mth;
		document.getElementById('AIR_fromdate').selectedIndex = dd - 1;
		document.getElementById('AIR_todate').selectedIndex = dd - dd;
		document.getElementById('AIR_tomonth').selectedIndex = mth-mth;
		document.getElementById('CAR_frommonth').selectedIndex = mth;
		document.getElementById('CAR_fromdate').selectedIndex = dd - 1;
		document.getElementById('CAR_todate').selectedIndex = dd - dd;
		document.getElementById('CAR_tomonth').selectedIndex = mth-mth;
	}
	else if ((dd>=29 ) || ((dd>=27 ) && (mth==1)))
	{
/*		document.resrvForm.doa_mm.selectedIndex = mth+1;
		document.resrvForm.doa_dd.selectedIndex = dd-dd;
		document.resrvForm.doa_yy.value= yy;
		document.resrvForm.dod_dd.selectedIndex = (dd-dd)+1;
		document.resrvForm.dod_mm.selectedIndex = mth + 1;
		document.resrvForm.dod_yy.value= yy;*/
		document.getElementById('CB_frommonth').selectedIndex = mth+1;
		document.getElementById('CB_fromdate').selectedIndex = dd-dd;
		document.getElementById('CB_todate').selectedIndex = (dd-dd)+1;
		document.getElementById('CB_tomonth').selectedIndex = mth + 1;
		document.getElementById('AIR_frommonth').selectedIndex = mth+1;
		document.getElementById('AIR_fromdate').selectedIndex = dd-dd;
		document.getElementById('AIR_todate').selectedIndex = (dd-dd)+1;
		document.getElementById('AIR_tomonth').selectedIndex = mth + 1;
		document.getElementById('CAR_frommonth').selectedIndex = mth+1;
		document.getElementById('CAR_fromdate').selectedIndex = dd-dd;
		document.getElementById('CAR_todate').selectedIndex = (dd-dd)+1;
		document.getElementById('CAR_tomonth').selectedIndex = mth + 1;
	}
	else
	{
/*		document.resrvForm.doa_mm.selectedIndex=mth;
		document.resrvForm.doa_dd.selectedIndex=dd+1;
		document.resrvForm.dod_yy.value= yy;
		document.resrvForm.dod_mm.selectedIndex=mth;
		document.resrvForm.dod_dd.selectedIndex=dd+3;
		document.resrvForm.dod_yy.value= yy;*/
		document.getElementById('CB_frommonth').selectedIndex=mth;
		document.getElementById('CB_fromdate').selectedIndex=dd-1;
		document.getElementById('CB_tomonth').selectedIndex=mth;
		document.getElementById('CB_todate').selectedIndex=dd+1;
		document.getElementById('AIR_frommonth').selectedIndex=mth;
		document.getElementById('AIR_fromdate').selectedIndex=dd-1;
		document.getElementById('AIR_tomonth').selectedIndex=mth;
		document.getElementById('AIR_todate').selectedIndex=dd+1;
		document.getElementById('CAR_frommonth').selectedIndex=mth;
		document.getElementById('CAR_fromdate').selectedIndex=dd-1;
		document.getElementById('CAR_tomonth').selectedIndex=mth;
		document.getElementById('CAR_todate').selectedIndex=dd+1;
	}
}

function sendArtData()
{
    var value = '';
    var art = document.art;
    var art_types = art.art_types;    

    for (i = 0; i < art_types.length; i++)
    {
        if (art_types[i].checked)
        {
            value += art_types[i].value + ",";
        }
    }

    value = value.replace(/,$/, '');
    document.art.art_types_submit.value = '(' + value + ')';

    art.submit();
}

function hideLocationMenus(menus)
{
	for (i in menus)
	{
		document.getElementById(menus[i]).style.display = 'none';
	}
}

function changeLocationMenus(mySelect)
{
	// Hide all menus
	hideLocationMenus(new Array('location', 'durhamDistrict', 'otherDiningArea'));

	// Hide location comments
	for (i = 0; i < 10; i++)
	{
		document.getElementById('description' + i).style.display = 'none';
	}

	menuName = mySelect.value;
	document.getElementById(menuName).style.display = 'block';
}

function resetLocationDropdown()
{
	document.getElementById('durhamDistrictRadio').checked='checked';
}

function hideElement(elementName)
{
	document.getElementById(elementName).style.visibility = 'hidden';
}

function setupCalendar () {
	Calendar.setup({
		inputField  : "start",         // ID of the input field
		button      : "start"       // ID of the button
	});
	var myDate = new Date();
	var day = myDate.getDate();
	var month = myDate.getMonth() + 1;
	var year = myDate.getFullYear();
	document.getElementById("start").value = month + "/" + day + "/" + year;
	Calendar.setup({
		inputField  : "end",         // ID of the input field
		button      : "end"       // ID of the button
	});
}

/*
if(console) {
	console.log("Path is: " + window.location.pathname);
	console.log("Href is: " + window.location.href);
	console.log("Host is: " + window.location.host);
} 
*/

// simple check for page URL
//if(window.location.pathname == "/visitors/event_calTEST.php") {
//	if(console) {
//		console.log("Hello World!");
//	}
//	// call the function if we are on the right page.
//	setupCalendar();
//}

         


