m1 = new Image();
m1.src="/i/m1_on.gif";
m2 = new Image();
m2.src="/i/m2_on.gif";
m3 = new Image();
m3.src="/i/m3_on.gif";
m4 = new Image();
m4.src="/i/m4_on.gif";
m5 = new Image();
m5.src="/i/m5_on.gif";
m6 = new Image();
m6.src="/i/m6_on.gif";
m7 = new Image();
m7.src="/i/m7_on.gif";


function pic_on(id){
	if (document.getElementById(id)){
		//idtd = "td"+id;
		//document.getElementById(idtd).style.background = "url(i/bg_menu_on.gif)";
		document.getElementById(id).src = "/i/" + id + "_on.gif";
	}
}

function pic_off(id){
	if (document.getElementById(id)){
		//idtd = "td"+id;
		//document.getElementById(idtd).style.background = "url(i/bg_menu.gif)";
		document.getElementById(id).src = "/i/" + id + ".gif";
	}
}
function setcookie(name,value) {
	var c = name+"="+value+"; path=/";
	var date = new Date();
	date.setDate(date.getYear()+1);
	c+="; expires="+date.toGMTString();
	document.cookie = c;
}

function getcookie(sName) {
	var c = document.cookie.split("; ");
	for (var i=0; i < c.length; i++) {
		var nv = c[i].split("=");
		if (sName == nv[0])	return unescape(nv[1]);
	}
	return null;
}


function setcur(val) {
	setcookie('currency',val);
	window.location.reload();
}

var cur_div;
var sel;

function show(id){
	
	if (cur_div){
		if (document.getElementById("sub"+cur_div)) {
			document.getElementById("sub"+cur_div).style.display = "none";
		}
			
	}else{
	
		if (document.getElementById("sub_")) { 
			document.getElementById("sub_").style.display="none";
		}
	}	
	document.getElementById("sub"+id).style.display = "block"; 
	cur_div = id;

}

function currency(val){
		
	if (val == 999) {
		document.getElementById('alert').style.display = 'none';
		document.getElementById('window').style.display = 'none';
		setcookie('currency',sel);
		window.location.reload();
		return;
	}
	if (val == 666) {
		document.getElementById('alert').style.display = 'none';
		document.getElementById('window').style.display = 'none';
		document.valuta.sel.options[cur_selected].selected = 'selected';
		return;
	}

	init();
	sel = val;
	//str = 'послать всех нахуй?';
	str = '<br>Сменить текущую валюту?<br><br><input type="button" value=" Да " onClick="currency(999)" style="width:80;"> <input type="button" value=" Нет " onClick="currency(666)" style="width:80;">';
	document.getElementById('alert').innerHTML = str;
	document.getElementById('alert').style.display = 'block';
	document.getElementById('window').style.display = 'block';
	
}
function init(){
	dt = document.body.scrollTop;
	dh = document.body.clientWidth;
	dv = document.body.clientHeight;
	dx = dh/2; 
	dy = dv/2 + dt;
	document.getElementById('window').style.top = dy - 100;
	document.getElementById('window').style.left = dx - 150;
	document.getElementById('alert').style.top = dy - 50;
	document.getElementById('alert').style.left = dx - 150;
}
