//********************** Site Variables */
var eventName = "frop";
var siteURL = "www.rolandgarros.com";
//var lang = "";
var infoImg = new Image();
var staticSB = 0;
var ptOn = 0;
var sbOn = 1;
var ajaxRefresh = 300000;
var newsRefresh = 900000;
var messageRefresh = 900000;
var sumScoreboardYear = 2007;
var sumScoresServer = "/";
var sumScoresWait = 3000;
var sumScoresError_e = "Please check back later for live, completed, and upcoming match information.";
var sumScoresError_f = "Veuillez consulter cette page ult&eacute;rieurement pour le direct, les r&eacute;sultats et les infos des matchs &agrave; venir.";
var sumScoresError_s = "Vuelve m&aacute;s tarde para consultar la informaci&oacute;n de los partidos (en juego, terminados y pr&oacute;ximos). ";
var noVideo_en_FR = "There are no videos available at the moment.";
var noVideo_fr_FR = "Aucune vid&eacute;o n'est disponible en ce moment.";
var noVideo_es_FR = "Ning&uacute;n v&iacute;deo n' est&aacute; disponible actualmente.";
//********************** Content Shedding Variables */
var useFlashNewsApp = true;
/***************************** shop navigation for all sites except RG */
/*function openShopExternal(){
url = "http://www.australianopenshop.com";
openExternal(url,true);
}
function openShop(){
//location.href="/en_AU/shop/index.html";
openShopExternal();
}*/
/***************************** Shop navigation for RG */
function openShop(){
if(lang=="en_FR") {shopUrl = "http://fr.sitestat.com/madeinsport/rg/s?1WSRG.linkstore.en&amp;ns_campaign=1WSRG.linkstore.en&amp;ns_mchannel=ppc&amp;ns_source=1WSRG&amp;ns_linkname=1WSRG.linkstore.en&amp;ns_fee=0.00&amp;ns_type=clickin";}
if(lang=="es_FR") {shopUrl = "http://fr.sitestat.com/madeinsport/rg/s?1WSRG.linkstore.es&amp;ns_campaign=1WSRG.linkstore.es&amp;ns_mchannel=ppc&amp;ns_source=1WSRG&amp;ns_linkname=1WSRG.linkstore.es&amp;ns_fee=0.00&amp;ns_type=clickin";}
if(lang=="fr_FR") {shopUrl = "http://fr.sitestat.com/madeinsport/rg/s?1WSRG.linkstore.fr&amp;ns_campaign=1WSRG.linkstore.fr&amp;ns_mchannel=ppc&amp;ns_source=1WSRG&amp;ns_linkname=1WSRG.linkstore.fr&amp;ns_fee=0.00&amp;ns_type=clickin";}
openExternal(shopUrl,true);
}
//********************** IBM links and function to open */
//var ibmRibbonLink_en = "http://www.ibm.com/ibm/ideasfromibm/us/smartplanet/index.shtml";
//var ibmRibbonLink_fr = "http://www-05.ibm.com/fr/smarterplanet/";
//var ibmRibbonLink_es = "http://www-05.ibm.com/es/smarterplanet/";
//var ibmRibbonLink_en = "http://www-05.ibm.com/innovation/uk/think/index.html?ca=neiotuk_smart_planet-20090128&me=a&met=rolandgarrost&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-neiotuk_smart_planet-20090128";
//var ibmRibbonLink_fr = "http://www-05.ibm.com/innovation/fr/think/index.html?ca=swiotfr_smart_planet-20090128&me=a&met=rolandgarros&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-swiotfr_smart_planet-20090128";
//var ibmRibbonLink_es = "http://www.ibm.com/es/";
var ibmRibbonLink_en = "http://www.ibm.com/innovation/fr/rolandgarros/en/index.html?ca=neiotuk_rg-q22010&me=a&met=fft_top_right&re=rg";
var ibmRibbonLink_fr = "http://www.ibm.com/innovation/fr/rolandgarros/?ca=swiotfr_rg-q22010&me=a&met=fft_top_right&re=rg";
var ibmRibbonLink_es = "http://www.ibm.com/innovation/fr/rolandgarros/es/index.html?ca=swiotes_rg-q22010&me=a&met=fft_top_right&re=rg";
//var ibmTechLink_en = "http://www-03.ibm.com/innovation/grandslam/en/index.html?ca=neiotuk_itm-20080509&me=a&met=rolandgarros_technologylink&re=rg_uk&s_tact=&cm_mmc=-_-b-_-rolandgarros_technologylink-rg_uk-_-neiotuk_itm-20080509";
//var ibmTechLink_fr = "http://www-03.ibm.com/innovation/grandslam/fr/index.html?ca=swiotfr_itm-20080509&me=a&met=rolandgarros_technologylink&re=rg_fr&s_tact=&cm_mmc=-_-b-_-rolandgarros_technologylink-rg_fr-_-swiotfr_itm-20080509";
//var ibmTechLink_es = "http://www-03.ibm.com/innovation/grandslam/es?ca=swiotes_rg-20080509&me=a&met=rolandgarros_technologylink&re=rg_es&s_tact=&cm_mmc=-_-b-_-rolandgarros_technologylink-rg_es-_-swiotes_itm-20080509";
//var ibmTechLink_en = "http://www-05.ibm.com/innovation/uk/think/index.html?ca=neiotuk_smart_planet-20090128&me=a&met=rolandgarrost&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-neiotuk_smart_planet-20090128";
//var ibmTechLink_fr = "http://www-05.ibm.com/innovation/fr/think/index.html?ca=swiotfr_smart_planet-20090128&me=a&met=rolandgarros&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-swiotfr_smart_planet-20090128";
//var ibmTechLink_es = "http://www.ibm.com/es/";
var ibmTechLink_en = "http://www.ibm.com/innovation/grandslam/en/";
var ibmTechLink_fr = "http://www.ibm.com/innovation/fr/rolandgarros";
var ibmTechLink_es = "http://www.ibm.com/innovation/grandslam/es/";
//var ibmLogoLink_en = "http://www-05.ibm.com/innovation/uk/think/index.html?ca=neiotuk_smart_planet-20090128&me=a&met=rolandgarrost&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-neiotuk_smart_planet-20090128";
//var ibmLogoLink_fr = "http://www-05.ibm.com/innovation/fr/think/index.html?ca=swiotfr_smart_planet-20090128&me=a&met=rolandgarros&re=smart_planet&s_tact=&cm_mmc=p-_-ribbon-smart_planet-_-swiotfr_smart_planet-20090128";
//var ibmLogoLink_es = "http://www.ibm.com/es/";
var ibmLogoLink_en = "http://www.ibm.com/innovation/fr/rolandgarros/en/index.html?ca=neiotuk_rg-q22010&me=a&met=fft_bottom_left&re=rg";
var ibmLogoLink_fr = "http://www.ibm.com/innovation/fr/rolandgarros/?ca=swiotfr_rg-q22010&me=a&met=fft_bottom_left&re=rg";
var ibmLogoLink_es = "http://www.ibm.com/innovation/fr/rolandgarros/es/index.html?ca=swiotes_rg-q22010&me=a&met=fft_bottom_left&re=rg";
//var ibmScenesLink_en = "http://www-03.ibm.com/innovation/grandslam/en/index.html?ca=neiotuk_itm-20080509&me=a&met=rolandgarros_behindthescene_button&re=rg_uk&s_tact=&cm_mmc=-_-b-_-rolandgarros_behindthescene_button-rg_uk-_-neiotuk_itm-20080509";
//var ibmScenesLink_fr = "http://www-03.ibm.com/innovation/grandslam/fr/index.html?ca=swiotfr_itm-20080509&me=a&met=rolandgarros_behindthescene_button&re=rg_fr&s_tact=&cm_mmc=-_-b-_-rolandgarros_behindthescene_button-rg_fr-_-swiotfr_itm-20080509";
//var ibmScenesLink_es = "http://www-03.ibm.com/innovation/grandslam/es?ca=swiotes_rg-20080509&me=a&met=rolandgarros_behindthescenes_button&re=rg_es&s_tact=&cm_mmc=-_-b-_-rolandgarros_behindthescene_button-rg_es-_-swiotes_itm-20080509";
var ibmScenesLink_en = "http://www.ibm.com/innovation/grandslam/en/";
var ibmScenesLink_fr = "http://www.ibm.com/rolandgarros/";
var ibmScenesLink_es = "http://www.ibm.com/innovation/grandslam/es/";
function openIBMRibbon(ribbonLang,promo){
var extraQS = "";
if (promo){
extraQS = promo;
}
if (ribbonLang.indexOf("en") == 0){ openExternal(ibmRibbonLink_en + extraQS,true); }
else if (ribbonLang.indexOf("fr") == 0){ openExternal(ibmRibbonLink_fr + extraQS,true); }
else if (ribbonLang.indexOf("es") == 0){ openExternal(ibmRibbonLink_es + extraQS,true); }
}
function openIBMTech(ribbonLang,promo){
var extraQS = "";
if (promo){
extraQS = promo;
}
if (ribbonLang.indexOf("en") == 0){ openExternal(ibmTechLink_en + extraQS,true); }
else if (ribbonLang.indexOf("fr") == 0){ openExternal(ibmTechLink_fr + extraQS,true); }
else if (ribbonLang.indexOf("es") == 0){ openExternal(ibmTechLink_es + extraQS,true); }
}
function openIBMlogo(ribbonLang,promo){
var extraQS = "";
if (promo){
extraQS = promo;
}
if (ribbonLang.indexOf("en") == 0){ openExternal(ibmLogoLink_en + extraQS,true); }
else if (ribbonLang.indexOf("fr") == 0){ openExternal(ibmLogoLink_fr + extraQS,true); }
else if (ribbonLang.indexOf("es") == 0){ openExternal(ibmLogoLink_es + extraQS,true); }
}
function openIBMScenes(ribbonLang,promo){
var extraQS = "";
if (promo){
extraQS = promo;
}
if (ribbonLang.indexOf("en") == 0){ openExternal(ibmScenesLink_en + extraQS,true); }
else if (ribbonLang.indexOf("fr") == 0){ openExternal(ibmScenesLink_fr + extraQS,true); }
else if (ribbonLang.indexOf("es") == 0){ openExternal(ibmScenesLink_es + extraQS,true); }
}
//for loading videos in hidden iframe, prevents new window from opening
function loadVideo(vidFile){
frames['videoLaunch'].location.href = vidFile;
}
/************************ Jquery functions */
$(document).ready(function(){
if (document.all){$("#nav_e li").hoverClass ("over");}
if (document.all){$("#nav_f li").hoverClass ("over");}
if (document.all){$("#nav_s li").hoverClass ("over");}
if (document.all){$("#bottom").hoverClass ("over");}
if (document.all){$("#multimediaNav li").hoverClass ("over");}
var path = location.pathname.substring(0);
$('#nav_e a[href$="' + path + '"]').parents("li").addClass('active');
$('#nav_e a[href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
$('#nav_f a[href$="' + path + '"]').parents("li").addClass('active');
$('#nav_f a[href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
$('#nav_s a[href$="' + path + '"]').parents("li").addClass('active');
$('#nav_s a[href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
$('#multimediaNav a[href$="' + path + '"]').parents("li").addClass('active');
$('#multimediaNav a[href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
//jquery code for image rollovers
$("img.rollover").hover(
function(){this.src = this.src.replace("_off","_on");},
function(){this.src = this.src.replace("_on","_off");}
);
//jquery code for selected state
$("img.widgetButton").click(function(){
$("img.widgetButton").each(function(){this.src = this.src.replace("_on","_off");});
this.src = this.src.replace("_off","_on");
});
//jquery code for selected state
$("#multimediaNav_e li a").click(function(){
$("#multimediaNav_e li a").each(function(){this.className = this.className.replace("active","");});
this.className = this.className.replace("","active");
});
//jquery code for selected state
$("#multimediaNav_f li a").click(function(){
$("#multimediaNav_f li a").each(function(){this.className = this.className.replace("active","");});
this.className = this.className.replace("","active");
});
//jquery code for selected state
$("#multimediaNav_s li a").click(function(){
$("#multimediaNav_s li a").each(function(){this.className = this.className.replace("active","");});
this.className = this.className.replace("","active");
});
//jquery code for photo gallery rollovers
$("#galleryIndex ul li").hover(
function() {$(this).removeClass('bg2');$(this).addClass('bg7');},
function() { $(this).removeClass('bg7');$(this).addClass('bg2'); }
);
//jquery code for alternating rows
$('table.striped tr:even').addClass('bg2');
//jquery code for multimedia side index
$("#multiIndexNav ul li").click(
function() {
$("#multiIndexNav ul li").each(function(){$(this).removeClass('multiIndexSelected')});
});
//jquery code to fix columns in daily summary page
$('#dailySummaryContainer #articleSection ul.newsListing li:even').css('clear','left');
// initialize full background image
initBackground();
});
//jquery code for top navigation
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover(
function() { $(this).addClass(c); },
function() { $(this).removeClass(c); }
);
});
};
/**************************** Language Detect */
//var lang;
//var site = location.pathname;
//if (site.indexOf("/en_FR/") == 0){
// lang = "en_FR";
//} else if (site.indexOf("/fr_FR/") == 0) {
// lang = "fr_FR";
//} else if (site.indexOf("/es_FR/") == 0) {
// lang = "es_FR";
//} else if (window.defaultLang){
// lang = defaultLang;
//}
//******************************/
// measurement function to measure uptime. Used in conjunction with uptime.js
//******************************/
function uptimeMeasure(info){
var page = "";
var refPage = escape(document.location.href);
var randomnumber=Math.floor(Math.random()*9999999999);
var ck = "";
ck = getCookie("sauid");
page = escape(info);
}
/**********************************************************************/
//Measurement Functions
/***********************************************************************/
// Measurement stuff:
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) { return null; }
} else { begin += 2; }
var end = document.cookie.indexOf(";", begin);
if (end == -1) { end = dc.length; }
return unescape(dc.substring(begin + prefix.length, end));
}
//*****************************/
// measurement function for flash shop app
// @param lang - lang of app, "en_US", "fr_FR", etc...
// @param subapp - which app (home or sublevel) is being viewed
// @param action - click type
//*****************************/
function shopAppMeasure(lang,subapp,action){
var page = "";
var refPage = "http://" + siteURL + "/" + lang + "/index.html";
var randomnumber=Math.floor(Math.random()*9999999999);
var ck = "";
ck = getCookie("sauid");
//page = escape("/" + lang + "/shopapp_" + subapp + "_" + action + ".html");
measureApp(subapp,action);
}
/**********************************************************************/
//Launch Functions
/***********************************************************************/
//***************launch flash scoreboard********************************/
var ttWindow = "";
var launchPage;
var ttWindowHeight;
function launchTT(lang,view,crt,syn,debug){
if (hasReqestedFlashVersion && NPRuntime){
if (view == "draw"){
ttWindowHeight = 665;
}
else{
ttWindowHeight = 665;
}
launchPage = "/en_FR/tracker/ttFrame.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_FR";
launchPage += (syn)?"&syn="+syn:"&syn=none";
launchPage += "&wh=" + ttWindowHeight;
launchPage += "&mode=" + view;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
launchPage += (crt)?"&crt="+crt:"&crt=none";
//alert(launchPage);
if (ttWindow.closed || ttWindow==""){
ttWindow = window.open(launchPage,"ttWindow","width=850,height=" + ttWindowHeight + ",top=0,left=0,statusbar=0")
if (ttWindow.opener == null) ttWindow.opener=self;
}
ttWindow.focus();
}
else{
// document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
document.location.href = "/" + lang + "/scores/index.html";
}
}
//***************launch visual match********************************/
var vmWindow = "";
var vmLaunchPage;
var vmWindowHeight;
function launchVM(lang,match,debug){
if (hasReqestedFlashVersion && NPRuntime){
vmWindowHeight = 510;
launchPage = "/en_FR/momentum/vmMain.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_FR";
launchPage += "&wh=" + vmWindowHeight;
launchPage += "&match=" + match;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
//alert(launchPage);
if (vmWindow.closed || vmWindow==""){
vmWindow = window.open(launchPage,"vmWindow","width=810,height=" + vmWindowHeight + ",top=0,left=0,statusbar=0")
if (vmWindow.opener == null) vmWindow.opener=self;
}
vmWindow.focus();
}
else{
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
function launch(which,crt){
var loc = "";
var loc2 = "";
var sbLang;
var url = location.pathname;
if (!which){
which = 'score';
}
loc = "/"+lang+"/ibmrealtime/index.html";
loc2 = "/"+lang+"/scores/index.html";
loc3 = "/"+lang+"/scores/draws/ms/index.html";
// Disabled until ready
launchTT(lang,which,crt,'','');
// Disable until pre/post
/*
if (which == "score"){
document.location.href = loc2;
}
else if (which == "draw"){
document.location.href = loc3;
}
else{
document.location.href = loc;
}
*/
}
/***************************** media console launch */
var consoleWindow = "";
var consolelaunchPage;
var mcWindowHeight = 522; //minimized with no ad
//tab values - "interviews","highlights","archives","radio"
function launchMC(targetLink,tab,lang,debug){
if (hasReqestedFlashVersion){
consolelaunchPage = "/en_FR/multimedia/console/mflash.html?";
consolelaunchPage += "targetLink="+escape(targetLink);
//consolelaunchPage += "&tab="+tab;
consolelaunchPage += "&lang="+lang;
consolelaunchPage += "&localisIE="+isIE;
if(debug){
consolelaunchPage += "&debug=true";
}
//alert(consolelaunchPage);
if (consoleWindow.closed || consoleWindow==""){
consoleWindow = window.open(consolelaunchPage,"consoleWindow","width=510,height=" + mcWindowHeight + ",top=50,left=50")
if (consoleWindow.opener == null) consoleWindow.opener=self;
} else {
//function to set new movie in exisiting console:
consoleWindow.setNewMovie(targetLink,tab,lang);
}
consoleWindow.focus();
}
else {
//user doesn't have flash8:
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
/***************************** radio console launch */
var radioWindow = "";
var radiolaunchPage;
function launchRadio(debug){
var radioLaunchPage = "/en_FR/multimedia/radio/radio.html?";
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
radioLaunchPage += "ts=" + t;
radioLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
radioLaunchPage += "&ref=" + document.location.host + document.location.pathname;
radioLaunchPage += "&lang=" + lang;
if (radioWindow.closed || radioWindow==""){
//consoleWindow = window.open(consolelaunchPage,"consoleWindow","width=510,height=" + mcWindowHeight + ",top=50,left=50")
radioWindow = window.open(radioLaunchPage,"radioWindow","width=420,height=185,top=50,left=50");
if (radioWindow.opener == null) radioWindow.opener=self;
}
radioWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
/*** new getScript allows you to specify caching ****/
$.getScript = function(url, callback, cache){
$.ajax({
type: "GET",
url: url,
success: callback,
dataType: "script",
cache: cache,
async:false
});
};
/**********************************************************************
These functions manipulate the background image when resizing the
browser window
**********************************************************************/
function initBackground() {
$(window).resize(backgroundResizeHandler);
$(window).trigger('resize');
};
var backgroundResizeHandler = function() {
// add the background if it does not exists (typically this is only for the home page)
if(browser.isIPad || browser.isIPhone) {
if($('#background').length == 0 && latestImageFile != "") {
//alert("no background found " + $('#background').length + "<");
// create background div
var bg = document.createElement("div");
bg.setAttribute("id","background");
bg.setAttribute("class", "vertical");
// create image
var bgImg = document.createElement("img");
bgImg.setAttribute("src", latestImageFile);
bg.appendChild(bgImg);
document.body.insertBefore(bg, document.getElementById("footer"));
}
}
// If the inital image isn't cached, it'll report 0 dimensions.
if ($('#background img').height() == 0 || $('#background img').width() == 0) {
setTimeout(function() { $(window).trigger('resize'); }, 100);
return;
}
// ipad
var landscape = false;
if(browser.isIPad || browser.isIPhone) {
landscape = (window.orientation % 180) ? true : false;
if (!$('#background').addClass('vertical')) {
$('#background').addClass('vertical').removeClass('horizontal');
}
$('#background img').css('marginLeft', -1 * parseInt($('#background img').width() / 2));
}
// everything else
else {
if ($('#background').hasClass('horizontal')) {
if ($('#background img').height() < $('#background').height()) {
$('#background').addClass('vertical').removeClass('horizontal');
//$('#background img').css('marginLeft', -1 * parseInt($('#background img').width() / 2));
}
} else {
if ($('#background img').width() < $('#background').width()) {
$('#background').addClass('horizontal').removeClass('vertical');
$('#background img').css('marginLeft', 0);
}
}
}
};
/********
* get current server time
*/
var serverTime="";
var venueTime=""
$.ajax( {
url :'/date',
type :'GET',
dataType :'html',
timeout :1000,
async : false,
error : function() {
// alert('Error loading XML document');
},
success : function(txt) {
serverTime = txt;
}
});
//Splits a single list into a number of lists, which can be styled into a multicolumn list.
//
// usage $("#my_list_id").columns(n);
// - Splits the list with id "my_list_id" into n columns.
//
// The lists will be nested inside an unordered list whose id is the same as the original list's.
// Note that the original list will be deleted.
//
// Parameters:
// numberOfColumns: the number of columns to split the list into.
// padIncompleteColumns: If set to true, and the source list does not contain enough items to 
// completely fill the last column, the plugin will pad that column with
// <li>&nbsp;</li>.
//
jQuery.fn.columns = function(numberOfColumns, padIncompleteColumns) {
return this.each(function () {
var $this = jQuery(this);
var targetId = $this.attr("id");
$this.attr("id", targetId + "_src");
var container = "<ul id=\"" + targetId + "\"></ul>";
$this.after(container);
target = $this.next();
// Create some sublists in the new list. We'll need as many as we have columns.
createSubLists(target, numberOfColumns);
// Move the contents of the old list into the new ones.
splitList(jQuery("li", $this), jQuery("ul", target), numberOfColumns, padIncompleteColumns);
// Apply styles to alternating columns.
applyStyle(jQuery("ul", target), "even", "odd");
// Remove the old list from the DOM.
$this.remove();
});
function createSubLists(container, numberOfSublists) {
for (i = 0; i < numberOfSublists; i++)
container.append("<ul></ul>");
}
function splitList(source, target, numberOfColumns, padIncompleteColumns) {
column = 0;
counter = 0;
// Determine how many items we need to stuff in each column to reach the full number.
itemsPerColumn = Math.ceil(source.length / numberOfColumns);
source.each(function (i) {
// Select the columns and put the list item in the current one.
target[column].appendChild(this);
counter++;
if (counter == itemsPerColumn) {
// We've filled one column, move to the next.
column ++;
counter = 0;
}
});
// If we can't fill up the columns, add more items.
if (counter != 0 && padIncompleteColumns)
while (counter < itemsPerColumn) {
jQuery(target[column]).append("<li>&nbsp;</li>");
counter++;
}
}
// Applies the even style to even numbered columns, and the odd style to odd numbered columns.
function applyStyle(columns, even, odd) {
columns.each(function (i) {
// We're using i+1 because the index is 0 based, so the 1st column is 0, etc.
// If we don't do this, then the odd/even columns would be inverted (eg. column index 2 is actually the third visible column).
jQuery(this).addClass(((i+1) % 2) == 0
? even
: odd);
});
}
}
/****
* Cufon replacement
*/
Cufon.replace('.rgLinkText'); // Works with a selector engine
Cufon.replace('.rgLinkTextBlack'); // Works with a selector engine
Cufon.replace('.rgLinkTextDown'); // Works with a selector engine
Cufon.replace('.rgLinkTextDownBlack'); // Works with a selector engine
Cufon.replace('.rgLinkTextUp'); // Works without a with engine
Cufon.replace('.rgText');
