var parentimage	= '';

function rollover( imageobj )
{
	var mystring	= imageobj.src;
		mystring	= mystring.replace( /\.gif/gi, '_on.gif' );
		mystring	= mystring.replace( /_on_on\.gif/gi, '_on.gif' );
	imageobj.src	= mystring;

	parentimage		= imageobj;
}

function rollout( imageobj )
{
	var mystring	= imageobj.src;
	imageobj.src	= mystring.replace( /\_on\.gif/gi, '.gif' );

	for( x = 1; x <= 10; x++ )
	{
		var mydiv	= 'dropdown' + x;
		if( document.getElementById( mydiv ) )
		{
			document.getElementById( mydiv ).style.visibility = 'hidden';
		}
	}			
}

function menuover()
{
	rollover( parentimage );
	var mystring	= parentimage.id;
		mystring	= mystring.replace( /img/gi, 'dropdown' );

	if( document.getElementById( mystring ) )
	{
		document.getElementById( mystring ).style.visibility = 'visible';
	}
}

function menuout()
{
	rollout( parentimage );

	var mystring	= parentimage.id;
		mystring	= mystring.replace( /img/gi, 'dropdown' );

	document.getElementById( mystring ).style.visibility = 'hidden';
}

function dditemhilite( divobj )
{
	var thisChild					= divobj.firstChild;
	divobj.style.backgroundColor	= '#C9CDDD';
	thisChild.style.color			= '#323232';
}

function dditemlolite( divobj )
{
	var thisChild					= divobj.firstChild;
	divobj.style.backgroundColor	= '#323232';
	thisChild.style.color			= '#ffffff';
}

function dditemonclick( divobj )
{
	var thisChild		= divobj.firstChild;
	document.location	= thisChild.href;
}

function getCookieVal( offset )
{

	  var endstr = document.cookie.indexOf (";", offset);
	  if (endstr == -1)
		endstr = document.cookie.length;
	  return unescape(document.cookie.substring(offset, endstr));

}
function GetCookie( name )
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
	return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break; 
  }
  return null;
}

function SetCookie(name, value)
{
  // Enter number of days the cookie should persist
  var expDays = 0.1;
  var exp = new Date(); 
  //exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
  exp.setTime(exp.getTime() + (30*1000));
  expirationDate = exp.toGMTString();

  // Set cookie with name and value provided
  // in function call and date from above
  document.cookie = name + "=" + escape(value)
  document.cookie += "; expires=" + exp.toGMTString();
}

function printpage()
{
	var winwidth	= ( screen.width  > 800 ) ? '820' : '750';
	var winheight	= ( screen.height > 600 ) ? '620' : '450';
	var winleft	= ( screen.availWidth  - 10 - winwidth  ) / 2;
	var wintop	= ( screen.availHeight - 20 - winheight ) / 2;

	printable = window.open('/engine/print/'+escape(location.href), 'printable', 'toolbar=yes, scrollbars=yes, resizable=yes, menubar=yes, status=yes, directories=no, location=no, top=' + wintop + ',left=' + winleft + ', screenY=' + wintop + ',screenx=' + winleft +', width='+winwidth+', height='+winheight);
	printable.focus();
	printable.print();
}

function emailpage()
{
	var winwidth	= '450';
	var winheight	= '510';
	var winleft	= ( screen.availWidth  - 10 - winwidth  ) / 2;
	var wintop	= ( screen.availHeight - 20 - winheight ) / 2;

	email = window.open('/engine/email/'+escape(location.href), 'email', 'toolbar=no, scrollbars=no, resizable=no, menubar=no, status=yes, directories=no, location=no, top=' + wintop + ',left=' + winleft + ', screenY=' + wintop + ',screenx=' + winleft +', width='+winwidth+', height='+winheight);
	email.focus();
}

function popImage(imageURL,imageTitle)
{
	PositionX	= 100;
	PositionY	= 100;
	defaultWidth	= 500;
	defaultHeight	= 500;
	var AutoClose	= true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='resizable=yes,scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='resizable=yes,scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}

	with (imgWin.document)
	{
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
		writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
		if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
		close();
	}
}

function testpassword(fieldname)
{
	// declare variables
	var savepword	= document.getElementById( fieldname );
	var newpword1	= document.getElementById( fieldname + '_1' );
	var newpword2	= document.getElementById( fieldname + '_2' );

	// test for empty password fields
	if( newpword1.value == '' && newpword2.value == '' )
	{
		return true;
	}

	// test for matching fields
	if( newpword1.value == newpword2.value )
	{
		savepword.value = newpword1.value;
		return true;
	}

	else if( newpword1.value != '' && newpword2.value == '' )
	{
		newpword2.focus();
		return true;
	}

	else
	{
		alert( 'Passwords do not match!' );
		newpword1.value = '';
		newpword2.value = '';
		newpword1.focus();
		return false;
	}
}

/* BROWSER DETECTION SCRIPT: http://www.dynamicdrive.com/dynamicindex9/browsersniffer.htm */

var exclude=1;
var agt=navigator.userAgent.toLowerCase();
var win=0;var mac=0;var lin=1;
if(agt.indexOf('win')!=-1){win=1;lin=0;}
if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
var lnx=0;if(lin){lnx=1;}
var ice=0;
var ie=0;var ie4=0;var ie5=0;var ie6=0;var com=0;var dcm;
var op5=0;var op6=0;var op7=0;
var ns4=0;var ns6=0;var ns7=0;var mz7=0;var kde=0;var saf=0;
if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){
		kde=1;
		ns6=1;
		exclude=0;
		}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof window.opera!="undefined"){
	exclude=0;
	if(agt.indexOf("opera/5")!=-1||agt.indexOf("opera 5")!=-1){op5=1;}
	if(agt.indexOf("opera/6")!=-1||agt.indexOf("opera 6")!=-1){op6=1;}
	if(agt.indexOf("opera/7")!=-1||agt.indexOf("opera 7")!=-1){op7=1;}
	}
else if(typeof document.all!="undefined"&&!kde){
	exclude=0;
	ie=1;
	if(typeof document.getElementById!="undefined"){
		ie5=1;
		if(agt.indexOf("msie 6")!=-1){
			ie6=1;
			dcm=document.compatMode;
			if(dcm!="BackCompat"){com=1;}
			}
		}
	else{ie4=1;}
	}
else if(typeof document.getElementById!="undefined"){
	exclude=0;
	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){ns6=1;}
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ns6=1;ns7=1;}
	else if(agt.indexOf("gecko")!=-1){ns6=1;mz7=1;}
	if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){mz7=0;ns6=1;saf=1;}
	}
else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
	exclude=0;
	ns4=1;
	if(typeof navigator.mimeTypes['*']=="undefined"){
		exclude=1;
		ns4=0;
		}
	}
if(agt.indexOf('escape')!=-1){exclude=1;ns4=0;}
if(typeof navigator.__ice_version!="undefined"){exclude=1;ie4=0;}

