//Checking of frameset
window.onerror = handleError;
URLDomain = self.location.host;

if(top != self)
{
   position = URLDomain.indexOf(top.location.host + '/');
   if (top.location.host != self.location.host)
   {
      top.location.href = self.location.href;
   }
}

function handleError()
{
   if(top != self)
   {
      window.parent.location=location;
   }
}

function GlosaryWindow(GlossaryTerm,relative_domain)
{

	url = relative_domain + "/tools/glossary.asp?term=" + GlossaryTerm;
	windowName = "GlossaryWindow";
	win1 =         window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0,width=" + 500 + ",height=" + 230 + "")
}

function PopUpWindow(NextPage) 
{
	url = NextPage;
	windowName = "FloatingWindow";
	win1 = window.open(url,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0,width=" + 600 + ",height=" + 500 + "")
}


function getStyleObject(objectId)
{
	if(document.getElementById && document.getElementById(objectId))
	{
		return document.getElementById(objectId).style;
	}
	else if(document.all && document.all(objectId))
	{
		return document.all(objectId).style;
	}
	else
	{
		return false;
	}
}

//to change styles for specific element
function changeDiv(the_div, the_change)
{
	var the_style = getStyleObject(the_div);
	if(the_style != false)
	{
		the_style.display = the_change;
	}
}

function changeColor(the_item, the_color)
{
	var the_style = getStyleObject(the_item);
	if(the_style != false)
	{
		the_style.color = the_color;
	}
}

function changeWeight(the_item, the_change)
{
	var the_style = getStyleObject(the_item);
	if(the_style != false)
	{
		the_style.fontWeight = the_change;
	}
}

function rolloverImage(image_id,new_image)
{
	if(document.images)
	{
		document.images[image_id].src = new_image;
	}
}

function restoreDefaults(theItem, fieldType, theField)
{
	var defaultColor = "#999";
	
	if(theField.value == '' || theField.value == null)
	{
		changeColor(theItem, defaultColor)
		switch(fieldType)
		{
			case 'date':
			{
				theField.value = 'MM/DD/YYYY';
				break;
			}
			
			case 'ssn':
			{
				theField.value = 'XXX-XX-XXXX';
				break;
			}
			
			case 'phone':
			{
				theField.value = 'XXX-XXX-XXXX';
				break;
			}
		}
	}
	else
	{	
		if(theField.value == 'MM/DD/YYYY' || theField.value == 'XXX-XX-XXXX' || theField.value == 'XXX-XXX-XXXX')
		{
			changeColor(theItem, defaultColor)
		}
		else if(fieldType=='date')
		{
			var getDate = parseDate(theField.value);
			var formattedDate;
			
			if(getDate)
			{
				formattedDate = formatDate(getDate,'MM/dd/yyyy',false);
			}
			else
			{
				formattedDate = theField.value;
			}
			
			theField.value = formattedDate;
		}
	}

}

function ReloadTopNav()
{
	if(top.parent.frames["top_nav"])
	{
		top.parent.frames["top_nav"].location.reload();
	}
}





