	/**
	  * -----------------------------------------------------------------------------
	  * Funkcje JavaScript ogólnego przeznaczenia
	  * @version $Id: script001.js, v 1.0 6 VIII 2006 15:41:11 Exp $
	  * @name script001.js
	  * -----------------------------------------------------------------------------
	  */


  	/**
	  * -----------------------------------------------------------------------------
	  * Funkcja odpowiedzialna za wyświetlanie plików Flash
	  *
	  * @param int     id 		      Identyfikator elementu w pliku HTML
	  *
	  * Example: {flash file="file.swf" extra='<param name="wmode" value="transparent">'}
	  *
	  * @access public
	  *
	  * @return string | JavaScript_Error  				String on success or a JavaScript_Error on failure.
	  * -----------------------------------------------------------------------------
	  */
	function showFlash(id) {
		document.getElementById(id).outerHTML = document.getElementById(id).outerHTML;
	}
	/**
	  * -----------------------------------------------------------------------------
      * Funkcja odpowiedzialna za wyświetlanie plików Flash - end
	  * -----------------------------------------------------------------------------
      */


	/**
	  * -----------------------------------------------------------------------------
      * Funkcja odpowiedzialna za prawidłowe wyświetlanie plików Flash w IE (bez obramowań)
	  *
	  * Example: wywołana na samym końcu szablonu
	  * Używana w przypadku gdy nie korzystamy powyższej funkcji "showFlash(id)"
	  *
	  * @access public
	  *
	  * @return string | JavaScript_Error  				String on success or a JavaScript_Error on failure.
	  * -----------------------------------------------------------------------------
	  */
	function updateFlash() {
		 objects = document.getElementsByTagName("object");
		 for (var i = 0; i < objects.length; i++) {
			 objects[i].outerHTML = objects[i].outerHTML;
		 }
	}
	/**
	  * -----------------------------------------------------------------------------
	  * Funkcja odpowiedzialna za prawidłowe wyświetlanie plików Flash w IE - end
	  * -----------------------------------------------------------------------------
      */


	/**
	  * -----------------------------------------------------------------------------
      * Funkcja odpowiedzialna za blokadę wyswietlania strony w ramkach 			 // break out of frames
	  *
	  * Example: Wywołanie funcki w sekcji <head></head>
	  *
	  * @access public
	  *
	  * @return void | JavaScript_Error  				Break out of frames on success or a JavaScript_Error on failure.
	  * -----------------------------------------------------------------------------
	  */
	function breakOutFrames () {
		if (window.location != top.window.location) {
			top.window.location = window.location;
		}
	}
	/**
	  * -----------------------------------------------------------------------------
	  * Funkcja odpowiedzialna za blokadę wyswietlania strony w ramkach  - end
	  * -----------------------------------------------------------------------------
      */


	function focusElement(e) {
		e.focus();
	}



	function przelaczPola(form)
	{
	Pic = '/_mm/_d/bg-input.gif'
	Pic2= '/_mm/_d/bg-input3.gif'
	obrazek = new Image();
	obrazek.src = Pic;
	obrazek2 = new Image();
	obrazek2.src = Pic2;

        if (form.type[0].checked == true)
        {
            form.business.disabled = false;
            form.personal.disabled = true;
            form.buspersonal.disabled = true;

            document.getElementById("business").style.background = 'url(/_mm/_d/bg-input.gif)';
            document.getElementById("personal").style.background = 'url(/_mm/_d/bg-input3.gif)';
            document.getElementById("buspersonal").style.background = 'url(/_mm/_d/bg-input3.gif)';
            /*
            document.getElementById("business_error").innerHTML = 'Required';
            document.getElementById("personal_error").innerHTML = '';
            document.getElementById("buspersonal_error").innerHTML = '';*/
        }


        if (form.type[1].checked == true)
        {
            form.business.disabled = true;
            form.personal.disabled = false;
            form.buspersonal.disabled = true;

            document.getElementById("business").style.background = 'url(/_mm/_d/bg-input3.gif)';
            document.getElementById("personal").style.background = 'url(/_mm/_d/bg-input.gif)';
            document.getElementById("buspersonal").style.background = 'url(/_mm/_d/bg-input3.gif)';
            /*
            document.getElementById("business_error").innerHTML = '';
            document.getElementById("personal_error").innerHTML = 'Required';
            document.getElementById("buspersonal_error").innerHTML = '';      */
        }

        if (form.type[2].checked == true)
        {
            form.business.disabled = true;
            form.personal.disabled = true;
            form.buspersonal.disabled = false;

            document.getElementById("business").style.background = 'url(/_mm/_d/bg-input3.gif)';
            document.getElementById("personal").style.background = 'url(/_mm/_d/bg-input3.gif)';
            document.getElementById("buspersonal").style.background = 'url(/_mm/_d/bg-input.gif)';
            /*
            document.getElementById("business_error").innerHTML = '';
            document.getElementById("personal_error").innerHTML = '';
            document.getElementById("buspersonal_error").innerHTML = 'Required';   */
        }


       // disabledDaneChange(form);
	}


	function requireds(form)
	{

        if (form.type[0].checked == true)
        {

        	document.getElementById("business_error").style.display = '';
            document.getElementById("business_error").innerHTML = 'Wymagane';
            document.getElementById("personal_error").style.display = 'none';
            document.getElementById("buspersonal_error").style.display = 'none';
            /*document.getElementById("personal_error").innerHTML = '';
            document.getElementById("buspersonal_error").innerHTML = '';*/
        }


        if (form.type[1].checked == true)
        {

            document.getElementById("business_error").style.display = 'none';
            document.getElementById("personal_error").style.display = '';
            document.getElementById("personal_error").innerHTML = 'Wymagane';
            document.getElementById("buspersonal_error").style.display = 'none';
        }

        if (form.type[2].checked == true)
        {

            document.getElementById("business_error").style.display = 'none';
            document.getElementById("personal_error").style.display = 'none';
            document.getElementById("buspersonal_error").style.display = '';
            document.getElementById("buspersonal_error").innerHTML = 'Wymagane';
        }


       // disabledDaneChange(form);
	}

	function disabledDaneChange(form)
	{

  //  form.firma.disabled = false;
        if(!form)
            return true;

      /*  if(form.NipRegonPeselDisabled)
            var vals = form.NipRegonPeselDisabled.value.split('/');
        else
            return true;
        */


    if(vals[2] == 't')
    {
        form.business.disabled = true;
    }
    if(vals[0] == 't')
    {
        form.personal.disabled = true;
    }
    if(vals[1] == 't')
    {
        form.buspersonal.disabled = true;
    }


	}

	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
	}

	function eraseCookie(name) {
	createCookie(name,"",-1);
	}


	function otworz(theURL,winName,features)
    {
    window.open(theURL,winName,features);
    }



    function updateDIV(mydiv,url)
    {
    	var params = 'param1=value&param2=value2';
    	var myAjax = new Ajax.Updater(mydiv, url, {asynchronous:true, evalScripts:true, onLoaded:function(request){Element.hide('progress')}, onLoading:function(request){Element.show('progress')}});
	}

    function updateDIV2(mydiv,url)
    {
    	var params = 'param1=value&param2=value2';
		var myAjax = new Ajax.Updater(mydiv, url, {asynchronous:true, evalScripts:true});
	}

    function updateDIV3(mydiv,url)
    {
    	var params = 'param1=value&param2=value2';
    	var myAjax = new Ajax.Updater(mydiv, url, {asynchronous:true, evalScripts:true, onLoading:function(request){Element.show('progress')}, onLoaded: function(){Element.hide('progress'); new Effect.Appear('perms');}});
    }

    function updateDIV4(mydiv,url)
    {
    	var params = 'param1=value&param2=value2';
    	var myAjax = new Ajax.Updater(mydiv, url, {asynchronous:true, evalScripts:true, onLoading:function(request){Element.show('progress')}, onLoaded: function(){Element.hide('progress'); new Effect.Appear('message');}});
    }

    function updateDIV5(mydiv,content)
    {
    	document.getElementById(mydiv).innerHTML = content;
    }

    
	function visi(nr)
	{
		if (document.layers)
		{
			vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
			document.layers[nr].visibility = vista;
		}
		else if (document.all)
		{
			vista = (document.all[nr].style.visibility == 'hidden') ? 'visible'	: 'hidden';
			document.all[nr].style.visibility = vista;
		}
		else if (document.getElementById)
		{
			vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
			document.getElementById(nr).style.visibility = vista;

		}
	}

	function blocking(nr)
	{
		if (document.layers)
		{
			current = (document.layers[nr].display == 'none') ? 'block' : 'none';
			document.layers[nr].display = current;
		}
		else if (document.all)
		{
			current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
			document.all[nr].style.display = current;
		}
		else if (document.getElementById)
		{
			vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
			document.getElementById(nr).style.display = vista;
		}
	}

