
function displayStatusMsg(msgStr) {
  status=msgStr;
  document.returnValue = true;
}

function browserDetect(url) {
if (document.layers) {	
	location.href='http://brigittedesroches.com/browser.html';
	}
}

function swapImage(imgTag, imgName){
	document.images[imgTag].src=imgName;
	}
	
function popWin(url) {
	window.open(url,'','screenX=0,left=0,screenY=0,top=0,scrollbars=1,resizable=0,status=0,width=650,height=('+ screen.height +'-20)');
}

function popupWin(url,wdth,hght) {
	window.open(url,'','screenX=0,left=0,screenY=0,top=0,scrollbars=1,resizable=0,status=0,width='+wdth+',height='+hght+'');
}

function popUpAdmin(url) {
	window.open(url,'','screenX=0,left=0,screenY=0,top=0,scrollbars=1,resizable=0,status=0,width=700,height=400');
}

  // close small window and return to larger new browser window
function linkAdmin() {
	window.opener.location.reload();
	window.close();
}

//this writes out the current date on the top of the page

function writeCurrentDateEn()
{
	monthArray = new Array(12);
	monthArray[0] = "January";
	monthArray[1] = "February";
	monthArray[2] = "March";
	monthArray[3] = "April";
	monthArray[4] = "May";
	monthArray[5] = "June";
	monthArray[6] = "July";
	monthArray[7] = "August";
	monthArray[8] = "September";
	monthArray[9] = "October";
	monthArray[10] = "November";
	monthArray[11] = "December";

	dayArray = new Array(7);
	dayArray[0] = "Sunday";
	dayArray[1] = "Monday";
	dayArray[2] = "Tuesday";
	dayArray[3] = "Wednesday";
	dayArray[4] = "Thursday";
	dayArray[5] = "Friday";
	dayArray[6] = "Saturday";

	currentDay = new Date();
	month = currentDay.getMonth();
	day = currentDay.getDay();
	year = currentDay.getFullYear();

	// Now write out the year
	document.write(monthArray[month] + " " + currentDay.getDate() + ", " + year);
}

function writeCurrentDateFr()
{
	monthArray = new Array(12);
	monthArray[0] = "janvier";
	monthArray[1] = "février";
	monthArray[2] = "mars";
	monthArray[3] = "avril";
	monthArray[4] = "mai";
	monthArray[5] = "juin";
	monthArray[6] = "juillet";
	monthArray[7] = "août";
	monthArray[8] = "septembre";
	monthArray[9] = "octobre";
	monthArray[10] = "novembre";
	monthArray[11] = "décembre";

	dayArray = new Array(7);
	dayArray[0] = "dimanche";
	dayArray[1] = "lundi";
	dayArray[2] = "mardi";
	dayArray[3] = "mercredi";
	dayArray[4] = "jeudi";
	dayArray[5] = "vendredi";
	dayArray[6] = "samedi";

	currentDay = new Date();
	month = currentDay.getMonth();
	day = currentDay.getDay();
	year = currentDay.getFullYear();

	// Now write out the year
	document.write("Le " + currentDay.getDate() + " " + monthArray[month] + " " + year);
}

function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}

function autoTab(field, limit, next, evt) {
	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode > 31 && field.value.length == limit) {
		field.form.elements[next].focus();
		}
	}
	
//image upload//

  // width to resize large images to
var maxWidth=70;
  // height to resize large images to
var maxHeight=70;
  // valid file types
var fileTypes=["jpe","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

function preview(what){
  var source=what.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  globalPic=new Image();
  if (i<fileTypes.length) globalPic.src=source;
  else {
    globalPic.src=defaultPic;
    alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));
  }
  setTimeout("applyChanges()",200);
}
var globalPic;
function applyChanges(){
  var field=document.getElementById(outImage);
  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
  }
  if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
  }
  field.style.display=(x<1 || y<1)?"none":"";
  field.src=globalPic.src;
  field.width=x;
  field.height=y;
}



/*<script language="JavaScript" type="text/javascript">*/
function popup(url,title,width,height) {
			window.open(url,title,'menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,width='+width+',height='+height+'');
		}
/*</script>*/

