");
$("#TB_overlay").click(tb_remove);
}
}
if(caption===null){caption="";}
$("body").append("

");//add loader to the page
$('#TB_load').show();//show loader
var baseURL;
if(url.indexOf("?")!==-1){ //ff there is a query string involved
baseURL = url.substr(0, url.indexOf("?"));
}else{
baseURL = url;
}
var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.bmp/g;
var urlType = baseURL.toLowerCase().match(urlString);
if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
TB_PrevCaption = "";
TB_PrevURL = "";
TB_PrevHTML = "";
TB_NextCaption = "";
TB_NextURL = "";
TB_NextHTML = "";
TB_imageCount = "";
TB_FoundURL = false;
if(imageGroup){
TB_TempArray = $("a[@rel="+imageGroup+"]").get();
for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
if (!(TB_TempArray[TB_Counter].href == url)) {
if (TB_FoundURL) {
TB_NextCaption = TB_TempArray[TB_Counter].title;
TB_NextURL = TB_TempArray[TB_Counter].href;
TB_NextHTML = "
Next >";
} else {
TB_PrevCaption = TB_TempArray[TB_Counter].title;
TB_PrevURL = TB_TempArray[TB_Counter].href;
TB_PrevHTML = "
< Prev";
}
} else {
TB_FoundURL = true;
TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
}
}
}
imgPreloader = new Image();
imgPreloader.onload = function(){
imgPreloader.onload = null;
// Resizing large images - orginal by Christian Montoya edited by me.
var pagesize = tb_getPageSize();
var x = pagesize[0] - 150;
var y = pagesize[1] - 150;
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
}
} else if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
}
}
// End Resizing
TB_WIDTH = imageWidth + 30;
TB_HEIGHT = imageHeight + 60;
$("#TB_window").append("

" + "
"+caption+"
" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
");
$("#TB_closeWindowButton").click(tb_remove);
if (!(TB_PrevHTML === "")) {
function goPrev(){
if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
$("#TB_window").remove();
$("body").append("
");
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
return false;
}
$("#TB_prev").click(goPrev);
}
if (!(TB_NextHTML === "")) {
function goNext(){
$("#TB_window").remove();
$("body").append("
");
tb_show(TB_NextCaption, TB_NextURL, imageGroup);
return false;
}
$("#TB_next").click(goNext);
}
document.onkeydown = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
} else if(keycode == 190){ // display previous image
if(!(TB_NextHTML == "")){
document.onkeydown = "";
goNext();
}
} else if(keycode == 188){ // display next image
if(!(TB_PrevHTML == "")){
document.onkeydown = "";
goPrev();
}
}
};
tb_position();
$("#TB_load").remove();
$("#TB_ImageOff").click(tb_remove);
$("#TB_window").css({display:"block"}); //for safari using css instead of show
};
imgPreloader.src = url;
}else{//code to show html pages
var queryString = url.replace(/^[^\?]+\??/,'');
var params = tb_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = TB_HEIGHT - 45;
if(url.indexOf('TB_iframe') != -1){
urlNoQuery = url.split('TB_');
$("#TB_window").append("
");
}else{
if($("#TB_window").css("display") != "block"){
if(params['modal'] != "true"){
$("#TB_window").append("
");
}else{
$("#TB_overlay").unbind();
$("#TB_window").append("
");
}
}else{
$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
$("#TB_ajaxContent")[0].scrollTop = 0;
$("#TB_ajaxWindowTitle").html(caption);
}
}
$("#TB_closeWindowButton").click(tb_remove);
if(url.indexOf('TB_inline') != -1){
$("#TB_ajaxContent").html($('#' + params['inlineId']).html());
tb_position();
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}else if(url.indexOf('TB_iframe') != -1){
tb_position();
if(frames['TB_iframeContent'] === undefined){//be nice to safari
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){tb_remove();}});
}
}else{
$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
tb_position();
$("#TB_load").remove();
tb_init("#TB_ajaxContent a.thickbox");
$("#TB_window").css({display:"block"});
});
}
}
if(!params['modal']){
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
}
};
}
} catch(e) {
//nothing here
}
}
//helper functions below
function tb_showIframe(){
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}
function tb_remove() {
$("#TB_imageOff").unbind("click");
$("#TB_overlay").unbind("click");
$("#TB_closeWindowButton").unbind("click");
$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
$("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
$("body","html").css({height: "auto", width: "auto"});
$("html").css("overflow","");
}
document.onkeydown = "";
return false;
}
/*
function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
if ( !(jQuery.browser.msie && typeof XMLHttpRequest == 'function')) { // take away IE6
$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}
}
*/
/* fix for IE6 */
function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
var version = jQuery.browser.version;
if (version instanceof Object) version=version.number();
if ( !(jQuery.browser.msie && version < 7)) { // take away IE6
$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}
}
function tb_parseQuery ( query ) {
var Params = {};
if ( ! query ) {return Params;}// return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function tb_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
arrayPageSize = [w,h];
return arrayPageSize;
}
/*
* Thickbox 2.1 - jQuery plugin for displaying content in a box above the page
*
* Copyright (c) 2006, 2007 Cody Lindley (http://www.codylindley.com)
*
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
/*
TB_special is a function to enable calling thickbox from a flash object
if using imageswap.swf & swfobject:
//$imageSet has no effect with flash
$imFlashVars [] = $displayImageURL."|".
"javascript:TB_special('".$popupImageURL."','".$imageCaption."','".$imageSet."')"."|".
$imageCaption);
$flashVars = "&im=".implode("__",$imFlashVars);
//then with SWFObject:
//so.addVariable("flashVars", "= $flashVars ?>");
*/
function TB_special(pi_href,imgcap,imgrel){
// get caption: either title or name attribute
var caption = imgcap || this.title || this.name || "";
// get rel attribute for image groups
var group = imgrel || this.rel || false;
// display the box for the elements href
TB_show(caption, pi_href, group);
}
// on page load call TB_init
$(document).ready(TB_init);
// add thickbox to href elements that have a class of .thickbox
function TB_init(){
$("a.thickbox").click(function(event){
// stop default behaviour
event.preventDefault();
// remove click border
this.blur();
// get caption: either title or name attribute
var caption = this.title || this.name || "";
// get rel attribute for image groups
var group = this.rel || false;
// display the box for the elements href
TB_show(caption, this.href, group);
});
}
// called when the user clicks on a thickbox link
function TB_show(caption, url, rel) {
// create iframe, overlay and box if non-existent
if ( !$("#TB_HideSelect").length ) {
$("body").append("
");
$("#TB_overlay").click(TB_remove);
}
// TODO replace or check if event is already assigned
$(window).scroll(TB_position);
// TODO replace
TB_overlaySize();
// TODO create loader only once, hide and show on demand
$("body").append("
");
TB_load_position();
// check if a query string is involved
var baseURL = url.match(/(.+)?/)[1] || url;
// regex to check if a href refers to an image
var imageURL = /\.(jpe?g|png|gif|bmp)/gi;
// check for images
if ( baseURL.match(imageURL) ) {
var dummy = { caption: "", url: "", html: "" };
var prev = dummy,
next = dummy,
imageCount = "";
// if an image group is given
if ( rel ) {
function getInfo(image, id, label) {
return {
caption: image.title,
url: image.href,
html: "
" + label + ""
}
}
// find the anchors that point to the group
var imageGroup = $("a[@rel="+rel+"]").get();
var foundSelf = false;
// loop through the anchors, looking for ourself, saving information about previous and next image
for (var i = 0; i < imageGroup.length; i++) {
var image = imageGroup[i];
var urlTypeTemp = image.href.match(imageURL);
// look for ourself
if ( image.href == url ) {
foundSelf = true;
imageCount = "Image " + (i + 1) + " of "+ (imageGroup.length);
} else {
// when we found ourself, the current is the next image
if ( foundSelf ) {
next = getInfo(image, "next", "Next >");
// stop searching
break;
} else {
// didn't find ourself yet, so this may be the one before ourself
prev = getInfo(image, "prev", "< Prev");
}
}
}
}
imgPreloader = new Image();
imgPreloader.onload = function() {
imgPreloader.onload = null;
// Resizing large images
var pagesize = TB_getPageSize();
var x = pagesize[0] - 150;
var y = pagesize[1] - 150;
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
}
} else if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
}
}
// End Resizing
// TODO don't use globals
TB_WIDTH = imageWidth;
TB_HEIGHT = imageHeight + 60;
// TODO empty window content instead
$("#TB_window").append("

" + "
"+caption+"
" + imageCount + prev.html + next.html + "
");
$("#TB_closeWindowButton").click(TB_remove);
function buildClickHandler(image) {
return function() {
$("#TB_window").remove();
$("body").append("
");
TB_show(image.caption, image.url, rel);
return false;
};
}
var goPrev = buildClickHandler(prev);
var goNext = buildClickHandler(next);
if ( prev.html ) {
$("#TB_prev").click(goPrev);
}
if ( next.html ) {
$("#TB_next").click(goNext);
}
// TODO use jQuery, maybe with event fix plugin, or just get the necessary parts of it
document.onkeydown = function(e) {
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
switch(keycode) {
case 27:
TB_remove();
break;
case 190:
if( next.html ) {
document.onkeydown = null;
goNext();
}
break;
case 188:
if( prev.html ) {
document.onkeydown = null;
goPrev();
}
break;
}
}
// TODO don't remove loader etc., just hide and show later
TB_position();
$("#TB_load").remove();
$("#TB_ImageOff").click(TB_remove);
// for safari using css instead of show
// TODO is that necessary? can't test safari
$("#TB_window").css({display:"block"});
}
imgPreloader.src = url;
} else { //code to show html pages
var queryString = url.match(/\?(.+)/)[1];
var params = TB_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30;
TB_HEIGHT = (params['height']*1) + 40;
var ajaxContentW = TB_WIDTH - 30,
ajaxContentH = TB_HEIGHT - 45;
if(url.indexOf('TB_iframe') != -1){
urlNoQuery = url.split('TB_');
$("#TB_window").append("
");
} else {
$("#TB_window").append("
");
}
$("#TB_closeWindowButton").click(TB_remove);
if(url.indexOf('TB_inline') != -1){
$("#TB_ajaxContent").html($('#' + params['inlineId']).html());
TB_position();
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}else if(url.indexOf('TB_iframe') != -1){
TB_position();
if(frames['TB_iframeContent'] == undefined){//be nice to safari
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
}
}else{
$("#TB_ajaxContent").load(url, function(){
TB_position();
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
});
}
}
$(window).resize(TB_position);
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
TB_remove();
}
}
}
//helper functions below
function TB_showIframe(){
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}
function TB_remove() {
$("#TB_imageOff").unbind("click");
$("#TB_overlay").unbind("click");
$("#TB_closeWindowButton").unbind("click");
$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
$("#TB_load").remove();
return false;
}
function TB_position() {
var pagesize = TB_getPageSize();
var arrayPageScroll = TB_getPageScrollTop();
var style = {width: TB_WIDTH, left: (arrayPageScroll[0] + (pagesize[0] - TB_WIDTH)/2), top: (arrayPageScroll[1] + (pagesize[1]-TB_HEIGHT)/2)};
$("#TB_window").css(style);
}
function TB_overlaySize(){
if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {
yScroll = window.innerHeight + window.scrollMaxY;
xScroll = window.innerWidth + window.scrollMaxX;
var deff = document.documentElement;
var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
xScroll -= (window.innerWidth - wff);
yScroll -= (window.innerHeight - hff);
} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
yScroll = document.body.scrollHeight;
xScroll = document.body.scrollWidth;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
yScroll = document.body.offsetHeight;
xScroll = document.body.offsetWidth;
}
$("#TB_overlay").css({"height": yScroll, "width": xScroll});
$("#TB_HideSelect").css({"height": yScroll,"width": xScroll});
}
function TB_load_position() {
var pagesize = TB_getPageSize();
var arrayPageScroll = TB_getPageScrollTop();
$("#TB_load")
.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2), top: (arrayPageScroll[1] + ((pagesize[1]-100)/2)) })
.css({display:"block"});
}
function TB_parseQuery ( query ) {
// return empty object
if( !query )
return {};
var params = {};
// parse query
var pairs = query.split(/[;&]/);
for ( var i = 0; i < pairs.length; i++ ) {
var pair = pairs[i].split('=');
if ( !pair || pair.length != 2 )
continue;
// unescape both key and value, replace "+" with spaces in value
params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
}
return params;
}
function TB_getPageScrollTop(){
var yScrolltop;
var xScrollleft;
if (self.pageYOffset || self.pageXOffset) {
yScrolltop = self.pageYOffset;
xScrollleft = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){ // Explorer 6 Strict
yScrolltop = document.documentElement.scrollTop;
xScrollleft = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScrolltop = document.body.scrollTop;
xScrollleft = document.body.scrollLeft;
}
arrayPageScroll = new Array(xScrollleft,yScrolltop)
return arrayPageScroll;
}
function TB_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
arrayPageSize = new Array(w,h)
return arrayPageSize;
}
// JavaScript Document
//alert('???');
$(document).ready(function () {
// all elements with class imageSwapper and src attribute
var JSONdefaults = new Object({
"defaultSwapper": '/imageSwapper/imageSwapper.swf',
"homepage": "/imageSwapper/homepageSwapper.swf",
"bgcolor": "#000000",
"flashVersion":"9",
"callBack": ""
});
// php generated overrides
var JSONParameters={"defaultSwapper":"\/imageSwapper\/homepageSwapper.swf","text":"\/imageSwapper\/imageSwapper_text.swf","textFilter":"\/imageSwapper\/imageSwapper_text.swf","subtablechoice":"\/imageSwapper\/imageSwapper_record.swf"};
var params = getParams( 'imageSwapper', JSONdefaults, JSONParameters );
$('.imageSwapper').each(function () {
if ($(this).attr('title').length > 1) {
var swapURL = params.defaultSwapper;
if ( $('#container').attr('class').length > 0 ) {
//alert( $('#container').attr('class') );
var classArray = $('#container').attr('class').split(" ");
for (var i=0;i
encoded, because safari won't deal with accessing noscript content (boo hiss)
// add it into the dom so that we get width and height of images
// this codes finds the comment in page media, and deencodes it.
var rexComment=new RegExp("<"+"!"+"--"+"([\\s\\S]+?)"+"--"+">");
var noscriptHTML = rexComment.exec($(this).html())[1].replace(/</g,'<').replace(/>/g,'>');
if ($.flashPlayerVersion[0] >= parseInt(params.flashVersion) && $.hasFlashPlayer==true) {
// now get the width and height
// the following would be brilliant but will break in IE
// var $noscriptObject = $( ''+mymatch[1].replace(/</g,'<').replace(/>/g,'>')+'
' );
// so I am going to use regexps again
var rexW=new RegExp(/width="([0-9]+)"/g);
var rexH=new RegExp(/height="([0-9]+)"/g);
//amazingly you can't do this in one because exec only returns one result.
// match returns multiple results, but then won't give you the numbers as a separate bit
$(this).flash({ // test_flashvars.swf is the flash document
swf: swapURL,
height: rexH.exec(noscriptHTML)[1],
width: rexW.exec(noscriptHTML)[1],
bgcolor: params.bgcolor,
params: {
allowscriptaccess: 'always',
menu: 'false',
wmode: 'transparent',
quality: 'high',
scale: 'noscale',
flashvars: { xmlURL: $(this).attr('title'), scaleToStage: 'no' }
}
});
$(this).removeAttr('title');
} else {
// no flash - put the noscript object back in place of the noscript tag
$(this).html( noscriptHTML );
}
}
});
});
var $calendarBox;
function removeCalendarPreview () {
// fadeOut
$('.calendarPreview',$calendarBox).fadeOut(100,function () {
$(this).remove();
});
}
function getCalendarPreview ( calendarURL ) {
// remove any calendar previews that we have already
$('.calendarPreview',$calendarBox).remove();
// then make a new one
//alert(calendarURL);
$.get(calendarURL, {}, function(data) {
var realData = $(".widgetInner",data).html();
if (realData.length > 1) {
var $calPreview = $('');
$calPreview.html(realData);
$calendarBox.append( $calPreview );
$calPreview.fadeIn(200);
}
});
}
function getCalendar ( calendarURL ) {
var params = getParams('calendarPreview');
var callBackFunction = eval(params.callBack);
var $calendarHolder = $('.calendarHolder',$calendarBox);
$calendarHolder.fadeOut(100,function () {
$.get(calendarURL, {}, function(data) {
// just get the calendarHolder
$calendarHolder.replaceWith( $(data).find('.calendarHolder') );
activateCalNav();
$calendarBox.fadeIn(200);
// REPLACE WITH CALLBACK CODE
if (callBackFunction) { callBackFunction(); }
});
});
}
function activateCalNav () {
// show navs
var params = getParams('calendarPreview');
$(".calPrev,.calNext",$calendarBox).each(function () {
var linkParts = $('a',this).attr('href');
var linkArray = linkParts.split('?');
var linkParams = linkArray[linkArray.length-1];
var calendarURL = '/widgets/calendar?'+linkParams;
$('a',this).attr("href","javascript:getCalendar('"+calendarURL+"')");
});
$("table.calendar td a",$calendarBox).each(function () {
//alert($(this).attr('href'));
var linkParts = $(this).attr('href');
var linkArray = linkParts.split('?');
var linkParams = linkArray[ linkArray.length-1 ];
var calendarURL = '/widgets/calendar?'+linkParams.replace('startFrom','startFromCalendarPreview');
//alert(calendarURL);
$(this).click(function () { return false; });
$(this).hoverIntent( function () { getCalendarPreview(calendarURL); }, function () { });
$(params.hoverOutTrigger).hoverIntent( function () { removeCalendarPreview(); }, function() {});
});
}
$(document).ready(function () {
var JSONdefaults = new Object({"calendarBox": ".widget.calendar",
"hoverOutTrigger": ".col1,.col2,.col3",
"callBack": ""
});
// php generated overrides
var JSONParameters=[];
var params = getParams( 'calendarPreview', JSONdefaults, JSONParameters );
//var param=getParams( 'adjustCssForRes');
$calendarBox = $(params.calendarBox);
getCalendar();
});
/*!
* Copyright (c) 2009 Simo Kinnunen.
* Licensed under the MIT license.
*
* @version ${Version}
*/
var Cufon = (function() {
var api = function() {
return api.replace.apply(null, arguments);
};
var DOM = api.DOM = {
ready: (function() {
var complete = false, readyStatus = { loaded: 1, complete: 1 };
var queue = [], perform = function() {
if (complete) return;
complete = true;
for (var fn; fn = queue.shift(); fn());
};
// Gecko, Opera, WebKit r26101+
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', perform, false);
window.addEventListener('pageshow', perform, false); // For cached Gecko pages
}
// Old WebKit, Internet Explorer
if (!window.opera && document.readyState) (function() {
readyStatus[document.readyState] ? perform() : setTimeout(arguments.callee, 10);
})();
// Internet Explorer
if (document.readyState && document.createStyleSheet) (function() {
try {
document.body.doScroll('left');
perform();
}
catch (e) {
setTimeout(arguments.callee, 1);
}
})();
addEvent(window, 'load', perform); // Fallback
return function(listener) {
if (!arguments.length) perform();
else complete ? listener() : queue.push(listener);
};
})(),
root: function() {
return document.documentElement || document.body;
}
};
var CSS = api.CSS = {
Size: function(value, base) {
this.value = parseFloat(value);
this.unit = String(value).match(/[a-z%]*$/)[0] || 'px';
this.convert = function(value) {
return value / base * this.value;
};
this.convertFrom = function(value) {
return value / this.value * base;
};
this.toString = function() {
return this.value + this.unit;
};
},
addClass: function(el, className) {
var current = el.className;
el.className = current + (current && ' ') + className;
return el;
},
color: cached(function(value) {
var parsed = {};
parsed.color = value.replace(/^rgba\((.*?),\s*([\d.]+)\)/, function($0, $1, $2) {
parsed.opacity = parseFloat($2);
return 'rgb(' + $1 + ')';
});
return parsed;
}),
// has no direct CSS equivalent.
// @see http://msdn.microsoft.com/en-us/library/system.windows.fontstretches.aspx
fontStretch: cached(function(value) {
if (typeof value == 'number') return value;
if (/%$/.test(value)) return parseFloat(value) / 100;
return {
'ultra-condensed': 0.5,
'extra-condensed': 0.625,
condensed: 0.75,
'semi-condensed': 0.875,
'semi-expanded': 1.125,
expanded: 1.25,
'extra-expanded': 1.5,
'ultra-expanded': 2
}[value] || 1;
}),
getStyle: function(el) {
var view = document.defaultView;
if (view && view.getComputedStyle) return new Style(view.getComputedStyle(el, null));
if (el.currentStyle) return new Style(el.currentStyle);
return new Style(el.style);
},
gradient: cached(function(value) {
var gradient = {
id: value,
type: value.match(/^-([a-z]+)-gradient\(/)[1],
stops: []
}, colors = value.substr(value.indexOf('(')).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);
for (var i = 0, l = colors.length, stop; i < l; ++i) {
stop = colors[i].split('=', 2).reverse();
gradient.stops.push([ stop[1] || i / (l - 1), stop[0] ]);
}
return gradient;
}),
quotedList: cached(function(value) {
// doesn't work properly with empty quoted strings (""), but
// it's not worth the extra code.
var list = [], re = /\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g, match;
while (match = re.exec(value)) list.push(match[3] || match[1]);
return list;
}),
recognizesMedia: cached(function(media) {
var el = document.createElement('style'), sheet, container, supported;
el.type = 'text/css';
el.media = media;
try { // this is cached anyway
el.appendChild(document.createTextNode('/**/'));
} catch (e) {}
container = elementsByTagName('head')[0];
container.insertBefore(el, container.firstChild);
sheet = (el.sheet || el.styleSheet);
supported = sheet && !sheet.disabled;
container.removeChild(el);
return supported;
}),
removeClass: function(el, className) {
var re = RegExp('(?:^|\\s+)' + className + '(?=\\s|$)', 'g');
el.className = el.className.replace(re, '');
return el;
},
supports: function(property, value) {
var checker = document.createElement('span').style;
if (checker[property] === undefined) return false;
checker[property] = value;
return checker[property] === value;
},
textAlign: function(word, style, position, wordCount) {
if (style.get('textAlign') == 'right') {
if (position > 0) word = ' ' + word;
}
else if (position < wordCount - 1) word += ' ';
return word;
},
textShadow: cached(function(value) {
if (value == 'none') return null;
var shadows = [], currentShadow = {}, result, offCount = 0;
var re = /(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;
while (result = re.exec(value)) {
if (result[0] == ',') {
shadows.push(currentShadow);
currentShadow = {};
offCount = 0;
}
else if (result[1]) {
currentShadow.color = result[1];
}
else {
currentShadow[[ 'offX', 'offY', 'blur' ][offCount++]] = result[2];
}
}
shadows.push(currentShadow);
return shadows;
}),
textTransform: (function() {
var map = {
uppercase: function(s) {
return s.toUpperCase();
},
lowercase: function(s) {
return s.toLowerCase();
},
capitalize: function(s) {
return s.replace(/\b./g, function($0) {
return $0.toUpperCase();
});
}
};
return function(text, style) {
var transform = map[style.get('textTransform')];
return transform ? transform(text) : text;
};
})(),
whiteSpace: (function() {
var ignore = {
inline: 1,
'inline-block': 1,
'run-in': 1
};
var wsStart = /^\s+/, wsEnd = /\s+$/;
return function(text, style, node, previousElement) {
if (previousElement) {
if (previousElement.nodeName.toLowerCase() == 'br') {
text = text.replace(wsStart, '');
}
}
if (ignore[style.get('display')]) return text;
if (!node.previousSibling) text = text.replace(wsStart, '');
if (!node.nextSibling) text = text.replace(wsEnd, '');
return text;
};
})()
};
CSS.ready = (function() {
// don't do anything in Safari 2 (it doesn't recognize any media type)
var complete = !CSS.recognizesMedia('all'), hasLayout = false;
var queue = [], perform = function() {
complete = true;
for (var fn; fn = queue.shift(); fn());
};
var links = elementsByTagName('link'), styles = elementsByTagName('style');
function isContainerReady(el) {
return el.disabled || isSheetReady(el.sheet, el.media || 'screen');
}
function isSheetReady(sheet, media) {
// in Opera sheet.disabled is true when it's still loading,
// even though link.disabled is false. they stay in sync if
// set manually.
if (!CSS.recognizesMedia(media || 'all')) return true;
if (!sheet || sheet.disabled) return false;
try {
var rules = sheet.cssRules, rule;
if (rules) {
// needed for Safari 3 and Chrome 1.0.
// in standards-conforming browsers cssRules contains @-rules.
// Chrome 1.0 weirdness: rules[]
// returns the last rule, so a for loop is the only option.
search: for (var i = 0, l = rules.length; rule = rules[i], i < l; ++i) {
switch (rule.type) {
case 2: // @charset
break;
case 3: // @import
if (!isSheetReady(rule.styleSheet, rule.media.mediaText)) return false;
break;
default:
// only @charset can precede @import
break search;
}
}
}
}
catch (e) {} // probably a style sheet from another domain
return true;
}
function allStylesLoaded() {
// Internet Explorer's style sheet model, there's no need to do anything
if (document.createStyleSheet) return true;
// standards-compliant browsers
var el, i;
for (i = 0; el = links[i]; ++i) {
if (el.rel.toLowerCase() == 'stylesheet' && !isContainerReady(el)) return false;
}
for (i = 0; el = styles[i]; ++i) {
if (!isContainerReady(el)) return false;
}
return true;
}
DOM.ready(function() {
// getComputedStyle returns null in Gecko if used in an iframe with display: none
if (!hasLayout) hasLayout = CSS.getStyle(document.body).isUsable();
if (complete || (hasLayout && allStylesLoaded())) perform();
else setTimeout(arguments.callee, 10);
});
return function(listener) {
if (complete) listener();
else queue.push(listener);
};
})();
function Font(data) {
var face = this.face = data.face, wordSeparators = {
'\u0020': 1,
'\u00a0': 1,
'\u3000': 1
};
this.glyphs = data.glyphs;
this.w = data.w;
this.baseSize = parseInt(face['units-per-em'], 10);
this.family = face['font-family'].toLowerCase();
this.weight = face['font-weight'];
this.style = face['font-style'] || 'normal';
this.viewBox = (function () {
var parts = face.bbox.split(/\s+/);
var box = {
minX: parseInt(parts[0], 10),
minY: parseInt(parts[1], 10),
maxX: parseInt(parts[2], 10),
maxY: parseInt(parts[3], 10)
};
box.width = box.maxX - box.minX;
box.height = box.maxY - box.minY;
box.toString = function() {
return [ this.minX, this.minY, this.width, this.height ].join(' ');
};
return box;
})();
this.ascent = -parseInt(face.ascent, 10);
this.descent = -parseInt(face.descent, 10);
this.height = -this.ascent + this.descent;
this.spacing = function(chars, letterSpacing, wordSpacing) {
var glyphs = this.glyphs, glyph,
kerning, k,
jumps = [],
width = 0, w,
i = -1, j = -1, chr;
while (chr = chars[++i]) {
glyph = glyphs[chr] || this.missingGlyph;
if (!glyph) continue;
if (kerning) {
width -= k = kerning[chr] || 0;
jumps[j] -= k;
}
w = glyph.w;
if (isNaN(w)) w = +this.w; // may have been a String in old fonts
w += letterSpacing;
if (wordSeparators[chr]) w += wordSpacing;
width += jumps[++j] = ~~w; // get rid of decimals
kerning = glyph.k;
}
jumps.total = width;
return jumps;
};
}
function FontFamily() {
var styles = {}, mapping = {
oblique: 'italic',
italic: 'oblique'
};
this.add = function(font) {
(styles[font.style] || (styles[font.style] = {}))[font.weight] = font;
};
this.get = function(style, weight) {
var weights = styles[style] || styles[mapping[style]]
|| styles.normal || styles.italic || styles.oblique;
if (!weights) return null;
// we don't have to worry about "bolder" and "lighter"
// because IE's currentStyle returns a numeric value for it,
// and other browsers use the computed value anyway
weight = {
normal: 400,
bold: 700
}[weight] || parseInt(weight, 10);
if (weights[weight]) return weights[weight];
// http://www.w3.org/TR/CSS21/fonts.html#propdef-font-weight
// Gecko uses x99/x01 for lighter/bolder
var up = {
1: 1,
99: 0
}[weight % 100], alts = [], min, max;
if (up === undefined) up = weight > 400;
if (weight == 500) weight = 400;
for (var alt in weights) {
if (!hasOwnProperty(weights, alt)) continue;
alt = parseInt(alt, 10);
if (!min || alt < min) min = alt;
if (!max || alt > max) max = alt;
alts.push(alt);
}
if (weight < min) weight = min;
if (weight > max) weight = max;
alts.sort(function(a, b) {
return (up
? (a >= weight && b >= weight) ? a < b : a > b
: (a <= weight && b <= weight) ? a > b : a < b) ? -1 : 1;
});
return weights[alts[0]];
};
}
function HoverHandler() {
function contains(node, anotherNode) {
if (node.contains) return node.contains(anotherNode);
return node.compareDocumentPosition(anotherNode) & 16;
}
function onOverOut(e) {
var related = e.relatedTarget;
if (!related || contains(this, related)) return;
trigger(this, e.type == 'mouseover');
}
function onEnterLeave(e) {
trigger(this, e.type == 'mouseenter');
}
function trigger(el, hoverState) {
// A timeout is needed so that the event can actually "happen"
// before replace is triggered. This ensures that styles are up
// to date.
setTimeout(function() {
var options = sharedStorage.get(el).options;
api.replace(el, hoverState ? merge(options, options.hover) : options, true);
}, 10);
}
this.attach = function(el) {
if (el.onmouseenter === undefined) {
addEvent(el, 'mouseover', onOverOut);
addEvent(el, 'mouseout', onOverOut);
}
else {
addEvent(el, 'mouseenter', onEnterLeave);
addEvent(el, 'mouseleave', onEnterLeave);
}
};
}
function ReplaceHistory() {
var list = [], map = {};
function filter(keys) {
var values = [], key;
for (var i = 0; key = keys[i]; ++i) values[i] = list[map[key]];
return values;
}
this.add = function(key, args) {
map[key] = list.push(args) - 1;
};
this.repeat = function() {
var snapshot = arguments.length ? filter(arguments) : list, args;
for (var i = 0; args = snapshot[i++];) api.replace(args[0], args[1], true);
};
}
function Storage() {
var map = {}, at = 0;
function identify(el) {
return el.cufid || (el.cufid = ++at);
}
this.get = function(el) {
var id = identify(el);
return map[id] || (map[id] = {});
};
}
function Style(style) {
var custom = {}, sizes = {};
this.extend = function(styles) {
for (var property in styles) {
if (hasOwnProperty(styles, property)) custom[property] = styles[property];
}
return this;
};
this.get = function(property) {
return custom[property] != undefined ? custom[property] : style[property];
};
this.getSize = function(property, base) {
return sizes[property] || (sizes[property] = new CSS.Size(this.get(property), base));
};
this.isUsable = function() {
return !!style;
};
}
function addEvent(el, type, listener) {
if (el.addEventListener) {
el.addEventListener(type, listener, false);
}
else if (el.attachEvent) {
el.attachEvent('on' + type, function() {
return listener.call(el, window.event);
});
}
}
function attach(el, options) {
var storage = sharedStorage.get(el);
if (storage.options) return el;
if (options.hover && options.hoverables[el.nodeName.toLowerCase()]) {
hoverHandler.attach(el);
}
storage.options = options;
return el;
}
function cached(fun) {
var cache = {};
return function(key) {
if (!hasOwnProperty(cache, key)) cache[key] = fun.apply(null, arguments);
return cache[key];
};
}
function getFont(el, style) {
var families = CSS.quotedList(style.get('fontFamily').toLowerCase()), family;
for (var i = 0; family = families[i]; ++i) {
if (fonts[family]) return fonts[family].get(style.get('fontStyle'), style.get('fontWeight'));
}
return null;
}
function elementsByTagName(query) {
return document.getElementsByTagName(query);
}
function hasOwnProperty(obj, property) {
return obj.hasOwnProperty(property);
}
function merge() {
var merged = {}, arg, key;
for (var i = 0, l = arguments.length; arg = arguments[i], i < l; ++i) {
for (key in arg) {
if (hasOwnProperty(arg, key)) merged[key] = arg[key];
}
}
return merged;
}
function process(font, text, style, options, node, el) {
var fragment = document.createDocumentFragment(), processed;
if (text === '') return fragment;
var separate = options.separate;
var parts = text.split(separators[separate]), needsAligning = (separate == 'words');
if (needsAligning && HAS_BROKEN_REGEXP) {
// @todo figure out a better way to do this
if (/^\s/.test(text)) parts.unshift('');
if (/\s$/.test(text)) parts.push('');
}
for (var i = 0, l = parts.length; i < l; ++i) {
processed = engines[options.engine](font,
needsAligning ? CSS.textAlign(parts[i], style, i, l) : parts[i],
style, options, node, el, i < l - 1);
if (processed) fragment.appendChild(processed);
}
return fragment;
}
function replaceElement(el, options) {
var name = el.nodeName.toLowerCase();
if (options.ignore[name]) return;
var replace = !options.textless[name];
var style = CSS.getStyle(attach(el, options)).extend(options);
var font = getFont(el, style), node, type, next, anchor, text, lastElement;
if (!font) return;
for (node = el.firstChild; node; node = next) {
type = node.nodeType;
next = node.nextSibling;
if (replace && type == 3) {
// Node.normalize() is broken in IE 6, 7, 8
if (anchor) {
anchor.appendData(node.data);
el.removeChild(node);
}
else anchor = node;
if (next) continue;
}
if (anchor) {
el.replaceChild(process(font,
CSS.whiteSpace(anchor.data, style, anchor, lastElement),
style, options, node, el), anchor);
anchor = null;
}
if (type == 1) {
if (node.firstChild) {
if (node.nodeName.toLowerCase() == 'cufon') {
engines[options.engine](font, null, style, options, node, el);
}
else arguments.callee(node, options);
}
lastElement = node;
}
}
}
var HAS_BROKEN_REGEXP = ' '.split(/\s+/).length == 0;
var sharedStorage = new Storage();
var hoverHandler = new HoverHandler();
var replaceHistory = new ReplaceHistory();
var initialized = false;
var engines = {}, fonts = {}, defaultOptions = {
autoDetect: false,
engine: null,
//fontScale: 1,
//fontScaling: false,
forceHitArea: false,
hover: false,
hoverables: {
a: true
},
ignore: {
applet: 1,
canvas: 1,
col: 1,
colgroup: 1,
head: 1,
iframe: 1,
map: 1,
noscript: 1,
optgroup: 1,
option: 1,
script: 1,
select: 1,
style: 1,
textarea: 1,
title: 1,
pre: 1
},
printable: true,
//rotation: 0,
//selectable: false,
selector: (
window.Sizzle
|| (window.jQuery && function(query) { return jQuery(query); }) // avoid noConflict issues
|| (window.dojo && dojo.query)
|| (window.Ext && Ext.query)
|| (window.YAHOO && YAHOO.util && YAHOO.util.Selector && YAHOO.util.Selector.query)
|| (window.$$ && function(query) { return $$(query); })
|| (window.$ && function(query) { return $(query); })
|| (document.querySelectorAll && function(query) { return document.querySelectorAll(query); })
|| elementsByTagName
),
separate: 'words', // 'none' and 'characters' are also accepted
textless: {
dl: 1,
html: 1,
ol: 1,
table: 1,
tbody: 1,
thead: 1,
tfoot: 1,
tr: 1,
ul: 1
},
textShadow: 'none'
};
var separators = {
// The first pattern may cause unicode characters above
// code point 255 to be removed in Safari 3.0. Luckily enough
// Safari 3.0 does not include non-breaking spaces in \s, so
// we can just use a simple alternative pattern.
words: /\s/.test('\u00a0') ? /[^\S\u00a0]+/ : /\s+/,
characters: '',
none: /^/
};
api.now = function() {
DOM.ready();
return api;
};
api.refresh = function() {
replaceHistory.repeat.apply(replaceHistory, arguments);
return api;
};
api.registerEngine = function(id, engine) {
if (!engine) return api;
engines[id] = engine;
return api.set('engine', id);
};
api.registerFont = function(data) {
if (!data) return api;
var font = new Font(data), family = font.family;
if (!fonts[family]) fonts[family] = new FontFamily();
fonts[family].add(font);
return api.set('fontFamily', '"' + family + '"');
};
api.replace = function(elements, options, ignoreHistory) {
options = merge(defaultOptions, options);
if (!options.engine) return api; // there's no browser support so we'll just stop here
if (!initialized) {
CSS.addClass(DOM.root(), 'cufon-active cufon-loading');
CSS.ready(function() {
// fires before any replace() calls, but it doesn't really matter
CSS.addClass(CSS.removeClass(DOM.root(), 'cufon-loading'), 'cufon-ready');
});
initialized = true;
}
if (options.hover) options.forceHitArea = true;
if (options.autoDetect) delete options.fontFamily;
if (typeof options.textShadow == 'string') {
options.textShadow = CSS.textShadow(options.textShadow);
}
if (typeof options.color == 'string' && /^-/.test(options.color)) {
options.textGradient = CSS.gradient(options.color);
}
else delete options.textGradient;
if (!ignoreHistory) replaceHistory.add(elements, arguments);
if (elements.nodeType || typeof elements == 'string') elements = [ elements ];
CSS.ready(function() {
for (var i = 0, l = elements.length; i < l; ++i) {
var el = elements[i];
if (typeof el == 'string') api.replace(options.selector(el), options, true);
else replaceElement(el, options);
}
});
return api;
};
api.set = function(option, value) {
defaultOptions[option] = value;
return api;
};
return api;
})();
Cufon.registerEngine('canvas', (function() {
// Safari 2 doesn't support .apply() on native methods
var check = document.createElement('canvas');
if (!check || !check.getContext || !check.getContext.apply) return;
check = null;
var HAS_INLINE_BLOCK = Cufon.CSS.supports('display', 'inline-block');
// Firefox 2 w/ non-strict doctype (almost standards mode)
var HAS_BROKEN_LINEHEIGHT = !HAS_INLINE_BLOCK && (document.compatMode == 'BackCompat' || /frameset|transitional/i.test(document.doctype.publicId));
var styleSheet = document.createElement('style');
styleSheet.type = 'text/css';
styleSheet.appendChild(document.createTextNode((
'cufon{text-indent:0;}' +
'@media screen,projection{' +
'cufon{display:inline;display:inline-block;position:relative;vertical-align:middle;' +
(HAS_BROKEN_LINEHEIGHT
? ''
: 'font-size:1px;line-height:1px;') +
'}cufon cufontext{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}' +
(HAS_INLINE_BLOCK
? 'cufon canvas{position:relative;}'
: 'cufon canvas{position:absolute;}') +
'}' +
'@media print{' +
'cufon{padding:0;}' + // Firefox 2
'cufon canvas{display:none;}' +
'}'
).replace(/;/g, '!important;')));
document.getElementsByTagName('head')[0].appendChild(styleSheet);
function generateFromVML(path, context) {
var atX = 0, atY = 0;
var code = [], re = /([mrvxe])([^a-z]*)/g, match;
generate: for (var i = 0; match = re.exec(path); ++i) {
var c = match[2].split(',');
switch (match[1]) {
case 'v':
code[i] = { m: 'bezierCurveTo', a: [ atX + ~~c[0], atY + ~~c[1], atX + ~~c[2], atY + ~~c[3], atX += ~~c[4], atY += ~~c[5] ] };
break;
case 'r':
code[i] = { m: 'lineTo', a: [ atX += ~~c[0], atY += ~~c[1] ] };
break;
case 'm':
code[i] = { m: 'moveTo', a: [ atX = ~~c[0], atY = ~~c[1] ] };
break;
case 'x':
code[i] = { m: 'closePath' };
break;
case 'e':
break generate;
}
context[code[i].m].apply(context, code[i].a);
}
return code;
}
function interpret(code, context) {
for (var i = 0, l = code.length; i < l; ++i) {
var line = code[i];
context[line.m].apply(context, line.a);
}
}
return function(font, text, style, options, node, el) {
var redraw = (text === null);
if (redraw) text = node.getAttribute('alt');
var viewBox = font.viewBox;
var size = style.getSize('fontSize', font.baseSize);
var expandTop = 0, expandRight = 0, expandBottom = 0, expandLeft = 0;
var shadows = options.textShadow, shadowOffsets = [];
if (shadows) {
for (var i = shadows.length; i--;) {
var shadow = shadows[i];
var x = size.convertFrom(parseFloat(shadow.offX));
var y = size.convertFrom(parseFloat(shadow.offY));
shadowOffsets[i] = [ x, y ];
if (y < expandTop) expandTop = y;
if (x > expandRight) expandRight = x;
if (y > expandBottom) expandBottom = y;
if (x < expandLeft) expandLeft = x;
}
}
var chars = Cufon.CSS.textTransform(text, style).split('');
var jumps = font.spacing(chars,
~~size.convertFrom(parseFloat(style.get('letterSpacing')) || 0),
~~size.convertFrom(parseFloat(style.get('wordSpacing')) || 0)
);
if (!jumps.length) return null; // there's nothing to render
var width = jumps.total;
expandRight += viewBox.width - jumps[jumps.length - 1];
expandLeft += viewBox.minX;
var wrapper, canvas;
if (redraw) {
wrapper = node;
canvas = node.firstChild;
}
else {
wrapper = document.createElement('cufon');
wrapper.className = 'cufon cufon-canvas';
wrapper.setAttribute('alt', text);
canvas = document.createElement('canvas');
wrapper.appendChild(canvas);
if (options.printable) {
var print = document.createElement('cufontext');
print.appendChild(document.createTextNode(text));
wrapper.appendChild(print);
}
}
var wStyle = wrapper.style;
var cStyle = canvas.style;
var height = size.convert(viewBox.height);
var roundedHeight = Math.ceil(height);
var roundingFactor = roundedHeight / height;
var stretchFactor = roundingFactor * Cufon.CSS.fontStretch(style.get('fontStretch'));
var stretchedWidth = width * stretchFactor;
var canvasWidth = Math.ceil(size.convert(stretchedWidth + expandRight - expandLeft));
var canvasHeight = Math.ceil(size.convert(viewBox.height - expandTop + expandBottom));
canvas.width = canvasWidth;
canvas.height = canvasHeight;
// needed for WebKit and full page zoom
cStyle.width = canvasWidth + 'px';
cStyle.height = canvasHeight + 'px';
// minY has no part in canvas.height
expandTop += viewBox.minY;
cStyle.top = Math.round(size.convert(expandTop - font.ascent)) + 'px';
cStyle.left = Math.round(size.convert(expandLeft)) + 'px';
var wrapperWidth = Math.max(Math.ceil(size.convert(stretchedWidth)), 0) + 'px';
if (HAS_INLINE_BLOCK) {
wStyle.width = wrapperWidth;
wStyle.height = size.convert(font.height) + 'px';
}
else {
wStyle.paddingLeft = wrapperWidth;
wStyle.paddingBottom = (size.convert(font.height) - 1) + 'px';
}
var g = canvas.getContext('2d'), scale = height / viewBox.height;
// proper horizontal scaling is performed later
g.scale(scale, scale * roundingFactor);
g.translate(-expandLeft, -expandTop);
g.save();
function renderText() {
var glyphs = font.glyphs, glyph, i = -1, j = -1, chr;
g.scale(stretchFactor, 1);
while (chr = chars[++i]) {
var glyph = glyphs[chars[i]] || font.missingGlyph;
if (!glyph) continue;
if (glyph.d) {
g.beginPath();
if (glyph.code) interpret(glyph.code, g);
else glyph.code = generateFromVML('m' + glyph.d, g);
g.fill();
}
g.translate(jumps[++j], 0);
}
g.restore();
}
if (shadows) {
for (var i = shadows.length; i--;) {
var shadow = shadows[i];
g.save();
g.fillStyle = shadow.color;
g.translate.apply(g, shadowOffsets[i]);
renderText();
}
}
var gradient = options.textGradient;
if (gradient) {
var stops = gradient.stops, fill = g.createLinearGradient(0, viewBox.minY, 0, viewBox.maxY);
for (var i = 0, l = stops.length; i < l; ++i) {
fill.addColorStop.apply(fill, stops[i]);
}
g.fillStyle = fill;
}
else g.fillStyle = style.get('color');
renderText();
return wrapper;
};
})());
Cufon.registerEngine('vml', (function() {
var ns = document.namespaces;
if (!ns) return;
ns.add('cvml', 'urn:schemas-microsoft-com:vml');
ns = null;
var check = document.createElement('cvml:shape');
check.style.behavior = 'url(#default#VML)';
if (!check.coordsize) return; // VML isn't supported
check = null;
var HAS_BROKEN_LINEHEIGHT = (document.documentMode || 0) < 8;
document.write(('').replace(/;/g, '!important;'));
function getFontSizeInPixels(el, value) {
return getSizeInPixels(el, /(?:em|ex|%)$|^[a-z-]+$/i.test(value) ? '1em' : value);
}
// Original by Dead Edwards.
// Combined with getFontSizeInPixels it also works with relative units.
function getSizeInPixels(el, value) {
if (value === '0') return 0;
if (/px$/i.test(value)) return parseFloat(value);
var style = el.style.left, runtimeStyle = el.runtimeStyle.left;
el.runtimeStyle.left = el.currentStyle.left;
el.style.left = value.replace('%', 'em');
var result = el.style.pixelLeft;
el.style.left = style;
el.runtimeStyle.left = runtimeStyle;
return result;
}
function getSpacingValue(el, style, size, property) {
var key = 'computed' + property, value = style[key];
if (isNaN(value)) {
value = style.get(property);
style[key] = value = (value == 'normal') ? 0 : ~~size.convertFrom(getSizeInPixels(el, value));
}
return value;
}
var fills = {};
function gradientFill(gradient) {
var id = gradient.id;
if (!fills[id]) {
var stops = gradient.stops, fill = document.createElement('cvml:fill'), colors = [];
fill.type = 'gradient';
fill.angle = 180;
fill.focus = '0';
fill.method = 'sigma';
fill.color = stops[0][1];
for (var j = 1, k = stops.length - 1; j < k; ++j) {
colors.push(stops[j][0] * 100 + '% ' + stops[j][1]);
}
fill.colors = colors.join(',');
fill.color2 = stops[k][1];
fills[id] = fill;
}
return fills[id];
}
return function(font, text, style, options, node, el, hasNext) {
var redraw = (text === null);
if (redraw) text = node.alt;
var viewBox = font.viewBox;
var size = style.computedFontSize || (style.computedFontSize = new Cufon.CSS.Size(getFontSizeInPixels(el, style.get('fontSize')) + 'px', font.baseSize));
var wrapper, canvas;
if (redraw) {
wrapper = node;
canvas = node.firstChild;
}
else {
wrapper = document.createElement('cufon');
wrapper.className = 'cufon cufon-vml';
wrapper.alt = text;
canvas = document.createElement('cufoncanvas');
wrapper.appendChild(canvas);
if (options.printable) {
var print = document.createElement('cufontext');
print.appendChild(document.createTextNode(text));
wrapper.appendChild(print);
}
// ie6, for some reason, has trouble rendering the last VML element in the document.
// we can work around this by injecting a dummy element where needed.
// @todo find a better solution
if (!hasNext) wrapper.appendChild(document.createElement('cvml:shape'));
}
var wStyle = wrapper.style;
var cStyle = canvas.style;
var height = size.convert(viewBox.height), roundedHeight = Math.ceil(height);
var roundingFactor = roundedHeight / height;
var stretchFactor = roundingFactor * Cufon.CSS.fontStretch(style.get('fontStretch'));
var minX = viewBox.minX, minY = viewBox.minY;
cStyle.height = roundedHeight;
cStyle.top = Math.round(size.convert(minY - font.ascent));
cStyle.left = Math.round(size.convert(minX));
wStyle.height = size.convert(font.height) + 'px';
var color = style.get('color');
var chars = Cufon.CSS.textTransform(text, style).split('');
var jumps = font.spacing(chars,
getSpacingValue(el, style, size, 'letterSpacing'),
getSpacingValue(el, style, size, 'wordSpacing')
);
if (!jumps.length) return null;
var width = jumps.total;
var fullWidth = -minX + width + (viewBox.width - jumps[jumps.length - 1]);
var shapeWidth = size.convert(fullWidth * stretchFactor), roundedShapeWidth = Math.round(shapeWidth);
var coordSize = fullWidth + ',' + viewBox.height, coordOrigin;
var stretch = 'r' + coordSize + 'ns';
var fill = options.textGradient && gradientFill(options.textGradient);
var glyphs = font.glyphs, offsetX = 0;
var shadows = options.textShadow;
var i = -1, j = 0, chr;
while (chr = chars[++i]) {
var glyph = glyphs[chars[i]] || font.missingGlyph, shape;
if (!glyph) continue;
if (redraw) {
// some glyphs may be missing so we can't use i
shape = canvas.childNodes[j];
while (shape.firstChild) shape.removeChild(shape.firstChild); // shadow, fill
}
else {
shape = document.createElement('cvml:shape');
canvas.appendChild(shape);
}
shape.stroked = 'f';
shape.coordsize = coordSize;
shape.coordorigin = coordOrigin = (minX - offsetX) + ',' + minY;
shape.path = (glyph.d ? 'm' + glyph.d + 'xe' : '') + 'm' + coordOrigin + stretch;
shape.fillcolor = color;
if (fill) shape.appendChild(fill.cloneNode(false));
// it's important to not set top/left or IE8 will grind to a halt
var sStyle = shape.style;
sStyle.width = roundedShapeWidth;
sStyle.height = roundedHeight;
if (shadows) {
// due to the limitations of the VML shadow element there
// can only be two visible shadows. opacity is shared
// for all shadows.
var shadow1 = shadows[0], shadow2 = shadows[1];
var color1 = Cufon.CSS.color(shadow1.color), color2;
var shadow = document.createElement('cvml:shadow');
shadow.on = 't';
shadow.color = color1.color;
shadow.offset = shadow1.offX + ',' + shadow1.offY;
if (shadow2) {
color2 = Cufon.CSS.color(shadow2.color);
shadow.type = 'double';
shadow.color2 = color2.color;
shadow.offset2 = shadow2.offX + ',' + shadow2.offY;
}
shadow.opacity = color1.opacity || (color2 && color2.opacity) || 1;
shape.appendChild(shadow);
}
offsetX += jumps[j++];
}
// addresses flickering issues on :hover
var cover = shape.nextSibling, coverFill, vStyle;
if (options.forceHitArea) {
if (!cover) {
cover = document.createElement('cvml:rect');
cover.stroked = 'f';
cover.className = 'cufon-vml-cover';
coverFill = document.createElement('cvml:fill');
coverFill.opacity = 0;
cover.appendChild(coverFill);
canvas.appendChild(cover);
}
vStyle = cover.style;
vStyle.width = roundedShapeWidth;
vStyle.height = roundedHeight;
}
else if (cover) canvas.removeChild(cover);
wStyle.width = Math.max(Math.ceil(size.convert(width * stretchFactor)), 0);
if (HAS_BROKEN_LINEHEIGHT) {
var yAdjust = style.computedYAdjust;
if (yAdjust === undefined) {
var lineHeight = style.get('lineHeight');
if (lineHeight == 'normal') lineHeight = '1em';
else if (!isNaN(lineHeight)) lineHeight += 'em'; // no unit
style.computedYAdjust = yAdjust = 0.5 * (getSizeInPixels(el, lineHeight) - parseFloat(wStyle.height));
}
if (yAdjust) {
wStyle.marginTop = Math.ceil(yAdjust) + 'px';
wStyle.marginBottom = yAdjust + 'px';
}
}
return wrapper;
};
})());
Cufon.registerFont({"w":200,"face":{"font-family":"IanMashedHelvetica","font-weight":400,"font-stretch":"normal","units-per-em":"360","panose-1":"0 0 0 0 0 0 0 0 0 0","ascent":"288","descent":"-72","x-height":"8","bbox":"-44 -272 321.894 82.1744","underline-thickness":"17.7539","underline-position":"-18.457","unicode-range":"U+0020-U+007A"},"glyphs":{" ":{"w":100},"!":{"d":"39,-86v15,-55,-24,-146,8,-174v15,7,32,2,48,7v8,40,-1,91,-1,133v0,41,-17,57,-49,48v-4,-3,-6,-7,-6,-14xm52,1v-21,-4,-11,-55,7,-57v16,8,47,1,31,32v6,21,-22,21,-38,25","w":119},"&":{"d":"172,-25v-63,86,-215,-21,-130,-94v8,-7,24,-18,30,-22v-16,-23,-33,-55,-15,-82v12,-17,30,-36,57,-34v31,1,72,18,72,51v0,32,-28,50,-46,69v14,14,23,29,36,46v17,-7,1,-48,34,-43v11,2,33,4,22,18v2,29,-13,47,-31,58v14,16,24,33,42,44v1,8,3,21,-7,15v-12,7,-27,3,-40,1v-10,-2,-19,-22,-24,-27xm136,-208v-11,8,-25,-24,-37,2v-10,13,3,32,18,34v12,-3,28,-18,19,-36xm100,-110v-16,1,-25,26,-32,39v3,33,50,46,68,18r9,-2v-13,-21,-30,-39,-45,-55","w":259},"(":{"d":"71,74v-69,-65,-77,-231,-10,-304v8,-22,35,-50,57,-25v-17,33,-56,57,-53,106v-9,34,-9,78,-3,114v-8,35,19,76,37,100v1,12,-20,10,-28,9","w":119},")":{"d":"22,74v-27,-8,9,-42,8,-61v14,-83,27,-201,-18,-259v-16,-20,12,-20,24,-19v59,33,76,157,53,242v-4,15,-28,86,-55,92v-5,3,-6,5,-12,5","w":119},",":{"d":"48,-3v-24,12,-31,-23,-30,-41v10,-12,42,-6,53,-8v20,40,-6,99,-36,115v-36,-14,14,-41,13,-66","w":100},"-":{"d":"7,-107v-13,-30,27,-17,47,-20v27,2,70,-3,53,32v6,35,-44,12,-76,14v-16,1,-22,-8,-20,-23v-1,0,-2,-1,-4,-3","w":119},".":{"d":"26,-7v-16,-36,5,-55,43,-41v19,8,5,27,4,43v-4,12,-42,8,-47,-2","w":100},"\/":{"d":"49,-176v19,-35,14,-108,70,-88v16,20,-4,21,-20,62v-12,30,-27,56,-40,88r-42,105v-4,23,-35,9,-38,-5v28,-49,42,-110,70,-162","w":100},"0":{"d":"79,-258v128,-23,133,179,73,249v-46,29,-124,9,-127,-43v-28,-72,-24,-203,54,-204r0,-2xm123,-43v18,-43,17,-132,-8,-166v-21,-7,-34,8,-41,25v-17,42,-13,102,2,138v10,23,37,15,47,3"},"1":{"d":"20,-183v0,-52,69,-10,71,-72v69,-23,44,72,44,125r-1,122v-13,15,-59,11,-47,-16r-5,-148v-33,6,-61,6,-62,-11","k":{"1":20}},"2":{"d":"19,-182v-11,-79,117,-103,156,-44v40,60,-11,118,-57,141v-13,13,-34,20,-41,39v36,2,80,-4,112,2v12,77,-101,23,-145,49v-14,0,-20,-4,-29,-6v1,-63,39,-106,89,-125v25,-9,51,-71,9,-84v-27,-9,-52,10,-49,34v-4,14,-39,13,-49,4v-2,-3,-1,-11,4,-10"},"3":{"d":"128,-184v2,-38,-63,-42,-68,-6v9,14,-11,16,-23,18v1,-1,0,-1,0,-1v-33,9,-22,-24,-13,-43v36,-79,195,-31,144,58v-2,10,-27,18,-11,24v43,15,38,95,4,114v-28,34,-91,28,-124,8v-10,-16,-28,-31,-25,-52v-6,0,-6,-13,-1,-16v9,-4,37,-2,44,4v6,21,27,55,54,32v36,-2,32,-55,6,-62v-11,-8,-54,7,-43,-27v-7,-12,11,-24,22,-17v5,-4,24,3,24,-10v4,-7,10,-14,10,-24"},"4":{"d":"95,-249v18,-7,69,-9,60,17v8,44,-8,100,7,135v28,-11,36,37,22,50v-10,5,-12,-3,-24,-1v6,30,-4,47,-35,45v-24,11,-19,-10,-13,-28v-1,-45,-57,-11,-95,-24v-16,-15,-9,-54,5,-65xm109,-199v-21,20,-39,71,-54,103v9,1,19,-1,26,3r0,-3v2,2,5,1,5,2r27,-2"},"5":{"d":"9,-68v33,-13,60,5,72,26v48,19,69,-55,32,-78v-32,-12,-45,19,-70,11v-14,8,-29,-10,-20,-30v6,-30,-1,-69,7,-104v27,-26,88,1,140,-10v13,3,11,47,-8,41v-23,-7,-66,8,-87,1v-5,10,-8,39,-6,55v91,-49,151,68,88,137v-36,39,-127,30,-140,-14v-3,-8,-15,-25,-8,-35"},"6":{"d":"34,-216v9,-34,74,-57,110,-29v20,3,42,33,32,51v-15,0,-51,19,-52,-6v-22,-25,-62,5,-62,35v-5,5,-7,19,-6,23v35,-37,112,-20,122,22v49,87,-83,177,-145,91v-35,-49,-26,-144,1,-187xm62,-99v-16,64,69,89,75,24v5,-46,-53,-58,-75,-24"},"7":{"d":"7,-213v-3,-78,111,-16,167,-42v55,37,-22,77,-34,117v-22,35,-34,80,-38,127v-27,24,-70,4,-50,-31v8,-70,38,-120,75,-160v-41,-3,-102,21,-120,-11"},"8":{"d":"154,-133v21,15,40,38,32,81v-8,17,-19,47,-45,47v-31,16,-94,17,-111,-10v-35,-21,-28,-106,8,-118v11,-13,-43,-47,-13,-84v22,-47,118,-50,140,-4v9,19,28,49,4,71v-5,7,-9,12,-15,17xm130,-175v8,-36,-45,-40,-58,-18v-5,7,-2,28,4,34v22,6,50,4,54,-16xm99,-34v48,0,47,-74,5,-80v0,1,0,1,-1,1v0,-1,-1,-1,-2,-1v-37,-7,-55,56,-22,72v6,2,14,8,20,8"},"9":{"d":"133,-98v-83,50,-172,-50,-107,-125v15,-30,56,-30,86,-34v93,13,94,160,56,228v-20,37,-96,46,-127,13v-12,-7,-42,-33,-20,-44v11,2,22,3,33,-1v20,-1,33,39,60,15v8,-17,19,-33,19,-52xm110,-126v47,-17,18,-101,-28,-77v-14,14,-23,57,-3,73v6,3,19,8,31,4"},":":{"d":"72,-130v-27,16,-37,-28,-30,-48v7,-20,68,-8,51,13v11,20,-3,33,-21,35xm41,-31v-9,-35,32,-28,50,-19v5,3,3,21,3,31v0,17,-17,21,-30,21v-18,0,-23,-13,-23,-33","w":119},"@":{"d":"30,-127v11,-86,60,-139,155,-144v0,0,-1,0,-1,-1v55,10,115,27,128,74v28,55,-8,124,-51,143v-28,-2,-42,-1,-56,-21v-16,19,-44,33,-74,19v-41,-19,-33,-118,5,-135v27,-12,17,-8,45,-10v14,-1,28,4,36,16v7,-2,4,-18,15,-17v14,1,20,7,25,18v-3,34,-22,68,-23,97v77,5,75,-122,22,-139v-22,-7,-44,-25,-73,-21v-44,7,-84,17,-97,56v-8,23,-22,39,-22,74v0,93,108,122,175,80v17,-3,46,-21,43,10v-50,41,-144,42,-194,11v-39,-23,-42,-67,-58,-110xm211,-157v-3,-21,-31,-29,-45,-11v-6,8,-22,31,-14,43v-5,2,0,4,-1,9v-10,7,-2,33,16,23v31,-4,34,-42,44,-64","w":351},"a":{"d":"-44,-256v2,0,5,-2,5,0r-5,0xm9,-133v12,-50,65,-80,134,-58v37,11,47,66,33,108v-4,5,-1,22,0,30v-5,20,1,36,8,46v-4,15,-47,17,-53,2v-1,0,1,-13,-5,-13v-34,35,-119,29,-116,-37v2,-41,48,-57,93,-59v14,-4,30,-21,19,-34v-15,-5,-46,-4,-46,12v0,20,-26,14,-43,19v-6,-8,-28,-1,-24,-16xm128,-87v-18,3,-49,10,-60,20v-2,19,5,33,21,33v30,0,42,-20,39,-53"},"b":{"d":"22,-22r-4,-230v12,-13,35,-5,51,-1v3,25,-2,57,5,78v10,-11,29,-24,52,-24v109,0,99,185,18,201v-28,5,-58,-6,-70,-23v13,31,-29,25,-53,29v-6,-3,-14,-19,-4,-23v3,-1,5,-3,5,-7xm113,-146v-26,1,-27,26,-42,38v1,36,13,68,48,71v39,-7,46,-85,14,-103v-4,-3,-11,-5,-21,-5v0,-1,1,-1,1,-1","w":219},"c":{"d":"125,-45v4,-27,20,-31,52,-31v28,7,-3,39,-10,51v-22,31,-76,37,-113,17v-55,-31,-48,-163,13,-180v9,-3,22,-9,35,-9v53,-3,74,34,88,67v-3,19,-54,25,-57,2v-4,-28,-57,-23,-60,2v-23,42,6,117,52,81"},"d":{"d":"87,3v-81,-7,-103,-159,-32,-193v28,-13,74,-2,92,12r-5,-73v13,-21,78,-12,59,27r3,215v-11,11,-53,20,-59,2v0,-2,0,-6,1,-11v-12,8,-27,13,-40,20v4,0,6,0,2,2v-10,0,-10,0,-21,-3v3,8,-3,1,-7,3v1,-3,5,-1,7,-1xm150,-96v0,-36,-19,-57,-54,-54v-5,4,-13,10,-21,7v-22,32,-6,102,24,106v38,4,51,-27,51,-59","w":219},"e":{"d":"181,-48v-4,37,-49,56,-92,53v0,0,1,0,1,-1v-78,-1,-106,-116,-60,-172v31,-40,121,-39,138,12v15,15,18,43,23,67v-26,27,-80,-1,-121,20v-4,1,-14,-3,-13,3v0,21,21,32,43,32v25,0,21,-29,49,-27v13,-6,30,3,32,13xm135,-117v6,-37,-53,-40,-67,-14v-14,15,3,15,17,15"},"f":{"d":"28,-197v-8,-54,47,-71,86,-61v13,30,-6,44,-32,47v4,5,-2,5,2,9v-3,2,-2,1,-1,10v11,2,35,0,37,13v-5,17,-15,31,-40,29v-5,40,7,104,-2,146v-16,11,-62,10,-50,-23v0,-40,10,-88,6,-124v-21,8,-32,-14,-32,-30v0,-9,19,-13,26,-16","w":119},"g":{"d":"43,-18v-47,-48,-29,-182,51,-178v21,1,39,14,50,24v-5,-18,9,-28,26,-19v50,-10,16,73,25,123v-6,19,4,46,1,66v-4,28,-16,67,-43,67v-31,32,-114,15,-132,-16v-13,-22,5,-37,29,-35v28,2,38,33,72,20v21,-3,32,-31,25,-55v-24,25,-66,31,-95,7xm91,-195r0,0r0,0xm141,-112v-6,-39,-69,-30,-73,10v-4,45,24,76,53,51v26,1,21,-43,18,-62","w":219},"h":{"d":"135,-127v2,-34,-46,-25,-53,-5v-10,32,-14,78,-9,116v-2,13,-19,19,-33,16v-46,-6,4,-81,-14,-121v-8,-41,3,-93,-9,-128v11,-18,66,-13,59,15r2,64v27,-45,121,-29,112,33r8,112v4,30,-49,36,-57,13v-2,-38,2,-83,-6,-115","w":219},"i":{"d":"20,-250v11,-10,53,-24,52,5v16,35,-31,48,-48,30xm29,-10v-5,-57,0,-123,-9,-174v16,-22,64,-6,54,22r9,146v-2,19,-29,12,-44,20v-8,-1,-12,-5,-10,-14","w":100},"j":{"d":"36,-262v9,9,38,-7,38,17v0,12,8,30,-10,29v-13,4,-40,10,-39,-11v-3,-15,-2,-39,10,-33v0,0,0,-1,1,-2xm21,24v44,-73,-58,-229,49,-221v14,50,13,144,15,198v2,51,-27,69,-69,74v-23,3,-22,-45,-7,-49v4,-1,10,-4,12,-2","w":100},"k":{"d":"21,-222v1,-24,-5,-43,27,-35v5,-7,31,-8,25,7r0,127v16,-13,31,-34,48,-48v-11,-32,32,-25,61,-22v5,3,15,7,11,15r-62,69v18,37,38,70,62,97v-3,26,-27,4,-45,12v-30,-12,-37,-46,-58,-67v-16,7,-21,26,-14,51v-6,22,-50,24,-56,9v11,-64,0,-149,1,-215"},"l":{"d":"24,-173v7,-12,-2,-22,-2,-51v12,-2,-10,-42,28,-34v36,-15,25,33,27,63v3,60,-4,129,4,184v-3,20,-67,22,-58,-3","w":100},"m":{"d":"14,-14v25,-39,5,-121,12,-173v1,-10,39,-5,53,1v23,-28,94,-18,97,18v4,7,4,-3,10,-6v14,-13,27,-25,55,-24v51,2,54,57,55,110v1,28,-6,63,6,80v0,16,-27,15,-43,15v1,1,1,2,-2,1v-49,-14,29,-146,-42,-159v-52,10,-16,95,-30,145v-10,13,-53,11,-49,-10v6,-34,2,-70,5,-103v3,-33,-27,-37,-54,-30v-18,12,-6,48,-16,75v2,20,1,46,8,61v-5,17,-62,23,-65,-1","w":320},"n":{"d":"18,-185v13,-17,64,-6,53,22v24,-14,28,-39,65,-34v37,5,67,29,57,78v2,35,11,71,8,105v-1,19,-49,29,-59,11r2,-111v-3,-19,-11,-50,-41,-37v-40,17,-27,81,-23,131v-4,17,-39,17,-53,15v-8,-49,2,-129,-9,-180","w":219},"o":{"d":"92,3v-92,2,-106,-155,-34,-188v22,-25,83,-18,101,4v38,17,56,77,39,127v-11,36,-45,54,-85,62v-4,0,-21,-3,-21,-5xm85,-144v-28,11,-21,58,-14,86v4,17,22,28,45,27v59,-3,58,-124,-2,-124v-11,0,-18,7,-29,11","w":219},"p":{"d":"21,-113v-3,-44,-22,-86,37,-81v13,0,15,9,15,20v27,-28,96,-28,115,9v18,17,15,54,23,75v-11,58,-29,83,-80,95v-17,-6,-43,-1,-52,-17v-5,-3,-6,-4,-9,-8v-2,32,13,79,-8,95v-21,5,-52,1,-39,-23xm124,-34v42,-6,45,-102,1,-115v-45,-14,-80,58,-41,94v12,11,21,19,40,21","w":219},"q":{"d":"14,-134v15,-55,83,-86,128,-40r3,-13v18,-7,26,-2,49,-4v9,69,2,170,6,248v2,24,-36,16,-52,17v-14,-10,1,-62,-1,-89v-25,19,-46,27,-86,18v-17,-14,-44,-31,-41,-57v-11,-20,-13,-53,-6,-80xm148,-72v-1,-36,1,-79,-34,-83v-56,-6,-71,94,-29,116v32,17,53,-9,63,-33","w":219},"r":{"d":"24,-17v6,-63,-18,-139,6,-174v15,-1,46,-5,41,19v17,-8,34,-28,60,-23v18,3,14,37,5,48v-33,-1,-66,11,-64,52r4,86v-7,10,-55,19,-52,-8","w":140,"k":{".":20,",":20}},"s":{"d":"65,-81v-57,-10,-57,-102,-2,-111v60,-9,105,6,121,50v-1,22,-57,23,-60,3v-8,-20,-53,-28,-57,0v-1,2,-1,3,-1,3v8,11,33,13,51,16v28,15,70,21,70,61v0,91,-162,81,-180,9v5,-19,29,-3,37,-11v18,-9,24,16,37,19v20,12,65,19,54,-21v-12,-16,-46,-14,-70,-18"},"t":{"d":"76,-157v-6,34,-9,92,13,116v28,-9,24,24,19,43v-30,12,-74,1,-78,-27v-5,-43,2,-90,2,-125v-21,0,-34,-10,-33,-34v3,-9,19,-8,32,-7v-5,-28,-11,-62,32,-51v22,-7,17,24,14,45v-2,4,-1,10,6,6v17,-1,32,3,32,24v0,17,-25,12,-39,10","w":119},"u":{"d":"21,-90v-2,-33,-12,-81,0,-101v30,-6,59,-2,51,38v3,51,-22,125,45,119v43,-21,20,-91,29,-147v-6,-5,0,-14,9,-14v10,5,28,5,37,11v12,48,3,116,2,171v-1,17,-26,7,-38,14v-7,-2,-14,-10,-13,-20v-24,28,-85,28,-107,-1v-14,-12,-13,-46,-15,-70","w":219},"v":{"d":"26,-125v-1,-14,-32,-64,-9,-68v23,2,58,-10,55,28r30,101v10,-38,34,-76,32,-118v4,-12,26,-10,42,-11v36,-3,11,32,6,51v-8,30,-22,52,-34,85v-17,21,-9,61,-43,54v-19,4,-46,15,-45,-13v-12,-31,-23,-74,-34,-109","k":{".":27,",":27}},"w":{"d":"162,-8v0,-35,-19,-70,-23,-106v-9,41,-15,85,-38,112v-16,4,-58,10,-48,-16v-10,-55,-38,-112,-49,-167v19,-21,67,-6,58,32r24,95r28,-124v11,-12,34,-20,44,-5v23,33,18,96,39,131r24,-131v9,-5,50,-9,50,10r-41,146v-4,28,-19,32,-47,36v-9,1,-21,-4,-21,-13","w":280,"k":{".":13,",":13}},"x":{"d":"8,-183v27,-28,85,3,87,40v1,4,3,6,5,9v9,-15,17,-30,29,-41v-11,-22,15,-17,31,-17v20,0,32,13,15,23v-4,25,-31,46,-43,68v15,32,46,59,55,94v-16,12,-68,7,-68,-18v-7,-7,-17,-20,-22,-28v-20,16,-18,67,-66,55r1,1v-44,-12,8,-35,14,-56r27,-40v-16,-34,-47,-58,-65,-90"},"y":{"d":"38,36v24,7,45,-23,28,-43r-41,-131v-6,-11,-20,-36,-19,-48v0,-10,19,-11,21,-2v24,-11,44,9,39,33v9,33,22,62,39,97v12,-41,28,-79,35,-126v3,-13,23,-3,32,-7v43,4,-3,45,-1,67v-19,55,-34,113,-59,162v-4,35,-40,40,-71,44v-16,2,-8,-21,-14,-33v0,-4,6,-11,11,-13","k":{".":27,",":27}},"z":{"d":"71,-47v45,18,100,-26,100,36v-25,23,-103,9,-152,14v-30,-23,1,-68,22,-81r56,-69v-20,-9,-55,6,-68,-8v-16,8,-17,-13,-16,-32v25,-25,100,7,138,-9v22,0,18,29,16,45v-18,23,-37,53,-59,68v-14,10,-28,22,-37,36","w":180},"?":{"d":"43,-175v-33,6,-20,-30,-7,-46v18,-21,39,-45,74,-41v48,5,100,30,86,92v-9,37,-49,50,-55,88v-9,14,-39,10,-56,5v-8,-33,16,-64,41,-76v24,-12,23,-65,-12,-65v-29,0,-30,24,-35,42v-13,4,-22,-1,-36,1xm142,-27v7,31,-43,31,-57,19v-21,-40,26,-59,57,-42v2,9,0,8,0,23","w":219},"\"":{"d":"53,-246v0,31,0,109,-36,81v-3,-25,-16,-45,-12,-69v-8,-13,2,-28,17,-20v11,-7,31,-9,31,8xm119,-248v-1,34,4,99,-31,89v-19,-5,-2,-25,-14,-39v-7,-23,-16,-70,20,-57v10,-6,22,-3,25,7","w":170},"'":{"d":"14,-251v11,-14,27,0,45,-3v28,18,-5,63,-2,89v-14,17,-44,5,-34,-25v-7,-17,-11,-48,-9,-61","w":85},"\u00a0":{"w":100}}});
// JavaScript Document
function initCufon () {
var elements = new Array (
'#nav li a',
'h2',
'h3',
'.subnavTabs li',
'.teaser',
'.bookNow',
'.eventArchive a',
'.expandingboxInner a.slick-toggle',
'.associatedevents h4',
'.mediaCaptionTitle',
'.cufon-text'
);
/* use element array instead of string! tab font color goes skewiff otherwise (weird but true) */
if ($('.cufon-alt').html()) Cufon.refresh(elements,{forceHitArea:true});
else Cufon.replace(elements, {forceHitArea:true} );
}
$(document).ready(function () { initCufon(); });
// JavaScript Document
// Author: Wagner
// 25/06/2009
var formHasBeenCleared = false;
// go through all form fields and clear the value, if they start with 'enter' or 'please'
function clearAllDefaultsFromTextFields () {
$("form input:text, form textarea").each(function () {
if ( $(this).val().toLowerCase().substring(0,5)=="enter" || $(this).val().toLowerCase().substring(0,6)=="please" ) {
$(this).val("");
}
});
}
// give all text fields a focus action, so that when they are focussed on, they trigger the command to go through all fields as above
$(document).ready (function () {
$("form input:text, form textarea").each(function () {
// on blur, go through all text fields, and if they start 'Please or enter', clear them
$(this).focus(function () {
if (formHasBeenCleared == false) {
// clear all form text elements
clearAllDefaultsFromTextFields();
formHasBeenCleared = true;
}
});
});
});
var currentAudio = null;
function audioPlayerPlay ( className, trackName, trackAudio ) {
var $audioWidget = $(".audioPlayer");
$("#flashAudioPlayer",$audioWidget).remove();
var $flashHolder = $('
');
//$flashHolder.css('height',113);
//$flashHolder.css('width',187);
$flashHolder.flash({ // test_flashvars.swf is the flash document
swf: '/audioPlayer/audioPlayer.swf',
height: 70,
width: 600,
bgcolor: '#e5e5e5',
flashvars: { mp3: trackAudio, mp3Name: trackName }
});
$('.audioPlayerInner',$audioWidget).prepend($flashHolder);
// save the played one
currentAudio = className;
// lastly go through the links and set the current active and the others inactive
$('li',$audioWidget).each (function (){
if ($(this).hasClass(className) ) {
$(this).addClass('active');
} else {
$(this).removeClass('active');
}
});
}
function audioPlayerNext () {
}
$(document).ready(function () {
if ($.hasFlashPlayerVersion(8)) {
$(".audioPlayer").each(function () {
// insert a new div to hold the flash before the list
// add a new class to make the audioPlayer taller
$(this).addClass('hasFlashAudioPlayer');
$('h3',this).remove();
// find the first li, make it active, and play the audio
var $firstLi = $('li:first .cufon-text',this);
$currentAudio = $firstLi;
var trackName = $('a',$firstLi).text();
var trackAudio = $('a',$firstLi).attr('href');
// then make all li s into links that play audio
var i = 1;
$('li',this).each (function (){
// make the click action go to a function
var $a = $('a',this);
$a.attr('href','javascript:audioPlayerPlay("ap'+i+'","'+escape($a.text().replace(/play track/,''))+'","'+$a.attr('href')+'");');
$(this).addClass('ap'+i);
i++;
});
audioPlayerPlay ( 'ap1',escape(trackName), trackAudio );
});
}
});
// JavaScript Document
function startTabs() {
// page to effectItOn
var params = getParams('tabs');
//alert(params);
//for (var p in params) {
// alert(p+': '+params[p]);
//}
var anchorAvoid = '-';
// var $page = $('body.products');
var $currentTabLink = null;
var i = 0;
var callBackFunction = eval(params.callBack);
//var callBackVar = eval(params.callBackVar);
var effectCallBackFunction = eval(params.effectCallBack);
var pageURL = document.location.toString();
var activeItem='';
// get anchor
if (pageURL.match('#')) activeItem = pageURL.replace(anchorAvoid,'').split('#').pop();
//alert(activeItem);
// hide all tabs
$('.tab').css('display','none');
$(params.tabSelector).each(function () {
// use 'bookmarked' item, else default to first link!
// change the href so that it has 'goto' after the hash to stop page bouncing with the anchors
$('a',this).attr('href', $('a',this).attr('href').replace('#','#'+anchorAvoid) );
if (i == 0) {
if (activeItem=='') {
$(this).addClass('active');
$currentTabLink = $('a',this);
} else {
$currentTabLink = $(params.tabSelector+' a.'+activeItem);
$($currentTabLink).parent().addClass('active');
}
//alert($currentTabLink.attr('class'));
// set attributes and show current tab
$('body').addClass('tab_'+$currentTabLink.attr('class'));
//window.location.hash='#'+$currentTabLink.attr('class');
var myTargetTab = '.tab.'+$($currentTabLink).attr('href').replace('#'+anchorAvoid,'').replace('#','');
//alert(myTargetTab);
$(myTargetTab).css('display','block');
}
// reset scroll, if any
//window.scrollTo(0,0);
// then set up a click action that goes through all the other tabs and turns them off
$('a',this).click(function () {
if ($(this).parent().hasClass('active')==false) {
var $newTabLink = $(this);
var $newTargetTab = $('.tab.'+$newTabLink.attr('href').replace('#'+anchorAvoid,''));
if ($currentTabLink != null) {
var $currentTab = $('.tab.'+$currentTabLink.attr('href').replace('#'+anchorAvoid,''));
$currentTabLink.parent().removeClass('active');
effectCallBackFunction($currentTab,$newTargetTab,params);
// remove previous body class
$('body').removeClass('tab_'+$currentTabLink.attr('class'));
$currentTabLink = $newTabLink;
$newTabLink.parent().addClass("active");
// and put a new body class on
$('body').addClass('tab_'+$newTabLink.attr('class'));
// REPLACE WITH CALLBACK CODE
if(callBackFunction) callBackFunction(params.callBackVar);
// return false;
}
}
});
i++;
});
// REPLACE WITH CALLBACK CODE
if(callBackFunction) callBackFunction(params.callBackVar);
}
function slideEffect($currentTab, $newTargetTab, params) {
$currentTab.slideUp(parseFloat(params.effectInSpeed), function() {
// needs to be callback AFTER slide up, else animation is uneven
$newTargetTab.slideDown(parseFloat(params.effectOutSpeed));
});
}
function fadeEffect($currentTab, $newTargetTab, params) {
$currentTab.fadeOut(parseFloat(params.effectInSpeed), function() {
// needs to be callback AFTER slide up, else animation is uneven
$newTargetTab.fadeIn(parseFloat(params.effectOutSpeed));
});
}
$(document).ready(function () {
var JSONdefaults = new Object({"template": "whatson",
"tabSelector": "ol.subnavTabs li",
"effectCallBack": "slideEffect",
"effectInSpeed": "400",
"effectOutSpeed": "600",
"callBack": "",
"callBackVar": ""
});
// php generated overrides
var JSONParameters={"template":"subtablechoice","callBack":"initCufon","callBackVar":".subnavTabs li"};
var params = getParams( 'tabs', JSONdefaults, JSONParameters );
//var param=getParams( 'adjustCssForRes');
var pageToActOn = params.template.split(",");
for (var i=0;i