function toggleT(_w,_h) {
	if (document.all) { // is IE
		if (_h=='s') eval("parent.document.getElementById('"+_w+"').style.visibility='visible';");
		if (_h=='h') eval("parent.document.getElementById('"+_w+"').style.visibility='hidden';");
	} else { // is NS? 
		if (_h=='s') eval("parent.document.getElementById('"+_w+"').style.visibility='visible';");
		if (_h=='h') eval("parent.document.getElementById('"+_w+"').style.visibility='hidden';");
	}
}

function MWJ_findSelect( oName, oDoc ) { //get a reference to the select box using its name
	if( !oDoc ) { oDoc = window.document; }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) { //scan layers ...
		var theOb = MWJ_findObj( oName, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
	return null;
}

function swap_month(d,m,y){
	d = MWJ_findSelect( d ), m = MWJ_findSelect( m ), y = MWJ_findSelect( y );
	var IsLeap = parseInt( y.options[y.selectedIndex].value );
	IsLeap = !( IsLeap % 4 ) && ( ( IsLeap % 100 ) || !( IsLeap % 400 ) );

	//find the number of days in that month
	IsLeap = [31,(IsLeap?29:28),31,30,31,30,31,31,30,31,30,31][m.selectedIndex];
	
	//store the current day - reduce it if the new month does not have enough days
	var storedDate = ( d.selectedIndex > IsLeap - 1 ) ? ( IsLeap - 1 ) : d.selectedIndex;
	while( d.options.length ) { d.options[0] = null; } //empty days box then refill with correct number of days
	
	var temp;
	for( var x = 0; x < IsLeap; x++ ) { 
		if (x < 9){ temp = "0" + (x + 1); } else { temp = x + 1; }
		d.options[x] = new Option( temp, temp ); 
	}
	d.options[storedDate].selected = true; //select the number that was selected before
	if( window.opera && document.importNode ) { window.setTimeout('MWJ_findSelect( \''+d.name+'\' ).options['+storedDate+'].selected = true;',0); }

}
