function docWrite(str) {
  document.write(str);
}

function swapImage(imgName, imgSrc) {
  if (document.images){
		document.images[imgName].src = imgSrc;
  }
}

function ClearForm() {
	clearAll(document.form1.searchFor);
	document.form1.orderOpt.options[0] = new Option('id/date', 'id', false, false);
	document.form1.orderOpt.options[1] = new Option('screen', 'page_name', false, false);
	document.form1.orderOpt.options[2] = new Option('status', 'review_phase', false, false);
	document.form1.srchField.selectedIndex=0;
	document.form1.srchValue.value='';
}

function removeStrings(strOrig){
  for (var i=1; i<removeStrings.arguments.length; i++) strOrig = strOrig.replace(removeStrings.arguments[i],'');
	return strOrig;
}

function StripString(strOrig,charStart,charEnd) {
	var strUnstripped = new String(strOrig);
	var posStart = strUnstripped.indexOf(charStart)+charStart.length+1;
	var posEnd = strUnstripped.indexOf(charEnd);
	if(charStart=='!'){posStart=0};
	if(charEnd=='!'){posEnd=strUnstripped.length};
	var strStripped = strUnstripped.substring(posStart, posEnd);
	return strStripped;
}

function deselect(theList){
	theList.selectedIndex = -1;
}

function clearAll(theList) { 
	for (var i=(theList.options.length-1); i>=0; i--) theList.options[i] = null; 
	deselect(theList);
} 

function clearSelected(theList) { 
	for (var i=(theList.options.length-1); i>=0; i--) if (theList.options[i].selected) theList.options[i] = null; 
	deselect(theList);
} 




function setRandomImg(i) {
	var maxPossibleNum = 2
	var randomNum = Math.round(Math.random()*(maxPossibleNum-1))+1;
	document.images[i].src = 'images/home' + randomNum + 'wBG.jpg';
}

var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function FullView(viewLink) {
	viewLink = viewLink + '&a=' + curAngle;
	PopWin(viewLink,450,450)
}

var popUpWin=0;
function PopWin(strLoc,winWidth,winHeight) {
  if (popUpWin) { if (!popUpWin.closed) popUpWin.close(); }
	var lPos = ((screen.width / 2) - (winWidth / 2));
	var tPos = ((screen.height / 2) - (winHeight / 2) - 20);
	var strOpenOptions = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+winWidth+',height='+winHeight+',left='+lPos+', top='+tPos+',screenX='+lPos+',screenY='+tPos;
	popUpWin = window.open(strLoc, 'popUpWin', strOpenOptions);
}

function ShowConfirm(txtVal) {
	//	\r places a line break
	if (confirm(txtVal)) {
		top.window.close();
	}
}

var currSampleNum = 1
var totalSampleNum = 5

function changeImage(i,n) {
	if (n == 'sample') {
		currSampleNum = currSampleNum + 1;
		if (currSampleNum > totalSampleNum) {
			currSampleNum = 1;
		}
		n = 'images/homeSample' + currSampleNum + '.jpg';
	}
	document.images[i].src = n;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);