
	//  FUNCTION: FOR LINK CONFIRMATION

	function confirmLink( theLink ) {
                theMessage = "Opravdu si přejete vymazat tuto položku?";
		if ( typeof( window.opera ) != 'undefined' ) {
			return true;
		}

		var is_confirmed = confirm( theMessage );
		if ( is_confirmed ) {
			theLink.href += '&is_js_confirmed=1';
		}
		return is_confirmed;
	}



    /**
     *  Funkce pro zobrazeni napovedy
     */

    function showHelp( helpID ) {
        $("#"+helpID).toggle();
    }



	// FUNCTION: FOR CHANGING PRODUCER PREFIX

	function changeProducerPrefix( producerID ) {

		defProducerSellingCode	= document.getElementById("product_code_selling").value;

		splitSellingCode	= defProducerSellingCode.split( " " );
		if ( splitSellingCode[0] ) {
			oldPrefix	= splitSellingCode[0];
			newSellingCode	= defProducerSellingCode.replace( oldPrefix + " ", "" );
		} else {
			newSellingCode	= defProducerSellingCode;
		}

		if ( ( producerID == "" ) || ( producerID == "0" ) || ( producerPrefix[ producerID ] == "" ) ) {
			document.getElementById("product_code_selling").value = newSellingCode;
		} else {
			document.getElementById("product_code_selling").value = producerPrefix[ producerID ] + " " + newSellingCode;
		}

	}



function showPaymentSettings(item) {
    value = $(item).val();
    $('.payment-type').hide();
    $('#showPayment_' + value).show();
}



function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }



    /**
     * Zmena zobrazeni jazykove mutace
     */

    function showLanguageSelection() {
        $(".languageSelection").toggle();
    }

    function selectLanguage( sLangShortcut, sLangName ) {
        $("div[id*='lang_']").hide();
        $("#lang_"+sLangShortcut).show();
        $("#currentLanguageFlag").attr({'src':'media/images/flags/' + sLangShortcut + '.png'});
        $("#currentLanguage").text(sLangName);
        showLanguageSelection();
    }



    /**
     * Aktivace polozky
     */

    function activeItem( sURL, sAction, iID, sLink ) {

        $.ajax({
            type: "POST",
            dataType: "json",
            url: sURL,
            data: "action=" + sAction + "&id=" + iID,
            success: function( msg ) {
                $(sLink).text( msg );
            }
        });

    }



    /**
     * Nacteni skriptu po nahrani dokumentu
     */

    $(document).ready(function() {
        $("#currentTime").jclock();
    });



    function changeProductOptions(iID)
    {
        sURL  = "/admin/catalogue_product_options.php";
        sData = "iProductID=" + iID + "&action=showOptionsJson";
        $.ajax({
            type: "POST",
            dataType: "json",
            url: sURL,
            data: sData,
            success: function(msg) {
                var aOptions = new Array;
                var cSelect = $('#product_palette_option_id');
                cSelect.removeOption(/./);
                for ( var iID = 0; iID < msg.length; iID++ ) {
                    aOptions[msg[iID]['id']] = msg[iID]['value'];
                }
                cSelect.addOption( aOptions, false );
            }
        });
    }

