$(document).ready(function() { jQuery(function() { /*test if there's an advertorial cell at all*/ var advt = false; if (($('#spotlight .sponsorSlice').html()) != '') { advt = true; } /*if there is slice content, test & parse the cell contents*/ if (advt) { /*test to see if any cell has video content, corrected video content and link nodes*/ var vplayer = $("#spotlight .ssBody .grid div.img a[href^='javascript']"); var corrected = $("#spotlight .ssBody .grid div.img a[href^='/id/']"); var icoVid = $("#spotlight .ssBody .grid div.text h6 a.icoVid"); var linkVid = $("#spotlight .ssBody .grid div.text h6 a[class!='icoVid']"); /*if there is a correction for each video, grab the href around the image and apply it to the text URL*/ if (vplayer.length > 0 && vplayer.length == corrected.length) { for (var i = 0; i < icoVid.length; i++) { var corr_url = corrected.slice(i,i+1).attr("href"); var ico_url = icoVid.slice(i,i+1).attr("href"); var link_url = linkVid.slice(i,i+1).attr("href"); icoVid.slice(i,i+1).attr("href",corr_url); linkVid.slice(i,i+1).attr("href",corr_url); } } } else {} }); })