var ie=document.all;
var nn6=document.getElementById&&!document.all; 

function confirmSubmit(){
	var agree=confirm("Czy jesteÅ? tego absolutnie pewien ?");
	if (agree)
		return true ;
	else
		return false ;
} 

function confirmDelete(id){
	var agree=confirm("Czy jesteÅ? tego absolutnie pewien ?");
	if (agree){
		document.mainform.edit.value='usun';	
		document.mainform.id.value=id;
		document.mainform.submit();
	}
} 

function otworz_okno(url){
	window.open(url, 'okno', 'status=no, width=600, height=450');
	return;
}

function okno_pomoc(url){
        window.open(url, 'okno','menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, fullscreen=no, channelmode=no, width=800, height=600');
        return;
} 

function Pokaz(warstwa){
	if (nn6){
		document.getElementById(warstwa).style.visibility = "visible"; 
	//	document.getElementById(warstwa).style.position = "static";	
		document.getElementById(warstwa).style.display = "block";	
	} else {
		document.all[warstwa].style.visibility = "visible"; 
	//	document.all[warstwa].style.position = "static";
		document.all[warstwa].style.display = "block";
	}
}

function Zaslon(warstwa){
	if (nn6){
		document.getElementById(warstwa).style.visibility = "hidden"; 
	//	document.getElementById(warstwa).style.position = "absolute";	
		document.getElementById(warstwa).style.display = "none";		
	} else {
		document.all[warstwa].style.visibility = "hidden"; 
	//	document.all[warstwa].style.position = "absolute";	
		document.all[warstwa].style.display = "none";
	}
}

function ClearForm(pole, pole1){
	document.getElementById(pole).value='';
	document.getElementById(pole1).value='';
}


function writeTempValue(fieldName, fieldObj) {
	fieldForm = fieldObj.form;
	//alert(fieldName+" => "+fieldForm.name+" - "+fieldForm.elements.length);
	for (i=0; i<=fieldForm.elements.length; i++) {
		//alert(fieldForm.elements[i].name);
		if (fieldForm.elements[i].name == fieldName ) {
			fieldForm.elements[i].value = fieldObj.value;
			break;
		}
	}				
}


function show(id)
{
	var cid = document.getElementById("cid");
	if (cid.value != '0')
	{
		var hide = document.getElementById(cid.value);
		hide.style.display = 'none';
	}
	
	var fields = document.getElementById(id);
	fields.style.display = 'block';
	cid.value = id;

}

function show2(id)
{
	var cid2 = document.getElementById("cid2");
	if (cid2.value != '0')
	{
		var hide = document.getElementById(cid2.value);
		hide.style.display = 'none';
	}
	
	var fields = document.getElementById(id);
	fields.style.display = 'block';
	cid2.value = id;

}


function externalLinks() {
    if( ! document.getElementsByTagName )
        return;

    var anchors = document.getElementsByTagName( "a" );
        for (var i=0; i<anchors.length; i++) {
            var anchor = anchors[i];
            if( anchor.getAttribute( "href" ) && anchor.getAttribute( "rel" ) == "external" )
                anchor.target = "_blank";
        }
}

window.onload = externalLinks;

function Activate(element,element2)
{
	var elem=document.getElementById('item_'+element);
	var bg_src=document.getElementById('menu_'+element);
	var src=document.getElementById(element2);
	var elem2=document.getElementById(element2);
	if(elem2.value>0)
	{
		var src2=document.getElementById('item_'+elem2.value);
		var bg_src2=document.getElementById('menu_'+elem2.value);
	bg_src2.style.backgroundPosition='0 0';
	bg_src2.style.color='#fff';
	src2.style.display='none';

	}

	if(bg_src) 
	{
		bg_src.style.color='#000';
		bg_src.style.backgroundPosition='0 -92px';
		elem.style.display='block';
		src.value=element;
	}
}


