jQuery(document).ready(function() {
	if (jQuery('.jqmWindow').length) {
		
		var lastcrumb = jQuery('.breadcrumb span').html();
		var beforecrumb = jQuery('.breadcrumb span').prev().html();
		if (jQuery('#modalBooking').length) {
			var reservelink = '<a href="#" id="biframelink"><span>Reserve Now</span></a>';
		}else{
			var reservelink = '<a href="#" id="reservenowtb"><span>Reserve Now</span></a>';
		}
		if (jQuery('#modalInquiry').length) {
			var inquirylink = '<a href="#" id="iiframelink"><span>Request More Info</span></a>';
		}else{
			var inquirylink = '<a href="#" id="moreinfotb"><span>Request More Info</span></a>';
		}
//alert(topTabBox);
		var topTabBox = '<div id="toptabbox"><h2>'+beforecrumb+'</h2><h3>'+lastcrumb+'</h3>'+reservelink+' '+inquirylink+'</div>';
		jQuery('.jwts_tabbertab:first').before(topTabBox);

		//jQuery('<div>', {id:'toptabbox'}).html("test");//append($('h2').html());
		//var topTabBox = "<p>Test</p>";
//alert(topTabBox);
		//jQuery('.jwts_tabbernav').after(jQuery('<div>', {id:'toptabbox'}).html("test"));
		//jQuery(jQuery('<div>', {id:'toptabbox'}).html("test")).appendTo('.jwts_tabbernav');

		//jQuery(".jwts_tabbernav").after("<div>test</div>");
		//jQuery('.breadcrumb').next().next().children(':first-child').after('<p>Test</p>');

		/*var t = '<h2>'+beforecrumb+'</h2><h3>'+lastcrumb+'</h3>'+reservelink+' '+inquirylink;
		var buttons = document.createElement('div');
		//buttons.setAttribute('id', 'toptabbox');
		//buttons.appendChild(t);

		//alert(t.html());
		//jQuery('.jwts_tabbernav').append(t);
		//var tabbernav = getElementByClass('.jwts_tabbernav');
		//alert(buttons.html());
		//document.createElement("div")).attr("id","toptabbox").innerHTML(t).insertAfter(tabbernav);
		//insertAfter(tabbernav,buttons);*/

		/*jQuery('<a/>', {  
		    id: 'foo',  
		    href: 'http://google.com',  
		    title: 'Become a Googler',  
		    rel: 'external',  
		   text: 'Go to Google!'  
		}).appendTo('#mySelector');*/
	}else{
		var lastcrumb = jQuery('.breadcrumb span').html();
		var beforecrumb = jQuery('.breadcrumb span').prev().html();
		var topTabBox = '<div id="toptabbox"><h2>'+beforecrumb+'</h2><h3>'+lastcrumb+'</h3><a href="#" id="reservenowtb"><span>Reserve Now</span></a><a href="#" id="moreinfotb"><span>Request More Info</span></a></div>';
		jQuery('.jwts_tabbernav').after(topTabBox);

	}
});


var allHTMLTags = new Array();
function getElementByClass(theClass) {
//Create Array of All HTML Tags
var allHTMLTags=document.getElementsByTagName("*");
//Loop through all tags using a for loop
for (i=0; i<allHTMLTags.length; i++) {
//Get all tags with the specified class name.
if (allHTMLTags[i].className==theClass) {
//Place any code you want to apply to all
//pages with the class specified.
//In this example is to “display:none;” them
//Making them all dissapear on the page.
allHTMLTags[i].style.display='none';
}
}
}
function insertAfter( referenceNode, newNode )
{
    referenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );
}

