<!--

/* Выводит мыло */
function showMail(){
var a,b,c,d,e,f
a='<a href=\"mai'
b='obme'+'nki'
c='\"><em>'
a+='lto:'
b+='@'
e='</em></a>'
f=''
b+='gmail.com'
if (f) d=f
else d=b
document.write(a+b+c+d+e)
}

/* Таймер */
var tcount=0;
var timeLeft=61;
var tf=0;
/*document.isTimer = 1;*/
function TimerRefresh()
{
	setCookie ("timer",document.isTimer, "Mon, 01-Jan-2200 00:00:00 GMT");
	var timer = $("#timer");
	tcount++; timeLeft--;
	minut = (Math.round(timeLeft) - Math.round(timeLeft)%60)/60;
	sec = Math.round(timeLeft)%60;
	if (sec < 10) sec = '0'+sec;
	timer.html(minut+':'+sec);
	if(document.isTimer) {
		tf = window.setTimeout("TimerRefresh();",1000);
		timer.css('color','red');
	} else {
		window.clearTimeout(tf);
		timer.css('color','gray');
		return;
	}
	if(timeLeft == 0) {
	  window.clearTimeout(tf);
	  timeUp=1;
	  getBest();
	}
}
/* -------------------- */

function setCookie (name, value, expires, path, domain, secure) {
 document.cookie = name + "=" + escape(value) +
 ((expires) ? "; expires=" + expires : "") +
 ((path) ? "; path=" + path : "") +
 ((domain) ? "; domain=" + domain : "") +
 ((secure) ? "; secure" : "");
}

function setRejim(val)
{
	setCookie ("rejim",val, "Mon, 01-Jan-2200 00:00:00 GMT");
}


function clearAmount()
{
	$("input[@name='a']").attr('value','');
}

function digitAmount(digit)
{
	var el = $("input[@name='a']");
	/*var val = el.attr('value');*/
	
	if (String(el.attr('value')) == 'undefined') {
		var val = new String("");
	} else {
		var val = new String(el.attr('value'));
	}
	/*alert(val.lastIndexOf('.', val));*/
	if (!val) val='';
	if (val.length==8) return;
	if (digit!='.') {
		el.attr('value',val+digit);
	} else if (val.lastIndexOf('.', '1'+val)=='-1') {
		el.attr('value',val+digit);
	} else return;
	
}

function digitAmountDbl(digit)
{
	if (document.getSelection) return;//код для Netscape
	if (document.selection) digitAmount(digit);//код для Internet Explorer
}



function selEmpty()
{
	if ( document.selection ) document.selection.empty();
	else if ( window.getSelection ) window.getSelection().collapseToStart();
}

function setBgColor(el, col) {
	el.style.background=col;
}

function submitCalc(val)
{
	$('#obmenki').append("<input type='hidden' name='s' value='"+val+"'>");
	$('#obmenki').submit();
	return false;
}


function getBest()
{
	var f = $("#f").get(0).value;
	var t = $('#t').get(0).value;
	var r = $('#r').get(0).value;
	document.location = 'index.php?f='+f+'&t='+t+'&r='+r;
	return false;
}

function ajax_menu()
{
		$(document).ready (function() {
			var arr;
			
			var f = $("#f").get(0).value;
			var t = $('#t').get(0).value;
			var r = $('#r').get(0).value;

			$fSelect = $('#f option');
			$tSelect = $('#t option');
			
			$fSelect.each(
				function(index)
				{
					if ($(this).attr('value') != f)
					{
						arr += '<a href="?f=' + $(this).attr('value') + '&t=' + t + '&r=' + r + '">';
						arr += $(this).text() + '</a><br />';						
					}
					else
					{
						arr += $(this).text();
					}
				}
			);
			
			$tSelect.each(
				function(index)
				{
					if ($(this).attr('value') != t)
					{					
						arr += '<a href="?f=' + f + '&t=' + $(this).attr('value') + '&r=' + r + '">';
						arr += $(this).text() + '</a><br />';						
					}
					else
					{
						arr += $(this).text();
					}
				}
			);			
			
			$('#goldGraph').append(arr);
	});
}


// -->