
// id элемента который прятать/показать, id кнопки у которой вид менять
function show_hide_element (element_name, button_name){
	if (document.getElementById(element_name).style.display == 'none'){
		document.getElementById(element_name).style.display = '';
//		document.getElementById(button_name).src = 'images/div_hide.gif';
//		document.getElementById(button_name).alt = 'скрыть блок';
		setCookie (element_name, 'show', 'Fri, 31-Dec-2010 00:00:00 GMT');
	} else {
		document.getElementById(element_name).style.display = 'none';
//		document.getElementById(button_name).src = 'images/div_show.gif';
//		document.getElementById(button_name).alt = 'показать блок';
		setCookie (element_name, 'hide', 'Fri, 31-Dec-2010 00:00:00 GMT');			
	}
}

function show_win (width, height, s_url){
	var p_top=(window.screen.height-height)/2, p_left=(window.screen.width-width)/2;
	var imgnwin=window.open(s_url,"imgswin","resizable=yes,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+width+",height="+height+",top="+p_top+",left="+p_left);
	imgnwin.focus();
}

function show_popup (mouseX, mouseY, width, height, content) {
//	alert (content);
	document.getElementById('pop_up').style.left = mouseX;
	document.getElementById('pop_up').style.top = mouseY;
	document.getElementById('pop_up').style.width = width;
	document.getElementById('pop_up').style.height = height;
	document.getElementById('pop_up').innerHTML = content;
	document.getElementById('pop_up').style.visibility = '';
}
function hide_popup() {
	document.getElementById('pop_up').style.visibility = 'hidden';
}

//////////////////////////// ФУНКЦИИ ДЛЯ РАБОТЫ С КУКАМИ /////////////////////////////////
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 GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;

	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}
function getCookieVal( offset )	{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}


 