--- /dev/null +++ b/betweenpoint.php @@ -1,1 +1,189 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <script src="openlayers/OpenLayers.js"></script> + <SCRIPT TYPE="text/javascript" SRC="OpenStreetMap.js"></SCRIPT> +<script type="text/javascript" src="jquery.1.3.2.min.js"></script> + <script type="text/javascript"> +function init() +{ + // create the ol map object + var map = new OpenLayers.Map('map'); + + var osmtiles = new OpenLayers.Layer.OSM("local", "http://127.0.0.1/Maps/OSM/${z}/${x}/${y}.png") +// use http://open.atlas.free.fr/GMapsTransparenciesImgOver.php and http://code.google.com/p/googletilecutter/ to make tiles + markers = new OpenLayers.Layer.Markers("Between Stop Markers"); + + +<?php +$conn = pg_connect("dbname=bus user=postgres password=snmc"); +if (!$conn) { + echo "An error occured.\n"; + exit; +} +$result_stops = pg_query($conn, "Select * FROM stops"); + +while ($stop = pg_fetch_assoc($result_stops)) { +echo 'marker = new OpenLayers.Marker(new OpenLayers.LonLat('.($stop['lng']/10000000).",".($stop['lat']/10000000).') + .transform( + new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 + new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection + ));'; + +echo ' + marker.id="'.$stop['geohash'].'"; + markers.addMarker(marker); +marker.events.register("mousedown", marker, function() { +document.getElementById("between_points").innerHTML += this.id+";"; +}); +'; +} +?> +var timeicon = new OpenLayers.Icon("http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png",new OpenLayers.Size(32,32)); +var timepoints = new OpenLayers.Layer.GeoRSS("Timing Points", "displaytimepoints.georss.php", { icon: timeicon }); + + map.addLayers([osmtiles, markers,timepoints]); + map.addControl(new OpenLayers.Control.LayerSwitcher()); + map.zoomToExtent(markers.getDataExtent()); + } + + function submit(){ + $.ajax({ + type: "POST", + url: "betweenpoint.submit.php", + data: "reverse=" + document.getElementById("reverse").value + + "&from=" + document.getElementById("from").value + + "&to=" + document.getElementById("to").value + + "&routes=" + document.getElementById("routes").value + + "&between_points=" + document.getElementById("between_points").value, + success: function(html){ + $("#response").html(html); + clearForms(); + } + }); + + } +<!-- +function OnChange(dropdown) +{ + var myindex = dropdown.selectedIndex + var selValue = dropdown.options[myindex].value +alert(selValue); + return true; +} +//--> + +// function will clear input elements on each form +function clearForms(){ +document.getElementById("between_points").innerHTML = ""; + // declare element type + var type = null; + // loop through forms on HTML page + for (var x=0; x<document.forms.length; x++){ + // loop through each element on form + for (var y=0; y<document.forms[x].elements.length; y++){ + // define element type + type = document.forms[x].elements[y].type + // alert before erasing form element + //alert('form='+x+' element='+y+' type='+type); + // switch on element type + switch(type){ + case "text": + case "textarea": + case "password": + //case "hidden": + document.forms[x].elements[y].value = ""; + break; + case "radio": + case "checkbox": + document.forms[x].elements[y].checked = ""; + break; + case "select-one": + document.forms[x].elements[y].options[0].selected = true; + break; + case "select-multiple": + for (z=0; z<document.forms[x].elements[y].options.length; z++){ + document.forms[x].elements[y].options[z].selected = false; + } + break; + } + } + } +} + </script> + + </head> + <body onload="init()"> + <div id="inputpane"><form id="inputform"> +<select name=selectPair onchange='OnChange(this.form.selectPair);'> +<option>Select a from/to pair...</option> +<?php +include('spyc/spyc.php'); +//$timetable = Spyc::YAMLLoad('../spyc.yaml'); +$path = "maxious-canberra-transit-feed/output/"; +$dhandle = opendir("maxious-canberra-transit-feed/output/"); +// define an array to hold the files +$files = array(); +$paths = array(); + +if ($dhandle) { + // loop through all of the files + while (false !== ($fname = readdir($dhandle))) { + if (($fname != '.') && ($fname != '..')) { + $timetable = Spyc::YAMLLoad("maxious-canberra-transit-feed/output/".$fname); + for ($i = 0; $i < sizeof($timetable["time_points"]) -1 ; $i++) + { + @$paths[$timetable["time_points"][$i]."->".$timetable["time_points"][$i+1]] .= $timetable["short_name"].";"; + } + } + } +} +$completedPaths = Array("Cameron Ave Bus Station->Lathlain St Bus Station", +"Lathlain St Bus Station->Cohen St Bus Station", +"Cohen St Bus Station->Lathlain St Bus Station", +"Lathlain St Bus Station->Cameron Ave Bus Station", +"Lathlain St Bus Station - Platform 1->Cameron Ave Bus Station - Platform 1", +"Lathlain St Bus Station - Platform 2->Cameron Ave Bus Station - Platform 1", +"Lathlain St Bus Station - Platform 2->Cameron Ave Bus Station - Platform 2", +"Lathlain St Bus Station - Platform 3->Cameron Ave Bus Station - Platform 2", +"Lathlain St Bus Station - Platform 3->Cameron Ave Bus Station - Platform 3", +"Lathlain St Bus Station - Platform 4->Cohen St Bus Station - Platform 4", +"Lathlain St Bus Station - Platform 4->Cohen St Bus Station - Platform 6", +"Lathlain St Bus Station - Platform 5->Cohen St Bus Station - Platform 5", +"Lathlain St Bus Station - Platform 6->Cohen St Bus Station - Platform 5", +"Cohen St Bus Station - Platform 1->Lathlain St Bus Station - Platform 2", +"Cohen St Bus Station - Platform 1->Lathlain St Bus Station - Platform 3", +"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 1", +"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 2", +"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 3", +"Cohen St Bus Station - Platform 3->Lathlain St Bus Station - Platform 1", +"Cameron Ave Bus Station - Platform 4->Lathlain St Bus Station - Platform 4", +"Cameron Ave Bus Station - Platform 5->Lathlain St Bus Station - Platform 5", +"Cameron Ave Bus Station - Platform 5->Lathlain St Bus Station - Platform 6" +); +ksort($paths); +foreach ($paths as $path => $routes) +{ + if (!in_array($path,$completedPaths)) echo "<option value=\"$routes:$path\">".sizeof(explode(";",$routes))." $path</option>\n"; +} +?> +</select> + from <input type="text" id="from"/> + to <input type="text" id="to"/> +<br> + on routes <input type="text" id="routes"/> +Reverse? <input type="checkbox" name="reverse" id="reverse" value="true"/> +<input type="button" onclick="javascript:submit()" name="mysubmit" value="Submit!"> +<input type="button" value="Clear" onclick="javascript:clearForms()" title="Start clearForms() JavaScript function"> +<br> +<textarea id="between_points" rows="1" cols="120"></textarea> +</form> +<br><div id="response"> + <!-- Our message will be echoed out here --> + </div> +</div> + <div id="map" width="100%" height="100%"></div> + </body> +</html> + +
--- /dev/null +++ b/betweenpoint.submit.php @@ -1,1 +1,76 @@ +<?php +/* + * GeoPo Encode in PHP + * @author : Shintaro Inagaki + * @param $location (Array) + * @return $geopo (String) + */ +function geopoEncode($lat, $lng) { + // 64characters (number + big and small letter + hyphen + underscore) + $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; + + $geopo = ""; + $scale = 7; + + // Change a degree measure to a decimal number + $lat = ($lat + 90) / 180 * pow(8, 10); + $lng = ($lng + 180) / 360 * pow(8, 10); + // Compute a GeoPo code from head and concatenate + for($i = 0; $i < $scale; $i++) { + $geopo .= substr($chars, floor($lat / pow(8, 9 - $i) % 8) + floor($lng / pow(8, 9 - $i) % 8) * 8, 1); + } + return $geopo; +} + +/* + * GeoPo Decode in PHP + * @author : Shintaro Inagaki + * @param $geopo (String) + * @return $location (Array) + */ +function geopoDecode($geopo) { + // 64characters (number + big and small letter + hyphen + underscore) + $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; + // Array for geolocation + $location = array (); + + for ($i = 0; $i < strlen($geopo); $i++) { + // What number of character that equal to a GeoPo code (0-63) + $order = strpos($chars, substr($geopo, $i, 1)); + // Lat/Lng plus geolocation value of scale + $location['lat'] = $location['lat'] + floor($order % 8) * pow(8, 9 - $i); + $location['lng'] = $location['lng'] + floor($order / 8) * pow(8, 9 - $i); + } + + // Change a decimal number to a degree measure, and plus revised value that shift center of area + $location['lat'] = $location['lat'] * 180 / pow(8, 10) + 180 / pow(8, strlen($geopo)) / 2 - 90; + $location['lng'] = $location['lng'] * 360 / pow(8, 10) + 360 / pow(8, strlen($geopo)) / 2 - 180; + $location['scale'] = strlen($geopo); + + return $location; +} + +$conn = pg_connect("dbname=bus user=postgres password=snmc"); +if (!$conn) { + echo "An error occured.\n"; + exit; +} +$xml = simplexml_load_file("04-locatebetweenpoints.osm"); + +/* Access the <rating> nodes of the first movie. + * Output the rating scale, too. */ +foreach ($xml->node as $node) { + $geoPo = geopoEncode((float)$node['lat'],(float)$node['lon']); + $node['lat'] = (int) ((float)$node['lat']*10000000); + $node['lon'] = (int) ((float)$node['lon']*10000000); + echo($node['lat'].",".$node['lon']."=$geoPo<br>"); + $sql = "INSERT INTO stops (geohash, lat, lng) VALUES('$geoPo','{$node['lat']}','{$node['lon']}')"; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() ."<br>\n"); + } +flush(); + +} +?>
--- /dev/null +++ b/busui/common.inc.php @@ -1,1 +1,17 @@ +<?php +date_default_timezone_set('Australia/ACT'); +function service_period() +{ +switch (date('w')){ + +case 0: + return 'sunday'; +case 6: + return 'saturday'; +default: + return 'weekday'; +} +} +?> +
--- /dev/null +++ b/busui/index.php @@ -1,1 +1,101 @@ +<!doctype html> +<html> + <head> + <meta charset="UTF-8" /> + <title>jQTouch β</title> + <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style> + <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style> + <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> + <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script> + <script src="extensions/jqt.location.js" type="application/x-javascript" charset="utf-8"></script> + + <script type="text/javascript" charset="utf-8"> + var jQT = new $.jQTouch({ + icon: 'jqtouch.png', + addGlossToIcon: false, + startupScreen: 'jqt_startup.png', + statusBar: 'black', + preloadImages: [ + 'themes/jqt/img/back_button.png', + 'themes/jqt/img/back_button_clicked.png', + 'themes/jqt/img/button_clicked.png', + 'themes/jqt/img/grayButton.png', + 'themes/jqt/img/whiteButton.png', + 'themes/jqt/img/loading.gif' + ] + }); + $(function(){ + function setDisplay(text) { + $('.info').empty().append(text) + } + + // We pass "updateLocation" a callback function, + // to run once we have the coordinates. + // We also set it to a variable, so we can know + // right away if it's working or not + var lookup = jQT.updateLocation(function(coords){ + if (coords) { + setDisplay('Latitude: ' + coords.latitude + '<br />Longitude: ' + coords.longitude); + $('.nearby').empty().append('<a href="list.php?lat=' + coords.latitude + '&lng=' + coords.longitude + '">Nearby List</a>'); + } else { + setDisplay('Device not capable of geo-location.'); + } + }); + + if (lookup) { + setDisplay('Looking up location…'); + } + }); + // Some sample Javascript functions: + $(function(){ + $('a[target="_blank"]').click(function() { + if (confirm('This link opens in a new window.')) { + return true; + } else { + $(this).removeClass('active'); + return false; + } + }); + // Page animation callback events + $('#pageevents'). + bind('pageAnimationStart', function(e, info){ + $(this).find('.info').append('Started animating ' + info.direction + '… '); + }). + bind('pageAnimationEnd', function(e, info){ + $(this).find('.info').append(' finished animating ' + info.direction + '.<br /><br />'); + }); + // Page animations end with AJAX callback event, example 1 (load remote HTML only first time) + $('#callback').bind('pageAnimationEnd', function(e, info){ + if (!$(this).data('loaded')) { // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down) + $(this).append($('<div>Loading</div>'). // Append a placeholder in case the remote HTML takes its sweet time making it back + load('ajax.html .info', function() { // Overwrite the "Loading" placeholder text with the remote HTML + $(this).parent().data('loaded', true); // Set the 'loaded' var to true so we know not to re-load the HTML next time the #callback div animation ends + })); + } + }); + // Orientation callback event + $('body').bind('turn', function(e, data){ + $('#orient').html('Orientation: ' + data.orientation); + }); + }); + </script> + </head> + <body> + <div id="home" class="current"> + <div class="toolbar"> + <h1>jQTouch</h1> + <a class="button slideup" id="infoButton" href="#about">About</a> + </div> + <ul class="rounded"> + <li class="arrow"><a href="#ui">User Interface</a> <small class="counter">4</small></li> + <li class="arrow"><a href="list.php">All stops List</a></li> + <li class="arrow nearby">Nearby List</li> + <li class="arrow"><a href="list.php">Favourites List</a></li> + </ul> + <div class="info"> + <p>Add this page to your home screen to view the custom icon, startup screen, and full screen mode.</p> + </div> + </div> + </body> +</html>
--- /dev/null +++ b/busui/list.php @@ -1,1 +1,22 @@ - +<div id="get"> + <div class="toolbar"> + <h1>GET Example</h1> + <a class="back" href="#">AJAX</a> + </div> + <div class="info"> + This page was loaded via AJAX. + </div> + <ul class="rounded"> + <li><a href="#livetest">Test live events</a></li> + </ul> +</div> +<div id="livetest"> + <div class="toolbar"> + <h1>Events test</h1> + <a class="back" href="#">AJAX</a> + <a class="button goback" href="#home">Home</a> + </div> + <div class="info"> + This is a test of live events. + </div> +</div>
--- /dev/null +++ b/busui/readme.txt @@ -1,1 +1,2 @@ +TODO
--- /dev/null +++ b/busui/route.php
--- /dev/null +++ b/busui/routeList.php
--- /dev/null +++ b/busui/stop.php
--- /dev/null +++ b/busui/stopList.php @@ -1,1 +1,23 @@ +<div id="get"> + <div class="toolbar"> + <h1>GET Example</h1> + <a class="back" href="#">AJAX</a> + </div> + <div class="info"> + This page was loaded via AJAX. + </div> + <ul class="rounded"> + <li><a href="#livetest">Test live events</a></li> + </ul> +</div> +<div id="livetest"> + <div class="toolbar"> + <h1>Events test</h1> + <a class="back" href="#">AJAX</a> + <a class="button goback" href="#home">Home</a> + </div> + <div class="info"> + This is a test of live events. + </div> +</div>
--- a/displaystops.georss.php +++ b/displaystops.georss.php @@ -1,17 +1,14 @@ <?php header('Content-Type: application/xml'); -echo '<?xml version="1.0" encoding="utf-8"?> -<feed xmlns="http://www.w3.org/2005/Atom" +echo '<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss"><title>Bus Stops from OSM</title>'; -$conn = pg_connect("dbname=openstreetmap user=postgres password=snmc"); +$conn = pg_connect("dbname=bus user=postgres password=snmc"); if (!$conn) { echo "An error occured.\n"; exit; } -/*SELECT * from current_node_tags, (Select id FROM current_node_tags WHERE "v" LIKE '%bus%') as a -where a.id = current_node_tags.id; */ -$result_stops = pg_query($conn, "Select * FROM current_node_tags INNER JOIN current_nodes ON -current_node_tags.id=current_nodes.id WHERE v LIKE '%bus%' "); +$result_stops = pg_query($conn, "Select * FROM stops "); if (!$result_stops) { echo "An stops retirieve error occured.\n"; exit; @@ -19,21 +16,10 @@ while ($stop = pg_fetch_assoc($result_stops)) { echo "\n<entry>\n"; - echo "<summary>"; -$result_stopkeys = pg_query($conn, "SELECT * from current_node_tags where id = {$stop['id']};"); -if (!$result_stopkeys) { - echo "An stops keys retirieve error occured.\n"; - exit; -} -$name = ""; -while ($stopkeys = pg_fetch_assoc($result_stopkeys)) { -echo htmlspecialchars(print_r($stopkeys,true)); -$name .= htmlspecialchars($stopkeys['v']); -} -echo "</summary>"; - echo "<title>$name</title>"; + echo "<summary> {$stop['geohash']}</summary>"; + echo "<title>{$stop['geohash']}</title>"; -echo "<georss:point> ";echo ($stop['latitude']/10000000)." ".($stop['longitude']/10000000); +echo "<georss:point> ";echo ($stop['lat']/10000000)." ".($stop['lng']/10000000); echo " </georss:point>"; echo '</entry>'; }
--- /dev/null +++ b/jquery.1.3.2.min.js @@ -1,1 +1,19 @@ - +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E