function ChangeDate(todate)
{
	YAHOO.calendar.cal1.selectDate(todate);
	SearchEvents(todate);
	mytabs.activeTab=mytabs.getTab(1);
}

function SearchEvents()
{
	var calID = YAHOO.util.Dom.get('hdnCalendar').value;	
	var div = YAHOO.util.Dom.get('search-results');
	var sURL = "/virtualDir/includesV2/Calendar.asp?a=search&wid=" + YAHOO.util.Dom.get('intID').value + "&q=" + YAHOO.util.Dom.get('txtSearch').value;
	var postData = "";
	if(calID != "")
		postData += "&calid=" + calID;
		
	var handleSuccess = function(o)
	{ 
		if(o.responseText !== undefined) 
			{
				//alert(o.responseText)
				div.innerHTML = o.responseText; 
			}
		else 
			{
				div.innerHTML = "Search failed, please try again.<br />If this continues, please contact support.";
			}
	}
	var handleFailure = function(o)
	{
		div.innerHTML = "Search failed, please try again.<br />If this continues, please contact support.";
	}
	 
	var callback = 
	{ 
		success: handleSuccess, 
		failure: handleFailure, 
		argument: ['foo','bar'] 
	}; 
	//alert(sURL);
	var request = YAHOO.util.Connect.asyncRequest('POST', sURL, callback, postData);
}



function DownloadICal(event_id,web_id,web_name)
{
	var url = "http://"+web_name+".usachamber.com/virtualDir/calendar/index.php?a=download&wid="+web_id+"&wn="+web_name+"&eid="+event_id;
	var win = window.open(url,"iCal_Download","width=800,height=300,scrollbars=no,menubar=no,status=no");
}

function ChangeCalendar(element)
{
	if(window.location.search != "")
	{
		rexp = /calid\=\w*\d*/gi;
		url = window.location.search.replace(rexp, "");
		window.location.search = url+"&calid=" + YAHOO.util.Dom.get("cboCalendar").options[YAHOO.util.Dom.get("cboCalendar").selectedIndex].value;
	} else window.location.search += "&calid=" + YAHOO.util.Dom.get("cboCalendar").options[YAHOO.util.Dom.get("cboCalendar").selectedIndex].value;
}


function Register(event_id)
{
	var sURL = "https://www.secure-submission.com/SecureEventRegV2/default.asp?intID="+event_id;
	var sOptions = "";
	window.open(sURL,"Event Registration", sOptions);
}

function CheckSubmission()
{
	if (document.getElementById("txtContactName").value == '')
		{
			document.getElementById("txtContactName").focus();
			alert('You must enter a Contact Name');
			return false;
		}
	if (document.getElementById("txtContactPhone").value == '')
		{
			document.getElementById("txtContactPhone").focus();
			alert('You must enter a Contact Phone Number');
			return false;
		}		
	if (document.getElementById("txtContactEmail").value == '')
		{
			document.getElementById("txtContactEmail").focus();
			alert('You must enter a Contact Email Address');
			return false;
		}		
	if (document.getElementById("txtEventTitle").value == '')
		{
			document.getElementById("txtEventTitle").focus();
			alert('You must enter an Event Title');
			return false;
		}	
	if (document.getElementById("txtEventStartDate").value == '')
		{
			document.getElementById("txtEventStartDate").focus();
			alert('You must enter an Event Start Date');
			return false;
		}
	if (document.getElementById("txaEventDescription").value == '')
		{
			document.getElementById("txaEventDescription").focus();
			alert('You must enter an Event Description');
			return false;
		}				
	if (document.getElementById("txaEventLocation").value == '')
		{
			document.getElementById("txaEventLocation").focus();
			alert('You must enter the Event Location');
			return false;
		}
	if (document.getElementById("txaAdmissionInfo").value == '')
		{
			document.getElementById("txaAdmissionInfo").focus();
			alert('You must enter the Admission and Pricing information');
			return false;
		}
	if (document.getElementById("txtConfirmation").value != 'chamber')
		{
			document.getElementById("txtConfirmation").focus();
			alert('You must enter the word in the image.');
			return false;
		}		
	document.frmEventSubmission.submit();
}