// Little Tree Software// JavaScript Framework based on JQuery and a collection of JQuery Plugins$(function() {	$('body').addClass("js");	$('a.external').attr("target", "_blank").attr("title", function(i,title) {return title + " (Opens in External Window)";}).html(function(i, html) {return "<span></span>" + html});		   	Cufon.replace('h1', { fontFamily: 'Gotham Light', fontWeight: '300' });	Cufon.replace('.six h2');		$('.navigation ul li a').addClass('toplevel');	$('.navigation ul li ul li a').removeClass('toplevel');		Cufon.replace($('.navigation ul li a.toplevel'), {hover: true});	Cufon.replace($('.secondary-navigation ul li a'), {hover: true});		$.lts.navigation();	$.lts.popup();	$.lts.tips();	});(function ($) {    $.lts = {				navigation: function() {			$('.navigation ul li').hover(function() {$(this).addClass("over")},function() {$(this).removeClass("over")})	;		},				tips: function tips() {				$('a.tooltip').qtip({				position: {				  corner: {					 target: 'topMiddle',					 tooltip: 'bottomMiddle'				  }				},				style: { 					padding: 5,					background: '#2999AA',					color: '#fff',					border: {						width: 3,						color: '#2999AA'					},					tip: { 						corner: 'bottomMiddle', 						color: '#2999AA',						size: {							x: 8, 							y : 8 						}					}				},				show: {					delay: 0,					when: {						event: 'mouseover'						},									},				hide: 'mouseout'				});					},				 popup: function (options) {            var defaults = {                selector: '.popup',                popupId: 'lts-popup',                preloadText: '<img src="_img/loader.gif" alt="Loading..." />',                errorText: 'There has been a problem with your request, please click outside this window to close it.',                closeText: 'Close'            };            if (typeof options == 'string') defaults.selector = options;            var options = $.extend(defaults, options);            return $(options.selector).each(function () {                $(this).click(function (e) {                    e.preventDefault();                    if ($.browser.opera) $.support.opacity = true;                    var ie6 = $.browser.msie && $.browser.version.substr(0, 1) < 7;                    var opera95 = $.browser.opera && $.browser.version <= 9.5;                    var w = $(window).width();                    var h = $(document).height();                    var w2 = $(window).width() / 2;                    var h2 = $(window).height() / 2;                    show = function () {                        $('#' + options.popupId + 'preloader').remove();                        if (cw != 0) $('#' + options.popupId + 'content').css('width', cw + 'px');                        if (ch != 0) $('#' + options.popupId + 'content').css('height', ch + 'px');                        set($('#' + options.popupId + 'content'));                        $('img', '#' + options.popupId + 'content').css('visibility', 'visible')                    };                    set = function (obj) {                        $(obj).css({                            'padding': '10px',                            'background': '#fff',                            'color': '#333',                            'text-align': 'left',                            'float': 'left',                            'position': 'fixed',                            'z-index': '10001',							'-moz-border-radius': '10px',							'-webkit-border-radius': '10px',                            'visible': 'hidden'                        });                        var left = w2 - $(obj).width() / 2;                        var top = h2 - $(obj).height() / 2;                        $(obj).css({                            'left': left,                            'top': top,                            'display': 'none'                        }).fadeIn('1000');                        if (ie6) $(obj).css({                            'position': 'absolute',                            'top': (top + $(window).scrollTop()) + 'px'                        });                        if (opera95) $(obj).css({                            'position': 'absolute',                            'top': (document.body['clientHeight'] / 2 - $(obj).height() / 2 + $(window).scrollTop()) + 'px'                        })                    };                    if (ie6) $('embed, object, select').css('visibility', 'hidden');                    error = function () {                        $('#' + options.popupId + 'content').text(options.errorText);                        show()                    };                    remove = function () {                        $('#' + options.popupId).remove();                        $('#' + options.popupId + 'content').remove();                        $('#' + options.popupId + 'preloader').remove();                        if (ie6) $('embed, object, select').css('visibility', 'visible')                    };                    $('<div id="' + options.popupId + '"></div>').appendTo('body').css({                        'width': w,                        'height': h,                        'background': '#000',                        'position': 'absolute',                        'top': '0',                        'left': '0',                        'z-index': '10000',                        'opacity': .7                    }).click(function () {                        remove()                    });                    var href = $(this).attr('href');                    var extension = href.substr(href.lastIndexOf('.')).toLowerCase();                    var content;                    var cw = 0;                    var ch = 0;                    var showOk = false;                    $('<div id="' + options.popupId + 'preloader">' + options.preloadText + '</div>').appendTo('body');                    set($('#' + options.popupId + 'preloader'));                    $('<div id="' + options.popupId + 'content"></div>').appendTo('body');                    if ($(this).hasClass('flash')) {                        var flash = '<object width="100%" height="100%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="' + href + '" /><embed src="' + href + '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%"></embed></object>';                        $(flash).appendTo('#' + options.popupId + 'content');                        cw = 600;                        ch = 400;                        showOk = true                    } else {                        if (extension == '.jpg' || extension == '.jpeg' || extension == '.gif' || extension == '.png' || extension == '.bmp') {                            var img = new Image();                            $(img).error(function () {                                error()                            }).css('visibility', 'hidden').appendTo('#' + options.popupId + 'content');                            img.onload = function () {                                show();                                img.onload = function () {}                            };                            img.src = href + '?' + (new Date()).getTime() + ' =' + (new Date()).getTime()                        } else if (href.charAt(0) == '#') {                            $(href).clone().removeClass('hidden').show().appendTo('#' + options.popupId + 'content');                            $.easy.forms('#' + options.popupId + 'content form');                            showOk = true                        } else {                            $('<iframe frameborder="0" scrolling="auto" style="width:100%;height:100%" src="' + href + '" />').appendTo('#' + options.popupId + 'content');                            cw = 900;                            ch = 500;                            showOk = true                        }                    };                    var rel = $(this).attr('rel').split(';');                    $.each(rel, function (i) {                        if (rel[i].indexOf('width') != -1) cw = rel[i].split(':')[1];                        if (rel[i].indexOf('height') != -1) ch = rel[i].split(':')[1]                    });                    if (showOk) show();                    $('<small>' + options.closeText + '</small>').appendTo('#' + options.popupId + 'content').css({                        'position': 'absolute',                        'float': 'left',                        'left': '0',                        'top': '-24px',                        'color': '#fff',                        'cursor': 'pointer'                    });                    $('#' + options.popupId + ', #' + options.popupId + 'content small').click(function () {                        remove()                    })                })            })        }	}		   })(jQuery);
