$(document).ready(function() {	/**	 * Need to do with using JS, so that the code is valid	 * Don't even need to worry about the unstyled flash, as this is hidden initially	 */	$('#headerNav ul').css('margin-top', '14px').css('padding-top', '0');		// And an IE7 fix as well	if($.browser.msie && $.browser.version == 7) $('#headerNav ul').css('margin-top', '24px');		/**	 * Need to add some additional classes and wraps to the tables	 */	if($('table').length > 0) {		$('table tr:first').html($('table tr:first').html().replace(/td/gi, 'th'));		$('table tr:odd').addClass('odd');	}			/**	 * Clear text fields on focus	 */	$('.clear-on-focus').focus(function() {		if(this.value == this.defaultValue) {			this.value = '';		}	}).blur(function() {		if(!this.value.length) {			this.value = this.defaultValue;		}	});			/**	 * The sliders for the footer text	 * When the more button is pressed, load the next slide	 * We have 3 seperate ones, one for each content area	 */	$('.homeFooterBox.media-evaluation .contents').cycle({		fx: 'scrollUp',		timeout: 0,		next: '#more-evaluation'	});	$('.homeFooterBox.media-monitoring .contents').cycle({		fx: 'scrollUp',		timeout: 0,		next: '#more-monitoring'	});	$('.homeFooterBox.press-releases .contents').cycle({		fx: 'scrollUp',		timeout: 0,		next: '#more-press'	});		/**	 * Add a line to seperate the intro text and listings on the news and resources page	 * We'll do this using JS, as otherwise, the line would appear on the inner listing pages as well	 */	if($('#listings-1').length > 0) {		$('.listing:first').css('border-top', '1px solid #999').css('padding-top', '20px');	}			/**	 * Add clears for IE7 A-Z listing	 */	$('.az-listing h2').each(function() {		$(this).before('<div class="clear">&nbsp;</div>');;	});		/**	 * Validation for "Keep in Touch"	 */	 $('#keep-in-touch').submit(function(event) {		var email = $('#keep-in-touch-email').val();				// Regex check for valid emails		var regex = /^([A-Za-z0-9_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;		if(regex.test(email) == false) {			// Invalid email			event.preventDefault();			$('#keep-in-touch-error').text("Sorry, please provide a valid email address").css('margin-top', '10px');		}	 });	 	/**	 * Tweets for the sidebar	 */	if($('#latest-tweets', '#homeRightCol').length > 0) {		$('#latest-tweets', '#homeRightCol').jTweetsAnywhere({			username: 'kantar_media',			count: 2		});	}		/**	 * Add Google Analaytics tracking code to all download links	 * Add the tracking code to each link which has a file	 * File types are set based on the extensions in the list below	 */	for(i in tracking_extensions) {		$('a[href$="' + tracking_extensions[i] + '"]').each(function() {			// We want the final URL to look like 			// <a href="http://www.example.com/files/map.pdf" onClick="javascript: _gaq.push(['_trackPageview', '/downloads/map');"> 			// Link: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55529			// The part after /download will be the file path on the server			$(this).attr('onClick', "\"javascript: _gaq.push(['_trackPageview', '/downloads" + this.pathname + "');\"");		});	}});
