// 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
	});
}

//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);
}


