$(document).ready(function(){	// add text to footer	//$("#footer div").append("<span>Copyright &copy; Zokem Ltd.</span>");		$("#footer div").append("<span>&copy; 2011 Arbitron Inc.</span>");		//	Resize the backround image	updateBackground = function() {		if ($("#background").is(':visible')) {			if ($(window).height() >= $(window).width()) {				$("#background").width($(window).width());				$("#background img").width($(window).height());				$("#background img, #background").height($(window).height());			}			else {				$("#background").height($(window).height());				$("#background img, #background").width($(window).width());				$("#background img").height($(window).width());			}			$("#background").show();		}	}	$(window).resize(function() {			updateBackground();	});// Distribute menu items// Calculate desired width -- SKIPPED TO OPTIMIZE SPEED	var desiredWidth = Math.round(100 / ($("#menu-main").children().length)) - 1;	$("#menu-main").children().css({		width: desiredWidth + "%",		visibility: "visible"	});// initiate menu selector    if ($("#menu-main .current_page_item").length == 0) {		var initialselectionpos = Math.round($("#menu-main:first-child a").position().left - 87 + $("#menu-main:first-child a").width() / 2);	}	else {		var initialselectionpos = Math.round($(".current_page_item>a").position().left - 87 + $(".current_page_item>a").width() / 2);	}	$("#menu-main").css({		backgroundPosition: initialselectionpos + "px 0",		visibility: "visible"	});		$("#menu-main li a").click(function() {		selectPage(this);		return false;	});		function selectPage(t, redirect) {		var targeturl = $(t).attr("href");		var firstPos = $(t).position().left;		var currwidth = $(t).width();		var selectionwidth = 87;		var selectLocation = Math.round(firstPos - selectionwidth + currwidth / 2);		$("#menu-main").animate({			backgroundPosition: [selectLocation, 0]		},function() {			$(window.location).attr('href', targeturl);		}		);	}// populate quicklinksif ($("#quicklinks")) {	$("#content h2").each(function () {		$("#quicklinks").append("<li>" + $(this).text() + "</li>");	});};// quicklink navigation$("#quicklinks li").click(function () {	var n = $("#quicklinks li").index(this);//	alert("#content h2:nth-child(" + n + ")");//	$.scrollTo("#content h2:nth-child(" + n + ")");	$.scrollTo("#content h2:eq(" + n + ")", 200 );});// draw initial background	updateBackground();	// end});// for the concept pagefunction roll(){	var stack = {	        delay: 600,	        actions:[],	        run: function() {	                if (stack.actions.length) {	                        stack.actions.shift()();	                        setTimeout(stack.run, stack.delay);	                        	                }	                	        }	};	$("#grid").children().each(function(){		var rapyla = $(this);						 stack.actions.push(function(){             $(rapyla).removeClass("grey").addClass("color").animate({             	 opacity:1             },stack.delay / 2);		 });					});	stack.actions.reverse();	stack.run();		}function move_pictos(clicked, clicked_picto){	var change_time = 200;	$("#pictogram-explained").children().each(function(){		if($(this).attr("id") == clicked){			$(this).slideDown(change_time);			//$(this).show();		}else{			$(this).hide();		}	});	$("#pictos").children().each(function(){		if($(this).attr("id") !== "threesixty-picto"){			if($(this).attr("id") == clicked_picto){				$(this).show();			}else{				if($(this).hasClass("colorish")){					$(this).hide();				}							}		}	});	}function init(){		var change_time = 400;	$("#grid").children().hover(			  function () {				  	$("#grid-tooltips").children("#" + $(this).attr("id") + "-tip").addClass("tooltip-hover");				  	$("#grid-tooltip-pointers").children("#" + $(this).attr("id") + "-tip-pointer").addClass("hoveri");				  },				  function () {					  $("#grid-tooltips").children("#" + $(this).attr("id") + "-tip").removeClass("tooltip-hover");					  $("#grid-tooltip-pointers").children("#" + $(this).attr("id") + "-tip-pointer").removeClass("hoveri");				  }				).click( function (e) {										var clicked = $(this).attr("id") + "-expl";					var clicked_picto = $(this).attr("id") + "-picto-color";										move_pictos(clicked, clicked_picto);										e.preventDefault();																});		$("#threesixty-picto").click(function(e){		move_pictos("threesixty-expl", "threesixty-picto");		e.preventDefault();	});		$("#grid-tooltips").children().hover(			  function () {				    var hoveri = $(this).attr("id").slice(0, -4);				  	$("#" + hoveri + "-tip").addClass("tooltip-hover");				  	$("#" + hoveri + "-tip-pointer").addClass("hoveri");				  },			  function () {					var hoveri = $(this).attr("id").slice(0, -4);					$("#" + hoveri + "-tip").removeClass("tooltip-hover");					$("#" + hoveri + "-tip-pointer").removeClass("hoveri");				  }				).click( function (e) {					var clicked = $(this).attr("id").slice(0, -4) + "-expl";					var clicked_picto = $(this).attr("id").slice(0, -4) + "-picto-color";															move_pictos(clicked,clicked_picto);					e.preventDefault();	});	}
