var bDocumentAttachments = false;

function sharePointPlaceholder(placeholderID,numChars)
{
	var e = document.getElementById(placeholderID);
	
	if(e != null)
	{
		var intPlaceholderContent = e.innerHTML.length;

		if(intPlaceholderContent<numChars)
		{
			document.getElementById(placeholderID).style.display="none";
		}
		else
		{
			bDocumentAttachments = true;
		}
	}
}

function relatedContentA(placeholder1,placeholderContainer)
{
	if(!bDocumentAttachments)
	{
		var e = document.getElementById(placeholder1);
		
		if(e==null)
		{
			var f = document.getElementById(placeholderContainer);
			
			if(f != null)
				f.style.display="none";
		}
	}
}

function relatedContentB(placeholder1,placeholder2,placeholderContainer)
{
	if(!bDocumentAttachments)
	{
		var e1 = document.getElementById(placeholder1);
		var e2 = document.getElementById(placeholder2);
	
		if((e1==null)&&(e2==null))
		{
			var f = document.getElementById(placeholderContainer);
			
			if(f != null)
				document.getElementById(placeholderContainer).style.display="none";
		}
	}
}

function clearTextBox(txtBox)
{
	var e = document.forms[0].Search1_txtSearch;
	e.value = "";
}

function bookmarkPage(strTitle)
{
	var strUrl = location.href;

	if(document.all)
	{
		window.external.AddFavorite(strUrl,strTitle)
	}	
}

function validSubscribe()
{
	// set valid form = true
	var bOk = true;
	var sMsg = "Please enter the following required fields:\n\n";
	// set var checkbox_choices to zero	
	var checkbox_choices = 0;
	// Loop from zero to the one minus the number of checkbox button selections
	for (counter = 0; counter < Form1.checkbox.length;counter++)
	{
		// If a checkbox has been selected it will return true
		// (If not it will return false)
		if (Form1.checkbox[counter].checked)
		{ 
			checkbox_choices = checkbox_choices + 1; 
		}
	}
	// valid email address regular expression
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	
	if(!filter.test(Form1.txtEmailAddress.value))
	{
		sMsg+="- A valid email address\n";
		bOk = false;
	}
	if(checkbox_choices == 0)
	{
		sMsg+="- At least one site area to subscribe to\n";
		bOk = false;
	}
	if(!bOk)
	{
		alert(sMsg);
	}
	else
	{
		Form1.submit();
	}
}

