(function (e) {
    var b = {},
        k, m, o, j = e.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
        a = false;
    e.tooltip = {
            blocked: false,
            defaults: {
                delay: 200,
                fade: false,
                showURL: true,
                extraClass: "",
                top: 15,
                left: 15,
                id: "tooltip"
            },
            block: function () {
                e.tooltip.blocked = !e.tooltip.blocked
            }
        };
    e.fn.extend({
            tooltip: function (p) {
                p = e.extend({}, e.tooltip.defaults, p);
                h(p);
                return this.each(function () {
                    e.data(this, "tooltip", p);
                    this.tOpacity = b.parent.css("opacity");
                    this.tooltipText = this.title;
                    e(this).removeAttr("title");
                    this.alt = ""
                }).mouseover(l).mouseout(f).click(f)
            },
            fixPNG: j ?
            function () {
                return this.each(function () {
                    var p = e(this).css("backgroundImage");
                    if (p.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
                        p = RegExp.$1;
                        e(this).css({
                            backgroundImage: "none",
                            filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + p + "')"
                        }).each(function () {
                            var q = e(this).css("position");
                            if (q != "absolute" && q != "relative") {
                                e(this).css("position", "relative")
                            }
                        })
                    }
                })
            } : function () {
                return this
            },
            unfixPNG: j ?
            function () {
                return this.each(function () {
                    e(this).css({
                        filter: "",
                        backgroundImage: ""
                    })
                })
            } : function () {
                return this
            },
            hideWhenEmpty: function () {
                return this.each(function () {
                    e(this)[e(this).html() ? "show" : "hide"]()
                })
            },
            url: function () {
                return this.attr("href") || this.attr("src")
            }
        });

    function h(p) {
            if (b.parent) {
                return
            }
            b.parent = e('<div id="' + p.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();
            if (e.fn.bgiframe) {
                b.parent.bgiframe()
            }
            b.title = e("h3", b.parent);
            b.body = e("div.body", b.parent);
            b.url = e("div.url", b.parent)
        }
    function c(p) {
            return e.data(p, "tooltip")
        }
    function g(p) {
            if (c(this).delay) {
                o = setTimeout(n, c(this).delay)
            } else {
                n()
            }
            a = !! c(this).track;
            e(document.body).bind("mousemove", d);
            d(p)
        }
    function l() {
            if (e.tooltip.blocked || this == k || (!this.tooltipText && !c(this).bodyHandler)) {
                return
            }
            k = this;
            m = this.tooltipText;
            if (c(this).bodyHandler) {
                b.title.hide();
                var s = c(this).bodyHandler.call(this);
                if (s.nodeType || s.jquery) {
                    b.body.empty().append(s)
                } else {
                    b.body.html(s)
                }
                b.body.show()
            } else {
                if (c(this).showBody) {
                    var r = m.split(c(this).showBody);
                    b.title.html(r.shift()).show();
                    b.body.empty();
                    for (var q = 0, p;
                    (p = r[q]); q++) {
                        if (q > 0) {
                            b.body.append("<br/>")
                        }
                        b.body.append(p)
                    }
                    b.body.hideWhenEmpty()
                } else {
                    b.title.html(m).show();
                    b.body.hide()
                }
            }
            if (c(this).showURL && e(this).url()) {
                b.url.html(e(this).url().replace("http://", "")).show()
            } else {
                b.url.hide()
            }
            b.parent.addClass(c(this).extraClass);
            if (c(this).fixPNG) {
                b.parent.fixPNG()
            }
            g.apply(this, arguments)
        }
    function n() {
            o = null;
            if ((!j || !e.fn.bgiframe) && c(k).fade) {
                if (b.parent.is(":animated")) {
                    b.parent.stop().show().fadeTo(c(k).fade, k.tOpacity)
                } else {
                    b.parent.is(":visible") ? b.parent.fadeTo(c(k).fade, k.tOpacity) : b.parent.fadeIn(c(k).fade)
                }
            } else {
                b.parent.show()
            }
            d()
        }
    function d(s) {
            if (e.tooltip.blocked) {
                return
            }
            if (s && s.target.tagName == "OPTION") {
                return
            }
            if (!a && b.parent.is(":visible")) {
                e(document.body).unbind("mousemove", d)
            }
            if (k == null) {
                e(document.body).unbind("mousemove", d);
                return
            }
            b.parent.removeClass("viewport-right").removeClass("viewport-bottom");
            var u = b.parent[0].offsetLeft;
            var t = b.parent[0].offsetTop;
            if (s) {
                u = s.pageX + c(k).left;
                t = s.pageY + c(k).top;
                var q = "auto";
                if (c(k).positionLeft) {
                    q = e(window).width() - u;
                    u = "auto"
                }
                b.parent.css({
                    left: u,
                    right: q,
                    top: t
                })
            }
            var p = i(),
                r = b.parent[0];
            if (p.x + p.cx < r.offsetLeft + r.offsetWidth) {
                    u -= r.offsetWidth + 20 + c(k).left;
                    b.parent.css({
                        left: u + "px"
                    }).addClass("viewport-right")
                }
            if (p.y + p.cy < r.offsetTop + r.offsetHeight) {
                    t -= r.offsetHeight + 20 + c(k).top;
                    b.parent.css({
                        top: t + "px"
                    }).addClass("viewport-bottom")
                }
        }
    function i() {
            return {
                x: e(window).scrollLeft(),
                y: e(window).scrollTop(),
                cx: e(window).width(),
                cy: e(window).height()
            }
        }
    function f(r) {
            if (e.tooltip.blocked) {
                return
            }
            if (o) {
                clearTimeout(o)
            }
            k = null;
            var q = c(this);

            function p() {
                b.parent.removeClass(q.extraClass).hide().css("opacity", "")
            }
            if ((!j || !e.fn.bgiframe) && q.fade) {
                if (b.parent.is(":animated")) {
                    b.parent.stop().fadeTo(q.fade, 0, p)
                } else {
                    b.parent.stop().fadeOut(q.fade, p)
                }
            } else {
                p()
            }
            if (c(this).fixPNG) {
                b.parent.unfixPNG()
            }
        }
})(jQuery);
(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);
function loadTime() {
    setTimeout("loadTime()", 1000);
    myDate = new Date();
    hours = myDate.getHours();
    minutes = myDate.getMinutes();
    seconds = myDate.getSeconds();
    if (hours < 10) {
        hours = "0" + hours
    }
    if (minutes < 10) {
        minutes = "0" + minutes
    }
    if (seconds < 10) {
        seconds = "0" + seconds
    }
    $("#time-display").html(hours + ":" + minutes + ":" + seconds)
}

function loadDate() {
    myDate = new Date();
    var b = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    var a = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    date = b[myDate.getDay()];
    number = myDate.getDate();
    year = myDate.getFullYear();
    month = a[myDate.getMonth()];
    $("#date-display").html(date + " " + number + ", " + month + " " + year + ",")
}

function sortHeader() {
    this.list = new Array();
    this.option = function (a) {
        for (x = 0; x <= this.list.length; x++) {
            if (this.list[x] == a) {
                $("#li-" + this.list[x]).addClass("active")
            } else {
                $("#li-" + this.list[x]).removeClass("active")
            }
        }
    }
}

function sendEmail(a) {
    $("#contactSending").show();
	$("#contactResponse").hide();
    $.post(mainURL + "index.php?page=sendMail", {
        sName: a.sName.value,
        sEmail: a.sEmail.value,
        sMessage: a.sMessage.value,
        noTopLoad: true
    }, function (b) {
		$("#contactSending").hide();
        if (b == "validationPassed" || b == "validationPassed<br />" || b == "validationPassed<br>") {
            jQuery.facebox('<h2>Message sent!</h2>Thank you for contacting OpenInferno.<br /><br />An OpenInferno staff member shall get back to you as soon as possible with a response.');
            $("#contactResponse").hide();
            $("#sName").val('');
            $("#sEmail").val('');
            $("#sMessage").val('')
        } else {
            $("#contactResponse").html(b);
			$("#contactResponse").show();
        }
    });
    return false
}

function swapFaceBox(a) {
    jQuery.facebox($("#news-" + a).html());
    return true
}

jQuery(document).ready(function ($) {
    $(".resizeImg").each(function () {
        var maxWidth = 700;
        $(this).css("width", "auto");
        $(this).removeAttr("width");
        var width = $(this).width();
        var height = $(this).height();
		var imageID = $(this).attr('id').replace('imageSrc-', '');
        if (width > maxWidth) {
            var ratio = maxWidth / width;
            $(this).css("width", maxWidth);
            $(this).css("height", height * ratio);
			$('#imageLink-' + imageID).after('<br /><div style="font-size: 10px; padding-top: 2px; padding-left: 2px;"><a target="_blank" style="color: #666;border-color: #666;" href="' + $(this).attr('src') + '">View high-res</a></div><br />');
			height = height * ratio
        }
    });
    $("#headImg, #twitDetails, #fLink, #sLink, #cLink, .showToolTip").tooltip({
        track: true,
        delay: 0,
        showURL: false,
        showBody: " || ",
        fade: 0
    })
});

function loadGallery() {
    $("div.thumbNav").css({
        width: "75px",
        "float": "left"
    });
    $("div.galContent").css("display", "block");
    var b = 0.67;
    $("#thumbs ul.thumbs li").opacityrollover({
        mouseOutOpacity: b,
        mouseOverOpacity: 1,
        fadeSpeed: "fast",
        exemptionSelector: ".selected"
    });
    var a = $("#thumbs").galleriffic({
        delay: 2500,
        numThumbs: 15,
        preloadAhead: 10,
        enableTopPager: true,
        enableBottomPager: true,
        maxPagesToShow: 7,
        imageContainerSel: "#slideshow",
        controlsContainerSel: "#controls",
        captionContainerSel: "#caption",
        loadingContainerSel: "#loading",
        renderSSControls: true,
        renderNavControls: true,
        playLinkText: "Play Slideshow",
        pauseLinkText: "Pause Slideshow",
        prevLinkText: "&lsaquo; Previous Photo",
        nextLinkText: "Next Photo &rsaquo;",
        nextPageLinkText: "Next &rsaquo;",
        prevPageLinkText: "&lsaquo; Prev",
        enableHistory: false,
        autoStart: false,
        syncTransitions: true,
        defaultTransitionDuration: 900,
        onSlideChange: function (d, c) {
            this.find("ul.thumbs").children().eq(d).fadeTo("fast", b).end().eq(c).fadeTo("fast", 1)
        },
        onPageTransitionOut: function (c) {
            this.fadeTo("fast", 0, c)
        },
        onPageTransitionIn: function () {
            this.fadeTo("fast", 1)
        }
    })
};
function showMini(option) {
	if($('#' + option + '-plan').length) {	
		$('#' + option + '-more').toggle();	
		$('#' + option + '-plan').toggle();	
		return false;
	} else {
		return true;
	}
}
function sendPaypal() {
	document.forms['paypal_form'].submit();
}