
var months = new Array('Jan','Feb','Mar','Apr','May',
'Jun','Jul','Aug','Sep','Oct','Nov','Dec');

var aNavVisible = new Array();
var aNavJustClosed = false;
var aNavJustOpened = false;
var clientOpera = navigator.userAgent.indexOf("Opera") > -1;
var clientIE = navigator.userAgent.indexOf("MSIE") > 1 && !clientOpera;
var clientMozilla = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !clientOpera;


function weekImg(){
    return 'http://widget.3dpregnancy.com/images/weeks/3dpregnancy_' + curWeek + '.jpg'
}


function ShowNav(iId){
	if (!aNavJustClosed){
    	NavInp = document.getElementById('navNfof_'+iId); 
    	NavhighlightText(NavInp,0,1);
    	document.getElementById('divNav_'+iId).style.display=''; 
        aNavJustOpened = true;
    	aNavVisible[iId] = false;
    	document.getElementById('navNfof_'+iId).focus(); 	
        setTimeout('aNavJustOpened = false',200);
	} else {
        aNavJustClosed = false;
    }
}

function nav_mouseover(iId,act){
	aNavVisible[iId] = act;
	//if (!act){
	NavInp = document.getElementById('navNfof_'+iId); 
	NavhighlightText(NavInp,0,1);
	//}
}

function navfoc(iId){
document.getElementById('navNfof_'+iId).focus(); 	
}

function HideNav(iId) { 
	if (!aNavVisible[iId] && !aNavJustOpened){
		document.getElementById('divNav_'+iId).style.display='none'; 
		aNavJustClosed = true;
		setTimeout('aNavJustClosed = false',200);
		//aNavVisible[iId] = false;
		//window.setTimeout('_HideNav(' + iId + ');', 200);
	} else {
        aNavJustOpened = false;
    }
}

function _HideNav(iId){ 
	if ( !aNavVisible[iId] ) 
		if(document.getElementById('divNav_'+iId))
		document.getElementById('divNav_'+iId).style.display='none'; 
}



function NavhighlightText(textboxObjBnw, iStart, iEnd) {
  switch(arguments.length) {
    case 1:      textboxObjBnw.select();
    break;
    case 2:      iEnd = textboxObjBnw.value.length;
    case 3:      if (clientIE) {
      var oRange = textboxObjBnw.createTextRange();
      oRange.moveStart("character", iStart);
      oRange.moveEnd("character", -textboxObjBnw.value.length + iEnd);
      oRange.select();
    }
    else if (clientMozilla || clientOpera){
      textboxObjBnw.setSelectionRange(iStart, iEnd);
    }
  }
  // Commented out to prevent pop-under by click in drop-down
  //textboxObjBnw.focus();
}