jQuery.fn.truncate = function(len){  this.val(this.val().substring(0,len));  return false;}jQuery.fn.maxLength = function(len){  var maxLengthKeyPress = new Array();  var maxLengthChange = new Array();  var appleKeyOn = false;    //the second argument should be true if len should be based on  //the maxlength attribute instead of the input  var useAttr = arguments.length>1 ? arguments[1] : false;    var handleKeyUp = function(e)  {    //if the apple key (macs) is being pressed, set the indicator    if(e.keyCode==224||e.keyCode==91)      appleKeyOn = false;  }    var handleKeyDown = function(e)  {    //if the apple key (macs) is being released, turn off the indicator    if(e.keyCode==224||e.keyCode==91)      appleKeyOn = true;  }    var handleKeyPress = function(e)  {       //if this keyCode does not increase the length of the textarea value,    //just let it go    if(appleKeyOn || (e.charCode==0&&e.keyCode!=13) || e.ctrlKey)      return;    //get the textarea element    var textarea = $(this);    //if the length should be based on the maxlength attribute instead of the    //input, use that    len = useAttr ? parseInt(textarea.attr('maxlength')) : len;    //get the value of the textarea    var val = textarea.val();    //get the length of the current text selection    var selected = Math.abs(textarea.attr('selectionStart') - textarea.attr('selectionEnd'));    selected = isNaN(selected) ? 0 : selected;    //if this is the maximum length    if(val.length==len && selected<1)      return false;    else if(val.length>len && selected<(val.length-len))      return textarea.truncate(len);  };    var handleChange = function(e)  {    //get the textarea element    var textarea = $(this);        //if the length should be based on the maxlength attribute instead of the    //input, use that    len = useAttr ? parseInt(textarea.attr('maxlength')) : len;        //truncate the textarea to its proper length    textarea.truncate(len);  };    //get the current keyup and change functions  var removeKeyPress = maxLengthKeyPress[this.selector];  var removeChange = maxLengthChange[this.selector];  //remove the keyup and change functions from any matched elements in case  //a maxlength was previously set and a new one is being set  this.die('keypress', removeKeyPress);  this.die('change', removeChange);    if(len==0 && !useAttr)    return;    //set the keyup and change functions for this element set and all future  //elements matching this selector  this.live('keypress', handleKeyPress);  this.live('change', handleChange);  this.live('keydown', handleKeyDown);  this.live('keyup', handleKeyUp);    //save the current keyup and change functions so that they can be  //remove later  maxLengthKeyPress[this.selector] = handleKeyPress;  maxLengthChange[this.selector] = handleChange;    //trigger a keypress event so that the limit will be enforced  this.keypress();};$(function(){         var cssPrefixString = {};    var cssPrefix = function(propertie) {    if (cssPrefixString[propertie]) return cssPrefixString[propertie] + propertie;    var e = document.createElement('div');    var prefixes = ['', 'Moz', 'Webkit', 'O', 'ms', 'Khtml']; // Various supports...    for (var i in prefixes) {        if (typeof e.style[prefixes[i] + propertie] !== 'undefined') {            cssPrefixString[propertie] = prefixes[i];            return prefixes[i] + propertie;        }    }    return false;};   var cssTransform = cssPrefix('Transform');if (cssTransform ) {    var cssProp = {};    cssProp[cssPrefix('borderRadius')] = '15px';    $('div.boxradius1').css(cssProp);    $('div.boxradius2').css(cssProp);    $('div.boxradius3').css(cssProp);    $('div.boxradius4').css(cssProp);    $('div.boxradius5').css(cssProp);    $('div.boxradius6').css(cssProp);    $('div.boxradius7').css(cssProp);    $('div.boxradius8').css(cssProp);        $('div.boxradius9').css(cssProp);    $('div#boxduplikacji').css(cssProp);    $('div.hiddenoferta').css(cssProp);    $('div.opis_dodatkowy').css(cssProp);}$("#more").click(function(){$(".hiddenoferta").toggle();});             $( "#dialog:ui-dialog" ).dialog( "destroy" );			$( "#dialog-modal_yt" ).dialog({                        autoOpen: false,                        minHeight: 380,                        width: 460,			modal: true		});                 $( "#opener_show_yt_move" ).click(function() {			$( "#dialog-modal_yt" ).dialog( "open" );			return false;		});                                $( "#dialog-modal_popros_referencje").dialog({                        autoOpen: false,                        minHeight: 180,                        width: 460,			modal: true		});                 $( "#opener_modal_popros_referencje" ).click(function() {			$( "#dialog-modal_popros_referencje" ).dialog( "open" );			return false;		});                                $( "#dialog-modal_yt_cv" ).dialog({                        autoOpen: false,                        minHeight: 380,                        width: 460,			modal: true		});                 $( "#opener_show_yt_move_cv" ).click(function() {			$( "#dialog-modal_yt_cv" ).dialog( "open" );			return false;		});                                $( "#dialog-modal_zmian_add_logo" ).dialog({                        autoOpen: false,                        minHeight: 130,                        width: 600,			modal: true		});                 $( "#opener_zmian_add_logo" ).click(function() {			$( "#dialog-modal_zmian_add_logo" ).dialog( "open" );			return false;		});                                $( "#dialog-modal_zm_plik_cv" ).dialog({                        autoOpen: false,                        minHeight: 180,                        width: 500,			modal: true		});                 $( "#opener_show_zm_plik_cv" ).click(function() {			$( "#dialog-modal_zm_plik_cv" ).dialog( "open" );			return false;		});                $( "#dialog-modal_add_plik_cv" ).dialog({                        autoOpen: false,                        minHeight: 180,                        width: 500,			modal: true		});                 $( "#opener_show_add_plik_cv" ).click(function() {			$( "#dialog-modal_add_plik_cv" ).dialog( "open" );			return false;		});                 $( "#dialog-modal_zm_budzet_dzienny" ).dialog({                        autoOpen: false,                        minHeight: 100,                        width: 200,			modal: true		});                 $( "#opener_zm_budzet_dzienny" ).click(function() {			$( "#dialog-modal_zm_budzet_dzienny" ).dialog( "open" );			return false;		});                                $( "#dialog-modal_rejestracja" ).dialog({                        autoOpen: true,                        minHeight: 140,                        width: 260,			modal: true		});                                $( "#dialog-modal_add_xml" ).dialog({                        autoOpen: false,                        minHeight: 370,                        width: 700,			modal: true		});                $( "#opener-modal_add_xml" ).click(function() {			$( "#dialog-modal_add_xml" ).dialog( "open" );			return false;		});                                 $('#addXMLFile').change(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                                $('#addXMLUrl').submit(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                                $('#logoFile').change(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                                $('#ustaw_budzet').submit(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                                $('#fileupload').change(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                $('#fileupload2').change(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                                $('#poprosOref').submit(function(){                        $.loader({                        className:"loader_class",                        content:''                    });                });                });
