var provOrder = new Array( 'BC', 'AB', 'SK', 'MB', 'ON', 'QC', 'NFL', 'NB', 'PEI', 'NS' );// name and coordinate data for provincesvar provData = (	{		'BC': { 'full': 'British Columbia', 'lat': 50, 'lng': -123 },		'AB': { 'full': 'Alberta', 'lat': 57, 'lng': -115 },		'SK': { 'full': 'Saskatchewan', 'lat': 50, 'lng': -105 },		'MB': { 'full': 'Manitoba', 'lat': 57, 'lng': -97.14 },		'ON': { 'full': 'Ontario', 'lat': 50, 'lng': -86 },		'QC': { 'full': 'Quebec', 'lat': 52.3, 'lng': -72.94 },		'NFL': { 'full': 'Newfoundland', 'lat': 54.5, 'lng': -59 },		'NB': { 'full': 'New Brunswick', 'lat': 48.004166, 'lng': -67 },		'NS': { 'full': 'Nova Scotia', 'lat': 44.353314, 'lng': -65.289001 },		'PEI': { 'full': 'Prince Edward Island', 'lat': 46.449685, 'lng': -62.019882 }	});var productLinks = (	{		'advantage': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=147&expandMenu_ID=249,247',		'advantage multi': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=187&expandMenu_ID=249,247,297',		'K9 Advantix': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=148&expandMenu_ID=249,247,297,250',		'Drontal': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=186&expandMenu_ID=249,247,297,250,248',		'Drontal Plus': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=186&expandMenu_ID=249,247,297,250,248',		'Profender': 'http://www.animalhealth.bayer.ca/profender/',		'Droncit': 'http://www.animalhealth.bayer.ca/display.cfm?Object_ID=303&Article_ID=186&expandMenu_ID=249,247,297,250,248'	});// override the default here if neededvar productLabels = (	{		'K9 Advantix': 'K9 advantix<sup>&reg;</sup>',		'Drontal Plus': 'Drontal<sup>&reg;</sup> Plus'	});// iconsvar parasiteIcons = (	{		// english		'roundworm': 'roundworm.gif',		'hookworm': 'hookworm.gif',		'tapeworm': 'tapeworm.gif',		'whipworm': 'whipworm.gif',		'fleas': 'flea.gif',		'heartworm': 'heartworm.gif',		'ear mites': 'ear_mite.gif',		'demodectic mange': 'd_mange.gif',		'Rocky Mountain wood tick': 'tick.gif',		'Brown dog tick': 'tick.gif',		'Blacklegged tick (Deer tick)': 'tick.gif',		'American dog tick': 'tick.gif',		'sarcoptic mange': 'mange_mite.gif',		'Western blacklegged tick': 'tick.gif',		'Lone star tick': 'tick.gif',				// french		"mites d'oreilles" : 'ear_mite.gif',		'puces': 'flea.gif',		'ver du coeur': 'heartworm.gif',		'ver en crochet': 'hookworm.gif',		'ver de rond': 'roundworm.gif',		'ver plat': 'tapeworm.gif',		'tique américaine du chien': 'tick.gif',		'tique am&eacute;ricaine du chien': 'tick.gif',		'tique à pattes noires (tique du chevreuil)': 'tick.gif',		'tique &agrave; pattes noires (tique du chevreuil)': 'tick.gif',		'tique brune du chien': 'tick.gif',		'démodicose': 'd_mange.gif',		'd&eacute;modicose': 'd_mange.gif',		"tique étoilée d'Amérique": 'tick.gif',		'gale sarcoptique': 'mange_mite.gif',		"tique d'Anderson": 'tick.gif',		'tique occidentale à pattes noires': 'tick.gif',		'ver en fouet': 'whipworm.gif'	});var map; // google map objectvar parasiteData;  // ajax resultsvar productData;  // ajax results// on document ready$( function(){	initPage();	initMap();	initEvents();});// hide noscript classes, display script classesfunction initPage(){	$('.noscript').hide();	$('.script').show();}// initialize google map objectfunction initMap(){	if (GBrowserIsCompatible()) {		map = new GMap2(document.getElementById("map"));		map.setCenter(new GLatLng(57, -93), 4);				map.addControl( new GMapTypeControl(), new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 15, 15 ) ) );		map.addControl( new GLargeMapControl(), new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 13, 45 ) ) );				map.enableScrollWheelZoom();		if( !ie6 )			map.enableContinuousZoom();	}else{		alert( "Unable to load Google Maps, incorrect API key or incompatible browser." );	}}// intialize event handlersfunction initEvents(){	$( '#closetab' ).click( function(){			$( '#panel' ).animate({	width: "0" });	} );	$( '#opentab' ).click( function(){		$( '#panel' ).animate({	width: "224px" });	} );	$( '.pets .radio' ).click( function(){		$( '.pets .radio' ).removeClass( 'on' ).each( function(){ this.src = this.src.replace( '-on', '-off' ) } );		this.src = this.src.replace( '-off', '-on' );		this.src = this.src.replace( '-hover', '-on' );		$(this).addClass( 'on' );		checkInputs();	} );	$( '.pets .radio' ).hover( 		function(){			this.src = this.src.replace( '-off', '-hover' );		},		function(){			this.src = this.src.replace( '-hover', '-off' );		}	);	$( '.step2 .age, .step3 .month' ).change( checkInputs );	$( '.step2 .age, .step3 .month' ).keypress( checkInputs );	$('#popup .close').click( function(){		$('#popup').hide();	});}// check panel inputs for validity and take appropriate action (get results, or clear existing)function checkInputs(){	var p = $('.pets .on').attr( 'alt' );	if( p ){		clearResults();		plotParasiteData( p );	}}// make ajax request to server for resultsfunction requestResults( p, a, m ){	$('body').addClass( 'waiting' );	m = escape( m ); // escape french chars in month name for URL	$.get( 		'../results.php', 		{ 			pet: p,			age: a,			month: m,			lang: lang		},		receiveResults,		'text'	);}// received results from serverfunction receiveResults( results, status ){	$('body').removeClass( 'waiting' );	if( status != 'success' ){		alert( 'Error receiving response from server.' );	}else{		clearResults();		processResults( results );	}}// process received ajax data (will be in JSON format)function processResults( results ){	var output = results + "\n\n";	var data = eval( '(' + results + ')' );	// JSON rocks	parasiteData = data.parasiteData;	productData = data.productData;	plotParasiteData( data.parasiteData );}// create icon windows to display all parasite data on mapfunction plotParasiteData( petName ){	var prov, provID, pdfFile;	for( var i in provOrder ){		prov = provOrder[ i ];		if( !provData[ prov ] ) continue;		provID = provIndex[ provData[prov].full ];		pdfFile = pdfs[ petName ][ provID ];		var contents = '<h4><a href="../files/' + pdfFile + '" target="_blank">All of ' + provData[prov].full + '</a></h4>';		var width = 3 * 35 + 18;		var height = 51;		addIconWindow( prov, provData[ prov ].lat, provData[ prov ].lng, width, height, 51, height, contents );	}}// clear all overlays (icon windows)function clearResults(){	map.clearOverlays();}// populate and display popup windowfunction showPopup( prov ){	$('#popup h5').html( provData[ prov ].full );	var listings = '';	var parasites = parasiteData[ prov ];	var products;	for( var i in parasites ){		listings += '<div' + ( i == 0 ? ' class="first"' : '' ) + ( i == parasites.length - 1 ? ' class="last"' : '' ) + '>';		listings += '<label><img src="../images/parasites/' + parasiteIcons[ parasites[i] ] + '" />' + parasites[i] + '</label>';		listings += '<ul>';		products = productData[ parasites[ i ] ];		var count = 0;		var productLabel = '';		for( var j in products ){			productLabel = productLabels[ products[j] ] ? productLabels[ products[j] ] : products[j] + '<sup>&reg;</sup>';			if( productLinks[ products[j] ] ){				listings += '<li><a target="_blank" href="' + productLinks[ products[j] ] + '">' + productLabel + '</a></li> ';			}else{				listings += '<li>' + productLabel + '</li> ';			}			count++;		}		if( count == 0 )			listings += '<li>&nbsp;</li>';		listings += '</ul></div>';	}	$('#popup .listing').html( listings );	$('#popup').show();}function addIconWindow( prov, lat, lng, width, height, offset_x, offset_y, contents ){	map.addOverlay( new IconWindow( 		prov,		new GLatLng( lat, lng ), 		new GSize( width, height ), 		new GPoint( offset_x, offset_y), 		contents	) );}function IconWindow( prov, lat_long, size, anchor_offset, contents ){	this.prov = prov;	this.lat_long = lat_long;	this.size = size;	this.anchor_offset = anchor_offset;	this.contents = contents;}IconWindow.prototype = new GOverlay();IconWindow.prototype.initialize = function(map) {  // Create the DIV representing our rectangle  var div = document.createElement("div");  div.style.position = "absolute";  div.style.cursor = "pointer";  div.className = "labelwindow";    var inner = document.createElement("div");  inner.style.height = "100%";  inner.className = "inner";  var prov = this.prov;  $(inner).html( this.contents );  $(inner).click( function(){	showPopup( prov );  });  div.appendChild( inner );    // Our rectangle is flat against the map, so we add our selves to the  // MAP_PANE pane, which is at the same z-index as the map itself (i.e.,  // below the marker shadows)  map.getPane(G_MAP_MAP_PANE).appendChild(div);  this.map = map;  this.div = div;}// Remove the main DIV from the map paneIconWindow.prototype.remove = function() {  this.div.parentNode.removeChild(this.div);}// Copy our data to a new RectangleIconWindow.prototype.copy = function() {  return new IconWindow(this.prov,this.lat_long, this.size, this.anchor_offset, this.contents);}// Redraw the overlay based on the current map co-ordinate systemIconWindow.prototype.redraw = function(force) {  if (!force) return;  // We only need to redraw if the coordinate system has changed  // get our pixel position  var p = this.map.fromLatLngToDivPixel(this.lat_long);  // now set position, applying anchor offsets  this.div.style.left = ( p.x - this.anchor_offset.x ) + "px";  this.div.style.top = ( p.y -this.anchor_offset.y )+ "px";  // set height  this.div.style.height = this.size.height + "px";}	  jQuery.preloadImages = function(){  for(var i = 0; i<arguments.length; i++)  {    jQuery("<img>").attr("src", arguments[i]);  }}