function SaveMyContent ( )
{
	if ( confirm( "Are you sure you want to save your changes?" ) )
	{
		var ContentObj = document.getElementById("content_edit");
		ContentObj.style.visible = false;
		var node_array = ContentObj.getElementsByTagName('input');
		for ( var i = 0; i < node_array.length; i++ )
		{
			node_array[i].setAttribute('value', node_array[i].value.replace(/\&/g, "&amp;"));
			if ( node_array[i].checked )
			{
				node_array[i].setAttribute('checked', 'true');
			}
		} // end for
		var node_array2 = ContentObj.getElementsByTagName('textarea');
		for ( var i = 0; i < node_array2.length; i++ )
		{
			node_array2[i].value = node_array2[i].value.replace(/\&/g, "&amp;");
		} // end for
		var node_array3 = ContentObj.getElementsByTagName('iframe');
		for ( var i = 0; i < node_array3.length; i++ )
		{
			var NodeId = node_array3[i].id.replace("___Frame", "");
			var NodeVal = FCKeditorAPI.__Instances[NodeId].GetXHTML();
			document.getElementById(NodeId).value = NodeVal;
		} // end for	
		var saveContentObj = FilterXmlPackage ( ContentObj );
		document.forms['Extranet_Form'].ContentHtml_Str.value = saveContentObj;
		setTimeout ( 'EnactForm();', 100 );
	} // end if
} // end function
function EnactForm ( )
{
	document.forms['Extranet_Form'].submit ();
} // end function
function CancelMyContent ( )
{
	if ( confirm( "Are you sure you want to cancel your changes?\nNone of the changes made will be saved." ) )
	{
		window.location.href = "/extranet/";
	}
} // end function
function Edit_Btn_Out ( itemName )
{
	itemName.style.backgroundImage = "url(/_cms/images/content_edit/contentsection16x16_h.png)";
} // end function

function ToggleLibrary ( itemName, scope )
{
	if ( document.getElementById(itemName) )
	{
		var Width = screen.width * 0.8;
		var Height = screen.height * 0.8;
		var Top = (screen.height - Height) / 2;
		var Left = (screen.width - Width) / 2;
		sScope = scope;
		sElement = document.getElementById(itemName);
		if ( sScope == 'images' )
		{
			sPreview = document.getElementById(itemName + '_Preview');
		}
		window.open('/_cms/_fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/aspx/connector.aspx&Type=Image&CurrentFolder=/uploadedImages/_Extranet/Stores&ServerPath=/uploadedImages/_Extranet/Stores', 'MediaLibrary', 'toolbar=no,status=no,resizable=no,dependent=yes,width=' + Width + ',height=' + Height + ',left=' + Left + ',top=' + Top);
	} // end if
} // end of the function
function ToggleImage ( itemName )
{
	sPreview = document.getElementById(itemName + '_Preview');
	if ( sPreview )
	{
		if ( confirm ("Are you sure you want to remove this image from the field?\nIt will NOT be deleted from the server.") )
		{
			sPreview.src = "/_cms/images/spacer.gif";
			sElement.value = "";
		}
	} // end if
} // end of the function
function SetUrl ( url, width, height, title )
{
	if ( sScope == 'Link' )
	{
		sElement.value = url;
	} // end if
	else if ( sScope == 'images' )
	{
		sPreview.src = url;
		sElement.value = url;
	} // end else if
	else
	{
		sElement.value = url;
	} // end else
} // end of the function
function SaveMyPassword ()
{
	if ( confirm( "Are you sure you want to save your changes?" ) )
	{
		if ( document.forms['Extranet_Form'].new_password.value == "" )
		{
			alert ( 'Please enter a new password.' );
			document.forms['Extranet_Form'].new_password.focus ();
		} // end if
		else if ( document.forms['Extranet_Form'].new_password2.value == "" )
		{
			alert ( 'Please confirm your new password.' );
			document.forms['Extranet_Form'].new_password2.focus ();
		} // end else if
		else if ( document.forms['Extranet_Form'].old_password.value == "" )
		{
			alert ( 'Please confirm your old password.' );
			document.forms['Extranet_Form'].old_password.focus ();
		} // end else if
		else if ( document.forms['Extranet_Form'].new_password.value != document.forms['Extranet_Form'].new_password2.value )
		{
			alert ( 'Your passwords did not match. Please re-enter and confirm the new password you wish to create.' );
		} // end else if
		else
		{
			setTimeout ( 'EnactForm();', 100 );
		} // end else
	} // end if
} // end function
function CleanInput ( field )
{
	var Field_Obj = field;
	Field_Obj.value = Field_Obj.value.replace ( '&', 'and' );
	Field_Obj.value = Field_Obj.value.replace ( '\'', '' );
} // end function

var currentlyActiveInputRef = false;
var currentlyActiveInputClassName = false;
function highlightActiveInput()
{
	if(currentlyActiveInputRef)
	{
		currentlyActiveInputRef.className = currentlyActiveInputClassName;
	}
	currentlyActiveInputClassName = this.className;
	this.className = 'inputHighlighted';
	currentlyActiveInputRef = this;	
}
function blurActiveInput()
{
	this.className = currentlyActiveInputClassName;	
	CleanInput ( this );
}
function initInputHighlightScript()
{
	var tags = ['INPUT','TEXTAREA'];
	for(tagCounter=0;tagCounter<tags.length;tagCounter++)
	{
		var inputs = document.getElementsByTagName(tags[tagCounter]);
		for(var no=0;no<inputs.length;no++)
		{
			inputs[no].onfocus = highlightActiveInput;
			inputs[no].onblur = blurActiveInput;
		}
	}
}