// hoverize.js // Based on hoverintent plugin for jQuery (function( $ ) { var opt = { slop: 7, interval: 200 }; function start() { if( ! timer ) { timer = setInterval( check, opt.interval ); $(document.body).bind( 'mousemove', move ); } } function clear() { if( timer ) { clearInterval( timer ); timer = null; $(document.body).unbind( 'mousemove', move ); } } function check() { if ( ( Math.abs( cur.x - last.x ) + Math.abs( cur.y - last.y ) ) < opt.slop ) { clear(); for( var i = 0, n = functions.length; i < n; ++i ) functions[i](); } else { last = cur; } } function move( e ) { cur = { x:e.screenX, y:e.screenY }; } var timer, last = { x:0, y:0 }, cur = { x:0, y:0 }, functions = []; hoverize = function( fn ) { function fire() { clear(); return fn.apply( null, args ); } functions.push( fire ); var args; return { clear: clear, now: function() { args = arguments; fire(); }, hover: function() { args = arguments; start(); } }; } })( jQuery ); (function( $ ) { var opt = window.GoogleElectionMapOptions || {}; //var imgBaseUrl = 'http://mg.to/iowa/server/images/'; var imgBaseUrl = 'http://gmaps-samples.googlecode.com/svn/trunk/elections/2008/images/icons/'; function loadScript( url ) { var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.charset = 'utf-8'; var seq = (new Date).getTime(); script.src = url + '?q=' + seq; script.title = 'jsonresult'; $('head')[0].appendChild( script ); } if( ! Array.prototype.forEach ) { Array.prototype.forEach = function( fun /*, thisp*/ ) { if( typeof fun != 'function' ) throw new TypeError(); var thisp = arguments[1]; for( var i = 0, n = this.length; i < n; ++i ) { if( i in this ) fun.call( thisp, this[i], i, this ); } }; } if( ! Array.prototype.map ) { Array.prototype.map = function( fun /*, thisp*/ ) { var len = this.length; if( typeof fun != 'function' ) throw new TypeError(); var res = new Array( len ); var thisp = arguments[1]; for( var i = 0; i < len; ++i ) { if( i in this ) res[i] = fun.call( thisp, this[i], i, this ); } return res; }; } if( ! Array.prototype.index ) { Array.prototype.index = function( field ) { this.by = {}; var by = this.by[field] = {}; for( var i = 0, n = this.length; i < n; ++i ) { var obj = this[i]; by[obj[field]] = obj; obj.index = i; } return this; }; } String.prototype.trim = function() { return this.replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' ); }; String.prototype.words = function( fun ) { this.split(' ').forEach( fun ); }; var parties = [ { name: 'democrat', shortName: 'Democratic', fullName: 'Democratic Party', url:'http://www.iowademocrats.org/' }, { name: 'republican', shortName: 'Republican', fullName: 'Republican Party', url:'http://www.iowagop.net/' } ].index('name'); var candidates = { all: [], democrat: [ { name: 'biden', lastName: 'Biden', fullName: 'Joe Biden', color: '#20FF1F' }, { name: 'clinton', lastName: 'Clinton', fullName: 'Hillary Clinton', color: '#FFFA00' }, { name: 'dodd', lastName: 'Dodd', fullName: 'Chris Dodd', color: '#E4Af95' }, { name: 'edwards', lastName: 'Edwards', fullName: 'John Edwards', color: '#FF1300' }, { name: 'gravel', lastName: 'Gravel', fullName: 'Mike Gravel', color: '#8A5C2E' }, { name: 'kucinich', lastName: 'Kucinich', fullName: 'Dennis Kucinich', color: '#EE00B5' }, { name: 'obama', lastName: 'Obama', fullName: 'Barack Obama', color: '#1700E8' }, { name: 'richardson', lastName: 'Richardson', fullName: 'Bill Richardson', color: '#336633' } ], republican: [ { name: 'giuliani', lastName: 'Giuliani', fullName: 'Rudy Giuliani', color: '#336633' }, { name: 'huckabee', lastName: 'Huckabee', fullName: 'Mike Huckabee', color: '#1700E8' }, { name: 'hunter', lastName: 'Hunter', fullName: 'Duncan Hunter', color: '#8A5C2E' }, { name: 'keyes', lastName: 'Keyes', fullName: 'Alan Keyes', color: '#8080FF' }, { name: 'mccain', lastName: 'McCain', fullName: 'John McCain', color: '#FFFA00' }, { name: 'paul', lastName: 'Paul', fullName: 'Ron Paul', color: '#E4Af95' }, { name: 'romney', lastName: 'Romney', fullName: 'Mitt Romney', color: '#FF1300' }, { name: 'tancredo', lastName: 'Tancredo', fullName: 'Tom Tancredo', color: '#EE00B5' }, { name: 'thompson', lastName: 'Thompson', fullName: 'Fred Thompson', color: '#20FF1F' } ] }; //var preloadCandidates = candidates.all.forEach( function( candidate ) { // var img = new Image( 16, 16 ); // img.src = imgUrl( candidate.name ); // return img; //}); var candidateNameList = []; parties.forEach( function( party ) { var list = candidates[party.name]; list.forEach( function( candidate ) { candidate.party = party; candidates.all.push( candidate ); candidateNameList.push( candidate.name ); }); list.index( 'name' ); }); candidates.all.index( 'name' ); var reCandidates = new RegExp( candidateNameList.join('|'), 'g' ); function candidateIcon( name ) { var icon = new GIcon; icon.image = imgUrl( name + '-border' ); icon.shadow = ''; icon.iconSize = new GSize( 18, 18 ); icon.shadowSize = new GSize( 0, 0 ); icon.iconAnchor = new GPoint( 9, 9 ); icon.infoWindowAnchor = new GPoint( 9, 9 ); return icon; } function loadCandidateIcons() { parties.forEach( function( party ) { candidates[party.name].forEach( function( candidate ) { candidate.icon = candidateIcon( candidate.name ); }); }); } // GAsync v2 by Michael Geary // Commented version and description at: // http://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api // Free beer and free speech license. Enjoy! function GAsync( obj ) { function callback() { args[nArgs].apply( null, results ); } function queue( iResult, name, next ) { function ready( value ) { results[iResult] = value; if( ! --nCalls ) callback(); } var a = []; if( next.join ) a = a.concat(next), ++iArg; if( mapplet ) { a.push( ready ); obj[ name+'Async' ].apply( obj, a ); } else { results[iResult] = obj[name].apply( obj, a ); } } var mapplet = ! window.GBrowserIsCompatible; var args = arguments, nArgs = args.length - 1; var results = [], nCalls = 0; for( var iArg = 1; iArg < nArgs; ++iArg ) { var name = args[iArg]; if( typeof name == 'object' ) obj = name; else queue( nCalls++, name, args[iArg+1] ); } if( ! mapplet ) callback(); } //var mapplet = location.host == 'gmodules.com'; var mapplet = ! window.GBrowserIsCompatible; var partyButtons = opt.party ? '' : [ '
', 'Vote results:', '', '', '
' ].join(''); document.write( ( opt.projector ? [ '', '
', '
', '
', '
' ] : mapplet ? [ '', '
', '
', 'New! ', 'Flordia Primary live results', '
', '
', 'Click the map for town info and results', '
', '
', 'View in Google Earth: ', 'Democratic', ' ', 'Republican', '
', //'
', // '', // '', // '', //'
', //'', partyButtons, '
', '

', '
', 'Loading…', '
', '
', '
', '
', '
', '
', '
' ] : [ '', '', '', '', '', '', '
', '
', '
', '
', partyButtons, '
', '

Primary Results

', '
Statewide Results
', '
', 'Loading…', '
', '
', 'Roll the mouse over the map for town-by-town results

', //'Scroll down for statewide details', '
', '
', '
', '
', '
' ] ).join('') ); if( 0 ) { var gFeedURLs = { news:'http://mg.to/iowa/section.xml', events:'http://mg.to/iowa/caucus_events.xml' }; } else { var gFeedURLs = { news: 'http://news.google.com/?ned=us&topic=el&output=rss', events:'http://data.desmoinesregister.com/newsroom_google/xml/caucus_events.xml', video: 'http://www.youtube.com/rss/user/wmurtv/videos.rss' }; } var map; var counties = Data.counties || [], state = Data.state || {}; counties.index( 'name' ); //var allEventData = []; var eventMarkers = []; var icons = {}; function onEventsReady( xml ) { var items = { eventtitle:1, eventid:1, eventdate:1, eventtimestart:1, eventendtime:1, venueid:1, venuename:1, venueaddress:1, venuecity:1, venuelat:1, venuelng:1, party:1, feclist:1, etidlist:1, candnamelist:1, iscurrent:1, eventdetailslink:1 }; $('marker',xml).each( function() { var event = {}; for( var item in items ) event[item] = this.getAttribute(item); event.latlng = new GLatLng( +event.venuelat, +event.venuelng ); event.marker = addEventMarker( event ); //allEventData.push( event ); }); initMap(); } function addEventMarker( event ) { var color = { b:'white', d:'blue', r:'red' }[event.party] || 'white'; var icon = icons[color]; var marker = new GMarker( event.latlng, { icon:icons[color] } ); GEvent.addListener( marker, 'click', function() { marker.openInfoWindowHtml( formatEvent(event), { maxWidth:500 } ); }); eventMarkers.push( marker ); map.addOverlay( marker ); return marker; } function onNewsReady( xml ) { var videos = []; $('rss channel item',xml).each( function( i ) { if( i > 4 ) return false; var $item = $(this); var $thumb = $('thumbnail',this); videos.push({ link: $('link',this).text(), //thumb: $thumb.attr('url'), //width: +$thumb.attr('width') / 2, //height: +$thumb.attr('height') / 2, title: $('title:first',this).text() }); return true; }); var html = [ '

Campaign News

', videos.map( function( video ) { return [ '
', //'', // '', //'', '', '
', video.title, '
', '
', '
', '
', '
' ].join(''); }).join(''), ].join(''); $('#news').html( html ); if( mapplet ) _IG_AdjustIFrameHeight(); } function onVideoReady( xml ) { var videos = []; $('rss channel item',xml).each( function( i ) { if( i > 2 ) return false; var $item = $(this); var $thumb = $('thumbnail',this); if( ! $thumb.length ) $thumb = $( this.getElementsByTagName( 'media:thumbnail' ) ); videos.push({ link: $('link',this).text(), thumb: $thumb.attr('url'), width: +$thumb.attr('width') / 2, height: +$thumb.attr('height') / 2, title: $('title:first',this).text() }); return true; }); var html = [ '

Latest Videos

', videos.map( function( video ) { var thumb = ! video.thumb ? '' : [ '', '', '' ].join(''); return [ '
', thumb, '', '
', video.title, '
', '
', '
', '
', '
' ].join(''); }).join(''), ].join(''); $('#videos').html( html ); if( mapplet ) _IG_AdjustIFrameHeight(); } function initMap() { if( ! mapplet ) { GEvent.addListener( map, 'mousemove', mousemoved/*.hover*/ ); //GEvent.addListener( map, 'mouseout', mousemoved.clear ); } //setTimeout( function() { $('#clicknote').show( 'slow' ); }, 1000 ); } function polyMethod( name, fn ) { GPolygon.prototype[name] = GPolyline.prototype[name] = fn; } polyMethod( 'contains', function( latlng ) { var inside = false; var x = latlng.lng(), y = latlng.lat(); var n = this.getVertexCount(); var v = this.getVertex(n-1), x1 = v.lng(), y1 = v.lat(); for( var i = 0; i < n; ++i ) { var v = this.getVertex(i), x2 = v.lng(), y2 = v.lat(); if( ( y1 < y && y2 >= y ) || ( y2 < y && y1 >= y ) ) if ( x1 + ( y - y1 ) / ( y2 - y1 ) * ( x2 - x1 ) < x ) inside = ! inside; x1 = x2, y1 = y2; } return inside; }); function initControls() { /* var $lst = $('#lstRegions'); option({ name:'', caption:'Entire State' }); 'northwest northcentral northeast southwest southcentral southeast'.words( function( name ) { option( regions.by.name[name] ); }); function option( region ) { var opt = document.createElement('option'); opt.innerHTML = region.caption; opt.value = region.name; $lst.append( opt ); } $lst.bind( 'change', function() { zoomRegion( regions.by.name[this.value] ); }); */ /* $('#chkEvents').bind( 'click', function() { map.closeInfoWindow(); var method = this.checked ? 'show' : 'hide'; eventMarkers.forEach( function( marker ) { marker[method](); }); }); */ } function zoomRegion( region ) { map.closeInfoWindow(); if( ! region ) { // Iowa: //map.setCenter( new GLatLng( 41.94, -93.69 ), 7 ); // NH: map.setCenter( new GLatLng( 43.975, -71.628 ), 8 ); //selectRegion(); } else { //GAsync( region.polygon.base, 'getBounds', // function( bounds ) { // GAsync( map, 'getBoundsZoomLevel', [ bounds ], // function( zoom ) { // //selectRegion( region ); // var center = pointLatLng( region.centroid ); // map.setCenter( center, zoom ); // }); // }); } } function pointLatLng( point ) { return new GLatLng( point[0], point[1] ); } function formatEvent( event ) { var href = event.eventdetailslink; var link = ! href ? '' : [ '
', 'Event details…', '
' ].join(''); var names = event.candnamelist.replace( /,+$/, '' ).replace( /, /, ',' ).replace( /,/, ', ' ).trim(); var who = ! names ? '' : [ '', 'Candidate: ', '', candidateIcons(names,'width:16; height:16; float:left; margin:2px 4px 2px 2px;'), names, '', '' ].join(''); var where = event.venuename == event.venuecity ? '' : [ '', 'Where: ', '', event.venuename, '', '' ].join(''); return [ '
', '
', event.eventtitle, '
', '', who, where, '', '', '', '', '', '', '', '', '
Address: ', ( event.venueaddress ? event.venueaddress + ', ' : '' ), event.venuecity, '
When: ', event.eventdate, ' at ', event.eventtimestart, '
', link, '
' ].join(''); } /* function getEvents(regionIdx) { var poly = regions[regionIdx].polygon.base; var html = '
'; for(var i=0; i 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function showStateProjector( json, party ) { var state = json.state, tallies = state.candidates, precincts = state.precincts; tallies.index('name'); var rows = []; addRow( 0, 3 ); addRow( 4, 7 ); var html = [ '', rows.join(''), '
', '
', '', '', '', '', '', '
', 'LIVE: Leading candidates by county', '', precincts.reporting, ' of ', precincts.total, ' precincts reporting', '
', '
', '
', ' ', '
', '', '', '
', candidate.fullName, '
', '
', formatNumber(tally.votes), '
', '
', '
', '' ].join('') ); } rows.push( [ '', cols.join(''), '' ].join('') ); } } function showStateSidebar( json, party ) { var state = json.state, tallies = state[party], precincts = state.precincts; tallies.index('name'); var rows = []; var cands = candidates[party]; addRows(); var html = [ '', rows.join(''), '
', '
', precincts.reporting, ' of ', precincts.total, ' precincts reporting', '
' ].join(''); $('#legend').html( html ); function addRows() { var cols = []; tallies.forEach( function( tally ) { var candidate = candidates.all.by.name[tally.name]; rows.push( [ '', '', '
', formatNumber(tally.votes), '
', '', '', '
', Math.round( tally.votes / state.total * 100 ), '%', '
', '', '', '
', ' ', '
', '', '', '
', candidate.fullName, '
', '', '' ].join('') ); }); } } function showStateTable( json, party ) { var state = json.state, tallies = state[party], precincts = state.precincts; tallies.index('name'); var cands = candidates[party]; var html = [ '', '', header(), '', '', stateRow(), countyRows(), '', '
', '
', precincts.reporting, ' of ', precincts.total, ' precincts reporting', '
' ].join(''); $('#fullstate').html( html ); function header() { return [ '', cands.map( function( candidate ) { return [ '', candidate.lastName, '' ].join(''); }).join(''), ].join(''); } function countyRows() { return counties.map( function( county ) { return row( county ); }).join(''); } function stateRow() { return row( null, 'Entire State', 'statewide' ); } function row( county, name, clas ) { var tallies = ( county ? json.counties[county.name] : json.state )[party]; if( ! tallies ) return ''; tallies.index('name'); return [ '', '', name || county.name, '', cands.map( function( candidate ) { var tally = tallies.by.name[candidate.name] || { votes:0 }; return [ '', formatNumber(tally.votes), '' ].join(''); }).join(''), '' ].join(''); } } function showCounties( json, party ) { counties.forEach( function( county ) { var vertices = county.vertices; if( json ) { var data = json.counties[county.name]; var tallies = county.tallies = data[party]; county.precincts = data.precincts; county.total = data.total; var leader = tallies && tallies[0]; if( leader ) { var votes = leader.votes; var candidate = candidates[party].by.name[leader.name]; var icon = candidate.icon; //if( ! opt.projector && ! mapplet ) { // var marker = new GMarker( new GLatLng( county.centroid[0], county.centroid[1] ), { icon:icon } ); // map.addOverlay( marker ); //} var color = candidate.color; } } var pts = county.vertices; var border = '#000080'; if( json ) { county.polygon = { base: opt.projector ? new GPolygon( pts, border, 1, .5, color, .9 ) : votes ? new GPolygon( pts, border, 1, .5, color, .7 ) : new GPolygon( pts, border, 1, .5 ) //, //select: new GPolygon( pts, color2, 1, .75, color2, .15 ) }; } else { var color = randomColor(); county.polygon = { base: new GPolygon( pts, border, 1, .5, color, .7 ) }; } map.addOverlay( county.polygon.base ); GEvent.addListener( county.polygon.base, 'click', function() { map.openInfoWindowHtml( pointLatLng( county.centroid ), voteBalloon( json, county ), { maxWidth:300 } ); }); }); initMap(); } function voteBalloon( json, county ) { return [ '
', countyTable( county, null, true ), '
' ].join(''); } function makeIcons() { 'red white blue'.words( function( color ) { icons[color] = makeColorIcon( color ); }); loadCandidateIcons(); } function makeColorIcon( color ) { var icon = new GIcon; icon.image = 'http://www.google.com/intl/en_us/mapfiles/ms/icons/' + color + '-dot.png'; //icon.shadow = ''; icon.iconSize = new GSize( 32, 32 ); //icon.shadowSize = new GSize( 0, 0 ); icon.iconAnchor = new GPoint( 16, 32 ); icon.infoWindowAnchor = new GPoint( 16, 0 ); return icon; } Json = { democratResults: function( json ) { showVotes( json, 'democrat' ); }, republicanResults: function( json ) { showVotes( json, 'republican' ); } }; function load() { if( mapplet ) { map = new GMap2; zoomRegion(); } else { if( ! GBrowserIsCompatible() ) return; map = new GMap2( $('#map')[0] ); zoomRegion(); map.enableContinuousZoom(); map.enableDoubleClickZoom(); map.enableGoogleBar(); map.enableScrollWheelZoom(); map.addControl( new GLargeMapControl() ); } makeIcons(); counties.forEach( function( county ) { var points = county.points; var pts = county.vertices = []; for( var i = 0, n = points.length; i < n; ++i ) { var point = points[i]; pts.push( new GLatLng( point[0], point[1] ) ); } }); //if( mapplet ) showVotes(); //GEvent.addListener( map, 'click', function( overlay, latlng ) { // //marker.openInfoWindowHtml( formatEvent(event), { maxWidth:500 } ); //}); var testdata = false; if( location.search.slice(1) == 'test' ) testdata = true; var q = opt.party || location.search.slice(1); var party = parties.by.name[q]; if( party ) { loadResults( party ); } else { //download( gFeedURLs.events, onEventsReady ); loadResults( parties[ Math.random() < .5 ? 0 : 1 ] ); } //showCounties(); if( mapplet ) { download( gFeedURLs.video, onVideoReady ); download( gFeedURLs.news, onNewsReady ); } $('#btnDem').click( function() { loadResults( parties.by.name['democrat'] ); return false; }); $('#btnRep').click( function() { loadResults( parties.by.name['republican'] ); return false; }); function loadResults( party ) { map.clearOverlays(); $('#votestitle').html( [ party.fullName ].join('') ); $('#legend').html( 'Loading…' ); //loadScript( 'http://gigapad/elections/2008/primary/nh/results_' + party.name + '.js' ); loadScript( 'http://gmaps-samples.googlecode.com/svn/trunk/elections/2008/primary/nh/results_' + party.name + '.js' ); //loadScript( 'http://mg.to/iowa/server/' + q + '_results.js' ); //if( testdata ) // loadScript( 'http://gigapad/iowa/server/test.' + party + '_results.js' ); //else //loadScript( 'http://gmaps-samples.googlecode.com/svn/trunk/elections/iowa/caucus/live/' + party.name + '_results.js' ); //var kmlBaseUrl = 'http://mg.to/nh/'; //var kmlBaseUrl = 'http://gmaps-samples.googlecode.com/svn/trunk/elections/2008/primary/nh/'; //var kml = new GGeoXml( kmlBaseUrl + 'maps-nh-' + party.name + '.kml?t=' + new Date().getTime() ); //map.addOverlay( kml ); //GEvent.addListener( kml, 'click', function( overlay, latlng ) { // console.log( 'kml', overlay, latlng ); // //marker.openInfoWindowHtml( formatEvent(event), { maxWidth:500 } ); //}); } //initControls(); if( mapplet ) _IG_AdjustIFrameHeight(); } var mousemoved = function( latlng ) { //$('#test').html( latlng.lng() + ' : ' + latlng.lat() ); /* for( var i = 0, n = regions.length; i < n; ++i ) { var region = regions[i]; if( region.polygon.base.contains( latlng ) ) { //$('#test').css({ color: region.color }); break; } } if( i == n ) i = -1; region = regions[i]; selectRegion( region ); */ for( var i = 0, n = counties.length; i < n; ++i ) { var county = counties[i]; if( county.polygon.base.contains( latlng ) ) { //$('#test').css({ color: region.color }); break; } } if( i == n ) i = -1; county = counties[i]; if( county ) $('#results').html( countyTable( county ) ); } function countyTable( county, party, balloon ) { //var fontsize = balloon ? 'font-size:10pt;' : ''; var fontsize = 'font-size:10pt;'; var pad = balloon ? '8px' : '4px'; party = party || opt.party; var lines = []; if( county.total ) { var tallies = county.tallies; tallies.forEach( function( tally ) { var candidate = candidates.all.by.name[tally.name]; lines.push( [ '', '', '
', formatNumber(tally.votes), '
', '', '', '
', Math.round( tally.votes / county.total * 100 ), '%', '
', '', '', '
', ' ', '
', '', //'', // '', //'', '', '
', candidate.fullName, '
', '', '' ].join('') ); }); } else if( ! county.precincts ) { lines.push( '' + county.name + ' residents vote in a nearby town.' ); } else { lines.push( 'No votes reported' ); } var wikilink = ! balloon ? '' : [ '', 'Town information', '' ].join(''); return [ '
', county.name, ', NH
', '
', wikilink, '
', '', lines.join(''), '
' ].join(''); } //if( ! mapplet ) mousemoved = hoverize( mousemoved ); /* function selectRegion( region ) { if( region == regions.selected ) return; if( regions.selected ) map.removeOverlay( regions.selected.polygon.select ); regions.selected = region; if( region ) map.addOverlay( region.polygon.select ); showRegionNews( region ); } */ /* function showRegionNews( region ) { if( ! region ) { $('#news') .css({ backgroundColor:'inherit' }) .html( [ '

', mapplet ? 'Click the map for regional news' : 'Rest the mouse over the map for regional news', '

' ].join('') ); return; } var news = region.news; var list = []; news && news.forEach( function( item ) { list.push( [ '
', candidateIcons( item.title ), '', item.title, '', '
' ].join('') ); }); $('#news') .css({ backgroundColor:region.solid }) .html( [ '

', region.caption, ' Iowa News', '

', '
', list.join(''), '
' ].join('') ); if( mapplet ) _IG_AdjustIFrameHeight(); } */ function imgUrl( name ) { return imgBaseUrl + name + '.png'; } function candidateIcons( text, style ) { var names = text.toLowerCase().match(reCandidates) || [ 'generic' ]; var icons = names.map( function( name ) { return [ '' ].join(''); }); return icons.join(''); } function download( url, ready ) { if( mapplet ) { _IG_FetchXmlContent( url, ready ); } else { //GDownloadUrl( 'proxy.php?url=' + encodeURIComponent(url), function( data ) { // ready( GXml.parse(data) ); //}); } } $(window).bind( 'load', load ).bind( 'onunload', GUnload ); })( jQuery );