﻿(function($) {
    $(document).ready(function() {
        if ($(document).find('#JustinBieber').length > 0)
            $('body').pan({ fps: 15, speed: 1, dir: 'left' });
    });
})(jQuery);

(function($) {

    var bg1 = '#background_hair';
    var bg2 = '#background_cap';
    var image1 = '#background_cap_small';
    var image2 = '#background_hair_small';
    var varAux;
    var bgAux;

    $(function() {
        $('#background_cap_small, #background_hair_small').wrapAll('<div id="content_cap_hair" />');
    })

    $(function() {
        changeGaga();
        setInterval(function() { changeGaga() }, 15000)
    })

    function changeGaga() {
        $(image2).animate({
            left: $(window).width()
        }, 1500, function() {
            $(bg2).fadeOut(3000);
            $(bg1).fadeIn(3000, function() {
                $(image1).animate({
                    left: 0
                }, 2500, function() {
                    bgAux = bg1;
                    bg1 = bg2;
                    bg2 = bgAux;
                    varAux = image1;
                    image1 = image2;
                    image2 = varAux;
                })
            });
        })
    }
})(jQuery);

/* FACEBOOK 
------------------------------------------------------------------------------------------------*/

// There is different api codes : Productions and Localohst
var localhost = location.host.toLowerCase();
if (localhost.indexOf(':2591') >= 0)
    var apiCode = 'b782d9d7d39ec50626dc92fc55bcbf5e'; // Dev
else if (localhost.indexOf('playphone.ca') >= 0) {
    var apiCode = '0fdd4755ddb51d44ac3c9ee3d0fa832b'; // PRODUCAO CA
} else {
    var apiCode = '0ff25c8ac052d8d7549eedff4b12aa9d'; // PRODUCAO US
}
var facebookApiCode = apiCode;
var facebookUrl = 'http://' + location.host + '/';


/* EASTER HEADER 
------------------------------------------------------------------------------------------------*/

/*var strTop = '';

strTop += '<object id="VideoPlayback" height="135" width="980" data="http://static.playphone.com/Alexander/Images/980x135_easter.swf" type="application/x-shockwave-flash">';
strTop += '<param value="http://static.playphone.com/Alexander/Images/980x135_easter.swf" name="movie"/>';
strTop += '<param value="sameDomain" name="allowScriptAcess"/>';
strTop += '<param value="best" name="quality"/>';
strTop += '<param value="transparent" name="wmode"/>';
strTop += '<param value="noScale" name="scale"/>';
strTop += '<param value="TL" name="salign"/>';
strTop += '<param value="playerMode=embedded&link=" name="FlashVars"/>';
strTop += '</object>';

$(function() {
$('#column_m1_1').prepend('<div class="easterTop">' + strTop + '</div>');
})*/



; (function($) {


    /* HELP TOLLTIPS
    ------------------------------------------------------------------------------------------------*/
    $.fn.overHelp = function() {
        $(this).hover(function() { $(this).find('span').css('display', 'block') }, function() { $(this).find('span').css('display', 'none'); })

        if ($(window).width() <= 1280) {
            $(this).find('span').css("left", -$(this).find('span').width() + "px");
        }
        else {
            $(this).find('span').css("left", "0");
        }
    }

    /* TOOLTIPS
    ------------------------------------------------------------------------------------------------*/
    $.fn.tips = function(txt) {
        $(this).live('mouseover', function() {
            //removo todos os anteriores
            $('.tips').remove();

            var str = '';

            str += '<div class="tips">';
            str += '<div class="tipsContainer">' + txt + ' </div>';
            str += '</div>';

            $(this).after(str);
            $('.tipsContainer').css({
                top: '-20px',
                left: '-17px'
            });

            $('.tipsContainer').corner("round 4px");
        });

        $(this).live('mouseout', function() {
            $('.tips').remove();
        })
    }


    /* SHOW ON FOCUS
    ------------------------------------------------------------------------------------------------*/
    $.fn.focusDescription = function() {
        $(this).focus(function() {
            $(this).parent().find('.fieldDescription').fadeIn();
        }).blur(function() {
            $(this).parent().find('.fieldDescription').fadeOut();
        })

    }

    /*	ESCONDE O TOOLTIP NO MOMENTO EM QUE DIGITA ALGUM TEXTO
    ------------------------------------------------------------------------------------------------*/
    $.fn.keyUpHideToolTip = function() {
        $(this).keyup(function() {
            if ($(this).val() != '') {
                $(this).parent().find('.fieldDescription').hide();
            }
            else {
                $(this).parent().find('.fieldDescription').show();
            }
        })
    }


    /* FOCUS ON INPUT
    ------------------------------------------------------------------------------------------------*/
    $.fn.focusMe = function() {
        if ($("#HowPlayphoneWorks").length == 0 && $("#Home").length == 0)
            $(this).find('input:eq(0)').focus();
    }


    /* SUBTITLE OVER
    ------------------------------------------------------------------------------------------------- */
    $.fn.overSubtitle = function() {

        $(this).click(function() {
            $(this).parent().find('li').removeClass('active');
            $(this).addClass('active');
        })
    }

    /* LEGALLINES SCROLLTO
    ------------------------------------------------------------------------------------------------- */
    $.fn.legalLinesScroll = function() {
        if ($(this).length >= 1) {
            var sizeWindow = $('.legalLines').offset().top - $(window).height() + 100;

            if (sizeWindow > 0)
                $(window).scrollTo(sizeWindow, 800)
        }
    }

    /* OVER CLASSNAME 
    ------------------------------------------------------------------------------------------------- */
    $.fn.over = function(nameClass) {
        $(this).live('mouseover', function() {
            $(this).addClass(nameClass);
        })

        $(this).live('mouseout', function() {
            $(this).removeClass(nameClass);
        })
    }

    /* BORDER BUTTON
    ------------------------------------------------------------------------------------------------- */
    $.fn.border = function() {
        $(this).before('<span class="left"></span>').after('<span class="right"></span>');
    }

})(jQuery);

$(function() {

    // Insere curva no Top de signUpSideBar
    $('.signUpSideBar').prepend('<img class="cornerTopSignUpSideBar" src="http://static.playphone.com/Alexander/Images/top_signUpSideBar_infoCreate.jpg">').append('<img class="cornerBottonSignUpSideBar" src="http://static.playphone.com/Alexander/Images/botton_signUpSideBar_infoCreate.jpg">');
    $('.signUpHowWorks').prepend('<img class="cornerTopsignUpHowWorks" src="http://static.playphone.com/Alexander/Images/corner_top_sign.gif">').append('<img class="cornerBottonsignUpHowWorks" src="http://static.playphone.com/Alexander/Images/corner_botton_sign.gif">');

    //Credits  Info
    $('.creditsInfo').click(function() {
        $('.offersList').slideToggle('fast');
    });

    //Over Help
    $('.helpIco').overHelp();

    //caso redimensione a tela chamo a fucnao novamente
    $(window).resize(function() { $('.helpIco').overHelp(); });

    //Focus Description
    $('#txtRegisterUserName, #txtRegisterPassword, #txtRegisterConfirmPassword, #txtRegisterEmail, #GiftCard #txtRegisterCellPhoneNumberControl_1, #GiftCard #txtRegisterCellPhoneNumberControl_2, #GiftCard #txtRegisterCellPhoneNumberControl_3, #txtGiftCardNumberControl_1, #txtGiftCardNumberControl_2, #txtGiftCardNumberControl_3, #txtGiftCardNumberControl_4, #txtGiftCardUserName, #txtGiftCardPassword, #txtGiftCardConfirmPassword, #txtGiftCardEmail, #createUserName, #createPassword, #createConfirmPassword, #createEmail').focusDescription();

    // Esconde Tolltip qdo digita o texto
    $('.signUpHowWorks input[type=text],.signUpHowWorks input[type=password], .signUpSideBar input[type=text],.signUpSideBar input[type=password]').keyUpHideToolTip();

    //funcao generica para focus
    $('.placeHolder').focusMe('over');

    //Esconder a borda de todos os campos de Checkbox/Radio
    $('input:checkbox,input:radio').css({ border: 'none', verticalAlign: 'middle' })

    //bordas botoes
    $('.button').find('span, a, input').live('click', function() {
        var obj = this;
        setTimeout(function() {
            if (obj.anularlink || $(obj).is("a"))
                return;

            var l;
            if ($(obj).hasClass('left'))
                l = $(obj).next()
            else if ($(obj).hasClass('right'))
                l = $(obj).prev();

            if (l == null || l == undefined)
                return;

            if (l.is("a")) {
                //l[0].click();
                var url = l.attr("href");
                if (url == "" || url.indexOf("void(0)") > -1)
                    l.trigger("click");
                else
                    location.href = l.attr("href");
            } else if (l.is("input[type=submit]")) {
                l[0].click();
            }
        }, 100);
    }).border();


    //over botoes
    $('.button').over('over');

    //over no botao do search
    $('.search_ico').hover(function() { $(this).addClass('active') }, function() { $(this).removeClass('active') });

    //Scroll ate a legallines
    $('.legalLines').legalLinesScroll();

    //subtitle over
    $('.subtitle ul li').overSubtitle();

    //Esconde a curva dos item somente no ie6
    hideCornersIE6();

})


//Ticker
function showTicker(colorTicker, sizeTicker, speedTicker) {

    speedTicker *= 1000; //converte a velocidade para milisegundos

    //manipulo as caracteristicas do ticker baseado nos paramentros recebidos
    $('.tickerControler').css({
        color: 'white',
        fontSize: sizeTicker
    });

    //caso queira fechar o Ticker
    $('.closeTicker').click(function() {
        $.ajax({
            url: "/ticker.ashx",
            data: "close=true",
            type: "POST",
            cache: false
        });

        $('#ticker').slideUp('slow', function() {
            $('#showTicker').slideDown('slow');
            $('#ticker').trigger('mouseover');
        });
    });

    //caso queira fechar o Ticker
    $('#showTicker').live('click', function() {
        $.ajax({
            url: "/ticker.ashx",
            data: "close=false",
            type: "POST",
            cache: false
        });

        $('#showTicker').slideUp('slow', function() {
            $('#ticker').slideDown('slow');
            $('#ticker').trigger('mouseout');
        });
    });

    var objInfo = {};
    objInfo.arr = $("#ticker li").hide();
    objInfo.atual = 0;

    var iTicker = setInterval(function() { swapTicker(objInfo); }, speedTicker);

    $('#ticker').hover(
        function() {
            clearInterval(iTicker);
        },
        function() {
            iTicker = setInterval(function() { swapTicker(objInfo); }, speedTicker);
        }
    ).after('<div id="showTicker"><span class="tickerTitle floatLeft">' + $('.tickerTitle').html() + '</span><a href="javascript:void(0);" class="floatLeft"></a></div>');

    //verifico o estado inicial para saber oq mostrar
    if ($('#ticker').is('.tickerDisable')) {
        $('#showTicker').slideDown('slow');
    }
    else {
        $('#ticker').slideDown('slow');
    }

    swapTicker(objInfo);
}

function swapTicker(obj) {
    var v = $("#tickerContainer li:visible");
    if (v.length == 0) {
        $(obj.arr[obj.atual++]).fadeIn(300);
        return;
    }

    v.fadeOut(200, function() {
        $(obj.arr[obj.atual++]).fadeIn(300);

        if (obj.atual >= obj.arr.length) {
            obj.atual = 0;
        }
    });
}


/* WITHOUT FLASH
------------------------------------------------------------------------------------------------*/
function withoutFlash() {
    //caso nao tenha o flash plater instalado
    if (!FlashDetect.installed) {
        $('object').each(function() {
            $(this).after('<div class="' + $(this).attr('class') + '" style="width:' + $(this).attr('width') + 'px; height:' + $(this).attr('height') + 'px; clear: both; text-align: center;"><a href="http://www.adobe.com/go/getflashplayer" target="_blank" style="display: block; margin-top:' + $(this).attr('height') / 2 + 'px;"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" /></a></div>')
        })
    }
}

$(function() {
    //caso o usario nao tenha o flash instalado ocupo o espaco onde estava o flash
    withoutFlash()
})



/* AJAX STATUS
Acao executada sempre que um ajax eh chamado na pagina
------------------------------------------------------------------------------------------------- */
$(function() {
    $('body').ajaxStart(
        function() {
            //REMOVO CASO JA EXISTA ALGUM
            $('.loadingAlert').remove();

            $('body').append('<div class="loadingAlert">Loading <img src="/Images/loading_3p.gif" /></div>');

            $('.loadingAlert').css('left', ($('body').width() / 2) - ($('.loadingAlert').width() / 2) + 'px');

            $('.draggable').draggable('disable');
            $('#sortable').sortable('disable');
            $('.getNow, .addQueue').parent().addClass('genericDisable');

        }
    ).ajaxStop(function() {
        $('.loadingAlert').animate({
            top: "-30px"
        }, 'slow', function() { $(this).remove() });

        $('.draggable,').draggable('enable');
        $('#sortable').sortable('enable');
        $('.getNow, .addQueue').parent().removeClass('genericDisable');
    })
})


/* CLOSE ME
------------------------------------------------------------------------------------------------- */
function closeMe(objeto, num) {
    if (num) { for (var i = 0; i < num; i++) { objeto = $(objeto).parent(); } }

    $(objeto).css('display', 'none');
}


/* FADE IN
------------------------------------------------------------------------------------------------- */
function fade(address, isPopUp, txtPopUp) {
    var altura = $(document).height();

    var destinoPopup = $('#column_header');

    if (destinoPopup.length == 0)
        destinoPopup = $("#column_m2_1");

    destinoPopup.before('<div id="fade"></div>').after("<div id='controlaFloater'></div>");
    $('#fade').css('height', altura + 'px');

    if (isPopUp)
        $('#controlaFloater').html('<div id="popUpContainer"><a class=\"closePop\" href=\"javascript: void(0);\" onClick=\"fadeOut();\"></a><div id="popUpTextContainer">' + txtPopUp + '</div></div>');
    else
        $('#controlaFloater').html('<div id="popUpContainer"><a class=\"closePop\" href=\"javascript: void(0);\" onClick=\"fadeOut();\"></a><iframe src="' + address + '" width="675" height="400"  name="iframeFloater" id="iframeFloater" allowtransparency="true" frameborder="0" scrolling="no"></iframe></div>');

    $('#fade').slideDown(1500, function() {
        $('#controlaFloater').css('display', 'block');
    });

    //$($("#iframeFloater")[0].contentWindow.document.body).find("#refreshParentWindow").length

    //caso clique na div ela fecha automaticamente
    $('#fade').click(function() {
        var campo = $($("#iframeFloater")[0].contentWindow.document.body).find("#refreshParentWindow");

        if (campo.length == 0)
            campo = $("#refreshParentWindow");

        if (campo.length > 0 && campo.val() == "True") {
            atualizarDevice(document.body);
        } else {

            $('#controlaFloater').remove();
            $('#fade').slideUp(1500, function() {
                $(this).remove();
            });
        }
    });
}


/* FADE OUT
------------------------------------------------------------------------------------------------- */
function fadeOut() {
    var controlaFloater = $("#controlaFloater", parent.document.body);
    var fade = $("#fade", parent.document.body);
    var campo = $("#refreshParentWindow");

    if (campo.length == 0)
        campo = $($("#iframeFloater")[0].contentWindow.document.body).find("#refreshParentWindow");

    if (campo.length > 0 && campo.val() == "True") {
        atualizarDevice(parent.document.body);
    } else {
        $(fade).remove();
        $(controlaFloater).remove();
    }

}

function atualizarDevice(origem) {

    if ($("#phoneModel", origem).length > 0) {
        $("#fade", origem).remove();
        $("#controlaFloater", origem).remove();
        return;
    }

    $.post("/SearchDevice.ashx", "recoverCustomerDevice=y", function(d) {
        var xml = $(d);

        $("#fade", origem).remove();
        $("#controlaFloater", origem).remove();

        //caso o usuário não tenha device, encerra a função
        if (xml.find("Device").length == 0) {
            $("#fade", origem).remove();
            $("#controlaFloater", origem).remove();
            return;
        }

        var str = [];
        str.push('<img title="' + xml.find("DeviceName").text() + '" src="' + xml.find("DeviceThumbnail").text() + '"/>');

        if ($("#ShowDragAndDrop", origem).val().toLowerCase() == "true") {
            str.push('<span class="getNow">' + xml.find("TextDragAndDrop").text() + '</span>');
        }

        str.push('<span id="phoneModel">' + xml.find("DeviceName").text());
        str.push(' (<a class="small" href="/MyCellphoneSelection">' + xml.find("TextChange").text() + '</a>)</span>');

        $("#getDefault", origem).html(str.join(""));

        if ($("#ContentOnlyByDevice", origem).length == 0 && $("#FilterByDevice", origem).val().toLowerCase() == "false") {
            var str2 = [];
            str2.push('<form method="post" action="/Customer/FilterByDeviceAndCarrier" id="ContentOnlyByDevice">');
            str2.push('<div class="checkbox">');
            str2.push('<input type="hidden" id="destinationUrl" name="destinationUrl"/>');
            str2.push('<input type="checkbox" id="optFilterByDevice" name="optFilterByDevice" style="border: medium none ; vertical-align: middle;"/>');
            str2.push('<span class="small"><strong>' + xml.find("TextOnlyShowContent").text() + '</strong></span>');
            str2.push('</div>');
            str2.push('<input type="hidden" value="1" id="NNId" name="NNId"/>');
            str2.push('</form>');

            $("#getContentDropArea", origem).after(str2.join(""));
        }


    });
}


/* CALCULATE SIZE
funcao que calcula o tamanho do pagina e envia a informação ao iframe pai
------------------------------------------------------------------------------------------------- */
function calculatesize() {
    var theFrame = $("#iframeFloater", parent.document.body);

    $(parent.window).scrollTo($('.global'), 1500);

    Resize(theFrame);

    $(document).ready(function() { Resize(theFrame); });

    $(window).bind("load", function() { Resize(theFrame); })
}

function Resize(frame) {
    setTimeout(function() {
        $("#selectPhone").show();
        if ($('body').height() > 650) {
            $('body').find('#content_p1_c1_2').css('width', 650 + 'px');
            $('body').find('#content_p1_c1_2').css('height', 420 + 'px'); 0
            $('body').find('#content_p1_c1_2').css('overflow-y', 'auto');
            $('body').find('#content_p1_c1_2').css('overflow-x', 'hidden');
        }

        var w = Math.max($('.global').width(), 675);

        if (w > 675) {
            var controlaFloater = $("#controlaFloater", parent.document.body);

            $(controlaFloater).css({
                width: (w + 10) + 'px'
            });
        }

        var h = Math.max($('.global').height(), 250);

        $(frame).css({
            width: w + 'px',
            height: h + 'px'
        });
    }, 1000);
}


/* Get Url Paramerters 
ex: index.html?bob=123&frank=321 - gup("bob") return = "123"
--------------------------------------------------------------------------------------------------*/
function gup(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return results[1];
}


/* POP UP
------------------------------------------------------------------------------------------------- */
function popUp(address, width, height) {
    var newPopUp = window.open(address, 'page', 'toolbar=no,location=yes,status=no,menubar=no,scrollbars=no,resizable=no,width=' + width + ',height=' + height);
}

/* HIDE ROUNDED CORNERS ON THE ITEMS (IE6) */
function hideCornersIE6() {
    if ((jQuery.browser.msie) && (jQuery.browser.version <= 6)) {
        $('.item_shadow, .item_shadow02, .item_shadow03, .item_shadow04').css('display', 'none')
    }
}


/* PLUGINS
------------------------------------------------------------------------------------------------- */

/*
Stylish Select 0.3 - jQuery plugin to replace a select drop down box with a stylable unordered list
http://scottdarby.com/

Copyright (c) 2009 Scott Darby

Requires: jQuery 1.3

Licensed under the GPL license:
http://www.gnu.org/licenses/gpl.html
*/
(function(a) { a("html").addClass("js"); Array.prototype.indexOf = function(c, d) { for (var b = (d || 0); b < this.length; b++) { if (this[b] == c) { return b } } }; a.fn.extend({ getSetSSValue: function(b) { if (b) { a(this).val(b).change(); return this } else { return selText = a(this).find(":selected").text() } }, resetSS: function() { $this = a(this); $this.next().remove(); $this.unbind().sSelect() } }); a.fn.sSelect = function(b) { return this.each(function() { var j = { defaultText: "Please select", animationSpeed: 0, ddMaxHeight: "" }; var m = a.extend(j, b), e = a(this), k = a('<div class="selectedTxt"></div>'), s = a('<div class="newListSelected" tabindex="0"></div>'), A = a('<ul class="newList"></ul>'), u = -1, d = -1, n = [], x = false, h = "", w = false; s.insertAfter(e); k.prependTo(s); A.appendTo(s); e.hide(); if (e.children("optgroup").length == 0) { e.children().each(function(B) { var C = a(this).text(); n.push(C.charAt(0).toLowerCase()); if (a(this).attr("selected") == true) { m.defaultText = C; d = B } h += "<li>" + C + "</li>" }); A.html(h); h = ""; var y = A.children() } else { e.children("optgroup").each(function(D) { var B = a(this).attr("label"), E = a('<li class="newListOptionTitle">' + B + "</li>"); E.appendTo(A); var C = a("<ul></ul>"); C.appendTo(E); a(this).children().each(function() { ++u; var F = a(this).text(); n.push(F.charAt(0).toLowerCase()); if (a(this).attr("selected") == true) { m.defaultText = F; d = u } h += "<li>" + F + "</li>" }); C.html(h); h = "" }); var y = A.find("ul li") } var p = A.height() + 3, o = s.height() + 3, z = y.length; if (d != -1) { i(d, true) } else { k.text(m.defaultText) } function q() { var C = s.offset().top, B = jQuery(window).height(), D = jQuery(window).scrollTop(); if (p > parseInt(m.ddMaxHeight)) { p = parseInt(m.ddMaxHeight) } C = C - D; if (C + p >= B) { A.css({ top: "-" + p + "px", height: p }); e.onTop = true } else { A.css({ top: o + "px", height: p }); e.onTop = false } } q(); a(window).resize(function() { q() }); a(window).scroll(function() { q() }); function t() { s.css("position", "relative") } function c() { s.css("position", "static") } k.click(function() { if (A.is(":visible")) { A.hide(); c(); return false } s.focus(); A.slideDown(m.animationSpeed); t(); A.scrollTop(e.liOffsetTop) }); y.hover(function(C) { var B = a(C.target); B.addClass("newListHover") }, function(C) { var B = a(C.target); B.removeClass("newListHover") }); y.click(function(C) { var B = a(C.target); d = y.index(B); w = true; i(d); A.hide(); s.css("position", "static") }); function i(D, F) { var B = s.offset().top, G = y.eq(D).offset().top, C = A.scrollTop(); if (e.onTop == true) { e.liOffsetTop = (((G - B) - o) + C) + parseInt(m.ddMaxHeight) } else { e.liOffsetTop = ((G - B) - o) + C } A.scrollTop(e.liOffsetTop); y.removeClass("hiLite").eq(D).addClass("hiLite"); var E = y.eq(D).text(); if (F == true) { e.val(E); k.text(E); return false } e.val(E).change(); k.text(E) } e.change(function(B) { $targetInput = a(B.target); if (w == true) { w = false; return false } $currentOpt = $targetInput.find(":selected"); d = $targetInput.find("option").index($currentOpt); i(d, true) }); function r(B) { B.onkeydown = function(E) { if (E == null) { var D = event.keyCode } else { var D = E.which } w = true; switch (D) { case 40: case 39: v(); return false; break; case 38: case 37: l(); return false; break; case 33: case 36: g(); return false; break; case 34: case 35: f(); return false; break; case 13: case 27: A.hide(); c(); return false; break } keyPressed = String.fromCharCode(D).toLowerCase(); var C = n.indexOf(keyPressed); if (typeof C != "undefined") { ++d; d = n.indexOf(keyPressed, d); if (d == -1 || d == null || x != keyPressed) { d = n.indexOf(keyPressed) } i(d); x = keyPressed; return false } } } function v() { if (d < (z - 1)) { ++d; i(d) } } function l() { if (d > 0) { --d; i(d) } } function g() { d = 0; i(d) } function f() { d = z - 1; i(d) } s.click(function() { r(this) }); s.focus(function() { a(this).addClass("newListSelFocus"); r(this) }); s.blur(function() { a(this).removeClass("newListSelFocus"); A.hide(); c() }); k.hover(function(C) { var B = a(C.target); B.parent().addClass("newListSelHover") }, function(C) { var B = a(C.target); B.parent().removeClass("newListSelHover") }); A.css("left", "0").hide() }) } })(jQuery);

$(document).ready(function() {
    setTimeout(function() {
        $('select').each(function() {
            var mySelectWidth = $(this).width();
            var mySelectHeight = $(this).width();
            var mySelectIndex = $('select').index(this);

            $(this).sSelect({ ddMaxHeight: '200px' });

            //ajusto o tamanho do select dde acordo com o select original
            $('ul.newList:eq(' + mySelectIndex + ')').width(mySelectWidth + 'px');
            $('.newListSelected:eq(' + mySelectIndex + ')').width(mySelectWidth - 5 + 'px');
            $('.newListSelected:eq(' + mySelectIndex + ')').find('span').width(mySelectWidth - 6 + 'px');
            $('.selectedTxt:eq(' + mySelectIndex + ')').width(mySelectWidth - 32 + 'px');

            //atualizo o select referente ao SSelect criado
            updateSelect()

        })
    }, 500)
})

function updateSelect() {
    $('.newListSelected ul li').live('click', function() {
        var mySelectIndex = $('.newListSelected').index($(this).parent().parent());
        var mySelectItemIndex = $('.newListSelected:eq(' + mySelectIndex + ')').find('li').index(this);

        $('select:eq(' + mySelectIndex + ')').find('option:eq(' + mySelectItemIndex + ')').attr('selected', 'selected');


    })
}



/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options = $.extend({}, options); options.expires = -1 } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)) } else { date = options.expires } expires = '; expires=' + date.toUTCString() } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('') } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break } } } return cookieValue } };


/**
* jQuery.ScrollTo
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 9/11/2008
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Tested with jQuery 1.2.6. On FF 2/3, IE 6/7, Opera 9.2/5 and Safari 3. on Windows.
*
* @author Ariel Flesler
* @version 1.4
*
*/
; (function($) { var $scrollTo = $.scrollTo = function(target, duration, settings) { $(window).scrollTo(target, duration, settings) }; $scrollTo.defaults = { axis: 'y', duration: 1 }; $scrollTo.window = function(scope) { return $(window).scrollable() }; $.fn.scrollable = function() { return this.map(function() { var win = this.parentWindow || this.defaultView, elem = this.nodeName == '#document' ? win.frameElement || win : this, doc = elem.contentDocument || (elem.contentWindow || elem).document, isWin = elem.setInterval; return elem.nodeName == 'IFRAME' || isWin && $.browser.safari ? doc.body : isWin ? doc.documentElement : this }) }; $.fn.scrollTo = function(target, duration, settings) { if (typeof duration == 'object') { settings = duration; duration = 0 } if (typeof settings == 'function') settings = { onAfter: settings }; settings = $.extend({}, $scrollTo.defaults, settings); duration = duration || settings.speed || settings.duration; settings.queue = settings.queue && settings.axis.length > 1; if (settings.queue) duration /= 2; settings.offset = both(settings.offset); settings.over = both(settings.over); return this.scrollable().each(function() { var elem = this, $elem = $(elem), targ = target, toff, attr = {}, win = $elem.is('html,body'); switch (typeof targ) { case 'number': case 'string': if (/^([+-]=)?\d+(px)?$/.test(targ)) { targ = both(targ); break } targ = $(targ, this); case 'object': if (targ.is || targ.style) toff = (targ = $(targ)).offset() } $.each(settings.axis.split(''), function(i, axis) { var Pos = axis == 'x' ? 'Left' : 'Top', pos = Pos.toLowerCase(), key = 'scroll' + Pos, old = elem[key], Dim = axis == 'x' ? 'Width' : 'Height', dim = Dim.toLowerCase(); if (toff) { attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]); if (settings.margin) { attr[key] -= parseInt(targ.css('margin' + Pos)) || 0; attr[key] -= parseInt(targ.css('border' + Pos + 'Width')) || 0 } attr[key] += settings.offset[pos] || 0; if (settings.over[pos]) attr[key] += targ[dim]() * settings.over[pos] } else attr[key] = targ[pos]; if (/^\d+$/.test(attr[key])) attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max(Dim)); if (!i && settings.queue) { if (old != attr[key]) animate(settings.onAfterFirst); delete attr[key] } }); animate(settings.onAfter); function animate(callback) { $elem.animate(attr, duration, settings.easing, callback && function() { callback.call(this, target, settings) }) }; function max(Dim) { var attr = 'scroll' + Dim, doc = elem.ownerDocument; return win ? Math.max(doc.documentElement[attr], doc.body[attr]) : elem[attr] } }).end() }; function both(val) { return typeof val == 'object' ? val : { top: val, left: val} } })(jQuery);

/*!
* jQuery UI 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
/*
* jQuery UI 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui || (function(a) { a.ui = { version: "1.8", plugin: { add: function(c, d, f) { var e = a.ui[c].prototype; for (var b in f) { e.plugins[b] = e.plugins[b] || []; e.plugins[b].push([d, f[b]]) } }, call: function(b, d, c) { var f = b.plugins[d]; if (!f || !b.element[0].parentNode) { return } for (var e = 0; e < f.length; e++) { if (b.options[f[e][0]]) { f[e][1].apply(b.element, c) } } } }, contains: function(d, c) { return document.compareDocumentPosition ? d.compareDocumentPosition(c) & 16 : d !== c && d.contains(c) }, hasScroll: function(e, c) { if (a(e).css("overflow") == "hidden") { return false } var b = (c && c == "left") ? "scrollLeft" : "scrollTop", d = false; if (e[b] > 0) { return true } e[b] = 1; d = (e[b] > 0); e[b] = 0; return d }, isOverAxis: function(c, b, d) { return (c > b) && (c < (b + d)) }, isOver: function(g, c, f, e, b, d) { return a.ui.isOverAxis(g, f, b) && a.ui.isOverAxis(c, e, d) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; a.fn.extend({ _focus: a.fn.focus, focus: function(b, c) { return typeof b === "number" ? this.each(function() { var d = this; setTimeout(function() { a(d).focus(); (c && c.call(d)) }, b) }) : this._focus.apply(this, arguments) }, enableSelection: function() { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function() { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function() { return false }) }, scrollParent: function() { var b; if ((a.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { b = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test(a.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(a.curCSS(this, "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1)) }).eq(0) } else { b = this.parents().filter(function() { return (/(auto|scroll)/).test(a.curCSS(this, "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1)) }).eq(0) } return (/fixed/).test(this.css("position")) || !b.length ? a(document) : b }, zIndex: function(e) { if (e !== undefined) { return this.css("zIndex", e) } if (this.length) { var c = a(this[0]), b, d; while (c.length && c[0] !== document) { b = c.css("position"); if (b == "absolute" || b == "relative" || b == "fixed") { d = parseInt(c.css("zIndex")); if (!isNaN(d) && d != 0) { return d } } c = c.parent() } } return 0 } }); a.extend(a.expr[":"], { data: function(d, c, b) { return !!a.data(d, b[3]) }, focusable: function(c) { var d = c.nodeName.toLowerCase(), b = a.attr(c, "tabindex"); return (/input|select|textarea|button|object/.test(d) ? !c.disabled : "a" == d || "area" == d ? c.href || !isNaN(b) : !isNaN(b)) && !a(c)["area" == d ? "parents" : "closest"](":hidden").length }, tabbable: function(c) { var b = a.attr(c, "tabindex"); return (isNaN(b) || b >= 0) && a(c).is(":focusable") } }) })(jQuery); ; /*!
 * jQuery UI Widget 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
/*
* jQuery UI Widget 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Widget
*/
(function(b) { var a = b.fn.remove; b.fn.remove = function(c, d) { return this.each(function() { if (!d) { if (!c || b.filter(c, [this]).length) { b("*", this).add(this).each(function() { b(this).triggerHandler("remove") }) } } return a.call(b(this), c, d) }) }; b.widget = function(d, f, c) { var e = d.split(".")[0], h; d = d.split(".")[1]; h = e + "-" + d; if (!c) { c = f; f = b.Widget } b.expr[":"][h] = function(i) { return !!b.data(i, d) }; b[e] = b[e] || {}; b[e][d] = function(i, j) { if (arguments.length) { this._createWidget(i, j) } }; var g = new f(); g.options = b.extend({}, g.options); b[e][d].prototype = b.extend(true, g, { namespace: e, widgetName: d, widgetEventPrefix: b[e][d].prototype.widgetEventPrefix || d, widgetBaseClass: h }, c); b.widget.bridge(d, b[e][d]) }; b.widget.bridge = function(d, c) { b.fn[d] = function(g) { var e = typeof g === "string", f = Array.prototype.slice.call(arguments, 1), h = this; g = !e && f.length ? b.extend.apply(null, [true, g].concat(f)) : g; if (e && g.substring(0, 1) === "_") { return h } if (e) { this.each(function() { var i = b.data(this, d), j = i && b.isFunction(i[g]) ? i[g].apply(i, f) : i; if (j !== i && j !== undefined) { h = j; return false } }) } else { this.each(function() { var i = b.data(this, d); if (i) { if (g) { i.option(g) } i._init() } else { b.data(this, d, new c(g, this)) } }) } return h } }; b.Widget = function(c, d) { if (arguments.length) { this._createWidget(c, d) } }; b.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", options: { disabled: false }, _createWidget: function(d, e) { this.element = b(e).data(this.widgetName, this); this.options = b.extend(true, {}, this.options, b.metadata && b.metadata.get(e)[this.widgetName], d); var c = this; this.element.bind("remove." + this.widgetName, function() { c.destroy() }); this._create(); this._init() }, _create: function() { }, _init: function() { }, destroy: function() { this.element.unbind("." + this.widgetName).removeData(this.widgetName); this.widget().unbind("." + this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled") }, widget: function() { return this.element }, option: function(e, f) { var d = e, c = this; if (arguments.length === 0) { return b.extend({}, c.options) } if (typeof e === "string") { if (f === undefined) { return this.options[e] } d = {}; d[e] = f } b.each(d, function(g, h) { c._setOption(g, h) }); return c }, _setOption: function(c, d) { this.options[c] = d; if (c === "disabled") { this.widget()[d ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", d) } return this }, enable: function() { return this._setOption("disabled", false) }, disable: function() { return this._setOption("disabled", true) }, _trigger: function(d, e, f) { var h = this.options[d]; e = b.Event(e); e.type = (d === this.widgetEventPrefix ? d : this.widgetEventPrefix + d).toLowerCase(); f = f || {}; if (e.originalEvent) { for (var c = b.event.props.length, g; c; ) { g = b.event.props[--c]; e[g] = e.originalEvent[g] } } this.element.trigger(e, f); return !(b.isFunction(h) && h.call(this.element[0], e, f) === false || e.isDefaultPrevented()) } } })(jQuery); ; /*!
 * jQuery UI Mouse 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
/*
* jQuery UI Mouse 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Mouse
*
* Depends:
*	jquery.ui.widget.js
*/
(function(a) { a.widget("ui.mouse", { options: { cancel: ":input,option", distance: 1, delay: 0 }, _mouseInit: function() { var b = this; this.element.bind("mousedown." + this.widgetName, function(c) { return b._mouseDown(c) }).bind("click." + this.widgetName, function(c) { if (b._preventClickEvent) { b._preventClickEvent = false; c.stopImmediatePropagation(); return false } }); this.started = false }, _mouseDestroy: function() { this.element.unbind("." + this.widgetName) }, _mouseDown: function(d) { d.originalEvent = d.originalEvent || {}; if (d.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(d)); this._mouseDownEvent = d; var c = this, e = (d.which == 1), b = (typeof this.options.cancel == "string" ? a(d.target).parents().add(d.target).filter(this.options.cancel).length : false); if (!e || b || !this._mouseCapture(d)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { c.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(d) && this._mouseDelayMet(d)) { this._mouseStarted = (this._mouseStart(d) !== false); if (!this._mouseStarted) { d.preventDefault(); return true } } this._mouseMoveDelegate = function(f) { return c._mouseMove(f) }; this._mouseUpDelegate = function(f) { return c._mouseUp(f) }; a(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (a.browser.safari || d.preventDefault()); d.originalEvent.mouseHandled = true; return true }, _mouseMove: function(b) { if (a.browser.msie && !b.button) { return this._mouseUp(b) } if (this._mouseStarted) { this._mouseDrag(b); return b.preventDefault() } if (this._mouseDistanceMet(b) && this._mouseDelayMet(b)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, b) !== false); (this._mouseStarted ? this._mouseDrag(b) : this._mouseUp(b)) } return !this._mouseStarted }, _mouseUp: function(b) { a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (b.target == this._mouseDownEvent.target); this._mouseStop(b) } return false }, _mouseDistanceMet: function(b) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - b.pageX), Math.abs(this._mouseDownEvent.pageY - b.pageY)) >= this.options.distance) }, _mouseDelayMet: function(b) { return this.mouseDelayMet }, _mouseStart: function(b) { }, _mouseDrag: function(b) { }, _mouseStop: function(b) { }, _mouseCapture: function(b) { return true } }) })(jQuery); ; /*
 * jQuery UI Position 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Position
 */
(function(f) { f.ui = f.ui || {}; var c = /left|center|right/, e = "center", d = /top|center|bottom/, g = "center", a = f.fn.position, b = f.fn.offset; f.fn.position = function(i) { if (!i || !i.of) { return a.apply(this, arguments) } i = f.extend({}, i); var l = f(i.of), n = (i.collision || "flip").split(" "), m = i.offset ? i.offset.split(" ") : [0, 0], k, h, j; if (i.of.nodeType === 9) { k = l.width(); h = l.height(); j = { top: 0, left: 0} } else { if (i.of.scrollTo && i.of.document) { k = l.width(); h = l.height(); j = { top: l.scrollTop(), left: l.scrollLeft()} } else { if (i.of.preventDefault) { i.at = "left top"; k = h = 0; j = { top: i.of.pageY, left: i.of.pageX} } else { k = l.outerWidth(); h = l.outerHeight(); j = l.offset() } } } f.each(["my", "at"], function() { var o = (i[this] || "").split(" "); if (o.length === 1) { o = c.test(o[0]) ? o.concat([g]) : d.test(o[0]) ? [e].concat(o) : [e, g] } o[0] = c.test(o[0]) ? o[0] : e; o[1] = d.test(o[1]) ? o[1] : g; i[this] = o }); if (n.length === 1) { n[1] = n[0] } m[0] = parseInt(m[0], 10) || 0; if (m.length === 1) { m[1] = m[0] } m[1] = parseInt(m[1], 10) || 0; if (i.at[0] === "right") { j.left += k } else { if (i.at[0] === e) { j.left += k / 2 } } if (i.at[1] === "bottom") { j.top += h } else { if (i.at[1] === g) { j.top += h / 2 } } j.left += m[0]; j.top += m[1]; return this.each(function() { var r = f(this), q = r.outerWidth(), p = r.outerHeight(), o = f.extend({}, j); if (i.my[0] === "right") { o.left -= q } else { if (i.my[0] === e) { o.left -= q / 2 } } if (i.my[1] === "bottom") { o.top -= p } else { if (i.my[1] === g) { o.top -= p / 2 } } f.each(["left", "top"], function(t, s) { if (f.ui.position[n[t]]) { f.ui.position[n[t]][s](o, { targetWidth: k, targetHeight: h, elemWidth: q, elemHeight: p, offset: m, my: i.my, at: i.at }) } }); if (f.fn.bgiframe) { r.bgiframe() } r.offset(f.extend(o, { using: i.using })) }) }; f.ui.position = { fit: { left: function(h, i) { var k = f(window), j = h.left + i.elemWidth - k.width() - k.scrollLeft(); h.left = j > 0 ? h.left - j : Math.max(0, h.left) }, top: function(h, i) { var k = f(window), j = h.top + i.elemHeight - k.height() - k.scrollTop(); h.top = j > 0 ? h.top - j : Math.max(0, h.top) } }, flip: { left: function(i, j) { if (j.at[0] === "center") { return } var l = f(window), k = i.left + j.elemWidth - l.width() - l.scrollLeft(), h = j.my[0] === "left" ? -j.elemWidth : j.my[0] === "right" ? j.elemWidth : 0, m = -2 * j.offset[0]; i.left += i.left < 0 ? h + j.targetWidth + m : k > 0 ? h - j.targetWidth + m : 0 }, top: function(i, k) { if (k.at[1] === "center") { return } var m = f(window), l = i.top + k.elemHeight - m.height() - m.scrollTop(), h = k.my[1] === "top" ? -k.elemHeight : k.my[1] === "bottom" ? k.elemHeight : 0, j = k.at[1] === "top" ? k.targetHeight : -k.targetHeight, n = -2 * k.offset[1]; i.top += i.top < 0 ? h + k.targetHeight + n : l > 0 ? h + j + n : 0 } } }; if (!f.offset.setOffset) { f.offset.setOffset = function(l, i) { if (/static/.test(f.curCSS(l, "position"))) { l.style.position = "relative" } var k = f(l), n = k.offset(), h = parseInt(f.curCSS(l, "top", true), 10) || 0, m = parseInt(f.curCSS(l, "left", true), 10) || 0, j = { top: (i.top - n.top) + h, left: (i.left - n.left) + m }; if ("using" in i) { i.using.call(l, j) } else { k.css(j) } }; f.fn.offset = function(h) { var i = this[0]; if (!i || !i.ownerDocument) { return null } if (h) { return this.each(function() { f.offset.setOffset(this, h) }) } return b.call(this) } } } (jQuery)); ; /*
 * jQuery UI Draggable 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(a) { a.widget("ui.draggable", a.ui.mouse, { widgetEventPrefix: "drag", options: { addClasses: true, appendTo: "parent", axis: false, connectToSortable: false, containment: false, cursor: "auto", cursorAt: false, grid: false, handle: false, helper: "original", iframeFix: false, opacity: false, refreshPositions: false, revert: false, revertDuration: 500, scope: "default", scroll: true, scrollSensitivity: 20, scrollSpeed: 20, snap: false, snapMode: "both", snapTolerance: 20, stack: false, zIndex: false }, _create: function() { if (this.options.helper == "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { this.element[0].style.position = "relative" } (this.options.addClasses && this.element.addClass("ui-draggable")); (this.options.disabled && this.element.addClass("ui-draggable-disabled")); this._mouseInit() }, destroy: function() { if (!this.element.data("draggable")) { return } this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"); this._mouseDestroy(); return this }, _mouseCapture: function(b) { var c = this.options; if (this.helper || c.disabled || a(b.target).is(".ui-resizable-handle")) { return false } this.handle = this._getHandle(b); if (!this.handle) { return false } return true }, _mouseStart: function(b) { var c = this.options; this.helper = this._createHelper(b); this._cacheHelperProportions(); if (a.ui.ddmanager) { a.ui.ddmanager.current = this } this._cacheMargins(); this.cssPosition = this.helper.css("position"); this.scrollParent = this.helper.scrollParent(); this.offset = this.positionAbs = this.element.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; a.extend(this.offset, { click: { left: b.pageX - this.offset.left, top: b.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }); this.originalPosition = this.position = this._generatePosition(b); this.originalPageX = b.pageX; this.originalPageY = b.pageY; (c.cursorAt && this._adjustOffsetFromHelper(c.cursorAt)); if (c.containment) { this._setContainment() } if (this._trigger("start", b) === false) { this._clear(); return false } this._cacheHelperProportions(); if (a.ui.ddmanager && !c.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, b) } this.helper.addClass("ui-draggable-dragging"); this._mouseDrag(b, true); return true }, _mouseDrag: function(b, d) { this.position = this._generatePosition(b); this.positionAbs = this._convertPositionTo("absolute"); if (!d) { var c = this._uiHash(); if (this._trigger("drag", b, c) === false) { this._mouseUp({}); return false } this.position = c.position } if (!this.options.axis || this.options.axis != "y") { this.helper[0].style.left = this.position.left + "px" } if (!this.options.axis || this.options.axis != "x") { this.helper[0].style.top = this.position.top + "px" } if (a.ui.ddmanager) { a.ui.ddmanager.drag(this, b) } return false }, _mouseStop: function(c) { var d = false; if (a.ui.ddmanager && !this.options.dropBehaviour) { d = a.ui.ddmanager.drop(this, c) } if (this.dropped) { d = this.dropped; this.dropped = false } if (!this.element[0] || !this.element[0].parentNode) { return false } if ((this.options.revert == "invalid" && !d) || (this.options.revert == "valid" && d) || this.options.revert === true || (a.isFunction(this.options.revert) && this.options.revert.call(this.element, d))) { var b = this; a(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { if (b._trigger("stop", c) !== false) { b._clear() } }) } else { if (this._trigger("stop", c) !== false) { this._clear() } } return false }, cancel: function() { if (this.helper.is(".ui-draggable-dragging")) { this._mouseUp({}) } else { this._clear() } return this }, _getHandle: function(b) { var c = !this.options.handle || !a(this.options.handle, this.element).length ? true : false; a(this.options.handle, this.element).find("*").andSelf().each(function() { if (this == b.target) { c = true } }); return c }, _createHelper: function(c) { var d = this.options; var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c])) : (d.helper == "clone" ? this.element.clone() : this.element); if (!b.parents("body").length) { b.appendTo((d.appendTo == "parent" ? this.element[0].parentNode : d.appendTo)) } if (b[0] != this.element[0] && !(/(fixed|absolute)/).test(b.css("position"))) { b.css("position", "absolute") } return b }, _adjustOffsetFromHelper: function(b) { if (typeof b == "string") { b = b.split(" ") } if (a.isArray(b)) { b = { left: +b[0], top: +b[1] || 0} } if ("left" in b) { this.offset.click.left = b.left + this.margins.left } if ("right" in b) { this.offset.click.left = this.helperProportions.width - b.right + this.margins.left } if ("top" in b) { this.offset.click.top = b.top + this.margins.top } if ("bottom" in b) { this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top } }, _getParentOffset: function() { this.offsetParent = this.helper.offsetParent(); var b = this.offsetParent.offset(); if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) { b.left += this.scrollParent.scrollLeft(); b.top += this.scrollParent.scrollTop() } if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) { b = { top: 0, left: 0} } return { top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)} }, _getRelativeOffset: function() { if (this.cssPosition == "relative") { var b = this.element.position(); return { top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()} } else { return { top: 0, left: 0} } }, _cacheMargins: function() { this.margins = { left: (parseInt(this.element.css("marginLeft"), 10) || 0), top: (parseInt(this.element.css("marginTop"), 10) || 0)} }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight()} }, _setContainment: function() { var e = this.options; if (e.containment == "parent") { e.containment = this.helper[0].parentNode } if (e.containment == "document" || e.containment == "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document : window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top] } if (!(/^(document|window|parent)$/).test(e.containment) && e.containment.constructor != Array) { var c = a(e.containment)[0]; if (!c) { return } var d = a(e.containment).offset(); var b = (a(c).css("overflow") != "hidden"); this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top] } else { if (e.containment.constructor == Array) { this.containment = e.containment } } }, _convertPositionTo: function(f, h) { if (!h) { h = this.position } var c = f == "absolute" ? 1 : -1; var e = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, g = (/(html|body)/i).test(b[0].tagName); return { top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && a.browser.version < 526 && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)), left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && a.browser.version < 526 && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c))} }, _generatePosition: function(e) { var h = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, i = (/(html|body)/i).test(b[0].tagName); var d = e.pageX; var c = e.pageY; if (this.originalPosition) { if (this.containment) { if (e.pageX - this.offset.click.left < this.containment[0]) { d = this.containment[0] + this.offset.click.left } if (e.pageY - this.offset.click.top < this.containment[1]) { c = this.containment[1] + this.offset.click.top } if (e.pageX - this.offset.click.left > this.containment[2]) { d = this.containment[2] + this.offset.click.left } if (e.pageY - this.offset.click.top > this.containment[3]) { c = this.containment[3] + this.offset.click.top } } if (h.grid) { var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1]; c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g : (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g; var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0]; d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f : (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f } } return { top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && a.browser.version < 526 && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))), left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && a.browser.version < 526 && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft())))} }, _clear: function() { this.helper.removeClass("ui-draggable-dragging"); if (this.helper[0] != this.element[0] && !this.cancelHelperRemoval) { this.helper.remove() } this.helper = null; this.cancelHelperRemoval = false }, _trigger: function(b, c, d) { d = d || this._uiHash(); a.ui.plugin.call(this, b, [c, d]); if (b == "drag") { this.positionAbs = this._convertPositionTo("absolute") } return a.Widget.prototype._trigger.call(this, b, c, d) }, plugins: {}, _uiHash: function(b) { return { helper: this.helper, position: this.position, originalPosition: this.originalPosition, offset: this.positionAbs} } }); a.extend(a.ui.draggable, { version: "1.8" }); a.ui.plugin.add("draggable", "connectToSortable", { start: function(c, e) { var d = a(this).data("draggable"), f = d.options, b = a.extend({}, e, { item: d.element }); d.sortables = []; a(f.connectToSortable).each(function() { var g = a.data(this, "sortable"); if (g && !g.options.disabled) { d.sortables.push({ instance: g, shouldRevert: g.options.revert }); g._refreshItems(); g._trigger("activate", c, b) } }) }, stop: function(c, e) { var d = a(this).data("draggable"), b = a.extend({}, e, { item: d.element }); a.each(d.sortables, function() { if (this.instance.isOver) { this.instance.isOver = 0; d.cancelHelperRemoval = true; this.instance.cancelHelperRemoval = false; if (this.shouldRevert) { this.instance.options.revert = true } this.instance._mouseStop(c); this.instance.options.helper = this.instance.options._helper; if (d.options.helper == "original") { this.instance.currentItem.css({ top: "auto", left: "auto" }) } } else { this.instance.cancelHelperRemoval = false; this.instance._trigger("deactivate", c, b) } }) }, drag: function(c, f) { var e = a(this).data("draggable"), b = this; var d = function(i) { var n = this.offset.click.top, m = this.offset.click.left; var g = this.positionAbs.top, k = this.positionAbs.left; var j = i.height, l = i.width; var p = i.top, h = i.left; return a.ui.isOver(g + n, k + m, p, h, j, l) }; a.each(e.sortables, function(g) { this.instance.positionAbs = e.positionAbs; this.instance.helperProportions = e.helperProportions; this.instance.offset.click = e.offset.click; if (this.instance._intersectsWith(this.instance.containerCache)) { if (!this.instance.isOver) { this.instance.isOver = 1; this.instance.currentItem = a(b).clone().appendTo(this.instance.element).data("sortable-item", true); this.instance.options._helper = this.instance.options.helper; this.instance.options.helper = function() { return f.helper[0] }; c.target = this.instance.currentItem[0]; this.instance._mouseCapture(c, true); this.instance._mouseStart(c, true, true); this.instance.offset.click.top = e.offset.click.top; this.instance.offset.click.left = e.offset.click.left; this.instance.offset.parent.left -= e.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.top -= e.offset.parent.top - this.instance.offset.parent.top; e._trigger("toSortable", c); e.dropped = this.instance.element; e.currentItem = e.element; this.instance.fromOutside = e } if (this.instance.currentItem) { this.instance._mouseDrag(c) } } else { if (this.instance.isOver) { this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; this.instance.options.revert = false; this.instance._trigger("out", c, this.instance._uiHash(this.instance)); this.instance._mouseStop(c, true); this.instance.options.helper = this.instance.options._helper; this.instance.currentItem.remove(); if (this.instance.placeholder) { this.instance.placeholder.remove() } e._trigger("fromSortable", c); e.dropped = false } } }) } }); a.ui.plugin.add("draggable", "cursor", { start: function(c, d) { var b = a("body"), e = a(this).data("draggable").options; if (b.css("cursor")) { e._cursor = b.css("cursor") } b.css("cursor", e.cursor) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._cursor) { a("body").css("cursor", d._cursor) } } }); a.ui.plugin.add("draggable", "iframeFix", { start: function(b, c) { var d = a(this).data("draggable").options; a(d.iframeFix === true ? "iframe" : d.iframeFix).each(function() { a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({ width: this.offsetWidth + "px", height: this.offsetHeight + "px", position: "absolute", opacity: "0.001", zIndex: 1000 }).css(a(this).offset()).appendTo("body") }) }, stop: function(b, c) { a("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this) }) } }); a.ui.plugin.add("draggable", "opacity", { start: function(c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("opacity")) { e._opacity = b.css("opacity") } b.css("opacity", e.opacity) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._opacity) { a(c.helper).css("opacity", d._opacity) } } }); a.ui.plugin.add("draggable", "scroll", { start: function(c, d) { var b = a(this).data("draggable"); if (b.scrollParent[0] != document && b.scrollParent[0].tagName != "HTML") { b.overflowOffset = b.scrollParent.offset() } }, drag: function(d, e) { var c = a(this).data("draggable"), f = c.options, b = false; if (c.scrollParent[0] != document && c.scrollParent[0].tagName != "HTML") { if (!f.axis || f.axis != "x") { if ((c.overflowOffset.top + c.scrollParent[0].offsetHeight) - d.pageY < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop + f.scrollSpeed } else { if (d.pageY - c.overflowOffset.top < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop - f.scrollSpeed } } } if (!f.axis || f.axis != "y") { if ((c.overflowOffset.left + c.scrollParent[0].offsetWidth) - d.pageX < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft + f.scrollSpeed } else { if (d.pageX - c.overflowOffset.left < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft - f.scrollSpeed } } } } else { if (!f.axis || f.axis != "x") { if (d.pageY - a(document).scrollTop() < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() - f.scrollSpeed) } else { if (a(window).height() - (d.pageY - a(document).scrollTop()) < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() + f.scrollSpeed) } } } if (!f.axis || f.axis != "y") { if (d.pageX - a(document).scrollLeft() < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() - f.scrollSpeed) } else { if (a(window).width() - (d.pageX - a(document).scrollLeft()) < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() + f.scrollSpeed) } } } } if (b !== false && a.ui.ddmanager && !f.dropBehaviour) { a.ui.ddmanager.prepareOffsets(c, d) } } }); a.ui.plugin.add("draggable", "snap", { start: function(c, d) { var b = a(this).data("draggable"), e = b.options; b.snapElements = []; a(e.snap.constructor != String ? (e.snap.items || ":data(draggable)") : e.snap).each(function() { var g = a(this); var f = g.offset(); if (this != b.element[0]) { b.snapElements.push({ item: this, width: g.outerWidth(), height: g.outerHeight(), top: f.top, left: f.left }) } }) }, drag: function(u, p) { var g = a(this).data("draggable"), q = g.options; var y = q.snapTolerance; var x = p.offset.left, w = x + g.helperProportions.width, f = p.offset.top, e = f + g.helperProportions.height; for (var v = g.snapElements.length - 1; v >= 0; v--) { var s = g.snapElements[v].left, n = s + g.snapElements[v].width, m = g.snapElements[v].top, A = m + g.snapElements[v].height; if (!((s - y < x && x < n + y && m - y < f && f < A + y) || (s - y < x && x < n + y && m - y < e && e < A + y) || (s - y < w && w < n + y && m - y < f && f < A + y) || (s - y < w && w < n + y && m - y < e && e < A + y))) { if (g.snapElements[v].snapping) { (g.options.snap.release && g.options.snap.release.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = false; continue } if (q.snapMode != "inner") { var c = Math.abs(m - e) <= y; var z = Math.abs(A - f) <= y; var j = Math.abs(s - w) <= y; var k = Math.abs(n - x) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m - g.helperProportions.height, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s - g.helperProportions.width }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n }).left - g.margins.left } } var h = (c || z || j || k); if (q.snapMode != "outer") { var c = Math.abs(m - f) <= y; var z = Math.abs(A - e) <= y; var j = Math.abs(s - x) <= y; var k = Math.abs(n - w) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A - g.helperProportions.height, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n - g.helperProportions.width }).left - g.margins.left } } if (!g.snapElements[v].snapping && (c || z || j || k || h)) { (g.options.snap.snap && g.options.snap.snap.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = (c || z || j || k || h) } } }); a.ui.plugin.add("draggable", "stack", { start: function(c, d) { var f = a(this).data("draggable").options; var e = a.makeArray(a(f.stack)).sort(function(h, g) { return (parseInt(a(h).css("zIndex"), 10) || 0) - (parseInt(a(g).css("zIndex"), 10) || 0) }); if (!e.length) { return } var b = parseInt(e[0].style.zIndex) || 0; a(e).each(function(g) { this.style.zIndex = b + g }); this[0].style.zIndex = b + e.length } }); a.ui.plugin.add("draggable", "zIndex", { start: function(c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("zIndex")) { e._zIndex = b.css("zIndex") } b.css("zIndex", e.zIndex) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._zIndex) { a(c.helper).css("zIndex", d._zIndex) } } }) })(jQuery); ; /*
 * jQuery UI Droppable 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Droppables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.mouse.js
 *	jquery.ui.draggable.js
 */
(function(a) { a.widget("ui.droppable", { widgetEventPrefix: "drop", options: { accept: "*", activeClass: false, addClasses: true, greedy: false, hoverClass: false, scope: "default", tolerance: "intersect" }, _create: function() { var c = this.options, b = c.accept; this.isover = 0; this.isout = 1; this.accept = a.isFunction(b) ? b : function(e) { return e.is(b) }; this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; a.ui.ddmanager.droppables[c.scope] = a.ui.ddmanager.droppables[c.scope] || []; a.ui.ddmanager.droppables[c.scope].push(this); (c.addClasses && this.element.addClass("ui-droppable")) }, destroy: function() { var b = a.ui.ddmanager.droppables[this.options.scope]; for (var c = 0; c < b.length; c++) { if (b[c] == this) { b.splice(c, 1) } } this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"); return this }, _setOption: function(b, c) { if (b == "accept") { this.accept = a.isFunction(c) ? c : function(e) { return e.is(c) } } a.Widget.prototype._setOption.apply(this, arguments) }, _activate: function(c) { var b = a.ui.ddmanager.current; if (this.options.activeClass) { this.element.addClass(this.options.activeClass) } (b && this._trigger("activate", c, this.ui(b))) }, _deactivate: function(c) { var b = a.ui.ddmanager.current; if (this.options.activeClass) { this.element.removeClass(this.options.activeClass) } (b && this._trigger("deactivate", c, this.ui(b))) }, _over: function(c) { var b = a.ui.ddmanager.current; if (!b || (b.currentItem || b.element)[0] == this.element[0]) { return } if (this.accept.call(this.element[0], (b.currentItem || b.element))) { if (this.options.hoverClass) { this.element.addClass(this.options.hoverClass) } this._trigger("over", c, this.ui(b)) } }, _out: function(c) { var b = a.ui.ddmanager.current; if (!b || (b.currentItem || b.element)[0] == this.element[0]) { return } if (this.accept.call(this.element[0], (b.currentItem || b.element))) { if (this.options.hoverClass) { this.element.removeClass(this.options.hoverClass) } this._trigger("out", c, this.ui(b)) } }, _drop: function(c, d) { var b = d || a.ui.ddmanager.current; if (!b || (b.currentItem || b.element)[0] == this.element[0]) { return false } var e = false; this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { var f = a.data(this, "droppable"); if (f.options.greedy && !f.options.disabled && f.options.scope == b.options.scope && f.accept.call(f.element[0], (b.currentItem || b.element)) && a.ui.intersect(b, a.extend(f, { offset: f.element.offset() }), f.options.tolerance)) { e = true; return false } }); if (e) { return false } if (this.accept.call(this.element[0], (b.currentItem || b.element))) { if (this.options.activeClass) { this.element.removeClass(this.options.activeClass) } if (this.options.hoverClass) { this.element.removeClass(this.options.hoverClass) } this._trigger("drop", c, this.ui(b)); return this.element } return false }, ui: function(b) { return { draggable: (b.currentItem || b.element), helper: b.helper, position: b.position, offset: b.positionAbs} } }); a.extend(a.ui.droppable, { version: "1.8" }); a.ui.intersect = function(q, j, o) { if (!j.offset) { return false } var e = (q.positionAbs || q.position.absolute).left, d = e + q.helperProportions.width, n = (q.positionAbs || q.position.absolute).top, m = n + q.helperProportions.height; var g = j.offset.left, c = g + j.proportions.width, p = j.offset.top, k = p + j.proportions.height; switch (o) { case "fit": return (g < e && d < c && p < n && m < k); break; case "intersect": return (g < e + (q.helperProportions.width / 2) && d - (q.helperProportions.width / 2) < c && p < n + (q.helperProportions.height / 2) && m - (q.helperProportions.height / 2) < k); break; case "pointer": var h = ((q.positionAbs || q.position.absolute).left + (q.clickOffset || q.offset.click).left), i = ((q.positionAbs || q.position.absolute).top + (q.clickOffset || q.offset.click).top), f = a.ui.isOver(i, h, p, g, j.proportions.height, j.proportions.width); return f; break; case "touch": return ((n >= p && n <= k) || (m >= p && m <= k) || (n < p && m > k)) && ((e >= g && e <= c) || (d >= g && d <= c) || (e < g && d > c)); break; default: return false; break } }; a.ui.ddmanager = { current: null, droppables: { "default": [] }, prepareOffsets: function(e, g) { var b = a.ui.ddmanager.droppables[e.options.scope] || []; var f = g ? g.type : null; var h = (e.currentItem || e.element).find(":data(droppable)").andSelf(); droppablesLoop: for (var d = 0; d < b.length; d++) { if (b[d].options.disabled || (e && !b[d].accept.call(b[d].element[0], (e.currentItem || e.element)))) { continue } for (var c = 0; c < h.length; c++) { if (h[c] == b[d].element[0]) { b[d].proportions.height = 0; continue droppablesLoop } } b[d].visible = b[d].element.css("display") != "none"; if (!b[d].visible) { continue } b[d].offset = b[d].element.offset(); b[d].proportions = { width: b[d].element[0].offsetWidth, height: b[d].element[0].offsetHeight }; if (f == "mousedown") { b[d]._activate.call(b[d], g) } } }, drop: function(b, c) { var d = false; a.each(a.ui.ddmanager.droppables[b.options.scope] || [], function() { if (!this.options) { return } if (!this.options.disabled && this.visible && a.ui.intersect(b, this, this.options.tolerance)) { d = d || this._drop.call(this, c) } if (!this.options.disabled && this.visible && this.accept.call(this.element[0], (b.currentItem || b.element))) { this.isout = 1; this.isover = 0; this._deactivate.call(this, c) } }); return d }, drag: function(b, c) { if (b.options.refreshPositions) { a.ui.ddmanager.prepareOffsets(b, c) } a.each(a.ui.ddmanager.droppables[b.options.scope] || [], function() { if (this.options.disabled || this.greedyChild || !this.visible) { return } var e = a.ui.intersect(b, this, this.options.tolerance); var g = !e && this.isover == 1 ? "isout" : (e && this.isover == 0 ? "isover" : null); if (!g) { return } var f; if (this.options.greedy) { var d = this.element.parents(":data(droppable):eq(0)"); if (d.length) { f = a.data(d[0], "droppable"); f.greedyChild = (g == "isover" ? 1 : 0) } } if (f && g == "isover") { f.isover = 0; f.isout = 1; f._out.call(f, c) } this[g] = 1; this[g == "isout" ? "isover" : "isout"] = 0; this[g == "isover" ? "_over" : "_out"].call(this, c); if (f && g == "isout") { f.isout = 0; f.isover = 1; f._over.call(f, c) } }) } } })(jQuery); ; /*
 * jQuery UI Resizable 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(c) { c.widget("ui.resizable", c.ui.mouse, { widgetEventPrefix: "resize", options: { alsoResize: false, animate: false, animateDuration: "slow", animateEasing: "swing", aspectRatio: false, autoHide: false, containment: false, ghost: false, grid: false, handles: "e,s,se", helper: false, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, zIndex: 1000 }, _create: function() { var e = this, j = this.options; this.element.addClass("ui-resizable"); c.extend(this, { _aspectRatio: !!(j.aspectRatio), aspectRatio: j.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], _helper: j.helper || j.ghost || j.animate ? j.helper || "ui-resizable-helper" : null }); if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { if (/relative/.test(this.element.css("position")) && c.browser.opera) { this.element.css({ position: "relative", top: "auto", left: "auto" }) } this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), top: this.element.css("top"), left: this.element.css("left") })); this.element = this.element.parent().data("resizable", this.element.data("resizable")); this.elementIsWrapper = true; this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0 }); this.originalResizeStyle = this.originalElement.css("resize"); this.originalElement.css("resize", "none"); this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" })); this.originalElement.css({ margin: this.originalElement.css("margin") }); this._proportionallyResize() } this.handles = j.handles || (!c(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" }); if (this.handles.constructor == String) { if (this.handles == "all") { this.handles = "n,e,s,w,se,sw,ne,nw" } var k = this.handles.split(","); this.handles = {}; for (var f = 0; f < k.length; f++) { var h = c.trim(k[f]), d = "ui-resizable-" + h; var g = c('<div class="ui-resizable-handle ' + d + '"></div>'); if (/sw|se|ne|nw/.test(h)) { g.css({ zIndex: ++j.zIndex }) } if ("se" == h) { g.addClass("ui-icon ui-icon-gripsmall-diagonal-se") } this.handles[h] = ".ui-resizable-" + h; this.element.append(g) } } this._renderAxis = function(p) { p = p || this.element; for (var m in this.handles) { if (this.handles[m].constructor == String) { this.handles[m] = c(this.handles[m], this.element).show() } if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { var n = c(this.handles[m], this.element), o = 0; o = /sw|ne|nw|se|n|s/.test(m) ? n.outerHeight() : n.outerWidth(); var l = ["padding", /ne|nw|n/.test(m) ? "Top" : /se|sw|s/.test(m) ? "Bottom" : /^e$/.test(m) ? "Right" : "Left"].join(""); p.css(l, o); this._proportionallyResize() } if (!c(this.handles[m]).length) { continue } } }; this._renderAxis(this.element); this._handles = c(".ui-resizable-handle", this.element).disableSelection(); this._handles.mouseover(function() { if (!e.resizing) { if (this.className) { var i = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i) } e.axis = i && i[1] ? i[1] : "se" } }); if (j.autoHide) { this._handles.hide(); c(this.element).addClass("ui-resizable-autohide").hover(function() { c(this).removeClass("ui-resizable-autohide"); e._handles.show() }, function() { if (!e.resizing) { c(this).addClass("ui-resizable-autohide"); e._handles.hide() } }) } this._mouseInit() }, destroy: function() { this._mouseDestroy(); var d = function(f) { c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove() }; if (this.elementIsWrapper) { d(this.element); var e = this.element; e.after(this.originalElement.css({ position: e.css("position"), width: e.outerWidth(), height: e.outerHeight(), top: e.css("top"), left: e.css("left") })).remove() } this.originalElement.css("resize", this.originalResizeStyle); d(this.originalElement); return this }, _mouseCapture: function(e) { var f = false; for (var d in this.handles) { if (c(this.handles[d])[0] == e.target) { f = true } } return !this.options.disabled && f }, _mouseStart: function(f) { var i = this.options, e = this.element.position(), d = this.element; this.resizing = true; this.documentScroll = { top: c(document).scrollTop(), left: c(document).scrollLeft() }; if (d.is(".ui-draggable") || (/absolute/).test(d.css("position"))) { d.css({ position: "absolute", top: e.top, left: e.left }) } if (c.browser.opera && (/relative/).test(d.css("position"))) { d.css({ position: "relative", top: "auto", left: "auto" }) } this._renderProxy(); var j = b(this.helper.css("left")), g = b(this.helper.css("top")); if (i.containment) { j += c(i.containment).scrollLeft() || 0; g += c(i.containment).scrollTop() || 0 } this.offset = this.helper.offset(); this.position = { left: j, top: g }; this.size = this._helper ? { width: d.outerWidth(), height: d.outerHeight()} : { width: d.width(), height: d.height() }; this.originalSize = this._helper ? { width: d.outerWidth(), height: d.outerHeight()} : { width: d.width(), height: d.height() }; this.originalPosition = { left: j, top: g }; this.sizeDiff = { width: d.outerWidth() - d.width(), height: d.outerHeight() - d.height() }; this.originalMousePosition = { left: f.pageX, top: f.pageY }; this.aspectRatio = (typeof i.aspectRatio == "number") ? i.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); var h = c(".ui-resizable-" + this.axis).css("cursor"); c("body").css("cursor", h == "auto" ? this.axis + "-resize" : h); d.addClass("ui-resizable-resizing"); this._propagate("start", f); return true }, _mouseDrag: function(d) { var g = this.helper, f = this.options, l = {}, p = this, i = this.originalMousePosition, m = this.axis; var q = (d.pageX - i.left) || 0, n = (d.pageY - i.top) || 0; var h = this._change[m]; if (!h) { return false } var k = h.apply(this, [d, q, n]), j = c.browser.msie && c.browser.version < 7, e = this.sizeDiff; if (this._aspectRatio || d.shiftKey) { k = this._updateRatio(k, d) } k = this._respectSize(k, d); this._propagate("resize", d); g.css({ top: this.position.top + "px", left: this.position.left + "px", width: this.size.width + "px", height: this.size.height + "px" }); if (!this._helper && this._proportionallyResizeElements.length) { this._proportionallyResize() } this._updateCache(k); this._trigger("resize", d, this.ui()); return false }, _mouseStop: function(g) { this.resizing = false; var h = this.options, l = this; if (this._helper) { var f = this._proportionallyResizeElements, d = f.length && (/textarea/i).test(f[0].nodeName), e = d && c.ui.hasScroll(f[0], "left") ? 0 : l.sizeDiff.height, j = d ? 0 : l.sizeDiff.width; var m = { width: (l.size.width - j), height: (l.size.height - e) }, i = (parseInt(l.element.css("left"), 10) + (l.position.left - l.originalPosition.left)) || null, k = (parseInt(l.element.css("top"), 10) + (l.position.top - l.originalPosition.top)) || null; if (!h.animate) { this.element.css(c.extend(m, { top: k, left: i })) } l.helper.height(l.size.height); l.helper.width(l.size.width); if (this._helper && !h.animate) { this._proportionallyResize() } } c("body").css("cursor", "auto"); this.element.removeClass("ui-resizable-resizing"); this._propagate("stop", g); if (this._helper) { this.helper.remove() } return false }, _updateCache: function(d) { var e = this.options; this.offset = this.helper.offset(); if (a(d.left)) { this.position.left = d.left } if (a(d.top)) { this.position.top = d.top } if (a(d.height)) { this.size.height = d.height } if (a(d.width)) { this.size.width = d.width } }, _updateRatio: function(g, f) { var h = this.options, i = this.position, e = this.size, d = this.axis; if (g.height) { g.width = (e.height * this.aspectRatio) } else { if (g.width) { g.height = (e.width / this.aspectRatio) } } if (d == "sw") { g.left = i.left + (e.width - g.width); g.top = null } if (d == "nw") { g.top = i.top + (e.height - g.height); g.left = i.left + (e.width - g.width) } return g }, _respectSize: function(k, f) { var i = this.helper, h = this.options, q = this._aspectRatio || f.shiftKey, p = this.axis, s = a(k.width) && h.maxWidth && (h.maxWidth < k.width), l = a(k.height) && h.maxHeight && (h.maxHeight < k.height), g = a(k.width) && h.minWidth && (h.minWidth > k.width), r = a(k.height) && h.minHeight && (h.minHeight > k.height); if (g) { k.width = h.minWidth } if (r) { k.height = h.minHeight } if (s) { k.width = h.maxWidth } if (l) { k.height = h.maxHeight } var e = this.originalPosition.left + this.originalSize.width, n = this.position.top + this.size.height; var j = /sw|nw|w/.test(p), d = /nw|ne|n/.test(p); if (g && j) { k.left = e - h.minWidth } if (s && j) { k.left = e - h.maxWidth } if (r && d) { k.top = n - h.minHeight } if (l && d) { k.top = n - h.maxHeight } var m = !k.width && !k.height; if (m && !k.left && k.top) { k.top = null } else { if (m && !k.top && k.left) { k.left = null } } return k }, _proportionallyResize: function() { var j = this.options; if (!this._proportionallyResizeElements.length) { return } var f = this.helper || this.element; for (var e = 0; e < this._proportionallyResizeElements.length; e++) { var g = this._proportionallyResizeElements[e]; if (!this.borderDif) { var d = [g.css("borderTopWidth"), g.css("borderRightWidth"), g.css("borderBottomWidth"), g.css("borderLeftWidth")], h = [g.css("paddingTop"), g.css("paddingRight"), g.css("paddingBottom"), g.css("paddingLeft")]; this.borderDif = c.map(d, function(k, m) { var l = parseInt(k, 10) || 0, n = parseInt(h[m], 10) || 0; return l + n }) } if (c.browser.msie && !(!(c(f).is(":hidden") || c(f).parents(":hidden").length))) { continue } g.css({ height: (f.height() - this.borderDif[0] - this.borderDif[2]) || 0, width: (f.width() - this.borderDif[1] - this.borderDif[3]) || 0 }) } }, _renderProxy: function() { var e = this.element, h = this.options; this.elementOffset = e.offset(); if (this._helper) { this.helper = this.helper || c('<div style="overflow:hidden;"></div>'); var d = c.browser.msie && c.browser.version < 7, f = (d ? 1 : 0), g = (d ? 2 : -1); this.helper.addClass(this._helper).css({ width: this.element.outerWidth() + g, height: this.element.outerHeight() + g, position: "absolute", left: this.elementOffset.left - f + "px", top: this.elementOffset.top - f + "px", zIndex: ++h.zIndex }); this.helper.appendTo("body").disableSelection() } else { this.helper = this.element } }, _change: { e: function(f, e, d) { return { width: this.originalSize.width + e} }, w: function(g, e, d) { var i = this.options, f = this.originalSize, h = this.originalPosition; return { left: h.left + e, width: f.width - e} }, n: function(g, e, d) { var i = this.options, f = this.originalSize, h = this.originalPosition; return { top: h.top + d, height: f.height - d} }, s: function(f, e, d) { return { height: this.originalSize.height + d} }, se: function(f, e, d) { return c.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [f, e, d])) }, sw: function(f, e, d) { return c.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [f, e, d])) }, ne: function(f, e, d) { return c.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [f, e, d])) }, nw: function(f, e, d) { return c.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [f, e, d])) } }, _propagate: function(e, d) { c.ui.plugin.call(this, e, [d, this.ui()]); (e != "resize" && this._trigger(e, d, this.ui())) }, plugins: {}, ui: function() { return { originalElement: this.originalElement, element: this.element, helper: this.helper, position: this.position, size: this.size, originalSize: this.originalSize, originalPosition: this.originalPosition} } }); c.extend(c.ui.resizable, { version: "1.8" }); c.ui.plugin.add("resizable", "alsoResize", { start: function(e, f) { var d = c(this).data("resizable"), h = d.options; var g = function(i) { c(i).each(function() { c(this).data("resizable-alsoresize", { width: parseInt(c(this).width(), 10), height: parseInt(c(this).height(), 10), left: parseInt(c(this).css("left"), 10), top: parseInt(c(this).css("top"), 10) }) }) }; if (typeof (h.alsoResize) == "object" && !h.alsoResize.parentNode) { if (h.alsoResize.length) { h.alsoResize = h.alsoResize[0]; g(h.alsoResize) } else { c.each(h.alsoResize, function(i, j) { g(i) }) } } else { g(h.alsoResize) } }, resize: function(f, h) { var e = c(this).data("resizable"), i = e.options, g = e.originalSize, k = e.originalPosition; var j = { height: (e.size.height - g.height) || 0, width: (e.size.width - g.width) || 0, top: (e.position.top - k.top) || 0, left: (e.position.left - k.left) || 0 }, d = function(l, m) { c(l).each(function() { var p = c(this), q = c(this).data("resizable-alsoresize"), o = {}, n = m && m.length ? m : ["width", "height", "top", "left"]; c.each(n || ["width", "height", "top", "left"], function(r, t) { var s = (q[t] || 0) + (j[t] || 0); if (s && s >= 0) { o[t] = s || null } }); if (/relative/.test(p.css("position")) && c.browser.opera) { e._revertToRelativePosition = true; p.css({ position: "absolute", top: "auto", left: "auto" }) } p.css(o) }) }; if (typeof (i.alsoResize) == "object" && !i.alsoResize.nodeType) { c.each(i.alsoResize, function(l, m) { d(l, m) }) } else { d(i.alsoResize) } }, stop: function(e, f) { var d = c(this).data("resizable"); if (d._revertToRelativePosition && c.browser.opera) { d._revertToRelativePosition = false; el.css({ position: "relative" }) } c(this).removeData("resizable-alsoresize-start") } }); c.ui.plugin.add("resizable", "animate", { stop: function(h, m) { var n = c(this).data("resizable"), i = n.options; var g = n._proportionallyResizeElements, d = g.length && (/textarea/i).test(g[0].nodeName), e = d && c.ui.hasScroll(g[0], "left") ? 0 : n.sizeDiff.height, k = d ? 0 : n.sizeDiff.width; var f = { width: (n.size.width - k), height: (n.size.height - e) }, j = (parseInt(n.element.css("left"), 10) + (n.position.left - n.originalPosition.left)) || null, l = (parseInt(n.element.css("top"), 10) + (n.position.top - n.originalPosition.top)) || null; n.element.animate(c.extend(f, l && j ? { top: l, left: j} : {}), { duration: i.animateDuration, easing: i.animateEasing, step: function() { var o = { width: parseInt(n.element.css("width"), 10), height: parseInt(n.element.css("height"), 10), top: parseInt(n.element.css("top"), 10), left: parseInt(n.element.css("left"), 10) }; if (g && g.length) { c(g[0]).css({ width: o.width, height: o.height }) } n._updateCache(o); n._propagate("resize", h) } }) } }); c.ui.plugin.add("resizable", "containment", { start: function(e, q) { var s = c(this).data("resizable"), i = s.options, k = s.element; var f = i.containment, j = (f instanceof c) ? f.get(0) : (/parent/.test(f)) ? k.parent().get(0) : f; if (!j) { return } s.containerElement = c(j); if (/document/.test(f) || f == document) { s.containerOffset = { left: 0, top: 0 }; s.containerPosition = { left: 0, top: 0 }; s.parentData = { element: c(document), left: 0, top: 0, width: c(document).width(), height: c(document).height() || document.body.parentNode.scrollHeight} } else { var m = c(j), h = []; c(["Top", "Right", "Left", "Bottom"]).each(function(p, o) { h[p] = b(m.css("padding" + o)) }); s.containerOffset = m.offset(); s.containerPosition = m.position(); s.containerSize = { height: (m.innerHeight() - h[3]), width: (m.innerWidth() - h[1]) }; var n = s.containerOffset, d = s.containerSize.height, l = s.containerSize.width, g = (c.ui.hasScroll(j, "left") ? j.scrollWidth : l), r = (c.ui.hasScroll(j) ? j.scrollHeight : d); s.parentData = { element: j, left: n.left, top: n.top, width: g, height: r} } }, resize: function(f, p) { var s = c(this).data("resizable"), h = s.options, e = s.containerSize, n = s.containerOffset, l = s.size, m = s.position, q = s._aspectRatio || f.shiftKey, d = { top: 0, left: 0 }, g = s.containerElement; if (g[0] != document && (/static/).test(g.css("position"))) { d = n } if (m.left < (s._helper ? n.left : 0)) { s.size.width = s.size.width + (s._helper ? (s.position.left - n.left) : (s.position.left - d.left)); if (q) { s.size.height = s.size.width / h.aspectRatio } s.position.left = h.helper ? n.left : 0 } if (m.top < (s._helper ? n.top : 0)) { s.size.height = s.size.height + (s._helper ? (s.position.top - n.top) : s.position.top); if (q) { s.size.width = s.size.height * h.aspectRatio } s.position.top = s._helper ? n.top : 0 } s.offset.left = s.parentData.left + s.position.left; s.offset.top = s.parentData.top + s.position.top; var k = Math.abs((s._helper ? s.offset.left - d.left : (s.offset.left - d.left)) + s.sizeDiff.width), r = Math.abs((s._helper ? s.offset.top - d.top : (s.offset.top - n.top)) + s.sizeDiff.height); var j = s.containerElement.get(0) == s.element.parent().get(0), i = /relative|absolute/.test(s.containerElement.css("position")); if (j && i) { k -= s.parentData.left } if (k + s.size.width >= s.parentData.width) { s.size.width = s.parentData.width - k; if (q) { s.size.height = s.size.width / s.aspectRatio } } if (r + s.size.height >= s.parentData.height) { s.size.height = s.parentData.height - r; if (q) { s.size.width = s.size.height * s.aspectRatio } } }, stop: function(e, m) { var p = c(this).data("resizable"), f = p.options, k = p.position, l = p.containerOffset, d = p.containerPosition, g = p.containerElement; var i = c(p.helper), q = i.offset(), n = i.outerWidth() - p.sizeDiff.width, j = i.outerHeight() - p.sizeDiff.height; if (p._helper && !f.animate && (/relative/).test(g.css("position"))) { c(this).css({ left: q.left - d.left - l.left, width: n, height: j }) } if (p._helper && !f.animate && (/static/).test(g.css("position"))) { c(this).css({ left: q.left - d.left - l.left, width: n, height: j }) } } }); c.ui.plugin.add("resizable", "ghost", { start: function(f, g) { var d = c(this).data("resizable"), h = d.options, e = d.size; d.ghost = d.originalElement.clone(); d.ghost.css({ opacity: 0.25, display: "block", position: "relative", height: e.height, width: e.width, margin: 0, left: 0, top: 0 }).addClass("ui-resizable-ghost").addClass(typeof h.ghost == "string" ? h.ghost : ""); d.ghost.appendTo(d.helper) }, resize: function(e, f) { var d = c(this).data("resizable"), g = d.options; if (d.ghost) { d.ghost.css({ position: "relative", height: d.size.height, width: d.size.width }) } }, stop: function(e, f) { var d = c(this).data("resizable"), g = d.options; if (d.ghost && d.helper) { d.helper.get(0).removeChild(d.ghost.get(0)) } } }); c.ui.plugin.add("resizable", "grid", { resize: function(d, l) { var n = c(this).data("resizable"), g = n.options, j = n.size, h = n.originalSize, i = n.originalPosition, m = n.axis, k = g._aspectRatio || d.shiftKey; g.grid = typeof g.grid == "number" ? [g.grid, g.grid] : g.grid; var f = Math.round((j.width - h.width) / (g.grid[0] || 1)) * (g.grid[0] || 1), e = Math.round((j.height - h.height) / (g.grid[1] || 1)) * (g.grid[1] || 1); if (/^(se|s|e)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e } else { if (/^(ne)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e; n.position.top = i.top - e } else { if (/^(sw)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e; n.position.left = i.left - f } else { n.size.width = h.width + f; n.size.height = h.height + e; n.position.top = i.top - e; n.position.left = i.left - f } } } } }); var b = function(d) { return parseInt(d, 10) || 0 }; var a = function(d) { return !isNaN(parseInt(d, 10)) } })(jQuery); ; /*
 * jQuery UI Selectable 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Selectables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(a) { a.widget("ui.selectable", a.ui.mouse, { options: { appendTo: "body", autoRefresh: true, distance: 0, filter: "*", tolerance: "touch" }, _create: function() { var b = this; this.element.addClass("ui-selectable"); this.dragged = false; var c; this.refresh = function() { c = a(b.options.filter, b.element[0]); c.each(function() { var d = a(this); var e = d.offset(); a.data(this, "selectable-item", { element: this, $element: d, left: e.left, top: e.top, right: e.left + d.outerWidth(), bottom: e.top + d.outerHeight(), startselected: false, selected: d.hasClass("ui-selected"), selecting: d.hasClass("ui-selecting"), unselecting: d.hasClass("ui-unselecting") }) }) }; this.refresh(); this.selectees = c.addClass("ui-selectee"); this._mouseInit(); this.helper = a(document.createElement("div")).css({ border: "1px dotted black" }).addClass("ui-selectable-helper") }, destroy: function() { this.selectees.removeClass("ui-selectee").removeData("selectable-item"); this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"); this._mouseDestroy(); return this }, _mouseStart: function(d) { var b = this; this.opos = [d.pageX, d.pageY]; if (this.options.disabled) { return } var c = this.options; this.selectees = a(c.filter, this.element[0]); this._trigger("start", d); a(c.appendTo).append(this.helper); this.helper.css({ "z-index": 100, position: "absolute", left: d.clientX, top: d.clientY, width: 0, height: 0 }); if (c.autoRefresh) { this.refresh() } this.selectees.filter(".ui-selected").each(function() { var e = a.data(this, "selectable-item"); e.startselected = true; if (!d.metaKey) { e.$element.removeClass("ui-selected"); e.selected = false; e.$element.addClass("ui-unselecting"); e.unselecting = true; b._trigger("unselecting", d, { unselecting: e.element }) } }); a(d.target).parents().andSelf().each(function() { var e = a.data(this, "selectable-item"); if (e) { e.$element.removeClass("ui-unselecting").addClass("ui-selecting"); e.unselecting = false; e.selecting = true; e.selected = true; b._trigger("selecting", d, { selecting: e.element }); return false } }) }, _mouseDrag: function(i) { var c = this; this.dragged = true; if (this.options.disabled) { return } var e = this.options; var d = this.opos[0], h = this.opos[1], b = i.pageX, g = i.pageY; if (d > b) { var f = b; b = d; d = f } if (h > g) { var f = g; g = h; h = f } this.helper.css({ left: d, top: h, width: b - d, height: g - h }); this.selectees.each(function() { var j = a.data(this, "selectable-item"); if (!j || j.element == c.element[0]) { return } var k = false; if (e.tolerance == "touch") { k = (!(j.left > b || j.right < d || j.top > g || j.bottom < h)) } else { if (e.tolerance == "fit") { k = (j.left > d && j.right < b && j.top > h && j.bottom < g) } } if (k) { if (j.selected) { j.$element.removeClass("ui-selected"); j.selected = false } if (j.unselecting) { j.$element.removeClass("ui-unselecting"); j.unselecting = false } if (!j.selecting) { j.$element.addClass("ui-selecting"); j.selecting = true; c._trigger("selecting", i, { selecting: j.element }) } } else { if (j.selecting) { if (i.metaKey && j.startselected) { j.$element.removeClass("ui-selecting"); j.selecting = false; j.$element.addClass("ui-selected"); j.selected = true } else { j.$element.removeClass("ui-selecting"); j.selecting = false; if (j.startselected) { j.$element.addClass("ui-unselecting"); j.unselecting = true } c._trigger("unselecting", i, { unselecting: j.element }) } } if (j.selected) { if (!i.metaKey && !j.startselected) { j.$element.removeClass("ui-selected"); j.selected = false; j.$element.addClass("ui-unselecting"); j.unselecting = true; c._trigger("unselecting", i, { unselecting: j.element }) } } } }); return false }, _mouseStop: function(d) { var b = this; this.dragged = false; var c = this.options; a(".ui-unselecting", this.element[0]).each(function() { var e = a.data(this, "selectable-item"); e.$element.removeClass("ui-unselecting"); e.unselecting = false; e.startselected = false; b._trigger("unselected", d, { unselected: e.element }) }); a(".ui-selecting", this.element[0]).each(function() { var e = a.data(this, "selectable-item"); e.$element.removeClass("ui-selecting").addClass("ui-selected"); e.selecting = false; e.selected = true; e.startselected = true; b._trigger("selected", d, { selected: e.element }) }); this._trigger("stop", d); this.helper.remove(); return false } }); a.extend(a.ui.selectable, { version: "1.8" }) })(jQuery); ; /*
 * jQuery UI Sortable 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Sortables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(a) { a.widget("ui.sortable", a.ui.mouse, { widgetEventPrefix: "sort", options: { appendTo: "parent", axis: false, connectWith: false, containment: false, cursor: "auto", cursorAt: false, dropOnEmpty: true, forcePlaceholderSize: false, forceHelperSize: false, grid: false, handle: false, helper: "original", items: "> *", opacity: false, placeholder: false, revert: false, scroll: true, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1000 }, _create: function() { var b = this.options; this.containerCache = {}; this.element.addClass("ui-sortable"); this.refresh(); this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css("float")) : false; this.offset = this.element.offset(); this._mouseInit() }, destroy: function() { this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable"); this._mouseDestroy(); for (var b = this.items.length - 1; b >= 0; b--) { this.items[b].item.removeData("sortable-item") } return this }, _mouseCapture: function(e, f) { if (this.reverting) { return false } if (this.options.disabled || this.options.type == "static") { return false } this._refreshItems(e); var d = null, c = this, b = a(e.target).parents().each(function() { if (a.data(this, "sortable-item") == c) { d = a(this); return false } }); if (a.data(e.target, "sortable-item") == c) { d = a(e.target) } if (!d) { return false } if (this.options.handle && !f) { var g = false; a(this.options.handle, d).find("*").andSelf().each(function() { if (this == e.target) { g = true } }); if (!g) { return false } } this.currentItem = d; this._removeCurrentsFromItems(); return true }, _mouseStart: function(e, f, b) { var g = this.options, c = this; this.currentContainer = this; this.refreshPositions(); this.helper = this._createHelper(e); this._cacheHelperProportions(); this._cacheMargins(); this.scrollParent = this.helper.scrollParent(); this.offset = this.currentItem.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; this.helper.css("position", "absolute"); this.cssPosition = this.helper.css("position"); a.extend(this.offset, { click: { left: e.pageX - this.offset.left, top: e.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }); this.originalPosition = this._generatePosition(e); this.originalPageX = e.pageX; this.originalPageY = e.pageY; (g.cursorAt && this._adjustOffsetFromHelper(g.cursorAt)); this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; if (this.helper[0] != this.currentItem[0]) { this.currentItem.hide() } this._createPlaceholder(); if (g.containment) { this._setContainment() } if (g.cursor) { if (a("body").css("cursor")) { this._storedCursor = a("body").css("cursor") } a("body").css("cursor", g.cursor) } if (g.opacity) { if (this.helper.css("opacity")) { this._storedOpacity = this.helper.css("opacity") } this.helper.css("opacity", g.opacity) } if (g.zIndex) { if (this.helper.css("zIndex")) { this._storedZIndex = this.helper.css("zIndex") } this.helper.css("zIndex", g.zIndex) } if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") { this.overflowOffset = this.scrollParent.offset() } this._trigger("start", e, this._uiHash()); if (!this._preserveHelperProportions) { this._cacheHelperProportions() } if (!b) { for (var d = this.containers.length - 1; d >= 0; d--) { this.containers[d]._trigger("activate", e, c._uiHash(this)) } } if (a.ui.ddmanager) { a.ui.ddmanager.current = this } if (a.ui.ddmanager && !g.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, e) } this.dragging = true; this.helper.addClass("ui-sortable-helper"); this._mouseDrag(e); return true }, _mouseDrag: function(f) { this.position = this._generatePosition(f); this.positionAbs = this._convertPositionTo("absolute"); if (!this.lastPositionAbs) { this.lastPositionAbs = this.positionAbs } if (this.options.scroll) { var g = this.options, b = false; if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") { if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - f.pageY < g.scrollSensitivity) { this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop + g.scrollSpeed } else { if (f.pageY - this.overflowOffset.top < g.scrollSensitivity) { this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop - g.scrollSpeed } } if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - f.pageX < g.scrollSensitivity) { this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft + g.scrollSpeed } else { if (f.pageX - this.overflowOffset.left < g.scrollSensitivity) { this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft - g.scrollSpeed } } } else { if (f.pageY - a(document).scrollTop() < g.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() - g.scrollSpeed) } else { if (a(window).height() - (f.pageY - a(document).scrollTop()) < g.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() + g.scrollSpeed) } } if (f.pageX - a(document).scrollLeft() < g.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() - g.scrollSpeed) } else { if (a(window).width() - (f.pageX - a(document).scrollLeft()) < g.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() + g.scrollSpeed) } } } if (b !== false && a.ui.ddmanager && !g.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, f) } } this.positionAbs = this._convertPositionTo("absolute"); if (!this.options.axis || this.options.axis != "y") { this.helper[0].style.left = this.position.left + "px" } if (!this.options.axis || this.options.axis != "x") { this.helper[0].style.top = this.position.top + "px" } for (var d = this.items.length - 1; d >= 0; d--) { var e = this.items[d], c = e.item[0], h = this._intersectsWithPointer(e); if (!h) { continue } if (c != this.currentItem[0] && this.placeholder[h == 1 ? "next" : "prev"]()[0] != c && !a.ui.contains(this.placeholder[0], c) && (this.options.type == "semi-dynamic" ? !a.ui.contains(this.element[0], c) : true)) { this.direction = h == 1 ? "down" : "up"; if (this.options.tolerance == "pointer" || this._intersectsWithSides(e)) { this._rearrange(f, e) } else { break } this._trigger("change", f, this._uiHash()); break } } this._contactContainers(f); if (a.ui.ddmanager) { a.ui.ddmanager.drag(this, f) } this._trigger("sort", f, this._uiHash()); this.lastPositionAbs = this.positionAbs; return false }, _mouseStop: function(c, d) { if (!c) { return } if (a.ui.ddmanager && !this.options.dropBehaviour) { a.ui.ddmanager.drop(this, c) } if (this.options.revert) { var b = this; var e = b.placeholder.offset(); b.reverting = true; a(this.helper).animate({ left: e.left - this.offset.parent.left - b.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: e.top - this.offset.parent.top - b.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) }, parseInt(this.options.revert, 10) || 500, function() { b._clear(c) }) } else { this._clear(c, d) } return false }, cancel: function() { var b = this; if (this.dragging) { this._mouseUp(); if (this.options.helper == "original") { this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") } else { this.currentItem.show() } for (var c = this.containers.length - 1; c >= 0; c--) { this.containers[c]._trigger("deactivate", null, b._uiHash(this)); if (this.containers[c].containerCache.over) { this.containers[c]._trigger("out", null, b._uiHash(this)); this.containers[c].containerCache.over = 0 } } } if (this.placeholder[0].parentNode) { this.placeholder[0].parentNode.removeChild(this.placeholder[0]) } if (this.options.helper != "original" && this.helper && this.helper[0].parentNode) { this.helper.remove() } a.extend(this, { helper: null, dragging: false, reverting: false, _noFinalSort: null }); if (this.domPosition.prev) { a(this.domPosition.prev).after(this.currentItem) } else { a(this.domPosition.parent).prepend(this.currentItem) } return this }, serialize: function(d) { var b = this._getItemsAsjQuery(d && d.connected); var c = []; d = d || {}; a(b).each(function() { var e = (a(d.item || this).attr(d.attribute || "id") || "").match(d.expression || (/(.+)[-=_](.+)/)); if (e) { c.push((d.key || e[1] + "[]") + "=" + (d.key && d.expression ? e[1] : e[2])) } }); return c.join("&") }, toArray: function(d) { var b = this._getItemsAsjQuery(d && d.connected); var c = []; d = d || {}; b.each(function() { c.push(a(d.item || this).attr(d.attribute || "id") || "") }); return c }, _intersectsWith: function(m) { var e = this.positionAbs.left, d = e + this.helperProportions.width, k = this.positionAbs.top, j = k + this.helperProportions.height; var f = m.left, c = f + m.width, n = m.top, i = n + m.height; var o = this.offset.click.top, h = this.offset.click.left; var g = (k + o) > n && (k + o) < i && (e + h) > f && (e + h) < c; if (this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? "width" : "height"] > m[this.floating ? "width" : "height"])) { return g } else { return (f < e + (this.helperProportions.width / 2) && d - (this.helperProportions.width / 2) < c && n < k + (this.helperProportions.height / 2) && j - (this.helperProportions.height / 2) < i) } }, _intersectsWithPointer: function(d) { var e = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, d.top, d.height), c = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, d.left, d.width), g = e && c, b = this._getDragVerticalDirection(), f = this._getDragHorizontalDirection(); if (!g) { return false } return this.floating ? (((f && f == "right") || b == "down") ? 2 : 1) : (b && (b == "down" ? 2 : 1)) }, _intersectsWithSides: function(e) { var c = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, e.top + (e.height / 2), e.height), d = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, e.left + (e.width / 2), e.width), b = this._getDragVerticalDirection(), f = this._getDragHorizontalDirection(); if (this.floating && f) { return ((f == "right" && d) || (f == "left" && !d)) } else { return b && ((b == "down" && c) || (b == "up" && !c)) } }, _getDragVerticalDirection: function() { var b = this.positionAbs.top - this.lastPositionAbs.top; return b != 0 && (b > 0 ? "down" : "up") }, _getDragHorizontalDirection: function() { var b = this.positionAbs.left - this.lastPositionAbs.left; return b != 0 && (b > 0 ? "right" : "left") }, refresh: function(b) { this._refreshItems(b); this.refreshPositions(); return this }, _connectWith: function() { var b = this.options; return b.connectWith.constructor == String ? [b.connectWith] : b.connectWith }, _getItemsAsjQuery: function(b) { var l = this; var g = []; var e = []; var h = this._connectWith(); if (h && b) { for (var d = h.length - 1; d >= 0; d--) { var k = a(h[d]); for (var c = k.length - 1; c >= 0; c--) { var f = a.data(k[c], "sortable"); if (f && f != this && !f.options.disabled) { e.push([a.isFunction(f.options.items) ? f.options.items.call(f.element) : a(f.options.items, f.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), f]) } } } } e.push([a.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : a(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); for (var d = e.length - 1; d >= 0; d--) { e[d][0].each(function() { g.push(this) }) } return a(g) }, _removeCurrentsFromItems: function() { var d = this.currentItem.find(":data(sortable-item)"); for (var c = 0; c < this.items.length; c++) { for (var b = 0; b < d.length; b++) { if (d[b] == this.items[c].item[0]) { this.items.splice(c, 1) } } } }, _refreshItems: function(b) { this.items = []; this.containers = [this]; var h = this.items; var p = this; var f = [[a.isFunction(this.options.items) ? this.options.items.call(this.element[0], b, { item: this.currentItem }) : a(this.options.items, this.element), this]]; var l = this._connectWith(); if (l) { for (var e = l.length - 1; e >= 0; e--) { var m = a(l[e]); for (var d = m.length - 1; d >= 0; d--) { var g = a.data(m[d], "sortable"); if (g && g != this && !g.options.disabled) { f.push([a.isFunction(g.options.items) ? g.options.items.call(g.element[0], b, { item: this.currentItem }) : a(g.options.items, g.element), g]); this.containers.push(g) } } } } for (var e = f.length - 1; e >= 0; e--) { var k = f[e][1]; var c = f[e][0]; for (var d = 0, n = c.length; d < n; d++) { var o = a(c[d]); o.data("sortable-item", k); h.push({ item: o, instance: k, width: 0, height: 0, left: 0, top: 0 }) } } }, refreshPositions: function(b) { if (this.offsetParent && this.helper) { this.offset.parent = this._getParentOffset() } for (var d = this.items.length - 1; d >= 0; d--) { var e = this.items[d]; var c = this.options.toleranceElement ? a(this.options.toleranceElement, e.item) : e.item; if (!b) { e.width = c.outerWidth(); e.height = c.outerHeight() } var f = c.offset(); e.left = f.left; e.top = f.top } if (this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call(this) } else { for (var d = this.containers.length - 1; d >= 0; d--) { var f = this.containers[d].element.offset(); this.containers[d].containerCache.left = f.left; this.containers[d].containerCache.top = f.top; this.containers[d].containerCache.width = this.containers[d].element.outerWidth(); this.containers[d].containerCache.height = this.containers[d].element.outerHeight() } } return this }, _createPlaceholder: function(d) { var b = d || this, e = b.options; if (!e.placeholder || e.placeholder.constructor == String) { var c = e.placeholder; e.placeholder = { element: function() { var f = a(document.createElement(b.currentItem[0].nodeName)).addClass(c || b.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper")[0]; if (!c) { f.style.visibility = "hidden" } return f }, update: function(f, g) { if (c && !e.forcePlaceholderSize) { return } if (!g.height()) { g.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10)) } if (!g.width()) { g.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10)) } } } } b.placeholder = a(e.placeholder.element.call(b.element, b.currentItem)); b.currentItem.after(b.placeholder); e.placeholder.update(b, b.placeholder) }, _contactContainers: function(b) { var d = null, k = null; for (var f = this.containers.length - 1; f >= 0; f--) { if (a.ui.contains(this.currentItem[0], this.containers[f].element[0])) { continue } if (this._intersectsWith(this.containers[f].containerCache)) { if (d && a.ui.contains(this.containers[f].element[0], d.element[0])) { continue } d = this.containers[f]; k = f } else { if (this.containers[f].containerCache.over) { this.containers[f]._trigger("out", b, this._uiHash(this)); this.containers[f].containerCache.over = 0 } } } if (!d) { return } if (this.containers.length === 1) { this.containers[k]._trigger("over", b, this._uiHash(this)); this.containers[k].containerCache.over = 1 } else { if (this.currentContainer != this.containers[k]) { var h = 10000; var g = null; var c = this.positionAbs[this.containers[k].floating ? "left" : "top"]; for (var e = this.items.length - 1; e >= 0; e--) { if (!a.ui.contains(this.containers[k].element[0], this.items[e].item[0])) { continue } var l = this.items[e][this.containers[k].floating ? "left" : "top"]; if (Math.abs(l - c) < h) { h = Math.abs(l - c); g = this.items[e] } } if (!g && !this.options.dropOnEmpty) { return } this.currentContainer = this.containers[k]; g ? this._rearrange(b, g, null, true) : this._rearrange(b, null, this.containers[k].element, true); this._trigger("change", b, this._uiHash()); this.containers[k]._trigger("change", b, this._uiHash(this)); this.options.placeholder.update(this.currentContainer, this.placeholder); this.containers[k]._trigger("over", b, this._uiHash(this)); this.containers[k].containerCache.over = 1 } } }, _createHelper: function(c) { var d = this.options; var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c, this.currentItem])) : (d.helper == "clone" ? this.currentItem.clone() : this.currentItem); if (!b.parents("body").length) { a(d.appendTo != "parent" ? d.appendTo : this.currentItem[0].parentNode)[0].appendChild(b[0]) } if (b[0] == this.currentItem[0]) { this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left")} } if (b[0].style.width == "" || d.forceHelperSize) { b.width(this.currentItem.width()) } if (b[0].style.height == "" || d.forceHelperSize) { b.height(this.currentItem.height()) } return b }, _adjustOffsetFromHelper: function(b) { if (typeof b == "string") { b = b.split(" ") } if (a.isArray(b)) { b = { left: +b[0], top: +b[1] || 0} } if ("left" in b) { this.offset.click.left = b.left + this.margins.left } if ("right" in b) { this.offset.click.left = this.helperProportions.width - b.right + this.margins.left } if ("top" in b) { this.offset.click.top = b.top + this.margins.top } if ("bottom" in b) { this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top } }, _getParentOffset: function() { this.offsetParent = this.helper.offsetParent(); var b = this.offsetParent.offset(); if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) { b.left += this.scrollParent.scrollLeft(); b.top += this.scrollParent.scrollTop() } if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) { b = { top: 0, left: 0} } return { top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)} }, _getRelativeOffset: function() { if (this.cssPosition == "relative") { var b = this.currentItem.position(); return { top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()} } else { return { top: 0, left: 0} } }, _cacheMargins: function() { this.margins = { left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), top: (parseInt(this.currentItem.css("marginTop"), 10) || 0)} }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight()} }, _setContainment: function() { var e = this.options; if (e.containment == "parent") { e.containment = this.helper[0].parentNode } if (e.containment == "document" || e.containment == "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document : window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top] } if (!(/^(document|window|parent)$/).test(e.containment)) { var c = a(e.containment)[0]; var d = a(e.containment).offset(); var b = (a(c).css("overflow") != "hidden"); this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top] } }, _convertPositionTo: function(f, h) { if (!h) { h = this.position } var c = f == "absolute" ? 1 : -1; var e = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, g = (/(html|body)/i).test(b[0].tagName); return { top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)), left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c))} }, _generatePosition: function(e) { var h = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, i = (/(html|body)/i).test(b[0].tagName); if (this.cssPosition == "relative" && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset() } var d = e.pageX; var c = e.pageY; if (this.originalPosition) { if (this.containment) { if (e.pageX - this.offset.click.left < this.containment[0]) { d = this.containment[0] + this.offset.click.left } if (e.pageY - this.offset.click.top < this.containment[1]) { c = this.containment[1] + this.offset.click.top } if (e.pageX - this.offset.click.left > this.containment[2]) { d = this.containment[2] + this.offset.click.left } if (e.pageY - this.offset.click.top > this.containment[3]) { c = this.containment[3] + this.offset.click.top } } if (h.grid) { var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1]; c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g : (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g; var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0]; d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f : (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f } } return { top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))), left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft())))} }, _rearrange: function(g, f, c, e) { c ? c[0].appendChild(this.placeholder[0]) : f.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == "down" ? f.item[0] : f.item[0].nextSibling)); this.counter = this.counter ? ++this.counter : 1; var d = this, b = this.counter; window.setTimeout(function() { if (b == d.counter) { d.refreshPositions(!e) } }, 0) }, _clear: function(d, e) { this.reverting = false; var f = [], b = this; if (!this._noFinalSort && this.currentItem[0].parentNode) { this.placeholder.before(this.currentItem) } this._noFinalSort = null; if (this.helper[0] == this.currentItem[0]) { for (var c in this._storedCSS) { if (this._storedCSS[c] == "auto" || this._storedCSS[c] == "static") { this._storedCSS[c] = "" } } this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") } else { this.currentItem.show() } if (this.fromOutside && !e) { f.push(function(g) { this._trigger("receive", g, this._uiHash(this.fromOutside)) }) } if ((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !e) { f.push(function(g) { this._trigger("update", g, this._uiHash()) }) } if (!a.ui.contains(this.element[0], this.currentItem[0])) { if (!e) { f.push(function(g) { this._trigger("remove", g, this._uiHash()) }) } for (var c = this.containers.length - 1; c >= 0; c--) { if (a.ui.contains(this.containers[c].element[0], this.currentItem[0]) && !e) { f.push((function(g) { return function(h) { g._trigger("receive", h, this._uiHash(this)) } }).call(this, this.containers[c])); f.push((function(g) { return function(h) { g._trigger("update", h, this._uiHash(this)) } }).call(this, this.containers[c])) } } } for (var c = this.containers.length - 1; c >= 0; c--) { if (!e) { f.push((function(g) { return function(h) { g._trigger("deactivate", h, this._uiHash(this)) } }).call(this, this.containers[c])) } if (this.containers[c].containerCache.over) { f.push((function(g) { return function(h) { g._trigger("out", h, this._uiHash(this)) } }).call(this, this.containers[c])); this.containers[c].containerCache.over = 0 } } if (this._storedCursor) { a("body").css("cursor", this._storedCursor) } if (this._storedOpacity) { this.helper.css("opacity", this._storedOpacity) } if (this._storedZIndex) { this.helper.css("zIndex", this._storedZIndex == "auto" ? "" : this._storedZIndex) } this.dragging = false; if (this.cancelHelperRemoval) { if (!e) { this._trigger("beforeStop", d, this._uiHash()); for (var c = 0; c < f.length; c++) { f[c].call(this, d) } this._trigger("stop", d, this._uiHash()) } return false } if (!e) { this._trigger("beforeStop", d, this._uiHash()) } this.placeholder[0].parentNode.removeChild(this.placeholder[0]); if (this.helper[0] != this.currentItem[0]) { this.helper.remove() } this.helper = null; if (!e) { for (var c = 0; c < f.length; c++) { f[c].call(this, d) } this._trigger("stop", d, this._uiHash()) } this.fromOutside = false; return true }, _trigger: function() { if (a.Widget.prototype._trigger.apply(this, arguments) === false) { this.cancel() } }, _uiHash: function(c) { var b = c || this; return { helper: b.helper, placeholder: b.placeholder || a([]), position: b.position, originalPosition: b.originalPosition, offset: b.positionAbs, item: b.currentItem, sender: c ? c.element : null} } }); a.extend(a.ui.sortable, { version: "1.8" }) })(jQuery); ; /*
 * jQuery UI Autocomplete 1.8
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function(a) { a.widget("ui.autocomplete", { options: { minLength: 1, delay: 50 }, _create: function() { var b = this, c = this.element[0].ownerDocument; this.element.addClass("ui-autocomplete-input").attr("autocomplete", "off").attr({ role: "textbox", "aria-autocomplete": "list", "aria-haspopup": "true" }).bind("keydown.autocomplete", function(d) { var e = a.ui.keyCode; switch (d.keyCode) { case e.PAGE_UP: b._move("previousPage", d); break; case e.PAGE_DOWN: b._move("nextPage", d); break; case e.UP: b._move("previous", d); d.preventDefault(); break; case e.DOWN: b._move("next", d); d.preventDefault(); break; /*case e.ENTER: if (b.menu.active) { d.preventDefault() }*/case e.TAB: if (!b.menu.active) { return } b.menu.select(); break; case e.ESCAPE: b.element.val(b.term); b.close(d); break; case e.SHIFT: case e.CONTROL: case 18: break; default: clearTimeout(b.searching); b.searching = setTimeout(function() { b.search(null, d) }, b.options.delay); break } }).bind("focus.autocomplete", function() { b.previous = b.element.val() }).bind("blur.autocomplete", function(d) { clearTimeout(b.searching); b.closing = setTimeout(function() { b.close(d) }, 150) }); this._initSource(); this.response = function() { return b._response.apply(b, arguments) }; this.menu = a("<ul></ul>").addClass("ui-autocomplete").appendTo("body", c).menu({ focus: function(e, f) { var d = f.item.data("item.autocomplete"); if (false !== b._trigger("focus", null, { item: d })) { b.element.val(d.value) } }, selected: function(e, f) { var d = f.item.data("item.autocomplete"); if (false !== b._trigger("select", e, { item: d })) { b.element.val(d.value) } b.close(e); b.previous = b.element.val(); if (b.element[0] !== c.activeElement) { b.element.focus() } }, blur: function(d, e) { if (b.menu.element.is(":visible")) { b.element.val(b.term) } } }).zIndex(this.element.zIndex() + 1).css({ top: 0, left: 0 }).hide().data("menu"); if (a.fn.bgiframe) { this.menu.element.bgiframe() } }, destroy: function() { this.element.removeClass("ui-autocomplete-input ui-widget ui-widget-content").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"); this.menu.element.remove(); a.Widget.prototype.destroy.call(this) }, _setOption: function(b) { a.Widget.prototype._setOption.apply(this, arguments); if (b === "source") { this._initSource() } }, _initSource: function() { var c, b; if (a.isArray(this.options.source)) { c = this.options.source; this.source = function(e, d) { var f = new RegExp(a.ui.autocomplete.escapeRegex(e.term), "i"); d(a.grep(c, function(g) { return f.test(g.label || g.value || g) })) } } else { if (typeof this.options.source === "string") { b = this.options.source; this.source = function(e, d) { a.getJSON(b, e, d) } } else { this.source = this.options.source } } }, search: function(c, b) { c = c != null ? c : this.element.val(); if (c.length < this.options.minLength) { return this.close(b) } clearTimeout(this.closing); if (this._trigger("search") === false) { return } return this._search(c) }, _search: function(b) { this.term = this.element.addClass("ui-autocomplete-loading").val(); this.source({ term: b }, this.response) }, _response: function(b) { if (b.length) { b = this._normalize(b); this._suggest(b); this._trigger("open") } else { this.close() } this.element.removeClass("ui-autocomplete-loading") }, close: function(b) { clearTimeout(this.closing); if (this.menu.element.is(":visible")) { this._trigger("close", b); this.menu.element.hide(); this.menu.deactivate() } if (this.previous !== this.element.val()) { this._trigger("change", b) } }, _normalize: function(b) { if (b.length && b[0].label && b[0].value) { return b } return a.map(b, function(c) { if (typeof c === "string") { return { label: c, value: c} } return a.extend({ label: c.label || c.value, value: c.value || c.label }, c) }) }, _suggest: function(b) { var c = this.menu.element.empty().zIndex(this.element.zIndex() + 1), d, e; this._renderMenu(c, b); this.menu.deactivate(); this.menu.refresh(); this.menu.element.show().position({ my: "left top", at: "left bottom", of: this.element, collision: "none" }); d = c.width("").width(); e = this.element.width(); c.width(Math.max(d, e)) }, _renderMenu: function(d, c) { var b = this; a.each(c, function(e, f) { b._renderItem(d, f) }) }, _renderItem: function(b, c) { return a("<li></li>").data("item.autocomplete", c).append("<a>" + c.label + "</a>").appendTo(b) }, _move: function(c, b) { if (!this.menu.element.is(":visible")) { this.search(null, b); return } if (this.menu.first() && /^previous/.test(c) || this.menu.last() && /^next/.test(c)) { this.element.val(this.term); this.menu.deactivate(); return } this.menu[c]() }, widget: function() { return this.menu.element } }); a.extend(a.ui.autocomplete, { escapeRegex: function(b) { return b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") } }) } (jQuery)); (function(a) { a.widget("ui.menu", { _create: function() { var b = this; this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({ role: "listbox", "aria-activedescendant": "ui-active-menuitem" }).click(function(c) { c.preventDefault(); b.select() }); this.refresh() }, refresh: function() { var c = this; var b = this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role", "menuitem"); b.children("a").addClass("ui-corner-all").attr("tabindex", -1).mouseenter(function() { c.activate(a(this).parent()) }).mouseleave(function() { c.deactivate() }) }, activate: function(d) { this.deactivate(); if (this.hasScroll()) { var e = d.offset().top - this.element.offset().top, b = this.element.attr("scrollTop"), c = this.element.height(); if (e < 0) { this.element.attr("scrollTop", b + e) } else { if (e > c) { this.element.attr("scrollTop", b + e - c + d.height()) } } } this.active = d.eq(0).children("a").addClass("ui-state-hover").attr("id", "ui-active-menuitem").end(); this._trigger("focus", null, { item: d }) }, deactivate: function() { if (!this.active) { return } this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); this._trigger("blur"); this.active = null }, next: function() { this.move("next", "li:first") }, previous: function() { this.move("prev", "li:last") }, first: function() { return this.active && !this.active.prev().length }, last: function() { return this.active && !this.active.next().length }, move: function(d, c) { if (!this.active) { this.activate(this.element.children(c)); return } var b = this.active[d](); if (b.length) { this.activate(b) } else { this.activate(this.element.children(c)) } }, nextPage: function() { if (this.hasScroll()) { if (!this.active || this.last()) { this.activate(this.element.children(":first")); return } var d = this.active.offset().top, c = this.element.height(), b = this.element.children("li").filter(function() { var e = a(this).offset().top - d - c + a(this).height(); return e < 10 && e > -10 }); if (!b.length) { b = this.element.children(":last") } this.activate(b) } else { this.activate(this.element.children(!this.active || this.last() ? ":first" : ":last")) } }, previousPage: function() { if (this.hasScroll()) { if (!this.active || this.first()) { this.activate(this.element.children(":last")); return } var c = this.active.offset().top, b = this.element.height(); result = this.element.children("li").filter(function() { var d = a(this).offset().top - c + b - a(this).height(); return d < 10 && d > -10 }); if (!result.length) { result = this.element.children(":first") } this.activate(result) } else { this.activate(this.element.children(!this.active || this.first() ? ":last" : ":first")) } }, hasScroll: function() { return this.element.height() < this.element.attr("scrollHeight") }, select: function() { this._trigger("selected", null, { item: this.active }) } }) } (jQuery)); ;


/*
Masked Input plugin for jQuery
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function(a) { var c = (a.browser.msie ? "paste" : "input") + ".mask"; var b = (window.orientation != undefined); a.mask = { definitions: { "9": "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]"} }; a.fn.extend({ caret: function(e, f) { if (this.length == 0) { return } if (typeof e == "number") { f = (typeof f == "number") ? f : e; return this.each(function() { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(e, f) } else { if (this.createTextRange) { var g = this.createTextRange(); g.collapse(true); g.moveEnd("character", f); g.moveStart("character", e); g.select() } } }) } else { if (this[0].setSelectionRange) { e = this[0].selectionStart; f = this[0].selectionEnd } else { if (document.selection && document.selection.createRange) { var d = document.selection.createRange(); e = 0 - d.duplicate().moveStart("character", -100000); f = e + d.text.length } } return { begin: e, end: f} } }, unmask: function() { return this.trigger("unmask") }, mask: function(j, d) { if (!j && this.length > 0) { var f = a(this[0]); var g = f.data("tests"); return a.map(f.data("buffer"), function(l, m) { return g[m] ? l : null }).join("") } d = a.extend({ placeholder: "_", completed: null }, d); var k = a.mask.definitions; var g = []; var e = j.length; var i = null; var h = j.length; a.each(j.split(""), function(m, l) { if (l == "?") { h--; e = m } else { if (k[l]) { g.push(new RegExp(k[l])); if (i == null) { i = g.length - 1 } } else { g.push(null) } } }); return this.each(function() { var r = a(this); var m = a.map(j.split(""), function(x, y) { if (x != "?") { return k[x] ? d.placeholder : x } }); var n = false; var q = r.val(); r.data("buffer", m).data("tests", g); function v(x) { while (++x <= h && !g[x]) { } return x } function t(x) { while (!g[x] && --x >= 0) { } for (var y = x; y < h; y++) { if (g[y]) { m[y] = d.placeholder; var z = v(y); if (z < h && g[y].test(m[z])) { m[y] = m[z] } else { break } } } s(); r.caret(Math.max(i, x)) } function u(y) { for (var A = y, z = d.placeholder; A < h; A++) { if (g[A]) { var B = v(A); var x = m[A]; m[A] = z; if (B < h && g[B].test(x)) { z = x } else { break } } } } function l(y) { var x = a(this).caret(); var z = y.keyCode; n = (z < 16 || (z > 16 && z < 32) || (z > 32 && z < 41)); if ((x.begin - x.end) != 0 && (!n || z == 8 || z == 46)) { w(x.begin, x.end) } if (z == 8 || z == 46 || (b && z == 127)) { t(x.begin + (z == 46 ? 0 : -1)); return false } else { if (z == 27) { r.val(q); r.caret(0, p()); return false } } } function o(B) { if (n) { n = false; return (B.keyCode == 8) ? false : null } B = B || window.event; var C = B.charCode || B.keyCode || B.which; var z = a(this).caret(); if (B.ctrlKey || B.altKey || B.metaKey) { return true } else { if ((C >= 32 && C <= 125) || C > 186) { var x = v(z.begin - 1); if (x < h) { var A = String.fromCharCode(C); if (g[x].test(A)) { u(x); m[x] = A; s(); var y = v(x); a(this).caret(y); if (d.completed && y == h) { d.completed.call(r) } } } } } return false } function w(x, y) { for (var z = x; z < y && z < h; z++) { if (g[z]) { m[z] = d.placeholder } } } function s() { return r.val(m.join("")).val() } function p(y) { var z = r.val(); var C = -1; for (var B = 0, x = 0; B < h; B++) { if (g[B]) { m[B] = d.placeholder; while (x++ < z.length) { var A = z.charAt(x - 1); if (g[B].test(A)) { m[B] = A; C = B; break } } if (x > z.length) { break } } else { if (m[B] == z[x] && B != e) { x++; C = B } } } if (!y && C + 1 < e) { r.val(""); w(0, h) } else { if (y || C + 1 >= e) { s(); if (!y) { r.val(r.val().substring(0, C + 1)) } } } return (e ? B : i) } if (!r.attr("readonly")) { r.one("unmask", function() { r.unbind(".mask").removeData("buffer").removeData("tests") }).bind("focus.mask", function() { q = r.val(); var x = p(); s(); setTimeout(function() { if (x == j.length) { r.caret(0, x) } else { r.caret(x) } }, 0) }).bind("blur.mask", function() { p(); if (r.val() != q) { r.change() } }).bind("keydown.mask", l).bind("keypress.mask", o).bind(c, function() { setTimeout(function() { r.caret(p(true)) }, 0) }) } p() }) } }) })(jQuery);

/**
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
* You can set up various options to control how the system will work
* Copyright (c) Denis Howlett <denish@isocra.com>
* Licensed like jQuery, see http://docs.jquery.com/License.
*/
jQuery.tableDnD = { currentTable: null, dragObject: null, mouseOffset: null, oldY: 0, build: function(options) {
    this.each(function() {
        this.tableDnDConfig = jQuery.extend({ onDragStyle: null, onDropStyle: null, onDragClass: "tDnD_whileDrag", onDrop: null, onDragStart: null, scrollAmount: 5, serializeRegexp: /[^\-]*$/, serializeParamName: null, dragHandle: null
        }, options || {}); jQuery.tableDnD.makeDraggable(this);
    }); jQuery(document)
.bind('mousemove', jQuery.tableDnD.mousemove)
.bind('mouseup', jQuery.tableDnD.mouseup); return this;
}, makeDraggable: function(table) {
    var config = table.tableDnDConfig; if (table.tableDnDConfig.dragHandle) {
        var cells = jQuery("td." + table.tableDnDConfig.dragHandle, table); cells.each(function() {
            jQuery(this).mousedown(function(ev) {
                jQuery.tableDnD.dragObject = this.parentNode; jQuery.tableDnD.currentTable = table; jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev); if (config.onDragStart) { config.onDragStart(table, this); }
                return false;
            });
        })
    } else {
        var rows = jQuery("tr", table); rows.each(function() {
            var row = jQuery(this); if (!row.hasClass("nodrag")) {
                row.mousedown(function(ev) {
                    if (ev.target.tagName == "TD") {
                        jQuery.tableDnD.dragObject = this; jQuery.tableDnD.currentTable = table; jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev); if (config.onDragStart) { config.onDragStart(table, this); }
                        return false;
                    }
                }).css("cursor", "move");
            }
        });
    }
}, updateTables: function() {
    this.each(function() {
        if (this.tableDnDConfig) { jQuery.tableDnD.makeDraggable(this); }
    })
}, mouseCoords: function(ev) {
    if (ev.pageX || ev.pageY) { return { x: ev.pageX, y: ev.pageY }; }
    return { x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, y: ev.clientY + document.body.scrollTop - document.body.clientTop
    };
}, getMouseOffset: function(target, ev) { ev = ev || window.event; var docPos = this.getPosition(target); var mousePos = this.mouseCoords(ev); return { x: mousePos.x - docPos.x, y: mousePos.y - docPos.y }; }, getPosition: function(e) {
    var left = 0; var top = 0; if (e.offsetHeight == 0) { e = e.firstChild; }
    while (e.offsetParent) { left += e.offsetLeft; top += e.offsetTop; e = e.offsetParent; }
    left += e.offsetLeft; top += e.offsetTop; return { x: left, y: top };
}, mousemove: function(ev) {
    if (jQuery.tableDnD.dragObject == null) { return; }
    var dragObj = jQuery(jQuery.tableDnD.dragObject); var config = jQuery.tableDnD.currentTable.tableDnDConfig; var mousePos = jQuery.tableDnD.mouseCoords(ev); var y = mousePos.y - jQuery.tableDnD.mouseOffset.y; var yOffset = window.pageYOffset; if (document.all) {
        if (typeof document.compatMode != 'undefined' &&
document.compatMode != 'BackCompat') { yOffset = document.documentElement.scrollTop; }
        else if (typeof document.body != 'undefined') { yOffset = document.body.scrollTop; }
    }
    if (mousePos.y - yOffset < config.scrollAmount) { window.scrollBy(0, -config.scrollAmount); } else {
        var windowHeight = window.innerHeight ? window.innerHeight
: document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; if (windowHeight - (mousePos.y - yOffset) < config.scrollAmount) { window.scrollBy(0, config.scrollAmount); }
    }
    if (y != jQuery.tableDnD.oldY) {
        var movingDown = y > jQuery.tableDnD.oldY; jQuery.tableDnD.oldY = y; if (config.onDragClass) { dragObj.addClass(config.onDragClass); } else { dragObj.css(config.onDragStyle); }
        var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y); if (currentRow) {
            if (movingDown && jQuery.tableDnD.dragObject != currentRow) { jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling); } else if (!movingDown && jQuery.tableDnD.dragObject != currentRow) { jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow); }
        }
    }
    return false;
}, findDropTargetRow: function(draggedRow, y) {
    var rows = jQuery.tableDnD.currentTable.rows; for (var i = 0; i < rows.length; i++) {
        var row = rows[i]; var rowY = this.getPosition(row).y; var rowHeight = parseInt(row.offsetHeight) / 2; if (row.offsetHeight == 0) { rowY = this.getPosition(row.firstChild).y; rowHeight = parseInt(row.firstChild.offsetHeight) / 2; }
        if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
            if (row == draggedRow) { return null; }
            var config = jQuery.tableDnD.currentTable.tableDnDConfig; if (config.onAllowDrop) {
                if (config.onAllowDrop(draggedRow, row)) { return row; } else { return null; }
            } else {
                var nodrop = jQuery(row).hasClass("nodrop"); if (!nodrop) { return row; } else { return null; }
            }
            return row;
        }
    }
    return null;
}, mouseup: function(e) {
    if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
        var droppedRow = jQuery.tableDnD.dragObject; var config = jQuery.tableDnD.currentTable.tableDnDConfig; if (config.onDragClass) { jQuery(droppedRow).removeClass(config.onDragClass); } else { jQuery(droppedRow).css(config.onDropStyle); }
        jQuery.tableDnD.dragObject = null; if (config.onDrop) { config.onDrop(jQuery.tableDnD.currentTable, droppedRow); }
        jQuery.tableDnD.currentTable = null;
    }
}, serialize: function() {
    if (jQuery.tableDnD.currentTable) { return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable); } else { return "Error: No Table id set, you need to set an id on your table and every row"; }
}, serializeTable: function(table) {
    var result = ""; var tableId = table.id; var rows = table.rows; for (var i = 0; i < rows.length; i++) {
        if (result.length > 0) result += "&"; var rowId = rows[i].id; if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) { rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0]; }
        result += tableId + '[]=' + rowId;
    }
    return result;
}, serializeTables: function() { var result = ""; this.each(function() { result += jQuery.tableDnD.serializeTable(this); }); return result; }
}
jQuery.fn.extend({ tableDnD: jQuery.tableDnD.build, tableDnDUpdate: jQuery.tableDnD.updateTables, tableDnDSerialize: jQuery.tableDnD.serializeTables
});


//FLASH DETECT http://www.featureblend.com/license.txt
var FlashDetect = new function() {
    var self = this; self.installed = false; self.raw = ""; self.major = -1; self.minor = -1; self.revision = -1; self.revisionStr = ""; var activeXDetectRules = [{ "name": "ShockwaveFlash.ShockwaveFlash.7", "version": function(obj) { return getActiveXVersion(obj); } }, { "name": "ShockwaveFlash.ShockwaveFlash.6", "version": function(obj) {
        var version = "6,0,21"; try { obj.AllowScriptAccess = "always"; version = getActiveXVersion(obj); } catch (err) { }
        return version;
    }
    }, { "name": "ShockwaveFlash.ShockwaveFlash", "version": function(obj) { return getActiveXVersion(obj); } }]; var getActiveXVersion = function(activeXObj) {
        var version = -1; try { version = activeXObj.GetVariable("$version"); } catch (err) { }
        return version;
    }; var getActiveXObject = function(name) {
        var obj = -1; try { obj = new ActiveXObject(name); } catch (err) { obj = { activeXError: true }; }
        return obj;
    }; var parseActiveXVersion = function(str) { var versionArray = str.split(","); return { "raw": str, "major": parseInt(versionArray[0].split(" ")[1], 10), "minor": parseInt(versionArray[1], 10), "revision": parseInt(versionArray[2], 10), "revisionStr": versionArray[2] }; }; var parseStandardVersion = function(str) { var descParts = str.split(/ +/); var majorMinor = descParts[2].split(/\./); var revisionStr = descParts[3]; return { "raw": str, "major": parseInt(majorMinor[0], 10), "minor": parseInt(majorMinor[1], 10), "revisionStr": revisionStr, "revision": parseRevisionStrToInt(revisionStr) }; }; var parseRevisionStrToInt = function(str) { return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision; }; self.majorAtLeast = function(version) { return self.major >= version; }; self.minorAtLeast = function(version) { return self.minor >= version; }; self.revisionAtLeast = function(version) { return self.revision >= version; }; self.versionAtLeast = function(major) { var properties = [self.major, self.minor, self.revision]; var len = Math.min(properties.length, arguments.length); for (i = 0; i < len; i++) { if (properties[i] >= arguments[i]) { if (i + 1 < len && properties[i] == arguments[i]) { continue; } else { return true; } } else { return false; } } }; self.FlashDetect = function() { if (navigator.plugins && navigator.plugins.length > 0) { var type = 'application/x-shockwave-flash'; var mimeTypes = navigator.mimeTypes; if (mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description) { var version = mimeTypes[type].enabledPlugin.description; var versionObj = parseStandardVersion(version); self.raw = versionObj.raw; self.major = versionObj.major; self.minor = versionObj.minor; self.revisionStr = versionObj.revisionStr; self.revision = versionObj.revision; self.installed = true; } } else if (navigator.appVersion.indexOf("Mac") == -1 && window.execScript) { var version = -1; for (var i = 0; i < activeXDetectRules.length && version == -1; i++) { var obj = getActiveXObject(activeXDetectRules[i].name); if (!obj.activeXError) { self.installed = true; version = activeXDetectRules[i].version(obj); if (version != -1) { var versionObj = parseActiveXVersion(version); self.raw = versionObj.raw; self.major = versionObj.major; self.minor = versionObj.minor; self.revision = versionObj.revision; self.revisionStr = versionObj.revisionStr; } } } } } ();
}; FlashDetect.JS_RELEASE = "1.0.4";

/*
* jScroller 0.4 - Autoscroller PlugIn for jQuery
*
* Copyright (c) 2007 Markus Bordihn (http://markusbordihn.de)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Date: 2009-06-18 20:00:00 +0100 (Sat, 18 Jul 2009) $
* $Rev: 0.4 $
*/

eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('$2={Q:{R:"S 2 T w U",V:0.4,W:"X Y (Z://10.11)",12:"13 14 15"},5:{g:[],x:16,s:{6:/([0-9,.\\-]+)6/}},h:{m:0,y:0},17:j(a,b,c,d,e){3($(a).F&&$(b).F&&c&&d>=1){$(a).k({18:\'19\'});$(b).k({1a:\'1b\',7:0,8:0});3(e){$(b).1c(j(){$2.n($(b),1d)},j(){$2.n($(b),G)})}$2.5.g.1e({z:$(a),f:$(b),H:c,o:d,n:G})}},n:j(a,b){3(a&&I b!==\'J\'){w(t i K $2.5.g){3($2.5.g[i].f.L("M")===a.L("M")){$2.5.g[i].n=b}}}},p:j(){3($2.h.m===0&&$2.5.x>0){$2.h.m=l.1f($2.A,$2.5.x)}3(!$2.h.y){$(l).1g($2.N);$(l).O($2.p);$(l).1h($2.p);$(l).A($2.p);$(1i).1j($2.p);3($.1k.1l){l.O()}$2.h.y=1}},N:j(){3($2.h.m){l.1m($2.h.m);$2.h.m=0}},B:{6:j(a){t b=\'\';3(a){3(a.C($2.5.s.6)){3(I a.C($2.5.s.6)[1]!==\'J\'){b=a.C($2.5.s.6)[1]}}}1n b}},A:j(){w(t i K $2.5.g){3($2.5.g.1o(i)){t a=$2.5.g[i],7=P(($2.B.6(a.f.k(\'7\'))||0)),8=P(($2.B.6(a.f.k(\'8\'))||0)),D=a.z.q(),E=a.z.r(),q=a.f.q(),r=a.f.r();3(!a.n){1p(a.H){u\'1q\':3(8<=-1*q){8=D}a.f.k(\'8\',8-a.o+\'6\');v;u\'1r\':3(7>=E){7=-1*r}a.f.k(\'7\',7+a.o+\'6\');v;u\'7\':3(7<=-1*r){7=E}a.f.k(\'7\',7-a.o+\'6\');v;u\'1s\':3(8>=D){8=-1*q}a.f.k(\'8\',8+a.o+\'6\');v}}}}}};', 62, 91, '||jScroller|if||config|px|left|top|||||||child|obj|cache||function|css|window|timer|pause|speed|start|height|width|regExp|var|case|break|for|refresh|init|parent|scroll|get|match|min_height|min_width|length|false|direction|typeof|undefined|in|attr|id|stop|focus|Number|info|Name|ByRei|Plugin|jQuery|Version|Author|Markus|Bordihn|http|markusbordihn|de|Description|Next|Generation|Autoscroller|120|add|overflow|hidden|position|absolute|hover|true|push|setInterval|blur|resize|document|mousemove|browser|msie|clearInterval|return|hasOwnProperty|switch|up|right|down'.split('|'), 0, {}))


/*
* jScroller 0.4 - Autoscroller PlugIn for jQuery
*
* Copyright (c) 2007 Markus Bordihn (http://markusbordihn.de)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Date: 2009-06-18 20:00:00 +0100 (Sat, 18 Jul 2009) $
* $Rev: 0.4 $
*/

eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('$2={Q:{R:"S 2 T w U",V:0.4,W:"X Y (Z://10.11)",12:"13 14 15"},5:{g:[],x:16,s:{6:/([0-9,.\\-]+)6/}},h:{m:0,y:0},17:j(a,b,c,d,e){3($(a).F&&$(b).F&&c&&d>=1){$(a).k({18:\'19\'});$(b).k({1a:\'1b\',7:0,8:0});3(e){$(b).1c(j(){$2.n($(b),1d)},j(){$2.n($(b),G)})}$2.5.g.1e({z:$(a),f:$(b),H:c,o:d,n:G})}},n:j(a,b){3(a&&I b!==\'J\'){w(t i K $2.5.g){3($2.5.g[i].f.L("M")===a.L("M")){$2.5.g[i].n=b}}}},p:j(){3($2.h.m===0&&$2.5.x>0){$2.h.m=l.1f($2.A,$2.5.x)}3(!$2.h.y){$(l).1g($2.N);$(l).O($2.p);$(l).1h($2.p);$(l).A($2.p);$(1i).1j($2.p);3($.1k.1l){l.O()}$2.h.y=1}},N:j(){3($2.h.m){l.1m($2.h.m);$2.h.m=0}},B:{6:j(a){t b=\'\';3(a){3(a.C($2.5.s.6)){3(I a.C($2.5.s.6)[1]!==\'J\'){b=a.C($2.5.s.6)[1]}}}1n b}},A:j(){w(t i K $2.5.g){3($2.5.g.1o(i)){t a=$2.5.g[i],7=P(($2.B.6(a.f.k(\'7\'))||0)),8=P(($2.B.6(a.f.k(\'8\'))||0)),D=a.z.q(),E=a.z.r(),q=a.f.q(),r=a.f.r();3(!a.n){1p(a.H){u\'1q\':3(8<=-1*q){8=D}a.f.k(\'8\',8-a.o+\'6\');v;u\'1r\':3(7>=E){7=-1*r}a.f.k(\'7\',7+a.o+\'6\');v;u\'7\':3(7<=-1*r){7=E}a.f.k(\'7\',7-a.o+\'6\');v;u\'1s\':3(8>=D){8=-1*q}a.f.k(\'8\',8+a.o+\'6\');v}}}}}};', 62, 91, '||jScroller|if||config|px|left|top|||||||child|obj|cache||function|css|window|timer|pause|speed|start|height|width|regExp|var|case|break|for|refresh|init|parent|scroll|get|match|min_height|min_width|length|false|direction|typeof|undefined|in|attr|id|stop|focus|Number|info|Name|ByRei|Plugin|jQuery|Version|Author|Markus|Bordihn|http|markusbordihn|de|Description|Next|Generation|Autoscroller|120|add|overflow|hidden|position|absolute|hover|true|push|setInterval|blur|resize|document|mousemove|browser|msie|clearInterval|return|hasOwnProperty|switch|up|right|down'.split('|'), 0, {}))

/*!
* jQuery corner plugin: simple corner rounding
* Examples and documentation at: http://jquery.malsup.com/corner/
* version 2.06 (16-FEB-2010)
* Requires jQuery v1.3.2 or later
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Authors: Dave Methvin and Mike Alsup
*/

/**
*  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
*
*  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
*  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
*  width:   width of the effect; in the case of rounded corners this is the radius. 
*           specify this value using the px suffix such as 10px (yes, it must be pixels).
*/
; (function($) {

    var style = document.createElement('div').style;
    var moz = style['MozBorderRadius'] !== undefined;
    var webkit = style['WebkitBorderRadius'] !== undefined;
    var radius = style['BorderRadius'] !== undefined;
    var mode = document.documentMode || 0;
    var noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);

    var expr = $.browser.msie && (function() {
        var div = document.createElement('div');
        try { div.style.setExpression('width', '0+0'); div.style.removeExpression('width'); }
        catch (e) { return false; }
        return true;
    })();

    function sz(el, p) {
        return parseInt($.css(el, p)) || 0;
    };
    function hex2(s) {
        var s = parseInt(s).toString(16);
        return (s.length < 2) ? '0' + s : s;
    };
    function gpc(node) {
        for (; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode) {
            var v = $.css(node, 'backgroundColor');
            if (v == 'rgba(0, 0, 0, 0)')
                continue; // webkit
            if (v.indexOf('rgb') >= 0) {
                var rgb = v.match(/\d+/g);
                return '#' + hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            if (v && v != 'transparent')
                return v;
        }
        return '#ffffff';
    };

    function getWidth(fx, i, width) {
        switch (fx) {
            case 'round': return Math.round(width * (1 - Math.cos(Math.asin(i / width))));
            case 'cool': return Math.round(width * (1 + Math.cos(Math.asin(i / width))));
            case 'sharp': return Math.round(width * (1 - Math.cos(Math.acos(i / width))));
            case 'bite': return Math.round(width * (Math.cos(Math.asin((width - i - 1) / width))));
            case 'slide': return Math.round(width * (Math.atan2(i, width / i)));
            case 'jut': return Math.round(width * (Math.atan2(width, (width - i - 1))));
            case 'curl': return Math.round(width * (Math.atan(i)));
            case 'tear': return Math.round(width * (Math.cos(i)));
            case 'wicked': return Math.round(width * (Math.tan(i)));
            case 'long': return Math.round(width * (Math.sqrt(i)));
            case 'sculpt': return Math.round(width * (Math.log((width - i - 1), width)));
            case 'dogfold':
            case 'dog': return (i & 1) ? (i + 1) : width;
            case 'dog2': return (i & 2) ? (i + 1) : width;
            case 'dog3': return (i & 3) ? (i + 1) : width;
            case 'fray': return (i % 2) * width;
            case 'notch': return width;
            case 'bevelfold':
            case 'bevel': return i + 1;
        }
    };

    $.fn.corner = function(options) {
        // in 1.3+ we can fix mistakes with the ready state
        if (this.length == 0) {
            if (!$.isReady && this.selector) {
                var s = this.selector, c = this.context;
                $(function() {
                    $(s, c).corner(options);
                });
            }
            return this;
        }

        return this.each(function(index) {
            var $this = $(this);
            // meta values override options
            var o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase();
            var keep = /keep/.test(o);                       // keep borders?
            var cc = ((o.match(/cc:(#[0-9a-f]+)/) || [])[1]);  // corner color
            var sc = ((o.match(/sc:(#[0-9a-f]+)/) || [])[1]);  // strip color
            var width = parseInt((o.match(/(\d+)px/) || [])[1]) || 10; // corner width
            var re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/;
            var fx = ((o.match(re) || ['round'])[0]);
            var fold = /dogfold|bevelfold/.test(o);
            var edges = { T: 0, B: 1 };
            var opts = {
                TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o),
                BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o)
            };
            if (!opts.TL && !opts.TR && !opts.BL && !opts.BR)
                opts = { TL: 1, TR: 1, BL: 1, BR: 1 };

            // support native rounding
            if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
                if (opts.TL)
                    $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
                if (opts.TR)
                    $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
                if (opts.BL)
                    $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
                if (opts.BR)
                    $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
                return;
            }

            var strip = document.createElement('div');
            $(strip).css({
                overflow: 'hidden',
                height: '1px',
                minHeight: '1px',
                fontSize: '1px',
                backgroundColor: sc || 'transparent',
                borderStyle: 'solid'
            });

            var pad = {
                T: parseInt($.css(this, 'paddingTop')) || 0, R: parseInt($.css(this, 'paddingRight')) || 0,
                B: parseInt($.css(this, 'paddingBottom')) || 0, L: parseInt($.css(this, 'paddingLeft')) || 0
            };

            if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
            if (!keep) this.style.border = 'none';
            strip.style.borderColor = cc || gpc(this.parentNode);
            var cssHeight = $.curCSS(this, 'height');

            for (var j in edges) {
                var bot = edges[j];
                // only add stips if needed
                if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                    strip.style.borderStyle = 'none ' + (opts[j + 'R'] ? 'solid' : 'none') + ' none ' + (opts[j + 'L'] ? 'solid' : 'none');
                    var d = document.createElement('div');
                    $(d).addClass('jquery-corner');
                    var ds = d.style;

                    bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                    if (bot && cssHeight != 'auto') {
                        if ($.css(this, 'position') == 'static')
                            this.style.position = 'relative';
                        ds.position = 'absolute';
                        ds.bottom = ds.left = ds.padding = ds.margin = '0';
                        if (expr)
                            ds.setExpression('width', 'this.parentNode.offsetWidth');
                        else
                            ds.width = '100%';
                    }
                    else if (!bot && $.browser.msie) {
                        if ($.css(this, 'position') == 'static')
                            this.style.position = 'relative';
                        ds.position = 'absolute';
                        ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';

                        // fix ie6 problem when blocked element has a border width
                        if (expr) {
                            var bw = sz(this, 'borderLeftWidth') + sz(this, 'borderRightWidth');
                            ds.setExpression('width', 'this.parentNode.offsetWidth - ' + bw + '+ "px"');
                        }
                        else
                            ds.width = '100%';
                    }
                    else {
                        ds.position = 'relative';
                        ds.margin = !bot ? '-' + pad.T + 'px -' + pad.R + 'px ' + (pad.T - width) + 'px -' + pad.L + 'px' :
                                        (pad.B - width) + 'px -' + pad.R + 'px -' + pad.B + 'px -' + pad.L + 'px';
                    }

                    for (var i = 0; i < width; i++) {
                        var w = Math.max(0, getWidth(fx, i, width));
                        var e = strip.cloneNode(false);
                        e.style.borderWidth = '0 ' + (opts[j + 'R'] ? w : 0) + 'px 0 ' + (opts[j + 'L'] ? w : 0) + 'px';
                        bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                    }

                    if (fold && $.support.boxModel) {
                        if (bot && noBottomFold) continue;
                        for (var c in opts) {
                            if (!opts[c]) continue;
                            if (bot && (c == 'TL' || c == 'TR')) continue;
                            if (!bot && (c == 'BL' || c == 'BR')) continue;

                            var common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
                            var $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
                            switch (c) {
                                case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
                                case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
                                case 'BL': $horz.css({ top: 0, left: 0 }); break;
                                case 'BR': $horz.css({ top: 0, right: 0 }); break;
                            }
                            d.appendChild($horz[0]);

                            var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
                            switch (c) {
                                case 'TL': $vert.css({ left: width }); break;
                                case 'TR': $vert.css({ right: width }); break;
                                case 'BL': $vert.css({ left: width }); break;
                                case 'BR': $vert.css({ right: width }); break;
                            }
                            d.appendChild($vert[0]);
                        }
                    }
                }
            }
        });
    };

    $.fn.uncorner = function() {
        if (radius || moz || webkit)
            this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
        $('div.jquery-corner', this).remove();
        return this;
    };

    // expose options
    $.fn.corner.defaults = {
        useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
        metaAttr: 'data-corner' // name of meta attribute to use for options
    };

})(jQuery);




/* GET MESSAGE
------------------------------------------------------------------------------------------------*/

function GetMessage(obj, message) {
    var componentId = $(obj).attr('componentId');
    return $('#' + componentId + '_' + message).attr('value');
}





/*
* jQuery spritely - Sprite up the web!
* http://spritely.net/
*
* Latest version:
* http://spritely.net/download/
*
* Copyright 2010, Peter Chater, Artlogic Media Ltd, http://www.artlogic.net/
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function($) {
    $._spritely = {
        // shared methods and variables used by spritely plugin
        animate: function(options) {
            var el = $(options.el);
            var el_id = el.attr('id');
            if (!$._spritely.instances) {
                $._spritely.instances = {};
            }
            if (!$._spritely.instances[el_id]) {
                $._spritely.instances[el_id] = { current_frame: -1 };
            }
            var instance = $._spritely.instances[el_id];
            if (options.type == 'sprite') {
                var frames;
                var animate = function(el) {
                    var w = options.width, h = options.height;
                    if (!frames) {
                        frames = [];
                        total = 0
                        for (var i = 0; i < options.no_of_frames; i++) {
                            frames[frames.length] = (0 - total);
                            total += w;
                        }
                    }
                    if ($._spritely.instances[el_id]['current_frame'] >= frames.length - 1) {
                        $._spritely.instances[el_id]['current_frame'] = 0;
                    } else {
                        $._spritely.instances[el_id]['current_frame'] = $._spritely.instances[el_id]['current_frame'] + 1;
                    }
                    el.css('background-position', frames[$._spritely.instances[el_id]['current_frame']] + 'px 0');
                    if (options.bounce && options.bounce[0] > 0 && options.bounce[1] > 0) {
                        var ud = options.bounce[0]; // up-down
                        var lr = options.bounce[1]; // left-right
                        var ms = options.bounce[2]; // milliseconds
                        el
							.animate({ top: '+=' + ud + 'px', left: '-=' + lr + 'px' }, ms)
							.animate({ top: '-=' + ud + 'px', left: '+=' + lr + 'px' }, ms);
                    }
                }
                animate(el);
            } else if (options.type == 'pan') {
                if (options.dir == 'left') {
                    $._spritely.instances[el_id]['l'] = ($._spritely.instances[el_id]['l'] - (options.speed || 1)) || 0;
                } else {
                    $._spritely.instances[el_id]['l'] = ($._spritely.instances[el_id]['l'] + (options.speed || 1)) || 0;
                }
                if ($.browser.msie) {
                    // fixme - the background-position property does not work
                    // corretly in IE so we have to hack it here... Not ideal
                    // especially as $.browser is depricated
                    var bp_top = $(el).css('background-position-y') || '0';
                    $(el).css('background-position', $._spritely.instances[el_id]['l'] + 'px ' + bp_top);
                } else {
                    var bp_top = ($(el).css('background-position').split(' ') || ' ')[1];
                    $(el).css('background-position', $._spritely.instances[el_id]['l'] + 'px ' + bp_top);
                }
            }
        },
        randomIntBetween: function(lower, higher) {
            return parseInt(rand_no = Math.floor((higher - (lower - 1)) * Math.random()) + lower);
        }
    };
    $.fn.extend({
        spritely: function(options) {
            var options = $.extend({
                type: 'sprite',
                do_once: false,
                width: null,
                height: null,
                fps: 12,
                no_of_frames: 2
            }, options || {});
            options.el = this;
            options.width = options.width || $(this).width() || 100;
            options.height = options.height || $(this).height() || 100;
            var get_rate = function() {
                return parseInt(1000 / options.fps);
            }
            if (!options.do_once) {
                window.setInterval(function() {
                    $._spritely.animate(options);
                }, get_rate(options.fps));
            } else {
                $._spritely.animate(options);
            }
            return this; // so we can chain events
        },
        sprite: function(options) {
            var options = $.extend({
                type: 'sprite',
                bounce: [0, 0, 1000] // up-down, left-right, milliseconds
            }, options || {});
            return $(this).spritely(options);
        },
        pan: function(options) {
            var options = $.extend({
                type: 'pan',
                dir: 'left',
                continuous: true,
                speed: 1 // 1 pixel per frame
            }, options || {});
            return $(this).spritely(options);
        },
        flyToTap: function(options) {
            var options = $.extend({
                el_to_move: null,
                type: 'moveToTap',
                ms: 1000, // milliseconds
                do_once: true
            }, options || {});
            if (options.el_to_move) {
                $(options.el_to_move).active();
            }
            if ($._spritely.activeSprite) {
                if (window.Touch) { // iphone method see http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone/9 or http://www.nimblekit.com/tutorials.html for clues...
                    $(this)[0].ontouchstart = function(e) {
                        var el_to_move = $._spritely.activeSprite;
                        var touch = e.touches[0];
                        var t = touch.pageY - (el_to_move.height() / 2);
                        var l = touch.pageX - (el_to_move.width() / 2);
                        el_to_move.animate({
                            top: t + 'px',
                            left: l + 'px'
                        }, 1000);
                    };
                } else {
                    $(this).click(function(e) {
                        var el_to_move = $._spritely.activeSprite;
                        $(el_to_move).stop(true);
                        var w = el_to_move.width();
                        var h = el_to_move.height();
                        var l = e.pageX - (w / 2);
                        var t = e.pageY - (h / 2);
                        el_to_move.animate({
                            top: t + 'px',
                            left: l + 'px'
                        }, 1000);
                    });
                }
            }
            return this;
        },
        active: function() {
            // the active sprite
            $._spritely.activeSprite = this;
            return this;
        },
        activeOnClick: function() {
            // make this the active script if clicked...
            var el = $(this);
            if (window.Touch) { // iphone method see http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone/9 or http://www.nimblekit.com/tutorials.html for clues...
                el[0].ontouchstart = function(e) {
                    $._spritely.activeSprite = el;
                };
            } else {
                el.click(function(e) {
                    $._spritely.activeSprite = el;
                });
            }
            return this;
        },
        spRandom: function(options) {
            var options = $.extend({
                top: 50,
                left: 50,
                right: 290,
                bottom: 320,
                speed: 4000,
                pause: 0
            }, options || {});
            var el_id = $(this).attr('id');
            var r = $._spritely.randomIntBetween;
            var t = r(options.top, options.bottom);
            var l = r(options.left, options.right);
            $('#' + el_id).animate({
                top: t + 'px',
                left: l + 'px'
            }, options.speed)
            window.setTimeout(function() {
                $('#' + el_id).spRandom(options);
            }, options.speed + options.pause)
            return this;
        },
        makeAbsolute: function() {
            // remove an element from its current position in the DOM and
            // position it absolutely, appended to the body tag.
            return this.each(function() {
                var el = $(this);
                var pos = el.position();
                el.css({ position: "absolute", marginLeft: 0, marginTop: 0, top: pos.top, left: pos.left })
					.remove()
					.appendTo("body");
            });

        }
    })
})(jQuery);
// Stop IE6 re-loading background images continuously
try {
    document.execCommand("BackgroundImageCache", false, true);
} catch (err) { }

//Google website optmizer
function utmx_section() { }

//ajusta os z-index dos campos de formulário para não dar problema com o tooltip
$(function() {
    var itens = $(".infoCreate .formArea");
    itens.each(function(i) {
        $(this).css("z-index", itens.length - i);
    });
});

