<!-- $Id: tools.js,v 1.4 2004/11/26 16:20:23 spa Exp $ -->
<!--
function openSmallWin(whichArray, width, height)
{
	mediaStatus=true;
	var ScreenWidth=window.screen.width;
	var ScreenHeight=window.screen.height;
	var movefromedge=0;
	placementx=(ScreenWidth/2)-((800)/2);
	placementy=(ScreenHeight/2)-((550+50)/2);
	//var whichHtml = new Array('media.html','dictionary/index.html');
	thiswin = window.open(whichArray,"theWin","width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
	foc=thiswin
	window.setTimeout('foc.focus()',100)
}

		function checkdate() {
		var err=0
		
		a=document.sales.month.value+document.sales.day.value+document.sales.year.value
		if (a.length != 8) err=1
		b = a.substring(0, 2)// month
		d = a.substring(2, 4)// day
		f = a.substring(4, 8)// year
		if (b<1 || b>12) err = 1
		if (d<1 || d>31) err = 1
		if (f<0) err = 1
		if (b==4 || b==6 || b==9 || b==11){
		if (d==31) err=1
		}
		if (b==2){
		var g=parseInt(f/4)
		if (isNaN(g)) {
		err=1
		}
		if (d>29) err=1
		if (d==29 && ((f/4)!=parseInt(f/4))) err=1
		}
		
		a=document.sales.to_month.value+document.sales.to_day.value+document.sales.to_year.value
		if (a.length != 8) err=1
		b = a.substring(0, 2)// month
		d = a.substring(2, 4)// day
		f = a.substring(4, 8)// year
		if (b<1 || b>12) err = 1
		if (d<1 || d>31) err = 1
		if (f<0) err = 1
		if (b==4 || b==6 || b==9 || b==11){
		if (d==31) err=1
		}
		if (b==2){
		var g=parseInt(f/4)
		if (isNaN(g)) {
		err=1
		}
		if (d>29) err=1
		if (d==29 && ((f/4)!=parseInt(f/4))) err=1
		}
		
		if (err==1) {
		alert('The date you entered is not valid');
		return false;
		}
		else {
		return true;
		}
		}
		
function displayImage(state, thepath, evt, w, h)
{
	if(state)
	{
		w += 20;
		h += 25;
		winID = window.open(thepath, "win", 'width=' + w + ', height=' + h + ', left=' + (getX(evt)+50) +' , top=' + (getY(evt)-20) +', menubar=no, titlebar=no');
	}
	else
	{
		winID.close();
	}
}

var getX = function(evt)
{
	if(evt.x)
	{
		return evt.x;
	}
	if(evt.pageX)
	{
		return evt.pageX;
	}
}

var getY = function(evt)
{
	if(evt.y)
	{
		return evt.y;
	}
	if(evt.pageY)
	{
		return evt.pageY;
	}
}

//-->

