(function() { // Localize jQuery variable var jQuery; /******** Load jQuery if not present *********/ if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { var script_tag = document.createElement('script'); script_tag.setAttribute('type','text/javascript'); script_tag.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); script_tag.onload = scriptLoadHandler; script_tag.onreadystatechange = function () { // Same thing but for IE if (this.readyState == 'complete' || this.readyState == 'loaded') { scriptLoadHandler(); } }; // Try to find the head, otherwise default to the documentElement (document.getElementsByTagName('head')[0] || document.documentElement).appendChild(script_tag); } else { // The jQuery version on the window is the one we want to use jQuery = window.jQuery; main(); } /******** Called once jQuery has loaded ******/ function scriptLoadHandler() { // Restore $ and window.jQuery to their previous values and store the // new jQuery in our local jQuery variable jQuery = window.jQuery.noConflict(true); // Call our main function main(); } /******** Our main function ********/ function main() { jQuery(document).ready(function($) { /******* Load CSS *******/ /* var css_link = $('', { rel: 'stylesheet', type: 'text/css', href: '' }); css_link.appendTo('head'); */ /******* Load HTML *******/ var jsonp_url = 'http://newyork.nearsay.com/gadget_content/4695-G1-1327697406'; $.ajax({ dataType: 'jsonp', url: jsonp_url, success: function (data) { $('#nearsay_gadget-4695-G1-1327697406').html(data.html); /* $('.ab_widget_body_inner').fadeIn(); */ }, }); $('.gadget_deal_button-4695-G1-1327697406').live('click', function() { var current_deal_nid = $(this).attr('current_deal_nid'); var next_deal_nid = $(this).attr('next_deal_nid'); //fadeout fadein function $('#gadget-4695-G1-1327697406_deal-' + current_deal_nid).fadeOut('fast', function(){ $('#gadget-4695-G1-1327697406_deal-' + next_deal_nid).fadeIn('fast'); var next_next_deal = $('#gadget-4695-G1-1327697406_deal-' + next_deal_nid).attr('next_deal_nid'); $('.gadget_deal_button-4695-G1-1327697406').attr('current_deal_nid', next_deal_nid); $('.gadget_deal_button-4695-G1-1327697406').attr('next_deal_nid', next_next_deal); }); //fadeout fadein function }); //dealbuttonclick $('.gadget_business_logo').live('mouseover mouseout', function(event) { if (event.type == 'mouseover') { var nid = $(this).attr('nid'); $('#gadget_details-'+nid).css('display', 'block'); $('#gadget_details-inner-'+nid).fadeIn('fast'); } else { var nid = $(this).attr('nid'); $('#gadget_details-'+nid).css('display', 'none'); $('#gadget_details-inner-'+nid).css('display', 'none'); } }); //GOOGLE NETWORK: not sure how well this will work in iframe var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-17190531-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); //QUANTCAST: not sure how well this will work in iframe var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == 'https:' ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; elem.async = true; elem.type = 'text/javascript'; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); _qevents.push({ qacct:'p-beau88unv3E2c' }); }); } })(); // Call anonymous function immediately