

// Change only "Featured News" in Second Column from H2 to H1
try {
	var obj=document.getElementById("xg_layout_column_2");
	var selElm=obj.getElementsByTagName('div');
	if ( obj.getElementsByTagName('h2')[0].innerHTML == "featured news" )
		selElm[1].innerHTML="<h1 style='font-size:2.7em; margin: 0px 0px 10px; font-weight: normal; line-height:1.5em; margin:0; padding:0;' >featured news</h1>"
	
} catch(e) 
{
	// do nothing
}

// Move Search Box
try {
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);

	var searchbar = document.getElementById("xn_bar_menu_search");
	var accountmod = document.getElementById("xg_module_account");
	var clone = searchbar;
	var childNode = accountmod.childNodes[0];
	
	//var clone = searchbar.cloneNode(true);
	if (browser=="Microsoft Internet Explorer") 
		if (childNode == null)
		 	clone.style.marginLeft = "0px";
		 else
			clone.style.marginLeft = "-5px";
	else
		clone.style.marginLeft = "-5px";
	
	// fix question mark
	var childNodeAnchor = clone.getElementsByTagName('A');
	childNodeAnchor[0].style.background = "transparent url(http://static.ning.com/planetbetterplace/widgets/index/gfx/ningbar/icon-search-ccc.png) no-repeat scroll 0 0";
	childNodeAnchor[0].style.height = "18px";
	childNodeAnchor[0].style.marginLeft = "6px";
	childNodeAnchor[0].style.cssFloat = "left";
	childNodeAnchor[0].style.styleFloat = "left";
	childNodeAnchor[0].style.width = "16px";
	childNodeAnchor[0].style.color = "#333333";	
	childNodeAnchor[0].style.textIndent = "-9999px";	
	childNodeAnchor[0].style.display = "block";
	
	// Fix Input box	
	childNodeAnchor = clone.getElementsByTagName("INPUT");
	childNodeAnchor[0].size = "18";
	childNodeAnchor[0].style.display = "block";
	childNodeAnchor[0].style.cssFloat = "left";
	childNodeAnchor[0].style.styleFloat = "left";

	// Add clearing div
	var clearingDiv = document.createElement('div');
	clearingDiv.style.clear = "both";	
	childNodeAnchor[0].parentNode.appendChild(clearingDiv);
	} catch(e) 
{
	// do nothing
}

	if (browser=="Microsoft Internet Explorer") 
	{
		if (childNode == null)
			accountmod.appendChild(clone);
		else
			childNode.appendChild(clone);	
	}
	else
	{
		// Add close Node
		var childNode = accountmod.childNodes[1];
		childNode.appendChild(clone);
	}
	// div style clear = "both"
	
	// set both
	// float left
	
	// add clearing div
	
	// search box width:115px;

	//document.insertBefore(clone, childNode);
			
//} catch(e) 
//{
	// do nothing
//}


var thisPage=location.pathname.split("/")[1];

document.write("<style>div #xg_module_account .xg_lightborder{border:0;padding:0;margin:0;color:#fff;} div #xg_module_account {color:#fff;}</style>");

if (thisPage == "") {
	document.write("<style>#welcome_box{display:none;}</style>");

	try {
		document.getElementById('xj_welcomebox_link_container').removeChild(document.getElementById('xj_welcomebox_link_container').childNodes[0]);
		document.getElementById('xj_welcomebox_link_container').removeChild(document.getElementById('xj_welcomebox_link_container').childNodes[1]);
		document.getElementById('xj_welcomebox_link_container').removeChild(document.getElementById('xj_welcomebox_link_container').childNodes[1]);
		var obj = document.createElement("li");
		obj.innerHTML = "<a href='/forum'><img src='http://www.betterplace.com/ning_assets/icon_forums.gif'>Post to Forums</a>";
		document.getElementById('xj_welcomebox_link_container').appendChild(obj);
		var obj = document.createElement("li");
		obj.innerHTML = "<a href='http://10words.betterplace.com'><img src='http://www.betterplace.com/ning_assets/icon_minifesto.gif'>Create Minifesto</a>";
		document.getElementById('xj_welcomebox_link_container').appendChild(obj);
	} catch(e) {	}

}

var obj = document.createElement("li");
obj.innerHTML = "<div id='bp_homelink' style='width:125px;height:75px;margin-top:-145px;margin-left:810px;z-index:100;'><a href='http://www.betterplace.com'> </a>";
document.getElementById('xg_sitename').appendChild(obj);

var obj = document.getElementById("xg_module_account");
var selElm = obj.getElementsByTagName("p");
var newHTML = '<a href="http://planet.betterplace.com/main/authorization/signUp?target=http%3A%2F%2Fplanet.betterplace.com%2F"><img src="http://www.betterplace.com/ning_assets/ning-signup.gif" /></a> ';
newHTML += '   <a href="http://planet.betterplace.com/main/authorization/signIn?target=http%3A%2F%2Fplanet.betterplace.com%2F" style="white-space:nowrap"><img src="http://www.betterplace.com/ning_assets/ning-signin.gif" /></a>';
selElm[1].innerHTML = newHTML;

try {
	var obj = document.getElementById("xg_module_account");
	selElm = obj.getElementsByTagName('a');
	selElm[0].innerHTML = "<img src='http://www.betterplace.com/ning_assets/button_signout.gif' />";
} catch(e) {}


if (thisPage == "groups") {
var obj = document.createElement("div");
var html = '<div id="bp_socialnetworks_groups" style="width:650px;padding-bottom:25px;color:#222;"><p style="padding-bottom:10px;font-style:bold;">Click the links below to join the Better Place group in these existing social networks or create a new one of your own right here in Planet Better Place.</p><a href="http://www.facebook.com/pages/Better-Place/22006641126"><img src="http://www.betterplace.com/ning_assets/ning_facebooklogo.jpg" alt="Facebook"  style="margin-right:10px;"/></a><a href="https://twitter.com/bpcommunity"><img src="http://www.betterplace.com/ning_assets/ning_twitterlogo.jpg" alt="Twitter"   style="margin-right:10px;"/></a></div>';
obj.innerHTML = html;
document.getElementById('xg_body').insertBefore(obj,document.getElementById('xg_body').childNodes[0]);
}

// Fix IE navigation problem
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer") {
document.getElementById('xg_tab_profile').style.display="inline";
try { document.getElementById('xg_module_account').document.getElementByClassName("xg_lightborder").style.border="0px";
} catch(e) {}
}

try { 
var d = document.getElementById("xg_sitename");
d.removeChild(d.firstChild);
} catch(e) {}