/******************************************************************************************************
NOTES:
* The categories in the menu are dynamic
* Under Destinations and Culinary Arts the Overview page must be the first item in the its subItems
* Destination links to destination_overview page
* Photos links to photos page
* Videos links to videos page
* Culinary Arts/Overview links to culinaryArts_overview page
* Culinary Arts/Recipes links to recipes page
* the rest of the items links to post_list page
*******************************************************************************************************/
var parentId = '0';
function selectItem( selectedItem ) {
var path = "";
var isParent = false;
if ( selectedItem == 'OverviewD' ) {
var obj = $("div.side_nav ul li a:contains('Destinations')");
path = "
Overview";
isParent = true;
} else if ( selectedItem == 'OverviewB' ) {
var obj = $("div.side_nav ul li a:contains('Blogs')");
path = "Overview";
isParent = true;
} else if ( selectedItem == 'OverviewC' ) {
var obj = $("div.side_nav ul li a:contains('Culinary')");
path = "Overview";
isParent = true;
} else if ( selectedItem == 'contestM' ) {
var obj = $("div.side_nav ul li a:contains('Contest')");
obj.parent().children("div.slide:first").find("li:first").addClass("active");
path = "Current Promotion";
isParent = true;
} else {
var obj = $("div.side_nav ul li a:contains('" + selectedItem + "')");
path = "" + selectedItem + "";
}
if ( obj ) {
if ( !isParent ) {
$( obj ).parent().addClass('active');
var slide = $( obj ).closest( 'div.slide' );
if ( slide.length > 0 ) {
var parent = $( slide ).closest( 'li' );
if ( parent.length > 0 ) {
parent.addClass( 'active' );
this._box = parent.children('.slide').eq(0);
this._box.show();
var parentLink = parent.children( 'a:first' );
path = "" + parentLink.html() + "" + path;
}
else $( obj ).parent().addClass( 'active' );
} else $( obj ).parent().addClass( 'active' );
} else {
var li = $( obj ).parent();
li.addClass( 'active' );
this._box = li.children('.slide').eq(0);
this._box.show();
path = "" + $( obj ).html() + "" + path;
}
}
$('ul.breadcrumbs').append( path );
}
function menuItem( previousItemLevel, level, nextItemLevel, id, name ) {
var href = '';
// Menu Items
if ( level == '0' ) {
parentId = id;
switch ( id ) {
case catDestinations :
href = '/destinations_overview/';
break;
case catPhotos :
href = '/photos/';
break;
case catVideos :
href = '/videos/';
break;
case catCulinaryArts :
href = '/culinaryArts_overview/';
break;
case catMixology :
href = '/mixology_list/';
break;
case catPhotoContest :
href = '/contest/';
break;
default :
href = '/category_list/?categoryid=' + id;
break;
}
if ( previousItemLevel < '1' ) {
if ( nextItemLevel == '1' ) return '' + name + '';
else if ( nextItemLevel < '1' ) return '' + name + '';
} else return '' + name + '';
// Submenu Items
} else if ( level == '1' ) {
if ( id == catRecipes ) href = '/recipes/';
else href = '/category_list/?categoryid=' + id;
if ( previousItemLevel != '0' ) {
if ( parentId == catPhotoContest ) {
href = '/contest_finalists/';
return '' + name + '';
}
if ( parentId == catDestinations ) href = '/hotel_list/?destinationid=' + id;
return '' + name + '';
} else {
var str = '';
if ( parentId == catCulinaryArts ) {
parentId = '0';
return str + '- ' + name + '
';
} else if ( parentId == catDestinations ) {
href = '/hotel_list/?destinationid=' + id;
return str + '- ' + name + '
';
} else if ( parentId == catPhotoContest ) {
href = '/contest/';
if ( nextItemLevel != -1 ) return str + '- ' + name + '
';
else return str + '- ' + name + '
';
}
}
}
}