var oas = 'http://ads.mgnetwork.com/RealMedia/ads/';
var RN = new String (Math.random());
var RNS = RN.substring (2,11);

function DisplayOasAd(position) {
	var oaspage = sitepage + '/1' + RNS + '@' + position;
	if (_version < 11) {
		document.write ('<a href="' + oas + 'click_nx.ads/' + oaspage + '" target="_top"><img src="' + oas + 'adstream_nx.ads/' + oaspage + '" border="0"></a>');
	}
	else {
		document.write ('<script language="JavaScript1.1" src="' + oas + 'adstream_jx.ads/' + oaspage + '"><\/script>');
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore) {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function addIEFavorite() {
	if (window.external) {
		external.AddFavorite(location.href, document.title);
	}
	else {
		alert("Oops, your browser doesn't support this feature.\n" +
		"If you are using Netscape Navigator, click Bookmarks\n" +
		"and then Add Bookmark to add this site to your favorites.");
	}
}

function setHeaderImage() {
	var imgs = new Array (
		"image1.jpg",
		"image2.jpg",
		"image3.jpg",
		"image4.jpg",
		"image5.jpg",
		"image6.jpg",
		"image7.jpg",
		"image8.jpg",
		"image9.jpg",
		"image10.jpg"
	);
	var imageNumber=Math.floor((Math.random() * imgs.length)%imgs.length);
	document.header.src = "http://media.gatewayva.com/rtd/images/header/" + imgs[imageNumber];
}

function writeDate() {
	var todaysDate = new Date();
	var today = todaysDate.getDay();
		if (today == 0) {day = "Sunday"};
		if (today == 1) {day = "Monday"};
		if (today == 2) {day = "Tuesday"};
		if (today == 3) {day = "Wednesday"};
		if (today == 4) {day = "Thursday"};
		if (today == 5) {day = "Friday"};
		if (today == 6) {day = "Saturday"};
	var thisMonth = todaysDate.getMonth();
		if (thisMonth == 0) {month = "Jan."};
		if (thisMonth == 1) {month = "Feb."};
		if (thisMonth == 2) {month = "Mar."};
		if (thisMonth == 3) {month = "Apr."};
		if (thisMonth == 4) {month = "May"};
		if (thisMonth == 5) {month = "Jun."};
		if (thisMonth == 6) {month = "Jul."};
		if (thisMonth == 7) {month = "Aug."};
		if (thisMonth == 8) {month = "Sep."};
		if (thisMonth == 9) {month = "Oct."};
		if (thisMonth == 10) {month = "Nov."};
		if (thisMonth == 11) {month = "Dec."};
	document.write(day + ', ' + month + ' ' + todaysDate.getDate() + ', ' + todaysDate.getFullYear());
}

function createWindow(pageURL,wWidth,hHeight) {
	window.open(pageURL, "rtdWin","toolbar=no,scrollbars=yes,directories=no,status=no,menubar=no,resizable=no,width=" + wWidth + ",height=" + hHeight);
}

function openPic(picURL) {
	var newWin = window.open(picURL,"largePicture","width=475,height=400,resizable=no,scrollbars=yes,menubar=no,toolbar=no");
}

function VoteWindow() {
	window.open("","pollpage","toolbar=no,scrollbars=yes,directories=no,status=no,menubar=no,resizable=no,width=400,height=400");
}

function VotePoll() {
	isChecked = false;
	for( i = 0; i < document.voteform.ITEM1.length; i++ ) {
		if (document.voteform.ITEM1[i].checked) {

			isChecked = true;
		}
	}
	if(isChecked) {
		VoteWindow();
		document.voteform.target = targetWin;
		document.voteform.submit();
	}
	else {
		alert("Sorry, but you forgot to vote\nPlease try again");
	}
}

function ViewPoll() {
	document.voteform.action.value = 'view';
	VoteWindow();
	document.voteform.submit();
}

function getImgIndex(imgName) {
	index = 'none';
	for ( i = 0; i < document.images.length; i++ ) {
		if ( document.images[i].name == imgName ) {
	 		index = i;
	 		break;
		}
	}
	return index;
}

function swapNavBarImg(imgName,imgURL,imgWidth,imgHeight) {
	imgIndex = getImgIndex(imgName);
	if ( imgIndex != 'none' ) {
		document.images[imgIndex].src = imgURL;
		document.images[imgIndex].width = imgWidth;
		document.images[imgIndex].height = imgHeight;
	}
}

 function sendsearch() 
    {
     if (document.searchform.typesearch[0].checked) 
      {
      document.searchform.action = "http://search.mgnetwork.com/cgi-bin/rtdsearch/rtdsearch.exe"
      return true;
      } 
     else if (document.searchform.typesearch[1].checked)
      {
      document.searchform.QryTxt.value = document.searchform.q.value;
      document.searchform.action = "http://pqasb.pqarchiver.com/timesdispatch/results.html"
      return true;
      };
    }



