function toggle(id)
{
    $('#'+id).slideToggle('fast');
}
function doAction(command, param)
{
    $('#_action_command').val(command);
    $('#_action_param').val(param);
    $('#aspnetForm')[0].submit();
}

$.fn.extend(
{
    defaultTo: function(original) {
        var org = original;
        return this.each(function() {
            $(this).bind('focus',function() {Handler($(this));});
	    })

        function Handler(object) {
            if (object.val() == '' && org.val() != '') {
                object.val(org.val());
                object.selectAll();
            }
        }
    },

    selectAll: function() {
        var len = this.val().length;
        o = this[0];
        if (o.createTextRange) {
            var r = o.createTextRange();
            r.moveStart("character", 0);
            r.moveEnd("character", len);
            r.select();

        }
        else if (o.setSelectionRange) {
            o.setSelectionRange(0, len);
        }
    },

    insertAtCaret: function(myValue) {
    //http://www.mail-archive.com/jquery-en@googlegroups.com/msg08708.html
    return this.each(function() {
        //IE support
        if (document.selection) {
            this.focus();
            sel = document.selection.createRange();
            sel.text = myValue;
            this.focus();
        }
        //MOZILLA/NETSCAPE support
        else if (this.selectionStart || this.selectionStart == '0') {
            var startPos = this.selectionStart;
            var endPos = this.selectionEnd;
            var scrollTop = this.scrollTop;
            this.value = this.value.substring(0, startPos)
                                      + myValue
                              + this.value.substring(endPos,
this.value.length);
            this.focus();
            this.selectionStart = startPos + myValue.length;
            this.selectionEnd = startPos + myValue.length;
            this.scrollTop = scrollTop;
        } else {
            this.value += myValue;
            this.focus();
        }
    });
}

})


$(function()
{
    $('table.cList1 tbody tr:even').removeClass('alt');
    $('table.cList1 tbody tr:odd').addClass('alt');

    if ($.fn.lightBox) {
    $('.cLightBox').lightBox({
       	overlayBgColor: '#414141',
       	containerResizeSpeed: 200,
       	imageLoading: 'lib/lightbox/images/lightbox-ico-loading.gif',
       	imageBtnClose: 'lib/lightbox/images/btn-close.gif',
       	imageBlank: 'lib/lightbox/images/lightbox-blank.gif',
       	txtImage:'',
       	txtOf:'/'	
    });
	}

    $('#whitetop div.cart')
        .click(function() { window.location = $('a', this).attr("href"); })
        .hover(function() { $(this).addClass('cart-hover'); },
            function() { $(this).removeClass('cart-hover'); })


//		$('#inputLoginLogin').watermark('Jméno');
//    $('#inputLoginPassword').watermark('Heslo');
});


