function jump(theSelectBox) {
	var tomt=theSelectBox.options[theSelectBox.selectedIndex].value;
	if(tomt!="x") {
	   top.location.href=tomt;
	}
}
function replacemon(oug)
{
	
	//var ovalue=new Array();
	var ovalue=oug.value;
	var ivalue='';
				
	var newus =new Array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','ө','п','р','с','т','у','ү','ф','х','ц','ч','ш','щ','ь','ъ','э','ю','я','А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','Ө','П','Р','С','Т','У','Ү','Ф','Х','Ц','Ч','Ш','Щ','Ь','Ъ','Э','Ю','Я','ы','Ы');
	var oldus = new Array('à','á','â','ã','ä','å','¸','æ','ç','è','é','ê','ë','ì','í','î','º','ï','ð','ñ','ò','ó','¿','ô','õ','ö','÷','ø','ù','ü','ú','ý','þ','ÿ','À','Á','Â','Ã','Ä','Å','¨','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','ª','Ï','Ð','Ñ','Ò','Ó','¯','Ô','Õ','Ö','×','Ø','Ù','Ü','Ú','Ý','Þ','ß','û','Û');		
	
	for(i=0;i<ovalue.length;i++)
	{	
		tug=0;
		ii=i+1;
		var shal=ovalue.substring(i,ii);
		for(j=0;j<newus.length;j++)
		{
			if(shal==oldus[j])
			{
				
				tug=1;
				ivalue +=newus[j];
			}			
		}
		if(tug==0)
				ivalue +=shal;
	}
	
	oug.value=ivalue;

}
function counter() {
	
    startpop 	= 6853019414; //6750819383;
	endpop =  6891371434; //6790062216;
    startmon 	=  	2735780; //2709865; //2704905;
	endmon    =    2760379; //2736764; //2735231; 2734154;
 //  poprate 	= 	2.4452;
 // monrate 	= 	1.5;


	//This function zero pads a number to ensure a minimum of two digits
	// i.e. 01, 02, 03 ...
	function ZeroPad(arg)
	{
	if (arg.length==1)
	  {
	   return '0' + arg;
	  }
	else
	  {
	   return arg;
	  }
	} // End of function


    today = new Date();
    startdatepop = new Date('July 1, 2010');
	enddatepop= new Date('January 1, 2011');
    startdatemon = new Date('January 1, 2010');
	enddatemon=new Date('July 1, 2010');
    censusdate=new Date('January 9,2010');
	
	todayUTC = today.getTime() + today.getTimezoneOffset() * 60000;

    OttawaTime = todayUTC + (10*60*60*1000);
	

    offset = today.getTimezoneOffset() * 60 * 1000;


	estimatedtime=Math.ceil(( censusdate.getTime()-today.getTime()  ) /1000/60/60/24);
	
		
    diffpop = (( today.getTime() + offset ) - startdatepop.getTime() ) / 1000;
    diffmon = (( today.getTime() + offset ) - startdatemon.getTime() ) / 1000;
	
	
		 //Now compute rate of population change on a per second basis...
	nbSecspop = (enddatepop - startdatepop) / 1000; //Dates in milliseconds, converted to seconds
	poprate = (endpop - startpop) / nbSecspop;
		

    var newpop = Math.ceil(startpop + (diffpop * poprate));
    newpop = '' + newpop;

    //Now compute rate of population change on a per second basis...
	nbSecsmon = (enddatemon - startdatemon) / 1000; //Dates in milliseconds, converted to seconds
	monrate = (endmon - startmon) / nbSecsmon;



    var newmon = Math.ceil(startmon + (diffmon * monrate));
    newmon = '' + newmon;

    a1 = newpop.substring(0,1);
    a2 = newpop.substring(1,4);
    a3 = newpop.substring(4,7);
    a4 = newpop.substring(7,10);

    formpop = a1 + ',' + a2 + ',' + a3 + ',' + a4; 

    b1 = newmon.substring(0,1); 
    b2 = newmon.substring(1,4);
    b3 = newmon.substring(4,7);
//    b4 = newmon.substring(7,10)

  //  formmon = b1 + "," + b2 + "," + b3 + "," + b4;
  
  formmon = b1 + ',' + b2 + ',' + b3;
  
  
  
		  var OttawaTimeDate = new Date(OttawaTime);
		
		hr =  OttawaTimeDate.getHours()-2;
		mnt = ZeroPad(String(OttawaTimeDate.getMinutes()));
		sec = ZeroPad(String(OttawaTimeDate.getSeconds()));
		dd  = ZeroPad(String(OttawaTimeDate.getDate()));
		mm  = ZeroPad(String(OttawaTimeDate.getMonth() + 1));
		yy  = OttawaTimeDate.getFullYear();
		
		if (hr > 12)
		  { 
			hr = hr - 12;
			AmPm = ' p.m.';
		  }
		else if (hr == 12)
		  { 
			AmPm = ' p.m.';
		  }
		
		else if (hr == 0)
		  {
			hr = 12;
			AmPm = ' a.m.';
		  }
		else
		  {
			AmPm = ' a.m.';
		  }
  
  

    document.time.pop.value = formpop;
//  document.time.pop.value = poprate;

    document.time.mon.value = formmon;
	document.time.my_date.value = yy + '-' + mm + '-' + dd;
	document.time.my_time.value = hr + ':' + mnt + ':' + sec + AmPm ;
//	document.time.my_time2.value = estimatedtime;
//    document.time.mon.value = monrate;
    setTimeout('counter()',200);
}
