var activeTab = null;
var activeTTab = null;

var activeInfo = null;

function dropInfo(blockId) {
    var blockNode = document.getElementById(blockId);
    if(activeInfo!=null) {
    	activeInfo.style.display = 'none';
    }
    if(activeInfo==blockNode) {
    	activeInfo=null;
    } else {
    	activeInfo=blockNode;
    	blockNode.style.display='block';
    }
}

function dropTab(blockId) {
    var blockNode = getElem(blockId);
    var ttab = getElem('t'+blockId);    
	if(activeTab==blockNode) {//ta sama zakladka - wylaczenie
		activeTab=null;
		activeTTab.className='';
		blockNode.style.display = 'none';		
		activeTTab=null;
	} else {
	    blockNode.style.display='block';
		if(activeTab!=null) { //przelaczenie na inna zakladke
			activeTab.style.display='none';
			activeTTab.className='';
		}
		activeTab = blockNode;
		activeTTab = ttab;
		activeTTab.className='active';
	}
}

	var prevImg='';
	function showImage(url,id){
		document.getElementById(prevImg).style.border='';	
		document.getElementById(id).style.border='1px solid black';
		prevImg=id;		
		document.images.im.src=url;
	}
	
	function doVisible(id,display)
	{
		var control=document.getElementById(id)
		control.style.display=display;
	}

var checked=false;

function check_form(id)
{
	checked=true;
	return testValidate(id);
}

function validate(id,valid)
{
	if(valid)
		document.getElementById(id).style.display='none';
	else
		document.getElementById(id).style.display='block';
	return valid;
}

 
function openWindow(url,w,h,scroll,resiz) {
    nwnd=window.open(url,'test','height='+h+',width='+w+',scrollbars='+scroll+',resizable='+resiz);
    nwnd.focus();
} 

function resizeToContent(addX,addY) {
    var win_w, win_h;
    if (self.innerHeight) {
        win_w = self.innerWidth;
        win_h = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        win_w = document.documentElement.clientWidth;
        win_h = document.documentElement.clientHeight;
    } else if (document.body) {
        win_w = document.body.clientWidth;
        win_h = document.body.clientHeight;
    }
    window.resizeTo(win_w+addX,win_h+addY);
}

function getElem(Elem) {
	if(document.getElementById) {
		return document.getElementById(Elem);
	} else if (document.all){
		return document.all[Elem];
	}
}