

/*****************************
***************************************************
    Add Discussion Tab Notice
    -----------------------------------------------------------------------------
    The following script will append a message under groups discussion tab to let 
    the user know they're in the "discussion" tab and give them a link to return 
    to the "browse" tab
********************************************************************************/

$E.onDOMReady(function(){ 


	var url = window.location.href.replace(/^http:\/\//gi,'');
	var endurl =  window.location.href.match(/physicianspracticetoolbox\.com\/discuss$/gi);
	

	
	var q = $("rm-group-tab-content");
	var x = YAHOO.util.Dom.getFirstChild(q);
	var link = x.getAttribute("href");


	//check if discuss tab is selected
	var elm = $$('rm-selected','a','rm-viewHead');
	q = elm[0].innerHTML;
	
	if(q.match(/^Discuss/gi)) {		

			// Create a new DIV element and give it some content
			noticeDiv = document.createElement("div");
			noticeDiv.innerHTML = "<div id=\"notification\" style=\"width:100%; border-width:1px; border-color: black; border-style:solid; height:40px; position:relative; background: #C2EC8F\">"		
	+ "<div style=\"font-size: 16px; font-weight: bold; font-family: arial; color:blue; margin: 10px\">"
	+ "<a href=\""
	+ link
	+ "\">"
	+ "<center>"
	+ "YOU ARE IN THE DISCUSSION VIEW. CLICK HERE TO RETURN TO BROWSE AND VIEW OTHER CONTENT"
	+ "</center>"
	+ "<a>"
	+ "</div>"
	+ "</div>";
					   
			// Add the newly created element and it's content into the DOM
			//existing_div = $("rm-head"); 		
			//parent_element = existing_div.parentNode;
			//parent_element = $("rm-viewContentWrap");
			//first_div = YAHOO.util.Dom.getFirstChild("rm-viewContentWrap");
			//this insertBefore with a "...nextSibling" works like the missing insertAfter function for javascrip
			first_div = $("rm-contentWrapper");
			parent_element = first_div.parentNode;
			parent_element.insertBefore(noticeDiv, first_div);  		 	 	
		
		
	}
})