function imgSwap(target)
 {
  theTarget=target;
  document.Splash.src='images/'+theTarget+'.jpg';
 }
function tabSwap(target)
 {
  theTarget=target;
  document.PentTabs.src='images/'+theTarget+'.gif';
 }

 Date.prototype.add = function (interval, n)
 {
	var dTemp = this;
	if (!interval || n == 0) return dTemp;
	switch (interval.toLowerCase()){
		case "ms":
			dTemp.setMilliseconds(dTemp.getMilliseconds() + n);
			break;
		case "s":
			dTemp.setSeconds(dTemp.getSeconds() + n);
			break;
		case "mi":
			dTemp.setMinutes(dTemp.getMinutes() + n);
			break;
		case "h":
			dTemp.setHours(dTemp.getHours() + n);
			break;
		case "d":
			dTemp.setDate(dTemp.getDate() + n);
			break;
		case "mo":
			dTemp.setMonth(dTemp.getMonth() + n);
			break;
		case "y":
			dTemp.setFullYear(dTemp.getFullYear() + n);
			break;
	}
	return dTemp;
}

function externalLinks() {
	//we should probably put up an error since they should use a browser that supports this
	if(!document.getElementsByTagName)
	    return;

	//get all the anchors and change the ones that have the external ref
	var anchors = document.getElementsByTagName("a");
	var index;

	for (index=0; index < anchors.length; ++index)
	{
		//only change the anchors that are actually hrefs and marked as being external
		if(anchors[index].getAttribute("href") && (anchors[index].getAttribute("rel") == "new_window")) {
			anchors[index].setAttribute("taget", "_blank");
			anchors[index].target = "_blank";
		}

	}
}
//make sure we call this
window.onload=externalLinks;

function validateDay(yearField, monthField, dayField)
{
	var m = monthField.value;
	var y = yearField.value;
	var d = dayField.value;
	var i;
	var opt;

	//this figures out the max days in the month for a given year by
	//taking advantage of rollover.
	var maxD = 32 - (new Date(y, m-1, 32)).getDate();
	if( dayField.length > maxD)
	{
		for(i = dayField.length; i > maxD; --i)
			dayField.remove(i -1);
	}

	//if we need to add days back on because we don't have enough do that
	//we need the test to make sure we don't add an extra last day
	if(dayField.length < maxD)
	{
		for(i = dayField.length; i <= maxD; ++i)
		{
			opt = document.createElement("option");
			opt.setAttribute("value", i);
			opt.text = i;

			try
			{
				dayField.add(opt, null); //this doesn't work in all version of IE
			}
			catch(e)
			{
				dayField.add(opt); //this does work if the other call failed
			}
		}
	}
}

function validateState(stateField, countryField)
{
	if(countryField.value != 2)
		stateField.value = 53;
}
