// Function to check data and manipulate necessary fields before posting
function post_check()
{
	if(title_check() && content_check() && url_check())
		return true;
	else
		return false;
}

// Function to check data and manipulate necessary fields before modifying
function modify_check()
{
	if(title_check() && content_check() && url_check())
		return true;
	else
		return false;
}

// The following functions relate to specific fields within the posting/modfiying form
// Function to ensure that something has been entered in the title field
function title_check()
{
	// check that a title has been added
	if (this.document.forms[0].title.value == "")
	{
		alert("You must enter a title.");
		return false;
	}
	else
		return true;
}


function content_check()
{
        // check that a content has been added
        if (this.document.forms[0].content.value == "")
        {
                alert("You must enter a Long Description.");
                return false;
        }
        else
                return true;
}


// If url is just "http://" (the value given as a default when the form loads) reset it to ""
function url_check()
{
	if (this.document.forms[0].url.value == "http://")
		this.document.forms[0].url.value ="";
	return true;
}

// Allows return spaces in textfield 
function replace(String) {

  var re = /\n/g
return String.replace(re,"<br>");
}

