function o(nodeName) {
	return document.getElementById(nodeName);
};

function openImage(url, width, height) {
    var sc=(width>screen.width-50 || height>screen.height-50 ? 'yes':'no')
    var ow=(width>screen.width-50 ? screen.width:width*1+50);
    var oh=(height>screen.height-50 ? screen.height:height*1+50);
	window.open(url, '', 'width='+ow+'px, height='+oh+'px, scrollbars='+sc);
	return false;
};

function _patchManualImagesClasses() {
    var images=document.getElementsByTagName('img');
    for(var i=0; i<images.length; i++ ) {
        var id=images[i].id;
        if (images[i].getAttribute('mediaid') != null || images[i].getAttribute('uid') != null ) {
            var _m=images[i];
            var align=_m.getAttribute('align');
            var iClass=_m.getAttribute('className');
            if (iClass == null || iClass.length==0 ) {
                iClass=_m.getAttribute('class');
            };

            if (iClass==null || iClass.length==0 ) {
                _m.setAttribute('class', 'img_'+align);
                _m.setAttribute('className', 'img_'+align);
            };
        };
    };
};

var m_hidden=new Array();
var m_opened=new Array();

function m_show(id) {
	for(var i=0; i<m_opened.length; i++ ) {
		if (m_opened[i] != id ) {
			o('subnav'+m_opened[i]).style.display='none';			
		};
	};
	var tmp=new Array();
	for(var i=0; i<m_hidden.length; i++ ) {
		if ( m_hidden[i]!=id ) {
			tmp.push( m_hidden[i] );
		};
	};
	m_hidden=tmp;
	o('subnav'+id).style.display='block';
	m_opened=new Array();
	m_opened.push(id);
};

function m_hide(id, flagTP) {
    var flag=0;
	var tmp=new Array();
	for(var i=0; i<m_hidden.length; i++ ) {
		if ( m_hidden[i]==id ) {
			o('subnav'+m_hidden[i]).style.display='none';
			flag=1;
		} else {
			tmp.push( m_hidden[i] );
		};
	};

	for(var i=0; i<m_opened.length; i++ ) {
		if (m_opened[i]==id && flagTP==1) return false;
	};


	if (flag ==0 ) {
		m_hidden.push(id);
		for(var i=0; i<m_opened.length; i++ ) {
			
		};
		if (flagTP!=1 ) {
			window.setTimeout("m_hide("+id+", 1)", 500);
		};
	} else {
		m_hidden=tmp;
		if ( !tmp.length) return false;
	};
};

var dCnt=0;
function debug(msg) {
	return false;
	dCnt++;
	o('debug').innerHTML=dCnt+':'+msg+'<br/>'+o('debug').innerHTML;
};

function showStory(id) {
	var divs=document.getElementsByTagName('SPAN');
	var re=/story(\d+)/
	for(var i=0; i<divs.length; i++ ) {
		var tmp=divs[i].id
		if (tmp != null ) {
			var res=tmp.match(re);
			if (res!=null && res.length>0 && divs[i].style.display!='none' ) {
				hideStory(res[1]);
			};
		};
	};
        if (o('anounce'+id) != null ) {
		o('anounce'+id).style.display='none';
        };
	o('link'+id).style.display='none';
	o('story'+id).style.display='block';
};

function hideStory(id) {
	o('story'+id).style.display='none';
	o('link'+id).style.display='block';
	o('link'+id).focus();
        if (o('anounce'+id) != null ) {
		o('anounce'+id).style.display='inline';
        };
};

function _ChangeDisplay(node) {
	if (o(node).style.display == 'none' ) {
              o().style.display='block';
        } else {
              o().style.display='none';
        };
};

var opera=false;