/*

	removes the <a> from the menu of the current showing page.
	also sets the <li> to "current_page_item
	
	note: 

*/



function clearCurrentLink(){
	
	
	
		// sets any current page with this url in it to add " selected" to the class name
		var forumLink = "forums.picclique.com";
		var helpLink = "picclique.com/help";
		
		// css id of menu. we only search inside this element for links
		var menuId = "hd-nav";
		
		var menu = document.getElementById(menuId);
    var a = menu.getElementsByTagName("a");
    
        
    for(var i=0;i<a.length;i++){
    	
    		var win = window.location.href.split("#")[0];
    		var item = a[i].href;
    		       
        // search for help or forums 'rough' match, or exact match
        if (  ((item.search(helpLink) > -1) && (window.location.href.search(helpLink) > -1))
        	||	((item.search(forumLink) > -1) && (window.location.href.search(forumLink) > -1))
        	||	((win.search(item) == 0) && ((win.length - item.length) < 3))
        	 
        	 )
        {
            
            // set the parent <li> to class "current_page_item""
            a[i].parentNode.className = a[i].parentNode.className + " selected";

        }
    }
}

function removeNode(n){
    if(n.hasChildNodes())
        for(var i=0;i<n.childNodes.length;i++)
            n.parentNode.insertBefore(n.childNodes[i].cloneNode(true),n);
    n.parentNode.removeChild(n);
}