// quicksearch definitions

var arrQuickSearch			= [["Art Shows", "art shows"], ["Children", "children"], ["DJ", "dj"], ["Fitness", "fitness"], ["Live Music", "live music"], ["Performing Arts", "performing arts"], ["Boutique Sales", "boutique sales"], ["Comedy", "comedy"], ["Early Dinner", "early dinner"], ["Getaway", "getaway"], ["Nightlife Parties", "nightlife parties"], ["Special Events", "special events"], ["Brunch", "brunch"], ["Community", "community"], ["Film", "film"], ["Happy Hour", "happy hour"], ["Open Houses", "open houses"], ["Sports", "sports"]];


function toggleQuickSearch() {
	var lyrQuickSearch			= document.getElementById("guide_quicksearch");

	if (lyrQuickSearch.style.display == "block") {
		lyrQuickSearch.style.display	= "none";
	} else {
		lyrQuickSearch.style.display	= "block";
	}
}


function setSearch (strQuery) {

	var strKeywordSearch		= document.getElementById('strKeywordSearch');

	

	strKeywordSearch.value		= strQuery;

	eventSearch();

}



function bookmarkItem() {

	document.forms.frmBookmark.submit();	

}



function buildQuickLinks() {

	var lyrQuickSearch		= document.getElementById('guide_quicksearch');

	
	var strLinks				= "";
	var intColorCounter			= 1;
	
	for (intCounter = 0; intCounter < arrQuickSearch.length; intCounter++) {
		if (intCounter == 0) {
			strLinks			+= "<div class=\"guide_quicklinks_row\">";
		} else {
			if (((intCounter) % 6) == 0) {
				strLinks			+= "</div><div class=\"guide_quicklinks_row\">";
				intColorCounter		= 1;
			}
		}
		
		strLinks			+= "<a href=\"javascript:setSearch('" + arrQuickSearch[intCounter][1] + "');\">" + arrQuickSearch[intCounter][0] + "</a>";

		intColorCounter++;
	}
	
	
	lyrQuickSearch.innerHTML	= strLinks + "</div>";

}



function showEvent (intID) {

	var intListingID		= document.forms.frmSearch.intListingID;

	intListingID.value		= intID;

	

	document.forms.frmSearch.submit();

}



function eventSearch() {

	var strKeywordSearch		= document.getElementById('strKeywordSearch');

	

	if (strKeywordSearch.value == '') {

		window.location			= '/events/';

	} else {

		window.location			= '/events/?q=' + strKeywordSearch.value;

	}

}



function eventsKeyHandler (intEvent) {

	var objEvent	= window.event ? event : intEvent;

	var objCharCode	= objEvent.charCode ? objEvent.charCode : objEvent.keyCode;

	

	switch (parseInt(objCharCode)) {

		case 13 :

			eventSearch();

			break;

	}

}



function displayRecurring (intRecurringType) {

	var lyrRecurring_Daily		= document.getElementById('lyrRecurring_Daily');

	var lyrRecurring_Weekly		= document.getElementById('lyrRecurring_Weekly');

	var lyrRecurring_Monthly	= document.getElementById('lyrRecurring_Monthly');

	

	switch (parseInt(intRecurringType)) {

		case 0 :

			lyrRecurring_Daily.style.display	= 'none';

			lyrRecurring_Weekly.style.display	= 'none';

			lyrRecurring_Monthly.style.display	= 'none';

			break;



		case 1 :

			lyrRecurring_Daily.style.display	= 'block';

			lyrRecurring_Weekly.style.display	= 'none';

			lyrRecurring_Monthly.style.display	= 'none';

			break;

			

		case 2 :

			lyrRecurring_Daily.style.display	= 'none';

			lyrRecurring_Weekly.style.display	= 'block';

			lyrRecurring_Monthly.style.display	= 'none';

			break;

		

		case 3 :

			lyrRecurring_Daily.style.display	= 'none';

			lyrRecurring_Weekly.style.display	= 'none';

			lyrRecurring_Monthly.style.display	= 'block';

			break;

	}

}



function editEvent (intEventID) {

	var intListingID				= document.getElementById('intListingID');

	intListingID.value				= intEventID;

	

	document.forms.frmEdit.submit();

}



function deleteImage (intID) {

	var intPhotoID					= document.getElementById('intPhotoID');

	

	if (confirm("Do you really want to remove this photo from your event?\n\nTHIS ACTION CANNOT BE UNDONE!\n\nPress [OK] to continue, or [CANCEL] to abort.")) {

		intPhotoID.value				= intID;

		document.forms.frmPhotos.submit();

	}

}

