	function renderLogin(x){
				if(x=="guest"){
							document.getElementById("login_form_placeholder").innerHTML="<input id=\"lid\" type=\"text\" value=\"Username\" name=\"lid\"/> <input id=\"lpass\" type=\"password\" value=\"********\" name=\"lpass\"/><BR/>"
							document.getElementById("sign_in_out").innerHTML="<a href=\"javascript:fnLogin()\"> Sign in</a>";
				}else{
							document.getElementById("sign_in_out").innerHTML="<a href=\"/cm/newui/blog/blogs.jsp?logout=y\"> Sign Out</a>";
				}
	}
	function fnLogin(){
				var x=document.frmLogin.lid.id;
				var y=document.frmLogin.lpass.id;
				divLogin(x,y);
	}

	function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}

	function deleteBlog(catName, catDesc)
	{
		if (showConfirm(60000, "blog " + catDesc))
		{
			window.location.href="../blog/blogs.jsp?delblogname=" + URLEncode(catName);
		}
		else
		{
			return;
		}
	}

	function login()
	{
		document.form1.action="blogs.jsp?login=y";
		document.form1.submit();
	}

	function loginOnEnter(event)
	{
	  if (isEnterEvent(event))
	  {
		login();  	
	  }
	}

			
	<!-- Add JSP Specific JS functions and code here-->
	var regEx=/^[A-Za-z0-9_]+$/;
	var numberRegEx=/^[0-9]+/;
	var whitespace = " \t\n\r";

	function isValidEntityName (s)
	{
		s=stripWhitespace(s);
		var i;
		for (i = 0; i < s.length; i++)
		{
			// Check that current character is number or letter.
			var c = s.charAt(i);
			if ( c == "\"" || c == "\\" || c == "/" || c == "|" || c == "%" || c == ":" || c == "^" || c == ">" || c == "<" || c == "?" || c == "&" || c == "+" || c == "#"){
				return false;
			}
		}
		
		return true;
	}

	function stripWhitespace (s)
	{
		return stripCharsInBag (s, whitespace)
	}

	function stripCharsInBag (s, bag)
	{
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++)
		{
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function createBlog()
	{
		var blogname = document.createblog.blogname.value;
		var blogalias = document.createblog.blogalias.value; 
		if(!et_g_isWhitespace(blogname))
		{
			if (!isValidEntityName(blogname)) 
			{
				showDialog(60010, new Array("Blog Name","\" \\ / | % : ^ > < ? & + #" ));
				document.createblog.blogname.focus();
				return;
			}			
		}
		else
		{
				showDialog(1053, new Array("Blog Name"));
				return;
		}
		if(!et_g_isWhitespace(blogalias))
		{
			if (!isValidEntityName(blogalias)) 
			{
				showDialog(60010, new Array("Blog Alias","\" \\ / | % : ^ > < ? & + #" ));
				document.createblog.blogalias.focus();
				return;
			}			
		}
		else
		{
				showDialog(1053, new Array("Blog Alias"));
				return;
		}
		document.createblog.submit();
		showLoading();
	}

	function impCheck(elem)
	{
		if (elem.checked)
		{
			document.getElementById("impfileId").disabled = false;
			elem.title="Disable Import";
		}
		else
		{
			document.getElementById("impfileId").disabled = true;
			elem.title="Enable Import";
		}
	}

function deletePost(blogName, postId, postTitle)
{
	if (showConfirm(60000, "post " + postTitle))
	{
		window.location.href = "../blog/postlist.jsp?blogname=" + escape(blogName) + "&postid=" + postId + "&operation=delete";
		showLoading();
	}
	else
	{
		return;
	}

}

function publishBlog(blogName, blogAlias)
{

	if (showConfirm(60006, "blog " + blogName))
	{
		window.location.href = "../blog/postlist.jsp?blogname=" + escape(blogAlias) +"&operation=publish";
		showLoading();
	}
	else
	{
		return;
	}

}


function deletePosts(blogName)
{
	var postIds = "";
	if (showConfirm(60007, ""))

	{
		var checkbox;
		var id;
		var temp;
		for(var i=0; i<	document.forms[0].elements.length;i++){
			if(document.forms[0].elements[i].type == "checkbox"){
				if(document.forms[0].elements[i].checked)
				{
					checkbox = document.forms[0].elements[i]; 
					id = checkbox.id;
					temp = id.substring(id.indexOf("_")+1,id.length);
					postIds = postIds+"@"+temp;
				
				}

			}
		}
		window.location.href = "../blog/postlist.jsp?blogname=" + blogName + "&postids=" + postIds + "&operation=deleteposts";
	}
	else
	{
		return;
	}
}

 

function blogsearchformsubmit() {

	var searchform = document.getElementById("search");

 
	if($("dropdown_search_label")!=null){

		var centername = $("dropdown_search_label").innerHTML.toLowerCase();
            
		if(centername=="nasa.gov"){
 
			searchform.action="http://search.nasa.gov/search/search.jsp";

		}else{
  
			document.getElementById("query").value=document.getElementById("nasaInclude").value;
                        document.getElementById("nasaInclude").value="";
			 
                       searchform.action="/cm/newui/blog/searchpostlist.jsp";
		}

	}else{

		searchform.action = "http://search.nasa.gov/search/search.jsp";

	}

	searchform.submit();

}



function createBlogSearchForm(){
 

	var headerform = document.getElementById('header_form');
        
	var searchformnasa = document.createElement('form');

	searchformnasa.id = "search";

	searchformnasa.method = "get";

	searchformnasa.action = "javascript:blogsearchformsubmit();";



	var searchformcenter = document.createElement('form');

	searchformcenter.id = "search";

	searchformcenter.method = "get";

	searchformcenter.action = "javascript:blogsearchformsubmit();";



	var searchdiv =  document.createElement('div');

	searchdiv.id = "search_form_new";



	var hiddenCenter = document.createElement('label');

	hiddenCenter.htmlFor = "searchfield";

	hiddenCenter.id = "searchfieldCenter";

	hiddenCenter.setAttribute('name','searchfieldCenter');

	hiddenCenter.innerHTML = '<input id="centername" name="centername" type="hidden" value=""/>';
        hiddenCenter.innerHTML = '<input id="sitename" name="sitename" type="hidden" value=""/>';
        hiddenCenter.innerHTML = '<input id="blogname" name="blogname" type="hidden" value=""/>';
        hiddenCenter.innerHTML = '<input id="username" name="username" type="hidden" value=""/>';
        hiddenCenter.innerHTML = '<input id="frompage" name="frompage" type="hidden" value="dashboard"/>';
        hiddenCenter.innerHTML = '<input id="query" name="query" type="hidden" value=""/>';

 
	var searchdivNoDrop = document.createElement('div');

	searchdivNoDrop.id = "search_form_nodrop";

	

	var spansearchbtn = document.createElement('span');

	spansearchbtn.id = "searchbutton";



	var searchselector = document.createElement('div');

	searchselector.id = "searchselector";



	var spaninput = document.createElement('span');

	spaninput.id = "inputfield";



	var searchinput = document.createElement('input');

		searchinput.title = "searchfield";

		searchinput.type = "text";

		searchinput.id = "nasaInclude";

		searchinput.name = "nasaInclude";

		searchinput.className = "searchbox";

		searchinput.value = "";





	spaninput.appendChild(searchinput);



	var anchorbtn = document.createElement('a');

	anchorbtn.alt = "Search";

		anchorbtn.src = "http://www.nasa.gov/templateimages/redesign/modules/header/search-button.gif";

		anchorbtn.className = "searchbtn";

		anchorbtn.href="javascript:blogsearchformsubmit();";

		anchorbtn.innerHTML = "Search Button";



	spansearchbtn.appendChild(anchorbtn);



	var existingHeader = headerform.innerHTML;



	if(search_list.size()>0){

		searchdiv.appendChild(spaninput);

		searchdiv.appendChild(searchselector);

		searchdiv.appendChild(spansearchbtn);



		searchformcenter.appendChild(hiddenCenter);

		searchformcenter.appendChild(searchdiv);





		headerform.appendChild(searchformcenter);

	}

	else{

		searchdivNoDrop.appendChild(spaninput);

		searchdivNoDrop.appendChild(searchselector);

		searchdivNoDrop.appendChild(spansearchbtn);



		searchformnasa.appendChild(searchdivNoDrop);

		headerform.appendChild(searchformnasa);

	}
 

	if(search_list.size()>0){

	var searchSelect = new Element("select");

	search_list.each(function(searchList)

	{

		var opElem = new Element("option",{'id':searchList['id'],'name':searchList['name']});

		opElem.update(searchList['value']);

		searchSelect.appendChild(opElem);

	});

	if($('searchselector')!=null){

	$('searchselector').appendChild(searchSelect);

	var skinnedDropper = new SkinnedSelectSearch($$('#searchselector')[0],$$('#searchselector'+' select')[0],function(){},'','gray');}

	}

}
