
jQuery.fn.truncate = function(max, settings) {
    settings = jQuery.extend({ chars: /\s/, trail: ["...", ""] }, settings);
    var myResults = {};
    var ie = $.browser.msie;
    function fixIE(o) {
        if (ie) { o.style.removeAttribute("filter") }
    }
    return this.each(function() {
        var $this = jQuery(this);
        var myStrOrig = $this.html().replace(/\r\n/gim, "");
        var myStr = myStrOrig;
        var myRegEx = /<\/?[^<>]*\/?>/gim;
        var myRegExArray;
        var myRegExHash = {};
        var myResultsKey = $("*").index(this);
        while ((myRegExArray = myRegEx.exec(myStr)) != null) {
            myRegExHash[myRegExArray.index] = myRegExArray[0]
        } myStr = jQuery.trim(myStr.split(myRegEx).join("")); if (myStr.length > max) { var c; while (max < myStr.length) { c = myStr.charAt(max); if (c.match(settings.chars)) { myStr = myStr.substring(0, max); break } max-- } if (myStrOrig.search(myRegEx) != -1) { var endCap = 0; for (eachEl in myRegExHash) { myStr = [myStr.substring(0, eachEl), myRegExHash[eachEl], myStr.substring(eachEl, myStr.length)].join(""); if (eachEl < myStr.length) { endCap = myStr.length } } $this.html([myStr.substring(0, endCap), myStr.substring(endCap, myStr.length).replace(/<(\w+)[^>]*>.*<\/\1>/gim, "").replace(/<(br|hr|img|input)[^<>]*\/?>/gim, "")].join("")) } else { $this.html(myStr) } myResults[myResultsKey] = myStrOrig; $this.html(["<div class='truncate_less'>", $this.html(), settings.trail[0], "</div>"].join("")).find(".truncate_show", this).click(function() { if ($this.find(".truncate_more").length == 0) { $this.append(["<div class='truncate_more' style='display: none;'>", myResults[myResultsKey], settings.trail[1], "</div>"].join("")).find(".truncate_hide").click(function() { $this.find(".truncate_more").css("background", "#fff").fadeOut("fast", function() { $this.find(".truncate_less").css("background", "#fff").fadeIn("fast", function() { fixIE(this); $(this).css("background", "none") }); fixIE(this) }); return false }) } $this.find(".truncate_less").fadeOut("fast", function() { $this.find(".truncate_more").fadeIn("fast", function() { fixIE(this) }); fixIE(this) }); jQuery(".truncate_show", $this).click(function() { $this.find(".truncate_less").css("background", "#fff").fadeOut("fast", function() { $this.find(".truncate_more").css("background", "#fff").fadeIn("fast", function() { fixIE(this); $(this).css("background", "none") }); fixIE(this) }); return false }); return false }) }
    })
};

/*
* jquery.qtip. The jQuery tooltip plugin
*
* Copyright (c) 2009 Craig Thompson
* http://craigsworks.com
*
* Licensed under MIT
* http://www.opensource.org/licenses/mit-license.php
*
* Launch  : February 2009
* Version : 1.0.0-rc3
* Released: Tuesday 12th May, 2009 - 00:00
* Debug: jquery.qtip.debug.js
*/

/*
CORUSEL
*/
//$(document).ready(function() {

//    options = {
//        scroll: 1,
//        auto: 4,
//        wrap: 'last',
//        initCallback: carousel_initCallback,
//        itemLoadCallback: carousel_loadedCallback
//    };

//    $('#carousela').jcarousel(options);
//    options.auto = 0;
//    $('#carouselb').jcarousel(options);
//    $('#carouselc').jcarousel(options);
//    $('#carouseld').jcarousel(options);

//    _hide($('.carousels'));
//    _show($('.carousels:eq(0)'));
//});

//function carousel_loadedCallback(carousel, state) {
//    ticklist = carousel.container.find('.jcarousel-control a');
//    ticklist.removeClass('selectedtr')
//    ticklist.eq((carousel.first - 1)).addClass('selectedtr');
//}

//function carousel_initCallback(carousel, state) {
//    carousel.container.find('.jcarousel-control a').bind('click', function() {
//        carousel.scroll($.jcarousel.intval($(this).attr('rel')));
//        return false;
//    });

//    carousel.buttonNext.bind('click', function() {
//        carousel.startAuto(0);
//    });

//    carousel.buttonPrev.bind('click', function() {
//        carousel.startAuto(0);
//    });

//    carousel.clip.hover(function() {
//        carousel.stopAuto();
//    }, function() {
//        carousel.startAuto();
//    });
//};

//function _hide(elem) {
//    elem.css('visibility', 'hidden');
//}

//function _show(elem) {
//    elem.css('visibility', 'visible');
//}

/*
TAB
*/

//        $(document).ready(function() {

//            //Default Action
//            $(".tab_content").hide(); //Hide all content
//            $("ul.tabs li:first").addClass("active").show(); //Activate first tab
//            $(".tab_content:first").show(); //Show first tab content

//            //On Click Event
//            $("ul.tabs li").click(function() {
//                $("ul.tabs li").removeClass("active"); //Remove any "active" class
//                $(this).addClass("active"); //Add "active" class to selected tab
//                $(".tab_content").hide(); //Hide all tab content
//                var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
//                $(activeTab).show(); //Fade in the active content
//                return false;
//            });

//        });
//$(document).ready(function() {

//    //Default Action
//    $(".tab_content").hide(); //Hide all content
//    if (location.hash != "") {
//        var target = location.hash.split("#")[1]
//        $(location.hash).show(); //Show first tab content
//        $("ul.tabs li:has(a[rel=" + target + "])").addClass("active").show(); ;
//    } else {
//        $("ul.tabs li:first").addClass("active").show(); //Activate first tab
//        $(".tab_content:first").show(); //Show first tab content
//    }

//    //On Click Event
//    $("ul.tabs li").click(function() {
//        $("ul.tabs li").removeClass("active"); //Remove any "active" class
//        $(this).addClass("active"); //Add "active" class to selected tab
//        $(".tab_content").hide(); //Hide all tab content
//        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
//        $(activeTab).show(); //Fade in the active content

//    });

//});
