function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
if (navigator.appName=='Microsoft Internet Explorer') window.attachEvent("onload", correctPNG);

    function poprawPNG() {
        var divs = document.getElementsByTagName('DIV');
       
        for(var i=0; i<divs.length; i++) {

            var div = divs[i];
            var back = eval('div.currentStyle.backgroundImage');
            if(back.indexOf(".png") != -1) {
                div.style.backgroundImage = 'none';
                div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + back.substring(5, back.length-2) + "', sizingMethod='scale')";
            }           

        }
    }

    if(window.attachEvent) {
        window.attachEvent('onload', poprawPNG);
    }



function $( ide ){
	return document.getElementById( ide );
}

function wyswietlMenu( ide ){
	var kont = $( 'kontMenu'+ide );
	
		
	//$('id'+ide).style.color = '#A31113';

		
	advAJAX.get({
				url: 'index.php?module=katalog&akcja=pokazPod&row='+ide+'&ajax=1',
				onInitialization : function() {
					kont.innerHTML = '<img src="tpl/images/czekaj_ico.gif" alt="czekaj" />';
				},
				onSuccess : function(obj) {	
						kont.innerHTML = obj.responseText;	
				},
				onError : function(obj) {
					kont.innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
				}	
			});
	
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}


browserversion = parseInt(navigator.appVersion);
}
function FirmaRoll(Nazwa) {
objFirma = document.getElementById(Nazwa);
if (objFirma.style.display=="block") objFirma.style.display="none";
else objFirma.style.display="block";
}
function rollOutFlash(myToggle,Nazwa)
{
objIn = document.getElementById(Nazwa);
objIn.SetVariable ("_root.myToggle"," " + myToggle);
}
function chkNewsletter() {
objZapisz1_1 = document.getElementById('NewsLetter1_1');
objZapisz1_2 = document.getElementById('NewsLetter1_2');
objWypisz2_1 = document.getElementById('NewsLetter2_1');
objWypisz2_2 = document.getElementById('NewsLetter2_2');
if (objZapisz1_1.style.display == 'inline') {
	objZapisz1_1.style.display = 'none';
	objZapisz1_2.style.display = 'inline';
	objWypisz2_1.style.display = 'inline';
	objWypisz2_2.style.display = 'none';
	}
else {
	objZapisz1_1.style.display = 'inline';
	objZapisz1_2.style.display = 'none';
	objWypisz2_1.style.display = 'none';
	objWypisz2_2.style.display = 'inline';
	}
}
function correctNewsletter() {
wpis = document.getElementById('newsletter');
objZapisz1_1 = document.getElementById('NewsLetter1_1');
todo = document.getElementById('todo');
if (objZapisz1_1.style.display == 'none') todo.value = 'Wypisz';
else todo.value = 'Zapisz';
var regEmail = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{1,4})$/;
if (!regEmail.test(wpis.value)) {
	alert( "Podaj prawidłowy format e-maila." );
	return false ;
	}
else return true;
}
function chgMenu(name) {
Act = name.substr(5,6);
listObj = document.getElementsByTagName('div');
for (i=0;i<listObj.length;i++) {
	if (listObj[i].id.substr(0,7)=='SubMenu') {
		if (listObj[i].id.substr(8,9) == Act) listObj[i].style.display = "block";
		else listObj[i].style.display = "none";
		};
	}
}


	var opt_values=new Array('','tygodniowe','miesieczne','kwartalne','polroczne');
	var opt_colors=new Array('blue','green','green','green','green');
	var opt_txt_pl=new Array('wszystkie notowania','ostatni tydzień','ostatni miesi&#353;c','ostatni kwartał','ostatnie pół roku'); 

	function Clear()
	{
    		for(var i = document.getElementById('tryb').length-1; i >=0; i--)
    		{
	    		document.getElementById('tryb').options[i] = null;
    		}
	}

	function FillSelect(par)
	{
      		Clear();
		if( par == 'PDA' )
		{
			cnt=1;
		}
		else
		{
			cnt=opt_values.length;
		}
		for(var i = 0; i < cnt; i++)
    		{
	    		document.getElementById('tryb').options[i] = new Option(opt_txt_pl[i], opt_values[i], false, false);
			document.getElementById('tryb').options[i].style.color= opt_colors[i];
    		}
		Pokaz();
	}

	function Pokaz()
	{
		for( i = 1; i <= 2; i++ )
		{
			radio = document.getElementById('spolka' + i);
			if( radio.checked == true )
			{
				val1 = radio.value;
			}
		}
		var select = document.getElementById('tryb');
		var val2 = select.options[select.selectedIndex].value;
		frames["wykresMK"].location.href="http://elfin.pl/MAKARONY/wykres.html?id_sp="+val1+"&tryb="+val2;
	}
// Event and Listners //
//if (document.addEventListener){ // Mozilla, Netscape, Firefox
//	window.addEventListener("load", chkNewsletter, false);
//} else { // IE
//	document.attachEvent('onload', chkNewsletter);
//}
