function toggleMenu(id) {
	if (navigator.appName == "Microsoft Internet Explorer") { 
		Effect.toggle('menu_'+id, 'appear'); 
	}	else { 
		Effect.toggle('menu_'+id, 'slide'); 
	}	
}

function getCurPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

function showBox(content, w, h) {
	var content = content || '';
	var width = w || 300;
	var height = h || 200;
	var curs = getCurPosition();
	var pr = document.getElementById("editor");
	if(pr == undefined) {
		pr = document.createElement('div');   
		pr.id = 'editor';   
		pr.style.display = "none";
		document.body.appendChild(pr);
		//alert("creating div element");
		//document.write('<div style="display:none;" id="editor"></div>');
		//pr = document.getElementById("editor");
	}
	pr.style.top = curs.y + 25;
	pr.style.left = curs.x + 20;
	pr.style.width = width;
	pr.style.height = height;
	Effect.toggle('editor', 'appear'); 
	new Draggable('editor', { starteffect: 'null' });
	//pr.innerHTML = '<a href="javascript:void(0);" onclick="closeBox();"><img src="/images/win_close.gif" width="14" height="14" alt="Закрыть окно" style="float: right; margin-top: 3px; margin-right: 3px;" border="0"></a>'+content;
	pr.innerHTML = '<input type="button" style="width: 14px; height:14px; background: url(/images/win_close.gif) no-repeat; float: right; margin-top: 3px; margin-right: 3px; border: 0; cursor: hand;" title="Закрыть окно" onclick="closeBox();">'+content;
	content = '';
	return false;
}

function closeBox(){
	Effect.toggle('editor', 'appear'); 
}

function clearTip(elem, val) {
	if(!elem.value) return '';
	if(!val) return '';
	if(elem.value == val) elem.value = '';	
	return true;
}