﻿/// <reference path="~/jquery/js/jquery-1.4.1.min.js" />

function setField(field) {
    var input = $(field);
    var results = [];
    $.get('/xml/landmarks.xml', function(xml) {
        $(xml).find('place').each(function() {
            var text = $.trim($(this).find('value').text());
            var value = $.trim($(this).find('name').text());
            results[results.length] = { 'data': { text: text, value: value }, 'result': text, 'value': value };
        });
    })
    input.autocomplete(results, {
        delay: 10,
        minChars: 1,
        matchSubset: 1,
        matchContains: 0,
        formatItem: function(data) { return $(data).val(); },
        formatResult: function(data) { return $(data).val(); }
    }).result(function(event, item) {
        input.val($(item).attr("result"));
    });
};

function parseXML(xml) {
    var results = [];
    $(xml).find('place').each(function() {
        var text = $.trim($(this).find('name').text());
        var value = $.trim($(this).find('value').text());
        results[results.length] = { 'data': { text: text, value: value }, 'result': text, 'value': value };
    });
}

function megaHoverOver() {
    $(this).addClass("hover");
}
//On Hover Out
function megaHoverOut() {
    $(this).removeClass("hover");
}
var megaConfig = { interval: 200, sensitivity: 2, over: megaHoverOver, timeout: 300, out: megaHoverOut };



/******************************************************* JQUERY PLUGINS ****************************************/
/*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
; (function($) {
    $.fn.extend({ autocomplete: function(urlOrData, options) { var isUrl = typeof urlOrData == "string"; options = $.extend({}, $.Autocompleter.defaults, { url: isUrl ? urlOrData : null, data: isUrl ? null : urlOrData, delay: isUrl ? $.Autocompleter.defaults.delay : 10, max: options && !options.scroll ? 10 : 150 }, options); options.highlight = options.highlight || function(value) { return value; }; options.formatMatch = options.formatMatch || options.formatItem; return this.each(function() { new $.Autocompleter(this, options); }); }, result: function(handler) { return this.bind("result", handler); }, search: function(handler) { return this.trigger("search", [handler]); }, flushCache: function() { return this.trigger("flushCache"); }, setOptions: function(options) { return this.trigger("setOptions", [options]); }, unautocomplete: function() { return this.trigger("unautocomplete"); } }); $.Autocompleter = function(input, options) { var KEY = { UP: 38, DOWN: 40, DEL: 46, TAB: 9, RETURN: 13, ESC: 27, COMMA: 188, PAGEUP: 33, PAGEDOWN: 34, BACKSPACE: 8 }; var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); var timeout; var previousValue = ""; var cache = $.Autocompleter.Cache(options); var hasFocus = 0; var lastKeyPressCode; var config = { mouseDownOnSelect: false }; var select = $.Autocompleter.Select(options, input, selectCurrent, config); var blockSubmit; $.browser.opera && $(input.form).bind("submit.autocomplete", function() { if (blockSubmit) { blockSubmit = false; return false; } }); $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { hasFocus = 1; lastKeyPressCode = event.keyCode; switch (event.keyCode) { case KEY.UP: event.preventDefault(); if (select.visible()) { select.prev(); } else { onChange(0, true); } break; case KEY.DOWN: event.preventDefault(); if (select.visible()) { select.next(); } else { onChange(0, true); } break; case KEY.PAGEUP: event.preventDefault(); if (select.visible()) { select.pageUp(); } else { onChange(0, true); } break; case KEY.PAGEDOWN: event.preventDefault(); if (select.visible()) { select.pageDown(); } else { onChange(0, true); } break; case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: case KEY.TAB: case KEY.RETURN: if (selectCurrent()) { event.preventDefault(); blockSubmit = true; return false; } break; case KEY.ESC: select.hide(); break; default: clearTimeout(timeout); timeout = setTimeout(onChange, options.delay); break; } }).focus(function() { hasFocus++; }).blur(function() { hasFocus = 0; if (!config.mouseDownOnSelect) { hideResults(); } }).click(function() { if (hasFocus++ > 1 && !select.visible()) { onChange(0, true); } }).bind("search", function() { var fn = (arguments.length > 1) ? arguments[1] : null; function findValueCallback(q, data) { var result; if (data && data.length) { for (var i = 0; i < data.length; i++) { if (data[i].result.toLowerCase() == q.toLowerCase()) { result = data[i]; break; } } } if (typeof fn == "function") fn(result); else $input.trigger("result", result && [result.data, result.value]); } $.each(trimWords($input.val()), function(i, value) { request(value, findValueCallback, findValueCallback); }); }).bind("flushCache", function() { cache.flush(); }).bind("setOptions", function() { $.extend(options, arguments[1]); if ("data" in arguments[1]) cache.populate(); }).bind("unautocomplete", function() { select.unbind(); $input.unbind(); $(input.form).unbind(".autocomplete"); }); function selectCurrent() { var selected = select.selected(); if (!selected) return false; var v = selected.result; previousValue = v; if (options.multiple) { var words = trimWords($input.val()); if (words.length > 1) { var seperator = options.multipleSeparator.length; var cursorAt = $(input).selection().start; var wordAt, progress = 0; $.each(words, function(i, word) { progress += word.length; if (cursorAt <= progress) { wordAt = i; return false; } progress += seperator; }); words[wordAt] = v; v = words.join(options.multipleSeparator); } v += options.multipleSeparator; } $input.val(v); hideResultsNow(); $input.trigger("result", [selected.data, selected.value]); return true; } function onChange(crap, skipPrevCheck) { if (lastKeyPressCode == KEY.DEL) { select.hide(); return; } var currentValue = $input.val(); if (!skipPrevCheck && currentValue == previousValue) return; previousValue = currentValue; currentValue = lastWord(currentValue); if (currentValue.length >= options.minChars) { $input.addClass(options.loadingClass); if (!options.matchCase) currentValue = currentValue.toLowerCase(); request(currentValue, receiveData, hideResultsNow); } else { stopLoading(); select.hide(); } }; function trimWords(value) { if (!value) return [""]; if (!options.multiple) return [$.trim(value)]; return $.map(value.split(options.multipleSeparator), function(word) { return $.trim(value).length ? $.trim(word) : null; }); } function lastWord(value) { if (!options.multiple) return value; var words = trimWords(value); if (words.length == 1) return words[0]; var cursorAt = $(input).selection().start; if (cursorAt == value.length) { words = trimWords(value) } else { words = trimWords(value.replace(value.substring(cursorAt), "")); } return words[words.length - 1]; } function autoFill(q, sValue) { if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) { $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); $(input).selection(previousValue.length, previousValue.length + sValue.length); } }; function hideResults() { clearTimeout(timeout); timeout = setTimeout(hideResultsNow, 200); }; function hideResultsNow() { var wasVisible = select.visible(); select.hide(); clearTimeout(timeout); stopLoading(); if (options.mustMatch) { $input.search(function(result) { if (!result) { if (options.multiple) { var words = trimWords($input.val()).slice(0, -1); $input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "")); } else { $input.val(""); $input.trigger("result", null); } } }); } }; function receiveData(q, data) { if (data && data.length && hasFocus) { stopLoading(); select.display(data, q); autoFill(q, data[0].value); select.show(); } else { hideResultsNow(); } }; function request(term, success, failure) { if (!options.matchCase) term = term.toLowerCase(); var data = cache.load(term); if (data && data.length) { success(term, data); } else if ((typeof options.url == "string") && (options.url.length > 0)) { var extraParams = { timestamp: +new Date() }; $.each(options.extraParams, function(key, param) { extraParams[key] = typeof param == "function" ? param() : param; }); $.ajax({ mode: "abort", port: "autocomplete" + input.name, dataType: options.dataType, url: options.url, data: $.extend({ q: lastWord(term), limit: options.max }, extraParams), success: function(data) { var parsed = options.parse && options.parse(data) || parse(data); cache.add(term, parsed); success(term, parsed); } }); } else { select.emptyList(); failure(term); } }; function parse(data) { var parsed = []; var rows = data.split("\n"); for (var i = 0; i < rows.length; i++) { var row = $.trim(rows[i]); if (row) { row = row.split("|"); parsed[parsed.length] = { data: row, value: row[0], result: options.formatResult && options.formatResult(row, row[0]) || row[0] }; } } return parsed; }; function stopLoading() { $input.removeClass(options.loadingClass); }; }; $.Autocompleter.defaults = { inputClass: "ac_input", resultsClass: "ac_results", loadingClass: "ac_loading", minChars: 1, delay: 400, matchCase: false, matchSubset: true, matchContains: false, cacheLength: 10, max: 100, mustMatch: false, extraParams: {}, selectFirst: true, formatItem: function(row) { return row[0]; }, formatMatch: null, autoFill: false, width: 0, multiple: false, multipleSeparator: ", ", highlight: function(value, term) { return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); }, scroll: true, scrollHeight: 180 }; $.Autocompleter.Cache = function(options) {
        var data = {}; var length = 0; function matchSubset(s, sub) { if (!options.matchCase) s = s.toLowerCase(); var i = s.indexOf(sub); if (options.matchContains == "word") { i = s.toLowerCase().search("\\b" + sub.toLowerCase()); } if (i == -1) return false; return i == 0 || options.matchContains; }; function add(q, value) { if (length > options.cacheLength) { flush(); } if (!data[q]) { length++; } data[q] = value; } function populate() { if (!options.data) return false; var stMatchSets = {}, nullData = 0; if (!options.url) options.cacheLength = 1; stMatchSets[""] = []; for (var i = 0, ol = options.data.length; i < ol; i++) { var rawValue = options.data[i]; rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; var value = options.formatMatch(rawValue, i + 1, options.data.length); if (value === false) continue; var firstChar = value.charAt(0).toLowerCase(); if (!stMatchSets[firstChar]) stMatchSets[firstChar] = []; var row = { value: value, data: rawValue, result: options.formatResult && options.formatResult(rawValue) || value }; stMatchSets[firstChar].push(row); if (nullData++ < options.max) { stMatchSets[""].push(row); } }; $.each(stMatchSets, function(i, value) { options.cacheLength++; add(i, value); }); } setTimeout(populate, 25); function flush() { data = {}; length = 0; } return { flush: flush, add: add, populate: populate, load: function(q) {
            if (!options.cacheLength || !length) return null; if (!options.url && options.matchContains) { var csub = []; for (var k in data) { if (k.length > 0) { var c = data[k]; $.each(c, function(i, x) { if (matchSubset(x.value, q)) { csub.push(x); } }); } } return csub; } else
                if (data[q]) { return data[q]; } else
                if (options.matchSubset) { for (var i = q.length - 1; i >= options.minChars; i--) { var c = data[q.substr(0, i)]; if (c) { var csub = []; $.each(c, function(i, x) { if (matchSubset(x.value, q)) { csub[csub.length] = x; } }); return csub; } } } return null;
        }
        };
    }; $.Autocompleter.Select = function(options, input, select, config) { var CLASSES = { ACTIVE: "ac_over" }; var listItems, active = -1, data, term = "", needsInit = true, element, list; function init() { if (!needsInit) return; element = $("<div/>").hide().addClass(options.resultsClass).css("position", "absolute").appendTo(document.body); list = $("<ul/>").appendTo(element).mouseover(function(event) { if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); $(target(event)).addClass(CLASSES.ACTIVE); } }).click(function(event) { $(target(event)).addClass(CLASSES.ACTIVE); select(); input.focus(); return false; }).mousedown(function() { config.mouseDownOnSelect = true; }).mouseup(function() { config.mouseDownOnSelect = false; }); if (options.width > 0) element.css("width", options.width); needsInit = false; } function target(event) { var element = event.target; while (element && element.tagName != "LI") element = element.parentNode; if (!element) return []; return element; } function moveSelect(step) { listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); movePosition(step); var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); if (options.scroll) { var offset = 0; listItems.slice(0, active).each(function() { offset += this.offsetHeight; }); if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); } else if (offset < list.scrollTop()) { list.scrollTop(offset); } } }; function movePosition(step) { active += step; if (active < 0) { active = listItems.size() - 1; } else if (active >= listItems.size()) { active = 0; } } function limitNumberOfItems(available) { return options.max && options.max < available ? options.max : available; } function fillList() { list.empty(); var max = limitNumberOfItems(data.length); for (var i = 0; i < max; i++) { if (!data[i]) continue; var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term); if (formatted === false) continue; var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; $.data(li, "ac_data", data[i]); } listItems = list.find("li"); if (options.selectFirst) { listItems.slice(0, 1).addClass(CLASSES.ACTIVE); active = 0; } if ($.fn.bgiframe) list.bgiframe(); } return { display: function(d, q) { init(); data = d; term = q; fillList(); }, next: function() { moveSelect(1); }, prev: function() { moveSelect(-1); }, pageUp: function() { if (active != 0 && active - 8 < 0) { moveSelect(-active); } else { moveSelect(-8); } }, pageDown: function() { if (active != listItems.size() - 1 && active + 8 > listItems.size()) { moveSelect(listItems.size() - 1 - active); } else { moveSelect(8); } }, hide: function() { element && element.hide(); listItems && listItems.removeClass(CLASSES.ACTIVE); active = -1; }, visible: function() { return element && element.is(":visible"); }, current: function() { return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); }, show: function() { var offset = $(input).offset(); element.css({ width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), top: offset.top + input.offsetHeight, left: offset.left }).show(); if (options.scroll) { list.scrollTop(0); list.css({ maxHeight: options.scrollHeight, overflow: 'auto' }); if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") { var listHeight = 0; listItems.each(function() { listHeight += this.offsetHeight; }); var scrollbarsVisible = listHeight > options.scrollHeight; list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight); if (!scrollbarsVisible) { listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right"))); } } } }, selected: function() { var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); return selected && selected.length && $.data(selected[0], "ac_data"); }, emptyList: function() { list && list.empty(); }, unbind: function() { element && element.remove(); } }; }; $.fn.selection = function(start, end) { if (start !== undefined) { return this.each(function() { if (this.createTextRange) { var selRange = this.createTextRange(); if (end === undefined || start == end) { selRange.move("character", start); selRange.select(); } else { selRange.collapse(true); selRange.moveStart("character", start); selRange.moveEnd("character", end); selRange.select(); } } else if (this.setSelectionRange) { this.setSelectionRange(start, end); } else if (this.selectionStart) { this.selectionStart = start; this.selectionEnd = end; } }); } var field = this[0]; if (field.createTextRange) { var range = document.selection.createRange(), orig = field.value, teststring = "<->", textLength = range.text.length; range.text = teststring; var caretAt = field.value.indexOf(teststring); field.value = orig; this.selection(caretAt, caretAt + textLength); return { start: caretAt, end: caretAt + textLength} } else if (field.selectionStart !== undefined) { return { start: field.selectionStart, end: field.selectionEnd} } };
})(jQuery);

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) { $.fn.hoverIntent = function(f, g) { var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; cfg = $.extend(cfg, g ? { over: f, out: g} : f); var cX, cY, pX, pY; var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; var compare = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) { $(ob).unbind("mousemove", track); ob.hoverIntent_s = 1; return cfg.over.apply(ob, [ev]); } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } }; var delay = function(ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob, [ev]); }; var handleHover = function(e) { var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } } if (p == this) { return false; } var ev = jQuery.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } if (e.type == "mouseover") { pX = ev.pageX; pY = ev.pageY; $(ob).bind("mousemove", track); if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function() { compare(ev, ob); }, cfg.interval); } } else { $(ob).unbind("mousemove", track); if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function() { delay(ev, ob); }, cfg.timeout); } } }; return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);

/*

JQuery Curvy Corners by Mike Jolley
http://blue-anvil.com
http://code.google.com/p/jquerycurvycorners/
------------ 
Version 2.0.2 Beta 3
	                                                        
Original by: Terry Riegel, Cameron Cooke and Tim Hutchison
Website: http://www.curvycorners.net
	
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
	
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
	
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

function styleit() {
    for (var t = 0; t < document.styleSheets.length; t++) {
        var theRules = new Array(); theRules = document.styleSheets[t].rules
        for (var i = 0; i < theRules.length; i++) { var allR = theRules[i].style.CCborderRadius || 0; var tR = theRules[i].style.CCborderRadiusTR || allR; var tL = theRules[i].style.CCborderRadiusTL || allR; var bR = theRules[i].style.CCborderRadiusBR || allR; var bL = theRules[i].style.CCborderRadiusBL || allR; if (allR || tR || tR || bR || bL) { var s = theRules[i].selectorText; var settings = { tl: { radius: makeInt(tL) }, tr: { radius: makeInt(tR) }, bl: { radius: makeInt(bL) }, br: { radius: makeInt(bR) }, antiAlias: true, autoPad: true, validTags: ["div"] }; $(s).corner(settings); } } 
    } 
} function opera_contains_border_radius(sheetnumber) { return /border-((top|bottom)-(left|right)-)?radius/.test(document.styleSheets.item(sheetnumber).ownerNode.text); } function makeInt(num) { var re = new RegExp('([0-9]*)'); var i = 0; if (isNaN(num)) { var a = re.exec(num); if (!isNaN(parseInt(a[1]))) { i = a[1]; } } else { i = num; } return i; } (function($) {
    $(function() { if ($.browser.msie) { styleit(); } else if ($.browser.opera) { for (t = 0; t < document.styleSheets.length; ++t) { if (opera_contains_border_radius(t)) { var txt = document.styleSheets.item(t).ownerNode.text; txt = txt.replace(/\/\*(\n|\r|.)*?\*\//g, ''); var pat = new RegExp("^([\\w.#][\\w.#, ]+)[\\n\\s]*\\{([^}]+border-((top|bottom)-(left|right)-)?radius[^}]*)\\}", "mg"); var matches; while ((matches = pat.exec(txt)) !== null) { var pat2 = new RegExp("(..)border-((top|bottom)-(left|right)-)?radius:\\s*([\\d.]+)(in|em|px|ex|pt)", "g"); var submatches; while ((submatches = pat2.exec(matches[2])) !== null) { if (submatches[1] !== "z-") { var tL, tR, bL, bR, tLu, tRu, bLu, bRu; if (!submatches[3]) { tL = tR = bL = bR = parseInt(submatches[5]); } else { propname = submatches[3].charAt(0) + submatches[4].charAt(0); this[propname + 'R'] = parseInt(submatches[5]); } var settings = { tl: { radius: tL }, tr: { radius: tR }, bl: { radius: bL }, br: { radius: bR} }; $(matches[1]).corner(settings); } } } } } } }); $.fn.corner = function(options) {
        var settings = { tl: { radius: 8 }, tr: { radius: 8 }, bl: { radius: 8 }, br: { radius: 8 }, antiAlias: true, autoPad: true, validTags: ["div"] }; if (options && typeof (options) != 'string') $.extend(settings, options); return this.each(function() { if (!$(this).is('.hasCorners')) { applyCorners(this, settings); } }); function applyCorners(box, settings) {
            var $$ = $(box); this.topContainer = null; this.bottomContainer = null; this.shell = null; this.masterCorners = new Array(); this.contentDIV = null; this.x_bgi = $$.css("backgroundImage"); this.x_bgi = (x_bgi != "none" && x_bgi != "initial") ? x_bgi : ""; this.x_bgr = $$.css("backgroundRepeat"); this.x_bgposX = strip_px($$.css("backgroundPositionX")) ? strip_px($$.css("backgroundPositionX")) : 0; this.x_bgposY = strip_px($$.css("backgroundPositionY")) ? strip_px($$.css("backgroundPositionY")) : 0; this.x_bgc = format_colour($$.css("backgroundColor")); var x_height = $$.css("height"); if (typeof x_height == 'undefined') x_height = 'auto'; this.x_height = parseInt(((x_height != "" && x_height != "auto" && x_height.indexOf("%") == -1) ? x_height.substring(0, x_height.indexOf("px")) : box.offsetHeight)); if ($.browser.msie && $.browser.version == 6) { this.x_width = strip_px(box.offsetWidth); } else
            { this.x_width = strip_px($$.css('width')); } this.xp_height = strip_px($$.parent().css("height")) ? strip_px($$.css("height")) : 'auto'; this.x_bw = strip_px($$.css("borderTopWidth")) ? strip_px($$.css("borderTopWidth")) : 0; this.x_bbw = strip_px($$.css("borderBottomWidth")) ? strip_px($$.css("borderBottomWidth")) : 0; this.x_tbw = strip_px($$.css("borderTopWidth")) ? strip_px($$.css("borderTopWidth")) : 0; this.x_lbw = strip_px($$.css("borderLeftWidth")) ? strip_px($$.css("borderLeftWidth")) : 0; this.x_rbw = strip_px($$.css("borderRightWidth")) ? strip_px($$.css("borderRightWidth")) : 0; this.x_bc = format_colour($$.css("borderTopColor")); this.x_bbc = format_colour($$.css("borderBottomColor")); this.x_tbc = format_colour($$.css("borderTopColor")); this.x_lbc = format_colour($$.css("borderLeftColor")); this.x_rbc = format_colour($$.css("borderRightColor")); this.borderString = this.x_bw + "px" + " solid " + this.x_bc; this.borderStringB = this.x_bbw + "px" + " solid " + this.x_bbc; this.borderStringR = this.x_rbw + "px" + " solid " + this.x_bc; this.borderStringL = this.x_lbw + "px" + " solid " + this.x_bbc; this.x_pad = strip_px($$.css("paddingTop")); this.x_tpad = strip_px($$.css("paddingTop")); this.x_bpad = strip_px($$.css("paddingBottom")); this.x_lpad = strip_px($$.css("paddingLeft")); this.x_rpad = strip_px($$.css("paddingRight")); this.topPaddingP = strip_px($$.parent().css("paddingTop")); this.bottomPaddingP = strip_px($$.parent().css("paddingBottom")); this.x_tmargin = strip_px($$.css("marginTop")); this.x_bmargin = strip_px($$.css("marginBottom")); this.topMaxRadius = Math.max(settings.tl ? settings.tl.radius : 0, settings.tr ? settings.tr.radius : 0); this.botMaxRadius = Math.max(settings.bl ? settings.bl.radius : 0, settings.br ? settings.br.radius : 0); $$.addClass('hasCorners').css({ "padding": "0", "border": "none", "backgroundColor": "transparent", "backgroundImage": "none", 'overflow': "visible" }); if (box.style.position != "absolute") $$.css("position", "relative"); $$.attr("id", "ccoriginaldiv"); var newMainContainer = document.createElement("div"); $(newMainContainer).css({ "padding": "0", width: '100%' }).attr('id', 'ccshell'); this.shell = newMainContainer; for (var t = 0; t < 2; t++) { switch (t) { case 0: if (settings.tl || settings.tr) { var newMainContainer = document.createElement("div"); $(newMainContainer).css({ width: '100%', "font-size": "1px", overflow: "hidden", position: "absolute", height: topMaxRadius + "px", top: 0 - topMaxRadius + "px", "marginLeft": -parseInt(this.x_lbw + this.x_lpad) + "px", "marginRight": -parseInt(this.x_rbw + this.x_rpad) + "px" }).attr('id', 'cctopcontainer'); if ($.browser.msie && $.browser.version == 6) { $(newMainContainer).css({ "paddingLeft": Math.abs(parseInt(this.x_lbw + this.x_lpad)) + "px", "paddingRight": Math.abs(parseInt(this.x_rbw + this.x_rpad)) + "px" }); } this.topContainer = this.shell.appendChild(newMainContainer); } break; case 1: if (settings.bl || settings.br) { var newMainContainer = document.createElement("div"); $(newMainContainer).css({ width: '100%', "font-size": "1px", "overflow": "hidden", "position": "absolute", height: botMaxRadius + "px", bottom: 0 - botMaxRadius + "px", "marginLeft": -parseInt(this.x_lbw + this.x_lpad) + "px", "marginRight": -parseInt(this.x_rbw + this.x_rpad) + "px" }).attr('id', 'ccbottomcontainer'); if ($.browser.msie && $.browser.version == 6) { $(newMainContainer).css({ "paddingLeft": Math.abs(parseInt(this.x_lbw + this.x_lpad)) + "px", "paddingRight": Math.abs(parseInt(this.x_rbw + this.x_rpad)) + "px" }); } this.bottomContainer = this.shell.appendChild(newMainContainer); } break; } } var corners = ["tr", "tl", "br", "bl"]; for (var i in corners) {
                if (i > -1 < 4) {
                    var cc = corners[i]; if (cc == "tr" || cc == "tl") { var bwidth = this.x_bw; var bcolor = this.x_bc; } else { var bwidth = this.x_bbw; var bcolor = this.x_bbc; } var newCorner = document.createElement("div"); $(newCorner).css({ position: "absolute", "font-size": "1px", overflow: "hidden" }).height(settings[cc].radius + "px").width(settings[cc].radius + "px"); var borderRadius = parseInt(settings[cc].radius - bwidth); for (var intx = 0, j = settings[cc].radius; intx < j; intx++) {
                        if ((intx + 1) >= borderRadius) var y1 = -1; else
                            var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx + 1), 2))) - 1); if (borderRadius != j) {
                            if ((intx) >= borderRadius) var y2 = -1; else
                                var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow(intx, 2))); if ((intx + 1) >= j) var y3 = -1; else
                                var y3 = (Math.floor(Math.sqrt(Math.pow(j, 2) - Math.pow((intx + 1), 2))) - 1);
                        } if ((intx) >= j) var y4 = -1; else
                            var y4 = Math.ceil(Math.sqrt(Math.pow(j, 2) - Math.pow(intx, 2))); if (y1 > -1) drawPixel(intx, 0, this.x_bgc, 100, (y1 + 1), newCorner, -1, settings[cc].radius, 0, this.x_bgi, this.x_width, this.x_height, this.x_bw, this.x_bgr); if (borderRadius != j) {
                            for (var inty = (y1 + 1); inty < y2; inty++) {
                                if (settings.antiAlias) {
                                    if (this.x_bgi != "") {
                                        var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if (borderFract < 30) { drawPixel(intx, inty, bcolor, 100, 1, newCorner, 0, settings[cc].radius, 0, this.x_bgi, this.x_width, this.x_height, bwidth, this.x_bgr); } else
                                        { drawPixel(intx, inty, bcolor, 100, 1, newCorner, -1, settings[cc].radius, 0, this.x_bgi, this.x_width, this.x_height, bwidth, this.x_bgr); } 
                                    } else
                                    { var pixelcolour = BlendColour(this.x_bgc, bcolor, pixelFraction(intx, inty, borderRadius)); drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, settings[cc].radius, 0, this.x_bgi, this.x_width, this.x_height, bwidth, this.x_bgr); } 
                                } 
                            } if (settings.antiAlias) { if (y3 >= y2) { if (y2 == -1) y2 = 0; drawPixel(intx, y2, bcolor, 100, (y3 - y2 + 1), newCorner, 0, 0, 1, this.x_bgi, this.x_width, this.x_height, bwidth, this.x_bgr); } } else
                            { if (y3 >= y1) { drawPixel(intx, (y1 + 1), bcolor, 100, (y3 - y1), newCorner, 0, 0, 1, this.x_bgi, this.x_width, this.x_height, bwidth, this.x_bgr); } } var outsideColour = bcolor;
                        } else
                        { var outsideColour = this.x_bgc; var y3 = y1; } if (settings.antiAlias) { for (var inty = (y3 + 1); inty < y4; inty++) { drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty, j) * 100), 1, newCorner, ((bwidth > 0) ? 0 : -1), settings[cc].radius, 0, this.x_bgi, this.x_width, this.x_height, bwidth); } } 
                    } masterCorners[settings[cc].radius] = $(newCorner).clone(); for (var t = 0, k = newCorner.childNodes.length; t < k; t++) { var pixelBar = newCorner.childNodes[t]; var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px"))); var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px"))); var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px"))); if (cc == "tl" || cc == "bl") { pixelBar.style.left = settings[cc].radius - pixelBarLeft - 1 + "px"; } if (cc == "tr" || cc == "tl") { pixelBar.style.top = settings[cc].radius - pixelBarHeight - pixelBarTop + "px"; } pixelBar.style.backgroundRepeat = this.x_bgr; switch (cc) { case "tr": if ($.browser.msie && $.browser.version == 6) var offset = this.x_lpad + this.x_rpad + this.x_lbw + this.x_rbw; else var offset = 0; pixelBar.style.backgroundPosition = parseInt(this.x_bgposX - Math.abs(this.x_rbw - this.x_lbw + (this.x_width - settings[cc].radius + this.x_rbw) + pixelBarLeft) - settings.bl.radius - this.x_bw - settings.br.radius - this.x_bw) + offset + "px " + parseInt(this.x_bgposY - Math.abs(settings[cc].radius - pixelBarHeight - pixelBarTop - this.x_bw)) + "px"; break; case "tl": pixelBar.style.backgroundPosition = parseInt(this.x_bgposX - Math.abs((settings[cc].radius - pixelBarLeft - 1) - this.x_lbw)) + "px " + parseInt(this.x_bgposY - Math.abs(settings[cc].radius - pixelBarHeight - pixelBarTop - this.x_bw)) + "px"; break; case "bl": pixelBar.style.backgroundPosition = parseInt(this.x_bgposX - Math.abs((settings[cc].radius - pixelBarLeft - 1) - this.x_lbw)) + "px " + parseInt(this.x_bgposY - Math.abs((this.x_height + (this.x_bw + this.x_tpad + this.x_bpad) - settings[cc].radius + pixelBarTop))) + "px"; break; case "br": if ($.browser.msie && $.browser.version == 6) var offset = this.x_lpad + this.x_rpad + this.x_lbw + this.x_rbw; else var offset = 0; pixelBar.style.backgroundPosition = parseInt(this.x_bgposX - Math.abs(this.x_rbw - this.x_lbw + (this.x_width - settings[cc].radius + this.x_rbw) + pixelBarLeft) - settings.bl.radius - this.x_bw - settings.br.radius - this.x_bw) + offset + "px " + parseInt(this.x_bgposY - Math.abs((this.x_height + (this.x_bw + this.x_tpad + this.x_bpad) - settings[cc].radius + pixelBarTop))) + "px"; break; } } switch (cc) { case "tl": if (newCorner.style.position == "absolute") newCorner.style.top = "0px"; if (newCorner.style.position == "absolute") newCorner.style.left = "0px"; if (this.topContainer) temp = this.topContainer.appendChild(newCorner); $(temp).attr("id", "cctl"); break; case "tr": if (newCorner.style.position == "absolute") newCorner.style.top = "0px"; if (newCorner.style.position == "absolute") newCorner.style.right = "0px"; if (this.topContainer) temp = this.topContainer.appendChild(newCorner); $(temp).attr("id", "cctr"); break; case "bl": if (newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if (newCorner.style.position == "absolute") newCorner.style.left = "0px"; if (this.bottomContainer) temp = this.bottomContainer.appendChild(newCorner); $(temp).attr("id", "ccbl"); break; case "br": if (newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if (newCorner.style.position == "absolute") newCorner.style.right = "0px"; if (this.bottomContainer) temp = this.bottomContainer.appendChild(newCorner); $(temp).attr("id", "ccbr"); break; } 
                } 
            } var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(settings.tl.radius - settings.tr.radius); radiusDiff["b"] = Math.abs(settings.bl.radius - settings.br.radius); for (z in radiusDiff) { if (z == "t" || z == "b") { if (radiusDiff[z]) { var smallerCornerType = ((settings[z + "l"].radius < settings[z + "r"].radius) ? z + "l" : z + "r"); var newFiller = document.createElement("DIV"); newFiller.style.height = radiusDiff[z] + "px"; newFiller.style.width = settings[smallerCornerType].radius + "px"; newFiller.style.position = "absolute"; newFiller.style.fontSize = "1px"; newFiller.style.overflow = "hidden"; newFiller.style.backgroundColor = this.x_bgc; switch (smallerCornerType) { case "tl": newFiller.style.bottom = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; temp = this.topContainer.appendChild(newFiller); temp.id = "cctlfiller"; break; case "tr": newFiller.style.bottom = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; temp = this.topContainer.appendChild(newFiller); temp.id = "cctrfiller"; break; case "bl": newFiller.style.top = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderStringB; temp = this.bottomContainer.appendChild(newFiller); temp.id = "ccblfiller"; break; case "br": newFiller.style.top = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderStringB; temp = this.bottomContainer.appendChild(newFiller); temp.id = "ccbrfiller"; break; } } var newFillerBar = document.createElement("div"); newFillerBar.style.position = "relative"; newFillerBar.style.fontSize = "1px"; newFillerBar.style.overflow = "hidden"; newFillerBar.style.backgroundColor = this.x_bgc; newFillerBar.style.backgroundImage = this.x_bgi; newFillerBar.style.backgroundRepeat = this.x_bgr; switch (z) { case "t": if (this.topContainer) { if (settings.tl.radius && settings.tr.radius) { newFillerBar.style.height = 100 + topMaxRadius - this.x_tbw + "px"; newFillerBar.style.marginLeft = settings.tl.radius - this.x_lbw + this.x_rbw + "px"; newFillerBar.style.marginRight = settings.tr.radius - this.x_lbw + this.x_rbw + "px"; newFillerBar.style.borderTop = this.borderString; if (this.x_bgi != "") newFillerBar.style.backgroundPosition = parseInt(this.x_bgposX - (topMaxRadius - this.x_lbw)) + "px " + parseInt(this.x_bgposY) + "px"; if ($.browser.msie && $.browser.version == 6) { $(newFillerBar).css({ "marginLeft": -parseInt(this.x_lbw + this.x_lpad - settings.tl.radius) + "px", "marginRight": -parseInt(this.x_rbw + this.x_rpad - settings.tr.radius) + "px" }); if (this.x_bgi != "") newFillerBar.style.backgroundPosition = parseInt(this.x_bgposX + this.x_lbw - (topMaxRadius)) + "px " + parseInt(this.x_bgposY) + "px"; } temp = this.topContainer.appendChild(newFillerBar); $(temp).attr("id", "cctopmiddlefiller"); $(this.shell).css("backgroundPosition", parseInt(this.x_bgposX) + "px " + parseInt(this.x_bgposY - (topMaxRadius - this.x_lbw)) + "px"); } } break; case "b": if (this.bottomContainer) { if (settings.bl.radius && settings.br.radius) { newFillerBar.style.height = botMaxRadius - this.x_bbw + "px"; newFillerBar.style.marginLeft = settings.bl.radius - this.x_lbw + this.x_rbw + "px"; newFillerBar.style.marginRight = settings.br.radius - this.x_lbw + this.x_rbw + "px"; newFillerBar.style.borderBottom = this.borderStringB; if (this.x_bgi != "") newFillerBar.style.backgroundPosition = parseInt(this.x_bgposX - (botMaxRadius - this.x_lbw)) + "px " + parseInt(this.x_bgposY - (this.x_height + this.x_tpad + this.x_bbw + this.x_bpad - botMaxRadius)) + "px"; if ($.browser.msie && $.browser.version == 6) { $(newFillerBar).css({ "marginLeft": -parseInt(this.x_lbw + this.x_lpad - settings.bl.radius) + "px", "marginRight": -parseInt(this.x_rbw + this.x_rpad - settings.br.radius) + "px" }); if (this.x_bgi != "") newFillerBar.style.backgroundPosition = parseInt(this.x_bgposX - (botMaxRadius - this.x_lbw)) + "px " + parseInt(this.x_bgposY - (this.x_height + this.x_tpad + this.x_bbw + this.x_bpad - botMaxRadius)) + "px"; } temp = this.bottomContainer.appendChild(newFillerBar); $(temp).attr("id", "ccbottommiddlefiller"); } } break; } } } var contentContainer = document.createElement("div"); var pd = 0; contentContainer.className = "autoPadDiv"; var topPadding = Math.abs(this.x_bw + this.x_pad); var botPadding = Math.abs(this.x_bbw + this.x_bpad); if (topMaxRadius < this.boxPadding) { contentContainer.style.paddingTop = Math.abs(parseInt(pd + topPadding)) + "px"; } else
            { contentContainer.style.paddingTop = "0"; } if (botMaxRadius < this.x_pad) { contentContainer.style.paddingBottom = Math.abs(parseInt(botPadding - botMaxRadius)) + "px"; } else
            { contentContainer.style.paddingBottom = "0"; } $(contentContainer).css({ "marginLeft": -parseInt(this.x_lbw + this.x_lpad) + "px", "marginRight": -parseInt(this.x_rbw + this.x_rpad) + "px", "marginTop": "-" + Math.abs(parseInt(this.x_tbw + (this.x_tpad - topMaxRadius))) + "px", "marginBottom": "-" + Math.abs(parseInt(this.x_bbw + (this.x_bpad - botMaxRadius))) + "px", "border-left": this.borderStringL, "border-right": this.borderStringR, "border-top": this.borderString, "border-bottom": this.borderStringB, "borderTopWidth": "0", "borderBottomWidth": "0", "height": "100%", "width": "100%", "paddingLeft": Math.abs(parseInt(this.x_lpad)) + "px", "paddingRight": Math.abs(parseInt(this.x_rpad)) + "px", "paddingTop": Math.abs(parseInt(this.x_tbw + (this.x_tpad - topMaxRadius))) + "px", "paddingBottom": Math.abs(parseInt(this.x_bbw + (this.x_bpad - botMaxRadius))) + "px" }); $$.css({ "paddingLeft": Math.abs(parseInt(this.x_lbw + this.x_lpad)) + "px", "paddingRight": Math.abs(parseInt(this.x_rbw + this.x_rpad)) + "px", "paddingTop": Math.abs(parseInt(this.x_tbw + (this.x_tpad - topMaxRadius))) + "px", "paddingBottom": Math.abs(parseInt(this.x_bbw + (this.x_bpad - botMaxRadius))) + "px", "backgroundColor": this.x_bgc, "backgroundImage": this.x_bgi, "backgroundPosition": this.x_bw + 'px -' + Math.abs(parseInt(topMaxRadius - this.x_bw)) + "px", 'margin-top': 0, 'margin-bottom': 0 }); if ($$.html() == "") $$.html('&nbsp;'); $$.wrapInner(contentContainer); $$.prepend(this.shell); var wrapper = document.createElement("div"); $(wrapper).css({ 'margin-top': parseInt(this.x_tmargin) + "px", 'margin-bottom': parseInt(this.x_bmargin) + "px", 'padding-top': topMaxRadius + "px", 'padding-bottom': botMaxRadius + "px", 'overflow': 'hidden' }).addClass('ccwrapper'); $$.wrap(wrapper); $$.after('<div class="clear" style="height:0;line-height:0px;">&nbsp;</div>');
        } function drawPixel(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius, isBorder, bgImage, x_width, x_height, x_bw, repeat) {
            var pixel = document.createElement("div"); $(pixel).css({ "height": height, "width": "1px", "position": "absolute", "font-size": "1px", "overflow": "hidden", "top": inty + "px", "left": intx + "px", "background-color": colour }); var topMaxRadius = Math.max(settings.tl ? settings.tl.radius : 0, settings.tr ? settings.tr.radius : 0); if (image == -1 && bgImage != "") { $(pixel).css({ "background-position": "-" + Math.abs(x_width - (cornerRadius - intx) + x_bw) + "px -" + Math.abs((x_height + topMaxRadius + inty) - x_bw) + "px", "background-image": bgImage, "background-repeat": repeat }); } else
            { if (!isBorder) $(pixel).addClass('hasBackgroundColor'); } if (transAmount != 100) $(pixel).css({ opacity: (transAmount / 100) }); newCorner.appendChild(pixel);
        }; function BlendColour(Col1, Col2, Col1Fraction) { var red1 = parseInt(Col1.substr(1, 2), 16); var green1 = parseInt(Col1.substr(3, 2), 16); var blue1 = parseInt(Col1.substr(5, 2), 16); var red2 = parseInt(Col2.substr(1, 2), 16); var green2 = parseInt(Col2.substr(3, 2), 16); var blue2 = parseInt(Col2.substr(5, 2), 16); if (Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if (endRed > 255) endRed = 255; if (endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if (endGreen > 255) endGreen = 255; if (endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if (endBlue > 255) endBlue = 255; if (endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed) + IntToHex(endGreen) + IntToHex(endBlue); } function IntToHex(strNum) { rem = strNum % 16; base = Math.floor(strNum / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS; } function MakeHex(x) {
            if ((x >= 0) && (x <= 9)) { return x; } else
            { switch (x) { case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F"; } } 
        } function pixelFraction(x, y, r) { var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(x, 2))); if ((intersect >= y) && (intersect < (y + 1))) { whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1; } var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(y + 1, 2))); if ((intersect >= x) && (intersect < (x + 1))) { whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1; } var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(x + 1, 2))); if ((intersect >= y) && (intersect < (y + 1))) { whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1; } var intersect = Math.sqrt((Math.pow(r, 2) - Math.pow(y, 2))); if ((intersect >= x) && (intersect < (x + 1))) { whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0; } switch (whatsides) { case "LeftRight": pixelfraction = Math.min(yvalues[0], yvalues[1]) + ((Math.max(yvalues[0], yvalues[1]) - Math.min(yvalues[0], yvalues[1])) / 2); break; case "TopRight": pixelfraction = 1 - (((1 - xvalues[0]) * (1 - yvalues[1])) / 2); break; case "TopBottom": pixelfraction = Math.min(xvalues[0], xvalues[1]) + ((Math.max(xvalues[0], xvalues[1]) - Math.min(xvalues[0], xvalues[1])) / 2); break; case "LeftBottom": pixelfraction = (yvalues[0] * xvalues[1]) / 2; break; default: pixelfraction = 1; } return pixelfraction; } function rgb2Hex(rgbColour) { try { var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue); } catch (e) { alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex"); } return hexColour; } function rgb2Array(rgbColour) { var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray; } function format_colour(colour) {
            var returnColour = "#ffffff"; if (colour != "" && colour != "transparent") {
                if (colour.substr(0, 3) == "rgb" && colour.substr(0, 4) != "rgba") { returnColour = rgb2Hex(colour); } else if (colour.length == 4) { returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4); } else
                { returnColour = colour; } 
            } return returnColour;
        } function strip_px(value) { if (typeof (value) != 'string') return value; return parseInt(((value != "auto" && value.indexOf("%") == -1 && value != "" && value.indexOf("px") !== -1) ? Math.round(value.slice(0, value.indexOf("px"))) : 0)) } 
    };
})(jQuery);
