var targetTags = new Array('p');
var fontSizes = new Array('xx-small','x-small','small','medium','large','x-large','xx-large');
var startSize = 2;
	
//This function resizes our select text
function resizeText(targetID,changeBy) {
	
	if (!document.getElementById) return; //Die if the browser doesn't like DOM
	var changeElement = null,fontSize = startSize,i,j,changeTags;
	
	//Up the fontSize counter
	fontSize += changeBy;
	if ( fontSize < 0 ) fontSize = 0;
	if ( fontSize > 6 ) fontSize = 6;
	startSize = fontSize;
	
	//If we can't get the element by ID, let's try by tag	
	if (!(changeElement=document.getElementById(targetID))) changeElement = document.getElementsByTagName(targetID)[ 0 ];

	//Actually apply the changes
	changeElement.style.fontSize = fontSizes[fontSize];

	//If at first you don't succeed...
	for (i = 0 ; i < targetTags.length ; i++) {
		changeTags = changeElement.getElementsByTagName(targetTags[ i ]);
		for ( j = 0 ; j < changeTags.length ; j++ ) changeTags[ j ].style.fontSize = fontSizes[ fontSize ];
	}
}

function showSummary(entryid,triggerid) {

	if (!document.getElementById) return; //Die if the browser doesn't like DOM
	var thisInfo = document.getElementById(entryid).style;
	var thisTrigger = document.getElementById(triggerid);

	// If the article summary is showing, hide it.
	if (thisInfo.display == "block") {
		thisInfo.display = "none";
		thisTrigger.innerHTML = "";
		thisTrigger.innerHTML = "<img src='/styles/images/article-icon-plus.gif' alt='SHOW SUMMARY'/>";

	}
	else {
		// If the article summary is hidden, show it.
		thisInfo.display = "block";
		thisTrigger.innerHTML = "";
		thisTrigger.innerHTML = "<img src='/styles/images/article-icon-minus.gif' alt='HIDE SUMMARY'/>";
	}
	return false;
}

/*
 * Clear Default Text: functions for clearing and replacing default text in <input> elements.
 */
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

function toggleCheck(targetid, checkid) {

	if (!document.getElementById) return; //Die if the browser doesn't like DOM
	var thisTarget = document.getElementById(targetid).style;
	var thisCheck = document.getElementById(checkid);

	// If the article summary is showing, hide it.
	if (thisTarget.display == "block") {
		thisTarget.display = "none";
		thisCheck.checked = true;
	}
	else {
		// If the article summary is hidden, show it.
		thisTarget.display = "block";
		thisCheck.checked = false;
	}
	return false;
}

function checkForms(validateClass) {
	var allTags=document.getElementsByTagName("*")
	var errCount=0

	for (i=0; i<allTags.length; i++){
		if (allTags[i].className==validateClass) { 
			if (allTags[i].value=="") { 
				allTags[i].style.border= "2px solid #f00";
				errCount++;
			}
			else {
				allTags[i].style.border="1px solid #999";
			}
		}
	}
	if (errCount>0) {alert ("Please be sure to fill in all mandatory fields. (*)");return false;}
}

function breakout_of_frame()
{
  if (top.location != location) {
    top.location.href = document.location.href ;
  }
}
