Move busui to seperate repository
Move busui to seperate repository

file:a/busui/about.php (deleted)
<?php  
include('common.inc.php');  
include_header("About","about")  
?>  
<p>  
Busness Time - An ACT bus timetable webapp<br />  
Based on the maxious-canberra-transit-feed (<a href="cbrfeed.zip">download</a>, last updated <?php echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br />  
Source code for the transit feed and this site @ <a href="http://maxious.lambdacomplex.org/git">http://maxious.lambdacomplex.org/git</a><br />  
Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br />  
<br />  
Feedback encouraged; contact maxious@lambdacomplex.org<br />  
<br />  
Some icons by Joseph Wain / glyphish.com<br />  
<br />  
<small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.  
Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty,  
express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided  
"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability.  
All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend,  
change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site  
without prior notice. </small>  
<?  
include_footer();  
?>  
 
file:a/busui/common.inc.php (deleted)
<?php  
date_default_timezone_set('Australia/ACT');  
$APIurl = "http://localhost:8765";  
$cloudmadeAPIkey="daa03470bb8740298d4b10e3f03d63e6";  
$googleMapsAPIkey="ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";  
$otpAPIurl = 'http://10.1.0.243:5080/opentripplanner-api-webapp/';  
if (isDebug()) error_reporting(E_ALL ^ E_NOTICE);  
 
// SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',')  
$suburbs = explode(",","Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla");  
 
// you have to open the session to be able to modify or remove it  
session_start();  
if (isset($_REQUEST['service_period'])) $_SESSION['service_period'] = filter_var($_REQUEST['service_period'],FILTER_SANITIZE_STRING);  
if (isset($_REQUEST['time'])) $_SESSION['time'] = filter_var($_REQUEST['time'],FILTER_SANITIZE_STRING);  
if (isset($_REQUEST['geolocate'])) {  
$contents = geocode(var_filter($_REQUEST['geolocate'],FILTER_SANITIZE_URL),true);  
if (isset($contents[0]->centroid)) {  
$session['lat'] = $contents[0]->centroid->coordinates[0];  
$session['lon'] = $contents[0]->centroid->coordinates[1];  
}  
else {  
$session['lat'] = "";  
$session['lon'] = "";  
}  
}  
//print_r ($_SESSION);  
function isDebug()  
{  
return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];  
}  
 
function isMetricsOn()  
{  
return true;  
}  
 
function debug($msg) {  
if (isDebug()) echo "<!-- $msg -->";  
}  
function isFastDevice() {  
$fastDevices = Array("Mozilla/5.0 (X11;", "Mozilla/5.0 (Windows;", "Mozilla/5.0 (iP", "Mozilla/5.0 (Linux; U; Android", "Mozilla/4.0 (compatible; MSIE");  
$slowDevices = Array("J2ME","MIDP","Opera/","Mozilla/2.0 (compatible;","Mozilla/3.0 (compatible;");  
return true;  
}  
 
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false) {  
echo '  
<!DOCTYPE html>  
<html>  
<head>  
<title>'.$pageTitle.'</title>';  
if (isDebug()) echo '<link rel="stylesheet" href="css/jquery-mobile-1.0a3.css" />  
<script type="text/javascript" src="js/jquery-1.5.js"></script>  
<script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>';  
else echo '<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.css" />  
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.js"></script>  
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.js"></script>';  
echo '  
<link rel="stylesheet" href="css/jquery.ui.datepicker.mobile.css" />  
<script>  
//reset type=date inputs to text  
$( document ).bind( "mobileinit", function(){  
$.mobile.page.prototype.options.degradeInputs.date = true;  
});  
</script>  
<script src="js/jQuery.ui.datepicker.js"></script>  
<script src="js/jquery.ui.datepicker.mobile.js"></script>  
<style type="text/css">  
.ui-navbar {  
width: 100%;  
}  
.ui-btn-inner {  
white-space: normal !important;  
}  
.ui-li-heading {  
white-space: normal !important;  
}  
.ui-listview-filter {  
margin: 0 !important;  
}  
#footer {  
text-size: 0.75em;  
text-align: center;  
}  
body {  
background-color: #F0F0F0;  
}  
</style>  
<meta name="apple-mobile-web-app-capable" content="yes" />  
<meta name="apple-mobile-web-app-status-bar-style" content="black" />  
<link rel="apple-touch-startup-image" href="startup.png" />  
<link rel="apple-touch-icon" href="apple-touch-icon.png" />';  
if ($geolocate) {  
echo "<script>  
 
function success(position) {  
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude);  
// setCookie('geolocate',position.coords.latitude+','+position.coords.longitude,1);  
$('#here').click(function(event) { $('#geolocate').val(doAJAXrequestForGeolocSessionHere()); return false;});  
$('#here').show();  
}  
function error(msg) {  
console.log(msg);  
}  
 
if (navigator.geolocation) {  
navigator.geolocation.getCurrentPosition(success, error);  
}  
 
</script> ";  
}  
echo '</head>  
<body>  
';  
if (isMetricsOn()) {  
require_once('owa/owa_env.php');  
require_once(OWA_DIR.'owa_php.php');  
$owa = new owa_php();  
$owa->setSiteId('bus.lambdacomplex.org');  
$owa->setPageTitle($pageTitle);  
$owa->setPageType($pageType);  
$owa->trackPageView();  
$owa->placeHelperPageTags();  
}  
 
if ($opendiv) {  
echo '<div data-role="page">  
<script>  
$(document).ready(function ()  
{  
document.title = "'.$pageTitle.'";  
});  
</script>  
<div data-role="header">  
<h1>'.$pageTitle.'</h1>  
</div><!-- /header -->  
<div data-role="content"> ';  
}  
}  
function include_footer()  
{  
if ($geolocate && isset($_SESSION['lat'])) {  
echo "<script>  
$('#here').click(function(event) { $('#geolocate').val(doAJAXrequestForGeolocSessionHere()); return false;});  
$('#here').show();  
</script>";  
}  
echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a></a>';  
echo '</div>';  
}  
 
$service_periods = Array ('sunday','saturday','weekday');  
 
function service_period()  
{  
if (isset($_SESSION['service_period'])) return $_SESSION['service_period'];  
 
switch (date('w')){  
 
case 0:  
return 'sunday';  
case 6:  
return 'saturday';  
default:  
return 'weekday';  
}  
}  
 
function remove_spaces($string)  
{  
return str_replace(' ','',$string);  
}  
 
function midnight_seconds()  
{  
// from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html  
if (isset($_SESSION['time'])) {  
$time = strtotime($_SESSION['time']);  
return (date("G",$time) * 3600) + (date("i",$time) * 60) + date("s",$time);  
}  
return (date("G") * 3600) + (date("i") * 60) + date("s");  
}  
 
function midnight_seconds_to_time($seconds)  
{  
if ($seconds > 0) {  
$midnight = mktime (0, 0, 0, date("n"), date("j"), date("Y"));  
return date("h:ia",$midnight+$seconds);  
} else {  
return "";  
}  
}  
function getPage($url)  
{  
debug($url);  
$ch = curl_init($url);  
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );  
curl_setopt( $ch, CURLOPT_HEADER, 0 );  
curl_setopt($ch,CURLOPT_TIMEOUT,30);  
$page = curl_exec($ch);  
if(curl_errno($ch)) echo "<font color=red> Database temporarily unavailable: ".curl_errno($ch)." ".curl_error($ch)."</font>";  
curl_close($ch);  
return $page;  
}  
function array_flatten($a,$f=array()){  
if(!$a||!is_array($a))return '';  
foreach($a as $k=>$v){  
if(is_array($v))$f=array_flatten($v,$f);  
else $f[$k]=$v;  
}  
return $f;  
}  
 
function staticmap($mapPoints, $zoom = 0, $markerImage = "iconb")  
{  
$width = 300;  
$height = 300;  
$metersperpixel[9]=305.492*$width;  
$metersperpixel[10]=152.746*$width;  
$metersperpixel[11]=76.373*$width;  
$metersperpixel[12]=38.187*$width;  
$metersperpixel[13]=19.093*$width;  
$metersperpixel[14]=9.547*$width;  
$metersperpixel[15]=4.773*$width;  
$metersperpixel[16]=2.387*$width;  
// $metersperpixel[17]=1.193*$width;  
$center = "";  
$markers = "";  
$minlat = 999;  
$minlon = 999;  
$maxlat = 0;  
$maxlon = 0;  
 
if (sizeof($mapPoints) < 1) return "map error";  
if (sizeof($mapPoints) === 1) {  
if ($zoom == 0) $zoom = 14;  
$markers .= "{$mapPoints[0][0]},{$mapPoints[0][1]},$markerimage";  
$center = "{$mapPoints[0][0]},{$mapPoints[0][1]}";  
} else {  
foreach ($mapPoints as $index => $mapPoint) {  
$markers .= $mapPoint[0].",".$mapPoint[1].",".$markerImage.($index+1);  
if ($index+1 != sizeof($mapPoints)) $markers .= "|";  
if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0];  
if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0];  
if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1];  
if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1];  
$totalLat += $mapPoint[0];  
$totalLon += $mapPoint[1];  
}  
if ($zoom == 0) {  
$mapwidthinmeters = distance($minlat,$minlon,$minlat,$maxlon);  
foreach (array_reverse($metersperpixel,true) as $zoomLevel => $maxdistance)  
{  
if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel;  
}  
}  
$center = $totalLat/sizeof($mapPoints).",".$totalLon/sizeof($mapPoints);  
}  
$output = "";  
$output .= '<div data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';  
$output .= '<center><img src="staticmaplite/staticmap.php?center='.$center.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype=mapnik&markers='.$markers.'" width='.$width.' height='.$height.'></center>';  
$output .= '</div>';  
return $output;  
}  
 
function distance($lat1, $lng1, $lat2, $lng2)  
{  
$pi80 = M_PI / 180;  
$lat1 *= $pi80;  
$lng1 *= $pi80;  
$lat2 *= $pi80;  
$lng2 *= $pi80;  
 
$r = 6372.797; // mean radius of Earth in km  
$dlat = $lat2 - $lat1;  
$dlng = $lng2 - $lng1;  
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);  
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));  
$km = $r * $c;  
 
return $km * 1000;  
}  
 
function decodePolylineToArray($encoded)  
{  
// source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5  
$length = strlen($encoded);  
$index = 0;  
$points = array();  
$lat = 0;  
$lng = 0;  
 
while ($index < $length)  
{  
// Temporary variable to hold each ASCII byte.  
$b = 0;  
 
// The encoded polyline consists of a latitude value followed by a  
// longitude value. They should always come in pairs. Read the  
// latitude value first.  
$shift = 0;  
$result = 0;  
do  
{  
// The `ord(substr($encoded, $index++))` statement returns the ASCII  
// code for the character at $index. Subtract 63 to get the original  
// value. (63 was added to ensure proper ASCII characters are displayed  
// in the encoded polyline string, which is `human` readable)  
$b = ord(substr($encoded, $index++)) - 63;  
 
// AND the bits of the byte with 0x1f to get the original 5-bit `chunk.  
// Then left shift the bits by the required amount, which increases  
// by 5 bits each time.  
// OR the value into $results, which sums up the individual 5-bit chunks  
// into the original value. Since the 5-bit chunks were reversed in  
// order during encoding, reading them in this way ensures proper  
// summation.  
$result |= ($b & 0x1f) << $shift;  
$shift += 5;  
}  
// Continue while the read byte is >= 0x20 since the last `chunk`  
// was not OR'd with 0x20 during the conversion process. (Signals the end)  
while ($b >= 0x20);  
 
// Check if negative, and convert. (All negative values have the last bit  
// set)  
$dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1));  
 
// Compute actual latitude since value is offset from previous value.  
$lat += $dlat;  
 
// The next values will correspond to the longitude for this point.  
$shift = 0;  
$result = 0;  
do  
{  
$b = ord(substr($encoded, $index++)) - 63;  
$result |= ($b & 0x1f) << $shift;  
$shift += 5;  
}  
while ($b >= 0x20);  
 
$dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1));  
$lng += $dlng;  
 
// The actual latitude and longitude values were multiplied by  
// 1e5 before encoding so that they could be converted to a 32-bit  
// integer representation. (With a decimal accuracy of 5 places)  
// Convert back to original values.  
$points[] = array($lat * 1e-5, $lng * 1e-5);  
}  
 
return $points;  
}  
 
function object2array($object) {  
if (is_object($object)) {  
foreach ($object as $key => $value) {  
$array[$key] = $value;  
}  
}  
else {  
$array = $object;  
}  
return $array;  
}  
 
function geocode($query, $giveOptions) {  
global $cloudmadeAPIkey;  
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=".$query."&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true";  
$contents = json_decode(getPage($url));  
if ($giveOptions) return $contents->features;  
elseif (isset($contents->features[0]->centroid)) return $contents->features[0]->centroid->coordinates[0].",".$contents->features[0]->centroid->coordinates[1];  
else return "";  
}  
 
function reverseGeocode($lat,$lng) {  
global $cloudmadeAPIkey;  
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=".$lat.",".$lng."&distance=closest&object_type=road";  
$contents = json_decode(getPage($url));  
return $contents->features[0]->properties->name;  
}  
 
function startsWith($haystack,$needle,$case=true) {  
if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);}  
return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0);  
}  
 
function endsWith($haystack,$needle,$case=true) {  
if($case){return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);}  
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);  
}  
function bracketsMeanNewLine($input) {  
return str_replace(")","</small>",str_replace("(","<br><small>",$input));  
}  
 
function viaPoints($tripid,$stopid, $timingPointsOnly = false) {  
global $APIurl;  
$url = $APIurl."/json/tripstoptimes?trip=".$tripid;  
 
$json = json_decode(getPage($url));  
debug(print_r($json,true));  
$stops = $json[0];  
$times = $json[1];  
$foundStop = false;  
$viaPoints = Array();  
foreach ($stops as $key => $row)  
{  
if ($foundStop) {  
if (!$timingPointsOnly || !startsWith($row[5],"Wj") ) {  
$viaPoints[] = Array("id" => $row[0], "name" => $row[1], "time" => $times[$key]);  
}  
} else {  
if ($row[0] == $stopid) $foundStop = true;  
}  
}  
return $viaPoints;  
}  
 
function viaPointNames($tripid,$stopid) {  
$points = viaPoints($tripid,$stopid,true);  
$pointNames = Array();  
foreach ($points as $point) {  
$pointNames[] = $point['name'];  
}  
return implode(", ",$pointNames);  
}  
 
function timePlaceSettings($geolocate = false) {  
global $service_periods;  
$geoerror = false;  
if ($geolocate == true) {  
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat'])  
|| $_SESSION['lat'] == "" || $_SESSION['lon'] == "";  
}  
if ($geoerror) {  
echo '<div class="error">Sorry, but your location could not currently be detected.  
Please allow location permission, wait for your location to be detected,  
or enter an address/co-ordinates in the box below.</div>';  
}  
echo '<div data-role="collapsible" data-collapsed="'.!$geoerror.'">  
<h3>Change Time/Place...</h3>  
<form action="" method="post">  
<div class="ui-body">  
<div data-role="fieldcontain">  
<label for="geolocate"> Current Location: </label>  
<input type="text" id="geolocate" name="geolocate" value="Enter co-ordinates or address here"/> <a href="#" style="display:none" name="here" id="here"/>Here?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="time"> Time: </label>  
<input type="time" name="time" id="time" value="'. ($_SESSION['time'] ? $_SESSION['time'] : date("H:m")).'"/> <a href="#" name="currentTime" id="currentTime"/>Current Time?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="service_period"> Service Period: </label>  
<select name="service_period">';  
 
foreach ($service_periods as $service_period) {  
echo "<option value=\"$service_period\"".(service_period() === $service_period ? "SELECTED" : "").'>'.ucwords($service_period).'</option>';  
}  
echo '</select>  
<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>  
</div>  
 
<input type="submit" value="Update"/>  
</form>  
</div></div>';  
}  
?>  
 Binary files a/busui/css/images/01-refresh.png and /dev/null differ
 Binary files a/busui/css/images/02-redo.png and /dev/null differ
 Binary files a/busui/css/images/06-magnify.png and /dev/null differ
 Binary files a/busui/css/images/07-map-marker.png and /dev/null differ
 Binary files a/busui/css/images/101-gameplan.png and /dev/null differ
 Binary files a/busui/css/images/102-walk.png and /dev/null differ
 Binary files a/busui/css/images/103-map.png and /dev/null differ
 Binary files a/busui/css/images/113-navigation.png and /dev/null differ
 Binary files a/busui/css/images/121-landscape.png and /dev/null differ
 Binary files a/busui/css/images/13-target.png and /dev/null differ
 Binary files a/busui/css/images/139-flags.png and /dev/null differ
 Binary files a/busui/css/images/145-persondot.png and /dev/null differ
 Binary files a/busui/css/images/184-warning.png and /dev/null differ
 Binary files a/busui/css/images/193-location-arrow.png and /dev/null differ
 Binary files a/busui/css/images/28-star.png and /dev/null differ
 Binary files a/busui/css/images/53-house.png and /dev/null differ
 Binary files a/busui/css/images/55-network.png and /dev/null differ
 Binary files a/busui/css/images/57-download.png and /dev/null differ
 Binary files a/busui/css/images/58-bookmark.png and /dev/null differ
 Binary files a/busui/css/images/59-flag.png and /dev/null differ
 Binary files a/busui/css/images/60-signpost.png and /dev/null differ
 Binary files a/busui/css/images/73-radar.png and /dev/null differ
 Binary files a/busui/css/images/74-location.png and /dev/null differ
 Binary files a/busui/css/images/83-calendar.png and /dev/null differ
 Binary files a/busui/css/images/ajax-loader.png and /dev/null differ
 Binary files a/busui/css/images/form-check-off.png and /dev/null differ
 Binary files a/busui/css/images/form-check-on.png and /dev/null differ
 Binary files a/busui/css/images/form-radio-off.png and /dev/null differ
 Binary files a/busui/css/images/form-radio-on.png and /dev/null differ
 Binary files a/busui/css/images/icon-search-black.png and /dev/null differ
 Binary files a/busui/css/images/icons-18-black.png and /dev/null differ
 Binary files a/busui/css/images/icons-18-white.png and /dev/null differ
 Binary files a/busui/css/images/icons-36-black.png and /dev/null differ
 Binary files a/busui/css/images/icons-36-white.png and /dev/null differ
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/.ui-bar-a{border:1px solid #2a2a2a;background:#111;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #000;background-image:-moz-linear-gradient(top,#3c3c3c,#111);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3c3c3c),color-stop(1,#111));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#3c3c3c', EndColorStr='#111111')"}.ui-bar-a,.ui-bar-a input,.ui-bar-a select,.ui-bar-a textarea,.ui-bar-a button{font-family:Helvetica,Arial,sans-serif}.ui-bar-a .ui-link-inherit{color:#fff}.ui-bar-a .ui-link{color:#7cc4e7;font-weight:bold}.ui-body-a{border:1px solid #2a2a2a;background:#222;color:#fff;text-shadow:0 1px 0 #000;font-weight:normal;background-image:-moz-linear-gradient(top,#666,#222);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#666),color-stop(1,#222));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#222222)')"}.ui-body-a,.ui-body-a input,.ui-body-a select,.ui-body-a textarea,.ui-body-a button{font-family:Helvetica,Arial,sans-serif}.ui-body-a .ui-link-inherit{color:#fff}.ui-body-a .ui-link{color:#2489ce;font-weight:bold}.ui-br{border-bottom:1px solid rgba(130,130,130,.3)}.ui-btn-up-a{border:1px solid #222;background:#333;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #000;text-decoration:none;background-image:-moz-linear-gradient(top,#555,#333);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#555),color-stop(1,#333));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#555555', EndColorStr='#333333')"}.ui-btn-up-a a.ui-link-inherit{color:#fff}.ui-btn-hover-a{border:1px solid #000;background:#444;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;text-decoration:none;background-image:-moz-linear-gradient(top,#666,#444);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#666),color-stop(1,#444));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#666666', EndColorStr='#444444')"}.ui-btn-hover-a a.ui-link-inherit{color:#fff}.ui-btn-down-a{border:1px solid #000;background:#3d3d3d;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;background-image:-moz-linear-gradient(top,#333,#5a5a5a);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#333),color-stop(1,#5a5a5a));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#333333', EndColorStr='#5a5a5a')"}.ui-btn-down-a a.ui-link-inherit{color:#fff}.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a{font-family:Helvetica,Arial,sans-serif}.ui-bar-b{border:1px solid #456f9a;background:#5e87b0;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #254f7a;background-image:-moz-linear-gradient(top,#81a8ce,#5e87b0);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#81a8ce),color-stop(1,#5e87b0));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#81a8ce', EndColorStr='#5e87b0')"}.ui-bar-b,.ui-bar-b input,.ui-bar-b select,.ui-bar-b textarea,.ui-bar-b button{font-family:Helvetica,Arial,sans-serif}.ui-bar-b .ui-link-inherit{color:#fff}.ui-bar-b .ui-link{color:#7cc4e7;font-weight:bold}.ui-body-b{border:1px solid #c6c6c6;background:#ccc;color:#333;text-shadow:0 1px 0 #fff;font-weight:normal;background-image:-moz-linear-gradient(top,#e6e6e6,#ccc);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#e6e6e6),color-stop(1,#ccc));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#e6e6e6', EndColorStr='#cccccc')"}.ui-body-b,.ui-body-b input,.ui-body-b select,.ui-body-b textarea,.ui-body-b button{font-family:Helvetica,Arial,sans-serif}.ui-body-b .ui-link-inherit{color:#333}.ui-body-b .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-b{border:1px solid #145072;background:#2567ab;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #145072;text-decoration:none;background-image:-moz-linear-gradient(top,#4e89c5,#2567ab);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#5f9cc5),color-stop(1,#396b9e));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#4e89c5', EndColorStr='#2567ab')"}.ui-btn-up-b a.ui-link-inherit{color:#fff}.ui-btn-hover-b{border:1px solid #00516e;background:#4b88b6;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #014d68;background-image:-moz-linear-gradient(top,#72b0d4,#4b88b6);text-decoration:none;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#72b0d4),color-stop(1,#4b88b6));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#72b0d4', EndColorStr='#4b88b6')"}.ui-btn-hover-b a.ui-link-inherit{color:#fff}.ui-btn-down-b{border:1px solid #225377;background:#4e89c5;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #225377;background-image:-moz-linear-gradient(top,#396b9e,#4e89c5);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#396b9e),color-stop(1,#4e89c5));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#396b9e', EndColorStr='#4e89c5')"}.ui-btn-down-b a.ui-link-inherit{color:#fff}.ui-btn-up-b,.ui-btn-hover-b,.ui-btn-down-b{font-family:Helvetica,Arial,sans-serif}.ui-bar-c{border:1px solid #b3b3b3;background:#e9eaeb;color:#3e3e3e;font-weight:bold;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#f0f0f0,#e9eaeb);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#f0f0f0),color-stop(1,#e9eaeb));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#f0f0f0', EndColorStr='#e9eaeb')"}.ui-bar-c,.ui-bar-c input,.ui-bar-c select,.ui-bar-c textarea,.ui-bar-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c{border:1px solid #b3b3b3;color:#333;text-shadow:0 1px 0 #fff;background:#f0f0f0;background-image:-moz-linear-gradient(top,#eee,#ddd);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#ddd));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#dddddd')"}.ui-body-c,.ui-body-c input,.ui-body-c select,.ui-body-c textarea,.ui-body-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c .ui-link-inherit{color:#333}.ui-body-c .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-c{border:1px solid #ccc;background:#eee;font-weight:bold;color:#444;cursor:pointer;text-shadow:0 1px 1px #f6f6f6;text-decoration:none;background-image:-moz-linear-gradient(top,#fefefe,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fdfdfd),color-stop(1,#eee));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"}.ui-btn-up-c a.ui-link-inherit{color:#2f3e46}.ui-btn-hover-c{border:1px solid #bbb;background:#dadada;font-weight:bold;color:#101010;text-decoration:none;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#ededed,#dadada);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ededed),color-stop(1,#dadada));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#ededed', EndColorStr='#dadada')"}.ui-btn-hover-c a.ui-link-inherit{color:#2f3e46}.ui-btn-down-c{border:1px solid #808080;background:#fdfdfd;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#eee,#fdfdfd);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#fdfdfd));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#fdfdfd')"}.ui-btn-down-c a.ui-link-inherit{color:#2f3e46}.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c{font-family:Helvetica,Arial,sans-serif}.ui-bar-d{border:1px solid #ccc;background:#bbb;color:#333;text-shadow:0 1px 0 #eee;background-image:-moz-linear-gradient(top,#ddd,#bbb);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ddd),color-stop(1,#bbb));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#dddddd', EndColorStr='#bbbbbb')"}.ui-bar-d,.ui-bar-d input,.ui-bar-d select,.ui-bar-d textarea,.ui-bar-d button{font-family:Helvetica,Arial,sans-serif}.ui-bar-d .ui-link-inherit{color:#333}.ui-bar-d .ui-link{color:#2489ce;font-weight:bold}.ui-body-d{border:1px solid #ccc;color:#333;text-shadow:0 1px 0 #fff;background:#fff}.ui-body-d,.ui-body-d input,.ui-body-d select,.ui-body-d textarea,.ui-body-d button{font-family:Helvetica,Arial,sans-serif}.ui-body-d .ui-link-inherit{color:#333}.ui-body-d .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-d{border:1px solid #ccc;background:#fff;font-weight:bold;color:#444;text-decoration:none;text-shadow:0 1px 1px #fff}.ui-btn-up-d a.ui-link-inherit{color:#333}.ui-btn-hover-d{border:1px solid #aaa;background:#eee;font-weight:bold;color:#222;cursor:pointer;text-shadow:0 1px 1px #fff;text-decoration:none;background-image:-moz-linear-gradient(top,#fdfdfd,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fdfdfd),color-stop(1,#eee));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fdfdfd', EndColorStr='#eeeeee')"}.ui-btn-hover-d a.ui-link-inherit{color:#222}.ui-btn-down-d{border:1px solid #aaa;background:#fff;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#eee,#fff);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#eee),color-stop(1,#fff));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#eeeeee', EndColorStr='#ffffff')"}.ui-btn-down-d a.ui-link-inherit{border:1px solid #808080;background:#ced0d2;font-weight:bold;color:#111;text-shadow:none;background-image:-moz-linear-gradient(top,#ccc,#eee);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#ccc),color-stop(1,#eee));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#cccccc', EndColorStr='#eeeeee')"}.ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d{font-family:Helvetica,Arial,sans-serif}.ui-bar-e{border:1px solid #f7c942;background:#fadb4e;color:#333;text-shadow:0 1px 0 #fff;background-image:-moz-linear-gradient(top,#fceda7,#fadb4e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fceda7),color-stop(1,#fadb4e));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"}.ui-bar-e,.ui-bar-e input,.ui-bar-e select,.ui-bar-e textarea,.ui-bar-d button{font-family:Helvetica,Arial,sans-serif}.ui-bar-e .ui-link-inherit{color:#333}.ui-bar-e .ui-link{color:#2489ce;font-weight:bold}.ui-body-e{border:1px solid #f7c942;color:#333;text-shadow:0 1px 0 #fff;background:#faeb9e;background-image:-moz-linear-gradient(top,#fff,#faeb9e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#faeb9e));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#faeb9e')"}.ui-body-e,.ui-body-e input,.ui-body-e select,.ui-body-e textarea,.ui-body-e button{font-family:Helvetica,Arial,sans-serif}.ui-body-e .ui-link-inherit{color:#333}.ui-body-e .ui-link{color:#2489ce;font-weight:bold}.ui-btn-up-e{border:1px solid #f7c942;background:#fadb4e;font-weight:bold;color:#333;cursor:pointer;text-shadow:0 1px 1px #fe3;text-decoration:none;text-shadow:0 1px 0 #fff;background-image:-moz-linear-gradient(top,#fceda7,#fadb4e);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fceda7),color-stop(1,#fadb4e));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fceda7', EndColorStr='#fadb4e')"}.ui-btn-up-e a.ui-link-inherit{color:#333}.ui-btn-hover-e{border:1px solid #e79952;background:#fbe26f;font-weight:bold;color:#111;text-decoration:none;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#fcf0b5,#fbe26f);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fcf0b5),color-stop(1,#fbe26f));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcf0b5', EndColorStr='#fbe26f')"}.ui-btn-hover-e a.ui-link-inherit{color:#333}.ui-btn-down-e{border:1px solid #f7c942;background:#fceda7;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-moz-linear-gradient(top,#fadb4e,#fceda7);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fadb4e),color-stop(1,#fceda7));-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#fadb4e', EndColorStr='#fceda7')"}.ui-btn-down-e a.ui-link-inherit{color:#333}.ui-btn-up-e,.ui-btn-hover-e,.ui-btn-down-e{font-family:Helvetica,Arial,sans-serif}a.ui-link-inherit{text-decoration:none!important}.ui-btn-active{border:1px solid #155678;background:#4596ce;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #145072;text-decoration:none;background-image:-moz-linear-gradient(top,#85bae4,#5393c5);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#85bae4),color-stop(1,#5393c5));-msfilter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#85bae4', EndColorStr='#5393c5')";outline:0}.ui-btn-active a.ui-link-inherit{color:#fff}.ui-btn-inner{border-top:1px solid #fff;border-color:rgba(255,255,255,.3)}.ui-corner-tl{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em}.ui-corner-tr{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bl{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-br{-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-top{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bottom{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-right{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-left{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-all{-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.ui-disabled{opacity:.3}.ui-disabled,.ui-disabled a{cursor:default!important}.ui-icon{background-image:url(images/icons-18-white.png);background-repeat:no-repeat;background-color:#666;background-color:rgba(0,0,0,.4);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.ui-icon-disc{background-color:#666;background-color:rgba(0,0,0,.3);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.ui-icon-black{background-image:url(images/icons-18-black.png)}.ui-icon-black-disc{background-color:#fff;background-color:rgba(255,255,255,.3);-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}@media screen and (-webkit-min-device-pixel-ratio:2),screen and (max--moz-device-pixel-ratio:2){.ui-icon{background-image:url(images/icons-36-white.png);background-size:630px 18px}.ui-icon-black{background-image:url(images/icons-36-black.png)}}.ui-icon-plus{background-position:-0 0}.ui-icon-minus{background-position:-36px 0}.ui-icon-delete{background-position:-72px 0}.ui-icon-arrow-r{background-position:-108px 0}.ui-icon-arrow-l{background-position:-144px 0}.ui-icon-arrow-u{background-position:-180px 0}.ui-icon-arrow-d{background-position:-216px 0}.ui-icon-check{background-position:-252px 0}.ui-icon-gear{background-position:-288px 0}.ui-icon-refresh{background-position:-324px 0}.ui-icon-forward{background-position:-360px 0}.ui-icon-back{background-position:-396px 0}.ui-icon-grid{background-position:-432px 0}.ui-icon-star{background-position:-468px 0}.ui-icon-alert{background-position:-504px 0}.ui-icon-info{background-position:-540px 0}.ui-icon-home{background-position:-576px 0}.ui-icon-search{background-position:-612px 0}.ui-icon-checkbox-off,.ui-icon-checkbox-on,.ui-icon-radio-off,.ui-icon-radio-on{background-color:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;background-size:20px 20px}.ui-icon-checkbox-off{background-image:url(images/form-check-off.png)}.ui-icon-checkbox-on{background-image:url(images/form-check-on.png)}.ui-icon-radio-off{background-image:url(images/form-radio-off.png)}.ui-icon-radio-on{background-image:url(images/form-radio-on.png)}.ui-icon-searchfield{background-image:url(images/icon-search-black.png);background-size:16px 16px}.ui-icon-loading{background-image:url(images/ajax-loader.png);width:40px;height:40px;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;background-size:35px 35px}.ui-btn-corner-tl{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em}.ui-btn-corner-tr{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bl{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-br{-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-top{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bottom{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-right{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-left{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-all{-moz-border-radius:1em;-webkit-border-radius:1em;border-radius:1em}.ui-corner-tl,.ui-corner-tr,.ui-corner-bl,.ui-corner-br,.ui-corner-top,.ui-corner-bottom,.ui-corner-right,.ui-corner-left,.ui-corner-all,.ui-btn-corner-tl,.ui-btn-corner-tr,.ui-btn-corner-bl,.ui-btn-corner-br,.ui-btn-corner-top,.ui-btn-corner-bottom,.ui-btn-corner-right,.ui-btn-corner-left,.ui-btn-corner-all{-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.ui-overlay{background:#666;opacity:.5;filter:Alpha(Opacity=50);position:absolute;width:100%;height:100%}.ui-overlay-shadow{-moz-box-shadow:0 0 12px rgba(0,0,0,.6);-webkit-box-shadow:0 0 12px rgba(0,0,0,.6);box-shadow:0 0 12px rgba(0,0,0,.6)}.ui-shadow{-moz-box-shadow:0 1px 4px rgba(0,0,0,.3);-webkit-box-shadow:0 1px 4px rgba(0,0,0,.3);box-shadow:0 1px 4px rgba(0,0,0,.3)}.ui-bar-a .ui-shadow,.ui-bar-b .ui-shadow,.ui-bar-c .ui-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.3);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.3);box-shadow:0 1px 0 rgba(255,255,255,.3)}.ui-shadow-inset{-moz-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);box-shadow:inset 0 1px 4px rgba(0,0,0,.2)}.ui-icon-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.4);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.4);box-shadow:0 1px 0 rgba(255,255,255,.4)}.ui-focus{-moz-box-shadow:0 0 12px #387bbe;-webkit-box-shadow:0 0 12px #387bbe;box-shadow:0 0 12px #387bbe}.ui-mobile-nosupport-boxshadow *{-moz-box-shadow:none!important;-webkit-box-shadow:none!important;box-shadow:none!important}.ui-mobile-nosupport-boxshadow .ui-focus{outline-width:2px}.ui-mobile fieldset,.ui-page{padding:0;margin:0}.ui-mobile a img,.ui-mobile fieldset{border:0}.ui-mobile-viewport{margin:0;overflow-x:hidden;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}[data-role=page],[data-role=dialog],.ui-page{top:0;left:0;width:100%;min-height:100%;position:absolute;display:none;border:0}.ui-page-active{display:block;overflow:visible}.portrait,.portrait .ui-page{min-height:480px}.landscape,.landscape .ui-page{min-height:320px}.ui-loading .ui-mobile-viewport{overflow:hidden!important}.ui-loading .ui-loader{display:block}.ui-loading .ui-page{overflow:hidden}.ui-loader{display:none;position:absolute;opacity:.85;z-index:10;left:50%;width:200px;margin-left:-130px;margin-top:-35px;padding:10px 30px}.ui-loader h1{font-size:15px;text-align:center}.ui-loader .ui-icon{position:static;display:block;opacity:.9;margin:0 auto;width:35px;height:35px;background-color:transparent}.ui-mobile-rendering>*{visibility:hidden}.ui-bar,.ui-body{position:relative;padding:.4em 15px;overflow:hidden;display:block;clear:both}.ui-bar{font-size:16px;margin:0}.ui-bar h1,.ui-bar h2,.ui-bar h3,.ui-bar h4,.ui-bar h5,.ui-bar h6{margin:0;padding:0;font-size:16px;display:inline-block}.ui-header,.ui-footer{display:block}.ui-page .ui-header,.ui-page .ui-footer{position:relative}.ui-header .ui-btn-left{position:absolute;left:10px;top:.4em}.ui-header .ui-title,.ui-footer .ui-title{text-align:center;font-size:16px;display:block;margin:.6em 90px .8em;padding:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;outline:0!important}.ui-header .ui-btn-right{position:absolute;right:10px;top:.4em}.ui-content{border-width:0;overflow:visible;overflow-x:hidden;padding:15px}.ui-page-fullscreen .ui-content{padding:0}.ui-icon{width:18px;height:18px}.ui-fullscreen img{max-width:100%}.ui-nojs{position:absolute;left:-9999px}.spin{-webkit-transform:rotate(360deg);-webkit-animation-name:spin;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite}@-webkit-keyframes spin{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(360deg)}}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms}.slide.in{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromright}.slide.out{-webkit-transform:translateX(-100%);-webkit-animation-name:slideouttoleft}.slide.in.reverse{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromleft}.slide.out.reverse{-webkit-transform:translateX(100%);-webkit-animation-name:slideouttoright}.slideup.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfrombottom;z-index:10}.slideup.out{-webkit-animation-name:dontmove;z-index:0}.slideup.out.reverse{-webkit-transform:translateY(100%);z-index:10;-webkit-animation-name:slideouttobottom}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove}.slidedown.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfromtop;z-index:10}.slidedown.out{-webkit-animation-name:dontmove;z-index:0}.slidedown.out.reverse{-webkit-transform:translateY(-100%);z-index:10;-webkit-animation-name:slideouttotop}.slidedown.in.reverse{z-index:0;-webkit-animation-name:dontmove}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(-100%)}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(100%)}}@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY(-100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY(100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(100%)}}@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(-100%)}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}.fade.in{opacity:1;z-index:10;-webkit-animation-name:fadein}.fade.out{z-index:0;-webkit-animation-name:fadeout}.ui-mobile-viewport-perspective{-webkit-perspective:1000;position:absolute}.ui-mobile-viewport-transitioning,.ui-mobile-viewport-transitioning .ui-page{width:100%;height:100%;overflow:hidden}.flip{-webkit-animation-duration:.65s;-webkit-backface-visibility:hidden;-webkit-transform:translateX(0)}.flip.in{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromleft}.flip.out{-webkit-transform:rotateY(-180deg) scale(.8);-webkit-animation-name:flipouttoleft}.flip.in.reverse{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromright}.flip.out.reverse{-webkit-transform:rotateY(180deg) scale(.8);-webkit-animation-name:flipouttoright}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(-180deg) scale(.8)}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(180deg) scale(.8)}}@-webkit-keyframes dontmove{from{opacity:1}to{opacity:1}}.pop{-webkit-transform-origin:50% 50%}.pop.in{-webkit-transform:scale(1);opacity:1;-webkit-animation-name:popin;z-index:10}.pop.out.reverse{-webkit-transform:scale(.2);opacity:0;-webkit-animation-name:popout;z-index:10}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.2);opacity:0}}.ui-grid-a,.ui-grid-b,.ui-grid-c,.ui-grid-d{overflow:hidden}.ui-block-a,.ui-block-b,.ui-block-c,.ui-block-d,.ui-block-e{margin:0;padding:0;border:0;float:left}.ui-grid-a .ui-block-a,.ui-grid-a .ui-block-b{width:50%}.ui-grid-a .ui-block-a{clear:left}.ui-grid-b .ui-block-a,.ui-grid-b .ui-block-b,.ui-grid-b .ui-block-c{width:33.333%}.ui-grid-b .ui-block-a{clear:left}.ui-grid-c .ui-block-a,.ui-grid-c .ui-block-b,.ui-grid-c .ui-block-c,.ui-grid-c .ui-block-d{width:25%}.ui-grid-c .ui-block-a{clear:left}.ui-grid-d .ui-block-a,.ui-grid-d .ui-block-b,.ui-grid-d .ui-block-c,.ui-grid-d .ui-block-d,.ui-grid-d .ui-block-e{width:20%}.ui-grid-d .ui-block-a{clear:left}.ui-header,.ui-footer,.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{position:absolute;overflow:hidden;width:100%;border-left-width:0;border-right-width:0}.ui-header-fixed,.ui-footer-fixed{z-index:1000;-webkit-transform:translateZ(0)}.ui-footer-duplicate,.ui-page-fullscreen .ui-fixed-inline{display:none}.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{opacity:.9}.ui-navbar{overflow:hidden}.ui-navbar ul,.ui-navbar-expanded ul{list-style:none;padding:0;margin:0;position:relative;display:block;border:0}.ui-navbar-collapsed ul{float:left;width:75%;margin-right:-2px}.ui-navbar-collapsed .ui-navbar-toggle{float:left;width:25%}.ui-navbar li.ui-navbar-truncate{position:absolute;left:-9999px;top:-9999px}.ui-navbar li .ui-btn,.ui-navbar .ui-navbar-toggle .ui-btn{display:block;font-size:12px;text-align:center;margin:0;border-right-width:0}.ui-navbar li .ui-btn{margin-right:-1px}.ui-navbar li .ui-btn:last-child{margin-right:0}.ui-header .ui-navbar li .ui-btn,.ui-header .ui-navbar .ui-navbar-toggle .ui-btn,.ui-footer .ui-navbar li .ui-btn,.ui-footer .ui-navbar .ui-navbar-toggle .ui-btn{border-top-width:0;border-bottom-width:0}.ui-navbar .ui-btn-inner{padding-left:2px;padding-right:2px}.ui-navbar-noicons li .ui-btn .ui-btn-inner,.ui-navbar-noicons .ui-navbar-toggle .ui-btn-inner{padding-top:.8em;padding-bottom:.9em}.ui-navbar-expanded .ui-btn{margin:0;font-size:14px}.ui-navbar-expanded .ui-btn-inner{padding-left:5px;padding-right:5px}.ui-navbar-expanded .ui-btn-icon-top .ui-btn-inner{padding:45px 5px 15px;text-align:center}.ui-navbar-expanded .ui-btn-icon-top .ui-icon{top:15px}.ui-navbar-expanded .ui-btn-icon-bottom .ui-btn-inner{padding:15px 5px 45px;text-align:center}.ui-navbar-expanded .ui-btn-icon-bottom .ui-icon{bottom:15px}.ui-navbar-expanded li .ui-btn .ui-btn-inner{min-height:2.5em}.ui-navbar-expanded .ui-navbar-noicons .ui-btn .ui-btn-inner{padding-top:1.8em;padding-bottom:1.9em}.ui-btn{display:block;text-align:center;cursor:pointer;position:relative;margin:.5em 5px;padding:0}.ui-btn:focus,.ui-btn:active{outline:0}.ui-header .ui-btn,.ui-footer .ui-btn,.ui-bar .ui-btn{display:inline-block;font-size:13px;margin:0}.ui-btn-inline{display:inline-block}.ui-btn-inner{padding:.6em 25px;display:block;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative}.ui-header .ui-btn-inner,.ui-footer .ui-btn-inner,.ui-bar .ui-btn-inner{padding:.4em 8px .5em}.ui-btn-icon-notext{display:inline-block;width:20px;height:20px;padding:2px 1px 2px 3px;text-indent:-9999px}.ui-btn-icon-notext .ui-btn-inner{padding:0}.ui-btn-icon-notext .ui-btn-text{position:absolute;left:-999px}.ui-btn-icon-left .ui-btn-inner{padding-left:33px}.ui-header .ui-btn-icon-left .ui-btn-inner,.ui-footer .ui-btn-icon-left .ui-btn-inner,.ui-bar .ui-btn-icon-left .ui-btn-inner{padding-left:27px}.ui-btn-icon-right .ui-btn-inner{padding-right:33px}.ui-header .ui-btn-icon-right .ui-btn-inner,.ui-footer .ui-btn-icon-right .ui-btn-inner,.ui-bar .ui-btn-icon-right .ui-btn-inner{padding-right:27px}.ui-btn-icon-top .ui-btn-inner{padding-top:33px}.ui-header .ui-btn-icon-top .ui-btn-inner,.ui-footer .ui-btn-icon-top .ui-btn-inner,.ui-bar .ui-btn-icon-top .ui-btn-inner{padding-top:27px}.ui-btn-icon-bottom .ui-btn-inner{padding-bottom:33px}.ui-header .ui-btn-icon-bottom .ui-btn-inner,.ui-footer .ui-btn-icon-bottom .ui-btn-inner,.ui-bar .ui-btn-icon-bottom .ui-btn-inner{padding-bottom:27px}.ui-btn-icon-notext .ui-icon{display:block}.ui-btn-icon-left .ui-icon,.ui-btn-icon-right .ui-icon{position:absolute;top:50%;margin-top:-9px}.ui-btn-icon-top .ui-icon,.ui-btn-icon-bottom .ui-icon{position:absolute;left:50%;margin-left:-9px}.ui-btn-icon-left .ui-icon{left:10px}.ui-btn-icon-right .ui-icon{right:10px}.ui-header .ui-btn-icon-left .ui-icon,.ui-footer .ui-btn-icon-left .ui-icon,.ui-bar .ui-btn-icon-left .ui-icon{left:4px}.ui-header .ui-btn-icon-right .ui-icon,.ui-footer .ui-btn-icon-right .ui-icon,.ui-bar .ui-btn-icon-right .ui-icon{right:4px}.ui-header .ui-btn-icon-top .ui-icon,.ui-footer .ui-btn-icon-top .ui-icon,.ui-bar .ui-btn-icon-top .ui-icon{top:4px}.ui-header .ui-btn-icon-bottom .ui-icon,.ui-footer .ui-btn-icon-bottom .ui-icon,.ui-bar .ui-btn-icon-bottom .ui-icon{bottom:4px}.ui-btn-icon-top .ui-icon{top:5px}.ui-btn-icon-bottom .ui-icon{bottom:5px}.ui-btn-hidden{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-appearance:button;opacity:0;cursor:pointer}.ui-collapsible-contain{margin:.5em 0}.ui-collapsible-heading{font-size:16px;display:block;margin:0 -8px;padding:0;border-width:0 0 1px 0;position:relative}.ui-collapsible-heading a{text-align:left;margin:0}.ui-collapsible-heading a .ui-btn-inner{padding-left:40px}.ui-collapsible-heading a span.ui-btn{position:absolute;left:6px;top:50%;margin:-12px 0 0 0;width:20px;height:20px;padding:1px 0 1px 2px;text-indent:-9999px}.ui-collapsible-heading a span.ui-btn .ui-btn-inner{padding:0}.ui-collapsible-heading a span.ui-btn .ui-icon{left:0;margin-top:-10px}.ui-collapsible-heading-status{position:absolute;left:-9999px}.ui-collapsible-content{display:block;padding:10px 0 10px 8px}.ui-collapsible-content-collapsed{display:none}.ui-collapsible-set{margin:.5em 0}.ui-collapsible-set .ui-collapsible-contain{margin:-1px 0 0}.ui-controlgroup,fieldset.ui-controlgroup{padding:0;margin:.5em 0 1em}.ui-bar .ui-controlgroup{margin:0 .3em}.ui-controlgroup-label{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em}.ui-controlgroup-controls{display:block;width:95%}.ui-controlgroup li{list-style:none}.ui-controlgroup-vertical .ui-btn,.ui-controlgroup-vertical .ui-checkbox,.ui-controlgroup-vertical .ui-radio{margin:0;border-bottom-width:0}.ui-controlgroup-vertical .ui-controlgroup-last{border-bottom-width:1px}.ui-controlgroup-horizontal{padding:0}.ui-controlgroup-horizontal .ui-btn,.ui-controlgroup-horizontal .ui-checkbox,.ui-controlgroup-horizontal .ui-radio{margin:0 -5px 0 0;display:inline-block}.ui-controlgroup-horizontal .ui-checkbox .ui-btn,.ui-controlgroup-horizontal .ui-radio .ui-btn,.ui-controlgroup-horizontal .ui-checkbox:last-child,.ui-controlgroup-horizontal .ui-radio:last-child{margin-right:0}.ui-controlgroup-horizontal .ui-controlgroup-last{margin-right:0}.ui-controlgroup .ui-checkbox label,.ui-controlgroup .ui-radio label{font-size:16px}.min-width-480px .ui-controlgroup-label{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px .ui-controlgroup-controls{width:60%;display:inline-block}.ui-dialog{min-height:480px}.ui-dialog .ui-header,.ui-dialog .ui-content,.ui-dialog .ui-footer{margin:15px;position:relative}.ui-dialog .ui-header,.ui-dialog .ui-footer{z-index:10;width:auto}.ui-dialog .ui-content,.ui-dialog .ui-footer{margin-top:-15px}.ui-checkbox,.ui-radio{position:relative;margin:.2em 0 .5em;z-index:1}.ui-checkbox .ui-btn,.ui-radio .ui-btn{margin:0;text-align:left;z-index:2}.ui-checkbox .ui-btn-icon-left .ui-btn-inner,.ui-radio .ui-btn-icon-left .ui-btn-inner{padding-left:45px}.ui-checkbox .ui-btn-icon-right .ui-btn-inner,.ui-radio .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-checkbox .ui-btn-icon-left .ui-icon,.ui-radio .ui-btn-icon-left .ui-icon{left:15px}.ui-checkbox .ui-btn-icon-right .ui-icon,.ui-radio .ui-btn-icon-right .ui-icon{right:15px}.ui-checkbox input,.ui-radio input{position:absolute;left:20px;top:50%;width:10px;height:10px;margin:-5px 0 0 0;outline:0!important;z-index:1}.ui-field-contain{background:0;padding:1.5em 0;margin:0;border-bottom-width:1px;overflow:visible}.ui-field-contain:first-child{border-top-width:0}.min-width-480px .ui-field-contain{border-width:0;padding:0;margin:1em 0}.ui-select{display:block;position:relative}.ui-select select{position:absolute;left:-9999px;top:-9999px}.ui-select .ui-btn select{cursor:pointer;-webkit-appearance:button;left:0;top:0;width:100%;height:100%;opacity:.001}.ui-select .ui-btn select.ui-select-nativeonly{opacity:1}.ui-select .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-select .ui-btn-icon-right .ui-icon{right:15px}label.ui-select{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em;display:block}.ui-select .ui-btn-text,.ui-selectmenu .ui-btn-text{display:inline-block;min-height:1em}.ui-select .ui-btn-text{text-overflow:ellipsis;overflow:hidden;width:85%}.ui-selectmenu{position:absolute;padding:0;z-index:100!important;width:80%;max-width:350px;padding:6px}.ui-selectmenu .ui-listview{margin:0}.ui-selectmenu .ui-btn.ui-li-divider{cursor:default}.ui-selectmenu-hidden{top:-9999px;left:-9999px}.ui-selectmenu-screen{position:absolute;top:0;left:0;width:100%;height:100%;z-index:99}.ui-screen-hidden,.ui-selectmenu-list .ui-li .ui-icon{display:none}.ui-selectmenu-list .ui-li .ui-icon{display:block}.ui-li.ui-selectmenu-placeholder{display:none}.min-width-480px label.ui-select{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px .ui-select{width:60%;display:inline-block}.ui-selectmenu .ui-header h1:after{content:'.';visibility:hidden}label.ui-input-text{font-size:16px;line-height:1.4;display:block;font-weight:normal;margin:0 0 .3em}input.ui-input-text,textarea.ui-input-text{background-image:none;padding:.4em;line-height:1.4;font-size:16px;display:block;width:95%}input.ui-input-text{-webkit-appearance:none}textarea.ui-input-text{height:50px;-webkit-transition:height 200ms linear;-moz-transition:height 200ms linear;-o-transition:height 200ms linear;transition:height 200ms linear}.ui-input-search{padding:0 30px;width:77%;background-position:8px 50%;background-repeat:no-repeat;position:relative}.ui-input-search input.ui-input-text{border:0;width:98%;padding:.4em 0;margin:0;display:block;background:transparent none;outline:0!important}.ui-input-search .ui-input-clear{position:absolute;right:0;top:50%;margin-top:-14px}.ui-input-search .ui-input-clear-hidden{display:none}.min-width-480px label.ui-input-text{vertical-align:top}.min-width-480px label.ui-input-text{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px input.ui-input-text,.min-width-480px textarea.ui-input-text,.min-width-480px .ui-input-search{width:60%;display:inline-block}.min-width-480px .ui-input-search{width:50%}.ui-listview{margin:0;counter-reset:listnumbering}.ui-content .ui-listview{margin:-15px}.ui-content .ui-listview-inset{margin:1em 0}.ui-listview,.ui-li{list-style:none;padding:0;zoom:1}.ui-li{display:block;margin:0;position:relative;overflow:hidden;text-align:left;border-width:0;border-top-width:1px}.ui-li .ui-btn-text{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-divider,.ui-li-static{padding:.5em 15px;font-size:14px;font-weight:bold;counter-reset:listnumbering}ol.ui-listview .ui-link-inherit:before,.ui-li-dec{font-size:.8em;display:inline-block;padding-right:.3em;font-weight:normal;counter-increment:listnumbering;content:counter(listnumbering) ". "}ol.ui-listview .ui-li-jsnumbering:before{content:""!important}.ui-listview-inset .ui-li{border-right-width:1px;border-left-width:1px}.ui-li:last-child{border-bottom-width:1px}.ui-li .ui-btn-inner{display:block;position:relative;padding:.7em 75px .7em 15px}.ui-li-has-thumb .ui-btn-inner{min-height:60px;padding-left:100px}.ui-li-has-icon .ui-btn-inner{min-height:20px;padding-left:40px}.ui-li-heading{font-size:16px;font-weight:bold;display:block;margin:.6em 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-desc{font-size:12px;font-weight:normal;display:block;margin:-.5em 0 .6em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-thumb,.ui-li-icon{position:absolute;left:1px;top:0;max-height:80px;max-width:80px}.ui-li-icon{max-height:40px;max-width:40px;left:10px;top:.9em}.ui-li-thumb,.ui-li-icon,.ui-li-content{float:left;margin-right:10px}.ui-li-aside{float:right;width:50%;text-align:right;margin:.3em 0}.min-width-480px .ui-li-aside{width:45%}.ui-li-has-alt .ui-btn-inner{padding-right:95px}.ui-li-count{position:absolute;font-size:11px;font-weight:bold;padding:.2em .5em;top:50%;margin-top:-.9em;right:38px}.ui-li-divider .ui-li-count{right:10px}.ui-li-has-alt .ui-li-count{right:55px}.ui-li-link-alt{position:absolute;width:40px;height:100%;border-width:0;border-left-width:1px;top:0;right:0;margin:0;padding:0}.ui-li-link-alt .ui-btn{overflow:hidden;position:absolute;right:8px;top:50%;margin:-11px 0 0 0;border-bottom-width:1px}.ui-li-link-alt .ui-btn-inner{padding:0;position:static}.ui-li-link-alt .ui-btn .ui-icon{right:50%;margin-right:-9px}.ui-listview-filter{border-width:0;overflow:hidden;margin:-15px -15px 15px -15px}.ui-listview-filter .ui-input-search{margin:5px;width:auto;display:block}@media only screen and (min-device-width:768px) and (max-device-width:1024px){.ui-li .ui-btn-text{overflow:visible}}label.ui-slider{display:block}input.ui-slider-input,.min-width-480px input.ui-slider-input{display:inline-block;width:50px}select.ui-slider-switch{display:none}div.ui-slider{position:relative;display:inline-block;overflow:visible;height:15px;padding:0;margin:0 2% 0 20px;top:4px;width:66%}a.ui-slider-handle{position:absolute;z-index:10;top:50%;width:28px;height:28px;margin-top:-15px;margin-left:-15px}a.ui-slider-handle .ui-btn-inner{padding-left:0;padding-right:0}.min-width-480px label.ui-slider{display:inline-block;width:20%;margin:0 2% 0 0}.min-width-480px div.ui-slider{width:45%}div.ui-slider-switch{height:32px;overflow:hidden;margin-left:0}div.ui-slider-inneroffset{margin-left:50%;position:absolute;top:1px;height:100%;width:50%}div.ui-slider-handle-snapping{-webkit-transition:left 100ms linear}div.ui-slider-labelbg{position:absolute;top:0;margin:0;border-width:0}div.ui-slider-switch div.ui-slider-labelbg-a{width:60%;height:100%;left:0}div.ui-slider-switch div.ui-slider-labelbg-b{width:60%;height:100%;right:0}.ui-slider-switch-a div.ui-slider-labelbg-a,.ui-slider-switch-b div.ui-slider-labelbg-b{z-index:1}.ui-slider-switch-a div.ui-slider-labelbg-b,.ui-slider-switch-b div.ui-slider-labelbg-a{z-index:10}div.ui-slider-switch a.ui-slider-handle{z-index:20;width:101%;height:32px;margin-top:-18px;margin-left:-101%}span.ui-slider-label{width:100%;position:absolute;height:32px;font-size:16px;text-align:center;line-height:2;background:0;border-color:transparent}span.ui-slider-label-a{left:-100%;margin-right:-1px}span.ui-slider-label-b{right:-100%;margin-left:-1px}  
/*  
* jQuery UI Datepicker @VERSION  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Datepicker#theming  
*/  
div.hasDatepicker{ display: block; padding: 0; overflow: visible; margin: 8px 0; }  
.ui-datepicker { overflow: visible; margin: 0; max-width: 500px; }  
.ui-datepicker .ui-datepicker-header { position:relative; padding:.4em 0; border-bottom: 0; font-weight: bold; }  
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { padding: 1px 0 1px 2px; position:absolute; top: .5em; margin-top: 0; text-indent: -9999px; }  
 
.ui-datepicker .ui-datepicker-prev { left:6px; }  
.ui-datepicker .ui-datepicker-next { right:6px; }  
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }  
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }  
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}  
.ui-datepicker select.ui-datepicker-month,  
.ui-datepicker select.ui-datepicker-year { width: 49%;}  
.ui-datepicker table {width: 100%; border-collapse: collapse; margin:0; }  
.ui-datepicker td { border-width: 1px; padding: 0; text-align: center; }  
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em 0; font-weight: bold; margin: 0; border-width: 0; text-align: center; text-decoration: none; }  
 
.ui-datepicker-calendar th { padding-top: .3em; padding-bottom: .3em; }  
.ui-datepicker-calendar th span, .ui-datepicker-calendar span.ui-state-default { opacity: .3; }  
.ui-datepicker-calendar td a { padding-top: .5em; padding-bottom: .5em; }  
 
.min-width-480px div.hasDatepicker { width: 63%; display: inline-block; margin: 0; }  
file:a/busui/feedback.php (deleted)
<?php  
include('common.inc.php');  
include_header("Feedback","feedback")  
?>  
<h3>Add/Move/Delete a Bus Stop Location</h3>  
StopID:  
or StopCode:  
 
Suggested Stop Location (lat/long or words):  
 
<h3>Bug Report/Feedback</h3>  
<textarea id="extrainfo">  
Referrer URL  
User Agent  
User host/IP  
Current date/time  
Dump of $_SESSION  
</textarea>  
file:a/busui/index.php (deleted)
<?php  
include('common.inc.php');  
include_header("bus.lambdacomplex.org","index",false, true)  
?>  
<div data-role="page">  
<div data-role="content">  
<div id="jqm-homeheader">  
<center><h3>busness time</h3><br><small>Canberra Bus Timetables and Trip Planner</small></center>  
</div>  
<a href="tripPlanner.php" data-role="button">Launch Trip Planner...</a>  
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">  
<li data-role="list-divider">Timetables - Stops</li>  
<li><a href="stopList.php">Major (Timing Point) Stops</a></li>  
<li><a href="stopList.php">All Stops</a></li>  
<li><a href="stopList.php?suburbs=yes">Stops By Suburb</a></li>  
<li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li>  
</ul>  
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">  
<li data-role="list-divider">Timetables - Routes</li>  
<li><a href="routeList.php">Routes By Final Destination</a></li>  
<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>  
<li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li>  
</ul>  
<?php  
echo timePlaceSettings();  
include_footer(true)  
?>  
 
/*!  
* jQuery UI 1.8.5  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI  
*/  
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.5",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,  
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,  
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");  
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind("mousedown.ui-disableSelection selectstart.ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,  
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c.style(this,h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c.style(this,  
h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});  
c(function(){var a=document.createElement("div"),b=document.body;c.extend(a.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.appendChild(a).offsetHeight===100;b.removeChild(a).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,  
d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);  
;/*  
* jQuery UI Datepicker 1.8.5  
*  
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Datepicker  
*  
* Depends:  
* jquery.ui.core.js  
*/  
(function(d,G){function L(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=  
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",  
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",  
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}function E(a,b){d.extend(a,  
b);for(var c in b)if(b[c]==null||b[c]==G)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.5"}});var y=(new Date).getTime();d.extend(L.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=  
f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},  
_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&  
b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==  
""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,  
c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),  
true);this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{});b=b&&b.constructor==  
Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);  
d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},  
_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=  
d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;  
for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&  
this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&  
!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass,b.dpDiv).add(d("td."+d.datepicker._currentClass,b.dpDiv));c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();  
return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||  
a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,  
a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));  
var c=String.fromCharCode(a.charCode==G?a.keyCode:a.charCode);return a.ctrlKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||  
a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);  
d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&  
d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=d.datepicker._getBorders(b.dpDiv);b.dpDiv.find("iframe.ui-datepicker-cover").css({left:-i[0],top:-i[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,  
h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");  
this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");  
this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);var e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");  
a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus()},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),  
k=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>k&&k>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];  
a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():  
"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&  
!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;  
b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=  
this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=  
d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,  
"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b==  
"object"?b.toString():b+"";if(b=="")return null;for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,k=c=-1,l=-1,u=-1,j=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"?4:p=="o"?  
3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,w,H){p=o(p)?H:w;for(w=0;w<p.length;w++)if(b.substr(s,p[w].length).toLowerCase()==p[w].toLowerCase()){s+=p[w].length;return w+1}throw"Unknown name at position "+s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(j)if(a.charAt(z)=="'"&&!o("'"))j=false;else r();else switch(a.charAt(z)){case "d":l=m("d");  
break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":k=m("m");break;case "M":k=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))r();else j=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>  
-1){k=1;l=u;do{e=this._getDaysInMonth(c,k-1);if(l<=e)break;k++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,k-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=k||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*  
60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=j+1<a.length&&a.charAt(j+1)==o)&&j++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},k=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var j=0;j<a.length;j++)if(u)if(a.charAt(j)==  
"'"&&!i("'"))u=false;else l+=a.charAt(j);else switch(a.charAt(j)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=k("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=k("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+=  
"'";else u=true;break;default:l+=a.charAt(j)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==G?a.settings[b]:this._defaults[b]},  
_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,  
this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,k=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=u.exec(h);j;){switch(j[2]||"d"){case "d":case "D":g+=  
parseInt(j[1],10);break;case "w":case "W":g+=parseInt(j[1],10)*7;break;case "m":case "M":l+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break;case "y":case "Y":k+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break}j=u.exec(h)}return new Date(k,l,g)};if(b=(b=b==null?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):b)&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},  
_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?  
"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),k=  
this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),j=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=j&&n<j?j:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,  
"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-k,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+k+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+  
n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+k,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+k+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+  
(c?"w":"e")+'">'+r+"</span></a>";k=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;k=!h?k:this.formatDate(k,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+  
y+".datepicker._gotoToday('#"+a.id+"');\">"+k+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;k=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),w=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var M=this._getDefaultDate(a),I="",C=0;C<i[0];C++){for(var N=  
"",D=0;D<i[1];D++){var J=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?  
f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,j,o,C>0||D>0,z,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=k?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,  
A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<A;O++){x+="<tr>";var P=!k?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F=p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,K=B&&!H||!F[0]||j&&q<j||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==J.getTime()&&g==a.selectedMonth&&  
a._keyEvent||M.getTime()==q.getTime()&&M.getTime()==J.getTime()?" "+this._dayOverClass:"")+(K?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!w?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!B||w)&&F[2]?' title="'+F[2]+'"':"")+(K?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!w?"&#xa0;":K?'<span class="ui-state-default">'+q.getDate()+  
"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==J.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");N+=x}I+=N}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':  
"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var k=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),j='<div class="ui-datepicker-title">',o="";if(h||!k)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+  
a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(j+=o+(h||!(k&&l)?"&#xa0;":""));if(h||!l)j+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,  
i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(j+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)j+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";j+="</select>"}j+=this._get(a,"yearSuffix");if(u)j+=(h||!(k&&l)?"&#xa0;":"")+o;j+="</div>";return j},_adjustInstDate:function(a,b,c){var e=  
a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,  
"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);  
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,  
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=  
function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));  
return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new L;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.5";window["DP_jQuery_"+y]=d})(jQuery);  
;  
file:a/busui/js/jquery-1.5.js (deleted)
/*!  
* jQuery JavaScript Library v1.5  
* http://jquery.com/  
*  
* Copyright 2011, John Resig  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* Includes Sizzle.js  
* http://sizzlejs.com/  
* Copyright 2011, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
*  
* Date: Mon Jan 31 08:31:29 2011 -0500  
*/  
(function( window, undefined ) {  
 
// Use the correct document accordingly with window argument (sandbox)  
var document = window.document;  
var jQuery = (function() {  
 
// Define a local copy of jQuery  
var jQuery = function( selector, context ) {  
// The jQuery object is actually just the init constructor 'enhanced'  
return new jQuery.fn.init( selector, context, rootjQuery );  
},  
 
// Map over jQuery in case of overwrite  
_jQuery = window.jQuery,  
 
// Map over the $ in case of overwrite  
_$ = window.$,  
 
// A central reference to the root jQuery(document)  
rootjQuery,  
 
// A simple way to check for HTML strings or ID strings  
// (both of which we optimize for)  
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,  
 
// Check if a string has a non-whitespace character in it  
rnotwhite = /\S/,  
 
// Used for trimming whitespace  
trimLeft = /^\s+/,  
trimRight = /\s+$/,  
 
// Check for digits  
rdigit = /\d/,  
 
// Match a standalone tag  
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,  
 
// JSON RegExp  
rvalidchars = /^[\],:{}\s]*$/,  
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,  
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,  
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,  
 
// Useragent RegExp  
rwebkit = /(webkit)[ \/]([\w.]+)/,  
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,  
rmsie = /(msie) ([\w.]+)/,  
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,  
 
// Keep a UserAgent string for use with jQuery.browser  
userAgent = navigator.userAgent,  
 
// For matching the engine and version of the browser  
browserMatch,  
 
// Has the ready events already been bound?  
readyBound = false,  
 
// The deferred used on DOM ready  
readyList,  
 
// Promise methods  
promiseMethods = "then done fail isResolved isRejected promise".split( " " ),  
 
// The ready event handler  
DOMContentLoaded,  
 
// Save a reference to some core methods  
toString = Object.prototype.toString,  
hasOwn = Object.prototype.hasOwnProperty,  
push = Array.prototype.push,  
slice = Array.prototype.slice,  
trim = String.prototype.trim,  
indexOf = Array.prototype.indexOf,  
 
// [[Class]] -> type pairs  
class2type = {};  
 
jQuery.fn = jQuery.prototype = {  
constructor: jQuery,  
init: function( selector, context, rootjQuery ) {  
var match, elem, ret, doc;  
 
// Handle $(""), $(null), or $(undefined)  
if ( !selector ) {  
return this;  
}  
 
// Handle $(DOMElement)  
if ( selector.nodeType ) {  
this.context = this[0] = selector;  
this.length = 1;  
return this;  
}  
 
// The body element only exists once, optimize finding it  
if ( selector === "body" && !context && document.body ) {  
this.context = document;  
this[0] = document.body;  
this.selector = "body";  
this.length = 1;  
return this;  
}  
 
// Handle HTML strings  
if ( typeof selector === "string" ) {  
// Are we dealing with HTML string or an ID?  
match = quickExpr.exec( selector );  
 
// Verify a match, and that no context was specified for #id  
if ( match && (match[1] || !context) ) {  
 
// HANDLE: $(html) -> $(array)  
if ( match[1] ) {  
context = context instanceof jQuery ? context[0] : context;  
doc = (context ? context.ownerDocument || context : document);  
 
// If a single string is passed in and it's a single tag  
// just do a createElement and skip the rest  
ret = rsingleTag.exec( selector );  
 
if ( ret ) {  
if ( jQuery.isPlainObject( context ) ) {  
selector = [ document.createElement( ret[1] ) ];  
jQuery.fn.attr.call( selector, context, true );  
 
} else {  
selector = [ doc.createElement( ret[1] ) ];  
}  
 
} else {  
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );  
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;  
}  
 
return jQuery.merge( this, selector );  
 
// HANDLE: $("#id")  
} else {  
elem = document.getElementById( match[2] );  
 
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
if ( elem && elem.parentNode ) {  
// Handle the case where IE and Opera return items  
// by name instead of ID  
if ( elem.id !== match[2] ) {  
return rootjQuery.find( selector );  
}  
 
// Otherwise, we inject the element directly into the jQuery object  
this.length = 1;  
this[0] = elem;  
}  
 
this.context = document;  
this.selector = selector;  
return this;  
}  
 
// HANDLE: $(expr, $(...))  
} else if ( !context || context.jquery ) {  
return (context || rootjQuery).find( selector );  
 
// HANDLE: $(expr, context)  
// (which is just equivalent to: $(context).find(expr)  
} else {  
return this.constructor( context ).find( selector );  
}  
 
// HANDLE: $(function)  
// Shortcut for document ready  
} else if ( jQuery.isFunction( selector ) ) {  
return rootjQuery.ready( selector );  
}  
 
if (selector.selector !== undefined) {  
this.selector = selector.selector;  
this.context = selector.context;  
}  
 
return jQuery.makeArray( selector, this );  
},  
 
// Start with an empty selector  
selector: "",  
 
// The current version of jQuery being used  
jquery: "1.5",  
 
// The default length of a jQuery object is 0  
length: 0,  
 
// The number of elements contained in the matched element set  
size: function() {  
return this.length;  
},  
 
toArray: function() {  
return slice.call( this, 0 );  
},  
 
// Get the Nth element in the matched element set OR  
// Get the whole matched element set as a clean array  
get: function( num ) {  
return num == null ?  
 
// Return a 'clean' array  
this.toArray() :  
 
// Return just the object  
( num < 0 ? this[ this.length + num ] : this[ num ] );  
},  
 
// Take an array of elements and push it onto the stack  
// (returning the new matched element set)  
pushStack: function( elems, name, selector ) {  
// Build a new jQuery matched element set  
var ret = this.constructor();  
 
if ( jQuery.isArray( elems ) ) {  
push.apply( ret, elems );  
 
} else {  
jQuery.merge( ret, elems );  
}  
 
// Add the old object onto the stack (as a reference)  
ret.prevObject = this;  
 
ret.context = this.context;  
 
if ( name === "find" ) {  
ret.selector = this.selector + (this.selector ? " " : "") + selector;  
} else if ( name ) {  
ret.selector = this.selector + "." + name + "(" + selector + ")";  
}  
 
// Return the newly-formed element set  
return ret;  
},  
 
// Execute a callback for every element in the matched set.  
// (You can seed the arguments with an array of args, but this is  
// only used internally.)  
each: function( callback, args ) {  
return jQuery.each( this, callback, args );  
},  
 
ready: function( fn ) {  
// Attach the listeners  
jQuery.bindReady();  
 
// Add the callback  
readyList.done( fn );  
 
return this;  
},  
 
eq: function( i ) {  
return i === -1 ?  
this.slice( i ) :  
this.slice( i, +i + 1 );  
},  
 
first: function() {  
return this.eq( 0 );  
},  
 
last: function() {  
return this.eq( -1 );  
},  
 
slice: function() {  
return this.pushStack( slice.apply( this, arguments ),  
"slice", slice.call(arguments).join(",") );  
},  
 
map: function( callback ) {  
return this.pushStack( jQuery.map(this, function( elem, i ) {  
return callback.call( elem, i, elem );  
}));  
},  
 
end: function() {  
return this.prevObject || this.constructor(null);  
},  
 
// For internal use only.  
// Behaves like an Array's method, not like a jQuery method.  
push: push,  
sort: [].sort,  
splice: [].splice  
};  
 
// Give the init function the jQuery prototype for later instantiation  
jQuery.fn.init.prototype = jQuery.fn;  
 
jQuery.extend = jQuery.fn.extend = function() {  
var options, name, src, copy, copyIsArray, clone,  
target = arguments[0] || {},  
i = 1,  
length = arguments.length,  
deep = false;  
 
// Handle a deep copy situation  
if ( typeof target === "boolean" ) {  
deep = target;  
target = arguments[1] || {};  
// skip the boolean and the target  
i = 2;  
}  
 
// Handle case when target is a string or something (possible in deep copy)  
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {  
target = {};  
}  
 
// extend jQuery itself if only one argument is passed  
if ( length === i ) {  
target = this;  
--i;  
}  
 
for ( ; i < length; i++ ) {  
// Only deal with non-null/undefined values  
if ( (options = arguments[ i ]) != null ) {  
// Extend the base object  
for ( name in options ) {  
src = target[ name ];  
copy = options[ name ];  
 
// Prevent never-ending loop  
if ( target === copy ) {  
continue;  
}  
 
// Recurse if we're merging plain objects or arrays  
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {  
if ( copyIsArray ) {  
copyIsArray = false;  
clone = src && jQuery.isArray(src) ? src : [];  
 
} else {  
clone = src && jQuery.isPlainObject(src) ? src : {};  
}  
 
// Never move original objects, clone them  
target[ name ] = jQuery.extend( deep, clone, copy );  
 
// Don't bring in undefined values  
} else if ( copy !== undefined ) {  
target[ name ] = copy;  
}  
}  
}  
}  
 
// Return the modified object  
return target;  
};  
 
jQuery.extend({  
noConflict: function( deep ) {  
window.$ = _$;  
 
if ( deep ) {  
window.jQuery = _jQuery;  
}  
 
return jQuery;  
},  
 
// Is the DOM ready to be used? Set to true once it occurs.  
isReady: false,  
 
// A counter to track how many items to wait for before  
// the ready event fires. See #6781  
readyWait: 1,  
 
// Handle when the DOM is ready  
ready: function( wait ) {  
// A third-party is pushing the ready event forwards  
if ( wait === true ) {  
jQuery.readyWait--;  
}  
 
// Make sure that the DOM is not already loaded  
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {  
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).  
if ( !document.body ) {  
return setTimeout( jQuery.ready, 1 );  
}  
 
// Remember that the DOM is ready  
jQuery.isReady = true;  
 
// If a normal DOM Ready event fired, decrement, and wait if need be  
if ( wait !== true && --jQuery.readyWait > 0 ) {  
return;  
}  
 
// If there are functions bound, to execute  
readyList.resolveWith( document, [ jQuery ] );  
 
// Trigger any bound ready events  
if ( jQuery.fn.trigger ) {  
jQuery( document ).trigger( "ready" ).unbind( "ready" );  
}  
}  
},  
 
bindReady: function() {  
if ( readyBound ) {  
return;  
}  
 
readyBound = true;  
 
// Catch cases where $(document).ready() is called after the  
// browser event has already occurred.  
if ( document.readyState === "complete" ) {  
// Handle it asynchronously to allow scripts the opportunity to delay ready  
return setTimeout( jQuery.ready, 1 );  
}  
 
// Mozilla, Opera and webkit nightlies currently support this event  
if ( document.addEventListener ) {  
// Use the handy event callback  
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );  
 
// A fallback to window.onload, that will always work  
window.addEventListener( "load", jQuery.ready, false );  
 
// If IE event model is used  
} else if ( document.attachEvent ) {  
// ensure firing before onload,  
// maybe late but safe also for iframes  
document.attachEvent("onreadystatechange", DOMContentLoaded);  
 
// A fallback to window.onload, that will always work  
window.attachEvent( "onload", jQuery.ready );  
 
// If IE and not a frame  
// continually check to see if the document is ready  
var toplevel = false;  
 
try {  
toplevel = window.frameElement == null;  
} catch(e) {}  
 
if ( document.documentElement.doScroll && toplevel ) {  
doScrollCheck();  
}  
}  
},  
 
// See test/unit/core.js for details concerning isFunction.  
// Since version 1.3, DOM methods and functions like alert  
// aren't supported. They return false on IE (#2968).  
isFunction: function( obj ) {  
return jQuery.type(obj) === "function";  
},  
 
isArray: Array.isArray || function( obj ) {  
return jQuery.type(obj) === "array";  
},  
 
// A crude way of determining if an object is a window  
isWindow: function( obj ) {  
return obj && typeof obj === "object" && "setInterval" in obj;  
},  
 
isNaN: function( obj ) {  
return obj == null || !rdigit.test( obj ) || isNaN( obj );  
},  
 
type: function( obj ) {  
return obj == null ?  
String( obj ) :  
class2type[ toString.call(obj) ] || "object";  
},  
 
isPlainObject: function( obj ) {  
// Must be an Object.  
// Because of IE, we also have to check the presence of the constructor property.  
// Make sure that DOM nodes and window objects don't pass through, as well  
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {  
return false;  
}  
 
// Not own constructor property must be Object  
if ( obj.constructor &&  
!hasOwn.call(obj, "constructor") &&  
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {  
return false;  
}  
 
// Own properties are enumerated firstly, so to speed up,  
// if last one is own, then all properties are own.  
 
var key;  
for ( key in obj ) {}  
 
return key === undefined || hasOwn.call( obj, key );  
},  
 
isEmptyObject: function( obj ) {  
for ( var name in obj ) {  
return false;  
}  
return true;  
},  
 
error: function( msg ) {  
throw msg;  
},  
 
parseJSON: function( data ) {  
if ( typeof data !== "string" || !data ) {  
return null;  
}  
 
// Make sure leading/trailing whitespace is removed (IE can't handle it)  
data = jQuery.trim( data );  
 
// Make sure the incoming data is actual JSON  
// Logic borrowed from http://json.org/json2.js  
if ( rvalidchars.test(data.replace(rvalidescape, "@")  
.replace(rvalidtokens, "]")  
.replace(rvalidbraces, "")) ) {  
 
// Try to use the native JSON parser first  
return window.JSON && window.JSON.parse ?  
window.JSON.parse( data ) :  
(new Function("return " + data))();  
 
} else {  
jQuery.error( "Invalid JSON: " + data );  
}  
},  
 
// Cross-browser xml parsing  
// (xml & tmp used internally)  
parseXML: function( data , xml , tmp ) {  
 
if ( window.DOMParser ) { // Standard  
tmp = new DOMParser();  
xml = tmp.parseFromString( data , "text/xml" );  
} else { // IE  
xml = new ActiveXObject( "Microsoft.XMLDOM" );  
xml.async = "false";  
xml.loadXML( data );  
}  
 
tmp = xml.documentElement;  
 
if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {  
jQuery.error( "Invalid XML: " + data );  
}  
 
return xml;  
},  
 
noop: function() {},  
 
// Evalulates a script in a global context  
globalEval: function( data ) {  
if ( data && rnotwhite.test(data) ) {  
// Inspired by code by Andrea Giammarchi  
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html  
var head = document.getElementsByTagName("head")[0] || document.documentElement,  
script = document.createElement("script");  
 
script.type = "text/javascript";  
 
if ( jQuery.support.scriptEval() ) {  
script.appendChild( document.createTextNode( data ) );  
} else {  
script.text = data;  
}  
 
// Use insertBefore instead of appendChild to circumvent an IE6 bug.  
// This arises when a base node is used (#2709).  
head.insertBefore( script, head.firstChild );  
head.removeChild( script );  
}  
},  
 
nodeName: function( elem, name ) {  
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();  
},  
 
// args is for internal usage only  
each: function( object, callback, args ) {  
var name, i = 0,  
length = object.length,  
isObj = length === undefined || jQuery.isFunction(object);  
 
if ( args ) {  
if ( isObj ) {  
for ( name in object ) {  
if ( callback.apply( object[ name ], args ) === false ) {  
break;  
}  
}  
} else {  
for ( ; i < length; ) {  
if ( callback.apply( object[ i++ ], args ) === false ) {  
break;  
}  
}  
}  
 
// A special, fast, case for the most common use of each  
} else {  
if ( isObj ) {  
for ( name in object ) {  
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {  
break;  
}  
}  
} else {  
for ( var value = object[0];  
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}  
}  
}  
 
return object;  
},  
 
// Use native String.trim function wherever possible  
trim: trim ?  
function( text ) {  
return text == null ?  
"" :  
trim.call( text );  
} :  
 
// Otherwise use our own trimming functionality  
function( text ) {  
return text == null ?  
"" :  
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );  
},  
 
// results is for internal usage only  
makeArray: function( array, results ) {  
var ret = results || [];  
 
if ( array != null ) {  
// The window, strings (and functions) also have 'length'  
// The extra typeof function check is to prevent crashes  
// in Safari 2 (See: #3039)  
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930  
var type = jQuery.type(array);  
 
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {  
push.call( ret, array );  
} else {  
jQuery.merge( ret, array );  
}  
}  
 
return ret;  
},  
 
inArray: function( elem, array ) {  
if ( array.indexOf ) {  
return array.indexOf( elem );  
}  
 
for ( var i = 0, length = array.length; i < length; i++ ) {  
if ( array[ i ] === elem ) {  
return i;  
}  
}  
 
return -1;  
},  
 
merge: function( first, second ) {  
var i = first.length,  
j = 0;  
 
if ( typeof second.length === "number" ) {  
for ( var l = second.length; j < l; j++ ) {  
first[ i++ ] = second[ j ];  
}  
 
} else {  
while ( second[j] !== undefined ) {  
first[ i++ ] = second[ j++ ];  
}  
}  
 
first.length = i;  
 
return first;  
},  
 
grep: function( elems, callback, inv ) {  
var ret = [], retVal;  
inv = !!inv;  
 
// Go through the array, only saving the items  
// that pass the validator function  
for ( var i = 0, length = elems.length; i < length; i++ ) {  
retVal = !!callback( elems[ i ], i );  
if ( inv !== retVal ) {  
ret.push( elems[ i ] );  
}  
}  
 
return ret;  
},  
 
// arg is for internal usage only  
map: function( elems, callback, arg ) {  
var ret = [], value;  
 
// Go through the array, translating each of the items to their  
// new value (or values).  
for ( var i = 0, length = elems.length; i < length; i++ ) {  
value = callback( elems[ i ], i, arg );  
 
if ( value != null ) {  
ret[ ret.length ] = value;  
}  
}  
 
// Flatten any nested arrays  
return ret.concat.apply( [], ret );  
},  
 
// A global GUID counter for objects  
guid: 1,  
 
proxy: function( fn, proxy, thisObject ) {  
if ( arguments.length === 2 ) {  
if ( typeof proxy === "string" ) {  
thisObject = fn;  
fn = thisObject[ proxy ];  
proxy = undefined;  
 
} else if ( proxy && !jQuery.isFunction( proxy ) ) {  
thisObject = proxy;  
proxy = undefined;  
}  
}  
 
if ( !proxy && fn ) {  
proxy = function() {  
return fn.apply( thisObject || this, arguments );  
};  
}  
 
// Set the guid of unique handler to the same of original handler, so it can be removed  
if ( fn ) {  
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;  
}  
 
// So proxy can be declared as an argument  
return proxy;  
},  
 
// Mutifunctional method to get and set values to a collection  
// The value/s can be optionally by executed if its a function  
access: function( elems, key, value, exec, fn, pass ) {  
var length = elems.length;  
 
// Setting many attributes  
if ( typeof key === "object" ) {  
for ( var k in key ) {  
jQuery.access( elems, k, key[k], exec, fn, value );  
}  
return elems;  
}  
 
// Setting one attribute  
if ( value !== undefined ) {  
// Optionally, function values get executed if exec is true  
exec = !pass && exec && jQuery.isFunction(value);  
 
for ( var i = 0; i < length; i++ ) {  
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );  
}  
 
return elems;  
}  
 
// Getting an attribute  
return length ? fn( elems[0], key ) : undefined;  
},  
 
now: function() {  
return (new Date()).getTime();  
},  
 
// Create a simple deferred (one callbacks list)  
_Deferred: function() {  
var // callbacks list  
callbacks = [],  
// stored [ context , args ]  
fired,  
// to avoid firing when already doing so  
firing,  
// flag to know if the deferred has been cancelled  
cancelled,  
// the deferred itself  
deferred = {  
 
// done( f1, f2, ...)  
done: function() {  
if ( !cancelled ) {  
var args = arguments,  
i,  
length,  
elem,  
type,  
_fired;  
if ( fired ) {  
_fired = fired;  
fired = 0;  
}  
for ( i = 0, length = args.length; i < length; i++ ) {  
elem = args[ i ];  
type = jQuery.type( elem );  
if ( type === "array" ) {  
deferred.done.apply( deferred, elem );  
} else if ( type === "function" ) {  
callbacks.push( elem );  
}  
}  
if ( _fired ) {  
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );  
}  
}  
return this;  
},  
 
// resolve with given context and args  
resolveWith: function( context, args ) {  
if ( !cancelled && !fired && !firing ) {  
firing = 1;  
try {  
while( callbacks[ 0 ] ) {  
callbacks.shift().apply( context, args );  
}  
}  
finally {  
fired = [ context, args ];  
firing = 0;  
}  
}  
return this;  
},  
 
// resolve with this as context and given arguments  
resolve: function() {  
deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );  
return this;  
},  
 
// Has this deferred been resolved?  
isResolved: function() {  
return !!( firing || fired );  
},  
 
// Cancel  
cancel: function() {  
cancelled = 1;  
callbacks = [];  
return this;  
}  
};  
 
return deferred;  
},  
 
// Full fledged deferred (two callbacks list)  
Deferred: function( func ) {  
var deferred = jQuery._Deferred(),  
failDeferred = jQuery._Deferred(),  
promise;  
// Add errorDeferred methods, then and promise  
jQuery.extend( deferred, {  
then: function( doneCallbacks, failCallbacks ) {  
deferred.done( doneCallbacks ).fail( failCallbacks );  
return this;  
},  
fail: failDeferred.done,  
rejectWith: failDeferred.resolveWith,  
reject: failDeferred.resolve,  
isRejected: failDeferred.isResolved,  
// Get a promise for this deferred  
// If obj is provided, the promise aspect is added to the object  
promise: function( obj , i /* internal */ ) {  
if ( obj == null ) {  
if ( promise ) {  
return promise;  
}  
promise = obj = {};  
}  
i = promiseMethods.length;  
while( i-- ) {  
obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];  
}  
return obj;  
}  
} );  
// Make sure only one callback list will be used  
deferred.then( failDeferred.cancel, deferred.cancel );  
// Unexpose cancel  
delete deferred.cancel;  
// Call given func if any  
if ( func ) {  
func.call( deferred, deferred );  
}  
return deferred;  
},  
 
// Deferred helper  
when: function( object ) {  
var args = arguments,  
length = args.length,  
deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ?  
object :  
jQuery.Deferred(),  
promise = deferred.promise(),  
resolveArray;  
 
if ( length > 1 ) {  
resolveArray = new Array( length );  
jQuery.each( args, function( index, element ) {  
jQuery.when( element ).then( function( value ) {  
resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;  
if( ! --length ) {  
deferred.resolveWith( promise, resolveArray );  
}  
}, deferred.reject );  
} );  
} else if ( deferred !== object ) {  
deferred.resolve( object );  
}  
return promise;  
},  
 
// Use of jQuery.browser is frowned upon.  
// More details: http://docs.jquery.com/Utilities/jQuery.browser  
uaMatch: function( ua ) {  
ua = ua.toLowerCase();  
 
var match = rwebkit.exec( ua ) ||  
ropera.exec( ua ) ||  
rmsie.exec( ua ) ||  
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||  
[];  
 
return { browser: match[1] || "", version: match[2] || "0" };  
},  
 
sub: function() {  
function jQuerySubclass( selector, context ) {  
return new jQuerySubclass.fn.init( selector, context );  
}  
jQuery.extend( true, jQuerySubclass, this );  
jQuerySubclass.superclass = this;  
jQuerySubclass.fn = jQuerySubclass.prototype = this();  
jQuerySubclass.fn.constructor = jQuerySubclass;  
jQuerySubclass.subclass = this.subclass;  
jQuerySubclass.fn.init = function init( selector, context ) {  
if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {  
context = jQuerySubclass(context);  
}  
 
return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );  
};  
jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;  
var rootjQuerySubclass = jQuerySubclass(document);  
return jQuerySubclass;  
},  
 
browser: {}  
});  
 
// Create readyList deferred  
readyList = jQuery._Deferred();  
 
// Populate the class2type map  
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {  
class2type[ "[object " + name + "]" ] = name.toLowerCase();  
});  
 
browserMatch = jQuery.uaMatch( userAgent );  
if ( browserMatch.browser ) {  
jQuery.browser[ browserMatch.browser ] = true;  
jQuery.browser.version = browserMatch.version;  
}  
 
// Deprecated, use jQuery.browser.webkit instead  
if ( jQuery.browser.webkit ) {  
jQuery.browser.safari = true;  
}  
 
if ( indexOf ) {  
jQuery.inArray = function( elem, array ) {  
return indexOf.call( array, elem );  
};  
}  
 
// IE doesn't match non-breaking spaces with \s  
if ( rnotwhite.test( "\xA0" ) ) {  
trimLeft = /^[\s\xA0]+/;  
trimRight = /[\s\xA0]+$/;  
}  
 
// All jQuery objects should point back to these  
rootjQuery = jQuery(document);  
 
// Cleanup functions for the document ready method  
if ( document.addEventListener ) {  
DOMContentLoaded = function() {  
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );  
jQuery.ready();  
};  
 
} else if ( document.attachEvent ) {  
DOMContentLoaded = function() {  
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).  
if ( document.readyState === "complete" ) {  
document.detachEvent( "onreadystatechange", DOMContentLoaded );  
jQuery.ready();  
}  
};  
}  
 
// The DOM ready check for Internet Explorer  
function doScrollCheck() {  
if ( jQuery.isReady ) {  
return;  
}  
 
try {  
// If IE is used, use the trick by Diego Perini  
// http://javascript.nwbox.com/IEContentLoaded/  
document.documentElement.doScroll("left");  
} catch(e) {  
setTimeout( doScrollCheck, 1 );  
return;  
}  
 
// and execute any waiting functions  
jQuery.ready();  
}  
 
// Expose jQuery to the global object  
return (window.jQuery = window.$ = jQuery);  
 
})();  
 
 
(function() {  
 
jQuery.support = {};  
 
var div = document.createElement("div");  
 
div.style.display = "none";  
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";  
 
var all = div.getElementsByTagName("*"),  
a = div.getElementsByTagName("a")[0],  
select = document.createElement("select"),  
opt = select.appendChild( document.createElement("option") );  
 
// Can't get basic test support  
if ( !all || !all.length || !a ) {  
return;  
}  
 
jQuery.support = {  
// IE strips leading whitespace when .innerHTML is used  
leadingWhitespace: div.firstChild.nodeType === 3,  
 
// Make sure that tbody elements aren't automatically inserted  
// IE will insert them into empty tables  
tbody: !div.getElementsByTagName("tbody").length,  
 
// Make sure that link elements get serialized correctly by innerHTML  
// This requires a wrapper element in IE  
htmlSerialize: !!div.getElementsByTagName("link").length,  
 
// Get the style information from getAttribute  
// (IE uses .cssText insted)  
style: /red/.test( a.getAttribute("style") ),  
 
// Make sure that URLs aren't manipulated  
// (IE normalizes it by default)  
hrefNormalized: a.getAttribute("href") === "/a",  
 
// Make sure that element opacity exists  
// (IE uses filter instead)  
// Use a regex to work around a WebKit issue. See #5145  
opacity: /^0.55$/.test( a.style.opacity ),  
 
// Verify style float existence  
// (IE uses styleFloat instead of cssFloat)  
cssFloat: !!a.style.cssFloat,  
 
// Make sure that if no value is specified for a checkbox  
// that it defaults to "on".  
// (WebKit defaults to "" instead)  
checkOn: div.getElementsByTagName("input")[0].value === "on",  
 
// Make sure that a selected-by-default option has a working selected property.  
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)  
optSelected: opt.selected,  
 
// Will be defined later  
deleteExpando: true,  
optDisabled: false,  
checkClone: false,  
_scriptEval: null,  
noCloneEvent: true,  
boxModel: null,  
inlineBlockNeedsLayout: false,  
shrinkWrapBlocks: false,  
reliableHiddenOffsets: true  
};  
 
// Make sure that the options inside disabled selects aren't marked as disabled  
// (WebKit marks them as diabled)  
select.disabled = true;  
jQuery.support.optDisabled = !opt.disabled;  
 
jQuery.support.scriptEval = function() {  
if ( jQuery.support._scriptEval === null ) {  
var root = document.documentElement,  
script = document.createElement("script"),  
id = "script" + jQuery.now();  
 
script.type = "text/javascript";  
try {  
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );  
} catch(e) {}  
 
root.insertBefore( script, root.firstChild );  
 
// Make sure that the execution of code works by injecting a script  
// tag with appendChild/createTextNode  
// (IE doesn't support this, fails, and uses .text instead)  
if ( window[ id ] ) {  
jQuery.support._scriptEval = true;  
delete window[ id ];  
} else {  
jQuery.support._scriptEval = false;  
}  
 
root.removeChild( script );  
// release memory in IE  
root = script = id = null;  
}  
 
return jQuery.support._scriptEval;  
};  
 
// Test to see if it's possible to delete an expando from an element  
// Fails in Internet Explorer  
try {  
delete div.test;  
 
} catch(e) {  
jQuery.support.deleteExpando = false;  
}  
 
if ( div.attachEvent && div.fireEvent ) {  
div.attachEvent("onclick", function click() {  
// Cloning a node shouldn't copy over any  
// bound event handlers (IE does this)  
jQuery.support.noCloneEvent = false;  
div.detachEvent("onclick", click);  
});  
div.cloneNode(true).fireEvent("onclick");  
}  
 
div = document.createElement("div");  
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";  
 
var fragment = document.createDocumentFragment();  
fragment.appendChild( div.firstChild );  
 
// WebKit doesn't clone checked state correctly in fragments  
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;  
 
// Figure out if the W3C box model works as expected  
// document.body must exist before we can do this  
jQuery(function() {  
var div = document.createElement("div"),  
body = document.getElementsByTagName("body")[0];  
 
// Frameset documents with no body should not run this code  
if ( !body ) {  
return;  
}  
 
div.style.width = div.style.paddingLeft = "1px";  
body.appendChild( div );  
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;  
 
if ( "zoom" in div.style ) {  
// Check if natively block-level elements act like inline-block  
// elements when setting their display to 'inline' and giving  
// them layout  
// (IE < 8 does this)  
div.style.display = "inline";  
div.style.zoom = 1;  
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;  
 
// Check if elements with layout shrink-wrap their children  
// (IE 6 does this)  
div.style.display = "";  
div.innerHTML = "<div style='width:4px;'></div>";  
jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;  
}  
 
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";  
var tds = div.getElementsByTagName("td");  
 
// Check if table cells still have offsetWidth/Height when they are set  
// to display:none and there are still other visible table cells in a  
// table row; if so, offsetWidth/Height are not reliable for use when  
// determining if an element has been hidden directly using  
// display:none (it is still safe to use offsets if a parent element is  
// hidden; don safety goggles and see bug #4512 for more information).  
// (only IE 8 fails this test)  
jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;  
 
tds[0].style.display = "";  
tds[1].style.display = "none";  
 
// Check if empty table cells still have offsetWidth/Height  
// (IE < 8 fail this test)  
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;  
div.innerHTML = "";  
 
body.removeChild( div ).style.display = "none";  
div = tds = null;  
});  
 
// Technique from Juriy Zaytsev  
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/  
var eventSupported = function( eventName ) {  
var el = document.createElement("div");  
eventName = "on" + eventName;  
 
// We only care about the case where non-standard event systems  
// are used, namely in IE. Short-circuiting here helps us to  
// avoid an eval call (in setAttribute) which can cause CSP  
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP  
if ( !el.attachEvent ) {  
return true;  
}  
 
var isSupported = (eventName in el);  
if ( !isSupported ) {  
el.setAttribute(eventName, "return;");  
isSupported = typeof el[eventName] === "function";  
}  
el = null;  
 
return isSupported;  
};  
 
jQuery.support.submitBubbles = eventSupported("submit");  
jQuery.support.changeBubbles = eventSupported("change");  
 
// release memory in IE  
div = all = a = null;  
})();  
 
 
 
var rbrace = /^(?:\{.*\}|\[.*\])$/;  
 
jQuery.extend({  
cache: {},  
 
// Please use with caution  
uuid: 0,  
 
// Unique for each copy of jQuery on the page  
// Non-digits removed to match rinlinejQuery  
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),  
 
// The following elements throw uncatchable exceptions if you  
// attempt to add expando properties to them.  
noData: {  
"embed": true,  
// Ban all objects except for Flash (which handle expandos)  
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",  
"applet": true  
},  
 
hasData: function( elem ) {  
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];  
 
return !!elem && !jQuery.isEmptyObject(elem);  
},  
 
data: function( elem, name, data, pvt /* Internal Use Only */ ) {  
if ( !jQuery.acceptData( elem ) ) {  
return;  
}  
 
var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,  
 
// We have to handle DOM nodes and JS objects differently because IE6-7  
// can't GC object references properly across the DOM-JS boundary  
isNode = elem.nodeType,  
 
// Only DOM nodes need the global jQuery cache; JS object data is  
// attached directly to the object so GC can occur automatically  
cache = isNode ? jQuery.cache : elem,  
 
// Only defining an ID for JS objects if its cache already exists allows  
// the code to shortcut on the same path as a DOM node with no cache  
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;  
 
// Avoid doing any more work than we need to when trying to get data on an  
// object that has no data at all  
if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {  
return;  
}  
 
if ( !id ) {  
// Only DOM nodes need a new unique ID for each element since their data  
// ends up in the global cache  
if ( isNode ) {  
elem[ jQuery.expando ] = id = ++jQuery.uuid;  
} else {  
id = jQuery.expando;  
}  
}  
 
if ( !cache[ id ] ) {  
cache[ id ] = {};  
}  
 
// An object can be passed to jQuery.data instead of a key/value pair; this gets  
// shallow copied over onto the existing cache  
if ( typeof name === "object" ) {  
if ( pvt ) {  
cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);  
} else {  
cache[ id ] = jQuery.extend(cache[ id ], name);  
}  
}  
 
thisCache = cache[ id ];  
 
// Internal jQuery data is stored in a separate object inside the object's data  
// cache in order to avoid key collisions between internal data and user-defined  
// data  
if ( pvt ) {  
if ( !thisCache[ internalKey ] ) {  
thisCache[ internalKey ] = {};  
}  
 
thisCache = thisCache[ internalKey ];  
}  
 
if ( data !== undefined ) {  
thisCache[ name ] = data;  
}  
 
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should  
// not attempt to inspect the internal events object using jQuery.data, as this  
// internal data object is undocumented and subject to change.  
if ( name === "events" && !thisCache[name] ) {  
return thisCache[ internalKey ] && thisCache[ internalKey ].events;  
}  
 
return getByName ? thisCache[ name ] : thisCache;  
},  
 
removeData: function( elem, name, pvt /* Internal Use Only */ ) {  
if ( !jQuery.acceptData( elem ) ) {  
return;  
}  
 
var internalKey = jQuery.expando, isNode = elem.nodeType,  
 
// See jQuery.data for more information  
cache = isNode ? jQuery.cache : elem,  
 
// See jQuery.data for more information  
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;  
 
// If there is already no cache entry for this object, there is no  
// purpose in continuing  
if ( !cache[ id ] ) {  
return;  
}  
 
if ( name ) {  
var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];  
 
if ( thisCache ) {  
delete thisCache[ name ];  
 
// If there is no data left in the cache, we want to continue  
// and let the cache object itself get destroyed  
if ( !jQuery.isEmptyObject(thisCache) ) {  
return;  
}  
}  
}  
 
// See jQuery.data for more information  
if ( pvt ) {  
delete cache[ id ][ internalKey ];  
 
// Don't destroy the parent cache unless the internal data object  
// had been the only thing left in it  
if ( !jQuery.isEmptyObject(cache[ id ]) ) {  
return;  
}  
}  
 
var internalCache = cache[ id ][ internalKey ];  
 
// Browsers that fail expando deletion also refuse to delete expandos on  
// the window, but it will allow it on all other JS objects; other browsers  
// don't care  
if ( jQuery.support.deleteExpando || cache != window ) {  
delete cache[ id ];  
} else {  
cache[ id ] = null;  
}  
 
// We destroyed the entire user cache at once because it's faster than  
// iterating through each key, but we need to continue to persist internal  
// data if it existed  
if ( internalCache ) {  
cache[ id ] = {};  
cache[ id ][ internalKey ] = internalCache;  
 
// Otherwise, we need to eliminate the expando on the node to avoid  
// false lookups in the cache for entries that no longer exist  
} else if ( isNode ) {  
// IE does not allow us to delete expando properties from nodes,  
// nor does it have a removeAttribute function on Document nodes;  
// we must handle all of these cases  
if ( jQuery.support.deleteExpando ) {  
delete elem[ jQuery.expando ];  
} else if ( elem.removeAttribute ) {  
elem.removeAttribute( jQuery.expando );  
} else {  
elem[ jQuery.expando ] = null;  
}  
}  
},  
 
// For internal use only.  
_data: function( elem, name, data ) {  
return jQuery.data( elem, name, data, true );  
},  
 
// A method for determining if a DOM node can handle the data expando  
acceptData: function( elem ) {  
if ( elem.nodeName ) {  
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];  
 
if ( match ) {  
return !(match === true || elem.getAttribute("classid") !== match);  
}  
}  
 
return true;  
}  
});  
 
jQuery.fn.extend({  
data: function( key, value ) {  
var data = null;  
 
if ( typeof key === "undefined" ) {  
if ( this.length ) {  
data = jQuery.data( this[0] );  
 
if ( this[0].nodeType === 1 ) {  
var attr = this[0].attributes, name;  
for ( var i = 0, l = attr.length; i < l; i++ ) {  
name = attr[i].name;  
 
if ( name.indexOf( "data-" ) === 0 ) {  
name = name.substr( 5 );  
dataAttr( this[0], name, data[ name ] );  
}  
}  
}  
}  
 
return data;  
 
} else if ( typeof key === "object" ) {  
return this.each(function() {  
jQuery.data( this, key );  
});  
}  
 
var parts = key.split(".");  
parts[1] = parts[1] ? "." + parts[1] : "";  
 
if ( value === undefined ) {  
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);  
 
// Try to fetch any internally stored data first  
if ( data === undefined && this.length ) {  
data = jQuery.data( this[0], key );  
data = dataAttr( this[0], key, data );  
}  
 
return data === undefined && parts[1] ?  
this.data( parts[0] ) :  
data;  
 
} else {  
return this.each(function() {  
var $this = jQuery( this ),  
args = [ parts[0], value ];  
 
$this.triggerHandler( "setData" + parts[1] + "!", args );  
jQuery.data( this, key, value );  
$this.triggerHandler( "changeData" + parts[1] + "!", args );  
});  
}  
},  
 
removeData: function( key ) {  
return this.each(function() {  
jQuery.removeData( this, key );  
});  
}  
});  
 
function dataAttr( elem, key, data ) {  
// If nothing was found internally, try to fetch any  
// data from the HTML5 data-* attribute  
if ( data === undefined && elem.nodeType === 1 ) {  
data = elem.getAttribute( "data-" + key );  
 
if ( typeof data === "string" ) {  
try {  
data = data === "true" ? true :  
data === "false" ? false :  
data === "null" ? null :  
!jQuery.isNaN( data ) ? parseFloat( data ) :  
rbrace.test( data ) ? jQuery.parseJSON( data ) :  
data;  
} catch( e ) {}  
 
// Make sure we set the data so it isn't changed later  
jQuery.data( elem, key, data );  
 
} else {  
data = undefined;  
}  
}  
 
return data;  
}  
 
 
 
 
jQuery.extend({  
queue: function( elem, type, data ) {  
if ( !elem ) {  
return;  
}  
 
type = (type || "fx") + "queue";  
var q = jQuery._data( elem, type );  
 
// Speed up dequeue by getting out quickly if this is just a lookup  
if ( !data ) {  
return q || [];  
}  
 
if ( !q || jQuery.isArray(data) ) {  
q = jQuery._data( elem, type, jQuery.makeArray(data) );  
 
} else {  
q.push( data );  
}  
 
return q;  
},  
 
dequeue: function( elem, type ) {  
type = type || "fx";  
 
var queue = jQuery.queue( elem, type ),  
fn = queue.shift();  
 
// If the fx queue is dequeued, always remove the progress sentinel  
if ( fn === "inprogress" ) {  
fn = queue.shift();  
}  
 
if ( fn ) {  
// Add a progress sentinel to prevent the fx queue from being  
// automatically dequeued  
if ( type === "fx" ) {  
queue.unshift("inprogress");  
}  
 
fn.call(elem, function() {  
jQuery.dequeue(elem, type);  
});  
}  
 
if ( !queue.length ) {  
jQuery.removeData( elem, type + "queue", true );  
}  
}  
});  
 
jQuery.fn.extend({  
queue: function( type, data ) {  
if ( typeof type !== "string" ) {  
data = type;  
type = "fx";  
}  
 
if ( data === undefined ) {  
return jQuery.queue( this[0], type );  
}  
return this.each(function( i ) {  
var queue = jQuery.queue( this, type, data );  
 
if ( type === "fx" && queue[0] !== "inprogress" ) {  
jQuery.dequeue( this, type );  
}  
});  
},  
dequeue: function( type ) {  
return this.each(function() {  
jQuery.dequeue( this, type );  
});  
},  
 
// Based off of the plugin by Clint Helfers, with permission.  
// http://blindsignals.com/index.php/2009/07/jquery-delay/  
delay: function( time, type ) {  
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;  
type = type || "fx";  
 
return this.queue( type, function() {  
var elem = this;  
setTimeout(function() {  
jQuery.dequeue( elem, type );  
}, time );  
});  
},  
 
clearQueue: function( type ) {  
return this.queue( type || "fx", [] );  
}  
});  
 
 
 
 
var rclass = /[\n\t\r]/g,  
rspaces = /\s+/,  
rreturn = /\r/g,  
rspecialurl = /^(?:href|src|style)$/,  
rtype = /^(?:button|input)$/i,  
rfocusable = /^(?:button|input|object|select|textarea)$/i,  
rclickable = /^a(?:rea)?$/i,  
rradiocheck = /^(?:radio|checkbox)$/i;  
 
jQuery.props = {  
"for": "htmlFor",  
"class": "className",  
readonly: "readOnly",  
maxlength: "maxLength",  
cellspacing: "cellSpacing",  
rowspan: "rowSpan",  
colspan: "colSpan",  
tabindex: "tabIndex",  
usemap: "useMap",  
frameborder: "frameBorder"  
};  
 
jQuery.fn.extend({  
attr: function( name, value ) {  
return jQuery.access( this, name, value, true, jQuery.attr );  
},  
 
removeAttr: function( name, fn ) {  
return this.each(function(){  
jQuery.attr( this, name, "" );  
if ( this.nodeType === 1 ) {  
this.removeAttribute( name );  
}  
});  
},  
 
addClass: function( value ) {  
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.addClass( value.call(this, i, self.attr("class")) );  
});  
}  
 
if ( value && typeof value === "string" ) {  
var classNames = (value || "").split( rspaces );  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
var elem = this[i];  
 
if ( elem.nodeType === 1 ) {  
if ( !elem.className ) {  
elem.className = value;  
 
} else {  
var className = " " + elem.className + " ",  
setClass = elem.className;  
 
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {  
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {  
setClass += " " + classNames[c];  
}  
}  
elem.className = jQuery.trim( setClass );  
}  
}  
}  
}  
 
return this;  
},  
 
removeClass: function( value ) {  
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.removeClass( value.call(this, i, self.attr("class")) );  
});  
}  
 
if ( (value && typeof value === "string") || value === undefined ) {  
var classNames = (value || "").split( rspaces );  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
var elem = this[i];  
 
if ( elem.nodeType === 1 && elem.className ) {  
if ( value ) {  
var className = (" " + elem.className + " ").replace(rclass, " ");  
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {  
className = className.replace(" " + classNames[c] + " ", " ");  
}  
elem.className = jQuery.trim( className );  
 
} else {  
elem.className = "";  
}  
}  
}  
}  
 
return this;  
},  
 
toggleClass: function( value, stateVal ) {  
var type = typeof value,  
isBool = typeof stateVal === "boolean";  
 
if ( jQuery.isFunction( value ) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );  
});  
}  
 
return this.each(function() {  
if ( type === "string" ) {  
// toggle individual class names  
var className,  
i = 0,  
self = jQuery( this ),  
state = stateVal,  
classNames = value.split( rspaces );  
 
while ( (className = classNames[ i++ ]) ) {  
// check each className given, space seperated list  
state = isBool ? state : !self.hasClass( className );  
self[ state ? "addClass" : "removeClass" ]( className );  
}  
 
} else if ( type === "undefined" || type === "boolean" ) {  
if ( this.className ) {  
// store className if set  
jQuery._data( this, "__className__", this.className );  
}  
 
// toggle whole className  
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";  
}  
});  
},  
 
hasClass: function( selector ) {  
var className = " " + selector + " ";  
for ( var i = 0, l = this.length; i < l; i++ ) {  
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {  
return true;  
}  
}  
 
return false;  
},  
 
val: function( value ) {  
if ( !arguments.length ) {  
var elem = this[0];  
 
if ( elem ) {  
if ( jQuery.nodeName( elem, "option" ) ) {  
// attributes.value is undefined in Blackberry 4.7 but  
// uses .value. See #6932  
var val = elem.attributes.value;  
return !val || val.specified ? elem.value : elem.text;  
}  
 
// We need to handle select boxes special  
if ( jQuery.nodeName( elem, "select" ) ) {  
var index = elem.selectedIndex,  
values = [],  
options = elem.options,  
one = elem.type === "select-one";  
 
// Nothing was selected  
if ( index < 0 ) {  
return null;  
}  
 
// Loop through all the selected options  
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {  
var option = options[ i ];  
 
// Don't return options that are disabled or in a disabled optgroup  
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&  
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {  
 
// Get the specific value for the option  
value = jQuery(option).val();  
 
// We don't need an array for one selects  
if ( one ) {  
return value;  
}  
 
// Multi-Selects return an array  
values.push( value );  
}  
}  
 
return values;  
}  
 
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified  
if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {  
return elem.getAttribute("value") === null ? "on" : elem.value;  
}  
 
// Everything else, we just grab the value  
return (elem.value || "").replace(rreturn, "");  
 
}  
 
return undefined;  
}  
 
var isFunction = jQuery.isFunction(value);  
 
return this.each(function(i) {  
var self = jQuery(this), val = value;  
 
if ( this.nodeType !== 1 ) {  
return;  
}  
 
if ( isFunction ) {  
val = value.call(this, i, self.val());  
}  
 
// Treat null/undefined as ""; convert numbers to string  
if ( val == null ) {  
val = "";  
} else if ( typeof val === "number" ) {  
val += "";  
} else if ( jQuery.isArray(val) ) {  
val = jQuery.map(val, function (value) {  
return value == null ? "" : value + "";  
});  
}  
 
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {  
this.checked = jQuery.inArray( self.val(), val ) >= 0;  
 
} else if ( jQuery.nodeName( this, "select" ) ) {  
var values = jQuery.makeArray(val);  
 
jQuery( "option", this ).each(function() {  
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;  
});  
 
if ( !values.length ) {  
this.selectedIndex = -1;  
}  
 
} else {  
this.value = val;  
}  
});  
}  
});  
 
jQuery.extend({  
attrFn: {  
val: true,  
css: true,  
html: true,  
text: true,  
data: true,  
width: true,  
height: true,  
offset: true  
},  
 
attr: function( elem, name, value, pass ) {  
// don't get/set attributes on text, comment and attribute nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {  
return undefined;  
}  
 
if ( pass && name in jQuery.attrFn ) {  
return jQuery(elem)[name](value);  
}  
 
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),  
// Whether we are setting (or getting)  
set = value !== undefined;  
 
// Try to normalize/fix the name  
name = notxml && jQuery.props[ name ] || name;  
 
// Only do all the following if this is a node (faster for style)  
if ( elem.nodeType === 1 ) {  
// These attributes require special treatment  
var special = rspecialurl.test( name );  
 
// Safari mis-reports the default selected property of an option  
// Accessing the parent's selectedIndex property fixes it  
if ( name === "selected" && !jQuery.support.optSelected ) {  
var parent = elem.parentNode;  
if ( parent ) {  
parent.selectedIndex;  
 
// Make sure that it also works with optgroups, see #5701  
if ( parent.parentNode ) {  
parent.parentNode.selectedIndex;  
}  
}  
}  
 
// If applicable, access the attribute via the DOM 0 way  
// 'in' checks fail in Blackberry 4.7 #6931  
if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {  
if ( set ) {  
// We can't allow the type property to be changed (since it causes problems in IE)  
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {  
jQuery.error( "type property can't be changed" );  
}  
 
if ( value === null ) {  
if ( elem.nodeType === 1 ) {  
elem.removeAttribute( name );  
}  
 
} else {  
elem[ name ] = value;  
}  
}  
 
// browsers index elements by id/name on forms, give priority to attributes.  
if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {  
return elem.getAttributeNode( name ).nodeValue;  
}  
 
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set  
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/  
if ( name === "tabIndex" ) {  
var attributeNode = elem.getAttributeNode( "tabIndex" );  
 
return attributeNode && attributeNode.specified ?  
attributeNode.value :  
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?  
0 :  
undefined;  
}  
 
return elem[ name ];  
}  
 
if ( !jQuery.support.style && notxml && name === "style" ) {  
if ( set ) {  
elem.style.cssText = "" + value;  
}  
 
return elem.style.cssText;  
}  
 
if ( set ) {  
// convert the value to a string (all browsers do this but IE) see #1070  
elem.setAttribute( name, "" + value );  
}  
 
// Ensure that missing attributes return undefined  
// Blackberry 4.7 returns "" from getAttribute #6938  
if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {  
return undefined;  
}  
 
var attr = !jQuery.support.hrefNormalized && notxml && special ?  
// Some attributes require a special call on IE  
elem.getAttribute( name, 2 ) :  
elem.getAttribute( name );  
 
// Non-existent attributes return null, we normalize to undefined  
return attr === null ? undefined : attr;  
}  
// Handle everything which isn't a DOM element node  
if ( set ) {  
elem[ name ] = value;  
}  
return elem[ name ];  
}  
});  
 
 
 
 
var rnamespaces = /\.(.*)$/,  
rformElems = /^(?:textarea|input|select)$/i,  
rperiod = /\./g,  
rspace = / /g,  
rescape = /[^\w\s.|`]/g,  
fcleanup = function( nm ) {  
return nm.replace(rescape, "\\$&");  
},  
eventKey = "events";  
 
/*  
* A number of helper functions used for managing events.  
* Many of the ideas behind this code originated from  
* Dean Edwards' addEvent library.  
*/  
jQuery.event = {  
 
// Bind an event to an element  
// Original by Dean Edwards  
add: function( elem, types, handler, data ) {  
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {  
return;  
}  
 
// For whatever reason, IE has trouble passing the window object  
// around, causing it to be cloned in the process  
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {  
elem = window;  
}  
 
if ( handler === false ) {  
handler = returnFalse;  
} else if ( !handler ) {  
// Fixes bug #7229. Fix recommended by jdalton  
return;  
}  
 
var handleObjIn, handleObj;  
 
if ( handler.handler ) {  
handleObjIn = handler;  
handler = handleObjIn.handler;  
}  
 
// Make sure that the function being executed has a unique ID  
if ( !handler.guid ) {  
handler.guid = jQuery.guid++;  
}  
 
// Init the element's event structure  
var elemData = jQuery._data( elem );  
 
// If no elemData is found then we must be trying to bind to one of the  
// banned noData elements  
if ( !elemData ) {  
return;  
}  
 
var events = elemData[ eventKey ],  
eventHandle = elemData.handle;  
 
if ( typeof events === "function" ) {  
// On plain objects events is a fn that holds the the data  
// which prevents this data from being JSON serialized  
// the function does not need to be called, it just contains the data  
eventHandle = events.handle;  
events = events.events;  
 
} else if ( !events ) {  
if ( !elem.nodeType ) {  
// On plain objects, create a fn that acts as the holder  
// of the values to avoid JSON serialization of event data  
elemData[ eventKey ] = elemData = function(){};  
}  
 
elemData.events = events = {};  
}  
 
if ( !eventHandle ) {  
elemData.handle = eventHandle = function() {  
// Handle the second event of a trigger and when  
// an event is called after a page has unloaded  
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?  
jQuery.event.handle.apply( eventHandle.elem, arguments ) :  
undefined;  
};  
}  
 
// Add elem as a property of the handle function  
// This is to prevent a memory leak with non-native events in IE.  
eventHandle.elem = elem;  
 
// Handle multiple events separated by a space  
// jQuery(...).bind("mouseover mouseout", fn);  
types = types.split(" ");  
 
var type, i = 0, namespaces;  
 
while ( (type = types[ i++ ]) ) {  
handleObj = handleObjIn ?  
jQuery.extend({}, handleObjIn) :  
{ handler: handler, data: data };  
 
// Namespaced event handlers  
if ( type.indexOf(".") > -1 ) {  
namespaces = type.split(".");  
type = namespaces.shift();  
handleObj.namespace = namespaces.slice(0).sort().join(".");  
 
} else {  
namespaces = [];  
handleObj.namespace = "";  
}  
 
handleObj.type = type;  
if ( !handleObj.guid ) {  
handleObj.guid = handler.guid;  
}  
 
// Get the current list of functions bound to this event  
var handlers = events[ type ],  
special = jQuery.event.special[ type ] || {};  
 
// Init the event handler queue  
if ( !handlers ) {  
handlers = events[ type ] = [];  
 
// Check for a special event handler  
// Only use addEventListener/attachEvent if the special  
// events handler returns false  
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {  
// Bind the global event handler to the element  
if ( elem.addEventListener ) {  
elem.addEventListener( type, eventHandle, false );  
 
} else if ( elem.attachEvent ) {  
elem.attachEvent( "on" + type, eventHandle );  
}  
}  
}  
 
if ( special.add ) {  
special.add.call( elem, handleObj );  
 
if ( !handleObj.handler.guid ) {  
handleObj.handler.guid = handler.guid;  
}  
}  
 
// Add the function to the element's handler list  
handlers.push( handleObj );  
 
// Keep track of which events have been used, for global triggering  
jQuery.event.global[ type ] = true;  
}  
 
// Nullify elem to prevent memory leaks in IE  
elem = null;  
},  
 
global: {},  
 
// Detach an event or set of events from an element  
remove: function( elem, types, handler, pos ) {  
// don't do events on text and comment nodes  
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {  
return;  
}  
 
if ( handler === false ) {  
handler = returnFalse;  
}  
 
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,  
elemData = jQuery.hasData( elem ) && jQuery._data( elem ),  
events = elemData && elemData[ eventKey ];  
 
if ( !elemData || !events ) {  
return;  
}  
 
if ( typeof events === "function" ) {  
elemData = events;  
events = events.events;  
}  
 
// types is actually an event object here  
if ( types && types.type ) {  
handler = types.handler;  
types = types.type;  
}  
 
// Unbind all events for the element  
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {  
types = types || "";  
 
for ( type in events ) {  
jQuery.event.remove( elem, type + types );  
}  
 
return;  
}  
 
// Handle multiple events separated by a space  
// jQuery(...).unbind("mouseover mouseout", fn);  
types = types.split(" ");  
 
while ( (type = types[ i++ ]) ) {  
origType = type;  
handleObj = null;  
all = type.indexOf(".") < 0;  
namespaces = [];  
 
if ( !all ) {  
// Namespaced event handlers  
namespaces = type.split(".");  
type = namespaces.shift();  
 
namespace = new RegExp("(^|\\.)" +  
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
eventType = events[ type ];  
 
if ( !eventType ) {  
continue;  
}  
 
if ( !handler ) {  
for ( j = 0; j < eventType.length; j++ ) {  
handleObj = eventType[ j ];  
 
if ( all || namespace.test( handleObj.namespace ) ) {  
jQuery.event.remove( elem, origType, handleObj.handler, j );  
eventType.splice( j--, 1 );  
}  
}  
 
continue;  
}  
 
special = jQuery.event.special[ type ] || {};  
 
for ( j = pos || 0; j < eventType.length; j++ ) {  
handleObj = eventType[ j ];  
 
if ( handler.guid === handleObj.guid ) {  
// remove the given handler for the given type  
if ( all || namespace.test( handleObj.namespace ) ) {  
if ( pos == null ) {  
eventType.splice( j--, 1 );  
}  
 
if ( special.remove ) {  
special.remove.call( elem, handleObj );  
}  
}  
 
if ( pos != null ) {  
break;  
}  
}  
}  
 
// remove generic event handler if no more handlers exist  
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {  
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {  
jQuery.removeEvent( elem, type, elemData.handle );  
}  
 
ret = null;  
delete events[ type ];  
}  
}  
 
// Remove the expando if it's no longer used  
if ( jQuery.isEmptyObject( events ) ) {  
var handle = elemData.handle;  
if ( handle ) {  
handle.elem = null;  
}  
 
delete elemData.events;  
delete elemData.handle;  
 
if ( typeof elemData === "function" ) {  
jQuery.removeData( elem, eventKey, true );  
 
} else if ( jQuery.isEmptyObject( elemData ) ) {  
jQuery.removeData( elem, undefined, true );  
}  
}  
},  
 
// bubbling is internal  
trigger: function( event, data, elem /*, bubbling */ ) {  
// Event object or event type  
var type = event.type || event,  
bubbling = arguments[3];  
 
if ( !bubbling ) {  
event = typeof event === "object" ?  
// jQuery.Event object  
event[ jQuery.expando ] ? event :  
// Object literal  
jQuery.extend( jQuery.Event(type), event ) :  
// Just the event type (string)  
jQuery.Event(type);  
 
if ( type.indexOf("!") >= 0 ) {  
event.type = type = type.slice(0, -1);  
event.exclusive = true;  
}  
 
// Handle a global trigger  
if ( !elem ) {  
// Don't bubble custom events when global (to avoid too much overhead)  
event.stopPropagation();  
 
// Only trigger if we've ever bound an event for it  
if ( jQuery.event.global[ type ] ) {  
// XXX This code smells terrible. event.js should not be directly  
// inspecting the data cache  
jQuery.each( jQuery.cache, function() {  
// internalKey variable is just used to make it easier to find  
// and potentially change this stuff later; currently it just  
// points to jQuery.expando  
var internalKey = jQuery.expando,  
internalCache = this[ internalKey ];  
if ( internalCache && internalCache.events && internalCache.events[type] ) {  
jQuery.event.trigger( event, data, internalCache.handle.elem );  
}  
});  
}  
}  
 
// Handle triggering a single element  
 
// don't do events on text and comment nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {  
return undefined;  
}  
 
// Clean up in case it is reused  
event.result = undefined;  
event.target = elem;  
 
// Clone the incoming data, if any  
data = jQuery.makeArray( data );  
data.unshift( event );  
}  
 
event.currentTarget = elem;  
 
// Trigger the event, it is assumed that "handle" is a function  
var handle = elem.nodeType ?  
jQuery._data( elem, "handle" ) :  
(jQuery._data( elem, eventKey ) || {}).handle;  
 
if ( handle ) {  
handle.apply( elem, data );  
}  
 
var parent = elem.parentNode || elem.ownerDocument;  
 
// Trigger an inline bound script  
try {  
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {  
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {  
event.result = false;  
event.preventDefault();  
}  
}  
 
// prevent IE from throwing an error for some elements with some event types, see #3533  
} catch (inlineError) {}  
 
if ( !event.isPropagationStopped() && parent ) {  
jQuery.event.trigger( event, data, parent, true );  
 
} else if ( !event.isDefaultPrevented() ) {  
var old,  
target = event.target,  
targetType = type.replace( rnamespaces, "" ),  
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",  
special = jQuery.event.special[ targetType ] || {};  
 
if ( (!special._default || special._default.call( elem, event ) === false) &&  
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {  
 
try {  
if ( target[ targetType ] ) {  
// Make sure that we don't accidentally re-trigger the onFOO events  
old = target[ "on" + targetType ];  
 
if ( old ) {  
target[ "on" + targetType ] = null;  
}  
 
jQuery.event.triggered = true;  
target[ targetType ]();  
}  
 
// prevent IE from throwing an error for some elements with some event types, see #3533  
} catch (triggerError) {}  
 
if ( old ) {  
target[ "on" + targetType ] = old;  
}  
 
jQuery.event.triggered = false;  
}  
}  
},  
 
handle: function( event ) {  
var all, handlers, namespaces, namespace_re, events,  
namespace_sort = [],  
args = jQuery.makeArray( arguments );  
 
event = args[0] = jQuery.event.fix( event || window.event );  
event.currentTarget = this;  
 
// Namespaced event handlers  
all = event.type.indexOf(".") < 0 && !event.exclusive;  
 
if ( !all ) {  
namespaces = event.type.split(".");  
event.type = namespaces.shift();  
namespace_sort = namespaces.slice(0).sort();  
namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
event.namespace = event.namespace || namespace_sort.join(".");  
 
events = jQuery._data(this, eventKey);  
 
if ( typeof events === "function" ) {  
events = events.events;  
}  
 
handlers = (events || {})[ event.type ];  
 
if ( events && handlers ) {  
// Clone the handlers to prevent manipulation  
handlers = handlers.slice(0);  
 
for ( var j = 0, l = handlers.length; j < l; j++ ) {  
var handleObj = handlers[ j ];  
 
// Filter the functions by class  
if ( all || namespace_re.test( handleObj.namespace ) ) {  
// Pass in a reference to the handler function itself  
// So that we can later remove it  
event.handler = handleObj.handler;  
event.data = handleObj.data;  
event.handleObj = handleObj;  
 
var ret = handleObj.handler.apply( this, args );  
 
if ( ret !== undefined ) {  
event.result = ret;  
if ( ret === false ) {  
event.preventDefault();  
event.stopPropagation();  
}  
}  
 
if ( event.isImmediatePropagationStopped() ) {  
break;  
}  
}  
}  
}  
 
return event.result;  
},  
 
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),  
 
fix: function( event ) {  
if ( event[ jQuery.expando ] ) {  
return event;  
}  
 
// store a copy of the original event object  
// and "clone" to set read-only properties  
var originalEvent = event;  
event = jQuery.Event( originalEvent );  
 
for ( var i = this.props.length, prop; i; ) {  
prop = this.props[ --i ];  
event[ prop ] = originalEvent[ prop ];  
}  
 
// Fix target property, if necessary  
if ( !event.target ) {  
// Fixes #1925 where srcElement might not be defined either  
event.target = event.srcElement || document;  
}  
 
// check if target is a textnode (safari)  
if ( event.target.nodeType === 3 ) {  
event.target = event.target.parentNode;  
}  
 
// Add relatedTarget, if necessary  
if ( !event.relatedTarget && event.fromElement ) {  
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;  
}  
 
// Calculate pageX/Y if missing and clientX/Y available  
if ( event.pageX == null && event.clientX != null ) {  
var doc = document.documentElement,  
body = document.body;  
 
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);  
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);  
}  
 
// Add which for key events  
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {  
event.which = event.charCode != null ? event.charCode : event.keyCode;  
}  
 
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)  
if ( !event.metaKey && event.ctrlKey ) {  
event.metaKey = event.ctrlKey;  
}  
 
// Add which for click: 1 === left; 2 === middle; 3 === right  
// Note: button is not normalized, so don't use it  
if ( !event.which && event.button !== undefined ) {  
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));  
}  
 
return event;  
},  
 
// Deprecated, use jQuery.guid instead  
guid: 1E8,  
 
// Deprecated, use jQuery.proxy instead  
proxy: jQuery.proxy,  
 
special: {  
ready: {  
// Make sure the ready event is setup  
setup: jQuery.bindReady,  
teardown: jQuery.noop  
},  
 
live: {  
add: function( handleObj ) {  
jQuery.event.add( this,  
liveConvert( handleObj.origType, handleObj.selector ),  
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );  
},  
 
remove: function( handleObj ) {  
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );  
}  
},  
 
beforeunload: {  
setup: function( data, namespaces, eventHandle ) {  
// We only want to do this special case on windows  
if ( jQuery.isWindow( this ) ) {  
this.onbeforeunload = eventHandle;  
}  
},  
 
teardown: function( namespaces, eventHandle ) {  
if ( this.onbeforeunload === eventHandle ) {  
this.onbeforeunload = null;  
}  
}  
}  
}  
};  
 
jQuery.removeEvent = document.removeEventListener ?  
function( elem, type, handle ) {  
if ( elem.removeEventListener ) {  
elem.removeEventListener( type, handle, false );  
}  
} :  
function( elem, type, handle ) {  
if ( elem.detachEvent ) {  
elem.detachEvent( "on" + type, handle );  
}  
};  
 
jQuery.Event = function( src ) {  
// Allow instantiation without the 'new' keyword  
if ( !this.preventDefault ) {  
return new jQuery.Event( src );  
}  
 
// Event object  
if ( src && src.type ) {  
this.originalEvent = src;  
this.type = src.type;  
 
// Events bubbling up the document may have been marked as prevented  
// by a handler lower down the tree; reflect the correct value.  
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||  
src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;  
 
// Event type  
} else {  
this.type = src;  
}  
 
// timeStamp is buggy for some events on Firefox(#3843)  
// So we won't rely on the native value  
this.timeStamp = jQuery.now();  
 
// Mark it as fixed  
this[ jQuery.expando ] = true;  
};  
 
function returnFalse() {  
return false;  
}  
function returnTrue() {  
return true;  
}  
 
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding  
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html  
jQuery.Event.prototype = {  
preventDefault: function() {  
this.isDefaultPrevented = returnTrue;  
 
var e = this.originalEvent;  
if ( !e ) {  
return;  
}  
 
// if preventDefault exists run it on the original event  
if ( e.preventDefault ) {  
e.preventDefault();  
 
// otherwise set the returnValue property of the original event to false (IE)  
} else {  
e.returnValue = false;  
}  
},  
stopPropagation: function() {  
this.isPropagationStopped = returnTrue;  
 
var e = this.originalEvent;  
if ( !e ) {  
return;  
}  
// if stopPropagation exists run it on the original event  
if ( e.stopPropagation ) {  
e.stopPropagation();  
}  
// otherwise set the cancelBubble property of the original event to true (IE)  
e.cancelBubble = true;  
},  
stopImmediatePropagation: function() {  
this.isImmediatePropagationStopped = returnTrue;  
this.stopPropagation();  
},  
isDefaultPrevented: returnFalse,  
isPropagationStopped: returnFalse,  
isImmediatePropagationStopped: returnFalse  
};  
 
// Checks if an event happened on an element within another element  
// Used in jQuery.event.special.mouseenter and mouseleave handlers  
var withinElement = function( event ) {  
// Check if mouse(over|out) are still within the same parent element  
var parent = event.relatedTarget;  
 
// Firefox sometimes assigns relatedTarget a XUL element  
// which we cannot access the parentNode property of  
try {  
// Traverse up the tree  
while ( parent && parent !== this ) {  
parent = parent.parentNode;  
}  
 
if ( parent !== this ) {  
// set the correct event type  
event.type = event.data;  
 
// handle event if we actually just moused on to a non sub-element  
jQuery.event.handle.apply( this, arguments );  
}  
 
// assuming we've left the element since we most likely mousedover a xul element  
} catch(e) { }  
},  
 
// In case of event delegation, we only need to rename the event.type,  
// liveHandler will take care of the rest.  
delegate = function( event ) {  
event.type = event.data;  
jQuery.event.handle.apply( this, arguments );  
};  
 
// Create mouseenter and mouseleave events  
jQuery.each({  
mouseenter: "mouseover",  
mouseleave: "mouseout"  
}, function( orig, fix ) {  
jQuery.event.special[ orig ] = {  
setup: function( data ) {  
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );  
},  
teardown: function( data ) {  
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );  
}  
};  
});  
 
// submit delegation  
if ( !jQuery.support.submitBubbles ) {  
 
jQuery.event.special.submit = {  
setup: function( data, namespaces ) {  
if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {  
jQuery.event.add(this, "click.specialSubmit", function( e ) {  
var elem = e.target,  
type = elem.type;  
 
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {  
e.liveFired = undefined;  
return trigger( "submit", this, arguments );  
}  
});  
 
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {  
var elem = e.target,  
type = elem.type;  
 
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {  
e.liveFired = undefined;  
return trigger( "submit", this, arguments );  
}  
});  
 
} else {  
return false;  
}  
},  
 
teardown: function( namespaces ) {  
jQuery.event.remove( this, ".specialSubmit" );  
}  
};  
 
}  
 
// change delegation, happens here so we have bind.  
if ( !jQuery.support.changeBubbles ) {  
 
var changeFilters,  
 
getVal = function( elem ) {  
var type = elem.type, val = elem.value;  
 
if ( type === "radio" || type === "checkbox" ) {  
val = elem.checked;  
 
} else if ( type === "select-multiple" ) {  
val = elem.selectedIndex > -1 ?  
jQuery.map( elem.options, function( elem ) {  
return elem.selected;  
}).join("-") :  
"";  
 
} else if ( elem.nodeName.toLowerCase() === "select" ) {  
val = elem.selectedIndex;  
}  
 
return val;  
},  
 
testChange = function testChange( e ) {  
var elem = e.target, data, val;  
 
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {  
return;  
}  
 
data = jQuery._data( elem, "_change_data" );  
val = getVal(elem);  
 
// the current data will be also retrieved by beforeactivate  
if ( e.type !== "focusout" || elem.type !== "radio" ) {  
jQuery._data( elem, "_change_data", val );  
}  
 
if ( data === undefined || val === data ) {  
return;  
}  
 
if ( data != null || val ) {  
e.type = "change";  
e.liveFired = undefined;  
return jQuery.event.trigger( e, arguments[1], elem );  
}  
};  
 
jQuery.event.special.change = {  
filters: {  
focusout: testChange,  
 
beforedeactivate: testChange,  
 
click: function( e ) {  
var elem = e.target, type = elem.type;  
 
if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {  
return testChange.call( this, e );  
}  
},  
 
// Change has to be called before submit  
// Keydown will be called before keypress, which is used in submit-event delegation  
keydown: function( e ) {  
var elem = e.target, type = elem.type;  
 
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||  
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||  
type === "select-multiple" ) {  
return testChange.call( this, e );  
}  
},  
 
// Beforeactivate happens also before the previous element is blurred  
// with this event you can't trigger a change event, but you can store  
// information  
beforeactivate: function( e ) {  
var elem = e.target;  
jQuery._data( elem, "_change_data", getVal(elem) );  
}  
},  
 
setup: function( data, namespaces ) {  
if ( this.type === "file" ) {  
return false;  
}  
 
for ( var type in changeFilters ) {  
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );  
}  
 
return rformElems.test( this.nodeName );  
},  
 
teardown: function( namespaces ) {  
jQuery.event.remove( this, ".specialChange" );  
 
return rformElems.test( this.nodeName );  
}  
};  
 
changeFilters = jQuery.event.special.change.filters;  
 
// Handle when the input is .focus()'d  
changeFilters.focus = changeFilters.beforeactivate;  
}  
 
function trigger( type, elem, args ) {  
args[0].type = type;  
return jQuery.event.handle.apply( elem, args );  
}  
 
// Create "bubbling" focus and blur events  
if ( document.addEventListener ) {  
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {  
jQuery.event.special[ fix ] = {  
setup: function() {  
this.addEventListener( orig, handler, true );  
},  
teardown: function() {  
this.removeEventListener( orig, handler, true );  
}  
};  
 
function handler( e ) {  
e = jQuery.event.fix( e );  
e.type = fix;  
return jQuery.event.handle.call( this, e );  
}  
});  
}  
 
jQuery.each(["bind", "one"], function( i, name ) {  
jQuery.fn[ name ] = function( type, data, fn ) {  
// Handle object literals  
if ( typeof type === "object" ) {  
for ( var key in type ) {  
this[ name ](key, data, type[key], fn);  
}  
return this;  
}  
 
if ( jQuery.isFunction( data ) || data === false ) {  
fn = data;  
data = undefined;  
}  
 
var handler = name === "one" ? jQuery.proxy( fn, function( event ) {  
jQuery( this ).unbind( event, handler );  
return fn.apply( this, arguments );  
}) : fn;  
 
if ( type === "unload" && name !== "one" ) {  
this.one( type, data, fn );  
 
} else {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
jQuery.event.add( this[i], type, handler, data );  
}  
}  
 
return this;  
};  
});  
 
jQuery.fn.extend({  
unbind: function( type, fn ) {  
// Handle object literals  
if ( typeof type === "object" && !type.preventDefault ) {  
for ( var key in type ) {  
this.unbind(key, type[key]);  
}  
 
} else {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
jQuery.event.remove( this[i], type, fn );  
}  
}  
 
return this;  
},  
 
delegate: function( selector, types, data, fn ) {  
return this.live( types, data, fn, selector );  
},  
 
undelegate: function( selector, types, fn ) {  
if ( arguments.length === 0 ) {  
return this.unbind( "live" );  
 
} else {  
return this.die( types, null, fn, selector );  
}  
},  
 
trigger: function( type, data ) {  
return this.each(function() {  
jQuery.event.trigger( type, data, this );  
});  
},  
 
triggerHandler: function( type, data ) {  
if ( this[0] ) {  
var event = jQuery.Event( type );  
event.preventDefault();  
event.stopPropagation();  
jQuery.event.trigger( event, data, this[0] );  
return event.result;  
}  
},  
 
toggle: function( fn ) {  
// Save reference to arguments for access in closure  
var args = arguments,  
i = 1;  
 
// link all the functions, so any of them can unbind this click handler  
while ( i < args.length ) {  
jQuery.proxy( fn, args[ i++ ] );  
}  
 
return this.click( jQuery.proxy( fn, function( event ) {  
// Figure out which function to execute  
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;  
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );  
 
// Make sure that clicks stop  
event.preventDefault();  
 
// and execute the function  
return args[ lastToggle ].apply( this, arguments ) || false;  
}));  
},  
 
hover: function( fnOver, fnOut ) {  
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );  
}  
});  
 
var liveMap = {  
focus: "focusin",  
blur: "focusout",  
mouseenter: "mouseover",  
mouseleave: "mouseout"  
};  
 
jQuery.each(["live", "die"], function( i, name ) {  
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {  
var type, i = 0, match, namespaces, preType,  
selector = origSelector || this.selector,  
context = origSelector ? this : jQuery( this.context );  
 
if ( typeof types === "object" && !types.preventDefault ) {  
for ( var key in types ) {  
context[ name ]( key, data, types[key], selector );  
}  
 
return this;  
}  
 
if ( jQuery.isFunction( data ) ) {  
fn = data;  
data = undefined;  
}  
 
types = (types || "").split(" ");  
 
while ( (type = types[ i++ ]) != null ) {  
match = rnamespaces.exec( type );  
namespaces = "";  
 
if ( match ) {  
namespaces = match[0];  
type = type.replace( rnamespaces, "" );  
}  
 
if ( type === "hover" ) {  
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );  
continue;  
}  
 
preType = type;  
 
if ( type === "focus" || type === "blur" ) {  
types.push( liveMap[ type ] + namespaces );  
type = type + namespaces;  
 
} else {  
type = (liveMap[ type ] || type) + namespaces;  
}  
 
if ( name === "live" ) {  
// bind live handler  
for ( var j = 0, l = context.length; j < l; j++ ) {  
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),  
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );  
}  
 
} else {  
// unbind live handler  
context.unbind( "live." + liveConvert( type, selector ), fn );  
}  
}  
 
return this;  
};  
});  
 
function liveHandler( event ) {  
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,  
elems = [],  
selectors = [],  
events = jQuery._data( this, eventKey );  
 
if ( typeof events === "function" ) {  
events = events.events;  
}  
 
// Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)  
if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {  
return;  
}  
 
if ( event.namespace ) {  
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");  
}  
 
event.liveFired = this;  
 
var live = events.live.slice(0);  
 
for ( j = 0; j < live.length; j++ ) {  
handleObj = live[j];  
 
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {  
selectors.push( handleObj.selector );  
 
} else {  
live.splice( j--, 1 );  
}  
}  
 
match = jQuery( event.target ).closest( selectors, event.currentTarget );  
 
for ( i = 0, l = match.length; i < l; i++ ) {  
close = match[i];  
 
for ( j = 0; j < live.length; j++ ) {  
handleObj = live[j];  
 
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {  
elem = close.elem;  
related = null;  
 
// Those two events require additional checking  
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {  
event.type = handleObj.preType;  
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];  
}  
 
if ( !related || related !== elem ) {  
elems.push({ elem: elem, handleObj: handleObj, level: close.level });  
}  
}  
}  
}  
 
for ( i = 0, l = elems.length; i < l; i++ ) {  
match = elems[i];  
 
if ( maxLevel && match.level > maxLevel ) {  
break;  
}  
 
event.currentTarget = match.elem;  
event.data = match.handleObj.data;  
event.handleObj = match.handleObj;  
 
ret = match.handleObj.origHandler.apply( match.elem, arguments );  
 
if ( ret === false || event.isPropagationStopped() ) {  
maxLevel = match.level;  
 
if ( ret === false ) {  
stop = false;  
}  
if ( event.isImmediatePropagationStopped() ) {  
break;  
}  
}  
}  
 
return stop;  
}  
 
function liveConvert( type, selector ) {  
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");  
}  
 
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +  
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +  
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {  
 
// Handle event binding  
jQuery.fn[ name ] = function( data, fn ) {  
if ( fn == null ) {  
fn = data;  
data = null;  
}  
 
return arguments.length > 0 ?  
this.bind( name, data, fn ) :  
this.trigger( name );  
};  
 
if ( jQuery.attrFn ) {  
jQuery.attrFn[ name ] = true;  
}  
});  
 
 
/*!  
* Sizzle CSS Selector Engine  
* Copyright 2011, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
* More information: http://sizzlejs.com/  
*/  
(function(){  
 
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,  
done = 0,  
toString = Object.prototype.toString,  
hasDuplicate = false,  
baseHasDuplicate = true;  
 
// Here we check if the JavaScript engine is using some sort of  
// optimization where it does not always call our comparision  
// function. If that is the case, discard the hasDuplicate value.  
// Thus far that includes Google Chrome.  
[0, 0].sort(function() {  
baseHasDuplicate = false;  
return 0;  
});  
 
var Sizzle = function( selector, context, results, seed ) {  
results = results || [];  
context = context || document;  
 
var origContext = context;  
 
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {  
return [];  
}  
 
if ( !selector || typeof selector !== "string" ) {  
return results;  
}  
 
var m, set, checkSet, extra, ret, cur, pop, i,  
prune = true,  
contextXML = Sizzle.isXML( context ),  
parts = [],  
soFar = selector;  
 
// Reset the position of the chunker regexp (start from head)  
do {  
chunker.exec( "" );  
m = chunker.exec( soFar );  
 
if ( m ) {  
soFar = m[3];  
 
parts.push( m[1] );  
 
if ( m[2] ) {  
extra = m[3];  
break;  
}  
}  
} while ( m );  
 
if ( parts.length > 1 && origPOS.exec( selector ) ) {  
 
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {  
set = posProcess( parts[0] + parts[1], context );  
 
} else {  
set = Expr.relative[ parts[0] ] ?  
[ context ] :  
Sizzle( parts.shift(), context );  
 
while ( parts.length ) {  
selector = parts.shift();  
 
if ( Expr.relative[ selector ] ) {  
selector += parts.shift();  
}  
 
set = posProcess( selector, set );  
}  
}  
 
} else {  
// Take a shortcut and set the context if the root selector is an ID  
// (but not if it'll be faster if the inner selector is an ID)  
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&  
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {  
 
ret = Sizzle.find( parts.shift(), context, contextXML );  
context = ret.expr ?  
Sizzle.filter( ret.expr, ret.set )[0] :  
ret.set[0];  
}  
 
if ( context ) {  
ret = seed ?  
{ expr: parts.pop(), set: makeArray(seed) } :  
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );  
 
set = ret.expr ?  
Sizzle.filter( ret.expr, ret.set ) :  
ret.set;  
 
if ( parts.length > 0 ) {  
checkSet = makeArray( set );  
 
} else {  
prune = false;  
}  
 
while ( parts.length ) {  
cur = parts.pop();  
pop = cur;  
 
if ( !Expr.relative[ cur ] ) {  
cur = "";  
} else {  
pop = parts.pop();  
}  
 
if ( pop == null ) {  
pop = context;  
}  
 
Expr.relative[ cur ]( checkSet, pop, contextXML );  
}  
 
} else {  
checkSet = parts = [];  
}  
}  
 
if ( !checkSet ) {  
checkSet = set;  
}  
 
if ( !checkSet ) {  
Sizzle.error( cur || selector );  
}  
 
if ( toString.call(checkSet) === "[object Array]" ) {  
if ( !prune ) {  
results.push.apply( results, checkSet );  
 
} else if ( context && context.nodeType === 1 ) {  
for ( i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {  
results.push( set[i] );  
}  
}  
 
} else {  
for ( i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {  
results.push( set[i] );  
}  
}  
}  
 
} else {  
makeArray( checkSet, results );  
}  
 
if ( extra ) {  
Sizzle( extra, origContext, results, seed );  
Sizzle.uniqueSort( results );  
}  
 
return results;  
};  
 
Sizzle.uniqueSort = function( results ) {  
if ( sortOrder ) {  
hasDuplicate = baseHasDuplicate;  
results.sort( sortOrder );  
 
if ( hasDuplicate ) {  
for ( var i = 1; i < results.length; i++ ) {  
if ( results[i] === results[ i - 1 ] ) {  
results.splice( i--, 1 );  
}  
}  
}  
}  
 
return results;  
};  
 
Sizzle.matches = function( expr, set ) {  
return Sizzle( expr, null, null, set );  
};  
 
Sizzle.matchesSelector = function( node, expr ) {  
return Sizzle( expr, null, null, [node] ).length > 0;  
};  
 
Sizzle.find = function( expr, context, isXML ) {  
var set;  
 
if ( !expr ) {  
return [];  
}  
 
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {  
var match,  
type = Expr.order[i];  
 
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {  
var left = match[1];  
match.splice( 1, 1 );  
 
if ( left.substr( left.length - 1 ) !== "\\" ) {  
match[1] = (match[1] || "").replace(/\\/g, "");  
set = Expr.find[ type ]( match, context, isXML );  
 
if ( set != null ) {  
expr = expr.replace( Expr.match[ type ], "" );  
break;  
}  
}  
}  
}  
 
if ( !set ) {  
set = typeof context.getElementsByTagName !== "undefined" ?  
context.getElementsByTagName( "*" ) :  
[];  
}  
 
return { set: set, expr: expr };  
};  
 
Sizzle.filter = function( expr, set, inplace, not ) {  
var match, anyFound,  
old = expr,  
result = [],  
curLoop = set,  
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );  
 
while ( expr && set.length ) {  
for ( var type in Expr.filter ) {  
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {  
var found, item,  
filter = Expr.filter[ type ],  
left = match[1];  
 
anyFound = false;  
 
match.splice(1,1);  
 
if ( left.substr( left.length - 1 ) === "\\" ) {  
continue;  
}  
 
if ( curLoop === result ) {  
result = [];  
}  
 
if ( Expr.preFilter[ type ] ) {  
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );  
 
if ( !match ) {  
anyFound = found = true;  
 
} else if ( match === true ) {  
continue;  
}  
}  
 
if ( match ) {  
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {  
if ( item ) {  
found = filter( item, match, i, curLoop );  
var pass = not ^ !!found;  
 
if ( inplace && found != null ) {  
if ( pass ) {  
anyFound = true;  
 
} else {  
curLoop[i] = false;  
}  
 
} else if ( pass ) {  
result.push( item );  
anyFound = true;  
}  
}  
}  
}  
 
if ( found !== undefined ) {  
if ( !inplace ) {  
curLoop = result;  
}  
 
expr = expr.replace( Expr.match[ type ], "" );  
 
if ( !anyFound ) {  
return [];  
}  
 
break;  
}  
}  
}  
 
// Improper expression  
if ( expr === old ) {  
if ( anyFound == null ) {  
Sizzle.error( expr );  
 
} else {  
break;  
}  
}  
 
old = expr;  
}  
 
return curLoop;  
};  
 
Sizzle.error = function( msg ) {  
throw "Syntax error, unrecognized expression: " + msg;  
};  
 
var Expr = Sizzle.selectors = {  
order: [ "ID", "NAME", "TAG" ],  
 
match: {  
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,  
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,  
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,  
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,  
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,  
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,  
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,  
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/  
},  
 
leftMatch: {},  
 
attrMap: {  
"class": "className",  
"for": "htmlFor"  
},  
 
attrHandle: {  
href: function( elem ) {  
return elem.getAttribute( "href" );  
}  
},  
 
relative: {  
"+": function(checkSet, part){  
var isPartStr = typeof part === "string",  
isTag = isPartStr && !/\W/.test( part ),  
isPartStrNotTag = isPartStr && !isTag;  
 
if ( isTag ) {  
part = part.toLowerCase();  
}  
 
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {  
if ( (elem = checkSet[i]) ) {  
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}  
 
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?  
elem || false :  
elem === part;  
}  
}  
 
if ( isPartStrNotTag ) {  
Sizzle.filter( part, checkSet, true );  
}  
},  
 
">": function( checkSet, part ) {  
var elem,  
isPartStr = typeof part === "string",  
i = 0,  
l = checkSet.length;  
 
if ( isPartStr && !/\W/.test( part ) ) {  
part = part.toLowerCase();  
 
for ( ; i < l; i++ ) {  
elem = checkSet[i];  
 
if ( elem ) {  
var parent = elem.parentNode;  
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;  
}  
}  
 
} else {  
for ( ; i < l; i++ ) {  
elem = checkSet[i];  
 
if ( elem ) {  
checkSet[i] = isPartStr ?  
elem.parentNode :  
elem.parentNode === part;  
}  
}  
 
if ( isPartStr ) {  
Sizzle.filter( part, checkSet, true );  
}  
}  
},  
 
"": function(checkSet, part, isXML){  
var nodeCheck,  
doneName = done++,  
checkFn = dirCheck;  
 
if ( typeof part === "string" && !/\W/.test(part) ) {  
part = part.toLowerCase();  
nodeCheck = part;  
checkFn = dirNodeCheck;  
}  
 
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );  
},  
 
"~": function( checkSet, part, isXML ) {  
var nodeCheck,  
doneName = done++,  
checkFn = dirCheck;  
 
if ( typeof part === "string" && !/\W/.test( part ) ) {  
part = part.toLowerCase();  
nodeCheck = part;  
checkFn = dirNodeCheck;  
}  
 
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );  
}  
},  
 
find: {  
ID: function( match, context, isXML ) {  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
return m && m.parentNode ? [m] : [];  
}  
},  
 
NAME: function( match, context ) {  
if ( typeof context.getElementsByName !== "undefined" ) {  
var ret = [],  
results = context.getElementsByName( match[1] );  
 
for ( var i = 0, l = results.length; i < l; i++ ) {  
if ( results[i].getAttribute("name") === match[1] ) {  
ret.push( results[i] );  
}  
}  
 
return ret.length === 0 ? null : ret;  
}  
},  
 
TAG: function( match, context ) {  
if ( typeof context.getElementsByTagName !== "undefined" ) {  
return context.getElementsByTagName( match[1] );  
}  
}  
},  
preFilter: {  
CLASS: function( match, curLoop, inplace, result, not, isXML ) {  
match = " " + match[1].replace(/\\/g, "") + " ";  
 
if ( isXML ) {  
return match;  
}  
 
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {  
if ( elem ) {  
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {  
if ( !inplace ) {  
result.push( elem );  
}  
 
} else if ( inplace ) {  
curLoop[i] = false;  
}  
}  
}  
 
return false;  
},  
 
ID: function( match ) {  
return match[1].replace(/\\/g, "");  
},  
 
TAG: function( match, curLoop ) {  
return match[1].toLowerCase();  
},  
 
CHILD: function( match ) {  
if ( match[1] === "nth" ) {  
if ( !match[2] ) {  
Sizzle.error( match[0] );  
}  
 
match[2] = match[2].replace(/^\+|\s*/g, '');  
 
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'  
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(  
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||  
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);  
 
// calculate the numbers (first)n+(last) including if they are negative  
match[2] = (test[1] + (test[2] || 1)) - 0;  
match[3] = test[3] - 0;  
}  
else if ( match[2] ) {  
Sizzle.error( match[0] );  
}  
 
// TODO: Move to normal caching system  
match[0] = done++;  
 
return match;  
},  
 
ATTR: function( match, curLoop, inplace, result, not, isXML ) {  
var name = match[1] = match[1].replace(/\\/g, "");  
 
if ( !isXML && Expr.attrMap[name] ) {  
match[1] = Expr.attrMap[name];  
}  
 
// Handle if an un-quoted value was used  
match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");  
 
if ( match[2] === "~=" ) {  
match[4] = " " + match[4] + " ";  
}  
 
return match;  
},  
 
PSEUDO: function( match, curLoop, inplace, result, not ) {  
if ( match[1] === "not" ) {  
// If we're dealing with a complex expression, or a simple one  
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {  
match[3] = Sizzle(match[3], null, null, curLoop);  
 
} else {  
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);  
 
if ( !inplace ) {  
result.push.apply( result, ret );  
}  
 
return false;  
}  
 
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {  
return true;  
}  
 
return match;  
},  
 
POS: function( match ) {  
match.unshift( true );  
 
return match;  
}  
},  
 
filters: {  
enabled: function( elem ) {  
return elem.disabled === false && elem.type !== "hidden";  
},  
 
disabled: function( elem ) {  
return elem.disabled === true;  
},  
 
checked: function( elem ) {  
return elem.checked === true;  
},  
 
selected: function( elem ) {  
// Accessing this property makes selected-by-default  
// options in Safari work properly  
elem.parentNode.selectedIndex;  
 
return elem.selected === true;  
},  
 
parent: function( elem ) {  
return !!elem.firstChild;  
},  
 
empty: function( elem ) {  
return !elem.firstChild;  
},  
 
has: function( elem, i, match ) {  
return !!Sizzle( match[3], elem ).length;  
},  
 
header: function( elem ) {  
return (/h\d/i).test( elem.nodeName );  
},  
 
text: function( elem ) {  
return "text" === elem.type;  
},  
radio: function( elem ) {  
return "radio" === elem.type;  
},  
 
checkbox: function( elem ) {  
return "checkbox" === elem.type;  
},  
 
file: function( elem ) {  
return "file" === elem.type;  
},  
password: function( elem ) {  
return "password" === elem.type;  
},  
 
submit: function( elem ) {  
return "submit" === elem.type;  
},  
 
image: function( elem ) {  
return "image" === elem.type;  
},  
 
reset: function( elem ) {  
return "reset" === elem.type;  
},  
 
button: function( elem ) {  
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";  
},  
 
input: function( elem ) {  
return (/input|select|textarea|button/i).test( elem.nodeName );  
}  
},  
setFilters: {  
first: function( elem, i ) {  
return i === 0;  
},  
 
last: function( elem, i, match, array ) {  
return i === array.length - 1;  
},  
 
even: function( elem, i ) {  
return i % 2 === 0;  
},  
 
odd: function( elem, i ) {  
return i % 2 === 1;  
},  
 
lt: function( elem, i, match ) {  
return i < match[3] - 0;  
},  
 
gt: function( elem, i, match ) {  
return i > match[3] - 0;  
},  
 
nth: function( elem, i, match ) {  
return match[3] - 0 === i;  
},  
 
eq: function( elem, i, match ) {  
return match[3] - 0 === i;  
}  
},  
filter: {  
PSEUDO: function( elem, match, i, array ) {  
var name = match[1],  
filter = Expr.filters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
 
} else if ( name === "contains" ) {  
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;  
 
} else if ( name === "not" ) {  
var not = match[3];  
 
for ( var j = 0, l = not.length; j < l; j++ ) {  
if ( not[j] === elem ) {  
return false;  
}  
}  
 
return true;  
 
} else {  
Sizzle.error( name );  
}  
},  
 
CHILD: function( elem, match ) {  
var type = match[1],  
node = elem;  
 
switch ( type ) {  
case "only":  
case "first":  
while ( (node = node.previousSibling) ) {  
if ( node.nodeType === 1 ) {  
return false;  
}  
}  
 
if ( type === "first" ) {  
return true;  
}  
 
node = elem;  
 
case "last":  
while ( (node = node.nextSibling) ) {  
if ( node.nodeType === 1 ) {  
return false;  
}  
}  
 
return true;  
 
case "nth":  
var first = match[2],  
last = match[3];  
 
if ( first === 1 && last === 0 ) {  
return true;  
}  
 
var doneName = match[0],  
parent = elem.parentNode;  
 
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {  
var count = 0;  
 
for ( node = parent.firstChild; node; node = node.nextSibling ) {  
if ( node.nodeType === 1 ) {  
node.nodeIndex = ++count;  
}  
}  
 
parent.sizcache = doneName;  
}  
 
var diff = elem.nodeIndex - last;  
 
if ( first === 0 ) {  
return diff === 0;  
 
} else {  
return ( diff % first === 0 && diff / first >= 0 );  
}  
}  
},  
 
ID: function( elem, match ) {  
return elem.nodeType === 1 && elem.getAttribute("id") === match;  
},  
 
TAG: function( elem, match ) {  
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;  
},  
 
CLASS: function( elem, match ) {  
return (" " + (elem.className || elem.getAttribute("class")) + " ")  
.indexOf( match ) > -1;  
},  
 
ATTR: function( elem, match ) {  
var name = match[1],  
result = Expr.attrHandle[ name ] ?  
Expr.attrHandle[ name ]( elem ) :  
elem[ name ] != null ?  
elem[ name ] :  
elem.getAttribute( name ),  
value = result + "",  
type = match[2],  
check = match[4];  
 
return result == null ?  
type === "!=" :  
type === "=" ?  
value === check :  
type === "*=" ?  
value.indexOf(check) >= 0 :  
type === "~=" ?  
(" " + value + " ").indexOf(check) >= 0 :  
!check ?  
value && result !== false :  
type === "!=" ?  
value !== check :  
type === "^=" ?  
value.indexOf(check) === 0 :  
type === "$=" ?  
value.substr(value.length - check.length) === check :  
type === "|=" ?  
value === check || value.substr(0, check.length + 1) === check + "-" :  
false;  
},  
 
POS: function( elem, match, i, array ) {  
var name = match[2],  
filter = Expr.setFilters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
}  
}  
}  
};  
 
var origPOS = Expr.match.POS,  
fescape = function(all, num){  
return "\\" + (num - 0 + 1);  
};  
 
for ( var type in Expr.match ) {  
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );  
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );  
}  
 
var makeArray = function( array, results ) {  
array = Array.prototype.slice.call( array, 0 );  
 
if ( results ) {  
results.push.apply( results, array );  
return results;  
}  
 
return array;  
};  
 
// Perform a simple check to determine if the browser is capable of  
// converting a NodeList to an array using builtin methods.  
// Also verifies that the returned array holds DOM nodes  
// (which is not the case in the Blackberry browser)  
try {  
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;  
 
// Provide a fallback method if it does not work  
} catch( e ) {  
makeArray = function( array, results ) {  
var i = 0,  
ret = results || [];  
 
if ( toString.call(array) === "[object Array]" ) {  
Array.prototype.push.apply( ret, array );  
 
} else {  
if ( typeof array.length === "number" ) {  
for ( var l = array.length; i < l; i++ ) {  
ret.push( array[i] );  
}  
 
} else {  
for ( ; array[i]; i++ ) {  
ret.push( array[i] );  
}  
}  
}  
 
return ret;  
};  
}  
 
var sortOrder, siblingCheck;  
 
if ( document.documentElement.compareDocumentPosition ) {  
sortOrder = function( a, b ) {  
if ( a === b ) {  
hasDuplicate = true;  
return 0;  
}  
 
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {  
return a.compareDocumentPosition ? -1 : 1;  
}  
 
return a.compareDocumentPosition(b) & 4 ? -1 : 1;  
};  
 
} else {  
sortOrder = function( a, b ) {  
var al, bl,  
ap = [],  
bp = [],  
aup = a.parentNode,  
bup = b.parentNode,  
cur = aup;  
 
// The nodes are identical, we can exit early  
if ( a === b ) {  
hasDuplicate = true;  
return 0;  
 
// If the nodes are siblings (or identical) we can do a quick check  
} else if ( aup === bup ) {  
return siblingCheck( a, b );  
 
// If no parents were found then the nodes are disconnected  
} else if ( !aup ) {  
return -1;  
 
} else if ( !bup ) {  
return 1;  
}  
 
// Otherwise they're somewhere else in the tree so we need  
// to build up a full list of the parentNodes for comparison  
while ( cur ) {  
ap.unshift( cur );  
cur = cur.parentNode;  
}  
 
cur = bup;  
 
while ( cur ) {  
bp.unshift( cur );  
cur = cur.parentNode;  
}  
 
al = ap.length;  
bl = bp.length;  
 
// Start walking down the tree looking for a discrepancy  
for ( var i = 0; i < al && i < bl; i++ ) {  
if ( ap[i] !== bp[i] ) {  
return siblingCheck( ap[i], bp[i] );  
}  
}  
 
// We ended someplace up the tree so do a sibling check  
return i === al ?  
siblingCheck( a, bp[i], -1 ) :  
siblingCheck( ap[i], b, 1 );  
};  
 
siblingCheck = function( a, b, ret ) {  
if ( a === b ) {  
return ret;  
}  
 
var cur = a.nextSibling;  
 
while ( cur ) {  
if ( cur === b ) {  
return -1;  
}  
 
cur = cur.nextSibling;  
}  
 
return 1;  
};  
}  
 
// Utility function for retreiving the text value of an array of DOM nodes  
Sizzle.getText = function( elems ) {  
var ret = "", elem;  
 
for ( var i = 0; elems[i]; i++ ) {  
elem = elems[i];  
 
// Get the text from text nodes and CDATA nodes  
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {  
ret += elem.nodeValue;  
 
// Traverse everything else, except comment nodes  
} else if ( elem.nodeType !== 8 ) {  
ret += Sizzle.getText( elem.childNodes );  
}  
}  
 
return ret;  
};  
 
// Check to see if the browser returns elements by name when  
// querying by getElementById (and provide a workaround)  
(function(){  
// We're going to inject a fake input element with a specified name  
var form = document.createElement("div"),  
id = "script" + (new Date()).getTime(),  
root = document.documentElement;  
 
form.innerHTML = "<a name='" + id + "'/>";  
 
// Inject it into the root element, check its status, and remove it quickly  
root.insertBefore( form, root.firstChild );  
 
// The workaround has to do additional checks after a getElementById  
// Which slows things down for other browsers (hence the branching)  
if ( document.getElementById( id ) ) {  
Expr.find.ID = function( match, context, isXML ) {  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
 
return m ?  
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?  
[m] :  
undefined :  
[];  
}  
};  
 
Expr.filter.ID = function( elem, match ) {  
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");  
 
return elem.nodeType === 1 && node && node.nodeValue === match;  
};  
}  
 
root.removeChild( form );  
 
// release memory in IE  
root = form = null;  
})();  
 
(function(){  
// Check to see if the browser returns only elements  
// when doing getElementsByTagName("*")  
 
// Create a fake element  
var div = document.createElement("div");  
div.appendChild( document.createComment("") );  
 
// Make sure no comments are found  
if ( div.getElementsByTagName("*").length > 0 ) {  
Expr.find.TAG = function( match, context ) {  
var results = context.getElementsByTagName( match[1] );  
 
// Filter out possible comments  
if ( match[1] === "*" ) {  
var tmp = [];  
 
for ( var i = 0; results[i]; i++ ) {  
if ( results[i].nodeType === 1 ) {  
tmp.push( results[i] );  
}  
}  
 
results = tmp;  
}  
 
return results;  
};  
}  
 
// Check to see if an attribute returns normalized href attributes  
div.innerHTML = "<a href='#'></a>";  
 
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&  
div.firstChild.getAttribute("href") !== "#" ) {  
 
Expr.attrHandle.href = function( elem ) {  
return elem.getAttribute( "href", 2 );  
};  
}  
 
// release memory in IE  
div = null;  
})();  
 
if ( document.querySelectorAll ) {  
(function(){  
var oldSizzle = Sizzle,  
div = document.createElement("div"),  
id = "__sizzle__";  
 
div.innerHTML = "<p class='TEST'></p>";  
 
// Safari can't handle uppercase or unicode characters when  
// in quirks mode.  
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {  
return;  
}  
 
Sizzle = function( query, context, extra, seed ) {  
context = context || document;  
 
// Only use querySelectorAll on non-XML documents  
// (ID selectors don't work in non-HTML documents)  
if ( !seed && !Sizzle.isXML(context) ) {  
// See if we find a selector to speed up  
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );  
 
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {  
// Speed-up: Sizzle("TAG")  
if ( match[1] ) {  
return makeArray( context.getElementsByTagName( query ), extra );  
 
// Speed-up: Sizzle(".CLASS")  
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {  
return makeArray( context.getElementsByClassName( match[2] ), extra );  
}  
}  
 
if ( context.nodeType === 9 ) {  
// Speed-up: Sizzle("body")  
// The body element only exists once, optimize finding it  
if ( query === "body" && context.body ) {  
return makeArray( [ context.body ], extra );  
 
// Speed-up: Sizzle("#ID")  
} else if ( match && match[3] ) {  
var elem = context.getElementById( match[3] );  
 
// Check parentNode to catch when Blackberry 4.6 returns  
// nodes that are no longer in the document #6963  
if ( elem && elem.parentNode ) {  
// Handle the case where IE and Opera return items  
// by name instead of ID  
if ( elem.id === match[3] ) {  
return makeArray( [ elem ], extra );  
}  
 
} else {  
return makeArray( [], extra );  
}  
}  
 
try {  
return makeArray( context.querySelectorAll(query), extra );  
} catch(qsaError) {}  
 
// qSA works strangely on Element-rooted queries  
// We can work around this by specifying an extra ID on the root  
// and working up from there (Thanks to Andrew Dupont for the technique)  
// IE 8 doesn't work on object elements  
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {  
var old = context.getAttribute( "id" ),  
nid = old || id,  
hasParent = context.parentNode,  
relativeHierarchySelector = /^\s*[+~]/.test( query );  
 
if ( !old ) {  
context.setAttribute( "id", nid );  
} else {  
nid = nid.replace( /'/g, "\\$&" );  
}  
if ( relativeHierarchySelector && hasParent ) {  
context = context.parentNode;  
}  
 
try {  
if ( !relativeHierarchySelector || hasParent ) {  
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );  
}  
 
} catch(pseudoError) {  
} finally {  
if ( !old ) {  
context.removeAttribute( "id" );  
}  
}  
}  
}  
 
return oldSizzle(query, context, extra, seed);  
};  
 
for ( var prop in oldSizzle ) {  
Sizzle[ prop ] = oldSizzle[ prop ];  
}  
 
// release memory in IE  
div = null;  
})();  
}  
 
(function(){  
var html = document.documentElement,  
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,  
pseudoWorks = false;  
 
try {  
// This should fail with an exception  
// Gecko does not error, returns false instead  
matches.call( document.documentElement, "[test!='']:sizzle" );  
 
} catch( pseudoError ) {  
pseudoWorks = true;  
}  
 
if ( matches ) {  
Sizzle.matchesSelector = function( node, expr ) {  
// Make sure that attribute selectors are quoted  
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");  
 
if ( !Sizzle.isXML( node ) ) {  
try {  
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {  
return matches.call( node, expr );  
}  
} catch(e) {}  
}  
 
return Sizzle(expr, null, null, [node]).length > 0;  
};  
}  
})();  
 
(function(){  
var div = document.createElement("div");  
 
div.innerHTML = "<div class='test e'></div><div class='test'></div>";  
 
// Opera can't find a second classname (in 9.6)  
// Also, make sure that getElementsByClassName actually exists  
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {  
return;  
}  
 
// Safari caches class attributes, doesn't catch changes (in 3.2)  
div.lastChild.className = "e";  
 
if ( div.getElementsByClassName("e").length === 1 ) {  
return;  
}  
 
Expr.order.splice(1, 0, "CLASS");  
Expr.find.CLASS = function( match, context, isXML ) {  
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {  
return context.getElementsByClassName(match[1]);  
}  
};  
 
// release memory in IE  
div = null;  
})();  
 
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
 
if ( elem ) {  
var match = false;  
 
elem = elem[dir];  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 && !isXML ){  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
 
if ( elem.nodeName.toLowerCase() === cur ) {  
match = elem;  
break;  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
 
if ( elem ) {  
var match = false;  
 
elem = elem[dir];  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 ) {  
if ( !isXML ) {  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
 
if ( typeof cur !== "string" ) {  
if ( elem === cur ) {  
match = true;  
break;  
}  
 
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {  
match = elem;  
break;  
}  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
if ( document.documentElement.contains ) {  
Sizzle.contains = function( a, b ) {  
return a !== b && (a.contains ? a.contains(b) : true);  
};  
 
} else if ( document.documentElement.compareDocumentPosition ) {  
Sizzle.contains = function( a, b ) {  
return !!(a.compareDocumentPosition(b) & 16);  
};  
 
} else {  
Sizzle.contains = function() {  
return false;  
};  
}  
 
Sizzle.isXML = function( elem ) {  
// documentElement is verified for cases where it doesn't yet exist  
// (such as loading iframes in IE - #4833)  
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;  
 
return documentElement ? documentElement.nodeName !== "HTML" : false;  
};  
 
var posProcess = function( selector, context ) {  
var match,  
tmpSet = [],  
later = "",  
root = context.nodeType ? [context] : context;  
 
// Position selectors must be done after the filter  
// And so must :not(positional) so we move all PSEUDOs to the end  
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {  
later += match[0];  
selector = selector.replace( Expr.match.PSEUDO, "" );  
}  
 
selector = Expr.relative[selector] ? selector + "*" : selector;  
 
for ( var i = 0, l = root.length; i < l; i++ ) {  
Sizzle( selector, root[i], tmpSet );  
}  
 
return Sizzle.filter( later, tmpSet );  
};  
 
// EXPOSE  
jQuery.find = Sizzle;  
jQuery.expr = Sizzle.selectors;  
jQuery.expr[":"] = jQuery.expr.filters;  
jQuery.unique = Sizzle.uniqueSort;  
jQuery.text = Sizzle.getText;  
jQuery.isXMLDoc = Sizzle.isXML;  
jQuery.contains = Sizzle.contains;  
 
 
})();  
 
 
var runtil = /Until$/,  
rparentsprev = /^(?:parents|prevUntil|prevAll)/,  
// Note: This RegExp should be improved, or likely pulled from Sizzle  
rmultiselector = /,/,  
isSimple = /^.[^:#\[\.,]*$/,  
slice = Array.prototype.slice,  
POS = jQuery.expr.match.POS,  
// methods guaranteed to produce a unique set when starting from a unique set  
guaranteedUnique = {  
children: true,  
contents: true,  
next: true,  
prev: true  
};  
 
jQuery.fn.extend({  
find: function( selector ) {  
var ret = this.pushStack( "", "find", selector ),  
length = 0;  
 
for ( var i = 0, l = this.length; i < l; i++ ) {  
length = ret.length;  
jQuery.find( selector, this[i], ret );  
 
if ( i > 0 ) {  
// Make sure that the results are unique  
for ( var n = length; n < ret.length; n++ ) {  
for ( var r = 0; r < length; r++ ) {  
if ( ret[r] === ret[n] ) {  
ret.splice(n--, 1);  
break;  
}  
}  
}  
}  
}  
 
return ret;  
},  
 
has: function( target ) {  
var targets = jQuery( target );  
return this.filter(function() {  
for ( var i = 0, l = targets.length; i < l; i++ ) {  
if ( jQuery.contains( this, targets[i] ) ) {  
return true;  
}  
}  
});  
},  
 
not: function( selector ) {  
return this.pushStack( winnow(this, selector, false), "not", selector);  
},  
 
filter: function( selector ) {  
return this.pushStack( winnow(this, selector, true), "filter", selector );  
},  
 
is: function( selector ) {  
return !!selector && jQuery.filter( selector, this ).length > 0;  
},  
 
closest: function( selectors, context ) {  
var ret = [], i, l, cur = this[0];  
 
if ( jQuery.isArray( selectors ) ) {  
var match, selector,  
matches = {},  
level = 1;  
 
if ( cur && selectors.length ) {  
for ( i = 0, l = selectors.length; i < l; i++ ) {  
selector = selectors[i];  
 
if ( !matches[selector] ) {  
matches[selector] = jQuery.expr.match.POS.test( selector ) ?  
jQuery( selector, context || this.context ) :  
selector;  
}  
}  
 
while ( cur && cur.ownerDocument && cur !== context ) {  
for ( selector in matches ) {  
match = matches[selector];  
 
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {  
ret.push({ selector: selector, elem: cur, level: level });  
}  
}  
 
cur = cur.parentNode;  
level++;  
}  
}  
 
return ret;  
}  
 
var pos = POS.test( selectors ) ?  
jQuery( selectors, context || this.context ) : null;  
 
for ( i = 0, l = this.length; i < l; i++ ) {  
cur = this[i];  
 
while ( cur ) {  
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {  
ret.push( cur );  
break;  
 
} else {  
cur = cur.parentNode;  
if ( !cur || !cur.ownerDocument || cur === context ) {  
break;  
}  
}  
}  
}  
 
ret = ret.length > 1 ? jQuery.unique(ret) : ret;  
 
return this.pushStack( ret, "closest", selectors );  
},  
 
// Determine the position of an element within  
// the matched set of elements  
index: function( elem ) {  
if ( !elem || typeof elem === "string" ) {  
return jQuery.inArray( this[0],  
// If it receives a string, the selector is used  
// If it receives nothing, the siblings are used  
elem ? jQuery( elem ) : this.parent().children() );  
}  
// Locate the position of the desired element  
return jQuery.inArray(  
// If it receives a jQuery object, the first element is used  
elem.jquery ? elem[0] : elem, this );  
},  
 
add: function( selector, context ) {  
var set = typeof selector === "string" ?  
jQuery( selector, context ) :  
jQuery.makeArray( selector ),  
all = jQuery.merge( this.get(), set );  
 
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?  
all :  
jQuery.unique( all ) );  
},  
 
andSelf: function() {  
return this.add( this.prevObject );  
}  
});  
 
// A painfully simple check to see if an element is disconnected  
// from a document (should be improved, where feasible).  
function isDisconnected( node ) {  
return !node || !node.parentNode || node.parentNode.nodeType === 11;  
}  
 
jQuery.each({  
parent: function( elem ) {  
var parent = elem.parentNode;  
return parent && parent.nodeType !== 11 ? parent : null;  
},  
parents: function( elem ) {  
return jQuery.dir( elem, "parentNode" );  
},  
parentsUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "parentNode", until );  
},  
next: function( elem ) {  
return jQuery.nth( elem, 2, "nextSibling" );  
},  
prev: function( elem ) {  
return jQuery.nth( elem, 2, "previousSibling" );  
},  
nextAll: function( elem ) {  
return jQuery.dir( elem, "nextSibling" );  
},  
prevAll: function( elem ) {  
return jQuery.dir( elem, "previousSibling" );  
},  
nextUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "nextSibling", until );  
},  
prevUntil: function( elem, i, until ) {  
return jQuery.dir( elem, "previousSibling", until );  
},  
siblings: function( elem ) {  
return jQuery.sibling( elem.parentNode.firstChild, elem );  
},  
children: function( elem ) {  
return jQuery.sibling( elem.firstChild );  
},  
contents: function( elem ) {  
return jQuery.nodeName( elem, "iframe" ) ?  
elem.contentDocument || elem.contentWindow.document :  
jQuery.makeArray( elem.childNodes );  
}  
}, function( name, fn ) {  
jQuery.fn[ name ] = function( until, selector ) {  
var ret = jQuery.map( this, fn, until ),  
// The variable 'args' was introduced in  
// https://github.com/jquery/jquery/commit/52a0238  
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.  
// http://code.google.com/p/v8/issues/detail?id=1050  
args = slice.call(arguments);  
 
if ( !runtil.test( name ) ) {  
selector = until;  
}  
 
if ( selector && typeof selector === "string" ) {  
ret = jQuery.filter( selector, ret );  
}  
 
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;  
 
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {  
ret = ret.reverse();  
}  
 
return this.pushStack( ret, name, args.join(",") );  
};  
});  
 
jQuery.extend({  
filter: function( expr, elems, not ) {  
if ( not ) {  
expr = ":not(" + expr + ")";  
}  
 
return elems.length === 1 ?  
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :  
jQuery.find.matches(expr, elems);  
},  
 
dir: function( elem, dir, until ) {  
var matched = [],  
cur = elem[ dir ];  
 
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {  
if ( cur.nodeType === 1 ) {  
matched.push( cur );  
}  
cur = cur[dir];  
}  
return matched;  
},  
 
nth: function( cur, result, dir, elem ) {  
result = result || 1;  
var num = 0;  
 
for ( ; cur; cur = cur[dir] ) {  
if ( cur.nodeType === 1 && ++num === result ) {  
break;  
}  
}  
 
return cur;  
},  
 
sibling: function( n, elem ) {  
var r = [];  
 
for ( ; n; n = n.nextSibling ) {  
if ( n.nodeType === 1 && n !== elem ) {  
r.push( n );  
}  
}  
 
return r;  
}  
});  
 
// Implement the identical functionality for filter and not  
function winnow( elements, qualifier, keep ) {  
if ( jQuery.isFunction( qualifier ) ) {  
return jQuery.grep(elements, function( elem, i ) {  
var retVal = !!qualifier.call( elem, i, elem );  
return retVal === keep;  
});  
 
} else if ( qualifier.nodeType ) {  
return jQuery.grep(elements, function( elem, i ) {  
return (elem === qualifier) === keep;  
});  
 
} else if ( typeof qualifier === "string" ) {  
var filtered = jQuery.grep(elements, function( elem ) {  
return elem.nodeType === 1;  
});  
 
if ( isSimple.test( qualifier ) ) {  
return jQuery.filter(qualifier, filtered, !keep);  
} else {  
qualifier = jQuery.filter( qualifier, filtered );  
}  
}  
 
return jQuery.grep(elements, function( elem, i ) {  
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;  
});  
}  
 
 
 
 
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,  
rleadingWhitespace = /^\s+/,  
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,  
rtagName = /<([\w:]+)/,  
rtbody = /<tbody/i,  
rhtml = /<|&#?\w+;/,  
rnocache = /<(?:script|object|embed|option|style)/i,  
// checked="checked" or checked (html5)  
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,  
wrapMap = {  
option: [ 1, "<select multiple='multiple'>", "</select>" ],  
legend: [ 1, "<fieldset>", "</fieldset>" ],  
thead: [ 1, "<table>", "</table>" ],  
tr: [ 2, "<table><tbody>", "</tbody></table>" ],  
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],  
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],  
area: [ 1, "<map>", "</map>" ],  
_default: [ 0, "", "" ]  
};  
 
wrapMap.optgroup = wrapMap.option;  
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;  
wrapMap.th = wrapMap.td;  
 
// IE can't serialize <link> and <script> tags normally  
if ( !jQuery.support.htmlSerialize ) {  
wrapMap._default = [ 1, "div<div>", "</div>" ];  
}  
 
jQuery.fn.extend({  
text: function( text ) {  
if ( jQuery.isFunction(text) ) {  
return this.each(function(i) {  
var self = jQuery( this );  
 
self.text( text.call(this, i, self.text()) );  
});  
}  
 
if ( typeof text !== "object" && text !== undefined ) {  
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );  
}  
 
return jQuery.text( this );  
},  
 
wrapAll: function( html ) {  
if ( jQuery.isFunction( html ) ) {  
return this.each(function(i) {  
jQuery(this).wrapAll( html.call(this, i) );  
});  
}  
 
if ( this[0] ) {  
// The elements to wrap the target around  
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);  
 
if ( this[0].parentNode ) {  
wrap.insertBefore( this[0] );  
}  
 
wrap.map(function() {  
var elem = this;  
 
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {  
elem = elem.firstChild;  
}  
 
return elem;  
}).append(this);  
}  
 
return this;  
},  
 
wrapInner: function( html ) {  
if ( jQuery.isFunction( html ) ) {  
return this.each(function(i) {  
jQuery(this).wrapInner( html.call(this, i) );  
});  
}  
 
return this.each(function() {  
var self = jQuery( this ),  
contents = self.contents();  
 
if ( contents.length ) {  
contents.wrapAll( html );  
 
} else {  
self.append( html );  
}  
});  
},  
 
wrap: function( html ) {  
return this.each(function() {  
jQuery( this ).wrapAll( html );  
});  
},  
 
unwrap: function() {  
return this.parent().each(function() {  
if ( !jQuery.nodeName( this, "body" ) ) {  
jQuery( this ).replaceWith( this.childNodes );  
}  
}).end();  
},  
 
append: function() {  
return this.domManip(arguments, true, function( elem ) {  
if ( this.nodeType === 1 ) {  
this.appendChild( elem );  
}  
});  
},  
 
prepend: function() {  
return this.domManip(arguments, true, function( elem ) {  
if ( this.nodeType === 1 ) {  
this.insertBefore( elem, this.firstChild );  
}  
});  
},  
 
before: function() {  
if ( this[0] && this[0].parentNode ) {  
return this.domManip(arguments, false, function( elem ) {  
this.parentNode.insertBefore( elem, this );  
});  
} else if ( arguments.length ) {  
var set = jQuery(arguments[0]);  
set.push.apply( set, this.toArray() );  
return this.pushStack( set, "before", arguments );  
}  
},  
 
after: function() {  
if ( this[0] && this[0].parentNode ) {  
return this.domManip(arguments, false, function( elem ) {  
this.parentNode.insertBefore( elem, this.nextSibling );  
});  
} else if ( arguments.length ) {  
var set = this.pushStack( this, "after", arguments );  
set.push.apply( set, jQuery(arguments[0]).toArray() );  
return set;  
}  
},  
 
// keepData is for internal use only--do not document  
remove: function( selector, keepData ) {  
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {  
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {  
if ( !keepData && elem.nodeType === 1 ) {  
jQuery.cleanData( elem.getElementsByTagName("*") );  
jQuery.cleanData( [ elem ] );  
}  
 
if ( elem.parentNode ) {  
elem.parentNode.removeChild( elem );  
}  
}  
}  
 
return this;  
},  
 
empty: function() {  
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {  
// Remove element nodes and prevent memory leaks  
if ( elem.nodeType === 1 ) {  
jQuery.cleanData( elem.getElementsByTagName("*") );  
}  
 
// Remove any remaining nodes  
while ( elem.firstChild ) {  
elem.removeChild( elem.firstChild );  
}  
}  
 
return this;  
},  
 
clone: function( dataAndEvents, deepDataAndEvents ) {  
dataAndEvents = dataAndEvents == null ? true : dataAndEvents;  
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;  
 
return this.map( function () {  
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );  
});  
},  
 
html: function( value ) {  
if ( value === undefined ) {  
return this[0] && this[0].nodeType === 1 ?  
this[0].innerHTML.replace(rinlinejQuery, "") :  
null;  
 
// See if we can take a shortcut and just use innerHTML  
} else if ( typeof value === "string" && !rnocache.test( value ) &&  
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&  
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {  
 
value = value.replace(rxhtmlTag, "<$1></$2>");  
 
try {  
for ( var i = 0, l = this.length; i < l; i++ ) {  
// Remove element nodes and prevent memory leaks  
if ( this[i].nodeType === 1 ) {  
jQuery.cleanData( this[i].getElementsByTagName("*") );  
this[i].innerHTML = value;  
}  
}  
 
// If using innerHTML throws an exception, use the fallback method  
} catch(e) {  
this.empty().append( value );  
}  
 
} else if ( jQuery.isFunction( value ) ) {  
this.each(function(i){  
var self = jQuery( this );  
 
self.html( value.call(this, i, self.html()) );  
});  
 
} else {  
this.empty().append( value );  
}  
 
return this;  
},  
 
replaceWith: function( value ) {  
if ( this[0] && this[0].parentNode ) {  
// Make sure that the elements are removed from the DOM before they are inserted  
// this can help fix replacing a parent with child elements  
if ( jQuery.isFunction( value ) ) {  
return this.each(function(i) {  
var self = jQuery(this), old = self.html();  
self.replaceWith( value.call( this, i, old ) );  
});  
}  
 
if ( typeof value !== "string" ) {  
value = jQuery( value ).detach();  
}  
 
return this.each(function() {  
var next = this.nextSibling,  
parent = this.parentNode;  
 
jQuery( this ).remove();  
 
if ( next ) {  
jQuery(next).before( value );  
} else {  
jQuery(parent).append( value );  
}  
});  
} else {  
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );  
}  
},  
 
detach: function( selector ) {  
return this.remove( selector, true );  
},  
 
domManip: function( args, table, callback ) {  
var results, first, fragment, parent,  
value = args[0],  
scripts = [];  
 
// We can't cloneNode fragments that contain checked, in WebKit  
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {  
return this.each(function() {  
jQuery(this).domManip( args, table, callback, true );  
});  
}  
 
if ( jQuery.isFunction(value) ) {  
return this.each(function(i) {  
var self = jQuery(this);  
args[0] = value.call(this, i, table ? self.html() : undefined);  
self.domManip( args, table, callback );  
});  
}  
 
if ( this[0] ) {  
parent = value && value.parentNode;  
 
// If we're in a fragment, just use that instead of building a new one  
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {  
results = { fragment: parent };  
 
} else {  
results = jQuery.buildFragment( args, this, scripts );  
}  
 
fragment = results.fragment;  
 
if ( fragment.childNodes.length === 1 ) {  
first = fragment = fragment.firstChild;  
} else {  
first = fragment.firstChild;  
}  
 
if ( first ) {  
table = table && jQuery.nodeName( first, "tr" );  
 
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {  
callback.call(  
table ?  
root(this[i], first) :  
this[i],  
// Make sure that we do not leak memory by inadvertently discarding  
// the original fragment (which might have attached data) instead of  
// using it; in addition, use the original fragment object for the last  
// item instead of first because it can end up being emptied incorrectly  
// in certain situations (Bug #8070).  
// Fragments from the fragment cache must always be cloned and never used  
// in place.  
results.cacheable || (l > 1 && i < lastIndex) ?  
jQuery.clone( fragment, true, true ) :  
fragment  
);  
}  
}  
 
if ( scripts.length ) {  
jQuery.each( scripts, evalScript );  
}  
}  
 
return this;  
}  
});  
 
function root( elem, cur ) {  
return jQuery.nodeName(elem, "table") ?  
(elem.getElementsByTagName("tbody")[0] ||  
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :  
elem;  
}  
 
function cloneCopyEvent( src, dest ) {  
 
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {  
return;  
}  
 
var internalKey = jQuery.expando,  
oldData = jQuery.data( src ),  
curData = jQuery.data( dest, oldData );  
 
// Switch to use the internal data object, if it exists, for the next  
// stage of data copying  
if ( (oldData = oldData[ internalKey ]) ) {  
var events = oldData.events;  
curData = curData[ internalKey ] = jQuery.extend({}, oldData);  
 
if ( events ) {  
delete curData.handle;  
curData.events = {};  
 
for ( var type in events ) {  
for ( var i = 0, l = events[ type ].length; i < l; i++ ) {  
jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data );  
}  
}  
}  
}  
}  
 
function cloneFixAttributes(src, dest) {  
// We do not need to do anything for non-Elements  
if ( dest.nodeType !== 1 ) {  
return;  
}  
 
var nodeName = dest.nodeName.toLowerCase();  
 
// clearAttributes removes the attributes, which we don't want,  
// but also removes the attachEvent events, which we *do* want  
dest.clearAttributes();  
 
// mergeAttributes, in contrast, only merges back on the  
// original attributes, not the events  
dest.mergeAttributes(src);  
 
// IE6-8 fail to clone children inside object elements that use  
// the proprietary classid attribute value (rather than the type  
// attribute) to identify the type of content to display  
if ( nodeName === "object" ) {  
dest.outerHTML = src.outerHTML;  
 
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {  
// IE6-8 fails to persist the checked state of a cloned checkbox  
// or radio button. Worse, IE6-7 fail to give the cloned element  
// a checked appearance if the defaultChecked value isn't also set  
if ( src.checked ) {  
dest.defaultChecked = dest.checked = src.checked;  
}  
 
// IE6-7 get confused and end up setting the value of a cloned  
// checkbox/radio button to an empty string instead of "on"  
if ( dest.value !== src.value ) {  
dest.value = src.value;  
}  
 
// IE6-8 fails to return the selected option to the default selected  
// state when cloning options  
} else if ( nodeName === "option" ) {  
dest.selected = src.defaultSelected;  
 
// IE6-8 fails to set the defaultValue to the correct value when  
// cloning other types of input fields  
} else if ( nodeName === "input" || nodeName === "textarea" ) {  
dest.defaultValue = src.defaultValue;  
}  
 
// Event data gets referenced instead of copied if the expando  
// gets copied too  
dest.removeAttribute( jQuery.expando );  
}  
 
jQuery.buildFragment = function( args, nodes, scripts ) {  
var fragment, cacheable, cacheresults,  
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);  
 
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document  
// Cloning options loses the selected state, so don't cache them  
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment  
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache  
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&  
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {  
 
cacheable = true;  
cacheresults = jQuery.fragments[ args[0] ];  
if ( cacheresults ) {  
if ( cacheresults !== 1 ) {  
fragment = cacheresults;  
}  
}  
}  
 
if ( !fragment ) {  
fragment = doc.createDocumentFragment();  
jQuery.clean( args, doc, fragment, scripts );  
}  
 
if ( cacheable ) {  
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;  
}  
 
return { fragment: fragment, cacheable: cacheable };  
};  
 
jQuery.fragments = {};  
 
jQuery.each({  
appendTo: "append",  
prependTo: "prepend",  
insertBefore: "before",  
insertAfter: "after",  
replaceAll: "replaceWith"  
}, function( name, original ) {  
jQuery.fn[ name ] = function( selector ) {  
var ret = [],  
insert = jQuery( selector ),  
parent = this.length === 1 && this[0].parentNode;  
 
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {  
insert[ original ]( this[0] );  
return this;  
 
} else {  
for ( var i = 0, l = insert.length; i < l; i++ ) {  
var elems = (i > 0 ? this.clone(true) : this).get();  
jQuery( insert[i] )[ original ]( elems );  
ret = ret.concat( elems );  
}  
 
return this.pushStack( ret, name, insert.selector );  
}  
};  
});  
 
jQuery.extend({  
clone: function( elem, dataAndEvents, deepDataAndEvents ) {  
var clone = elem.cloneNode(true),  
srcElements,  
destElements,  
i;  
 
if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {  
// IE copies events bound via attachEvent when using cloneNode.  
// Calling detachEvent on the clone will also remove the events  
// from the original. In order to get around this, we use some  
// proprietary methods to clear the events. Thanks to MooTools  
// guys for this hotness.  
 
// Using Sizzle here is crazy slow, so we use getElementsByTagName  
// instead  
srcElements = elem.getElementsByTagName("*");  
destElements = clone.getElementsByTagName("*");  
 
// Weird iteration because IE will replace the length property  
// with an element if you are cloning the body and one of the  
// elements on the page has a name or id of "length"  
for ( i = 0; srcElements[i]; ++i ) {  
cloneFixAttributes( srcElements[i], destElements[i] );  
}  
 
cloneFixAttributes( elem, clone );  
}  
 
// Copy the events from the original to the clone  
if ( dataAndEvents ) {  
 
cloneCopyEvent( elem, clone );  
 
if ( deepDataAndEvents && "getElementsByTagName" in elem ) {  
 
srcElements = elem.getElementsByTagName("*");  
destElements = clone.getElementsByTagName("*");  
 
if ( srcElements.length ) {  
for ( i = 0; srcElements[i]; ++i ) {  
cloneCopyEvent( srcElements[i], destElements[i] );  
}  
}  
}  
}  
// Return the cloned set  
return clone;  
},  
clean: function( elems, context, fragment, scripts ) {  
context = context || document;  
 
// !context.createElement fails in IE with an error but returns typeof 'object'  
if ( typeof context.createElement === "undefined" ) {  
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;  
}  
 
var ret = [];  
 
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
if ( typeof elem === "number" ) {  
elem += "";  
}  
 
if ( !elem ) {  
continue;  
}  
 
// Convert html string into DOM nodes  
if ( typeof elem === "string" && !rhtml.test( elem ) ) {  
elem = context.createTextNode( elem );  
 
} else if ( typeof elem === "string" ) {  
// Fix "XHTML"-style tags in all browsers  
elem = elem.replace(rxhtmlTag, "<$1></$2>");  
 
// Trim whitespace, otherwise indexOf won't work as expected  
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),  
wrap = wrapMap[ tag ] || wrapMap._default,  
depth = wrap[0],  
div = context.createElement("div");  
 
// Go to html and back, then peel off extra wrappers  
div.innerHTML = wrap[1] + elem + wrap[2];  
 
// Move to the right depth  
while ( depth-- ) {  
div = div.lastChild;  
}  
 
// Remove IE's autoinserted <tbody> from table fragments  
if ( !jQuery.support.tbody ) {  
 
// String was a <table>, *may* have spurious <tbody>  
var hasBody = rtbody.test(elem),  
tbody = tag === "table" && !hasBody ?  
div.firstChild && div.firstChild.childNodes :  
 
// String was a bare <thead> or <tfoot>  
wrap[1] === "<table>" && !hasBody ?  
div.childNodes :  
[];  
 
for ( var j = tbody.length - 1; j >= 0 ; --j ) {  
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {  
tbody[ j ].parentNode.removeChild( tbody[ j ] );  
}  
}  
 
}  
 
// IE completely kills leading whitespace when innerHTML is used  
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {  
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );  
}  
 
elem = div.childNodes;  
}  
 
if ( elem.nodeType ) {  
ret.push( elem );  
} else {  
ret = jQuery.merge( ret, elem );  
}  
}  
 
if ( fragment ) {  
for ( i = 0; ret[i]; i++ ) {  
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {  
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );  
 
} else {  
if ( ret[i].nodeType === 1 ) {  
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );  
}  
fragment.appendChild( ret[i] );  
}  
}  
}  
 
return ret;  
},  
 
cleanData: function( elems ) {  
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,  
deleteExpando = jQuery.support.deleteExpando;  
 
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {  
continue;  
}  
 
id = elem[ jQuery.expando ];  
 
if ( id ) {  
data = cache[ id ] && cache[ id ][ internalKey ];  
 
if ( data && data.events ) {  
for ( var type in data.events ) {  
if ( special[ type ] ) {  
jQuery.event.remove( elem, type );  
 
// This is a shortcut to avoid jQuery.event.remove's overhead  
} else {  
jQuery.removeEvent( elem, type, data.handle );  
}  
}  
 
// Null the DOM reference to avoid IE6/7/8 leak (#7054)  
if ( data.handle ) {  
data.handle.elem = null;  
}  
}  
 
if ( deleteExpando ) {  
delete elem[ jQuery.expando ];  
 
} else if ( elem.removeAttribute ) {  
elem.removeAttribute( jQuery.expando );  
}  
 
delete cache[ id ];  
}  
}  
}  
});  
 
function evalScript( i, elem ) {  
if ( elem.src ) {  
jQuery.ajax({  
url: elem.src,  
async: false,  
dataType: "script"  
});  
} else {  
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );  
}  
 
if ( elem.parentNode ) {  
elem.parentNode.removeChild( elem );  
}  
}  
 
 
 
 
var ralpha = /alpha\([^)]*\)/i,  
ropacity = /opacity=([^)]*)/,  
rdashAlpha = /-([a-z])/ig,  
rupper = /([A-Z])/g,  
rnumpx = /^-?\d+(?:px)?$/i,  
rnum = /^-?\d/,  
 
cssShow = { position: "absolute", visibility: "hidden", display: "block" },  
cssWidth = [ "Left", "Right" ],  
cssHeight = [ "Top", "Bottom" ],  
curCSS,  
 
getComputedStyle,  
currentStyle,  
 
fcamelCase = function( all, letter ) {  
return letter.toUpperCase();  
};  
 
jQuery.fn.css = function( name, value ) {  
// Setting 'undefined' is a no-op  
if ( arguments.length === 2 && value === undefined ) {  
return this;  
}  
 
return jQuery.access( this, name, value, true, function( elem, name, value ) {  
return value !== undefined ?  
jQuery.style( elem, name, value ) :  
jQuery.css( elem, name );  
});  
};  
 
jQuery.extend({  
// Add in style property hooks for overriding the default  
// behavior of getting and setting a style property  
cssHooks: {  
opacity: {  
get: function( elem, computed ) {  
if ( computed ) {  
// We should always get a number back from opacity  
var ret = curCSS( elem, "opacity", "opacity" );  
return ret === "" ? "1" : ret;  
 
} else {  
return elem.style.opacity;  
}  
}  
}  
},  
 
// Exclude the following css properties to add px  
cssNumber: {  
"zIndex": true,  
"fontWeight": true,  
"opacity": true,  
"zoom": true,  
"lineHeight": true  
},  
 
// Add in properties whose names you wish to fix before  
// setting or getting the value  
cssProps: {  
// normalize float css property  
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"  
},  
 
// Get and set the style property on a DOM Node  
style: function( elem, name, value, extra ) {  
// Don't set styles on text and comment nodes  
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {  
return;  
}  
 
// Make sure that we're working with the right name  
var ret, origName = jQuery.camelCase( name ),  
style = elem.style, hooks = jQuery.cssHooks[ origName ];  
 
name = jQuery.cssProps[ origName ] || origName;  
 
// Check if we're setting a value  
if ( value !== undefined ) {  
// Make sure that NaN and null values aren't set. See: #7116  
if ( typeof value === "number" && isNaN( value ) || value == null ) {  
return;  
}  
 
// If a number was passed in, add 'px' to the (except for certain CSS properties)  
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {  
value += "px";  
}  
 
// If a hook was provided, use that value, otherwise just set the specified value  
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {  
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided  
// Fixes bug #5509  
try {  
style[ name ] = value;  
} catch(e) {}  
}  
 
} else {  
// If a hook was provided get the non-computed value from there  
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {  
return ret;  
}  
 
// Otherwise just get the value from the style object  
return style[ name ];  
}  
},  
 
css: function( elem, name, extra ) {  
// Make sure that we're working with the right name  
var ret, origName = jQuery.camelCase( name ),  
hooks = jQuery.cssHooks[ origName ];  
 
name = jQuery.cssProps[ origName ] || origName;  
 
// If a hook was provided get the computed value from there  
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {  
return ret;  
 
// Otherwise, if a way to get the computed value exists, use that  
} else if ( curCSS ) {  
return curCSS( elem, name, origName );  
}  
},  
 
// A method for quickly swapping in/out CSS properties to get correct calculations  
swap: function( elem, options, callback ) {  
var old = {};  
 
// Remember the old values, and insert the new ones  
for ( var name in options ) {  
old[ name ] = elem.style[ name ];  
elem.style[ name ] = options[ name ];  
}  
 
callback.call( elem );  
 
// Revert the old values  
for ( name in options ) {  
elem.style[ name ] = old[ name ];  
}  
},  
 
camelCase: function( string ) {  
return string.replace( rdashAlpha, fcamelCase );  
}  
});  
 
// DEPRECATED, Use jQuery.css() instead  
jQuery.curCSS = jQuery.css;  
 
jQuery.each(["height", "width"], function( i, name ) {  
jQuery.cssHooks[ name ] = {  
get: function( elem, computed, extra ) {  
var val;  
 
if ( computed ) {  
if ( elem.offsetWidth !== 0 ) {  
val = getWH( elem, name, extra );  
 
} else {  
jQuery.swap( elem, cssShow, function() {  
val = getWH( elem, name, extra );  
});  
}  
 
if ( val <= 0 ) {  
val = curCSS( elem, name, name );  
 
if ( val === "0px" && currentStyle ) {  
val = currentStyle( elem, name, name );  
}  
 
if ( val != null ) {  
// Should return "auto" instead of 0, use 0 for  
// temporary backwards-compat  
return val === "" || val === "auto" ? "0px" : val;  
}  
}  
 
if ( val < 0 || val == null ) {  
val = elem.style[ name ];  
 
// Should return "auto" instead of 0, use 0 for  
// temporary backwards-compat  
return val === "" || val === "auto" ? "0px" : val;  
}  
 
return typeof val === "string" ? val : val + "px";  
}  
},  
 
set: function( elem, value ) {  
if ( rnumpx.test( value ) ) {  
// ignore negative width and height values #1599  
value = parseFloat(value);  
 
if ( value >= 0 ) {  
return value + "px";  
}  
 
} else {  
return value;  
}  
}  
};  
});  
 
if ( !jQuery.support.opacity ) {  
jQuery.cssHooks.opacity = {  
get: function( elem, computed ) {  
// IE uses filters for opacity  
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?  
(parseFloat(RegExp.$1) / 100) + "" :  
computed ? "1" : "";  
},  
 
set: function( elem, value ) {  
var style = elem.style;  
 
// IE has trouble with opacity if it does not have layout  
// Force it by setting the zoom level  
style.zoom = 1;  
 
// Set the alpha filter to set the opacity  
var opacity = jQuery.isNaN(value) ?  
"" :  
"alpha(opacity=" + value * 100 + ")",  
filter = style.filter || "";  
 
style.filter = ralpha.test(filter) ?  
filter.replace(ralpha, opacity) :  
style.filter + ' ' + opacity;  
}  
};  
}  
 
if ( document.defaultView && document.defaultView.getComputedStyle ) {  
getComputedStyle = function( elem, newName, name ) {  
var ret, defaultView, computedStyle;  
 
name = name.replace( rupper, "-$1" ).toLowerCase();  
 
if ( !(defaultView = elem.ownerDocument.defaultView) ) {  
return undefined;  
}  
 
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {  
ret = computedStyle.getPropertyValue( name );  
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {  
ret = jQuery.style( elem, name );  
}  
}  
 
return ret;  
};  
}  
 
if ( document.documentElement.currentStyle ) {  
currentStyle = function( elem, name ) {  
var left,  
ret = elem.currentStyle && elem.currentStyle[ name ],  
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],  
style = elem.style;  
 
// From the awesome hack by Dean Edwards  
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291  
 
// If we're not dealing with a regular pixel number  
// but a number that has a weird ending, we need to convert it to pixels  
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {  
// Remember the original values  
left = style.left;  
 
// Put in the new values to get a computed value out  
if ( rsLeft ) {  
elem.runtimeStyle.left = elem.currentStyle.left;  
}  
style.left = name === "fontSize" ? "1em" : (ret || 0);  
ret = style.pixelLeft + "px";  
 
// Revert the changed values  
style.left = left;  
if ( rsLeft ) {  
elem.runtimeStyle.left = rsLeft;  
}  
}  
 
return ret === "" ? "auto" : ret;  
};  
}  
 
curCSS = getComputedStyle || currentStyle;  
 
function getWH( elem, name, extra ) {  
var which = name === "width" ? cssWidth : cssHeight,  
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;  
 
if ( extra === "border" ) {  
return val;  
}  
 
jQuery.each( which, function() {  
if ( !extra ) {  
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;  
}  
 
if ( extra === "margin" ) {  
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;  
 
} else {  
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;  
}  
});  
 
return val;  
}  
 
if ( jQuery.expr && jQuery.expr.filters ) {  
jQuery.expr.filters.hidden = function( elem ) {  
var width = elem.offsetWidth,  
height = elem.offsetHeight;  
 
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");  
};  
 
jQuery.expr.filters.visible = function( elem ) {  
return !jQuery.expr.filters.hidden( elem );  
};  
}  
 
 
 
 
var r20 = /%20/g,  
rbracket = /\[\]$/,  
rCRLF = /\r?\n/g,  
rhash = /#.*$/,  
rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL  
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,  
rnoContent = /^(?:GET|HEAD)$/,  
rprotocol = /^\/\//,  
rquery = /\?/,  
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,  
rselectTextarea = /^(?:select|textarea)/i,  
rspacesAjax = /\s+/,  
rts = /([?&])_=[^&]*/,  
rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,  
 
// Keep a copy of the old load method  
_load = jQuery.fn.load,  
 
/* Prefilters  
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)  
* 2) These are called:  
* - BEFORE asking for a transport  
* - AFTER param serialization (s.data is a string if s.processData is true)  
* 3) key is the dataType  
* 4) the catchall symbol "*" can be used  
* 5) execution will start with transport dataType and THEN continue down to "*" if needed  
*/  
prefilters = {},  
 
/* Transports bindings  
* 1) key is the dataType  
* 2) the catchall symbol "*" can be used  
* 3) selection will start with transport dataType and THEN go to "*" if needed  
*/  
transports = {};  
 
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport  
function addToPrefiltersOrTransports( structure ) {  
 
// dataTypeExpression is optional and defaults to "*"  
return function( dataTypeExpression, func ) {  
 
if ( typeof dataTypeExpression !== "string" ) {  
func = dataTypeExpression;  
dataTypeExpression = "*";  
}  
 
if ( jQuery.isFunction( func ) ) {  
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),  
i = 0,  
length = dataTypes.length,  
dataType,  
list,  
placeBefore;  
 
// For each dataType in the dataTypeExpression  
for(; i < length; i++ ) {  
dataType = dataTypes[ i ];  
// We control if we're asked to add before  
// any existing element  
placeBefore = /^\+/.test( dataType );  
if ( placeBefore ) {  
dataType = dataType.substr( 1 ) || "*";  
}  
list = structure[ dataType ] = structure[ dataType ] || [];  
// then we add to the structure accordingly  
list[ placeBefore ? "unshift" : "push" ]( func );  
}  
}  
};  
}  
 
//Base inspection function for prefilters and transports  
function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR,  
dataType /* internal */, inspected /* internal */ ) {  
 
dataType = dataType || options.dataTypes[ 0 ];  
inspected = inspected || {};  
 
inspected[ dataType ] = true;  
 
var list = structure[ dataType ],  
i = 0,  
length = list ? list.length : 0,  
executeOnly = ( structure === prefilters ),  
selection;  
 
for(; i < length && ( executeOnly || !selection ); i++ ) {  
selection = list[ i ]( options, originalOptions, jXHR );  
// If we got redirected to another dataType  
// we try there if not done already  
if ( typeof selection === "string" ) {  
if ( inspected[ selection ] ) {  
selection = undefined;  
} else {  
options.dataTypes.unshift( selection );  
selection = inspectPrefiltersOrTransports(  
structure, options, originalOptions, jXHR, selection, inspected );  
}  
}  
}  
// If we're only executing or nothing was selected  
// we try the catchall dataType if not done already  
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {  
selection = inspectPrefiltersOrTransports(  
structure, options, originalOptions, jXHR, "*", inspected );  
}  
// unnecessary when only executing (prefilters)  
// but it'll be ignored by the caller in that case  
return selection;  
}  
 
jQuery.fn.extend({  
load: function( url, params, callback ) {  
if ( typeof url !== "string" && _load ) {  
return _load.apply( this, arguments );  
 
// Don't do a request if no elements are being requested  
} else if ( !this.length ) {  
return this;  
}  
 
var off = url.indexOf( " " );  
if ( off >= 0 ) {  
var selector = url.slice( off, url.length );  
url = url.slice( 0, off );  
}  
 
// Default to a GET request  
var type = "GET";  
 
// If the second parameter was provided  
if ( params ) {  
// If it's a function  
if ( jQuery.isFunction( params ) ) {  
// We assume that it's the callback  
callback = params;  
params = null;  
 
// Otherwise, build a param string  
} else if ( typeof params === "object" ) {  
params = jQuery.param( params, jQuery.ajaxSettings.traditional );  
type = "POST";  
}  
}  
 
var self = this;  
 
// Request the remote document  
jQuery.ajax({  
url: url,  
type: type,  
dataType: "html",  
data: params,  
// Complete callback (responseText is used internally)  
complete: function( jXHR, status, responseText ) {  
// Store the response as specified by the jXHR object  
responseText = jXHR.responseText;  
// If successful, inject the HTML into all the matched elements  
if ( jXHR.isResolved() ) {  
// #4825: Get the actual response in case  
// a dataFilter is present in ajaxSettings  
jXHR.done(function( r ) {  
responseText = r;  
});  
// See if a selector was specified  
self.html( selector ?  
// Create a dummy div to hold the results  
jQuery("<div>")  
// inject the contents of the document in, removing the scripts  
// to avoid any 'Permission Denied' errors in IE  
.append(responseText.replace(rscript, ""))  
 
// Locate the specified elements  
.find(selector) :  
 
// If not, just inject the full result  
responseText );  
}  
 
if ( callback ) {  
self.each( callback, [ responseText, status, jXHR ] );  
}  
}  
});  
 
return this;  
},  
 
serialize: function() {  
return jQuery.param( this.serializeArray() );  
},  
 
serializeArray: function() {  
return this.map(function(){  
return this.elements ? jQuery.makeArray( this.elements ) : this;  
})  
.filter(function(){  
return this.name && !this.disabled &&  
( this.checked || rselectTextarea.test( this.nodeName ) ||  
rinput.test( this.type ) );  
})  
.map(function( i, elem ){  
var val = jQuery( this ).val();  
 
return val == null ?  
null :  
jQuery.isArray( val ) ?  
jQuery.map( val, function( val, i ){  
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };  
}) :  
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };  
}).get();  
}  
});  
 
// Attach a bunch of functions for handling common AJAX events  
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){  
jQuery.fn[ o ] = function( f ){  
return this.bind( o, f );  
};  
} );  
 
jQuery.each( [ "get", "post" ], function( i, method ) {  
jQuery[ method ] = function( url, data, callback, type ) {  
// shift arguments if data argument was omitted  
if ( jQuery.isFunction( data ) ) {  
type = type || callback;  
callback = data;  
data = null;  
}  
 
return jQuery.ajax({  
type: method,  
url: url,  
data: data,  
success: callback,  
dataType: type  
});  
};  
} );  
 
jQuery.extend({  
 
getScript: function( url, callback ) {  
return jQuery.get( url, null, callback, "script" );  
},  
 
getJSON: function( url, data, callback ) {  
return jQuery.get( url, data, callback, "json" );  
},  
 
ajaxSetup: function( settings ) {  
jQuery.extend( true, jQuery.ajaxSettings, settings );  
if ( settings.context ) {  
jQuery.ajaxSettings.context = settings.context;  
}  
},  
 
ajaxSettings: {  
url: location.href,  
global: true,  
type: "GET",  
contentType: "application/x-www-form-urlencoded",  
processData: true,  
async: true,  
/*  
timeout: 0,  
data: null,  
dataType: null,  
username: null,  
password: null,  
cache: null,  
traditional: false,  
headers: {},  
crossDomain: null,  
*/  
 
accepts: {  
xml: "application/xml, text/xml",  
html: "text/html",  
text: "text/plain",  
json: "application/json, text/javascript",  
"*": "*/*"  
},  
 
contents: {  
xml: /xml/,  
html: /html/,  
json: /json/  
},  
 
responseFields: {  
xml: "responseXML",  
text: "responseText"  
},  
 
// List of data converters  
// 1) key format is "source_type destination_type" (a single space in-between)  
// 2) the catchall symbol "*" can be used for source_type  
converters: {  
 
// Convert anything to text  
"* text": window.String,  
 
// Text to html (true = no transformation)  
"text html": true,  
 
// Evaluate text as a json expression  
"text json": jQuery.parseJSON,  
 
// Parse text as xml  
"text xml": jQuery.parseXML  
}  
},  
 
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),  
ajaxTransport: addToPrefiltersOrTransports( transports ),  
 
// Main method  
ajax: function( url, options ) {  
 
// If options is not an object,  
// we simulate pre-1.5 signature  
if ( typeof options !== "object" ) {  
options = url;  
url = undefined;  
}  
 
// Force options to be an object  
options = options || {};  
 
var // Create the final options object  
s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),  
// Callbacks contexts  
// We force the original context if it exists  
// or take it from jQuery.ajaxSettings otherwise  
// (plain objects used as context get extended)  
callbackContext =  
( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,  
globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ),  
// Deferreds  
deferred = jQuery.Deferred(),  
completeDeferred = jQuery._Deferred(),  
// Status-dependent callbacks  
statusCode = s.statusCode || {},  
// Headers (they are sent all at once)  
requestHeaders = {},  
// Response headers  
responseHeadersString,  
responseHeaders,  
// transport  
transport,  
// timeout handle  
timeoutTimer,  
// Cross-domain detection vars  
loc = document.location,  
protocol = loc.protocol || "http:",  
parts,  
// The jXHR state  
state = 0,  
// Loop variable  
i,  
// Fake xhr  
jXHR = {  
 
readyState: 0,  
 
// Caches the header  
setRequestHeader: function( name, value ) {  
if ( state === 0 ) {  
requestHeaders[ name.toLowerCase() ] = value;  
}  
return this;  
},  
 
// Raw string  
getAllResponseHeaders: function() {  
return state === 2 ? responseHeadersString : null;  
},  
 
// Builds headers hashtable if needed  
getResponseHeader: function( key ) {  
var match;  
if ( state === 2 ) {  
if ( !responseHeaders ) {  
responseHeaders = {};  
while( ( match = rheaders.exec( responseHeadersString ) ) ) {  
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];  
}  
}  
match = responseHeaders[ key.toLowerCase() ];  
}  
return match || null;  
},  
 
// Cancel the request  
abort: function( statusText ) {  
statusText = statusText || "abort";  
if ( transport ) {  
transport.abort( statusText );  
}  
done( 0, statusText );  
return this;  
}  
};  
 
// Callback for when everything is done  
// It is defined here because jslint complains if it is declared  
// at the end of the function (which would be more logical and readable)  
function done( status, statusText, responses, headers) {  
 
// Called once  
if ( state === 2 ) {  
return;  
}  
 
// State is "done" now  
state = 2;  
 
// Clear timeout if it exists  
if ( timeoutTimer ) {  
clearTimeout( timeoutTimer );  
}  
 
// Dereference transport for early garbage collection  
// (no matter how long the jXHR object will be used)  
transport = undefined;  
 
// Cache response headers  
responseHeadersString = headers || "";  
 
// Set readyState  
jXHR.readyState = status ? 4 : 0;  
 
var isSuccess,  
success,  
error,  
response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined,  
lastModified,  
etag;  
 
// If successful, handle type chaining  
if ( status >= 200 && status < 300 || status === 304 ) {  
 
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.  
if ( s.ifModified ) {  
 
if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) {  
jQuery.lastModified[ s.url ] = lastModified;  
}  
if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) {  
jQuery.etag[ s.url ] = etag;  
}  
}  
 
// If not modified  
if ( status === 304 ) {  
 
statusText = "notmodified";  
isSuccess = true;  
 
// If we have data  
} else {  
 
try {  
success = ajaxConvert( s, response );  
statusText = "success";  
isSuccess = true;  
} catch(e) {  
// We have a parsererror  
statusText = "parsererror";  
error = e;  
}  
}  
} else {  
// We extract error from statusText  
// then normalize statusText and status for non-aborts  
error = statusText;  
if( status ) {  
statusText = "error";  
if ( status < 0 ) {  
status = 0;  
}  
}  
}  
 
// Set data for the fake xhr object  
jXHR.status = status;  
jXHR.statusText = statusText;  
 
// Success/Error  
if ( isSuccess ) {  
deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] );  
} else {  
deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] );  
}  
 
// Status-dependent callbacks  
jXHR.statusCode( statusCode );  
statusCode = undefined;  
 
if ( s.global ) {  
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),  
[ jXHR, s, isSuccess ? success : error ] );  
}  
 
// Complete  
completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] );  
 
if ( s.global ) {  
globalEventContext.trigger( "ajaxComplete", [ jXHR, s] );  
// Handle the global AJAX counter  
if ( !( --jQuery.active ) ) {  
jQuery.event.trigger( "ajaxStop" );  
}  
}  
}  
 
// Attach deferreds  
deferred.promise( jXHR );  
jXHR.success = jXHR.done;  
jXHR.error = jXHR.fail;  
jXHR.complete = completeDeferred.done;  
 
// Status-dependent callbacks  
jXHR.statusCode = function( map ) {  
if ( map ) {  
var tmp;  
if ( state < 2 ) {  
for( tmp in map ) {  
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];  
}  
} else {  
tmp = map[ jXHR.status ];  
jXHR.then( tmp, tmp );  
}  
}  
return this;  
};  
 
// Remove hash character (#7531: and string promotion)  
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)  
// We also use the url parameter if available  
s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" );  
 
// Extract dataTypes list  
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );  
 
// Determine if a cross-domain request is in order  
if ( !s.crossDomain ) {  
parts = rurl.exec( s.url.toLowerCase() );  
s.crossDomain = !!( parts &&  
( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname ||  
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=  
( loc.port || ( protocol === "http:" ? 80 : 443 ) ) )  
);  
}  
 
// Convert data if not already a string  
if ( s.data && s.processData && typeof s.data !== "string" ) {  
s.data = jQuery.param( s.data, s.traditional );  
}  
 
// Apply prefilters  
inspectPrefiltersOrTransports( prefilters, s, options, jXHR );  
 
// Uppercase the type  
s.type = s.type.toUpperCase();  
 
// Determine if request has content  
s.hasContent = !rnoContent.test( s.type );  
 
// Watch for a new set of requests  
if ( s.global && jQuery.active++ === 0 ) {  
jQuery.event.trigger( "ajaxStart" );  
}  
 
// More options handling for requests with no content  
if ( !s.hasContent ) {  
 
// If data is available, append data to url  
if ( s.data ) {  
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;  
}  
 
// Add anti-cache in url if needed  
if ( s.cache === false ) {  
 
var ts = jQuery.now(),  
// try replacing _= if it is there  
ret = s.url.replace( rts, "$1_=" + ts );  
 
// if nothing was replaced, add timestamp to the end  
s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );  
}  
}  
 
// Set the correct header, if data is being sent  
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {  
requestHeaders[ "content-type" ] = s.contentType;  
}  
 
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.  
if ( s.ifModified ) {  
if ( jQuery.lastModified[ s.url ] ) {  
requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ];  
}  
if ( jQuery.etag[ s.url ] ) {  
requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ];  
}  
}  
 
// Set the Accepts header for the server, depending on the dataType  
requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?  
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :  
s.accepts[ "*" ];  
 
// Check for headers option  
for ( i in s.headers ) {  
requestHeaders[ i.toLowerCase() ] = s.headers[ i ];  
}  
 
// Allow custom headers/mimetypes and early abort  
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) {  
// Abort if not done already  
done( 0, "abort" );  
// Return false  
jXHR = false;  
 
} else {  
 
// Install callbacks on deferreds  
for ( i in { success: 1, error: 1, complete: 1 } ) {  
jXHR[ i ]( s[ i ] );  
}  
 
// Get transport  
transport = inspectPrefiltersOrTransports( transports, s, options, jXHR );  
 
// If no transport, we auto-abort  
if ( !transport ) {  
done( -1, "No Transport" );  
} else {  
// Set state as sending  
state = jXHR.readyState = 1;  
// Send global event  
if ( s.global ) {  
globalEventContext.trigger( "ajaxSend", [ jXHR, s ] );  
}  
// Timeout  
if ( s.async && s.timeout > 0 ) {  
timeoutTimer = setTimeout( function(){  
jXHR.abort( "timeout" );  
}, s.timeout );  
}  
 
try {  
transport.send( requestHeaders, done );  
} catch (e) {  
// Propagate exception as error if not done  
if ( status < 2 ) {  
done( -1, e );  
// Simply rethrow otherwise  
} else {  
jQuery.error( e );  
}  
}  
}  
}  
return jXHR;  
},  
 
// Serialize an array of form elements or a set of  
// key/values into a query string  
param: function( a, traditional ) {  
var s = [],  
add = function( key, value ) {  
// If value is a function, invoke it and return its value  
value = jQuery.isFunction( value ) ? value() : value;  
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );  
};  
 
// Set traditional to true for jQuery <= 1.3.2 behavior.  
if ( traditional === undefined ) {  
traditional = jQuery.ajaxSettings.traditional;  
}  
 
// If an array was passed in, assume that it is an array of form elements.  
if ( jQuery.isArray( a ) || a.jquery ) {  
// Serialize the form elements  
jQuery.each( a, function() {  
add( this.name, this.value );  
} );  
 
} else {  
// If traditional, encode the "old" way (the way 1.3.2 or older  
// did it), otherwise encode params recursively.  
for ( var prefix in a ) {  
buildParams( prefix, a[ prefix ], traditional, add );  
}  
}  
 
// Return the resulting serialization  
return s.join( "&" ).replace( r20, "+" );  
}  
});  
 
function buildParams( prefix, obj, traditional, add ) {  
if ( jQuery.isArray( obj ) && obj.length ) {  
// Serialize array item.  
jQuery.each( obj, function( i, v ) {  
if ( traditional || rbracket.test( prefix ) ) {  
// Treat each array item as a scalar.  
add( prefix, v );  
 
} else {  
// If array item is non-scalar (array or object), encode its  
// numeric index to resolve deserialization ambiguity issues.  
// Note that rack (as of 1.0.0) can't currently deserialize  
// nested arrays properly, and attempting to do so may cause  
// a server error. Possible fixes are to modify rack's  
// deserialization algorithm or to provide an option or flag  
// to force array serialization to be shallow.  
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );  
}  
});  
 
} else if ( !traditional && obj != null && typeof obj === "object" ) {  
// If we see an array here, it is empty and should be treated as an empty  
// object  
if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {  
add( prefix, "" );  
 
// Serialize object item.  
} else {  
jQuery.each( obj, function( k, v ) {  
buildParams( prefix + "[" + k + "]", v, traditional, add );  
});  
}  
 
} else {  
// Serialize scalar item.  
add( prefix, obj );  
}  
}  
 
// This is still on the jQuery object... for now  
// Want to move this to jQuery.ajax some day  
jQuery.extend({  
 
// Counter for holding the number of active queries  
active: 0,  
 
// Last-Modified header cache for next request  
lastModified: {},  
etag: {}  
 
});  
 
/* Handles responses to an ajax request:  
* - sets all responseXXX fields accordingly  
* - finds the right dataType (mediates between content-type and expected dataType)  
* - returns the corresponding response  
*/  
function ajaxHandleResponses( s, jXHR, responses ) {  
 
var contents = s.contents,  
dataTypes = s.dataTypes,  
responseFields = s.responseFields,  
ct,  
type,  
finalDataType,  
firstDataType;  
 
// Fill responseXXX fields  
for( type in responseFields ) {  
if ( type in responses ) {  
jXHR[ responseFields[type] ] = responses[ type ];  
}  
}  
 
// Remove auto dataType and get content-type in the process  
while( dataTypes[ 0 ] === "*" ) {  
dataTypes.shift();  
if ( ct === undefined ) {  
ct = jXHR.getResponseHeader( "content-type" );  
}  
}  
 
// Check if we're dealing with a known content-type  
if ( ct ) {  
for ( type in contents ) {  
if ( contents[ type ] && contents[ type ].test( ct ) ) {  
dataTypes.unshift( type );  
break;  
}  
}  
}  
 
// Check to see if we have a response for the expected dataType  
if ( dataTypes[ 0 ] in responses ) {  
finalDataType = dataTypes[ 0 ];  
} else {  
// Try convertible dataTypes  
for ( type in responses ) {  
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {  
finalDataType = type;  
break;  
}  
if ( !firstDataType ) {  
firstDataType = type;  
}  
}  
// Or just use first one  
finalDataType = finalDataType || firstDataType;  
}  
 
// If we found a dataType  
// We add the dataType to the list if needed  
// and return the corresponding response  
if ( finalDataType ) {  
if ( finalDataType !== dataTypes[ 0 ] ) {  
dataTypes.unshift( finalDataType );  
}  
return responses[ finalDataType ];  
}  
}  
 
// Chain conversions given the request and the original response  
function ajaxConvert( s, response ) {  
 
// Apply the dataFilter if provided  
if ( s.dataFilter ) {  
response = s.dataFilter( response, s.dataType );  
}  
 
var dataTypes = s.dataTypes,  
converters = s.converters,  
i,  
length = dataTypes.length,  
tmp,  
// Current and previous dataTypes  
current = dataTypes[ 0 ],  
prev,  
// Conversion expression  
conversion,  
// Conversion function  
conv,  
// Conversion functions (transitive conversion)  
conv1,  
conv2;  
 
// For each dataType in the chain  
for( i = 1; i < length; i++ ) {  
 
// Get the dataTypes  
prev = current;  
current = dataTypes[ i ];  
 
// If current is auto dataType, update it to prev  
if( current === "*" ) {  
current = prev;  
// If no auto and dataTypes are actually different  
} else if ( prev !== "*" && prev !== current ) {  
 
// Get the converter  
conversion = prev + " " + current;  
conv = converters[ conversion ] || converters[ "* " + current ];  
 
// If there is no direct converter, search transitively  
if ( !conv ) {  
conv2 = undefined;  
for( conv1 in converters ) {  
tmp = conv1.split( " " );  
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {  
conv2 = converters[ tmp[1] + " " + current ];  
if ( conv2 ) {  
conv1 = converters[ conv1 ];  
if ( conv1 === true ) {  
conv = conv2;  
} else if ( conv2 === true ) {  
conv = conv1;  
}  
break;  
}  
}  
}  
}  
// If we found no converter, dispatch an error  
if ( !( conv || conv2 ) ) {  
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );  
}  
// If found converter is not an equivalence  
if ( conv !== true ) {  
// Convert with 1 or 2 converters accordingly  
response = conv ? conv( response ) : conv2( conv1(response) );  
}  
}  
}  
return response;  
}  
 
 
 
 
var jsc = jQuery.now(),  
jsre = /(\=)\?(&|$)|()\?\?()/i;  
 
// Default jsonp settings  
jQuery.ajaxSetup({  
jsonp: "callback",  
jsonpCallback: function() {  
return jQuery.expando + "_" + ( jsc++ );  
}  
});  
 
// Detect, normalize options and install callbacks for jsonp requests  
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {  
 
dataIsString = ( typeof s.data === "string" );  
 
if ( s.dataTypes[ 0 ] === "jsonp" ||  
originalSettings.jsonpCallback ||  
originalSettings.jsonp != null ||  
s.jsonp !== false && ( jsre.test( s.url ) ||  
dataIsString && jsre.test( s.data ) ) ) {  
 
var responseContainer,  
jsonpCallback = s.jsonpCallback =  
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,  
previous = window[ jsonpCallback ],  
url = s.url,  
data = s.data,  
replace = "$1" + jsonpCallback + "$2";  
 
if ( s.jsonp !== false ) {  
url = url.replace( jsre, replace );  
if ( s.url === url ) {  
if ( dataIsString ) {  
data = data.replace( jsre, replace );  
}  
if ( s.data === data ) {  
// Add callback manually  
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;  
}  
}  
}  
 
s.url = url;  
s.data = data;  
 
window[ jsonpCallback ] = function( response ) {  
responseContainer = [ response ];  
};  
 
s.complete = [ function() {  
 
// Set callback back to previous value  
window[ jsonpCallback ] = previous;  
 
// Call if it was a function and we have a response  
if ( previous) {  
if ( responseContainer && jQuery.isFunction( previous ) ) {  
window[ jsonpCallback ] ( responseContainer[ 0 ] );  
}  
} else {  
// else, more memory leak avoidance  
try{  
delete window[ jsonpCallback ];  
} catch( e ) {}  
}  
 
}, s.complete ];  
 
// Use data converter to retrieve json after script execution  
s.converters["script json"] = function() {  
if ( ! responseContainer ) {  
jQuery.error( jsonpCallback + " was not called" );  
}  
return responseContainer[ 0 ];  
};  
 
// force json dataType  
s.dataTypes[ 0 ] = "json";  
 
// Delegate to script  
return "script";  
}  
} );  
 
 
 
 
// Install script dataType  
jQuery.ajaxSetup({  
accepts: {  
script: "text/javascript, application/javascript"  
},  
contents: {  
script: /javascript/  
},  
converters: {  
"text script": function( text ) {  
jQuery.globalEval( text );  
return text;  
}  
}  
});  
 
// Handle cache's special case and global  
jQuery.ajaxPrefilter( "script", function( s ) {  
if ( s.cache === undefined ) {  
s.cache = false;  
}  
if ( s.crossDomain ) {  
s.type = "GET";  
s.global = false;  
}  
} );  
 
// Bind script tag hack transport  
jQuery.ajaxTransport( "script", function(s) {  
 
// This transport only deals with cross domain requests  
if ( s.crossDomain ) {  
 
var script,  
head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;  
 
return {  
 
send: function( _, callback ) {  
 
script = document.createElement( "script" );  
 
script.async = "async";  
 
if ( s.scriptCharset ) {  
script.charset = s.scriptCharset;  
}  
 
script.src = s.url;  
 
// Attach handlers for all browsers  
script.onload = script.onreadystatechange = function( _, isAbort ) {  
 
if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {  
 
// Handle memory leak in IE  
script.onload = script.onreadystatechange = null;  
 
// Remove the script  
if ( head && script.parentNode ) {  
head.removeChild( script );  
}  
 
// Dereference the script  
script = undefined;  
 
// Callback if not abort  
if ( !isAbort ) {  
callback( 200, "success" );  
}  
}  
};  
// Use insertBefore instead of appendChild to circumvent an IE6 bug.  
// This arises when a base node is used (#2709 and #4378).  
head.insertBefore( script, head.firstChild );  
},  
 
abort: function() {  
if ( script ) {  
script.onload( 0, 1 );  
}  
}  
};  
}  
} );  
 
 
 
 
var // Next active xhr id  
xhrId = jQuery.now(),  
 
// active xhrs  
xhrs = {},  
 
// #5280: see below  
xhrUnloadAbortInstalled,  
 
// XHR used to determine supports properties  
testXHR;  
 
// Create the request object  
// (This is still attached to ajaxSettings for backward compatibility)  
jQuery.ajaxSettings.xhr = window.ActiveXObject ?  
/* Microsoft failed to properly  
* implement the XMLHttpRequest in IE7 (can't request local files),  
* so we use the ActiveXObject when it is available  
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so  
* we need a fallback.  
*/  
function() {  
if ( window.location.protocol !== "file:" ) {  
try {  
return new window.XMLHttpRequest();  
} catch( xhrError ) {}  
}  
 
try {  
return new window.ActiveXObject("Microsoft.XMLHTTP");  
} catch( activeError ) {}  
} :  
// For all other browsers, use the standard XMLHttpRequest object  
function() {  
return new window.XMLHttpRequest();  
};  
 
// Test if we can create an xhr object  
try {  
testXHR = jQuery.ajaxSettings.xhr();  
} catch( xhrCreationException ) {}  
 
//Does this browser support XHR requests?  
jQuery.support.ajax = !!testXHR;  
 
// Does this browser support crossDomain XHR requests  
jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );  
 
// No need for the temporary xhr anymore  
testXHR = undefined;  
 
// Create transport if the browser can provide an xhr  
if ( jQuery.support.ajax ) {  
 
jQuery.ajaxTransport(function( s ) {  
// Cross domain only allowed if supported through XMLHttpRequest  
if ( !s.crossDomain || jQuery.support.cors ) {  
 
var callback;  
 
return {  
send: function( headers, complete ) {  
 
// #5280: we need to abort on unload or IE will keep connections alive  
if ( !xhrUnloadAbortInstalled ) {  
 
xhrUnloadAbortInstalled = 1;  
 
jQuery(window).bind( "unload", function() {  
 
// Abort all pending requests  
jQuery.each( xhrs, function( _, xhr ) {  
if ( xhr.onreadystatechange ) {  
xhr.onreadystatechange( 1 );  
}  
} );  
 
} );  
}  
 
// Get a new xhr  
var xhr = s.xhr(),  
handle;  
 
// Open the socket  
// Passing null username, generates a login popup on Opera (#2865)  
if ( s.username ) {  
xhr.open( s.type, s.url, s.async, s.username, s.password );  
} else {  
xhr.open( s.type, s.url, s.async );  
}  
 
// Requested-With header  
// Not set for crossDomain requests with no content  
// (see why at http://trac.dojotoolkit.org/ticket/9486)  
// Won't change header if already provided  
if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) {  
headers[ "x-requested-with" ] = "XMLHttpRequest";  
}  
 
// Need an extra try/catch for cross domain requests in Firefox 3  
try {  
jQuery.each( headers, function( key, value ) {  
xhr.setRequestHeader( key, value );  
} );  
} catch( _ ) {}  
 
// Do send the request  
// This may raise an exception which is actually  
// handled in jQuery.ajax (so no try/catch here)  
xhr.send( ( s.hasContent && s.data ) || null );  
 
// Listener  
callback = function( _, isAbort ) {  
 
// Was never called and is aborted or complete  
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {  
 
// Only called once  
callback = 0;  
 
// Do not keep as active anymore  
if ( handle ) {  
xhr.onreadystatechange = jQuery.noop;  
delete xhrs[ handle ];  
}  
 
// If it's an abort  
if ( isAbort ) {  
// Abort it manually if needed  
if ( xhr.readyState !== 4 ) {  
xhr.abort();  
}  
} else {  
// Get info  
var status = xhr.status,  
statusText,  
responseHeaders = xhr.getAllResponseHeaders(),  
responses = {},  
xml = xhr.responseXML;  
 
// Construct response list  
if ( xml && xml.documentElement /* #4958 */ ) {  
responses.xml = xml;  
}  
responses.text = xhr.responseText;  
 
// Firefox throws an exception when accessing  
// statusText for faulty cross-domain requests  
try {  
statusText = xhr.statusText;  
} catch( e ) {  
// We normalize with Webkit giving an empty statusText  
statusText = "";  
}  
 
// Filter status for non standard behaviours  
status =  
// Opera returns 0 when it should be 304  
// Webkit returns 0 for failing cross-domain no matter the real status  
status === 0 ?  
(  
// Webkit, Firefox: filter out faulty cross-domain requests  
!s.crossDomain || statusText ?  
(  
// Opera: filter out real aborts #6060  
responseHeaders ?  
304 :  
0  
) :  
// We assume 302 but could be anything cross-domain related  
302  
) :  
(  
// IE sometimes returns 1223 when it should be 204 (see #1450)  
status == 1223 ?  
204 :  
status  
);  
 
// Call complete  
complete( status, statusText, responses, responseHeaders );  
}  
}  
};  
 
// if we're in sync mode or it's in cache  
// and has been retrieved directly (IE6 & IE7)  
// we need to manually fire the callback  
if ( !s.async || xhr.readyState === 4 ) {  
callback();  
} else {  
// Add to list of active xhrs  
handle = xhrId++;  
xhrs[ handle ] = xhr;  
xhr.onreadystatechange = callback;  
}  
},  
 
abort: function() {  
if ( callback ) {  
callback(0,1);  
}  
}  
};  
}  
});  
}  
 
 
 
 
var elemdisplay = {},  
rfxtypes = /^(?:toggle|show|hide)$/,  
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,  
timerId,  
fxAttrs = [  
// height animations  
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],  
// width animations  
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],  
// opacity animations  
[ "opacity" ]  
];  
 
jQuery.fn.extend({  
show: function( speed, easing, callback ) {  
var elem, display;  
 
if ( speed || speed === 0 ) {  
return this.animate( genFx("show", 3), speed, easing, callback);  
 
} else {  
for ( var i = 0, j = this.length; i < j; i++ ) {  
elem = this[i];  
display = elem.style.display;  
 
// Reset the inline display of this element to learn if it is  
// being hidden by cascaded rules or not  
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {  
display = elem.style.display = "";  
}  
 
// Set elements which have been overridden with display: none  
// in a stylesheet to whatever the default browser style is  
// for such an element  
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {  
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));  
}  
}  
 
// Set the display of most of the elements in a second loop  
// to avoid the constant reflow  
for ( i = 0; i < j; i++ ) {  
elem = this[i];  
display = elem.style.display;  
 
if ( display === "" || display === "none" ) {  
elem.style.display = jQuery._data(elem, "olddisplay") || "";  
}  
}  
 
return this;  
}  
},  
 
hide: function( speed, easing, callback ) {  
if ( speed || speed === 0 ) {  
return this.animate( genFx("hide", 3), speed, easing, callback);  
 
} else {  
for ( var i = 0, j = this.length; i < j; i++ ) {  
var display = jQuery.css( this[i], "display" );  
 
if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {  
jQuery._data( this[i], "olddisplay", display );  
}  
}  
 
// Set the display of the elements in a second loop  
// to avoid the constant reflow  
for ( i = 0; i < j; i++ ) {  
this[i].style.display = "none";  
}  
 
return this;  
}  
},  
 
// Save the old toggle function  
_toggle: jQuery.fn.toggle,  
 
toggle: function( fn, fn2, callback ) {  
var bool = typeof fn === "boolean";  
 
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {  
this._toggle.apply( this, arguments );  
 
} else if ( fn == null || bool ) {  
this.each(function() {  
var state = bool ? fn : jQuery(this).is(":hidden");  
jQuery(this)[ state ? "show" : "hide" ]();  
});  
 
} else {  
this.animate(genFx("toggle", 3), fn, fn2, callback);  
}  
 
return this;  
},  
 
fadeTo: function( speed, to, easing, callback ) {  
return this.filter(":hidden").css("opacity", 0).show().end()  
.animate({opacity: to}, speed, easing, callback);  
},  
 
animate: function( prop, speed, easing, callback ) {  
var optall = jQuery.speed(speed, easing, callback);  
 
if ( jQuery.isEmptyObject( prop ) ) {  
return this.each( optall.complete );  
}  
 
return this[ optall.queue === false ? "each" : "queue" ](function() {  
// XXX 'this' does not always have a nodeName when running the  
// test suite  
 
var opt = jQuery.extend({}, optall), p,  
isElement = this.nodeType === 1,  
hidden = isElement && jQuery(this).is(":hidden"),  
self = this;  
 
for ( p in prop ) {  
var name = jQuery.camelCase( p );  
 
if ( p !== name ) {  
prop[ name ] = prop[ p ];  
delete prop[ p ];  
p = name;  
}  
 
if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {  
return opt.complete.call(this);  
}  
 
if ( isElement && ( p === "height" || p === "width" ) ) {  
// Make sure that nothing sneaks out  
// Record all 3 overflow attributes because IE does not  
// change the overflow attribute when overflowX and  
// overflowY are set to the same value  
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];  
 
// Set display property to inline-block for height/width  
// animations on inline elements that are having width/height  
// animated  
if ( jQuery.css( this, "display" ) === "inline" &&  
jQuery.css( this, "float" ) === "none" ) {  
if ( !jQuery.support.inlineBlockNeedsLayout ) {  
this.style.display = "inline-block";  
 
} else {  
var display = defaultDisplay(this.nodeName);  
 
// inline-level elements accept inline-block;  
// block-level elements need to be inline with layout  
if ( display === "inline" ) {  
this.style.display = "inline-block";  
 
} else {  
this.style.display = "inline";  
this.style.zoom = 1;  
}  
}  
}  
}  
 
if ( jQuery.isArray( prop[p] ) ) {  
// Create (if needed) and add to specialEasing  
(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];  
prop[p] = prop[p][0];  
}  
}  
 
if ( opt.overflow != null ) {  
this.style.overflow = "hidden";  
}  
 
opt.curAnim = jQuery.extend({}, prop);  
 
jQuery.each( prop, function( name, val ) {  
var e = new jQuery.fx( self, opt, name );  
 
if ( rfxtypes.test(val) ) {  
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );  
 
} else {  
var parts = rfxnum.exec(val),  
start = e.cur() || 0;  
 
if ( parts ) {  
var end = parseFloat( parts[2] ),  
unit = parts[3] || "px";  
 
// We need to compute starting value  
if ( unit !== "px" ) {  
jQuery.style( self, name, (end || 1) + unit);  
start = ((end || 1) / e.cur()) * start;  
jQuery.style( self, name, start + unit);  
}  
 
// If a +=/-= token was provided, we're doing a relative animation  
if ( parts[1] ) {  
end = ((parts[1] === "-=" ? -1 : 1) * end) + start;  
}  
 
e.custom( start, end, unit );  
 
} else {  
e.custom( start, val, "" );  
}  
}  
});  
 
// For JS strict compliance  
return true;  
});  
},  
 
stop: function( clearQueue, gotoEnd ) {  
var timers = jQuery.timers;  
 
if ( clearQueue ) {  
this.queue([]);  
}  
 
this.each(function() {  
// go in reverse order so anything added to the queue during the loop is ignored  
for ( var i = timers.length - 1; i >= 0; i-- ) {  
if ( timers[i].elem === this ) {  
if (gotoEnd) {  
// force the next step to be the last  
timers[i](true);  
}  
 
timers.splice(i, 1);  
}  
}  
});  
 
// start the next in the queue if the last step wasn't forced  
if ( !gotoEnd ) {  
this.dequeue();  
}  
 
return this;  
}  
 
});  
 
function genFx( type, num ) {  
var obj = {};  
 
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {  
obj[ this ] = type;  
});  
 
return obj;  
}  
 
// Generate shortcuts for custom animations  
jQuery.each({  
slideDown: genFx("show", 1),  
slideUp: genFx("hide", 1),  
slideToggle: genFx("toggle", 1),  
fadeIn: { opacity: "show" },  
fadeOut: { opacity: "hide" },  
fadeToggle: { opacity: "toggle" }  
}, function( name, props ) {  
jQuery.fn[ name ] = function( speed, easing, callback ) {  
return this.animate( props, speed, easing, callback );  
};  
});  
 
jQuery.extend({  
speed: function( speed, easing, fn ) {  
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {  
complete: fn || !fn && easing ||  
jQuery.isFunction( speed ) && speed,  
duration: speed,  
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing  
};  
 
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :  
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;  
 
// Queueing  
opt.old = opt.complete;  
opt.complete = function() {  
if ( opt.queue !== false ) {  
jQuery(this).dequeue();  
}  
if ( jQuery.isFunction( opt.old ) ) {  
opt.old.call( this );  
}  
};  
 
return opt;  
},  
 
easing: {  
linear: function( p, n, firstNum, diff ) {  
return firstNum + diff * p;  
},  
swing: function( p, n, firstNum, diff ) {  
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;  
}  
},  
 
timers: [],  
 
fx: function( elem, options, prop ) {  
this.options = options;  
this.elem = elem;  
this.prop = prop;  
 
if ( !options.orig ) {  
options.orig = {};  
}  
}  
 
});  
 
jQuery.fx.prototype = {  
// Simple function for setting a style value  
update: function() {  
if ( this.options.step ) {  
this.options.step.call( this.elem, this.now, this );  
}  
 
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );  
},  
 
// Get the current size  
cur: function() {  
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {  
return this.elem[ this.prop ];  
}  
 
var r = parseFloat( jQuery.css( this.elem, this.prop ) );  
return r || 0;  
},  
 
// Start an animation from one number to another  
custom: function( from, to, unit ) {  
var self = this,  
fx = jQuery.fx;  
 
this.startTime = jQuery.now();  
this.start = from;  
this.end = to;  
this.unit = unit || this.unit || "px";  
this.now = this.start;  
this.pos = this.state = 0;  
 
function t( gotoEnd ) {  
return self.step(gotoEnd);  
}  
 
t.elem = this.elem;  
 
if ( t() && jQuery.timers.push(t) && !timerId ) {  
timerId = setInterval(fx.tick, fx.interval);  
}  
},  
 
// Simple 'show' function  
show: function() {  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );  
this.options.show = true;  
 
// Begin the animation  
// Make sure that we start at a small width/height to avoid any  
// flash of content  
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());  
 
// Start by showing the element  
jQuery( this.elem ).show();  
},  
 
// Simple 'hide' function  
hide: function() {  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );  
this.options.hide = true;  
 
// Begin the animation  
this.custom(this.cur(), 0);  
},  
 
// Each step of an animation  
step: function( gotoEnd ) {  
var t = jQuery.now(), done = true;  
 
if ( gotoEnd || t >= this.options.duration + this.startTime ) {  
this.now = this.end;  
this.pos = this.state = 1;  
this.update();  
 
this.options.curAnim[ this.prop ] = true;  
 
for ( var i in this.options.curAnim ) {  
if ( this.options.curAnim[i] !== true ) {  
done = false;  
}  
}  
 
if ( done ) {  
// Reset the overflow  
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {  
var elem = this.elem,  
options = this.options;  
 
jQuery.each( [ "", "X", "Y" ], function (index, value) {  
elem.style[ "overflow" + value ] = options.overflow[index];  
} );  
}  
 
// Hide the element if the "hide" operation was done  
if ( this.options.hide ) {  
jQuery(this.elem).hide();  
}  
 
// Reset the properties, if the item has been hidden or shown  
if ( this.options.hide || this.options.show ) {  
for ( var p in this.options.curAnim ) {  
jQuery.style( this.elem, p, this.options.orig[p] );  
}  
}  
 
// Execute the complete function  
this.options.complete.call( this.elem );  
}  
 
return false;  
 
} else {  
var n = t - this.startTime;  
this.state = n / this.options.duration;  
 
// Perform the easing function, defaults to swing  
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];  
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");  
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);  
this.now = this.start + ((this.end - this.start) * this.pos);  
 
// Perform the next step of the animation  
this.update();  
}  
 
return true;  
}  
};  
 
jQuery.extend( jQuery.fx, {  
tick: function() {  
var timers = jQuery.timers;  
 
for ( var i = 0; i < timers.length; i++ ) {  
if ( !timers[i]() ) {  
timers.splice(i--, 1);  
}  
}  
 
if ( !timers.length ) {  
jQuery.fx.stop();  
}  
},  
 
interval: 13,  
 
stop: function() {  
clearInterval( timerId );  
timerId = null;  
},  
 
speeds: {  
slow: 600,  
fast: 200,  
// Default speed  
_default: 400  
},  
 
step: {  
opacity: function( fx ) {  
jQuery.style( fx.elem, "opacity", fx.now );  
},  
 
_default: function( fx ) {  
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {  
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;  
} else {  
fx.elem[ fx.prop ] = fx.now;  
}  
}  
}  
});  
 
if ( jQuery.expr && jQuery.expr.filters ) {  
jQuery.expr.filters.animated = function( elem ) {  
return jQuery.grep(jQuery.timers, function( fn ) {  
return elem === fn.elem;  
}).length;  
};  
}  
 
function defaultDisplay( nodeName ) {  
if ( !elemdisplay[ nodeName ] ) {  
var elem = jQuery("<" + nodeName + ">").appendTo("body"),  
display = elem.css("display");  
 
elem.remove();  
 
if ( display === "none" || display === "" ) {  
display = "block";  
}  
 
elemdisplay[ nodeName ] = display;  
}  
 
return elemdisplay[ nodeName ];  
}  
 
 
 
 
var rtable = /^t(?:able|d|h)$/i,  
rroot = /^(?:body|html)$/i;  
 
if ( "getBoundingClientRect" in document.documentElement ) {  
jQuery.fn.offset = function( options ) {  
var elem = this[0], box;  
 
if ( options ) {  
return this.each(function( i ) {  
jQuery.offset.setOffset( this, options, i );  
});  
}  
 
if ( !elem || !elem.ownerDocument ) {  
return null;  
}  
 
if ( elem === elem.ownerDocument.body ) {  
return jQuery.offset.bodyOffset( elem );  
}  
 
try {  
box = elem.getBoundingClientRect();  
} catch(e) {}  
 
var doc = elem.ownerDocument,  
docElem = doc.documentElement;  
 
// Make sure we're not dealing with a disconnected DOM node  
if ( !box || !jQuery.contains( docElem, elem ) ) {  
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };  
}  
 
var body = doc.body,  
win = getWindow(doc),  
clientTop = docElem.clientTop || body.clientTop || 0,  
clientLeft = docElem.clientLeft || body.clientLeft || 0,  
scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),  
scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),  
top = box.top + scrollTop - clientTop,  
left = box.left + scrollLeft - clientLeft;  
 
return { top: top, left: left };  
};  
 
} else {  
jQuery.fn.offset = function( options ) {  
var elem = this[0];  
 
if ( options ) {  
return this.each(function( i ) {  
jQuery.offset.setOffset( this, options, i );  
});  
}  
 
if ( !elem || !elem.ownerDocument ) {  
return null;  
}  
 
if ( elem === elem.ownerDocument.body ) {  
return jQuery.offset.bodyOffset( elem );  
}  
 
jQuery.offset.initialize();  
 
var computedStyle,  
offsetParent = elem.offsetParent,  
prevOffsetParent = elem,  
doc = elem.ownerDocument,  
docElem = doc.documentElement,  
body = doc.body,  
defaultView = doc.defaultView,  
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,  
top = elem.offsetTop,  
left = elem.offsetLeft;  
 
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {  
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {  
break;  
}  
 
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;  
top -= elem.scrollTop;  
left -= elem.scrollLeft;  
 
if ( elem === offsetParent ) {  
top += elem.offsetTop;  
left += elem.offsetLeft;  
 
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {  
top += parseFloat( computedStyle.borderTopWidth ) || 0;  
left += parseFloat( computedStyle.borderLeftWidth ) || 0;  
}  
 
prevOffsetParent = offsetParent;  
offsetParent = elem.offsetParent;  
}  
 
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {  
top += parseFloat( computedStyle.borderTopWidth ) || 0;  
left += parseFloat( computedStyle.borderLeftWidth ) || 0;  
}  
 
prevComputedStyle = computedStyle;  
}  
 
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {  
top += body.offsetTop;  
left += body.offsetLeft;  
}  
 
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {  
top += Math.max( docElem.scrollTop, body.scrollTop );  
left += Math.max( docElem.scrollLeft, body.scrollLeft );  
}  
 
return { top: top, left: left };  
};  
}  
 
jQuery.offset = {  
initialize: function() {  
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,  
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";  
 
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );  
 
container.innerHTML = html;  
body.insertBefore( container, body.firstChild );  
innerDiv = container.firstChild;  
checkDiv = innerDiv.firstChild;  
td = innerDiv.nextSibling.firstChild.firstChild;  
 
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);  
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);  
 
checkDiv.style.position = "fixed";  
checkDiv.style.top = "20px";  
 
// safari subtracts parent border width here which is 5px  
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);  
checkDiv.style.position = checkDiv.style.top = "";  
 
innerDiv.style.overflow = "hidden";  
innerDiv.style.position = "relative";  
 
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);  
 
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);  
 
body.removeChild( container );  
body = container = innerDiv = checkDiv = table = td = null;  
jQuery.offset.initialize = jQuery.noop;  
},  
 
bodyOffset: function( body ) {  
var top = body.offsetTop,  
left = body.offsetLeft;  
 
jQuery.offset.initialize();  
 
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {  
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;  
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;  
}  
 
return { top: top, left: left };  
},  
 
setOffset: function( elem, options, i ) {  
var position = jQuery.css( elem, "position" );  
 
// set position first, in-case top/left are set even on static elem  
if ( position === "static" ) {  
elem.style.position = "relative";  
}  
 
var curElem = jQuery( elem ),  
curOffset = curElem.offset(),  
curCSSTop = jQuery.css( elem, "top" ),  
curCSSLeft = jQuery.css( elem, "left" ),  
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),  
props = {}, curPosition = {}, curTop, curLeft;  
 
// need to be able to calculate position if either top or left is auto and position is absolute  
if ( calculatePosition ) {  
curPosition = curElem.position();  
}  
 
curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;  
curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;  
 
if ( jQuery.isFunction( options ) ) {  
options = options.call( elem, i, curOffset );  
}  
 
if (options.top != null) {  
props.top = (options.top - curOffset.top) + curTop;  
}  
if (options.left != null) {  
props.left = (options.left - curOffset.left) + curLeft;  
}  
 
if ( "using" in options ) {  
options.using.call( elem, props );  
} else {  
curElem.css( props );  
}  
}  
};  
 
 
jQuery.fn.extend({  
position: function() {  
if ( !this[0] ) {  
return null;  
}  
 
var elem = this[0],  
 
// Get *real* offsetParent  
offsetParent = this.offsetParent(),  
 
// Get correct offsets  
offset = this.offset(),  
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();  
 
// Subtract element margins  
// note: when an element has margin: auto the offsetLeft and marginLeft  
// are the same in Safari causing offset.left to incorrectly be 0  
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;  
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;  
 
// Add offsetParent borders  
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;  
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;  
 
// Subtract the two offsets  
return {  
top: offset.top - parentOffset.top,  
left: offset.left - parentOffset.left  
};  
},  
 
offsetParent: function() {  
return this.map(function() {  
var offsetParent = this.offsetParent || document.body;  
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {  
offsetParent = offsetParent.offsetParent;  
}  
return offsetParent;  
});  
}  
});  
 
 
// Create scrollLeft and scrollTop methods  
jQuery.each( ["Left", "Top"], function( i, name ) {  
var method = "scroll" + name;  
 
jQuery.fn[ method ] = function(val) {  
var elem = this[0], win;  
 
if ( !elem ) {  
return null;  
}  
 
if ( val !== undefined ) {  
// Set the scroll offset  
return this.each(function() {  
win = getWindow( this );  
 
if ( win ) {  
win.scrollTo(  
!i ? val : jQuery(win).scrollLeft(),  
i ? val : jQuery(win).scrollTop()  
);  
 
} else {  
this[ method ] = val;  
}  
});  
} else {  
win = getWindow( elem );  
 
// Return the scroll offset  
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :  
jQuery.support.boxModel && win.document.documentElement[ method ] ||  
win.document.body[ method ] :  
elem[ method ];  
}  
};  
});  
 
function getWindow( elem ) {  
return jQuery.isWindow( elem ) ?  
elem :  
elem.nodeType === 9 ?  
elem.defaultView || elem.parentWindow :  
false;  
}  
 
 
 
 
// Create innerHeight, innerWidth, outerHeight and outerWidth methods  
jQuery.each([ "Height", "Width" ], function( i, name ) {  
 
var type = name.toLowerCase();  
 
// innerHeight and innerWidth  
jQuery.fn["inner" + name] = function() {  
return this[0] ?  
parseFloat( jQuery.css( this[0], type, "padding" ) ) :  
null;  
};  
 
// outerHeight and outerWidth  
jQuery.fn["outer" + name] = function( margin ) {  
return this[0] ?  
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :  
null;  
};  
 
jQuery.fn[ type ] = function( size ) {  
// Get window width or height  
var elem = this[0];  
if ( !elem ) {  
return size == null ? null : this;  
}  
 
if ( jQuery.isFunction( size ) ) {  
return this.each(function( i ) {  
var self = jQuery( this );  
self[ type ]( size.call( this, i, self[ type ]() ) );  
});  
}  
 
if ( jQuery.isWindow( elem ) ) {  
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode  
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat  
var docElemProp = elem.document.documentElement[ "client" + name ];  
return elem.document.compatMode === "CSS1Compat" && docElemProp ||  
elem.document.body[ "client" + name ] || docElemProp;  
 
// Get document width or height  
} else if ( elem.nodeType === 9 ) {  
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater  
return Math.max(  
elem.documentElement["client" + name],  
elem.body["scroll" + name], elem.documentElement["scroll" + name],  
elem.body["offset" + name], elem.documentElement["offset" + name]  
);  
 
// Get or set width or height on the element  
} else if ( size === undefined ) {  
var orig = jQuery.css( elem, type ),  
ret = parseFloat( orig );  
 
return jQuery.isNaN( ret ) ? orig : ret;  
 
// Set the width or height on the element (default to pixels if value is unitless)  
} else {  
return this.css( type, typeof size === "string" ? size : size + "px" );  
}  
};  
 
});  
 
 
})(window);  
 
/*!  
* jQuery Mobile v1.0a3  
* http://jquerymobile.com/  
*  
* Copyright 2010, jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
(function(a,d){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var g=0,e;(e=b[g])!=null;g++)a(e).triggerHandler("remove");c(b)}}else{var f=a.fn.remove;a.fn.remove=function(b,g){return this.each(function(){if(!g)if(!b||a.filter(b,[this]).length)a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return f.call(a(this),b,g)})}}a.widget=function(b,g,e){var i=b.split(".")[0],h;b=b.split(".")[1];h=i+"-"+b;if(!e){e=g;g=a.Widget}a.expr[":"][h]=function(k){return!!a.data(k,  
b)};a[i]=a[i]||{};a[i][b]=function(k,j){arguments.length&&this._createWidget(k,j)};g=new g;g.options=a.extend(true,{},g.options);a[i][b].prototype=a.extend(true,g,{namespace:i,widgetName:b,widgetEventPrefix:a[i][b].prototype.widgetEventPrefix||b,widgetBaseClass:h},e);a.widget.bridge(b,a[i][b])};a.widget.bridge=function(b,g){a.fn[b]=function(e){var i=typeof e==="string",h=Array.prototype.slice.call(arguments,1),k=this;e=!i&&h.length?a.extend.apply(null,[true,e].concat(h)):e;if(i&&e.charAt(0)==="_")return k;  
i?this.each(function(){var j=a.data(this,b);if(!j)throw"cannot call methods on "+b+" prior to initialization; attempted to call method '"+e+"'";if(!a.isFunction(j[e]))throw"no such method '"+e+"' for "+b+" widget instance";var o=j[e].apply(j,h);if(o!==j&&o!==d){k=o;return false}}):this.each(function(){var j=a.data(this,b);j?j.option(e||{})._init():a.data(this,b,new g(e,this))});return k}};a.Widget=function(b,g){arguments.length&&this._createWidget(b,g)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",  
options:{disabled:false},_createWidget:function(b,g){a.data(g,this.widgetName,this);this.element=a(g);this.options=a.extend(true,{},this.options,this._getCreateOptions(),b);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){var b={};if(a.metadata)b=a.metadata.get(element)[this.widgetName];return b},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);  
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,g){var e=b;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(g===d)return this.options[b];e={};e[b]=g}this._setOptions(e);return this},_setOptions:function(b){var g=this;a.each(b,function(e,i){g._setOption(e,i)});return this},_setOption:function(b,g){this.options[b]=g;if(b===  
"disabled")this.widget()[g?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",g);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(b,g,e){var i=this.options[b];g=a.Event(g);g.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();e=e||{};if(g.originalEvent){b=a.event.props.length;for(var h;b;){h=a.event.props[--b];g[h]=g.originalEvent[h]}}this.element.trigger(g,  
e);return!(a.isFunction(i)&&i.call(this.element[0],g,e)===false||g.isDefaultPrevented())}}})(jQuery);(function(a,d){a.widget("mobile.widget",{_getCreateOptions:function(){var c=this.element,f={};a.each(this.options,function(b){var g=c.data(b.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}));if(g!==d)f[b]=g});return f}})})(jQuery);  
(function(a){function d(){var g=c.width(),e=[],i=[],h;f.removeClass("min-width-"+b.join("px min-width-")+"px max-width-"+b.join("px max-width-")+"px");a.each(b,function(k,j){g>=j&&e.push("min-width-"+j+"px");g<=j&&i.push("max-width-"+j+"px")});if(e.length)h=e.join(" ");if(i.length)h+=" "+i.join(" ");f.addClass(h)}var c=a(window),f=a("html"),b=[320,480,768,1024];a.mobile.media=function(){var g={},e=a("<div id='jquery-mediatest'>"),i=a("<body>").append(e);return function(h){if(!(h in g)){var k=document.createElement("style"),  
j="@media "+h+" { #jquery-mediatest { position:absolute; } }";k.type="text/css";if(k.styleSheet)k.styleSheet.cssText=j;else k.appendChild(document.createTextNode(j));f.prepend(i).prepend(k);g[h]=e.css("position")==="absolute";i.add(k).remove()}return g[h]}}();a.mobile.addResolutionBreakpoints=function(g){if(a.type(g)==="array")b=b.concat(g);else b.push(g);b.sort(function(e,i){return e-i});d()};a(document).bind("mobileinit.htmlclass",function(){c.bind("orientationchange.htmlclass resize.htmlclass",  
function(g){g.orientation&&f.removeClass("portrait landscape").addClass(g.orientation);d()})});a(function(){c.trigger("orientationchange.htmlclass")})})(jQuery);  
(function(a,d){function c(h){var k=h.charAt(0).toUpperCase()+h.substr(1);h=(h+" "+g.join(k+" ")+k).split(" ");for(var j in h)if(b[j]!==d)return true}var f=a("<body>").prependTo("html"),b=f[0].style,g=["webkit","moz","o"],e=window.palmGetResource||window.PalmServiceBridge,i=window.blackberry;a.extend(a.support,{orientation:"orientation"in window,touch:"ontouchend"in document,cssTransitions:"WebKitTransitionEvent"in window,pushState:!!history.pushState,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!c("content"),  
boxShadow:!!c("boxShadow")&&!i,scrollTop:("pageXOffset"in window||"scrollTop"in document.documentElement||"scrollTop"in f[0])&&!e,dynamicBaseTag:function(){var h=location.protocol+"//"+location.host+location.pathname+"ui-dir/",k=a("head base"),j=null,o="";if(k.length)o=k.attr("href");else k=j=a("<base>",{href:h}).appendTo("head");var p=a("<a href='testurl'></a>").prependTo(f)[0].href;k[0].href=o?o:location.pathname;j&&j.remove();return p.indexOf(h)===0}()});f.remove();a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")})(jQuery);  
(function(a,d){a.each("touchstart touchmove touchend orientationchange tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(e,i){a.fn[i]=function(h){return h?this.bind(i,h):this.trigger(i)};a.attrFn[i]=true});var c=a.support.touch,f=c?"touchstart":"mousedown",b=c?"touchend":"mouseup",g=c?"touchmove":"mousemove";a.event.special.scrollstart={enabled:true,setup:function(){function e(j,o){h=o;var p=j.type;j.type=h?"scrollstart":"scrollstop";a.event.handle.call(i,j);j.type=  
p}var i=this,h,k;a(i).bind("touchmove scroll",function(j){if(a.event.special.scrollstart.enabled){h||e(j,true);clearTimeout(k);k=setTimeout(function(){e(j,false)},50)}})}};a.event.special.tap={setup:function(){var e=this,i=a(e);i.bind("mousedown touchstart",function(h){function k(n){if(n.type=="scroll")j=true;else{n=n.type=="touchmove"?n.originalEvent.touches[0]:n;if(Math.abs(v[0]-n.pageX)>10||Math.abs(v[1]-n.pageY)>10)j=true}}if(h.which&&h.which!==1||i.data("prevEvent")&&i.data("prevEvent")!==h.type)return false;  
i.data("prevEvent",h.type);setTimeout(function(){i.removeData("prevEvent")},800);var j=false,o=true,p=h.target,t=h.originalEvent,v=h.type=="touchstart"?[t.touches[0].pageX,t.touches[0].pageY]:[h.pageX,h.pageY],m,r;r=setTimeout(function(){if(o&&!j){m=h.type;h.type="taphold";a.event.handle.call(e,h);h.type=m}},750);a(window).one("scroll",k);i.bind("mousemove touchmove",k).one("mouseup touchend",function(n){i.unbind("mousemove touchmove",k);a(window).unbind("scroll",k);clearTimeout(r);o=false;if(!j&&  
p==n.target){m=n.type;n.type="tap";a.event.handle.call(e,n);n.type=m}})})}};a.event.special.swipe={setup:function(){var e=a(this);e.bind(f,function(i){function h(p){if(j){var t=p.originalEvent.touches?p.originalEvent.touches[0]:p;o={time:(new Date).getTime(),coords:[t.pageX,t.pageY]};Math.abs(j.coords[0]-o.coords[0])>10&&p.preventDefault()}}var k=i.originalEvent.touches?i.originalEvent.touches[0]:i,j={time:(new Date).getTime(),coords:[k.pageX,k.pageY],origin:a(i.target)},o;e.bind(g,h).one(b,function(){e.unbind(g,  
h);if(j&&o)if(o.time-j.time<1E3&&Math.abs(j.coords[0]-o.coords[0])>30&&Math.abs(j.coords[1]-o.coords[1])<75)j.origin.trigger("swipe").trigger(j.coords[0]>o.coords[0]?"swipeleft":"swiperight");j=o=d})})}};(function(e){function i(){var o=k();if(o!==j){j=o;h.trigger("orientationchange")}}var h=e(window),k,j;e.event.special.orientationchange={setup:function(){if(e.support.orientation)return false;j=k();h.bind("resize",i)},teardown:function(){if(e.support.orientation)return false;h.unbind("resize",i)},  
add:function(o){var p=o.handler;o.handler=function(t){t.orientation=k();return p.apply(this,arguments)}}};k=function(){var o=document.documentElement;return o&&o.clientWidth/o.clientHeight<1.1?"portrait":"landscape"}})(jQuery);a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(e,i){a.event.special[e]={setup:function(){a(this).bind(i,a.noop)}}})})(jQuery);  
(function(a,d,c){function f(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}var b="hashchange",g=document,e,i=a.event.special,h=g.documentMode,k="on"+b in d&&(h===c||h>7);a.fn[b]=function(j){return j?this.bind(b,j):this.trigger(b)};a.fn[b].delay=50;i[b]=a.extend(i[b],{setup:function(){if(k)return false;a(e.start)},teardown:function(){if(k)return false;a(e.stop)}});e=function(){function j(){var n=f(),u=r(t);if(n!==t){m(t=n,u);a(d).trigger(b)}else if(u!==t)location.href=location.href.replace(/#.*/,  
"")+u;p=setTimeout(j,a.fn[b].delay)}var o={},p,t=f(),v=function(n){return n},m=v,r=v;o.start=function(){p||j()};o.stop=function(){p&&clearTimeout(p);p=c};a.browser.msie&&!k&&function(){var n,u;o.start=function(){if(!n){u=(u=a.fn[b].src)&&u+f();n=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){u||m(f());j()}).attr("src",u||"javascript:0").insertAfter("body")[0].contentWindow;g.onpropertychange=function(){try{if(event.propertyName==="title")n.document.title=g.title}catch(l){}}}};  
o.stop=v;r=function(){return f(n.location.href)};m=function(l,s){var q=n.document,w=a.fn[b].domain;if(l!==s){q.title=g.title;q.open();w&&q.write('<script>document.domain="'+w+'"<\/script>');q.close();n.location.hash=l}}}();return o}()})(jQuery,this);  
(function(a){a.widget("mobile.page",a.mobile.widget,{options:{backBtnText:"Back",addBackBtn:true,degradeInputs:{color:false,date:false,datetime:false,"datetime-local":false,email:false,month:false,number:false,range:"number",search:true,tel:false,time:false,url:false,week:false},keepNative:null},_create:function(){var d=this.element,c=this.options;this.keepNative="[data-role='none'], [data-role='nojs']"+(c.keepNative?", "+c.keepNative:"");if(this._trigger("beforeCreate")!==false){d.find("[data-role='page'], [data-role='content']").andSelf().each(function(){a(this).addClass("ui-"+  
a(this).data("role"))});d.find("[data-role='nojs']").addClass("ui-nojs");d.find("[data-role]").andSelf().each(function(){var f=a(this),b=f.data("role"),g=f.data("theme");if(b==="header"||b==="footer"){f.addClass("ui-bar-"+(g||f.parent("[data-role=page]").data("theme")||"a"));f.attr("role",b==="header"?"banner":"contentinfo");g=f.children("a");var e=g.hasClass("ui-btn-left"),i=g.hasClass("ui-btn-right");if(!e)e=g.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length;i||g.eq(1).addClass("ui-btn-right");  
c.addBackBtn&&b==="header"&&a(".ui-page").length>1&&d.data("url")!==a.mobile.path.stripHash(location.hash)&&!e&&f.data("backbtn")!==false&&a("<a href='#' class='ui-btn-left' data-rel='back' data-icon='arrow-l'>"+c.backBtnText+"</a>").prependTo(f);f.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({tabindex:"0",role:"heading","aria-level":"1"})}else if(b==="content"){g&&f.addClass("ui-body-"+g);f.attr("role","main")}else if(b==="page")f.addClass("ui-body-"+(g||"c"));switch(b){case "header":case "footer":case "page":case "content":f.addClass("ui-"+  
b);break;case "collapsible":case "fieldcontain":case "navbar":case "listview":case "dialog":f[b]()}});this._enhanceControls();d.find("[data-role='button'], .ui-bar > a, .ui-header > a, .ui-footer > a").not(".ui-btn").not(this.keepNative).buttonMarkup();d.find("[data-role='controlgroup']").controlgroup();d.find("a:not(.ui-btn):not(.ui-link-inherit)").not(this.keepNative).addClass("ui-link");d.fixHeaderFooter()}},_enhanceControls:function(){var d=this.options;this.element.find("input").not(this.keepNative).each(function(){var b=  
this.getAttribute("type"),g=d.degradeInputs[b]||"text";d.degradeInputs[b]&&a(this).replaceWith(a("<div>").html(a(this).clone()).html().replace(/type="([a-zA-Z]+)"/,"type="+g+" data-type='$1'"))});var c=this.element.find("input, textarea, select, button"),f=c.not(this.keepNative);c=c.filter("input[type=text]");c.length&&typeof c[0].autocorrect!=="undefined"&&c.each(function(){this.setAttribute("autocorrect","off");this.setAttribute("autocomplete","off")});f.filter("[type='radio'], [type='checkbox']").checkboxradio();  
f.filter("button, [type='button'], [type='submit'], [type='reset'], [type='image']").button();f.filter("input, textarea").not("[type='radio'], [type='checkbox'], [type='button'], [type='submit'], [type='reset'], [type='image'], [type='hidden']").textinput();f.filter("input, select").filter("[data-role='slider'], [data-type='range']").slider();f.filter("select:not([data-role='slider'])").selectmenu()}})})(jQuery);  
(function(a,d,c){a.extend(a.mobile,{subPageUrlKey:"ui-page",nonHistorySelectors:"dialog",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",ajaxEnabled:true,hashListeningEnabled:true,ajaxLinksEnabled:true,ajaxFormsEnabled:true,defaultTransition:"slide",loadingMessage:"loading",metaViewportContent:"width=device-width, minimum-scale=1, maximum-scale=1",gradeA:function(){return a.support.mediaquery},autoInitialize:true,keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,  
COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a(d.document).trigger("mobileinit");if(a.mobile.gradeA()){var f=a(d),b=a("html"),g=a("head"),e=a.mobile.loadingMessage?a("<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1>"+  
a.mobile.loadingMessage+"</h1></div>"):c;b.addClass("ui-mobile ui-mobile-rendering");a.mobile.metaViewportContent&&a("<meta>",{name:"viewport",content:a.mobile.metaViewportContent}).prependTo(g);a.extend(a.mobile,{pageLoading:function(i){if(i)b.removeClass("ui-loading");else{if(a.mobile.loadingMessage){i=a("."+a.mobile.activeBtnClass).first();e.appendTo(a.mobile.pageContainer).css({top:a.support.scrollTop&&a(d).scrollTop()+a(d).height()/2||i.length&&i.offset().top||100})}b.addClass("ui-loading")}},  
silentScroll:function(i){i=i||0;a.event.special.scrollstart.enabled=false;setTimeout(function(){d.scrollTo(0,i);a(document).trigger("silentscroll",{x:0,y:i})},20);setTimeout(function(){a.event.special.scrollstart.enabled=true},150)},initializePage:function(){var i=a("[data-role='page']");i.add("[data-role='dialog']").each(function(){a(this).attr("data-url",a(this).attr("id"))});a.mobile.firstPage=i.first();a.mobile.pageContainer=i.first().parent().addClass("ui-mobile-viewport");a.mobile.pageLoading();  
!a.mobile.hashListeningEnabled||!a.mobile.path.stripHash(location.hash)?a.mobile.changePage(a.mobile.firstPage,false,true,false,true):f.trigger("hashchange",[true])}});a.mobile.autoInitialize&&a(a.mobile.initializePage);f.load(a.mobile.silentScroll)}})(jQuery,this);  
(function(a,d){function c(l){if(i&&(!i.closest(".ui-page-active").length||l))i.removeClass(a.mobile.activeBtnClass);i=null}var f=a(window),b=a("html"),g=a("head"),e={get:function(l){if(l==d)l=location.hash;return e.stripHash(l).replace(/[^\/]*\.[^\/*]+$/,"")},getFilePath:function(l){var s="&"+a.mobile.subPageUrlKey;return l&&l.split(s)[0].split(t)[0]},set:function(l){location.hash=l},origin:"",setOrigin:function(){e.origin=e.get(location.protocol+"//"+location.host+location.pathname)},makeAbsolute:function(l){return e.get()+  
l},clean:function(l){return l.replace(location.protocol+"//"+location.host,"")},stripHash:function(l){return l.replace(/^#/,"")},isExternal:function(l){return e.hasProtocol(e.clean(l))},hasProtocol:function(l){return/^(:?\w+:)/.test(l)},isRelative:function(l){return/^[^\/|#]/.test(l)&&!e.hasProtocol(l)},isEmbeddedPage:function(l){return/^#/.test(l)}},i=null,h={stack:[],activeIndex:0,getActive:function(){return h.stack[h.activeIndex]},getPrev:function(){return h.stack[h.activeIndex-1]},getNext:function(){return h.stack[h.activeIndex+  
1]},addNew:function(l,s){h.getNext()&&h.clearForward();h.stack.push({url:l,transition:s});h.activeIndex=h.stack.length-1},clearForward:function(){h.stack=h.stack.slice(0,h.activeIndex+1)},ignoreNextHashChange:true},k="[tabindex],a,button:visible,select:visible,input",j=null,o=[],p=false,t="&ui-state=dialog",v=g.children("base"),m=location.protocol+"//"+location.host,r=e.get(m+location.pathname),n=r;if(v.length){var u=v.attr("href");if(u)n=u.search(/^[^:/]+:\/\/[^/]+\/?/)==-1?u.charAt(0)=="/"?m+u:  
r+u:u;n+=n.charAt(n.length-1)=="/"?" ":"/"}base=a.support.dynamicBaseTag?{element:v.length?v:a("<base>",{href:n}).prependTo(g),set:function(l){base.element.attr("href",n+e.get(l))},reset:function(){base.element.attr("href",n)}}:d;e.setOrigin();a.fn.animationComplete=function(l){if(a.support.cssTransitions)return a(this).one("webkitAnimationEnd",l);else setTimeout(l,0)};a.mobile.updateHash=e.set;a.mobile.path=e;a.mobile.base=base;a.mobile.urlstack=h.stack;a.mobile.urlHistory=h;a.mobile.changePage=  
function(l,s,q,w,z){function F(){function A(){if(w!==false&&x){h.ignoreNextHashChange=false;e.set(x)}!I&&!K&&h.addNew(x,s);c();a.mobile.silentScroll(l.data("lastScroll"));var G=l,P=G.find(".ui-title:eq(0)");P.length?P.focus():G.find(k).eq(0).focus();y&&y.data("page")._trigger("hide",null,{nextPage:l});l.data("page")._trigger("show",null,{prevPage:y||a("")});a.mobile.activePage=l;L!=null&&L.remove();b.removeClass("ui-mobile-rendering");p=false;o.length>0&&a.mobile.changePage.apply(a.mobile,o.pop())}  
function B(G){a.mobile.pageContainer.addClass(G);D.push(G)}a.mobile.silentScroll();var M=f.scrollTop(),J=["flip"],D=[];if(x.indexOf("&"+a.mobile.subPageUrlKey)>-1)l=a("[data-url='"+x+"']");if(y){y.data("lastScroll",M);y.data("page")._trigger("beforehide",{nextPage:l})}l.data("page")._trigger("beforeshow",{prevPage:y||a("")});if(s&&s!=="none"){a.mobile.pageLoading(true);a.inArray(s,J)>=0&&B("ui-mobile-viewport-perspective");B("ui-mobile-viewport-transitioning");if(y)y.addClass(s+" out "+(q?"reverse":  
""));l.addClass(a.mobile.activePageClass+" "+s+" in "+(q?"reverse":""));l.animationComplete(function(){y.add(l).removeClass("out in reverse "+s);y&&y.removeClass(a.mobile.activePageClass);A();a.mobile.pageContainer.removeClass(D.join(" "));D=[]})}else{a.mobile.pageLoading(true);y&&y.removeClass(a.mobile.activePageClass);l.addClass(a.mobile.activePageClass);A()}}function Q(){if(j||l.data("role")=="dialog"){x=h.getActive().url+t;if(j){l.attr("data-role",j);j=null}}l.page()}var E=a.type(l)==="array",  
H=a.type(l)==="object",y=E?l[0]:a.mobile.activePage;l=E?l[1]:l;var x=fileUrl=a.type(l)==="string"?e.stripHash(l):"",C=d,N="get",R=false,L=null,O=h.getActive(),I=false,K=false;if(!(O&&h.stack.length>1&&O.url===x&&!E&&!H))if(p)o.unshift(arguments);else{p=true;if(z){a.each(h.stack,function(A){if(this.url==x){urlIndex=A;I=A<h.activeIndex;K=!I;h.activeIndex=A}});if(I){q=true;s=s||O.transition}else if(K)s=s||h.getActive().transition}if(H&&l.url){x=l.url;C=l.data;N=l.type;R=true;if(C&&N=="get"){if(a.type(C)==  
"object")C=a.param(C);x+="?"+C;C=d}}base&&base.reset();a(window.document.activeElement).add("input:focus, textarea:focus, select:focus").blur();if(x){l=a("[data-url='"+x+"']");fileUrl=e.getFilePath(x)}else{E=l.attr("data-url");H=e.getFilePath(E);if(E!=H)fileUrl=H}if(s===d)s=a.mobile.defaultTransition;if(l.length&&!R){fileUrl&&base&&base.set(fileUrl);Q();F()}else{if(l.length)L=l;a.mobile.pageLoading();a.ajax({url:fileUrl,type:N,data:C,success:function(A){var B=/ data-url="(.*)"/.test(A)&&RegExp.$1;  
if(B){base&&base.set(B);x=fileUrl=e.getFilePath(B)}else base&&base.set(fileUrl);B=a("<div></div>");B.get(0).innerHTML=A;l=B.find('[data-role="page"], [data-role="dialog"]').first();if(!a.support.dynamicBaseTag){var M=e.get(fileUrl);l.find("[src],link[href]").each(function(){var J=a(this).is("[href]")?"href":"src",D=a(this).attr(J);D.replace(location.protocol+"//"+location.host+location.pathname,"");/^(\w+:|#|\/)/.test(D)||a(this).attr(J,M+D)})}l.attr("data-url",fileUrl).appendTo(a.mobile.pageContainer);  
Q();setTimeout(function(){F()},0)},error:function(){a.mobile.pageLoading(true);c(true);base&&base.set(e.get());a("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>Error Loading Page</h1></div>").css({display:"block",opacity:0.96,top:a(window).scrollTop()+100}).appendTo(a.mobile.pageContainer).delay(800).fadeOut(400,function(){a(this).remove()})}})}}};a("form[data-ajax!='false']").live("submit",function(l){if(a.mobile.ajaxEnabled&&a.mobile.ajaxFormsEnabled){var s=a(this).attr("method"),  
q=e.clean(a(this).attr("action"));if(!e.isExternal(q)){if(e.isRelative(q))q=e.makeAbsolute(q);a.mobile.changePage({url:q,type:s,data:a(this).serialize()},d,d,true);l.preventDefault()}}});a("a").live("click",function(l){var s=a(this),q=s.attr("href")||"#";q=e.clean(q);var w=s.is("[rel='external']"),z=e.isEmbeddedPage(q);w=e.isExternal(q)||w&&!z;z=s.is("[target]");var F=s.is("[data-ajax='false']");if(s.is("[data-rel='back']")){window.history.back();return false}if(q==="#")return false;i=s.closest(".ui-btn").addClass(a.mobile.activeBtnClass);  
if(w||F||z||!a.mobile.ajaxEnabled||!a.mobile.ajaxLinksEnabled){c(true);if(z)window.open(q);else if(F)return;else location.href=q}else{w=s.data("transition");z=(z=s.data("direction"))&&z=="reverse"||s.data("back");j=s.attr("data-rel");if(e.isRelative(q))q=e.makeAbsolute(q);q=e.stripHash(q);a.mobile.changePage(q,w,z)}l.preventDefault()});f.bind("hashchange",function(){var l=e.stripHash(location.hash),s=a.mobile.urlHistory.stack.length===0?false:d;if(!a.mobile.hashListeningEnabled||!h.ignoreNextHashChange||  
h.stack.length>1&&l.indexOf(t)>-1&&!a.mobile.activePage.is(".ui-dialog")){if(!h.ignoreNextHashChange)h.ignoreNextHashChange=true}else l?a.mobile.changePage(l,s,d,false,true):a.mobile.changePage(a.mobile.firstPage,s,true,false,true)})})(jQuery);  
(function(a,d){a.fn.fixHeaderFooter=function(){if(!a.support.scrollTop)return this;return this.each(function(){var c=a(this);c.data("fullscreen")&&c.addClass("ui-page-fullscreen");c.find('.ui-header[data-position="fixed"]').addClass("ui-header-fixed ui-fixed-inline fade");c.find('.ui-footer[data-position="fixed"]').addClass("ui-footer-fixed ui-fixed-inline fade")})};a.fixedToolbars=function(){function c(){if(!e&&g=="overlay"){i||a.fixedToolbars.hide(true);a.fixedToolbars.startShowTimer()}}function f(m){var r=  
0;if(m){var n=m.offsetParent,u=document.body;for(r=m.offsetTop;m&&m!=u;){r+=m.scrollTop||0;if(m==n){r+=n.offsetTop;n=m.offsetParent}m=m.parentNode}}return r}function b(m){var r=a(window).scrollTop(),n=f(m[0]),u=m.css("top")=="auto"?0:parseFloat(m.css("top")),l=window.innerHeight,s=m.outerHeight(),q=m.parents(".ui-page:not(.ui-page-fullscreen)").length;if(m.is(".ui-header-fixed")){u=r-n+u;if(u<n)u=0;return m.css("top",q?u:r)}else{u=r+l-s-(n-u);return m.css("top",q?u:r+l-s)}}if(a.support.scrollTop){var g=  
"inline",e=false,i,h,k=a.support.touch,j=k?"touchstart":"mousedown",o=k?"touchend":"mouseup",p=null,t=false,v=true;a(function(){a(document).bind(j,function(m){if(v)a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length||(p=g)}).bind(o,function(m){if(v)if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length)if(!t){a.fixedToolbars.toggle(p);p=null}}).bind("scrollstart",function(m){if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){t=  
true;if(p==null)p=g;if(e=(m=p=="overlay")||!!i){a.fixedToolbars.clearShowTimer();m&&a.fixedToolbars.hide(true)}}}).bind("scrollstop",function(m){if(!a(m.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){t=false;if(e){e=false;a.fixedToolbars.startShowTimer()}p=null}}).bind("silentscroll",c);a(window).bind("resize",c)});a(".ui-page").live("pagebeforeshow",function(m){m=a(m.target).find('[data-role="footer"]:not(.ui-sticky-footer)');var r=m.data("id");  
h=null;if(r){h=a('.ui-footer[data-id="'+r+'"].ui-sticky-footer');if(h.length==0){h=m;m=h.clone();h.addClass("ui-sticky-footer").before(m)}m.addClass("ui-footer-duplicate");h.appendTo(a.pageContainer).css("top",0);b(h)}});a(".ui-page").live("pageshow",function(m){h&&h.length&&h.appendTo(m.target).css("top",0);a.fixedToolbars.show(true,this)});return{show:function(m,r){a.fixedToolbars.clearShowTimer();g="overlay";return(r?a(r):a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var n=  
a(this),u=a(window).scrollTop(),l=f(n[0]),s=window.innerHeight,q=n.outerHeight();u=n.is(".ui-header-fixed")&&u<=l+q||n.is(".ui-footer-fixed")&&l<=u+s;n.addClass("ui-fixed-overlay").removeClass("ui-fixed-inline");!u&&!m&&n.animationComplete(function(){n.removeClass("in")}).addClass("in");b(n)})},hide:function(m){g="inline";return(a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var r=a(this),  
n=r.css("top");n=n=="auto"?0:parseFloat(n);r.addClass("ui-fixed-inline").removeClass("ui-fixed-overlay");if(n<0||r.is(".ui-header-fixed")&&n!=0)if(m)r.css("top",0);else r.css("top")!=="auto"&&parseFloat(r.css("top"))!==0&&r.animationComplete(function(){r.removeClass("out reverse");r.css("top",0)}).addClass("out reverse")})},startShowTimer:function(){a.fixedToolbars.clearShowTimer();var m=a.makeArray(arguments);i=setTimeout(function(){i=d;a.fixedToolbars.show.apply(null,m)},100)},clearShowTimer:function(){i&&  
clearTimeout(i);i=d},toggle:function(m){if(m)g=m;return g=="overlay"?a.fixedToolbars.hide():a.fixedToolbars.show()},setTouchToggleEnabled:function(m){v=m}}}}()})(jQuery);  
(function(a,d){a.widget("mobile.checkboxradio",a.mobile.widget,{options:{theme:null},_create:function(){var c=this,f=this.element,b=f.closest("form,fieldset,[data-role='page']").find("label[for='"+f.attr("id")+"']"),g=f.attr("type"),e="ui-icon-"+g+"-off";if(!(g!="checkbox"&&g!="radio")){if(!this.options.theme)this.options.theme=this.element.data("theme");b.buttonMarkup({theme:this.options.theme,icon:this.element.parents("[data-type='horizontal']").length?d:e,shadow:false});f.add(b).wrapAll("<div class='ui-"+  
g+"'></div>");b.bind({mouseover:function(){if(a(this).parent().is(".ui-disabled"))return false},touchmove:function(i){i=i.originalEvent.touches[0];if(b.data("movestart")){if(Math.abs(b.data("movestart")[0]-i.pageX)>10||Math.abs(abel.data("movestart")[1]-i.pageY)>10)b.data("moved",true)}else b.data("movestart",[parseFloat(i.pageX),parseFloat(i.pageY)])},"touchend mouseup":function(i){b.removeData("movestart");if(b.data("etype")&&b.data("etype")!==i.type||b.data("moved")){b.removeData("etype").removeData("moved");  
b.data("moved")&&b.removeData("moved");return false}b.data("etype",i.type);c._cacheVals();f.attr("checked",g==="radio"&&true||!f.is(":checked"));c._updateAll();i.preventDefault()},click:false});f.bind({mousedown:function(){this._cacheVals()},click:function(){c._updateAll()},focus:function(){b.addClass("ui-focus")},blur:function(){b.removeClass("ui-focus")}});this.refresh()}},_cacheVals:function(){this._getInputSet().each(function(){a(this).data("cacheVal",a(this).is(":checked"))})},_getInputSet:function(){return this.element.closest("form,fieldset,[data-role='page']").find("input[name='"+  
this.element.attr("name")+"'][type='"+this.element.attr("type")+"']")},_updateAll:function(){this._getInputSet().each(function(){var c=a(this).data("cacheVal");if(c&&c!==a(this).is(":checked")||a(this).is("[type='checkbox']"))a(this).trigger("change")}).checkboxradio("refresh")},refresh:function(){var c=this.element,f=c.closest("form,fieldset,[data-role='page']").find("label[for='"+c.attr("id")+"']"),b=c.attr("type"),g=f.find(".ui-icon"),e="ui-icon-"+b+"-on";b="ui-icon-"+b+"-off";if(c[0].checked){f.addClass("ui-btn-active");  
g.addClass(e);g.removeClass(b)}else{f.removeClass("ui-btn-active");g.removeClass(e);g.addClass(b)}c.is(":disabled")?this.disable():this.enable()},disable:function(){this.element.attr("disabled",true).parent().addClass("ui-disabled")},enable:function(){this.element.attr("disabled",false).parent().removeClass("ui-disabled")}})})(jQuery);  
(function(a){a.widget("mobile.textinput",a.mobile.widget,{options:{theme:null},_create:function(){var d=this.element,c=this.options,f=c.theme;if(!f){f=this.element.closest("[class*='ui-bar-'],[class*='ui-body-']");f=f.length?/ui-(bar|body)-([a-z])/.exec(f.attr("class"))[2]:"c"}f=" ui-body-"+f;a("label[for="+d.attr("id")+"]").addClass("ui-input-text");d.addClass("ui-input-text ui-body-"+c.theme);var b=d;if(d.is('[type="search"],[data-type="search"]')){b=d.wrap('<div class="ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield'+  
f+'"></div>').parent();var g=a('<a href="#" class="ui-input-clear" title="clear text">clear text</a>').tap(function(h){d.val("").focus();d.trigger("change");g.addClass("ui-input-clear-hidden");h.preventDefault()}).appendTo(b).buttonMarkup({icon:"delete",iconpos:"notext",corners:true,shadow:true});c=function(){d.val()==""?g.addClass("ui-input-clear-hidden"):g.removeClass("ui-input-clear-hidden")};c();d.keyup(c)}else d.addClass("ui-corner-all ui-shadow-inset"+f);d.focus(function(){b.addClass("ui-focus")}).blur(function(){b.removeClass("ui-focus")});  
if(d.is("textarea")){var e=function(){var h=d[0].scrollHeight;d[0].clientHeight<h&&d.css({height:h+15})},i;d.keyup(function(){clearTimeout(i);i=setTimeout(e,100)})}},disable:function(){(this.element.attr("disabled",true).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).addClass("ui-disabled")},enable:function(){(this.element.attr("disabled",false).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).removeClass("ui-disabled")}})})(jQuery);  
(function(a){a.widget("mobile.selectmenu",a.mobile.widget,{options:{theme:null,disabled:false,icon:"arrow-d",iconpos:"right",inline:null,corners:true,shadow:true,iconshadow:true,menuPageTheme:"b",overlayTheme:"a",hidePlaceholderMenuItems:true,closeText:"Close",nativeMenu:false},_create:function(){var d=this,c=this.options,f=this.element.wrap("<div class='ui-select'>"),b=f.attr("id"),g=a("label[for="+b+"]").addClass("ui-select"),e=(d.options.nativeMenu?a("<div/>"):a("<a>",{href:"#",role:"button",id:k,  
"aria-haspopup":"true","aria-owns":j})).text(a(f[0].options.item(f[0].selectedIndex)).text()).insertBefore(f).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}),i=d.isMultiple=f[0].multiple;c.nativeMenu&&window.opera&&window.opera.version&&f.addClass("ui-select-nativeonly");if(!c.nativeMenu){var h=f.find("option"),k=b+"-button",j=b+"-menu",o=f.closest(".ui-page"),p=/ui-btn-up-([a-z])/.exec(e.attr("class"))[1],t=a("<div data-role='dialog' data-theme='"+  
c.menuPageTheme+"'><div data-role='header'><div class='ui-title'>"+g.text()+"</div></div><div data-role='content'></div></div>").appendTo(a.mobile.pageContainer).page(),v=t.find(".ui-content"),m=t.find(".ui-header a"),r=a("<div>",{"class":"ui-selectmenu-screen ui-screen-hidden"}).appendTo(o),n=a("<div>",{"class":"ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all pop ui-body-"+c.overlayTheme}).insertAfter(r),u=a("<ul>",{"class":"ui-selectmenu-list",id:j,role:"listbox","aria-labelledby":k,  
"data-theme":p}).appendTo(n);p=a("<div>",{"class":"ui-header ui-bar-"+p}).prependTo(n);var l=a("<h1>",{"class":"ui-title"}).appendTo(p),s=a("<a>",{"data-iconpos":"notext","data-icon":"delete",text:c.closeText,href:"#","class":"ui-btn-left"}).appendTo(p).buttonMarkup()}if(i)d.buttonCount=a("<span>").addClass("ui-li-count ui-btn-up-c ui-btn-corner-all").hide().appendTo(e);c.disabled&&this.disable();f.change(function(){d.refresh()});a.extend(d,{select:f,optionElems:h,selectID:b,label:g,buttonId:k,menuId:j,  
thisPage:o,button:e,menuPage:t,menuPageContent:v,screen:r,listbox:n,list:u,menuType:void 0,header:p,headerClose:s,headerTitle:l,placeholder:""});if(c.nativeMenu){f.appendTo(e).bind("touchstart mousedown",function(){e.addClass(a.mobile.activeBtnClass)}).bind("focus mouseover",function(){e.trigger("mouseover")}).bind("touchmove",function(){e.removeClass(a.mobile.activeBtnClass)}).bind("change blur mouseout",function(){e.trigger("mouseout").removeClass(a.mobile.activeBtnClass)});e.attr("tabindex","-1")}else{d.refresh();  
f.attr("tabindex","-1").focus(function(){a(this).blur();e.focus()});e.bind("touchstart",function(q){a(this).data("startTouches",a.extend({},q.originalEvent.touches[0]))}).bind(a.support.touch?"touchend":"mouseup",function(q){a(this).data("moved")?a(this).removeData("moved"):d.open();q.preventDefault()}).bind("touchmove",function(q){q=q.originalEvent.touches[0];var w=a(this).data("startTouches"),z=Math.abs(q.pageY-w.pageY);if(Math.abs(q.pageX-w.pageX)>10||z>10)a(this).data("moved",true)});u.delegate("li:not(.ui-disabled, .ui-li-divider)",  
"click",function(q){if(a(q.target).is("a")){var w=u.find("li:not(.ui-li-divider)").index(this);w=d.optionElems.eq(w)[0];w.selected=i?!w.selected:true;i&&a(this).find(".ui-icon").toggleClass("ui-icon-checkbox-on",w.selected).toggleClass("ui-icon-checkbox-off",!w.selected);f.trigger("change");i||d.close();q.preventDefault()}});r.add(s).add(m).bind("click",function(q){d.close();q.preventDefault();a.contains(m[0],q.target)&&q.stopImmediatePropagation()})}},_buildList:function(){var d=this,c=this.options,  
f=this.placeholder,b=[],g=[],e=d.isMultiple?"checkbox-off":"false";d.list.empty().filter(".ui-listview").listview("destroy");d.select.find("option").each(function(){var i=a(this),h=i.parent(),k=i.text(),j="<a href='#'>"+k+"</a>",o=[],p=[];if(h.is("optgroup")){h=h.attr("label");if(a.inArray(h,b)===-1){g.push("<li data-role='list-divider'>"+h+"</li>");b.push(h)}}if(!this.getAttribute("value")||k.length==0||i.data("placeholder")){c.hidePlaceholderMenuItems&&o.push("ui-selectmenu-placeholder");f=d.placeholder=  
k}if(this.disabled){o.push("ui-disabled");p.push("aria-disabled='true'")}g.push("<li data-icon='"+e+"' class='"+o.join(" ")+"' "+p.join(" ")+">"+j+"</li>")});d.list.html(g.join(" "));this.isMultiple||this.headerClose.hide();!this.isMultiple&&!f.length?this.header.hide():this.headerTitle.text(this.placeholder);d.list.listview()},refresh:function(d){var c=this,f=this.element,b=this.isMultiple,g=this.optionElems=f.find("option"),e=g.filter(":selected"),i=e.map(function(){return g.index(this)}).get();  
if(!c.options.nativeMenu&&(d||f[0].options.length>c.list.find("li").length))c._buildList();c.button.find(".ui-btn-text").text(function(){if(!b)return e.text();return e.length?e.map(function(){return a(this).text()}).get().join(", "):c.placeholder});if(b)c.buttonCount[e.length>1?"show":"hide"]().text(e.length);c.options.nativeMenu||c.list.find("li:not(.ui-li-divider)").removeClass(a.mobile.activeBtnClass).attr("aria-selected",false).each(function(h){if(a.inArray(h,i)>-1){h=a(this).addClass(a.mobile.activeBtnClass);  
h.find("a").attr("aria-selected",true);b&&h.find(".ui-icon").removeClass("ui-icon-checkbox-off").addClass("ui-icon-checkbox-on")}})},open:function(){function d(){c.list.find(".ui-btn-active").focus()}if(!(this.options.disabled||this.options.nativeMenu)){var c=this,f=c.list.outerHeight(),b=c.list.outerWidth(),g=a(window).scrollTop(),e=c.button.offset().top,i=window.innerHeight,h=c.list.parents(".ui-dialog").length;c.button.addClass(a.mobile.activeBtnClass);if(h||f>i-80||!a.support.scrollTop){g==0&&  
e>i&&c.thisPage.one("pagehide",function(){a(this).data("lastScroll",e)});c.menuPage.one("pageshow",function(){a(window).one("silentscroll",function(){d()})});c.menuType="page";c.menuPageContent.append(c.list);a.mobile.changePage(c.menuPage,"pop",false,true)}else{c.menuType="overlay";c.screen.height(a(document).height()).removeClass("ui-screen-hidden");h=e-g;var k=g+i-e,j=f/2;f=h>f/2&&k>f/2?e+c.button.outerHeight()/2-j:h>k?g+i-f-30:g+30;b=c.button.offset().left+c.button.outerWidth()/2-b/2;c.listbox.append(c.list).removeClass("ui-selectmenu-hidden").css({top:f,  
left:b}).addClass("in");d()}setTimeout(function(){c.isOpen=true},400)}},close:function(){function d(){setTimeout(function(){c.button.focus();c.button.removeClass(a.mobile.activeBtnClass)},40);c.listbox.removeAttr("style").append(c.list)}if(!(this.options.disabled||!this.isOpen||this.options.nativeMenu)){var c=this;if(c.menuType=="page"){a.mobile.changePage([c.menuPage,c.thisPage],"pop",true,false);c.menuPage.one("pagehide",d)}else{c.screen.addClass("ui-screen-hidden");c.listbox.addClass("ui-selectmenu-hidden").removeAttr("style").removeClass("in");  
d()}this.isOpen=false}},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)}})})(jQuery);  
(function(a){a.fn.buttonMarkup=function(c){return this.each(function(){var f=a(this),b=a.extend({},a.fn.buttonMarkup.defaults,f.data(),c),g,e="ui-btn-inner",i;d&&d();if(!b.theme){g=f.closest("[class*='ui-bar-'],[class*='ui-body-']");b.theme=g.length?/ui-(bar|body)-([a-z])/.exec(g.attr("class"))[2]:"c"}g="ui-btn ui-btn-up-"+b.theme;if(b.inline)g+=" ui-btn-inline";if(b.icon){b.icon="ui-icon-"+b.icon;b.iconpos=b.iconpos||"left";i="ui-icon "+b.icon;if(b.shadow)i+=" ui-icon-shadow"}if(b.iconpos){g+=" ui-btn-icon-"+  
b.iconpos;b.iconpos=="notext"&&!f.attr("title")&&f.attr("title",f.text())}if(b.corners){g+=" ui-btn-corner-all";e+=" ui-btn-corner-all"}if(b.shadow)g+=" ui-shadow";f.attr("data-theme",b.theme).addClass(g);b=("<D class='"+e+"'><D class='ui-btn-text'></D>"+(b.icon?"<span class='"+i+"'></span>":"")+"</D>").replace(/D/g,b.wrapperEls);f.wrapInner(b)})};a.fn.buttonMarkup.defaults={corners:true,shadow:true,iconshadow:true,wrapperEls:"span"};var d=function(){a(".ui-btn:not(.ui-disabled)").live({"touchstart mousedown":function(){var c=  
a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-down-"+c)},"touchmove touchend mouseup":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-down-"+c).addClass("ui-btn-up-"+c)},"mouseover focus":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-hover-"+c)},"mouseout blur":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-hover-"+c).addClass("ui-btn-up-"+c)}});d=null}})(jQuery);  
(function(a){a.widget("mobile.button",a.mobile.widget,{options:{theme:null,icon:null,iconpos:null,inline:null,corners:true,shadow:true,iconshadow:true},_create:function(){var d=this.element,c=this.options;this.button=a("<div></div>").text(d.text()||d.val()).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}).insertBefore(d).append(d.addClass("ui-btn-hidden"));d.attr("type")!=="reset"&&d.click(function(){var f=a("<input>",  
{type:"hidden",name:d.attr("name"),value:d.attr("value")}).insertBefore(d);a(document).submit(function(){f.remove()})})},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);  
(function(a){a.widget("mobile.slider",a.mobile.widget,{options:{theme:null,trackTheme:null,disabled:false},_create:function(){var d=this,c=this.element,f=c.parents("[class*=ui-bar-],[class*=ui-body-]").eq(0);f=f.length?f.attr("class").match(/ui-(bar|body)-([a-z])/)[2]:"c";var b=this.options.theme?this.options.theme:f,g=this.options.trackTheme?this.options.trackTheme:f,e=c[0].nodeName.toLowerCase();f=e=="select"?"ui-slider-switch":"";var i=c.attr("id"),h=i+"-label";i=a("[for="+i+"]").attr("id",h);  
var k=function(){return e=="input"?parseFloat(c.val()):c[0].selectedIndex},j=e=="input"?parseFloat(c.attr("min")):0,o=e=="input"?parseFloat(c.attr("max")):c.find("option").length-1,p=window.parseFloat(c.attr("step")||1),t=a('<div class="ui-slider '+f+" ui-btn-down-"+g+' ui-btn-corner-all" role="application"></div>'),v=a('<a href="#" class="ui-slider-handle"></a>').appendTo(t).buttonMarkup({corners:true,theme:b,shadow:true}).attr({role:"slider","aria-valuemin":j,"aria-valuemax":o,"aria-valuenow":k(),  
"aria-valuetext":k(),title:k(),"aria-labelledby":h});a.extend(this,{slider:t,handle:v,dragging:false,beforeStart:null});if(e=="select"){t.wrapInner('<div class="ui-slider-inneroffset"></div>');c.find("option");c.find("option").each(function(m){var r=m==0?"b":"a",n=m==0?"right":"left";m=m==0?" ui-btn-down-"+g:" ui-btn-active";a('<div class="ui-slider-labelbg ui-slider-labelbg-'+r+m+" ui-btn-corner-"+n+'"></div>').prependTo(t);a('<span class="ui-slider-label ui-slider-label-'+r+m+" ui-btn-corner-"+  
n+'" role="img">'+a(this).text()+"</span>").prependTo(v)})}i.addClass("ui-slider");c.addClass(e=="input"?"ui-slider-input":"ui-slider-switch").change(function(){d.refresh(k(),true)}).keyup(function(){d.refresh(k(),true,true)}).blur(function(){d.refresh(k(),true)});a(document).bind("touchmove mousemove",function(m){if(d.dragging){d.refresh(m);return false}});t.bind("touchstart mousedown",function(m){d.dragging=true;if(e==="select")d.beforeStart=c[0].selectedIndex;d.refresh(m);return false});t.add(document).bind("touchend mouseup",  
function(){if(d.dragging){d.dragging=false;if(e==="select"){if(d.beforeStart===c[0].selectedIndex)d.refresh(d.beforeStart===0?1:0);var m=k();m=Math.round(m/(o-j)*100);v.addClass("ui-slider-handle-snapping").css("left",m+"%").animationComplete(function(){v.removeClass("ui-slider-handle-snapping")})}return false}});t.insertAfter(c);this.handle.bind("touchstart mousedown",function(){a(this).focus()});this.handle.bind("keydown",function(m){var r=k();if(!d.options.disabled){switch(m.keyCode){case a.mobile.keyCode.HOME:case a.mobile.keyCode.END:case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:m.preventDefault();  
if(!d._keySliding){d._keySliding=true;a(this).addClass("ui-state-active")}}switch(m.keyCode){case a.mobile.keyCode.HOME:d.refresh(j);break;case a.mobile.keyCode.END:d.refresh(o);break;case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:d.refresh(r+p);break;case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:d.refresh(r-p)}}}).keyup(function(){if(d._keySliding){d._keySliding=false;a(this).removeClass("ui-state-active")}});this.refresh()},  
refresh:function(d,c,f){if(!this.options.disabled){var b=this.element,g=b[0].nodeName.toLowerCase(),e=g==="input"?parseFloat(b.attr("min")):0,i=g==="input"?parseFloat(b.attr("max")):b.find("option").length-1;if(typeof d==="object"){d=d.originalEvent.touches?d.originalEvent.touches[0]:d;if(!this.dragging||d.pageX<this.slider.offset().left-8||d.pageX>this.slider.offset().left+this.slider.width()+8)return;d=Math.round((d.pageX-this.slider.offset().left)/this.slider.width()*100)}else{if(d==null)d=g===  
"input"?parseFloat(b.val()):b[0].selectedIndex;d=(parseFloat(d)-e)/(i-e)*100}if(!isNaN(d)){if(d<0)d=0;if(d>100)d=100;var h=Math.round(d/100*(i-e))+e;if(h<e)h=e;if(h>i)h=i;this.handle.css("left",d+"%");this.handle.attr({"aria-valuenow":g==="input"?h:b.find("option").eq(h).attr("value"),"aria-valuetext":g==="input"?h:b.find("option").eq(h).text(),title:h});if(g==="select")h===0?this.slider.addClass("ui-slider-switch-a").removeClass("ui-slider-switch-b"):this.slider.addClass("ui-slider-switch-b").removeClass("ui-slider-switch-a");  
if(!f){if(g==="input")b.val(h);else b[0].selectedIndex=h;c||b.trigger("change")}}}},enable:function(){this.element.attr("disabled",false);this.slider.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.slider.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);  
(function(a){a.widget("mobile.collapsible",a.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:false,heading:">:header,>legend",theme:null,iconTheme:"d"},_create:function(){var d=this.element,c=this.options,f=d.addClass("ui-collapsible-contain"),b=d.find(c.heading).eq(0),g=f.wrapInner('<div class="ui-collapsible-content"></div>').find(".ui-collapsible-content");d=d.closest('[data-role="collapsible-set"]').addClass("ui-collapsible-set");  
if(b.is("legend")){b=a('<div role="heading">'+b.html()+"</div>").insertBefore(b);b.next().remove()}b.insertBefore(g);b.addClass("ui-collapsible-heading").append('<span class="ui-collapsible-heading-status"></span>').wrapInner('<a href="#" class="ui-collapsible-heading-toggle"></a>').find("a:eq(0)").buttonMarkup({shadow:!!!d.length,corners:false,iconPos:"left",icon:"plus",theme:c.theme}).find(".ui-icon").removeAttr("class").buttonMarkup({shadow:true,corners:true,iconPos:"notext",icon:"plus",theme:c.iconTheme});  
if(d.length)f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom");else b.find("a:eq(0)").addClass("ui-corner-all").find(".ui-btn-inner").addClass("ui-corner-all");f.bind("collapse",function(e){if(!e.isDefaultPrevented()){e.preventDefault();b.addClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.expandCueText);b.find(".ui-icon").removeClass("ui-icon-minus").addClass("ui-icon-plus");g.addClass("ui-collapsible-content-collapsed").attr("aria-hidden",  
true);f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom")}}).bind("expand",function(e){if(!e.isDefaultPrevented()){e.preventDefault();b.removeClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.collapseCueText);b.find(".ui-icon").removeClass("ui-icon-plus").addClass("ui-icon-minus");g.removeClass("ui-collapsible-content-collapsed").attr("aria-hidden",false);f.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").removeClass("ui-corner-bottom")}}).trigger(c.collapsed?  
"collapse":"expand");if(d.length&&!d.data("collapsiblebound")){d.data("collapsiblebound",true).bind("expand",function(e){a(this).find(".ui-collapsible-contain").not(a(e.target).closest(".ui-collapsible-contain")).not("> .ui-collapsible-contain .ui-collapsible-contain").trigger("collapse")});d=d.find("[data-role=collapsible]");d.first().find("a:eq(0)").addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top");d.last().data("collapsible-last",true)}b.bind(a.support.touch?"touchstart":  
"click",function(){b.is(".ui-collapsible-heading-collapsed")?f.trigger("expand"):f.trigger("collapse");return false})}})})(jQuery);  
(function(a){a.fn.controlgroup=function(d){return this.each(function(){function c(e){e.removeClass("ui-btn-corner-all ui-shadow").eq(0).addClass(g[0]).end().filter(":last").addClass(g[1]).addClass("ui-controlgroup-last")}var f=a.extend({direction:a(this).data("type")||"vertical",shadow:false},d),b=a(this).find(">legend"),g=f.direction=="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"];a(this).find("input:eq(0)").attr("type");if(b.length){a(this).wrapInner('<div class="ui-controlgroup-controls"></div>');  
a('<div role="heading" class="ui-controlgroup-label">'+b.html()+"</div>").insertBefore(a(this).children(0));b.remove()}a(this).addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+f.direction);c(a(this).find(".ui-btn"));c(a(this).find(".ui-btn-inner"));f.shadow&&a(this).addClass("ui-shadow")})}})(jQuery);(function(a){a.fn.fieldcontain=function(){return this.addClass("ui-field-contain ui-body ui-br")}})(jQuery);  
(function(a){a.widget("mobile.listview",a.mobile.widget,{options:{theme:"c",countTheme:"c",headerTheme:"b",dividerTheme:"b",splitIcon:"arrow-r",splitTheme:"b",inset:false},_create:function(){var d=this.element,c=this.options;d.addClass("ui-listview").attr("role","listbox");c.inset&&d.addClass("ui-listview-inset ui-corner-all ui-shadow");d.delegate(".ui-li","focusin",function(){a(this).attr("tabindex","0")});this._itemApply(d,d);this.refresh(true);d.keydown(function(f){var b=a(f.target),g=b.closest("li");  
switch(f.keyCode){case 38:f=g.prev();if(f.length){b.blur().attr("tabindex","-1");f.find("a").first().focus()}return false;case 40:f=g.next();if(f.length){b.blur().attr("tabindex","-1");f.find("a").first().focus()}return false;case 39:f=g.find("a.ui-li-link-alt");if(f.length){b.blur();f.first().focus()}return false;case 37:f=g.find("a.ui-link-inherit");if(f.length){b.blur();f.first().focus()}return false;case 13:case 32:b.trigger("click");return false}});d.delegate("li","click",function(f){if(!a(f.target).closest("a").length){a(this).find("a").first().trigger("click");  
return false}})},_itemApply:function(d,c){c.find(".ui-li-count").addClass("ui-btn-up-"+(d.data("counttheme")||this.options.countTheme)+" ui-btn-corner-all");c.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading");c.find("p, dl").addClass("ui-li-desc");c.find("li").find("img:eq(0)").addClass("ui-li-thumb").each(function(){a(this).closest("li").addClass(a(this).is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb")});var f=c.find(".ui-li-aside");f.length&&f.each(function(b,g){a(g).prependTo(a(g).parent())});  
a.support.cssPseudoElement||a.nodeName(c[0],"ol")},_removeCorners:function(d){d.add(d.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb")).removeClass("ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl")},refresh:function(d){this._createSubPages();var c=this.options,f=this.element,b=this,g=f.data("dividertheme")||c.dividerTheme,e=f.children("li"),i=a.support.cssPseudoElement||!a.nodeName(f[0],"ol")?0:1;i&&f.find(".ui-li-dec").remove();e.attr({role:"option",tabindex:"-1"});  
e.first().attr("tabindex","0");e.each(function(h){var k=a(this),j="ui-li";if(!(!d&&k.hasClass("ui-li"))){var o=k.data("theme")||c.theme,p=k.find("a");if(p.length){var t=k.data("icon");k.buttonMarkup({wrapperEls:"div",shadow:false,corners:false,iconpos:"right",icon:p.length>1||t===false?false:t||"arrow-r",theme:o});p.first().addClass("ui-link-inherit");if(p.length>1){j+=" ui-li-has-alt";p=p.last();t=f.data("splittheme")||p.data("theme")||c.splitTheme;p.appendTo(k).attr("title",p.text()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:false,  
corners:false,theme:o,icon:false,iconpos:false}).find(".ui-btn-inner").append(a("<span>").buttonMarkup({shadow:true,corners:true,theme:t,iconpos:"notext",icon:f.data("spliticon")||p.data("icon")||c.splitIcon}))}}else if(k.data("role")==="list-divider"){j+=" ui-li-divider ui-btn ui-bar-"+g;k.attr("role","heading");if(i)i=1}else j+=" ui-li-static ui-btn-up-"+o;if(c.inset){if(h===0){j+=" ui-corner-top";k.add(k.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-tr").end().find(".ui-li-thumb").addClass("ui-corner-tl");  
k.next().next().length&&b._removeCorners(k.next())}if(h===e.length-1){j+=" ui-corner-bottom";k.add(k.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").addClass("ui-corner-bl");k.prev().prev().length&&b._removeCorners(k.prev())}}i&&j.indexOf("ui-li-divider")<0&&k.find(".ui-link-inherit").first().addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+i++ +". </span>");k.addClass(j);d||b._itemApply(f,k)}})},_idStringEscape:function(d){return d.replace(/[^a-zA-Z0-9]/g,  
"-")},_createSubPages:function(){var d=this.element,c=d.closest(".ui-page"),f=c.data("url"),b=this.options,g=this,e=c.find("[data-role='footer']").data("id");a(d.find("ul, ol").toArray().reverse()).each(function(i){var h=a(this),k=h.parent(),j=a.trim(k.contents()[0].nodeValue)||k.find("a:first").text();i=f+"&"+a.mobile.subPageUrlKey+"="+g._idStringEscape(j+" "+i);var o=h.data("theme")||b.theme,p=h.data("counttheme")||d.data("counttheme")||b.countTheme;h.wrap("<div data-role='page'><div data-role='content'></div></div>").parent().before("<div data-role='header' data-theme='"+  
b.headerTheme+"'><div class='ui-title'>"+j+"</div></div>").after(e?a("<div>",{"data-role":"footer","data-id":e,"class":"ui-footer-duplicate"}):"").parent().attr({"data-url":i,"data-theme":o,"data-count-theme":p}).appendTo(a.mobile.pageContainer).page();h=k.find("a:first");h.length||(h=a("<a></a>").html(j).prependTo(k.empty()));h.attr("href","#"+i)}).listview()}})})(jQuery);  
(function(a){a.mobile.listview.prototype.options.filter=false;a("[data-role='listview']").live("listviewcreate",function(){var d=a(this);if(d.data("listview").options.filter){var c=a("<form>",{"class":"ui-listview-filter ui-bar-c",role:"search"});a("<input>",{placeholder:"Filter results...","data-type":"search"}).bind("keyup change",function(){var f=this.value.toLowerCase();d.children().show();f&&d.children().filter(function(){return a(this).text().toLowerCase().indexOf(f)===-1}).hide()}).appendTo(c).textinput();  
c.insertBefore(d)}})})(jQuery);  
(function(a){a.widget("mobile.dialog",a.mobile.widget,{options:{},_create:function(){this.element.attr("role","dialog").addClass("ui-page ui-dialog ui-body-a").find("[data-role=header]").addClass("ui-corner-top ui-overlay-shadow").prepend('<a href="#" data-icon="delete" data-rel="back" data-iconpos="notext">Close</a>').end().find('.ui-content:not([class*="ui-body-"])').addClass("ui-body-c").end().find(".ui-content,[data-role=footer]").last().addClass("ui-corner-bottom ui-overlay-shadow");this.element.bind("click submit",  
function(d){d=d.type=="click"?a(d.target).closest("a"):a(d.target).closest("form");d.length&&!d.data("transition")&&d.attr("data-transition",a.mobile.urlHistory.getActive().transition).attr("data-direction","reverse")})},close:function(){window.history.back()}})})(jQuery);  
(function(a,d){a.widget("mobile.navbar",a.mobile.widget,{options:{iconpos:"top",grid:null},_create:function(){var c=this.element,f=c.find("a"),b=f.filter("[data-icon]").length?this.options.iconpos:d;c.addClass("ui-navbar").attr("role","navigation").find("ul").grid({grid:this.options.grid});b||c.addClass("ui-navbar-noicons");f.buttonMarkup({corners:false,shadow:false,iconpos:b});c.delegate("a","click",function(){f.removeClass("ui-btn-active");a(this).addClass("ui-btn-active")})}})})(jQuery);  
(function(a){a.fn.grid=function(d){return this.each(function(){var c=a.extend({grid:null},d),f=a(this).children(),b={a:2,b:3,c:4,d:5};c=c.grid;if(!c)if(f.length<=5)for(var g in b){if(b[g]==f.length)c=g}else c="a";b=b[c];a(this).addClass("ui-grid-"+c);f.filter(":nth-child("+b+"n+1)").addClass("ui-block-a");f.filter(":nth-child("+b+"n+2)").addClass("ui-block-b");b>2&&f.filter(":nth-child(3n+3)").addClass("ui-block-c");b>3&&f.filter(":nth-child(4n+4)").addClass("ui-block-d");b>4&&f.filter(":nth-child(5n+5)").addClass("ui-block-e")})}})(jQuery);  
 
/*  
* jQuery UI Effects @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Effects/  
*/  
;jQuery.effects || (function($, undefined) {  
 
$.effects = {};  
 
 
 
/******************************************************************************/  
/****************************** COLOR ANIMATIONS ******************************/  
/******************************************************************************/  
 
// override the animation for color styles  
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',  
'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],  
function(i, attr) {  
$.fx.step[attr] = function(fx) {  
if (!fx.colorInit) {  
fx.start = getColor(fx.elem, attr);  
fx.end = getRGB(fx.end);  
fx.colorInit = true;  
}  
 
fx.elem.style[attr] = 'rgb(' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +  
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';  
};  
});  
 
// Color Conversion functions from highlightFade  
// By Blair Mitchelmore  
// http://jquery.offput.ca/highlightFade/  
 
// Parse strings looking for color tuples [255,255,255]  
function getRGB(color) {  
var result;  
 
// Check if we're already dealing with an array of colors  
if ( color && color.constructor == Array && color.length == 3 )  
return color;  
 
// Look for rgb(num,num,num)  
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))  
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];  
 
// Look for rgb(num%,num%,num%)  
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))  
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];  
 
// Look for #a0b1c2  
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))  
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];  
 
// Look for #fff  
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))  
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];  
 
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3  
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))  
return colors['transparent'];  
 
// Otherwise, we're most likely dealing with a named color  
return colors[$.trim(color).toLowerCase()];  
}  
 
function getColor(elem, attr) {  
var color;  
 
do {  
color = $.curCSS(elem, attr);  
 
// Keep going until we find an element that has color, or we hit the body  
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )  
break;  
 
attr = "backgroundColor";  
} while ( elem = elem.parentNode );  
 
return getRGB(color);  
};  
 
// Some named colors to work with  
// From Interface by Stefan Petre  
// http://interface.eyecon.ro/  
 
var colors = {  
aqua:[0,255,255],  
azure:[240,255,255],  
beige:[245,245,220],  
black:[0,0,0],  
blue:[0,0,255],  
brown:[165,42,42],  
cyan:[0,255,255],  
darkblue:[0,0,139],  
darkcyan:[0,139,139],  
darkgrey:[169,169,169],  
darkgreen:[0,100,0],  
darkkhaki:[189,183,107],  
darkmagenta:[139,0,139],  
darkolivegreen:[85,107,47],  
darkorange:[255,140,0],  
darkorchid:[153,50,204],  
darkred:[139,0,0],  
darksalmon:[233,150,122],  
darkviolet:[148,0,211],  
fuchsia:[255,0,255],  
gold:[255,215,0],  
green:[0,128,0],  
indigo:[75,0,130],  
khaki:[240,230,140],  
lightblue:[173,216,230],  
lightcyan:[224,255,255],  
lightgreen:[144,238,144],  
lightgrey:[211,211,211],  
lightpink:[255,182,193],  
lightyellow:[255,255,224],  
lime:[0,255,0],  
magenta:[255,0,255],  
maroon:[128,0,0],  
navy:[0,0,128],  
olive:[128,128,0],  
orange:[255,165,0],  
pink:[255,192,203],  
purple:[128,0,128],  
violet:[128,0,128],  
red:[255,0,0],  
silver:[192,192,192],  
white:[255,255,255],  
yellow:[255,255,0],  
transparent: [255,255,255]  
};  
 
 
 
/******************************************************************************/  
/****************************** CLASS ANIMATIONS ******************************/  
/******************************************************************************/  
 
var classAnimationActions = ['add', 'remove', 'toggle'],  
shorthandStyles = {  
border: 1,  
borderBottom: 1,  
borderColor: 1,  
borderLeft: 1,  
borderRight: 1,  
borderTop: 1,  
borderWidth: 1,  
margin: 1,  
padding: 1  
};  
 
function getElementStyles() {  
var style = document.defaultView  
? document.defaultView.getComputedStyle(this, null)  
: this.currentStyle,  
newStyle = {},  
key,  
camelCase;  
 
// webkit enumerates style porperties  
if (style && style.length && style[0] && style[style[0]]) {  
var len = style.length;  
while (len--) {  
key = style[len];  
if (typeof style[key] == 'string') {  
camelCase = key.replace(/\-(\w)/g, function(all, letter){  
return letter.toUpperCase();  
});  
newStyle[camelCase] = style[key];  
}  
}  
} else {  
for (key in style) {  
if (typeof style[key] === 'string') {  
newStyle[key] = style[key];  
}  
}  
}  
 
return newStyle;  
}  
 
function filterStyles(styles) {  
var name, value;  
for (name in styles) {  
value = styles[name];  
if (  
// ignore null and undefined values  
value == null ||  
// ignore functions (when does this occur?)  
$.isFunction(value) ||  
// shorthand styles that need to be expanded  
name in shorthandStyles ||  
// ignore scrollbars (break in IE)  
(/scrollbar/).test(name) ||  
 
// only colors or values that can be converted to numbers  
(!(/color/i).test(name) && isNaN(parseFloat(value)))  
) {  
delete styles[name];  
}  
}  
 
return styles;  
}  
 
function styleDifference(oldStyle, newStyle) {  
var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459  
name;  
 
for (name in newStyle) {  
if (oldStyle[name] != newStyle[name]) {  
diff[name] = newStyle[name];  
}  
}  
 
return diff;  
}  
 
$.effects.animateClass = function(value, duration, easing, callback) {  
if ($.isFunction(easing)) {  
callback = easing;  
easing = null;  
}  
 
return this.queue('fx', function() {  
var that = $(this),  
originalStyleAttr = that.attr('style') || ' ',  
originalStyle = filterStyles(getElementStyles.call(this)),  
newStyle,  
className = that.attr('className');  
 
$.each(classAnimationActions, function(i, action) {  
if (value[action]) {  
that[action + 'Class'](value[action]);  
}  
});  
newStyle = filterStyles(getElementStyles.call(this));  
that.attr('className', className);  
 
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {  
$.each(classAnimationActions, function(i, action) {  
if (value[action]) { that[action + 'Class'](value[action]); }  
});  
// work around bug in IE by clearing the cssText before setting it  
if (typeof that.attr('style') == 'object') {  
that.attr('style').cssText = '';  
that.attr('style').cssText = originalStyleAttr;  
} else {  
that.attr('style', originalStyleAttr);  
}  
if (callback) { callback.apply(this, arguments); }  
});  
 
// $.animate adds a function to the end of the queue  
// but we want it at the front  
var queue = $.queue(this),  
anim = queue.splice(queue.length - 1, 1)[0];  
queue.splice(1, 0, anim);  
$.dequeue(this);  
});  
};  
 
$.fn.extend({  
_addClass: $.fn.addClass,  
addClass: function(classNames, speed, easing, callback) {  
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);  
},  
 
_removeClass: $.fn.removeClass,  
removeClass: function(classNames,speed,easing,callback) {  
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);  
},  
 
_toggleClass: $.fn.toggleClass,  
toggleClass: function(classNames, force, speed, easing, callback) {  
if ( typeof force == "boolean" || force === undefined ) {  
if ( !speed ) {  
// without speed parameter;  
return this._toggleClass(classNames, force);  
} else {  
return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);  
}  
} else {  
// without switch parameter;  
return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);  
}  
},  
 
switchClass: function(remove,add,speed,easing,callback) {  
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);  
}  
});  
 
 
 
/******************************************************************************/  
/*********************************** EFFECTS **********************************/  
/******************************************************************************/  
 
$.extend($.effects, {  
version: "@VERSION",  
 
// Saves a set of properties in a data storage  
save: function(element, set) {  
for(var i=0; i < set.length; i++) {  
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);  
}  
},  
 
// Restores a set of previously saved properties from a data storage  
restore: function(element, set) {  
for(var i=0; i < set.length; i++) {  
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));  
}  
},  
 
setMode: function(el, mode) {  
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle  
return mode;  
},  
 
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value  
// this should be a little more flexible in the future to handle a string & hash  
var y, x;  
switch (origin[0]) {  
case 'top': y = 0; break;  
case 'middle': y = 0.5; break;  
case 'bottom': y = 1; break;  
default: y = origin[0] / original.height;  
};  
switch (origin[1]) {  
case 'left': x = 0; break;  
case 'center': x = 0.5; break;  
case 'right': x = 1; break;  
default: x = origin[1] / original.width;  
};  
return {x: x, y: y};  
},  
 
// Wraps the element around a wrapper that copies position properties  
createWrapper: function(element) {  
 
// if the element is already wrapped, return it  
if (element.parent().is('.ui-effects-wrapper')) {  
return element.parent();  
}  
 
// wrap the element  
var props = {  
width: element.outerWidth(true),  
height: element.outerHeight(true),  
'float': element.css('float')  
},  
wrapper = $('<div></div>')  
.addClass('ui-effects-wrapper')  
.css({  
fontSize: '100%',  
background: 'transparent',  
border: 'none',  
margin: 0,  
padding: 0  
});  
 
element.wrap(wrapper);  
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element  
 
// transfer positioning properties to the wrapper  
if (element.css('position') == 'static') {  
wrapper.css({ position: 'relative' });  
element.css({ position: 'relative' });  
} else {  
$.extend(props, {  
position: element.css('position'),  
zIndex: element.css('z-index')  
});  
$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {  
props[pos] = element.css(pos);  
if (isNaN(parseInt(props[pos], 10))) {  
props[pos] = 'auto';  
}  
});  
element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });  
}  
 
return wrapper.css(props).show();  
},  
 
removeWrapper: function(element) {  
if (element.parent().is('.ui-effects-wrapper'))  
return element.parent().replaceWith(element);  
return element;  
},  
 
setTransition: function(element, list, factor, value) {  
value = value || {};  
$.each(list, function(i, x){  
unit = element.cssUnit(x);  
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];  
});  
return value;  
}  
});  
 
 
function _normalizeArguments(effect, options, speed, callback) {  
// shift params for method overloading  
if (typeof effect == 'object') {  
callback = options;  
speed = null;  
options = effect;  
effect = options.effect;  
}  
if ($.isFunction(options)) {  
callback = options;  
speed = null;  
options = {};  
}  
if (typeof options == 'number' || $.fx.speeds[options]) {  
callback = speed;  
speed = options;  
options = {};  
}  
if ($.isFunction(speed)) {  
callback = speed;  
speed = null;  
}  
 
options = options || {};  
 
speed = speed || options.duration;  
speed = $.fx.off ? 0 : typeof speed == 'number'  
? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;  
 
callback = callback || options.complete;  
 
return [effect, options, speed, callback];  
}  
 
function standardSpeed( speed ) {  
// valid standard speeds  
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {  
return true;  
}  
 
// invalid strings - treat as "normal" speed  
if ( typeof speed === "string" && !$.effects[ speed ] ) {  
return true;  
}  
 
return false;  
}  
 
$.fn.extend({  
effect: function(effect, options, speed, callback) {  
var args = _normalizeArguments.apply(this, arguments),  
// TODO: make effects take actual parameters instead of a hash  
args2 = {  
options: args[1],  
duration: args[2],  
callback: args[3]  
},  
mode = args2.options.mode,  
effectMethod = $.effects[effect];  
 
if ( $.fx.off || !effectMethod ) {  
// delegate to the original method (e.g., .show()) if possible  
if ( mode ) {  
return this[ mode ]( args2.duration, args2.callback );  
} else {  
return this.each(function() {  
if ( args2.callback ) {  
args2.callback.call( this );  
}  
});  
}  
}  
 
return effectMethod.call(this, args2);  
},  
 
_show: $.fn.show,  
show: function(speed) {  
if ( standardSpeed( speed ) ) {  
return this._show.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'show';  
return this.effect.apply(this, args);  
}  
},  
 
_hide: $.fn.hide,  
hide: function(speed) {  
if ( standardSpeed( speed ) ) {  
return this._hide.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'hide';  
return this.effect.apply(this, args);  
}  
},  
 
// jQuery core overloads toggle and creates _toggle  
__toggle: $.fn.toggle,  
toggle: function(speed) {  
if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {  
return this.__toggle.apply(this, arguments);  
} else {  
var args = _normalizeArguments.apply(this, arguments);  
args[1].mode = 'toggle';  
return this.effect.apply(this, args);  
}  
},  
 
// helper functions  
cssUnit: function(key) {  
var style = this.css(key), val = [];  
$.each( ['em','px','%','pt'], function(i, unit){  
if(style.indexOf(unit) > 0)  
val = [parseFloat(style), unit];  
});  
return val;  
}  
});  
 
 
 
/******************************************************************************/  
/*********************************** EASING ***********************************/  
/******************************************************************************/  
 
/*  
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/  
*  
* Uses the built in easing capabilities added In jQuery 1.1  
* to offer multiple easing options  
*  
* TERMS OF USE - jQuery Easing  
*  
* Open source under the BSD License.  
*  
* Copyright 2008 George McGinley Smith  
* All rights reserved.  
*  
* Redistribution and use in source and binary forms, with or without modification,  
* are permitted provided that the following conditions are met:  
*  
* Redistributions of source code must retain the above copyright notice, this list of  
* conditions and the following disclaimer.  
* Redistributions in binary form must reproduce the above copyright notice, this list  
* of conditions and the following disclaimer in the documentation and/or other materials  
* provided with the distribution.  
*  
* Neither the name of the author nor the names of contributors may be used to endorse  
* or promote products derived from this software without specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY  
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE  
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  
* OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
*/  
 
// t: current time, b: begInnIng value, c: change In value, d: duration  
$.easing.jswing = $.easing.swing;  
 
$.extend($.easing,  
{  
def: 'easeOutQuad',  
swing: function (x, t, b, c, d) {  
//alert($.easing.default);  
return $.easing[$.easing.def](x, t, b, c, d);  
},  
easeInQuad: function (x, t, b, c, d) {  
return c*(t/=d)*t + b;  
},  
easeOutQuad: function (x, t, b, c, d) {  
return -c *(t/=d)*(t-2) + b;  
},  
easeInOutQuad: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t + b;  
return -c/2 * ((--t)*(t-2) - 1) + b;  
},  
easeInCubic: function (x, t, b, c, d) {  
return c*(t/=d)*t*t + b;  
},  
easeOutCubic: function (x, t, b, c, d) {  
return c*((t=t/d-1)*t*t + 1) + b;  
},  
easeInOutCubic: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t + b;  
return c/2*((t-=2)*t*t + 2) + b;  
},  
easeInQuart: function (x, t, b, c, d) {  
return c*(t/=d)*t*t*t + b;  
},  
easeOutQuart: function (x, t, b, c, d) {  
return -c * ((t=t/d-1)*t*t*t - 1) + b;  
},  
easeInOutQuart: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;  
return -c/2 * ((t-=2)*t*t*t - 2) + b;  
},  
easeInQuint: function (x, t, b, c, d) {  
return c*(t/=d)*t*t*t*t + b;  
},  
easeOutQuint: function (x, t, b, c, d) {  
return c*((t=t/d-1)*t*t*t*t + 1) + b;  
},  
easeInOutQuint: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;  
return c/2*((t-=2)*t*t*t*t + 2) + b;  
},  
easeInSine: function (x, t, b, c, d) {  
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;  
},  
easeOutSine: function (x, t, b, c, d) {  
return c * Math.sin(t/d * (Math.PI/2)) + b;  
},  
easeInOutSine: function (x, t, b, c, d) {  
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;  
},  
easeInExpo: function (x, t, b, c, d) {  
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;  
},  
easeOutExpo: function (x, t, b, c, d) {  
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;  
},  
easeInOutExpo: function (x, t, b, c, d) {  
if (t==0) return b;  
if (t==d) return b+c;  
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;  
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;  
},  
easeInCirc: function (x, t, b, c, d) {  
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;  
},  
easeOutCirc: function (x, t, b, c, d) {  
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;  
},  
easeInOutCirc: function (x, t, b, c, d) {  
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;  
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;  
},  
easeInElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;  
},  
easeOutElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;  
},  
easeInOutElastic: function (x, t, b, c, d) {  
var s=1.70158;var p=0;var a=c;  
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);  
if (a < Math.abs(c)) { a=c; var s=p/4; }  
else var s = p/(2*Math.PI) * Math.asin (c/a);  
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;  
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;  
},  
easeInBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
return c*(t/=d)*t*((s+1)*t - s) + b;  
},  
easeOutBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;  
},  
easeInOutBack: function (x, t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;  
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;  
},  
easeInBounce: function (x, t, b, c, d) {  
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;  
},  
easeOutBounce: function (x, t, b, c, d) {  
if ((t/=d) < (1/2.75)) {  
return c*(7.5625*t*t) + b;  
} else if (t < (2/2.75)) {  
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;  
} else if (t < (2.5/2.75)) {  
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;  
} else {  
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;  
}  
},  
easeInOutBounce: function (x, t, b, c, d) {  
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;  
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;  
}  
});  
 
/*  
*  
* TERMS OF USE - EASING EQUATIONS  
*  
* Open source under the BSD License.  
*  
* Copyright 2001 Robert Penner  
* All rights reserved.  
*  
* Redistribution and use in source and binary forms, with or without modification,  
* are permitted provided that the following conditions are met:  
*  
* Redistributions of source code must retain the above copyright notice, this list of  
* conditions and the following disclaimer.  
* Redistributions in binary form must reproduce the above copyright notice, this list  
* of conditions and the following disclaimer in the documentation and/or other materials  
* provided with the distribution.  
*  
* Neither the name of the author nor the names of contributors may be used to endorse  
* or promote products derived from this software without specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY  
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE  
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  
* OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
*/  
 
})(jQuery);  
 
/*  
* jQuery UI Autocomplete @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Autocomplete  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
* jquery.ui.position.js  
* jquery.ui.menu.js  
*/  
(function( $, undefined ) {  
 
// used to prevent race conditions with remote data sources  
var requestIndex = 0;  
 
$.widget( "ui.autocomplete", {  
defaultElement: "<input>",  
options: {  
appendTo: "body",  
delay: 300,  
minLength: 1,  
position: {  
my: "left top",  
at: "left bottom",  
collision: "none"  
},  
source: null  
},  
 
pending: 0,  
 
_create: function() {  
var self = this,  
doc = this.element[ 0 ].ownerDocument,  
suppressKeyPress;  
 
this.element  
.addClass( "ui-autocomplete-input" )  
.attr( "autocomplete", "off" )  
// TODO verify these actually work as intended  
.attr({  
role: "textbox",  
"aria-autocomplete": "list",  
"aria-haspopup": "true"  
})  
.bind( "keydown.autocomplete", function( event ) {  
if ( self.options.disabled || self.element.attr( "readonly" ) ) {  
return;  
}  
 
suppressKeyPress = false;  
var keyCode = $.ui.keyCode;  
switch( event.keyCode ) {  
case keyCode.PAGE_UP:  
self._move( "previousPage", event );  
break;  
case keyCode.PAGE_DOWN:  
self._move( "nextPage", event );  
break;  
case keyCode.UP:  
self._move( "previous", event );  
// prevent moving cursor to beginning of text field in some browsers  
event.preventDefault();  
break;  
case keyCode.DOWN:  
self._move( "next", event );  
// prevent moving cursor to end of text field in some browsers  
event.preventDefault();  
break;  
case keyCode.ENTER:  
case keyCode.NUMPAD_ENTER:  
// when menu is open and has focus  
if ( self.menu.active ) {  
// #6055 - Opera still allows the keypress to occur  
// which causes forms to submit  
suppressKeyPress = true;  
event.preventDefault();  
}  
//passthrough - ENTER and TAB both select the current element  
case keyCode.TAB:  
if ( !self.menu.active ) {  
return;  
}  
self.menu.select( event );  
break;  
case keyCode.ESCAPE:  
self.element.val( self.term );  
self.close( event );  
break;  
default:  
// keypress is triggered before the input value is changed  
clearTimeout( self.searching );  
self.searching = setTimeout(function() {  
// only search if the value has changed  
if ( self.term != self.element.val() ) {  
self.selectedItem = null;  
self.search( null, event );  
}  
}, self.options.delay );  
break;  
}  
})  
.bind( "keypress.autocomplete", function( event ) {  
if ( suppressKeyPress ) {  
suppressKeyPress = false;  
event.preventDefault();  
}  
})  
.bind( "focus.autocomplete", function() {  
if ( self.options.disabled ) {  
return;  
}  
 
self.selectedItem = null;  
self.previous = self.element.val();  
})  
.bind( "blur.autocomplete", function( event ) {  
if ( self.options.disabled ) {  
return;  
}  
 
clearTimeout( self.searching );  
// clicks on the menu (or a button to trigger a search) will cause a blur event  
self.closing = setTimeout(function() {  
self.close( event );  
self._change( event );  
}, 150 );  
});  
this._initSource();  
this.response = function() {  
return self._response.apply( self, arguments );  
};  
this.menu = $( "<ul></ul>" )  
.addClass( "ui-autocomplete" )  
.appendTo( $( this.options.appendTo || "body", doc )[0] )  
// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)  
.mousedown(function( event ) {  
// clicking on the scrollbar causes focus to shift to the body  
// but we can't detect a mouseup or a click immediately afterward  
// so we have to track the next mousedown and close the menu if  
// the user clicks somewhere outside of the autocomplete  
var menuElement = self.menu.element[ 0 ];  
if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {  
setTimeout(function() {  
$( document ).one( 'mousedown', function( event ) {  
if ( event.target !== self.element[ 0 ] &&  
event.target !== menuElement &&  
!$.contains( menuElement, event.target ) ) {  
self.close();  
}  
});  
}, 1 );  
}  
 
// use another timeout to make sure the blur-event-handler on the input was already triggered  
setTimeout(function() {  
clearTimeout( self.closing );  
}, 13);  
})  
.menu({  
// custom key handling for now  
input: $(),  
focus: function( event, ui ) {  
var item = ui.item.data( "item.autocomplete" );  
if ( false !== self._trigger( "focus", event, { item: item } ) ) {  
// use value to match what will end up in the input, if it was a key event  
if ( /^key/.test(event.originalEvent.type) ) {  
self.element.val( item.value );  
}  
}  
},  
select: function( event, ui ) {  
var item = ui.item.data( "item.autocomplete" ),  
previous = self.previous;  
 
// only trigger when focus was lost (click on menu)  
if ( self.element[0] !== doc.activeElement ) {  
self.element.focus();  
self.previous = previous;  
// #6109 - IE triggers two focus events and the second  
// is asynchronous, so we need to reset the previous  
// term synchronously and asynchronously :-(  
setTimeout(function() {  
self.previous = previous;  
self.selectedItem = item;  
}, 1);  
}  
 
if ( false !== self._trigger( "select", event, { item: item } ) ) {  
self.element.val( item.value );  
}  
// reset the term after the select event  
// this allows custom select handling to work properly  
self.term = self.element.val();  
 
self.close( event );  
self.selectedItem = item;  
},  
blur: function( event, ui ) {  
// don't set the value of the text field if it's already correct  
// this prevents moving the cursor unnecessarily  
if ( self.menu.element.is(":visible") &&  
( self.element.val() !== self.term ) ) {  
self.element.val( self.term );  
}  
}  
})  
.zIndex( this.element.zIndex() + 1 )  
.hide()  
.data( "menu" );  
if ( $.fn.bgiframe ) {  
this.menu.element.bgiframe();  
}  
},  
 
_destroy: function() {  
this.element  
.removeClass( "ui-autocomplete-input" )  
.removeAttr( "autocomplete" )  
.removeAttr( "role" )  
.removeAttr( "aria-autocomplete" )  
.removeAttr( "aria-haspopup" );  
this.menu.element.remove();  
},  
 
_setOption: function( key, value ) {  
this._super( "_setOption", key, value );  
if ( key === "source" ) {  
this._initSource();  
}  
if ( key === "appendTo" ) {  
this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )  
}  
if ( key === "disabled" && value && this.xhr ) {  
this.xhr.abort();  
}  
},  
 
_initSource: function() {  
var self = this,  
array,  
url;  
if ( $.isArray(this.options.source) ) {  
array = this.options.source;  
this.source = function( request, response ) {  
response( $.ui.autocomplete.filter(array, request.term) );  
};  
} else if ( typeof this.options.source === "string" ) {  
url = this.options.source;  
this.source = function( request, response ) {  
if ( self.xhr ) {  
self.xhr.abort();  
}  
self.xhr = $.ajax({  
url: url,  
data: request,  
dataType: "json",  
autocompleteRequest: ++requestIndex,  
success: function( data, status ) {  
if ( this.autocompleteRequest === requestIndex ) {  
response( data );  
}  
},  
error: function() {  
if ( this.autocompleteRequest === requestIndex ) {  
response( [] );  
}  
}  
});  
};  
} else {  
this.source = this.options.source;  
}  
},  
 
search: function( value, event ) {  
value = value != null ? value : this.element.val();  
 
// always save the actual value, not the one passed as an argument  
this.term = this.element.val();  
 
if ( value.length < this.options.minLength ) {  
return this.close( event );  
}  
 
clearTimeout( this.closing );  
if ( this._trigger( "search", event ) === false ) {  
return;  
}  
 
return this._search( value );  
},  
 
_search: function( value ) {  
this.pending++;  
this.element.addClass( "ui-autocomplete-loading" );  
 
this.source( { term: value }, this.response );  
},  
 
_response: function( content ) {  
if ( !this.options.disabled && content && content.length ) {  
content = this._normalize( content );  
this._suggest( content );  
this._trigger( "open" );  
} else {  
this.close();  
}  
this.pending--;  
if ( !this.pending ) {  
this.element.removeClass( "ui-autocomplete-loading" );  
}  
},  
 
close: function( event ) {  
clearTimeout( this.closing );  
if ( this.menu.element.is(":visible") ) {  
this.menu.element.hide();  
this.menu.deactivate();  
this._trigger( "close", event );  
}  
},  
 
_change: function( event ) {  
if ( this.previous !== this.element.val() ) {  
this._trigger( "change", event, { item: this.selectedItem } );  
}  
},  
 
_normalize: function( items ) {  
// assume all items have the right format when the first item is complete  
if ( items.length && items[0].label && items[0].value ) {  
return items;  
}  
return $.map( items, function(item) {  
if ( typeof item === "string" ) {  
return {  
label: item,  
value: item  
};  
}  
return $.extend({  
label: item.label || item.value,  
value: item.value || item.label  
}, item );  
});  
},  
 
_suggest: function( items ) {  
var ul = this.menu.element  
.empty()  
.zIndex( this.element.zIndex() + 1 );  
this._renderMenu( ul, items );  
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate  
this.menu.deactivate();  
this.menu.refresh();  
 
// size and position menu  
ul.show();  
this._resizeMenu();  
ul.position( $.extend({  
of: this.element  
}, this.options.position ));  
},  
 
_resizeMenu: function() {  
var ul = this.menu.element;  
ul.outerWidth( Math.max(  
ul.width( "" ).outerWidth(),  
this.element.outerWidth()  
) );  
},  
 
_renderMenu: function( ul, items ) {  
var self = this;  
$.each( items, function( index, item ) {  
self._renderItem( ul, item );  
});  
},  
 
_renderItem: function( ul, item) {  
return $( "<li></li>" )  
.data( "item.autocomplete", item )  
.append( $( "<a></a>" ).text( item.label ) )  
.appendTo( ul );  
},  
 
_move: function( direction, event ) {  
if ( !this.menu.element.is(":visible") ) {  
this.search( null, event );  
return;  
}  
if ( this.menu.first() && /^previous/.test(direction) ||  
this.menu.last() && /^next/.test(direction) ) {  
this.element.val( this.term );  
this.menu.deactivate();  
return;  
}  
this.menu[ direction ]( event );  
},  
 
widget: function() {  
return this.menu.element;  
}  
});  
 
$.extend( $.ui.autocomplete, {  
version: "@VERSION",  
escapeRegex: function( value ) {  
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");  
},  
filter: function(array, term) {  
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );  
return $.grep( array, function(value) {  
return matcher.test( value.label || value.value || value );  
});  
}  
});  
 
}( jQuery ));  
 
/*  
* jQuery Mobile Framework : temporary extension to port jQuery UI's datepicker for mobile  
* Copyright (c) jQuery Project  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*/  
(function($, undefined ) {  
 
//cache previous datepicker ui method  
var prevDp = $.fn.datepicker;  
 
//rewrite datepicker  
$.fn.datepicker = function( options ){  
 
var dp = this;  
 
//call cached datepicker plugin  
prevDp.call( this, options );  
 
//extend with some dom manipulation to update the markup for jQM  
//call immediately  
function updateDatepicker(){  
$( ".ui-datepicker-header", dp ).addClass("ui-body-c ui-corner-top").removeClass("ui-corner-all");  
$( ".ui-datepicker-prev, .ui-datepicker-next", dp ).attr("href", "#");  
$( ".ui-datepicker-prev", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-l", shadow: true, corners: true});  
$( ".ui-datepicker-next", dp ).buttonMarkup({iconpos: "notext", icon: "arrow-r", shadow: true, corners: true});  
$( ".ui-datepicker-calendar th", dp ).addClass("ui-bar-c");  
$( ".ui-datepicker-calendar td", dp ).addClass("ui-body-c");  
$( ".ui-datepicker-calendar a", dp ).buttonMarkup({corners: false, shadow: false});  
$( ".ui-datepicker-calendar a.ui-state-active", dp ).addClass("ui-btn-active"); // selected date  
$( ".ui-datepicker-calendar a.ui-state-highlight", dp ).addClass("ui-btn-up-e"); // today"s date  
$( ".ui-datepicker-calendar .ui-btn", dp ).each(function(){  
var el = $(this);  
// remove extra button markup - necessary for date value to be interpreted correctly  
el.html( el.find( ".ui-btn-text" ).text() );  
});  
};  
 
//update now  
updateDatepicker();  
 
// and on click  
$( dp ).click( updateDatepicker );  
 
//return jqm obj  
return this;  
};  
 
//bind to pagecreate to automatically enhance date inputs  
$( ".ui-page" ).live( "pagecreate", function(){  
$( "input[type='date'], input[data-type='date']" ).each(function(){  
if ($(this).hasClass("hasDatepicker") == false) {  
$(this).after( $( "<div />" ).datepicker({ altField: "#" + $(this).attr( "id" ), showOtherMonths: true }) );  
$(this).addClass("hasDatepicker");  
}  
});  
});  
})( jQuery );  
/*  
* jQuery UI Position @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Position  
*/  
(function( $, undefined ) {  
 
$.ui = $.ui || {};  
 
var horizontalPositions = /left|center|right/,  
verticalPositions = /top|center|bottom/,  
center = "center",  
_position = $.fn.position,  
_offset = $.fn.offset;  
 
$.fn.position = function( options ) {  
if ( !options || !options.of ) {  
return _position.apply( this, arguments );  
}  
 
// make a copy, we don't want to modify arguments  
options = $.extend( {}, options );  
 
var target = $( options.of ),  
targetElem = target[0],  
collision = ( options.collision || "flip" ).split( " " ),  
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],  
targetWidth,  
targetHeight,  
basePosition;  
 
if ( targetElem.nodeType === 9 ) {  
targetWidth = target.width();  
targetHeight = target.height();  
basePosition = { top: 0, left: 0 };  
} else if ( $.isWindow( targetElem ) ) {  
targetWidth = target.width();  
targetHeight = target.height();  
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };  
} else if ( targetElem.preventDefault ) {  
// force left top to allow flipping  
options.at = "left top";  
targetWidth = targetHeight = 0;  
basePosition = { top: options.of.pageY, left: options.of.pageX };  
} else {  
targetWidth = target.outerWidth();  
targetHeight = target.outerHeight();  
basePosition = target.offset();  
}  
 
// force my and at to have valid horizontal and veritcal positions  
// if a value is missing or invalid, it will be converted to center  
$.each( [ "my", "at" ], function() {  
var pos = ( options[this] || "" ).split( " " );  
if ( pos.length === 1) {  
pos = horizontalPositions.test( pos[0] ) ?  
pos.concat( [center] ) :  
verticalPositions.test( pos[0] ) ?  
[ center ].concat( pos ) :  
[ center, center ];  
}  
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;  
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;  
options[ this ] = pos;  
});  
 
// normalize collision option  
if ( collision.length === 1 ) {  
collision[ 1 ] = collision[ 0 ];  
}  
 
// normalize offset option  
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;  
if ( offset.length === 1 ) {  
offset[ 1 ] = offset[ 0 ];  
}  
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;  
 
if ( options.at[0] === "right" ) {  
basePosition.left += targetWidth;  
} else if ( options.at[0] === center ) {  
basePosition.left += targetWidth / 2;  
}  
 
if ( options.at[1] === "bottom" ) {  
basePosition.top += targetHeight;  
} else if ( options.at[1] === center ) {  
basePosition.top += targetHeight / 2;  
}  
 
basePosition.left += offset[ 0 ];  
basePosition.top += offset[ 1 ];  
 
return this.each(function() {  
var elem = $( this ),  
elemWidth = elem.outerWidth(),  
elemHeight = elem.outerHeight(),  
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,  
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,  
collisionWidth = elemWidth + marginLeft +  
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),  
collisionHeight = elemHeight + marginTop +  
( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),  
position = $.extend( {}, basePosition ),  
collisionPosition;  
 
if ( options.my[0] === "right" ) {  
position.left -= elemWidth;  
} else if ( options.my[0] === center ) {  
position.left -= elemWidth / 2;  
}  
 
if ( options.my[1] === "bottom" ) {  
position.top -= elemHeight;  
} else if ( options.my[1] === center ) {  
position.top -= elemHeight / 2;  
}  
 
// prevent fractions (see #5280)  
position.left = Math.round( position.left );  
position.top = Math.round( position.top );  
 
collisionPosition = {  
left: position.left - marginLeft,  
top: position.top - marginTop  
};  
 
$.each( [ "left", "top" ], function( i, dir ) {  
if ( $.ui.position[ collision[i] ] ) {  
$.ui.position[ collision[i] ][ dir ]( position, {  
targetWidth: targetWidth,  
targetHeight: targetHeight,  
elemWidth: elemWidth,  
elemHeight: elemHeight,  
collisionPosition: collisionPosition,  
collisionWidth: collisionWidth,  
collisionHeight: collisionHeight,  
offset: offset,  
my: options.my,  
at: options.at  
});  
}  
});  
 
if ( $.fn.bgiframe ) {  
elem.bgiframe();  
}  
elem.offset( $.extend( position, { using: options.using } ) );  
});  
};  
 
$.ui.position = {  
fit: {  
left: function( position, data ) {  
var win = $( window ),  
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();  
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );  
},  
top: function( position, data ) {  
var win = $( window ),  
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();  
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );  
}  
},  
 
flip: {  
left: function( position, data ) {  
if ( data.at[0] === center ) {  
return;  
}  
var win = $( window ),  
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),  
myOffset = data.my[ 0 ] === "left" ?  
-data.elemWidth :  
data.my[ 0 ] === "right" ?  
data.elemWidth :  
0,  
atOffset = data.at[ 0 ] === "left" ?  
data.targetWidth :  
-data.targetWidth,  
offset = -2 * data.offset[ 0 ];  
position.left += data.collisionPosition.left < 0 ?  
myOffset + atOffset + offset :  
over > 0 ?  
myOffset + atOffset + offset :  
0;  
},  
top: function( position, data ) {  
if ( data.at[1] === center ) {  
return;  
}  
var win = $( window ),  
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),  
myOffset = data.my[ 1 ] === "top" ?  
-data.elemHeight :  
data.my[ 1 ] === "bottom" ?  
data.elemHeight :  
0,  
atOffset = data.at[ 1 ] === "top" ?  
data.targetHeight :  
-data.targetHeight,  
offset = -2 * data.offset[ 1 ];  
position.top += data.collisionPosition.top < 0 ?  
myOffset + atOffset + offset :  
over > 0 ?  
myOffset + atOffset + offset :  
0;  
}  
}  
};  
 
// offset setter from jQuery 1.4  
if ( !$.offset.setOffset ) {  
$.offset.setOffset = function( elem, options ) {  
// set position first, in-case top/left are set even on static elem  
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {  
elem.style.position = "relative";  
}  
var curElem = $( elem ),  
curOffset = curElem.offset(),  
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,  
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,  
props = {  
top: (options.top - curOffset.top) + curTop,  
left: (options.left - curOffset.left) + curLeft  
};  
 
if ( 'using' in options ) {  
options.using.call( elem, props );  
} else {  
curElem.css( props );  
}  
};  
 
$.fn.offset = function( options ) {  
var elem = this[ 0 ];  
if ( !elem || !elem.ownerDocument ) { return null; }  
if ( options ) {  
return this.each(function() {  
$.offset.setOffset( this, options );  
});  
}  
return _offset.call( this );  
};  
}  
 
}( jQuery ));  
 
/*!  
* jQuery UI Widget @VERSION  
*  
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* http://docs.jquery.com/UI/Widget  
*/  
(function( $, undefined ) {  
 
var slice = Array.prototype.slice;  
 
var _cleanData = $.cleanData;  
$.cleanData = function( elems ) {  
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {  
$( elem ).triggerHandler( "remove" );  
}  
_cleanData( elems );  
};  
 
$.widget = function( name, base, prototype ) {  
var namespace = name.split( "." )[ 0 ],  
fullName;  
name = name.split( "." )[ 1 ];  
fullName = namespace + "-" + name;  
 
if ( !prototype ) {  
prototype = base;  
base = $.Widget;  
}  
 
// create selector for plugin  
$.expr[ ":" ][ fullName ] = function( elem ) {  
return !!$.data( elem, name );  
};  
 
$[ namespace ] = $[ namespace ] || {};  
$[ namespace ][ name ] = $[ namespace ][ name ] || function( options, element ) {  
// allow instantiation without "new" keyword  
if ( !this._createWidget ) {  
return new $[ namespace ][ name ]( options, element );  
}  
 
// allow instantiation without initializing for simple inheritance  
// must use "new" keyword (the code above always passes args)  
if ( arguments.length ) {  
this._createWidget( options, element );  
}  
};  
 
var basePrototype = new base();  
// we need to make the options hash a property directly on the new instance  
// otherwise we'll modify the options hash on the prototype that we're  
// inheriting from  
basePrototype.options = $.extend( true, {}, basePrototype.options );  
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {  
namespace: namespace,  
widgetName: name,  
widgetEventPrefix: name,  
widgetBaseClass: fullName,  
base: base.prototype  
}, prototype );  
 
$.widget.bridge( name, $[ namespace ][ name ] );  
};  
 
$.widget.bridge = function( name, object ) {  
$.fn[ name ] = function( options ) {  
var isMethodCall = typeof options === "string",  
args = slice.call( arguments, 1 ),  
returnValue = this;  
 
// allow multiple hashes to be passed on init  
options = !isMethodCall && args.length ?  
$.extend.apply( null, [ true, options ].concat(args) ) :  
options;  
 
// prevent calls to internal methods  
if ( isMethodCall && options.charAt( 0 ) === "_" ) {  
return returnValue;  
}  
 
if ( isMethodCall ) {  
this.each(function() {  
var instance = $.data( this, name );  
if ( !instance ) {  
return $.error( "cannot call methods on " + name + " prior to initialization; " +  
"attempted to call method '" + options + "'" );  
}  
if ( !$.isFunction( instance[options] ) ) {  
return $.error( "no such method '" + options + "' for " + name + " widget instance" );  
}  
var methodValue = instance[ options ].apply( instance, args );  
if ( methodValue !== instance && methodValue !== undefined ) {  
returnValue = methodValue;  
return false;  
}  
});  
} else {  
this.each(function() {  
var instance = $.data( this, name );  
if ( instance ) {  
instance.option( options || {} )._init();  
} else {  
object( options, this );  
}  
});  
}  
 
return returnValue;  
};  
};  
 
$.Widget = function( options, element ) {  
// allow instantiation without "new" keyword  
if ( !this._createWidget ) {  
return new $[ namespace ][ name ]( options, element );  
}  
 
// allow instantiation without initializing for simple inheritance  
// must use "new" keyword (the code above always passes args)  
if ( arguments.length ) {  
this._createWidget( options, element );  
}  
};  
 
$.Widget.prototype = {  
widgetName: "widget",  
widgetEventPrefix: "",  
defaultElement: "<div>",  
options: {  
disabled: false  
},  
_createWidget: function( options, element ) {  
element = $( element || this.defaultElement || this )[ 0 ];  
this.element = $( element );  
this.options = $.extend( true, {},  
this.options,  
this._getCreateOptions(),  
options );  
 
this.bindings = $();  
this.hoverable = $();  
this.focusable = $();  
 
if ( element !== this ) {  
$.data( element, this.widgetName, this );  
this._bind({ remove: "destroy" });  
}  
 
this._create();  
this._trigger( "create" );  
this._init();  
},  
_getCreateOptions: function() {  
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];  
},  
_create: $.noop,  
_init: $.noop,  
 
_super: function( method ) {  
return this.base[ method ].apply( this, slice.call( arguments, 1 ) );  
},  
_superApply: function( method, args ) {  
return this.base[ method ].apply( this, args );  
},  
 
destroy: function() {  
this._destroy();  
// we can probably remove the unbind calls in 2.0  
// all event bindings should go through this._bind()  
this.element  
.unbind( "." + this.widgetName )  
.removeData( this.widgetName );  
this.widget()  
.unbind( "." + this.widgetName )  
.removeAttr( "aria-disabled" )  
.removeClass(  
this.widgetBaseClass + "-disabled " +  
"ui-state-disabled" );  
 
// clean up events and states  
this.bindings.unbind( "." + this.widgetName );  
this.hoverable.removeClass( "ui-state-hover" );  
this.focusable.removeClass( "ui-state-focus" );  
},  
_destroy: $.noop,  
 
widget: function() {  
return this.element;  
},  
 
option: function( key, value ) {  
var options = key;  
 
if ( arguments.length === 0 ) {  
// don't return a reference to the internal hash  
return $.extend( {}, this.options );  
}  
 
if (typeof key === "string" ) {  
if ( value === undefined ) {  
return this.options[ key ];  
}  
options = {};  
options[ key ] = value;  
}  
 
this._setOptions( options );  
 
return this;  
},  
_setOptions: function( options ) {  
var self = this;  
$.each( options, function( key, value ) {  
self._setOption( key, value );  
});  
 
return this;  
},  
_setOption: function( key, value ) {  
this.options[ key ] = value;  
 
if ( key === "disabled" ) {  
this.widget()  
.toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value )  
.attr( "aria-disabled", value );  
this.hoverable.removeClass( "ui-state-hover" );  
this.focusable.removeClass( "ui-state-focus" );  
}  
 
return this;  
},  
 
enable: function() {  
return this._setOption( "disabled", false );  
},  
disable: function() {  
return this._setOption( "disabled", true );  
},  
 
_bind: function( element, handlers ) {  
// no element argument, shuffle and use this.element  
if ( !handlers ) {  
handlers = element;  
element = this.element;  
} else {  
this.bindings = this.bindings.add( element );  
}  
var instance = this;  
$.each( handlers, function( event, handler ) {  
element.bind( event + "." + instance.widgetName, function() {  
// allow widgets to customize the disabled handling  
// - disabled as an array instead of boolean  
// - disabled class as method for disabling individual parts  
if ( instance.options.disabled === true ||  
$( this ).hasClass( "ui-state-disabled" ) ) {  
return;  
}  
return ( typeof handler === "string" ? instance[ handler ] : handler )  
.apply( instance, arguments );  
});  
});  
},  
 
_hoverable: function( element ) {  
this.hoverable = this.hoverable.add( element );  
this._bind( element, {  
mouseenter: function( event ) {  
$( event.currentTarget ).addClass( "ui-state-hover" );  
},  
mouseleave: function( event ) {  
$( event.currentTarget ).removeClass( "ui-state-hover" );  
}  
});  
},  
 
_focusable: function( element ) {  
this.focusable = this.focusable.add( element );  
this._bind( element, {  
focusin: function( event ) {  
$( event.currentTarget ).addClass( "ui-state-focus" );  
},  
focusout: function( event ) {  
$( event.currentTarget ).removeClass( "ui-state-focus" );  
}  
});  
},  
 
_trigger: function( type, event, data ) {  
var callback = this.options[ type ],  
args;  
 
event = $.Event( event );  
event.type = ( type === this.widgetEventPrefix ?  
type :  
this.widgetEventPrefix + type ).toLowerCase();  
data = data || {};  
 
// copy original event properties over to the new event  
// this would happen if we could call $.event.fix instead of $.Event  
// but we don't have a way to force an event to be fixed multiple times  
if ( event.originalEvent ) {  
for ( var i = $.event.props.length, prop; i; ) {  
prop = $.event.props[ --i ];  
event[ prop ] = event.originalEvent[ prop ];  
}  
}  
 
this.element.trigger( event, data );  
 
args = $.isArray( data ) ?  
[ event ].concat( data ) :  
[ event, data ];  
 
return !( $.isFunction( callback ) &&  
callback.apply( this.element[0], args ) === false ||  
event.isDefaultPrevented() );  
}  
};  
 
})( jQuery );  
 
file:a/busui/layar_api.php (deleted)
<?php  
include('common.inc.php');  
$output = Array();  
$output['hotspots'] = Array();  
$output['layer'] = "canberrabusstops";  
 
$max_page = 10;  
$max_results = 50;  
$page_start = 0+$_REQUEST['pageKey'];  
$page_end = $max_page+$_REQUEST['pageKey'];  
 
$url = $APIurl."/json/neareststops?lat={$_REQUEST['lat']}&lon={$_REQUEST['lon']}&limit=50";  
$contents = json_decode(getPage($url));  
debug(print_r($contents,true));  
$stopNum = 0;  
foreach ($contents as $row)  
{  
$stopNum++;  
if ($stopNum > $page_start && $stopNum <= $page_end) {  
$hotspot = Array();  
$hotspot['id'] = $row[0];  
$hotspot['title'] = $row[1];  
$hotspot['type'] = 0;  
$hotspot['lat'] = floor($row[2]*1000000);  
$hotspot['lon'] = floor($row[3]*1000000);  
$hotspot['distance'] = distance($row[2], $row[3], $_REQUEST['lat'], $_REQUEST['lon']);  
if (!isset($_REQUEST['radius']) || $hotspot['distance'] < $_REQUEST['radius']) {  
$hotspot['actions'] = Array(Array("label" => 'View more trips/information', 'uri' => 'http://bus.lambdacomplex.org/'.'stop.php?stopid='.$row[0]));  
$url = $APIurl."/json/stoptrips?stop=".$row[0]."&time=".midnight_seconds()."&service_period=".service_period();  
$trips = json_decode(getPage($url));  
debug(print_r($trips,true));  
foreach ($trips as $key => $row)  
{  
if ($key < 3) {  
$hotspot['line'.strval($key+2)]= $row[1][1] .' @ ' .midnight_seconds_to_time($row[0]);  
}  
}  
if (sizeof($trips) == 0) $hotspot['line2'] = 'No trips in the near future.';  
$output['hotspots'][] = $hotspot;  
}  
}  
}  
if (sizeof($hotspot) > 0) {  
$output['errorString'] = 'ok';  
$output['errorCode'] = 0;  
} else {  
$output['errorString'] = 'no results, try increasing range';  
$output['errorCode'] = 21;  
}  
if ($page_end >= $max_results || sizeof($hotspot) < $max_page) {  
$output["morePages"] = false;  
$output["nextPageKey"] = null;  
} else {  
$output["morePages"] = true;  
$output["nextPageKey"] = $page_end;  
}  
echo json_encode($output);  
?>  
file:a/busui/owa/Callbacks.inc (deleted)
<?php  
 
 
/**  
* Gallery Template Callbacks class placeholder  
* Needed for fake out the require_once() in Gallery's template class callback method  
* See OWA Gallery module for the actual callback class  
*/  
 
?>  
file:a/busui/owa/action.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_php.php');  
 
/**  
* Special HTTP Requests Controler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
* @depricated  
*/  
 
$owa = new owa_php;  
 
$owa->e->debug('Special action request received by action.php...');  
 
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
// run controller or view and echo page content  
echo $owa->handleRequestFromURL();  
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
file:a/busui/owa/api.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_php.php');  
 
/**  
* REST API  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
* @link http://wiki.openwebanalytics.com/index.php?title=REST_API  
*/  
 
// define entry point cnstant  
define('OWA_API', true);  
// invoke OWA  
$owa = new owa_php;  
 
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
// run api command and echo page content  
echo $owa->handleRequest('', 'base.apiRequest');  
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
file:a/busui/owa/cli.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once('owa_env.php');  
require_once(OWA_DIR.'owa_php.php');  
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* OWA Comand Line Interface (CLI)  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
define('OWA_CLI', true);  
 
if (!empty($_POST)) {  
exit();  
} elseif (!empty($_GET)) {  
exit();  
} elseif (!empty($argv)) {  
$params = array();  
// get params from the command line args  
// $argv is a php super global variable  
 
for ($i=1; $i<count($argv);$i++)  
{  
$it = split("=",$argv[$i]);  
$params[$it[0]] = $it[1];  
}  
unset($params['action']);  
unset($params['do']);  
 
} else {  
// No params found  
exit();  
}  
 
// Initialize owa  
$owa = &new owa_php;  
 
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
// setting CLI mode to true  
$owa->setSetting('base', 'cli_mode', true);  
// setting user auth  
$owa->setCurrentUser('admin', 'cli-user');  
// run controller or view and echo page content  
$s = owa_coreAPI::serviceSingleton();  
$s->loadCliCommands();  
 
if (array_key_exists('cmd', $params)) {  
 
$cmd = $s->getCliCommandClass($params['cmd']);  
 
if ($cmd) {  
$params['do'] = $cmd;  
echo $owa->handleRequest($params);  
} else {  
echo "Invalid command name.";  
}  
 
} else {  
echo "Missing a command argument.";  
}  
 
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
<?php  
/**  
* ISO-3166-1 http://en.wikipedia.org/wiki/ISO_3166-1  
*/  
$countryCode2Name = array (  
'AF' => 'Afghanistan',  
'AX' => 'Åland Islands',  
'AL' => 'Albania',  
'DZ' => 'Algeria',  
'AS' => 'American Samoa',  
'AD' => 'Andorra',  
'AO' => 'Angola',  
'AI' => 'Anguilla',  
'AQ' => 'Antarctica',  
'AG' => 'Antigua and Barbuda',  
'AR' => 'Argentina',  
'AM' => 'Armenia',  
'AW' => 'Aruba',  
'AU' => 'Australia',  
'AT' => 'Austria',  
'AZ' => 'Azerbaijan',  
'BS' => 'Bahamas',  
'BH' => 'Bahrain',  
'BD' => 'Bangladesh',  
'BB' => 'Barbados',  
'BY' => 'Belarus',  
'BE' => 'Belgium',  
'BZ' => 'Belize',  
'BJ' => 'Benin',  
'BM' => 'Bermuda',  
'BT' => 'Bhutan',  
'BO' => 'Bolivia, Plurinational State of',  
'BA' => 'Bosnia and Herzegovina',  
'BW' => 'Botswana',  
'BV' => 'Bouvet Island',  
'BR' => 'Brazil',  
'IO' => 'British Indian Ocean Territory',  
'BN' => 'Brunei Darussalam',  
'BG' => 'Bulgaria',  
'BF' => 'Burkina Faso',  
'BI' => 'Burundi',  
'KH' => 'Cambodia',  
'CM' => 'Cameroon',  
'CA' => 'Canada',  
'CV' => 'Cape Verde',  
'KY' => 'Cayman Islands',  
'CF' => 'Central African Republic',  
'TD' => 'Chad',  
'CL' => 'Chile',  
'CN' => 'China',  
'CX' => 'Christmas Island',  
'CC' => 'Cocos (Keeling) Islands',  
'CO' => 'Colombia',  
'KM' => 'Comoros',  
'CG' => 'Congo',  
'CD' => 'Congo, the Democratic Republic of the',  
'CK' => 'Cook Islands',  
'CR' => 'Costa Rica',  
'CI' => "Côte d'Ivoire",  
'HR' => 'Croatia',  
'CU' => 'Cuba',  
'CY' => 'Cyprus',  
'CZ' => 'Czech Republic',  
'DK' => 'Denmark',  
'DJ' => 'Djibouti',  
'DM' => 'Dominica',  
'DO' => 'Dominican Republic',  
'EC' => 'Ecuador',  
'EG' => 'Egypt',  
'SV' => 'El Salvador',  
'GQ' => 'Equatorial Guinea',  
'ER' => 'Eritrea',  
'EE' => 'Estonia',  
'ET' => 'Ethiopia',  
'FK' => 'Falkland Islands (Malvinas)',  
'FO' => 'Faroe Islands',  
'FJ' => 'Fiji',  
'FI' => 'Finland',  
'FR' => 'France',  
'GF' => 'French Guiana',  
'PF' => 'French Polynesia',  
'TF' => 'French Southern Territories',  
'GA' => 'Gabon',  
'GM' => 'Gambia',  
'GE' => 'Georgia',  
'DE' => 'Germany',  
'GH' => 'Ghana',  
'GI' => 'Gibraltar',  
'GR' => 'Greece',  
'GL' => 'Greenland',  
'GD' => 'Grenada',  
'GP' => 'Guadeloupe',  
'GU' => 'Guam',  
'GT' => 'Guatemala',  
'GG' => 'Guernsey',  
'GN' => 'Guinea',  
'GW' => 'Guinea-Bissau',  
'GY' => 'Guyana',  
'HT' => 'Haiti',  
'HM' => 'Heard Island and McDonald Islands',  
'VA' => 'Holy See (Vatican City State)',  
'HN' => 'Honduras',  
'HK' => 'Hong Kong',  
'HU' => 'Hungary',  
'IS' => 'Iceland',  
'IN' => 'India',  
'ID' => 'Indonesia',  
'IR' => 'Iran, Islamic Republic of',  
'IQ' => 'Iraq',  
'IE' => 'Ireland',  
'IM' => 'Isle of Man',  
'IL' => 'Israel',  
'IT' => 'Italy',  
'JM' => 'Jamaica',  
'JP' => 'Japan',  
'JE' => 'Jersey',  
'JO' => 'Jordan',  
'KZ' => 'Kazakhstan',  
'KE' => 'Kenya',  
'KI' => 'Kiribati',  
'KP' => "Korea, Democratic People's Republic of",  
'KR' => 'Korea, Republic of',  
'KW' => 'Kuwait',  
'KG' => 'Kyrgyzstan',  
'LA' => "Lao People's Democratic Republic",  
'LV' => 'Latvia',  
'LB' => 'Lebanon',  
'LS' => 'Lesotho',  
'LR' => 'Liberia',  
'LY' => 'Libyan Arab Jamahiriya',  
'LI' => 'Liechtenstein',  
'LT' => 'Lithuania',  
'LU' => 'Luxembourg',  
'MO' => 'Macao',  
'MK' => 'Macedonia, the former Yugoslav Republic of',  
'MG' => 'Madagascar',  
'MW' => 'Malawi',  
'MY' => 'Malaysia',  
'MV' => 'Maldives',  
'ML' => 'Mali',  
'MT' => 'Malta',  
'MH' => 'Marshall Islands',  
'MQ' => 'Martinique',  
'MR' => 'Mauritania',  
'MU' => 'Mauritius',  
'YT' => 'Mayotte',  
'MX' => 'Mexico',  
'FM' => 'Micronesia, Federated States of',  
'MD' => 'Moldova, Republic of',  
'MC' => 'Monaco',  
'MN' => 'Mongolia',  
'ME' => 'Montenegro',  
'MS' => 'Montserrat',  
'MA' => 'Morocco',  
'MZ' => 'Mozambique',  
'MM' => 'Myanmar',  
'NA' => 'Namibia',  
'NR' => 'Nauru',  
'NP' => 'Nepal',  
'NL' => 'Netherlands',  
'AN' => 'Netherlands Antilles',  
'NC' => 'New Caledonia',  
'NZ' => 'New Zealand',  
'NI' => 'Nicaragua',  
'NE' => 'Niger',  
'NG' => 'Nigeria',  
'NU' => 'Niue',  
'NF' => 'Norfolk Island',  
'MP' => 'Northern Mariana Islands',  
'NO' => 'Norway',  
'OM' => 'Oman',  
'PK' => 'Pakistan',  
'PW' => 'Palau',  
'PS' => 'Palestinian Territory, Occupied',  
'PA' => 'Panama',  
'PG' => 'Papua New Guinea',  
'PY' => 'Paraguay',  
'PE' => 'Peru',  
'PH' => 'Philippines',  
'PN' => 'Pitcairn',  
'PL' => 'Poland',  
'PT' => 'Portugal',  
'PR' => 'Puerto Rico',  
'QA' => 'Qatar',  
'RE' => 'Réunion',  
'RO' => 'Romania',  
'RU' => 'Russian Federation',  
'RW' => 'Rwanda',  
'BL' => 'Saint Barthélemy',  
'SH' => 'Saint Helena',  
'KN' => 'Saint Kitts and Nevis',  
'LC' => 'Saint Lucia',  
'MF' => 'Saint Martin (French part)',  
'PM' => 'Saint Pierre and Miquelon',  
'VC' => 'Saint Vincent and the Grenadines',  
'WS' => 'Samoa',  
'SM' => 'San Marino',  
'ST' => 'Sao Tome and Principe',  
'SA' => 'Saudi Arabia',  
'SN' => 'Senegal',  
'RS' => 'Serbia',  
'SC' => 'Seychelles',  
'SL' => 'Sierra Leone',  
'SG' => 'Singapore',  
'SK' => 'Slovakia',  
'SI' => 'Slovenia',  
'SB' => 'Solomon Islands',  
'SO' => 'Somalia',  
'ZA' => 'South Africa',  
'GS' => 'South Georgia and the South Sandwich Islands',  
'ES' => 'Spain',  
'LK' => 'Sri Lanka',  
'SD' => 'Sudan',  
'SR' => 'Suriname',  
'SJ' => 'Svalbard and Jan Mayen',  
'SZ' => 'Swaziland',  
'SE' => 'Sweden',  
'CH' => 'Switzerland',  
'SY' => 'Syrian Arab Republic',  
'TW' => 'Taiwan, Province of China',  
'TJ' => 'Tajikistan',  
'TZ' => 'Tanzania, United Republic of',  
'TH' => 'Thailand',  
'TL' => 'Timor-Leste',  
'TG' => 'Togo',  
'TK' => 'Tokelau',  
'TO' => 'Tonga',  
'TT' => 'Trinidad and Tobago',  
'TN' => 'Tunisia',  
'TR' => 'Turkey',  
'TM' => 'Turkmenistan',  
'TC' => 'Turks and Caicos Islands',  
'TV' => 'Tuvalu',  
'UG' => 'Uganda',  
'UA' => 'Ukraine',  
'AE' => 'United Arab Emirates',  
'GB' => 'United Kingdom',  
'US' => 'United States',  
'UM' => 'United States Minor Outlying Islands',  
'UY' => 'Uruguay',  
'UZ' => 'Uzbekistan',  
'VU' => 'Vanuatu',  
'VE' => 'Venezuela, Bolivarian Republic of',  
'VN' => 'Viet Nam',  
'VG' => 'Virgin Islands, British',  
'VI' => 'Virgin Islands, U.S.',  
'WF' => 'Wallis and Futuna',  
'EH' => 'Western Sahara',  
'YE' => 'Yemen',  
'ZM' => 'Zambia',  
'ZW' => 'Zimbabwe'  
);  
?>  
<?php  
$countryName2Code = array(  
"afghanistan" => 'AF',  
"Åland islands" => 'AX',  
"albania" => 'AL',  
"algeria" => 'DZ',  
"american samoa" => 'AS',  
"andorra" => 'AD',  
"angola" => 'AO',  
"anguilla" => 'AI',  
"antarctica" => 'AQ',  
"antigua and barbuda" => 'AG',  
"argentina" => 'AR',  
"armenia" => 'AM',  
"aruba" => 'AW',  
"australia" => 'AU',  
"austria" => 'AT',  
"azerbaijan" => 'AZ',  
"bahamas" => 'BS',  
"bahrain" => 'BH',  
"bangladesh" => 'BD',  
"barbados" => 'BB',  
"belarus" => 'BY',  
"belgium" => 'BE',  
"belize" => 'BZ',  
"benin" => 'BJ',  
"bermuda" => 'BM',  
"bhutan" => 'BT',  
"bolivia, plurinational state of" => 'BO',  
"bosnia and herzegovina" => 'BA',  
"botswana" => 'BW',  
"bouvet island" => 'BV',  
"brazil" => 'BR',  
"british indian ocean territory" => 'IO',  
"brunei darussalam" => 'BN',  
"bulgaria" => 'BG',  
"burkina faso" => 'BF',  
"burundi" => 'BI',  
"cambodia" => 'KH',  
"cameroon" => 'CM',  
"canada" => 'CA',  
"cape verde" => 'CV',  
"cayman islands" => 'KY',  
"central african republic" => 'CF',  
"chad" => 'TD',  
"chile" => 'CL',  
"china" => 'CN',  
"christmas island" => 'CX',  
"cocos (keeling) islands" => 'CC',  
"colombia" => 'CO',  
"comoros" => 'KM',  
"congo" => 'CG',  
"congo, the democratic republic of the" => 'CD',  
"cook islands" => 'CK',  
"costa rica" => 'CR',  
"côte d'ivoire" => 'CI',  
"croatia" => 'HR',  
"cuba" => 'CU',  
"cyprus" => 'CY',  
"czech republic" => 'CZ',  
"denmark" => 'DK',  
"djibouti" => 'DJ',  
"dominica" => 'DM',  
"dominican republic" => 'DO',  
"ecuador" => 'EC',  
"egypt" => 'EG',  
"el salvador" => 'SV',  
"equatorial guinea" => 'GQ',  
"eritrea" => 'ER',  
"estonia" => 'EE',  
"ethiopia" => 'ET',  
"falkland islands (malvinas)" => 'FK',  
"faroe islands" => 'FO',  
"fiji" => 'FJ',  
"finland" => 'FI',  
"france" => 'FR',  
"french guiana" => 'GF',  
"french polynesia" => 'PF',  
"french southern territories" => 'TF',  
"gabon" => 'GA',  
"gambia" => 'GM',  
"georgia" => 'GE',  
"germany" => 'DE',  
"ghana" => 'GH',  
"gibraltar" => 'GI',  
"greece" => 'GR',  
"greenland" => 'GL',  
"grenada" => 'GD',  
"guadeloupe" => 'GP',  
"guam" => 'GU',  
"guatemala" => 'GT',  
"guernsey" => 'GG',  
"guinea" => 'GN',  
"guinea-bissau" => 'GW',  
"guyana" => 'GY',  
"haiti" => 'HT',  
"heard island and mcdonald islands" => 'HM',  
"holy see (vatican city state)" => 'VA',  
"honduras" => 'HN',  
"hong kong" => 'HK',  
"hungary" => 'HU',  
"iceland" => 'IS',  
"india" => 'IN',  
"indonesia" => 'ID',  
"iran, islamic republic of" => 'IR',  
"iraq" => 'IQ',  
"ireland" => 'IE',  
"isle of man" => 'IM',  
"israel" => 'IL',  
"italy" => 'IT',  
"jamaica" => 'JM',  
"japan" => 'JP',  
"jersey" => 'JE',  
"jordan" => 'JO',  
"kazakhstan" => 'KZ',  
"kenya" => 'KE',  
"kiribati" => 'KI',  
"korea, democratic people's republic of" => 'KP',  
"korea, republic of" => 'KR',  
"kuwait" => 'KW',  
"kyrgyzstan" => 'KG',  
"lao people's democratic republic" => 'LA',  
"latvia" => 'LV',  
"lebanon" => 'LB',  
"lesotho" => 'LS',  
"liberia" => 'LR',  
"libyan arab jamahiriya" => 'LY',  
"liechtenstein" => 'LI',  
"lithuania" => 'LT',  
"luxembourg" => 'LU',  
"macao" => 'MO',  
"macedonia, the former yugoslav republic of" => 'MK',  
"madagascar" => 'MG',  
"malawi" => 'MW',  
"malaysia" => 'MY',  
"maldives" => 'MV',  
"mali" => 'ML',  
"malta" => 'MT',  
"marshall islands" => 'MH',  
"martinique" => 'MQ',  
"mauritania" => 'MR',  
"mauritius" => 'MU',  
"mayotte" => 'YT',  
"mexico" => 'MX',  
"micronesia, federated states of" => 'FM',  
"moldova, republic of" => 'MD',  
"monaco" => 'MC',  
"mongolia" => 'MN',  
"montenegro" => 'ME',  
"montserrat" => 'MS',  
"morocco" => 'MA',  
"mozambique" => 'MZ',  
"myanmar" => 'MM',  
"namibia" => 'NA',  
"nauru" => 'NR',  
"nepal" => 'NP',  
"netherlands" => 'NL',  
"netherlands antilles" => 'AN',  
"new caledonia" => 'NC',  
"new zealand" => 'NZ',  
"nicaragua" => 'NI',  
"niger" => 'NE',  
"nigeria" => 'NG',  
"niue" => 'NU',  
"norfolk island" => 'NF',  
"northern mariana islands" => 'MP',  
"norway" => 'NO',  
"oman" => 'OM',  
"pakistan" => 'PK',  
"palau" => 'PW',  
"palestinian territory, occupied" => 'PS',  
"panama" => 'PA',  
"papua new guinea" => 'PG',  
"paraguay" => 'PY',  
"peru" => 'PE',  
"philippines" => 'PH',  
"pitcairn" => 'PN',  
"poland" => 'PL',  
"portugal" => 'PT',  
"puerto rico" => 'PR',  
"qatar" => 'QA',  
"réunion" => 'RE',  
"romania" => 'RO',  
"russian federation" => 'RU',  
"rwanda" => 'RW',  
"saint barthélemy" => 'BL',  
"saint helena" => 'SH',  
"saint kitts and nevis" => 'KN',  
"saint lucia" => 'LC',  
"saint martin (french part)" => 'MF',  
"saint pierre and miquelon" => 'PM',  
"saint vincent and the grenadines" => 'VC',  
"samoa" => 'WS',  
"san marino" => 'SM',  
"sao tome and principe" => 'ST',  
"saudi arabia" => 'SA',  
"senegal" => 'SN',  
"serbia" => 'RS',  
"seychelles" => 'SC',  
"sierra leone" => 'SL',  
"singapore" => 'SG',  
"slovakia" => 'SK',  
"slovenia" => 'SI',  
"solomon islands" => 'SB',  
"somalia" => 'SO',  
"south africa" => 'ZA',  
"south georgia and the south sandwich islands" => 'GS',  
"spain" => 'ES',  
"sri lanka" => 'LK',  
"sudan" => 'SD',  
"suriname" => 'SR',  
"svalbard and jan mayen" => 'SJ',  
"swaziland" => 'SZ',  
"sweden" => 'SE',  
"switzerland" => 'CH',  
"syrian arab republic" => 'SY',  
"taiwan, province of china" => 'TW',  
"tajikistan" => 'TJ',  
"tanzania, united republic of" => 'TZ',  
"thailand" => 'TH',  
"timor-leste" => 'TL',  
"togo" => 'TG',  
"tokelau" => 'TK',  
"tonga" => 'TO',  
"trinidad and tobago" => 'TT',  
"tunisia" => 'TN',  
"turkey" => 'TR',  
"turkmenistan" => 'TM',  
"turks and caicos islands" => 'TC',  
"tuvalu" => 'TV',  
"uganda" => 'UG',  
"ukraine" => 'UA',  
"united arab emirates" => 'AE',  
"united kingdom" => 'GB',  
"united states" => 'US',  
"united states minor outlying islands" => 'UM',  
"uruguay" => 'UY',  
"uzbekistan" => 'UZ',  
"vanuatu" => 'VU',  
"venezuela, bolivarian republic of" => 'VE',  
"viet nam" => 'VN',  
"virgin islands, british" => 'VG',  
"virgin islands, u.s." => 'VI',  
"wallis and futuna" => 'WF',  
"western sahara" => 'EH',  
"yemen" => 'YE',  
"zambia" => 'ZM',  
"zimbabwe" => 'ZW',  
);  
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id: messages.php 1051 2010-08-29 08:10:30Z padams $  
//  
 
 
/**  
* Messages and Strings file  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision: 1051 $  
* @since owa 1.0.0  
*/  
 
$_owa_messages = array(  
 
2000 => array("An e-mail containing instructions on how to complete the password reset process has been sent to %s",1),  
2001 => array("The e-mail <B>%s</B> was not found in our database. Please check the address and try again.",1),  
2002 => array("<B>Login Failed</B>. Your user name or password did not match.",0),  
2003 => array("Your Account lacks the necessary privileges to access the requested resource.",0),  
2004 => array("You must login to access the requested resource.",0),  
2010 => array("Success. Logout Complete.",0),  
2011 => array("Error. Can't find your temporary passkey in the db.",0),  
 
// Options/Configuration related  
2500 => array("Options Saved.",0),  
2501 => array("The module was activated successfully.",0),  
2502 => array("The module was deactivated successfully.",0),  
2503 => array("Options reset to Default Values.",0),  
2504 => array("Entity %s Schema Created.",1),  
2504 => array("Goal Saved.",0),  
 
 
//User managment  
3000 => array("Success. User Added.", 0),  
3001 => array("Error. That user name is already taken.",0),  
3002 => array("The form data that you entered contained one or more errors. Please check the data and submit the from again."),  
3003 => array("Success. User profile saved.",0),  
3004 => array("Success. User acount deleted."),  
3005 => array("Enter Your New Password", 0),  
3006 => array("Success. Please login with your new password.",0),  
3007 => array("Error. Your passwords must match.",0),  
3008 => array("Error. Your password must be %s characters long.", 1),  
3009 => array("Error. A user with that email address already exists.", 0),  
3010 => array("A user with that email address does not exist.", 0),  
3011 => array("Could not update user profile."),  
3012 => array("Could not connect the database. Check your settings and try again.",0),  
 
//sites management  
3200 => array("Error. Please fill in all required fields.",0),  
3201 => array("Success. Site Profile Updated.",0),  
3202 => array("Success. Site Added.",0),  
3203 => array("Error. Site Could not be added",0),  
3204 => array("Success. Site Deleted.",0),  
3206 => array("Error. A site with that domain already exists.",0),  
3207 => array("Error. You must enter a domain when adding a web site.",0),  
3208 => array("Error. That site does not exist.",0),  
3208 => array("Please remove the http:// from your beginning of your domain.",0),  
 
 
//install  
3300 => array("Could not connect to the database. Please check the database connection settings in your configuration file and try again.",0),  
3301 => array("This version of OWA requires PHP 5.2.x or higher.",0),  
3302 => array("Database Schema Installation failed. Please check the error log file for more details.",0),  
3303 => array("Success. Default Site Added.",0),  
3304 => array("Success. Admin User Added.",0),  
3305 => array("Success. Base Database Schema Installed.",0),  
3306 => array("Error. User id already exists for some reason.",0),  
3307 => array("Updates failed. Check OWA's error log file for more details and try again.",0),  
3308 => array("Success. Updates were applied.",0),  
3309 => array("Site Domain is required.",0),  
3310 => array("E-mail Address is required.",0),  
3311 => array("These updates must be applied using the command line interface (CLI). Run <code>'/path/to/php cli.php cmd=update'</code> from your server's command shell to apply these updates. For more information on updating see the install/update page on the wiki.",0),  
// Graph related  
3500 => array("There is no data for\nthis time period.",0),  
 
// Report Related  
3600 => array("Unknown",0)  
 
);  
 
 
?>  
file:a/busui/owa/conf/os.ini (deleted)
;;; Operating Systems  
 
[info]  
name="2006-03-30"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Windows  
 
[Win.*NT 5.1]  
name="Windows XP"  
 
[Win.*NT 5\.0]  
name="Windows 2000"  
 
[Win.*(Vista|XP|2000|ME|NT|9.?)]  
name="Windows $1"  
 
[Windows .*(3\.11|NT)]  
name="Windows $1"  
 
[Win32]  
name="Windows [prior to 1995"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; UNIX  
 
[Linux 2\.(.?)\.]  
name="Linux 2.$1.x"  
 
[Linux]  
name="Linux [unknown version]"  
 
[FreeBSD .*-CURRENT$]  
name="FreeBSD -CURRENT"  
 
[FreeBSD (.?)\.]  
name="FreeBSD $1.x"  
 
[NetBSD 1\.(.?)\.]  
name="NetBSD 1.$1.x"  
 
[(Free|Net|Open)BSD]  
name="$1BSD [unknown]"  
 
[HP-UX B\.(10|11)\.]  
name="HP-UX B.$1.x"  
 
[IRIX(64)? 6\.]  
name="IRIX 6.x"  
 
[SunOS 4\.1]  
name="SunOS 4.1.x"  
 
[SunOS 5\.([4-6])]  
name="Solaris 2.$1.x"  
 
[SunOS 5\.([78])]  
name="Solaris $1.x"  
 
[X11]  
name="UNIX [unknown]"  
 
[Unix]  
name="UNIX [unknown]"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Macintosh  
 
[Mac_PowerPC]  
name="Mac OS [PowerPC]"  
 
[Mac OS X]  
name="Mac OS X"  
 
[*]  
name="Unknown OS"  
[\?(?:.+&|)q=(.+?)(?:&|$)]  
[search\?(?:.+&|)p=(.+?)(?:&|$)]  
[\?(?:.+&|)Keywords=(.+?)(?:&|$)]  
[\?(?:.+&|)MT=(.+?)(?:&|$)]  
[\?(?:.+&|)Q=(.+?)(?:&|$)]  
[\?(?:.+&|)QUERY=(.+?)(?:&|$)]  
[\?(?:.+&|)Suchwort=(.+?)(?:&|$)]  
[\?(?:.+&|)ask=(.+?)(?:&|$)]  
[\?(?:.+&|)eingabe=(.+?)(?:&|$)]  
[\?(?:.+&|)in=(.+?)(?:&|$)]  
[\?(?:.+&|)keyword=(.+?)(?:&|$)]  
[\?(?:.+&|)keywords=(.+?)(?:&|$)]  
[\?(?:.+&|)kw=(.+?)(?:&|$)]  
[\?(?:.+&|)mots=(.+?)(?:&|$)]  
[\?(?:.+&|)motscles=(.+?)(?:&|$)]  
[\?(?:.+&|)query=(.+?)(?:&|$)]  
[\?(?:.+&|)query2=(.+?)(?:&|$)]  
[\?(?:.+&|)queryterm=(.+?)(?:&|$)]  
[\?(?:.+&|)sTerm=(.+?)(?:&|$)]  
[\?(?:.+&|)sc=(.+?)(?:&|$)]  
[\?(?:.+&|)search=(.+?)(?:&|$)]  
[\?(?:.+&|)search2=(.+?)(?:&|$)]  
[\?(?:.+&|)searchfor=(.+?)(?:&|$)]  
[\?(?:.+&|)searchText=(.+?)(?:&|$)]  
[\?(?:.+&|)srch=(.+?)(?:&|$)]  
[\?(?:.+&|)su=(.+?)(?:&|$)]  
[\?(?:.+&|)such=(.+?)(?:&|$)]  
[\?(?:.+&|)suche=(.+?)(?:&|$)]  
[\?(?:.+&|)szukaj=(.+?)(?:&|$)]  
#bot#  
#crawl#  
#spider#  
#curl#  
#host#  
#localhost#  
#java#  
#libcurl#  
#libwww#  
#lwp#  
#perl#  
#php#  
#wget#  
#search#  
;;; Search Engines  
 
[info]  
name="2006-02-22"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Google  
[Google]  
name="Google"  
 
[google\.co\.uk/custom\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[groups\.google\.(?:com|fr)/groups\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[go(?:[ogle]{4})\.[a-z.]+(?::80|)/(?:search|linux|de|ie|url|custom|cobrand|bsd|mac|netscape|uk|redhat|webhp)\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[google\.com/u/[A-Za-z0-9]*\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[images\.google\.[a-z]*/imgres\?(?:.+&|)imgurl=(.+?)(?:&|$)]  
parent=Google  
 
[images\.google\.[a-z]*/images\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[google\.netscape\.com/(?:netscape|search)\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[216\.239\.[0-9]+\.100/search\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[free\.fr/google\.pl\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Google  
 
[google\.com/search\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Google  
 
[google\.netscape\.com/netscape\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Google  
 
[google\.com/netscape\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Google  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OVERTURE  
 
[Overture]  
name="Overture"  
 
[overture\.com/d/search[^?]*\?(?:.+&|)Keywords=(.+?)(?:&|$)]  
parent=Overture  
 
[search\.as\.orientation\.com/cgi-bin/gotosearch\.cgi\?(?:.+&|)Keywords=(.+?)(?:&|$)]  
parent=Overture  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HOTBOT  
 
[Hotbot]  
name="HotBot"  
 
[hotbot\?(?:.+&|)MT=(.+?)(?:&|$)]  
parent=Hotbot  
 
[hotbot\.lycos\.com/?\?(?:.+&|)MT=(.+?)(?:&|$)]  
parent=Hotbot  
 
[hotbot\.lycos\.com\/text/default\.asp\?(?:.+&|)MT=(.+?)(?:&|$)]  
parent=Hotbot  
 
[hotbot\.lycos\.com/director\.asp\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Hotbot  
 
[hotbot\.lycos\.com/include/nc_frameset_ink_highend\.asp\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Hotbot  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MSN  
 
[MSN]  
name="MSN search"  
 
[search\..*msn\..+/spbasic\.htm\?(?:.+&|)MT=(.+?)(?:&|$)]  
parent=MSN  
 
[search\..*msn\..+/(?:sp)?results\.asp\?(?:.+&|)MT=(.+?)(?:&|$)]  
parent=MSN  
 
[search\.[a-z.]*msn\.[a-z.]+/(?:sp)?(?:results\.asp|basic\.htm|results\.aspx)\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=MSN  
 
[search\.[a-z.]*msn\.[a-z.]+/autosearch/as_(?:pane)?results\.asp\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=MSN  
 
[msn\.[^/]+/[^?]+?default\.asp\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=MSN  
 
[encarta\.msn\.com/(?:encarta|find)/search\.asp\?(?:.+&|)search=(.+?)(?:&|$)]  
name="MSN Encarta"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Random Engines  
 
[goo\.ne\.jp/[^?]+\.asp\?(?:.+&|)MT=(.+?)(?:&|$)]  
name="Goo Japan"  
 
[search\.icq\.com/default\.asp\?(?:.+&|)MT=(.+?)(?:&|$)]  
name="ICQ Directory"  
 
[nomade\.(?:tiscali\.)?fr/(?:ink|[_a-zA-Z0-9]*recherche[_a-zA-Z0-9]*)\.asp\?(?:.+&|)MT=(.+?)(?:&|$)]  
name="Nomade"  
 
[yahoo\.co\.jp/bin/search\?(?:.+&|)p=(.+?)(?:&|$)]  
name="Yahoo Japan"  
 
[metacrawler\.com(?:/crawler|)\?(?:.+&|)general=(.+?)(?:&|$)]  
name="MetaCrawler"  
 
[chello\.[^/]+/utilities/search[^?]*\?(?:.+&|)keywords=(.+?)(?:&|$)]  
name="Chello"  
 
[Voila]  
name"Viola"  
 
[voila\.[^/]+/(?:S/)?(?:ns|www|msie_fr|quiquoiou|voilang|voila|search|wanadoo[a-z_]*|r?msie4[a-z_]*)\?(?:.+&|)kw=(.+?)(?:&|$)]  
parent=Voila  
 
[voila\.fr/voila\?(?:.+&|)kw=(.+?)(?:&|$)]  
parent=Voila  
 
[voila\.fr/(?:quiquoiou|voilang|voila|search|wanadoo[a-z_]*|r?msie4[a-z_]*)/?\?(?:.+&|)mots=(.+?)(?:&|$)]  
parent=Voila  
 
[search\.ke\.wanadoo\.fr/S/wanadoo\?(?:.+&|)kw=(.+?)(?:&|$)]  
name="Wanadoo.fr"  
 
[freshmeat\.net/search/?\?(?:.+&|)q=(.+?)(?:&|$)]  
name="Freshmeat"  
 
[Vivisimo]  
name="Vivisimo"  
 
[vivisimo.com/search\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Vivisimo  
 
[vivisimo\.com/cgi-bin/xml2html\.sh\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=Vivisimo  
 
[vivisimo\.com/cgi-bin/treeHtmlMain\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=Vivisimo  
 
[webcrawler.com/cgi-bin/WebQuery\?(?:.+&|)searchText=(.+?)(?:&|$)]  
name="WebCrawler"  
 
[findology\.com/(?:ce/|)search\.pl\?(?:.+&|)search=(.+?)(?:&|$)]  
name="Findology"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Search.com  
 
[Search.com]  
name="Search.com"  
 
[search\.cnet\.com/Infoseek/\?(?:.+&|)QUERY=(.+?)(?:&|$)]  
parent=Search.com  
 
[search\.com/Infoseek/\?(?:.+&|)QUERY=(.+?)(?:&|$)]  
parent=Search.com  
 
[search\.com/search\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Search.com  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ask Jeeves  
 
[Ask_Jeeves]  
name="Ask Jeeves"  
 
 
[(?:askjeeves|aj|ask)\..+/main/meta[aA]nswer\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[(?:askjeeves|aj|ask)\..+/main/[aA]sk[jJ]eeves\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[(?:askjeeves|aj|ask)\..+/main/followup\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[(?:askjeeves|aj|ask)\..+/main/Links\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[(?:askjeeves|aj|ask)\..+/main/moreResults\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[tm\.ask\.com/r\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
[ask\.co\.uk/main/followup40\.asp\?(?:.+&|)ask=(.+?)(?:&|$)]  
parent=Ask_Jeeves  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LookSmart  
 
[Looksmart]  
name="Looksmart"  
 
[looksmart\.com\?(?:.+&|)key=(.+?)(?:&|$)]  
parent=Looksmart  
 
[looksmart\.(?:co\.uk|com)/r_search\?(?:.+&|)key=(.+?)(?:&|$)]  
parent=Looksmart  
 
[surfy\.com/cgi-bin/search\?(?:.+&|)key=(.+?)(?:&|$)]  
parent=Looksmart  
 
[synd(?:-[a-z]+)?\.looksmart\.co\.uk/synd-[a-z]*/Search[a-z]*\.jsp\?(?:.+&|)key=(.+?)(?:&|$)]  
parent=Looksmart  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Alltheweb  
 
[alltheweb\.(?:com|net)/search\?(?:.+&|)q=(.+?)(?:&|$)]  
name="Alltheweb"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AltaVista  
 
[Altavista]  
name="AltaVista"  
 
[altavista\.com/(?:query|q|)\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/iepane\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/sites/search/res_text\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/sites/listings/GT_av\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/web\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/iepane\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.com/sites/search/res_text\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Altavista  
 
[altavista\.digital\.com/sites/search/web\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Altavista  
 
[[-a-z]+\.altavista\.com/q\?(?:.+&|)what=(.+?)(?:&|$)]  
parent=Altavista  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CompuServe  
 
[CompuServe]  
name="Compuserve"  
 
[compuserve(?:office)*\.de/suche/suche\.jsp\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=CompuServe  
 
[cissearch\.compuserve\.com/search/cssearch/cssearch-(?:frameset|results)\.adp\?(?:.+&|)sTerm=(.+?)(?:&|$)]  
parent=CompuServe  
 
[search\.cs\.com/search/cssearch/cssearch-frameset\.adp\?(?:.+&|)sTerm=(.+?)(?:&|$)]  
parent=CompuServe  
 
[websearch\.cs\.com/cs/results/cssearch-(?:banner|frameset)\.adp\?(?:.+&|)sTerm=(.+?)(?:&|$)]  
parent=CompuServe  
 
[websearch\.cs\.com/gateway/results/gateway-(?:cat|frameset|results|banner)\.adp\?(?:.+&|)sTerm=(.+?)(?:&|$)]  
parent=CompuServe  
 
[search\.compuserve\.co\.uk/results\.adp\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=CompuServe  
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dogpile  
 
[Dogpile]  
name="Dogpile"  
 
[dogpile\.com/texis/search\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Dogpile  
 
[dogpile\.com/info.dogpl/search/web/(?:.+&|)]  
parent=Dogpile  
 
[catalog\.dogpile\.com/texis/catalog\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Dogpile  
 
[catalog\.dogpile\.com/texis/redir/main\.bin\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Dogpile  
 
[opendir\.dogpile\.com/texis/dpdir/search\.html\?(?:.+&|)q=(.+?)(?:&|$)]  
parent=Dogpile  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL  
 
[AOL]  
name="AOL"  
 
[(?:search|suchen|recherche|aolrecherches)\.aol\.(?:co\.)?[a-z.]+/(?:search|minisearch|itemsearch|results|web|cat|dirsearch|advncd|redirect)(?:_[a-z]+)?\.adp\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=AOL  
 
[uk-nf01\.web\.aol\.com/cgi-bin/pursuit\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=AOL  
 
[americaonline\.com\.br/cgi-bin\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=AOL  
 
[shopping\.aol\.de/scripts/ao/results\.php\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=AOL  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LYCOS  
 
[Lycos]  
name="Lycos"  
 
[(?:richmedia|multimedia|search)\.lycos\.com/default.asp\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[lycosuk\.co\.uk/cgi-bin/pursuit\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[lycos\.com(?:\.)*/srch(?:/setup\.html|/more\.html)*\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[search\.lycos\.com/main(?:/|/default.asp|)\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[lycos\.com/srch/\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[lycos\.com/srch/index\.html\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
[search\.lycos\.com/main\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Lycos  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAMA  
 
[Mamma]  
name="Mamma"  
 
[mamma\.com/Mamma\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Mamma  
 
[mamma[0-9]+\.mamma\.com/Mamma\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Mamma  
 
[partners\.mamma\.com/(?:Altavista|Askjeeves1|Beaucoup|Botbot|Cb_12c4|HotSheet|Hotbar|Pages)\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Mamma  
 
[mamma\.com/Mamma_pictures\?(?:.+&|)query=(.+?)(?:&|$)]  
parent=Mamma  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EXCITE  
 
[Excite]  
name="Excite"  
 
[search\.excite\.com\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=Excite  
 
[excite\.[a-z.]+/search\search.dcg\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=Excite  
 
[\.excite(?:\.[a-z]+|)\.[a-z]+/[^?]+\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Excite  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; YAHOO  
 
[Yahoo]  
name="Yahoo!"  
 
[de\.finance\.yahoo\.com/q\?(?:.+&|)s=(.+?)(?:&|$)]  
parent=Yahoo  
 
[(?:[a-z]+\.)?search\.yahoo\.[^/]+/(?:[a-z]+/)?search/?[^?]*\?(?:.+&|)p=(.+?)(?:&|$)]  
parent=Yahoo  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DMOZ  
 
[dmoz]  
name="The Open Directory Project (DMOZ)"  
 
[search\.dmoz\.org\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=dmoz  
 
[directory\.wwwresources\.com/directory.cgi\?(?:.+&|)search2=(.+?)(?:&|$)]  
parent=dmoz  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NETSCAPE  
 
[Netscape]  
name="Netscape"  
 
[(?:search|search-intl|directory)\.netscape\.com/(?:[a-z]*/)?google\.tmpl\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
[search\.netscape\.com/search.psp\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
[search\.netscape\.com\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
[directory\.netscape\.com/cgi-bin/search\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
[directory\.netscape\.com/search\.tmpl\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
[search-intl\.netscape\.com/(?:de|fr|uk)/search(?:[0-9]|)\.tmpl\?(?:.+&|)search=(.+?)(?:&|$)]  
parent=Netscape  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Default  
 
;;; [*]  
;;; name="Unknown Referer"  
 
file:a/busui/owa/daemon.php (deleted)
<?php  
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006-2011 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* OWA Daemon  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
require_once('owa_env.php');  
require_once(OWA_DIR.'owa_php.php');  
require_once(OWA_BASE_CLASS_DIR.'daemon.php');  
 
define('OWA_DAEMON', true);  
 
if (!empty($_POST)) {  
exit();  
} elseif (!empty($_GET)) {  
exit();  
}  
 
$owa = new owa_php();  
 
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
// start daemon  
$daemon = new owa_daemon();  
$daemon->start();  
 
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists('owa_observer')) {  
 
require_once(OWA_BASE_CLASSES_DIR. 'owa_observer.php');  
}  
 
if (!class_exists('owa_event') ) {  
require_once(OWA_BASE_CLASS_DIR.'event.php');  
}  
 
define('OWA_EHS_EVENT_HANDLED', 2);  
define('OWA_EHS_EVENT_FAILED', 3);  
 
/**  
* Event Dispatcher  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class eventQueue {  
 
/**  
* Stores listeners  
*  
*/  
var $listeners = array();  
 
/**  
* Stores listener IDs by event type  
*  
*/  
var $listenersByEventType = array();  
 
/**  
* Stores listener IDs by event type  
*  
*/  
var $listenersByFilterType = array();  
 
/**  
* Constructor  
*  
*/  
function __construct() {  
 
}  
 
/**  
* Attach  
*  
* Attaches observers by event type.  
* Takes a valid user defined callback function for use by PHP's call_user_func_array  
*  
* @param $event_name string  
* @param $observer mixed can be a function name or function array  
* @return bool  
*/  
 
function attach($event_name, $observer) {  
 
$id = md5(microtime());  
 
// Register event names for this handler  
if(is_array($event_name)) {  
 
foreach ($event_name as $k => $name) {  
 
$this->listenersByEventType[$name][] = $id;  
}  
 
} else {  
 
$this->listenersByEventType[$event_name][] = $id;  
}  
 
$this->listeners[$id] = $observer;  
 
return true;  
}  
 
/**  
* Attach  
*  
* Attaches observers by filter type.  
* Takes a valid user defined callback function for use by PHP's call_user_func_array  
*  
* @param $filter_name string  
* @param $observer mixed can be a function name or function array  
* @return bool  
*/  
 
function attachFilter($filter_name, $observer, $priority = 10) {  
 
$id = md5(microtime());  
 
$this->listenersByFilterType[$filter_name][$priority][] = $id;  
 
$this->listeners[$id] = $observer;  
 
}  
 
/**  
* Notify  
*  
* Notifies all handlers of events in order that they were registered  
*  
* @param $event_type string  
* @param $event array  
* @return bool  
*/  
function notify($event) {  
 
$responses = array();  
owa_coreAPI::debug("Notifying listeners of ".$event->getEventType());  
//print_r($this->listenersByEventType[$event_type] );  
//print $event->getEventType();  
if (array_key_exists($event->getEventType(), $this->listenersByEventType)) {  
$list = $this->listenersByEventType[$event->getEventType()];  
//print_r($list);  
if (!empty($list)) {  
foreach ($this->listenersByEventType[$event->getEventType()] as $k => $observer_id) {  
//print_r($list);  
$class = get_class( $this->listeners[$observer_id][0] );  
$responses[ $class ] = call_user_func_array($this->listeners[$observer_id], array($event));  
//owa_coreAPI::debug(print_r($event, true));  
owa_coreAPI::debug(sprintf("%s event handled by %s.",$event->getEventType(), get_class($this->listeners[$observer_id][0])));  
}  
}  
} else {  
owa_coreAPI::debug("no listeners registered for this event type.");  
}  
 
owa_coreAPI::debug('EHS: Responses - '.print_r($responses, true));  
 
if ( in_array( OWA_EHS_EVENT_FAILED, $responses, true ) ) {  
owa_coreAPI::debug("EHS: Event was not handled successfully by some handlers.");  
//$q = $this->getAsyncEventQueue(owa_coreAPI::getSetting('base', 'event_queue_type'));  
//$q->addToQueue($event);  
return OWA_EHS_EVENT_FAILED;  
} else {  
owa_coreAPI::debug("EHS: Event was handled successfully by all handlers.");  
return OWA_EHS_EVENT_HANDLED;  
}  
 
}  
 
/**  
* Notify Untill  
*  
* Notifies all handlers of events in order that they were registered  
* Stops notifying after first handler returns true  
*  
* @param $event_type string  
* @param $event array  
* @return bool  
*/  
 
function notifyUntill() {  
owa_coreAPI::debug("Notifying Until listener for $event_type answers");  
}  
 
/**  
* Filter  
*  
* Filters event by handlers in order that they were registered  
*  
* @param $filter_name string  
* @param $value array  
* @return $new_value mixed  
*/  
function filter($filter_name, $value = '') {  
owa_coreAPI::debug("Filtering $filter_name");  
 
if (array_key_exists($filter_name, $this->listenersByFilterType)) {  
// sort the filter list by priority  
ksort($this->listenersByFilterType[$filter_name]);  
//get the function arguments  
$args = func_get_args();  
// outer priority loop  
foreach ($this->listenersByFilterType[$filter_name] as $priority) {  
// inner filter class/function loop  
foreach ($priority as $observer_id) {  
// pass args to filter  
owa_coreAPI::debug(sprintf("Filter: %s::%s. Value passed: %s", get_class($this->listeners[$observer_id][0]),$this->listeners[$observer_id][1], print_r($value, true)));  
$value = call_user_func_array($this->listeners[$observer_id], array_slice($args,1));  
owa_coreAPI::debug(sprintf("Filter: %s::%s. Value returned: %s", get_class($this->listeners[$observer_id][0]),$this->listeners[$observer_id][1], print_r($value, true)));  
// set filterred value as value in args for next filter  
$args[1] = $value;  
// debug whats going on  
owa_coreAPI::debug(sprintf("%s filtered by %s.", $filter_name, get_class($this->listeners[$observer_id][0])));  
}  
}  
}  
 
return $value;  
}  
 
/**  
* Log  
*  
* Notifies handlers of tracking events  
* Provides switch for async notification  
*  
* @param $event_params array  
* @param $event_type string  
*/  
function log($event_params, $event_type = '') {  
//owa_coreAPI::debug("Notifying listeners of tracking event type: $event_type");  
 
if (!is_a($event_params,'owa_event')) {  
$event = owa_coreAPI::supportClassFactory('base', 'event');  
$event->setProperties($event_params);  
$event->setEventType($event_type);  
} else {  
$event = $event_params;  
}  
 
$this->asyncNotify($event);  
 
}  
 
/**  
* Async Notify  
*  
* Adds event to async notiication queue for notification by another process.  
*  
* @param $event array  
* @return bool  
*/  
function asyncNotify($event) {  
 
// check config to see if async mode is enabled, if not fall back to realtime notification  
if (owa_coreAPI::getSetting('base', 'queue_events')) {  
owa_coreAPI::debug(sprintf("Adding event of %s to async %s queue.", $event->getEventType(), owa_coreAPI::getSetting('base', 'event_queue_type')));  
// check to see first if OWA is not already acting as a remote event queue,  
// then check to see if we are configured to use a remote or local event queue  
// then see if we have an endpoint  
if (!owa_coreAPI::getSetting('base', 'is_remote_event_queue') &&  
owa_coreAPI::getSetting('base', 'use_remote_event_queue') &&  
owa_coreAPI::getSetting('base', 'remote_event_queue_type') &&  
owa_coreAPI::getSetting('base', 'remote_event_queue_endpoint')) {  
// get a network queue  
$q = $this->getAsyncEventQueue(owa_coreAPI::getSetting('base', 'remote_event_queue_type'));  
// use a local event queue  
} else {  
// get a local event queue  
$q = $this->getAsyncEventQueue(owa_coreAPI::getSetting('base', 'event_queue_type'));  
}  
 
// if an event queue is returned then pass it the event  
if ($q) {  
 
return $q->addToQueue($event);  
// otherwise skip the queue and just notify the listeners immeadiately.  
} else {  
return $this->notify($event);  
}  
 
// otherwise skip the queue and just notify the listeners immeadiately.  
} else {  
return $this->notify($event);  
}  
}  
 
function getAsyncEventQueue($type) {  
 
static $q = array();  
 
if ( ! array_key_exists( $type, $q ) ) {  
 
switch( $type ) {  
 
case 'http':  
$q['http'] = owa_coreAPI::supportClassFactory( 'base', 'httpEventQueue' );  
break;  
case 'database':  
$q['database'] = owa_coreAPI::supportClassFactory( 'base', 'dbEventQueue' );  
break;  
case 'file':  
$q['file'] = owa_coreAPI::supportClassFactory( 'base', 'fileEventQueue' );  
break;  
}  
}  
 
if ( array_key_exists( $type, $q ) ) {  
return $q[$type];  
} else {  
owa_coreAPI::debug('No event queue of that type exists.');  
return false;  
}  
}  
 
function eventFactory() {  
 
return owa_coreAPI::supportClassFactory('base', 'event');  
}  
 
function makeEvent($type = '') {  
 
$event = $this->eventFactory();  
 
if ($type) {  
$event->setEventType($type);  
}  
 
return $event;  
}  
 
/*  
function processEventQueue($processing_queue_type = '') {  
 
// get the primary async queue  
 
// get an item from the queue  
 
// send to the notify method  
 
// check return status  
 
// mark item accordingly  
}  
*/  
 
/**  
* Singleton  
*  
* @static  
* @return object  
* @access public  
*/  
public static function &get_instance() {  
 
static $eq;  
 
if (empty($eq)) {  
$eq = new eventQueue();  
}  
 
return $eq;  
}  
 
}  
 
?>  
<?php /* $Id: CronParser.php,v 1.7 2005/09/12 01:04:05 ns Exp $ */  
 
/**####################################################################################################**\  
Version: V1.01  
Release Date: 12 Sep 2005  
Licence: GPL  
By: Nikol S  
Please send bug reports to ns@eyo.com.au  
\**####################################################################################################**/  
 
/* This class is based on the concept in the CronParser class written by Mick Sear http://www.ecreate.co.uk  
* The following functions are direct copies from or based on the original class:  
* getLastRan(), getDebug(), debug(), expand_ranges()  
*  
* Who can use this class?  
* This class is idea for people who can not use the traditional Unix cron through shell.  
* One way of using is embedding the calling script in a web page which is often visited.  
* The script will work out the last due time, by comparing with run log timestamp. The scrip  
* will envoke any scripts needed to run, be it deleting older table records, or updating prices.  
* It can parse the same cron string used by Unix.  
*/  
 
/* Usage example:  
 
$cron_str0 = "0,12,30-51 3,21-23,10 1-25 9-12,1 0,3-7";  
require_once("CronParser.php");  
$cron = new CronParser();  
$cron->calcLastRan($cron_str0);  
// $cron->getLastRanUnix() returns an Unix timestamp  
echo "Cron '$cron_str0' last due at: " . date('r', $cron->getLastRanUnix()) . "<p>";  
// $cron->getLastRan() returns last due time in an array  
print_r($cron->getLastRan());  
echo "Debug:<br>" . nl2br($cron->getDebug());  
 
$cron_str1 = "3 12 * * *";  
if ($cron->calcLastRan($cron_str1))  
{  
echo "<p>Cron '$cron_str1' last due at: " . date('r', $cron->getLastRanUnix()) . "<p>";  
print_r($cron->getLastRan());  
}  
else  
{  
echo "Error parsing";  
}  
echo "Debug:<br>" . nl2br($cron->getDebug());  
 
*#######################################################################################################  
*/  
 
class CronParser  
{  
 
var $bits = Array(); //exploded String like 0 1 * * *  
var $now = Array(); //Array of cron-style entries for time()  
var $lastRan; //Timestamp of last ran time.  
var $taken;  
var $debug;  
var $year;  
var $month;  
var $day;  
var $hour;  
var $minute;  
var $minutes_arr = array(); //minutes array based on cron string  
var $hours_arr = array(); //hours array based on cron string  
var $months_arr = array(); //months array based on cron string  
 
function getLastRan()  
{  
return explode(",", strftime("%M,%H,%d,%m,%w,%Y", $this->lastRan)); //Get the values for now in a format we can use  
}  
 
function getLastRanUnix()  
{  
return $this->lastRan;  
}  
 
function getDebug()  
{  
return $this->debug;  
}  
 
function debug($str)  
{  
if (is_array($str))  
{  
$this->debug .= "\nArray: ";  
foreach($str as $k=>$v)  
{  
$this->debug .= "$k=>$v, ";  
}  
 
}  
else  
{  
$this->debug .= "\n$str";  
}  
//echo nl2br($this->debug);  
}  
 
/**  
* Assumes that value is not *, and creates an array of valid numbers that  
* the string represents. Returns an array.  
*/  
function expand_ranges($str)  
{  
if (strstr($str, ","))  
{  
$arParts = explode(',', $str);  
foreach ($arParts AS $part)  
{  
if (strstr($part, '-'))  
{  
$arRange = explode('-', $part);  
for ($i = $arRange[0]; $i <= $arRange[1]; $i++)  
{  
$ret[] = $i;  
}  
}  
else  
{  
$ret[] = $part;  
}  
}  
}  
elseif (strstr($str, '-'))  
{  
$arRange = explode('-', $str);  
for ($i = $arRange[0]; $i <= $arRange[1]; $i++)  
{  
$ret[] = $i;  
}  
}  
else  
{  
$ret[] = $str;  
}  
$ret = array_unique($ret);  
sort($ret);  
return $ret;  
}  
 
function daysinmonth($month, $year)  
{  
return date('t', mktime(0, 0, 0, $month, 1, $year));  
}  
 
/**  
* Calculate the last due time before this moment  
*/  
function calcLastRan($string)  
{  
 
$tstart = microtime();  
$this->debug = "";  
$this->lastRan = 0;  
$this->year = NULL;  
$this->month = NULL;  
$this->day = NULL;  
$this->hour = NULL;  
$this->minute = NULL;  
$this->hours_arr = array();  
$this->minutes_arr = array();  
$this->months_arr = array();  
 
$string = preg_replace('/[\s]{2,}/', ' ', $string);  
 
if (preg_match('/[^-,* \\d]/', $string) !== 0)  
{  
$this->debug("Cron String contains invalid character");  
return false;  
}  
 
$this->debug("<b>Working on cron schedule: $string</b>");  
$this->bits = @explode(" ", $string);  
 
if (count($this->bits) != 5)  
{  
$this->debug("Cron string is invalid. Too many or too little sections after explode");  
return false;  
}  
 
//put the current time into an array  
$t = strftime("%M,%H,%d,%m,%w,%Y", time());  
$this->now = explode(",", $t);  
 
$this->year = $this->now[5];  
 
$arMonths = $this->_getMonthsArray();  
 
do  
{  
$this->month = array_pop($arMonths);  
}  
while ($this->month > $this->now[3]);  
 
if ($this->month === NULL)  
{  
$this->year = $this->year - 1;  
$this->debug("Not due within this year. So checking the previous year " . $this->year);  
$arMonths = $this->_getMonthsArray();  
$this->_prevMonth($arMonths);  
}  
elseif ($this->month == $this->now[3]) //now Sep, month = array(7,9,12)  
{  
$this->debug("Cron is due this month, getting days array.");  
$arDays = $this->_getDaysArray($this->month, $this->year);  
 
do  
{  
$this->day = array_pop($arDays);  
}  
while ($this->day > $this->now[2]);  
 
if ($this->day === NULL)  
{  
$this->debug("Smallest day is even greater than today");  
$this->_prevMonth($arMonths);  
}  
elseif ($this->day == $this->now[2])  
{  
$this->debug("Due to run today");  
$arHours = $this->_getHoursArray();  
 
do  
{  
$this->hour = array_pop($arHours);  
}  
while ($this->hour > $this->now[1]);  
 
if ($this->hour === NULL) // now =2, arHours = array(3,5,7)  
{  
$this->debug("Not due this hour and some earlier hours, so go for previous day");  
$this->_prevDay($arDays, $arMonths);  
}  
elseif ($this->hour < $this->now[1]) //now =2, arHours = array(1,3,5)  
{  
$this->minute = $this->_getLastMinute();  
}  
else // now =2, arHours = array(1,2,5)  
{  
$this->debug("Due this hour");  
$arMinutes = $this->_getMinutesArray();  
do  
{  
$this->minute = array_pop($arMinutes);  
}  
while ($this->minute > $this->now[0]);  
 
if ($this->minute === NULL)  
{  
$this->debug("Not due this minute, so go for previous hour.");  
$this->_prevHour($arHours, $arDays, $arMonths);  
}  
else  
{  
$this->debug("Due this very minute or some earlier minutes before this moment within this hour.");  
}  
}  
}  
else  
{  
$this->debug("Cron was due on " . $this->day . " of this month");  
$this->hour = $this->_getLastHour();  
$this->minute = $this->_getLastMinute();  
}  
}  
else //now Sep, arrMonths=array(7, 10)  
{  
$this->debug("Cron was due before this month. Previous month is: " . $this->year . '-' . $this->month);  
$this->day = $this->_getLastDay($this->month, $this->year);  
if ($this->day === NULL)  
{  
//No scheduled date within this month. So we will try the previous month in the month array  
$this->_prevMonth($arMonths);  
}  
else  
{  
$this->hour = $this->_getLastHour();  
$this->minute = $this->_getLastMinute();  
}  
}  
 
$tend = microtime();  
$this->taken = $tend - $tstart;  
$this->debug("Parsing $string taken " . $this->taken . " seconds");  
 
//if the last due is beyond 1970  
if ($this->minute === NULL)  
{  
$this->debug("Error calculating last due time");  
return false;  
}  
else  
{  
$this->debug("LAST DUE: " . $this->hour . ":" . $this->minute . " on " . $this->day . "/" . $this->month . "/" . $this->year);  
$this->lastRan = mktime($this->hour, $this->minute, 0, $this->month, $this->day, $this->year);  
return true;  
}  
}  
 
//get the due time before current month  
function _prevMonth($arMonths)  
{  
$this->month = array_pop($arMonths);  
if ($this->month === NULL)  
{  
$this->year = $this->year -1;  
if ($this->year <= 1970)  
{  
$this->debug("Can not calculate last due time. At least not before 1970..");  
}  
else  
{  
$this->debug("Have to go for previous year " . $this->year);  
$arMonths = $this->_getMonthsArray();  
$this->_prevMonth($arMonths);  
}  
}  
else  
{  
$this->debug("Getting the last day for previous month: " . $this->year . '-' . $this->month);  
$this->day = $this->_getLastDay($this->month, $this->year);  
 
if ($this->day === NULL)  
{  
//no available date schedule in this month  
$this->_prevMonth($arMonths);  
}  
else  
{  
$this->hour = $this->_getLastHour();  
$this->minute = $this->_getLastMinute();  
}  
}  
 
}  
 
//get the due time before current day  
function _prevDay($arDays, $arMonths)  
{  
$this->debug("Go for the previous day");  
$this->day = array_pop($arDays);  
if ($this->day === NULL)  
{  
$this->debug("Have to go for previous month");  
$this->_prevMonth($arMonths);  
}  
else  
{  
$this->hour = $this->_getLastHour();  
$this->minute = $this->_getLastMinute();  
}  
}  
 
//get the due time before current hour  
function _prevHour($arHours, $arDays, $arMonths)  
{  
$this->debug("Going for previous hour");  
$this->hour = array_pop($arHours);  
if ($this->hour === NULL)  
{  
$this->debug("Have to go for previous day");  
$this->_prevDay($arDays, $arMonths);  
}  
else  
{  
$this->minute = $this->_getLastMinute();  
}  
}  
 
//not used at the moment  
function _getLastMonth()  
{  
$months = $this->_getMonthsArray();  
$month = array_pop($months);  
 
return $month;  
}  
 
function _getLastDay($month, $year)  
{  
//put the available days for that month into an array  
$days = $this->_getDaysArray($month, $year);  
$day = array_pop($days);  
 
return $day;  
}  
 
function _getLastHour()  
{  
$hours = $this->_getHoursArray();  
$hour = array_pop($hours);  
 
return $hour;  
}  
 
function _getLastMinute()  
{  
$minutes = $this->_getMinutesArray();  
$minute = array_pop($minutes);  
 
return $minute;  
}  
 
//remove the out of range array elements. $arr should be sorted already and does not contain duplicates  
function _sanitize ($arr, $low, $high)  
{  
$count = count($arr);  
for ($i = 0; $i <= ($count - 1); $i++)  
{  
if ($arr[$i] < $low)  
{  
$this->debug("Remove out of range element. {$arr[$i]} is outside $low - $high");  
unset($arr[$i]);  
}  
else  
{  
break;  
}  
}  
 
for ($i = ($count - 1); $i >= 0; $i--)  
{  
if ($arr[$i] > $high)  
{  
$this->debug("Remove out of range element. {$arr[$i]} is outside $low - $high");  
unset ($arr[$i]);  
}  
else  
{  
break;  
}  
}  
 
//re-assign keys  
sort($arr);  
return $arr;  
}  
 
//given a month/year, list all the days within that month fell into the week days list.  
function _getDaysArray($month, $year = 0)  
{  
if ($year == 0)  
{  
$year = $this->year;  
}  
 
$days = array();  
 
//return everyday of the month if both bit[2] and bit[4] are '*'  
if ($this->bits[2] == '*' AND $this->bits[4] == '*')  
{  
$days = $this->getDays($month, $year);  
}  
else  
{  
//create an array for the weekdays  
if ($this->bits[4] == '*')  
{  
for ($i = 0; $i <= 6; $i++)  
{  
$arWeekdays[] = $i;  
}  
}  
else  
{  
$arWeekdays = $this->expand_ranges($this->bits[4]);  
$arWeekdays = $this->_sanitize($arWeekdays, 0, 7);  
 
//map 7 to 0, both represents Sunday. Array is sorted already!  
if (in_array(7, $arWeekdays))  
{  
if (in_array(0, $arWeekdays))  
{  
array_pop($arWeekdays);  
}  
else  
{  
$tmp[] = 0;  
array_pop($arWeekdays);  
$arWeekdays = array_merge($tmp, $arWeekdays);  
}  
}  
}  
$this->debug("Array for the weekdays");  
$this->debug($arWeekdays);  
 
if ($this->bits[2] == '*')  
{  
$daysmonth = $this->getDays($month, $year);  
}  
else  
{  
$daysmonth = $this->expand_ranges($this->bits[2]);  
// so that we do not end up with 31 of Feb  
$daysinmonth = $this->daysinmonth($month, $year);  
$daysmonth = $this->_sanitize($daysmonth, 1, $daysinmonth);  
}  
 
//Now match these days with weekdays  
foreach ($daysmonth AS $day)  
{  
$wkday = date('w', mktime(0, 0, 0, $month, $day, $year));  
if (in_array($wkday, $arWeekdays))  
{  
$days[] = $day;  
}  
}  
}  
$this->debug("Days array matching weekdays for $year-$month");  
$this->debug($days);  
return $days;  
}  
 
//given a month/year, return an array containing all the days in that month  
function getDays($month, $year)  
{  
$daysinmonth = $this->daysinmonth($month, $year);  
$this->debug("Number of days in $year-$month : $daysinmonth");  
$days = array();  
for ($i = 1; $i <= $daysinmonth; $i++)  
{  
$days[] = $i;  
}  
return $days;  
}  
 
function _getHoursArray()  
{  
if (empty($this->hours_arr))  
{  
$hours = array();  
 
if ($this->bits[1] == '*')  
{  
for ($i = 0; $i <= 23; $i++)  
{  
$hours[] = $i;  
}  
}  
else  
{  
$hours = $this->expand_ranges($this->bits[1]);  
$hours = $this->_sanitize($hours, 0, 23);  
}  
 
$this->debug("Hour array");  
$this->debug($hours);  
$this->hours_arr = $hours;  
}  
return $this->hours_arr;  
}  
 
function _getMinutesArray()  
{  
if (empty($this->minutes_arr))  
{  
$minutes = array();  
 
if ($this->bits[0] == '*')  
{  
for ($i = 0; $i <= 60; $i++)  
{  
$minutes[] = $i;  
}  
}  
else  
{  
$minutes = $this->expand_ranges($this->bits[0]);  
$minutes = $this->_sanitize($minutes, 0, 59);  
}  
$this->debug("Minutes array");  
$this->debug($minutes);  
$this->minutes_arr = $minutes;  
}  
return $this->minutes_arr;  
}  
 
function _getMonthsArray()  
{  
if (empty($this->months_arr))  
{  
$months = array();  
if ($this->bits[3] == '*')  
{  
for ($i = 1; $i <= 12; $i++)  
{  
$months[] = $i;  
}  
}  
else  
{  
$months = $this->expand_ranges($this->bits[3]);  
$months = $this->_sanitize($months, 1, 12);  
}  
$this->debug("Months array");  
$this->debug($months);  
$this->months_arr = $months;  
}  
return $this->months_arr;  
}  
 
}  
?>  
<?php  
/**  
* @package binarychoice.system.unix  
* @since 1.0.3  
*/  
 
// Log message levels  
define('DLOG_TO_CONSOLE', 1);  
define('DLOG_NOTICE', 2);  
define('DLOG_WARNING', 4);  
define('DLOG_ERROR', 8);  
define('DLOG_CRITICAL', 16);  
 
/**  
* Daemon base class  
*  
* Requirements:  
* Unix like operating system  
* PHP 4 >= 4.3.0 or PHP 5  
* PHP compiled with:  
* --enable-sigchild  
* --enable-pcntl  
*  
* @package binarychoice.system.unix  
* @author Michal 'Seth' Golebiowski <seth at binarychoice dot pl>  
* @copyright Copyright 2005 Seth  
* @since 1.0.3  
*/  
class Daemon  
{  
/**#@+  
* @access public  
*/  
/**  
* User ID  
*  
* @var int  
* @since 1.0  
*/  
var $userID = 99;  
 
/**  
* Group ID  
*  
* @var integer  
* @since 1.0  
*/  
var $groupID = 99;  
 
/**  
* Terminate daemon when set identity failure ?  
*  
* @var bool  
* @since 1.0.3  
*/  
var $requireSetIdentity = false;  
 
/**  
* Path to PID file  
*  
* @var string  
* @since 1.0.1  
*/  
var $pidFileLocation = '/tmp/daemon.pid';  
 
/**  
* Home path  
*  
* @var string  
* @since 1.0  
*/  
var $homePath = '/';  
/**#@-*/  
 
 
/**#@+  
* @access protected  
*/  
/**  
* Current process ID  
*  
* @var int  
* @since 1.0  
*/  
var $_pid = 0;  
 
/**  
* Is this process a children  
*  
* @var boolean  
* @since 1.0  
*/  
var $_isChildren = false;  
 
/**  
* Is daemon running  
*  
* @var boolean  
* @since 1.0  
*/  
var $_isRunning = false;  
/**#@-*/  
 
 
/**  
* Constructor  
*  
* @access public  
* @since 1.0  
* @return void  
*/  
function __construct()  
{  
error_reporting(0);  
set_time_limit(0);  
ob_implicit_flush();  
 
}  
 
/**  
* Starts daemon  
*  
* @access public  
* @since 1.0  
* @return bool  
*/  
function start()  
{  
$this->_logMessage('Starting daemon');  
 
if (!$this->_daemonize())  
{  
$this->_logMessage('Could not start daemon', DLOG_ERROR);  
 
return false;  
}  
 
 
$this->_logMessage('Running...');  
 
$this->_isRunning = true;  
 
 
while ($this->_isRunning)  
{  
$this->_doTask();  
}  
 
return true;  
}  
 
/**  
* Stops daemon  
*  
* @access public  
* @since 1.0  
* @return void  
*/  
function stop()  
{  
$this->_logMessage('Stoping daemon');  
 
$this->_isRunning = false;  
}  
 
/**  
* Do task  
*  
* @access protected  
* @since 1.0  
* @return void  
*/  
function _doTask()  
{  
// override this method  
}  
 
/**  
* Logs message  
*  
* @access protected  
* @since 1.0  
* @return void  
*/  
function _logMessage($msg, $level = DLOG_NOTICE)  
{  
// override this method  
}  
 
/**  
* Daemonize  
*  
* Several rules or characteristics that most daemons possess:  
* 1) Check is daemon already running  
* 2) Fork child process  
* 3) Sets identity  
* 4) Make current process a session laeder  
* 5) Write process ID to file  
* 6) Change home path  
* 7) umask(0)  
*  
* @access private  
* @since 1.0  
* @return void  
*/  
function _daemonize()  
{  
ob_end_flush();  
 
if ($this->_isDaemonRunning())  
{  
// Deamon is already running. Exiting  
return false;  
}  
 
if (!$this->_fork())  
{  
// Coudn't fork. Exiting.  
return false;  
}  
 
if (!$this->_setIdentity() && $this->requireSetIdentity)  
{  
// Required identity set failed. Exiting  
return false;  
}  
 
if (!posix_setsid())  
{  
$this->_logMessage('Could not make the current process a session leader', DLOG_ERROR);  
 
return false;  
}  
 
if (!$fp = @fopen($this->pidFileLocation, 'w'))  
{  
$this->_logMessage('Could not write to PID file', DLOG_ERROR);  
 
return false;  
}  
else  
{  
fputs($fp, $this->_pid);  
fclose($fp);  
}  
 
@chdir($this->homePath);  
umask(0);  
 
declare(ticks = 1);  
 
pcntl_signal(SIGCHLD, array(&$this, 'sigHandler'));  
pcntl_signal(SIGTERM, array(&$this, 'sigHandler'));  
 
return true;  
}  
 
/**  
* Cheks is daemon already running  
*  
* @access private  
* @since 1.0.3  
* @return bool  
*/  
function _isDaemonRunning()  
{  
$oldPid = @file_get_contents($this->pidFileLocation);  
 
if ($oldPid !== false && posix_kill(trim($oldPid),0))  
{  
$this->_logMessage('Daemon already running with PID: '.$oldPid, (DLOG_TO_CONSOLE | DLOG_ERROR));  
 
return true;  
}  
else  
{  
return false;  
}  
}  
 
/**  
* Forks process  
*  
* @access private  
* @since 1.0  
* @return bool  
*/  
function _fork()  
{  
$this->_logMessage('Forking...');  
 
if (!function_exists('pcntl_fork')) {  
$this->_logMessage('Forking 2...');  
}  
$pid = pcntl_fork();  
 
if ($pid == -1) // error  
{  
$this->_logMessage('Could not fork', DLOG_ERROR);  
 
return false;  
}  
else if ($pid) // parent  
{  
$this->_logMessage('Killing parent');  
 
exit();  
}  
else // children  
{  
$this->_isChildren = true;  
$this->_pid = posix_getpid();  
 
return true;  
}  
}  
 
/**  
* Sets identity of a daemon and returns result  
*  
* @access private  
* @since 1.0  
* @return bool  
*/  
function _setIdentity()  
{  
if (!posix_setgid($this->groupID) || !posix_setuid($this->userID))  
{  
$this->_logMessage('Could not set identity', DLOG_WARNING);  
 
return false;  
}  
else  
{  
return true;  
}  
}  
 
/**  
* Signals handler  
*  
* @access public  
* @since 1.0  
* @return void  
*/  
function sigHandler($sigNo)  
{  
switch ($sigNo)  
{  
case SIGTERM: // Shutdown  
$this->_logMessage('Shutdown signal');  
exit();  
break;  
 
case SIGCHLD: // Halt  
$this->_logMessage('Halt signal');  
while (pcntl_waitpid(-1, $status, WNOHANG) > 0);  
break;  
}  
}  
 
/**  
* Releases daemon pid file  
* This method is called on exit (destructor like)  
*  
* @access public  
* @since 1.0  
* @return void  
*/  
function __destruct()  
{  
if ($this->_isChildren && file_exists($this->pidFileLocation))  
{  
$this->_logMessage('Releasing daemon');  
 
unlink($this->pidFileLocation);  
}  
}  
}  
?>  
<?php  
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */  
/**  
* Converts to and from JSON format.  
*  
* JSON (JavaScript Object Notation) is a lightweight data-interchange  
* format. It is easy for humans to read and write. It is easy for machines  
* to parse and generate. It is based on a subset of the JavaScript  
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.  
* This feature can also be found in Python. JSON is a text format that is  
* completely language independent but uses conventions that are familiar  
* to programmers of the C-family of languages, including C, C++, C#, Java,  
* JavaScript, Perl, TCL, and many others. These properties make JSON an  
* ideal data-interchange language.  
*  
* This package provides a simple encoder and decoder for JSON notation. It  
* is intended for use with client-side Javascript applications that make  
* use of HTTPRequest to perform server communication functions - data can  
* be encoded into JSON notation for use in a client-side javascript, or  
* decoded from incoming Javascript requests. JSON format is native to  
* Javascript, and can be directly eval()'ed with no further parsing  
* overhead  
*  
* All strings should be in ASCII or UTF-8 format!  
*  
* LICENSE: Redistribution and use in source and binary forms, with or  
* without modification, are permitted provided that the following  
* conditions are met: Redistributions of source code must retain the  
* above copyright notice, this list of conditions and the following  
* disclaimer. Redistributions in binary form must reproduce the above  
* copyright notice, this list of conditions and the following disclaimer  
* in the documentation and/or other materials provided with the  
* distribution.  
*  
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED  
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN  
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,  
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,  
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS  
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND  
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR  
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE  
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH  
* DAMAGE.  
*  
* @category  
* @package Services_JSON  
* @author Michal Migurski <mike-json@teczno.com>  
* @author Matt Knapp <mdknapp[at]gmail[dot]com>  
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>  
* @copyright 2005 Michal Migurski  
* @version CVS: $Id: JSON.php 288200 2009-09-09 15:41:29Z alan_k $  
* @license http://www.opensource.org/licenses/bsd-license.php  
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198  
*/  
 
/**  
* Marker constant for Services_JSON::decode(), used to flag stack state  
*/  
define('SERVICES_JSON_SLICE', 1);  
 
/**  
* Marker constant for Services_JSON::decode(), used to flag stack state  
*/  
define('SERVICES_JSON_IN_STR', 2);  
 
/**  
* Marker constant for Services_JSON::decode(), used to flag stack state  
*/  
define('SERVICES_JSON_IN_ARR', 3);  
 
/**  
* Marker constant for Services_JSON::decode(), used to flag stack state  
*/  
define('SERVICES_JSON_IN_OBJ', 4);  
 
/**  
* Marker constant for Services_JSON::decode(), used to flag stack state  
*/  
define('SERVICES_JSON_IN_CMT', 5);  
 
/**  
* Behavior switch for Services_JSON::decode()  
*/  
define('SERVICES_JSON_LOOSE_TYPE', 16);  
 
/**  
* Behavior switch for Services_JSON::decode()  
*/  
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);  
 
/**  
* Converts to and from JSON format.  
*  
* Brief example of use:  
*  
* <code>  
* // create a new instance of Services_JSON  
* $json = new Services_JSON();  
*  
* // convert a complexe value to JSON notation, and send it to the browser  
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));  
* $output = $json->encode($value);  
*  
* print($output);  
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]  
*  
* // accept incoming POST data, assumed to be in JSON notation  
* $input = file_get_contents('php://input', 1000000);  
* $value = $json->decode($input);  
* </code>  
*/  
class Services_JSON  
{  
/**  
* constructs a new JSON instance  
*  
* @param int $use object behavior flags; combine with boolean-OR  
*  
* possible values:  
* - SERVICES_JSON_LOOSE_TYPE: loose typing.  
* "{...}" syntax creates associative arrays  
* instead of objects in decode().  
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.  
* Values which can't be encoded (e.g. resources)  
* appear as NULL instead of throwing errors.  
* By default, a deeply-nested resource will  
* bubble up with an error, so all return values  
* from encode() should be checked with isError()  
*/  
function Services_JSON($use = 0)  
{  
$this->use = $use;  
}  
 
/**  
* convert a string from one UTF-16 char to one UTF-8 char  
*  
* Normally should be handled by mb_convert_encoding, but  
* provides a slower PHP-only method for installations  
* that lack the multibye string extension.  
*  
* @param string $utf16 UTF-16 character  
* @return string UTF-8 character  
* @access private  
*/  
function utf162utf8($utf16)  
{  
// oh please oh please oh please oh please oh please  
if(function_exists('mb_convert_encoding')) {  
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');  
}  
 
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});  
 
switch(true) {  
case ((0x7F & $bytes) == $bytes):  
// this case should never be reached, because we are in ASCII range  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return chr(0x7F & $bytes);  
 
case (0x07FF & $bytes) == $bytes:  
// return a 2-byte UTF-8 character  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return chr(0xC0 | (($bytes >> 6) & 0x1F))  
. chr(0x80 | ($bytes & 0x3F));  
 
case (0xFFFF & $bytes) == $bytes:  
// return a 3-byte UTF-8 character  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return chr(0xE0 | (($bytes >> 12) & 0x0F))  
. chr(0x80 | (($bytes >> 6) & 0x3F))  
. chr(0x80 | ($bytes & 0x3F));  
}  
 
// ignoring UTF-32 for now, sorry  
return '';  
}  
 
/**  
* convert a string from one UTF-8 char to one UTF-16 char  
*  
* Normally should be handled by mb_convert_encoding, but  
* provides a slower PHP-only method for installations  
* that lack the multibye string extension.  
*  
* @param string $utf8 UTF-8 character  
* @return string UTF-16 character  
* @access private  
*/  
function utf82utf16($utf8)  
{  
// oh please oh please oh please oh please oh please  
if(function_exists('mb_convert_encoding')) {  
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');  
}  
 
switch(strlen($utf8)) {  
case 1:  
// this case should never be reached, because we are in ASCII range  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return $utf8;  
 
case 2:  
// return a UTF-16 character from a 2-byte UTF-8 char  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return chr(0x07 & (ord($utf8{0}) >> 2))  
. chr((0xC0 & (ord($utf8{0}) << 6))  
| (0x3F & ord($utf8{1})));  
 
case 3:  
// return a UTF-16 character from a 3-byte UTF-8 char  
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
return chr((0xF0 & (ord($utf8{0}) << 4))  
| (0x0F & (ord($utf8{1}) >> 2)))  
. chr((0xC0 & (ord($utf8{1}) << 6))  
| (0x7F & ord($utf8{2})));  
}  
 
// ignoring UTF-32 for now, sorry  
return '';  
}  
 
/**  
* encodes an arbitrary variable into JSON format (and sends JSON Header)  
*  
* @param mixed $var any number, boolean, string, array, or object to be encoded.  
* see argument 1 to Services_JSON() above for array-parsing behavior.  
* if var is a strng, note that encode() always expects it  
* to be in ASCII or UTF-8 format!  
*  
* @return mixed JSON string representation of input var or an error if a problem occurs  
* @access public  
*/  
function encode($var)  
{  
header('Content-type: application/json');  
return $this->_encode($var);  
}  
/**  
* encodes an arbitrary variable into JSON format without JSON Header - warning - may allow CSS!!!!)  
*  
* @param mixed $var any number, boolean, string, array, or object to be encoded.  
* see argument 1 to Services_JSON() above for array-parsing behavior.  
* if var is a strng, note that encode() always expects it  
* to be in ASCII or UTF-8 format!  
*  
* @return mixed JSON string representation of input var or an error if a problem occurs  
* @access public  
*/  
function encodeUnsafe($var)  
{  
return $this->_encode($var);  
}  
/**  
* PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format  
*  
* @param mixed $var any number, boolean, string, array, or object to be encoded.  
* see argument 1 to Services_JSON() above for array-parsing behavior.  
* if var is a strng, note that encode() always expects it  
* to be in ASCII or UTF-8 format!  
*  
* @return mixed JSON string representation of input var or an error if a problem occurs  
* @access public  
*/  
function _encode($var)  
{  
 
switch (gettype($var)) {  
case 'boolean':  
return $var ? 'true' : 'false';  
 
case 'NULL':  
return 'null';  
 
case 'integer':  
return (int) $var;  
 
case 'double':  
case 'float':  
return (float) $var;  
 
case 'string':  
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT  
$ascii = '';  
$strlen_var = strlen($var);  
 
/*  
* Iterate over every character in the string,  
* escaping with a slash or encoding to UTF-8 where necessary  
*/  
for ($c = 0; $c < $strlen_var; ++$c) {  
 
$ord_var_c = ord($var{$c});  
 
switch (true) {  
case $ord_var_c == 0x08:  
$ascii .= '\b';  
break;  
case $ord_var_c == 0x09:  
$ascii .= '\t';  
break;  
case $ord_var_c == 0x0A:  
$ascii .= '\n';  
break;  
case $ord_var_c == 0x0C:  
$ascii .= '\f';  
break;  
case $ord_var_c == 0x0D:  
$ascii .= '\r';  
break;  
 
case $ord_var_c == 0x22:  
case $ord_var_c == 0x2F:  
case $ord_var_c == 0x5C:  
// double quote, slash, slosh  
$ascii .= '\\'.$var{$c};  
break;  
 
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):  
// characters U-00000000 - U-0000007F (same as ASCII)  
$ascii .= $var{$c};  
break;  
 
case (($ord_var_c & 0xE0) == 0xC0):  
// characters U-00000080 - U-000007FF, mask 110XXXXX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
if ($c+1 >= $strlen_var) {  
$c += 1;  
$ascii .= '?';  
break;  
}  
 
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));  
$c += 1;  
$utf16 = $this->utf82utf16($char);  
$ascii .= sprintf('\u%04s', bin2hex($utf16));  
break;  
 
case (($ord_var_c & 0xF0) == 0xE0):  
if ($c+2 >= $strlen_var) {  
$c += 2;  
$ascii .= '?';  
break;  
}  
// characters U-00000800 - U-0000FFFF, mask 1110XXXX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$char = pack('C*', $ord_var_c,  
@ord($var{$c + 1}),  
@ord($var{$c + 2}));  
$c += 2;  
$utf16 = $this->utf82utf16($char);  
$ascii .= sprintf('\u%04s', bin2hex($utf16));  
break;  
 
case (($ord_var_c & 0xF8) == 0xF0):  
if ($c+3 >= $strlen_var) {  
$c += 3;  
$ascii .= '?';  
break;  
}  
// characters U-00010000 - U-001FFFFF, mask 11110XXX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$char = pack('C*', $ord_var_c,  
ord($var{$c + 1}),  
ord($var{$c + 2}),  
ord($var{$c + 3}));  
$c += 3;  
$utf16 = $this->utf82utf16($char);  
$ascii .= sprintf('\u%04s', bin2hex($utf16));  
break;  
 
case (($ord_var_c & 0xFC) == 0xF8):  
// characters U-00200000 - U-03FFFFFF, mask 111110XX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
if ($c+4 >= $strlen_var) {  
$c += 4;  
$ascii .= '?';  
break;  
}  
$char = pack('C*', $ord_var_c,  
ord($var{$c + 1}),  
ord($var{$c + 2}),  
ord($var{$c + 3}),  
ord($var{$c + 4}));  
$c += 4;  
$utf16 = $this->utf82utf16($char);  
$ascii .= sprintf('\u%04s', bin2hex($utf16));  
break;  
 
case (($ord_var_c & 0xFE) == 0xFC):  
if ($c+5 >= $strlen_var) {  
$c += 5;  
$ascii .= '?';  
break;  
}  
// characters U-04000000 - U-7FFFFFFF, mask 1111110X  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$char = pack('C*', $ord_var_c,  
ord($var{$c + 1}),  
ord($var{$c + 2}),  
ord($var{$c + 3}),  
ord($var{$c + 4}),  
ord($var{$c + 5}));  
$c += 5;  
$utf16 = $this->utf82utf16($char);  
$ascii .= sprintf('\u%04s', bin2hex($utf16));  
break;  
}  
}  
return '"'.$ascii.'"';  
 
case 'array':  
/*  
* As per JSON spec if any array key is not an integer  
* we must treat the the whole array as an object. We  
* also try to catch a sparsely populated associative  
* array with numeric keys here because some JS engines  
* will create an array with empty indexes up to  
* max_index which can cause memory issues and because  
* the keys, which may be relevant, will be remapped  
* otherwise.  
*  
* As per the ECMA and JSON specification an object may  
* have any string as a property. Unfortunately due to  
* a hole in the ECMA specification if the key is a  
* ECMA reserved word or starts with a digit the  
* parameter is only accessible using ECMAScript's  
* bracket notation.  
*/  
 
// treat as a JSON object  
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {  
$properties = array_map(array($this, 'name_value'),  
array_keys($var),  
array_values($var));  
 
foreach($properties as $property) {  
if(Services_JSON::isError($property)) {  
return $property;  
}  
}  
 
return '{' . join(',', $properties) . '}';  
}  
 
// treat it like a regular array  
$elements = array_map(array($this, '_encode'), $var);  
 
foreach($elements as $element) {  
if(Services_JSON::isError($element)) {  
return $element;  
}  
}  
 
return '[' . join(',', $elements) . ']';  
 
case 'object':  
$vars = get_object_vars($var);  
 
$properties = array_map(array($this, 'name_value'),  
array_keys($vars),  
array_values($vars));  
 
foreach($properties as $property) {  
if(Services_JSON::isError($property)) {  
return $property;  
}  
}  
 
return '{' . join(',', $properties) . '}';  
 
default:  
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)  
? 'null'  
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");  
}  
}  
 
/**  
* array-walking function for use in generating JSON-formatted name-value pairs  
*  
* @param string $name name of key to use  
* @param mixed $value reference to an array element to be encoded  
*  
* @return string JSON-formatted name-value pair, like '"name":value'  
* @access private  
*/  
function name_value($name, $value)  
{  
$encoded_value = $this->_encode($value);  
 
if(Services_JSON::isError($encoded_value)) {  
return $encoded_value;  
}  
 
return $this->_encode(strval($name)) . ':' . $encoded_value;  
}  
 
/**  
* reduce a string by removing leading and trailing comments and whitespace  
*  
* @param $str string string value to strip of comments and whitespace  
*  
* @return string string value stripped of comments and whitespace  
* @access private  
*/  
function reduce_string($str)  
{  
$str = preg_replace(array(  
 
// eliminate single line comments in '// ...' form  
'#^\s*//(.+)$#m',  
 
// eliminate multi-line comments in '/* ... */' form, at start of string  
'#^\s*/\*(.+)\*/#Us',  
 
// eliminate multi-line comments in '/* ... */' form, at end of string  
'#/\*(.+)\*/\s*$#Us'  
 
), '', $str);  
 
// eliminate extraneous space  
return trim($str);  
}  
 
/**  
* decodes a JSON string into appropriate variable  
*  
* @param string $str JSON-formatted string  
*  
* @return mixed number, boolean, string, array, or object  
* corresponding to given JSON input string.  
* See argument 1 to Services_JSON() above for object-output behavior.  
* Note that decode() always returns strings  
* in ASCII or UTF-8 format!  
* @access public  
*/  
function decode($str)  
{  
$str = $this->reduce_string($str);  
 
switch (strtolower($str)) {  
case 'true':  
return true;  
 
case 'false':  
return false;  
 
case 'null':  
return null;  
 
default:  
$m = array();  
 
if (is_numeric($str)) {  
// Lookie-loo, it's a number  
 
// This would work on its own, but I'm trying to be  
// good about returning integers where appropriate:  
// return (float)$str;  
 
// Return float or int, as appropriate  
return ((float)$str == (integer)$str)  
? (integer)$str  
: (float)$str;  
 
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {  
// STRINGS RETURNED IN UTF-8 FORMAT  
$delim = substr($str, 0, 1);  
$chrs = substr($str, 1, -1);  
$utf8 = '';  
$strlen_chrs = strlen($chrs);  
 
for ($c = 0; $c < $strlen_chrs; ++$c) {  
 
$substr_chrs_c_2 = substr($chrs, $c, 2);  
$ord_chrs_c = ord($chrs{$c});  
 
switch (true) {  
case $substr_chrs_c_2 == '\b':  
$utf8 .= chr(0x08);  
++$c;  
break;  
case $substr_chrs_c_2 == '\t':  
$utf8 .= chr(0x09);  
++$c;  
break;  
case $substr_chrs_c_2 == '\n':  
$utf8 .= chr(0x0A);  
++$c;  
break;  
case $substr_chrs_c_2 == '\f':  
$utf8 .= chr(0x0C);  
++$c;  
break;  
case $substr_chrs_c_2 == '\r':  
$utf8 .= chr(0x0D);  
++$c;  
break;  
 
case $substr_chrs_c_2 == '\\"':  
case $substr_chrs_c_2 == '\\\'':  
case $substr_chrs_c_2 == '\\\\':  
case $substr_chrs_c_2 == '\\/':  
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||  
($delim == "'" && $substr_chrs_c_2 != '\\"')) {  
$utf8 .= $chrs{++$c};  
}  
break;  
 
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):  
// single, escaped unicode character  
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))  
. chr(hexdec(substr($chrs, ($c + 4), 2)));  
$utf8 .= $this->utf162utf8($utf16);  
$c += 5;  
break;  
 
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):  
$utf8 .= $chrs{$c};  
break;  
 
case ($ord_chrs_c & 0xE0) == 0xC0:  
// characters U-00000080 - U-000007FF, mask 110XXXXX  
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$utf8 .= substr($chrs, $c, 2);  
++$c;  
break;  
 
case ($ord_chrs_c & 0xF0) == 0xE0:  
// characters U-00000800 - U-0000FFFF, mask 1110XXXX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$utf8 .= substr($chrs, $c, 3);  
$c += 2;  
break;  
 
case ($ord_chrs_c & 0xF8) == 0xF0:  
// characters U-00010000 - U-001FFFFF, mask 11110XXX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$utf8 .= substr($chrs, $c, 4);  
$c += 3;  
break;  
 
case ($ord_chrs_c & 0xFC) == 0xF8:  
// characters U-00200000 - U-03FFFFFF, mask 111110XX  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$utf8 .= substr($chrs, $c, 5);  
$c += 4;  
break;  
 
case ($ord_chrs_c & 0xFE) == 0xFC:  
// characters U-04000000 - U-7FFFFFFF, mask 1111110X  
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8  
$utf8 .= substr($chrs, $c, 6);  
$c += 5;  
break;  
 
}  
 
}  
 
return $utf8;  
 
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {  
// array, or object notation  
 
if ($str{0} == '[') {  
$stk = array(SERVICES_JSON_IN_ARR);  
$arr = array();  
} else {  
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {  
$stk = array(SERVICES_JSON_IN_OBJ);  
$obj = array();  
} else {  
$stk = array(SERVICES_JSON_IN_OBJ);  
$obj = new stdClass();  
}  
}  
 
array_push($stk, array('what' => SERVICES_JSON_SLICE,  
'where' => 0,  
'delim' => false));  
 
$chrs = substr($str, 1, -1);  
$chrs = $this->reduce_string($chrs);  
 
if ($chrs == '') {  
if (reset($stk) == SERVICES_JSON_IN_ARR) {  
return $arr;  
 
} else {  
return $obj;  
 
}  
}  
 
//print("\nparsing {$chrs}\n");  
 
$strlen_chrs = strlen($chrs);  
 
for ($c = 0; $c <= $strlen_chrs; ++$c) {  
 
$top = end($stk);  
$substr_chrs_c_2 = substr($chrs, $c, 2);  
 
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {  
// found a comma that is not inside a string, array, etc.,  
// OR we've reached the end of the character list  
$slice = substr($chrs, $top['where'], ($c - $top['where']));  
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));  
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");  
 
if (reset($stk) == SERVICES_JSON_IN_ARR) {  
// we are in an array, so just push an element onto the stack  
array_push($arr, $this->decode($slice));  
 
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {  
// we are in an object, so figure  
// out the property name and set an  
// element in an associative array,  
// for now  
$parts = array();  
 
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {  
// "name":value pair  
$key = $this->decode($parts[1]);  
$val = $this->decode($parts[2]);  
 
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {  
$obj[$key] = $val;  
} else {  
$obj->$key = $val;  
}  
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {  
// name:value pair, where name is unquoted  
$key = $parts[1];  
$val = $this->decode($parts[2]);  
 
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {  
$obj[$key] = $val;  
} else {  
$obj->$key = $val;  
}  
}  
 
}  
 
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {  
// found a quote, and we are not inside a string  
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));  
//print("Found start of string at {$c}\n");  
 
} elseif (($chrs{$c} == $top['delim']) &&  
($top['what'] == SERVICES_JSON_IN_STR) &&  
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {  
// found a quote, we're in a string, and it's not escaped  
// we know that it's not escaped becase there is _not_ an  
// odd number of backslashes at the end of the string so far  
array_pop($stk);  
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");  
 
} elseif (($chrs{$c} == '[') &&  
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {  
// found a left-bracket, and we are in an array, object, or slice  
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));  
//print("Found start of array at {$c}\n");  
 
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {  
// found a right-bracket, and we're in an array  
array_pop($stk);  
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");  
 
} elseif (($chrs{$c} == '{') &&  
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {  
// found a left-brace, and we are in an array, object, or slice  
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));  
//print("Found start of object at {$c}\n");  
 
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {  
// found a right-brace, and we're in an object  
array_pop($stk);  
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");  
 
} elseif (($substr_chrs_c_2 == '/*') &&  
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {  
// found a comment start, and we are in an array, object, or slice  
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));  
$c++;  
//print("Found start of comment at {$c}\n");  
 
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {  
// found a comment end, and we're in one now  
array_pop($stk);  
$c++;  
 
for ($i = $top['where']; $i <= $c; ++$i)  
$chrs = substr_replace($chrs, ' ', $i, 1);  
 
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");  
 
}  
 
}  
 
if (reset($stk) == SERVICES_JSON_IN_ARR) {  
return $arr;  
 
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {  
return $obj;  
 
}  
 
}  
}  
}  
 
/**  
* @todo Ultimately, this should just call PEAR::isError()  
*/  
function isError($data, $code = null)  
{  
if (class_exists('pear')) {  
return PEAR::isError($data, $code);  
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||  
is_subclass_of($data, 'services_json_error'))) {  
return true;  
}  
 
return false;  
}  
}  
 
if (class_exists('PEAR_Error')) {  
 
class Services_JSON_Error extends PEAR_Error  
{  
function Services_JSON_Error($message = 'unknown error', $code = null,  
$mode = null, $options = null, $userinfo = null)  
{  
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);  
}  
}  
 
} else {  
 
/**  
* @todo Ultimately, this class shall be descended from PEAR_Error  
*/  
class Services_JSON_Error  
{  
function Services_JSON_Error($message = 'unknown error', $code = null,  
$mode = null, $options = null, $userinfo = null)  
{  
 
}  
}  
 
}  
 
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log.php,v 1.15 2000/06/29 23:39:45 jon Exp $  
*  
* @version $Revision: 302787 $  
* @package Log  
*/  
 
define('PEAR_LOG_EMERG', 0); /* System is unusable */  
define('PEAR_LOG_ALERT', 1); /* Immediate action required */  
define('PEAR_LOG_CRIT', 2); /* Critical conditions */  
define('PEAR_LOG_ERR', 3); /* Error conditions */  
define('PEAR_LOG_WARNING', 4); /* Warning conditions */  
define('PEAR_LOG_NOTICE', 5); /* Normal but significant */  
define('PEAR_LOG_INFO', 6); /* Informational */  
define('PEAR_LOG_DEBUG', 7); /* Debug-level messages */  
 
define('PEAR_LOG_ALL', 0xffffffff); /* All messages */  
define('PEAR_LOG_NONE', 0x00000000); /* No message */  
 
/* Log types for PHP's native error_log() function. */  
define('PEAR_LOG_TYPE_SYSTEM', 0); /* Use PHP's system logger */  
define('PEAR_LOG_TYPE_MAIL', 1); /* Use PHP's mail() function */  
define('PEAR_LOG_TYPE_DEBUG', 2); /* Use PHP's debugging connection */  
define('PEAR_LOG_TYPE_FILE', 3); /* Append to a file */  
define('PEAR_LOG_TYPE_SAPI', 4); /* Use the SAPI logging handler */  
 
/**  
* The Log:: class implements both an abstraction for various logging  
* mechanisms and the Subject end of a Subject-Observer pattern.  
*  
* @author Chuck Hagenbuch <chuck@horde.org>  
* @author Jon Parise <jon@php.net>  
* @since Horde 1.3  
* @package Log  
*/  
class Log  
{  
/**  
* Indicates whether or not the log can been opened / connected.  
*  
* @var boolean  
* @access protected  
*/  
var $_opened = false;  
 
/**  
* Instance-specific unique identification number.  
*  
* @var integer  
* @access protected  
*/  
var $_id = 0;  
 
/**  
* The label that uniquely identifies this set of log messages.  
*  
* @var string  
* @access protected  
*/  
var $_ident = '';  
 
/**  
* The default priority to use when logging an event.  
*  
* @var integer  
* @access protected  
*/  
var $_priority = PEAR_LOG_INFO;  
 
/**  
* The bitmask of allowed log levels.  
*  
* @var integer  
* @access protected  
*/  
var $_mask = PEAR_LOG_ALL;  
 
/**  
* Holds all Log_observer objects that wish to be notified of new messages.  
*  
* @var array  
* @access protected  
*/  
var $_listeners = array();  
 
/**  
* Maps canonical format keys to position arguments for use in building  
* "line format" strings.  
*  
* @var array  
* @access protected  
*/  
var $_formatMap = array('%{timestamp}' => '%1$s',  
'%{ident}' => '%2$s',  
'%{priority}' => '%3$s',  
'%{message}' => '%4$s',  
'%{file}' => '%5$s',  
'%{line}' => '%6$s',  
'%{function}' => '%7$s',  
'%{class}' => '%8$s',  
'%\{' => '%%{');  
 
/**  
* Attempts to return a concrete Log instance of type $handler.  
*  
* @param string $handler The type of concrete Log subclass to return.  
* Attempt to dynamically include the code for  
* this subclass. Currently, valid values are  
* 'console', 'syslog', 'sql', 'file', and 'mcal'.  
*  
* @param string $name The name of the actually log file, table, or  
* other specific store to use. Defaults to an  
* empty string, with which the subclass will  
* attempt to do something intelligent.  
*  
* @param string $ident The identity reported to the log system.  
*  
* @param array $conf A hash containing any additional configuration  
* information that a subclass might need.  
*  
* @param int $level Log messages up to and including this level.  
*  
* @return object Log The newly created concrete Log instance, or  
* null on an error.  
* @access public  
* @since Log 1.0  
*/  
public static function factory($handler, $name = '', $ident = '',  
$conf = array(), $level = PEAR_LOG_DEBUG)  
{  
$handler = strtolower($handler);  
$class = 'Log_' . $handler;  
$classfile = 'Log/' . $handler . '.php';  
 
/*  
* Attempt to include our version of the named class, but don't treat  
* a failure as fatal. The caller may have already included their own  
* version of the named class.  
*/  
if (!class_exists($class, false)) {  
include_once $classfile;  
}  
 
/* If the class exists, return a new instance of it. */  
if (class_exists($class, false)) {  
$obj = new $class($name, $ident, $conf, $level);  
return $obj;  
}  
 
$null = null;  
return $null;  
}  
 
/**  
* Attempts to return a reference to a concrete Log instance of type  
* $handler, only creating a new instance if no log instance with the same  
* parameters currently exists.  
*  
* You should use this if there are multiple places you might create a  
* logger, you don't want to create multiple loggers, and you don't want to  
* check for the existance of one each time. The singleton pattern does all  
* the checking work for you.  
*  
* <b>You MUST call this method with the $var = &Log::singleton() syntax.  
* Without the ampersand (&) in front of the method name, you will not get  
* a reference, you will get a copy.</b>  
*  
* @param string $handler The type of concrete Log subclass to return.  
* Attempt to dynamically include the code for  
* this subclass. Currently, valid values are  
* 'console', 'syslog', 'sql', 'file', and 'mcal'.  
*  
* @param string $name The name of the actually log file, table, or  
* other specific store to use. Defaults to an  
* empty string, with which the subclass will  
* attempt to do something intelligent.  
*  
* @param string $ident The identity reported to the log system.  
*  
* @param array $conf A hash containing any additional configuration  
* information that a subclass might need.  
*  
* @param int $level Log messages up to and including this level.  
*  
* @return object Log The newly created concrete Log instance, or  
* null on an error.  
* @access public  
* @since Log 1.0  
*/  
public static function singleton($handler, $name = '', $ident = '',  
$conf = array(), $level = PEAR_LOG_DEBUG)  
{  
static $instances;  
if (!isset($instances)) $instances = array();  
 
$signature = serialize(array($handler, $name, $ident, $conf, $level));  
if (!isset($instances[$signature])) {  
$instances[$signature] = Log::factory($handler, $name, $ident,  
$conf, $level);  
}  
 
return $instances[$signature];  
}  
 
/**  
* Abstract implementation of the open() method.  
* @since Log 1.0  
*/  
function open()  
{  
return false;  
}  
 
/**  
* Abstract implementation of the close() method.  
* @since Log 1.0  
*/  
function close()  
{  
return false;  
}  
 
/**  
* Abstract implementation of the flush() method.  
* @since Log 1.8.2  
*/  
function flush()  
{  
return false;  
}  
 
/**  
* Abstract implementation of the log() method.  
* @since Log 1.0  
*/  
function log($message, $priority = null)  
{  
return false;  
}  
 
/**  
* A convenience function for logging a emergency event. It will log a  
* message at the PEAR_LOG_EMERG log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function emerg($message)  
{  
return $this->log($message, PEAR_LOG_EMERG);  
}  
 
/**  
* A convenience function for logging an alert event. It will log a  
* message at the PEAR_LOG_ALERT log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function alert($message)  
{  
return $this->log($message, PEAR_LOG_ALERT);  
}  
 
/**  
* A convenience function for logging a critical event. It will log a  
* message at the PEAR_LOG_CRIT log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function crit($message)  
{  
return $this->log($message, PEAR_LOG_CRIT);  
}  
 
/**  
* A convenience function for logging a error event. It will log a  
* message at the PEAR_LOG_ERR log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function err($message)  
{  
return $this->log($message, PEAR_LOG_ERR);  
}  
 
/**  
* A convenience function for logging a warning event. It will log a  
* message at the PEAR_LOG_WARNING log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function warning($message)  
{  
return $this->log($message, PEAR_LOG_WARNING);  
}  
 
/**  
* A convenience function for logging a notice event. It will log a  
* message at the PEAR_LOG_NOTICE log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function notice($message)  
{  
return $this->log($message, PEAR_LOG_NOTICE);  
}  
 
/**  
* A convenience function for logging a information event. It will log a  
* message at the PEAR_LOG_INFO log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function info($message)  
{  
return $this->log($message, PEAR_LOG_INFO);  
}  
 
/**  
* A convenience function for logging a debug event. It will log a  
* message at the PEAR_LOG_DEBUG log level.  
*  
* @param mixed $message String or object containing the message  
* to log.  
*  
* @return boolean True if the message was successfully logged.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function debug($message)  
{  
return $this->log($message, PEAR_LOG_DEBUG);  
}  
 
/**  
* Returns the string representation of the message data.  
*  
* If $message is an object, _extractMessage() will attempt to extract  
* the message text using a known method (such as a PEAR_Error object's  
* getMessage() method). If a known method, cannot be found, the  
* serialized representation of the object will be returned.  
*  
* If the message data is already a string, it will be returned unchanged.  
*  
* @param mixed $message The original message data. This may be a  
* string or any object.  
*  
* @return string The string representation of the message.  
*  
* @access protected  
*/  
function _extractMessage($message)  
{  
/*  
* If we've been given an object, attempt to extract the message using  
* a known method. If we can't find such a method, default to the  
* "human-readable" version of the object.  
*  
* We also use the human-readable format for arrays.  
*/  
if (is_object($message)) {  
if (method_exists($message, 'getmessage')) {  
$message = $message->getMessage();  
} else if (method_exists($message, 'tostring')) {  
$message = $message->toString();  
} else if (method_exists($message, '__tostring')) {  
$message = (string)$message;  
} else {  
$message = var_export($message, true);  
}  
} else if (is_array($message)) {  
if (isset($message['message'])) {  
if (is_scalar($message['message'])) {  
$message = $message['message'];  
} else {  
$message = var_export($message['message'], true);  
}  
} else {  
$message = var_export($message, true);  
}  
} else if (is_bool($message) || $message === NULL) {  
$message = var_export($message, true);  
}  
 
/* Otherwise, we assume the message is a string. */  
return $message;  
}  
 
/**  
* Using debug_backtrace(), returns the file, line, and enclosing function  
* name of the source code context from which log() was invoked.  
*  
* @param int $depth The initial number of frames we should step  
* back into the trace.  
*  
* @return array Array containing four strings: the filename, the line,  
* the function name, and the class name from which log()  
* was called.  
*  
* @access private  
* @since Log 1.9.4  
*/  
function _getBacktraceVars($depth)  
{  
/* Start by generating a backtrace from the current call (here). */  
$bt = debug_backtrace();  
 
/* Store some handy shortcuts to our previous frames. */  
$bt0 = isset($bt[$depth]) ? $bt[$depth] : null;  
$bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;  
 
/*  
* If we were ultimately invoked by the composite handler, we need to  
* increase our depth one additional level to compensate.  
*/  
$class = isset($bt1['class']) ? $bt1['class'] : null;  
if ($class !== null && strcasecmp($class, 'Log_composite') == 0) {  
$depth++;  
$bt0 = isset($bt[$depth]) ? $bt[$depth] : null;  
$bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;  
$class = isset($bt1['class']) ? $bt1['class'] : null;  
}  
 
/*  
* We're interested in the frame which invoked the log() function, so  
* we need to walk back some number of frames into the backtrace. The  
* $depth parameter tells us where to start looking. We go one step  
* further back to find the name of the encapsulating function from  
* which log() was called.  
*/  
$file = isset($bt0) ? $bt0['file'] : null;  
$line = isset($bt0) ? $bt0['line'] : 0;  
$func = isset($bt1) ? $bt1['function'] : null;  
 
/*  
* However, if log() was called from one of our "shortcut" functions,  
* we're going to need to go back an additional step.  
*/  
if (in_array($func, array('emerg', 'alert', 'crit', 'err', 'warning',  
'notice', 'info', 'debug'))) {  
$bt2 = isset($bt[$depth + 2]) ? $bt[$depth + 2] : null;  
 
$file = is_array($bt1) ? $bt1['file'] : null;  
$line = is_array($bt1) ? $bt1['line'] : 0;  
$func = is_array($bt2) ? $bt2['function'] : null;  
$class = isset($bt2['class']) ? $bt2['class'] : null;  
}  
 
/*  
* If we couldn't extract a function name (perhaps because we were  
* executed from the "main" context), provide a default value.  
*/  
if ($func === null) {  
$func = '(none)';  
}  
 
/* Return a 4-tuple containing (file, line, function, class). */  
return array($file, $line, $func, $class);  
}  
 
/**  
* Produces a formatted log line based on a format string and a set of  
* variables representing the current log record and state.  
*  
* @return string Formatted log string.  
*  
* @access protected  
* @since Log 1.9.4  
*/  
function _format($format, $timestamp, $priority, $message)  
{  
/*  
* If the format string references any of the backtrace-driven  
* variables (%5 %6,%7,%8), generate the backtrace and fetch them.  
*/  
if (preg_match('/%[5678]/', $format)) {  
list($file, $line, $func, $class) = $this->_getBacktraceVars(2);  
}  
 
/*  
* Build the formatted string. We use the sprintf() function's  
* "argument swapping" capability to dynamically select and position  
* the variables which will ultimately appear in the log string.  
*/  
return sprintf($format,  
$timestamp,  
$this->_ident,  
$this->priorityToString($priority),  
$message,  
isset($file) ? $file : '',  
isset($line) ? $line : '',  
isset($func) ? $func : '',  
isset($class) ? $class : '');  
}  
 
/**  
* Returns the string representation of a PEAR_LOG_* integer constant.  
*  
* @param int $priority A PEAR_LOG_* integer constant.  
*  
* @return string The string representation of $level.  
*  
* @access public  
* @since Log 1.0  
*/  
function priorityToString($priority)  
{  
$levels = array(  
PEAR_LOG_EMERG => 'emergency',  
PEAR_LOG_ALERT => 'alert',  
PEAR_LOG_CRIT => 'critical',  
PEAR_LOG_ERR => 'error',  
PEAR_LOG_WARNING => 'warning',  
PEAR_LOG_NOTICE => 'notice',  
PEAR_LOG_INFO => 'info',  
PEAR_LOG_DEBUG => 'debug'  
);  
 
return $levels[$priority];  
}  
 
/**  
* Returns the the PEAR_LOG_* integer constant for the given string  
* representation of a priority name. This function performs a  
* case-insensitive search.  
*  
* @param string $name String containing a priority name.  
*  
* @return string The PEAR_LOG_* integer contstant corresponding  
* the the specified priority name.  
*  
* @access public  
* @since Log 1.9.0  
*/  
function stringToPriority($name)  
{  
$levels = array(  
'emergency' => PEAR_LOG_EMERG,  
'alert' => PEAR_LOG_ALERT,  
'critical' => PEAR_LOG_CRIT,  
'error' => PEAR_LOG_ERR,  
'warning' => PEAR_LOG_WARNING,  
'notice' => PEAR_LOG_NOTICE,  
'info' => PEAR_LOG_INFO,  
'debug' => PEAR_LOG_DEBUG  
);  
 
return $levels[strtolower($name)];  
}  
 
/**  
* Calculate the log mask for the given priority.  
*  
* This method may be called statically.  
*  
* @param integer $priority The priority whose mask will be calculated.  
*  
* @return integer The calculated log mask.  
*  
* @access public  
* @since Log 1.7.0  
*/  
public static function MASK($priority)  
{  
return (1 << $priority);  
}  
 
/**  
* Calculate the log mask for all priorities up to the given priority.  
*  
* This method may be called statically.  
*  
* @param integer $priority The maximum priority covered by this mask.  
*  
* @return integer The resulting log mask.  
*  
* @access public  
* @since Log 1.7.0  
*  
* @deprecated deprecated since Log 1.9.4; use Log::MAX() instead  
*/  
public static function UPTO($priority)  
{  
return Log::MAX($priority);  
}  
 
/**  
* Calculate the log mask for all priorities greater than or equal to the  
* given priority. In other words, $priority will be the lowest priority  
* matched by the resulting mask.  
*  
* This method may be called statically.  
*  
* @param integer $priority The minimum priority covered by this mask.  
*  
* @return integer The resulting log mask.  
*  
* @access public  
* @since Log 1.9.4  
*/  
public static function MIN($priority)  
{  
return PEAR_LOG_ALL ^ ((1 << $priority) - 1);  
}  
 
/**  
* Calculate the log mask for all priorities less than or equal to the  
* given priority. In other words, $priority will be the highests priority  
* matched by the resulting mask.  
*  
* This method may be called statically.  
*  
* @param integer $priority The maximum priority covered by this mask.  
*  
* @return integer The resulting log mask.  
*  
* @access public  
* @since Log 1.9.4  
*/  
public static function MAX($priority)  
{  
return ((1 << ($priority + 1)) - 1);  
}  
 
/**  
* Set and return the level mask for the current Log instance.  
*  
* @param integer $mask A bitwise mask of log levels.  
*  
* @return integer The current level mask.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function setMask($mask)  
{  
$this->_mask = $mask;  
 
return $this->_mask;  
}  
 
/**  
* Returns the current level mask.  
*  
* @return interger The current level mask.  
*  
* @access public  
* @since Log 1.7.0  
*/  
function getMask()  
{  
return $this->_mask;  
}  
 
/**  
* Check if the given priority is included in the current level mask.  
*  
* @param integer $priority The priority to check.  
*  
* @return boolean True if the given priority is included in the current  
* log mask.  
*  
* @access protected  
* @since Log 1.7.0  
*/  
function _isMasked($priority)  
{  
return (Log::MASK($priority) & $this->_mask);  
}  
 
/**  
* Returns the current default priority.  
*  
* @return integer The current default priority.  
*  
* @access public  
* @since Log 1.8.4  
*/  
function getPriority()  
{  
return $this->_priority;  
}  
 
/**  
* Sets the default priority to the specified value.  
*  
* @param integer $priority The new default priority.  
*  
* @access public  
* @since Log 1.8.4  
*/  
function setPriority($priority)  
{  
$this->_priority = $priority;  
}  
 
/**  
* Adds a Log_observer instance to the list of observers that are listening  
* for messages emitted by this Log instance.  
*  
* @param object $observer The Log_observer instance to attach as a  
* listener.  
*  
* @param boolean True if the observer is successfully attached.  
*  
* @access public  
* @since Log 1.0  
*/  
function attach(&$observer)  
{  
if (!is_a($observer, 'Log_observer')) {  
return false;  
}  
 
$this->_listeners[$observer->_id] = &$observer;  
 
return true;  
}  
 
/**  
* Removes a Log_observer instance from the list of observers.  
*  
* @param object $observer The Log_observer instance to detach from  
* the list of listeners.  
*  
* @param boolean True if the observer is successfully detached.  
*  
* @access public  
* @since Log 1.0  
*/  
function detach($observer)  
{  
if (!is_a($observer, 'Log_observer') ||  
!isset($this->_listeners[$observer->_id])) {  
return false;  
}  
 
unset($this->_listeners[$observer->_id]);  
 
return true;  
}  
 
/**  
* Informs each registered observer instance that a new message has been  
* logged.  
*  
* @param array $event A hash describing the log event.  
*  
* @access protected  
*/  
function _announce($event)  
{  
foreach ($this->_listeners as $id => $listener) {  
if ($event['priority'] <= $this->_listeners[$id]->_priority) {  
$this->_listeners[$id]->notify($event);  
}  
}  
}  
 
/**  
* Indicates whether this is a composite class.  
*  
* @return boolean True if this is a composite class.  
*  
* @access public  
* @since Log 1.0  
*/  
function isComposite()  
{  
return false;  
}  
 
/**  
* Sets this Log instance's identification string.  
*  
* @param string $ident The new identification string.  
*  
* @access public  
* @since Log 1.6.3  
*/  
function setIdent($ident)  
{  
$this->_ident = $ident;  
}  
 
/**  
* Returns the current identification string.  
*  
* @return string The current Log instance's identification string.  
*  
* @access public  
* @since Log 1.6.3  
*/  
function getIdent()  
{  
return $this->_ident;  
}  
}  
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log/composite.php,v 1.2 2000/06/28 21:36:13 jon Exp $  
*  
* @version $Revision: 215528 $  
* @package Log  
*/  
 
/**  
* The Log_composite:: class implements a Composite pattern which  
* allows multiple Log implementations to receive the same events.  
*  
* @author Chuck Hagenbuch <chuck@horde.org>  
* @author Jon Parise <jon@php.net>  
*  
* @since Horde 1.3  
* @since Log 1.0  
* @package Log  
*  
* @example composite.php Using the composite handler.  
*/  
class Log_composite extends Log  
{  
/**  
* Array holding all of the Log instances to which log events should be  
* sent.  
*  
* @var array  
* @access private  
*/  
var $_children = array();  
 
 
/**  
* Constructs a new composite Log object.  
*  
* @param boolean $name This parameter is ignored.  
* @param boolean $ident This parameter is ignored.  
* @param boolean $conf This parameter is ignored.  
* @param boolean $level This parameter is ignored.  
*  
* @access public  
*/  
function Log_composite($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_ident = $ident;  
}  
 
/**  
* Opens all of the child instances.  
*  
* @return True if all of the child instances were successfully opened.  
*  
* @access public  
*/  
function open()  
{  
/* Attempt to open each of our children. */  
$this->_opened = true;  
foreach ($this->_children as $id => $child) {  
$this->_opened &= $this->_children[$id]->open();  
}  
 
/* If all children were opened, return success. */  
return $this->_opened;  
}  
 
/**  
* Closes all of the child instances.  
*  
* @return True if all of the child instances were successfully closed.  
*  
* @access public  
*/  
function close()  
{  
/* Attempt to close each of our children. */  
$closed = true;  
foreach ($this->_children as $id => $child) {  
$closed &= $this->_children[$id]->close();  
}  
 
/* Track the _opened state for consistency. */  
$this->_opened = false;  
 
/* If all children were closed, return success. */  
return $closed;  
}  
 
/**  
* Flushes all child instances. It is assumed that all of the children  
* have been successfully opened.  
*  
* @return True if all of the child instances were successfully flushed.  
*  
* @access public  
* @since Log 1.8.2  
*/  
function flush()  
{  
/* Attempt to flush each of our children. */  
$flushed = true;  
foreach ($this->_children as $id => $child) {  
$flushed &= $this->_children[$id]->flush();  
}  
 
/* If all children were flushed, return success. */  
return $flushed;  
}  
 
/**  
* Sends $message and $priority to each child of this composite. If the  
* children aren't already open, they will be opened here.  
*  
* @param mixed $message String or object containing the message  
* to log.  
* @param string $priority (optional) The priority of the message.  
* Valid values are: PEAR_LOG_EMERG,  
* PEAR_LOG_ALERT, PEAR_LOG_CRIT,  
* PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and  
* PEAR_LOG_DEBUG.  
*  
* @return boolean True if the entry is successfully logged.  
*  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/*  
* If the handlers haven't been opened, attempt to open them now.  
* However, we don't treat failure to open all of the handlers as a  
* fatal error. We defer that consideration to the success of calling  
* each handler's log() method below.  
*/  
if (!$this->_opened) {  
$this->open();  
}  
 
/* Attempt to log the event using each of the children. */  
$success = true;  
foreach ($this->_children as $id => $child) {  
$success &= $this->_children[$id]->log($message, $priority);  
}  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
/* Return success if all of the children logged the event. */  
return $success;  
}  
 
/**  
* Returns true if this is a composite.  
*  
* @return boolean True if this is a composite class.  
*  
* @access public  
*/  
function isComposite()  
{  
return true;  
}  
 
/**  
* Sets this identification string for all of this composite's children.  
*  
* @param string $ident The new identification string.  
*  
* @access public  
* @since Log 1.6.7  
*/  
function setIdent($ident)  
{  
/* Call our base class's setIdent() method. */  
parent::setIdent($ident);  
 
/* ... and then call setIdent() on all of our children. */  
foreach ($this->_children as $id => $child) {  
$this->_children[$id]->setIdent($ident);  
}  
}  
 
/**  
* Adds a Log instance to the list of children.  
*  
* @param object $child The Log instance to add.  
*  
* @return boolean True if the Log instance was successfully added.  
*  
* @access public  
*/  
function addChild(&$child)  
{  
/* Make sure this is a Log instance. */  
if (!is_a($child, 'Log')) {  
return false;  
}  
 
$this->_children[$child->_id] = &$child;  
 
return true;  
}  
 
/**  
* Removes a Log instance from the list of children.  
*  
* @param object $child The Log instance to remove.  
*  
* @return boolean True if the Log instance was successfully removed.  
*  
* @access public  
*/  
function removeChild($child)  
{  
if (!is_a($child, 'Log') || !isset($this->_children[$child->_id])) {  
return false;  
}  
 
unset($this->_children[$child->_id]);  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 224513 $  
* @package Log  
*/  
 
/**  
* The Log_console class is a concrete implementation of the Log::  
* abstract class which writes message to the text console.  
*  
* @author Jon Parise <jon@php.net>  
* @since Log 1.1  
* @package Log  
*  
* @example console.php Using the console handler.  
*/  
class Log_console extends Log  
{  
/**  
* Handle to the current output stream.  
* @var resource  
* @access private  
*/  
var $_stream = STDOUT;  
 
/**  
* Should the output be buffered or displayed immediately?  
* @var string  
* @access private  
*/  
var $_buffering = false;  
 
/**  
* String holding the buffered output.  
* @var string  
* @access private  
*/  
var $_buffer = '';  
 
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%1$s %2$s [%3$s] %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* Constructs a new Log_console object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_console($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (!empty($conf['stream'])) {  
$this->_stream = $conf['stream'];  
}  
 
if (isset($conf['buffering'])) {  
$this->_buffering = $conf['buffering'];  
}  
 
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
 
/*  
* If output buffering has been requested, we need to register a  
* shutdown function that will dump the buffer upon termination.  
*/  
if ($this->_buffering) {  
register_shutdown_function(array(&$this, '_Log_console'));  
}  
}  
 
/**  
* Destructor  
*/  
function _Log_console()  
{  
$this->close();  
}  
 
/**  
* Open the output stream.  
*  
* @access public  
* @since Log 1.9.7  
*/  
function open()  
{  
$this->_opened = true;  
return true;  
}  
 
/**  
* Closes the output stream.  
*  
* This results in a call to flush().  
*  
* @access public  
* @since Log 1.9.0  
*/  
function close()  
{  
$this->flush();  
$this->_opened = false;  
return true;  
}  
 
/**  
* Flushes all pending ("buffered") data to the output stream.  
*  
* @access public  
* @since Log 1.8.2  
*/  
function flush()  
{  
/*  
* If output buffering is enabled, dump the contents of the buffer to  
* the output stream.  
*/  
if ($this->_buffering && (strlen($this->_buffer) > 0)) {  
fwrite($this->_stream, $this->_buffer);  
$this->_buffer = '';  
}  
 
if (is_resource($this->_stream)) {  
return fflush($this->_stream);  
}  
 
return false;  
}  
 
/**  
* Writes $message to the text console. Also, passes the message  
* along to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build the string containing the complete log line. */  
$line = $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority, $message) . "\n";  
 
/*  
* If buffering is enabled, append this line to the output buffer.  
* Otherwise, print the line to the output stream immediately.  
*/  
if ($this->_buffering) {  
$this->_buffer .= $line;  
} else {  
fwrite($this->_stream, $line);  
}  
 
/* Notify observers about this log message. */  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 250926 $  
* @package Log  
*/  
 
/**  
* The Log_daemon class is a concrete implementation of the Log::  
* abstract class which sends messages to syslog daemon on UNIX-like machines.  
* This class uses the syslog protocol: http://www.ietf.org/rfc/rfc3164.txt  
*  
* @author Bart van der Schans <schans@dds.nl>  
* @version $Revision: 250926 $  
* @package Log  
*/  
class Log_daemon extends Log  
{  
/**  
* Integer holding the log facility to use.  
* @var string  
*/  
var $_name = LOG_DAEMON;  
 
/**  
* Var holding the resource pointer to the socket  
* @var resource  
*/  
var $_socket;  
 
/**  
* The ip address or servername  
* @see http://www.php.net/manual/en/transports.php  
* @var string  
*/  
var $_ip = '127.0.0.1';  
 
/**  
* Protocol to use (tcp, udp, etc.)  
* @see http://www.php.net/manual/en/transports.php  
* @var string  
*/  
var $_proto = 'udp';  
 
/**  
* Port to connect to  
* @var int  
*/  
var $_port = 514;  
 
/**  
* Maximum message length in bytes  
* @var int  
*/  
var $_maxsize = 4096;  
 
/**  
* Socket timeout in seconds  
* @var int  
*/  
var $_timeout = 1;  
 
 
/**  
* Constructs a new syslog object.  
*  
* @param string $name The syslog facility.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $maxLevel Maximum level at which to log.  
* @access public  
*/  
function Log_daemon($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
/* Ensure we have a valid integer value for $name. */  
if (empty($name) || !is_int($name)) {  
$name = LOG_SYSLOG;  
}  
 
$this->_id = md5(microtime());  
$this->_name = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (isset($conf['ip'])) {  
$this->_ip = $conf['ip'];  
}  
if (isset($conf['proto'])) {  
$this->_proto = $conf['proto'];  
}  
if (isset($conf['port'])) {  
$this->_port = $conf['port'];  
}  
if (isset($conf['maxsize'])) {  
$this->_maxsize = $conf['maxsize'];  
}  
if (isset($conf['timeout'])) {  
$this->_timeout = $conf['timeout'];  
}  
$this->_proto = $this->_proto . '://';  
 
register_shutdown_function(array(&$this, '_Log_daemon'));  
}  
 
/**  
* Destructor.  
*  
* @access private  
*/  
function _Log_daemon()  
{  
$this->close();  
}  
 
/**  
* Opens a connection to the system logger, if it has not already  
* been opened. This is implicitly called by log(), if necessary.  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
$this->_opened = (bool)($this->_socket = @fsockopen(  
$this->_proto . $this->_ip,  
$this->_port,  
$errno,  
$errstr,  
$this->_timeout));  
}  
return $this->_opened;  
}  
 
/**  
* Closes the connection to the system logger, if it is open.  
* @access public  
*/  
function close()  
{  
if ($this->_opened) {  
$this->_opened = false;  
return fclose($this->_socket);  
}  
return true;  
}  
 
/**  
* Sends $message to the currently open syslog connection. Calls  
* open() if necessary. Also passes the message along to any Log_observer  
* instances that are observing this Log.  
*  
* @param string $message The textual message to be logged.  
* @param int $priority (optional) The priority of the message. Valid  
* values are: LOG_EMERG, LOG_ALERT, LOG_CRIT,  
* LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO,  
* and LOG_DEBUG. The default is LOG_INFO.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Set the facility level. */  
$facility_level = intval($this->_name) +  
intval($this->_toSyslog($priority));  
 
/* Prepend ident info. */  
if (!empty($this->_ident)) {  
$message = $this->_ident . ' ' . $message;  
}  
 
/* Check for message length. */  
if (strlen($message) > $this->_maxsize) {  
$message = substr($message, 0, ($this->_maxsize) - 10) . ' [...]';  
}  
 
/* Write to socket. */  
fwrite($this->_socket, '<' . $facility_level . '>' . $message . "\n");  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
}  
 
/**  
* Converts a PEAR_LOG_* constant into a syslog LOG_* constant.  
*  
* This function exists because, under Windows, not all of the LOG_*  
* constants have unique values. Instead, the PEAR_LOG_* were introduced  
* for global use, with the conversion to the LOG_* constants kept local to  
* to the syslog driver.  
*  
* @param int $priority PEAR_LOG_* value to convert to LOG_* value.  
*  
* @return The LOG_* representation of $priority.  
*  
* @access private  
*/  
function _toSyslog($priority)  
{  
static $priorities = array(  
PEAR_LOG_EMERG => LOG_EMERG,  
PEAR_LOG_ALERT => LOG_ALERT,  
PEAR_LOG_CRIT => LOG_CRIT,  
PEAR_LOG_ERR => LOG_ERR,  
PEAR_LOG_WARNING => LOG_WARNING,  
PEAR_LOG_NOTICE => LOG_NOTICE,  
PEAR_LOG_INFO => LOG_INFO,  
PEAR_LOG_DEBUG => LOG_DEBUG  
);  
 
/* If we're passed an unknown priority, default to LOG_INFO. */  
if (!is_int($priority) || !in_array($priority, $priorities)) {  
return LOG_INFO;  
}  
 
return $priorities[$priority];  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 255603 $  
* @package Log  
*/  
 
/**  
* The Log_display class is a concrete implementation of the Log::  
* abstract class which writes message into browser in usual PHP maner.  
* This may be useful because when you use PEAR::setErrorHandling in  
* PEAR_ERROR_CALLBACK mode error messages are not displayed by  
* PHP error handler.  
*  
* @author Paul Yanchenko <pusher@inaco.ru>  
* @since Log 1.8.0  
* @package Log  
*  
* @example display.php Using the display handler.  
*/  
class Log_display extends Log  
{  
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '<b>%3$s</b>: %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* Constructs a new Log_display object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_display($name = '', $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
/* Start by configuring the line format. */  
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
/* We may need to prepend a string to our line format. */  
$prepend = null;  
if (isset($conf['error_prepend'])) {  
$prepend = $conf['error_prepend'];  
} else {  
$prepend = ini_get('error_prepend_string');  
}  
if (!empty($prepend)) {  
$this->_lineFormat = $prepend . $this->_lineFormat;  
}  
 
/* We may also need to append a string to our line format. */  
$append = null;  
if (isset($conf['error_append'])) {  
$append = $conf['error_append'];  
} else {  
$append = ini_get('error_append_string');  
}  
if (!empty($append)) {  
$this->_lineFormat .= $append;  
}  
 
/* Lastly, the line ending sequence is also configurable. */  
if (isset($conf['linebreak'])) {  
$this->_lineFormat .= $conf['linebreak'];  
} else {  
$this->_lineFormat .= "<br />\n";  
}  
 
/* The user can also change the time format. */  
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
}  
 
/**  
* Opens the display handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function open()  
{  
$this->_opened = true;  
return true;  
}  
 
/**  
* Closes the display handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function close()  
{  
$this->_opened = false;  
return true;  
}  
 
/**  
* Writes $message to the text browser. Also, passes the message  
* along to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build and output the complete log line. */  
echo $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority,  
nl2br(htmlspecialchars($message)));  
 
/* Notify observers about this log message. */  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 293927 $  
* @package Log  
*/  
 
/**  
* The Log_error_log class is a concrete implementation of the Log abstract  
* class that logs messages using PHP's error_log() function.  
*  
* @author Jon Parise <jon@php.net>  
* @since Log 1.7.0  
* @package Log  
*  
* @example error_log.php Using the error_log handler.  
*/  
class Log_error_log extends Log  
{  
/**  
* The error_log() log type.  
* @var integer  
* @access private  
*/  
var $_type = PEAR_LOG_TYPE_SYSTEM;  
 
/**  
* The type-specific destination value.  
* @var string  
* @access private  
*/  
var $_destination = '';  
 
/**  
* Additional headers to pass to the mail() function when the  
* PEAR_LOG_TYPE_MAIL type is used.  
* @var string  
* @access private  
*/  
var $_extra_headers = '';  
 
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%2$s: %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* Constructs a new Log_error_log object.  
*  
* @param string $name One of the PEAR_LOG_TYPE_* constants.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_error_log($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_type = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (!empty($conf['destination'])) {  
$this->_destination = $conf['destination'];  
}  
 
if (!empty($conf['extra_headers'])) {  
$this->_extra_headers = $conf['extra_headers'];  
}  
 
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
}  
 
/**  
* Opens the handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function open()  
{  
$this->_opened = true;  
return true;  
}  
 
/**  
* Closes the handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function close()  
{  
$this->_opened = false;  
return true;  
}  
 
/**  
* Logs $message using PHP's error_log() function. The message is also  
* passed along to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build the string containing the complete log line. */  
$line = $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority, $message);  
 
/* Pass the log line and parameters to the error_log() function. */  
$success = error_log($line, $this->_type, $this->_destination,  
$this->_extra_headers);  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return $success;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 224513 $  
* @package Log  
*/  
 
/**  
* The Log_file class is a concrete implementation of the Log abstract  
* class that logs messages to a text file.  
*  
* @author Jon Parise <jon@php.net>  
* @author Roman Neuhauser <neuhauser@bellavista.cz>  
* @since Log 1.0  
* @package Log  
*  
* @example file.php Using the file handler.  
*/  
class Log_file extends Log  
{  
/**  
* String containing the name of the log file.  
* @var string  
* @access private  
*/  
var $_filename = 'php.log';  
 
/**  
* Handle to the log file.  
* @var resource  
* @access private  
*/  
var $_fp = false;  
 
/**  
* Should new log entries be append to an existing log file, or should the  
* a new log file overwrite an existing one?  
* @var boolean  
* @access private  
*/  
var $_append = true;  
 
/**  
* Should advisory file locking (i.e., flock()) be used?  
* @var boolean  
* @access private  
*/  
var $_locking = false;  
 
/**  
* Integer (in octal) containing the log file's permissions mode.  
* @var integer  
* @access private  
*/  
var $_mode = 0644;  
 
/**  
* Integer (in octal) specifying the file permission mode that will be  
* used when creating directories that do not already exist.  
* @var integer  
* @access private  
*/  
var $_dirmode = 0755;  
 
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%1$s %2$s [%3$s] %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* String containing the end-on-line character sequence.  
* @var string  
* @access private  
*/  
var $_eol = "\n";  
 
/**  
* Constructs a new Log_file object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_file($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_filename = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (isset($conf['append'])) {  
$this->_append = $conf['append'];  
}  
 
if (isset($conf['locking'])) {  
$this->_locking = $conf['locking'];  
}  
 
if (!empty($conf['mode'])) {  
if (is_string($conf['mode'])) {  
$this->_mode = octdec($conf['mode']);  
} else {  
$this->_mode = $conf['mode'];  
}  
}  
 
if (!empty($conf['dirmode'])) {  
if (is_string($conf['dirmode'])) {  
$this->_dirmode = octdec($conf['dirmode']);  
} else {  
$this->_dirmode = $conf['dirmode'];  
}  
}  
 
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
 
if (!empty($conf['eol'])) {  
$this->_eol = $conf['eol'];  
} else {  
$this->_eol = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n";  
}  
 
register_shutdown_function(array(&$this, '_Log_file'));  
}  
 
/**  
* Destructor  
*/  
function _Log_file()  
{  
if ($this->_opened) {  
$this->close();  
}  
}  
 
/**  
* Creates the given directory path. If the parent directories don't  
* already exist, they will be created, too.  
*  
* This implementation is inspired by Python's os.makedirs function.  
*  
* @param string $path The full directory path to create.  
* @param integer $mode The permissions mode with which the  
* directories will be created.  
*  
* @return True if the full path is successfully created or already  
* exists.  
*  
* @access private  
*/  
function _mkpath($path, $mode = 0700)  
{  
/* Separate the last pathname component from the rest of the path. */  
$head = dirname($path);  
$tail = basename($path);  
 
/* Make sure we've split the path into two complete components. */  
if (empty($tail)) {  
$head = dirname($path);  
$tail = basename($path);  
}  
 
/* Recurse up the path if our current segment does not exist. */  
if (!empty($head) && !empty($tail) && !is_dir($head)) {  
$this->_mkpath($head, $mode);  
}  
 
/* Create this segment of the path. */  
return @mkdir($head, $mode);  
}  
 
/**  
* Opens the log file for output. If the specified log file does not  
* already exist, it will be created. By default, new log entries are  
* appended to the end of the log file.  
*  
* This is implicitly called by log(), if necessary.  
*  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
/* If the log file's directory doesn't exist, create it. */  
if (!is_dir(dirname($this->_filename))) {  
$this->_mkpath($this->_filename, $this->_dirmode);  
}  
 
/* Determine whether the log file needs to be created. */  
$creating = !file_exists($this->_filename);  
 
/* Obtain a handle to the log file. */  
$this->_fp = fopen($this->_filename, ($this->_append) ? 'a' : 'w');  
 
/* We consider the file "opened" if we have a valid file pointer. */  
$this->_opened = ($this->_fp !== false);  
 
/* Attempt to set the file's permissions if we just created it. */  
if ($creating && $this->_opened) {  
chmod($this->_filename, $this->_mode);  
}  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the log file if it is open.  
*  
* @access public  
*/  
function close()  
{  
/* If the log file is open, close it. */  
if ($this->_opened && fclose($this->_fp)) {  
$this->_opened = false;  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Flushes all pending data to the file handle.  
*  
* @access public  
* @since Log 1.8.2  
*/  
function flush()  
{  
if (is_resource($this->_fp)) {  
return fflush($this->_fp);  
}  
 
return false;  
}  
 
/**  
* Logs $message to the output window. The message is also passed along  
* to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the log file isn't already open, open it now. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build the string containing the complete log line. */  
$line = $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority, $message) . $this->_eol;  
 
/* If locking is enabled, acquire an exclusive lock on the file. */  
if ($this->_locking) {  
flock($this->_fp, LOCK_EX);  
}  
 
/* Write the log line to the log file. */  
$success = (fwrite($this->_fp, $line) !== false);  
 
/* Unlock the file now that we're finished writing to it. */  
if ($this->_locking) {  
flock($this->_fp, LOCK_UN);  
}  
 
/* Notify observers about this log message. */  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return $success;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 250923 $  
* @package Log  
*/  
 
/**  
* The Log_firebug class is a concrete implementation of the Log::  
* abstract class which writes message into Firebug console.  
*  
* http://www.getfirebug.com/  
*  
* @author Mika Tuupola <tuupola@appelsiini.net>  
* @since Log 1.9.11  
* @package Log  
*  
* @example firebug.php Using the firebug handler.  
*/  
class Log_firebug extends Log  
{  
/**  
* Should the output be buffered or displayed immediately?  
* @var string  
* @access private  
*/  
var $_buffering = false;  
 
/**  
* String holding the buffered output.  
* @var string  
* @access private  
*/  
var $_buffer = array();  
 
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%2$s [%3$s] %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
*  
* Note! Default lineFormat of this driver does not display time.  
*  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* Mapping of log priorities to Firebug methods.  
* @var array  
* @access private  
*/  
var $_methods = array(  
PEAR_LOG_EMERG => 'error',  
PEAR_LOG_ALERT => 'error',  
PEAR_LOG_CRIT => 'error',  
PEAR_LOG_ERR => 'error',  
PEAR_LOG_WARNING => 'warn',  
PEAR_LOG_NOTICE => 'info',  
PEAR_LOG_INFO => 'info',  
PEAR_LOG_DEBUG => 'debug'  
);  
 
/**  
* Constructs a new Log_firebug object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_firebug($name = '', $ident = 'PHP', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
if (isset($conf['buffering'])) {  
$this->_buffering = $conf['buffering'];  
}  
 
if ($this->_buffering) {  
register_shutdown_function(array(&$this, '_Log_firebug'));  
}  
 
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
}  
 
/**  
* Opens the firebug handler.  
*  
* @access public  
*/  
function open()  
{  
$this->_opened = true;  
return true;  
}  
 
/**  
* Destructor  
*/  
function _Log_firebug()  
{  
$this->close();  
}  
 
/**  
* Closes the firebug handler.  
*  
* @access public  
*/  
function close()  
{  
$this->flush();  
$this->_opened = false;  
return true;  
}  
 
/**  
* Flushes all pending ("buffered") data.  
*  
* @access public  
*/  
function flush() {  
if (count($this->_buffer)) {  
print '<script type="text/javascript">';  
print "\nif (('console' in window) && ('firebug' in console)) {\n";  
foreach ($this->_buffer as $line) {  
print " $line\n";  
}  
print "}\n";  
print "</script>\n";  
};  
$this->_buffer = array();  
}  
 
/**  
* Writes $message to Firebug console. Also, passes the message  
* along to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
$method = $this->_methods[$priority];  
 
/* normalize line breaks */  
$message = str_replace("\r\n", "\n", $message);  
 
/* escape line breaks */  
$message = str_replace("\n", "\\n\\\n", $message);  
 
/* escape quotes */  
$message = str_replace('"', '\\"', $message);  
 
/* Build the string containing the complete log line. */  
$line = $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority,  
$message);  
 
if ($this->_buffering) {  
$this->_buffer[] = sprintf('console.%s("%s");', $method, $line);  
} else {  
print '<script type="text/javascript">';  
print "\nif (('console' in window) && ('firebug' in console)) {\n";  
/* Build and output the complete log line. */  
printf(' console.%s("%s");', $method, $line);  
print "\n}\n";  
print "</script>\n";  
}  
/* Notify observers about this log message. */  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 266658 $  
* @package Log  
*/  
 
/**  
* The Log_mail class is a concrete implementation of the Log:: abstract class  
* which sends log messages to a mailbox.  
* The mail is actually sent when you close() the logger, or when the destructor  
* is called (when the script is terminated).  
*  
* PLEASE NOTE that you must create a Log_mail object using =&, like this :  
* $logger =& Log::factory("mail", "recipient@example.com", ...)  
*  
* This is a PEAR requirement for destructors to work properly.  
* See http://pear.php.net/manual/en/class.pear.php  
*  
* @author Ronnie Garcia <ronnie@mk2.net>  
* @author Jon Parise <jon@php.net>  
* @since Log 1.3  
* @package Log  
*  
* @example mail.php Using the mail handler.  
*/  
class Log_mail extends Log  
{  
/**  
* String holding the recipients' email addresses. Multiple addresses  
* should be separated with commas.  
* @var string  
* @access private  
*/  
var $_recipients = '';  
 
/**  
* String holding the sender's email address.  
* @var string  
* @access private  
*/  
var $_from = '';  
 
/**  
* String holding the email's subject.  
* @var string  
* @access private  
*/  
var $_subject = '[Log_mail] Log message';  
 
/**  
* String holding an optional preamble for the log messages.  
* @var string  
* @access private  
*/  
var $_preamble = '';  
 
/**  
* String containing the format of a log line.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%1$s %2$s [%3$s] %4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* String holding the mail message body.  
* @var string  
* @access private  
*/  
var $_message = '';  
 
/**  
* Flag used to indicated that log lines have been written to the message  
* body and the message should be sent on close().  
* @var boolean  
* @access private  
*/  
var $_shouldSend = false;  
 
/**  
* String holding the backend name of PEAR::Mail  
* @var string  
* @access private  
*/  
var $_mailBackend = '';  
 
/**  
* Array holding the params for PEAR::Mail  
* @var array  
* @access private  
*/  
var $_mailParams = array();  
 
/**  
* Constructs a new Log_mail object.  
*  
* Here is how you can customize the mail driver with the conf[] hash :  
* $conf['from']: the mail's "From" header line,  
* $conf['subject']: the mail's "Subject" line.  
* $conf['mailBackend']: backend name of PEAR::Mail  
* $conf['mailParams']: parameters for the PEAR::Mail backend  
*  
* @param string $name The message's recipients.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_mail($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_recipients = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (!empty($conf['from'])) {  
$this->_from = $conf['from'];  
} else {  
$this->_from = ini_get('sendmail_from');  
}  
 
if (!empty($conf['subject'])) {  
$this->_subject = $conf['subject'];  
}  
 
if (!empty($conf['preamble'])) {  
$this->_preamble = $conf['preamble'];  
}  
 
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
 
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
 
if (!empty($conf['mailBackend'])) {  
$this->_mailBackend = $conf['mailBackend'];  
}  
 
if (!empty($conf['mailParams'])) {  
$this->_mailParams = $conf['mailParams'];  
}  
 
/* register the destructor */  
register_shutdown_function(array(&$this, '_Log_mail'));  
}  
 
/**  
* Destructor. Calls close().  
*  
* @access private  
*/  
function _Log_mail()  
{  
$this->close();  
}  
 
/**  
* Starts a new mail message.  
* This is implicitly called by log(), if necessary.  
*  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
if (!empty($this->_preamble)) {  
$this->_message = $this->_preamble . "\r\n\r\n";  
}  
$this->_opened = true;  
$_shouldSend = false;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the message, if it is open, and sends the mail.  
* This is implicitly called by the destructor, if necessary.  
*  
* @access public  
*/  
function close()  
{  
if ($this->_opened) {  
if ($this->_shouldSend && !empty($this->_message)) {  
if ($this->_mailBackend === '') { // use mail()  
$headers = "From: $this->_from\r\n";  
$headers .= 'User-Agent: PEAR Log Package';  
if (mail($this->_recipients, $this->_subject,  
$this->_message, $headers) == false) {  
return false;  
}  
} else { // use PEAR::Mail  
include_once 'Mail.php';  
$headers = array('From' => $this->_from,  
'To' => $this->_recipients,  
'User-Agent' => 'PEAR Log Package',  
'Subject' => $this->_subject);  
$mailer = &Mail::factory($this->_mailBackend,  
$this->_mailParams);  
$res = $mailer->send($this->_recipients, $headers,  
$this->_message);  
if (PEAR::isError($res)) {  
return false;  
}  
}  
 
/* Clear the message string now that the email has been sent. */  
$this->_message = '';  
$this->_shouldSend = false;  
}  
$this->_opened = false;  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Flushes the log output by forcing the email message to be sent now.  
* Events that are logged after flush() is called will be appended to a  
* new email message.  
*  
* @access public  
* @since Log 1.8.2  
*/  
function flush()  
{  
/*  
* It's sufficient to simply call close() to flush the output.  
* The next call to log() will cause the handler to be reopened.  
*/  
return $this->close();  
}  
 
/**  
* Writes $message to the currently open mail message.  
* Calls open(), if necessary.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the message isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Append the string containing the complete log line. */  
$this->_message .= $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority, $message) . "\r\n";  
$this->_shouldSend = true;  
 
/* Notify observers about this log message. */  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
}  
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log/mcal.php,v 1.2 2000/06/28 21:36:13 jon Exp $  
*  
* @version $Revision: 180836 $  
* @package Log  
*/  
 
/**  
* The Log_mcal class is a concrete implementation of the Log::  
* abstract class which sends messages to a local or remote calendar  
* store accessed through MCAL.  
*  
* @author Chuck Hagenbuch <chuck@horde.org>  
* @since Horde 1.3  
* @since Log 1.0  
* @package Log  
*/  
class Log_mcal extends Log  
{  
/**  
* holding the calendar specification to connect to.  
* @var string  
* @access private  
*/  
var $_calendar = '{localhost/mstore}';  
 
/**  
* holding the username to use.  
* @var string  
* @access private  
*/  
var $_username = '';  
 
/**  
* holding the password to use.  
* @var string  
* @access private  
*/  
var $_password = '';  
 
/**  
* holding the options to pass to the calendar stream.  
* @var integer  
* @access private  
*/  
var $_options = 0;  
 
/**  
* ResourceID of the MCAL stream.  
* @var string  
* @access private  
*/  
var $_stream = '';  
 
/**  
* Integer holding the log facility to use.  
* @var string  
* @access private  
*/  
var $_name = LOG_SYSLOG;  
 
 
/**  
* Constructs a new Log_mcal object.  
*  
* @param string $name The category to use for our events.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_mcal($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_name = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
$this->_calendar = $conf['calendar'];  
$this->_username = $conf['username'];  
$this->_password = $conf['password'];  
$this->_options = $conf['options'];  
}  
 
/**  
* Opens a calendar stream, if it has not already been  
* opened. This is implicitly called by log(), if necessary.  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
$this->_stream = mcal_open($this->_calendar, $this->_username,  
$this->_password, $this->_options);  
$this->_opened = true;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the calendar stream, if it is open.  
* @access public  
*/  
function close()  
{  
if ($this->_opened) {  
mcal_close($this->_stream);  
$this->_opened = false;  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Logs $message and associated information to the currently open  
* calendar stream. Calls open() if necessary. Also passes the  
* message along to any Log_observer instances that are observing  
* this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
$date_str = date('Y:n:j:G:i:s');  
$dates = explode(':', $date_str);  
 
mcal_event_init($this->_stream);  
mcal_event_set_title($this->_stream, $this->_ident);  
mcal_event_set_category($this->_stream, $this->_name);  
mcal_event_set_description($this->_stream, $message);  
mcal_event_add_attribute($this->_stream, 'priority', $priority);  
mcal_event_set_start($this->_stream, $dates[0], $dates[1], $dates[2],  
$dates[3], $dates[4], $dates[5]);  
mcal_event_set_end($this->_stream, $dates[0], $dates[1], $dates[2],  
$dates[3], $dates[4], $dates[5]);  
mcal_append_event($this->_stream);  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 204814 $  
* @package Log  
*/  
 
/** PEAR's MDB2 package */  
require_once 'MDB2.php';  
MDB2::loadFile('Date');  
 
/**  
* The Log_mdb2 class is a concrete implementation of the Log:: abstract class  
* which sends messages to an SQL server. Each entry occupies a separate row  
* in the database.  
*  
* This implementation uses PEAR's MDB2 database abstraction layer.  
*  
* CREATE TABLE log_table (  
* id INT NOT NULL,  
* logtime TIMESTAMP NOT NULL,  
* ident CHAR(16) NOT NULL,  
* priority INT NOT NULL,  
* message VARCHAR(200),  
* PRIMARY KEY (id)  
* );  
*  
* @author Lukas Smith <smith@backendmedia.com>  
* @author Jon Parise <jon@php.net>  
* @since Log 1.9.0  
* @package Log  
*/  
class Log_mdb2 extends Log  
{  
/**  
* Variable containing the DSN information.  
* @var mixed  
* @access private  
*/  
var $_dsn = '';  
 
/**  
* Array containing our set of DB configuration options.  
* @var array  
* @access private  
*/  
var $_options = array('persistent' => true);  
 
/**  
* Object holding the database handle.  
* @var object  
* @access private  
*/  
var $_db = null;  
 
/**  
* Resource holding the prepared statement handle.  
* @var resource  
* @access private  
*/  
var $_statement = null;  
 
/**  
* Flag indicating that we're using an existing database connection.  
* @var boolean  
* @access private  
*/  
var $_existingConnection = false;  
 
/**  
* String holding the database table to use.  
* @var string  
* @access private  
*/  
var $_table = 'log_table';  
 
/**  
* String holding the name of the ID sequence.  
* @var string  
* @access private  
*/  
var $_sequence = 'log_id';  
 
/**  
* Maximum length of the $ident string. This corresponds to the size of  
* the 'ident' column in the SQL table.  
* @var integer  
* @access private  
*/  
var $_identLimit = 16;  
 
/**  
* Set of field types used in the database table.  
* @var array  
* @access private  
*/  
var $_types = array(  
'id' => 'integer',  
'logtime' => 'timestamp',  
'ident' => 'text',  
'priority' => 'text',  
'message' => 'clob'  
);  
 
/**  
* Constructs a new sql logging object.  
*  
* @param string $name The target SQL table.  
* @param string $ident The identification field.  
* @param array $conf The connection configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_mdb2($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_table = $name;  
$this->_mask = Log::UPTO($level);  
 
/* If an options array was provided, use it. */  
if (isset($conf['options']) && is_array($conf['options'])) {  
$this->_options = $conf['options'];  
}  
 
/* If a specific sequence name was provided, use it. */  
if (!empty($conf['sequence'])) {  
$this->_sequence = $conf['sequence'];  
}  
 
/* If a specific sequence name was provided, use it. */  
if (isset($conf['identLimit'])) {  
$this->_identLimit = $conf['identLimit'];  
}  
 
/* Now that the ident limit is confirmed, set the ident string. */  
$this->setIdent($ident);  
 
/* If an existing database connection was provided, use it. */  
if (isset($conf['db'])) {  
$this->_db = &$conf['db'];  
$this->_existingConnection = true;  
$this->_opened = true;  
} elseif (isset($conf['singleton'])) {  
$this->_db = &MDB2::singleton($conf['singleton'], $this->_options);  
$this->_existingConnection = true;  
$this->_opened = true;  
} else {  
$this->_dsn = $conf['dsn'];  
}  
}  
 
/**  
* Opens a connection to the database, if it has not already  
* been opened. This is implicitly called by log(), if necessary.  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
/* Use the DSN and options to create a database connection. */  
$this->_db = &MDB2::connect($this->_dsn, $this->_options);  
if (PEAR::isError($this->_db)) {  
return false;  
}  
 
/* Create a prepared statement for repeated use in log(). */  
if (!$this->_prepareStatement()) {  
return false;  
}  
 
/* We now consider out connection open. */  
$this->_opened = true;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the connection to the database if it is still open and we were  
* the ones that opened it. It is the caller's responsible to close an  
* existing connection that was passed to us via $conf['db'].  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function close()  
{  
/* If we have a statement object, free it. */  
if (is_object($this->_statement)) {  
$this->_statement->free();  
$this->_statement = null;  
}  
 
/* If we opened the database connection, disconnect it. */  
if ($this->_opened && !$this->_existingConnection) {  
$this->_opened = false;  
return $this->_db->disconnect();  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Sets this Log instance's identification string. Note that this  
* SQL-specific implementation will limit the length of the $ident string  
* to sixteen (16) characters.  
*  
* @param string $ident The new identification string.  
*  
* @access public  
* @since Log 1.8.5  
*/  
function setIdent($ident)  
{  
$this->_ident = substr($ident, 0, $this->_identLimit);  
}  
 
/**  
* Inserts $message to the currently open database. Calls open(),  
* if necessary. Also passes the message along to any Log_observer  
* instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* If we don't already have a statement object, create one. */  
if (!is_object($this->_statement) && !$this->_prepareStatement()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build our set of values for this log entry. */  
$values = array(  
'id' => $this->_db->nextId($this->_sequence),  
'logtime' => MDB2_Date::mdbNow(),  
'ident' => $this->_ident,  
'priority' => $priority,  
'message' => $message  
);  
 
/* Execute the SQL query for this log entry insertion. */  
$this->_db->expectError(MDB2_ERROR_NOSUCHTABLE);  
$result = &$this->_statement->execute($values);  
$this->_db->popExpect();  
 
/* Attempt to handle any errors. */  
if (PEAR::isError($result)) {  
/* We can only handle MDB2_ERROR_NOSUCHTABLE errors. */  
if ($result->getCode() != MDB2_ERROR_NOSUCHTABLE) {  
return false;  
}  
 
/* Attempt to create the target table. */  
if (!$this->_createTable()) {  
return false;  
}  
 
/* Recreate our prepared statement resource. */  
$this->_statement->free();  
if (!$this->_prepareStatement()) {  
return false;  
}  
 
/* Attempt to re-execute the insertion query. */  
$result = $this->_statement->execute($values);  
if (PEAR::isError($result)) {  
return false;  
}  
}  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
/**  
* Create the log table in the database.  
*  
* @return boolean True on success or false on failure.  
* @access private  
*/  
function _createTable()  
{  
$this->_db->loadModule('Manager', null, true);  
$result = $this->_db->manager->createTable(  
$this->_table,  
array(  
'id' => array('type' => $this->_types['id']),  
'logtime' => array('type' => $this->_types['logtime']),  
'ident' => array('type' => $this->_types['ident']),  
'priority' => array('type' => $this->_types['priority']),  
'message' => array('type' => $this->_types['message'])  
)  
);  
if (PEAR::isError($result)) {  
return false;  
}  
 
$result = $this->_db->manager->createIndex(  
$this->_table,  
'unique_id',  
array('fields' => array('id' => true), 'unique' => true)  
);  
if (PEAR::isError($result)) {  
return false;  
}  
 
return true;  
}  
 
/**  
* Prepare the SQL insertion statement.  
*  
* @return boolean True if the statement was successfully created.  
*  
* @access private  
* @since Log 1.9.0  
*/  
function _prepareStatement()  
{  
$this->_statement = &$this->_db->prepare(  
'INSERT INTO ' . $this->_table .  
' (id, logtime, ident, priority, message)' .  
' VALUES(:id, :logtime, :ident, :priority, :message)',  
$this->_types, MDB2_PREPARE_MANIP);  
 
/* Return success if we didn't generate an error. */  
return (PEAR::isError($this->_statement) === false);  
}  
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 215527 $  
* @package Log  
*/  
 
/**  
* The Log_null class is a concrete implementation of the Log:: abstract  
* class. It simply consumes log events.  
*  
* @author Jon Parise <jon@php.net>  
* @since Log 1.8.2  
* @package Log  
*  
* @example null.php Using the null handler.  
*/  
class Log_null extends Log  
{  
/**  
* Constructs a new Log_null object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_null($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
}  
 
/**  
* Opens the handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function open()  
{  
$this->_opened = true;  
return true;  
}  
 
/**  
* Closes the handler.  
*  
* @access public  
* @since Log 1.9.6  
*/  
function close()  
{  
$this->_opened = false;  
return true;  
}  
 
/**  
* Simply consumes the log event. The message will still be passed  
* along to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log/observer.php,v 1.5 2000/06/28 21:36:13 jon Exp $  
*  
* @version $Revision: 211953 $  
* @package Log  
*/  
 
/**  
* The Log_observer:: class implements the Observer end of a Subject-Observer  
* pattern for watching log activity and taking actions on exceptional events.  
*  
* @author Chuck Hagenbuch <chuck@horde.org>  
* @since Horde 1.3  
* @since Log 1.0  
* @package Log  
*  
* @example observer_mail.php An example Log_observer implementation.  
*/  
class Log_observer  
{  
/**  
* Instance-specific unique identification number.  
*  
* @var integer  
* @access private  
*/  
var $_id = 0;  
 
/**  
* The minimum priority level of message that we want to hear about.  
* PEAR_LOG_EMERG is the highest priority, so we will only hear messages  
* with an integer priority value less than or equal to ours. It defaults  
* to PEAR_LOG_INFO, which listens to everything except PEAR_LOG_DEBUG.  
*  
* @var string  
* @access private  
*/  
var $_priority = PEAR_LOG_INFO;  
 
/**  
* Creates a new basic Log_observer instance.  
*  
* @param integer $priority The highest priority at which to receive  
* log event notifications.  
*  
* @access public  
*/  
function Log_observer($priority = PEAR_LOG_INFO)  
{  
$this->_id = md5(microtime());  
$this->_priority = $priority;  
}  
 
/**  
* Attempts to return a new concrete Log_observer instance of the requested  
* type.  
*  
* @param string $type The type of concreate Log_observer subclass  
* to return.  
* @param integer $priority The highest priority at which to receive  
* log event notifications.  
* @param array $conf Optional associative array of additional  
* configuration values.  
*  
* @return object The newly created concrete Log_observer  
* instance, or null on an error.  
*/  
function &factory($type, $priority = PEAR_LOG_INFO, $conf = array())  
{  
$type = strtolower($type);  
$class = 'Log_observer_' . $type;  
 
/*  
* If the desired class already exists (because the caller has supplied  
* it from some custom location), simply instantiate and return a new  
* instance.  
*/  
if (class_exists($class)) {  
$object = &new $class($priority, $conf);  
return $object;  
}  
 
/* Support both the new-style and old-style file naming conventions. */  
$newstyle = true;  
$classfile = dirname(__FILE__) . '/observer_' . $type . '.php';  
 
if (!file_exists($classfile)) {  
$classfile = 'Log/' . $type . '.php';  
$newstyle = false;  
}  
 
/*  
* Attempt to include our version of the named class, but don't treat  
* a failure as fatal. The caller may have already included their own  
* version of the named class.  
*/  
@include_once $classfile;  
 
/* If the class exists, return a new instance of it. */  
if (class_exists($class)) {  
/* Support both new-style and old-style construction. */  
if ($newstyle) {  
$object = &new $class($priority, $conf);  
} else {  
$object = &new $class($priority);  
}  
return $object;  
}  
 
$null = null;  
return $null;  
}  
 
/**  
* This is a stub method to make sure that Log_Observer classes do  
* something when they are notified of a message. The default behavior  
* is to just print the message, which is obviously not desireable in  
* practically any situation - which is why you need to override this  
* method. :)  
*  
* @param array $event A hash describing the log event.  
*/  
function notify($event)  
{  
print_r($event);  
}  
}  
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log/sql.php,v 1.12 2000/08/16 20:27:34 chuck Exp $  
*  
* @version $Revision: 250926 $  
* @package Log  
*/  
 
/**  
* We require the PEAR DB class. This is generally defined in the DB.php file,  
* but it's possible that the caller may have provided the DB class, or a  
* compatible wrapper (such as the one shipped with MDB2), so we first check  
* for an existing 'DB' class before including 'DB.php'.  
*/  
if (!class_exists('DB')) {  
require_once 'DB.php';  
}  
 
/**  
* The Log_sql class is a concrete implementation of the Log::  
* abstract class which sends messages to an SQL server. Each entry  
* occupies a separate row in the database.  
*  
* This implementation uses PHP's PEAR database abstraction layer.  
*  
* CREATE TABLE log_table (  
* id INT NOT NULL,  
* logtime TIMESTAMP NOT NULL,  
* ident CHAR(16) NOT NULL,  
* priority INT NOT NULL,  
* message VARCHAR(200),  
* PRIMARY KEY (id)  
* );  
*  
* @author Jon Parise <jon@php.net>  
* @since Horde 1.3  
* @since Log 1.0  
* @package Log  
*  
* @example sql.php Using the SQL handler.  
*/  
class Log_sql extends Log  
{  
/**  
* Variable containing the DSN information.  
* @var mixed  
* @access private  
*/  
var $_dsn = '';  
 
/**  
* String containing the SQL insertion statement.  
*  
* @var string  
* @access private  
*/  
var $_sql = '';  
 
/**  
* Array containing our set of DB configuration options.  
* @var array  
* @access private  
*/  
var $_options = array('persistent' => true);  
 
/**  
* Object holding the database handle.  
* @var object  
* @access private  
*/  
var $_db = null;  
 
/**  
* Resource holding the prepared statement handle.  
* @var resource  
* @access private  
*/  
var $_statement = null;  
 
/**  
* Flag indicating that we're using an existing database connection.  
* @var boolean  
* @access private  
*/  
var $_existingConnection = false;  
 
/**  
* String holding the database table to use.  
* @var string  
* @access private  
*/  
var $_table = 'log_table';  
 
/**  
* String holding the name of the ID sequence.  
* @var string  
* @access private  
*/  
var $_sequence = 'log_id';  
 
/**  
* Maximum length of the $ident string. This corresponds to the size of  
* the 'ident' column in the SQL table.  
* @var integer  
* @access private  
*/  
var $_identLimit = 16;  
 
 
/**  
* Constructs a new sql logging object.  
*  
* @param string $name The target SQL table.  
* @param string $ident The identification field.  
* @param array $conf The connection configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_sql($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_table = $name;  
$this->_mask = Log::UPTO($level);  
 
/* Now that we have a table name, assign our SQL statement. */  
if (!empty($conf['sql'])) {  
$this->_sql = $conf['sql'];  
} else {  
$this->_sql = 'INSERT INTO ' . $this->_table .  
' (id, logtime, ident, priority, message)' .  
' VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)';  
}  
 
/* If an options array was provided, use it. */  
if (isset($conf['options']) && is_array($conf['options'])) {  
$this->_options = $conf['options'];  
}  
 
/* If a specific sequence name was provided, use it. */  
if (!empty($conf['sequence'])) {  
$this->_sequence = $conf['sequence'];  
}  
 
/* If a specific sequence name was provided, use it. */  
if (isset($conf['identLimit'])) {  
$this->_identLimit = $conf['identLimit'];  
}  
 
/* Now that the ident limit is confirmed, set the ident string. */  
$this->setIdent($ident);  
 
/* If an existing database connection was provided, use it. */  
if (isset($conf['db'])) {  
$this->_db = &$conf['db'];  
$this->_existingConnection = true;  
$this->_opened = true;  
} else {  
$this->_dsn = $conf['dsn'];  
}  
}  
 
/**  
* Opens a connection to the database, if it has not already  
* been opened. This is implicitly called by log(), if necessary.  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
/* Use the DSN and options to create a database connection. */  
$this->_db = &DB::connect($this->_dsn, $this->_options);  
if (DB::isError($this->_db)) {  
return false;  
}  
 
/* Create a prepared statement for repeated use in log(). */  
if (!$this->_prepareStatement()) {  
return false;  
}  
 
/* We now consider out connection open. */  
$this->_opened = true;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the connection to the database if it is still open and we were  
* the ones that opened it. It is the caller's responsible to close an  
* existing connection that was passed to us via $conf['db'].  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function close()  
{  
if ($this->_opened && !$this->_existingConnection) {  
$this->_opened = false;  
$this->_db->freePrepared($this->_statement);  
return $this->_db->disconnect();  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Sets this Log instance's identification string. Note that this  
* SQL-specific implementation will limit the length of the $ident string  
* to sixteen (16) characters.  
*  
* @param string $ident The new identification string.  
*  
* @access public  
* @since Log 1.8.5  
*/  
function setIdent($ident)  
{  
$this->_ident = substr($ident, 0, $this->_identLimit);  
}  
 
/**  
* Inserts $message to the currently open database. Calls open(),  
* if necessary. Also passes the message along to any Log_observer  
* instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* If we don't already have our statement object yet, create it. */  
if (!is_object($this->_statement) && !$this->_prepareStatement()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build our set of values for this log entry. */  
$id = $this->_db->nextId($this->_sequence);  
$values = array($id, $this->_ident, $priority, $message);  
 
/* Execute the SQL query for this log entry insertion. */  
$result =& $this->_db->execute($this->_statement, $values);  
if (DB::isError($result)) {  
return false;  
}  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
/**  
* Prepare the SQL insertion statement.  
*  
* @return boolean True if the statement was successfully created.  
*  
* @access private  
* @since Log 1.9.1  
*/  
function _prepareStatement()  
{  
$this->_statement = $this->_db->prepare($this->_sql);  
 
/* Return success if we didn't generate an error. */  
return (DB::isError($this->_statement) === false);  
}  
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 202069 $  
* @package Log  
*/  
 
/**  
* The Log_sqlite class is a concrete implementation of the Log::  
* abstract class which sends messages to an Sqlite database.  
* Each entry occupies a separate row in the database.  
*  
* This implementation uses PHP native Sqlite functions.  
*  
* CREATE TABLE log_table (  
* id INTEGER PRIMARY KEY NOT NULL,  
* logtime NOT NULL,  
* ident CHAR(16) NOT NULL,  
* priority INT NOT NULL,  
* message  
* );  
*  
* @author Bertrand Mansion <bmansion@mamasam.com>  
* @author Jon Parise <jon@php.net>  
* @since Log 1.8.3  
* @package Log  
*  
* @example sqlite.php Using the Sqlite handler.  
*/  
class Log_sqlite extends Log  
{  
/**  
* Array containing the connection defaults  
* @var array  
* @access private  
*/  
var $_options = array('mode' => 0666,  
'persistent' => false);  
 
/**  
* Object holding the database handle.  
* @var object  
* @access private  
*/  
var $_db = null;  
 
/**  
* Flag indicating that we're using an existing database connection.  
* @var boolean  
* @access private  
*/  
var $_existingConnection = false;  
 
/**  
* String holding the database table to use.  
* @var string  
* @access private  
*/  
var $_table = 'log_table';  
 
 
/**  
* Constructs a new sql logging object.  
*  
* @param string $name The target SQL table.  
* @param string $ident The identification field.  
* @param mixed $conf Can be an array of configuration options used  
* to open a new database connection  
* or an already opened sqlite connection.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_sqlite($name, $ident = '', &$conf, $level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_table = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (is_array($conf)) {  
foreach ($conf as $k => $opt) {  
$this->_options[$k] = $opt;  
}  
} else {  
// If an existing database connection was provided, use it.  
$this->_db =& $conf;  
$this->_existingConnection = true;  
}  
}  
 
/**  
* Opens a connection to the database, if it has not already  
* been opened. This is implicitly called by log(), if necessary.  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function open()  
{  
if (is_resource($this->_db)) {  
$this->_opened = true;  
return $this->_createTable();  
} else {  
/* Set the connection function based on the 'persistent' option. */  
if (empty($this->_options['persistent'])) {  
$connectFunction = 'sqlite_open';  
} else {  
$connectFunction = 'sqlite_popen';  
}  
 
/* Attempt to connect to the database. */  
if ($this->_db = $connectFunction($this->_options['filename'],  
(int)$this->_options['mode'],  
$error)) {  
$this->_opened = true;  
return $this->_createTable();  
}  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the connection to the database if it is still open and we were  
* the ones that opened it. It is the caller's responsible to close an  
* existing connection that was passed to us via $conf['db'].  
*  
* @return boolean True on success, false on failure.  
* @access public  
*/  
function close()  
{  
/* We never close existing connections. */  
if ($this->_existingConnection) {  
return false;  
}  
 
if ($this->_opened) {  
$this->_opened = false;  
sqlite_close($this->_db);  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Inserts $message to the currently open database. Calls open(),  
* if necessary. Also passes the message along to any Log_observer  
* instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
// Extract the string representation of the message.  
$message = $this->_extractMessage($message);  
 
// Build the SQL query for this log entry insertion.  
$q = sprintf('INSERT INTO [%s] (logtime, ident, priority, message) ' .  
"VALUES ('%s', '%s', %d, '%s')",  
$this->_table,  
strftime('%Y-%m-%d %H:%M:%S', time()),  
sqlite_escape_string($this->_ident),  
$priority,  
sqlite_escape_string($message));  
if (!($res = @sqlite_unbuffered_query($this->_db, $q))) {  
return false;  
}  
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
/**  
* Checks whether the log table exists and creates it if necessary.  
*  
* @return boolean True on success or false on failure.  
* @access private  
*/  
function _createTable()  
{  
$q = "SELECT name FROM sqlite_master WHERE name='" . $this->_table .  
"' AND type='table'";  
 
$res = sqlite_query($this->_db, $q);  
 
if (sqlite_num_rows($res) == 0) {  
$q = 'CREATE TABLE [' . $this->_table . '] (' .  
'id INTEGER PRIMARY KEY NOT NULL, ' .  
'logtime NOT NULL, ' .  
'ident CHAR(16) NOT NULL, ' .  
'priority INT NOT NULL, ' .  
'message)';  
 
if (!($res = sqlite_unbuffered_query($this->_db, $q))) {  
return false;  
}  
}  
 
return true;  
}  
 
}  
 
<?php  
/**  
* $Header$  
* $Horde: horde/lib/Log/syslog.php,v 1.6 2000/06/28 21:36:13 jon Exp $  
*  
* @version $Revision: 302789 $  
* @package Log  
*/  
 
/**  
* The Log_syslog class is a concrete implementation of the Log::  
* abstract class which sends messages to syslog on UNIX-like machines  
* (PHP emulates this with the Event Log on Windows machines).  
*  
* @author Chuck Hagenbuch <chuck@horde.org>  
* @author Jon Parise <jon@php.net>  
* @since Horde 1.3  
* @since Log 1.0  
* @package Log  
*  
* @example syslog.php Using the syslog handler.  
*/  
class Log_syslog extends Log  
{  
/**  
* Integer holding the log facility to use.  
* @var integer  
* @access private  
*/  
var $_name = LOG_SYSLOG;  
 
/**  
* Should we inherit the current syslog connection for this process, or  
* should we call openlog() to start a new syslog connection?  
* @var boolean  
* @access private  
*/  
var $_inherit = false;  
 
/**  
* Maximum message length that will be sent to syslog(). If the handler  
* receives a message longer than this length limit, it will be split into  
* multiple syslog() calls.  
* @var integer  
* @access private  
*/  
var $_maxLength = 500;  
 
/**  
* String containing the format of a message.  
* @var string  
* @access private  
*/  
var $_lineFormat = '%4$s';  
 
/**  
* String containing the timestamp format. It will be passed directly to  
* strftime(). Note that the timestamp string will generated using the  
* current locale.  
* @var string  
* @access private  
*/  
var $_timeFormat = '%b %d %H:%M:%S';  
 
/**  
* Constructs a new syslog object.  
*  
* @param string $name The syslog facility.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_syslog($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
/* Ensure we have a valid integer value for $name. */  
if (empty($name) || !is_int($name)) {  
$name = LOG_SYSLOG;  
}  
 
if (isset($conf['inherit'])) {  
$this->_inherit = $conf['inherit'];  
$this->_opened = $this->_inherit;  
}  
if (isset($conf['maxLength'])) {  
$this->_maxLength = $conf['maxLength'];  
}  
if (!empty($conf['lineFormat'])) {  
$this->_lineFormat = str_replace(array_keys($this->_formatMap),  
array_values($this->_formatMap),  
$conf['lineFormat']);  
}  
if (!empty($conf['timeFormat'])) {  
$this->_timeFormat = $conf['timeFormat'];  
}  
 
$this->_id = md5(microtime());  
$this->_name = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
}  
 
/**  
* Opens a connection to the system logger, if it has not already  
* been opened. This is implicitly called by log(), if necessary.  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
$this->_opened = openlog($this->_ident, LOG_PID, $this->_name);  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the connection to the system logger, if it is open.  
* @access public  
*/  
function close()  
{  
if ($this->_opened && !$this->_inherit) {  
closelog();  
$this->_opened = false;  
}  
 
return true;  
}  
 
/**  
* Sends $message to the currently open syslog connection. Calls  
* open() if necessary. Also passes the message along to any Log_observer  
* instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param int $priority (optional) The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* If the connection isn't open and can't be opened, return failure. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
/* Build a syslog priority value based on our current configuration. */  
$priority = $this->_toSyslog($priority);  
if ($this->_inherit) {  
$priority |= $this->_name;  
}  
 
/* Apply the configured line format to the message string. */  
$message = $this->_format($this->_lineFormat,  
strftime($this->_timeFormat),  
$priority, $message);  
 
/* Split the string into parts based on our maximum length setting. */  
$parts = str_split($message, $this->_maxLength);  
if ($parts === false) {  
return false;  
}  
 
foreach ($parts as $part) {  
if (!syslog($priority, $part)) {  
return false;  
}  
}  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
/**  
* Converts a PEAR_LOG_* constant into a syslog LOG_* constant.  
*  
* This function exists because, under Windows, not all of the LOG_*  
* constants have unique values. Instead, the PEAR_LOG_* were introduced  
* for global use, with the conversion to the LOG_* constants kept local to  
* to the syslog driver.  
*  
* @param int $priority PEAR_LOG_* value to convert to LOG_* value.  
*  
* @return The LOG_* representation of $priority.  
*  
* @access private  
*/  
function _toSyslog($priority)  
{  
static $priorities = array(  
PEAR_LOG_EMERG => LOG_EMERG,  
PEAR_LOG_ALERT => LOG_ALERT,  
PEAR_LOG_CRIT => LOG_CRIT,  
PEAR_LOG_ERR => LOG_ERR,  
PEAR_LOG_WARNING => LOG_WARNING,  
PEAR_LOG_NOTICE => LOG_NOTICE,  
PEAR_LOG_INFO => LOG_INFO,  
PEAR_LOG_DEBUG => LOG_DEBUG  
);  
 
/* If we're passed an unknown priority, default to LOG_INFO. */  
if (!is_int($priority) || !in_array($priority, $priorities)) {  
return LOG_INFO;  
}  
 
return $priorities[$priority];  
}  
 
}  
 
<?php  
/**  
* $Header$  
*  
* @version $Revision: 278003 $  
* @package Log  
*/  
 
/**  
* The Log_win class is a concrete implementation of the Log abstract  
* class that logs messages to a separate browser window.  
*  
* The concept for this log handler is based on part by Craig Davis' article  
* entitled "JavaScript Power PHP Debugging:  
*  
* http://www.zend.com/zend/tut/tutorial-DebugLib.php  
*  
* @author Jon Parise <jon@php.net>  
* @since Log 1.7.0  
* @package Log  
*  
* @example win.php Using the window handler.  
*/  
class Log_win extends Log  
{  
/**  
* The name of the output window.  
* @var string  
* @access private  
*/  
var $_name = 'LogWindow';  
 
/**  
* The title of the output window.  
* @var string  
* @access private  
*/  
var $_title = 'Log Output Window';  
 
/**  
* Mapping of log priorities to styles.  
* @var array  
* @access private  
*/  
var $_styles = array(  
PEAR_LOG_EMERG => 'color: red;',  
PEAR_LOG_ALERT => 'color: orange;',  
PEAR_LOG_CRIT => 'color: yellow;',  
PEAR_LOG_ERR => 'color: green;',  
PEAR_LOG_WARNING => 'color: blue;',  
PEAR_LOG_NOTICE => 'color: indigo;',  
PEAR_LOG_INFO => 'color: violet;',  
PEAR_LOG_DEBUG => 'color: black;'  
);  
 
/**  
* String buffer that holds line that are pending output.  
* @var array  
* @access private  
*/  
var $_buffer = array();  
 
/**  
* Constructs a new Log_win object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_win($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
$this->_id = md5(microtime());  
$this->_name = str_replace(' ', '_', $name);  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
if (isset($conf['title'])) {  
$this->_title = $conf['title'];  
}  
if (isset($conf['styles']) && is_array($conf['styles'])) {  
$this->_styles = $conf['styles'];  
}  
if (isset($conf['colors']) && is_array($conf['colors'])) {  
foreach ($conf['colors'] as $level => $color) {  
$this->_styles[$level] .= "color: $color;";  
}  
}  
 
register_shutdown_function(array(&$this, '_Log_win'));  
}  
 
/**  
* Destructor  
*/  
function _Log_win()  
{  
if ($this->_opened || (count($this->_buffer) > 0)) {  
$this->close();  
}  
}  
 
/**  
* The first time open() is called, it will open a new browser window and  
* prepare it for output.  
*  
* This is implicitly called by log(), if necessary.  
*  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
$win = $this->_name;  
$styles = $this->_styles;  
 
if (!empty($this->_ident)) {  
$identHeader = "$win.document.writeln('<th>Ident</th>')";  
} else {  
$identHeader = '';  
}  
 
echo <<< EOT  
<script language="JavaScript">  
$win = window.open('', '{$this->_name}', 'toolbar=no,scrollbars,width=600,height=400');  
$win.document.writeln('<html>');  
$win.document.writeln('<head>');  
$win.document.writeln('<title>{$this->_title}</title>');  
$win.document.writeln('<style type="text/css">');  
$win.document.writeln('body { font-family: monospace; font-size: 8pt; }');  
$win.document.writeln('td,th { font-size: 8pt; }');  
$win.document.writeln('td,th { border-bottom: #999999 solid 1px; }');  
$win.document.writeln('td,th { border-right: #999999 solid 1px; }');  
$win.document.writeln('tr { text-align: left; vertical-align: top; }');  
$win.document.writeln('td.l0 { $styles[0] }');  
$win.document.writeln('td.l1 { $styles[1] }');  
$win.document.writeln('td.l2 { $styles[2] }');  
$win.document.writeln('td.l3 { $styles[3] }');  
$win.document.writeln('td.l4 { $styles[4] }');  
$win.document.writeln('td.l5 { $styles[5] }');  
$win.document.writeln('td.l6 { $styles[6] }');  
$win.document.writeln('td.l7 { $styles[7] }');  
$win.document.writeln('</style>');  
$win.document.writeln('<script type="text/javascript">');  
$win.document.writeln('function scroll() {');  
$win.document.writeln(' body = document.getElementById("{$this->_name}");');  
$win.document.writeln(' body.scrollTop = body.scrollHeight;');  
$win.document.writeln('}');  
$win.document.writeln('<\/script>');  
$win.document.writeln('</head>');  
$win.document.writeln('<body id="{$this->_name}" onclick="scroll()">');  
$win.document.writeln('<table border="0" cellpadding="2" cellspacing="0">');  
$win.document.writeln('<tr><th>Time</th>');  
$identHeader  
$win.document.writeln('<th>Priority</th><th width="100%">Message</th></tr>');  
</script>  
EOT;  
$this->_opened = true;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the output stream if it is open. If there are still pending  
* lines in the output buffer, the output window will be opened so that  
* the buffer can be drained.  
*  
* @access public  
*/  
function close()  
{  
/*  
* If there are still lines waiting to be written, open the output  
* window so that we can drain the buffer.  
*/  
if (!$this->_opened && (count($this->_buffer) > 0)) {  
$this->open();  
}  
 
if ($this->_opened) {  
$this->_writeln('</table>');  
$this->_writeln('</body></html>');  
$this->_drainBuffer();  
$this->_opened = false;  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Writes the contents of the output buffer to the output window.  
*  
* @access private  
*/  
function _drainBuffer()  
{  
$win = $this->_name;  
foreach ($this->_buffer as $line) {  
echo "<script language='JavaScript'>\n";  
echo "$win.document.writeln('" . addslashes($line) . "');\n";  
echo "self.focus();\n";  
echo "</script>\n";  
}  
 
/* Now that the buffer has been drained, clear it. */  
$this->_buffer = array();  
}  
 
/**  
* Writes a single line of text to the output buffer.  
*  
* @param string $line The line of text to write.  
*  
* @access private  
*/  
function _writeln($line)  
{  
/* Add this line to our output buffer. */  
$this->_buffer[] = $line;  
 
/* Buffer the output until this page's headers have been sent. */  
if (!headers_sent()) {  
return;  
}  
 
/* If we haven't already opened the output window, do so now. */  
if (!$this->_opened && !$this->open()) {  
return;  
}  
 
/* Drain the buffer to the output window. */  
$this->_drainBuffer();  
}  
 
/**  
* Logs $message to the output window. The message is also passed along  
* to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
$message = preg_replace('/\r\n|\n|\r/', '<br />', $message);  
 
list($usec, $sec) = explode(' ', microtime());  
 
/* Build the output line that contains the log entry row. */  
$line = '<tr>';  
$line .= sprintf('<td>%s.%s</td>',  
strftime('%H:%M:%S', $sec), substr($usec, 2, 2));  
if (!empty($this->_ident)) {  
$line .= '<td>' . $this->_ident . '</td>';  
}  
$line .= '<td>' . ucfirst($this->priorityToString($priority)) . '</td>';  
$line .= sprintf('<td class="l%d">%s</td>', $priority, $message);  
$line .= '</tr>';  
 
$this->_writeln($line);  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
 
ChangeLog  
 
Version 2.0.3 (November 08 2008)  
* fixed line 1041 in class.smtp.php (endless loop from missing = sign)  
* fixed duplicate images in email body  
* removed English language from language files and made it a default within  
class.phpmailer.php - if no language is found, it will default to use  
the english language translation  
* corrected $basedir to $directory  
* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user  
if default is not acceptable  
* removed trim() from return results in EncodeQP  
* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);  
* We have removed the /phpdoc from the downloads. All documentation is now on  
the http://phpmailer.codeworxtech.com website.  
 
Version 2.0.2 (June 04 2008)  
 
** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.  
IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE  
APPRECIATED.  
 
* added S/MIME functionality (ability to digitally sign emails)  
BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.  
The "Signed Emails" functionality adds the Sign method to pass the private key  
filename and the password to read it, and then email will be sent with  
content-type multipart/signed and with the digital signature attached.  
* added ability to define path (mainly for embedded images)  
function MsgHTML($message,$basedir='') ... where:  
$basedir is the fully qualified path  
* fixed MsgHTML() function:  
- Embedded Images where images are specified by <protocol>:// will not be altered or embedded  
* fixed the return value of SMTP exit code ( pclose )  
* addressed issue of multibyte characters in subject line and truncating  
* added ability to have user specified Message ID  
(default is still that PHPMailer create a unique Message ID)  
* corrected unidentified message type to 'application/octet-stream'  
* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).  
* added check for added attachments  
* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")  
 
Version 2.0.1 (Sun, Dec 02 2007)  
* corrected incorrect version numbers in all three classes  
 
Version 2.0.0 (Sun, Dec 02 2007)  
* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)  
* finished all testing, all known bugs corrected, enhancements tested  
- note: designed for PHP4, but will work with PHP5 (not compatible with  
E_STRICT) ... full PHP5 version of PHPMailer released separately.  
PHP5 version will NOT work with PHP4.  
 
Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release  
* implements new property to control VERP in class.smtp.php  
example (requires instantiating class.smtp.php):  
$mail->do_verp = true;  
* POP-before-SMTP functionality included, thanks to Richard Davey  
(see class.pop3.php & pop3_before_smtp_test.php for examples)  
* included example showing how to use PHPMailer with GMAIL  
* fixed the missing Cc in SendMail() and Mail()  
 
******************  
A note on sending bulk emails:  
 
If the email you are sending is not personalized, consider using the  
"undisclosed-recipient:;" strategy. That is, put all of your recipients  
in the Bcc field and set the To field to "undisclosed-recipients:;".  
It's a lot faster (only one send) and saves quite a bit on resources.  
Contrary to some opinions, this will not get you listed in spam engines -  
it's a legitimate way for you to send emails.  
 
A partial example for use with PHPMailer:  
 
$mail->AddAddress("undisclosed-recipients:;");  
$mail->AddBCC("email1@anydomain.com,email2@anyotherdomain.com,email3@anyalternatedomain.com");  
 
Many email service providers restrict the number of emails that can be sent  
in any given time period. Often that is between 50 - 60 emails maximum  
per hour or per send session.  
 
If that's the case, then break up your Bcc lists into chunks that are one  
less than your limit, and put a pause in your script.  
*******************  
 
Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release  
* dramatically simplified using inline graphics ... it's fully automated and  
requires no user input  
* added automatic document type detection for attachments and pictures  
* added MsgHTML() function to replace Body tag for HTML emails  
* fixed the SendMail security issues (input validation vulnerability)  
* enhanced the AddAddresses functionality so that the "Name" portion is used  
in the email address  
* removed the need to use the AltBody method (set from the HTML, or default  
text used)  
* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)  
* removed the need to set the IsHTML property (set automatically)  
* added Estonian language file by Indrek P&auml;ri  
* added header injection patch  
* added "set" method to permit users to create their own pseudo-properties  
like 'X-Headers', etc.  
example of use:  
$mail->set('X-Priority', '3');  
$mail->set('X-MSMail-Priority', 'Normal');  
* fixed warning message in SMTP get_lines method  
* added TLS/SSL SMTP support  
example of use:  
$mail = new PHPMailer();  
$mail->Mailer = "smtp";  
$mail->Host = "smtp.example.com";  
$mail->SMTPSecure = "tls"; // option  
//$mail->SMTPSecure = "ssl"; // option  
...  
$mail->Send();  
* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)  
* Works with PHP installed as a module or as CGI-PHP  
- NOTE: will NOT work with PHP5 in E_STRICT error mode  
 
Version 1.73 (Sun, Jun 10 2005)  
* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf  
* Now has a total of 20 translations  
* Fixed alt attachments bug: http://tinyurl.com/98u9k  
 
Version 1.72 (Wed, May 25 2004)  
* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.  
* Received: Removed this method because spam filter programs like  
SpamAssassin reject this header.  
* Fixed error count bug.  
* SetLanguage default is now "language/".  
* Fixed magic_quotes_runtime bug.  
 
Version 1.71 (Tue, Jul 28 2003)  
* Made several speed enhancements  
* Added German and Italian translation files  
* Fixed HELO/AUTH bugs on keep-alive connects  
* Now provides an error message if language file does not load  
* Fixed attachment EOL bug  
* Updated some unclear documentation  
* Added additional tests and improved others  
 
Version 1.70 (Mon, Jun 20 2003)  
* Added SMTP keep-alive support  
* Added IsError method for error detection  
* Added error message translation support (SetLanguage)  
* Refactored many methods to increase library performance  
* Hello now sends the newer EHLO message before HELO as per RFC 2821  
* Removed the boundary class and replaced it with GetBoundary  
* Removed queue support methods  
* New $Hostname variable  
* New Message-ID header  
* Received header reformat  
* Helo variable default changed to $Hostname  
* Removed extra spaces in Content-Type definition (#667182)  
* Return-Path should be set to Sender when set  
* Adds Q or B encoding to headers when necessary  
* quoted-encoding should now encode NULs \000  
* Fixed encoding of body/AltBody (#553370)  
* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)  
* Multiple bug fixes  
 
Version 1.65 (Fri, Aug 09 2002)  
* Fixed non-visible attachment bug (#585097) for Outlook  
* SMTP connections are now closed after each transaction  
* Fixed SMTP::Expand return value  
* Converted SMTP class documentation to phpDocumentor format  
 
Version 1.62 (Wed, Jun 26 2002)  
* Fixed multi-attach bug  
* Set proper word wrapping  
* Reduced memory use with attachments  
* Added more debugging  
* Changed documentation to phpDocumentor format  
 
Version 1.60 (Sat, Mar 30 2002)  
* Sendmail pipe and address patch (Christian Holtje)  
* Added embedded image and read confirmation support (A. Ognio)  
* Added unit tests  
* Added SMTP timeout support (*nix only)  
* Added possibly temporary PluginDir variable for SMTP class  
* Added LE message line ending variable  
* Refactored boundary and attachment code  
* Eliminated SMTP class warnings  
* Added SendToQueue method for future queuing support  
 
Version 1.54 (Wed, Dec 19 2001)  
* Add some queuing support code  
* Fixed a pesky multi/alt bug  
* Messages are no longer forced to have "To" addresses  
 
Version 1.50 (Thu, Nov 08 2001)  
* Fix extra lines when not using SMTP mailer  
* Set WordWrap variable to int with a zero default  
 
Version 1.47 (Tue, Oct 16 2001)  
* Fixed Received header code format  
* Fixed AltBody order error  
* Fixed alternate port warning  
 
Version 1.45 (Tue, Sep 25 2001)  
* Added enhanced SMTP debug support  
* Added support for multiple ports on SMTP  
* Added Received header for tracing  
* Fixed AddStringAttachment encoding  
* Fixed possible header name quote bug  
* Fixed wordwrap() trim bug  
* Couple other small bug fixes  
 
Version 1.41 (Wed, Aug 22 2001)  
* Fixed AltBody bug w/o attachments  
* Fixed rfc_date() for certain mail servers  
 
Version 1.40 (Sun, Aug 12 2001)  
* Added multipart/alternative support (AltBody)  
* Documentation update  
* Fixed bug in Mercury MTA  
 
Version 1.29 (Fri, Aug 03 2001)  
* Added AddStringAttachment() method  
* Added SMTP authentication support  
 
Version 1.28 (Mon, Jul 30 2001)  
* Fixed a typo in SMTP class  
* Fixed header issue with Imail (win32) SMTP server  
* Made fopen() calls for attachments use "rb" to fix win32 error  
 
Version 1.25 (Mon, Jul 02 2001)  
* Added RFC 822 date fix (Patrice)  
* Added improved error handling by adding a $ErrorInfo variable  
* Removed MailerDebug variable (obsolete with new error handler)  
 
Version 1.20 (Mon, Jun 25 2001)  
* Added quoted-printable encoding (Patrice)  
* Set Version as public and removed PrintVersion()  
* Changed phpdoc to only display public variables and methods  
 
Version 1.19 (Thu, Jun 21 2001)  
* Fixed MS Mail header bug  
* Added fix for Bcc problem with mail(). *Does not work on Win32*  
(See PHP bug report: http://www.php.net/bugs.php?id=11616)  
* mail() no longer passes a fifth parameter when not needed  
 
Version 1.15 (Fri, Jun 15 2001)  
[Note: these changes contributed by Patrice Fournier]  
* Changed all remaining \n to \r\n  
* Bcc: header no longer writen to message except  
when sent directly to sendmail  
* Added a small message to non-MIME compliant mail reader  
* Added Sender variable to change the Sender email  
used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode  
* Changed boundary setting to a place it will be set only once  
* Removed transfer encoding for whole message when using multipart  
* Message body now uses Encoding in multipart messages  
* Can set encoding and type to attachments 7bit, 8bit  
and binary attachment are sent as is, base64 are encoded  
* Can set Encoding to base64 to send 8 bits body  
through 7 bits servers  
 
Version 1.10 (Tue, Jun 12 2001)  
* Fixed win32 mail header bug (printed out headers in message body)  
 
Version 1.09 (Fri, Jun 08 2001)  
* Changed date header to work with Netscape mail programs  
* Altered phpdoc documentation  
 
Version 1.08 (Tue, Jun 05 2001)  
* Added enhanced error-checking  
* Added phpdoc documentation to source  
 
Version 1.06 (Fri, Jun 01 2001)  
* Added optional name for file attachments  
 
Version 1.05 (Tue, May 29 2001)  
* Code cleanup  
* Eliminated sendmail header warning message  
* Fixed possible SMTP error  
 
Version 1.03 (Thu, May 24 2001)  
* Fixed problem where qmail sends out duplicate messages  
 
Version 1.02 (Wed, May 23 2001)  
* Added multiple recipient and attachment Clear* methods  
* Added Sendmail public variable  
* Fixed problem with loading SMTP library multiple times  
 
Version 0.98 (Tue, May 22 2001)  
* Fixed problem with redundant mail hosts sending out multiple messages  
* Added additional error handler code  
* Added AddCustomHeader() function  
* Added support for Microsoft mail client headers (affects priority)  
* Fixed small bug with Mailer variable  
* Added PrintVersion() function  
 
Version 0.92 (Tue, May 15 2001)  
* Changed file names to class.phpmailer.php and class.smtp.php to match  
current PHP class trend.  
* Fixed problem where body not being printed when a message is attached  
* Several small bug fixes  
 
Version 0.90 (Tue, April 17 2001)  
* Intial public release  
 
GNU LESSER GENERAL PUBLIC LICENSE  
Version 2.1, February 1999  
 
Copyright (C) 1991, 1999 Free Software Foundation, Inc.  
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
Everyone is permitted to copy and distribute verbatim copies  
of this license document, but changing it is not allowed.  
 
[This is the first released version of the Lesser GPL. It also counts  
as the successor of the GNU Library Public License, version 2, hence  
the version number 2.1.]  
 
Preamble  
 
The licenses for most software are designed to take away your  
freedom to share and change it. By contrast, the GNU General Public  
Licenses are intended to guarantee your freedom to share and change  
free software--to make sure the software is free for all its users.  
 
This license, the Lesser General Public License, applies to some  
specially designated software packages--typically libraries--of the  
Free Software Foundation and other authors who decide to use it. You  
can use it too, but we suggest you first think carefully about whether  
this license or the ordinary General Public License is the better  
strategy to use in any particular case, based on the explanations below.  
 
When we speak of free software, we are referring to freedom of use,  
not price. Our General Public Licenses are designed to make sure that  
you have the freedom to distribute copies of free software (and charge  
for this service if you wish); that you receive source code or can get  
it if you want it; that you can change the software and use pieces of  
it in new free programs; and that you are informed that you can do  
these things.  
 
To protect your rights, we need to make restrictions that forbid  
distributors to deny you these rights or to ask you to surrender these  
rights. These restrictions translate to certain responsibilities for  
you if you distribute copies of the library or if you modify it.  
 
For example, if you distribute copies of the library, whether gratis  
or for a fee, you must give the recipients all the rights that we gave  
you. You must make sure that they, too, receive or can get the source  
code. If you link other code with the library, you must provide  
complete object files to the recipients, so that they can relink them  
with the library after making changes to the library and recompiling  
it. And you must show them these terms so they know their rights.  
 
We protect your rights with a two-step method: (1) we copyright the  
library, and (2) we offer you this license, which gives you legal  
permission to copy, distribute and/or modify the library.  
 
To protect each distributor, we want to make it very clear that  
there is no warranty for the free library. Also, if the library is  
modified by someone else and passed on, the recipients should know  
that what they have is not the original version, so that the original  
author's reputation will not be affected by problems that might be  
introduced by others.  
 
Finally, software patents pose a constant threat to the existence of  
any free program. We wish to make sure that a company cannot  
effectively restrict the users of a free program by obtaining a  
restrictive license from a patent holder. Therefore, we insist that  
any patent license obtained for a version of the library must be  
consistent with the full freedom of use specified in this license.  
 
Most GNU software, including some libraries, is covered by the  
ordinary GNU General Public License. This license, the GNU Lesser  
General Public License, applies to certain designated libraries, and  
is quite different from the ordinary General Public License. We use  
this license for certain libraries in order to permit linking those  
libraries into non-free programs.  
 
When a program is linked with a library, whether statically or using  
a shared library, the combination of the two is legally speaking a  
combined work, a derivative of the original library. The ordinary  
General Public License therefore permits such linking only if the  
entire combination fits its criteria of freedom. The Lesser General  
Public License permits more lax criteria for linking other code with  
the library.  
 
We call this license the "Lesser" General Public License because it  
does Less to protect the user's freedom than the ordinary General  
Public License. It also provides other free software developers Less  
of an advantage over competing non-free programs. These disadvantages  
are the reason we use the ordinary General Public License for many  
libraries. However, the Lesser license provides advantages in certain  
special circumstances.  
 
For example, on rare occasions, there may be a special need to  
encourage the widest possible use of a certain library, so that it becomes  
a de-facto standard. To achieve this, non-free programs must be  
allowed to use the library. A more frequent case is that a free  
library does the same job as widely used non-free libraries. In this  
case, there is little to gain by limiting the free library to free  
software only, so we use the Lesser General Public License.  
 
In other cases, permission to use a particular library in non-free  
programs enables a greater number of people to use a large body of  
free software. For example, permission to use the GNU C Library in  
non-free programs enables many more people to use the whole GNU  
operating system, as well as its variant, the GNU/Linux operating  
system.  
 
Although the Lesser General Public License is Less protective of the  
users' freedom, it does ensure that the user of a program that is  
linked with the Library has the freedom and the wherewithal to run  
that program using a modified version of the Library.  
 
The precise terms and conditions for copying, distribution and  
modification follow. Pay close attention to the difference between a  
"work based on the library" and a "work that uses the library". The  
former contains code derived from the library, whereas the latter must  
be combined with the library in order to run.  
 
GNU LESSER GENERAL PUBLIC LICENSE  
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION  
 
0. This License Agreement applies to any software library or other  
program which contains a notice placed by the copyright holder or  
other authorized party saying it may be distributed under the terms of  
this Lesser General Public License (also called "this License").  
Each licensee is addressed as "you".  
 
A "library" means a collection of software functions and/or data  
prepared so as to be conveniently linked with application programs  
(which use some of those functions and data) to form executables.  
 
The "Library", below, refers to any such software library or work  
which has been distributed under these terms. A "work based on the  
Library" means either the Library or any derivative work under  
copyright law: that is to say, a work containing the Library or a  
portion of it, either verbatim or with modifications and/or translated  
straightforwardly into another language. (Hereinafter, translation is  
included without limitation in the term "modification".)  
 
"Source code" for a work means the preferred form of the work for  
making modifications to it. For a library, complete source code means  
all the source code for all modules it contains, plus any associated  
interface definition files, plus the scripts used to control compilation  
and installation of the library.  
 
Activities other than copying, distribution and modification are not  
covered by this License; they are outside its scope. The act of  
running a program using the Library is not restricted, and output from  
such a program is covered only if its contents constitute a work based  
on the Library (independent of the use of the Library in a tool for  
writing it). Whether that is true depends on what the Library does  
and what the program that uses the Library does.  
 
1. You may copy and distribute verbatim copies of the Library's  
complete source code as you receive it, in any medium, provided that  
you conspicuously and appropriately publish on each copy an  
appropriate copyright notice and disclaimer of warranty; keep intact  
all the notices that refer to this License and to the absence of any  
warranty; and distribute a copy of this License along with the  
Library.  
 
You may charge a fee for the physical act of transferring a copy,  
and you may at your option offer warranty protection in exchange for a  
fee.  
 
2. You may modify your copy or copies of the Library or any portion  
of it, thus forming a work based on the Library, and copy and  
distribute such modifications or work under the terms of Section 1  
above, provided that you also meet all of these conditions:  
 
a) The modified work must itself be a software library.  
 
b) You must cause the files modified to carry prominent notices  
stating that you changed the files and the date of any change.  
 
c) You must cause the whole of the work to be licensed at no  
charge to all third parties under the terms of this License.  
 
d) If a facility in the modified Library refers to a function or a  
table of data to be supplied by an application program that uses  
the facility, other than as an argument passed when the facility  
is invoked, then you must make a good faith effort to ensure that,  
in the event an application does not supply such function or  
table, the facility still operates, and performs whatever part of  
its purpose remains meaningful.  
 
(For example, a function in a library to compute square roots has  
a purpose that is entirely well-defined independent of the  
application. Therefore, Subsection 2d requires that any  
application-supplied function or table used by this function must  
be optional: if the application does not supply it, the square  
root function must still compute square roots.)  
 
These requirements apply to the modified work as a whole. If  
identifiable sections of that work are not derived from the Library,  
and can be reasonably considered independent and separate works in  
themselves, then this License, and its terms, do not apply to those  
sections when you distribute them as separate works. But when you  
distribute the same sections as part of a whole which is a work based  
on the Library, the distribution of the whole must be on the terms of  
this License, whose permissions for other licensees extend to the  
entire whole, and thus to each and every part regardless of who wrote  
it.  
 
Thus, it is not the intent of this section to claim rights or contest  
your rights to work written entirely by you; rather, the intent is to  
exercise the right to control the distribution of derivative or  
collective works based on the Library.  
 
In addition, mere aggregation of another work not based on the Library  
with the Library (or with a work based on the Library) on a volume of  
a storage or distribution medium does not bring the other work under  
the scope of this License.  
 
3. You may opt to apply the terms of the ordinary GNU General Public  
License instead of this License to a given copy of the Library. To do  
this, you must alter all the notices that refer to this License, so  
that they refer to the ordinary GNU General Public License, version 2,  
instead of to this License. (If a newer version than version 2 of the  
ordinary GNU General Public License has appeared, then you can specify  
that version instead if you wish.) Do not make any other change in  
these notices.  
 
Once this change is made in a given copy, it is irreversible for  
that copy, so the ordinary GNU General Public License applies to all  
subsequent copies and derivative works made from that copy.  
 
This option is useful when you wish to copy part of the code of  
the Library into a program that is not a library.  
 
4. You may copy and distribute the Library (or a portion or  
derivative of it, under Section 2) in object code or executable form  
under the terms of Sections 1 and 2 above provided that you accompany  
it with the complete corresponding machine-readable source code, which  
must be distributed under the terms of Sections 1 and 2 above on a  
medium customarily used for software interchange.  
 
If distribution of object code is made by offering access to copy  
from a designated place, then offering equivalent access to copy the  
source code from the same place satisfies the requirement to  
distribute the source code, even though third parties are not  
compelled to copy the source along with the object code.  
 
5. A program that contains no derivative of any portion of the  
Library, but is designed to work with the Library by being compiled or  
linked with it, is called a "work that uses the Library". Such a  
work, in isolation, is not a derivative work of the Library, and  
therefore falls outside the scope of this License.  
 
However, linking a "work that uses the Library" with the Library  
creates an executable that is a derivative of the Library (because it  
contains portions of the Library), rather than a "work that uses the  
library". The executable is therefore covered by this License.  
Section 6 states terms for distribution of such executables.  
 
When a "work that uses the Library" uses material from a header file  
that is part of the Library, the object code for the work may be a  
derivative work of the Library even though the source code is not.  
Whether this is true is especially significant if the work can be  
linked without the Library, or if the work is itself a library. The  
threshold for this to be true is not precisely defined by law.  
 
If such an object file uses only numerical parameters, data  
structure layouts and accessors, and small macros and small inline  
functions (ten lines or less in length), then the use of the object  
file is unrestricted, regardless of whether it is legally a derivative  
work. (Executables containing this object code plus portions of the  
Library will still fall under Section 6.)  
 
Otherwise, if the work is a derivative of the Library, you may  
distribute the object code for the work under the terms of Section 6.  
Any executables containing that work also fall under Section 6,  
whether or not they are linked directly with the Library itself.  
 
6. As an exception to the Sections above, you may also combine or  
link a "work that uses the Library" with the Library to produce a  
work containing portions of the Library, and distribute that work  
under terms of your choice, provided that the terms permit  
modification of the work for the customer's own use and reverse  
engineering for debugging such modifications.  
 
You must give prominent notice with each copy of the work that the  
Library is used in it and that the Library and its use are covered by  
this License. You must supply a copy of this License. If the work  
during execution displays copyright notices, you must include the  
copyright notice for the Library among them, as well as a reference  
directing the user to the copy of this License. Also, you must do one  
of these things:  
 
a) Accompany the work with the complete corresponding  
machine-readable source code for the Library including whatever  
changes were used in the work (which must be distributed under  
Sections 1 and 2 above); and, if the work is an executable linked  
with the Library, with the complete machine-readable "work that  
uses the Library", as object code and/or source code, so that the  
user can modify the Library and then relink to produce a modified  
executable containing the modified Library. (It is understood  
that the user who changes the contents of definitions files in the  
Library will not necessarily be able to recompile the application  
to use the modified definitions.)  
 
b) Use a suitable shared library mechanism for linking with the  
Library. A suitable mechanism is one that (1) uses at run time a  
copy of the library already present on the user's computer system,  
rather than copying library functions into the executable, and (2)  
will operate properly with a modified version of the library, if  
the user installs one, as long as the modified version is  
interface-compatible with the version that the work was made with.  
 
c) Accompany the work with a written offer, valid for at  
least three years, to give the same user the materials  
specified in Subsection 6a, above, for a charge no more  
than the cost of performing this distribution.  
 
d) If distribution of the work is made by offering access to copy  
from a designated place, offer equivalent access to copy the above  
specified materials from the same place.  
 
e) Verify that the user has already received a copy of these  
materials or that you have already sent this user a copy.  
 
For an executable, the required form of the "work that uses the  
Library" must include any data and utility programs needed for  
reproducing the executable from it. However, as a special exception,  
the materials to be distributed need not include anything that is  
normally distributed (in either source or binary form) with the major  
components (compiler, kernel, and so on) of the operating system on  
which the executable runs, unless that component itself accompanies  
the executable.  
 
It may happen that this requirement contradicts the license  
restrictions of other proprietary libraries that do not normally  
accompany the operating system. Such a contradiction means you cannot  
use both them and the Library together in an executable that you  
distribute.  
 
7. You may place library facilities that are a work based on the  
Library side-by-side in a single library together with other library  
facilities not covered by this License, and distribute such a combined  
library, provided that the separate distribution of the work based on  
the Library and of the other library facilities is otherwise  
permitted, and provided that you do these two things:  
 
a) Accompany the combined library with a copy of the same work  
based on the Library, uncombined with any other library  
facilities. This must be distributed under the terms of the  
Sections above.  
 
b) Give prominent notice with the combined library of the fact  
that part of it is a work based on the Library, and explaining  
where to find the accompanying uncombined form of the same work.  
 
8. You may not copy, modify, sublicense, link with, or distribute  
the Library except as expressly provided under this License. Any  
attempt otherwise to copy, modify, sublicense, link with, or  
distribute the Library is void, and will automatically terminate your  
rights under this License. However, parties who have received copies,  
or rights, from you under this License will not have their licenses  
terminated so long as such parties remain in full compliance.  
 
9. You are not required to accept this License, since you have not  
signed it. However, nothing else grants you permission to modify or  
distribute the Library or its derivative works. These actions are  
prohibited by law if you do not accept this License. Therefore, by  
modifying or distributing the Library (or any work based on the  
Library), you indicate your acceptance of this License to do so, and  
all its terms and conditions for copying, distributing or modifying  
the Library or works based on it.  
 
10. Each time you redistribute the Library (or any work based on the  
Library), the recipient automatically receives a license from the  
original licensor to copy, distribute, link with or modify the Library  
subject to these terms and conditions. You may not impose any further  
restrictions on the recipients' exercise of the rights granted herein.  
You are not responsible for enforcing compliance by third parties with  
this License.  
 
11. If, as a consequence of a court judgment or allegation of patent  
infringement or for any other reason (not limited to patent issues),  
conditions are imposed on you (whether by court order, agreement or  
otherwise) that contradict the conditions of this License, they do not  
excuse you from the conditions of this License. If you cannot  
distribute so as to satisfy simultaneously your obligations under this  
License and any other pertinent obligations, then as a consequence you  
may not distribute the Library at all. For example, if a patent  
license would not permit royalty-free redistribution of the Library by  
all those who receive copies directly or indirectly through you, then  
the only way you could satisfy both it and this License would be to  
refrain entirely from distribution of the Library.  
 
If any portion of this section is held invalid or unenforceable under any  
particular circumstance, the balance of the section is intended to apply,  
and the section as a whole is intended to apply in other circumstances.  
 
It is not the purpose of this section to induce you to infringe any  
patents or other property right claims or to contest validity of any  
such claims; this section has the sole purpose of protecting the  
integrity of the free software distribution system which is  
implemented by public license practices. Many people have made  
generous contributions to the wide range of software distributed  
through that system in reliance on consistent application of that  
system; it is up to the author/donor to decide if he or she is willing  
to distribute software through any other system and a licensee cannot  
impose that choice.  
 
This section is intended to make thoroughly clear what is believed to  
be a consequence of the rest of this License.  
 
12. If the distribution and/or use of the Library is restricted in  
certain countries either by patents or by copyrighted interfaces, the  
original copyright holder who places the Library under this License may add  
an explicit geographical distribution limitation excluding those countries,  
so that distribution is permitted only in or among countries not thus  
excluded. In such case, this License incorporates the limitation as if  
written in the body of this License.  
 
13. The Free Software Foundation may publish revised and/or new  
versions of the Lesser General Public License from time to time.  
Such new versions will be similar in spirit to the present version,  
but may differ in detail to address new problems or concerns.  
 
Each version is given a distinguishing version number. If the Library  
specifies a version number of this License which applies to it and  
"any later version", you have the option of following the terms and  
conditions either of that version or of any later version published by  
the Free Software Foundation. If the Library does not specify a  
license version number, you may choose any version ever published by  
the Free Software Foundation.  
 
14. If you wish to incorporate parts of the Library into other free  
programs whose distribution conditions are incompatible with these,  
write to the author to ask for permission. For software which is  
copyrighted by the Free Software Foundation, write to the Free  
Software Foundation; we sometimes make exceptions for this. Our  
decision will be guided by the two goals of preserving the free status  
of all derivatives of our free software and of promoting the sharing  
and reuse of software generally.  
 
NO WARRANTY  
 
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO  
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR  
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY  
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE  
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE  
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME  
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.  
 
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN  
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY  
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU  
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR  
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE  
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING  
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A  
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF  
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH  
DAMAGES.  
 
END OF TERMS AND CONDITIONS  
 
How to Apply These Terms to Your New Libraries  
 
If you develop a new library, and you want it to be of the greatest  
possible use to the public, we recommend making it free software that  
everyone can redistribute and change. You can do so by permitting  
redistribution under these terms (or, alternatively, under the terms of the  
ordinary General Public License).  
 
To apply these terms, attach the following notices to the library. It is  
safest to attach them to the start of each source file to most effectively  
convey the exclusion of warranty; and each file should have at least the  
"copyright" line and a pointer to where the full notice is found.  
 
<one line to give the library's name and a brief idea of what it does.>  
Copyright (C) <year> <name of author>  
 
This library is free software; you can redistribute it and/or  
modify it under the terms of the GNU Lesser General Public  
License as published by the Free Software Foundation; either  
version 2.1 of the License, or (at your option) any later version.  
 
This library is distributed in the hope that it will be useful,  
but WITHOUT ANY WARRANTY; without even the implied warranty of  
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
Lesser General Public License for more details.  
 
You should have received a copy of the GNU Lesser General Public  
License along with this library; if not, write to the Free Software  
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
 
Also add information on how to contact you by electronic and paper mail.  
 
You should also get your employer (if you work as a programmer) or your  
school, if any, to sign a "copyright disclaimer" for the library, if  
necessary. Here is a sample; alter the names:  
 
Yoyodyne, Inc., hereby disclaims all copyright interest in the  
library `Frob' (a library for tweaking knobs) written by James Random Hacker.  
 
<signature of Ty Coon>, 1 April 1990  
Ty Coon, President of Vice  
 
That's all there is to it!  
 
 
 
/*******************************************************************  
* The http://phpmailer.codeworxtech.com/ website now carries a few *  
* advertisements through the Google Adsense network. Please visit *  
* the advertiser sites and help us offset some of our costs. *  
* Thanks .... *  
********************************************************************/  
 
PHPMailer  
Full Featured Email Transfer Class for PHP  
==========================================  
 
Version 2.3 (November 08, 2008)  
 
PHP4 continues to be a major platform for developers. We are responding  
to the emails received to continue development for PHP4 with this  
release.  
 
We have removed the /phpdoc from the downloads. All documentation is now on  
the http://phpmailer.codeworxtech.com website.  
 
For all other changes and notes, please see the changelog.  
 
Donations are accepted at PayPal with our id "paypal@worxteam.com".  
 
Version 2.2 (July 15 2008)  
 
- see the changelog.  
 
Version 2.0.2 (June 04 2008)  
 
With this release, we are announcing that the development of PHPMailer for PHP5  
will be our focus from this date on. We have implemented all the enhancements  
and fixes from the sourceforge.net Tracker.  
 
** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.  
IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE  
APPRECIATED.  
 
We have now added S/MIME functionality (ability to digitally sign emails).  
BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.  
The "Signed Emails" functionality adds the Sign method to pass the private key  
filename and the password to read it, and then email will be sent with  
content-type multipart/signed and with the digital signature attached.  
 
We have also included more example files to show the use of "sendmail", "mail()",  
"smtp", and "gmail".  
 
We are also looking for more programmers to join the volunteer development team.  
If you have an interest in this, please let us know.  
 
Enjoy!  
 
** NOTE:  
 
As of November 2007, PHPMailer has a new project team headed by industry  
veteran Andy Prevost (codeworxtech). The first release in more than two  
years will focus on fixes, adding ease-of-use enhancements, provide  
basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility  
features. A new release is planned before year-end 2007 that will provide  
full compatiblity with PHP4 and PHP5, as well as more bug fixes.  
 
We are looking for project developers to assist in restoring PHPMailer to  
its leadership position. Our goals are to simplify use of PHPMailer, provide  
good documentation and examples, and retain backward compatibility to level  
1.7.3 standards.  
 
If you are interested in helping out, visit http://sourceforge.net/projects/phpmailer  
and indicate your interest.  
 
**  
 
http://phpmailer.sourceforge.net/  
 
This software is licenced under the LGPL. Please read LICENSE for information on the  
software availability and distribution.  
 
Class Features:  
- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs  
- Redundant SMTP servers  
- Multipart/alternative emails for mail clients that do not read HTML email  
- Support for 8bit, base64, binary, and quoted-printable encoding  
- Uses the same methods as the very popular AspEmail active server (COM) component  
- SMTP authentication  
- Native language support  
- Word wrap, and more!  
 
Why you might need it:  
 
Many PHP developers utilize email in their code. The only PHP function  
that supports this is the mail() function. However, it does not expose  
any of the popular features that many email clients use nowadays like  
HTML-based emails and attachments. There are two proprietary  
development tools out there that have all the functionality built into  
easy to use classes: AspEmail(tm) and AspMail. Both of these  
programs are COM components only available on Windows. They are also a  
little pricey for smaller projects.  
 
 
So I built a version myself that implements the same methods (object  
calls) that the Windows-based components do. It is open source and the  
LGPL license allows you to place the class in your proprietary PHP  
projects.  
 
 
Installation:  
 
Copy class.phpmailer.php into your php.ini include_path. If you are  
using the SMTP mailer then place class.smtp.php in your path as well.  
In the language directory you will find several files like  
phpmailer.lang-en.php. If you look right before the .php extension  
that there are two letters. These represent the language type of the  
translation file. For instance "en" is the English file and "br" is  
the Portuguese file. Chose the file that best fits with your language  
and place it in the PHP include path. If your language is English  
then you have nothing more to do. If it is a different language then  
you must point PHPMailer to the correct translation. To do this, call  
the PHPMailer SetLanguage method like so:  
 
// To load the Portuguese version  
$mail->SetLanguage("br", "/optional/path/to/language/directory/");  
 
That's it. You should now be ready to use PHPMailer!  
 
 
A Simple Example:  
 
<?php  
require("class.phpmailer.php");  
 
$mail = new PHPMailer();  
 
$mail->IsSMTP(); // set mailer to use SMTP  
$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server  
$mail->SMTPAuth = true; // turn on SMTP authentication  
$mail->Username = "jswan"; // SMTP username  
$mail->Password = "secret"; // SMTP password  
 
$mail->From = "from@example.com";  
$mail->FromName = "Mailer";  
$mail->AddAddress("josh@example.net", "Josh Adams");  
$mail->AddAddress("ellen@example.com"); // name is optional  
$mail->AddReplyTo("info@example.com", "Information");  
 
$mail->WordWrap = 50; // set word wrap to 50 characters  
$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments  
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name  
$mail->IsHTML(true); // set email format to HTML  
 
$mail->Subject = "Here is the subject";  
$mail->Body = "This is the HTML message body <b>in bold!</b>";  
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";  
 
if(!$mail->Send())  
{  
echo "Message could not be sent. <p>";  
echo "Mailer Error: " . $mail->ErrorInfo;  
exit;  
}  
 
echo "Message has been sent";  
?>  
 
CHANGELOG  
 
See ChangeLog.txt  
 
Download: http://sourceforge.net/project/showfiles.php?group_id=26031  
 
Andy Prevost  
 
<?php  
/*~ class.phpmailer.php  
.---------------------------------------------------------------------------.  
| Software: PHPMailer - PHP email class |  
| Version: 2.0.3 |  
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |  
| Info: http://phpmailer.sourceforge.net |  
| Support: http://sourceforge.net/projects/phpmailer/ |  
| ------------------------------------------------------------------------- |  
| Author: Andy Prevost (project admininistrator) |  
| Author: Brent R. Matzelle (original founder) |  
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |  
| Copyright (c) 2001-2003, Brent R. Matzelle |  
| ------------------------------------------------------------------------- |  
| License: Distributed under the Lesser General Public License (LGPL) |  
| http://www.gnu.org/copyleft/lesser.html |  
| This program is distributed in the hope that it will be useful - WITHOUT |  
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |  
| FITNESS FOR A PARTICULAR PURPOSE. |  
| ------------------------------------------------------------------------- |  
| We offer a number of paid services (www.codeworxtech.com): |  
| - Web Hosting on highly optimized fast and secure servers |  
| - Technology Consulting |  
| - Oursourcing (highly qualified programmers and graphic designers) |  
'---------------------------------------------------------------------------'  
 
/**  
* PHPMailer - PHP email transport class  
* @package PHPMailer  
* @author Andy Prevost  
* @copyright 2004 - 2008 Andy Prevost  
*/  
 
class PHPMailer {  
 
/////////////////////////////////////////////////  
// PROPERTIES, PUBLIC  
/////////////////////////////////////////////////  
 
/**  
* Email priority (1 = High, 3 = Normal, 5 = low).  
* @var int  
*/  
var $Priority = 3;  
 
/**  
* Sets the CharSet of the message.  
* @var string  
*/  
var $CharSet = 'iso-8859-1';  
 
/**  
* Sets the Content-type of the message.  
* @var string  
*/  
var $ContentType = 'text/plain';  
 
/**  
* Sets the Encoding of the message. Options for this are "8bit",  
* "7bit", "binary", "base64", and "quoted-printable".  
* @var string  
*/  
var $Encoding = '8bit';  
 
/**  
* Holds the most recent mailer error message.  
* @var string  
*/  
var $ErrorInfo = '';  
 
/**  
* Sets the From email address for the message.  
* @var string  
*/  
var $From = 'root@localhost';  
 
/**  
* Sets the From name of the message.  
* @var string  
*/  
var $FromName = 'Root User';  
 
/**  
* Sets the Sender email (Return-Path) of the message. If not empty,  
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.  
* @var string  
*/  
var $Sender = '';  
 
/**  
* Sets the Subject of the message.  
* @var string  
*/  
var $Subject = '';  
 
/**  
* Sets the Body of the message. This can be either an HTML or text body.  
* If HTML then run IsHTML(true).  
* @var string  
*/  
var $Body = '';  
 
/**  
* Sets the text-only body of the message. This automatically sets the  
* email to multipart/alternative. This body can be read by mail  
* clients that do not have HTML email capability such as mutt. Clients  
* that can read HTML will view the normal Body.  
* @var string  
*/  
var $AltBody = '';  
 
/**  
* Sets word wrapping on the body of the message to a given number of  
* characters.  
* @var int  
*/  
var $WordWrap = 0;  
 
/**  
* Method to send mail: ("mail", "sendmail", or "smtp").  
* @var string  
*/  
var $Mailer = 'mail';  
 
/**  
* Sets the path of the sendmail program.  
* @var string  
*/  
var $Sendmail = '/usr/sbin/sendmail';  
 
/**  
* Path to PHPMailer plugins. This is now only useful if the SMTP class  
* is in a different directory than the PHP include path.  
* @var string  
*/  
var $PluginDir = '';  
 
/**  
* Holds PHPMailer version.  
* @var string  
*/  
var $Version = "2.0.3";  
 
/**  
* Sets the email address that a reading confirmation will be sent.  
* @var string  
*/  
var $ConfirmReadingTo = '';  
 
/**  
* Sets the hostname to use in Message-Id and Received headers  
* and as default HELO string. If empty, the value returned  
* by SERVER_NAME is used or 'localhost.localdomain'.  
* @var string  
*/  
var $Hostname = '';  
 
/**  
* Sets the message ID to be used in the Message-Id header.  
* If empty, a unique id will be generated.  
* @var string  
*/  
var $MessageID = '';  
 
/////////////////////////////////////////////////  
// PROPERTIES FOR SMTP  
/////////////////////////////////////////////////  
 
/**  
* Sets the SMTP hosts. All hosts must be separated by a  
* semicolon. You can also specify a different port  
* for each host by using this format: [hostname:port]  
* (e.g. "smtp1.example.com:25;smtp2.example.com").  
* Hosts will be tried in order.  
* @var string  
*/  
var $Host = 'localhost';  
 
/**  
* Sets the default SMTP server port.  
* @var int  
*/  
var $Port = 25;  
 
/**  
* Sets the SMTP HELO of the message (Default is $Hostname).  
* @var string  
*/  
var $Helo = '';  
 
/**  
* Sets connection prefix.  
* Options are "", "ssl" or "tls"  
* @var string  
*/  
var $SMTPSecure = "";  
 
/**  
* Sets SMTP authentication. Utilizes the Username and Password variables.  
* @var bool  
*/  
var $SMTPAuth = false;  
 
/**  
* Sets SMTP username.  
* @var string  
*/  
var $Username = '';  
 
/**  
* Sets SMTP password.  
* @var string  
*/  
var $Password = '';  
 
/**  
* Sets the SMTP server timeout in seconds. This function will not  
* work with the win32 version.  
* @var int  
*/  
var $Timeout = 10;  
 
/**  
* Sets SMTP class debugging on or off.  
* @var bool  
*/  
var $SMTPDebug = false;  
 
/**  
* Prevents the SMTP connection from being closed after each mail  
* sending. If this is set to true then to close the connection  
* requires an explicit call to SmtpClose().  
* @var bool  
*/  
var $SMTPKeepAlive = false;  
 
/**  
* Provides the ability to have the TO field process individual  
* emails, instead of sending to entire TO addresses  
* @var bool  
*/  
var $SingleTo = false;  
 
/////////////////////////////////////////////////  
// PROPERTIES, PRIVATE  
/////////////////////////////////////////////////  
 
var $smtp = NULL;  
var $to = array();  
var $cc = array();  
var $bcc = array();  
var $ReplyTo = array();  
var $attachment = array();  
var $CustomHeader = array();  
var $message_type = '';  
var $boundary = array();  
var $language = array();  
var $error_count = 0;  
var $LE = "\r\n";  
var $sign_cert_file = "";  
var $sign_key_file = "";  
var $sign_key_pass = "";  
 
/////////////////////////////////////////////////  
// METHODS, VARIABLES  
/////////////////////////////////////////////////  
 
/**  
* Sets message type to HTML.  
* @param bool $bool  
* @return void  
*/  
function IsHTML($bool) {  
if($bool == true) {  
$this->ContentType = 'text/html';  
} else {  
$this->ContentType = 'text/plain';  
}  
}  
 
/**  
* Sets Mailer to send message using SMTP.  
* @return void  
*/  
function IsSMTP() {  
$this->Mailer = 'smtp';  
}  
 
/**  
* Sets Mailer to send message using PHP mail() function.  
* @return void  
*/  
function IsMail() {  
$this->Mailer = 'mail';  
}  
 
/**  
* Sets Mailer to send message using the $Sendmail program.  
* @return void  
*/  
function IsSendmail() {  
$this->Mailer = 'sendmail';  
}  
 
/**  
* Sets Mailer to send message using the qmail MTA.  
* @return void  
*/  
function IsQmail() {  
$this->Sendmail = '/var/qmail/bin/sendmail';  
$this->Mailer = 'sendmail';  
}  
 
/////////////////////////////////////////////////  
// METHODS, RECIPIENTS  
/////////////////////////////////////////////////  
 
/**  
* Adds a "To" address.  
* @param string $address  
* @param string $name  
* @return void  
*/  
function AddAddress($address, $name = '') {  
$cur = count($this->to);  
$this->to[$cur][0] = trim($address);  
$this->to[$cur][1] = $name;  
}  
 
/**  
* Adds a "Cc" address. Note: this function works  
* with the SMTP mailer on win32, not with the "mail"  
* mailer.  
* @param string $address  
* @param string $name  
* @return void  
*/  
function AddCC($address, $name = '') {  
$cur = count($this->cc);  
$this->cc[$cur][0] = trim($address);  
$this->cc[$cur][1] = $name;  
}  
 
/**  
* Adds a "Bcc" address. Note: this function works  
* with the SMTP mailer on win32, not with the "mail"  
* mailer.  
* @param string $address  
* @param string $name  
* @return void  
*/  
function AddBCC($address, $name = '') {  
$cur = count($this->bcc);  
$this->bcc[$cur][0] = trim($address);  
$this->bcc[$cur][1] = $name;  
}  
 
/**  
* Adds a "Reply-To" address.  
* @param string $address  
* @param string $name  
* @return void  
*/  
function AddReplyTo($address, $name = '') {  
$cur = count($this->ReplyTo);  
$this->ReplyTo[$cur][0] = trim($address);  
$this->ReplyTo[$cur][1] = $name;  
}  
 
/////////////////////////////////////////////////  
// METHODS, MAIL SENDING  
/////////////////////////////////////////////////  
 
/**  
* Creates message and assigns Mailer. If the message is  
* not sent successfully then it returns false. Use the ErrorInfo  
* variable to view description of the error.  
* @return bool  
*/  
function Send() {  
$header = '';  
$body = '';  
$result = true;  
 
if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {  
$this->SetError($this->Lang('provide_address'));  
return false;  
}  
 
/* Set whether the message is multipart/alternative */  
if(!empty($this->AltBody)) {  
$this->ContentType = 'multipart/alternative';  
}  
 
$this->error_count = 0; // reset errors  
$this->SetMessageType();  
$header .= $this->CreateHeader();  
$body = $this->CreateBody();  
 
if($body == '') {  
return false;  
}  
 
/* Choose the mailer */  
switch($this->Mailer) {  
case 'sendmail':  
$result = $this->SendmailSend($header, $body);  
break;  
case 'smtp':  
$result = $this->SmtpSend($header, $body);  
break;  
case 'mail':  
$result = $this->MailSend($header, $body);  
break;  
default:  
$result = $this->MailSend($header, $body);  
break;  
//$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));  
//$result = false;  
//break;  
}  
 
return $result;  
}  
 
/**  
* Sends mail using the $Sendmail program.  
* @access private  
* @return bool  
*/  
function SendmailSend($header, $body) {  
if ($this->Sender != '') {  
$sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));  
} else {  
$sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));  
}  
 
if(!@$mail = popen($sendmail, 'w')) {  
$this->SetError($this->Lang('execute') . $this->Sendmail);  
return false;  
}  
 
fputs($mail, $header);  
fputs($mail, $body);  
 
$result = pclose($mail);  
if (version_compare(phpversion(), '4.2.3') == -1) {  
$result = $result >> 8 & 0xFF;  
}  
if($result != 0) {  
$this->SetError($this->Lang('execute') . $this->Sendmail);  
return false;  
}  
return true;  
}  
 
/**  
* Sends mail using the PHP mail() function.  
* @access private  
* @return bool  
*/  
function MailSend($header, $body) {  
 
$to = '';  
for($i = 0; $i < count($this->to); $i++) {  
if($i != 0) { $to .= ', '; }  
$to .= $this->AddrFormat($this->to[$i]);  
}  
 
$toArr = split(',', $to);  
 
$params = sprintf("-oi -f %s", $this->Sender);  
if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {  
$old_from = ini_get('sendmail_from');  
ini_set('sendmail_from', $this->Sender);  
if ($this->SingleTo === true && count($toArr) > 1) {  
foreach ($toArr as $key => $val) {  
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);  
}  
} else {  
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);  
}  
} else {  
if ($this->SingleTo === true && count($toArr) > 1) {  
foreach ($toArr as $key => $val) {  
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);  
}  
} else {  
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);  
}  
}  
 
if (isset($old_from)) {  
ini_set('sendmail_from', $old_from);  
}  
 
if(!$rt) {  
$this->SetError($this->Lang('instantiate'));  
return false;  
}  
 
return true;  
}  
 
/**  
* Sends mail via SMTP using PhpSMTP (Author:  
* Chris Ryan). Returns bool. Returns false if there is a  
* bad MAIL FROM, RCPT, or DATA input.  
* @access private  
* @return bool  
*/  
function SmtpSend($header, $body) {  
include_once($this->PluginDir . 'class.smtp.php');  
$error = '';  
$bad_rcpt = array();  
 
if(!$this->SmtpConnect()) {  
return false;  
}  
 
$smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;  
if(!$this->smtp->Mail($smtp_from)) {  
$error = $this->Lang('from_failed') . $smtp_from;  
$this->SetError($error);  
$this->smtp->Reset();  
return false;  
}  
 
/* Attempt to send attach all recipients */  
for($i = 0; $i < count($this->to); $i++) {  
if(!$this->smtp->Recipient($this->to[$i][0])) {  
$bad_rcpt[] = $this->to[$i][0];  
}  
}  
for($i = 0; $i < count($this->cc); $i++) {  
if(!$this->smtp->Recipient($this->cc[$i][0])) {  
$bad_rcpt[] = $this->cc[$i][0];  
}  
}  
for($i = 0; $i < count($this->bcc); $i++) {  
if(!$this->smtp->Recipient($this->bcc[$i][0])) {  
$bad_rcpt[] = $this->bcc[$i][0];  
}  
}  
 
if(count($bad_rcpt) > 0) { // Create error message  
for($i = 0; $i < count($bad_rcpt); $i++) {  
if($i != 0) {  
$error .= ', ';  
}  
$error .= $bad_rcpt[$i];  
}  
$error = $this->Lang('recipients_failed') . $error;  
$this->SetError($error);  
$this->smtp->Reset();  
return false;  
}  
 
if(!$this->smtp->Data($header . $body)) {  
$this->SetError($this->Lang('data_not_accepted'));  
$this->smtp->Reset();  
return false;  
}  
if($this->SMTPKeepAlive == true) {  
$this->smtp->Reset();  
} else {  
$this->SmtpClose();  
}  
 
return true;  
}  
 
/**  
* Initiates a connection to an SMTP server. Returns false if the  
* operation failed.  
* @access private  
* @return bool  
*/  
function SmtpConnect() {  
if($this->smtp == NULL) {  
$this->smtp = new SMTP();  
}  
 
$this->smtp->do_debug = $this->SMTPDebug;  
$hosts = explode(';', $this->Host);  
$index = 0;  
$connection = ($this->smtp->Connected());  
 
/* Retry while there is no connection */  
while($index < count($hosts) && $connection == false) {  
$hostinfo = array();  
if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {  
$host = $hostinfo[1];  
$port = $hostinfo[2];  
} else {  
$host = $hosts[$index];  
$port = $this->Port;  
}  
 
if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {  
if ($this->Helo != '') {  
$this->smtp->Hello($this->Helo);  
} else {  
$this->smtp->Hello($this->ServerHostname());  
}  
 
$connection = true;  
if($this->SMTPAuth) {  
if(!$this->smtp->Authenticate($this->Username, $this->Password)) {  
$this->SetError($this->Lang('authenticate'));  
$this->smtp->Reset();  
$connection = false;  
}  
}  
}  
$index++;  
}  
if(!$connection) {  
$this->SetError($this->Lang('connect_host'));  
}  
 
return $connection;  
}  
 
/**  
* Closes the active SMTP session if one exists.  
* @return void  
*/  
function SmtpClose() {  
if($this->smtp != NULL) {  
if($this->smtp->Connected()) {  
$this->smtp->Quit();  
$this->smtp->Close();  
}  
}  
}  
 
/**  
* Sets the language for all class error messages. Returns false  
* if it cannot load the language file. The default language type  
* is English.  
* @param string $lang_type Type of language (e.g. Portuguese: "br")  
* @param string $lang_path Path to the language file directory  
* @access public  
* @return bool  
*/  
function SetLanguage($lang_type, $lang_path = 'language/') {  
if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {  
include($lang_path.'phpmailer.lang-'.$lang_type.'.php');  
} elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {  
include($lang_path.'phpmailer.lang-en.php');  
} else {  
$PHPMAILER_LANG = array();  
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';  
$PHPMAILER_LANG["execute"] = 'Could not execute: ';  
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';  
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';  
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';  
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';  
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
}  
$this->language = $PHPMAILER_LANG;  
 
return true;  
}  
 
/////////////////////////////////////////////////  
// METHODS, MESSAGE CREATION  
/////////////////////////////////////////////////  
 
/**  
* Creates recipient headers.  
* @access private  
* @return string  
*/  
function AddrAppend($type, $addr) {  
$addr_str = $type . ': ';  
$addr_str .= $this->AddrFormat($addr[0]);  
if(count($addr) > 1) {  
for($i = 1; $i < count($addr); $i++) {  
$addr_str .= ', ' . $this->AddrFormat($addr[$i]);  
}  
}  
$addr_str .= $this->LE;  
 
return $addr_str;  
}  
 
/**  
* Formats an address correctly.  
* @access private  
* @return string  
*/  
function AddrFormat($addr) {  
if(empty($addr[1])) {  
$formatted = $this->SecureHeader($addr[0]);  
} else {  
$formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";  
}  
 
return $formatted;  
}  
 
/**  
* Wraps message for use with mailers that do not  
* automatically perform wrapping and for quoted-printable.  
* Original written by philippe.  
* @access private  
* @return string  
*/  
function WrapText($message, $length, $qp_mode = false) {  
$soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;  
// If utf-8 encoding is used, we will need to make sure we don't  
// split multibyte characters when we wrap  
$is_utf8 = (strtolower($this->CharSet) == "utf-8");  
 
$message = $this->FixEOL($message);  
if (substr($message, -1) == $this->LE) {  
$message = substr($message, 0, -1);  
}  
 
$line = explode($this->LE, $message);  
$message = '';  
for ($i=0 ;$i < count($line); $i++) {  
$line_part = explode(' ', $line[$i]);  
$buf = '';  
for ($e = 0; $e<count($line_part); $e++) {  
$word = $line_part[$e];  
if ($qp_mode and (strlen($word) > $length)) {  
$space_left = $length - strlen($buf) - 1;  
if ($e != 0) {  
if ($space_left > 20) {  
$len = $space_left;  
if ($is_utf8) {  
$len = $this->UTF8CharBoundary($word, $len);  
} elseif (substr($word, $len - 1, 1) == "=") {  
$len--;  
} elseif (substr($word, $len - 2, 1) == "=") {  
$len -= 2;  
}  
$part = substr($word, 0, $len);  
$word = substr($word, $len);  
$buf .= ' ' . $part;  
$message .= $buf . sprintf("=%s", $this->LE);  
} else {  
$message .= $buf . $soft_break;  
}  
$buf = '';  
}  
while (strlen($word) > 0) {  
$len = $length;  
if ($is_utf8) {  
$len = $this->UTF8CharBoundary($word, $len);  
} elseif (substr($word, $len - 1, 1) == "=") {  
$len--;  
} elseif (substr($word, $len - 2, 1) == "=") {  
$len -= 2;  
}  
$part = substr($word, 0, $len);  
$word = substr($word, $len);  
 
if (strlen($word) > 0) {  
$message .= $part . sprintf("=%s", $this->LE);  
} else {  
$buf = $part;  
}  
}  
} else {  
$buf_o = $buf;  
$buf .= ($e == 0) ? $word : (' ' . $word);  
 
if (strlen($buf) > $length and $buf_o != '') {  
$message .= $buf_o . $soft_break;  
$buf = $word;  
}  
}  
}  
$message .= $buf . $this->LE;  
}  
 
return $message;  
}  
 
/**  
* Finds last character boundary prior to maxLength in a utf-8  
* quoted (printable) encoded string.  
* Original written by Colin Brown.  
* @access private  
* @param string $encodedText utf-8 QP text  
* @param int $maxLength find last character boundary prior to this length  
* @return int  
*/  
function UTF8CharBoundary($encodedText, $maxLength) {  
$foundSplitPos = false;  
$lookBack = 3;  
while (!$foundSplitPos) {  
$lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);  
$encodedCharPos = strpos($lastChunk, "=");  
if ($encodedCharPos !== false) {  
// Found start of encoded character byte within $lookBack block.  
// Check the encoded byte value (the 2 chars after the '=')  
$hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);  
$dec = hexdec($hex);  
if ($dec < 128) { // Single byte character.  
// If the encoded char was found at pos 0, it will fit  
// otherwise reduce maxLength to start of the encoded char  
$maxLength = ($encodedCharPos == 0) ? $maxLength :  
$maxLength - ($lookBack - $encodedCharPos);  
$foundSplitPos = true;  
} elseif ($dec >= 192) { // First byte of a multi byte character  
// Reduce maxLength to split at start of character  
$maxLength = $maxLength - ($lookBack - $encodedCharPos);  
$foundSplitPos = true;  
} elseif ($dec < 192) { // Middle byte of a multi byte character, look further back  
$lookBack += 3;  
}  
} else {  
// No encoded character found  
$foundSplitPos = true;  
}  
}  
return $maxLength;  
}  
 
/**  
* Set the body wrapping.  
* @access private  
* @return void  
*/  
function SetWordWrap() {  
if($this->WordWrap < 1) {  
return;  
}  
 
switch($this->message_type) {  
case 'alt':  
/* fall through */  
case 'alt_attachments':  
$this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);  
break;  
default:  
$this->Body = $this->WrapText($this->Body, $this->WordWrap);  
break;  
}  
}  
 
/**  
* Assembles message header.  
* @access private  
* @return string  
*/  
function CreateHeader() {  
$result = '';  
 
/* Set the boundaries */  
$uniq_id = md5(uniqid(time()));  
$this->boundary[1] = 'b1_' . $uniq_id;  
$this->boundary[2] = 'b2_' . $uniq_id;  
 
$result .= $this->HeaderLine('Date', $this->RFCDate());  
if($this->Sender == '') {  
$result .= $this->HeaderLine('Return-Path', trim($this->From));  
} else {  
$result .= $this->HeaderLine('Return-Path', trim($this->Sender));  
}  
 
/* To be created automatically by mail() */  
if($this->Mailer != 'mail') {  
if(count($this->to) > 0) {  
$result .= $this->AddrAppend('To', $this->to);  
} elseif (count($this->cc) == 0) {  
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;');  
}  
}  
 
$from = array();  
$from[0][0] = trim($this->From);  
$from[0][1] = $this->FromName;  
$result .= $this->AddrAppend('From', $from);  
 
/* sendmail and mail() extract Cc from the header before sending */  
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {  
$result .= $this->AddrAppend('Cc', $this->cc);  
}  
 
/* sendmail and mail() extract Bcc from the header before sending */  
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {  
$result .= $this->AddrAppend('Bcc', $this->bcc);  
}  
 
if(count($this->ReplyTo) > 0) {  
$result .= $this->AddrAppend('Reply-To', $this->ReplyTo);  
}  
 
/* mail() sets the subject itself */  
if($this->Mailer != 'mail') {  
$result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));  
}  
 
if($this->MessageID != '') {  
$result .= $this->HeaderLine('Message-ID',$this->MessageID);  
} else {  
$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);  
}  
$result .= $this->HeaderLine('X-Priority', $this->Priority);  
$result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');  
 
if($this->ConfirmReadingTo != '') {  
$result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');  
}  
 
// Add custom headers  
for($index = 0; $index < count($this->CustomHeader); $index++) {  
$result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));  
}  
if (!$this->sign_key_file) {  
$result .= $this->HeaderLine('MIME-Version', '1.0');  
$result .= $this->GetMailMIME();  
}  
 
return $result;  
}  
 
/**  
* Returns the message MIME.  
* @access private  
* @return string  
*/  
function GetMailMIME() {  
$result = '';  
switch($this->message_type) {  
case 'plain':  
$result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);  
$result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);  
break;  
case 'attachments':  
/* fall through */  
case 'alt_attachments':  
if($this->InlineImageExists()){  
$result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);  
} else {  
$result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');  
$result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');  
}  
break;  
case 'alt':  
$result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');  
$result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');  
break;  
}  
 
if($this->Mailer != 'mail') {  
$result .= $this->LE.$this->LE;  
}  
 
return $result;  
}  
 
/**  
* Assembles the message body. Returns an empty string on failure.  
* @access private  
* @return string  
*/  
function CreateBody() {  
$result = '';  
if ($this->sign_key_file) {  
$result .= $this->GetMailMIME();  
}  
 
$this->SetWordWrap();  
 
switch($this->message_type) {  
case 'alt':  
$result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');  
$result .= $this->EncodeString($this->AltBody, $this->Encoding);  
$result .= $this->LE.$this->LE;  
$result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');  
$result .= $this->EncodeString($this->Body, $this->Encoding);  
$result .= $this->LE.$this->LE;  
$result .= $this->EndBoundary($this->boundary[1]);  
break;  
case 'plain':  
$result .= $this->EncodeString($this->Body, $this->Encoding);  
break;  
case 'attachments':  
$result .= $this->GetBoundary($this->boundary[1], '', '', '');  
$result .= $this->EncodeString($this->Body, $this->Encoding);  
$result .= $this->LE;  
$result .= $this->AttachAll();  
break;  
case 'alt_attachments':  
$result .= sprintf("--%s%s", $this->boundary[1], $this->LE);  
$result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);  
$result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body  
$result .= $this->EncodeString($this->AltBody, $this->Encoding);  
$result .= $this->LE.$this->LE;  
$result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body  
$result .= $this->EncodeString($this->Body, $this->Encoding);  
$result .= $this->LE.$this->LE;  
$result .= $this->EndBoundary($this->boundary[2]);  
$result .= $this->AttachAll();  
break;  
}  
 
if($this->IsError()) {  
$result = '';  
} else if ($this->sign_key_file) {  
$file = tempnam("", "mail");  
$fp = fopen($file, "w");  
fwrite($fp, $result);  
fclose($fp);  
$signed = tempnam("", "signed");  
 
if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {  
$fp = fopen($signed, "r");  
$result = fread($fp, filesize($this->sign_key_file));  
$result = '';  
while(!feof($fp)){  
$result = $result . fread($fp, 1024);  
}  
fclose($fp);  
} else {  
$this->SetError($this->Lang("signing").openssl_error_string());  
$result = '';  
}  
 
unlink($file);  
unlink($signed);  
}  
 
return $result;  
}  
 
/**  
* Returns the start of a message boundary.  
* @access private  
*/  
function GetBoundary($boundary, $charSet, $contentType, $encoding) {  
$result = '';  
if($charSet == '') {  
$charSet = $this->CharSet;  
}  
if($contentType == '') {  
$contentType = $this->ContentType;  
}  
if($encoding == '') {  
$encoding = $this->Encoding;  
}  
$result .= $this->TextLine('--' . $boundary);  
$result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);  
$result .= $this->LE;  
$result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);  
$result .= $this->LE;  
 
return $result;  
}  
 
/**  
* Returns the end of a message boundary.  
* @access private  
*/  
function EndBoundary($boundary) {  
return $this->LE . '--' . $boundary . '--' . $this->LE;  
}  
 
/**  
* Sets the message type.  
* @access private  
* @return void  
*/  
function SetMessageType() {  
if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {  
$this->message_type = 'plain';  
} else {  
if(count($this->attachment) > 0) {  
$this->message_type = 'attachments';  
}  
if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {  
$this->message_type = 'alt';  
}  
if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {  
$this->message_type = 'alt_attachments';  
}  
}  
}  
 
/* Returns a formatted header line.  
* @access private  
* @return string  
*/  
function HeaderLine($name, $value) {  
return $name . ': ' . $value . $this->LE;  
}  
 
/**  
* Returns a formatted mail line.  
* @access private  
* @return string  
*/  
function TextLine($value) {  
return $value . $this->LE;  
}  
 
/////////////////////////////////////////////////  
// CLASS METHODS, ATTACHMENTS  
/////////////////////////////////////////////////  
 
/**  
* Adds an attachment from a path on the filesystem.  
* Returns false if the file could not be found  
* or accessed.  
* @param string $path Path to the attachment.  
* @param string $name Overrides the attachment name.  
* @param string $encoding File encoding (see $Encoding).  
* @param string $type File extension (MIME) type.  
* @return bool  
*/  
function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {  
if(!@is_file($path)) {  
$this->SetError($this->Lang('file_access') . $path);  
return false;  
}  
 
$filename = basename($path);  
if($name == '') {  
$name = $filename;  
}  
 
$cur = count($this->attachment);  
$this->attachment[$cur][0] = $path;  
$this->attachment[$cur][1] = $filename;  
$this->attachment[$cur][2] = $name;  
$this->attachment[$cur][3] = $encoding;  
$this->attachment[$cur][4] = $type;  
$this->attachment[$cur][5] = false; // isStringAttachment  
$this->attachment[$cur][6] = 'attachment';  
$this->attachment[$cur][7] = 0;  
 
return true;  
}  
 
/**  
* Attaches all fs, string, and binary attachments to the message.  
* Returns an empty string on failure.  
* @access private  
* @return string  
*/  
function AttachAll() {  
/* Return text of body */  
$mime = array();  
 
/* Add all attachments */  
for($i = 0; $i < count($this->attachment); $i++) {  
/* Check for string attachment */  
$bString = $this->attachment[$i][5];  
if ($bString) {  
$string = $this->attachment[$i][0];  
} else {  
$path = $this->attachment[$i][0];  
}  
 
$filename = $this->attachment[$i][1];  
$name = $this->attachment[$i][2];  
$encoding = $this->attachment[$i][3];  
$type = $this->attachment[$i][4];  
$disposition = $this->attachment[$i][6];  
$cid = $this->attachment[$i][7];  
 
$mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);  
$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);  
$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);  
 
if($disposition == 'inline') {  
$mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);  
}  
 
$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);  
 
/* Encode as string attachment */  
if($bString) {  
$mime[] = $this->EncodeString($string, $encoding);  
if($this->IsError()) {  
return '';  
}  
$mime[] = $this->LE.$this->LE;  
} else {  
$mime[] = $this->EncodeFile($path, $encoding);  
if($this->IsError()) {  
return '';  
}  
$mime[] = $this->LE.$this->LE;  
}  
}  
 
$mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);  
 
return join('', $mime);  
}  
 
/**  
* Encodes attachment in requested format. Returns an  
* empty string on failure.  
* @access private  
* @return string  
*/  
function EncodeFile ($path, $encoding = 'base64') {  
if(!@$fd = fopen($path, 'rb')) {  
$this->SetError($this->Lang('file_open') . $path);  
return '';  
}  
$magic_quotes = get_magic_quotes_runtime();  
set_magic_quotes_runtime(0);  
$file_buffer = fread($fd, filesize($path));  
$file_buffer = $this->EncodeString($file_buffer, $encoding);  
fclose($fd);  
set_magic_quotes_runtime($magic_quotes);  
 
return $file_buffer;  
}  
 
/**  
* Encodes string to requested format. Returns an  
* empty string on failure.  
* @access private  
* @return string  
*/  
function EncodeString ($str, $encoding = 'base64') {  
$encoded = '';  
switch(strtolower($encoding)) {  
case 'base64':  
/* chunk_split is found in PHP >= 3.0.6 */  
$encoded = chunk_split(base64_encode($str), 76, $this->LE);  
break;  
case '7bit':  
case '8bit':  
$encoded = $this->FixEOL($str);  
if (substr($encoded, -(strlen($this->LE))) != $this->LE)  
$encoded .= $this->LE;  
break;  
case 'binary':  
$encoded = $str;  
break;  
case 'quoted-printable':  
$encoded = $this->EncodeQP($str);  
break;  
default:  
$this->SetError($this->Lang('encoding') . $encoding);  
break;  
}  
return $encoded;  
}  
 
/**  
* Encode a header string to best of Q, B, quoted or none.  
* @access private  
* @return string  
*/  
function EncodeHeader ($str, $position = 'text') {  
$x = 0;  
 
switch (strtolower($position)) {  
case 'phrase':  
if (!preg_match('/[\200-\377]/', $str)) {  
/* Can't use addslashes as we don't know what value has magic_quotes_sybase. */  
$encoded = addcslashes($str, "\0..\37\177\\\"");  
if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {  
return ($encoded);  
} else {  
return ("\"$encoded\"");  
}  
}  
$x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);  
break;  
case 'comment':  
$x = preg_match_all('/[()"]/', $str, $matches);  
/* Fall-through */  
case 'text':  
default:  
$x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);  
break;  
}  
 
if ($x == 0) {  
return ($str);  
}  
 
$maxlen = 75 - 7 - strlen($this->CharSet);  
/* Try to select the encoding which should produce the shortest output */  
if (strlen($str)/3 < $x) {  
$encoding = 'B';  
if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {  
// Use a custom function which correctly encodes and wraps long  
// multibyte strings without breaking lines within a character  
$encoded = $this->Base64EncodeWrapMB($str);  
} else {  
$encoded = base64_encode($str);  
$maxlen -= $maxlen % 4;  
$encoded = trim(chunk_split($encoded, $maxlen, "\n"));  
}  
} else {  
$encoding = 'Q';  
$encoded = $this->EncodeQ($str, $position);  
$encoded = $this->WrapText($encoded, $maxlen, true);  
$encoded = str_replace('='.$this->LE, "\n", trim($encoded));  
}  
 
$encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);  
$encoded = trim(str_replace("\n", $this->LE, $encoded));  
 
return $encoded;  
}  
 
/**  
* Checks if a string contains multibyte characters.  
* @access private  
* @param string $str multi-byte text to wrap encode  
* @return bool  
*/  
function HasMultiBytes($str) {  
if (function_exists('mb_strlen')) {  
return (strlen($str) > mb_strlen($str, $this->CharSet));  
} else { // Assume no multibytes (we can't handle without mbstring functions anyway)  
return False;  
}  
}  
 
/**  
* Correctly encodes and wraps long multibyte strings for mail headers  
* without breaking lines within a character.  
* Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php  
* @access private  
* @param string $str multi-byte text to wrap encode  
* @return string  
*/  
function Base64EncodeWrapMB($str) {  
$start = "=?".$this->CharSet."?B?";  
$end = "?=";  
$encoded = "";  
 
$mb_length = mb_strlen($str, $this->CharSet);  
// Each line must have length <= 75, including $start and $end  
$length = 75 - strlen($start) - strlen($end);  
// Average multi-byte ratio  
$ratio = $mb_length / strlen($str);  
// Base64 has a 4:3 ratio  
$offset = $avgLength = floor($length * $ratio * .75);  
 
for ($i = 0; $i < $mb_length; $i += $offset) {  
$lookBack = 0;  
 
do {  
$offset = $avgLength - $lookBack;  
$chunk = mb_substr($str, $i, $offset, $this->CharSet);  
$chunk = base64_encode($chunk);  
$lookBack++;  
}  
while (strlen($chunk) > $length);  
 
$encoded .= $chunk . $this->LE;  
}  
 
// Chomp the last linefeed  
$encoded = substr($encoded, 0, -strlen($this->LE));  
return $encoded;  
}  
 
/**  
* Encode string to quoted-printable.  
* @access private  
* @return string  
*/  
function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {  
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');  
$lines = preg_split('/(?:\r\n|\r|\n)/', $input);  
$eol = "\r\n";  
$escape = '=';  
$output = '';  
while( list(, $line) = each($lines) ) {  
$linlen = strlen($line);  
$newline = '';  
for($i = 0; $i < $linlen; $i++) {  
$c = substr( $line, $i, 1 );  
$dec = ord( $c );  
if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E  
$c = '=2E';  
}  
if ( $dec == 32 ) {  
if ( $i == ( $linlen - 1 ) ) { // convert space at eol only  
$c = '=20';  
} else if ( $space_conv ) {  
$c = '=20';  
}  
} elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required  
$h2 = floor($dec/16);  
$h1 = floor($dec%16);  
$c = $escape.$hex[$h2].$hex[$h1];  
}  
if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted  
$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay  
$newline = '';  
// check if newline first character will be point or not  
if ( $dec == 46 ) {  
$c = '=2E';  
}  
}  
$newline .= $c;  
} // end of for  
$output .= $newline.$eol;  
} // end of while  
return $output;  
}  
 
/**  
* Encode string to q encoding.  
* @access private  
* @return string  
*/  
function EncodeQ ($str, $position = 'text') {  
/* There should not be any EOL in the string */  
$encoded = preg_replace("[\r\n]", '', $str);  
 
switch (strtolower($position)) {  
case 'phrase':  
$encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);  
break;  
case 'comment':  
$encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);  
case 'text':  
default:  
/* Replace every high ascii, control =, ? and _ characters */  
$encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',  
"'='.sprintf('%02X', ord('\\1'))", $encoded);  
break;  
}  
 
/* Replace every spaces to _ (more readable than =20) */  
$encoded = str_replace(' ', '_', $encoded);  
 
return $encoded;  
}  
 
/**  
* Adds a string or binary attachment (non-filesystem) to the list.  
* This method can be used to attach ascii or binary data,  
* such as a BLOB record from a database.  
* @param string $string String attachment data.  
* @param string $filename Name of the attachment.  
* @param string $encoding File encoding (see $Encoding).  
* @param string $type File extension (MIME) type.  
* @return void  
*/  
function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {  
/* Append to $attachment array */  
$cur = count($this->attachment);  
$this->attachment[$cur][0] = $string;  
$this->attachment[$cur][1] = $filename;  
$this->attachment[$cur][2] = $filename;  
$this->attachment[$cur][3] = $encoding;  
$this->attachment[$cur][4] = $type;  
$this->attachment[$cur][5] = true; // isString  
$this->attachment[$cur][6] = 'attachment';  
$this->attachment[$cur][7] = 0;  
}  
 
/**  
* Adds an embedded attachment. This can include images, sounds, and  
* just about any other document. Make sure to set the $type to an  
* image type. For JPEG images use "image/jpeg" and for GIF images  
* use "image/gif".  
* @param string $path Path to the attachment.  
* @param string $cid Content ID of the attachment. Use this to identify  
* the Id for accessing the image in an HTML form.  
* @param string $name Overrides the attachment name.  
* @param string $encoding File encoding (see $Encoding).  
* @param string $type File extension (MIME) type.  
* @return bool  
*/  
function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {  
 
if(!@is_file($path)) {  
$this->SetError($this->Lang('file_access') . $path);  
return false;  
}  
 
$filename = basename($path);  
if($name == '') {  
$name = $filename;  
}  
 
/* Append to $attachment array */  
$cur = count($this->attachment);  
$this->attachment[$cur][0] = $path;  
$this->attachment[$cur][1] = $filename;  
$this->attachment[$cur][2] = $name;  
$this->attachment[$cur][3] = $encoding;  
$this->attachment[$cur][4] = $type;  
$this->attachment[$cur][5] = false;  
$this->attachment[$cur][6] = 'inline';  
$this->attachment[$cur][7] = $cid;  
 
return true;  
}  
 
/**  
* Returns true if an inline attachment is present.  
* @access private  
* @return bool  
*/  
function InlineImageExists() {  
$result = false;  
for($i = 0; $i < count($this->attachment); $i++) {  
if($this->attachment[$i][6] == 'inline') {  
$result = true;  
break;  
}  
}  
 
return $result;  
}  
 
/////////////////////////////////////////////////  
// CLASS METHODS, MESSAGE RESET  
/////////////////////////////////////////////////  
 
/**  
* Clears all recipients assigned in the TO array. Returns void.  
* @return void  
*/  
function ClearAddresses() {  
$this->to = array();  
}  
 
/**  
* Clears all recipients assigned in the CC array. Returns void.  
* @return void  
*/  
function ClearCCs() {  
$this->cc = array();  
}  
 
/**  
* Clears all recipients assigned in the BCC array. Returns void.  
* @return void  
*/  
function ClearBCCs() {  
$this->bcc = array();  
}  
 
/**  
* Clears all recipients assigned in the ReplyTo array. Returns void.  
* @return void  
*/  
function ClearReplyTos() {  
$this->ReplyTo = array();  
}  
 
/**  
* Clears all recipients assigned in the TO, CC and BCC  
* array. Returns void.  
* @return void  
*/  
function ClearAllRecipients() {  
$this->to = array();  
$this->cc = array();  
$this->bcc = array();  
}  
 
/**  
* Clears all previously set filesystem, string, and binary  
* attachments. Returns void.  
* @return void  
*/  
function ClearAttachments() {  
$this->attachment = array();  
}  
 
/**  
* Clears all custom headers. Returns void.  
* @return void  
*/  
function ClearCustomHeaders() {  
$this->CustomHeader = array();  
}  
 
/////////////////////////////////////////////////  
// CLASS METHODS, MISCELLANEOUS  
/////////////////////////////////////////////////  
 
/**  
* Adds the error message to the error container.  
* Returns void.  
* @access private  
* @return void  
*/  
function SetError($msg) {  
$this->error_count++;  
$this->ErrorInfo = $msg;  
}  
 
/**  
* Returns the proper RFC 822 formatted date.  
* @access private  
* @return string  
*/  
function RFCDate() {  
$tz = date('Z');  
$tzs = ($tz < 0) ? '-' : '+';  
$tz = abs($tz);  
$tz = (int)($tz/3600)*100 + ($tz%3600)/60;  
$result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);  
 
return $result;  
}  
 
/**  
* Returns the appropriate server variable. Should work with both  
* PHP 4.1.0+ as well as older versions. Returns an empty string  
* if nothing is found.  
* @access private  
* @return mixed  
*/  
function ServerVar($varName) {  
global $HTTP_SERVER_VARS;  
global $HTTP_ENV_VARS;  
 
if(!isset($_SERVER)) {  
$_SERVER = $HTTP_SERVER_VARS;  
if(!isset($_SERVER['REMOTE_ADDR'])) {  
$_SERVER = $HTTP_ENV_VARS; // must be Apache  
}  
}  
 
if(isset($_SERVER[$varName])) {  
return $_SERVER[$varName];  
} else {  
return '';  
}  
}  
 
/**  
* Returns the server hostname or 'localhost.localdomain' if unknown.  
* @access private  
* @return string  
*/  
function ServerHostname() {  
if ($this->Hostname != '') {  
$result = $this->Hostname;  
} elseif ($this->ServerVar('SERVER_NAME') != '') {  
$result = $this->ServerVar('SERVER_NAME');  
} else {  
$result = 'localhost.localdomain';  
}  
 
return $result;  
}  
 
/**  
* Returns a message in the appropriate language.  
* @access private  
* @return string  
*/  
function Lang($key) {  
if(count($this->language) < 1) {  
$this->SetLanguage('en'); // set the default language  
}  
 
if(isset($this->language[$key])) {  
return $this->language[$key];  
} else {  
return 'Language string failed to load: ' . $key;  
}  
}  
 
/**  
* Returns true if an error occurred.  
* @return bool  
*/  
function IsError() {  
return ($this->error_count > 0);  
}  
 
/**  
* Changes every end of line from CR or LF to CRLF.  
* @access private  
* @return string  
*/  
function FixEOL($str) {  
$str = str_replace("\r\n", "\n", $str);  
$str = str_replace("\r", "\n", $str);  
$str = str_replace("\n", $this->LE, $str);  
return $str;  
}  
 
/**  
* Adds a custom header.  
* @return void  
*/  
function AddCustomHeader($custom_header) {  
$this->CustomHeader[] = explode(':', $custom_header, 2);  
}  
 
/**  
* Evaluates the message and returns modifications for inline images and backgrounds  
* @access public  
* @return $message  
*/  
function MsgHTML($message,$basedir='') {  
preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);  
if(isset($images[2])) {  
foreach($images[2] as $i => $url) {  
// do not change urls for absolute images (thanks to corvuscorax)  
if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {  
$filename = basename($url);  
$directory = dirname($url);  
($directory == '.')?$directory='':'';  
$cid = 'cid:' . md5($filename);  
$fileParts = split("\.", $filename);  
$ext = $fileParts[1];  
$mimeType = $this->_mime_types($ext);  
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }  
if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }  
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {  
$message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);  
}  
}  
}  
}  
$this->IsHTML(true);  
$this->Body = $message;  
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));  
if ( !empty($textMsg) && empty($this->AltBody) ) {  
$this->AltBody = html_entity_decode($textMsg);  
}  
if ( empty($this->AltBody) ) {  
$this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";  
}  
}  
 
/**  
* Gets the mime type of the embedded or inline image  
* @access private  
* @return mime type of ext  
*/  
function _mime_types($ext = '') {  
$mimes = array(  
'ai' => 'application/postscript',  
'aif' => 'audio/x-aiff',  
'aifc' => 'audio/x-aiff',  
'aiff' => 'audio/x-aiff',  
'avi' => 'video/x-msvideo',  
'bin' => 'application/macbinary',  
'bmp' => 'image/bmp',  
'class' => 'application/octet-stream',  
'cpt' => 'application/mac-compactpro',  
'css' => 'text/css',  
'dcr' => 'application/x-director',  
'dir' => 'application/x-director',  
'dll' => 'application/octet-stream',  
'dms' => 'application/octet-stream',  
'doc' => 'application/msword',  
'dvi' => 'application/x-dvi',  
'dxr' => 'application/x-director',  
'eml' => 'message/rfc822',  
'eps' => 'application/postscript',  
'exe' => 'application/octet-stream',  
'gif' => 'image/gif',  
'gtar' => 'application/x-gtar',  
'htm' => 'text/html',  
'html' => 'text/html',  
'jpe' => 'image/jpeg',  
'jpeg' => 'image/jpeg',  
'jpg' => 'image/jpeg',  
'hqx' => 'application/mac-binhex40',  
'js' => 'application/x-javascript',  
'lha' => 'application/octet-stream',  
'log' => 'text/plain',  
'lzh' => 'application/octet-stream',  
'mid' => 'audio/midi',  
'midi' => 'audio/midi',  
'mif' => 'application/vnd.mif',  
'mov' => 'video/quicktime',  
'movie' => 'video/x-sgi-movie',  
'mp2' => 'audio/mpeg',  
'mp3' => 'audio/mpeg',  
'mpe' => 'video/mpeg',  
'mpeg' => 'video/mpeg',  
'mpg' => 'video/mpeg',  
'mpga' => 'audio/mpeg',  
'oda' => 'application/oda',  
'pdf' => 'application/pdf',  
'php' => 'application/x-httpd-php',  
'php3' => 'application/x-httpd-php',  
'php4' => 'application/x-httpd-php',  
'phps' => 'application/x-httpd-php-source',  
'phtml' => 'application/x-httpd-php',  
'png' => 'image/png',  
'ppt' => 'application/vnd.ms-powerpoint',  
'ps' => 'application/postscript',  
'psd' => 'application/octet-stream',  
'qt' => 'video/quicktime',  
'ra' => 'audio/x-realaudio',  
'ram' => 'audio/x-pn-realaudio',  
'rm' => 'audio/x-pn-realaudio',  
'rpm' => 'audio/x-pn-realaudio-plugin',  
'rtf' => 'text/rtf',  
'rtx' => 'text/richtext',  
'rv' => 'video/vnd.rn-realvideo',  
'sea' => 'application/octet-stream',  
'shtml' => 'text/html',  
'sit' => 'application/x-stuffit',  
'so' => 'application/octet-stream',  
'smi' => 'application/smil',  
'smil' => 'application/smil',  
'swf' => 'application/x-shockwave-flash',  
'tar' => 'application/x-tar',  
'text' => 'text/plain',  
'txt' => 'text/plain',  
'tgz' => 'application/x-tar',  
'tif' => 'image/tiff',  
'tiff' => 'image/tiff',  
'wav' => 'audio/x-wav',  
'wbxml' => 'application/vnd.wap.wbxml',  
'wmlc' => 'application/vnd.wap.wmlc',  
'word' => 'application/msword',  
'xht' => 'application/xhtml+xml',  
'xhtml' => 'application/xhtml+xml',  
'xl' => 'application/excel',  
'xls' => 'application/vnd.ms-excel',  
'xml' => 'text/xml',  
'xsl' => 'text/xml',  
'zip' => 'application/zip'  
);  
return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];  
}  
 
/**  
* Set (or reset) Class Objects (variables)  
*  
* Usage Example:  
* $page->set('X-Priority', '3');  
*  
* @access public  
* @param string $name Parameter Name  
* @param mixed $value Parameter Value  
* NOTE: will not work with arrays, there are no arrays to set/reset  
*/  
function set ( $name, $value = '' ) {  
if ( isset($this->$name) ) {  
$this->$name = $value;  
} else {  
$this->SetError('Cannot set or reset variable ' . $name);  
return false;  
}  
}  
 
/**  
* Read a file from a supplied filename and return it.  
*  
* @access public  
* @param string $filename Parameter File Name  
*/  
function getFile($filename) {  
$return = '';  
if ($fp = fopen($filename, 'rb')) {  
while (!feof($fp)) {  
$return .= fread($fp, 1024);  
}  
fclose($fp);  
return $return;  
} else {  
return false;  
}  
}  
 
/**  
* Strips newlines to prevent header injection.  
* @access private  
* @param string $str String  
* @return string  
*/  
function SecureHeader($str) {  
$str = trim($str);  
$str = str_replace("\r", "", $str);  
$str = str_replace("\n", "", $str);  
return $str;  
}  
 
/**  
* Set the private key file and password to sign the message.  
*  
* @access public  
* @param string $key_filename Parameter File Name  
* @param string $key_pass Password for private key  
*/  
function Sign($cert_filename, $key_filename, $key_pass) {  
$this->sign_cert_file = $cert_filename;  
$this->sign_key_file = $key_filename;  
$this->sign_key_pass = $key_pass;  
}  
 
}  
 
?>  
<?php  
/*~ class.pop3.php  
.---------------------------------------------------------------------------.  
| Software: PHPMailer - PHP email class |  
| Version: 2.0.3 |  
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |  
| Info: http://phpmailer.sourceforge.net |  
| Support: http://sourceforge.net/projects/phpmailer/ |  
| ------------------------------------------------------------------------- |  
| Author: Andy Prevost (project admininistrator) |  
| Author: Brent R. Matzelle (original founder) |  
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |  
| Copyright (c) 2001-2003, Brent R. Matzelle |  
| ------------------------------------------------------------------------- |  
| License: Distributed under the Lesser General Public License (LGPL) |  
| http://www.gnu.org/copyleft/lesser.html |  
| This program is distributed in the hope that it will be useful - WITHOUT |  
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |  
| FITNESS FOR A PARTICULAR PURPOSE. |  
| ------------------------------------------------------------------------- |  
| We offer a number of paid services (www.codeworxtech.com): |  
| - Web Hosting on highly optimized fast and secure servers |  
| - Technology Consulting |  
| - Oursourcing (highly qualified programmers and graphic designers) |  
'---------------------------------------------------------------------------'  
 
/**  
* POP Before SMTP Authentication Class  
*  
* Author: Richard Davey (rich@corephp.co.uk)  
* License: LGPL, see PHPMailer License  
*  
* Specifically for PHPMailer to allow POP before SMTP authentication.  
* Does not yet work with APOP - if you have an APOP account, contact me  
* and we can test changes to this script.  
*  
* This class is based on the structure of the SMTP class by Chris Ryan  
*  
* This class is rfc 1939 compliant and implements all the commands  
* required for POP3 connection, authentication and disconnection.  
*  
* @package PHPMailer  
* @author Richard Davey  
*/  
 
class POP3  
{  
/**  
* Default POP3 port  
* @var int  
*/  
var $POP3_PORT = 110;  
 
/**  
* Default Timeout  
* @var int  
*/  
var $POP3_TIMEOUT = 30;  
 
/**  
* POP3 Carriage Return + Line Feed  
* @var string  
*/  
var $CRLF = "\r\n";  
 
/**  
* Displaying Debug warnings? (0 = now, 1+ = yes)  
* @var int  
*/  
var $do_debug = 2;  
 
/**  
* POP3 Mail Server  
* @var string  
*/  
var $host;  
 
/**  
* POP3 Port  
* @var int  
*/  
var $port;  
 
/**  
* POP3 Timeout Value  
* @var int  
*/  
var $tval;  
 
/**  
* POP3 Username  
* @var string  
*/  
var $username;  
 
/**  
* POP3 Password  
* @var string  
*/  
var $password;  
 
/**#@+  
* @access private  
*/  
var $pop_conn;  
var $connected;  
var $error; // Error log array  
/**#@-*/  
 
/**  
* Constructor, sets the initial values  
*  
* @return POP3  
*/  
function POP3 ()  
{  
$this->pop_conn = 0;  
$this->connected = false;  
$this->error = null;  
}  
 
/**  
* Combination of public events - connect, login, disconnect  
*  
* @param string $host  
* @param integer $port  
* @param integer $tval  
* @param string $username  
* @param string $password  
*/  
function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0)  
{  
$this->host = $host;  
 
// If no port value is passed, retrieve it  
if ($port == false)  
{  
$this->port = $this->POP3_PORT;  
}  
else  
{  
$this->port = $port;  
}  
 
// If no port value is passed, retrieve it  
if ($tval == false)  
{  
$this->tval = $this->POP3_TIMEOUT;  
}  
else  
{  
$this->tval = $tval;  
}  
 
$this->do_debug = $debug_level;  
$this->username = $username;  
$this->password = $password;  
 
// Refresh the error log  
$this->error = null;  
 
// Connect  
$result = $this->Connect($this->host, $this->port, $this->tval);  
 
if ($result)  
{  
$login_result = $this->Login($this->username, $this->password);  
 
if ($login_result)  
{  
$this->Disconnect();  
 
return true;  
}  
 
}  
 
// We need to disconnect regardless if the login succeeded  
$this->Disconnect();  
 
return false;  
}  
 
/**  
* Connect to the POP3 server  
*  
* @param string $host  
* @param integer $port  
* @param integer $tval  
* @return boolean  
*/  
function Connect ($host, $port = false, $tval = 30)  
{  
// Are we already connected?  
if ($this->connected)  
{  
return true;  
}  
 
/*  
On Windows this will raise a PHP Warning error if the hostname doesn't exist.  
Rather than supress it with @fsockopen, let's capture it cleanly instead  
*/  
 
set_error_handler(array(&$this, 'catchWarning'));  
 
// Connect to the POP3 server  
$this->pop_conn = fsockopen($host, // POP3 Host  
$port, // Port #  
$errno, // Error Number  
$errstr, // Error Message  
$tval); // Timeout (seconds)  
 
// Restore the error handler  
restore_error_handler();  
 
// Does the Error Log now contain anything?  
if ($this->error && $this->do_debug >= 1)  
{  
$this->displayErrors();  
}  
 
// Did we connect?  
if ($this->pop_conn == false)  
{  
// It would appear not...  
$this->error = array(  
'error' => "Failed to connect to server $host on port $port",  
'errno' => $errno,  
'errstr' => $errstr  
);  
 
if ($this->do_debug >= 1)  
{  
$this->displayErrors();  
}  
 
return false;  
}  
 
// Increase the stream time-out  
 
// Check for PHP 4.3.0 or later  
if (version_compare(phpversion(), '4.3.0', 'ge'))  
{  
stream_set_timeout($this->pop_conn, $tval, 0);  
}  
else  
{  
// Does not work on Windows  
if (substr(PHP_OS, 0, 3) !== 'WIN')  
{  
socket_set_timeout($this->pop_conn, $tval, 0);  
}  
}  
 
// Get the POP3 server response  
$pop3_response = $this->getResponse();  
 
// Check for the +OK  
if ($this->checkResponse($pop3_response))  
{  
// The connection is established and the POP3 server is talking  
$this->connected = true;  
return true;  
}  
 
}  
 
/**  
* Login to the POP3 server (does not support APOP yet)  
*  
* @param string $username  
* @param string $password  
* @return boolean  
*/  
function Login ($username = '', $password = '')  
{  
if ($this->connected == false)  
{  
$this->error = 'Not connected to POP3 server';  
 
if ($this->do_debug >= 1)  
{  
$this->displayErrors();  
}  
}  
 
if (empty($username))  
{  
$username = $this->username;  
}  
 
if (empty($password))  
{  
$password = $this->password;  
}  
 
$pop_username = "USER $username" . $this->CRLF;  
$pop_password = "PASS $password" . $this->CRLF;  
 
// Send the Username  
$this->sendString($pop_username);  
$pop3_response = $this->getResponse();  
 
if ($this->checkResponse($pop3_response))  
{  
// Send the Password  
$this->sendString($pop_password);  
$pop3_response = $this->getResponse();  
 
if ($this->checkResponse($pop3_response))  
{  
return true;  
}  
else  
{  
return false;  
}  
}  
else  
{  
return false;  
}  
}  
 
/**  
* Disconnect from the POP3 server  
*/  
function Disconnect ()  
{  
$this->sendString('QUIT');  
 
fclose($this->pop_conn);  
}  
 
/*  
---------------  
Private Methods  
---------------  
*/  
 
/**  
* Get the socket response back.  
* $size is the maximum number of bytes to retrieve  
*  
* @param integer $size  
* @return string  
*/  
function getResponse ($size = 128)  
{  
$pop3_response = fgets($this->pop_conn, $size);  
 
return $pop3_response;  
}  
 
/**  
* Send a string down the open socket connection to the POP3 server  
*  
* @param string $string  
* @return integer  
*/  
function sendString ($string)  
{  
$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));  
 
return $bytes_sent;  
 
}  
 
/**  
* Checks the POP3 server response for +OK or -ERR  
*  
* @param string $string  
* @return boolean  
*/  
function checkResponse ($string)  
{  
if (substr($string, 0, 3) !== '+OK')  
{  
$this->error = array(  
'error' => "Server reported an error: $string",  
'errno' => 0,  
'errstr' => ''  
);  
 
if ($this->do_debug >= 1)  
{  
$this->displayErrors();  
}  
 
return false;  
}  
else  
{  
return true;  
}  
 
}  
 
/**  
* If debug is enabled, display the error message array  
*  
*/  
function displayErrors ()  
{  
echo '<pre>';  
 
foreach ($this->error as $single_error)  
{  
print_r($single_error);  
}  
 
echo '</pre>';  
}  
 
/**  
* Takes over from PHP for the socket warning handler  
*  
* @param integer $errno  
* @param string $errstr  
* @param string $errfile  
* @param integer $errline  
*/  
function catchWarning ($errno, $errstr, $errfile, $errline)  
{  
$this->error[] = array(  
'error' => "Connecting to the POP3 server raised a PHP warning: ",  
'errno' => $errno,  
'errstr' => $errstr  
);  
}  
 
// End of class  
}  
?>  
 
<?php  
/*~ class.smtp.php  
.---------------------------------------------------------------------------.  
| Software: PHPMailer - PHP email class |  
| Version: 2.0.3 |  
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |  
| Info: http://phpmailer.sourceforge.net |  
| Support: http://sourceforge.net/projects/phpmailer/ |  
| ------------------------------------------------------------------------- |  
| Author: Andy Prevost (project admininistrator) |  
| Author: Brent R. Matzelle (original founder) |  
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |  
| Copyright (c) 2001-2003, Brent R. Matzelle |  
| ------------------------------------------------------------------------- |  
| License: Distributed under the Lesser General Public License (LGPL) |  
| http://www.gnu.org/copyleft/lesser.html |  
| This program is distributed in the hope that it will be useful - WITHOUT |  
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |  
| FITNESS FOR A PARTICULAR PURPOSE. |  
| ------------------------------------------------------------------------- |  
| We offer a number of paid services (www.codeworxtech.com): |  
| - Web Hosting on highly optimized fast and secure servers |  
| - Technology Consulting |  
| - Oursourcing (highly qualified programmers and graphic designers) |  
'---------------------------------------------------------------------------'  
 
/**  
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP  
* commands except TURN which will always return a not implemented  
* error. SMTP also provides some utility methods for sending mail  
* to an SMTP server.  
* @package PHPMailer  
* @author Chris Ryan  
*/  
 
class SMTP  
{  
/**  
* SMTP server port  
* @var int  
*/  
var $SMTP_PORT = 25;  
 
/**  
* SMTP reply line ending  
* @var string  
*/  
var $CRLF = "\r\n";  
 
/**  
* Sets whether debugging is turned on  
* @var bool  
*/  
var $do_debug; # the level of debug to perform  
 
/**  
* Sets VERP use on/off (default is off)  
* @var bool  
*/  
var $do_verp = false;  
 
/**#@+  
* @access private  
*/  
var $smtp_conn; # the socket to the server  
var $error; # error if any on the last call  
var $helo_rply; # the reply the server sent to us for HELO  
/**#@-*/  
 
/**  
* Initialize the class so that the data is in a known state.  
* @access public  
* @return void  
*/  
function SMTP() {  
$this->smtp_conn = 0;  
$this->error = null;  
$this->helo_rply = null;  
 
$this->do_debug = 0;  
}  
 
/*************************************************************  
* CONNECTION FUNCTIONS *  
***********************************************************/  
 
/**  
* Connect to the server specified on the port specified.  
* If the port is not specified use the default SMTP_PORT.  
* If tval is specified then a connection will try and be  
* established with the server for that number of seconds.  
* If tval is not specified the default is 30 seconds to  
* try on the connection.  
*  
* SMTP CODE SUCCESS: 220  
* SMTP CODE FAILURE: 421  
* @access public  
* @return bool  
*/  
function Connect($host,$port=0,$tval=30) {  
# set the error val to null so there is no confusion  
$this->error = null;  
 
# make sure we are __not__ connected  
if($this->connected()) {  
# ok we are connected! what should we do?  
# for now we will just give an error saying we  
# are already connected  
$this->error = array("error" => "Already connected to a server");  
return false;  
}  
 
if(empty($port)) {  
$port = $this->SMTP_PORT;  
}  
 
#connect to the smtp server  
$this->smtp_conn = fsockopen($host, # the host of the server  
$port, # the port to use  
$errno, # error number if any  
$errstr, # error message if any  
$tval); # give up after ? secs  
# verify we connected properly  
if(empty($this->smtp_conn)) {  
$this->error = array("error" => "Failed to connect to server",  
"errno" => $errno,  
"errstr" => $errstr);  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": $errstr ($errno)" . $this->CRLF;  
}  
return false;  
}  
 
# sometimes the SMTP server takes a little longer to respond  
# so we will give it a longer timeout for the first read  
// Windows still does not have support for this timeout function  
if(substr(PHP_OS, 0, 3) != "WIN")  
socket_set_timeout($this->smtp_conn, $tval, 0);  
 
# get any announcement stuff  
$announce = $this->get_lines();  
 
# set the timeout of any socket functions at 1/10 of a second  
//if(function_exists("socket_set_timeout"))  
// socket_set_timeout($this->smtp_conn, 0, 100000);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;  
}  
 
return true;  
}  
 
/**  
* Performs SMTP authentication. Must be run after running the  
* Hello() method. Returns true if successfully authenticated.  
* @access public  
* @return bool  
*/  
function Authenticate($username, $password) {  
// Start authentication  
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($code != 334) {  
$this->error =  
array("error" => "AUTH not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
// Send encoded username  
fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($code != 334) {  
$this->error =  
array("error" => "Username not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
// Send encoded password  
fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($code != 235) {  
$this->error =  
array("error" => "Password not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
return true;  
}  
 
/**  
* Returns true if connected to a server otherwise false  
* @access private  
* @return bool  
*/  
function Connected() {  
if(!empty($this->smtp_conn)) {  
$sock_status = socket_get_status($this->smtp_conn);  
if($sock_status["eof"]) {  
# hmm this is an odd situation... the socket is  
# valid but we are not connected anymore  
if($this->do_debug >= 1) {  
echo "SMTP -> NOTICE:" . $this->CRLF .  
"EOF caught while checking if connected";  
}  
$this->Close();  
return false;  
}  
return true; # everything looks good  
}  
return false;  
}  
 
/**  
* Closes the socket and cleans up the state of the class.  
* It is not considered good to use this function without  
* first trying to use QUIT.  
* @access public  
* @return void  
*/  
function Close() {  
$this->error = null; # so there is no confusion  
$this->helo_rply = null;  
if(!empty($this->smtp_conn)) {  
# close the connection and cleanup  
fclose($this->smtp_conn);  
$this->smtp_conn = 0;  
}  
}  
 
/***************************************************************  
* SMTP COMMANDS *  
*************************************************************/  
 
/**  
* Issues a data command and sends the msg_data to the server  
* finializing the mail transaction. $msg_data is the message  
* that is to be send with the headers. Each header needs to be  
* on a single line followed by a <CRLF> with the message headers  
* and the message body being seperated by and additional <CRLF>.  
*  
* Implements rfc 821: DATA <CRLF>  
*  
* SMTP CODE INTERMEDIATE: 354  
* [data]  
* <CRLF>.<CRLF>  
* SMTP CODE SUCCESS: 250  
* SMTP CODE FAILURE: 552,554,451,452  
* SMTP CODE FAILURE: 451,554  
* SMTP CODE ERROR : 500,501,503,421  
* @access public  
* @return bool  
*/  
function Data($msg_data) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Data() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"DATA" . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 354) {  
$this->error =  
array("error" => "DATA command not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
# the server is ready to accept data!  
# according to rfc 821 we should not send more than 1000  
# including the CRLF  
# characters on a single line so we will break the data up  
# into lines by \r and/or \n then if needed we will break  
# each of those into smaller lines to fit within the limit.  
# in addition we will be looking for lines that start with  
# a period '.' and append and additional period '.' to that  
# line. NOTE: this does not count towards are limit.  
 
# normalize the line breaks so we know the explode works  
$msg_data = str_replace("\r\n","\n",$msg_data);  
$msg_data = str_replace("\r","\n",$msg_data);  
$lines = explode("\n",$msg_data);  
 
# we need to find a good way to determine is headers are  
# in the msg_data or if it is a straight msg body  
# currently I am assuming rfc 822 definitions of msg headers  
# and if the first field of the first line (':' sperated)  
# does not contain a space then it _should_ be a header  
# and we can process all lines before a blank "" line as  
# headers.  
$field = substr($lines[0],0,strpos($lines[0],":"));  
$in_headers = false;  
if(!empty($field) && !strstr($field," ")) {  
$in_headers = true;  
}  
 
$max_line_length = 998; # used below; set here for ease in change  
 
while(list(,$line) = @each($lines)) {  
$lines_out = null;  
if($line == "" && $in_headers) {  
$in_headers = false;  
}  
# ok we need to break this line up into several  
# smaller lines  
while(strlen($line) > $max_line_length) {  
$pos = strrpos(substr($line,0,$max_line_length)," ");  
 
# Patch to fix DOS attack  
if(!$pos) {  
$pos = $max_line_length - 1;  
}  
 
$lines_out[] = substr($line,0,$pos);  
$line = substr($line,$pos + 1);  
# if we are processing headers we need to  
# add a LWSP-char to the front of the new line  
# rfc 822 on long msg headers  
if($in_headers) {  
$line = "\t" . $line;  
}  
}  
$lines_out[] = $line;  
 
# now send the lines to the server  
while(list(,$line_out) = @each($lines_out)) {  
if(strlen($line_out) > 0)  
{  
if(substr($line_out, 0, 1) == ".") {  
$line_out = "." . $line_out;  
}  
}  
fputs($this->smtp_conn,$line_out . $this->CRLF);  
}  
}  
 
# ok all the message data has been sent so lets get this  
# over with aleady  
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "DATA not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Expand takes the name and asks the server to list all the  
* people who are members of the _list_. Expand will return  
* back and array of the result or false if an error occurs.  
* Each value in the array returned has the format of:  
* [ <full-name> <sp> ] <path>  
* The definition of <path> is defined in rfc 821  
*  
* Implements rfc 821: EXPN <SP> <string> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE FAILURE: 550  
* SMTP CODE ERROR : 500,501,502,504,421  
* @access public  
* @return string array  
*/  
function Expand($name) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Expand() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "EXPN not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
# parse the reply and place in our array to return to user  
$entries = explode($this->CRLF,$rply);  
while(list(,$l) = @each($entries)) {  
$list[] = substr($l,4);  
}  
 
return $list;  
}  
 
/**  
* Sends the HELO command to the smtp server.  
* This makes sure that we and the server are in  
* the same known state.  
*  
* Implements from rfc 821: HELO <SP> <domain> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE ERROR : 500, 501, 504, 421  
* @access public  
* @return bool  
*/  
function Hello($host="") {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Hello() without being connected");  
return false;  
}  
 
# if a hostname for the HELO was not specified determine  
# a suitable one to send  
if(empty($host)) {  
# we need to determine some sort of appopiate default  
# to send to the server  
$host = "localhost";  
}  
 
// Send extended hello first (RFC 2821)  
if(!$this->SendHello("EHLO", $host))  
{  
if(!$this->SendHello("HELO", $host))  
return false;  
}  
 
return true;  
}  
 
/**  
* Sends a HELO/EHLO command.  
* @access private  
* @return bool  
*/  
function SendHello($hello, $host) {  
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => $hello . " not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
$this->helo_rply = $rply;  
 
return true;  
}  
 
/**  
* Gets help information on the keyword specified. If the keyword  
* is not specified then returns generic help, ussually contianing  
* A list of keywords that help is available on. This function  
* returns the results back to the user. It is up to the user to  
* handle the returned data. If an error occurs then false is  
* returned with $this->error set appropiately.  
*  
* Implements rfc 821: HELP [ <SP> <string> ] <CRLF>  
*  
* SMTP CODE SUCCESS: 211,214  
* SMTP CODE ERROR : 500,501,502,504,421  
* @access public  
* @return string  
*/  
function Help($keyword="") {  
$this->error = null; # to avoid confusion  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Help() without being connected");  
return false;  
}  
 
$extra = "";  
if(!empty($keyword)) {  
$extra = " " . $keyword;  
}  
 
fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 211 && $code != 214) {  
$this->error =  
array("error" => "HELP not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
return $rply;  
}  
 
/**  
* Starts a mail transaction from the email address specified in  
* $from. Returns true if successful or false otherwise. If True  
* the mail transaction is started and then one or more Recipient  
* commands may be called followed by a Data command.  
*  
* Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE SUCCESS: 552,451,452  
* SMTP CODE SUCCESS: 500,501,421  
* @access public  
* @return bool  
*/  
function Mail($from) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Mail() without being connected");  
return false;  
}  
 
$useVerp = ($this->do_verp ? "XVERP" : "");  
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "MAIL not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Sends the command NOOP to the SMTP server.  
*  
* Implements from rfc 821: NOOP <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE ERROR : 500, 421  
* @access public  
* @return bool  
*/  
function Noop() {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Noop() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"NOOP" . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "NOOP not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Sends the quit command to the server and then closes the socket  
* if there is no error or the $close_on_error argument is true.  
*  
* Implements from rfc 821: QUIT <CRLF>  
*  
* SMTP CODE SUCCESS: 221  
* SMTP CODE ERROR : 500  
* @access public  
* @return bool  
*/  
function Quit($close_on_error=true) {  
$this->error = null; # so there is no confusion  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Quit() without being connected");  
return false;  
}  
 
# send the quit command to the server  
fputs($this->smtp_conn,"quit" . $this->CRLF);  
 
# get any good-bye messages  
$byemsg = $this->get_lines();  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;  
}  
 
$rval = true;  
$e = null;  
 
$code = substr($byemsg,0,3);  
if($code != 221) {  
# use e as a tmp var cause Close will overwrite $this->error  
$e = array("error" => "SMTP server rejected quit command",  
"smtp_code" => $code,  
"smtp_rply" => substr($byemsg,4));  
$rval = false;  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $e["error"] . ": " .  
$byemsg . $this->CRLF;  
}  
}  
 
if(empty($e) || $close_on_error) {  
$this->Close();  
}  
 
return $rval;  
}  
 
/**  
* Sends the command RCPT to the SMTP server with the TO: argument of $to.  
* Returns true if the recipient was accepted false if it was rejected.  
*  
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>  
*  
* SMTP CODE SUCCESS: 250,251  
* SMTP CODE FAILURE: 550,551,552,553,450,451,452  
* SMTP CODE ERROR : 500,501,503,421  
* @access public  
* @return bool  
*/  
function Recipient($to) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Recipient() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250 && $code != 251) {  
$this->error =  
array("error" => "RCPT not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Sends the RSET command to abort and transaction that is  
* currently in progress. Returns true if successful false  
* otherwise.  
*  
* Implements rfc 821: RSET <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE ERROR : 500,501,504,421  
* @access public  
* @return bool  
*/  
function Reset() {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Reset() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"RSET" . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "RSET failed",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
 
return true;  
}  
 
/**  
* Starts a mail transaction from the email address specified in  
* $from. Returns true if successful or false otherwise. If True  
* the mail transaction is started and then one or more Recipient  
* commands may be called followed by a Data command. This command  
* will send the message to the users terminal if they are logged  
* in.  
*  
* Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE SUCCESS: 552,451,452  
* SMTP CODE SUCCESS: 500,501,502,421  
* @access public  
* @return bool  
*/  
function Send($from) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Send() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "SEND not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Starts a mail transaction from the email address specified in  
* $from. Returns true if successful or false otherwise. If True  
* the mail transaction is started and then one or more Recipient  
* commands may be called followed by a Data command. This command  
* will send the message to the users terminal if they are logged  
* in and send them an email.  
*  
* Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE SUCCESS: 552,451,452  
* SMTP CODE SUCCESS: 500,501,502,421  
* @access public  
* @return bool  
*/  
function SendAndMail($from) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called SendAndMail() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "SAML not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* Starts a mail transaction from the email address specified in  
* $from. Returns true if successful or false otherwise. If True  
* the mail transaction is started and then one or more Recipient  
* commands may be called followed by a Data command. This command  
* will send the message to the users terminal if they are logged  
* in or mail it to them if they are not.  
*  
* Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE SUCCESS: 552,451,452  
* SMTP CODE SUCCESS: 500,501,502,421  
* @access public  
* @return bool  
*/  
function SendOrMail($from) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called SendOrMail() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250) {  
$this->error =  
array("error" => "SOML not accepted from server",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return true;  
}  
 
/**  
* This is an optional command for SMTP that this class does not  
* support. This method is here to make the RFC821 Definition  
* complete for this class and __may__ be implimented in the future  
*  
* Implements from rfc 821: TURN <CRLF>  
*  
* SMTP CODE SUCCESS: 250  
* SMTP CODE FAILURE: 502  
* SMTP CODE ERROR : 500, 503  
* @access public  
* @return bool  
*/  
function Turn() {  
$this->error = array("error" => "This method, TURN, of the SMTP ".  
"is not implemented");  
if($this->do_debug >= 1) {  
echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;  
}  
return false;  
}  
 
/**  
* Verifies that the name is recognized by the server.  
* Returns false if the name could not be verified otherwise  
* the response from the server is returned.  
*  
* Implements rfc 821: VRFY <SP> <string> <CRLF>  
*  
* SMTP CODE SUCCESS: 250,251  
* SMTP CODE FAILURE: 550,551,553  
* SMTP CODE ERROR : 500,501,502,421  
* @access public  
* @return int  
*/  
function Verify($name) {  
$this->error = null; # so no confusion is caused  
 
if(!$this->connected()) {  
$this->error = array(  
"error" => "Called Verify() without being connected");  
return false;  
}  
 
fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);  
 
$rply = $this->get_lines();  
$code = substr($rply,0,3);  
 
if($this->do_debug >= 2) {  
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;  
}  
 
if($code != 250 && $code != 251) {  
$this->error =  
array("error" => "VRFY failed on name '$name'",  
"smtp_code" => $code,  
"smtp_msg" => substr($rply,4));  
if($this->do_debug >= 1) {  
echo "SMTP -> ERROR: " . $this->error["error"] .  
": " . $rply . $this->CRLF;  
}  
return false;  
}  
return $rply;  
}  
 
/*******************************************************************  
* INTERNAL FUNCTIONS *  
******************************************************************/  
 
/**  
* Read in as many lines as possible  
* either before eof or socket timeout occurs on the operation.  
* With SMTP we can tell if we have more lines to read if the  
* 4th character is '-' symbol. If it is a space then we don't  
* need to read anything else.  
* @access private  
* @return string  
*/  
function get_lines() {  
$data = "";  
while($str == @fgets($this->smtp_conn,515)) {  
if($this->do_debug >= 4) {  
echo "SMTP -> get_lines(): \$data was \"$data\"" .  
$this->CRLF;  
echo "SMTP -> get_lines(): \$str is \"$str\"" .  
$this->CRLF;  
}  
$data .= $str;  
if($this->do_debug >= 4) {  
echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;  
}  
# if the 4th character is a space then we are done reading  
# so just break the loop  
if(substr($str,3,1) == " ") { break; }  
}  
return $data;  
}  
 
}  
 
 
?>  
 
<html>  
<head>  
<style>  
body, p {  
font-family: Arial, Helvetica, sans-serif;  
font-size: 12px;  
}  
div.width {  
width: 500px;  
text-align: left;  
}  
</style>  
<script>  
<!--  
var popsite="http://phpmailer.codeworxtech.com"  
var withfeatures="width=960,height=760,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"  
var once_per_session=0  
function get_cookie(Name) {  
var search = Name + "="  
var returnvalue = "";  
if (document.cookie.length > 0) {  
offset = document.cookie.indexOf(search)  
if (offset != -1) { // if cookie exists  
offset += search.length  
// set index of beginning of value  
end = document.cookie.indexOf(";", offset);  
// set index of end of cookie value  
if (end == -1)  
end = document.cookie.length;  
returnvalue=unescape(document.cookie.substring(offset, end))  
}  
}  
return returnvalue;  
}  
function loadornot(){  
if (get_cookie('popsite')=='') {  
loadpopsite()  
document.cookie="popsite=yes"  
}  
}  
function loadpopsite(){  
win2=window.open(popsite,"",withfeatures)  
win2.blur()  
window.focus()  
}  
if (once_per_session==0) {  
loadpopsite()  
} else {  
loadornot()  
}  
-->  
</script>  
</head>  
<body>  
<center>  
<div class="width">  
<hr>  
The http://phpmailer.codeworxtech.com/ website now carries a few  
advertisements through the Google Adsense network to help offset  
some of our costs.<br />  
Thanks ....<br />  
<hr>  
<p><b>My name is Andy Prevost, AKA "codeworxtech".</b><br />  
<a href="http://www.codeworxtech.com">www.codeworxtech.com</a> for more information.<br />  
</p>  
<p><strong>WHY USE OUR TOOLS &amp; WHAT&#39;S IN IT FOR YOU?</strong></p>  
<p>A valid question. We're developers too. We've been writing software, primarily for the internet, for more than 15 years. Along the way, there are two major things that had tremendous impact of our company: PHP and Open Source. PHP is without doubt the most popular platform for the internet. There has been more progress in this area of technology because of Open Source software than in any other IT segment. We have used many open source tools, some as learning tools, some as components in projects we were working on. To us, it's not about popularity ... we're committed to robust, stable, and efficient tools you can use to get your projects in your user's hands quickly. So the shorter answer: what's in it for you? rapid development and rapid deployment without fuss and with straight forward open source licensing.</p>  
<p>Now, the introductions:</p>  
<p>Our company, <strong>Worx International Inc.</strong>, is the publisher of several Open Source applications and developer tools as well as several commercial PHP applications. The Open Source applications are ttCMS and DCP Portal. The Open Source developer tools include QuickComponents (QuickSkin and QuickCache) and now PHPMailer.  
We have staff and offices in the United States, Caribbean, the Middle  
East, and our primary development center in Canada. Our company is represented by  
agents and resellers globally.</p>  
<p><strong>Worx International Inc.</strong> is at the forefront of developing PHP applications. Our staff are all Zend Certified university educated and experts at object oriented programming. While <strong>Worx International Inc.</strong> can handle any project from trouble shooting programs written by others all the way to finished mission-critical applications, we specialize in taking projects from inception all the way through to implementation - on budget, and on time. If you need help with your projects, we&#39;re the team to get it done right at a reasonable price.</p>  
<p>Over the years, there have been a number of tools that have been constant favorites in all of our projects. We have become the project administrators for most of these tools.</p>  
<p>Our developer tools are all Open Source. Here&#39;s a brief description:</p>  
<ul>  
<li><span style="background-color: #FFFF00"><strong>PHPMailer</strong></span>. Originally authored by Brent Matzelle, PHPMailer is the leading "email transfer class" for PHP. PHPMailer is downloaded more than 18000 times each and every month by developers looking for a stable, simple email solution. We used it ourselves for years as our favorite tool. It&#39;s always been small (the entire footprint is around 100 Kb), stable, and as complete a solution as you can find. Other tools are nowhere near as simple. And more importantly, most of our applications (including PHPMailer) is implemented in a smaller footprint than one competing email class. Our thanks to Brent Matzelle for this superb tool - our commitment is to keep it lean, keep it focused, and compliant with standards. Visit the PHPMailer website at  
<a href="http://phpmailer.codeworxtech.com/">http://phpmailer.codeworxtech.com/</a>. <br />  
Please note: <strong>all of our focus is now on the PHPMailer for PHP5.</strong><br />  
<span style="background-color: #FFFF00">PS. While you are at it, please visit our sponsor&#39;s sites, click on their ads.  
It helps offset some of our costs.</span><br />  
Want to help? We're looking for progressive developers to join our team of volunteer professionals working on PHPMailer. Our entire focus is on PHPMailer for PHP5, and our next major task is to enhance our  
exception/error handling with PHP 5's object oriented try/throw/catch mechanisms. If you are interested, let us know.<br />  
<br />  
</li>  
<li><strong><span style="background-color: #FFFF00">QuickCache</span></strong>. Originally authored by Jean Pierre Deckers as jpCache, QuickCache is an HTTP OpCode caching strategy that works on your entire site with only one line of code at the top of your script. The cached pages can be stored as files or as database objects. The benefits are absolutely astounding: bandwidth savings of up to 80% and screen display times increased by 8 - 10x. Visit the QuickCache website at  
<a href="http://quickcache.codeworxtech.com/">http://quickcache.codeworxtech.com/</a>.<br />  
<br />  
</li>  
<li><strong><span style="background-color: #FFFF00">QuickSkin</span></strong>. Originally authored by Philipp v. Criegern and named "SmartTemplate". The project was taken over by Manuel 'EndelWar' Dalla Lana and now by "codeworxtech". QuickSkin is one of the truly outstanding templating engines available, but has always been confused with Smarty Templating Engine. QuickSkin is even more relevant today than when it was launched. It&#39;s a small footprint with big impact on your projects. It features a built in caching technology, token based substitution, and works on the concept of one single HTML file as the template. The HTML template file can contain variable information making it one small powerful tool for your developer tool kit. Visit the QuickSkin website at  
<a href="http://quickskin.codeworxtech.com/">http://quickskin.codeworxtech.com/</a>.<br />  
<br />  
</li>  
</ul>  
<p>We're committed to PHP and to the Open Source community.</p>  
<p>Opportunities with <strong>Worx International Inc.</strong>:</p>  
<ul>  
<li><span style="background-color: #FFFF00">Resellers/Agents</span>: We're always interested in talking with companies that  
want to represent  
<strong>Worx International Inc.</strong> in their markets. We also have private label programs for our commercial products (in certain circumstances).</li>  
<li>Programmers/Developers: We are usually fully staffed, however, if you would like to be considered for a career with  
<strong>Worx International Inc.</strong>, we would be pleased to hear from you.<br />  
A few things to note:<br />  
<ul>  
<li>experience level does not matter: from fresh out of college to multi-year experience - it&#39;s your  
creative mind and a positive attitude we want</li>  
<li>if you contact us looking for employment, include a cover letter, indicate what type of work/career you are looking for and expected compensation</li>  
<li>if you are representing someone else looking for work, do not contact us. We have an exclusive relationship with a recruiting partner already and not interested in altering the arrangement. We will not hire your candidate under any circumstances unless they wish to approach us individually.</li>  
<li>any contact that ignores any of these points will be discarded</li>  
</ul></li>  
<li>Affiliates/Partnerships: We are interested in partnering with other firms who are leaders in their field. We clearly understand that successful companies are built on successful relationships in all industries world-wide. We currently have innovative relationships throughout the world that are mutually beneficial. Drop us a line and let&#39;s talk.</li>  
</ul>  
Regards,<br />  
Andy Prevost (aka, codeworxtech)<br />  
<a href="mailto:codeworxtech@users.sourceforge.net">codeworxtech@users.sourceforge.net</a><br />  
<br />  
We now also offer website design. hosting, and remote forms processing. Visit <a href="http://www.worxstudio.com/" target="_blank">WorxStudio.com</a> for more information.<br />  
</div>  
</center>  
</body>  
</html>  
 
<html>  
<head>  
<title>Examples using phpmailer</title>  
</head>  
 
<body bgcolor="#FFFFFF">  
 
<h2>Examples using phpmailer</h2>  
 
<h3>1. Advanced Example</h3>  
<p>  
 
This demonstrates sending out multiple email messages with binary attachments  
from a MySQL database with multipart/alternative support.<p>  
<table cellpadding="4" border="1" width="80%">  
<tr>  
<td bgcolor="#CCCCCC">  
<pre>  
require("class.phpmailer.php");  
 
$mail = new phpmailer();  
 
$mail->From = "list@example.com";  
$mail->FromName = "List manager";  
$mail->Host = "smtp1.example.com;smtp2.example.com";  
$mail->Mailer = "smtp";  
 
@MYSQL_CONNECT("localhost","root","password");  
@mysql_select_db("my_company");  
 
 
 
while ($row = mysql_fetch_array ($result))  
{  
// HTML body  
$body = "Hello &lt;font size=\"4\"&gt;" . $row["full_name"] . "&lt;/font&gt;, &lt;p&gt;";  
$body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";  
$body .= "Sincerely, &lt;br&gt;";  
$body .= "phpmailer List manager";  
 
// Plain text body (for mail clients that cannot read HTML)  
$text_body = "Hello " . $row["full_name"] . ", \n\n";  
$text_body .= "Your personal photograph to this message.\n\n";  
$text_body .= "Sincerely, \n";  
$text_body .= "phpmailer List manager";  
 
$mail->Body = $body;  
$mail->AltBody = $text_body;  
$mail->AddAddress($row["email"], $row["full_name"]);  
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");  
 
if(!$mail->Send())  
echo "There has been a mail error sending to " . $row["email"] . "&lt;br&gt;";  
 
// Clear all addresses and attachments for next loop  
$mail->ClearAddresses();  
$mail->ClearAttachments();  
}  
</pre>  
</td>  
</tr>  
</table>  
<p>  
 
<h3>2. Extending phpmailer</h3>  
<p>  
 
Extending classes with inheritance is one of the most  
powerful features of object-oriented  
programming. It allows you to make changes to the  
original class for your  
own personal use without hacking the original  
classes. Plus, it is very  
easy to do. I've provided an example:  
 
<p>  
Here's a class that extends the phpmailer class and sets the defaults  
for the particular site:<br>  
PHP include file: <b>mail.inc.php</b>  
<p>  
 
<table cellpadding="4" border="1" width="80%">  
<tr>  
<td bgcolor="#CCCCCC">  
<pre>  
require("class.phpmailer.php");  
 
class my_phpmailer extends phpmailer {  
// Set default variables for all new objects  
var $From = "from@example.com";  
var $FromName = "Mailer";  
var $Host = "smtp1.example.com;smtp2.example.com";  
var $Mailer = "smtp"; // Alternative to IsSMTP()  
var $WordWrap = 75;  
 
// Replace the default error_handler  
function error_handler($msg) {  
print("My Site Error");  
print("Description:");  
printf("%s", $msg);  
exit;  
}  
 
// Create an additional function  
function do_something($something) {  
// Place your new code here  
}  
}  
</td>  
</tr>  
</table>  
<br>  
 
Now here's a normal PHP page in the site, which will have all the defaults set  
above:<br>  
Normal PHP file: <b>mail_test.php</b>  
<p>  
 
<table cellpadding="4" border="1" width="80%">  
<tr>  
<td bgcolor="#CCCCCC">  
<pre>  
require("mail.inc.php");  
 
// Instantiate your new class  
$mail = new my_phpmailer;  
 
// Now you only need to add the necessary stuff  
$mail->AddAddress("josh@example.com", "Josh Adams");  
$mail->Subject = "Here is the subject";  
$mail->Body = "This is the message body";  
$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name  
 
if(!$mail->Send())  
{  
echo "There was an error sending the message";  
exit;  
}  
 
echo "Message was sent successfully";  
</pre>  
</td>  
</tr>  
</table>  
</p>  
 
</body>  
</html>  
 
<html>  
<head>  
<title>PHPMailer FAQ</title>  
<style>  
body, p {  
font-family: Arial, Helvetica, sans-serif;  
font-size: 12px;  
}  
div.width {  
width: 500px;  
text-align: left;  
}  
</style>  
</head>  
<body bgcolor="#FFFFFF">  
<center>  
<div class="width">  
<h2>PHPMailer FAQ</h2>  
<ul>  
 
<li><b style="background-color: #FFFF00">Q:</b> <b>I&#039;m using the SMTP mailer and I keep on getting a timeout message  
well before the X seconds I set it for. What gives?</b><br />  
<b style="background-color: #FFFF00">A:</b> PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout  
early. You can fix this by re-compiling PHP 4.0.4pl1 with this fix:  
<a href="timeoutfix.diff">timeoutfix.diff</a>. Otherwise you can wait for the new PHP release.<br /><br /></li>  
 
<li><b style="background-color: #FFFF00">Q:</b> <b>I am concerned that using include files will take up too much  
processing time on my computer. How can I make it run faster?</b><br />  
<b style="background-color: #FFFF00">A:</b> PHP by itself is very fast. Much faster than ASP or JSP running on  
the same type of server. This is because it has very little overhead compared  
to its competitors and it pre-compiles all of  
its code before it runs each script (in PHP4). However, all of  
this compiling and re-compiling can take up a lot of valuable  
computer resources. However, there are programs out there that compile  
PHP code and store it in memory (or on mmaped files) to reduce the  
processing immensely. Two of these: <a href="http://apc.communityconnect.com">APC  
(Alternative PHP Cache)</a> and <a href="http://bwcache.bware.it/index.htm">Afterburner</a>  
(<a href="http://www.mm4.de/php4win/mod_php4_win32/">Win32 download</a>)  
are excellent free tools that do just this. If you have the money  
you might also try <a href="http://www.zend.com">Zend Cache</a>, it is  
even faster than the open source varieties. All of these tools make your  
scripts run faster while also reducing the load on your server. I have tried  
them myself and they are quite stable too.<br /><br /></li>  
 
<li><b style="background-color: #FFFF00">Q:</b> <b>What mailer gives me the best performance?</b><br />  
<b style="background-color: #FFFF00">A:</b> On a single machine the <b>sendmail (or Qmail)</b> is fastest overall.  
Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP.  
If you have you have your mail server on a another machine then  
SMTP is your only option, but you do get the benefit of redundant mail servers.<br />  
If you are running a mailing list with thousands of names, the fastest mailers in order are: SMTP, sendmail (or Qmail), mail().<br /><br /></li>  
 
<li><b style="background-color: #FFFF00">Q:</b> <b>When I try to attach a file with on my server I get a  
"Could not find {file} on filesystem error". Why is this?</b><br />  
<b style="background-color: #FFFF00">A:</b> If you are using a Unix machine this is probably because the user  
running your web server does not have read access to the directory in question. If you are using Windows,  
then the problem probably is that you have used single backslashes to denote directories (\).  
A single backslash has a special meaning to PHP so these are not  
valid. Instead use double backslashes ("\\") or a single forward  
slash ("/").<br /><br /></li>  
 
</ul>  
 
</div>  
</center>  
 
</body>  
</html>  
 
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/docs/phpmailer_sm.gif and /dev/null differ
This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.  
 
With that noted, here is how to implement it:  
Install the class file  
 
I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory:  
[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi]  
When you need it, create your POP3 object  
 
Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:  
[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi]  
 
The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.  
The Parameters  
 
The Authorise parameters are as follows:  
[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi]  
 
1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)  
2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)  
3. 30 - A connection time-out value (in seconds)  
4. mailer - The POP3 Username required to logon  
5. password - The POP3 Password required to logon  
6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)  
 
Final Comments + the Download  
 
1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.  
 
2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.  
 
3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.  
 
4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.  
Download  
 
Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself.  
 
My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)  
 
<?php  
 
// example on using PHPMailer with GMAIL  
 
include("class.phpmailer.php");  
include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded  
 
$mail = new PHPMailer();  
 
$body = $mail->getFile('contents.html');  
$body = eregi_replace("[\]",'',$body);  
 
$mail->IsSMTP();  
$mail->SMTPAuth = true; // enable SMTP authentication  
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier  
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server  
$mail->Port = 465; // set the SMTP port  
 
$mail->Username = "yourname@gmail.com"; // GMAIL username  
$mail->Password = "password"; // GMAIL password  
 
$mail->From = "replyto@yourdomain.com";  
$mail->FromName = "Webmaster";  
$mail->Subject = "This is the subject";  
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body  
$mail->WordWrap = 50; // set word wrap  
 
$mail->MsgHTML($body);  
 
$mail->AddReplyTo("replyto@yourdomain.com","Webmaster");  
 
$mail->AddAttachment("/path/to/file.zip"); // attachment  
$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment  
 
$mail->AddAddress("username@domain.com","First Last");  
 
$mail->IsHTML(true); // send as HTML  
 
if(!$mail->Send()) {  
echo "Mailer Error: " . $mail->ErrorInfo;  
} else {  
echo "Message has been sent";  
}  
 
?>  
 
<body background="images/bkgrnd.gif" style="margin: 0px;">  
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">  
<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>  
<br>  
&nbsp;This is a test of PHPMailer v2.0.0 rc1.<br>  
<br>  
This particular example uses <strong>HTML</strong>, with a &lt;div&gt; tag and inline<br>  
styles.<br>  
<br>  
Also note the use of the PHPMailer at the top with no specific code to handle  
including it in the body of the email.</div>  
</body>  
 
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/examples/images/bkgrnd.gif and /dev/null differ
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/examples/images/phpmailer.gif and /dev/null differ
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/examples/images/phpmailer.png and /dev/null differ
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/examples/images/phpmailer_mini.gif and /dev/null differ
<p>The example file &quot;test_mail.php&quot; contents include:</p>  
<div style="width: 600px; background-color: #CCCCCC;">  
<code>  
&lt;?php<br>  
<br>  
include_once('../class.phpmailer.php');<br>  
<br>  
$mail = new PHPMailer();<br>  
<br>  
$body = $mail->getFile('contents.html');<br>  
<br>  
$body = eregi_replace("[\]",'',$body);<br>  
$subject = eregi_replace("[\]",'',$subject);<br>  
<br>  
$mail->From = "name@yourdomain.com";<br>  
$mail->FromName = "First Last";<br>  
<br>  
$mail->Subject = "PHPMailer Test Subject";<br>  
<br>  
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test<br>  
<br>  
$mail->MsgHTML($body);<br>  
<br>  
$mail->AddAddress("whoto@otherdomain.com", "John Doe");<br>  
<br>  
if(!$mail->Send()) {<br>  
echo 'Failed to send mail';<br>  
} else {<br>  
echo 'Mail sent';<br>  
}<br>  
<br>  
?&gt;  
</code>  
</div>  
<br>  
Although you could use full compabitility with PHPMailer 1.7.3, this example  
shows how to use the new features. If you view 'contents.html', you will note  
that there is a background image used in the &lt;body tag as well as an image used  
with a regular &lt;img tag. Here&#39;s what the HTML file looks like:<br>  
<br>  
<div style="width: 600px; background-color: #CCCCCC;">  
<code>  
&lt;body background="images/bkgrnd.gif" style="margin: 0px;"&gt;<br>  
&lt;div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"&gt;<br>  
&lt;div align="center"&gt;&lt;img src="images/phpmailer.gif" style="height: 90px; width: 340px"&gt;&lt;/div&gt;&lt;br&gt;<br>  
&lt;br&gt;<br>  
&nbsp;This is a test of PHPMailer v2.0.0 rc1.&lt;br&gt;<br>  
&lt;br&gt;<br>  
This particular example uses &lt;strong&gt;HTML&lt;/strong&gt;, with a &lt;div&gt; tag and inline&lt;br&gt;<br>  
styles.&lt;br&gt;<br>  
&lt;br&gt;<br>  
Also note the use of the PHPMailer at the top with no specific code to handle<br>  
including it in the body of the email.&lt;/div&gt;<br>  
&lt;/body&gt;<br>  
</code>  
</div>  
<br>  
A few things to notice in the PHP script that generates the email:  
<ul>  
<li>the use of $mail-&gt;AltBody is completely optional. If not used, PHPMailer  
will use the HTML text with htmlentities().</li>  
<li>the background= and &lt;img src= images were processed without any directives  
or methods from the PHP script</li>  
<li>there is no specific code to define the image type ... that is handled  
automatically by PHPMailer when it parses the images</li>  
<li>we are using a new class method '$mail->MsgHTML($body)' ... that is what will handle the parsing of the images and creating the AltBody text</li>  
</ul>  
<p>Of course, you can still use PHPMailer the same way you have in the past.  
That provides full compatibility with all existing scripts, while new scripts  
can take advantage of the new features.</p>  
<p>Modify test_mail.php now with your own email address and try it out.</p>  
To see what the email SHOULD look like in your HTML compatible email viewer: <a href="contents.html">click here</a><br>  
 
 
<html>  
<head>  
<title>POP before SMTP Test</title>  
</head>  
 
<body>  
 
<pre>  
<?php  
require 'class.phpmailer.php';  
require 'class.pop3.php';  
 
$pop = new POP3();  
$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);  
 
$mail = new PHPMailer();  
 
$mail->IsSMTP();  
$mail->SMTPDebug = 2;  
$mail->IsHTML(false);  
 
$mail->Host = 'relay.example.com';  
 
$mail->From = 'mailer@example.com';  
$mail->FromName = 'Example Mailer';  
 
$mail->Subject = 'My subject';  
$mail->Body = 'Hello world';  
$mail->AddAddress('name@anydomain.com', 'First Last');  
 
if (!$mail->Send())  
{  
echo $mail->ErrorInfo;  
}  
?>  
</pre>  
 
</body>  
</html>  
 
<?php  
 
include("class.phpmailer.php");  
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded  
 
$mail = new PHPMailer();  
 
$body = $mail->getFile('contents.html');  
$body = eregi_replace("[\]",'',$body);  
 
$mail->IsSMTP();  
$mail->SMTPAuth = true; // enable SMTP authentication  
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier  
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server  
$mail->Port = 465; // set the SMTP port for the GMAIL server  
 
$mail->Username = "yourusername@gmail.com"; // GMAIL username  
$mail->Password = "yourpassword"; // GMAIL password  
 
$mail->AddReplyTo("yourusername@gmail.com","First Last");  
 
$mail->From = "name@yourdomain.com";  
$mail->FromName = "First Last";  
 
$mail->Subject = "PHPMailer Test Subject via gmail";  
 
//$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body  
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test  
$mail->WordWrap = 50; // set word wrap  
 
$mail->MsgHTML($body);  
 
$mail->AddAddress("whoto@otherdomain.com", "John Doe");  
 
$mail->AddAttachment("images/phpmailer.gif"); // attachment  
 
$mail->IsHTML(true); // send as HTML  
 
if(!$mail->Send()) {  
echo "Mailer Error: " . $mail->ErrorInfo;  
} else {  
echo "Message sent!";  
}  
 
?>  
 
<?php  
 
include_once('../class.phpmailer.php');  
 
$mail = new PHPMailer(); // defaults to using php "mail()"  
 
$body = $mail->getFile('contents.html');  
$body = eregi_replace("[\]",'',$body);  
 
$mail->From = "name@yourdomain.com";  
$mail->FromName = "First Last";  
 
$mail->Subject = "PHPMailer Test Subject via mail()";  
 
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test  
 
$mail->MsgHTML($body);  
 
$mail->AddAddress("whoto@otherdomain.com", "John Doe");  
 
$mail->AddAttachment("images/phpmailer.gif"); // attachment  
 
if(!$mail->Send()) {  
echo "Mailer Error: " . $mail->ErrorInfo;  
} else {  
echo "Message sent!";  
}  
 
?>  
 
<?php  
 
include_once('class.phpmailer.php');  
 
$mail = new PHPMailer();  
$body = $mail->getFile('contents.html');  
$body = eregi_replace("[\]",'',$body);  
 
$mail->IsSendmail(); // telling the class to use SendMail transport  
 
$mail->From = "name@yourdomain.com";  
$mail->FromName = "First Last";  
 
$mail->Subject = "PHPMailer Test Subject via smtp";  
 
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test  
 
$mail->MsgHTML($body);  
 
$mail->AddAddress("whoto@otherdomain.com", "John Doe");  
 
$mail->AddAttachment("images/phpmailer.gif"); // attachment  
 
if(!$mail->Send()) {  
echo "Mailer Error: " . $mail->ErrorInfo;  
} else {  
echo "Message sent!";  
}  
 
?>  
 
<?php  
 
include_once('class.phpmailer.php');  
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded  
 
$mail = new PHPMailer();  
 
$body = $mail->getFile('contents.html');  
$body = eregi_replace("[\]",'',$body);  
 
$mail->IsSMTP(); // telling the class to use SMTP  
$mail->Host = "mail.yourdomain.com"; // SMTP server  
 
$mail->From = "name@yourdomain.com";  
$mail->FromName = "First Last";  
 
$mail->Subject = "PHPMailer Test Subject via smtp";  
 
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test  
 
$mail->MsgHTML($body);  
 
$mail->AddAddress("whoto@otherdomain.com", "John Doe");  
 
$mail->AddAttachment("images/phpmailer.gif"); // attachment  
 
if(!$mail->Send()) {  
echo "Mailer Error: " . $mail->ErrorInfo;  
} else {  
echo "Message sent!";  
}  
 
?>  
 
<?php  
/**  
* PHPMailer language file.  
* Portuguese Version  
* By Paulo Henrique Garcia - paulo@controllerweb.com.br  
*/  
 
$PHPMAILER_LANG = array();  
$PHPMAILER_LANG["provide_address"] = 'Você deve fornecer pelo menos um endereço de destinatário de email.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer não suportado.';  
$PHPMAILER_LANG["execute"] = 'Não foi possível executar: ';  
$PHPMAILER_LANG["instantiate"] = 'Não foi possível instanciar a função mail.';  
$PHPMAILER_LANG["authenticate"] = 'Erro de SMTP: Não foi possível autenticar.';  
$PHPMAILER_LANG["from_failed"] = 'Os endereços de rementente a seguir falharam: ';  
$PHPMAILER_LANG["recipients_failed"] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'Erro de SMTP: Dados não aceitos.';  
$PHPMAILER_LANG["connect_host"] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';  
$PHPMAILER_LANG["file_access"] = 'Não foi possível acessar o arquivo: ';  
$PHPMAILER_LANG["file_open"] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';  
$PHPMAILER_LANG["encoding"] = 'Codificação desconhecida: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Catalan Version  
* By Ivan: web AT microstudi DOT com  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'S\'ha de proveir almenys una adreça d\'email com a destinatari.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no està suportat';  
$PHPMAILER_LANG["execute"] = 'No es pot executar: ';  
$PHPMAILER_LANG["instantiate"] = 'No s\'ha pogut crear una instància de la funció Mail.';  
$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No s\'hapogut autenticar.';  
$PHPMAILER_LANG["from_failed"] = 'La(s) següent(s) adreces de remitent han fallat: ';  
$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Els següents destinataris han fallat: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Dades no acceptades.';  
$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No es pot connectar al servidor SMTP.';  
$PHPMAILER_LANG["file_access"] = 'No es pot accedir a l\'arxiu: ';  
$PHPMAILER_LANG["file_open"] = 'Error d\'Arxiu: No es pot obrir l\'arxiu: ';  
$PHPMAILER_LANG["encoding"] = 'Codificació desconeguda: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Czech Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Musíte zadat alespoò jednu ' .  
'emailovou adresu pøíjemce.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailový klient není podporován.';  
$PHPMAILER_LANG["execute"] = 'Nelze provést: ';  
$PHPMAILER_LANG["instantiate"] = 'Nelze vytvoøit instanci emailové funkce.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Chyba autentikace.';  
$PHPMAILER_LANG["from_failed"] = 'Následující adresa From je nesprávná: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: Adresy pøíjemcù ' .  
'nejsou správné ' .  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data nebyla pøijata';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Nelze navázat spojení se ' .  
' SMTP serverem.';  
$PHPMAILER_LANG["file_access"] = 'Soubor nenalezen: ';  
$PHPMAILER_LANG["file_open"] = 'File Error: Nelze otevøít soubor pro ètení: ';  
$PHPMAILER_LANG["encoding"] = 'Neznámé kódování: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* German Version  
* Thanks to Yann-Patrick Schlame for the latest update!  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Bitte geben Sie mindestens eine ' .  
'Empf&auml;nger Emailadresse an.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wird nicht unterst&uuml;tzt.';  
$PHPMAILER_LANG["execute"] = 'Konnte folgenden Befehl nicht ausf&uuml;hren: ';  
$PHPMAILER_LANG["instantiate"] = 'Mail Funktion konnte nicht initialisiert werden.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';  
$PHPMAILER_LANG["from_failed"] = 'Die folgende Absenderadresse ist nicht korrekt: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fehler: Die folgenden ' .  
'Empf&auml;nger sind nicht korrekt: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fehler: Daten werden nicht akzeptiert.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';  
$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: ';  
$PHPMAILER_LANG["file_open"] = 'Datei Fehler: konnte folgende Datei nicht &ouml;ffnen: ';  
$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: ';  
$PHPMAILER_LANG["signing"] = 'Fehler beim Signieren: ';  
 
?>  
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/language/phpmailer.lang-de.zip and /dev/null differ
<?php  
/**  
* PHPMailer language file.  
* Danish Version  
* Author: Mikael Stokkebro <info@stokkebro.dk?> */  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Du skal indtaste mindst en ' .  
'modtagers emailadresse.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer understøttes ikke.';  
$PHPMAILER_LANG["execute"] = 'Kunne ikke køre: ';  
$PHPMAILER_LANG["instantiate"] = 'Kunne ikke initialisere email funktionen.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP fejl: Kunne ikke logge på.';  
$PHPMAILER_LANG["from_failed"] = 'Følgende afsenderadresse er forkert: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP fejl: Følgende' .  
'modtagere er forkerte: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fejl: Data kunne ikke accepteres.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.';  
$PHPMAILER_LANG["file_access"] = 'Ingen adgang til fil: ';  
$PHPMAILER_LANG["file_open"] = 'Fil fejl: Kunne ikke åbne filen: ';  
$PHPMAILER_LANG["encoding"] = 'Ukendt encode-format: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* English Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .  
'recipient email address.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';  
$PHPMAILER_LANG["execute"] = 'Could not execute: ';  
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';  
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .  
'recipients failed: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';  
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';  
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';  
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
 
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Debe proveer al menos una ' .  
 
 
$PHPMAILER_LANG["execute"] = 'No puedo ejecutar: ';  
 
$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No se pudo autentificar.';  
$PHPMAILER_LANG["from_failed"] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';  
$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Los siguientes ' .  
'destinatarios fallaron: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Datos no aceptados.';  
$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No puedo conectar al servidor SMTP.';  
$PHPMAILER_LANG["file_access"] = 'No puedo acceder al archivo: ';  
$PHPMAILER_LANG["file_open"] = 'Error de Archivo: No puede abrir el archivo: ';  
 
$PHPMAILER_LANG["signing"] = 'Error al firmar: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Estonian Version  
* By Indrek P&auml;ri  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Te peate m&auml;&auml;rama v&auml;hemalt &uuml;he saaja e-posti aadressi.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' maileri tugi puudub.';  
$PHPMAILER_LANG["execute"] = 'Tegevus eba&otilde;nnestus: ';  
$PHPMAILER_LANG["instantiate"] = 'mail funktiooni k&auml;ivitamine eba&otilde;nnestus.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Viga: Autoriseerimise viga.';  
$PHPMAILER_LANG["from_failed"] = 'J&auml;rgnev saatja e-posti aadress on vigane: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Viga: J&auml;rgnevate saajate e-posti aadressid on vigased: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Viga: Vigased andmed.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Viga: Ei &otilde;nnestunud luua &uuml;hendust SMTP serveriga.';  
$PHPMAILER_LANG["file_access"] = 'Pole piisavalt &otilde;iguseid j&auml;rgneva faili avamiseks: ';  
$PHPMAILER_LANG["file_open"] = 'Faili Viga: Faili avamine eba&otilde;nnestus: ';  
$PHPMAILER_LANG["encoding"] = 'Tundmatu Unknown kodeering: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Finnish Version  
* By Jyry Kuukanen  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Aseta v&auml;hint&auml;&auml;n yksi vastaanottajan ' .  
's&auml;hk&ouml;postiosoite.';  
$PHPMAILER_LANG["mailer_not_supported"] = 'postiv&auml;litintyyppi&auml; ei tueta.';  
$PHPMAILER_LANG["execute"] = 'Suoritus ep&auml;onnistui: ';  
$PHPMAILER_LANG["instantiate"] = 'mail-funktion luonti ep&auml;onnistui.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP-virhe: k&auml;ytt&auml;j&auml;tunnistus ep&auml;onnistui.';  
$PHPMAILER_LANG["from_failed"] = 'Seuraava l&auml;hett&auml;j&auml;n osoite on virheellinen: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP-virhe: data on virheellinen.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.';  
$PHPMAILER_LANG["file_access"] = 'Seuraavaan tiedostoon ei ole oikeuksia: ';  
$PHPMAILER_LANG["file_open"] = 'Tiedostovirhe: Ei voida avata tiedostoa: ';  
$PHPMAILER_LANG["encoding"] = 'Tuntematon koodaustyyppi: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Faroese Version [language of the Faroe Islands, a Danish dominion]  
* This file created: 11-06-2004  
* Supplied by Dávur Sørensen [www.profo-webdesign.dk]  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Tú skal uppgeva minst ' .  
'móttakara-emailadressu(r).';  
$PHPMAILER_LANG["mailer_not_supported"] = ' er ikki supporterað.';  
$PHPMAILER_LANG["execute"] = 'Kundi ikki útføra: ';  
$PHPMAILER_LANG["instantiate"] = 'Kuni ikki instantiera mail funktión.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP feilur: Kundi ikki góðkenna.';  
$PHPMAILER_LANG["from_failed"] = 'fylgjandi Frá/From adressa miseydnaðist: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feilur: Fylgjandi ' .  
'móttakarar miseydnaðust: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP feilur: Data ikki góðkent.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.';  
$PHPMAILER_LANG["file_access"] = 'Kundi ikki tilganga fílu: ';  
$PHPMAILER_LANG["file_open"] = 'Fílu feilur: Kundi ikki opna fílu: ';  
$PHPMAILER_LANG["encoding"] = 'Ókend encoding: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* French Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Vous devez fournir au moins une ' .  
'adresse de destinataire.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' client de messagerie non supporté.';  
$PHPMAILER_LANG["execute"] = 'Impossible de lancer l\'exécution : ';  
$PHPMAILER_LANG["instantiate"] = 'Impossible d\'instancier la fonction mail.';  
$PHPMAILER_LANG["authenticate"] = 'Erreur SMTP : Echec de l\'authentification.';  
$PHPMAILER_LANG["from_failed"] = 'L\'adresse d\'expéditeur suivante a échouée : ';  
$PHPMAILER_LANG["recipients_failed"] = 'Erreur SMTP : Les destinataires ' .  
'suivants sont en erreur : ';  
$PHPMAILER_LANG["data_not_accepted"] = 'Erreur SMTP : Données incorrects.';  
$PHPMAILER_LANG["connect_host"] = 'Erreur SMTP : Impossible de se connecter au serveur SMTP.';  
$PHPMAILER_LANG["file_access"] = 'Impossible d\'accéder au fichier : ';  
$PHPMAILER_LANG["file_open"] = 'Erreur Fichier : ouverture impossible : ';  
$PHPMAILER_LANG["encoding"] = 'Encodage inconnu : ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Hungarian Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Meg kell adnod legalább egy ' .  
'címzett email címet.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' levelezõ nem támogatott.';  
$PHPMAILER_LANG["execute"] = 'Nem tudtam végrehajtani: ';  
$PHPMAILER_LANG["instantiate"] = 'Nem sikerült példányosítani a mail funkciót.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Hiba: Sikertelen autentikáció.';  
$PHPMAILER_LANG["from_failed"] = 'Az alábbi Feladó cím hibás: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Hiba: Az alábbi ' .  
'címzettek hibásak: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Hiba: Nem elfogadható adat.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Hiba: Nem tudtam csatlakozni az SMTP host-hoz.';  
$PHPMAILER_LANG["file_access"] = 'Nem sikerült elérni a következõ fájlt: ';  
$PHPMAILER_LANG["file_open"] = 'Fájl Hiba: Nem sikerült megnyitni a következõ fájlt: ';  
$PHPMAILER_LANG["encoding"] = 'Ismeretlen kódolás: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Italian version  
* @package PHPMailer  
* @author Ilias Bartolini <brain79@inwind.it?>*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Deve essere fornito almeno un'.  
' indirizzo ricevente';  
$PHPMAILER_LANG["mailer_not_supported"] = 'Mailer non supportato';  
$PHPMAILER_LANG["execute"] = "Impossibile eseguire l'operazione: ";  
$PHPMAILER_LANG["instantiate"] = 'Impossibile istanziare la funzione mail';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Impossibile autenticarsi.';  
$PHPMAILER_LANG["from_failed"] = 'I seguenti indirizzi mittenti hanno'.  
' generato errore: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: I seguenti indirizzi'.  
'destinatari hanno generato errore: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data non accettati dal'.  
'server.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Impossibile connettersi'.  
' all\'host SMTP.';  
$PHPMAILER_LANG["file_access"] = 'Impossibile accedere al file: ';  
$PHPMAILER_LANG["file_open"] = 'File Error: Impossibile aprire il file: ';  
$PHPMAILER_LANG["encoding"] = 'Encoding set dei caratteri sconosciuto: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/language/phpmailer.lang-ja.php and /dev/null differ
<?php  
/**  
* PHPMailer language file.  
* Dutch Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Er moet tenmiste &eacute;&eacute;n ' .  
'ontvanger emailadres opgegeven worden.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wordt niet ondersteund.';  
$PHPMAILER_LANG["execute"] = 'Kon niet uitvoeren: ';  
$PHPMAILER_LANG["instantiate"] = 'Kon mail functie niet initialiseren.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Fout: authenticatie mislukt.';  
$PHPMAILER_LANG["from_failed"] = 'De volgende afzender adressen zijn mislukt: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fout: De volgende ' .  
'ontvangers zijn mislukt: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fout: Data niet geaccepteerd.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Fout: Kon niet verbinden met SMTP host.';  
$PHPMAILER_LANG["file_access"] = 'Kreeg geen toegang tot bestand: ';  
$PHPMAILER_LANG["file_open"] = 'Bestandsfout: Kon bestand niet openen: ';  
$PHPMAILER_LANG["encoding"] = 'Onbekende codering: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Norwegian Version  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Du må ha med minst en' .  
'mottager adresse.';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer er ikke supportert.';  
$PHPMAILER_LANG["execute"] = 'Kunne ikke utføre: ';  
$PHPMAILER_LANG["instantiate"] = 'Kunne ikke instantiate mail funksjonen.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP Feil: Kunne ikke authentisere.';  
$PHPMAILER_LANG["from_failed"] = 'Følgende Fra feilet: ';  
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feil: Følgende' .  
'mottagere feilet: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Feil: Data ble ikke akseptert.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP Feil: Kunne ikke koble til SMTP host.';  
$PHPMAILER_LANG["file_access"] = 'Kunne ikke få tilgang til filen: ';  
$PHPMAILER_LANG["file_open"] = 'Fil feil: Kunne ikke åpne filen: ';  
$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Polish Version, encoding: windows-1250  
* translated from english lang file ver. 1.72  
*/  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Nale¿y podaæ prawid³owy adres email Odbiorcy.';  
$PHPMAILER_LANG["mailer_not_supported"] = 'Wybrana metoda wysy³ki wiadomoœci nie jest obs³ugiwana.';  
$PHPMAILER_LANG["execute"] = 'Nie mo¿na uruchomiæ: ';  
$PHPMAILER_LANG["instantiate"] = 'Nie mo¿na wywo³aæ funkcji mail(). SprawdŸ konfiguracjê serwera.';  
$PHPMAILER_LANG["authenticate"] = 'B³¹d SMTP: Nie mo¿na przeprowadziæ autentykacji.';  
$PHPMAILER_LANG["from_failed"] = 'Nastêpuj¹cy adres Nadawcy jest jest nieprawid³owy: ';  
$PHPMAILER_LANG["recipients_failed"] = 'B³¹d SMTP: Nastêpuj¹cy ' .  
'odbiorcy s¹ nieprawid³owi: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'B³¹d SMTP: Dane nie zosta³y przyjête.';  
$PHPMAILER_LANG["connect_host"] = 'B³¹d SMTP: Nie mo¿na po³¹czyæ siê z wybranym hostem.';  
$PHPMAILER_LANG["file_access"] = 'Brak dostêpu do pliku: ';  
$PHPMAILER_LANG["file_open"] = 'Nie mo¿na otworzyæ pliku: ';  
$PHPMAILER_LANG["encoding"] = 'Nieznany sposób kodowania znaków: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Romanian Version  
* @package PHPMailer  
* @author Catalin Constantin <catalin@dazoot.ro?> */  
 
$PHPMAILER_LANG = array();  
 
$PHPMAILER_LANG["provide_address"] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).';  
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer nu este suportat.';  
$PHPMAILER_LANG["execute"] = 'Nu pot executa: ';  
$PHPMAILER_LANG["instantiate"] = 'Nu am putut instantia functia mail.';  
$PHPMAILER_LANG["authenticate"] = 'Eroare SMTP: Nu a functionat autentificarea.';  
$PHPMAILER_LANG["from_failed"] = 'Urmatoarele adrese From au dat eroare: ';  
$PHPMAILER_LANG["recipients_failed"] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: ';  
$PHPMAILER_LANG["data_not_accepted"] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.';  
$PHPMAILER_LANG["connect_host"] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.';  
$PHPMAILER_LANG["file_access"] = 'Nu pot accesa fisierul: ';  
$PHPMAILER_LANG["file_open"] = 'Eroare de fisier: Nu pot deschide fisierul: ';  
$PHPMAILER_LANG["encoding"] = 'Encodare necunoscuta: ';  
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Russian Version by Alexey Chumakov <alex@chumakov.ru?> */  
 
$PHPMAILER_LANG = array();  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
* PHPMailer language file.  
* Swedish Version  
 
 
$PHPMAILER_LANG = array();  
 
 
'mottagares e-postadress.';  
 
 
$PHPMAILER_LANG["instantiate"] = 'Kunde inte initiera e-postfunktion.';  
$PHPMAILER_LANG["authenticate"] = 'SMTP fel: Kunde inte autentisera.';  
 
 
 
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fel: Data accepterades inte.';  
$PHPMAILER_LANG["connect_host"] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';  
 
 
 
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/**  
 
 
 
*/  
 
$PHPMAILER_LANG = array();  
 
 
 
$PHPMAILER_LANG["mailer_not_supported"] = ' mailler desteklenmemektedir.';  
 
 
 
 
 
 
 
 
 
 
 
$PHPMAILER_LANG["signing"] = 'Signing Error: ';  
 
?>  
<?php  
/*******************  
Unit Test  
Type: phpmailer class  
********************/  
 
$INCLUDE_DIR = "../";  
 
require("phpunit.php");  
require($INCLUDE_DIR . "class.phpmailer.php");  
error_reporting(E_ALL);  
 
/**  
* Performs authentication tests  
*/  
class phpmailerTest extends TestCase  
{  
/**  
* Holds the default phpmailer instance.  
* @private  
* @type object  
*/  
var $Mail = false;  
 
/**  
* Holds the SMTP mail host.  
* @public  
* @type string  
*/  
var $Host = "";  
 
/**  
* Holds the change log.  
* @private  
* @type string array  
*/  
var $ChangeLog = array();  
 
/**  
* Holds the note log.  
* @private  
* @type string array  
*/  
var $NoteLog = array();  
 
/**  
* Class constuctor.  
*/  
function phpmailerTest($name) {  
/* must define this constructor */  
$this->TestCase( $name );  
}  
 
/**  
* Run before each test is started.  
*/  
function setUp() {  
global $global_vars;  
global $INCLUDE_DIR;  
 
$this->Mail = new PHPMailer();  
 
$this->Mail->Priority = 3;  
$this->Mail->Encoding = "8bit";  
$this->Mail->CharSet = "iso-8859-1";  
$this->Mail->From = "unit_test@phpmailer.sf.net";  
$this->Mail->FromName = "Unit Tester";  
$this->Mail->Sender = "";  
$this->Mail->Subject = "Unit Test";  
$this->Mail->Body = "";  
$this->Mail->AltBody = "";  
$this->Mail->WordWrap = 0;  
$this->Mail->Host = $global_vars["mail_host"];  
$this->Mail->Port = 25;  
$this->Mail->Helo = "localhost.localdomain";  
$this->Mail->SMTPAuth = false;  
$this->Mail->Username = "";  
$this->Mail->Password = "";  
$this->Mail->PluginDir = $INCLUDE_DIR;  
$this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy");  
$this->Mail->Sender = "unit_test@phpmailer.sf.net";  
 
if(strlen($this->Mail->Host) > 0)  
$this->Mail->Mailer = "smtp";  
else  
{  
$this->Mail->Mailer = "mail";  
$this->Sender = "unit_test@phpmailer.sf.net";  
}  
 
global $global_vars;  
$this->SetAddress($global_vars["mail_to"], "Test User");  
if(strlen($global_vars["mail_cc"]) > 0)  
$this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");  
}  
 
/**  
* Run after each test is completed.  
*/  
function tearDown() {  
// Clean global variables  
$this->Mail = NULL;  
$this->ChangeLog = array();  
$this->NoteLog = array();  
}  
 
 
/**  
* Build the body of the message in the appropriate format.  
* @private  
* @returns void  
*/  
function BuildBody() {  
$this->CheckChanges();  
 
// Determine line endings for message  
if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)  
{  
$eol = "<br/>";  
$bullet = "<li>";  
$bullet_start = "<ul>";  
$bullet_end = "</ul>";  
}  
else  
{  
$eol = "\n";  
$bullet = " - ";  
$bullet_start = "";  
$bullet_end = "";  
}  
 
$ReportBody = "";  
 
$ReportBody .= "---------------------" . $eol;  
$ReportBody .= "Unit Test Information" . $eol;  
$ReportBody .= "---------------------" . $eol;  
$ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;  
$ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;  
 
if(strlen($this->Mail->Host) > 0)  
$ReportBody .= "Host: " . $this->Mail->Host . $eol;  
 
// If attachments then create an attachment list  
if(count($this->Mail->attachment) > 0)  
{  
$ReportBody .= "Attachments:" . $eol;  
$ReportBody .= $bullet_start;  
for($i = 0; $i < count($this->Mail->attachment); $i++)  
{  
$ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";  
$ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";  
$ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;  
}  
$ReportBody .= $bullet_end . $eol;  
}  
 
// If there are changes then list them  
if(count($this->ChangeLog) > 0)  
{  
$ReportBody .= "Changes" . $eol;  
$ReportBody .= "-------" . $eol;  
 
$ReportBody .= $bullet_start;  
for($i = 0; $i < count($this->ChangeLog); $i++)  
{  
$ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" .  
$this->ChangeLog[$i][1] . "]" . $eol;  
}  
$ReportBody .= $bullet_end . $eol . $eol;  
}  
 
// If there are notes then list them  
if(count($this->NoteLog) > 0)  
{  
$ReportBody .= "Notes" . $eol;  
$ReportBody .= "-----" . $eol;  
 
$ReportBody .= $bullet_start;  
for($i = 0; $i < count($this->NoteLog); $i++)  
{  
$ReportBody .= $bullet . $this->NoteLog[$i] . $eol;  
}  
$ReportBody .= $bullet_end;  
}  
 
// Re-attach the original body  
$this->Mail->Body .= $eol . $eol . $ReportBody;  
}  
 
/**  
* Check which default settings have been changed for the report.  
* @private  
* @returns void  
*/  
function CheckChanges() {  
if($this->Mail->Priority != 3)  
$this->AddChange("Priority", $this->Mail->Priority);  
if($this->Mail->Encoding != "8bit")  
$this->AddChange("Encoding", $this->Mail->Encoding);  
if($this->Mail->CharSet != "iso-8859-1")  
$this->AddChange("CharSet", $this->Mail->CharSet);  
if($this->Mail->Sender != "")  
$this->AddChange("Sender", $this->Mail->Sender);  
if($this->Mail->WordWrap != 0)  
$this->AddChange("WordWrap", $this->Mail->WordWrap);  
if($this->Mail->Mailer != "mail")  
$this->AddChange("Mailer", $this->Mail->Mailer);  
if($this->Mail->Port != 25)  
$this->AddChange("Port", $this->Mail->Port);  
if($this->Mail->Helo != "localhost.localdomain")  
$this->AddChange("Helo", $this->Mail->Helo);  
if($this->Mail->SMTPAuth)  
$this->AddChange("SMTPAuth", "true");  
}  
 
/**  
* Adds a change entry.  
* @private  
* @returns void  
*/  
function AddChange($sName, $sNewValue) {  
$cur = count($this->ChangeLog);  
$this->ChangeLog[$cur][0] = $sName;  
$this->ChangeLog[$cur][1] = $sNewValue;  
}  
 
/**  
* Adds a simple note to the message.  
* @public  
* @returns void  
*/  
function AddNote($sValue) {  
$this->NoteLog[] = $sValue;  
}  
 
/**  
* Adds all of the addresses  
* @public  
* @returns void  
*/  
function SetAddress($sAddress, $sName = "", $sType = "to") {  
switch($sType)  
{  
case "to":  
$this->Mail->AddAddress($sAddress, $sName);  
break;  
case "cc":  
$this->Mail->AddCC($sAddress, $sName);  
break;  
case "bcc":  
$this->Mail->AddBCC($sAddress, $sName);  
break;  
}  
}  
 
/////////////////////////////////////////////////  
// UNIT TESTS  
/////////////////////////////////////////////////  
 
/**  
* Try a plain message.  
*/  
function test_WordWrap() {  
 
$this->Mail->WordWrap = 40;  
$my_body = "Here is the main body of this message. It should " .  
"be quite a few lines. It should be wrapped at the " .  
"40 characters. Make sure that it is.";  
$nBodyLen = strlen($my_body);  
$my_body .= "\n\nThis is the above body length: " . $nBodyLen;  
 
$this->Mail->Body = $my_body;  
$this->Mail->Subject .= ": Wordwrap";  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Try a plain message.  
*/  
function test_Low_Priority() {  
 
$this->Mail->Priority = 5;  
$this->Mail->Body = "Here is the main body. There should be " .  
"a reply to address in this message.";  
$this->Mail->Subject .= ": Low Priority";  
$this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)");  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Simple plain file attachment test.  
*/  
function test_Multiple_Plain_FileAttachment() {  
 
$this->Mail->Body = "Here is the text body";  
$this->Mail->Subject .= ": Plain + Multiple FileAttachments";  
 
if(!$this->Mail->AddAttachment("test.png"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Simple plain string attachment test.  
*/  
function test_Plain_StringAttachment() {  
 
$this->Mail->Body = "Here is the text body";  
$this->Mail->Subject .= ": Plain + StringAttachment";  
 
$sAttachment = "These characters are the content of the " .  
"string attachment.\nThis might be taken from a ".  
"database or some other such thing. ";  
 
$this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Plain quoted-printable message.  
*/  
function test_Quoted_Printable() {  
 
$this->Mail->Body = "Here is the main body";  
$this->Mail->Subject .= ": Plain + Quoted-printable";  
$this->Mail->Encoding = "quoted-printable";  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Try a plain message.  
*/  
function test_Html() {  
 
$this->Mail->IsHTML(true);  
$this->Mail->Subject .= ": HTML only";  
 
$this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .  
"Go to <a href=\"http://phpmailer.sourceforge.net/\">" .  
"http://phpmailer.sourceforge.net/</a> for new versions of " .  
"phpmailer. <p/> Thank you!";  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Simple HTML and attachment test  
*/  
function test_HTML_Attachment() {  
 
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";  
$this->Mail->Subject .= ": HTML + Attachment";  
$this->Mail->IsHTML(true);  
 
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* An embedded attachment test.  
*/  
function test_Embedded_Image() {  
 
$this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .  
"Here is an image!</a>";  
$this->Mail->Subject .= ": Embedded Image";  
$this->Mail->IsHTML(true);  
 
if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",  
"base64", "image/png"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* An embedded attachment test.  
*/  
function test_Multi_Embedded_Image() {  
 
$this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .  
"Here is an image!</a>";  
$this->Mail->Subject .= ": Embedded Image + Attachment";  
$this->Mail->IsHTML(true);  
 
if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",  
"base64", "image/png"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Simple multipart/alternative test.  
*/  
function test_AltBody() {  
 
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";  
$this->Mail->AltBody = "Here is the text body of this message. " .  
"It should be quite a few lines. It should be wrapped at the " .  
"40 characters. Make sure that it is.";  
$this->Mail->WordWrap = 40;  
$this->AddNote("This is a mulipart alternative email");  
$this->Mail->Subject .= ": AltBody + Word Wrap";  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
/**  
* Simple HTML and attachment test  
*/  
function test_AltBody_Attachment() {  
 
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";  
$this->Mail->AltBody = "This is the text part of the email.";  
$this->Mail->Subject .= ": AltBody + Attachment";  
$this->Mail->IsHTML(true);  
 
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))  
{  
$this->assert(false, $this->Mail->ErrorInfo);  
return;  
}  
 
$this->BuildBody();  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
 
$fp = fopen("message.txt", "w");  
fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());  
fclose($fp);  
}  
 
function test_MultipleSend() {  
$this->Mail->Body = "Sending two messages without keepalive";  
$this->BuildBody();  
$subject = $this->Mail->Subject;  
 
$this->Mail->Subject = $subject . ": SMTP 1";  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
 
$this->Mail->Subject = $subject . ": SMTP 2";  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
function test_SmtpKeepAlive() {  
$this->Mail->Body = "This was done using the SMTP keep-alive.";  
$this->BuildBody();  
$subject = $this->Mail->Subject;  
 
$this->Mail->SMTPKeepAlive = true;  
$this->Mail->Subject = $subject . ": SMTP keep-alive 1";  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
 
$this->Mail->Subject = $subject . ": SMTP keep-alive 2";  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
$this->Mail->SmtpClose();  
}  
 
/**  
* Tests this denial of service attack:  
* http://www.cybsec.com/vuln/PHPMailer-DOS.pdf  
*/  
function test_DenialOfServiceAttack() {  
$this->Mail->Body = "This should no longer cause a denial of service.";  
$this->BuildBody();  
 
$this->Mail->Subject = str_repeat("A", 998);  
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);  
}  
 
function test_Error() {  
$this->Mail->Subject .= ": This should be sent";  
$this->BuildBody();  
$this->Mail->ClearAllRecipients(); // no addresses should cause an error  
$this->assert($this->Mail->IsError() == false, "Error found");  
$this->assert($this->Mail->Send() == false, "Send succeeded");  
$this->assert($this->Mail->IsError(), "No error found");  
$this->assertEquals('You must provide at least one ' .  
'recipient email address.', $this->Mail->ErrorInfo);  
$this->Mail->AddAddress(get("mail_to"));  
$this->assert($this->Mail->Send(), "Send failed");  
}  
}  
 
/**  
* Create and run test instance.  
*/  
 
if(isset($HTTP_GET_VARS))  
$global_vars = $HTTP_GET_VARS;  
else  
$global_vars = $_REQUEST;  
 
if(isset($global_vars["submitted"]))  
{  
echo "Test results:<br>";  
$suite = new TestSuite( "phpmailerTest" );  
 
$testRunner = new TestRunner;  
$testRunner->run($suite);  
echo "<hr noshade/>";  
}  
 
function get($sName) {  
global $global_vars;  
if(isset($global_vars[$sName]))  
return $global_vars[$sName];  
else  
return "";  
}  
 
?>  
 
<html>  
<body>  
<h3>phpmailer Unit Test</h3>  
By entering a SMTP hostname it will automatically perform tests with SMTP.  
 
<form name="phpmailer_unit" action="phpmailer_test.php" method="get">  
<input type="hidden" name="submitted" value="1"/>  
To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>  
<br/>  
Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>  
<br/>  
SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>  
<p/>  
<input type="submit" value="Run Test"/>  
 
</form>  
</body>  
</html>  
 
<?php  
//  
// PHP framework for testing, based on the design of "JUnit".  
//  
// Written by Fred Yankowski <fred@ontosys.com>  
// OntoSys, Inc <http://www.OntoSys.com>  
//  
// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $  
 
// Copyright (c) 2000 Fred Yankowski  
 
// Permission is hereby granted, free of charge, to any person  
// obtaining a copy of this software and associated documentation  
// files (the "Software"), to deal in the Software without  
// restriction, including without limitation the rights to use, copy,  
// modify, merge, publish, distribute, sublicense, and/or sell copies  
// of the Software, and to permit persons to whom the Software is  
// furnished to do so, subject to the following conditions:  
//  
// The above copyright notice and this permission notice shall be  
// included in all copies or substantial portions of the Software.  
//  
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS  
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
// SOFTWARE.  
//  
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |  
E_CORE_ERROR | E_CORE_WARNING);  
 
/*  
interface Test {  
function run(&$aTestResult);  
function countTestCases();  
}  
*/  
 
function trace($msg) {  
return;  
print($msg);  
flush();  
}  
 
 
class Exception {  
/* Emulate a Java exception, sort of... */  
var $message;  
function Exception($message) {  
$this->message = $message;  
}  
function getMessage() {  
return $this->message;  
}  
}  
 
class Assert {  
function assert($boolean, $message=0) {  
if (! $boolean)  
$this->fail($message);  
}  
 
function assertEquals($expected, $actual, $message=0) {  
if ($expected != $actual) {  
$this->failNotEquals($expected, $actual, "expected", $message);  
}  
}  
 
function assertRegexp($regexp, $actual, $message=false) {  
if (! preg_match($regexp, $actual)) {  
$this->failNotEquals($regexp, $actual, "pattern", $message);  
}  
}  
 
function failNotEquals($expected, $actual, $expected_label, $message=0) {  
// Private function for reporting failure to match.  
$str = $message ? ($message . ' ') : '';  
$str .= "($expected_label/actual)<br>";  
$htmlExpected = htmlspecialchars($expected);  
$htmlActual = htmlspecialchars($actual);  
$str .= sprintf("<pre>%s\n--------\n%s</pre>",  
$htmlExpected, $htmlActual);  
$this->fail($str);  
}  
}  
 
class TestCase extends Assert /* implements Test */ {  
/* Defines context for running tests. Specific context -- such as  
instance variables, global variables, global state -- is defined  
by creating a subclass that specializes the setUp() and  
tearDown() methods. A specific test is defined by a subclass  
that specializes the runTest() method. */  
var $fName;  
var $fResult;  
var $fExceptions = array();  
 
function TestCase($name) {  
$this->fName = $name;  
}  
 
function run($testResult=0) {  
/* Run this single test, by calling the run() method of the  
TestResult object which will in turn call the runBare() method  
of this object. That complication allows the TestResult object  
to do various kinds of progress reporting as it invokes each  
test. Create/obtain a TestResult object if none was passed in.  
Note that if a TestResult object was passed in, it must be by  
reference. */  
if (! $testResult)  
$testResult = $this->_createResult();  
$this->fResult = $testResult;  
$testResult->run(&$this);  
$this->fResult = 0;  
return $testResult;  
}  
 
function countTestCases() {  
return 1;  
}  
 
function runTest() {  
$name = $this->name();  
// Since isset($this->$name) is false, no way to run defensive checks  
$this->$name();  
}  
 
function setUp() /* expect override */ {  
//print("TestCase::setUp()<br>\n");  
}  
 
function tearDown() /* possible override */ {  
//print("TestCase::tearDown()<br>\n");  
}  
 
////////////////////////////////////////////////////////////////  
 
 
function _createResult() /* protected */ {  
/* override this to use specialized subclass of TestResult */  
return new TestResult;  
}  
 
function fail($message=0) {  
//printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');  
/* JUnit throws AssertionFailedError here. We just record the  
failure and carry on */  
$this->fExceptions[] = new Exception(&$message);  
}  
 
function error($message) {  
/* report error that requires correction in the test script  
itself, or (heaven forbid) in this testing infrastructure */  
printf('<b>ERROR: ' . $message . '</b><br>');  
$this->fResult->stop();  
}  
 
function failed() {  
return count($this->fExceptions);  
}  
 
function getExceptions() {  
return $this->fExceptions;  
}  
 
function name() {  
return $this->fName;  
}  
 
function runBare() {  
$this->setup();  
$this->runTest();  
$this->tearDown();  
}  
}  
 
 
class TestSuite /* implements Test */ {  
/* Compose a set of Tests (instances of TestCase or TestSuite), and  
run them all. */  
var $fTests = array();  
 
function TestSuite($classname=false) {  
if ($classname) {  
// Find all methods of the given class whose name starts with  
// "test" and add them to the test suite. We are just _barely_  
// able to do this with PHP's limited introspection... Note  
// that PHP seems to store method names in lower case, and we  
// have to avoid the constructor function for the TestCase class  
// superclass. This will fail when $classname starts with  
// "Test" since that will have a constructor method that will  
// get matched below and then treated (incorrectly) as a test  
// method. So don't name any TestCase subclasses as "Test..."!  
if (floor(phpversion()) >= 4) {  
// PHP4 introspection, submitted by Dylan Kuhn  
$names = get_class_methods($classname);  
while (list($key, $method) = each($names)) {  
if (preg_match('/^test/', $method) && $method != "testcase") {  
$this->addTest(new $classname($method));  
}  
}  
}  
else {  
$dummy = new $classname("dummy");  
$names = (array) $dummy;  
while (list($key, $value) = each($names)) {  
$type = gettype($value);  
if ($type == "user function" && preg_match('/^test/', $key)  
&& $key != "testcase") {  
$this->addTest(new $classname($key));  
}  
}  
}  
}  
}  
 
function addTest($test) {  
/* Add TestCase or TestSuite to this TestSuite */  
$this->fTests[] = $test;  
}  
 
function run(&$testResult) {  
/* Run all TestCases and TestSuites comprising this TestSuite,  
accumulating results in the given TestResult object. */  
reset($this->fTests);  
while (list($na, $test) = each($this->fTests)) {  
if ($testResult->shouldStop())  
break;  
$test->run(&$testResult);  
}  
}  
 
function countTestCases() {  
/* Number of TestCases comprising this TestSuite (including those  
in any constituent TestSuites) */  
$count = 0;  
reset($fTests);  
while (list($na, $test_case) = each($this->fTests)) {  
$count += $test_case->countTestCases();  
}  
return $count;  
}  
}  
 
 
class TestFailure {  
/* Record failure of a single TestCase, associating it with the  
exception(s) that occurred */  
var $fFailedTestName;  
var $fExceptions;  
 
function TestFailure(&$test, &$exceptions) {  
$this->fFailedTestName = $test->name();  
$this->fExceptions = $exceptions;  
}  
 
function getExceptions() {  
return $this->fExceptions;  
}  
function getTestName() {  
return $this->fFailedTestName;  
}  
}  
 
 
class TestResult {  
/* Collect the results of running a set of TestCases. */  
var $fFailures = array();  
var $fRunTests = 0;  
var $fStop = false;  
 
function TestResult() { }  
 
function _endTest($test) /* protected */ {  
/* specialize this for end-of-test action, such as progress  
reports */  
}  
 
function getFailures() {  
return $this->fFailures;  
}  
 
function run($test) {  
/* Run a single TestCase in the context of this TestResult */  
$this->_startTest($test);  
$this->fRunTests++;  
 
$test->runBare();  
 
/* this is where JUnit would catch AssertionFailedError */  
$exceptions = $test->getExceptions();  
if ($exceptions)  
$this->fFailures[] = new TestFailure(&$test, &$exceptions);  
$this->_endTest($test);  
}  
 
function countTests() {  
return $this->fRunTests;  
}  
 
function shouldStop() {  
return $this->fStop;  
}  
 
function _startTest($test) /* protected */ {  
/* specialize this for start-of-test actions */  
}  
 
function stop() {  
/* set indication that the test sequence should halt */  
$fStop = true;  
}  
 
function countFailures() {  
return count($this->fFailures);  
}  
}  
 
 
class TextTestResult extends TestResult {  
/* Specialize TestResult to produce text/html report */  
function TextTestResult() {  
$this->TestResult(); // call superclass constructor  
}  
 
function report() {  
/* report result of test run */  
$nRun = $this->countTests();  
$nFailures = $this->countFailures();  
printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');  
printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');  
if ($nFailures == 0)  
return;  
 
print("<ol>\n");  
$failures = $this->getFailures();  
while (list($i, $failure) = each($failures)) {  
$failedTestName = $failure->getTestName();  
printf("<li>%s\n", $failedTestName);  
 
$exceptions = $failure->getExceptions();  
print("<ul>");  
while (list($na, $exception) = each($exceptions))  
printf("<li>%s\n", $exception->getMessage());  
print("</ul>");  
}  
print("</ol>\n");  
}  
 
function _startTest($test) {  
printf("%s ", $test->name());  
flush();  
}  
 
function _endTest($test) {  
$outcome = $test->failed()  
? "<font color=\"red\">FAIL</font>"  
: "<font color=\"green\">ok</font>";  
printf("$outcome<br>\n");  
flush();  
}  
}  
 
 
class TestRunner {  
/* Run a suite of tests and report results. */  
function run($suite) {  
$result = new TextTestResult;  
$suite->run($result);  
$result->report();  
}  
}  
 
?>  
 
 Binary files a/busui/owa/includes/PHPMailer_v2.0.3/test/test.png and /dev/null differ
<?php  
 
/*************************************************  
 
Snoopy - the PHP net client  
Author: Monte Ohrt <monte@ispi.net>  
Copyright (c): 1999-2008 New Digital Group, all rights reserved  
Version: 1.2.4  
 
* This library is free software; you can redistribute it and/or  
* modify it under the terms of the GNU Lesser General Public  
* License as published by the Free Software Foundation; either  
* version 2.1 of the License, or (at your option) any later version.  
*  
* This library is distributed in the hope that it will be useful,  
* but WITHOUT ANY WARRANTY; without even the implied warranty of  
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
* Lesser General Public License for more details.  
*  
* You should have received a copy of the GNU Lesser General Public  
* License along with this library; if not, write to the Free Software  
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
 
You may contact the author of Snoopy by e-mail at:  
monte@ohrt.com  
 
The latest version of Snoopy can be obtained from:  
http://snoopy.sourceforge.net/  
 
*************************************************/  
 
class Snoopy  
{  
/**** Public variables ****/  
 
/* user definable vars */  
 
var $host = "www.php.net"; // host name we are connecting to  
var $port = 80; // port we are connecting to  
var $proxy_host = ""; // proxy host to use  
var $proxy_port = ""; // proxy port to use  
var $proxy_user = ""; // proxy user to use  
var $proxy_pass = ""; // proxy password to use  
 
var $agent = "Snoopy v1.2.4"; // agent we masquerade as  
var $referer = ""; // referer info to pass  
var $cookies = array(); // array of cookies to pass  
// $cookies["username"]="joe";  
var $rawheaders = array(); // array of raw headers to send  
// $rawheaders["Content-type"]="text/html";  
 
var $maxredirs = 5; // http redirection depth maximum. 0 = disallow  
var $lastredirectaddr = ""; // contains address of last redirected address  
var $offsiteok = true; // allows redirection off-site  
var $maxframes = 0; // frame content depth maximum. 0 = disallow  
var $expandlinks = true; // expand links to fully qualified URLs.  
// this only applies to fetchlinks()  
// submitlinks(), and submittext()  
var $passcookies = true; // pass set cookies back through redirects  
// NOTE: this currently does not respect  
// dates, domains or paths.  
 
var $user = ""; // user for http authentication  
var $pass = ""; // password for http authentication  
 
// http accept types  
var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";  
 
var $results = ""; // where the content is put  
 
var $error = ""; // error messages sent here  
var $response_code = ""; // response code returned from server  
var $headers = array(); // headers returned from server sent here  
var $maxlength = 500000; // max return data length (body)  
var $read_timeout = 0; // timeout on read operations, in seconds  
// supported only since PHP 4 Beta 4  
// set to 0 to disallow timeouts  
var $timed_out = false; // if a read operation timed out  
var $status = 0; // http request status  
 
var $temp_dir = "/tmp"; // temporary directory that the webserver  
// has permission to write to.  
// under Windows, this should be C:\temp  
 
var $curl_path = "/usr/local/bin/curl";  
// Snoopy will use cURL for fetching  
// SSL content if a full system path to  
// the cURL binary is supplied here.  
// set to false if you do not have  
// cURL installed. See http://curl.haxx.se  
// for details on installing cURL.  
// Snoopy does *not* use the cURL  
// library functions built into php,  
// as these functions are not stable  
// as of this Snoopy release.  
 
/**** Private variables ****/  
 
var $_maxlinelen = 4096; // max line length (headers)  
 
var $_httpmethod = "GET"; // default http request method  
var $_httpversion = "HTTP/1.0"; // default http request version  
var $_submit_method = "POST"; // default submit method  
var $_submit_type = "application/x-www-form-urlencoded"; // default submit type  
var $_mime_boundary = ""; // MIME boundary for multipart/form-data submit type  
var $_redirectaddr = false; // will be set if page fetched is a redirect  
var $_redirectdepth = 0; // increments on an http redirect  
var $_frameurls = array(); // frame src urls  
var $_framedepth = 0; // increments on frame depth  
 
var $_isproxy = false; // set if using a proxy server  
var $_fp_timeout = 30; // timeout for socket connection  
 
/*======================================================================*\  
Function: fetch  
Purpose: fetch the contents of a web page  
(and possibly other protocols in the  
future like ftp, nntp, gopher, etc.)  
Input: $URI the location of the page to fetch  
Output: $this->results the output text from the fetch  
\*======================================================================*/  
 
function fetch($URI)  
{  
 
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);  
$URI_PARTS = parse_url($URI);  
if (!empty($URI_PARTS["user"]))  
$this->user = $URI_PARTS["user"];  
if (!empty($URI_PARTS["pass"]))  
$this->pass = $URI_PARTS["pass"];  
if (empty($URI_PARTS["query"]))  
$URI_PARTS["query"] = '';  
if (empty($URI_PARTS["path"]))  
$URI_PARTS["path"] = '';  
 
switch(strtolower($URI_PARTS["scheme"]))  
{  
case "http":  
$this->host = $URI_PARTS["host"];  
if(!empty($URI_PARTS["port"]))  
$this->port = $URI_PARTS["port"];  
if($this->_connect($fp))  
{  
if($this->_isproxy)  
{  
// using proxy, send entire URI  
$this->_httprequest($URI,$fp,$URI,$this->_httpmethod);  
}  
else  
{  
$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");  
// no proxy, send only the path  
$this->_httprequest($path, $fp, $URI, $this->_httpmethod);  
}  
 
$this->_disconnect($fp);  
 
if($this->_redirectaddr)  
{  
/* url was redirected, check if we've hit the max depth */  
if($this->maxredirs > $this->_redirectdepth)  
{  
// only follow redirect if it's on this site, or offsiteok is true  
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)  
{  
/* follow the redirect */  
$this->_redirectdepth++;  
$this->lastredirectaddr=$this->_redirectaddr;  
$this->fetch($this->_redirectaddr);  
}  
}  
}  
 
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)  
{  
$frameurls = $this->_frameurls;  
$this->_frameurls = array();  
 
while(list(,$frameurl) = each($frameurls))  
{  
if($this->_framedepth < $this->maxframes)  
{  
$this->fetch($frameurl);  
$this->_framedepth++;  
}  
else  
break;  
}  
}  
}  
else  
{  
return false;  
}  
return true;  
break;  
case "https":  
if(!$this->curl_path)  
return false;  
if(function_exists("is_executable"))  
if (!is_executable($this->curl_path))  
return false;  
$this->host = $URI_PARTS["host"];  
if(!empty($URI_PARTS["port"]))  
$this->port = $URI_PARTS["port"];  
if($this->_isproxy)  
{  
// using proxy, send entire URI  
$this->_httpsrequest($URI,$URI,$this->_httpmethod);  
}  
else  
{  
$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");  
// no proxy, send only the path  
$this->_httpsrequest($path, $URI, $this->_httpmethod);  
}  
 
if($this->_redirectaddr)  
{  
/* url was redirected, check if we've hit the max depth */  
if($this->maxredirs > $this->_redirectdepth)  
{  
// only follow redirect if it's on this site, or offsiteok is true  
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)  
{  
/* follow the redirect */  
$this->_redirectdepth++;  
$this->lastredirectaddr=$this->_redirectaddr;  
$this->fetch($this->_redirectaddr);  
}  
}  
}  
 
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)  
{  
$frameurls = $this->_frameurls;  
$this->_frameurls = array();  
 
while(list(,$frameurl) = each($frameurls))  
{  
if($this->_framedepth < $this->maxframes)  
{  
$this->fetch($frameurl);  
$this->_framedepth++;  
}  
else  
break;  
}  
}  
return true;  
break;  
default:  
// not a valid protocol  
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';  
return false;  
break;  
}  
return true;  
}  
 
/*======================================================================*\  
Function: submit  
Purpose: submit an http form  
Input: $URI the location to post the data  
$formvars the formvars to use.  
format: $formvars["var"] = "val";  
$formfiles an array of files to submit  
format: $formfiles["var"] = "/dir/filename.ext";  
Output: $this->results the text output from the post  
\*======================================================================*/  
 
function submit($URI, $formvars="", $formfiles="")  
{  
unset($postdata);  
 
$postdata = $this->_prepare_post_body($formvars, $formfiles);  
 
$URI_PARTS = parse_url($URI);  
if (!empty($URI_PARTS["user"]))  
$this->user = $URI_PARTS["user"];  
if (!empty($URI_PARTS["pass"]))  
$this->pass = $URI_PARTS["pass"];  
if (empty($URI_PARTS["query"]))  
$URI_PARTS["query"] = '';  
if (empty($URI_PARTS["path"]))  
$URI_PARTS["path"] = '';  
 
switch(strtolower($URI_PARTS["scheme"]))  
{  
case "http":  
$this->host = $URI_PARTS["host"];  
if(!empty($URI_PARTS["port"]))  
$this->port = $URI_PARTS["port"];  
if($this->_connect($fp))  
{  
if($this->_isproxy)  
{  
// using proxy, send entire URI  
$this->_httprequest($URI,$fp,$URI,$this->_submit_method,$this->_submit_type,$postdata);  
}  
else  
{  
$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");  
// no proxy, send only the path  
$this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);  
}  
 
$this->_disconnect($fp);  
 
if($this->_redirectaddr)  
{  
/* url was redirected, check if we've hit the max depth */  
if($this->maxredirs > $this->_redirectdepth)  
{  
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))  
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);  
 
// only follow redirect if it's on this site, or offsiteok is true  
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)  
{  
/* follow the redirect */  
$this->_redirectdepth++;  
$this->lastredirectaddr=$this->_redirectaddr;  
if( strpos( $this->_redirectaddr, "?" ) > 0 )  
$this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get  
else  
$this->submit($this->_redirectaddr,$formvars, $formfiles);  
}  
}  
}  
 
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)  
{  
$frameurls = $this->_frameurls;  
$this->_frameurls = array();  
 
while(list(,$frameurl) = each($frameurls))  
{  
if($this->_framedepth < $this->maxframes)  
{  
$this->fetch($frameurl);  
$this->_framedepth++;  
}  
else  
break;  
}  
}  
 
}  
else  
{  
return false;  
}  
return true;  
break;  
case "https":  
if(!$this->curl_path)  
return false;  
if(function_exists("is_executable"))  
if (!is_executable($this->curl_path))  
return false;  
$this->host = $URI_PARTS["host"];  
if(!empty($URI_PARTS["port"]))  
$this->port = $URI_PARTS["port"];  
if($this->_isproxy)  
{  
// using proxy, send entire URI  
$this->_httpsrequest($URI, $URI, $this->_submit_method, $this->_submit_type, $postdata);  
}  
else  
{  
$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");  
// no proxy, send only the path  
$this->_httpsrequest($path, $URI, $this->_submit_method, $this->_submit_type, $postdata);  
}  
 
if($this->_redirectaddr)  
{  
/* url was redirected, check if we've hit the max depth */  
if($this->maxredirs > $this->_redirectdepth)  
{  
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))  
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);  
 
// only follow redirect if it's on this site, or offsiteok is true  
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)  
{  
/* follow the redirect */  
$this->_redirectdepth++;  
$this->lastredirectaddr=$this->_redirectaddr;  
if( strpos( $this->_redirectaddr, "?" ) > 0 )  
$this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get  
else  
$this->submit($this->_redirectaddr,$formvars, $formfiles);  
}  
}  
}  
 
if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)  
{  
$frameurls = $this->_frameurls;  
$this->_frameurls = array();  
 
while(list(,$frameurl) = each($frameurls))  
{  
if($this->_framedepth < $this->maxframes)  
{  
$this->fetch($frameurl);  
$this->_framedepth++;  
}  
else  
break;  
}  
}  
return true;  
break;  
 
default:  
// not a valid protocol  
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';  
return false;  
break;  
}  
return true;  
}  
 
/*======================================================================*\  
Function: fetchlinks  
Purpose: fetch the links from a web page  
Input: $URI where you are fetching from  
Output: $this->results an array of the URLs  
\*======================================================================*/  
 
function fetchlinks($URI)  
{  
if ($this->fetch($URI))  
{  
if($this->lastredirectaddr)  
$URI = $this->lastredirectaddr;  
if(is_array($this->results))  
{  
for($x=0;$x<count($this->results);$x++)  
$this->results[$x] = $this->_striplinks($this->results[$x]);  
}  
else  
$this->results = $this->_striplinks($this->results);  
 
if($this->expandlinks)  
$this->results = $this->_expandlinks($this->results, $URI);  
return true;  
}  
else  
return false;  
}  
 
/*======================================================================*\  
Function: fetchform  
Purpose: fetch the form elements from a web page  
Input: $URI where you are fetching from  
Output: $this->results the resulting html form  
\*======================================================================*/  
 
function fetchform($URI)  
{  
 
if ($this->fetch($URI))  
{  
 
if(is_array($this->results))  
{  
for($x=0;$x<count($this->results);$x++)  
$this->results[$x] = $this->_stripform($this->results[$x]);  
}  
else  
$this->results = $this->_stripform($this->results);  
 
return true;  
}  
else  
return false;  
}  
 
 
/*======================================================================*\  
Function: fetchtext  
Purpose: fetch the text from a web page, stripping the links  
Input: $URI where you are fetching from  
Output: $this->results the text from the web page  
\*======================================================================*/  
 
function fetchtext($URI)  
{  
if($this->fetch($URI))  
{  
if(is_array($this->results))  
{  
for($x=0;$x<count($this->results);$x++)  
$this->results[$x] = $this->_striptext($this->results[$x]);  
}  
else  
$this->results = $this->_striptext($this->results);  
return true;  
}  
else  
return false;  
}  
 
/*======================================================================*\  
Function: submitlinks  
Purpose: grab links from a form submission  
Input: $URI where you are submitting from  
Output: $this->results an array of the links from the post  
\*======================================================================*/  
 
function submitlinks($URI, $formvars="", $formfiles="")  
{  
if($this->submit($URI,$formvars, $formfiles))  
{  
if($this->lastredirectaddr)  
$URI = $this->lastredirectaddr;  
if(is_array($this->results))  
{  
for($x=0;$x<count($this->results);$x++)  
{  
$this->results[$x] = $this->_striplinks($this->results[$x]);  
if($this->expandlinks)  
$this->results[$x] = $this->_expandlinks($this->results[$x],$URI);  
}  
}  
else  
{  
$this->results = $this->_striplinks($this->results);  
if($this->expandlinks)  
$this->results = $this->_expandlinks($this->results,$URI);  
}  
return true;  
}  
else  
return false;  
}  
 
/*======================================================================*\  
Function: submittext  
Purpose: grab text from a form submission  
Input: $URI where you are submitting from  
Output: $this->results the text from the web page  
\*======================================================================*/  
 
function submittext($URI, $formvars = "", $formfiles = "")  
{  
if($this->submit($URI,$formvars, $formfiles))  
{  
if($this->lastredirectaddr)  
$URI = $this->lastredirectaddr;  
if(is_array($this->results))  
{  
for($x=0;$x<count($this->results);$x++)  
{  
$this->results[$x] = $this->_striptext($this->results[$x]);  
if($this->expandlinks)  
$this->results[$x] = $this->_expandlinks($this->results[$x],$URI);  
}  
}  
else  
{  
$this->results = $this->_striptext($this->results);  
if($this->expandlinks)  
$this->results = $this->_expandlinks($this->results,$URI);  
}  
return true;  
}  
else  
return false;  
}  
 
 
 
/*======================================================================*\  
Function: set_submit_multipart  
Purpose: Set the form submission content type to  
multipart/form-data  
\*======================================================================*/  
function set_submit_multipart()  
{  
$this->_submit_type = "multipart/form-data";  
}  
 
 
/*======================================================================*\  
Function: set_submit_normal  
Purpose: Set the form submission content type to  
application/x-www-form-urlencoded  
\*======================================================================*/  
function set_submit_normal()  
{  
$this->_submit_type = "application/x-www-form-urlencoded";  
}  
 
 
 
 
/*======================================================================*\  
Private functions  
\*======================================================================*/  
 
 
/*======================================================================*\  
Function: _striplinks  
Purpose: strip the hyperlinks from an html document  
Input: $document document to strip.  
Output: $match an array of the links  
\*======================================================================*/  
 
function _striplinks($document)  
{  
preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href=  
([\"\'])? # find single or double quote  
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching  
# quote, otherwise match up to next space  
'isx",$document,$links);  
 
 
// catenate the non-empty matches from the conditional subpattern  
 
while(list($key,$val) = each($links[2]))  
{  
if(!empty($val))  
$match[] = $val;  
}  
 
while(list($key,$val) = each($links[3]))  
{  
if(!empty($val))  
$match[] = $val;  
}  
 
// return the links  
return $match;  
}  
 
/*======================================================================*\  
Function: _stripform  
Purpose: strip the form elements from an html document  
Input: $document document to strip.  
Output: $match an array of the links  
\*======================================================================*/  
 
function _stripform($document)  
{  
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);  
 
// catenate the matches  
$match = implode("\r\n",$elements[0]);  
 
// return the links  
return $match;  
}  
 
 
 
/*======================================================================*\  
Function: _striptext  
Purpose: strip the text from an html document  
Input: $document document to strip.  
Output: $text the resulting text  
\*======================================================================*/  
 
function _striptext($document)  
{  
 
// I didn't use preg eval (//e) since that is only available in PHP 4.0.  
// so, list your entities one by one here. I included some of the  
// more common ones.  
 
$search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript  
"'<[\/\!]*?[^<>]*?>'si", // strip out html tags  
"'([\r\n])[\s]+'", // strip out white space  
"'&(quot|#34|#034|#x22);'i", // replace html entities  
"'&(amp|#38|#038|#x26);'i", // added hexadecimal values  
"'&(lt|#60|#060|#x3c);'i",  
"'&(gt|#62|#062|#x3e);'i",  
"'&(nbsp|#160|#xa0);'i",  
"'&(iexcl|#161);'i",  
"'&(cent|#162);'i",  
"'&(pound|#163);'i",  
"'&(copy|#169);'i",  
"'&(reg|#174);'i",  
"'&(deg|#176);'i",  
"'&(#39|#039|#x27);'",  
"'&(euro|#8364);'i", // europe  
"'&a(uml|UML);'", // german  
"'&o(uml|UML);'",  
"'&u(uml|UML);'",  
"'&A(uml|UML);'",  
"'&O(uml|UML);'",  
"'&U(uml|UML);'",  
"'&szlig;'i",  
);  
$replace = array( "",  
"",  
"\\1",  
"\"",  
"&",  
"<",  
">",  
" ",  
chr(161),  
chr(162),  
chr(163),  
chr(169),  
chr(174),  
chr(176),  
chr(39),  
chr(128),  
 
 
 
 
 
 
 
);  
 
$text = preg_replace($search,$replace,$document);  
 
return $text;  
}  
 
/*======================================================================*\  
Function: _expandlinks  
Purpose: expand each link into a fully qualified URL  
Input: $links the links to qualify  
$URI the full URI to get the base from  
Output: $expandedLinks the expanded links  
\*======================================================================*/  
 
function _expandlinks($links,$URI)  
{  
 
preg_match("/^[^\?]+/",$URI,$match);  
 
$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);  
$match = preg_replace("|/$|","",$match);  
$match_part = parse_url($match);  
$match_root =  
$match_part["scheme"]."://".$match_part["host"];  
 
$search = array( "|^http://".preg_quote($this->host)."|i",  
"|^(\/)|i",  
"|^(?!http://)(?!mailto:)|i",  
"|/\./|",  
"|/[^\/]+/\.\./|"  
);  
 
$replace = array( "",  
$match_root."/",  
$match."/",  
"/",  
"/"  
);  
 
$expandedLinks = preg_replace($search,$replace,$links);  
 
return $expandedLinks;  
}  
 
/*======================================================================*\  
Function: _httprequest  
Purpose: go get the http data from the server  
Input: $url the url to fetch  
$fp the current open file pointer  
$URI the full URI  
$body body contents to send if any (POST)  
Output:  
\*======================================================================*/  
 
function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")  
{  
$cookie_headers = '';  
if($this->passcookies && $this->_redirectaddr)  
$this->setcookies();  
 
$URI_PARTS = parse_url($URI);  
if(empty($url))  
$url = "/";  
$headers = $http_method." ".$url." ".$this->_httpversion."\r\n";  
if(!empty($this->agent))  
$headers .= "User-Agent: ".$this->agent."\r\n";  
if(!empty($this->host) && !isset($this->rawheaders['Host'])) {  
$headers .= "Host: ".$this->host;  
if(!empty($this->port))  
$headers .= ":".$this->port;  
$headers .= "\r\n";  
}  
if(!empty($this->accept))  
$headers .= "Accept: ".$this->accept."\r\n";  
if(!empty($this->referer))  
$headers .= "Referer: ".$this->referer."\r\n";  
if(!empty($this->cookies))  
{  
if(!is_array($this->cookies))  
$this->cookies = (array)$this->cookies;  
 
reset($this->cookies);  
if ( count($this->cookies) > 0 ) {  
$cookie_headers .= 'Cookie: ';  
foreach ( $this->cookies as $cookieKey => $cookieVal ) {  
$cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; ";  
}  
$headers .= substr($cookie_headers,0,-2) . "\r\n";  
}  
}  
if(!empty($this->rawheaders))  
{  
if(!is_array($this->rawheaders))  
$this->rawheaders = (array)$this->rawheaders;  
while(list($headerKey,$headerVal) = each($this->rawheaders))  
$headers .= $headerKey.": ".$headerVal."\r\n";  
}  
if(!empty($content_type)) {  
$headers .= "Content-type: $content_type";  
if ($content_type == "multipart/form-data")  
$headers .= "; boundary=".$this->_mime_boundary;  
$headers .= "\r\n";  
}  
if(!empty($body))  
$headers .= "Content-length: ".strlen($body)."\r\n";  
if(!empty($this->user) || !empty($this->pass))  
$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";  
 
//add proxy auth headers  
if(!empty($this->proxy_user))  
$headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n";  
 
 
$headers .= "\r\n";  
 
// set the read timeout if needed  
if ($this->read_timeout > 0)  
socket_set_timeout($fp, $this->read_timeout);  
$this->timed_out = false;  
 
fwrite($fp,$headers.$body,strlen($headers.$body));  
 
$this->_redirectaddr = false;  
unset($this->headers);  
 
while($currentHeader = fgets($fp,$this->_maxlinelen))  
{  
if ($this->read_timeout > 0 && $this->_check_timeout($fp))  
{  
$this->status=-100;  
return false;  
}  
 
if($currentHeader == "\r\n")  
break;  
 
// if a header begins with Location: or URI:, set the redirect  
if(preg_match("/^(Location:|URI:)/i",$currentHeader))  
{  
// get URL portion of the redirect  
preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches);  
// look for :// in the Location header to see if hostname is included  
if(!preg_match("|\:\/\/|",$matches[2]))  
{  
// no host in the path, so prepend  
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;  
// eliminate double slash  
if(!preg_match("|^/|",$matches[2]))  
$this->_redirectaddr .= "/".$matches[2];  
else  
$this->_redirectaddr .= $matches[2];  
}  
else  
$this->_redirectaddr = $matches[2];  
}  
 
if(preg_match("|^HTTP/|",$currentHeader))  
{  
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))  
{  
$this->status= $status[1];  
}  
$this->response_code = $currentHeader;  
}  
 
$this->headers[] = $currentHeader;  
}  
 
$results = '';  
do {  
$_data = fread($fp, $this->maxlength);  
if (strlen($_data) == 0) {  
break;  
}  
$results .= $_data;  
} while(true);  
 
if ($this->read_timeout > 0 && $this->_check_timeout($fp))  
{  
$this->status=-100;  
return false;  
}  
 
// check if there is a a redirect meta tag  
 
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))  
 
{  
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);  
}  
 
// have we hit our frame depth and is there frame src to fetch?  
if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))  
{  
$this->results[] = $results;  
for($x=0; $x<count($match[1]); $x++)  
$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);  
}  
// have we already fetched framed content?  
elseif(is_array($this->results))  
$this->results[] = $results;  
// no framed content  
else  
$this->results = $results;  
 
return true;  
}  
 
/*======================================================================*\  
Function: _httpsrequest  
Purpose: go get the https data from the server using curl  
Input: $url the url to fetch  
$URI the full URI  
$body body contents to send if any (POST)  
Output:  
\*======================================================================*/  
 
function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")  
{  
if($this->passcookies && $this->_redirectaddr)  
$this->setcookies();  
 
$headers = array();  
 
$URI_PARTS = parse_url($URI);  
if(empty($url))  
$url = "/";  
// GET ... header not needed for curl  
//$headers[] = $http_method." ".$url." ".$this->_httpversion;  
if(!empty($this->agent))  
$headers[] = "User-Agent: ".$this->agent;  
if(!empty($this->host))  
if(!empty($this->port))  
$headers[] = "Host: ".$this->host.":".$this->port;  
else  
$headers[] = "Host: ".$this->host;  
if(!empty($this->accept))  
$headers[] = "Accept: ".$this->accept;  
if(!empty($this->referer))  
$headers[] = "Referer: ".$this->referer;  
if(!empty($this->cookies))  
{  
if(!is_array($this->cookies))  
$this->cookies = (array)$this->cookies;  
 
reset($this->cookies);  
if ( count($this->cookies) > 0 ) {  
$cookie_str = 'Cookie: ';  
foreach ( $this->cookies as $cookieKey => $cookieVal ) {  
$cookie_str .= $cookieKey."=".urlencode($cookieVal)."; ";  
}  
$headers[] = substr($cookie_str,0,-2);  
}  
}  
if(!empty($this->rawheaders))  
{  
if(!is_array($this->rawheaders))  
$this->rawheaders = (array)$this->rawheaders;  
while(list($headerKey,$headerVal) = each($this->rawheaders))  
$headers[] = $headerKey.": ".$headerVal;  
}  
if(!empty($content_type)) {  
if ($content_type == "multipart/form-data")  
$headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;  
else  
$headers[] = "Content-type: $content_type";  
}  
if(!empty($body))  
$headers[] = "Content-length: ".strlen($body);  
if(!empty($this->user) || !empty($this->pass))  
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);  
 
for($curr_header = 0; $curr_header < count($headers); $curr_header++) {  
$safer_header = strtr( $headers[$curr_header], "\"", " " );  
$cmdline_params .= " -H \"".$safer_header."\"";  
}  
 
if(!empty($body))  
$cmdline_params .= " -d \"$body\"";  
 
if($this->read_timeout > 0)  
$cmdline_params .= " -m ".$this->read_timeout;  
 
$headerfile = tempnam($temp_dir, "sno");  
 
exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);  
 
if($return)  
{  
$this->error = "Error: cURL could not retrieve the document, error $return.";  
return false;  
}  
 
 
$results = implode("\r\n",$results);  
 
$result_headers = file("$headerfile");  
 
$this->_redirectaddr = false;  
unset($this->headers);  
 
for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)  
{  
 
// if a header begins with Location: or URI:, set the redirect  
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))  
{  
// get URL portion of the redirect  
preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches);  
// look for :// in the Location header to see if hostname is included  
if(!preg_match("|\:\/\/|",$matches[2]))  
{  
// no host in the path, so prepend  
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;  
// eliminate double slash  
if(!preg_match("|^/|",$matches[2]))  
$this->_redirectaddr .= "/".$matches[2];  
else  
$this->_redirectaddr .= $matches[2];  
}  
else  
$this->_redirectaddr = $matches[2];  
}  
 
if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))  
$this->response_code = $result_headers[$currentHeader];  
 
$this->headers[] = $result_headers[$currentHeader];  
}  
 
// check if there is a a redirect meta tag  
 
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))  
{  
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);  
}  
 
// have we hit our frame depth and is there frame src to fetch?  
if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))  
{  
$this->results[] = $results;  
for($x=0; $x<count($match[1]); $x++)  
$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);  
}  
// have we already fetched framed content?  
elseif(is_array($this->results))  
$this->results[] = $results;  
// no framed content  
else  
$this->results = $results;  
 
unlink("$headerfile");  
 
return true;  
}  
 
/*======================================================================*\  
Function: setcookies()  
Purpose: set cookies for a redirection  
\*======================================================================*/  
 
function setcookies()  
{  
for($x=0; $x<count($this->headers); $x++)  
{  
if(preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x],$match))  
$this->cookies[$match[1]] = urldecode($match[2]);  
}  
}  
 
 
/*======================================================================*\  
Function: _check_timeout  
Purpose: checks whether timeout has occurred  
Input: $fp file pointer  
\*======================================================================*/  
 
function _check_timeout($fp)  
{  
if ($this->read_timeout > 0) {  
$fp_status = socket_get_status($fp);  
if ($fp_status["timed_out"]) {  
$this->timed_out = true;  
return true;  
}  
}  
return false;  
}  
 
/*======================================================================*\  
Function: _connect  
Purpose: make a socket connection  
Input: $fp file pointer  
\*======================================================================*/  
 
function _connect(&$fp)  
{  
if(!empty($this->proxy_host) && !empty($this->proxy_port))  
{  
$this->_isproxy = true;  
 
$host = $this->proxy_host;  
$port = $this->proxy_port;  
}  
else  
{  
$host = $this->host;  
$port = $this->port;  
}  
 
$this->status = 0;  
 
if($fp = fsockopen(  
$host,  
$port,  
$errno,  
$errstr,  
$this->_fp_timeout  
))  
{  
// socket connection succeeded  
 
return true;  
}  
else  
{  
// socket connection failed  
$this->status = $errno;  
switch($errno)  
{  
case -3:  
$this->error="socket creation failed (-3)";  
case -4:  
$this->error="dns lookup failure (-4)";  
case -5:  
$this->error="connection refused or timed out (-5)";  
default:  
$this->error="connection failed (".$errno.")";  
}  
return false;  
}  
}  
/*======================================================================*\  
Function: _disconnect  
Purpose: disconnect a socket connection  
Input: $fp file pointer  
\*======================================================================*/  
 
function _disconnect($fp)  
{  
return(fclose($fp));  
}  
 
 
/*======================================================================*\  
Function: _prepare_post_body  
Purpose: Prepare post body according to encoding type  
Input: $formvars - form variables  
$formfiles - form upload files  
Output: post body  
\*======================================================================*/  
 
function _prepare_post_body($formvars, $formfiles)  
{  
settype($formvars, "array");  
settype($formfiles, "array");  
$postdata = '';  
 
if (count($formvars) == 0 && count($formfiles) == 0)  
return;  
 
switch ($this->_submit_type) {  
case "application/x-www-form-urlencoded":  
reset($formvars);  
while(list($key,$val) = each($formvars)) {  
if (is_array($val) || is_object($val)) {  
while (list($cur_key, $cur_val) = each($val)) {  
$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";  
}  
} else  
$postdata .= urlencode($key)."=".urlencode($val)."&";  
}  
break;  
 
case "multipart/form-data":  
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));  
 
reset($formvars);  
while(list($key,$val) = each($formvars)) {  
if (is_array($val) || is_object($val)) {  
while (list($cur_key, $cur_val) = each($val)) {  
$postdata .= "--".$this->_mime_boundary."\r\n";  
$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";  
$postdata .= "$cur_val\r\n";  
}  
} else {  
$postdata .= "--".$this->_mime_boundary."\r\n";  
$postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";  
$postdata .= "$val\r\n";  
}  
}  
 
reset($formfiles);  
while (list($field_name, $file_names) = each($formfiles)) {  
settype($file_names, "array");  
while (list(, $file_name) = each($file_names)) {  
if (!is_readable($file_name)) continue;  
 
$fp = fopen($file_name, "r");  
$file_content = fread($fp, filesize($file_name));  
fclose($fp);  
$base_name = basename($file_name);  
 
$postdata .= "--".$this->_mime_boundary."\r\n";  
$postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";  
$postdata .= "$file_content\r\n";  
}  
}  
$postdata .= "--".$this->_mime_boundary."--\r\n";  
break;  
}  
 
return $postdata;  
}  
}  
 
?>  
<?php  
 
/** @class: InputFilter (PHP4 & PHP5, with comments)  
* @project: PHP Input Filter  
* @date: 10-05-2005  
* @version: 1.2.2_php4/php5  
* @author: Daniel Morris  
* @contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie.  
* @copyright: Daniel Morris  
* @email: dan@rootcube.com  
* @license: GNU General Public License (GPL)  
*/  
class owa_InputFilter {  
var $tagsArray; // default = empty array  
var $attrArray; // default = empty array  
 
var $tagsMethod; // default = 0  
var $attrMethod; // default = 0  
 
var $xssAuto; // default = 1  
var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml');  
var $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc'); // also will strip ALL event handlers  
 
/**  
* Constructor for inputFilter class. Only first parameter is required.  
* @access constructor  
* @param Array $tagsArray - list of user-defined tags  
* @param Array $attrArray - list of user-defined attributes  
* @param int $tagsMethod - 0= allow just user-defined, 1= allow all but user-defined  
* @param int $attrMethod - 0= allow just user-defined, 1= allow all but user-defined  
* @param int $xssAuto - 0= only auto clean essentials, 1= allow clean blacklisted tags/attr  
*/  
function inputFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) {  
// make sure user defined arrays are in lowercase  
for ($i = 0; $i < count($tagsArray); $i++) $tagsArray[$i] = strtolower($tagsArray[$i]);  
for ($i = 0; $i < count($attrArray); $i++) $attrArray[$i] = strtolower($attrArray[$i]);  
// assign to member vars  
$this->tagsArray = (array) $tagsArray;  
$this->attrArray = (array) $attrArray;  
$this->tagsMethod = $tagsMethod;  
$this->attrMethod = $attrMethod;  
$this->xssAuto = $xssAuto;  
}  
 
/**  
* Method to be called by another php script. Processes for XSS and specified bad code.  
* @access public  
* @param Mixed $source - input string/array-of-string to be 'cleaned'  
* @return String $source - 'cleaned' version of input parameter  
*/  
function process($source) {  
// clean all elements in this array  
if (is_array($source)) {  
foreach($source as $key => $value)  
// filter element for XSS and other 'bad' code etc.  
if (is_string($value)) $source[$key] = $this->remove($this->decode($value));  
return $source;  
// clean this string  
} else if (is_string($source)) {  
// filter source for XSS and other 'bad' code etc.  
return $this->remove($this->decode($source));  
// return parameter as given  
} else return $source;  
}  
 
/**  
* Internal method to iteratively remove all unwanted tags and attributes  
* @access protected  
* @param String $source - input string to be 'cleaned'  
* @return String $source - 'cleaned' version of input parameter  
*/  
function remove($source) {  
$loopCounter=0;  
// provides nested-tag protection  
while($source != $this->filterTags($source)) {  
$source = $this->filterTags($source);  
$loopCounter++;  
}  
return $source;  
}  
 
/**  
* Internal method to strip a string of certain tags  
* @access protected  
* @param String $source - input string to be 'cleaned'  
* @return String $source - 'cleaned' version of input parameter  
*/  
function filterTags($source) {  
// filter pass setup  
$preTag = NULL;  
$postTag = $source;  
// find initial tag's position  
$tagOpen_start = strpos($source, '<');  
// interate through string until no tags left  
while($tagOpen_start !== FALSE) {  
// process tag interatively  
$preTag .= substr($postTag, 0, $tagOpen_start);  
$postTag = substr($postTag, $tagOpen_start);  
$fromTagOpen = substr($postTag, 1);  
// end of tag  
$tagOpen_end = strpos($fromTagOpen, '>');  
if ($tagOpen_end === false) break;  
// next start of tag (for nested tag assessment)  
$tagOpen_nested = strpos($fromTagOpen, '<');  
if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) {  
$preTag .= substr($postTag, 0, ($tagOpen_nested+1));  
$postTag = substr($postTag, ($tagOpen_nested+1));  
$tagOpen_start = strpos($postTag, '<');  
continue;  
}  
$tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start + 1);  
$currentTag = substr($fromTagOpen, 0, $tagOpen_end);  
$tagLength = strlen($currentTag);  
if (!$tagOpen_end) {  
$preTag .= $postTag;  
$tagOpen_start = strpos($postTag, '<');  
}  
// iterate through tag finding attribute pairs - setup  
$tagLeft = $currentTag;  
$attrSet = array();  
$currentSpace = strpos($tagLeft, ' ');  
// is end tag  
if (substr($currentTag, 0, 1) == "/") {  
$isCloseTag = TRUE;  
list($tagName) = explode(' ', $currentTag);  
$tagName = substr($tagName, 1);  
// is start tag  
} else {  
$isCloseTag = FALSE;  
list($tagName) = explode(' ', $currentTag);  
}  
// excludes all "non-regular" tagnames OR no tagname OR remove if xssauto is on and tag is blacklisted  
if ((!preg_match("/^[a-z][a-z0-9]*$/i",$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) {  
$postTag = substr($postTag, ($tagLength + 2));  
$tagOpen_start = strpos($postTag, '<');  
// don't append this tag  
continue;  
}  
// this while is needed to support attribute values with spaces in!  
while ($currentSpace !== FALSE) {  
$fromSpace = substr($tagLeft, ($currentSpace+1));  
$nextSpace = strpos($fromSpace, ' ');  
$openQuotes = strpos($fromSpace, '"');  
$closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1;  
// another equals exists  
if (strpos($fromSpace, '=') !== FALSE) {  
// opening and closing quotes exists  
if (($openQuotes !== FALSE) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== FALSE))  
$attr = substr($fromSpace, 0, ($closeQuotes+1));  
// one or neither exist  
else $attr = substr($fromSpace, 0, $nextSpace);  
// no more equals exist  
} else $attr = substr($fromSpace, 0, $nextSpace);  
// last attr pair  
if (!$attr) $attr = $fromSpace;  
// add to attribute pairs array  
$attrSet[] = $attr;  
// next inc  
$tagLeft = substr($fromSpace, strlen($attr));  
$currentSpace = strpos($tagLeft, ' ');  
}  
// appears in array specified by user  
$tagFound = in_array(strtolower($tagName), $this->tagsArray);  
// remove this tag on condition  
if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) {  
// reconstruct tag with allowed attributes  
if (!$isCloseTag) {  
$attrSet = $this->filterAttr($attrSet);  
$preTag .= '<' . $tagName;  
for ($i = 0; $i < count($attrSet); $i++)  
$preTag .= ' ' . $attrSet[$i];  
// reformat single tags to XHTML  
if (strpos($fromTagOpen, "</" . $tagName)) $preTag .= '>';  
else $preTag .= ' />';  
// just the tagname  
} else $preTag .= '</' . $tagName . '>';  
}  
// find next tag's start  
$postTag = substr($postTag, ($tagLength + 2));  
$tagOpen_start = strpos($postTag, '<');  
}  
// append any code after end of tags  
$preTag .= $postTag;  
return $preTag;  
}  
 
/**  
* Internal method to strip a tag of certain attributes  
* @access protected  
* @param Array $attrSet  
* @return Array $newSet  
*/  
function filterAttr($attrSet) {  
$newSet = array();  
// process attributes  
for ($i = 0; $i <count($attrSet); $i++) {  
// skip blank spaces in tag  
if (!$attrSet[$i]) continue;  
// split into attr name and value  
$attrSubSet = explode('=', trim($attrSet[$i]));  
list($attrSubSet[0]) = explode(' ', $attrSubSet[0]);  
// removes all "non-regular" attr names AND also attr blacklisted  
if ((!eregi("^[a-z]*$",$attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on'))))  
continue;  
// xss attr value filtering  
if ($attrSubSet[1]) {  
// strips unicode, hex, etc  
$attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]);  
// strip normal newline within attr value  
$attrSubSet[1] = preg_replace('/\s+/', '', $attrSubSet[1]);  
// strip double quotes  
$attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);  
// [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)  
if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'"))  
$attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2));  
// strip slashes  
$attrSubSet[1] = stripslashes($attrSubSet[1]);  
}  
// auto strip attr's with "javascript:  
if ( ((strpos(strtolower($attrSubSet[1]), 'expression') !== false) && (strtolower($attrSubSet[0]) == 'style')) ||  
(strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) ||  
(strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) ||  
(strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) ||  
(strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) ||  
(strpos(strtolower($attrSubSet[1]), 'livescript:') !== false)  
) continue;  
 
// if matches user defined array  
$attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray);  
// keep this attr on condition  
if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) {  
// attr has value  
if ($attrSubSet[1]) $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';  
// attr has decimal zero as value  
else if ($attrSubSet[1] == "0") $newSet[] = $attrSubSet[0] . '="0"';  
// reformat single attributes to XHTML  
else $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';  
}  
}  
return $newSet;  
}  
 
/**  
* Try to convert to plaintext  
* @access protected  
* @param String $source  
* @return String $source  
*/  
function decode($source) {  
// url decode  
$source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");  
// convert decimal  
$source = preg_replace('/&#(\d+);/me',"chr(\\1)", $source); // decimal notation  
// convert hex  
$source = preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source); // hex notation  
return $source;  
}  
 
/**  
* Method to be called by another php script. Processes for SQL injection  
* @access public  
* @param Mixed $source - input string/array-of-string to be 'cleaned'  
* @param Buffer $connection - An open MySQL connection  
* @return String $source - 'cleaned' version of input parameter  
*/  
function safeSQL($source, &$connection) {  
// clean all elements in this array  
if (is_array($source)) {  
foreach($source as $key => $value)  
// filter element for SQL injection  
if (is_string($value)) $source[$key] = $this->quoteSmart($this->decode($value), $connection);  
return $source;  
// clean this string  
} else if (is_string($source)) {  
// filter source for SQL injection  
if (is_string($source)) return $this->quoteSmart($this->decode($source), $connection);  
// return parameter as given  
} else return $source;  
}  
 
/**  
* @author Chris Tobin  
* @author Daniel Morris  
* @access protected  
* @param String $source  
* @param Resource $connection - An open MySQL connection  
* @return String $source  
*/  
function quoteSmart($source, &$connection) {  
// strip slashes  
if (get_magic_quotes_gpc()) $source = stripslashes($source);  
// quote both numeric and text  
$source = $this->escapeString($source, $connection);  
return $source;  
}  
 
/**  
* @author Chris Tobin  
* @author Daniel Morris  
* @access protected  
* @param String $source  
* @param Resource $connection - An open MySQL connection  
* @return String $source  
*/  
function escapeString($string, &$connection) {  
// depreciated function  
if (version_compare(phpversion(),"4.3.0", "<")) mysql_escape_string($string);  
// current function  
else mysql_real_escape_string($string);  
return $string;  
}  
}  
 
?>  
HTTP client PHP class  
 
This LICENSE is in the BSD license style.  
 
License Version Control:  
@(#) $Id: LICENSE.txt,v 1.1 2006/04/17 19:44:04 mlemos Exp $  
 
Copyright (c) 1999 - 2006, Manuel Lemos  
All rights reserved.  
 
Redistribution and use in source and binary forms, with or without  
modification, are permitted provided that the following conditions  
are met:  
 
Redistributions of source code must retain the above copyright  
notice, this list of conditions and the following disclaimer.  
 
Redistributions in binary form must reproduce the above copyright  
notice, this list of conditions and the following disclaimer in the  
documentation and/or other materials provided with the distribution.  
 
Neither the name of Manuel Lemos nor the names of his contributors  
may be used to endorse or promote products derived from this software  
without specific prior written permission.  
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR  
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
 
<?php  
/*  
* http.php  
*  
* @(#) $Header: /home/mlemos/cvsroot/http/http.php,v 1.79 2009/09/03 00:09:37 mlemos Exp $  
*  
*/  
 
class http_class  
{  
var $host_name="";  
var $host_port=0;  
var $proxy_host_name="";  
var $proxy_host_port=80;  
var $socks_host_name = '';  
var $socks_host_port = 1080;  
var $socks_version = '5';  
 
var $protocol="http";  
var $request_method="GET";  
var $user_agent='httpclient (http://www.phpclasses.org/httpclient $Revision: 1.79 $)';  
var $authentication_mechanism="";  
var $user;  
var $password;  
var $realm;  
var $workstation;  
var $proxy_authentication_mechanism="";  
var $proxy_user;  
var $proxy_password;  
var $proxy_realm;  
var $proxy_workstation;  
var $request_uri="";  
var $request="";  
var $request_headers=array();  
var $request_user;  
var $request_password;  
var $request_realm;  
var $request_workstation;  
var $proxy_request_user;  
var $proxy_request_password;  
var $proxy_request_realm;  
var $proxy_request_workstation;  
var $request_body="";  
var $request_arguments=array();  
var $protocol_version="1.1";  
var $timeout=0;  
var $data_timeout=0;  
var $debug=0;  
var $debug_response_body=1;  
var $html_debug=0;  
var $support_cookies=1;  
var $cookies=array();  
var $error="";  
var $exclude_address="";  
var $follow_redirect=0;  
var $redirection_limit=5;  
var $response_status="";  
var $response_message="";  
var $file_buffer_length=8000;  
var $force_multipart_form_post=0;  
var $prefer_curl = 0;  
 
/* private variables - DO NOT ACCESS */  
 
var $state="Disconnected";  
var $use_curl=0;  
var $connection=0;  
var $content_length=0;  
var $response="";  
var $read_response=0;  
var $read_length=0;  
var $request_host="";  
var $next_token="";  
var $redirection_level=0;  
var $chunked=0;  
var $remaining_chunk=0;  
var $last_chunk_read=0;  
var $months=array(  
"Jan"=>"01",  
"Feb"=>"02",  
"Mar"=>"03",  
"Apr"=>"04",  
"May"=>"05",  
"Jun"=>"06",  
"Jul"=>"07",  
"Aug"=>"08",  
"Sep"=>"09",  
"Oct"=>"10",  
"Nov"=>"11",  
"Dec"=>"12");  
var $session='';  
var $connection_close=0;  
 
/* Private methods - DO NOT CALL */  
 
Function Tokenize($string,$separator="")  
{  
if(!strcmp($separator,""))  
{  
$separator=$string;  
$string=$this->next_token;  
}  
for($character=0;$character<strlen($separator);$character++)  
{  
if(GetType($position=strpos($string,$separator[$character]))=="integer")  
$found=(IsSet($found) ? min($found,$position) : $position);  
}  
if(IsSet($found))  
{  
$this->next_token=substr($string,$found+1);  
return(substr($string,0,$found));  
}  
else  
{  
$this->next_token="";  
return($string);  
}  
}  
 
Function CookieEncode($value, $name)  
{  
return($name ? str_replace("=", "%25", $value) : str_replace(";", "%3B", $value));  
}  
 
Function SetError($error)  
{  
return($this->error=$error);  
}  
 
Function SetPHPError($error, &$php_error_message)  
{  
if(IsSet($php_error_message)  
&& strlen($php_error_message))  
$error.=": ".$php_error_message;  
return($this->SetError($error));  
}  
 
Function SetDataAccessError($error,$check_connection=0)  
{  
$this->error=$error;  
if(!$this->use_curl  
&& function_exists("socket_get_status"))  
{  
$status=socket_get_status($this->connection);  
if($status["timed_out"])  
$this->error.=": data access time out";  
elseif($status["eof"])  
{  
if($check_connection)  
$this->error="";  
else  
$this->error.=": the server disconnected";  
}  
}  
}  
 
Function OutputDebug($message)  
{  
$message.="\n";  
if($this->html_debug)  
$message=str_replace("\n","<br />\n",HtmlEntities($message));  
echo $message;  
flush();  
}  
 
Function GetLine()  
{  
for($line="";;)  
{  
if($this->use_curl)  
{  
$eol=strpos($this->response,"\n",$this->read_response);  
$data=($eol ? substr($this->response,$this->read_response,$eol+1-$this->read_response) : "");  
$this->read_response+=strlen($data);  
}  
else  
{  
if(feof($this->connection))  
{  
$this->SetDataAccessError("reached the end of data while reading from the HTTP server connection");  
return(0);  
}  
$data=fgets($this->connection,100);  
}  
if(GetType($data)!="string"  
|| strlen($data)==0)  
{  
$this->SetDataAccessError("it was not possible to read line from the HTTP server");  
return(0);  
}  
$line.=$data;  
$length=strlen($line);  
if($length  
&& !strcmp(substr($line,$length-1,1),"\n"))  
{  
$length-=(($length>=2 && !strcmp(substr($line,$length-2,1),"\r")) ? 2 : 1);  
$line=substr($line,0,$length);  
if($this->debug)  
$this->OutputDebug("S $line");  
return($line);  
}  
}  
}  
 
Function PutLine($line)  
{  
if($this->debug)  
$this->OutputDebug("C $line");  
if(!fputs($this->connection,$line."\r\n"))  
{  
$this->SetDataAccessError("it was not possible to send a line to the HTTP server");  
return(0);  
}  
return(1);  
}  
 
Function PutData($data)  
{  
if(strlen($data))  
{  
if($this->debug)  
$this->OutputDebug('C '.$data);  
if(!fputs($this->connection,$data))  
{  
$this->SetDataAccessError("it was not possible to send data to the HTTP server");  
return(0);  
}  
}  
return(1);  
}  
 
Function FlushData()  
{  
if(!fflush($this->connection))  
{  
$this->SetDataAccessError("it was not possible to send data to the HTTP server");  
return(0);  
}  
return(1);  
}  
 
Function ReadChunkSize()  
{  
if($this->remaining_chunk==0)  
{  
$debug=$this->debug;  
if(!$this->debug_response_body)  
$this->debug=0;  
$line=$this->GetLine();  
$this->debug=$debug;  
if(GetType($line)!="string")  
return($this->SetError("4 could not read chunk start: ".$this->error));  
$this->remaining_chunk=hexdec($line);  
}  
return("");  
}  
 
Function ReadBytes($length)  
{  
if($this->use_curl)  
{  
$bytes=substr($this->response,$this->read_response,min($length,strlen($this->response)-$this->read_response));  
$this->read_response+=strlen($bytes);  
if($this->debug  
&& $this->debug_response_body  
&& strlen($bytes))  
$this->OutputDebug("S ".$bytes);  
}  
else  
{  
if($this->chunked)  
{  
for($bytes="",$remaining=$length;$remaining;)  
{  
if(strlen($this->ReadChunkSize()))  
return("");  
if($this->remaining_chunk==0)  
{  
$this->last_chunk_read=1;  
break;  
}  
$ask=min($this->remaining_chunk,$remaining);  
$chunk=@fread($this->connection,$ask);  
$read=strlen($chunk);  
if($read==0)  
{  
$this->SetDataAccessError("it was not possible to read data chunk from the HTTP server");  
return("");  
}  
if($this->debug  
&& $this->debug_response_body)  
$this->OutputDebug("S ".$chunk);  
$bytes.=$chunk;  
$this->remaining_chunk-=$read;  
$remaining-=$read;  
if($this->remaining_chunk==0)  
{  
if(feof($this->connection))  
return($this->SetError("reached the end of data while reading the end of data chunk mark from the HTTP server"));  
$data=@fread($this->connection,2);  
if(strcmp($data,"\r\n"))  
{  
$this->SetDataAccessError("it was not possible to read end of data chunk from the HTTP server");  
return("");  
}  
}  
}  
}  
else  
{  
$bytes=@fread($this->connection,$length);  
if(strlen($bytes))  
{  
if($this->debug  
&& $this->debug_response_body)  
$this->OutputDebug("S ".$bytes);  
}  
else  
$this->SetDataAccessError("it was not possible to read data from the HTTP server", $this->connection_close);  
}  
}  
return($bytes);  
}  
 
Function EndOfInput()  
{  
if($this->use_curl)  
return($this->read_response>=strlen($this->response));  
if($this->chunked)  
return($this->last_chunk_read);  
return(feof($this->connection));  
}  
 
Function Resolve($domain, &$ip, $server_type)  
{  
if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',$domain))  
$ip=$domain;  
else  
{  
if($this->debug)  
$this->OutputDebug('Resolving '.$server_type.' server domain "'.$domain.'"...');  
if(!strcmp($ip=@gethostbyname($domain),$domain))  
$ip="";  
}  
if(strlen($ip)==0  
|| (strlen($this->exclude_address)  
&& !strcmp(@gethostbyname($this->exclude_address),$ip)))  
return($this->SetError("could not resolve the host domain \"".$domain."\""));  
return('');  
}  
 
Function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP')  
{  
$domain=$host_name;  
$port = $host_port;  
if(strlen($error = $this->Resolve($domain, $ip, $server_type)))  
return($error);  
if(strlen($this->socks_host_name))  
{  
switch($this->socks_version)  
{  
case '4':  
$version = 4;  
break;  
case '5':  
$version = 5;  
break;  
default:  
return('it was not specified a supported SOCKS protocol version');  
break;  
}  
$host_ip = $ip;  
$port = $this->socks_host_port;  
$host_server_type = $server_type;  
$server_type = 'SOCKS';  
if(strlen($error = $this->Resolve($this->socks_host_name, $ip, $server_type)))  
return($error);  
}  
if($this->debug)  
$this->OutputDebug('Connecting to '.$server_type.' server IP '.$ip.' port '.$port.'...');  
if($ssl)  
$ip="ssl://".$ip;  
if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)  
{  
switch($errno)  
{  
case -3:  
return($this->SetError("-3 socket could not be created"));  
case -4:  
return($this->SetError("-4 dns lookup on hostname \"".$host_name."\" failed"));  
case -5:  
return($this->SetError("-5 connection refused or timed out"));  
case -6:  
return($this->SetError("-6 fdopen() call failed"));  
case -7:  
return($this->SetError("-7 setvbuf() call failed"));  
default:  
return($this->SetPHPError($errno." could not connect to the host \"".$host_name."\"",$php_errormsg));  
}  
}  
else  
{  
if($this->data_timeout  
&& function_exists("socket_set_timeout"))  
socket_set_timeout($this->connection,$this->data_timeout,0);  
if(strlen($this->socks_host_name))  
{  
if($this->debug)  
$this->OutputDebug('Connected to the SOCKS server '.$this->socks_host_name);  
$send_error = 'it was not possible to send data to the SOCKS server';  
$receive_error = 'it was not possible to receive data from the SOCKS server';  
switch($version)  
{  
case 4:  
$command = 1;  
if(!fputs($this->connection, chr($version).chr($command).pack('nN', $host_port, ip2long($host_ip)).$this->user.Chr(0)))  
$error = $this->SetDataAccessError($send_error);  
else  
{  
$response = fgets($this->connection, 9);  
if(strlen($response) != 8)  
$error = $this->SetDataAccessError($receive_error);  
else  
{  
$socks_errors = array(  
"\x5a"=>'',  
"\x5b"=>'request rejected',  
"\x5c"=>'request failed because client is not running identd (or not reachable from the server)',  
"\x5d"=>'request failed because client\'s identd could not confirm the user ID string in the request',  
);  
$error_code = $response[1];  
$error = (IsSet($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown');  
if(strlen($error))  
$error = 'SOCKS error: '.$error;  
}  
}  
break;  
case 5:  
if($this->debug)  
$this->OutputDebug('Negotiating the authentication method ...');  
$methods = 1;  
$method = 0;  
if(!fputs($this->connection, chr($version).chr($methods).chr($method)))  
$error = $this->SetDataAccessError($send_error);  
else  
{  
$response = fgets($this->connection, 3);  
if(strlen($response) != 2)  
$error = $this->SetDataAccessError($receive_error);  
elseif(Ord($response[1]) != $method)  
$error = 'the SOCKS server requires an authentication method that is not yet supported';  
else  
{  
if($this->debug)  
$this->OutputDebug('Connecting to '.$host_server_type.' server IP '.$host_ip.' port '.$host_port.'...');  
$command = 1;  
$address_type = 1;  
if(!fputs($this->connection, chr($version).chr($command)."\x00".chr($address_type).pack('Nn', ip2long($host_ip), $host_port)))  
$error = $this->SetDataAccessError($send_error);  
else  
{  
$response = fgets($this->connection, 11);  
if(strlen($response) != 10)  
$error = $this->SetDataAccessError($receive_error);  
else  
{  
$socks_errors = array(  
"\x00"=>'',  
"\x01"=>'general SOCKS server failure',  
"\x02"=>'connection not allowed by ruleset',  
"\x03"=>'Network unreachable',  
"\x04"=>'Host unreachable',  
"\x05"=>'Connection refused',  
"\x06"=>'TTL expired',  
"\x07"=>'Command not supported',  
"\x08"=>'Address type not supported'  
);  
$error_code = $response[1];  
$error = (IsSet($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown');  
if(strlen($error))  
$error = 'SOCKS error: '.$error;  
}  
}  
}  
}  
break;  
default:  
$error = 'support for SOCKS protocol version '.$this->socks_version.' is not yet implemented';  
break;  
}  
if(strlen($error))  
{  
fclose($this->connection);  
return($error);  
}  
}  
if($this->debug)  
$this->OutputDebug("Connected to $host_name");  
if(strlen($this->proxy_host_name)  
&& !strcmp(strtolower($this->protocol), 'https'))  
{  
if(function_exists('stream_socket_enable_crypto')  
&& in_array('ssl', stream_get_transports()))  
$this->state = "ConnectedToProxy";  
else  
{  
$this->OutputDebug("It is not possible to start SSL after connecting to the proxy server. If the proxy refuses to forward the SSL request, you may need to upgrade to PHP 5.1 or later with OpenSSL support enabled.");  
$this->state="Connected";  
}  
}  
else  
$this->state="Connected";  
return("");  
}  
}  
 
Function Disconnect()  
{  
if($this->debug)  
$this->OutputDebug("Disconnected from ".$this->host_name);  
if($this->use_curl)  
{  
curl_close($this->connection);  
$this->response="";  
}  
else  
fclose($this->connection);  
$this->state="Disconnected";  
return("");  
}  
 
/* Public methods */  
 
Function GetRequestArguments($url, &$arguments)  
{  
$this->error = '';  
$arguments=array();  
$url = str_replace(' ', '%20', $url);  
$parameters=@parse_url($url);  
if(!$parameters)  
return($this->SetError("it was not specified a valid URL"));  
if(!IsSet($parameters["scheme"]))  
return($this->SetError("it was not specified the protocol type argument"));  
switch(strtolower($parameters["scheme"]))  
{  
case "http":  
case "https":  
$arguments["Protocol"]=$parameters["scheme"];  
break;  
default:  
return($parameters["scheme"]." connection scheme is not yet supported");  
}  
if(!IsSet($parameters["host"]))  
return($this->SetError("it was not specified the connection host argument"));  
$arguments["HostName"]=$parameters["host"];  
$arguments["Headers"]=array("Host"=>$parameters["host"].(IsSet($parameters["port"]) ? ":".$parameters["port"] : ""));  
if(IsSet($parameters["user"]))  
{  
$arguments["AuthUser"]=UrlDecode($parameters["user"]);  
if(!IsSet($parameters["pass"]))  
$arguments["AuthPassword"]="";  
}  
if(IsSet($parameters["pass"]))  
{  
if(!IsSet($parameters["user"]))  
$arguments["AuthUser"]="";  
$arguments["AuthPassword"]=UrlDecode($parameters["pass"]);  
}  
if(IsSet($parameters["port"]))  
{  
if(strcmp($parameters["port"],strval(intval($parameters["port"]))))  
return($this->SetError("it was not specified a valid connection host argument"));  
$arguments["HostPort"]=intval($parameters["port"]);  
}  
else  
$arguments["HostPort"]=0;  
$arguments["RequestURI"]=(IsSet($parameters["path"]) ? $parameters["path"] : "/").(IsSet($parameters["query"]) ? "?".$parameters["query"] : "");  
if(strlen($this->user_agent))  
$arguments["Headers"]["User-Agent"]=$this->user_agent;  
return("");  
}  
 
Function Open($arguments)  
{  
if(strlen($this->error))  
return($this->error);  
if($this->state!="Disconnected")  
return("1 already connected");  
if(IsSet($arguments["HostName"]))  
$this->host_name=$arguments["HostName"];  
if(IsSet($arguments["HostPort"]))  
$this->host_port=$arguments["HostPort"];  
if(IsSet($arguments["ProxyHostName"]))  
$this->proxy_host_name=$arguments["ProxyHostName"];  
if(IsSet($arguments["ProxyHostPort"]))  
$this->proxy_host_port=$arguments["ProxyHostPort"];  
if(IsSet($arguments["SOCKSHostName"]))  
$this->socks_host_name=$arguments["SOCKSHostName"];  
if(IsSet($arguments["SOCKSHostPort"]))  
$this->socks_host_port=$arguments["SOCKSHostPort"];  
if(IsSet($arguments["SOCKSVersion"]))  
$this->socks_version=$arguments["SOCKSVersion"];  
if(IsSet($arguments["Protocol"]))  
$this->protocol=$arguments["Protocol"];  
switch(strtolower($this->protocol))  
{  
case "http":  
$default_port=80;  
break;  
case "https":  
$default_port=443;  
break;  
default:  
return($this->SetError("2 it was not specified a valid connection protocol"));  
}  
if(strlen($this->proxy_host_name)==0)  
{  
if(strlen($this->host_name)==0)  
return($this->SetError("2 it was not specified a valid hostname"));  
$host_name=$this->host_name;  
$host_port=($this->host_port ? $this->host_port : $default_port);  
$server_type = 'HTTP';  
}  
else  
{  
$host_name=$this->proxy_host_name;  
$host_port=$this->proxy_host_port;  
$server_type = 'HTTP proxy';  
}  
$ssl=(strtolower($this->protocol)=="https" && strlen($this->proxy_host_name)==0);  
if($ssl  
&& strlen($this->socks_host_name))  
return($this->SetError('establishing SSL connections via a SOCKS server is not yet supported'));  
$this->use_curl=($ssl && $this->prefer_curl && function_exists("curl_init"));  
if($this->debug)  
$this->OutputDebug("Connecting to ".$this->host_name);  
if($this->use_curl)  
{  
$error=(($this->connection=curl_init($this->protocol."://".$this->host_name.($host_port==$default_port ? "" : ":".strval($host_port))."/")) ? "" : "Could not initialize a CURL session");  
if(strlen($error)==0)  
{  
if(IsSet($arguments["SSLCertificateFile"]))  
curl_setopt($this->connection,CURLOPT_SSLCERT,$arguments["SSLCertificateFile"]);  
if(IsSet($arguments["SSLCertificatePassword"]))  
curl_setopt($this->connection,CURLOPT_SSLCERTPASSWD,$arguments["SSLCertificatePassword"]);  
if(IsSet($arguments["SSLKeyFile"]))  
curl_setopt($this->connection,CURLOPT_SSLKEY,$arguments["SSLKeyFile"]);  
if(IsSet($arguments["SSLKeyPassword"]))  
curl_setopt($this->connection,CURLOPT_SSLKEYPASSWD,$arguments["SSLKeyPassword"]);  
}  
$this->state="Connected";  
}  
else  
{  
$error="";  
if(strlen($this->proxy_host_name)  
&& (IsSet($arguments["SSLCertificateFile"])  
|| IsSet($arguments["SSLCertificateFile"])))  
$error="establishing SSL connections using certificates or private keys via non-SSL proxies is not supported";  
else  
{  
if($ssl)  
{  
if(IsSet($arguments["SSLCertificateFile"]))  
$error="establishing SSL connections using certificates is only supported when the cURL extension is enabled";  
elseif(IsSet($arguments["SSLKeyFile"]))  
$error="establishing SSL connections using a private key is only supported when the cURL extension is enabled";  
else  
{  
$version=explode(".",function_exists("phpversion") ? phpversion() : "3.0.7");  
$php_version=intval($version[0])*1000000+intval($version[1])*1000+intval($version[2]);  
if($php_version<4003000)  
$error="establishing SSL connections requires at least PHP version 4.3.0 or having the cURL extension enabled";  
elseif(!function_exists("extension_loaded")  
|| !extension_loaded("openssl"))  
$error="establishing SSL connections requires the OpenSSL extension enabled";  
}  
}  
if(strlen($error)==0)  
$error=$this->Connect($host_name, $host_port, $ssl, $server_type);  
}  
}  
if(strlen($error))  
return($this->SetError($error));  
$this->session=md5(uniqid(""));  
return("");  
}  
 
Function Close()  
{  
if($this->state=="Disconnected")  
return("1 already disconnected");  
$error=$this->Disconnect();  
if(strlen($error)==0)  
$this->state="Disconnected";  
return($error);  
}  
 
Function PickCookies(&$cookies,$secure)  
{  
if(IsSet($this->cookies[$secure]))  
{  
$now=gmdate("Y-m-d H-i-s");  
for($domain=0,Reset($this->cookies[$secure]);$domain<count($this->cookies[$secure]);Next($this->cookies[$secure]),$domain++)  
{  
$domain_pattern=Key($this->cookies[$secure]);  
$match=strlen($this->request_host)-strlen($domain_pattern);  
if($match>=0  
&& !strcmp($domain_pattern,substr($this->request_host,$match))  
&& ($match==0  
|| $domain_pattern[0]=="."  
|| $this->request_host[$match-1]=="."))  
{  
for(Reset($this->cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($this->cookies[$secure][$domain_pattern]);Next($this->cookies[$secure][$domain_pattern]),$path_part++)  
{  
$path=Key($this->cookies[$secure][$domain_pattern]);  
if(strlen($this->request_uri)>=strlen($path)  
&& substr($this->request_uri,0,strlen($path))==$path)  
{  
for(Reset($this->cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($this->cookies[$secure][$domain_pattern][$path]);Next($this->cookies[$secure][$domain_pattern][$path]),$cookie++)  
{  
$cookie_name=Key($this->cookies[$secure][$domain_pattern][$path]);  
$expires=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"];  
if($expires==""  
|| strcmp($now,$expires)<0)  
$cookies[$cookie_name]=$this->cookies[$secure][$domain_pattern][$path][$cookie_name];  
}  
}  
}  
}  
}  
}  
}  
 
Function GetFileDefinition($file, &$definition)  
{  
$name="";  
if(IsSet($file["FileName"]))  
$name=basename($file["FileName"]);  
if(IsSet($file["Name"]))  
$name=$file["Name"];  
if(strlen($name)==0)  
return("it was not specified the file part name");  
if(IsSet($file["Content-Type"]))  
{  
$content_type=$file["Content-Type"];  
$type=$this->Tokenize(strtolower($content_type),"/");  
$sub_type=$this->Tokenize("");  
switch($type)  
{  
case "text":  
case "image":  
case "audio":  
case "video":  
case "application":  
case "message":  
break;  
case "automatic":  
switch($sub_type)  
{  
case "name":  
switch(GetType($dot=strrpos($name,"."))=="integer" ? strtolower(substr($name,$dot)) : "")  
{  
case ".xls":  
$content_type="application/excel";  
break;  
case ".hqx":  
$content_type="application/macbinhex40";  
break;  
case ".doc":  
case ".dot":  
case ".wrd":  
$content_type="application/msword";  
break;  
case ".pdf":  
$content_type="application/pdf";  
break;  
case ".pgp":  
$content_type="application/pgp";  
break;  
case ".ps":  
case ".eps":  
case ".ai":  
$content_type="application/postscript";  
break;  
case ".ppt":  
$content_type="application/powerpoint";  
break;  
case ".rtf":  
$content_type="application/rtf";  
break;  
case ".tgz":  
case ".gtar":  
$content_type="application/x-gtar";  
break;  
case ".gz":  
$content_type="application/x-gzip";  
break;  
case ".php":  
case ".php3":  
$content_type="application/x-httpd-php";  
break;  
case ".js":  
$content_type="application/x-javascript";  
break;  
case ".ppd":  
case ".psd":  
$content_type="application/x-photoshop";  
break;  
case ".swf":  
case ".swc":  
case ".rf":  
$content_type="application/x-shockwave-flash";  
break;  
case ".tar":  
$content_type="application/x-tar";  
break;  
case ".zip":  
$content_type="application/zip";  
break;  
case ".mid":  
case ".midi":  
case ".kar":  
$content_type="audio/midi";  
break;  
case ".mp2":  
case ".mp3":  
case ".mpga":  
$content_type="audio/mpeg";  
break;  
case ".ra":  
$content_type="audio/x-realaudio";  
break;  
case ".wav":  
$content_type="audio/wav";  
break;  
case ".bmp":  
$content_type="image/bitmap";  
break;  
case ".gif":  
$content_type="image/gif";  
break;  
case ".iff":  
$content_type="image/iff";  
break;  
case ".jb2":  
$content_type="image/jb2";  
break;  
case ".jpg":  
case ".jpe":  
case ".jpeg":  
$content_type="image/jpeg";  
break;  
case ".jpx":  
$content_type="image/jpx";  
break;  
case ".png":  
$content_type="image/png";  
break;  
case ".tif":  
case ".tiff":  
$content_type="image/tiff";  
break;  
case ".wbmp":  
$content_type="image/vnd.wap.wbmp";  
break;  
case ".xbm":  
$content_type="image/xbm";  
break;  
case ".css":  
$content_type="text/css";  
break;  
case ".txt":  
$content_type="text/plain";  
break;  
case ".htm":  
case ".html":  
$content_type="text/html";  
break;  
case ".xml":  
$content_type="text/xml";  
break;  
case ".mpg":  
case ".mpe":  
case ".mpeg":  
$content_type="video/mpeg";  
break;  
case ".qt":  
case ".mov":  
$content_type="video/quicktime";  
break;  
case ".avi":  
$content_type="video/x-ms-video";  
break;  
case ".eml":  
$content_type="message/rfc822";  
break;  
default:  
$content_type="application/octet-stream";  
break;  
}  
break;  
default:  
return($content_type." is not a supported automatic content type detection method");  
}  
break;  
default:  
return($content_type." is not a supported file content type");  
}  
}  
else  
$content_type="application/octet-stream";  
$definition=array(  
"Content-Type"=>$content_type,  
"NAME"=>$name  
);  
if(IsSet($file["FileName"]))  
{  
if(GetType($length=@filesize($file["FileName"]))!="integer")  
{  
$error="it was not possible to determine the length of the file ".$file["FileName"];  
if(IsSet($php_errormsg)  
&& strlen($php_errormsg))  
$error.=": ".$php_errormsg;  
if(!file_exists($file["FileName"]))  
$error="it was not possible to access the file ".$file["FileName"];  
return($error);  
}  
$definition["FILENAME"]=$file["FileName"];  
$definition["Content-Length"]=$length;  
}  
elseif(IsSet($file["Data"]))  
$definition["Content-Length"]=strlen($definition["DATA"]=$file["Data"]);  
else  
return("it was not specified a valid file name");  
return("");  
}  
 
Function ConnectFromProxy($arguments, &$headers)  
{  
if(!$this->PutLine('CONNECT '.$this->host_name.':'.($this->host_port ? $this->host_port : 443).' HTTP/1.0')  
|| (strlen($this->user_agent)  
&& !$this->PutLine('User-Agent: '.$this->user_agent))  
|| (IsSet($arguments['Headers']['Proxy-Authorization'])  
&& !$this->PutLine('Proxy-Authorization: '.$arguments['Headers']['Proxy-Authorization']))  
|| !$this->PutLine(''))  
{  
$this->Disconnect();  
return($this->error);  
}  
$this->state = "ConnectSent";  
if(strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($error);  
$proxy_authorization="";  
while(!strcmp($this->response_status, "100"))  
{  
$this->state="ConnectSent";  
if(strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($error);  
}  
switch($this->response_status)  
{  
case "200":  
if(!@stream_socket_enable_crypto($this->connection, 1, STREAM_CRYPTO_METHOD_SSLv23_CLIENT))  
{  
$this->SetPHPError('it was not possible to start a SSL encrypted connection via this proxy', $php_errormsg);  
$this->Disconnect();  
return($this->error);  
}  
$this->state = "Connected";  
break;  
case "407":  
if(strlen($error=$this->Authenticate($headers, -1, $proxy_authorization, $this->proxy_request_user, $this->proxy_request_password, $this->proxy_request_realm, $this->proxy_request_workstation)))  
return($error);  
break;  
default:  
return($this->SetError("unable to send request via proxy"));  
}  
return("");  
}  
 
Function SendRequest($arguments)  
{  
if(strlen($this->error))  
return($this->error);  
if(IsSet($arguments["ProxyUser"]))  
$this->proxy_request_user=$arguments["ProxyUser"];  
elseif(IsSet($this->proxy_user))  
$this->proxy_request_user=$this->proxy_user;  
if(IsSet($arguments["ProxyPassword"]))  
$this->proxy_request_password=$arguments["ProxyPassword"];  
elseif(IsSet($this->proxy_password))  
$this->proxy_request_password=$this->proxy_password;  
if(IsSet($arguments["ProxyRealm"]))  
$this->proxy_request_realm=$arguments["ProxyRealm"];  
elseif(IsSet($this->proxy_realm))  
$this->proxy_request_realm=$this->proxy_realm;  
if(IsSet($arguments["ProxyWorkstation"]))  
$this->proxy_request_workstation=$arguments["ProxyWorkstation"];  
elseif(IsSet($this->proxy_workstation))  
$this->proxy_request_workstation=$this->proxy_workstation;  
switch($this->state)  
{  
case "Disconnected":  
return($this->SetError("1 connection was not yet established"));  
case "Connected":  
$connect = 0;  
break;  
case "ConnectedToProxy":  
if(strlen($error = $this->ConnectFromProxy($arguments, $headers)))  
return($error);  
$connect = 1;  
break;  
default:  
return($this->SetError("2 can not send request in the current connection state"));  
}  
if(IsSet($arguments["RequestMethod"]))  
$this->request_method=$arguments["RequestMethod"];  
if(IsSet($arguments["User-Agent"]))  
$this->user_agent=$arguments["User-Agent"];  
if(!IsSet($arguments["Headers"]["User-Agent"])  
&& strlen($this->user_agent))  
$arguments["Headers"]["User-Agent"]=$this->user_agent;  
if(strlen($this->request_method)==0)  
return($this->SetError("3 it was not specified a valid request method"));  
if(IsSet($arguments["RequestURI"]))  
$this->request_uri=$arguments["RequestURI"];  
if(strlen($this->request_uri)==0  
|| substr($this->request_uri,0,1)!="/")  
return($this->SetError("4 it was not specified a valid request URI"));  
$this->request_arguments=$arguments;  
$this->request_headers=(IsSet($arguments["Headers"]) ? $arguments["Headers"] : array());  
$body_length=0;  
$this->request_body="";  
$get_body=1;  
if($this->request_method=="POST"  
|| $this->request_method=="PUT")  
{  
if(IsSet($arguments['StreamRequest']))  
{  
$get_body = 0;  
$this->request_headers["Transfer-Encoding"]="chunked";  
}  
elseif(IsSet($arguments["PostFiles"])  
|| ($this->force_multipart_form_post  
&& IsSet($arguments["PostValues"])))  
{  
$boundary="--".md5(uniqid(time()));  
$this->request_headers["Content-Type"]="multipart/form-data; boundary=".$boundary.(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : "");  
$post_parts=array();  
if(IsSet($arguments["PostValues"]))  
{  
$values=$arguments["PostValues"];  
if(GetType($values)!="array")  
return($this->SetError("5 it was not specified a valid POST method values array"));  
for(Reset($values),$value=0;$value<count($values);Next($values),$value++)  
{  
$input=Key($values);  
$headers="--".$boundary."\r\nContent-Disposition: form-data; name=\"".$input."\"\r\n\r\n";  
$data=$values[$input];  
$post_parts[]=array("HEADERS"=>$headers,"DATA"=>$data);  
$body_length+=strlen($headers)+strlen($data)+strlen("\r\n");  
}  
}  
$body_length+=strlen("--".$boundary."--\r\n");  
$files=(IsSet($arguments["PostFiles"]) ? $arguments["PostFiles"] : array());  
Reset($files);  
$end=(GetType($input=Key($files))!="string");  
for(;!$end;)  
{  
if(strlen($error=$this->GetFileDefinition($files[$input],$definition)))  
return("3 ".$error);  
$headers="--".$boundary."\r\nContent-Disposition: form-data; name=\"".$input."\"; filename=\"".$definition["NAME"]."\"\r\nContent-Type: ".$definition["Content-Type"]."\r\n\r\n";  
$part=count($post_parts);  
$post_parts[$part]=array("HEADERS"=>$headers);  
if(IsSet($definition["FILENAME"]))  
{  
$post_parts[$part]["FILENAME"]=$definition["FILENAME"];  
$data="";  
}  
else  
$data=$definition["DATA"];  
$post_parts[$part]["DATA"]=$data;  
$body_length+=strlen($headers)+$definition["Content-Length"]+strlen("\r\n");  
Next($files);  
$end=(GetType($input=Key($files))!="string");  
}  
$get_body=0;  
}  
elseif(IsSet($arguments["PostValues"]))  
{  
$values=$arguments["PostValues"];  
if(GetType($values)!="array")  
return($this->SetError("5 it was not specified a valid POST method values array"));  
for(Reset($values),$value=0;$value<count($values);Next($values),$value++)  
{  
$k=Key($values);  
if(GetType($values[$k])=="array")  
{  
for($v = 0; $v < count($values[$k]); $v++)  
{  
if($value+$v>0)  
$this->request_body.="&";  
$this->request_body.=UrlEncode($k)."=".UrlEncode($values[$k][$v]);  
}  
}  
else  
{  
if($value>0)  
$this->request_body.="&";  
$this->request_body.=UrlEncode($k)."=".UrlEncode($values[$k]);  
}  
}  
$this->request_headers["Content-Type"]="application/x-www-form-urlencoded".(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : "");  
$get_body=0;  
}  
}  
if($get_body  
&& (IsSet($arguments["Body"])  
|| IsSet($arguments["BodyStream"])))  
{  
if(IsSet($arguments["Body"]))  
$this->request_body=$arguments["Body"];  
else  
{  
$stream=$arguments["BodyStream"];  
$this->request_body="";  
for($part=0; $part<count($stream); $part++)  
{  
if(IsSet($stream[$part]["Data"]))  
$this->request_body.=$stream[$part]["Data"];  
elseif(IsSet($stream[$part]["File"]))  
{  
if(!($file=@fopen($stream[$part]["File"],"rb")))  
return($this->SetPHPError("could not open upload file ".$stream[$part]["File"], $php_errormsg));  
while(!feof($file))  
{  
if(GetType($block=@fread($file,$this->file_buffer_length))!="string")  
{  
$error=$this->SetPHPError("could not read body stream file ".$stream[$part]["File"], $php_errormsg);  
fclose($file);  
return($error);  
}  
$this->request_body.=$block;  
}  
fclose($file);  
}  
else  
return("5 it was not specified a valid file or data body stream element at position ".$part);  
}  
}  
if(!IsSet($this->request_headers["Content-Type"]))  
$this->request_headers["Content-Type"]="application/octet-stream".(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : "");  
}  
if(IsSet($arguments["AuthUser"]))  
$this->request_user=$arguments["AuthUser"];  
elseif(IsSet($this->user))  
$this->request_user=$this->user;  
if(IsSet($arguments["AuthPassword"]))  
$this->request_password=$arguments["AuthPassword"];  
elseif(IsSet($this->password))  
$this->request_password=$this->password;  
if(IsSet($arguments["AuthRealm"]))  
$this->request_realm=$arguments["AuthRealm"];  
elseif(IsSet($this->realm))  
$this->request_realm=$this->realm;  
if(IsSet($arguments["AuthWorkstation"]))  
$this->request_workstation=$arguments["AuthWorkstation"];  
elseif(IsSet($this->workstation))  
$this->request_workstation=$this->workstation;  
if(strlen($this->proxy_host_name)==0  
|| $connect)  
$request_uri=$this->request_uri;  
else  
{  
switch(strtolower($this->protocol))  
{  
case "http":  
$default_port=80;  
break;  
case "https":  
$default_port=443;  
break;  
}  
$request_uri=strtolower($this->protocol)."://".$this->host_name.(($this->host_port==0 || $this->host_port==$default_port) ? "" : ":".$this->host_port).$this->request_uri;  
}  
if($this->use_curl)  
{  
$version=(GetType($v=curl_version())=="array" ? (IsSet($v["version"]) ? $v["version"] : "0.0.0") : (preg_match("/^libcurl\\/([0-9]+\\.[0-9]+\\.[0-9]+)/",$v,$m) ? $m[1] : "0.0.0"));  
$curl_version=100000*intval($this->Tokenize($version,"."))+1000*intval($this->Tokenize("."))+intval($this->Tokenize(""));  
$protocol_version=($curl_version<713002 ? "1.0" : $this->protocol_version);  
}  
else  
$protocol_version=$this->protocol_version;  
$this->request=$this->request_method." ".$request_uri." HTTP/".$protocol_version;  
if($body_length  
|| ($body_length=strlen($this->request_body)))  
$this->request_headers["Content-Length"]=$body_length;  
for($headers=array(),$host_set=0,Reset($this->request_headers),$header=0;$header<count($this->request_headers);Next($this->request_headers),$header++)  
{  
$header_name=Key($this->request_headers);  
$header_value=$this->request_headers[$header_name];  
if(GetType($header_value)=="array")  
{  
for(Reset($header_value),$value=0;$value<count($header_value);Next($header_value),$value++)  
$headers[]=$header_name.": ".$header_value[Key($header_value)];  
}  
else  
$headers[]=$header_name.": ".$header_value;  
if(strtolower(Key($this->request_headers))=="host")  
{  
$this->request_host=strtolower($header_value);  
$host_set=1;  
}  
}  
if(!$host_set)  
{  
$headers[]="Host: ".$this->host_name;  
$this->request_host=strtolower($this->host_name);  
}  
if(count($this->cookies))  
{  
$cookies=array();  
$this->PickCookies($cookies,0);  
if(strtolower($this->protocol)=="https")  
$this->PickCookies($cookies,1);  
if(count($cookies))  
{  
$h=count($headers);  
$headers[$h]="Cookie:";  
for(Reset($cookies),$cookie=0;$cookie<count($cookies);Next($cookies),$cookie++)  
{  
$cookie_name=Key($cookies);  
$headers[$h].=" ".$cookie_name."=".$cookies[$cookie_name]["value"].";";  
}  
}  
}  
$next_state = "RequestSent";  
if($this->use_curl)  
{  
if(IsSet($arguments['StreamRequest']))  
return($this->SetError("Streaming request data is not supported when using Curl"));  
if($body_length  
&& strlen($this->request_body)==0)  
{  
for($request_body="",$success=1,$part=0;$part<count($post_parts);$part++)  
{  
$request_body.=$post_parts[$part]["HEADERS"].$post_parts[$part]["DATA"];  
if(IsSet($post_parts[$part]["FILENAME"]))  
{  
if(!($file=@fopen($post_parts[$part]["FILENAME"],"rb")))  
{  
$this->SetPHPError("could not open upload file ".$post_parts[$part]["FILENAME"], $php_errormsg);  
$success=0;  
break;  
}  
while(!feof($file))  
{  
if(GetType($block=@fread($file,$this->file_buffer_length))!="string")  
{  
$this->SetPHPError("could not read upload file", $php_errormsg);  
$success=0;  
break;  
}  
$request_body.=$block;  
}  
fclose($file);  
if(!$success)  
break;  
}  
$request_body.="\r\n";  
}  
$request_body.="--".$boundary."--\r\n";  
}  
else  
$request_body=$this->request_body;  
curl_setopt($this->connection,CURLOPT_HEADER,1);  
curl_setopt($this->connection,CURLOPT_RETURNTRANSFER,1);  
if($this->timeout)  
curl_setopt($this->connection,CURLOPT_TIMEOUT,$this->timeout);  
curl_setopt($this->connection,CURLOPT_SSL_VERIFYPEER,0);  
curl_setopt($this->connection,CURLOPT_SSL_VERIFYHOST,0);  
$request=$this->request."\r\n".implode("\r\n",$headers)."\r\n\r\n".$request_body;  
curl_setopt($this->connection,CURLOPT_CUSTOMREQUEST,$request);  
if($this->debug)  
$this->OutputDebug("C ".$request);  
if(!($success=(strlen($this->response=curl_exec($this->connection))!=0)))  
{  
$error=curl_error($this->connection);  
$this->SetError("Could not execute the request".(strlen($error) ? ": ".$error : ""));  
}  
}  
else  
{  
if(($success=$this->PutLine($this->request)))  
{  
for($header=0;$header<count($headers);$header++)  
{  
if(!$success=$this->PutLine($headers[$header]))  
break;  
}  
if($success  
&& ($success=$this->PutLine("")))  
{  
if(IsSet($arguments['StreamRequest']))  
$next_state = "SendingRequestBody";  
elseif($body_length)  
{  
if(strlen($this->request_body))  
$success=$this->PutData($this->request_body);  
else  
{  
for($part=0;$part<count($post_parts);$part++)  
{  
if(!($success=$this->PutData($post_parts[$part]["HEADERS"]))  
|| !($success=$this->PutData($post_parts[$part]["DATA"])))  
break;  
if(IsSet($post_parts[$part]["FILENAME"]))  
{  
if(!($file=@fopen($post_parts[$part]["FILENAME"],"rb")))  
{  
$this->SetPHPError("could not open upload file ".$post_parts[$part]["FILENAME"], $php_errormsg);  
$success=0;  
break;  
}  
while(!feof($file))  
{  
if(GetType($block=@fread($file,$this->file_buffer_length))!="string")  
{  
$this->SetPHPError("could not read upload file", $php_errormsg);  
$success=0;  
break;  
}  
if(!($success=$this->PutData($block)))  
break;  
}  
fclose($file);  
if(!$success)  
break;  
}  
if(!($success=$this->PutLine("")))  
break;  
}  
if($success)  
$success=$this->PutLine("--".$boundary."--");  
}  
if($success)  
$sucess=$this->FlushData();  
}  
}  
}  
}  
if(!$success)  
return($this->SetError("5 could not send the HTTP request: ".$this->error));  
$this->state=$next_state;  
return("");  
}  
 
Function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0)  
{  
if(strlen($this->error))  
return($this->error);  
if(strlen($name)==0)  
return($this->SetError("it was not specified a valid cookie name"));  
if(strlen($path)==0  
|| strcmp($path[0],"/"))  
return($this->SetError($path." is not a valid path for setting cookie ".$name));  
if($domain==""  
|| !strpos($domain,".",$domain[0]=="." ? 1 : 0))  
return($this->SetError($domain." is not a valid domain for setting cookie ".$name));  
$domain=strtolower($domain);  
if(!strcmp($domain[0],"."))  
$domain=substr($domain,1);  
if(!$verbatim)  
{  
$name=$this->CookieEncode($name,1);  
$value=$this->CookieEncode($value,0);  
}  
$secure=intval($secure);  
$this->cookies[$secure][$domain][$path][$name]=array(  
"name"=>$name,  
"value"=>$value,  
"domain"=>$domain,  
"path"=>$path,  
"expires"=>$expires,  
"secure"=>$secure  
);  
return("");  
}  
 
Function SendRequestBody($data, $end_of_data)  
{  
if(strlen($this->error))  
return($this->error);  
switch($this->state)  
{  
case "Disconnected":  
return($this->SetError("1 connection was not yet established"));  
case "Connected":  
case "ConnectedToProxy":  
return($this->SetError("2 request was not sent"));  
case "SendingRequestBody":  
break;  
case "RequestSent":  
return($this->SetError("3 request body was already sent"));  
default:  
return($this->SetError("4 can not send the request body in the current connection state"));  
}  
$length = strlen($data);  
if($length)  
{  
$size = dechex($length)."\r\n";  
if(!$this->PutData($size)  
|| !$this->PutData($data))  
return($this->error);  
}  
if($end_of_data)  
{  
$size = "0\r\n";  
if(!$this->PutData($size))  
return($this->error);  
$this->state = "RequestSent";  
}  
return("");  
}  
 
Function ReadReplyHeadersResponse(&$headers)  
{  
$headers=array();  
if(strlen($this->error))  
return($this->error);  
switch($this->state)  
{  
case "Disconnected":  
return($this->SetError("1 connection was not yet established"));  
case "Connected":  
return($this->SetError("2 request was not sent"));  
case "ConnectedToProxy":  
return($this->SetError("2 connection from the remote server from the proxy was not yet established"));  
case "SendingRequestBody":  
return($this->SetError("4 request body data was not completely sent"));  
case "ConnectSent":  
$connect = 1;  
break;  
case "RequestSent":  
$connect = 0;  
break;  
default:  
return($this->SetError("3 can not get request headers in the current connection state"));  
}  
$this->content_length=$this->read_length=$this->read_response=$this->remaining_chunk=0;  
$this->content_length_set=$this->chunked=$this->last_chunk_read=$chunked=0;  
$this->connection_close=0;  
for($this->response_status="";;)  
{  
$line=$this->GetLine();  
if(GetType($line)!="string")  
return($this->SetError("4 could not read request reply: ".$this->error));  
if(strlen($this->response_status)==0)  
{  
if(!preg_match($match="/^http\\/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$/i",$line,$matches))  
return($this->SetError("3 it was received an unexpected HTTP response status"));  
$this->response_status=$matches[1];  
$this->response_message=$matches[2];  
}  
if($line=="")  
{  
if(strlen($this->response_status)==0)  
return($this->SetError("3 it was not received HTTP response status"));  
$this->state=($connect ? "GotConnectHeaders" : "GotReplyHeaders");  
break;  
}  
$header_name=strtolower($this->Tokenize($line,":"));  
$header_value=Trim(Chop($this->Tokenize("\r\n")));  
if(IsSet($headers[$header_name]))  
{  
if(GetType($headers[$header_name])=="string")  
$headers[$header_name]=array($headers[$header_name]);  
$headers[$header_name][]=$header_value;  
}  
else  
$headers[$header_name]=$header_value;  
if(!$connect)  
{  
switch($header_name)  
{  
case "content-length":  
$this->content_length=intval($headers[$header_name]);  
$this->content_length_set=1;  
break;  
case "transfer-encoding":  
$encoding=$this->Tokenize($header_value,"; \t");  
if(!$this->use_curl  
&& !strcmp($encoding,"chunked"))  
$chunked=1;  
break;  
case "set-cookie":  
if($this->support_cookies)  
{  
if(GetType($headers[$header_name])=="array")  
$cookie_headers=$headers[$header_name];  
else  
$cookie_headers=array($headers[$header_name]);  
for($cookie=0;$cookie<count($cookie_headers);$cookie++)  
{  
$cookie_name=trim($this->Tokenize($cookie_headers[$cookie],"="));  
$cookie_value=$this->Tokenize(";");  
$domain=$this->request_host;  
$path="/";  
$expires="";  
$secure=0;  
while(($name=trim(UrlDecode($this->Tokenize("="))))!="")  
{  
$value=UrlDecode($this->Tokenize(";"));  
switch($name)  
{  
case "domain":  
$domain=$value;  
break;  
case "path":  
$path=$value;  
break;  
case "expires":  
if(preg_match("/^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT\$/",$value,$matches))  
{  
$year=intval($matches[5]);  
if($year<1900)  
$year+=($year<70 ? 2000 : 1900);  
$expires="$year-".$this->months[$matches[4]]."-".$matches[3]." ".$matches[6].":".$matches[7].":".$matches[8];  
}  
break;  
case "secure":  
$secure=1;  
break;  
}  
}  
if(strlen($this->SetCookie($cookie_name, $cookie_value, $expires, $path , $domain, $secure, 1)))  
$this->error="";  
}  
}  
break;  
case "connection":  
$this->connection_close=!strcmp(strtolower($header_value),"close");  
break;  
}  
}  
}  
$this->chunked=$chunked;  
if($this->content_length_set)  
$this->connection_close=0;  
return("");  
}  
 
Function Redirect(&$headers)  
{  
if($this->follow_redirect)  
{  
if(!IsSet($headers["location"])  
|| (GetType($headers["location"])!="array"  
&& strlen($location=$headers["location"])==0)  
|| (GetType($headers["location"])=="array"  
&& strlen($location=$headers["location"][0])==0))  
return($this->SetError("3 it was received a redirect without location URL"));  
if(strcmp($location[0],"/"))  
{  
$location_arguments=parse_url($location);  
if(!IsSet($location_arguments["scheme"]))  
$location=((GetType($end=strrpos($this->request_uri,"/"))=="integer" && $end>1) ? substr($this->request_uri,0,$end) : "")."/".$location;  
}  
if(!strcmp($location[0],"/"))  
$location=$this->protocol."://".$this->host_name.($this->host_port ? ":".$this->host_port : "").$location;  
$error=$this->GetRequestArguments($location,$arguments);  
if(strlen($error))  
return($this->SetError("could not process redirect url: ".$error));  
$arguments["RequestMethod"]="GET";  
if(strlen($error=$this->Close())==0  
&& strlen($error=$this->Open($arguments))==0  
&& strlen($error=$this->SendRequest($arguments))==0)  
{  
$this->redirection_level++;  
if($this->redirection_level>$this->redirection_limit)  
$error="it was exceeded the limit of request redirections";  
else  
$error=$this->ReadReplyHeaders($headers);  
$this->redirection_level--;  
}  
if(strlen($error))  
return($this->SetError($error));  
}  
return("");  
}  
 
Function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation)  
{  
if($proxy)  
{  
$authenticate_header="proxy-authenticate";  
$authorization_header="Proxy-Authorization";  
$authenticate_status="407";  
$authentication_mechanism=$this->proxy_authentication_mechanism;  
}  
else  
{  
$authenticate_header="www-authenticate";  
$authorization_header="Authorization";  
$authenticate_status="401";  
$authentication_mechanism=$this->authentication_mechanism;  
}  
if(IsSet($headers[$authenticate_header]))  
{  
if(function_exists("class_exists")  
&& !class_exists("sasl_client_class"))  
return($this->SetError("the SASL client class needs to be loaded to be able to authenticate".($proxy ? " with the proxy server" : "")." and access this site"));  
if(GetType($headers[$authenticate_header])=="array")  
$authenticate=$headers[$authenticate_header];  
else  
$authenticate=array($headers[$authenticate_header]);  
for($response="", $mechanisms=array(),$m=0;$m<count($authenticate);$m++)  
{  
$mechanism=$this->Tokenize($authenticate[$m]," ");  
$response=$this->Tokenize("");  
if(strlen($authentication_mechanism))  
{  
if(!strcmp($authentication_mechanism,$mechanism))  
{  
$mechanisms[]=$mechanism;  
break;  
}  
}  
else  
$mechanisms[]=$mechanism;  
}  
$sasl=new sasl_client_class;  
if(IsSet($user))  
$sasl->SetCredential("user",$user);  
if(IsSet($password))  
$sasl->SetCredential("password",$password);  
if(IsSet($realm))  
$sasl->SetCredential("realm",$realm);  
if(IsSet($workstation))  
$sasl->SetCredential("workstation",$workstation);  
$sasl->SetCredential("uri",$this->request_uri);  
$sasl->SetCredential("method",$this->request_method);  
$sasl->SetCredential("session",$this->session);  
do  
{  
$status=$sasl->Start($mechanisms,$message,$interactions);  
}  
while($status==SASL_INTERACT);  
switch($status)  
{  
case SASL_CONTINUE:  
break;  
case SASL_NOMECH:  
return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".(strlen($authentication_mechanism) ? "authentication mechanism ".$authentication_mechanism." may not be used: " : "").$sasl->error));  
default:  
return($this->SetError("Could not start the SASL ".($proxy ? "proxy " : "")."authentication client: ".$sasl->error));  
}  
if($proxy >= 0)  
{  
for(;;)  
{  
if(strlen($error=$this->ReadReplyBody($body,$this->file_buffer_length)))  
return($error);  
if(strlen($body)==0)  
break;  
}  
}  
$authorization_value=$sasl->mechanism.(IsSet($message) ? " ".($sasl->encode_response ? base64_encode($message) : $message) : "");  
$request_arguments=$this->request_arguments;  
$arguments=$request_arguments;  
$arguments["Headers"][$authorization_header]=$authorization_value;  
if(!$proxy  
&& strlen($proxy_authorization))  
$arguments["Headers"]["Proxy-Authorization"]=$proxy_authorization;  
if(strlen($error=$this->Close())  
|| strlen($error=$this->Open($arguments)))  
return($this->SetError($error));  
$authenticated=0;  
if(IsSet($message))  
{  
if($proxy < 0)  
{  
if(strlen($error=$this->ConnectFromProxy($arguments, $headers)))  
return($this->SetError($error));  
}  
else  
{  
if(strlen($error=$this->SendRequest($arguments))  
|| strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($this->SetError($error));  
}  
if(!IsSet($headers[$authenticate_header]))  
$authenticate=array();  
elseif(GetType($headers[$authenticate_header])=="array")  
$authenticate=$headers[$authenticate_header];  
else  
$authenticate=array($headers[$authenticate_header]);  
for($mechanism=0;$mechanism<count($authenticate);$mechanism++)  
{  
if(!strcmp($this->Tokenize($authenticate[$mechanism]," "),$sasl->mechanism))  
{  
$response=$this->Tokenize("");  
break;  
}  
}  
switch($this->response_status)  
{  
case $authenticate_status:  
break;  
case "301":  
case "302":  
case "303":  
case "307":  
if($proxy >= 0)  
return($this->Redirect($headers));  
default:  
if(intval($this->response_status/100)==2)  
{  
if($proxy)  
$proxy_authorization=$authorization_value;  
$authenticated=1;  
break;  
}  
if($proxy  
&& !strcmp($this->response_status,"401"))  
{  
$proxy_authorization=$authorization_value;  
$authenticated=1;  
break;  
}  
return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".$this->response_status." ".$this->response_message));  
}  
}  
for(;!$authenticated;)  
{  
do  
{  
$status=$sasl->Step($response,$message,$interactions);  
}  
while($status==SASL_INTERACT);  
switch($status)  
{  
case SASL_CONTINUE:  
$authorization_value=$sasl->mechanism.(IsSet($message) ? " ".($sasl->encode_response ? base64_encode($message) : $message) : "");  
$arguments=$request_arguments;  
$arguments["Headers"][$authorization_header]=$authorization_value;  
if(!$proxy  
&& strlen($proxy_authorization))  
$arguments["Headers"]["Proxy-Authorization"]=$proxy_authorization;  
if($proxy < 0)  
{  
if(strlen($error=$this->ConnectFromProxy($arguments, $headers)))  
return($this->SetError($error));  
}  
else  
{  
if(strlen($error=$this->SendRequest($arguments))  
|| strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($this->SetError($error));  
}  
switch($this->response_status)  
{  
case $authenticate_status:  
if(GetType($headers[$authenticate_header])=="array")  
$authenticate=$headers[$authenticate_header];  
else  
$authenticate=array($headers[$authenticate_header]);  
for($response="",$mechanism=0;$mechanism<count($authenticate);$mechanism++)  
{  
if(!strcmp($this->Tokenize($authenticate[$mechanism]," "),$sasl->mechanism))  
{  
$response=$this->Tokenize("");  
break;  
}  
}  
if($proxy >= 0)  
{  
for(;;)  
{  
if(strlen($error=$this->ReadReplyBody($body,$this->file_buffer_length)))  
return($error);  
if(strlen($body)==0)  
break;  
}  
}  
$this->state="Connected";  
break;  
case "301":  
case "302":  
case "303":  
case "307":  
if($proxy >= 0)  
return($this->Redirect($headers));  
default:  
if(intval($this->response_status/100)==2)  
{  
if($proxy)  
$proxy_authorization=$authorization_value;  
$authenticated=1;  
break;  
}  
if($proxy  
&& !strcmp($this->response_status,"401"))  
{  
$proxy_authorization=$authorization_value;  
$authenticated=1;  
break;  
}  
return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".$this->response_status." ".$this->response_message));  
}  
break;  
default:  
return($this->SetError("Could not process the SASL ".($proxy ? "proxy " : "")."authentication step: ".$sasl->error));  
}  
}  
}  
return("");  
}  
 
Function ReadReplyHeaders(&$headers)  
{  
if(strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($error);  
$proxy_authorization="";  
while(!strcmp($this->response_status, "100"))  
{  
$this->state="RequestSent";  
if(strlen($error=$this->ReadReplyHeadersResponse($headers)))  
return($error);  
}  
switch($this->response_status)  
{  
case "301":  
case "302":  
case "303":  
case "307":  
if(strlen($error=$this->Redirect($headers)))  
return($error);  
break;  
case "407":  
if(strlen($error=$this->Authenticate($headers, 1, $proxy_authorization, $this->proxy_request_user, $this->proxy_request_password, $this->proxy_request_realm, $this->proxy_request_workstation)))  
return($error);  
if(strcmp($this->response_status,"401"))  
return("");  
case "401":  
return($this->Authenticate($headers, 0, $proxy_authorization, $this->request_user, $this->request_password, $this->request_realm, $this->request_workstation));  
}  
return("");  
}  
 
Function ReadReplyBody(&$body,$length)  
{  
$body="";  
if(strlen($this->error))  
return($this->error);  
switch($this->state)  
{  
case "Disconnected":  
return($this->SetError("1 connection was not yet established"));  
case "Connected":  
case "ConnectedToProxy":  
return($this->SetError("2 request was not sent"));  
case "RequestSent":  
if(($error=$this->ReadReplyHeaders($headers))!="")  
return($error);  
break;  
case "GotReplyHeaders":  
break;  
default:  
return($this->SetError("3 can not get request headers in the current connection state"));  
}  
if($this->content_length_set)  
$length=min($this->content_length-$this->read_length,$length);  
if($length>0  
&& !$this->EndOfInput()  
&& ($body=$this->ReadBytes($length))=="")  
{  
if(strlen($this->error))  
return($this->SetError("4 could not get the request reply body: ".$this->error));  
}  
$this->read_length+=strlen($body);  
return("");  
}  
 
Function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0)  
{  
$now=gmdate("Y-m-d H-i-s");  
$cookies=array();  
for($secure_cookies=0,Reset($this->cookies);$secure_cookies<count($this->cookies);Next($this->cookies),$secure_cookies++)  
{  
$secure=Key($this->cookies);  
if(!$secure_only  
|| $secure)  
{  
for($cookie_domain=0,Reset($this->cookies[$secure]);$cookie_domain<count($this->cookies[$secure]);Next($this->cookies[$secure]),$cookie_domain++)  
{  
$domain_pattern=Key($this->cookies[$secure]);  
$match=strlen($domain)-strlen($domain_pattern);  
if(strlen($domain)==0  
|| ($match>=0  
&& !strcmp($domain_pattern,substr($domain,$match))  
&& ($match==0  
|| $domain_pattern[0]=="."  
|| $domain[$match-1]==".")))  
{  
for(Reset($this->cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($this->cookies[$secure][$domain_pattern]);Next($this->cookies[$secure][$domain_pattern]),$path_part++)  
{  
$path=Key($this->cookies[$secure][$domain_pattern]);  
for(Reset($this->cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($this->cookies[$secure][$domain_pattern][$path]);Next($this->cookies[$secure][$domain_pattern][$path]),$cookie++)  
{  
$cookie_name=Key($this->cookies[$secure][$domain_pattern][$path]);  
$expires=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"];  
if((!$persistent_only  
&& strlen($expires)==0)  
|| (strlen($expires)  
&& strcmp($now,$expires)<0))  
$cookies[$secure][$domain_pattern][$path][$cookie_name]=$this->cookies[$secure][$domain_pattern][$path][$cookie_name];  
}  
}  
}  
}  
}  
}  
}  
 
Function SavePersistentCookies(&$cookies, $domain='', $secure_only=0)  
{  
$this->SaveCookies($cookies, $domain, $secure_only, 1);  
}  
 
Function GetPersistentCookies(&$cookies, $domain='', $secure_only=0)  
{  
$this->SavePersistentCookies($cookies, $domain, $secure_only);  
}  
 
Function RestoreCookies($cookies, $clear=1)  
{  
$new_cookies=($clear ? array() : $this->cookies);  
for($secure_cookies=0, Reset($cookies); $secure_cookies<count($cookies); Next($cookies), $secure_cookies++)  
{  
$secure=Key($cookies);  
if(GetType($secure)!="integer")  
return($this->SetError("invalid cookie secure value type (".serialize($secure).")"));  
for($cookie_domain=0,Reset($cookies[$secure]);$cookie_domain<count($cookies[$secure]);Next($cookies[$secure]),$cookie_domain++)  
{  
$domain_pattern=Key($cookies[$secure]);  
if(GetType($domain_pattern)!="string")  
return($this->SetError("invalid cookie domain value type (".serialize($domain_pattern).")"));  
for(Reset($cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($cookies[$secure][$domain_pattern]);Next($cookies[$secure][$domain_pattern]),$path_part++)  
{  
$path=Key($cookies[$secure][$domain_pattern]);  
if(GetType($path)!="string"  
|| strcmp(substr($path, 0, 1), "/"))  
return($this->SetError("invalid cookie path value type (".serialize($path).")"));  
for(Reset($cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($cookies[$secure][$domain_pattern][$path]);Next($cookies[$secure][$domain_pattern][$path]),$cookie++)  
{  
$cookie_name=Key($cookies[$secure][$domain_pattern][$path]);  
$expires=$cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"];  
$value=$cookies[$secure][$domain_pattern][$path][$cookie_name]["value"];  
if(GetType($expires)!="string"  
|| (strlen($expires)  
&& !preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\$/", $expires)))  
return($this->SetError("invalid cookie expiry value type (".serialize($expires).")"));  
$new_cookies[$secure][$domain_pattern][$path][$cookie_name]=array(  
"name"=>$cookie_name,  
"value"=>$value,  
"domain"=>$domain_pattern,  
"path"=>$path,  
"expires"=>$expires,  
"secure"=>$secure  
);  
}  
}  
}  
}  
$this->cookies=$new_cookies;  
return("");  
}  
};  
 
?>  
<?php  
/*  
* test_http.php  
*  
* @(#) $Header: /home/mlemos/cvsroot/http/test_http.php,v 1.18 2008/02/24 05:06:30 mlemos Exp $  
*  
*/  
 
?><HTML>  
<HEAD>  
<TITLE>Test for Manuel Lemos' PHP HTTP class</TITLE>  
</HEAD>  
<BODY>  
<H1><CENTER>Test for Manuel Lemos' PHP HTTP class</CENTER></H1>  
<HR>  
<UL>  
<?php  
require("http.php");  
 
/* Uncomment the line below when accessing Web servers or proxies that  
* require authentication.  
*/  
/*  
require("sasl.php");  
*/  
 
set_time_limit(0);  
$http=new http_class;  
 
/* Connection timeout */  
$http->timeout=0;  
 
/* Data transfer timeout */  
$http->data_timeout=0;  
 
/* Output debugging information about the progress of the connection */  
$http->debug=1;  
 
/* Format dubug output to display with HTML pages */  
$http->html_debug=1;  
 
 
/*  
* Need to emulate a certain browser user agent?  
* Set the user agent this way:  
*/  
$http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";  
 
/*  
* If you want to the class to follow the URL of redirect responses  
* set this variable to 1.  
*/  
$http->follow_redirect=1;  
 
/*  
* How many consecutive redirected requests the class should follow.  
*/  
$http->redirection_limit=5;  
 
/*  
* If your DNS always resolves non-existing domains to a default IP  
* address to force the redirection to a given page, specify the  
* default IP address in this variable to make the class handle it  
* as when domain resolution fails.  
*/  
$http->exclude_address="";  
 
/*  
* If you want to establish SSL connections and you do not want the  
* class to use the CURL library, set this variable to 0 .  
*/  
$http->prefer_curl=0;  
 
/*  
* If basic authentication is required, specify the user name and  
* password in these variables.  
*/  
 
$user="";  
$password="";  
$realm=""; /* Authentication realm or domain */  
$workstation=""; /* Workstation for NTLM authentication */  
$authentication=(strlen($user) ? UrlEncode($user).":".UrlEncode($password)."@" : "");  
 
/*  
Do you want to access a page via SSL?  
Just specify the https:// URL.  
$url="https://www.openssl.org/";  
*/  
 
$url="http://".$authentication."www.php.net/";  
 
/*  
* Generate a list of arguments for opening a connection and make an  
* HTTP request from a given URL.  
*/  
$error=$http->GetRequestArguments($url,$arguments);  
 
if(strlen($realm))  
$arguments["AuthRealm"]=$realm;  
 
if(strlen($workstation))  
$arguments["AuthWorkstation"]=$workstation;  
 
$http->authentication_mechanism=""; // force a given authentication mechanism;  
 
/*  
* If you need to access a site using a proxy server, use these  
* arguments to set the proxy host and authentication credentials if  
* necessary.  
*/  
/*  
$arguments["ProxyHostName"]="127.0.0.1";  
$arguments["ProxyHostPort"]=3128;  
$arguments["ProxyUser"]="proxyuser";  
$arguments["ProxyPassword"]="proxypassword";  
$arguments["ProxyRealm"]="proxyrealm"; // Proxy authentication realm or domain  
$arguments["ProxyWorkstation"]="proxyrealm"; // Workstation for NTLM proxy authentication  
$http->proxy_authentication_mechanism=""; // force a given proxy authentication mechanism;  
*/  
 
/*  
* If you need to access a site using a SOCKS server, use these  
* arguments to set the SOCKS host and port.  
*/  
/*  
$arguments["SOCKSHostName"]='127.0.0.1';  
$arguments["SOCKSHostPort"]=1080;  
$arguments["SOCKSVersion"]='5';  
*/  
 
/* Set additional request headers */  
$arguments["Headers"]["Pragma"]="nocache";  
/*  
Is it necessary to specify a certificate to access a page via SSL?  
Specify the certificate file this way.  
$arguments["SSLCertificateFile"]="my_certificate_file.pem";  
$arguments["SSLCertificatePassword"]="some certificate password";  
*/  
 
/*  
Is it necessary to preset some cookies?  
Just use the SetCookie function to set each cookie this way:  
 
$cookie_name="LAST_LANG";  
$cookie_value="de";  
$cookie_expires="2010-01-01 00:00:00"; // "" for session cookies  
$cookie_uri_path="/";  
$cookie_domain=".php.net";  
$cookie_secure=0; // 1 for SSL only cookies  
$http->SetCookie($cookie_name, $cookie_value, $cookie_expiry, $cookie_uri_path, $cookie_domain, $cookie_secure);  
*/  
 
echo "<H2><LI>Opening connection to:</H2>\n<PRE>",HtmlEntities($arguments["HostName"]),"</PRE>\n";  
flush();  
$error=$http->Open($arguments);  
 
if($error=="")  
{  
echo "<H2><LI>Sending request for page:</H2>\n<PRE>";  
echo HtmlEntities($arguments["RequestURI"]),"\n";  
if(strlen($user))  
echo "\nLogin: ",$user,"\nPassword: ",str_repeat("*",strlen($password));  
echo "</PRE>\n";  
flush();  
$error=$http->SendRequest($arguments);  
 
if($error=="")  
{  
echo "<H2><LI>Request:</LI</H2>\n<PRE>\n".HtmlEntities($http->request)."</PRE>\n";  
echo "<H2><LI>Request headers:</LI</H2>\n<PRE>\n";  
for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++)  
{  
$header_name=Key($http->request_headers);  
if(GetType($http->request_headers[$header_name])=="array")  
{  
for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++)  
echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n";  
}  
else  
echo $header_name.": ".$http->request_headers[$header_name],"\r\n";  
}  
echo "</PRE>\n";  
flush();  
 
$headers=array();  
$error=$http->ReadReplyHeaders($headers);  
if($error=="")  
{  
echo "<H2><LI>Response status code:</LI</H2>\n<P>".$http->response_status;  
switch($http->response_status)  
{  
case "301":  
case "302":  
case "303":  
case "307":  
echo " (redirect to <TT>".$headers["location"]."</TT>)<BR>\nSet the <TT>follow_redirect</TT> variable to handle redirect responses automatically.";  
break;  
}  
echo "</P>\n";  
echo "<H2><LI>Response headers:</LI</H2>\n<PRE>\n";  
for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++)  
{  
$header_name=Key($headers);  
if(GetType($headers[$header_name])=="array")  
{  
for($header_value=0;$header_value<count($headers[$header_name]);$header_value++)  
echo $header_name.": ".$headers[$header_name][$header_value],"\r\n";  
}  
else  
echo $header_name.": ".$headers[$header_name],"\r\n";  
}  
echo "</PRE>\n";  
flush();  
 
echo "<H2><LI>Response body:</LI</H2>\n<PRE>\n";  
for(;;)  
{  
$error=$http->ReadReplyBody($body,1000);  
if($error!=""  
|| strlen($body)==0)  
break;  
echo HtmlSpecialChars($body);  
}  
echo "</PRE>\n";  
flush();  
}  
}  
$http->Close();  
}  
if(strlen($error))  
echo "<CENTER><H2>Error: ",$error,"</H2><CENTER>\n";  
?>  
</UL>  
<HR>  
</BODY>  
</HTML>  
 
<?php  
// ...  
?>  
<?php  
/**  
* jsmin.php - PHP implementation of Douglas Crockford's JSMin.  
*  
* This is pretty much a direct port of jsmin.c to PHP with just a few  
* PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and  
* outputs to stdout, this library accepts a string as input and returns another  
* string as output.  
*  
* PHP 5 or higher is required.  
*  
* Permission is hereby granted to use this version of the library under the  
* same terms as jsmin.c, which has the following license:  
*  
* --  
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)  
*  
* Permission is hereby granted, free of charge, to any person obtaining a copy of  
* this software and associated documentation files (the "Software"), to deal in  
* the Software without restriction, including without limitation the rights to  
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies  
* of the Software, and to permit persons to whom the Software is furnished to do  
* so, subject to the following conditions:  
*  
* The above copyright notice and this permission notice shall be included in all  
* copies or substantial portions of the Software.  
*  
* The Software shall be used for Good, not Evil.  
*  
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
* SOFTWARE.  
* --  
*  
* @package JSMin  
* @author Ryan Grove <ryan@wonko.com>  
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)  
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)  
* @license http://opensource.org/licenses/mit-license.php MIT License  
* @version 1.1.1 (2008-03-02)  
* @link http://code.google.com/p/jsmin-php/  
*/  
 
class JSMin {  
const ORD_LF = 10;  
const ORD_SPACE = 32;  
 
protected $a = '';  
protected $b = '';  
protected $input = '';  
protected $inputIndex = 0;  
protected $inputLength = 0;  
protected $lookAhead = null;  
protected $output = '';  
 
// -- Public Static Methods --------------------------------------------------  
 
public static function minify($js) {  
$jsmin = new JSMin($js);  
return $jsmin->min();  
}  
 
// -- Public Instance Methods ------------------------------------------------  
 
public function __construct($input) {  
$this->input = str_replace("\r\n", "\n", $input);  
$this->inputLength = strlen($this->input);  
}  
 
// -- Protected Instance Methods ---------------------------------------------  
 
protected function action($d) {  
switch($d) {  
case 1:  
$this->output .= $this->a;  
 
case 2:  
$this->a = $this->b;  
 
if ($this->a === "'" || $this->a === '"') {  
for (;;) {  
$this->output .= $this->a;  
$this->a = $this->get();  
 
if ($this->a === $this->b) {  
break;  
}  
 
if (ord($this->a) <= self::ORD_LF) {  
throw new JSMinException('Unterminated string literal.');  
}  
 
if ($this->a === '\\') {  
$this->output .= $this->a;  
$this->a = $this->get();  
}  
}  
}  
 
case 3:  
$this->b = $this->next();  
 
if ($this->b === '/' && (  
$this->a === '(' || $this->a === ',' || $this->a === '=' ||  
$this->a === ':' || $this->a === '[' || $this->a === '!' ||  
$this->a === '&' || $this->a === '|' || $this->a === '?')) {  
 
$this->output .= $this->a . $this->b;  
 
for (;;) {  
$this->a = $this->get();  
 
if ($this->a === '/') {  
break;  
} elseif ($this->a === '\\') {  
$this->output .= $this->a;  
$this->a = $this->get();  
} elseif (ord($this->a) <= self::ORD_LF) {  
throw new JSMinException('Unterminated regular expression '.  
'literal.');  
}  
 
$this->output .= $this->a;  
}  
 
$this->b = $this->next();  
}  
}  
}  
 
protected function get() {  
$c = $this->lookAhead;  
$this->lookAhead = null;  
 
if ($c === null) {  
if ($this->inputIndex < $this->inputLength) {  
$c = $this->input[$this->inputIndex];  
$this->inputIndex += 1;  
} else {  
$c = null;  
}  
}  
 
if ($c === "\r") {  
return "\n";  
}  
 
if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {  
return $c;  
}  
 
return ' ';  
}  
 
protected function isAlphaNum($c) {  
return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;  
}  
 
protected function min() {  
$this->a = "\n";  
$this->action(3);  
 
while ($this->a !== null) {  
switch ($this->a) {  
case ' ':  
if ($this->isAlphaNum($this->b)) {  
$this->action(1);  
} else {  
$this->action(2);  
}  
break;  
 
case "\n":  
switch ($this->b) {  
case '{':  
case '[':  
case '(':  
case '+':  
case '-':  
$this->action(1);  
break;  
 
case ' ':  
$this->action(3);  
break;  
 
default:  
if ($this->isAlphaNum($this->b)) {  
$this->action(1);  
}  
else {  
$this->action(2);  
}  
}  
break;  
 
default:  
switch ($this->b) {  
case ' ':  
if ($this->isAlphaNum($this->a)) {  
$this->action(1);  
break;  
}  
 
$this->action(3);  
break;  
 
case "\n":  
switch ($this->a) {  
case '}':  
case ']':  
case ')':  
case '+':  
case '-':  
case '"':  
case "'":  
$this->action(1);  
break;  
 
default:  
if ($this->isAlphaNum($this->a)) {  
$this->action(1);  
}  
else {  
$this->action(3);  
}  
}  
break;  
 
default:  
$this->action(1);  
break;  
}  
}  
}  
 
return $this->output;  
}  
 
protected function next() {  
$c = $this->get();  
 
if ($c === '/') {  
switch($this->peek()) {  
case '/':  
for (;;) {  
$c = $this->get();  
 
if (ord($c) <= self::ORD_LF) {  
return $c;  
}  
}  
 
case '*':  
$this->get();  
 
for (;;) {  
switch($this->get()) {  
case '*':  
if ($this->peek() === '/') {  
$this->get();  
return ' ';  
}  
break;  
 
case null:  
throw new JSMinException('Unterminated comment.');  
}  
}  
 
default:  
return $c;  
}  
}  
 
return $c;  
}  
 
protected function peek() {  
$this->lookAhead = $this->get();  
return $this->lookAhead;  
}  
}  
 
// -- Exceptions ---------------------------------------------------------------  
class JSMinException extends Exception {}  
?>  
<?php  
/*  
======================================================================  
lastRSS 0.9.1  
 
Simple yet powerfull PHP class to parse RSS files.  
 
by Vojtech Semecky, webmaster @ webdot . cz  
 
Latest version, features, manual and examples:  
http://lastrss.webdot.cz/  
 
----------------------------------------------------------------------  
LICENSE  
 
This program is free software; you can redistribute it and/or  
modify it under the terms of the GNU General Public License (GPL)  
as published by the Free Software Foundation; either version 2  
of the License, or (at your option) any later version.  
 
This program is distributed in the hope that it will be useful,  
but WITHOUT ANY WARRANTY; without even the implied warranty of  
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
GNU General Public License for more details.  
 
To read the license please visit http://www.gnu.org/copyleft/gpl.html  
======================================================================  
*/  
 
/**  
* lastRSS  
* Simple yet powerfull PHP class to parse RSS files.  
*/  
class lastRSS {  
// -------------------------------------------------------------------  
// Public properties  
// -------------------------------------------------------------------  
var $default_cp = 'UTF-8';  
var $CDATA = 'nochange';  
var $cp = '';  
var $items_limit = 0;  
var $stripHTML = False;  
var $date_format = '';  
 
// -------------------------------------------------------------------  
// Private variables  
// -------------------------------------------------------------------  
var $channeltags = array ('title', 'link', 'description', 'language', 'copyright', 'managingEditor', 'webMaster', 'lastBuildDate', 'rating', 'docs');  
var $itemtags = array('title', 'link', 'description', 'author', 'category', 'comments', 'enclosure', 'guid', 'pubDate', 'source');  
var $imagetags = array('title', 'url', 'link', 'width', 'height');  
var $textinputtags = array('title', 'description', 'name', 'link');  
 
// -------------------------------------------------------------------  
// Parse RSS file and returns associative array.  
// -------------------------------------------------------------------  
function Get ($rss_url) {  
// If CACHE ENABLED  
if ($this->cache_dir != '') {  
$cache_file = $this->cache_dir . '/rsscache_' . md5($rss_url);  
$timedif = @(time() - filemtime($cache_file));  
if ($timedif < $this->cache_time) {  
// cached file is fresh enough, return cached array  
$result = unserialize(join('', file($cache_file)));  
// set 'cached' to 1 only if cached file is correct  
if ($result) $result['cached'] = 1;  
} else {  
// cached file is too old, create new  
$result = $this->Parse($rss_url);  
$serialized = serialize($result);  
if ($f = @fopen($cache_file, 'w')) {  
fwrite ($f, $serialized, strlen($serialized));  
fclose($f);  
}  
if ($result) $result['cached'] = 0;  
}  
}  
// If CACHE DISABLED >> load and parse the file directly  
else {  
$result = $this->Parse($rss_url);  
 
if ($result) $result['cached'] = 0;  
}  
// return result  
return $result;  
}  
 
// -------------------------------------------------------------------  
// Modification of preg_match(); return trimed field with index 1  
// from 'classic' preg_match() array output  
// -------------------------------------------------------------------  
function my_preg_match ($pattern, $subject) {  
// start regullar expression  
preg_match($pattern, $subject, $out);  
 
// if there is some result... process it and return it  
if(isset($out[1])) {  
// Process CDATA (if present)  
if ($this->CDATA == 'content') { // Get CDATA content (without CDATA tag)  
$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));  
} elseif ($this->CDATA == 'strip') { // Strip CDATA  
$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));  
}  
 
// If code page is set convert character encoding to required  
if ($this->cp != '')  
//$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);  
$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);  
// Return result  
return trim($out[1]);  
} else {  
// if there is NO result, return empty string  
return '';  
}  
}  
 
// -------------------------------------------------------------------  
// Replace HTML entities &something; by real characters  
// -------------------------------------------------------------------  
function unhtmlentities ($string) {  
// Get HTML entities table  
$trans_tbl = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES);  
// Flip keys<==>values  
$trans_tbl = array_flip ($trans_tbl);  
// Add support for &apos; entity (missing in HTML_ENTITIES)  
$trans_tbl += array('&apos;' => "'");  
// Replace entities by values  
return strtr ($string, $trans_tbl);  
}  
 
// -------------------------------------------------------------------  
// Parse() is private method used by Get() to load and parse RSS file.  
// Don't use Parse() in your scripts - use Get($rss_file) instead.  
// -------------------------------------------------------------------  
function Parse ($rss_url) {  
// Open and load RSS file  
 
if ($f = @fopen($rss_url, 'r')) {  
$rss_content = '';  
while (!feof($f)) {  
$rss_content .= fgets($f, 4096);  
print $rss_content;  
}  
fclose($f);  
 
// Parse document encoding  
$result['encoding'] = $this->my_preg_match("'encoding=[\'\"](.*?)[\'\"]'si", $rss_content);  
// if document codepage is specified, use it  
if ($result['encoding'] != '')  
{ $this->rsscp = $result['encoding']; } // This is used in my_preg_match()  
// otherwise use the default codepage  
else  
{ $this->rsscp = $this->default_cp; } // This is used in my_preg_match()  
 
// Parse CHANNEL info  
preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);  
foreach($this->channeltags as $channeltag)  
{  
$temp = $this->my_preg_match("'<$channeltag.*?>(.*?)</$channeltag>'si", $out_channel[1]);  
if ($temp != '') $result[$channeltag] = $temp; // Set only if not empty  
}  
// If date_format is specified and lastBuildDate is valid  
if ($this->date_format != '' && ($timestamp = strtotime($result['lastBuildDate'])) !==-1) {  
// convert lastBuildDate to specified date format  
$result['lastBuildDate'] = date($this->date_format, $timestamp);  
}  
 
// Parse TEXTINPUT info  
preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);  
// This a little strange regexp means:  
// Look for tag <textinput> with or without any attributes, but skip truncated version <textinput /> (it's not beggining tag)  
if (isset($out_textinfo[2])) {  
foreach($this->textinputtags as $textinputtag) {  
$temp = $this->my_preg_match("'<$textinputtag.*?>(.*?)</$textinputtag>'si", $out_textinfo[2]);  
if ($temp != '') $result['textinput_'.$textinputtag] = $temp; // Set only if not empty  
}  
}  
// Parse IMAGE info  
preg_match("'<image.*?>(.*?)</image>'si", $rss_content, $out_imageinfo);  
if (isset($out_imageinfo[1])) {  
foreach($this->imagetags as $imagetag) {  
$temp = $this->my_preg_match("'<$imagetag.*?>(.*?)</$imagetag>'si", $out_imageinfo[1]);  
if ($temp != '') $result['image_'.$imagetag] = $temp; // Set only if not empty  
}  
}  
// Parse ITEMS  
preg_match_all("'<item(| .*?)>(.*?)</item>'si", $rss_content, $items);  
$rss_items = $items[2];  
$i = 0;  
$result['items'] = array(); // create array even if there are no items  
foreach($rss_items as $rss_item) {  
// If number of items is lower then limit: Parse one item  
if ($i < $this->items_limit || $this->items_limit == 0) {  
foreach($this->itemtags as $itemtag) {  
$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)</$itemtag>'si", $rss_item);  
if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty  
}  
// Strip HTML tags and other bullshit from DESCRIPTION  
if ($this->stripHTML && $result['items'][$i]['description'])  
$result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));  
// Strip HTML tags and other bullshit from TITLE  
if ($this->stripHTML && $result['items'][$i]['title'])  
$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));  
// If date_format is specified and pubDate is valid  
if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !==-1) {  
// convert pubDate to specified date format  
$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);  
}  
// Item counter  
$i++;  
}  
}  
 
$result['items_count'] = $i;  
return $result;  
}  
else // Error in opening return False  
{  
return False;  
}  
}  
}  
 
?>  
<?php  
//  
// +---------------------------------------------------------------------------+  
// | memcached client, PHP |  
// +---------------------------------------------------------------------------+  
// | Copyright (c) 2003 Ryan T. Dean <rtdean@cytherianage.net> |  
// | All rights reserved. |  
// | |  
// | Redistribution and use in source and binary forms, with or without |  
// | modification, are permitted provided that the following conditions |  
// | are met: |  
// | |  
// | 1. Redistributions of source code must retain the above copyright |  
// | notice, this list of conditions and the following disclaimer. |  
// | 2. Redistributions in binary form must reproduce the above copyright |  
// | notice, this list of conditions and the following disclaimer in the |  
// | documentation and/or other materials provided with the distribution. |  
// | |  
// | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |  
// | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |  
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |  
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |  
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |  
// | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |  
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |  
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |  
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |  
// | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  
// +---------------------------------------------------------------------------+  
// | Author: Ryan T. Dean <rtdean@cytherianage.net> |  
// | Heavily influenced by the Perl memcached client by Brad Fitzpatrick. |  
// | Permission granted by Brad Fitzpatrick for relicense of ported Perl |  
// | client logic under 2-clause BSD license. |  
// +---------------------------------------------------------------------------+  
//  
// $TCAnet$  
//  
 
/**  
* This is the PHP client for memcached - a distributed memory cache daemon.  
* More information is available at http://www.danga.com/memcached/  
*  
* Usage example:  
*  
* require_once 'memcached.php';  
*  
* $mc = new memcached(array(  
* 'servers' => array('127.0.0.1:10000',  
* array('192.0.0.1:10010', 2),  
* '127.0.0.1:10020'),  
* 'debug' => false,  
* 'compress_threshold' => 10240,  
* 'persistant' => true));  
*  
* $mc->add('key', array('some', 'array'));  
* $mc->replace('key', 'some random string');  
* $val = $mc->get('key');  
*  
* @author Ryan T. Dean <rtdean@cytherianage.net>  
* @version 0.1.2  
*/  
 
// {{{ requirements  
// }}}  
 
// {{{ class memcached  
/**  
* memcached client class implemented using (p)fsockopen()  
*  
* @author Ryan T. Dean <rtdean@cytherianage.net>  
* @ingroup Cache  
*/  
class memcached  
{  
// {{{ properties  
// {{{ public  
 
// {{{ constants  
// {{{ flags  
 
/**  
* Flag: indicates data is serialized  
*/  
const SERIALIZED = 1;  
 
/**  
* Flag: indicates data is compressed  
*/  
const COMPRESSED = 2;  
 
// }}}  
 
/**  
* Minimum savings to store data compressed  
*/  
const COMPRESSION_SAVINGS = 0.20;  
 
// }}}  
 
 
/**  
* Command statistics  
*  
* @var array  
* @access public  
*/  
var $stats;  
 
// }}}  
// {{{ private  
 
/**  
* Cached Sockets that are connected  
*  
* @var array  
* @access private  
*/  
var $_cache_sock;  
 
/**  
* Current debug status; 0 - none to 9 - profiling  
*  
* @var boolean  
* @access private  
*/  
var $_debug;  
 
/**  
* Dead hosts, assoc array, 'host'=>'unixtime when ok to check again'  
*  
* @var array  
* @access private  
*/  
var $_host_dead;  
 
/**  
* Is compression available?  
*  
* @var boolean  
* @access private  
*/  
var $_have_zlib;  
 
/**  
* Do we want to use compression?  
*  
* @var boolean  
* @access private  
*/  
var $_compress_enable;  
 
/**  
* At how many bytes should we compress?  
*  
* @var integer  
* @access private  
*/  
var $_compress_threshold;  
 
/**  
* Are we using persistant links?  
*  
* @var boolean  
* @access private  
*/  
var $_persistant;  
 
/**  
* If only using one server; contains ip:port to connect to  
*  
* @var string  
* @access private  
*/  
var $_single_sock;  
 
/**  
* Array containing ip:port or array(ip:port, weight)  
*  
* @var array  
* @access private  
*/  
var $_servers;  
 
/**  
* Our bit buckets  
*  
* @var array  
* @access private  
*/  
var $_buckets;  
 
/**  
* Total # of bit buckets we have  
*  
* @var integer  
* @access private  
*/  
var $_bucketcount;  
 
/**  
* # of total servers we have  
*  
* @var integer  
* @access private  
*/  
var $_active;  
 
/**  
* Stream timeout in seconds. Applies for example to fread()  
*  
* @var integer  
* @access private  
*/  
var $_timeout_seconds;  
 
/**  
* Stream timeout in microseconds  
*  
* @var integer  
* @access private  
*/  
var $_timeout_microseconds;  
 
/**  
* Connect timeout in seconds  
*/  
var $_connect_timeout;  
 
/**  
* Number of connection attempts for each server  
*/  
var $_connect_attempts;  
 
// }}}  
// }}}  
// {{{ methods  
// {{{ public functions  
// {{{ memcached()  
 
/**  
* Memcache initializer  
*  
* @param array $args Associative array of settings  
*  
* @return mixed  
* @access public  
*/  
function memcached ($args)  
{  
$this->set_servers(@$args['servers']);  
$this->_debug = @$args['debug'];  
$this->stats = array();  
$this->_compress_threshold = @$args['compress_threshold'];  
$this->_persistant = array_key_exists('persistant', $args) ? (@$args['persistant']) : false;  
$this->_compress_enable = true;  
$this->_have_zlib = function_exists("gzcompress");  
 
$this->_cache_sock = array();  
$this->_host_dead = array();  
 
$this->_timeout_seconds = 1;  
$this->_timeout_microseconds = 0;  
 
$this->_connect_timeout = 0.01;  
$this->_connect_attempts = 3;  
}  
 
// }}}  
// {{{ add()  
 
/**  
* Adds a key/value to the memcache server if one isn't already set with  
* that key  
*  
* @param string $key Key to set with data  
* @param mixed $val Value to store  
* @param integer $exp (optional) Time to expire data at  
*  
* @return boolean  
* @access public  
*/  
function add ($key, $val, $exp = 0)  
{  
return $this->_set('add', $key, $val, $exp);  
}  
 
// }}}  
// {{{ decr()  
 
/**  
* Decriment a value stored on the memcache server  
*  
* @param string $key Key to decriment  
* @param integer $amt (optional) Amount to decriment  
*  
* @return mixed FALSE on failure, value on success  
* @access public  
*/  
function decr ($key, $amt=1)  
{  
return $this->_incrdecr('decr', $key, $amt);  
}  
 
// }}}  
// {{{ delete()  
 
/**  
* Deletes a key from the server, optionally after $time  
*  
* @param string $key Key to delete  
* @param integer $time (optional) How long to wait before deleting  
*  
* @return boolean TRUE on success, FALSE on failure  
* @access public  
*/  
function delete ($key, $time = 0)  
{  
if (!$this->_active)  
return false;  
 
$sock = $this->get_sock($key);  
if (!is_resource($sock))  
return false;  
 
$key = is_array($key) ? $key[1] : $key;  
 
@$this->stats['delete']++;  
$cmd = "delete $key $time\r\n";  
if(!$this->_safe_fwrite($sock, $cmd, strlen($cmd)))  
{  
$this->_dead_sock($sock);  
return false;  
}  
$res = trim(fgets($sock));  
 
if ($this->_debug)  
$this->_debugprint(sprintf("MemCache: delete %s (%s)\n", $key, $res));  
 
if ($res == "DELETED")  
return true;  
return false;  
}  
 
// }}}  
// {{{ disconnect_all()  
 
/**  
* Disconnects all connected sockets  
*  
* @access public  
*/  
function disconnect_all ()  
{  
foreach ($this->_cache_sock as $sock)  
fclose($sock);  
 
$this->_cache_sock = array();  
}  
 
// }}}  
// {{{ enable_compress()  
 
/**  
* Enable / Disable compression  
*  
* @param boolean $enable TRUE to enable, FALSE to disable  
*  
* @access public  
*/  
function enable_compress ($enable)  
{  
$this->_compress_enable = $enable;  
}  
 
// }}}  
// {{{ forget_dead_hosts()  
 
/**  
* Forget about all of the dead hosts  
*  
* @access public  
*/  
function forget_dead_hosts ()  
{  
$this->_host_dead = array();  
}  
 
// }}}  
// {{{ get()  
 
/**  
* Retrieves the value associated with the key from the memcache server  
*  
* @param string $key Key to retrieve  
*  
* @return mixed  
* @access public  
*/  
function get ($key)  
{  
$fname = 'memcached::get';  
 
if (defined('MEDIAWIKI')) wfProfileIn( $fname );  
 
if ( $this->_debug ) {  
$this->_debugprint( "get($key)\n" );  
}  
 
if (!$this->_active) {  
if (defined('MEDIAWIKI')) wfProfileOut( $fname );  
return false;  
}  
 
$sock = $this->get_sock($key);  
 
if (!is_resource($sock)) {  
if (defined('MEDIAWIKI')) wfProfileOut( $fname );  
return false;  
}  
 
@$this->stats['get']++;  
 
$cmd = "get $key\r\n";  
if (!$this->_safe_fwrite($sock, $cmd, strlen($cmd)))  
{  
$this->_dead_sock($sock);  
if (defined('MEDIAWIKI')) wfProfileOut( $fname );  
return false;  
}  
 
$val = array();  
$this->_load_items($sock, $val);  
 
if ($this->_debug)  
foreach ($val as $k => $v)  
$this->_debugprint(sprintf("MemCache: sock %s got %s\n", serialize($sock), $k));  
 
if (defined('MEDIAWIKI')) wfProfileOut( $fname );  
return @$val[$key];  
}  
 
// }}}  
// {{{ get_multi()  
 
/**  
* Get multiple keys from the server(s)  
*  
* @param array $keys Keys to retrieve  
*  
* @return array  
* @access public  
*/  
function get_multi ($keys)  
{  
if (!$this->_active)  
return false;  
 
@$this->stats['get_multi']++;  
$sock_keys = array();  
 
foreach ($keys as $key)  
{  
$sock = $this->get_sock($key);  
if (!is_resource($sock)) continue;  
$key = is_array($key) ? $key[1] : $key;  
if (!isset($sock_keys[$sock]))  
{  
$sock_keys[$sock] = array();  
$socks[] = $sock;  
}  
$sock_keys[$sock][] = $key;  
}  
 
// Send out the requests  
foreach ($socks as $sock)  
{  
$cmd = "get";  
foreach ($sock_keys[$sock] as $key)  
{  
$cmd .= " ". $key;  
}  
$cmd .= "\r\n";  
 
if ($this->_safe_fwrite($sock, $cmd, strlen($cmd)))  
{  
$gather[] = $sock;  
} else  
{  
$this->_dead_sock($sock);  
}  
}  
 
// Parse responses  
$val = array();  
foreach ($gather as $sock)  
{  
$this->_load_items($sock, $val);  
}  
 
if ($this->_debug)  
foreach ($val as $k => $v)  
$this->_debugprint(sprintf("MemCache: got %s\n", $k));  
 
return $val;  
}  
 
// }}}  
// {{{ incr()  
 
/**  
* Increments $key (optionally) by $amt  
*  
* @param string $key Key to increment  
* @param integer $amt (optional) amount to increment  
*  
* @return integer New key value?  
* @access public  
*/  
function incr ($key, $amt=1)  
{  
return $this->_incrdecr('incr', $key, $amt);  
}  
 
// }}}  
// {{{ replace()  
 
/**  
* Overwrites an existing value for key; only works if key is already set  
*  
* @param string $key Key to set value as  
* @param mixed $value Value to store  
* @param integer $exp (optional) Experiation time  
*  
* @return boolean  
* @access public  
*/  
function replace ($key, $value, $exp=0)  
{  
return $this->_set('replace', $key, $value, $exp);  
}  
 
// }}}  
// {{{ run_command()  
 
/**  
* Passes through $cmd to the memcache server connected by $sock; returns  
* output as an array (null array if no output)  
*  
* NOTE: due to a possible bug in how PHP reads while using fgets(), each  
* line may not be terminated by a \r\n. More specifically, my testing  
* has shown that, on FreeBSD at least, each line is terminated only  
* with a \n. This is with the PHP flag auto_detect_line_endings set  
* to falase (the default).  
*  
* @param resource $sock Socket to send command on  
* @param string $cmd Command to run  
*  
* @return array Output array  
* @access public  
*/  
function run_command ($sock, $cmd)  
{  
if (!is_resource($sock))  
return array();  
 
if (!$this->_safe_fwrite($sock, $cmd, strlen($cmd)))  
return array();  
 
while (true)  
{  
$res = fgets($sock);  
$ret[] = $res;  
if (preg_match('/^END/', $res))  
break;  
if (strlen($res) == 0)  
break;  
}  
return $ret;  
}  
 
// }}}  
// {{{ set()  
 
/**  
* Unconditionally sets a key to a given value in the memcache. Returns true  
* if set successfully.  
*  
* @param string $key Key to set value as  
* @param mixed $value Value to set  
* @param integer $exp (optional) Experiation time  
*  
* @return boolean TRUE on success  
* @access public  
*/  
function set ($key, $value, $exp=0)  
{  
return $this->_set('set', $key, $value, $exp);  
}  
 
// }}}  
// {{{ set_compress_threshold()  
 
/**  
* Sets the compression threshold  
*  
* @param integer $thresh Threshold to compress if larger than  
*  
* @access public  
*/  
function set_compress_threshold ($thresh)  
{  
$this->_compress_threshold = $thresh;  
}  
 
// }}}  
// {{{ set_debug()  
 
/**  
* Sets the debug flag  
*  
* @param boolean $dbg TRUE for debugging, FALSE otherwise  
*  
* @access public  
*  
* @see memcahced::memcached  
*/  
function set_debug ($dbg)  
{  
$this->_debug = $dbg;  
}  
 
// }}}  
// {{{ set_servers()  
 
/**  
* Sets the server list to distribute key gets and puts between  
*  
* @param array $list Array of servers to connect to  
*  
* @access public  
*  
* @see memcached::memcached()  
*/  
function set_servers ($list)  
{  
$this->_servers = $list;  
$this->_active = count($list);  
$this->_buckets = null;  
$this->_bucketcount = 0;  
 
$this->_single_sock = null;  
if ($this->_active == 1)  
$this->_single_sock = $this->_servers[0];  
}  
 
/**  
* Sets the timeout for new connections  
*  
* @param integer $seconds Number of seconds  
* @param integer $microseconds Number of microseconds  
*  
* @access public  
*/  
function set_timeout ($seconds, $microseconds)  
{  
$this->_timeout_seconds = $seconds;  
$this->_timeout_microseconds = $microseconds;  
}  
 
// }}}  
// }}}  
// {{{ private methods  
// {{{ _close_sock()  
 
/**  
* Close the specified socket  
*  
* @param string $sock Socket to close  
*  
* @access private  
*/  
function _close_sock ($sock)  
{  
$host = array_search($sock, $this->_cache_sock);  
fclose($this->_cache_sock[$host]);  
unset($this->_cache_sock[$host]);  
}  
 
// }}}  
// {{{ _connect_sock()  
 
/**  
* Connects $sock to $host, timing out after $timeout  
*  
* @param integer $sock Socket to connect  
* @param string $host Host:IP to connect to  
*  
* @return boolean  
* @access private  
*/  
function _connect_sock (&$sock, $host)  
{  
list ($ip, $port) = explode(":", $host);  
$sock = false;  
$timeout = $this->_connect_timeout;  
$errno = $errstr = null;  
for ($i = 0; !$sock && $i < $this->_connect_attempts; $i++) {  
if ($i > 0) {  
# Sleep until the timeout, in case it failed fast  
$elapsed = microtime(true) - $t;  
if ( $elapsed < $timeout ) {  
usleep(($timeout - $elapsed) * 1e6);  
}  
$timeout *= 2;  
}  
$t = microtime(true);  
if ($this->_persistant == 1)  
{  
$sock = @pfsockopen($ip, $port, $errno, $errstr, $timeout);  
} else  
{  
$sock = @fsockopen($ip, $port, $errno, $errstr, $timeout);  
}  
}  
if (!$sock) {  
if ($this->_debug)  
$this->_debugprint( "Error connecting to $host: $errstr\n" );  
return false;  
}  
 
// Initialise timeout  
stream_set_timeout($sock, $this->_timeout_seconds, $this->_timeout_microseconds);  
 
return true;  
}  
 
// }}}  
// {{{ _dead_sock()  
 
/**  
* Marks a host as dead until 30-40 seconds in the future  
*  
* @param string $sock Socket to mark as dead  
*  
* @access private  
*/  
function _dead_sock ($sock)  
{  
$host = array_search($sock, $this->_cache_sock);  
@list ($ip, /* $port */) = explode(":", $host);  
$this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10));  
$this->_host_dead[$host] = $this->_host_dead[$ip];  
unset($this->_cache_sock[$host]);  
}  
 
// }}}  
// {{{ get_sock()  
 
/**  
* get_sock  
*  
* @param string $key Key to retrieve value for;  
*  
* @return mixed resource on success, false on failure  
* @access private  
*/  
function get_sock ($key)  
{  
if (!$this->_active)  
return false;  
 
if ($this->_single_sock !== null) {  
$this->_flush_read_buffer($this->_single_sock);  
return $this->sock_to_host($this->_single_sock);  
}  
 
$hv = is_array($key) ? intval($key[0]) : $this->_hashfunc($key);  
 
if ($this->_buckets === null)  
{  
foreach ($this->_servers as $v)  
{  
if (is_array($v))  
{  
for ($i=0; $i<$v[1]; $i++)  
$bu[] = $v[0];  
} else  
{  
$bu[] = $v;  
}  
}  
$this->_buckets = $bu;  
$this->_bucketcount = count($bu);  
}  
 
$realkey = is_array($key) ? $key[1] : $key;  
for ($tries = 0; $tries<20; $tries++)  
{  
$host = $this->_buckets[$hv % $this->_bucketcount];  
$sock = $this->sock_to_host($host);  
if (is_resource($sock)) {  
$this->_flush_read_buffer($sock);  
return $sock;  
}  
$hv = $this->_hashfunc( $hv . $realkey );  
}  
 
return false;  
}  
 
// }}}  
// {{{ _hashfunc()  
 
/**  
* Creates a hash integer based on the $key  
*  
* @param string $key Key to hash  
*  
* @return integer Hash value  
* @access private  
*/  
function _hashfunc ($key)  
{  
# Hash function must on [0,0x7ffffff]  
# We take the first 31 bits of the MD5 hash, which unlike the hash  
# function used in a previous version of this client, works  
return hexdec(substr(md5($key),0,8)) & 0x7fffffff;  
}  
 
// }}}  
// {{{ _incrdecr()  
 
/**  
* Perform increment/decriment on $key  
*  
* @param string $cmd Command to perform  
* @param string $key Key to perform it on  
* @param integer $amt Amount to adjust  
*  
* @return integer New value of $key  
* @access private  
*/  
function _incrdecr ($cmd, $key, $amt=1)  
{  
if (!$this->_active)  
return null;  
 
$sock = $this->get_sock($key);  
if (!is_resource($sock))  
return null;  
 
$key = is_array($key) ? $key[1] : $key;  
@$this->stats[$cmd]++;  
if (!$this->_safe_fwrite($sock, "$cmd $key $amt\r\n"))  
return $this->_dead_sock($sock);  
 
stream_set_timeout($sock, 1, 0);  
$line = fgets($sock);  
$match = array();  
if (!preg_match('/^(\d+)/', $line, $match))  
return null;  
return $match[1];  
}  
 
// }}}  
// {{{ _load_items()  
 
/**  
* Load items into $ret from $sock  
*  
* @param resource $sock Socket to read from  
* @param array $ret Returned values  
*  
* @access private  
*/  
function _load_items ($sock, &$ret)  
{  
while (1)  
{  
$decl = fgets($sock);  
if ($decl == "END\r\n")  
{  
return true;  
} elseif (preg_match('/^VALUE (\S+) (\d+) (\d+)\r\n$/', $decl, $match))  
{  
list($rkey, $flags, $len) = array($match[1], $match[2], $match[3]);  
$bneed = $len+2;  
$offset = 0;  
 
while ($bneed > 0)  
{  
$data = fread($sock, $bneed);  
$n = strlen($data);  
if ($n == 0)  
break;  
$offset += $n;  
$bneed -= $n;  
@$ret[$rkey] .= $data;  
}  
 
if ($offset != $len+2)  
{  
// Something is borked!  
if ($this->_debug)  
$this->_debugprint(sprintf("Something is borked! key %s expecting %d got %d length\n", $rkey, $len+2, $offset));  
 
unset($ret[$rkey]);  
$this->_close_sock($sock);  
return false;  
}  
 
if ($this->_have_zlib && $flags & memcached::COMPRESSED)  
$ret[$rkey] = gzuncompress($ret[$rkey]);  
 
$ret[$rkey] = rtrim($ret[$rkey]);  
 
if ($flags & memcached::SERIALIZED)  
$ret[$rkey] = unserialize($ret[$rkey]);  
 
} else  
{  
$this->_debugprint("Error parsing memcached response\n");  
return 0;  
}  
}  
}  
 
// }}}  
// {{{ _set()  
 
/**  
* Performs the requested storage operation to the memcache server  
*  
* @param string $cmd Command to perform  
* @param string $key Key to act on  
* @param mixed $val What we need to store  
* @param integer $exp When it should expire  
*  
* @return boolean  
* @access private  
*/  
function _set ($cmd, $key, $val, $exp)  
{  
if (!$this->_active)  
return false;  
 
$sock = $this->get_sock($key);  
if (!is_resource($sock))  
return false;  
 
@$this->stats[$cmd]++;  
 
$flags = 0;  
 
if (!is_scalar($val))  
{  
$val = serialize($val);  
$flags |= memcached::SERIALIZED;  
if ($this->_debug)  
$this->_debugprint(sprintf("client: serializing data as it is not scalar\n"));  
}  
 
$len = strlen($val);  
 
if ($this->_have_zlib && $this->_compress_enable &&  
$this->_compress_threshold && $len >= $this->_compress_threshold)  
{  
$c_val = gzcompress($val, 9);  
$c_len = strlen($c_val);  
 
if ($c_len < $len*(1 - memcached::COMPRESSION_SAVINGS))  
{  
if ($this->_debug)  
$this->_debugprint(sprintf("client: compressing data; was %d bytes is now %d bytes\n", $len, $c_len));  
$val = $c_val;  
$len = $c_len;  
$flags |= memcached::COMPRESSED;  
}  
}  
if (!$this->_safe_fwrite($sock, "$cmd $key $flags $exp $len\r\n$val\r\n"))  
return $this->_dead_sock($sock);  
 
$line = trim(fgets($sock));  
 
if ($this->_debug)  
{  
$this->_debugprint(sprintf("%s %s (%s)\n", $cmd, $key, $line));  
}  
if ($line == "STORED")  
return true;  
return false;  
}  
 
// }}}  
// {{{ sock_to_host()  
 
/**  
* Returns the socket for the host  
*  
* @param string $host Host:IP to get socket for  
*  
* @return mixed IO Stream or false  
* @access private  
*/  
function sock_to_host ($host)  
{  
if (isset($this->_cache_sock[$host]))  
return $this->_cache_sock[$host];  
 
$sock = null;  
$now = time();  
list ($ip, /* $port */) = explode (":", $host);  
if (isset($this->_host_dead[$host]) && $this->_host_dead[$host] > $now ||  
isset($this->_host_dead[$ip]) && $this->_host_dead[$ip] > $now)  
return null;  
 
if (!$this->_connect_sock($sock, $host))  
return $this->_dead_sock($host);  
 
// Do not buffer writes  
stream_set_write_buffer($sock, 0);  
 
$this->_cache_sock[$host] = $sock;  
 
return $this->_cache_sock[$host];  
}  
 
function _debugprint($str){  
print($str);  
}  
 
/**  
* Write to a stream, timing out after the correct amount of time  
*  
* @return bool false on failure, true on success  
*/  
/*  
function _safe_fwrite($f, $buf, $len = false) {  
stream_set_blocking($f, 0);  
 
if ($len === false) {  
wfDebug("Writing " . strlen( $buf ) . " bytes\n");  
$bytesWritten = fwrite($f, $buf);  
} else {  
wfDebug("Writing $len bytes\n");  
$bytesWritten = fwrite($f, $buf, $len);  
}  
$n = stream_select($r=NULL, $w = array($f), $e = NULL, 10, 0);  
# $this->_timeout_seconds, $this->_timeout_microseconds);  
 
wfDebug("stream_select returned $n\n");  
stream_set_blocking($f, 1);  
return $n == 1;  
return $bytesWritten;  
}*/  
 
/**  
* Original behaviour  
*/  
function _safe_fwrite($f, $buf, $len = false) {  
if ($len === false) {  
$bytesWritten = fwrite($f, $buf);  
} else {  
$bytesWritten = fwrite($f, $buf, $len);  
}  
return $bytesWritten;  
}  
 
/**  
* Flush the read buffer of a stream  
*/  
function _flush_read_buffer($f) {  
if (!is_resource($f)) {  
return;  
}  
 
$r = array( $f );  
$w = NULL;  
$e = NULL;  
$n = stream_select( $r, $w, $e, 0, 0 );  
while ($n == 1 && !feof($f)) {  
fread($f, 1024);  
$r= array( $f );  
$w = NULL;  
$e = NULL;  
$n = stream_select( $r, $w, $e, 0, 0 );  
}  
}  
 
// }}}  
// }}}  
// }}}  
}  
 
// vim: sts=3 sw=3 et  
 
// }}}  
?>  
PHP Quick Profiler README  
http://particletree.com/features/php-quick-profiler/  
 
#### On This Page ####  
 
1. Introduction and Overview of Files  
2. Getting the Example Working  
3. Setting up the Database Class  
4. Using Smarty instead of PHP echos  
 
#####################################  
1. Introduction and Overview of Files  
#####################################  
 
PHP Quick Profiler is a helper class that outputs debugging related information  
to the screen when the page has finished executing. This zip package contains a  
functional example project that utilizes the helper classes.  
 
- index.php : The landing page of the example. Navigate to it in your browser to see the demo.  
- display.php : Contains the markup for PQP.  
- pqp.tpl : A Smarty variation of the PQP markup.  
- /css/ : The stylesheets used by PQP.  
- /images/ : The images used by PQP.  
- /classes/Console.php : The class used to log items to the PQP display.  
- /classes/MySqlDatabase : A sample database wrapper to explain how database logging could be implemented.  
- /classes/PhpQuickProfiler : The core class that compiles the data before outputting to the browser.  
 
##############################  
2. Getting the Example Working  
##############################  
 
For the most part, the example will work once you drop it in your root directory.  
There are a few settings to check though.  
 
- In PHPQuickProfiler.php, set the $config member variable to the path relative to your root (located in the constructor).  
- If PQP does not appear after navigating to index.php in your browser, locate the destructor  
of the PQPExample class (at the bottom). Rename the function from __destruct() to display(). Then,  
manually call the function display() just underneath the class after the call to init(). The reason this would  
happen is because the destructor is not firing on your server configuration.  
- At this point, everything should work except for the database tab.  
 
################################  
3. Setting up the Database Class  
################################  
 
NOTE - This step does require knowledge on PHP / Database interactions. There is no copy/paste solution.  
 
Logging database data is by far the hardest part of integrating PQP into your own project. It  
requires that you have some sort of database wrapper around your code. If you do, it should be easy to implement.  
To show you how it works, follow these steps with the sample database class we have provided.  
 
- Create a database named 'test' and run the following query on it.  
 
CREATE TABLE `Posts` (  
`PostId` int(11) unsigned NOT NULL default '0',  
PRIMARY KEY (`PostId`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1  
 
- In index.php, uncomment out the second include, which includes the database class.  
- In index.php, uncomment out the function sampleDatabaseData().  
- In the sampleDatabaseData(), supply your database host, username, password, and database name.  
 
Given those steps, database logging will be enabled. If you would like to transition this to your own database class,  
open /classes/MySqlDatabase.php and note the following:  
 
- $queryCount and $queries member variables declared on initialization  
- When a query is run, the following is executed:  
 
$start = $this->getTime();  
$rs = mysql_query($sql, $this->conn);  
$this->queryCount += 1;  
$this->logQuery($sql, $start);  
 
- Everything in /classes/MySqlDatabase.php under the section comment "Debugging"  
must be available for the above snippet to work.  
 
####################################  
4. Using Smarty instead of PHP echos  
####################################  
 
We love Smarty and hate echos, but to make this work for everyone we set the default as echos. To show love  
to the Smarty users out there, we have included a pqp.tpl file for PQP. To make it work, you would have to change  
the following in /classes/PhpQuickProfiler.php:  
 
- Add a require_once to your Smarty Library.  
- In the constructor, declare an instance of Smarty: $this->smarty = new Smarty(...);  
- Everywhere in in the code you see $this->output[... change it to a smarty assign. For example:  
 
$this->output['logs'] = $logs;  
 
... becomes ...  
 
$this->smarty->assign('logs', $logs);  
 
After doing it once, you'll see the pattern and can probably use a find/replace to do the rest quickly.  
 
- Locate the display() function at the bottom. Remove the last 2 lines, and add:  
 
$this->smarty->display('pathToDisplay.tpl');  
 
All set after that!  
 
<?php  
 
/* - - - - - - - - - - - - - - - - - - - - -  
 
Title : PHP Quick Profiler Console Class  
Author : Created by Ryan Campbell  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 22, 2009  
 
Description : This class serves as a wrapper around a global  
php variable, debugger_logs, that we have created.  
 
- - - - - - - - - - - - - - - - - - - - - */  
 
class Console {  
 
/*-----------------------------------  
LOG A VARIABLE TO CONSOLE  
------------------------------------*/  
 
public static function log($data) {  
$logItem = array(  
"data" => $data,  
"type" => 'log'  
);  
$GLOBALS['debugger_logs']['console'][] = $logItem;  
$GLOBALS['debugger_logs']['logCount'] += 1;  
}  
 
/*---------------------------------------------------  
LOG MEMORY USAGE OF VARIABLE OR ENTIRE SCRIPT  
-----------------------------------------------------*/  
 
public function logMemory($object = false, $name = 'PHP') {  
$memory = memory_get_usage();  
if($object) $memory = strlen(serialize($object));  
$logItem = array(  
"data" => $memory,  
"type" => 'memory',  
"name" => $name,  
"dataType" => gettype($object)  
);  
$GLOBALS['debugger_logs']['console'][] = $logItem;  
$GLOBALS['debugger_logs']['memoryCount'] += 1;  
}  
 
/*-----------------------------------  
LOG A PHP EXCEPTION OBJECT  
------------------------------------*/  
 
public function logError($exception, $message) {  
$logItem = array(  
"data" => $message,  
"type" => 'error',  
"file" => $exception->getFile(),  
"line" => $exception->getLine()  
);  
$GLOBALS['debugger_logs']['console'][] = $logItem;  
$GLOBALS['debugger_logs']['errorCount'] += 1;  
}  
 
/*------------------------------------  
POINT IN TIME SPEED SNAPSHOT  
-------------------------------------*/  
 
public function logSpeed($name = 'Point in Time') {  
$logItem = array(  
"data" => PhpQuickProfiler::getMicroTime(),  
"type" => 'speed',  
"name" => $name  
);  
$GLOBALS['debugger_logs']['console'][] = $logItem;  
$GLOBALS['debugger_logs']['speedCount'] += 1;  
}  
 
/*-----------------------------------  
SET DEFAULTS & RETURN LOGS  
------------------------------------*/  
 
public function getLogs() {  
if(!$GLOBALS['debugger_logs']['memoryCount']) $GLOBALS['debugger_logs']['memoryCount'] = 0;  
if(!$GLOBALS['debugger_logs']['logCount']) $GLOBALS['debugger_logs']['logCount'] = 0;  
if(!$GLOBALS['debugger_logs']['speedCount']) $GLOBALS['debugger_logs']['speedCount'] = 0;  
if(!$GLOBALS['debugger_logs']['errorCount']) $GLOBALS['debugger_logs']['errorCount'] = 0;  
return $GLOBALS['debugger_logs'];  
}  
}  
 
?>  
<?php  
 
/* - - - - - - - - - - - - - - - - - - - - -  
 
Title : PHP Quick Profiler MySQL Class  
Author : Created by Ryan Campbell  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 22, 2009  
 
Description : A simple database wrapper that includes  
logging of queries.  
 
- - - - - - - - - - - - - - - - - - - - - */  
 
class MySqlDatabase {  
 
private $host;  
private $user;  
private $password;  
private $database;  
public $queryCount = 0;  
public $queries = array();  
public $conn;  
 
/*------------------------------------  
CONFIG CONNECTION  
------------------------------------*/  
 
function __construct($host, $user, $password) {  
$this->host = $host;  
$this->user = $user;  
$this->password = $password;  
}  
 
function connect($new = false) {  
$this->conn = mysql_connect($this->host, $this->user, $this->password, $new);  
if(!$this->conn) {  
throw new Exception('We\'re working on a few connection issues.');  
}  
}  
 
function changeDatabase($database) {  
$this->database = $database;  
if($this->conn) {  
if(!mysql_select_db($database, $this->conn)) {  
throw new CustomException('We\'re working on a few connection issues.');  
}  
}  
}  
 
function lazyLoadConnection() {  
$this->connect(true);  
if($this->database) $this->changeDatabase($this->database);  
}  
 
/*-----------------------------------  
QUERY  
------------------------------------*/  
 
function query($sql) {  
if(!$this->conn) $this->lazyLoadConnection();  
$start = $this->getTime();  
$rs = mysql_query($sql, $this->conn);  
$this->queryCount += 1;  
$this->logQuery($sql, $start);  
if(!$rs) {  
throw new Exception('Could not execute query.');  
}  
return $rs;  
}  
 
/*-----------------------------------  
DEBUGGING  
------------------------------------*/  
 
function logQuery($sql, $start) {  
$query = array(  
'sql' => $sql,  
'time' => ($this->getTime() - $start)*1000  
);  
array_push($this->queries, $query);  
}  
 
function getTime() {  
$time = microtime();  
$time = explode(' ', $time);  
$time = $time[1] + $time[0];  
$start = $time;  
return $start;  
}  
 
public function getReadableTime($time) {  
$ret = $time;  
$formatter = 0;  
$formats = array('ms', 's', 'm');  
if($time >= 1000 && $time < 60000) {  
$formatter = 1;  
$ret = ($time / 1000);  
}  
if($time >= 60000) {  
$formatter = 2;  
$ret = ($time / 1000) / 60;  
}  
$ret = number_format($ret,3,'.','') . ' ' . $formats[$formatter];  
return $ret;  
}  
 
function __destruct() {  
@mysql_close($this->conn);  
}  
 
}  
 
?>  
 
<?php  
 
/* - - - - - - - - - - - - - - - - - - - - -  
 
Title : PHP Quick Profiler Class  
Author : Created by Ryan Campbell  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 22, 2009  
 
Description : This class processes the logs and organizes the data  
for output to the browser. Initialize this class with a start time at  
the beginning of your code, and then call the display method when your code  
is terminating.  
 
- - - - - - - - - - - - - - - - - - - - - */  
 
class PhpQuickProfiler {  
 
public $output = array();  
public $config = '';  
 
public function __construct($startTime, $config = 'pqp/') {  
$this->startTime = $startTime;  
$this->config = $config;  
require_once($config.'classes/Console.php');  
}  
 
/*-------------------------------------------  
FORMAT THE DIFFERENT TYPES OF LOGS  
-------------------------------------------*/  
 
public function gatherConsoleData() {  
$logs = Console::getLogs();  
if($logs['console']) {  
foreach($logs['console'] as $key => $log) {  
if($log['type'] == 'log') {  
$logs['console'][$key]['data'] = print_r($log['data'], true);  
}  
elseif($log['type'] == 'memory') {  
$logs['console'][$key]['data'] = $this->getReadableFileSize($log['data']);  
}  
elseif($log['type'] == 'speed') {  
$logs['console'][$key]['data'] = $this->getReadableTime(($log['data'] - $this->startTime)*1000);  
}  
}  
}  
$this->output['logs'] = $logs;  
}  
 
/*-------------------------------------------  
AGGREGATE DATA ON THE FILES INCLUDED  
-------------------------------------------*/  
 
public function gatherFileData() {  
$files = get_included_files();  
$fileList = array();  
$fileTotals = array(  
"count" => count($files),  
"size" => 0,  
"largest" => 0,  
);  
 
foreach($files as $key => $file) {  
$size = filesize($file);  
$fileList[] = array(  
'name' => $file,  
'size' => $this->getReadableFileSize($size)  
);  
$fileTotals['size'] += $size;  
if($size > $fileTotals['largest']) $fileTotals['largest'] = $size;  
}  
 
$fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']);  
$fileTotals['largest'] = $this->getReadableFileSize($fileTotals['largest']);  
$this->output['files'] = $fileList;  
$this->output['fileTotals'] = $fileTotals;  
}  
 
/*-------------------------------------------  
MEMORY USAGE AND MEMORY AVAILABLE  
-------------------------------------------*/  
 
public function gatherMemoryData() {  
$memoryTotals = array();  
$memoryTotals['used'] = $this->getReadableFileSize(memory_get_peak_usage());  
$memoryTotals['total'] = ini_get("memory_limit");  
$this->output['memoryTotals'] = $memoryTotals;  
}  
 
/*--------------------------------------------------------  
QUERY DATA -- DATABASE OBJECT WITH LOGGING REQUIRED  
----------------------------------------------------------*/  
 
public function gatherQueryData() {  
$queryTotals = array();  
$queryTotals['count'] = 0;  
$queryTotals['time'] = 0;  
$queries = array();  
 
if($this->db != '') {  
$queryTotals['count'] += $this->db->queryCount;  
foreach($this->db->queries as $key => $query) {  
$query = $this->attemptToExplainQuery($query);  
$queryTotals['time'] += $query['time'];  
$query['time'] = $this->getReadableTime($query['time']);  
$queries[] = $query;  
}  
}  
 
$queryTotals['time'] = $this->getReadableTime($queryTotals['time']);  
$this->output['queries'] = $queries;  
$this->output['queryTotals'] = $queryTotals;  
}  
 
/*--------------------------------------------------------  
CALL SQL EXPLAIN ON THE QUERY TO FIND MORE INFO  
----------------------------------------------------------*/  
 
function attemptToExplainQuery($query) {  
try {  
$sql = 'EXPLAIN '.$query['sql'];  
$rs = $this->db->query($sql);  
}  
catch(Exception $e) {}  
if($rs) {  
$row = mysql_fetch_array($rs, MYSQL_ASSOC);  
$query['explain'] = $row;  
}  
return $query;  
}  
 
/*-------------------------------------------  
SPEED DATA FOR ENTIRE PAGE LOAD  
-------------------------------------------*/  
 
public function gatherSpeedData() {  
$speedTotals = array();  
$speedTotals['total'] = $this->getReadableTime(($this->getMicroTime() - $this->startTime)*1000);  
$speedTotals['allowed'] = ini_get("max_execution_time");  
$this->output['speedTotals'] = $speedTotals;  
}  
 
/*-------------------------------------------  
HELPER FUNCTIONS TO FORMAT DATA  
-------------------------------------------*/  
 
function getMicroTime() {  
$time = microtime();  
$time = explode(' ', $time);  
return $time[1] + $time[0];  
}  
 
public function getReadableFileSize($size, $retstring = null) {  
// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php  
$sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');  
 
if ($retstring === null) { $retstring = '%01.2f %s'; }  
 
$lastsizestring = end($sizes);  
 
foreach ($sizes as $sizestring) {  
if ($size < 1024) { break; }  
if ($sizestring != $lastsizestring) { $size /= 1024; }  
}  
if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional  
return sprintf($retstring, $size, $sizestring);  
}  
 
public function getReadableTime($time) {  
$ret = $time;  
$formatter = 0;  
$formats = array('ms', 's', 'm');  
if($time >= 1000 && $time < 60000) {  
$formatter = 1;  
$ret = ($time / 1000);  
}  
if($time >= 60000) {  
$formatter = 2;  
$ret = ($time / 1000) / 60;  
}  
$ret = number_format($ret,3,'.','') . ' ' . $formats[$formatter];  
return $ret;  
}  
 
/*---------------------------------------------------------  
DISPLAY TO THE SCREEN -- CALL WHEN CODE TERMINATING  
-----------------------------------------------------------*/  
 
public function display($db = '', $master_db = '') {  
$this->db = $db;  
$this->master_db = $master_db;  
$this->gatherConsoleData();  
$this->gatherFileData();  
$this->gatherMemoryData();  
$this->gatherQueryData();  
$this->gatherSpeedData();  
require_once($this->config.'display.php');  
displayPqp($this->output, OWA_PUBLIC_URL.'includes/pqp/');  
}  
 
}  
 
?>  
/* - - - - - - - - - - - - - - - - - - - - -  
 
Title : PHP Quick Profiler CSS  
Author : Designed by Kevin Hale.  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 21, 2009  
 
- - - - - - - - - - - - - - - - - - - - - */  
 
.pQp{  
width:100%;  
text-align:center;  
position:fixed;  
bottom:0;  
}  
* html .pQp{  
position:absolute;  
}  
.pQp *{  
margin:0;  
padding:0;  
border:none;  
}  
#pQp{  
margin:0 auto;  
width:85%;  
min-width:960px;  
background-color:#222;  
border:12px solid #000;  
border-bottom:none;  
font-family:"Lucida Grande", Tahoma, Arial, sans-serif;  
-webkit-border-top-left-radius:15px;  
-webkit-border-top-right-radius:15px;  
-moz-border-radius-topleft:15px;  
-moz-border-radius-topright:15px;  
}  
#pQp .pqp-box h3{  
font-weight:normal;  
line-height:200px;  
padding:0 15px;  
color:#fff;  
}  
.pQp, .pQp td{  
color:#444;  
}  
 
/* ----- IDS ----- */  
 
#pqp-metrics{  
background:#000;  
width:100%;  
}  
#pqp-console, #pqp-speed, #pqp-queries, #pqp-memory, #pqp-files{  
background:url(../images/overlay.gif);  
border-top:1px solid #ccc;  
height:200px;  
overflow:auto;  
}  
 
/* ----- Colors ----- */  
 
.pQp .green{color:#588E13 !important;}  
.pQp .blue{color:#3769A0 !important;}  
.pQp .purple{color:#953FA1 !important;}  
.pQp .orange{color:#D28C00 !important;}  
.pQp .red{color:#B72F09 !important;}  
 
/* ----- Logic ----- */  
 
#pQp, #pqp-console, #pqp-speed, #pqp-queries, #pqp-memory, #pqp-files{  
display:none;  
}  
.pQp .console, .pQp .speed, .pQp .queries, .pQp .memory, .pQp .files{  
display:block !important;  
}  
.pQp .console #pqp-console, .pQp .speed #pqp-speed, .pQp .queries #pqp-queries,  
.pQp .memory #pqp-memory, .pQp .files #pqp-files{  
display:block;  
}  
.console td.green, .speed td.blue, .queries td.purple, .memory td.orange, .files td.red{  
background:#222 !important;  
border-bottom:6px solid #fff !important;  
cursor:default !important;  
}  
 
.tallDetails #pQp .pqp-box{  
height:500px;  
}  
.tallDetails #pQp .pqp-box h3{  
line-height:500px;  
}  
.hideDetails #pQp .pqp-box{  
display:none !important;  
}  
.hideDetails #pqp-footer{  
border-top:1px dotted #444;  
}  
.hideDetails #pQp #pqp-metrics td{  
height:50px;  
background:#000 !important;  
border-bottom:none !important;  
cursor:default !important;  
}  
.hideDetails #pQp var{  
font-size:18px;  
margin:0 0 2px 0;  
}  
.hideDetails #pQp h4{  
font-size:10px;  
}  
.hideDetails .heightToggle{  
visibility:hidden;  
}  
 
/* ----- Metrics ----- */  
 
#pqp-metrics td{  
height:80px;  
width:20%;  
text-align:center;  
cursor:pointer;  
border:1px solid #000;  
border-bottom:6px solid #444;  
-webkit-border-top-left-radius:10px;  
-moz-border-radius-topleft:10px;  
-webkit-border-top-right-radius:10px;  
-moz-border-radius-topright:10px;  
}  
#pqp-metrics td:hover{  
background:#222;  
border-bottom:6px solid #777;  
}  
#pqp-metrics .green{  
border-left:none;  
}  
#pqp-metrics .red{  
border-right:none;  
}  
 
#pqp-metrics h4{  
text-shadow:#000 1px 1px 1px;  
}  
.side var{  
text-shadow:#444 1px 1px 1px;  
}  
 
.pQp var{  
font-size:23px;  
font-weight:bold;  
font-style:normal;  
margin:0 0 3px 0;  
display:block;  
}  
.pQp h4{  
font-size:12px;  
color:#fff;  
margin:0 0 4px 0;  
}  
 
/* ----- Main ----- */  
 
.pQp .main{  
width:80%;  
}  
*+html .pQp .main{  
width:78%;  
}  
* html .pQp .main{  
width:77%;  
}  
.pQp .main td{  
padding:7px 15px;  
text-align:left;  
background:#151515;  
border-left:1px solid #333;  
border-right:1px solid #333;  
border-bottom:1px dotted #323232;  
color:#FFF;  
}  
.pQp .main td, pre{  
font-family:Monaco, "Consolas", "Lucida Console", "Courier New", monospace;  
font-size:11px;  
}  
.pQp .main td.alt{  
background:#111;  
}  
.pQp .main tr.alt td{  
background:#2E2E2E;  
border-top:1px dotted #4E4E4E;  
}  
.pQp .main tr.alt td.alt{  
background:#333;  
}  
.pQp .main td b{  
float:right;  
font-weight:normal;  
color:#E6F387;  
}  
.pQp .main td:hover{  
background:#2E2E2E;  
}  
 
/* ----- Side ----- */  
 
.pQp .side{  
float:left;  
width:20%;  
background:#000;  
color:#fff;  
-webkit-border-bottom-left-radius:30px;  
-moz-border-radius-bottomleft:30px;  
text-align:center;  
}  
.pQp .side td{  
padding:10px 0 5px 0;  
background:url(../images/side.png) repeat-y right;  
}  
.pQp .side var{  
color:#fff;  
font-size:15px;  
}  
.pQp .side h4{  
font-weight:normal;  
color:#F4FCCA;  
font-size:11px;  
}  
 
/* ----- Console ----- */  
 
#pqp-console .side td{  
padding:12px 0;  
}  
#pqp-console .side td.alt1{  
background:#588E13;  
width:51%;  
}  
#pqp-console .side td.alt2{  
background-color:#B72F09;  
}  
#pqp-console .side td.alt3{  
background:#D28C00;  
border-bottom:1px solid #9C6800;  
border-left:1px solid #9C6800;  
-webkit-border-bottom-left-radius:30px;  
-moz-border-radius-bottomleft:30px;  
}  
#pqp-console .side td.alt4{  
background-color:#3769A0;  
border-bottom:1px solid #274B74;  
}  
 
#pqp-console .main table{  
width:100%;  
}  
#pqp-console td div{  
width:100%;  
overflow:hidden;  
}  
#pqp-console td.type{  
font-family:"Lucida Grande", Tahoma, Arial, sans-serif;  
text-align:center;  
text-transform: uppercase;  
font-size:9px;  
padding-top:9px;  
color:#F4FCCA;  
vertical-align:top;  
width:40px;  
}  
.pQp .log-log td.type{  
background:#47740D !important;  
}  
.pQp .log-error td.type{  
background:#9B2700 !important;  
}  
.pQp .log-memory td.type{  
background:#D28C00 !important;  
}  
.pQp .log-speed td.type{  
background:#2B5481 !important;  
}  
 
.pQp .log-log pre{  
color:#999;  
}  
.pQp .log-log td:hover pre{  
color:#fff;  
}  
 
.pQp .log-memory em, .pQp .log-speed em{  
float:left;  
font-style:normal;  
display:block;  
color:#fff;  
}  
.pQp .log-memory pre, .pQp .log-speed pre{  
float:right;  
white-space: normal;  
display:block;  
color:#FFFD70;  
}  
 
/* ----- Speed ----- */  
 
#pqp-speed .side td{  
padding:12px 0;  
}  
#pqp-speed .side{  
background-color:#3769A0;  
}  
#pqp-speed .side td.alt{  
background-color:#2B5481;  
border-bottom:1px solid #1E3C5C;  
border-left:1px solid #1E3C5C;  
-webkit-border-bottom-left-radius:30px;  
-moz-border-radius-bottomleft:30px;  
}  
 
/* ----- Queries ----- */  
 
#pqp-queries .side{  
background-color:#953FA1;  
border-bottom:1px solid #662A6E;  
border-left:1px solid #662A6E;  
}  
#pqp-queries .side td.alt{  
background-color:#7B3384;  
}  
#pqp-queries .main b{  
float:none;  
}  
#pqp-queries .main em{  
display:block;  
padding:2px 0 0 0;  
font-style:normal;  
color:#aaa;  
}  
 
/* ----- Memory ----- */  
 
#pqp-memory .side td{  
padding:12px 0;  
}  
#pqp-memory .side{  
background-color:#C48200;  
}  
#pqp-memory .side td.alt{  
background-color:#AC7200;  
border-bottom:1px solid #865900;  
border-left:1px solid #865900;  
-webkit-border-bottom-left-radius:30px;  
-moz-border-radius-bottomleft:30px;  
}  
 
/* ----- Files ----- */  
 
#pqp-files .side{  
background-color:#B72F09;  
border-bottom:1px solid #7C1F00;  
border-left:1px solid #7C1F00;  
}  
#pqp-files .side td.alt{  
background-color:#9B2700;  
}  
 
/* ----- Footer ----- */  
 
#pqp-footer{  
width:100%;  
background:#000;  
font-size:11px;  
border-top:1px solid #ccc;  
}  
#pqp-footer td{  
padding:0 !important;  
border:none !important;  
}  
#pqp-footer strong{  
color:#fff;  
}  
#pqp-footer a{  
color:#999;  
padding:5px 10px;  
text-decoration:none;  
}  
#pqp-footer .credit{  
width:20%;  
text-align:left;  
}  
#pqp-footer .actions{  
width:80%;  
text-align:right;  
}  
#pqp-footer .actions a{  
float:right;  
width:auto;  
}  
#pqp-footer a:hover, #pqp-footer a:hover strong, #pqp-footer a:hover b{  
background:#fff;  
color:blue !important;  
text-decoration:underline;  
}  
#pqp-footer a:active, #pqp-footer a:active strong, #pqp-footer a:active b{  
background:#ECF488;  
color:green !important;  
}  
<?php  
 
/* - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 
Title : HTML Output for Php Quick Profiler  
Author : Created by Ryan Campbell  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 22, 2009  
 
Description : This is a horribly ugly function used to output  
the PQP HTML. This is great because it will just work in your project,  
but it is hard to maintain and read. See the README file for how to use  
the Smarty file we provided with PQP.  
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - */  
 
function displayPqp($output, $config) {  
 
$cssUrl = $config.'css/pQp.css';  
 
echo <<<JAVASCRIPT  
<!-- JavaScript -->  
<script type="text/javascript">  
var PQP_DETAILS = true;  
var PQP_HEIGHT = "short";  
 
addEvent(window, 'load', loadCSS);  
 
function changeTab(tab) {  
var pQp = document.getElementById('pQp');  
hideAllTabs();  
addClassName(pQp, tab, true);  
}  
 
function hideAllTabs() {  
var pQp = document.getElementById('pQp');  
removeClassName(pQp, 'console');  
removeClassName(pQp, 'speed');  
removeClassName(pQp, 'queries');  
removeClassName(pQp, 'memory');  
removeClassName(pQp, 'files');  
}  
 
function toggleDetails(){  
var container = document.getElementById('pqp-container');  
 
if(PQP_DETAILS){  
addClassName(container, 'hideDetails', true);  
PQP_DETAILS = false;  
}  
else{  
removeClassName(container, 'hideDetails');  
PQP_DETAILS = true;  
}  
}  
function toggleHeight(){  
var container = document.getElementById('pqp-container');  
 
if(PQP_HEIGHT == "short"){  
addClassName(container, 'tallDetails', true);  
PQP_HEIGHT = "tall";  
}  
else{  
removeClassName(container, 'tallDetails');  
PQP_HEIGHT = "short";  
}  
}  
 
function loadCSS() {  
var sheet = document.createElement("link");  
sheet.setAttribute("rel", "stylesheet");  
sheet.setAttribute("type", "text/css");  
sheet.setAttribute("href", "$cssUrl");  
document.getElementsByTagName("head")[0].appendChild(sheet);  
setTimeout(function(){document.getElementById("pqp-container").style.display = "block"}, 10);  
}  
 
 
//http://www.bigbold.com/snippets/posts/show/2630  
function addClassName(objElement, strClass, blnMayAlreadyExist){  
if ( objElement.className ){  
var arrList = objElement.className.split(' ');  
if ( blnMayAlreadyExist ){  
var strClassUpper = strClass.toUpperCase();  
for ( var i = 0; i < arrList.length; i++ ){  
if ( arrList[i].toUpperCase() == strClassUpper ){  
arrList.splice(i, 1);  
i--;  
}  
}  
}  
arrList[arrList.length] = strClass;  
objElement.className = arrList.join(' ');  
}  
else{  
objElement.className = strClass;  
}  
}  
 
//http://www.bigbold.com/snippets/posts/show/2630  
function removeClassName(objElement, strClass){  
if ( objElement.className ){  
var arrList = objElement.className.split(' ');  
var strClassUpper = strClass.toUpperCase();  
for ( var i = 0; i < arrList.length; i++ ){  
if ( arrList[i].toUpperCase() == strClassUpper ){  
arrList.splice(i, 1);  
i--;  
}  
}  
objElement.className = arrList.join(' ');  
}  
}  
 
//http://ejohn.org/projects/flexible-javascript-events/  
function addEvent( obj, type, fn ) {  
if ( obj.attachEvent ) {  
obj["e"+type+fn] = fn;  
obj[type+fn] = function() { obj["e"+type+fn]( window.event ) };  
obj.attachEvent( "on"+type, obj[type+fn] );  
}  
else{  
obj.addEventListener( type, fn, false );  
}  
}  
</script>  
JAVASCRIPT;  
 
echo '<div id="pqp-container" class="pQp" style="display:none">';  
 
$logCount = count($output['logs']['console']);  
$fileCount = count($output['files']);  
$memoryUsed = $output['memoryTotals']['used'];  
$queryCount = $output['queryTotals']['count'];  
$speedTotal = $output['speedTotals']['total'];  
 
echo <<<PQPTABS  
<div id="pQp" class="console">  
<table id="pqp-metrics" cellspacing="0">  
<tr>  
<td class="green" onclick="changeTab('console');">  
<var>$logCount</var>  
<h4>Console</h4>  
</td>  
<td class="blue" onclick="changeTab('speed');">  
<var>$speedTotal</var>  
<h4>Load Time</h4>  
</td>  
<td class="purple" onclick="changeTab('queries');">  
<var>$queryCount Queries</var>  
<h4>Database</h4>  
</td>  
<td class="orange" onclick="changeTab('memory');">  
<var>$memoryUsed</var>  
<h4>Memory Used</h4>  
</td>  
<td class="red" onclick="changeTab('files');">  
<var>{$fileCount} Files</var>  
<h4>Included</h4>  
</td>  
</tr>  
</table>  
PQPTABS;  
 
echo '<div id="pqp-console" class="pqp-box">';  
 
if($logCount == 0) {  
echo '<h3>This panel has no log items.</h3>';  
}  
else {  
echo '<table class="side" cellspacing="0">  
<tr>  
<td class="alt1"><var>'.$output['logs']['logCount'].'</var><h4>Logs</h4></td>  
<td class="alt2"><var>'.$output['logs']['errorCount'].'</var> <h4>Errors</h4></td>  
</tr>  
<tr>  
<td class="alt3"><var>'.$output['logs']['memoryCount'].'</var> <h4>Memory</h4></td>  
<td class="alt4"><var>'.$output['logs']['speedCount'].'</var> <h4>Speed</h4></td>  
</tr>  
</table>  
<table class="main" cellspacing="0">';  
 
$class = '';  
foreach($output['logs']['console'] as $log) {  
echo '<tr class="log-'.$log['type'].'">  
<td class="type">'.$log['type'].'</td>  
<td class="'.$class.'">';  
if($log['type'] == 'log') {  
echo '<div><pre>'.$log['data'].'</pre></div>';  
}  
elseif($log['type'] == 'memory') {  
echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>';  
}  
elseif($log['type'] == 'speed') {  
echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';  
}  
elseif($log['type'] == 'error') {  
echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>';  
}  
 
echo '</td></tr>';  
if($class == '') $class = 'alt';  
else $class = '';  
}  
 
echo '</table>';  
}  
 
echo '</div>';  
 
echo '<div id="pqp-speed" class="pqp-box">';  
 
if($output['logs']['speedCount'] == 0) {  
echo '<h3>This panel has no log items.</h3>';  
}  
else {  
echo '<table class="side" cellspacing="0">  
<tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr>  
<tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr>  
</table>  
<table class="main" cellspacing="0">';  
 
$class = '';  
foreach($output['logs']['console'] as $log) {  
if($log['type'] == 'speed') {  
echo '<tr class="log-'.$log['type'].'">  
<td class="'.$class.'">';  
echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';  
echo '</td></tr>';  
if($class == '') $class = 'alt';  
else $class = '';  
}  
}  
 
echo '</table>';  
}  
 
echo '</div>';  
 
echo '<div id="pqp-queries" class="pqp-box">';  
 
if($output['queryTotals']['count'] == 0) {  
echo '<h3>This panel has no log items.</h3>';  
}  
else {  
echo '<table class="side" cellspacing="0">  
<tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr>  
<tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr>  
<tr><td><var>0</var> <h4>Duplicates</h4></td></tr>  
</table>  
<table class="main" cellspacing="0">';  
 
$class = '';  
foreach($output['queries'] as $query) {  
echo '<tr>  
<td class="'.$class.'">'.$query['sql'];  
if($query['explain']) {  
echo '<em>  
Possible keys: <b>'.$query['explain']['possible_keys'].'</b> &middot;  
Key Used: <b>'.$query['explain']['key'].'</b> &middot;  
Type: <b>'.$query['explain']['type'].'</b> &middot;  
Rows: <b>'.$query['explain']['rows'].'</b> &middot;  
Speed: <b>'.$query['time'].'</b>  
</em>';  
}  
echo '</td></tr>';  
if($class == '') $class = 'alt';  
else $class = '';  
}  
 
echo '</table>';  
}  
 
echo '</div>';  
 
echo '<div id="pqp-memory" class="pqp-box">';  
 
if($output['logs']['memoryCount'] == 0) {  
echo '<h3>This panel has no log items.</h3>';  
}  
else {  
echo '<table class="side" cellspacing="0">  
<tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr>  
<tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr>  
</table>  
<table class="main" cellspacing="0">';  
 
$class = '';  
foreach($output['logs']['console'] as $log) {  
if($log['type'] == 'memory') {  
echo '<tr class="log-'.$log['type'].'">';  
echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>';  
echo '</tr>';  
if($class == '') $class = 'alt';  
else $class = '';  
}  
}  
 
echo '</table>';  
}  
 
echo '</div>';  
 
echo '<div id="pqp-files" class="pqp-box">';  
 
if($output['fileTotals']['count'] == 0) {  
echo '<h3>This panel has no log items.</h3>';  
}  
else {  
echo '<table class="side" cellspacing="0">  
<tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr>  
<tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr>  
<tr><td><var>'.$output['fileTotals']['largest'].'</var> <h4>Largest</h4></td></tr>  
</table>  
<table class="main" cellspacing="0">';  
 
$class ='';  
foreach($output['files'] as $file) {  
echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>';  
if($class == '') $class = 'alt';  
else $class = '';  
}  
 
echo '</table>';  
}  
 
echo '</div>';  
 
echo <<<FOOTER  
<table id="pqp-footer" cellspacing="0">  
<tr>  
<td class="credit">  
<a href="http://particletree.com" target="_blank">  
<strong>PHP</strong>  
<b class="green">Q</b><b class="blue">u</b><b class="purple">i</b><b class="orange">c</b><b class="red">k</b>  
Profiler</a></td>  
<td class="actions">  
<a href="#" onclick="toggleDetails();return false">Details</a>  
<a class="heightToggle" href="#" onclick="toggleHeight();return false">Height</a>  
</td>  
</tr>  
</table>  
FOOTER;  
 
echo '</div></div>';  
 
}  
 
?>  
 Binary files a/busui/owa/includes/pqp/images/overlay.gif and /dev/null differ
 Binary files a/busui/owa/includes/pqp/images/side.png and /dev/null differ
<?php  
 
/* - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 
Title : Sample Landing page for PHP Quick Profiler Class  
Author : Created by Ryan Campbell  
URL : http://particletree.com/features/php-quick-profiler/  
 
Last Updated : April 22, 2009  
 
Description : This file contains the basic class shell needed  
to use PQP. In addition, the init() function calls for example  
usages of how PQP can aid debugging. See README file for help  
setting this example up.  
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - */  
 
require_once('classes/PhpQuickProfiler.php');  
//require_once('classes/MySqlDatabase.php');  
 
class PQPExample {  
 
private $profiler;  
private $db = '';  
 
public function __construct() {  
$this->profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime());  
}  
 
public function init() {  
$this->sampleConsoleData();  
$this->sampleDatabaseData();  
$this->sampleMemoryLeak();  
$this->sampleSpeedComparison();  
}  
 
/*-------------------------------------------  
EXAMPLES OF THE 4 CONSOLE FUNCTIONS  
-------------------------------------------*/  
 
public function sampleConsoleData() {  
try {  
Console::log('Begin logging data');  
Console::logMemory($this, 'PQP Example Class : Line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::log(array('Name' => 'Ryan', 'Last' => 'Campbell'));  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logMemory($this, 'PQP Example Class : Line '.__LINE__);  
Console::log('Ending log below with a sample error.');  
throw new Exception('Unable to write to log!');  
}  
catch(Exception $e) {  
Console::logError($e, 'Sample error logging.');  
}  
}  
 
/*-------------------------------------  
DATABASE OBJECT TO LOG QUERIES  
--------------------------------------*/  
 
public function sampleDatabaseData() {  
/*$this->db = new MySqlDatabase(  
'your DB host',  
'your DB user',  
'your DB password');  
$this->db->connect(true);  
$this->db->changeDatabase('your db name');  
 
$sql = 'SELECT PostId FROM Posts WHERE PostId > 2';  
$rs = $this->db->query($sql);  
 
$sql = 'SELECT COUNT(PostId) FROM Posts';  
$rs = $this->db->query($sql);  
 
$sql = 'SELECT COUNT(PostId) FROM Posts WHERE PostId != 1';  
$rs = $this->db->query($sql);*/  
}  
 
/*-----------------------------------  
EXAMPLE MEMORY LEAK DETECTED  
------------------------------------*/  
 
public function sampleMemoryLeak() {  
$ret = '';  
$longString = 'This is a really long string that when appended with the . symbol  
will cause memory to be duplicated in order to create the new string.';  
for($i = 0; $i < 10; $i++) {  
$ret = $ret . $longString;  
Console::logMemory($ret, 'Watch memory leak -- iteration '.$i);  
}  
}  
 
/*-----------------------------------  
POINT IN TIME SPEED MARKS  
------------------------------------*/  
 
public function sampleSpeedComparison() {  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
Console::logSpeed('Time taken to get to line '.__LINE__);  
}  
 
public function __destruct() {  
$this->profiler->display($this->db);  
}  
 
}  
 
$pqp = new PQPExample();  
$pqp->init();  
 
?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
 
<title>  
PHP Quick Profiler Demo  
</title>  
 
 
<!-- CSS -->  
 
<style type="text/css">  
body{  
font-family:"Lucida Grande", Tahoma, Arial, sans-serif;  
margin:100px 0 0 0;  
background:#eee;  
}  
h3{  
line-height:160%;  
}  
#box{  
margin:100px auto 0 auto;  
width: 450px;  
padding:10px 20px 30px 20px;  
background-color: #FFF;  
border: 10px solid #dedede;  
}  
#box ul {  
margin:0 0 20px 0;  
padding:0;  
}  
#box li {  
margin:0 0 0 20px;  
padding:0 0 10px 0;  
}  
li a{  
color:blue;  
}  
strong a{  
color:#7EA411;  
}  
</style>  
 
<body>  
 
<div id="box">  
<h3>On this Page You Can See How to <br /> Use the PHP Quick Profiler to...</h3>  
 
<ul>  
<li>Log PHP Objects. [ <a href="#" onclick="changeTab('console'); return false;">Demo</a> ]</li>  
<li>Watch as a string eats up memory. [ <a href="#" onclick="changeTab('memory'); return false;">Demo</a> ]</li>  
<li>Monitor our queries and their indexes. [ <a href="#" onclick="changeTab('queries'); return false;">Demo</a> ]</li>  
<li>Ensure page execution time is acceptable. [ <a href="#" onclick="changeTab('speed'); return false;">Demo</a> ]</li>  
<li>Prevent files from getting out of control. [ <a href="#" onclick="changeTab('files'); return false;">Demo</a> ]</li>  
</ul>  
 
<strong>Return to <a href="http://particletree.com/features/php-quick-profiler/">Particletree</a>.</strong>  
</div>  
 
</body>  
</html>  
<!-- JavaScript -->  
{literal}  
<script type="text/javascript">  
var PQP_DETAILS = true;  
var PQP_HEIGHT = "short";  
 
addEvent(window, 'load', loadCSS);  
 
function changeTab(tab) {  
var pQp = document.getElementById('pQp');  
hideAllTabs();  
addClassName(pQp, tab, true);  
}  
 
function hideAllTabs() {  
var pQp = document.getElementById('pQp');  
removeClassName(pQp, 'console');  
removeClassName(pQp, 'speed');  
removeClassName(pQp, 'queries');  
removeClassName(pQp, 'memory');  
removeClassName(pQp, 'files');  
}  
 
function toggleDetails(){  
var container = document.getElementById('pqp-container');  
 
if(PQP_DETAILS){  
addClassName(container, 'hideDetails', true);  
PQP_DETAILS = false;  
}  
else{  
removeClassName(container, 'hideDetails');  
PQP_DETAILS = true;  
}  
}  
function toggleHeight(){  
var container = document.getElementById('pqp-container');  
 
if(PQP_HEIGHT == "short"){  
addClassName(container, 'tallDetails', true);  
PQP_HEIGHT = "tall";  
}  
else{  
removeClassName(container, 'tallDetails');  
PQP_HEIGHT = "short";  
}  
}  
 
function loadCSS() {  
var sheet = document.createElement("link");  
sheet.setAttribute("rel", "stylesheet");  
sheet.setAttribute("type", "text/css");  
sheet.setAttribute("href", "/pqp/css/pQp.css");  
document.getElementsByTagName("head")[0].appendChild(sheet);  
setTimeout(function(){document.getElementById("pqp-container").style.display = "block"}, 10);  
}  
 
 
//http://www.bigbold.com/snippets/posts/show/2630  
function addClassName(objElement, strClass, blnMayAlreadyExist){  
if ( objElement.className ){  
var arrList = objElement.className.split(' ');  
if ( blnMayAlreadyExist ){  
var strClassUpper = strClass.toUpperCase();  
for ( var i = 0; i < arrList.length; i++ ){  
if ( arrList[i].toUpperCase() == strClassUpper ){  
arrList.splice(i, 1);  
i--;  
}  
}  
}  
arrList[arrList.length] = strClass;  
objElement.className = arrList.join(' ');  
}  
else{  
objElement.className = strClass;  
}  
}  
 
//http://www.bigbold.com/snippets/posts/show/2630  
function removeClassName(objElement, strClass){  
if ( objElement.className ){  
var arrList = objElement.className.split(' ');  
var strClassUpper = strClass.toUpperCase();  
for ( var i = 0; i < arrList.length; i++ ){  
if ( arrList[i].toUpperCase() == strClassUpper ){  
arrList.splice(i, 1);  
i--;  
}  
}  
objElement.className = arrList.join(' ');  
}  
}  
 
//http://ejohn.org/projects/flexible-javascript-events/  
function addEvent( obj, type, fn ) {  
if ( obj.attachEvent ) {  
obj["e"+type+fn] = fn;  
obj[type+fn] = function() { obj["e"+type+fn]( window.event ) };  
obj.attachEvent( "on"+type, obj[type+fn] );  
}  
else{  
obj.addEventListener( type, fn, false );  
}  
}  
</script>  
{/literal}  
 
<div id="pqp-container" class="pQp" style="display:none">  
<div id="pQp" class="console">  
<table id="pqp-metrics" cellspacing="0">  
<tr>  
<td class="green" onclick="changeTab('console');">  
<var>{$logs.console|@count}</var>  
<h4>Console</h4>  
</td>  
<td class="blue" onclick="changeTab('speed');">  
<var>{$speedTotals.total}</var>  
<h4>Load Time</h4>  
</td>  
<td class="purple" onclick="changeTab('queries');">  
<var>{$queryTotals.count} Queries</var>  
<h4>Database</h4>  
</td>  
<td class="orange" onclick="changeTab('memory');">  
<var>{$memoryTotals.used}</var>  
<h4>Memory Used</h4>  
</td>  
<td class="red" onclick="changeTab('files');">  
<var>{$files|@count} Files</var>  
<h4>Included</h4>  
</td>  
</tr>  
</table>  
 
<div id='pqp-console' class='pqp-box'>  
{if $logs.console|@count == 0}  
<h3>This panel has no log items.</h3>  
{else}  
<table class='side' cellspacing='0'>  
<tr>  
<td class='alt1'><var>{$logs.logCount}</var><h4>Logs</h4></td>  
<td class='alt2'><var>{$logs.errorCount}</var> <h4>Errors</h4></td>  
</tr>  
<tr>  
<td class='alt3'><var>{$logs.memoryCount}</var> <h4>Memory</h4></td>  
<td class='alt4'><var>{$logs.speedCount}</var> <h4>Speed</h4></td>  
</tr>  
</table>  
<table class='main' cellspacing='0'>  
{foreach from=$logs.console item=log}  
<tr class='log-{$log.type}'>  
<td class='type'>{$log.type}</td>  
<td class="{cycle values="alt,"}">  
{if $log.type == 'log'}  
<div><pre>{$log.data}</pre></div>  
{elseif $log.type == 'memory'}  
<div><pre>{$log.data}</pre> <em>{$log.dataType}</em>: {$log.name} </div>  
{elseif $log.type == 'speed'}  
<div><pre>{$log.data}</pre> <em>{$log.name}</em></div>  
{elseif $log.type == 'error'}  
<div><em>Line {$log.line}</em> : {$log.data} <pre>{$log.file}</pre></div>  
{/if}  
</td>  
</tr>  
{/foreach}  
</table>  
{/if}  
</div>  
 
<div id="pqp-speed" class="pqp-box">  
{if $logs.speedCount == 0}  
<h3>This panel has no log items.</h3>  
{else}  
<table class='side' cellspacing='0'>  
<tr><td><var>{$speedTotals.total}</var><h4>Load Time</h4></td></tr>  
<tr><td class='alt'><var>{$speedTotals.allowed} s</var> <h4>Max Execution Time</h4></td></tr>  
</table>  
 
<table class='main' cellspacing='0'>  
{foreach from=$logs.console item=log}  
{if $log.type == 'speed'}  
<tr class='log-{$log.type}'>  
<td class="{cycle values="alt,"}"><b>{$log.data}</b> {$log.name}</td>  
</tr>  
{/if}  
{/foreach}  
</table>  
{/if}  
</div>  
 
<div id='pqp-queries' class='pqp-box'>  
{if $queryTotals.count == 0}  
<h3>This panel has no log items.</h3>  
{else}  
<table class='side' cellspacing='0'>  
<tr><td><var>{$queryTotals.count}</var><h4>Total Queries</h4></td></tr>  
<tr><td class='alt'><var>{$queryTotals.time}</var> <h4>Total Time</h4></td></tr>  
<tr><td><var>0</var> <h4>Duplicates</h4></td></tr>  
</table>  
 
<table class='main' cellspacing='0'>  
{foreach from=$queries item=query}  
<tr>  
<td class="{cycle values="alt,"}">  
{$query.sql}  
{if $query.explain}  
<em>  
Possible keys: <b>{$query.explain.possible_keys}</b> &middot;  
Key Used: <b>{$query.explain.key}</b> &middot;  
Type: <b>{$query.explain.type}</b> &middot;  
Rows: <b>{$query.explain.rows}</b> &middot;  
Speed: <b>{$query.time}</b>  
</em>  
{/if}  
</td>  
</tr>  
{/foreach}  
</table>  
{/if}  
</div>  
 
<div id="pqp-memory" class="pqp-box">  
{if $logs.memoryCount == 0}  
<h3>This panel has no log items.</h3>  
{else}  
<table class='side' cellspacing='0'>  
<tr><td><var>{$memoryTotals.used}</var><h4>Used Memory</h4></td></tr>  
<tr><td class='alt'><var>{$memoryTotals.total}</var> <h4>Total Available</h4></td></tr>  
</table>  
 
<table class='main' cellspacing='0'>  
{foreach from=$logs.console item=log}  
{if $log.type == 'memory'}  
<tr class='log-{$log.type}'>  
<td class="{cycle values="alt,"}"><b>{$log.data}</b> <em>{$log.dataType}</em>: {$log.name}</td>  
</tr>  
{/if}  
{/foreach}  
</table>  
{/if}  
</div>  
 
<div id='pqp-files' class='pqp-box'>  
<table class='side' cellspacing='0'>  
<tr><td><var>{$fileTotals.count}</var><h4>Total Files</h4></td></tr>  
<tr><td class='alt'><var>{$fileTotals.size}</var> <h4>Total Size</h4></td></tr>  
<tr><td><var>{$fileTotals.largest}</var> <h4>Largest</h4></td></tr>  
</table>  
<table class='main' cellspacing='0'>  
{foreach from=$files item=file}  
<tr><td class="{cycle values="alt,"}"><b>{$file.size}</b> {$file.name}</td></tr>  
{/foreach}  
</table>  
</div>  
 
<table id="pqp-footer" cellspacing="0">  
<tr>  
<td class="credit">  
<a href="http://particletree.com/features/php-quick-profiler/" target="_blank">  
<strong>PHP</strong>  
<b class="green">Q</b><b class="blue">u</b><b class="purple">i</b><b class="orange">c</b><b class="red">k</b>  
Profiler</a></td>  
<td class="actions">  
<a href="#" onclick="toggleDetails();return false">Details</a>  
<a class="heightToggle" href="#" onclick="toggleHeight();return false">Height</a>  
</td>  
</tr>  
</table>  
</div>  
</div>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Template  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class Template {  
 
/**  
* Template files directory  
*  
* @var string  
*/  
var $template_dir;  
 
/**  
* Template Variables  
*  
* @var array  
*/  
var $vars = array();  
 
/**  
* Template file  
*  
* @var string  
*/  
var $file;  
 
/**  
* Constructor  
*  
* @access public  
*/  
function Template() {  
 
return;  
}  
 
/**  
* Set the template file  
*  
* @param string $file  
*/  
function set_template($file = null) {  
$this->file = $this->template_dir.$file;  
return;  
}  
 
/**  
* Set a template variable  
*  
* @param string $name  
* @param unknown_value $value  
* @access public  
*/  
function set($name, $value) {  
 
if (is_object($value)) {  
$class = 'Template';  
if ($value instanceof $this) {  
$value = $value->fetch();  
}  
}  
 
$this->vars[$name] = $value;  
return;  
}  
 
/**  
* Open, parse, and return the template file.  
*  
* @param string $file  
* @return string $contents  
* @access public  
*/  
function fetch($file = null) {  
if(!$file):  
$file = $this->file;  
else:  
$file = $this->template_dir.$file;  
endif;  
 
extract($this->vars); // Extract the vars to local namespace  
ob_start(); // Start output buffering  
include($file); // Include the file  
$contents = ob_get_contents(); // Get the contents of the buffer  
ob_end_clean(); // End buffering and discard  
return $contents; // Return the contents  
}  
 
}  
 
/**  
* An extension to Template that provides automatic caching of  
* template contents.  
*/  
class CachedTemplate extends Template {  
var $cache_id;  
var $expire;  
var $cached;  
 
/**  
* Constructor.  
*  
* @param $cache_id string unique cache identifier  
* @param $expire int number of seconds the cache will live  
*/  
function CachedTemplate($cache_id = null, $expire = 900) {  
$this->Template();  
$this->cache_id = $cache_id ? 'cache/' . md5($cache_id) : $cache_id;  
$this->expire = $expire;  
}  
 
/**  
* Test to see whether the currently loaded cache_id has a valid  
* corrosponding cache file.  
*/  
function is_cached() {  
if($this->cached) return true;  
 
// Passed a cache_id?  
if(!$this->cache_id) return false;  
 
// Cache file exists?  
if(!file_exists($this->cache_id)) return false;  
 
// Can get the time of the file?  
if(!($mtime = filemtime($this->cache_id))) return false;  
 
// Cache expired?  
if(($mtime + $this->expire) < time()) {  
@unlink($this->cache_id);  
return false;  
}  
else {  
/**  
* Cache the results of this is_cached() call. Why? So  
* we don't have to double the overhead for each template.  
* If we didn't cache, it would be hitting the file system  
* twice as much (file_exists() & filemtime() [twice each]).  
*/  
$this->cached = true;  
return true;  
}  
}  
 
/**  
* This function returns a cached copy of a template (if it exists),  
* otherwise, it parses it as normal and caches the content.  
*  
* @param $file string the template file  
*/  
function fetch_cache($file) {  
if($this->is_cached()) {  
$fp = @fopen($this->cache_id, 'r');  
$contents = fread($fp, filesize($this->cache_id));  
fclose($fp);  
return $contents;  
}  
else {  
$contents = $this->fetch($file);  
 
// Write the cache  
if($fp = @fopen($this->cache_id, 'w')) {  
fwrite($fp, $contents);  
fclose($fp);  
}  
else {  
die('Unable to write cache.');  
}  
 
return $contents;  
}  
}  
}  
 
?>  
file:a/busui/owa/index.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once('owa_env.php');  
require_once(OWA_DIR.'owa_php.php');  
 
/**  
* Main Admin Page Wrapper Script  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
// Initialize owa admin  
$owa = &new owa_php;  
 
if (!$owa->isOwaInstalled()) {  
// redirect to install  
owa_lib::redirectBrowser(owa_coreAPI::getSetting('base','public_url').'install.php');  
}  
 
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
// run controller or view and echo page content  
echo $owa->handleRequestFromURL();  
} else {  
// unload owa  
$owa->restInPeace();  
}  
?>  
file:a/busui/owa/ini_db.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* INI Database  
*  
* Searches INI files for matches based on various lookup methods.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category wa  
* @package wa  
* @version $Revision$  
* @since wa 1.0.0  
*/  
class ini_db extends owa_base {  
 
/**  
* Data file  
*  
* @var unknown_type  
*/  
var $ini_file;  
 
/**  
* Result Format  
*  
* @var string  
*/  
var $return_format;  
 
/**  
* Cache flag  
*  
* @var boolean  
*/  
var $cache = true;  
 
 
/**  
* Database Access Object  
*  
* @var object  
*/  
var $db;  
 
/**  
* Constructor  
*  
* @param string $ini_file  
* @param string_type $sections  
* @param string $return_format  
* @access public  
* @return ini_db  
*/  
function __construct($ini_file, $sections = null, $return_format = 'object') {  
 
parent::__construct();  
$this->ini_file = $ini_file;  
$this->return_format = $return_format;  
 
if (!empty($sections)){  
$this->db = $this->readINIfile($this->ini_file, ';');  
} else {  
$this->db = file($this->ini_file);  
}  
}  
 
/**  
* Returns a section from an ini file based on regex match rule  
* contained as keys in an ini file.  
*  
* @param string  
* @access public  
*/  
function fetch($haystack) {  
 
$record = null;  
 
foreach ($this->db as $key=>$value) {  
if (($key!='#*#')&&(!array_key_exists('parent',$value))) continue;  
 
$keyEreg = '#'.$key.'#';  
 
if (preg_match($keyEreg, $haystack)) {  
$record=array('regex'=>strtolower($keyEreg),'pattern'=>$key)+$value;  
 
$maxDeep=8;  
while (array_key_exists('parent',$value)&&(--$maxDeep>0))  
 
$record+=($value = $this->db[strtolower($value['parent'])]);  
break;  
}  
}  
 
switch ($this->return_format) {  
case "array":  
return $record;  
break;  
case "object":  
return ((object)$record);  
break;  
}  
return $record;  
}  
 
/**  
* Returns part of the passed string based on regex match rules  
* contained as keys in an ini file.  
*  
* @param string  
* @access public  
* @return string  
*/  
function match($haystack) {  
 
$needle = '';  
 
if (!empty($haystack)):  
 
$tmp = '';  
 
foreach ($this->db as $key => $value) {  
 
if (!empty($value)):  
//$this->e->debug('ref db:'.print_r($this->db, true));  
preg_match(trim($value), $haystack, $tmp);  
if (!empty($tmp)):  
$needle = $tmp;  
//$this->e->debug('ref db:'.print_r($tmp, true));  
endif;  
endif;  
}  
 
return $needle;  
 
else:  
return;  
endif;  
}  
 
function contains($haystack = '') {  
 
$pos = false;  
 
if ($haystack) {  
 
foreach ($this->db as $k => $needle) {  
$needle = substr(strtolower(trim($needle)),1,-1);  
$pos = strpos(strtolower($haystack), $needle);  
 
if ($pos) {  
owa_coreAPI::debug(sprintf('Haystack contains "%s" at position %d', $needle, $pos));  
return true;  
}  
}  
 
return false;  
}  
}  
 
/**  
* Fetch a record set and perfrom a regex replace on the name  
*  
* @param string $haystack  
* @return string  
*/  
function fetch_replace($haystack) {  
 
$record = $this->fetch($haystack);  
 
//print_r($record);  
 
$new_record = preg_replace($record->regex, $record->name, $haystack);  
 
return $new_record;  
}  
 
/**  
* Reads INI file  
*  
* @param string $filename  
* @param string $commentchar  
* @return array  
*/  
function readINIfile ($filename, $commentchar) {  
$array1 = file($filename);  
$section = '';  
foreach ($array1 as $filedata) {  
$dataline = trim($filedata);  
$firstchar = substr($dataline, 0, 1);  
if ($firstchar!=$commentchar && $dataline!='') {  
//It's an entry (not a comment and not a blank line)  
if ($firstchar == '[' && substr($dataline, -1, 1) == ']') {  
//It's a section  
$section = strtolower(substr($dataline, 1, -1));  
} else {  
//It's a key...  
$delimiter = strpos($dataline, '=');  
if ($delimiter > 0) {  
//...with a value  
$key = strtolower(trim(substr($dataline, 0, $delimiter)));  
$value = trim(substr($dataline, $delimiter + 1));  
if (substr($value, 1, 1) == '"' && substr($value, -1, 1) == '"') { $value = substr($value, 1, -1); }  
$array2[$section][$key] = stripcslashes($value);  
} else {  
//...without a value  
$array2[$section][strtolower(trim($dataline))]='';  
}  
}  
} else {  
//It's a comment or blank line. Ignore.  
}  
}  
 
return $array2;  
}  
}  
 
?>  
file:a/busui/owa/install.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_php.php');  
 
/**  
* Install Page Wrapper Script  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
// Initialize owa  
//define('OWA_ERROR_HANDLER', 'development');  
define('OWA_CACHE_OBJECTS', false);  
define('OWA_INSTALLING', true);  
$owa = new owa_php();  
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
// need third param here so that seting is not persisted.  
$owa->setSetting('base','main_url', 'install.php');  
// run controller, echo page content  
$do = owa_coreAPI::getRequestParam('do');  
$params = array();  
if (empty($do)) {  
 
$params['do'] = 'base.installStart';  
}  
 
// run controller or view and echo page content  
echo $owa->handleRequest($params);  
 
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
file:a/busui/owa/log.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_php.php');  
 
/**  
* Special HTTP Requests Controler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
ignore_user_abort(true);  
$owa = new owa_php();  
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
$owa->e->debug('Logging Event from Url...');  
// log event  
$ret = $owa->logEventFromUrl();  
echo owa_coreAPI::displayView(array(), 'base.pixel');  
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
file:a/busui/owa/module.inc (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once('owa_env.php');  
require_once(OWA_BASE_CLASSES_DIR.'owa_php.php');  
 
/**  
* OWA Singleton.  
*  
* Creates instance of OWA that can be called from within Gallery.  
* All configuration taken from Gallery directly.  
*/  
function owa_factory($params = array()) {  
 
static $owa;  
 
if(!empty($owa)):  
return $owa;  
else:  
 
// globals  
global $gallery;  
 
// init the configuration array for this caller  
$owa_config = $params;  
 
// OWA DATABASE CONFIGURATION  
// Will use Gallery config unless there is a config file present.  
// OWA uses this to setup it's own DB connection seperate from the one  
// that Gallery uses.  
 
//$gallery_base_url = $gallery->getConfig('galleryBaseUrl');  
$urlgenerator = $gallery->getUrlGenerator();  
$gallery_base_url = $urlgenerator->getCurrentUrlDir();  
 
// Gallery specific config overrides array  
 
$owa_config['report_wrapper'] = 'wrapper_gallery2.tpl';  
$owa_config['images_url'] = OWA_PUBLIC_URL.'i/';  
$owa_config['images_absolute_url'] = $owa_config['images_url'];  
$owa_config['main_url'] = $gallery_base_url.'main.php?g2_view=core.SiteAdmin&g2_subView=owa.owaGeneric';  
$owa_config['main_absolute_url'] = $owa_config['main_url'];  
$owa_config['action_url'] = $gallery_base_url.'main.php?g2_view=owa.owaAction&owa_specialAction';  
$owa_config['log_url'] = $gallery_base_url.'main.php?g2_view=owa.owaAction&owa_logAction=1';  
$owa_config['link_template'] = '%s&%s';  
//$owa_config['authentication'] = 'gallery';  
$owa_config['site_id'] = md5($gallery_base_url);  
$owa_config['query_string_filters'] = 'g2_fromNavId';  
$owa_config['is_embedded'] = 'true';  
 
$gallery->debug('hello from gallery owa plugin');  
 
// create owa instance  
$owa = new owa_php($owa_config);  
$gallery->debug('new owa instance created');  
 
return $owa;  
 
endif;  
 
}  
 
/**  
* Sets OWA priviledge info for current gallery user  
*/  
function owa_set_priviledges() {  
 
global $gallery;  
 
// get Gallery's active user  
$u = $gallery->getActiveUser();  
 
// create instance of OWA  
$owa = owa_factory();  
 
//set user level. Needed for OWA's auth module.  
 
// check to see if user is a guest or not  
list ($ret, $user) = GalleryCoreApi::isAnonymousUser();  
 
if ($user == true):  
 
$level = 'everyone';  
 
else:  
// check to see if the user is a site admin. important becasue we might not want  
// to log such users activities.  
list ($ret, $admin) = GalleryCoreApi::isUserInSiteAdminGroup();  
 
if ($admin = true):  
$level = 'admin';  
else:  
$level = 'viewer';  
endif;  
 
endif;  
 
// preemptively set the current user info and mark as authenticated so that  
// downstream controllers don't have to authenticate  
$cu =&owa_coreAPI::getCurrentUser();  
 
// gallery gives all users a username of guest if there are not named users...  
if ($u->userName != 'guest'):  
$cu->setUserData('user_id', $u->userName);  
$cu->setUserData('email_address', $u->email);  
$cu->setUserData('real_name', $u->fullName);  
endif;  
 
$cu->setRole($level);  
$cu->setAuthStatus(true);  
 
return;  
}  
 
/**  
* OWA Gallery Module  
*  
* Integrates OWA with Gallery 2.2 or later  
*  
* @package owa  
* @author Peter Adams <peter@openwebanalytics.com>  
* @version $Revision$ $Date: $  
*/  
class owaModule extends GalleryModule {  
 
function owaModule() {  
global $gallery;  
 
$this->setId('owa');  
$this->setName($gallery->i18n('Open Web Analytics for Gallery'));  
$this->setDescription($gallery->i18n('Adds web analytics capabilities to Gallery.'));  
$this->setVersion('1.0.0');  
$this->setGroup('OWA', $gallery->i18n('Open Web Analytics'));  
$this->setRequiredCoreApi(array(7, 18));  
$this->setRequiredModuleApi(array(3, 4));  
$this->setCallbacks('getSiteAdminViews|getSystemLinks');  
 
return;  
}  
 
 
/**  
* Main OWA logging method  
*  
* Using getSystemLinks as a callback because it is called on every request.  
*/  
function getSystemLinks() {  
 
global $gallery;  
 
 
if (GalleryUtilities::hasRequestVariable('view')):  
$viewName = GalleryUtilities::getRequestVariables('view');  
 
 
// ensure this is not a Gallery admin screen  
if ($viewName == "core.SiteAdmin" || $viewName == "core.ItemAdmin"):  
return;  
else:  
 
// get instance of owa  
$owa = owa_factory();  
 
// set user priviledges of the request for OWA to log  
owa_set_priviledges();  
 
// Setup OWA request params  
$params = array();  
 
// get information on current view  
list ($ret, $view) = GalleryView::loadView($viewName);  
list ($ret, $page_type) = $view->getViewDescription();  
$params['page_type'] = $page_type;  
 
//Log request is for an item, get item details  
if (GalleryUtilities::hasRequestVariable('itemId')):  
//Lookup item from view  
list ($rest, $item) = $view->getItem();  
$params['page_title'] = $item->title;  
else:  
$params['page_title'] = $page_type;  
endif;  
 
// is RSS page type  
 
if (($viewName == "rss.Render") || ($viewName == "rss.SimpleRender")):  
$params['page_type'] = 'feed';  
$params['is_feedreader'] = true;  
$params['feed_format'] = $_GET['feed'];  
endif;  
 
// log request  
 
//print_r($owa->config);  
 
$owa->log($params);  
endif;  
endif;  
 
return;  
 
}  
 
 
/**  
* Check to see if OWA is installed and activated  
*  
*/  
function owa_isActivated() {  
 
list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'owa');  
 
if (!empty($params)):  
return true;  
else:  
return false;  
endif;  
}  
 
 
/**  
* @see GalleryModule::getSiteAdminViews  
*/  
function getSiteAdminViews() {  
 
global $gallery;  
 
// this is needed becasue on the plugins page this callback is triggered  
// whether then plugin is active or not for some reason.  
//if ($this->owa_isActivated()):  
// get OWA instance  
// $owa = owa_factory();  
// set user priviledges of the request for OWA  
// owa_set_priviledges();  
//endif;  
 
$data = array(array('name' => $this->translate('Dashboard'), 'view' => 'owa.owaDashboard'),  
array('name' => $this->translate('Admin Settings'), 'view' => 'owa.owaOptions'));  
return array(null, $data);  
}  
 
/**  
* Module specific logic for install  
*  
* @see GalleryModule::install  
*/  
function upgrade($currentVersion, $statusMonitor) {  
 
global $gallery;  
 
$owa_config = array();  
$owa_config['do_not_fetch_config_from_db'] = true;  
$owa = owa_factory($owa_config);  
// set user priviledges of the request for OWA to log  
owa_set_priviledges();  
 
//get the base gallery url  
$urlgenerator = $gallery->getUrlGenerator();  
$site_url = $urlgenerator->getCurrentUrlDir();  
 
//Config('galleryBaseUrl');  
 
$params = array('site_id' => md5($site_url),  
'name' => 'Gallery',  
'domain' => $site_url,  
'description' => '',  
'do' => 'base.installEmbedded');  
 
$page = $owa->handleRequest($params);  
 
return null;  
}  
 
/*  
 
// register event handlers  
function performFactoryRegistrations() {  
 
owa_coreAPI::debug("g2 factory regs");  
$ret = GalleryCoreApi::registerFactoryImplementation('GalleryEventListener', 'owaLoginEventHandler ', 'owa', __FILE__, 'owa', array('Gallery::Login'), null);  
 
$ret = GalleryCoreApi::registerFactoryImplementation('GalleryEventListener', 'owaLoginEventHandler ', 'owa', __FILE__, 'owa', array('Gallery::Logout'), null);  
 
//$listener = new owaLoginEventHandler();  
//$ret = GalleryCoreApi::registerEventListener('Gallery::Login', $listener, true);  
//$ret = GalleryCoreApi::registerEventListener('Gallery::Logout', $listener, true);  
 
if ($ret) {  
return $ret;  
}  
 
return null;  
 
}  
 
*/  
}  
 
/**  
* OWA Gallery Views  
*  
* Enables OWA to be embedded as a Gallery's site admin screen  
*/  
class owaOptionsView extends GalleryView {  
 
/**  
* @see GalleryView::loadTemplate  
*/  
function loadTemplate(&$template, &$form) {  
 
$owa = owa_factory();  
 
owa_set_priviledges();  
 
$params = array();  
 
if (empty($owa->params['do'])):  
$params['do'] = 'base.optionsGeneral';  
endif;  
 
$page = $owa->handleRequest($params);  
$template->setVariable('owa', array('content' => $page));  
return array(null, array('body' => 'modules/owa/modules/base/templates/gallery.tpl'));  
}  
 
/**  
* Does this view change any data? Only controllers should change data, but AJAX and some  
* immediate views are handled in views in Gallery.  
* @return bool true if the view changes data  
*/  
function isControllerLike() {  
return true;  
}  
 
 
}  
 
/**  
* OWA Gallery Views  
*  
*  
*/  
class owaDashboardView extends GalleryView {  
 
/**  
* @see GalleryView::loadTemplate  
*/  
function loadTemplate(&$template, &$form) {  
 
$owa = owa_factory();  
 
owa_set_priviledges();  
 
$params = array();  
//$params['view'] = 'base.report';  
$params['action'] = 'base.reportDashboard';  
$params['period'] = 'today';  
$page = $owa->handleRequest($params);  
$template->setVariable('owa', array('content' => $page));  
return array(null, array('body' => 'modules/owa/modules/base/templates/gallery.tpl'));  
}  
 
}  
 
class owaGenericView extends GalleryView {  
 
/**  
* @see GalleryView::loadTemplate  
*/  
function loadTemplate(&$template, &$form) {  
 
$owa = owa_factory();  
 
owa_set_priviledges();  
 
$page = $owa->handleRequest();  
$template->setVariable('owa', array('content' => $page));  
return array(null, array('body' => 'modules/owa/modules/base/templates/gallery.tpl'));  
}  
 
/**  
* Does this view change any data? Only controllers should change data, but AJAX and some  
* immediate views are handled in views in Gallery.  
* @return bool true if the view changes data  
*/  
function isControllerLike() {  
return true;  
}  
 
}  
 
 
GalleryCoreApi::requireOnce('modules/core/classes/GalleryController.class');  
class owaControlController extends GalleryController {  
 
/**  
* @see GalleryController::handleRequest  
*/  
function handleRequest($form) {  
 
$result = array('delegate' => array('view' => 'owa.owaGeneric'),  
'status' => 1, 'error' => '');  
return array(null, $result);  
 
}  
 
}  
 
 
/**  
* Handles OWA's special action requests  
*  
*/  
class owaActionView extends GalleryView {  
 
 
/**  
* @see GalleryView::isImmediate  
*/  
function isImmediate() {  
return true;  
}  
 
/**  
* Method called when view is set to render immeadiately.  
* This will bypass Gallery's global templating allowing  
* the view to send output directly to the browser.  
*/  
function renderImmediate($status, $error) {  
 
global $gallery;  
$owa = owa_factory();  
 
$gallery->debug('hello from owaAction');  
owa_set_priviledges();  
 
$owa->handleSpecialActionRequest();  
 
return null;  
}  
 
 
}  
 
/**  
* Gallery Template Callback for OWA footer elements  
*  
* This class is packaged here for convienence only but could also be  
* put in Callbacks.inc.  
*/  
class owaCallbacks {  
 
function callback($params, &$smarty, $callback, $userId=null) {  
/* 1. Identify the exact callback */  
switch ($callback) {  
case 'pagetags':  
 
$viewName = GalleryUtilities::getRequestVariables('view');  
// ensure this is not a Gallery admin screen  
 
if ($viewName == "core.SiteAdmin" || $viewName == "core.ItemAdmin"):  
return;  
else:  
/* 2. Load the requested data */  
 
$owa = owa_factory();  
$tags = $owa->placeHelperPageTags(false);  
 
/* 3. Assign the requested data to a template variable */  
$block =& $smarty->_tpl_vars['block'];  
 
/* By convention, put the data into $block[$moduleId] (in this case, moduleId is 'owa') */  
$block['owa']['pagetags'] = array('owaData' => $tags,  
'randomNumber' => rand()); // You can put any data into the template variable...  
endif;  
 
break;  
 
case 'SomeOtherCallbackName':  
;  
break;  
default:  
;  
}  
 
return null;  
}  
}  
 
class owaLoginEventHandler {  
 
function owaLoginEventHandler() {  
return;  
}  
 
function __construct() {  
return;  
}  
 
function handleEvent($event) {  
global $gallery;  
owa_coreAPI::debug("hello from login event handler ".print_r($event));  
return array(null, null);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
/**  
* API Request Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_apiRequestController extends owa_controller {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$s = owa_coreAPI::serviceSingleton();  
// lookup method class  
$do = $s->getApiMethodClass($this->getParam('do'));  
 
if ($do) {  
 
// check credentials  
/* PERFORM AUTHENTICATION */  
if (array_key_exists('required_capability', $do)) {  
 
/* CHECK USER FOR CAPABILITIES */  
if ( ! owa_coreAPI::isCurrentUserCapable( $do['required_capability'] ) ) {  
// doesn't look like the currentuser has the necessary priviledges  
owa_coreAPI::debug('User does not have capability required by this controller.');  
// auth user  
$auth = &owa_auth::get_instance();  
$status = $auth->authenticateUser();  
// if auth was not successful then return login view.  
if ($status['auth_status'] != true) {  
return 'This method requires authentication.';  
} else {  
//check for needed capability again now that they are authenticated  
if (!owa_coreAPI::isCurrentUserCapable($do['required_capability'])) {  
return 'Your user does not have privileges to access this method.';  
}  
}  
}  
}  
 
//perform  
$map = owa_coreAPI::getRequest()->getAllOwaParams();  
echo owa_coreAPI::executeApiCommand($map);  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require (OWA_INCLUDE_DIR.'jsmin-1.1.1.php');  
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Build Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_buildController extends owa_cliController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$this->setRequiredCapability('edit_modules');  
 
return;  
}  
 
function action() {  
 
 
// build owa.tracker-combined-min.js  
owa_coreAPI::debug("Building owa.tracker-combined-min.js");  
 
$tracker_js = array();  
$tracker_js['json2'] = OWA_MODULES_DIR.'base/js/includes/json2.js';  
$tracker_js['lazyload'] = OWA_MODULES_DIR.'base/js/includes/lazyload-2.0.min.js';  
$tracker_js['owa'] = OWA_MODULES_DIR.'base/js/owa.js';  
$tracker_js['owa.tracker'] = OWA_MODULES_DIR.'base/js/owa.tracker.js';  
 
$minjs = sprintf("// OWA Tracker Min file created %s \n\n",date(time()));  
 
foreach ($tracker_js as $k => $v) {  
owa_coreAPI::debug("Minimizing Javascript in $v");  
$minjs .= "//// Start of $k //// \n";  
$minjs .= JSMin::minify(file_get_contents($v)) . "\n";  
$minjs .= "//// End of $k //// \n";  
}  
 
$handle = fopen(OWA_MODULES_DIR."base/js/owa.tracker-combined-min.js", "w");  
fwrite($handle, $minjs);  
fclose($handle);  
 
return;  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
//require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'owa_base.php');  
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'ini_db.php');  
 
/**  
* Browscap Class  
*  
* Used to load and lookup user agents in a local Browscap file  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_browscap extends owa_base {  
 
 
/**  
* main browscap_db maintained by Gary Keith's  
* Browser Capabilities project.  
*  
* @var array  
*/  
var $browscap_db;  
 
/**  
* Browscap Record for current User agent  
*  
* @var unknown_type  
*/  
var $browser;  
 
/**  
* Current user Agent  
*  
* @var string  
*/  
var $ua;  
var $cache;  
var $cacheExpiration;  
 
function __construct($ua = '') {  
 
parent::__construct();  
// set user agent  
$this->ua = $ua;  
 
// init cache  
$this->cache = &owa_coreAPI::cacheSingleton();  
$this->cacheExpiration = owa_coreAPI::getSetting('base', 'default_cache_expiration_period');  
$this->cache->setCollectionExpirationPeriod('browscap', $this->cacheExpiration);  
//lookup robot in main browscap db  
$this->browser = $this->lookup($this->ua);  
$this->e->debug('Browser Name : '. $this->browser->Browser);  
 
}  
 
function robotCheck() {  
// must use == due to wacky type issues with phpBrowsecap ini file  
if ($this->browser->Crawler == "true" || $this->browser->Crawler == "1") {  
return true;  
} elseif ($this->browser->Browser === "Default Browser") {  
return $this->robotRegexCheck();  
}  
 
return false;  
}  
 
function lookup($user_agent) {  
 
if (owa_coreAPI::getSetting('base','cache_objects') === true) {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$cache_obj = $this->cache->get('browscap', $this->ua);  
}  
 
if (!empty($cache_obj)) {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
return $cache_obj;  
 
} else {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
 
// Load browscap file into memory  
$user_browscap_file = OWA_DATA_DIR.'browscap/php_browscap.ini';  
// check to see if a user downloaded version of the file exists  
if ( file_exists( $user_browscap_file ) ) {  
$this->browscap_db = $this->load( $user_browscap_file );  
} else {  
$this->browscap_db = $this->load( $this->config['browscap.ini'] );  
}  
 
$cap = null;  
 
foreach ($this->browscap_db as $key=>$value) {  
if (($key!='*')&&(!array_key_exists('Parent',$value))) continue;  
$keyEreg='^'.str_replace(  
array('\\','.','?','*','^','$','[',']','|','(',')','+','{','}','%'),  
array('\\\\','\\.','.','.*','\\^','\\$','\\[','\\]','\\|','\\(','\\)','\\+','\\{','\\}','\\%'),  
$key).'$';  
if (preg_match('%'.$keyEreg.'%i',$user_agent))  
{  
$cap=array('browser_name_regex'=>strtolower($keyEreg),'browser_name_pattern'=>$key)+$value;  
$maxDeep=8;  
while (array_key_exists('Parent',$value)&&(--$maxDeep>0))  
$cap += ($value = $this->browscap_db[$value['Parent']]);  
break;  
}  
}  
 
if ( ! empty( $cap ) ) {  
 
if ( $this->config['cache_objects'] == true ) {  
if ( $cap['Browser'] != 'Default Browser' ) {  
$this->cache->set( 'browscap', $this->ua, (object)$cap, $this->cacheExpiration );  
}  
}  
}  
 
return ( (object)$cap );  
}  
}  
 
function load($file) {  
 
if(defined('INI_SCANNER_RAW')) {  
return parse_ini_file($file, true, INI_SCANNER_RAW);  
} else {  
return parse_ini_file($file, true);  
}  
 
}  
 
function robotRegexCheck() {  
 
$db = new ini_db(OWA_CONF_DIR.'robots.ini');  
owa_coreAPI::debug('Checking for robot strings...');  
$match = $db->contains($this->ua);  
 
if (!empty($match)):  
owa_coreAPI::debug('Robot detect string found.');  
$this->browser->Crawler = true;  
return true;  
else:  
return false;  
endif;  
 
}  
 
function get($name) {  
 
return $this->browser->$name;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Cache Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_cache {  
 
var $cache;  
var $statistics = array('warm' => 0, 'cold' => 0, 'miss' => 0, 'replaced' => 0, 'added' => 0, 'removed' => 0, 'dirty' => 0);  
var $cache_id = 1; // default cache id  
var $collections;  
var $dirty_collections;  
var $dirty_objs = array();  
var $global_collections = array();  
var $collection_expiration_periods = array();  
var $e;  
 
/**  
* Constructor  
*  
* Takes cache directory as param  
*  
* @param $cache_dir string  
*/  
function __construct($cache_dir = '') {  
 
$this->e = &owa_coreAPI::errorSingleton();  
}  
 
function set($collection, $key, $value, $expires = '') {  
 
$hkey = $this->hash($key);  
//owa_coreAPI::debug('set key: '.$key);  
//owa_coreAPI::debug('set hkey: '.$hkey);  
$this->cache[$collection][$hkey] = $value;  
$this->debug(sprintf('Added Object to Cache - Collection: %s, id: %s', $collection, $hkey));  
$this->statistics['added']++;  
$this->dirty_objs[$collection][$hkey] = $hkey;  
$this->dirty_collections[$collection] = true;  
$this->debug(sprintf('Added Object to Dirty List - Collection: %s, id: %s', $collection, $hkey));  
$this->statistics['dirty']++;  
 
}  
 
function replace($collection, $key, $value) {  
 
$hkey = $this->hash($key);  
$this->cache[$collection][$hkey] = $value;  
$this->debug(sprintf('Replacing Object in Cache - Collection: %s, id: %s', $collection, $hkey));  
$this->statistics['replaced']++;  
 
// check to make sure the dirty collection exists and object is not already in there.  
if (!empty($this->dirty_objs[$collection])) {  
if(!in_array($hkey, $this->dirty_objs[$collection])) {  
$this->dirty_objs[$collection][] = $hkey;  
$this->dirty_collections[$collection] = true;  
$this->debug(sprintf('Added Object to Dirty List - Collection: %s, id: %s', $collection, $hkey));  
$this->statistics['dirty']++;  
}  
} else {  
$this->dirty_objs[$collection][] = $hkey;  
$this->dirty_collections[$collection] = true;  
$this->debug(sprintf('Added Object to Dirty List - Collection: %s, id: %s', $collection, $hkey));  
$this->statistics['dirty']++;  
}  
 
 
}  
 
function get($collection, $key) {  
 
$id = $this->hash($key);  
// check warm cache and return  
if (isset($this->cache[$collection][$id])) {  
$this->debug(sprintf('CACHE HIT (Warm) - Retrieved Object from Cache - Collection: %s, id: %s', $collection, $id));  
$this->statistics['warm']++;  
//load from cache file  
} else {  
 
$item = $this->getItemFromCacheStore($collection, $id);  
if ($item) {  
$this->cache[$collection][$id] = $item;  
$this->debug(sprintf('CACHE HIT (Cold) - Retrieved Object from Cache File - Collection: %s, id: %s', $collection, $id));  
$this->statistics['cold']++;  
} else {  
$this->debug( sprintf( 'CACHE MISS - object not found for Collection: %s, id: %s', $collection, $id ) );  
$this->statistics['miss']++;  
}  
}  
 
if (isset($this->cache[$collection][$id])) {  
return $this->cache[$collection][$id];  
} else {  
return false;  
}  
 
}  
 
function remove($collection, $key) {  
 
$id = $this->hash($key);  
unset($this->cache[$collection][$id]);  
 
return $this->removeItemFromCacheStore($collection, $id);  
 
}  
 
function persistCache() {  
 
$this->debug("starting to persist cache...");  
 
// check for dirty objects  
if (!empty($this->dirty_objs)) {  
 
$this->debug('Dirty Objects: '.print_r($this->dirty_objs, true));  
$this->debug("starting to persist cache...");  
 
// persist dirty objects  
foreach ($this->dirty_objs as $collection => $ids) {  
 
foreach ($ids as $id) {  
$this->putItemToCacheStore($collection, $id);  
}  
}  
 
} else {  
$this->debug("There seem to be no dirty objects in the cache to persist.");  
}  
}  
 
/**  
* Store specific implementation of getting an object from the cold cache store  
*/  
function getItemFromCacheStore($collection, $id) {  
return false;  
}  
/**  
* Store specific implementation of putting an object to the cold cache store  
*/  
function putItemToCacheStore($collection, $id) {  
return false;  
}  
 
/**  
* Store specific implementation of removing an object to the cold cache store  
*/  
function removeItemFromCacheStore($collection, $id) {  
return false;  
}  
 
/**  
* Store specific implementation of flushing the cold cache store  
*/  
function flush() {  
 
return false;  
}  
 
function getStats() {  
 
return sprintf("Cache Statistics:  
Total Hits: %s (Warm/Cold: %s/%s)  
Total Miss: %s  
Total Added to Cache: %s  
Total Replaced: %s  
Total Persisted: %s  
Total Removed: %s",  
$this->statistics['warm'] + $this->statistics['cold'],  
$this->statistics['warm'],  
$this->statistics['cold'],  
$this->statistics['miss'],  
$this->statistics['added'],  
$this->statistics['replaced'],  
$this->statistics['dirty'],  
$this->statistics['removed']);  
}  
 
function prepare($obj) {  
 
return $obj;  
}  
 
function __destruct() {  
 
$this->persistCache();  
$this->debug($this->getStats());  
$this->persistStats();  
}  
 
function persistStats() {  
 
return false;  
}  
 
function hash($id) {  
 
return md5($id);  
}  
 
function debug($msg) {  
 
return owa_coreAPI::debug($msg);  
}  
 
function error($msg) {  
 
return false;  
}  
 
function setCollectionExpirationPeriod($collection_name, $seconds) {  
 
$this->collection_expiration_periods[$collection_name] = $seconds;  
}  
 
function getCollectionExpirationPeriod($collection_name) {  
 
// for some reason an 'array_key_exists' check does not work here. using isset instead.  
if (isset($this->collection_expiration_periods[$collection_name])) {  
return $this->collection_expiration_periods[$collection_name];  
} else {  
return false;  
}  
}  
 
function setGlobalCollection($collection) {  
 
return $this->global_collections[] = $collection;  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Calculated Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_calculatedMetric extends owa_metric {  
 
var $is_calculated = true;  
var $child_metrics = array();  
var $formula;  
 
function setChildMetric($name) {  
 
$this->child_metrics[] = $name;  
}  
 
function getChildMetrics() {  
 
return $this->child_metrics;  
}  
 
function setFormula($string) {  
 
$this->formula = $string;  
}  
 
function getFormula() {  
 
return $this->formula;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Chart Data Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_chartData {  
 
var $series_data = array();  
var $series_labels = array();  
 
function __construct() {  
 
return;  
}  
 
function owa_chartData() {  
 
return owa_chartData::__construct();  
}  
 
function setSeries($name, $data, $label = '') {  
 
$this->series_data[$name] = $data;  
$this->series_label[$name] = $label;  
return;  
}  
 
function getSeriesData($name) {  
 
if (array_key_exists($name, $this->series_data)) {  
return $this->series_data[$name];  
} else {  
return array();  
}  
 
}  
 
function getSeriesLabel($name) {  
 
if (array_key_exists($name, $this->series_label)) {  
return $this->series_label[$name];  
} else {  
return false;  
}  
}  
 
function getMin($name) {  
 
$min = min($this->getSeriesData($name));  
 
if ($min >= 0) {  
return 0;  
} else {  
return $min - 2;  
}  
 
}  
 
function getMax($name, $name2 = null) {  
 
$max_values = array();  
 
$max_values[] = max($this->getSeriesData($name));  
 
if (!empty($name2)) {  
$max_values[] = max($this->getSeriesData($name2));  
}  
 
$max = max($max_values);  
 
return $max + 2;  
}  
 
function checkForSeries() {  
 
$counts = array();  
foreach ($this->series_data as $series) {  
 
$counts[] = count($series);  
}  
 
if (array_sum($counts) > 0) {  
return true;  
} else {  
return false;  
}  
}  
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* CLI Controller Class  
*  
* This controller should be used for internal management pages/actions that require authentication  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_cliController extends owa_adminController {  
 
var $is_admin = true;  
 
/**  
* Constructor  
*  
* @param array $params  
* @return owa_controller  
*/  
function __construct($params) {  
 
if (owa_coreAPI::getSetting('base', 'cli_mode')) {  
 
return parent::__construct($params);  
 
} else {  
 
owa_coreAPI::notice("Controller not called from CLI");  
exit;  
}  
}  
 
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once( OWA_BASE_CLASSES_DIR . 'owa_caller.php' );  
 
/**  
* OWA Client Class  
*  
* Abstract Client Class for use in php based applications  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_client extends owa_caller {  
 
var $commerce_event;  
 
var $pageview_event;  
 
var $global_event_properties = array();  
 
var $stateInit;  
 
// set one traffic has been attributed.  
var $isTrafficAttributed;  
 
public function __construct($config = null) {  
 
$this->pageview_event = $this->makeEvent();  
$this->pageview_event->setEventType('base.page_request');  
 
return parent::__construct($config);  
}  
 
public function setPageTitle($value) {  
$this->pageview_event->set('page_title', $value);  
}  
 
public function setPageType($value) {  
$this->pageview_event->set('page_type', $value);  
}  
 
public function setProperty($name, $value) {  
$this->setGlobalEventProperty($name, $value);  
}  
 
private function setGlobalEventProperty($name, $value) {  
 
$this->global_event_properties[$name] = $value;  
}  
 
private function getGlobalEventProperty($name) {  
 
if ( array_key_exists($name, $this->global_event_properties) ) {  
return $this->global_event_properties[$name];  
}  
}  
 
private function manageState( &$event ) {  
 
if ( ! $this->stateInit ) {  
$this->setVisitorId( $event );  
$this->setFirstSessionTimestamp( $event );  
$this->setLastRequestTime( $event );  
$this->setSessionId( $event );  
$this->setNumberPriorSessions( $event );  
$this->setTrafficAttribution( $event );  
// clear old style session cookie  
$session_store_name = sprintf('%s_%s', owa_coreAPI::getSetting('base', 'site_session_param'), $this->site_id);  
owa_coreAPI::clearState( $session_store_name );  
 
$this->stateInit = true;  
}  
}  
 
private function setVisitorId( &$event ) {  
 
$visitor_id = owa_coreAPI::getStateParam( 'v', 'vid' );  
 
if ( ! $visitor_id ) {  
$visitor_id = owa_coreAPI::getStateParam( 'v' );  
owa_coreAPI::clearState( 'v' );  
owa_coreAPI::setState( 'v', 'vid', $visitor_id, 'cookie', true );  
 
}  
 
if ( ! $visitor_id ) {  
$visitor_id = $event->getSiteSpecificGuid( $this->site_id );  
$this->setGlobalEventProperty( 'is_new_visitor', true );  
owa_coreAPI::setState( 'v', 'vid', $visitor_id, 'cookie', true );  
}  
// set property on event object  
$this->setGlobalEventProperty( 'visitor_id', $visitor_id );  
}  
 
private function setNumberPriorSessions( &$event ) {  
// if check for nps value in vistor cookie.  
$nps = owa_coreAPI::getStateParam('v', 'nps');  
// set value to 0 if not found.  
if (!$nps) {  
$nps = 0;  
}  
 
// if new session, increment visit count and persist to state store  
if ( $this->getGlobalEventProperty('is_new_session' ) ) {  
owa_coreAPI::setState('v', 'nps', $nps + 1, 'cookie', true);  
}  
 
// set property on the event object  
$this->setGlobalEventProperty('num_prior_sessions', $nps);  
}  
 
private function setFirstSessionTimestamp( &$event ) {  
 
$fsts = owa_coreAPI::getStateParam( 'v', 'fsts' );  
 
if ( ! $fsts ) {  
$fsts = $event->get('timestamp');  
owa_coreAPI::setState(owa_coreAPI::getSetting('base', 'visitor_param'), 'fsts', $fsts , 'cookie', true);  
}  
 
$this->setGlobalEventProperty( 'fsts', $fsts );  
}  
 
private function setSessionId( &$event ) {  
 
$is_new_session = $this->isNewSession( $event->get( 'timestamp' ), $this->getGlobalEventProperty( 'last_req' ) );  
if ( $is_new_session ) {  
//set prior_session_id  
$prior_session_id = owa_coreAPI::getStateParam('s', 'sid');  
if ( ! $prior_session_id ) {  
$state_store_name = sprintf('%s_%s', owa_coreAPI::getSetting('base', 'site_session_param'), $this->site_id);  
$prior_session_id = owa_coreAPI::getStateParam($state_store_name, 's');  
}  
if ($prior_session_id) {  
$this->setGlobalEventProperty( 'prior_session_id', $prior_session_id );  
}  
$session_id = $event->getSiteSpecificGuid( $this->site_id );  
// it's a new session. generate new session ID  
$this->setGlobalEventProperty( 'session_id', $session_id );  
//mark new session flag on current request  
$this->setGlobalEventProperty( 'is_new_session', true );  
owa_coreAPI::setState( 's', 'sid', $session_id, 'cookie', true );  
} else {  
// Must be an active session so just pull the session id from the state store  
$session_id = owa_coreAPI::getStateParam('s', 'sid');  
 
// support for old style cookie  
if ( ! $session_id ) {  
$state_store_name = sprintf('%s_%s', owa_coreAPI::getSetting('base', 'site_session_param'), $this->site_id);  
$session_id = owa_coreAPI::getStateParam($state_store_name, 's');  
owa_coreAPI::setState( 's', 'sid', $session_id, 'cookie', true );  
}  
 
$this->setGlobalEventProperty('session_id', $session_id);  
}  
 
// fail-safe just in case there is no session_id  
if ( ! $this->getGlobalEventProperty( 'session_id' ) ) {  
$session_id = $event->getSiteSpecificGuid( $this->site_id );  
$this->setGlobalEventProperty( 'session_id', $session_id );  
//mark new session flag on current request  
$this->setGlobalEventProperty( 'is_new_session', true );  
owa_coreAPI::debug('hello from failsafe');  
owa_coreAPI::setState( 's', 'sid', $session_id, 'cookie', true );  
}  
}  
 
private function setLastRequestTime( &$event ) {  
 
$last_req = owa_coreAPI::getStateParam('s', 'last_req');  
 
// suppport for old style cookie  
if ( ! $last_req ) {  
$state_store_name = sprintf( '%s_%s', owa_coreAPI::getSetting( 'base', 'site_session_param' ), $this->site_id );  
$last_req = owa_coreAPI::getStateParam( $state_store_name, 'last_req' );  
}  
// set property on event object  
$this->setGlobalEventProperty( 'last_req', $last_req );  
// store new state value  
owa_coreAPI::setState( 's', 'last_req', $event->get( 'timestamp' ), 'cookie', true );  
}  
 
/**  
* Check to see if request is a new or active session  
*  
* @return boolean  
*/  
private function isNewSession($timestamp = '', $last_req = 0) {  
 
$is_new_session = false;  
 
if ( ! $timestamp ) {  
$timestamp = time();  
}  
 
$time_since_lastreq = $timestamp - $last_req;  
$len = owa_coreAPI::getSetting( 'base', 'session_length' );  
if ( $time_since_lastreq < $len ) {  
owa_coreAPI::debug("This request is part of a active session.");  
return false;  
} else {  
//NEW SESSION. prev session expired, because no requests since some time.  
owa_coreAPI::debug("This request is the start of a new session. Prior session expired.");  
return true;  
}  
}  
 
/**  
* Logs tracking event from url params taken from request scope.  
* Takes event type from url.  
*  
* @return unknown  
*/  
function logEventFromUrl($manage_state = false) {  
 
// keeps php executing even if the client closes the connection  
ignore_user_abort(true);  
$service = &owa_coreAPI::serviceSingleton();  
$service->request->decodeRequestParams();  
$event = owa_coreAPI::supportClassFactory('base', 'event');  
$event->setEventType(owa_coreAPI::getRequestParam('event_type'));  
$event->setProperties($service->request->getAllOwaParams());  
 
// check for third party cookie mode.  
$mode = owa_coreAPI::getRequestParam('thirdParty');  
if ( $mode ) {  
return $this->trackEvent($event);  
} else {  
return owa_coreAPI::logEvent($event->getEventType(), $event);  
}  
}  
 
/**  
* Logs tracking event  
*  
* This function fires a tracking event that will be processed and then dispatched  
*  
* @param object $event  
* @return boolean  
*/  
public function trackEvent($event) {  
 
// do not track anything if user is in overlay mode  
if (owa_coreAPI::getStateParam('overlay')) {  
return false;  
}  
 
// needed by helper page tags function so it can append to first hit tag url  
if (!$this->getSiteId()) {  
$this->setSiteId($event->get('site_id'));  
}  
 
if (!$this->getSiteId()) {  
$this->setSiteId(owa_coreAPI::getRequestParam('site_id'));  
}  
 
// set various state properties.  
$this->manageState( $event );  
 
 
$event = $this->setAllGlobalEventProperties( $event );  
 
// send event to log API for processing.  
return owa_coreAPI::logEvent($event->getEventType(), $event);  
}  
 
public function setAllGlobalEventProperties( $event ) {  
 
if ( ! $event->get('site_id') ) {  
$event->set( 'site_id', $this->getSiteId() );  
}  
 
// merge global event properties  
foreach ($this->global_event_properties as $k => $v) {  
$event->set($k, $v);  
}  
 
return $event;  
 
}  
 
public function getAllEventProperties( $event ) {  
 
$event = $this->setAllGlobalEventProperties( $event );  
return $event->getProperties();  
}  
 
public function trackPageview($event = '') {  
 
if ($event) {  
$event->setEventType('base.page_request');  
$this->pageview_event = $event;  
}  
return $this->trackEvent($this->pageview_event);  
}  
 
public function trackAction($action_group = '', $action_name, $action_label = '', $numeric_value = 0) {  
 
$event = $this->makeEvent();  
$event->setEventType('track.action');  
$event->set('action_group', $action_group);  
$event->set('action_name', $action_name);  
$event->set('action_label', $action_label);  
$event->set('numeric_value', $numeric_value);  
$event->set('site_id', $this->getSiteId());  
return $this->trackEvent($event);  
}  
 
/**  
* Creates a ecommerce Transaction event  
*  
* Creates a parent commerce.transaction event  
*/  
public function addTransaction(  
$order_id,  
$order_source = '',  
$total = 0,  
$tax = 0,  
$shipping = 0,  
$gateway = '',  
$country = '',  
$state = '',  
$city = '',  
$page_url = '',  
$session_id = ''  
) {  
 
$this->commerce_event = $this->makeEvent();  
$this->commerce_event->setEventType( 'ecommerce.transaction' );  
$this->commerce_event->set( 'ct_order_id', $order_id );  
$this->commerce_event->set( 'ct_order_source', $order_source );  
$this->commerce_event->set( 'ct_total', $total );  
$this->commerce_event->set( 'ct_tax', $tax );  
$this->commerce_event->set( 'ct_shipping', $shipping );  
$this->commerce_event->set( 'ct_gateway', $gateway );  
$this->commerce_event->set( 'page_url', $page_url );  
$this->commerce_event->set( 'ct_line_items', array() );  
$this->commerce_event->set( 'country', $page_url );  
$this->commerce_event->set( 'state', $page_url );  
$this->commerce_event->set( 'city', $page_url );  
if ( $session_id ) {  
$this->commerce_event->set( 'original_session_id', $session_id );  
// tells the client to NOT manage state properties as we are  
// going to look them up from the session later.  
$this->commerce_event->set( 'is_state_set', true );  
}  
}  
 
/**  
* Adds a line item to a commerce transaction  
*  
* Creates and a commerce.line_item event and adds it to the parent transaction event  
*/  
public function addTransactionLineItem($order_id, $sku = '', $product_name = '', $category = '', $unit_price = 0, $quantity = 0) {  
 
if ( empty( $this->commerce_event ) ) {  
$this->addTransaction('none set');  
}  
 
$li = array();  
$li['li_order_id'] = $order_id ;  
$li['li_sku'] = $sku ;  
$li['li_product_name'] = $product_name ;  
$li['li_category'] = $category ;  
$li['li_unit_price'] = $unit_price ;  
$li['li_quantity'] = $quantity ;  
 
$items = $this->commerce_event->get( 'ct_line_items' );  
$items[] = $li;  
$this->commerce_event->set( 'ct_line_items', $items );  
}  
 
/**  
* tracks a commerce events  
*  
* Tracks a parent transaction event by sending it to the event queue  
*/  
public function trackTransaction() {  
 
if ( ! empty( $this->commerce_event ) ) {  
$this->trackEvent( $this->commerce_event );  
$this->commerce_event = '';  
}  
}  
 
public function createSiteId($value) {  
 
return md5($value);  
}  
 
function getCampaignProperties( $event ) {  
 
$campaign_params = owa_coreAPI::getSetting( 'base', 'campaign_params' );  
$campaign_properties = array();  
$campaign_state = array();  
foreach ($campaign_params as $k => $param) {  
//look for property on the event  
$property = $event->get($param);  
 
// look for property on the request scope.  
if ( ! $property ) {  
$property = owa_coreAPI::getRequestParam($param);  
}  
if ( $property ) {  
$campaign_properties[$k] = $property;  
}  
}  
 
// backfill values for incomplete param combos  
 
if (array_key_exists('at', $campaign_properties) && !array_key_exists('ad', $campaign_properties)) {  
$campaign_properties['ad'] = '(not set)';  
}  
 
if (array_key_exists('ad', $campaign_properties) && !array_key_exists('at', $campaign_properties)) {  
$campaign_properties['at'] = '(not set)';  
}  
 
if (!empty($campaign_properties)) {  
//$campaign_properties['ts'] = $event->get('timestamp');  
}  
 
owa_coreAPI::debug('campaign properties: '. print_r($campaign_properties, true));  
 
return $campaign_properties;  
}  
 
function directAttributionModel( &$campaign_properties ) {  
 
// add new campaign info to existing campaign cookie.  
if ( !empty( $campaign_properties ) ) {  
$campaign_state = $this->getCampaignState();  
// add timestamp  
//$campaign_properties['ts'] = $event->get('timestamp');  
// add new campaign into state array  
$campaign_state[] = (object) $campaign_properties;  
 
// if more than x slice the first one off to make room  
$count = count( $campaign_state );  
$max = owa_coreAPI::getSetting( 'base', 'max_prior_campaigns');  
if ($count > $max ) {  
array_shift( $campaign_state );  
}  
 
// reset state  
$this->setCampaignCookie($campaign_state);  
 
// set flag  
$this->isTrafficAttributed = true;  
}  
 
}  
 
function originalAttributionModel( &$campaign_properties ) {  
 
$campaign_state = $this->getCampaignState();  
// orignal touch was set previously. jus use that.  
if (!empty($campaign_state)) {  
// do nothing  
// set the attributes from the first campaign touch  
$campaign_properties = $campaign_state[0];  
$this->isTrafficAttributed = true;  
 
// no orginal touch, set one if it's a new campaign touch  
} else {  
 
if (!empty($campaign_properties)) {  
// add timestamp  
//$campaign_properties['ts'] = $event->get('timestamp');  
owa_coreAPI::debug('Setting original Campaign attrbution.');  
$campaign_state[] = $campaign_properties;  
// set cookie  
$this->setCampaignCookie($campaign_state);  
$this->isTrafficAttributed = true;  
}  
}  
}  
 
function getCampaignState() {  
 
$campaign_state = owa_coreAPI::getStateParam( 'c' );  
if ( $campaign_state ) {  
$campaign_state = json_decode( $campaign_state );  
} else {  
$campaign_state = array();  
}  
 
return $campaign_state;  
}  
 
function setTrafficAttribution( &$event ) {  
 
// if not then look for individual campaign params on the request.  
// this happens when the client is php and the params are on the url  
$campaign_properties = $this->getCampaignProperties( $event );  
if ( $campaign_properties ) {  
$campaign_properties['ts'] = $event->get('timestamp');  
}  
 
// choose attribution model.  
$model = owa_coreAPI::getSetting('base', 'trafficAttributionMode');  
switch ( $model ) {  
 
case 'direct':  
owa_coreAPI::debug( 'Applying "Direct" Traffic Attribution Model' );  
$this->directAttributionModel( $campaign_properties );  
break;  
case 'original':  
owa_coreAPI::debug( 'Applying "Original" Traffic Attribution Model' );  
$this->originalAttributionModel( $campaign_properties );  
break;  
default:  
owa_coreAPI::debug( 'Applying Default (Direct) Traffic Attribution Model' );  
$this->directAttributionModel( $campaign_properties );  
}  
 
// if one of the attribution methods attributes the traffic them  
// set attribution properties on the event object  
if ( $this->isTrafficAttributed ) {  
 
owa_coreAPI::debug( 'Attributing Traffic to: %s', print_r($campaign_pproperties, true ) );  
 
$this->applyCampaignPropertiesToEvent( $event, $campaign_properties );  
 
// set campaign touches  
$campaign_state = owa_coreAPI::getStateParam('c');  
if ($campaign_state) {  
$this->setGlobalEventProperty( 'attribs', json_encode( $campaign_state ) );  
}  
 
} else {  
owa_coreAPI::debug( 'No traffic attribution.' );  
}  
}  
 
function applyCampaignPropertiesToEvent( $event, $campaign_properties) {  
 
// set the attributes  
if (!empty($campaign_properties)) {  
 
foreach ($campaign_properties as $k => $v) {  
 
if ($k === 'md') {  
$this->setGlobalEventProperty( 'medium', $campaign_properties[$k] );  
}  
 
if ($k === 'sr') {  
$this->setGlobalEventProperty( 'source', $campaign_properties[$k] );  
}  
 
if ($k === 'cn') {  
$this->setGlobalEventProperty( 'campaign', $campaign_properties[$k] );  
}  
 
if ($k === 'at') {  
$this->setGlobalEventProperty( 'ad_type', $campaign_properties[$k] );  
}  
 
if ($k === 'ad') {  
$this->setGlobalEventProperty( 'ad', $campaign_properties[$k] );  
}  
 
if ($k === 'tr') {  
$this->setGlobalEventProperty( 'search_terms', $campaign_properties[$k] );  
}  
}  
}  
}  
 
function setCampaignCookie($values) {  
// reset state  
owa_coreAPI::setState('c', '',  
json_encode( $values ),  
'cookie',  
owa_coreAPI::getSetting( 'base', 'campaign_attribution_window' ) );  
}  
 
// sets cookies domain  
function setCookieDomain($domain) {  
 
if (!empty($domain)) {  
$c = &owa_coreAPI::configSingleton();  
// sanitizes the domain  
$c->setCookieDomain($domain);  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Database Column Object  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_dbColumn {  
 
var $name;  
 
var $value;  
 
var $data_type;  
 
var $foriegn_key;  
 
var $is_primary_key = false;  
 
var $auto_increment = false;  
 
var $is_unique = false;  
 
var $is_not_null = false;  
 
var $label;  
 
var $index;  
 
var $default_value;  
 
function __construct($name ='', $data_type = '') {  
 
if ($name) {  
$this->setName($name);  
}  
 
if ($data_type) {  
$this->setDataType($data_type);  
}  
 
}  
 
function get($name) {  
 
return $this->$name;  
}  
 
function set($name, $value) {  
 
$this->$name = $value;  
 
return;  
}  
 
function getValue() {  
 
return $this->value;  
}  
 
function setValue($value) {  
 
$this->value = $value;  
 
return;  
}  
 
function getDefinition() {  
 
$definition = '';  
 
$definition .= $this->get('data_type');  
 
// Check for auto increment  
if ($this->get('auto_increment') == true):  
$definition .= ' '.OWA_DTD_AUTO_INCREMENT;  
endif;  
 
// Check for auto Not null  
if ($this->get('is_not_null') == true):  
$definition .= ' '.OWA_DTD_NOT_NULL;  
endif;  
 
// Check for unique  
if ($this->get('is_unique') == true):  
$definition .= ' '.OWA_DTD_UNIQUE;  
endif;  
 
// check for primary key  
if ($this->get('is_primary_key') == true):  
$definition .= ' '.OWA_DTD_PRIMARY_KEY;  
//$definition .= sprintf(", INDEX (%s)", $this->get('name'));  
endif;  
 
// check for index  
if ($this->get('index') == true):  
$definition .= sprintf(", INDEX (%s)", $this->get('name'));  
endif;  
 
return $definition;  
 
}  
 
function setDataType($type) {  
 
$this->data_type = $type;  
}  
 
function setDefaultValue($value) {  
 
$this->default_value = $value;  
}  
 
function setPrimaryKey() {  
 
$this->is_primary_key = true;  
}  
 
function setIndex() {  
 
$this->index = true;  
}  
 
function setNotNull() {  
 
$this->is_not_null = true;  
}  
 
function setUnique() {  
 
$this->is_unique = true;  
}  
 
function setLabel($label) {  
 
$this->label = $label;  
}  
 
function setForeignKey($entity, $column = 'id') {  
 
$this->foreign_key = array($entity, $column);  
}  
 
function getForeignKey() {  
 
return $this->foreign_key;  
}  
 
function isForeignKey() {  
 
if (!empty($this->foreign_key)) {  
return true;  
} else {  
return false;  
}  
}  
 
function setAutoIncrement() {  
 
$this->auto_increment = true;  
}  
 
function setName($name) {  
 
$this->name = $name;  
}  
 
function getName() {  
 
return $this->name;  
}  
 
}  
 
?>  
<?php  
 
if ( ! class_exists( 'Daemon' ) ) {  
require_once( OWA_INCLUDE_DIR.'Daemon.class.php' );  
}  
 
if ( ! class_exists( 'CronParser.php' ) ) {  
require_once(OWA_INCLUDE_DIR.'CronParser.php');  
}  
 
class owa_daemon extends Daemon {  
 
var $pids = array();  
var $params = array();  
var $max_workers = 5;  
var $job_scheduling_interval = 30;  
var $eq;  
var $workerCountByJob = array();  
var $lastExecutionTimeByJob = array();  
var $jobsByPid = array();  
var $defaultMaxWorkersPerJob = 3;  
var $jobs;  
 
function __construct() {  
 
$this->params = $this->getArgs();  
 
if (isset($this->params['interval'])) {  
$this->job_scheduling_interval = $this->params['interval'];  
}  
 
if (isset($this->params['max_workers'])) {  
$this->max_workers = $this->params['max_workers'];  
}  
 
if (isset($this->params['pid_file_location'])) {  
$this->pidFileLocation = $this->params['pid_file_location'];  
}  
 
if (isset($this->params['uid'])) {  
$this->userID = $this->params['uid'];  
}  
 
if (isset($this->params['gid'])) {  
$this->groupID = $this->params['gid'];  
}  
 
if (isset($this->params['pid_file_location'])) {  
$this->pidFileLocation = $this->params['pid_file_location'];  
}  
 
$s = owa_coreAPI::serviceSingleton();  
$this->jobs = $s->getMap('backgound_jobs');  
 
$this->eq = owa_coreAPI::getEventDispatch();  
 
return parent::__construct();  
}  
 
function getArgs() {  
 
$params = array();  
// get params from the command line args  
// $argv is a php super global variable  
global $argv;  
for ( $i=1; $i < count( $argv ); $i++ ) {  
$it = split("=",$argv[$i]);  
$params[$it[0]] = $it[1];  
}  
 
return $params;  
}  
 
function _logMessage($msg, $status = DLOG_NOTICE) {  
 
if ($status & DLOG_TO_CONSOLE) {  
echo $msg."\n";  
}  
 
owa_coreAPI::notice("Daemon: $msg");  
}  
 
function isWorkerAvailable() {  
 
$active_workers = count( $this->pids );  
$available_workers = $this->max_workers - $active_workers;  
if ( $available_workers >= 1 ) {  
return true;  
} else {  
return false;  
}  
}  
 
function isAnotherWorkerAllowed($job_name, $job_max_workers = '') {  
 
if ( ! $job_max_workers ) {  
$job_max_workers = $this->defaultMaxWorkersPerJob;  
}  
 
if ( array_key_exists($job_name, $this->workerCountByJob ) ) {  
if ( $this->workerCountByJob[$job_name] < $job_max_workers) {  
owa_coreAPI::debug(sprintf(  
"New worker processes is allowed for job: %s. %d of %d processes are active.",  
$job_name,  
$this->workerCountByJob[$job_name], $job_max_workers  
));  
return true;  
} else {  
owa_coreAPI::debug(sprintf(  
"New worker processes not allowed for job: %s. %d of %d processes are active.",  
$job_name,  
$this->workerCountByJob[$job_name], $job_max_workers  
));  
return false;  
}  
} else {  
owa_coreAPI::debug(sprintf(  
"New worker processes is allowed for job: %s. %d of %d processes are active.",  
$job_name,  
$this->workerCountByJob[$job_name], $job_max_workers  
));  
return true;  
}  
}  
 
function isTimeForJob($cron_tab, $last_execution_time) {  
 
$cron = new CronParser();  
$cron->calcLastRan($cron_tab);  
$last_due = $cron->getLastRanUnix();  
 
if ($last_due > $last_execution_time) {  
return true;  
} else {  
return false;  
}  
}  
 
function getLastExecutionTime($job_name) {  
 
if ( array_key_exists( $job_name, $this->lastExecutionTimeByJob ) ) {  
return $this->lastExecutionTimeByJob[$job_name];  
} else {  
return 0;  
}  
}  
 
/**  
* This function is happening in a while loop  
*/  
function _doTask() {  
 
if ( $this->isWorkerAvailable() ) {  
 
$jobs = $this->jobs;  
 
if ( $jobs ) {  
$i = 0;  
//for ($i = 0; $i < $available_workers; $i++) {  
foreach ($jobs as $k => $job) {  
 
if ( $this->isAnotherWorkerAllowed( $job['name'], $job['max_processes'] ) &&  
$this->isTimeForJob( $job['cron_tab'], $this->getLastExecutionTime( $job['name'] ) ) ) {  
// fork a new child  
$pid = pcntl_fork();  
if ( ! $pid ) {  
// this part is executed in the child  
owa_coreAPI::debug( 'New child process executing job ' . print_r( $job, true ) );  
pcntl_exec( OWA_DIR.'cli.php', $job['cmd'] ); // takes an array of arguments  
exit();  
} elseif ($pid == -1) {  
// happens when something goes wrong and fork fails (handle errors here)  
owa_coreAPI::debug( 'Could not fork new child' );  
} else {  
// this part is executed in the parent  
// We add pids to a global array, so that when we get a kill signal  
// we tell the kids to flush and exit.  
if ( array_key_exists( $k, $this->workerCountByJob ) ) {  
$this->workerCountByJob[$k]++;  
} else {  
$this->workerCountByJob[$k] = 1;  
$this->lastExecutionTimeByJob[$k] = time();  
$this->jobsByPid[$pid] = $k;  
}  
 
$this->pids[] = $pid;  
}  
}  
}  
}  
}  
 
// Collect any children which have exited on their own. pcntl_waitpid will  
// return the PID that exited or 0 or ERROR  
// WNOHANG means we won't sit here waiting if there's not a child ready  
// for us to reap immediately  
// -1 means any child  
$dead_and_gone = pcntl_waitpid( -1, $status, WNOHANG );  
 
while( $dead_and_gone > 0 ) {  
// Remove the gone pid from the array  
unset( $this->pids[array_search( $dead_and_gone, $this->pids )] );  
$past_job = $this->jobsByPid[$dead_and_gone];  
// decrement worker count  
--$this->workerCountByJob[$past_job];  
unset($this->jobsByPid[$dead_and_gone]);  
 
// Look for another one  
$dead_and_gone = pcntl_waitpid( -1, $status, WNOHANG);  
}  
 
owa_coreAPI::debug(sprintf(  
"Daemon Statistics -- pidsByJob: %s, workerCountByJob: %s, lastExecutionTimeByJob: %s",  
print_r( $this->pidsByJob, true),  
print_r( $this->workerCountByJob, true),  
print_r( $this->lastExecutiontimeByJob, true)  
));  
 
// Sleep for some interval  
sleep($this->job_scheduling_interval);  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Date Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_date {  
 
var $yyyymmdd;  
var $timestamp;  
var $label;  
var $label_formal;  
var $year;  
var $month;  
var $day;  
var $is_leap_year;  
var $day_of_week;  
var $day_of_week_label;  
var $day_of_year;  
var $day_of_year_label;  
var $week_of_year;  
var $hour;  
var $minute;  
var $second;  
var $microsecond;  
var $meridiem;  
var $num_days_in_month;  
var $utc_offset;  
 
function __construct() {  
 
return;  
}  
 
function set($date, $format = 'yyyymmdd') {  
 
switch ($format) {  
 
case 'yyyymmdd':  
$this->yyyymmdd = $date;  
list($this->year, $this->month, $this->day) = sscanf($date, "%4d%2d%2d");  
$this->timestamp = mktime(0, 0, 0, $this->month, $this->day, $this->year);  
break;  
 
case 'timestamp':  
$this->timestamp = $date;  
$this->yyyymmdd = date('Ymd', $date);  
list($this->year, $this->month, $this->day) = sscanf($this->yyyymmdd, "%4d%2d%2d");  
break;  
 
 
}  
 
$this->utc_offset = date('Z', $this->timestamp);  
$this->hour = date('H', $this->timestamp);  
$this->minute = date('i', $this->timestamp);  
$this->second = date('s', $this->timestamp);  
$this->microsecond = date('u', $this->timestamp);  
$this->meridiem = date('a', $this->timestamp);  
$this->day_of_week = date('w', $this->timestamp);  
$this->day_of_week_label = date('l', $this->timestamp);  
$this->week_of_year = date('W', $this->timestamp);  
$this->day_of_year = date('z', $this->timestamp);  
$this->num_days_in_month = date('t', $this->timestamp);  
$this->label = date('m/d/Y', $this->timestamp);  
$this->label_formal = date('F jS Y', $this->timestamp);  
}  
 
function get($name){  
 
return $this->$name;  
}  
 
function getDay() {  
return $this->day;  
}  
 
function getMonth() {  
return $this->month;  
}  
 
function getYear() {  
return $this->year;  
}  
 
function getLabel($format = '') {  
 
if (empty($format)) {  
 
$format = 'label';  
 
} else {  
 
$format = 'label_'.$format;  
}  
 
return $this->$format;  
}  
 
function getYyyymmdd() {  
 
return $this->yyyymmdd;  
}  
 
function getTimestamp() {  
 
return $this->timestamp;  
}  
 
function getLocalTimestamp() {  
 
return $this->getTimestamp() + $this->utc_offset;  
}  
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if ( ! class_exists( 'eventQueue' ) ) {  
require_once( OWA_BASE_CLASS_DIR.'eventQueue.php' );  
}  
/**  
* Database backed Event Queue Implementation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_dbEventQueue extends eventQueue {  
 
var $db;  
var $items_per_fetch = 50;  
 
function __construct($queue_dir = '') {  
 
$this->db = owa_coreAPI::dbSingleton();  
return parent::__construct();  
}  
 
function addToQueue($event) {  
 
$qi = owa_coreAPI::entityFactory('base.queue_item');  
$serialized_event = serialize( $event );  
$qi->set( 'id', $qi->generateId( $serialized_event) );  
$qi->set( 'event_type', $event->getEventType() );  
$qi->set( 'status', 'unhandled' );  
$qi->set( 'priority', $this->determinPriority( $event->getEventType() ) );  
$qi->set( 'event', $serialized_event );  
$qi->set( 'insertion_timestamp', $this->makeTimestamp() );  
$qi->set( 'insertion_datestamp', $this->makeDatestamp() );  
$qi->save();  
}  
 
function markAsFailed($item_id, $error_msg = '') {  
 
$qi = owa_coreAPI::entityFactory('base.queue_item');  
$qi->load($item_id);  
$inserted_timestamp = $qi->get('insertion_timestamp');  
if ($inserted_timestamp) {  
$qi->set( 'failed_attempt_count' , $qi->get( 'failed_attempt_count' ) + 1 );  
$qi->set( 'last_attempt_timestamp', $this->makeTimestamp() );  
$qi->set( 'not_before_timestamp', $this->determineNextAttempt($qi->get('event_type'), $qi->get('failed_attempt_count') ) );  
$qi->set( 'last_error_msg', $error_msg);  
$qi->save();  
}  
}  
 
function markAsHandled($item_id) {  
$qi = owa_coreAPI::entityFactory('base.queue_item');  
$qi->load($item_id);  
$inserted_timestamp = $qi->get('insertion_timestamp');  
if ($inserted_timestamp) {  
$qi->set( 'status', 'handled' );  
$qi->set( 'handled_timestamp', $this->makeTimestamp() );  
$qi->save();  
}  
}  
 
function getNextItems($limit = '') {  
 
if ( ! $limit ) {  
$limit = $this->items_per_fetch;  
}  
$this->db->select( '*' );  
$this->db->from( 'owa_queue_item' );  
$this->db->where( 'status', 'unhandled' );  
$this->db->where( 'not_before_timestamp', time(), '<' );  
$this->db->orderBy( 'insertion_timestamp' , 'ASC' );  
$this->db->limit( $limit );  
 
$items = $this->db->getAllRows();  
 
if ( $items ) {  
$entities = array();  
foreach ( $items as $item ) {  
$qi = owa_coreAPI::entityFactory( 'base.queue_item' );  
$qi->setProperties( $item );  
$entities[] = $qi;  
}  
 
if ( $limit > 1 ) {  
return $entities;  
} else {  
return $entities[0];  
}  
}  
}  
 
function getNextItem() {  
 
return $this->getNextItems(1);  
}  
 
function determineNextAttempt($event_type, $failed_count) {  
 
return $this->makeTimeStamp(time() + 30);  
}  
 
function makeTimestamp() {  
 
return time();  
}  
 
// safe for mysql timestamp column type  
function makeDatestamp($time = '') {  
 
if ( ! $time ) {  
$time = time();  
}  
 
return gmdate("Y-m-d H:i:s", $time);  
}  
 
function determinPriority($event_type) {  
 
return 99;  
}  
 
function processQueue() {  
 
$more = true;  
 
while( $more ) {  
 
$items = $this->getNextItems();  
 
if ( $items ) {  
 
foreach ( $items as $item ) {  
owa_coreAPI::debug('About to dispatch queue item id: ' . $item->get( 'id' ) );  
$event = unserialize( $item->get('event') );  
$dispatch = owa_coreAPI::getEventDispatch();  
$ret = $dispatch->notify( $event );  
owa_coreAPI::debug($ret);  
 
$id = $item->get( 'id' );  
if ( $ret === OWA_EHS_EVENT_HANDLED ) {  
$this->markAsHandled( $id );  
owa_coreAPI::debug("EHS: marked item ($id) as handled.");  
} else {  
$this->markAsFailed( $id );  
owa_coreAPI::debug("EHS: marked item ($id) as failed.");  
}  
 
}  
 
} else {  
$more = false;  
}  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if ( ! class_exists( 'Log' ) ) {  
require_once (OWA_PEARLOG_DIR . '/Log.php');  
}  
if ( ! class_exists( 'Log_file' ) ) {  
require_once (OWA_PEARLOG_DIR . '/Log/file.php');  
}  
if ( ! class_exists( 'Log_composite' ) ) {  
require_once (OWA_PEARLOG_DIR . '/Log/composite.php');  
}  
if ( ! class_exists( 'Log_mail' ) ) {  
require_once (OWA_PEARLOG_DIR . '/Log/mail.php');  
}  
 
/**  
* Error handler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_error {  
 
/**  
* Instance of the current logger  
*  
* @var object  
*/  
var $logger;  
 
/**  
* Buffered Msgs  
*  
* @var array  
*/  
var $bmsgs;  
 
var $hasChildren = false;  
 
var $init = false;  
 
var $c;  
 
/**  
* Constructor  
*  
*/  
function __construct() {  
 
// setup composite logger  
$this->logger = &Log::singleton('composite');  
$this->addLogger('null');  
}  
 
function __destruct() {  
 
return;  
}  
 
function setConfig($c) {  
$this->c = $c;  
}  
 
function setErrorLevel() {  
 
return;  
}  
 
function addLogger($type, $mask = null, $config = array()) {  
 
// make child logger  
$child = $this->loggerFactory($type, $config);  
 
if (!empty($child)):  
//set error level mask  
if (!empty($mask)):  
$child->setMask($mask);  
endif;  
 
// add child to main composite logger  
$ret = $this->logger->addChild($child);  
else:  
$ret = false;  
endif;  
 
//set hasChildren flag  
if ($ret == true):  
$this->hasChildren = true;  
else:  
return false;  
endif;  
}  
 
function removeLogger($type) {  
return false;  
}  
 
 
function setHandler($type) {  
 
switch ($type) {  
case "development":  
$this->createDevelopmentHandler();  
break;  
case "production":  
$this->createProductionHandler();  
break;  
default:  
$this->createProductionHandler();  
}  
 
$this->init = true;  
$this->logBufferedMsgs();  
 
return;  
 
}  
 
function createDevelopmentHandler() {  
 
$mask = PEAR_LOG_ALL;  
$this->addLogger('file', $mask);  
 
if (defined('OWA_CLI')) {  
$this->addLogger('console', $mask);  
}  
}  
 
function createCliDevelopmentHandler() {  
 
$mask = PEAR_LOG_ALL;  
$this->addLogger('file', $mask);  
$this->addLogger('console', $mask);  
}  
 
function createCliProductionHandler() {  
 
$mail_mask = Log::MASK(PEAR_LOG_EMERG) | Log::MASK(PEAR_LOG_CRIT) | Log::MASK(PEAR_LOG_ALERT);  
$this->addLogger('mail', $mail_mask);  
$this->addLogger('console', $file_mask);  
}  
 
function createProductionHandler() {  
 
$file_mask = PEAR_LOG_ALL ^ Log::MASK(PEAR_LOG_DEBUG) ^ Log::MASK(PEAR_LOG_INFO);  
$this->addLogger('file', $file_mask);  
$mail_mask = Log::MASK(PEAR_LOG_EMERG) | Log::MASK(PEAR_LOG_CRIT) | Log::MASK(PEAR_LOG_ALERT);  
$this->addLogger('mail', $mail_mask);  
 
if (defined('OWA_CLI')) {  
$this->addLogger('console', $file_mask);  
}  
}  
 
 
function debug($message) {  
 
return $this->log($message, PEAR_LOG_DEBUG);  
 
}  
 
function info($message) {  
 
return $this->log($message, PEAR_LOG_INFO);  
}  
 
function notice($message) {  
 
return $this->log($message, PEAR_LOG_NOTICE);  
}  
 
function warning($message) {  
 
return $this->log($message, PEAR_LOG_WARNING);  
}  
 
function err($message) {  
 
return $this->log($message, PEAR_LOG_ERR);  
 
}  
 
function crit($message) {  
 
return $this->log($message, PEAR_LOG_CRIT);  
 
}  
 
function alert($message) {  
 
return $this->log($message, PEAR_LOG_ALERT);  
 
}  
 
function emerg($message) {  
 
return $this->log($message, PEAR_LOG_EMERG);  
 
}  
 
function log($err, $priority) {  
 
// log to normal logger  
if ($this->init) {  
return $this->logger->log($err, $priority);  
} else {  
return $this->bufferMsg($err, $priority);  
}  
}  
 
function bufferMsg($err, $priority) {  
 
$this->bmsgs[] = array('error' => $err, 'priority' => $priority);  
return true;  
}  
 
function logBufferedMsgs() {  
 
if (!empty($this->bmsgs)):  
foreach($this->bmsgs as $msg) {  
 
$this->log($msg['error'], $msg['priority']);  
}  
 
$this->bmsgs = null;  
endif;  
 
return;  
 
}  
 
 
function loggerFactory($type, $config = array()) {  
 
switch ($type) {  
case "display":  
return $this->make_display_logger($config);  
break;  
case "window":  
return $this->make_window_logger($config);  
break;  
case "file":  
return $this->make_file_logger($config);  
break;  
case "syslog":  
return $this->make_syslog_logger($config);  
break;  
case "mail":  
return $this->make_mail_logger($config);  
break;  
case "console":  
return $this->make_console_logger($config);  
break;  
case "firebug":  
return $this->makeFirebugLogger($config);  
break;  
case "null":  
return $this->make_null_logger();  
break;  
default:  
return false;  
}  
 
}  
 
function makeFirebugLogger() {  
 
$logger = &Log::singleton('firebug', '', getmypid());  
return $logger;  
}  
 
 
/**  
* Builds a null logger  
*  
* @return object  
*/  
function make_null_logger() {  
 
$logger = &Log::singleton('null');  
return $logger;  
}  
 
 
/**  
* Builds a console logger  
*  
* @return object  
*/  
function make_console_logger() {  
if (!defined('STDOUT')) {  
define('STDOUT', fopen("php://stdout", "r"));  
}  
$conf = array('stream' => STDOUT, 'buffering' => false);  
$logger = &Log::singleton('console', '', getmypid(), $conf);  
return $logger;  
}  
 
/**  
* Builds a logger that writes to a file.  
*  
* @return unknown  
*/  
function make_file_logger() {  
 
// fetch config object  
//$c = &owa_coreAPI::configSingleton();  
 
// test to see if file is writable  
$handle = @fopen(owa_coreAPI::getSetting('base', 'error_log_file'), "a");  
 
if ($handle != false):  
fclose($handle);  
$conf = array('mode' => 0600, 'timeFormat' => '%X %x', 'lineFormat' => '%1$s %2$s [%3$s] %4$s');  
$logger = &Log::singleton('file', owa_coreAPI::getSetting('base', 'error_log_file'), getmypid(), $conf);  
return $logger;  
else:  
return;  
endif;  
}  
 
/**  
* Builds a logger that sends lines via email  
*  
* @return unknown  
*/  
function make_mail_logger() {  
 
// fetch config object  
$c = &owa_coreAPI::configSingleton();  
 
$conf = array('subject' => 'Important Error Log Events', 'from' => 'OWA-Error-Logger');  
$logger = &Log::singleton('mail', owa_coreAPI::getSetting('base', 'notice_email'), getmypid(), $conf);  
 
return $logger;  
}  
 
function logPhpErrors() {  
error_reporting(E_ALL);  
ini_set('display_errors', E_ALL);  
return set_error_handler(array("owa_error", "handlePhpError"));  
 
}  
 
 
/**  
* Alternative error handler for PHP specific errors.  
*  
* @param string $errno  
* @param string $errmsg  
* @param string $filename  
* @param string $linenum  
* @param string $vars  
*/  
function handlePhpError($errno = null, $errmsg, $filename, $linenum, $vars) {  
 
$dt = date("Y-m-d H:i:s (T)");  
 
// set of errors for which a var trace will be saved  
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, E_STRICT);  
 
$err = "<errorentry>\n";  
$err .= "\t<datetime>" . $dt . "</datetime>\n";  
$err .= "\t<errornum>" . $errno . "</errornum>\n";  
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";  
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";  
$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";  
 
if (in_array($errno, $user_errors)) {  
// $err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";  
}  
 
$err .= "</errorentry>\n\n";  
 
owa_coreAPI::debug($err);  
 
return;  
}  
 
function backtrace() {  
 
$dbgTrace = debug_backtrace();  
$bt = array();  
foreach($dbgTrace as $dbgIndex => $dbgInfo) {  
 
$bt[$dbgIndex] = array('file' => $dbgInfo['file'],  
'line' => $dbgInfo['line'],  
'function' => $dbgInfo['function'],  
'args' => $dbgInfo['args']);  
}  
 
return $bt;  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract OWA Event Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_event {  
 
/**  
* Event Properties  
*  
* @var array  
*/  
var $properties = array();  
 
/**  
* State  
*  
* @var string  
*/  
//var $state;  
 
var $eventType;  
 
/**  
* Time since last request.  
*  
* Used to tell if a new session should be created.  
*  
* @var integer $time_since_lastreq  
*/  
var $time_since_lastreq;  
 
/**  
* Event guid  
*  
* @var string  
*/  
var $guid;  
 
/**  
* Constructor  
* @access public  
*/  
function __construct() {  
 
// Set GUID for event  
$this->guid = $this->set_guid();  
//needed?  
$this->set('guid', $this->guid);  
$this->set('timestamp', time() );  
 
}  
 
function set($name, $value) {  
 
$this->properties[$name] = $value;  
return;  
}  
 
function get($name) {  
 
if(array_key_exists($name, $this->properties)) {  
//print_r($this->properties[$name]);  
return $this->properties[$name];  
} else {  
return false;  
}  
}  
 
/**  
* Sets time related event properties  
*  
* @param integer $timestamp  
*/  
function setTime($timestamp = null) {  
 
if ( $timestamp ) {  
$this->set('timestamp', $timestamp);  
} else {  
$timestamp = $this->get('timestamp');  
}  
 
// convert to local time and reset timestamp  
//$timestamp = owa_lib::utcToLocalTimestamp($timestamp);  
//$this->set('timestamp', $timestamp);  
 
$this->set('year', date("Y", $timestamp));  
$this->set('month', date("n", $timestamp));  
$this->set('day', date("d", $timestamp));  
$this->set('yyyymmdd', date("Ymd", $timestamp));  
$this->set('dayofweek', date("D", $timestamp));  
$this->set('dayofyear', date("z", $timestamp));  
$this->set('weekofyear', date("W", $timestamp));  
$this->set('hour', date("G", $timestamp));  
$this->set('minute', date("i", $timestamp));  
$this->set('second', date("s", $timestamp));  
 
//epoc time  
list($msec, $sec) = explode(" ", microtime());  
$this->set('sec', $sec);  
$this->set('msec', $msec);  
 
}  
 
function setCookieDomain($domain) {  
 
$this->properties['cookie_domain'] = $domain;  
}  
 
/**  
* Determines the time since the last request from this borwser  
*  
* @access private  
* @return integer  
*/  
function timeSinceLastRequest() {  
 
return ($this->get('timestamp') - $this->get('last_req'));  
}  
 
/**  
* Applies calling application specific properties to request  
*  
* @access private  
* @param array $properties  
*/  
function setProperties($properties = null) {  
 
if(!empty($properties)) {  
 
if (empty($this->properties)) {  
$this->properties = $properties;  
} else {  
$this->properties = array_merge($this->properties, $properties);  
}  
}  
}  
 
function replaceProperties($properties) {  
 
$this->properties = $properties;  
}  
 
/**  
* Create guid from process id  
*  
* @return integer  
* @access private  
*/  
function set_guid() {  
 
return crc32(getmypid().time().rand());  
 
}  
 
/**  
* Create guid from string  
*  
* @param string $string  
* @return integer  
* @access private  
*/  
function set_string_guid($string) {  
 
return crc32(strtolower($string));  
 
}  
 
/**  
* Attempts to make a unique ID out of http request variables.  
* This should only be used when storing state in a cookie is impossible.  
*  
* @return integer  
*/  
function setEnvGUID() {  
 
return crc32( $this->get('ua') . $this->get('ip_address') );  
 
}  
 
function setSiteSessionState($site_id, $name, $value, $store_type = 'cookie') {  
 
$store_name = owa_coreAPI::getSetting('base', 'site_session_param').'_'.$site_id;  
return owa_coreAPI::setState($store_name, $name, $value, $store_type, true);  
}  
 
function deleteSiteSessionState($site_id, $store_type = 'cookie') {  
 
$store_name = owa_coreAPI::getSetting('base', 'site_session_param').'_'.$site_id;  
return owa_coreAPI::clearState($store_name);  
}  
 
function getProperties() {  
 
return $this->properties;  
}  
 
function getEventType() {  
 
if (!empty($this->eventType)) {  
return $this->eventType;  
} elseif ($this->get('event_type')) {  
return $this->get('event_type');  
} else {  
 
return 'unknown_event_type';  
}  
}  
 
function setEventType($value) {  
$this->eventType = $value;  
}  
 
function cleanProperties() {  
 
return $this->setProperties(owa_lib::inputFilter($this->getProperties()));  
}  
 
function setPageTitle($value) {  
 
$this->set('page_title', $value);  
}  
 
function setSiteId($value) {  
 
$this->set('site_id', $value);  
}  
 
function setPageType($value) {  
 
$this->set('page_type', $value);  
}  
 
function getGuid() {  
 
return $this->guid;  
}  
 
function getSiteSpecificGuid($site_id) {  
 
return crc32(getmypid().time().rand().$site_id);  
}  
 
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Event Queue  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_eventQueue {  
 
function __construct() {  
 
}  
 
function addToQueue($event) {  
 
return false;  
}  
 
function processQueue() {  
 
return false;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cache.php');  
 
/**  
* File Based Cache Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_fileCache extends owa_cache {  
 
var $cache_dir;  
var $lock_file_name = 'cache.lock';  
var $cache_file_header = '<?php\n/*';  
var $cache_file_footer = '*/\n?>';  
var $file_perms = 0750;  
var $dir_perms = 0750;  
var $mutex;  
 
/**  
* Constructor  
*  
* Takes cache directory as param  
*  
* @param $cache_dir string  
*/  
function __construct($cache_dir = '') {  
 
if ($cache_dir) {  
$this->cache_dir = $cache_dir;  
} else {  
$this->cache_dir = OWA_CACHE_DIR;  
}  
 
return parent::__construct();  
}  
 
function getItemFromCacheStore($collection, $id) {  
 
$cache_file = $this->makeCollectionDirPath($collection).$id.'.php';  
$this->debug("check cache file: ".$cache_file);  
 
// if no cache file then return false  
if (!file_exists($cache_file)) {  
$this->debug(sprintf('Cache File not found for Collection: %s, id: %s, file: %s', $collection, $id, $cache_file));  
return false;  
 
// cache object has expired  
} elseif ((filectime($cache_file) + $this->getCollectionExpirationPeriod($collection)) < time()) {  
$this->debug("time: ".time());  
$this->debug("ctime: ".filectime($cache_file));  
$this->debug("diff: ".(time() - filectime($cache_file)));  
$this->debug("exp period: ".$this->getCollectionExpirationPeriod($collection));  
$this->removeCacheFile($this->makeCollectionDirPath($collection).$id.'.php');  
$this->debug(sprintf('Cache Object has expired for Collection: %s, id: %s', $collection, $id));  
return false;  
 
// load from cache file  
} else {  
return unserialize(base64_decode(substr(@ file_get_contents($cache_file), strlen($this->cache_file_header), -strlen($this->cache_file_footer))));  
}  
 
}  
 
function putItemToCacheStore($collection, $id) {  
owa_coreAPI::debug('put id: '.$id);  
if ( $this->acquire_lock() ) {  
$this->makeCacheCollectionDir($collection);  
$this->debug(' writing file for: '.$collection.$id);  
// create collection dir  
$collection_dir = $this->makeCollectionDirPath($collection);  
// asemble cache file name  
$cache_file = $collection_dir.$id.'.php';  
 
$this->removeCacheFile($cache_file);  
 
$temp_cache_file = tempnam($collection_dir, 'tmp_'.$id);  
 
$data = $this->cache_file_header.base64_encode(serialize($this->cache[$collection][$id])).$this->cache_file_footer;  
 
 
// open the temp cache file for writing  
$tcf_handle = @fopen($temp_cache_file, 'w');  
 
if ( false === $tcf_handle ) {  
$this->debug('could not acquire temp file handler');  
} else {  
 
fputs($tcf_handle, $data);  
 
fclose($tcf_handle);  
 
if (!@ rename($temp_cache_file, $cache_file)) {  
 
if (!@ copy($temp_cache_file, $cache_file)) {  
$this->debug('could not rename or copy temp file to cache file');  
} else {  
@ unlink($temp_cache_file);  
$this->debug('removing temp cache file');  
}  
}  
 
@ chmod($cache_file, $this->file_perms);  
$this->debug('changing file permissions on cache file');  
}  
 
$this->release_lock();  
} else {  
$this->debug("could not persist item to cache due to failure acquiring lock.");  
}  
}  
 
function removeItemFromCacheStore($collection, $id) {  
 
return $this->removeCacheFile($this->makeCollectionDirPath($collection).$id.'.php');  
}  
 
function makeCollectionDirPath($collection) {  
 
if (!in_array($collection, $this->global_collections)) {  
return $this->cache_dir.$this->cache_id.DIRECTORY_SEPARATOR.$collection.DIRECTORY_SEPARATOR;  
} else {  
return $this->cache_dir.$collection.DIRECTORY_SEPARATOR;  
}  
}  
 
function makeCacheCollectionDir($collection) {  
 
// check to see if the caches directory is writable, return if not.  
if (!is_writable($this->cache_dir)) {  
return;  
}  
 
// localize the cache directory based on some id passed from caller  
 
if (!file_exists($this->cache_dir.$this->cache_id)) {  
 
mkdir($this->cache_dir.$this->cache_id);  
chmod($this->cache_dir.$this->cache_id, $this->dir_perms);  
}  
 
$collection_dir = $this->makeCollectionDirPath($collection);  
 
if (!file_exists($collection_dir)) {  
 
mkdir($collection_dir);  
chmod($collection_dir, $this->dir_perms);  
}  
 
if (!file_exists($collection_dir."index.php")) {  
 
touch($collection_dir."index.php");  
chmod($collection_dir."index.php", $this->file_perms);  
}  
}  
 
function removeCacheFile($cache_file) {  
 
// Remove the cache file  
if (file_exists($cache_file)) {  
@ unlink($cache_file);  
$this->debug('Cache File Removed: '.$cache_file);  
$this->statistics['removed']++;  
return true;  
} else {  
return false;  
}  
}  
 
function flush() {  
 
$tld = $this->readDir($this->cache_dir);  
$this->debug("Reading cache file list from: ". $this->cache_dir);  
$this->deleteFiles($tld['files']);  
 
foreach ($tld['dirs'] as $k => $dir) {  
 
$sld = $this->readDir($dir);  
$this->debug("Reading cache file list from: ". $dir);  
if (array_key_exists('files', $sld)) {  
$this->deleteFiles($sld['files']);  
}  
foreach ($sld['dirs'] as $sk => $sdir) {  
$ssld = $this->readDir($sdir);  
$this->debug("Reading cache file list from: ". $sdir);  
$this->deleteFiles($ssld['files']);  
 
rmdir($sdir);  
}  
 
rmdir($dir);  
}  
}  
 
function setCacheDir($dir) {  
 
$this->cache_dir = $dir;  
}  
 
function acquire_lock() {  
// Acquire a write lock.  
$this->mutex = @fopen($this->cache_dir.$this->lock_file_name, 'w');  
if (false == $this->mutex) {  
return false;  
} else {  
flock($this->mutex, LOCK_EX);  
return true;  
}  
}  
 
function release_lock() {  
// Release write lock.  
flock($this->mutex, LOCK_UN);  
fclose($this->mutex);  
}  
 
function readDir($dir) {  
 
if ($handle = opendir($dir)) {  
 
while (($file = readdir($handle)) !== false) {  
 
if (is_dir($dir.$file)) {  
 
if (strpos($file, '.') === false) {  
$data['dirs'][] = $dir.$file.DIRECTORY_SEPARATOR;  
}  
} else {  
if (strpos($file, '.php') == true) {  
$data['files'][] = $dir.$file;  
}  
 
if (strpos($file, '.lock') == true) {  
$data['files'][] = $dir.$file;  
}  
}  
}  
 
}  
 
closedir($handle);  
return $data;  
}  
 
function deleteFiles($files) {  
 
if (!empty($files)) {  
 
foreach ($files as $file) {  
$this->debug("About to unlink cache file: ".$file);  
unlink($file);  
}  
 
} else {  
owa_coreAPI::debug('No Cache Files to delete.');  
}  
 
return true;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'eventQueue.php');  
require_once(OWA_BASE_CLASS_DIR.'event.php');  
require_once(OWA_PEARLOG_DIR . DIRECTORY_SEPARATOR . 'Log.php');  
require_once(OWA_PEARLOG_DIR . DIRECTORY_SEPARATOR . 'Log/file.php');  
 
/**  
* File based Event Queue Implementation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_fileEventQueue extends owa_eventQueue {  
 
var $queue;  
var $error_logger;  
var $queue_dir;  
var $event_file;  
 
function __construct($queue_dir = '') {  
 
// set event file  
if (!$queue_dir) {  
$this->queue_dir = owa_coreAPI::getSetting('base', 'async_log_dir');  
}  
 
$this->event_file = $this->queue_dir.'events.txt';  
$this->lock_file = $this->queue_dir.'lock.txt';  
}  
 
function makeQueue() {  
 
//make file queue  
$conf = array('mode' => 0600, 'timeFormat' => '%X %x');  
//$this->queue = &Log::singleton('async_queue', $this->event_file, 'async_event_queue', $conf);  
$this->queue = Log::singleton('file', $this->event_file, 'async_event_queue', $conf);  
$this->queue->_lineFormat = '%1$s|*|%2$s|*|[%3$s]|*|%4$s';  
// not sure why this is needed but it is.  
$this->queue->_filename = $this->event_file;  
}  
 
function addToQueue($event) {  
 
if (!$this->queue) {  
$this->makeQueue();  
}  
 
$this->queue->log(urlencode(serialize($event)));  
 
}  
 
function processQueue($event_file = '') {  
 
if ($event_file) {  
 
$this->event_file = $this->queue_dir.$event_file;  
}  
 
if ( file_exists( $this->event_file ) ) {  
 
$event_log_rotate_size = owa_coreAPI::getSetting( 'base', 'async_log_rotate_size' );  
 
if ( filesize( $this->event_file ) > $event_log_rotate_size ) {  
 
owa_coreAPI::notice(sprintf('Starting Async Event Processing Run for: %s', $this->event_file));  
 
//check for lock file  
if (!$this->isLocked()) {  
 
return $this->process_event_log($this->event_file);  
 
} else {  
 
owa_coreAPI::notice(sprintf('Previous Process (%d) still active. Terminating Run.', $former_pid));  
}  
 
} else {  
 
owa_coreAPI::debug("Event file is not large enough to process yet. Size is only: ".filesize($this->event_file));  
}  
 
} else {  
 
owa_coreAPI::debug("No event file found at: ".$this->event_file);  
}  
 
}  
 
function isLocked() {  
 
if (file_exists($this->lock_file)) {  
//read contents of lock file for last PID  
$lock = fopen($this->lock_file, "r") or die ("Could not read lock file");  
if ($lock) {  
while (!feof($lock)) {  
$former_pid = fgets($lock, 4096);  
}  
fclose($lock);  
}  
 
//check to see if former process is still running  
$ps_check = $this->isRunning($former_pid);  
//if the process is still running, exit.  
if ($ps_check) {  
owa_coreAPI::notice(sprintf('Previous Process (%d) still active. Terminating Run.', $former_pid));  
return true;  
//if it's not running remove the lock file and proceead.  
} else {  
owa_coreAPI::debug(sprintf('Process %d is no longer running. Deleting old Lock file. \n', $former_pid));  
unlink ($this->lock_file);  
return false;  
}  
 
} else {  
return false;  
}  
}  
 
function isRunning($pid) {  
 
$process_state = '';  
 
exec("ps $pid", $process_state);  
//print $pid;  
print_r($process_state);  
 
if (count($process_state) >= 2) {  
return true;  
} else {  
return false;  
}  
}  
 
function process_event_log($file) {  
 
// check to see if event log file exisits  
if (!file_exists($file)) {  
owa_coreAPI::debug("Event file does not exist at $file");  
return false;  
}  
 
//create lock file  
$this->create_lock_file();  
 
// get event dispatcher  
$dispatch = owa_coreAPI::getEventDispatch();  
 
// Create a new log file name  
$new_file_name = $this->queue_dir.time().".".getmypid();  
$new_file = $new_file_name.".processing";  
 
// Rename current log file  
rename ($file, $new_file ) or die ("Could not rename file");  
owa_coreAPI::debug('renamed event file.');  
 
// open file for reading  
$handle = @fopen($new_file, "r");  
if ($handle) {  
while (!feof($handle)) {  
 
// Read row  
$buffer = fgets($handle, 14096); // big enough?  
 
// Parse the row  
$event = $this->parse_log_row($buffer);  
 
// Log event to the event queue  
if (!empty($event)) {  
//print_r($event);  
// debug  
owa_coreAPI::debug(sprintf('Processing: %s (%s)', '', $event->guid));  
// send event object to event queue  
$ret = $dispatch->notify($event);  
 
// is the dispatch was not successful then add the event back into the queue.  
if ( $ret != OWA_EHS_EVENT_HANDLED ) {  
$dispatch->asyncNotify($event);  
}  
 
} else {  
owa_coreAPI::debug("No event found in log row. Must be end of file.");  
}  
}  
//Close file  
fclose($handle);  
 
// rename file to mark it as processed  
$processed_file_name = $new_file_name.".processed";  
rename ($new_file, $processed_file_name) or die ("Could not rename file");  
owa_coreAPI::debug(sprintf('Processing Complete. Renaming File to %s', $processed_file_name ));  
 
//Delete processed file  
unlink($processed_file_name);  
owa_coreAPI::debug(sprintf('Deleting File %s', $processed_file_name));  
 
//Delete Lock file  
unlink($this->lock_file);  
 
return true;  
} else {  
//could not open file for processing  
owa_coreAPI::error(sprintf('Could not open file %s. Terminating Run.', $new_file));  
}  
}  
 
function makeErrorLogFile() {  
 
$conf = array('mode' => 640, 'timeFormat' => '%X %x');  
$this->error_logger = &Log::singleton('file', owa_coreAPI::getSetting('async_error_log_file'), 'ident', $conf);  
$this->error_logger->_lineFormat = '[%3$s]';  
$this->error_logger->_filename = owa_coreAPI::getSetting('async_error_log_file');  
}  
 
function logError($event) {  
 
}  
 
/**  
* Parse row from event log file  
*  
* @param string $row  
* @return array  
*/  
function parse_log_row($row) {  
if ($row) {  
$raw_event = explode("|*|", $row);  
//print_r($raw_event);  
//$row_array = array( 'timestamp' => $raw_event[0], 'event_type' => $raw_event[3], 'event_obj' => $raw_event[4]);  
$row_array = array( 'timestamp' => $raw_event[0], 'event_obj' => $raw_event[3]);  
//print_r($row_array);  
$event = unserialize(urldecode($row_array['event_obj']));  
//print_r($event);  
return $event;  
}  
}  
 
function create_lock_file() {  
 
$lock_file = fopen($this->lock_file, "w+") or die ("Could not create lock file at: ".$this->lock_file);  
 
// Write PID to lock file  
if (fwrite($lock_file, getmypid()) === FALSE) {  
owa_coreAPI::debug('Cannot write to lock file. Terminating Run.');  
exit;  
}  
 
return;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Geolocation Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
 
class owa_geolocation {  
 
var $properties = array();  
 
public static function getInstance() {  
 
return new owa_geolocation();  
}  
 
function __construct() {  
 
}  
 
function __destruct() {  
 
}  
 
function getGeolocationFromIp($ip_address, $refresh = false) {  
 
if (empty($this->properties) || $refresh === true) {  
 
$geo = array('ip_address' => $ip_address,  
'city' => '',  
'country' => '',  
'state' => '',  
'country_code' => '',  
'latitude' => '',  
'longitude' => '');  
 
if ( owa_coreAPI::getSetting( 'base', 'geolocation_lookup' ) ) {  
 
$eq = owa_coreAPI::getEventDispatch();  
$geo = $eq->filter('geolocation', $geo);  
 
}  
 
foreach ($geo as $k => $v) {  
if ( ! $v ) {  
$geo[$k] = '(not set)';  
}  
}  
 
$this->properties = $geo;  
}  
}  
 
function getProperty($name) {  
 
if (array_key_exists($name, $this->properties)) {  
return $this->properties[$name];  
}  
}  
 
function setProperty($name, $value) {  
 
$this->properties[$name] = $value;  
}  
 
function getCity() {  
 
if (array_key_exists('city', $this->properties)) {  
return $this->properties['city'];  
}  
}  
 
function getState() {  
if (array_key_exists('state', $this->properties)) {  
return $this->properties['state'];  
}  
}  
 
function getCountry() {  
if (array_key_exists('country', $this->properties)) {  
return $this->properties['country'];  
}  
}  
 
function getCountryCode() {  
if (array_key_exists('country_code', $this->properties)) {  
return $this->properties['country_code'];  
}  
}  
 
function getLatitude() {  
if (array_key_exists('latitude', $this->properties)) {  
return $this->properties['latitude'];  
}  
}  
 
function getLongitude() {  
if (array_key_exists('longitude', $this->properties)) {  
return $this->properties['longitude'];  
}  
}  
 
function generateId($country = '', $state = '', $city = '') {  
 
if ( ! $country ) {  
 
$country = $this->getCountry();  
}  
 
if ( ! $state ) {  
 
$state = $this->getState();  
}  
 
if ( ! $city ) {  
 
$city = $this->getCity();  
}  
$id_string = trim( strtolower($country)) . trim( strtolower($state)) . trim( strtolower($city));  
return owa_lib::setStringGuid( $id_string );  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal Manager  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
 
class owa_goalManager extends owa_base {  
 
var $goals;  
var $activeGoals;  
var $goal_group_labels;  
var $activeGoalGroups;  
var $activeGoalsByGroup;  
var $site_id;  
var $numGoals;  
var $numGoalGroups;  
var $isDirtyGoals;  
var $isDirtyGoalGroups;  
 
/**  
* Constructor  
*  
* Takes cache directory as param  
*  
* @param $cache_dir string  
*/  
function __construct( $site_id ) {  
 
$this->site_id = $site_id;  
$this->numGoals = owa_coreAPI::getSetting('base', 'numGoals');  
$this->numGoalGroups = owa_coreAPI::getSetting('base', 'numGoalGroups');  
$this->loadGoals( $site_id );  
$this->loadGoalGroupLabels ( $site_id );  
}  
 
function setSiteId( $site_id ) {  
 
$this->site_id = $site_id;  
}  
 
function loadGoalGroupLabels( $site_id ) {  
 
$this->goal_group_labels = array();  
for ( $i = 1; $i <= $this->numGoalGroups; $i++ ) {  
$this->goal_group_labels[$i] = "Goal Group $i";  
}  
 
$from_db = owa_coreAPI::getSiteSetting( $site_id , 'goal_groups' );  
 
if ($from_db) {  
 
foreach($from_db as $k => $goalGroup) {  
if (array_key_exists($k, $this->goal_group_labels)) {  
$this->goal_group_labels[$k] = $goalGroup;  
}  
}  
}  
}  
 
function loadGoals( $site_id ) {  
 
$this->goals = array();  
 
for ( $i = 1; $i <= $this->numGoals; $i++ ) {  
$this->goals[$i] = array(  
'goal_number' => '',  
'goal_name' => '',  
'goal_group' => '',  
'goal_status' => '',  
'goal_type' => ''  
);  
}  
 
$from_db = owa_coreAPI::getSiteSetting( $site_id, 'goals' );  
 
if ($from_db) {  
 
foreach ($from_db as $k => $goal) {  
 
if (array_key_exists($k, $this->goals)) {  
// add to goal array  
$this->goals[$k] = $goal;  
// set active goal lists  
if (array_key_exists('goal_status', $goal) && $goal['goal_status'] === 'active') {  
// set active goals  
$this->activeGoals[] = $goal['goal_number'];  
// set active goal groups  
if (array_key_exists('goal_group', $goal)) {  
$this->activeGoalGroups[$goal['goal_group']] = $goal['goal_group'];  
// set active goals by group  
$this->activeGoalsByGroup[$goal['goal_group']][] = $goal['goal_number'];  
}  
}  
}  
}  
}  
}  
 
function getActiveGoals() {  
if (!empty($this->activeGoals)) {  
$goals = array();  
foreach ($this->activeGoals as $goal_number) {  
$goals[$goal_number] = $this->getGoal($goal_number);  
}  
return $goals;  
}  
}  
 
function getAllGoals() {  
 
return $this->goals;  
}  
 
function getActiveGoalGroups() {  
 
return $this->activeGoalGroups;  
}  
 
function getActiveGoalsByGroup($group_number) {  
 
return $this->activeGoalsByGroup[$group_number];  
}  
 
function getGoal($number) {  
 
if ( array_key_exists( $number, $this->goals ) ) {  
 
return $this->goals[$number];  
}  
}  
 
function getGoalGroupLabel($number) {  
 
if ( array_key_exists( $number, $this->goal_group_labels ) ) {  
 
return $this->goal_group_labels[$number];  
}  
}  
 
function getAllGoalGroupLabels() {  
 
return $this->goal_group_labels;  
}  
 
function saveGoal($number, $goal) {  
 
if ( $number <= $this->numGoals ) {  
 
$goal['goal_number'] = $number;  
$this->goals[$goal['goal_number']] = $goal;  
$this->isDirtyGoals = true;  
}  
}  
 
function saveGoalGroupLabel($number, $goal_group) {  
 
$this->goal_group_labels[$number] = $goal_group;  
$this->isDirtyGoalGroups = true;  
}  
 
function __destruct() {  
 
if ( $this->isDirtyGoals ) {  
 
owa_coreAPI::persistSiteSetting( $this->site_id, 'goals', $this->goals );  
}  
 
if ( $this->isDirtyGoalGroups ) {  
 
owa_coreAPI::persistSiteSetting( $this->site_id, 'goal_groups', $this->goal_group_labels );  
}  
}  
 
function getGoalFunnel($goal_number) {  
 
$goal = $this->getGoal($goal_number);  
if ( array_key_exists( 'details', $goal ) && array_key_exists( 'funnel_steps', $goal['details'] ) ) {  
return $goal['details']['funnel_steps'];  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
require_once(OWA_BASE_DIR.'/owa_location.php');  
 
if (!class_exists('owa_http')) {  
//owa_coreAPI::debug('owa_http already defined');  
require_once(OWA_BASE_DIR.'/owa_httpRequest.php');  
}  
 
/**  
* Geolocation plugin for Hostip.info web service  
*  
* See http://www.hostip.info/use.html for API documentation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_hostip extends owa_location {  
 
/**  
* URL template for REST based web service  
*  
* @var unknown_type  
*/  
var $ws_url = "http://api.hostip.info/get_html.php?ip=%s&position=true";  
 
/**  
* Constructor  
*  
* @return owa_hostip  
*/  
function __construct() {  
 
return parent::__construct();  
}  
 
/**  
* Fetches the location from the hostip.info web service  
*  
* @param string $ip  
*/  
function get_location($location_map) {  
 
$city = '';  
$state = '';  
$country = '';  
$country_code = '';  
$latitude = '';  
$longitude = '';  
 
// check to see if ip is in map  
if ( array_key_exists('ip_address',$location_map)  
&& ! empty( $location_map['ip_address'] )  
&& empty( $location_map['country'] ) ) {  
 
// check to see if ip is valid and not a private address  
if ( filter_var( $location_map['ip_address'],  
FILTER_VALIDATE_IP,  
FILTER_FLAG_IPV4 |  
FILTER_FLAG_NO_PRIV_RANGE ) ) {  
 
// create crawler  
$crawler = new owa_http;  
$crawler->read_timeout = owa_coreAPI::getSetting('base','ws_timeout');  
// hit web service  
$crawler->fetch(sprintf($this->ws_url, $location_map['ip_address']));  
owa_coreAPI::debug(sprintf("HostIp web service response code: %s", $crawler->crawler->response_code));  
$location = $crawler->crawler->results;  
// replace delimiter  
$location = str_replace("\n", "|", $location);  
// convert string to array  
$loc_array = explode("|", $location);  
$result = array();  
// convert array to multi dimensional array  
foreach ($loc_array as $k => $v) {  
 
if (!empty($v)) {  
list($name, $value) = explode(":", $v, 2);  
$result[$name] = $value;  
}  
}  
 
// parse the city line of response  
if ( isset( $result['City'] ) && ! empty( $result['City'] ) ) {  
// lowercase  
$result['City'] = strtolower($result['City']);  
// explode into array  
$city_array = explode(',', $result['City']);  
// city name is always first  
$city = $city_array[0];  
// if there is a second element then it's a state  
if (isset($city_array[1])) {  
$state = $city_array[1];  
}  
}  
 
// parse country line of response  
if ( isset( $result['Country'] ) && ! empty( $result['Country'] ) ) {  
//lowercase  
$result['Country'] = strtolower( $result['Country'] );  
// set country  
$country_parts = explode('(', trim( $result['Country'] ) );  
$country = $country_parts[0];  
// if there is a second element then it's a country code.  
if ( isset($country_parts[1] ) ) {  
$country_code = substr($country_code,0,-1);  
}  
// debug  
owa_coreAPI::debug('Parse of Hostip country string: '.$result['Country'].' c: '. $country.' cc: '.$country_code);  
 
}  
 
// set latitude  
if ( isset( $result['Latitude'] ) && ! empty( $result['Latitude'] ) ) {  
$latitude = $result['Latitude'];  
}  
// set longitude  
if ( isset( $result['Longitude'] ) && ! empty( $result['Longitude'] ) ) {  
$longitude = $result['Longitude'];  
}  
}  
 
// fail safe checks for empty, unknown or private adddress labels  
// check to make sure values are not "private address" contain "unknown" or "xx"  
if ( empty($city) || strpos( $city, 'private' ) || strpos( $city, 'unknown') ) {  
 
$city = '(not set)';  
}  
// check state  
if ( empty($state) || strpos( $state, 'private' ) || strpos( $state, 'unknown') ) {  
 
$state = '(not set)';  
}  
// check country  
if ( empty( $country )  
|| strpos( $country, 'unknown' )  
|| strpos( $country, 'private' )  
) {  
$country = '(not set)';  
}  
// check country code  
if ( empty( $country_code )  
|| strpos( $country_code, 'xx' )  
|| strpos( $country_code, 'unknown' )  
|| strpos( $country_code, 'private' )  
) {  
$country_code = '(not set)';  
}  
 
$location_map['city'] = strtolower(trim($city));  
$location_map['state'] = strtolower(trim($state));  
$location_map['country'] = strtolower(trim($country));  
$location_map['country_code'] = strtoupper(trim($country_code));  
$location_map['latitude'] = trim($latitude);  
$location_map['longitude'] = trim($longitude);  
 
// log headers if status is not a 200  
if ( isset( $crawler->response_code ) && ! strpos( $crawler->response_code, '200' ) ) {  
owa_coreAPI::debug(sprintf("HostIp web service response headers: %s", print_r($crawler->crawler->headers, true)));  
}  
}  
 
return $location_map;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'eventQueue.php');  
 
/**  
* http Event Queue  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_httpEventQueue extends owa_eventQueue {  
 
var $endpoint = '';  
 
function __construct($options = '') {  
// set the endpoint. move this to constructor  
if (array_key_exists('endpoint', $options)) {  
$this->endpoint = $options['endpoint'];  
} else {  
$this->endpoint = owa_coreAPI::getSetting('base', 'remote_event_queue_endpoint');  
}  
}  
 
function addToQueue($event) {  
 
if ($event) {  
$properties['owa_event'] = base64_encode(serialize($event));  
 
//$properties = array_map('urlencode', $properties);  
$properties = owa_lib::implode_assoc('=', '&', $properties);  
//print_r($properties);  
//return;  
} else {  
return;  
}  
 
$parts = parse_url($this->endpoint);  
 
$fp = fsockopen($parts['host'], isset($parts['port'])?$parts['port']:80, $errno, $errstr, 30);  
 
if (!$fp) {  
return false;  
} else {  
$out = "POST ".$parts['path']." HTTP/1.1\r\n";  
$out.= "Host: ".$parts['host']."\r\n";  
$out.= "Content-Type: application/x-www-form-urlencoded\r\n";  
$out.= "Content-Length: ".strlen($properties)."\r\n";  
$out.= "Connection: Close\r\n\r\n";  
$out.= $properties;  
owa_coreAPI::debug("out: $out");  
 
fwrite($fp, $out);  
fclose($fp);  
return true;  
}  
 
}  
 
function processQueue() {  
 
}  
 
}  
 
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_controller.php');  
 
/**  
* Abstract Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_installController extends owa_controller {  
 
var $is_installer = true;  
 
function __construct($params) {  
 
// needed just in case a re-install happens and updates are also needed.  
// tells the controller to skip the updates redirect  
if (!defined('OWA_INSTALLING')) {  
define('OWA_INSTALLING', true);  
}  
 
//$this->c->setSetting('base', 'cache_objects', false);  
 
return parent::__construct($params);  
}  
 
function pre() {  
 
if (owa_coreAPI::getSetting('base', 'install_complete')) {  
owa_coreAPI::debug('Install complete redirecting to base.installDetected');  
return $this->redirectBrowser('base.installDetected', false);  
}  
 
return;  
}  
 
function installSchema() {  
 
$service = &owa_coreAPI::serviceSingleton();  
$base = $service->getModule('base');  
$status = $base->install();  
return $status;  
 
}  
 
function createAdminUser($email_address, $real_name = '') {  
 
//create user entity  
$u = owa_coreAPI::entityFactory('base.user');  
// check to see if an admin user already exists  
$u->getByColumn('role', 'admin');  
$id_check = $u->get('id');  
// if not then proceed  
if (empty($id_check)) {  
 
//Check to see if user name already exists  
$u->getByColumn('user_id', 'admin');  
 
$id = $u->get('id');  
 
// Set user object Params  
if (empty($id)) {  
 
$password = $u->generateRandomPassword();  
$ret = $u->createNewUser('admin', 'admin', $password, $email_address, $real_name);  
owa_coreAPI::debug("Admin user created successfully.");  
return $password;  
 
} else {  
owa_coreAPI::debug($this->getMsg(3306));  
}  
} else {  
owa_coreAPI::debug("Admin user already exists.");  
}  
 
}  
 
function createDefaultSite($domain, $name = '', $description = '', $site_family = '', $site_id = '') {  
 
if (!$name) {  
$name = $domain;  
}  
 
$site = owa_coreAPI::entityFactory('base.site');  
 
if (!$site_id) {  
$site_id = $site->generateSiteId($domain);  
}  
 
 
// Check to see if default site already exists  
$this->e->notice('Checking for existence of default site.');  
 
// create site_id....how???  
$site->getByColumn('site_id', $site_id);  
$id = $site->get('id');  
 
if(empty($id)) {  
// Create default site  
$site->set('id', $site->generateId($site_id));  
$site->set('site_id', $site_id);  
$site->set('name', $name);  
$site->set('description', $description);  
$site->set('domain', $domain);  
$site->set('site_family', $site_family);  
$site_status = $site->create();  
 
if ($site_status == true) {  
$this->e->notice('Created default site.');  
} else {  
$this->e->notice('Creation of default site failed.');  
}  
 
} else {  
$this->e->notice(sprintf("Default site already exists (id = %s). nothing to do here.", $id));  
}  
 
return $site->get('site_id');  
}  
 
function checkDbConnection() {  
 
// Check DB connection status  
$db = &owa_coreAPI::dbSingleton();  
$db->connect();  
if ($db->connection_status === true) {  
return true;  
} else {  
return false;  
}  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_installManager extends owa_base {  
 
function __construct($params = '') {  
 
return parent::__construct($params);  
}  
 
function installSchema() {  
 
$service = &owa_coreAPI::serviceSingleton();  
$base = $service->getModule('base');  
$status = $base->install();  
return $status;  
 
}  
 
function createAdminUser($email_address, $real_name = '', $password = '') {  
 
//create user entity  
$u = owa_coreAPI::entityFactory('base.user');  
// check to see if an admin user already exists  
$u->getByColumn('role', 'admin');  
$id_check = $u->get('id');  
// if not then proceed  
if (empty($id_check)) {  
 
//Check to see if user name already exists  
$u->getByColumn('user_id', 'admin');  
 
$id = $u->get('id');  
 
// Set user object Params  
if (empty($id)) {  
 
if ( ! $password ) {  
 
$password = $u->generateRandomPassword();  
}  
 
$ret = $u->createNewUser('admin', 'admin', $password, $email_address, $real_name);  
owa_coreAPI::debug("Admin user created successfully.");  
return $password;  
 
} else {  
owa_coreAPI::debug($this->getMsg(3306));  
}  
} else {  
owa_coreAPI::debug("Admin user already exists.");  
}  
 
}  
 
function createDefaultSite($domain, $name = '', $description = '', $site_family = '', $site_id = '') {  
 
if (!$name) {  
$name = $domain;  
}  
 
$site = owa_coreAPI::entityFactory('base.site');  
 
if (!$site_id) {  
$site_id = $site->generateSiteId($domain);  
}  
 
 
// Check to see if default site already exists  
$this->e->notice('Checking for existence of default site.');  
 
// create site_id....how???  
$site->getByColumn('site_id', $site_id);  
$id = $site->get('id');  
 
if(empty($id)) {  
// Create default site  
$site->set('id', $site->generateId($site_id));  
$site->set('site_id', $site_id);  
$site->set('name', $name);  
$site->set('description', $description);  
$site->set('domain', $domain);  
$site->set('site_family', $site_family);  
$site_status = $site->create();  
 
if ($site_status == true) {  
$this->e->notice('Created default site.');  
} else {  
$this->e->notice('Creation of default site failed.');  
}  
 
} else {  
$this->e->notice(sprintf("Default site already exists (id = %s). nothing to do here.", $id));  
}  
 
return $site->get('site_id');  
}  
 
function checkDbConnection() {  
 
// Check DB connection status  
$db = &owa_coreAPI::dbSingleton();  
$db->connect();  
if ($db->connection_status === true) {  
return true;  
} else {  
return false;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_PHPMAILER_DIR.'class.phpmailer.php');  
 
/**  
* phpmailer wrapper class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_mailer extends owa_base {  
 
var $mailer;  
 
/**  
* Constructor  
*  
* @return owa_mailer  
*/  
function __construct() {  
 
parent::__construct();  
$this->mailer = new PHPMailer();  
 
if (!empty($this->config['mailer-from'])):  
$this->mailer->From = $this->config['mailer-from'];  
endif;  
 
if (!empty($this->config['mailer-fromName'])):  
$this->mailer->FromName = $this->config['mailer-fromName'];  
endif;  
 
if (!empty($this->config['mailer-host'])):  
$this->mailer->Host = $this->config['mailer-host'];  
endif;  
 
if (!empty($this->config['mailer-port'])):  
$this->mailer->Port = $this->config['mailer-port'];  
endif;  
 
if (!empty($this->config['mailer-smtpAuth'])):  
$this->mailer->SMTPAuth = $this->config['mailer-smtpAuth'];  
endif;  
 
if (!empty($this->config['mailer-username'])):  
$this->mailer->Username = $this->config['mailer-username'];  
endif;  
 
if (!empty($this->config['mailer-password'])):  
$this->mailer->Password = $this->config['mailer-password'];  
endif;  
 
return;  
 
}  
 
function sendMail() {  
 
if(!$this->mailer->Send()):  
 
return $this->e->debug(sprintf("Mailer Failure. Was not able to send to %s with subject of '%s'. Error Msgs: '%s'", $this->mailer->to, $this->mailer->Subject, $this->mailer->ErrorInfo));  
 
else:  
return $this->e->debug(sprintf("Mail sent to %s with the subject of '%s'.", $this->mailer->to[0], $this->mailer->Subject));  
endif;  
 
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cache.php');  
 
if ( ! class_exists( 'memcached' ) ) {  
require_once( OWA_INCLUDE_DIR . 'memcached-client.php' );  
}  
 
/**  
* Memcached Based Cache  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_memcachedCache extends owa_cache {  
 
var $mc;  
 
/**  
* Constructor  
*  
* Takes cache directory as param  
*  
* @param $cache_dir string  
*/  
function __construct() {  
 
$servers = owa_coreAPI::getSetting( 'base', 'memcachedServers' );  
if ( ! $servers ) {  
owa_coreAPI::notice('No memcached servers found in configuration settings.');  
return;  
}  
$persistant = owa_coreAPI::getSetting( 'base', 'memcachedPersisantConnections' );  
$error_mode = owa_coreAPI::getSetting( 'base', 'error_handler' );  
if ( $error_mode === 'development' ) {  
$debug = true;  
} else {  
$debug = false;  
}  
 
$this->mc = new owa_memcachedClient(array(  
'servers' => $servers,  
'debug' => $debug,  
'compress_threshold' => 10240,  
'persistant' => $persistant  
));  
 
return parent::__construct();  
}  
 
function makeKey($values) {  
$key = 'owa-';  
$key .= $this->cache_id . '-';  
$key .= implode('-', $values);  
return $key;  
}  
 
function getItemFromCacheStore($collection, $id) {  
$key = $this->makeKey( array( $collection, $id ) );  
$item = $this->mc->get( $key );  
 
if ($item) {  
$this->debug("$key retrieved from memcache.");  
return $item;  
} else {  
$this->debug("$key was not found in memcache.");  
}  
 
}  
 
function putItemToCacheStore($collection, $id) {  
 
$key = $this->makeKey( array( $collection, $id ) );  
$item = $this->cache[$collection][$id];  
$expiration = $this->getCollectionExpirationPeriod( $collection );  
$ret = $this->mc->replace( $key, $item, $expiration );  
 
if ( $ret ) {  
$this->debug( "$key successfully replaced in memcache." );  
return true;  
 
} else {  
$ret = $this->mc->add( $key, $item );  
if ( $ret ) {  
$this->debug( "$key successfully added to memcache." );  
return true;  
} else {  
$this->debug( "$key not added/replaced in memcache." );  
return false;  
}  
}  
}  
 
function removeItemFromCacheStore($collection, $id) {  
 
$key = $this->makeKey( array( $collection, $id ) );  
$item = $this->cache[$collection][$id];  
$ret = $this->mc->delete($key);  
 
if ($ret) {  
$this->debug( "$key successfully deleted from memcache." );  
} else {  
$this->debug( "$key not deleted from memcache.");  
}  
}  
 
function flush() {  
 
owa_coreAPI::notice("Cannot flush Memcache from client.");  
return true;  
}  
}  
 
class owa_memcachedClient extends memcached {  
 
function _debugprint( $text ) {  
owa_coreAPI::debug( "memcached: $text" );  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Pagination  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_paginatedResultSet {  
 
/**  
* Unique hash of result set used by front end  
* to see if there are any changes.  
*/  
var $guid;  
 
var $timePeriod;  
var $resultsPerPage = 25;  
var $resultsTotal;  
var $resultsReturned;  
var $resultsRows = array();  
var $sortColumn;  
var $sortOrder;  
 
/**  
* Aggregate values for metrics  
*/  
var $aggregates = array();  
 
var $rows;  
 
var $labels;  
 
var $more;  
var $page = 1;  
var $total_pages;  
 
/**  
* The API URL that produces the results  
*/  
var $self;  
 
/**  
* The API URL that produces the next page of results  
*/  
var $next;  
 
/**  
* The API URL that produces the previous page of results  
*/  
var $previous;  
 
/**  
* The base API URL that is used to construct client side pagination links.  
* Does not contain any 'page' params.  
*/  
var $base_url;  
 
var $results_count = 0;  
var $offset = 0;  
var $limit;  
var $query_limit;  
 
 
function __construct() {  
 
}  
 
function setLimit($limit) {  
 
$this->resultsPerPage = $limit;  
$this->limit = $limit;  
}  
 
function setPage($page) {  
 
$this->page = $page;  
}  
 
function setMorePages() {  
 
$this->more = true;  
}  
 
function calculateOffset() {  
 
$this->offset = $this->limit * ($this->page - 1);  
return $this->offset;  
}  
 
function countResults($results) {  
 
$this->resultsTotal = count($results);  
$this->results_count = count($results);  
 
if ($this->limit) {  
$this->total_pages = ceil(($this->results_count + $this->offset) / $this->limit);  
 
if ($this->results_count <= $this->limit) {  
// no more pages  
} else {  
// more pages  
$this->setMorePages();  
 
}  
}  
}  
 
function getRowCount() {  
 
return $this->results_count;  
}  
 
function generate($dao, $method = 'getAllRows') {  
 
if (!empty($this->limit)) {  
// query for more than we need  
$dao->limit($this->limit * 10);  
}  
 
if (!empty($this->page)) {  
 
$dao->offset($this->calculateOffset());  
} else {  
$this->page = 1;  
}  
 
$results = $dao->$method();  
if (!empty($results)) {  
$this->countResults($results);  
 
if ($this->resultsPerPage) {  
$this->rows = array_slice($results, 0, $this->limit);  
} else {  
$this->rows = $results;  
}  
 
$this->resultsReturned = count($this->rows);  
} else {  
$this->rows = array();  
}  
 
return $this->rows;  
}  
 
function getResultSetAsArray() {  
 
$set = array();  
 
$set['labels'] = $this->labels;  
$set['rows'] = $this->rows;  
$set['count'] = $this->results_count;  
$set['page'] = $this->page;  
$set['total_pages'] = $this->total_pages;  
$set['more'] = $this->more;  
$set['period'] = $this->getPeriodInfo();  
return $set;  
}  
 
function setLabels($labels) {  
 
$this->labels = $labels;  
}  
 
function displayPagination() {  
 
 
}  
 
function getPeriodInfo() {  
return $this->periodInfo;  
}  
 
function setPeriodInfo($info) {  
$this->timePeriod = $info;  
}  
 
function getLabel($key) {  
 
if (array_key_exists($key, $this->labels)) {  
return $this->labels[$key];  
}  
}  
 
function getAllLabels() {  
 
return $this->labels;  
}  
 
 
function formatResults($format) {  
 
$formats = array('html' => 'resultSetToHtml',  
'json' => 'resultSetToJson',  
'jsonp' => 'resultSetToJsonp',  
'xml' => 'resultSetToXml',  
'php' => 'resultSetToSerializedPhp',  
'csv' => 'resultSetToCsv',  
'debug' => 'resultSetToDebug');  
 
if (array_key_exists($format, $formats)) {  
 
return $this->$formats[$format]();  
} else {  
return 'That format is not supported';  
}  
 
}  
 
 
function resultSetToXml() {  
 
$t = new owa_template;  
 
$t->set_template('resultSetXml.php');  
$t->set('rs', $this);  
 
return $t->fetch();  
}  
 
function resultSetToJson() {  
return json_encode($this);  
}  
 
function resultSetToJsonp($callback = '') {  
 
// if not found look on the request scope.  
if ( ! $callback ) {  
$callback = owa_coreAPI::getRequestParam('jsonpCallback');  
}  
 
if ( ! $callback ) {  
 
return $this->resultSetToJson();  
}  
 
$t = new owa_template;  
$t->set_template('json.php');  
 
// set  
$body = sprintf("%s(%s);", $callback, json_encode( $this ) );  
 
$t->set('json', $body);  
return $t->fetch();  
}  
 
function resultSetToDebug() {  
 
return print_r($this, true);  
}  
 
function resultSetToSerializedPhp() {  
return serialize($this);  
}  
 
function resultSetToHtml($class = 'dimensionalResultSet') {  
$t = new owa_template;  
 
$t->set_template('resultSetHtml.php');  
$t->set('rs', $this);  
$t->set('class', $class);  
 
return $t->fetch();  
}  
 
function getDataRows() {  
return $this->resultsRows;  
}  
 
function addLinkToRowItem($item_name, $template, $subs) {  
 
 
foreach ($this->resultsRows as $k => $row) {  
 
$sub_array = array();  
 
foreach ($subs as $sub) {  
$sub_array[] = urlencode($this->resultsRows[$k][$sub]['value']);  
}  
 
$this->resultsRows[$k][$item_name]['link'] = vsprintf($template, $sub_array);  
}  
 
}  
 
function getSeries($name) {  
 
$rows = $this->getDataRows();  
 
if ($rows) {  
$series = array();  
foreach ($rows as $row) {  
foreach($row as $item) {  
if ($item['name'] === $name) {  
$series[] = $item['value'];  
}  
}  
}  
return $series;  
} else {  
return false;  
}  
}  
 
function getAggregateMetric($name) {  
 
if (array_key_exists($name, $this->aggregates)) {  
return $this->aggregates[$name]['value'];  
} else {  
owa_coreAPI::debug("No aggregate metric called $name found.");  
}  
}  
 
function setAggregateMetric($name, $value, $label, $data_type, $formatted_value = '') {  
 
$this->aggregates[$name] = array('result_type' => 'metric', 'name' => $name, 'value' => $value, 'label' => $label, 'data_type' => $data_type, 'formatted_value' => $formatted_value);  
}  
 
function appendRow($row_num, $type, $name, $value, $label, $data_type, $formatted_value = '') {  
 
$this->resultsRows[$row_num][$name] = array('result_type' => $type, 'name' => $name, 'value' => $value, 'label' => $label, 'data_type' => $data_type, 'formatted_value' => $formatted_value);  
}  
 
function removeMetric($name) {  
 
if (array_key_exists($name, $this->aggregates)) {  
 
unset($this->aggregates[$name]);  
}  
 
if ($this->getRowCount() > 0) {  
 
foreach ($this->resultsRows as $k => $row) {  
 
if (array_key_exists($name, $row)) {  
 
unset($this->resultsRows[$k][$name]);  
}  
}  
}  
}  
 
function createResultSetHash() {  
 
$this->guid = md5(serialize($this));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Pagination  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_pagination extends owa_base {  
 
var $page = 1;  
 
var $limit;  
 
var $offset = 0;  
 
var $total_count;  
 
function __construct() {  
 
return;  
 
}  
 
function setLimit($limit) {  
$this->limit = $limit;  
return;  
}  
 
function setPage($page) {  
$this->page = $page;  
return;  
}  
 
function setMorePages($bool) {  
 
$this->more_pages = $bool;  
return;  
 
}  
 
function calculateOffset() {  
 
$this->offset = $this->limit * ($this->page - 1);  
return $this->offset;  
}  
 
function getMaxPageNum() {  
 
if ($this->total_count > 0) {  
 
$c = $this->total_count / $this->limit;  
$c = ceil($c);  
} else {  
 
$c = 0;  
}  
 
return $c;  
}  
 
function getPagination() {  
 
$pagination = array();  
$pagination['limit'] = $this->limit;  
$pagination['page_num'] = $this->page;  
$pagination['offset'] = $this->offset;  
$pagination['max_page_num'] = $this->getMaxPageNum();  
$pagination['more_pages'] = $this->more_pages;  
$pagination['total_count'] = $this->total_count;  
$pagination['results_count'] = $this->results_count;  
$pagination['diff_count'] = $this->total_count - $this->results_count;  
return $pagination;  
}  
 
function countResults($results) {  
 
$this->results_count = count($results);  
 
if ($this->results_count < $this->limit):  
$this->more_pages = false;  
else:  
$this->more_pages = true;  
endif;  
 
return;  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'pagination.php');  
require_once(OWA_BASE_CLASS_DIR.'timePeriod.php');  
require_once(OWA_DIR.'owa_template.php');  
 
/**  
* Result Set Manager  
*  
* Responsible for creating a data result set from various metrics and dimensions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_resultSetManager extends owa_base {  
 
/**  
* The params of the caller, either a report or graph  
*  
* @var array  
*/  
var $params = array();  
 
/**  
* The lables for calculated measures  
*  
* @var array  
*/  
var $labels = array();  
 
/**  
* Data Access Object  
*  
* @var object  
*/  
var $db;  
 
/**  
* The dimensions to groupby  
*  
* @var array  
*/  
var $dimensions = array();  
 
/**  
* The Number of Dimensions to groupby  
*  
* @var integer  
*/  
var $dimensionCount;  
 
/**  
* The table/column or denormalized dimensions  
* associated with this metric  
*  
* @var array  
*/  
var $denormalizedDimensions = array();  
 
var $_default_offset = 0;  
var $page;  
var $limit;  
var $order;  
var $format;  
var $constraint_operators = array('==','!=','>=', '<=', '>', '<', '=~', '!~', '=@','!@');  
var $related_entities = array();  
var $related_dimensions = array();  
var $related_metrics = array();  
var $resultSet;  
var $base_table;  
var $metrics = array();  
var $metricsByTable = array();  
var $childMetrics = array();  
var $calculatedMetrics = array();  
var $query_params = array();  
var $baseEntity;  
var $metricObjectsByEntityMap = array();  
var $errors = array();  
var $formatters = array();  
 
function __construct($db = '') {  
 
if ($db) {  
$this->db = $db;  
} else {  
$this->db = owa_coreAPI::dbSingleton();  
}  
 
$this->formatters = array(  
//'yyyymmdd' => array($this, 'dateFormatter'),  
'timestamp' => array($this, 'formatSeconds'),  
'percentage' => array($this, 'formatPercentage'),  
'integer' => array($this, 'numberFormatter'),  
'currency' => array($this, 'formatCurrency')  
);  
 
return parent::__construct();  
}  
 
 
function setConstraint($name, $value, $operator = '') {  
 
if (empty($operator)) {  
$operator = '=';  
}  
 
if (!empty($value)) {  
$this->params['constraints'][] = array('operator' => $operator, 'value' => $value, 'name' => $name);  
}  
}  
 
function setConstraints($array) {  
 
if (is_array($array)) {  
 
if (is_array($this->params['constraints'])) {  
$this->params['constraints'] = array_merge($array, $this->params['constraints']);  
} else {  
$this->params['constraints'] = $array;  
}  
}  
}  
 
function constraintsStringToArray($string) {  
 
if ($string) {  
//print_r($string);  
// add string to query params array for use in URLs.  
$this->query_params['constraints'] = $string;  
 
$constraints = explode(',', $string);  
//print_r($constraints);  
$constraint_array = array();  
 
foreach($constraints as $constraint) {  
 
foreach ($this->constraint_operators as $operator) {  
 
if (strpos($constraint, $operator)) {  
list ($name, $value) = split($operator, $constraint);  
 
$constraint_array[] = array('name' => $name, 'value' => $value, 'operator' => $operator);  
 
 
break;  
}  
}  
}  
//print_r($constraint_array);  
return $constraint_array;  
}  
}  
 
function getConstraints() {  
 
return $this->params['constraints'];  
}  
 
function applyConstraints() {  
 
$nconstraints = array();  
 
foreach ($this->getConstraints() as $k => $constraint) {  
 
$dim = $this->lookupDimension($constraint['name'], $this->baseEntity);  
 
//$dimEntity = owa_coreAPI::entityFactory($dim['entity']);  
 
 
$col = $dim['column'];  
$constraint['name'] = $col;  
$nconstraints[$col] = $constraint;  
$this->db->multiWhere($nconstraints);  
//print_r($nconstraints);  
 
}  
 
}  
 
 
function chooseBaseEntity() {  
 
$metric_imps = array();  
 
// load metric implementations  
foreach ($this->metrics as $metric_name) {  
 
$metric_imps = array_merge($this->getMetricEntities($metric_name), $metric_imps);  
 
 
}  
//print_r($metric_imps);  
owa_coreAPI::debug('pre-reduce set of entities to choose from: '.print_r($metric_imps, true));  
 
$entities = array();  
// reduce entities  
foreach ($metric_imps as $mimp) {  
 
if (empty($entities)) {  
$entities = $mimp;  
}  
 
$entities = $this->reduceTables($mimp, $entities);  
 
if (empty($entities)) {  
return $this->addError('illegal metric combination');  
}  
}  
 
owa_coreAPI::debug('post-reduce set of entities to choose from: '.print_r($entities, true));  
 
// check summary level of entities  
$niceness = array();  
 
foreach ($entities as $entity) {  
 
$niceness[$entity] = owa_coreAPI::entityFactory($entity)->getSummaryLevel();  
}  
//sort by summary level  
arsort($niceness);  
 
owa_coreAPI::debug('Entities summary levels: '.print_r($niceness, true));  
 
$entity_count = count($niceness);  
$i = 1;  
//check entities for dimension relations  
foreach ($niceness as $entity_name => $summary_level) {  
 
$error = false;  
 
//cycle through each dimension frm dim list and those found in constraints.  
$dims = array_unique(array_merge($this->dimensions, $this->getDimensionsFromConstraints()));  
 
owa_coreAPI::debug(sprintf('Dimensions: %s',print_r($this->dimensions, true)));  
 
owa_coreAPI::debug(sprintf('Checking the following dimensions for relation to %s: %s',$entity_name, print_r($dims, true)));  
 
foreach ($dims as $dimension) {  
 
$check = $this->isDimensionRelated($dimension, $entity_name);  
 
// is the realtionship check fails then move onto the next entity.  
if (!$check) {  
$error = true;  
owa_coreAPI::debug("$dimension is not related to $entity_name. Moving on to next entity...");  
break;  
} else {  
owa_coreAPI::debug("Dimension: $dimension is related to $entity_name.");  
}  
}  
 
// is no error then everythig is related and we are good to go.  
if (!$error) {  
owa_coreAPI::debug('optimal base entity is: '.$entity_name);  
$this->baseEntity = owa_coreAPI::entityFactory($entity_name);  
return $this->baseEntity;  
}  
 
if ($i === $entity_count) {  
$this->addError('illegal dimension combination: '.$dimension);  
} else {  
$i++;  
}  
}  
}  
 
function getDimensionsFromConstraints() {  
 
$dims = array();  
 
$constraints = $this->getConstraints();  
//print_r($constraints);  
if (!empty($constraints)) {  
 
foreach ($constraints as $carray) {  
 
$dims[] = $carray['name'];  
}  
}  
 
return $dims;  
}  
 
function isDimensionRelated($dimension_name, $entity_name) {  
 
$entity = owa_coreAPI::entityFactory($entity_name);  
 
$dimension = $this->lookupDimension($dimension_name, $entity);  
 
if ($dimension['denormalized'] === true) {  
$this->related_dimensions[$dimension['name']] = $dimension;  
owa_coreAPI::debug("Dimension: $dimension_name is denormalized into $entity_name");  
return true;  
} else {  
 
$fk = $this->getDimensionForeignKey($dimension, $entity);  
 
if ($fk) {  
owa_coreAPI::debug("Dimension: $dimension_name is related to $entity_name");  
$this->related_dimensions[$dimension['name']] = $dimension;  
return true;  
} else {  
owa_coreAPI::debug("Could not find a foreign key for $dimension_name in $entity_name");  
}  
}  
}  
 
function getMetricEntities($metric_name) {  
 
//get the class implementations  
$s = owa_coreAPI::serviceSingleton();  
$classes = $s->getMetricClasses($metric_name);  
 
$entities = array();  
 
// cycles through metric classes and get their entity names  
foreach ($classes as $name => $map) {  
$m = owa_coreAPI::metricFactory($map['class'], $map['params']);  
 
// check to see if this is a calculated metric  
if ($m->isCalculated()) {  
 
foreach ($m->getChildMetrics() as $cmetric_name) {  
$this->addCalculatedMetric($m);  
$entities = array_merge($this->getMetricEntities($cmetric_name), $entities);  
}  
 
} else {  
$this->metricObjectsByEntityMap[$m->getEntityName()][$metric_name] = $m;  
$entities[$metric_name][] = $m->getEntityName();  
}  
 
}  
 
return $entities;  
}  
 
function reduceTables($new, $old) {  
 
return array_intersect($new, $old);  
}  
 
function getDimensionForeignKey($dimension, $entity) {  
 
if ($dimension) {  
//$entity = ;  
$dim = $dimension;  
$fk = array();  
// check for foreign key column by name if dimension specifies one  
if (array_key_exists('foreign_key_name', $dim) && !empty($dim['foreign_key_name'])) {  
// get foreign key col by  
if ($entity->isForeignKeyColumn($dim['foreign_key_name'])){  
$fk = array('col' => $dim['foreign_key_name'], 'entity' => $entity);  
}  
 
} else {  
// if not check for foreign key by entity name  
//check to see if the metric's entity has a foreign key to the dimenesion table.  
$fk = array();  
 
$fkcol = $entity->getForeignKeyColumn($dim['entity']);  
owa_coreAPI::debug("Foreign Key check: ". print_r($fkcol, true));  
if ($fkcol) {  
$fk['col'] = $fkcol;  
$fk['entity'] = $entity;  
}  
}  
 
return $fk;  
}  
}  
 
function lookupDimension($name, $entity) {  
 
// check dimensions  
if (array_key_exists($name, $this->related_dimensions)) {  
//return $this->related_dimensions[$name];  
}  
//print_r($this->metrics[0]);  
// check for denormalized  
 
$service = owa_coreAPI::serviceSingleton();  
$dim = $service->getDenormalizedDimension($name, $entity->getName());  
 
if ($dim) {  
//apply table aliasing to dimension column  
$dim['column'] = $entity->getTableAlias().'.'.$dim['column'];  
} else {  
 
// check for normalized dim  
if (array_key_exists($name, $this->related_dimensions)) {  
$dim = $this->related_dimensions[$name];  
} else {  
 
$dim = $service->getDimension($name);  
 
if ($dim) {  
$dimEntity = owa_coreAPI::entityFactory($dim['entity']);  
// alias needs to use fk name in case there are two joins on the  
// same table. This is also used in addRelation method  
$alias = $dimEntity->getTableAlias().'_via_'.$dim['foreign_key_name'];  
//$dim['column'] = $dimEntity->getTableAlias().'.'.$dim['column'];  
$dim['column'] = $alias.'.'.$dim['column'];  
} else {  
$msg = "$name is not a registered dimension.";  
owa_coreAPI::debug($msg);  
$this->addError($msg);  
}  
 
}  
}  
 
return $dim;  
}  
 
function setLimit($value) {  
 
if (!empty($value)) {  
 
$this->limit = $value;  
}  
}  
 
function setOrder($value) {  
 
if (!empty($value)) {  
$this->params['order'] = $value;  
}  
}  
 
function getOrder() {  
 
if (array_key_exists('order', $this->params)) {  
return $this->params['order'];  
}  
}  
 
function setSort($column, $order) {  
 
//$this->params['orderby'][] = array($this->getColumnName($column), $order);  
}  
 
function setSorts($array) {  
 
if (is_array($array)) {  
 
if (!empty($this->params['orderby'])) {  
$this->params['orderby'] = array_merge($array, $this->params['orderby']);  
 
} else {  
$this->params['orderby'] = $array;  
}  
}  
}  
 
function sortStringToArray($string) {  
 
if ($string) {  
 
// add string to query params array for use in URLs.  
$this->query_params['sort'] = $string;  
 
$sorts = explode(',', $string);  
 
$sort_array = array();  
 
foreach ($sorts as $sort) {  
 
if (strpos($sort, '-')) {  
$column = substr($sort, 0, -1);  
$order = 'DESC';  
} else {  
$column = $sort;  
$order = 'ASC';  
}  
 
//$col_name = $this->getColumnName($column);  
$check = $this->isSortValid($column);  
 
if ($check) {  
 
$col_name = $column;  
 
if ($col_name) {  
$sort_array[$sort][0] = $col_name;  
$sort_array[$sort][1] = $order;  
 
} else {  
$this->addError("$column is not a valid column to sort on");  
}  
}  
}  
 
return $sort_array;  
}  
}  
 
function isSortValid($needle) {  
 
$haystack = array_merge($this->metrics, $this->dimensions);  
return in_array($needle, $haystack);  
}  
 
function setPage($value) {  
 
if (!empty($value)) {  
 
$this->page = $value;  
 
if (!empty($this->pagination)) {  
$this->pagination->setPage($value);  
}  
}  
}  
 
function setOffset($value) {  
 
if (!empty($value)) {  
$this->params['offset'] = $value;  
}  
}  
 
function setFormat($value) {  
if (!empty($value)) {  
$this->format;  
$this->params['result_format'] = $value;  
}  
}  
 
function setPeriod($value) {  
if (!empty($value)) {  
$this->params['period'] = $value;  
}  
}  
 
function setTimePeriod($period_name = '', $startDate = null, $endDate = null, $startTime = null, $endTime = null) {  
 
$map = false;  
 
if ($startDate && $endDate) {  
$period_name = 'date_range';  
$map = array('startDate' => $startDate, 'endDate' => $endDate);  
$dimension_name = 'date';  
$format = 'yyyymmdd';  
} elseif ($startTime && $endTime) {  
$period_name = 'time_range';  
$map = array('startTime' => $startTime, 'endTime' => $endTime);  
$dimension_name = 'timestamp';  
$format = 'timestamp';  
} else {  
owa_coreAPI::debug('no start/end params passed to owa_metric::setTimePeriod');  
$dimension_name = 'date';  
$format = 'yyyymmdd';  
}  
 
// add to query params array for use in URL construction  
if ($map) {  
$this->query_params = array_merge($map, $this->query_params);  
} else {  
$this->query_params['period'] = $period_name;  
}  
 
$p = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
 
$p->set($period_name, $map);  
 
$this->setPeriod($p);  
 
$start = $p->startDate->get($format);  
$end = $p->endDate->get($format);  
 
$this->setConstraint($dimension_name, array('start' => $start, 'end' => $end), 'BETWEEN');  
 
 
}  
 
function setStartDate($date) {  
 
if (!empty($date)) {  
$this->params['startDate'] = $date;  
}  
}  
 
function setEndDate($date) {  
if (!empty($date)) {  
$this->params['endDate'] = $date;  
}  
}  
 
function applyMetaDataToResults($results) {  
 
$new_rows = array();  
 
foreach ($results as $row) {  
 
$new_rows[] = $this->applyMetaDataToSingleResultRow($row);  
}  
 
return $new_rows;  
}  
 
function applyMetaDataToSingleResultRow($row) {  
 
$new_row = array();  
 
foreach ($row as $k => $v) {  
 
if (in_array($k, $this->dimensions)) {  
$type = 'dimension';  
$dim = $this->lookupDimension($k, $this->baseEntity);  
$data_type = $dim['data_type'];  
} elseif (in_array($k, $this->metrics)){  
$type = 'metric';  
$data_type = $this->getMetric($k)->getDataType();  
}  
 
 
 
$new_row[$k] = array(  
'result_type' => $type,  
'name' => $k,  
'value' => $v,  
'formatted_value' => $this->formatValue($data_type, $v),  
'label' => $this->getLabel($k), 'data_type' => $data_type);  
}  
 
return $new_row;  
}  
 
function formatValue($type, $value) {  
 
if (array_key_exists($type, $this->formatters)) {  
 
$formatter = $this->formatters[$type];  
 
if (!empty($formatter)) {  
 
$value = call_user_func($formatter, $value);  
}  
}  
 
 
return $value;  
}  
 
function numberFormatter($value) {  
 
return number_format($value);  
}  
 
function formatSeconds($value) {  
 
return date("G:i:s",mktime(0,0,($value)));  
}  
 
function formatPercentage($value) {  
 
return number_format($value * 100, 2).'%';  
}  
 
function formatCurrency($value) {  
 
return owa_lib::formatCurrency( $value, owa_coreAPI::getSetting( 'base', 'currencyLocal' ) );  
}  
 
/**  
* Sets an individual label  
* return the key so that it can be nested  
* @return $key string  
*/  
function addLabel($key, $label) {  
 
$this->labels[$key] = $label;  
return $key;  
}  
 
function getLabel($key = '') {  
 
if (array_key_exists($key, $this->labels)) {  
return $this->labels[$key];  
} else {  
//owa_coreAPI::debug("No label found for $key.");  
}  
 
}  
 
/**  
* Retrieve the labels of the measures  
*  
*/  
function getLabels() {  
 
return $this->labels;  
}  
 
/**  
* Sets an individual label  
* return the key so that it can be nested  
* @return $key string  
*/  
function setLabel($label) {  
 
$this->labels[$this->getName()] = $label;  
}  
 
/**  
* Set the labels of the measures  
*  
*/  
function setLabels($array) {  
 
$this->labels = $array;  
}  
 
function getPeriod() {  
 
return $this->params['period'];  
}  
 
function getLimit() {  
 
return $this->limit;  
}  
 
/**  
* Adds a dimension to the dimension map  
*  
* Retrieves dimension info from service layer and checks to see if  
* dimension is denromalized or if it is a valid relation  
*/  
function setDimension($name) {  
 
if ($name) {  
$this->dimensions[] = $name;  
}  
}  
 
function setDimensions($array) {  
 
if ($array) {  
 
foreach($array as $name) {  
 
$this->setDimension($name);  
}  
}  
}  
 
function dimensionsStringToArray($string) {  
 
// add string to query params array for use in URLs.  
$this->query_params['dimensions'] = $string;  
return explode(',', $string);  
}  
 
function metricsStringToArray($string) {  
 
// add string to query params array for use in URLs.  
$this->query_params['metrics'] = $string;  
return explode(',', $string);  
}  
 
 
function dimensionsArrayToString($array) {  
 
return implode(',', $array);  
}  
 
/**  
* Applies dimensional sql to dao object  
*/  
function applyDimensions() {  
 
foreach ($this->dimensions as $dimension_name) {  
$dim = $this->lookupDimension($dimension_name, $this->baseEntity);  
// add column name to select statement  
$this->db->selectColumn($dim['column'], $dim['name']);  
// add groupby  
$this->db->groupBy($dim['column']);  
$this->addLabel($dim['name'], $dim['label']);  
}  
}  
 
function applyJoins() {  
 
foreach($this->related_dimensions as $dim) {  
$this->addRelation($dim);  
}  
}  
 
function addRelation($dim) {  
 
// if denomalized, skip  
if ($dim['denormalized'] === true) {  
return;  
}  
 
// have already determined base enttiy at this point so use that.  
$fk = $this->getDimensionForeignKey($dim, $this->baseEntity);  
//print_r($fk);  
//print $fk;  
if ($fk) {  
 
// create dimension entity  
$dimEntity = owa_coreAPI::entityFactory($dim['entity']);  
// get foreign key column  
//$bm = $this->getBaseMetric();  
//$fpk_col = $bm->entity->getProperty($fk);  
$fpk_col = $fk['entity']->getProperty($fk['col']);  
//$fpk_col = $this->baseEntity->getProperty($fk['col']);  
 
//print_r($fk['col']);  
$fpk = $fpk_col->getForeignKey();  
// add join  
//print_r($fpk);  
// needed to make joins unique in cases where there are  
// two joins onthe same table using different foreign keys.  
$alias = $dimEntity->getTableAlias().'_via_'.$dim['foreign_key_name'];  
//$this->db->join(OWA_SQL_JOIN, $dimEntity->getTableName(), $dimEntity->getTableAlias(), $fk['entity']->getTableAlias().'.'.$fk['col'], $dimEntity->getTableAlias().'.'.$fpk[1]);  
$this->db->join(OWA_SQL_JOIN, $dimEntity->getTableName(), $alias, $fk['entity']->getTableAlias().'.'.$fk['col'], $alias.'.'.$fpk[1]);  
 
//$this->addColumn($dim['name'], $dimEntity->getTableAlias().'.'.$dim['column']);  
$this->addColumn($dim['name'], $alias.'.'.$dim['column']);  
 
} else {  
// add error result set  
owa_coreAPI::debug(sprintf('%s metric does not have relation to dimension %s', $fk['entity']->getName(), $dim['name']));  
}  
 
}  
 
// remove  
function addMetric($metric_name, $child = false) {  
 
$ret = false;  
 
$m = $this->getMetric($metric_name);  
 
if (!$m) {  
$m = owa_coreAPI::metricFactory($metric_name);  
 
if ($m) {  
 
 
// necessary if the metric was first added as a child but later added as a parent.  
if (!$child) {  
 
if (array_key_exists($metric_name, $this->childMetrics)) {  
unset ($this->childMetrics[$metric_name]);  
}  
} else {  
// add child metrics to child metric maps  
// check to see if it wasn't already added as a non-child metric.  
if (!array_key_exists($metric_name, $this->metrics)){  
$this->childMetrics[$metric_name] = $metric_name;  
}  
}  
 
// check to see if this is a calculated metric  
if ($m->isCalculated()) {  
 
return $this->addCalculatedMetric($m);  
}  
 
if ($this->checkForFactTableRelation($m)) {  
 
$this->metrics[$metric_name] = $m;  
$this->metricsByTable[$m->getTableName()] = $metric_name;  
$this->addSelect($m->getSelect());  
$this->addLabel($m->getName(), $m->getLabel());  
 
$ret = true;  
}  
 
} else {  
$this->addError("$metric_name is not a metric.");  
}  
} else {  
$ret = true;  
}  
 
 
 
return $ret;  
}  
 
function addCalculatedMetric($calc_metric_obj) {  
 
// add label of calculated metric obj  
$this->addLabel($calc_metric_obj->getName(),$calc_metric_obj->getLabel());  
// add to calculated metric map  
$this->calculatedMetrics[$calc_metric_obj->getName()] = $calc_metric_obj;  
 
}  
 
function getCalculatedMetricByName($name) {  
 
return $this->calculatedMetrics[$name];  
}  
 
function addSelect($select_array) {  
 
$this->params['selects'][] = $select_array;  
}  
 
function getSelects() {  
 
if (array_key_exists('selects', $this->params)) {  
return $this->params['selects'];  
}  
}  
 
function applySelects() {  
//print_r($this->metrics);  
foreach($this->metrics as $k => $metric_name) {  
 
if (!array_key_exists($metric_name, $this->calculatedMetrics)) {  
 
$m = $this->metricObjectsByEntityMap[$this->baseEntity->getName()][$metric_name];  
 
$select = $m->getSelect();  
//print_r ($select);  
$this->db->selectColumn($select[0], $select[1]);  
} else {  
$m = $this->getCalculatedMetricByName($metric_name);  
}  
 
$this->addLabel($m->getName(), $m->getLabel());  
}  
 
// add selects for calculated metrics  
if (!empty($this->calculatedMetrics)) {  
 
// loop through calculated metric objects  
foreach ($this->calculatedMetrics as $cmetric) {  
//create child metrics  
foreach( $cmetric->getChildMetrics() as $child_name) {  
// check to see if the metric has already been added  
if (!in_array($child_name, $this->metrics)) {  
 
$child = $this->metricObjectsByEntityMap[$this->baseEntity->getName()][$child_name];  
$select = $child->getSelect();  
//print_r ($select[0]);  
$this->db->selectColumn($select[0], $select[1]);  
// needed so we can remove this temp metric later  
$this->childMetrics[] = $child_name;  
owa_coreAPI::debug("Added $child_name to ChildMetrics array");  
}  
}  
}  
}  
}  
 
function getFormat() {  
 
if (array_key_exists('result_format', $this->params)) {  
return $this->params['result_format'];  
}  
}  
 
function getColumnName($string) {  
 
//$string = trim($string);  
if (array_key_exists($string, $this->related_dimensions)) {  
return $this->related_dimensions[$string]['column'];  
}  
 
if (array_key_exists($string, $this->related_metrics)) {  
return $string;  
}  
 
 
//return $string;  
 
}  
 
/**  
* Sets a metric's column name into the all_columns map  
*  
* this is needed when combining metrics so that sort and  
* constraint column names can be looked up fro ma single map.  
*/  
function addColumn($name, $col) {  
 
$this->all_columns[$name] = $col;  
}  
 
function addError($msg) {  
 
$this->errors[] = $msg;  
owa_coreAPI::debug($msg);  
}  
 
/**  
* Generates a result set for the metric  
*  
*/  
function getResults() {  
 
// get paginated result set object  
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
 
$bm = $this->chooseBaseEntity();  
 
if ($bm) {  
 
$bname = $bm->getName();  
 
owa_coreAPI::debug("Using $bname as base entity for making result set.");  
 
// set constraints  
$this->applyJoins();  
$this->applyConstraints();  
$this->applySelects();  
 
$this->db->selectFrom($bm->getTableName(), $bm->getTableAlias());  
// generate aggregate results  
$results = $this->db->getOneRow();  
// merge into result set  
if ($results) {  
$rs->aggregates = array_merge($this->applyMetaDataToSingleResultRow($results), $rs->aggregates);  
}  
 
// setup dimensional query  
if (!empty($this->dimensions)) {  
$this->applyJoins();  
// apply dimensional SQL  
$this->applyDimensions();  
 
$this->applySelects();  
 
$this->db->selectFrom($bm->getTableName(), $bm->getTableAlias());  
 
// pass limit to db object if one exists  
if (!empty($this->limit)) {  
$rs->setLimit($this->limit);  
}  
// pass limit to db object if one exists  
if (!empty($this->page)) {  
$rs->setPage($this->page);  
}  
 
$this->applyConstraints();  
 
if (array_key_exists('orderby', $this->params)) {  
$sorts = $this->params['orderby'];  
// apply sort by  
if ($sorts) {  
foreach ($sorts as $sort) {  
$this->db->orderBy($sort[0], $sort[1]);  
$rs->sortColumn = $sort[0];  
if (isset($sort[1])){  
$rs->sortOrder = strtolower($sort[1]);  
} else {  
$rs->sortOrder = 'asc';  
}  
}  
}  
}  
 
// add labels  
$rs->setLabels($this->getLabels());  
 
// generate dimensonal results  
$results = $rs->generate($this->db);  
 
$rs->resultsRows = $this->applyMetaDataToResults($results);  
}  
 
// add labels  
$rs->setLabels($this->getLabels());  
 
// add period info  
 
$rs->setPeriodInfo($this->params['period']->getAllInfo());  
 
$rs = $this->computeCalculatedMetrics($rs);  
 
// add urls  
$urls = $this->makeResultSetUrls();  
$rs->self = $urls['self'];  
 
if ($rs->more) {  
 
$rs->next = $urls['next'];  
}  
 
if ($this->page >=2) {  
$rs->previous = $urls['previous'];  
}  
 
$rs->createResultSetHash();  
}  
 
$rs->errors = $this->errors;  
 
return $rs;  
}  
 
function computeCalculatedMetrics($rs) {  
 
foreach ($this->calculatedMetrics as $cm) {  
 
// add aggregate metric  
$formula = $cm->getFormula();  
$div_by_zero = false;  
 
foreach ($cm->getChildMetrics() as $metric_name) {  
 
$ag_value = $rs->getAggregateMetric($metric_name);  
 
if (empty($ag_value) || $ag_value == 0) {  
$ag_value = 0;  
$div_by_zero = true;  
}  
 
$formula = str_replace($metric_name, $ag_value, $formula);  
}  
 
if ( ! $div_by_zero ) {  
$value = $this->evalFormula($formula);  
} else {  
$value = 0;  
}  
 
$rs->setAggregateMetric($cm->getName(), $value, $cm->getLabel(), $cm->getDataType(), $this->formatValue($cm->getDataType(), $value));  
 
// add dimensional metric  
 
if ($rs->getRowCount() > 0) {  
 
foreach ($rs->resultsRows as $k => $row) {  
 
// add aggregate metric  
$formula = $cm->getFormula();  
$row_div_by_zero = false;  
foreach ($cm->getChildMetrics() as $metric_name) {  
 
if (array_key_exists($metric_name, $row)) {  
$row_value = $row[$metric_name]['value'];  
} else {  
$row_value = '';  
}  
if (empty($row_value) || $row_value == 0) {  
$row_value = 0;  
$row_div_by_zero = true;  
}  
 
$formula = str_replace($metric_name, $row_value, $formula);  
 
}  
 
if ( ! $row_div_by_zero ) {  
$value = $this->evalFormula($formula);  
} else {  
$value = 0;  
}  
 
$rs->appendRow($k, 'metric', $cm->getName(), $value, $cm->getLabel(), $cm->getDataType(), $this->formatValue($cm->getDataType(), $value));  
}  
}  
 
foreach ($this->childMetrics as $metric_name) {  
 
$rs->removeMetric($metric_name);  
}  
 
}  
 
return $rs;  
}  
 
function evalFormula($formula) {  
 
//safety first. should only be computing numbers.  
$formula = str_replace('$','', $formula);  
 
// need parens and @ to handle divsion by zero errors  
$formula = '$value = ('.$formula.');';  
//print $formula;  
// calc  
@ eval($formula);  
 
if (!$value) {  
$value = 0;  
}  
 
return $value;  
}  
 
function getMetric($name) {  
 
if (in_array($name, $this->metrics)) {  
return $this->metricObjectsByEntityMap[$this->baseEntity->getName()][$name];  
}  
}  
 
function setQueryStringParam($name, $string) {  
 
$this->query_params[$name] = $string;  
}  
 
function makeResultSetUrls() {  
 
$urls = array();  
// get api url  
$api_url = owa_coreAPI::getSetting('base', 'api_url');  
// get base query params  
$query_params = $this->query_params;  
// add api command  
$query_params['do'] = 'getResultSet';  
//add format  
if ($this->format) {  
$query_params['format'] = $this->format;  
} else {  
$query_params['format'] = 'json';  
}  
// add current page if any  
if ($this->page) {  
$query_params['page'] = $this->page;  
}  
// add limit  
if ($this->limit) {  
$query_params['resultsPerPage'] = $this->limit;  
}  
 
// build url for this result set  
$link_template = owa_coreAPI::getSetting('base', 'link_template');  
$q = $this->buildQueryString($query_params);  
$urls['self'] = sprintf($link_template, $api_url, $q);  
 
// build url for next page of result set  
$next_query_params = $query_params;  
if ($this->page) {  
$next_query_params['page'] = $query_params['page'] + 1;  
} else {  
$next_query_params['page'] = 2;  
}  
 
$nq = $this->buildQueryString($next_query_params);  
$urls['next'] = sprintf($link_template, $api_url, $nq);  
 
// build previous url if page is greater than 2  
if ($this->page >= 2) {  
$previous_query_params = $query_params;  
$previous_query_params['page'] = $query_params['page'] - 1;  
$pq = $this->buildQueryString($previous_query_params);  
$urls['previous'] = sprintf($link_template, $api_url, $pq);  
}  
 
$base_query_params = $this->query_params;  
$base_query_params['format'] = $this->format;  
 
// build pagination url template for use in constructing  
$q = $this->buildQueryString($base_query_params);  
$url['base_url'] = sprintf($link_template, $api_url, $q);  
 
return $urls;  
}  
 
function buildQueryString($params, $seperator = '&') {  
 
$new = array();  
//get namespace  
$ns = owa_coreAPI::getSetting('base', 'ns');  
foreach ($params as $k => $v) {  
 
$new[$ns.$k] = $v;  
}  
 
return http_build_query($new,'', $seperator);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006-2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Sanitize Class  
*  
* Responsible sanitizing input and escaping output  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_sanitize {  
 
/**  
* Remove Non alpha or numeric characters  
*  
* @param string|array $input String or array contain input to sanitize.  
* @param array $exceptions An array of additional characters that should be allowed.  
* @return string|array $sanitzed A Santized string or array  
*/  
public static function removeNonAlphaNumeric($input, $exceptions = array()) {  
 
$allow = '';  
 
// add exceptions to allowed char part of regex  
if ( !empty( $exceptions ) ) {  
foreach ( $exceptions as $value ) {  
$allowed_chars .= "\\$value";  
}  
}  
 
$regex = "/[^{$allowed_chars}a-zA-Z0-9]/";  
 
// check to see if string is an array  
if ( is_array ( $input ) ) {  
$sanitized = array();  
foreach ( $input as $key => $item ) {  
$sanitized[$key] = preg_replace( $regex, '', $item );  
}  
// assume input is a singel string  
} else {  
$sanitized = preg_replace( $regex, '', $input );  
}  
 
return $sanitized;  
}  
 
/**  
* Escapes a string for use in display output  
*  
* @param string $string The string to be escaped  
* @param string $encoding The charset to use in encoding.  
* @param string $quotes The php constant for encodig quotations used by htmlentities  
* @return string html encoded string  
* @link http://www.php.net/manual/en/function.htmlentities.php  
* @access public  
*/  
public static function escapeForDisplay($string, $encoding = 'UTF-8', $quotes = '') {  
 
if (!$quotes) {  
//use mode to ocnvert both single and double quotes.  
$quotes = ENT_QUOTES;  
}  
 
return htmlentities($string, $quotes, $encoding);  
}  
 
 
/**  
* Strip Whitespace  
*  
* @param string $str String to strip  
* @return string whitespace sanitized input  
* @access public  
*/  
public static function stripWhitespace( $input ) {  
 
$output = preg_replace( '/[\n\r\t]+/', '', $input );  
return preg_replace( '/\s{2,}/', ' ', $output );  
}  
 
/**  
* Strip IMG html tags  
*  
* @param string $input String to sanitize  
* @return string String with no img tags  
* @access public  
*/  
public static function stripImages( $input ) {  
 
$output = preg_replace('/(<a[^>]*>)(<img[^>]+alt=")([^"]*)("[^>]*>)(<\/a>)/i', '$1$3$5<br />', $input);  
$output = preg_replace('/(<img[^>]+alt=")([^"]*)("[^>]*>)/i', '$2<br />', $output);  
$output = preg_replace('/<img[^>]*>/i', '', $output);  
return $output;  
}  
 
/**  
* Strip Scripts and Stylesheets  
*  
* @param string $input String to sanitize  
* @return string String with <script>, <style>, <link> elements removed.  
* @access public  
* @static  
*/  
public static function stripScriptsAndCss( $input ) {  
 
return preg_replace(  
'/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/is',  
'',  
$input );  
}  
 
/**  
* Strip whitespace, images, scripts and stylesheets  
*  
* @param string $input String to sanitize  
* @return string sanitized string  
* @access public  
*/  
public static function stripAllTags( $input = '' ) {  
 
//$output = owa_sanitize::stripWhitespace( $input );  
$output = owa_sanitize::stripScriptsAndCss( $input );  
$output = owa_sanitize::stripImages( $output );  
$output = owa_sanitize::stripHtml( $output );  
 
return $output;  
}  
 
/**  
* Strips specified html tags  
*  
* @param string $input String to sanitize  
* @param array $tags Tag to remove  
* @return string sanitized String  
* @access public  
* @static  
*/  
public static function stripHtml( $input = '', $tags = array() ) {  
 
if ($tags) {  
foreach ( $tags as $tag ) {  
$output = preg_replace( '/<' . $tag . '\b[^>]*>/i', '', $input );  
$output = preg_replace( '/<\/' . $tag . '[^>]*>/i', '', $output );  
}  
} else {  
$output = strip_tags($input);  
}  
 
return $output;  
}  
 
public static function removeHiddenSpaces( $input = '' ) {  
 
return str_replace( chr( 0xCA ), '', str_replace( ' ', ' ', $input ) );  
}  
 
public static function escapeUnicode( $input = '' ) {  
 
return preg_replace( "/&amp;#([0-9]+);/s", "&#\\1;", $input );  
}  
 
public static function escapeBackslash( $input = '' ) {  
 
return preg_replace( "/\\\(?!&amp;#|\?#)/", "\\", $input );  
}  
 
public static function stirpCarriageReturns( $input = '' ) {  
 
return str_replace( "\r", "", $input );  
}  
 
public static function escapeDollarSigns( $input = '' ) {  
 
return str_replace( "\\\$", "$", $input );  
}  
 
public static function escapeOctets ( $input = '' ) {  
 
$match = array();  
$found = false;  
while ( preg_match('/%[a-f0-9]{2}/i', $input, $match) ) {  
$input = str_replace($match[0], '', $input);  
$found = true;  
}  
 
if ( $found ) {  
// Strip out the whitespace that may now exist after removing the octets.  
$filtered_input = trim( preg_replace( '/ +/', ' ', $input ) );  
}  
}  
 
/**  
* Sanitizes for safe input. Takes an array of options:  
*  
* - hidden_spaces - removes any non space whitespace characters  
* - escape_html - Encode any html entities. Encode must be true for the `remove_html` to work.  
* - dollar - Escape `$` with `\$`  
* - carriage - Remove `\r`  
* - unicode  
* - backslash -  
* - remove_html - Strip HTML with strip_tags. `encode` must be true for this option to work.  
*  
* @param mixed $data Data to sanitize  
* @param array $options  
* @return mixed Sanitized data  
* @access public  
* @static  
*/  
function cleanInput($input, $options = array()) {  
 
if (empty($input)) {  
return;  
}  
 
$options = array_merge(  
array(  
'hidden_spaces' => true,  
'remove_html' => false,  
'encode' => true,  
'dollar' => true,  
'carriage' => true,  
'unicode' => true,  
'escape_html' => true,  
'backslash' => true),  
$options);  
 
if (is_array($input)) {  
 
$output = array();  
foreach ($input as $k => $v) {  
$output[$k] = owa_sanitize::cleanInput($v, $options);  
}  
return $output;  
 
} else {  
 
if ($options['hidden_spaces']) {  
$output = owa_sanitize::removeHiddenSpaces($input);  
}  
 
if ($options['remove_html']) {  
$output = owa_sanitize::stripAllTags($output);  
}  
 
if ($options['dollar']) {  
$output = owa_sanitize::escapeDollarSigns($output);  
}  
 
if ($options['carriage']) {  
$output = owa_sanitize::stripCarriageReturns($output);  
}  
 
if ($options['unicode']) {  
$output = owa_sanitize::escapeUnicode($output);  
}  
 
if ($options['escape_html']) {  
$output = owa_sanitize::escapeForDisplay($output);  
}  
 
if ($options['backslash']) {  
$output = owa_sanitize::escapeBackslash($output);  
}  
 
return $output;  
}  
}  
 
public static function cleanFilename( $str ) {  
 
$str = str_replace("http://", "", $str);  
$str = str_replace("/", "", $str);  
$str = str_replace("\\", "", $str);  
$str = str_replace("../", "", $str);  
$str = str_replace("..", "", $str);  
$str = str_replace("?", "", $str);  
$str = str_replace("%00", "", $str);  
 
if (strpos($str, '%00')) {  
$str = '';  
}  
 
if (strpos($str, null)) {  
$str = '';  
}  
 
return $str;  
}  
 
public static function cleanUrl( $url ) {  
 
return;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'geolocation.php');  
 
/**  
* Service Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_service extends owa_base {  
 
var $init = false;  
var $request;  
var $state;  
var $current_user;  
var $settings;  
var $maps = array();  
var $update_required = false;  
var $install_required = false;  
var $modules_needing_updates = array();  
var $modules = array();  
var $entities = array();  
var $metrics = array();  
var $dimensions = array();  
var $denormalizedDimensions = array();  
var $browscap;  
var $geolocation;  
 
function __construct() {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
 
}  
 
function __destruct() {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
}  
 
function initializeFramework() {  
 
if (!$this->isInit()) {  
$this->_loadModules();  
$this->_loadEntities();  
$this->_loadMetrics();  
$this->_loadDimensions();  
$this->_loadApiMethods();  
$this->_loadEventProcessors();  
$this->setInit();  
 
// setup request container  
$this->request = owa_coreAPI::requestContainerSingleton();  
// setup current user  
$this->current_user = owa_coreAPI::supportClassFactory('base', 'serviceUser');  
$this->current_user->setRole('everyone');  
// the 'log_users' config directive relies on this being populated  
$this->current_user->setUserData('user_id', $this->request->state->get('u'));  
 
// load geolocation obj.  
$this->geolocation = owa_geolocation::getInstance();  
}  
 
}  
 
function setBrowscap($b) {  
 
$this->browscap = $b;  
}  
 
function getBrowscap() {  
 
if (empty($this->browscap)) {  
$this->browscap = owa_coreAPI::supportClassFactory('base', 'browscap', $this->request->getServerParam('HTTP_USER_AGENT'));  
}  
 
return $this->browscap;  
}  
 
function _loadModules() {  
 
$am = owa_coreAPI::getActiveModules();  
 
foreach ($am as $k => $v) {  
 
$m = owa_coreAPI::moduleClassFactory($v);  
 
$this->addModule($m);  
 
// check for schema updates  
$check = $m->isSchemaCurrent();  
 
if ($check != true) {  
$this->markModuleAsNeedingUpdate($m->name);  
}  
}  
 
// set schema update flag  
if (!empty($this->modules_needing_updates)) {  
$this->setUpdateRequired();  
}  
 
return;  
}  
 
 
function _loadEntities() {  
 
foreach ($this->modules as $k => $module) {  
 
foreach ($module->entities as $entity_k => $entity_v) {  
// TODO: remove this to make API stateless  
//$this->entities[] = $module->name.$entity_v;  
// proper call  
$this->addEntity($entity_v, $module->name.'.'.$entity_v);  
}  
}  
 
return;  
}  
 
function _loadMetrics() {  
 
foreach ($this->modules as $k => $module) {  
 
if (is_array($module->metrics)) {  
 
$this->metrics = array_merge_recursive( $this->metrics, $module->metrics);  
}  
}  
}  
 
function loadCliCommands() {  
 
$command_map = array();  
 
foreach ($this->modules as $k => $module) {  
 
if (is_array($module->cli_commands)) {  
$command_map = array_merge($command_map, $module->cli_commands);  
}  
}  
 
$this->setMap('cli_commands', $command_map);  
}  
 
function _loadApiMethods() {  
 
$method_map = array();  
 
foreach ($this->modules as $k => $module) {  
 
if (is_array($module->api_methods)) {  
$method_map = array_merge($method_map, $module->api_methods);  
}  
}  
 
$this->setMap('api_methods', $method_map);  
}  
 
function _loadDimensions() {  
 
foreach ($this->modules as $k => $module) {  
 
if (is_array($module->dimensions)) {  
$this->dimensions = array_merge($this->dimensions, $module->dimensions);  
}  
 
if (is_array($module->denormalizedDimensions)) {  
 
$this->denormalizedDimensions = array_merge_recursive($this->denormalizedDimensions, $module->denormalizedDimensions);  
}  
 
//print_r($this->denormalizedDimensions);  
}  
}  
 
function _loadEventProcessors() {  
 
$processors = array();  
 
foreach ($this->modules as $k => $module) {  
 
$processors = array_merge($processors, $module->event_processors);  
}  
 
$this->setMap('event_processors', $processors);  
 
}  
 
function &getCurrentUser() {  
 
return $this->current_user;  
}  
 
function getRequest() {  
 
return $this->request;  
}  
 
function getState() {  
 
return $this->request->state;  
}  
 
function getMapValue($map_name, $name) {  
 
if (array_key_exists($map_name, $this->maps)) {  
 
if (array_key_exists($name, $this->maps[$map_name])) {  
 
return $this->maps[$map_name][$name];  
} else {  
 
return false;  
}  
} else {  
 
return false;  
}  
}  
 
function getMap($name) {  
 
if (array_key_exists($name, $this->maps)) {  
 
return $this->maps[$name];  
}  
 
}  
 
function setMap($name, $map) {  
 
$this->maps[$name] = $map;  
return;  
}  
 
function setMapValue($map_name, $name, $value) {  
 
$this->maps[$map_name][$name] = $value;  
}  
 
function setUpdateRequired() {  
 
$this->update_required = true;  
return;  
}  
 
function isUpdateRequired() {  
 
return $this->update_required;  
}  
 
function addModule($module) {  
 
$this->modules[$module->name] = $module;  
}  
 
function markModuleAsNeedingUpdate($name) {  
 
$this->modules_needing_updates[] = $name;  
}  
 
function getModulesNeedingUpdates() {  
 
return $this->modules_needing_updates;  
}  
 
 
function setInstallRequired() {  
$this->install_required = true;  
}  
 
function isInstallRequired() {  
 
return $this->install_required;  
}  
 
function addEntity($entity_name, $class) {  
 
$this->entities[$entity_name] = $class;  
}  
 
function setInit() {  
$this->init = true;  
}  
 
function isInit() {  
 
return $this->init;  
}  
 
function getModule($name) {  
 
if (array_key_exists($name, $this->modules)) {  
return $this->modules[$name];  
} else {  
return false;  
}  
 
}  
 
function getAllModules() {  
return $this->modules;  
}  
 
function getMetricClasses($name) {  
 
if (array_key_exists($name, $this->metrics)) {  
 
return $this->metrics[$name];  
}  
}  
 
function getDimension($name) {  
 
if (array_key_exists($name, $this->dimensions)) {  
return $this->dimensions[$name];  
}  
}  
 
function getDenormalizedDimension($name, $entity) {  
 
//print_r($this->denormalizedDimensions);  
if (array_key_exists($name, $this->denormalizedDimensions)) {  
if (array_key_exists($entity, $this->denormalizedDimensions[$name])) {  
return $this->denormalizedDimensions[$name][$entity];  
}  
}  
}  
 
function getCliCommandClass($command) {  
 
return $this->getMapValue('cli_commands', $command);  
}  
 
function setCliCommandClass($command, $class) {  
 
$this->setMapValue('cli_commands', $command, $class);  
}  
 
function getApiMethodClass($method_name) {  
 
return $this->getMapValue('api_methods', $method_name);  
}  
 
function setApiMethodClass($method_name, $class) {  
 
$this->setMapValue('api_methods', $method_name, $class);  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Service User Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_serviceUser extends owa_base {  
 
var $user;  
var $capabilities = array();  
var $preferences = array();  
var $is_authenticated;  
 
function __construct() {  
 
//parent::__construct();  
$this->user = owa_coreApi::entityFactory('base.user');  
}  
 
function load($user_id) {  
 
$this->user->load($user_id, 'user_id');  
$this->loadRelatedUserData();  
return;  
}  
 
function loadRelatedUserData() {  
 
$this->capabilities = $this->getCapabilities($this->user->get('role'));  
$this->preferences = $this->getPreferences($this->user->get('user_id'));  
return;  
}  
 
function getCapabilities($role) {  
 
$caps = owa_coreAPI::getSetting('base', 'capabilities');  
 
if (array_key_exists($role, $caps)) {  
return $caps[$role];  
} else {  
return array();  
}  
 
}  
 
function getPreferences($user_id) {  
 
return false;  
}  
 
function getRole() {  
 
return $this->user->get('role');  
}  
 
function setRole($value) {  
 
$this->user->set('role', $value);  
$this->capabilities = $this->getCapabilities($value);  
 
}  
 
function setUserData($name, $value) {  
 
$this->user->set($name, $value);  
return;  
}  
 
function getUserData($name) {  
 
return $this->user->get($name);  
}  
 
function isCapable($cap) {  
//owa_coreAPI::debug(print_r($this->user->getProperties(), true));  
owa_coreAPI::debug("cap ".$cap);  
// just in case there is no cap passed  
if (!empty($cap)) {  
//adding @ here as is_array throws warning that an empty array is not the right data type!  
if (in_array($cap, $this->capabilities)) {  
return true;  
} else {  
return false;  
}  
 
} else {  
 
return true;  
}  
 
}  
 
// mark the user as authenticated and populate their capabilities  
function setAuthStatus($bool) {  
 
$this->is_authenticated = true;  
 
return;  
}  
 
function isAuthenticated() {  
 
return $this->is_authenticated;  
}  
 
function loadNewUserByObject($obj) {  
$this->user = $obj;  
//$this->current_user->loadNewUserByObject($obj);  
$this->loadRelatedUserData();  
return;  
}  
 
function loadNewUserById($id) {  
 
// get a user object  
// load it  
// $this->loadNewUserByObject($obj);  
return;  
 
}  
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Settings Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_settings {  
 
/**  
* Configuration Entity  
*  
* @var object configuration entity  
*/  
var $config;  
 
var $default_config;  
 
var $db_settings = array();  
 
var $fetched_from_db;  
 
var $is_dirty;  
 
var $config_id;  
 
var $config_from_db;  
 
/**  
* Constructor  
*  
* @param string id the id of the configuration array to load  
*/  
function __construct() {  
 
// create configuration object  
$this->config = owa_coreAPI::entityFactory('base.configuration');  
// load the default settings  
$this->getDefaultConfig();  
// include/load config file  
$this->loadConfigFile();  
// apply config constants  
$this->applyConfigConstants();  
// setup directory paths  
$this->setupPaths();  
 
// set default timezone if not set already. Needed to avoid an E_WARNING.  
if (!ini_get('date.timezone')) {  
 
if (function_exists('date_default_timezone_set')) {  
date_default_timezone_set($this->get('base', 'timezone'));  
}  
}  
// Todo: must remove config object dependancy from all classes generated by $this->load  
// before we can uncomment this and remove it from owa_caller constructor or else there  
// is a race condition.  
 
//if ($this->isConfigFilePresent()) {  
// $this->load($this->get('base', 'configuration_id'));  
//}  
 
// include storage engine class so that DTD constants get loaded  
owa_coreAPI::setupStorageEngine($this->get('base','db_type'));  
 
}  
 
function isConfigFilePresent() {  
 
$file = OWA_DIR.'owa-config.php';  
$oldfile = OWA_BASE_DIR.'/conf/owa-config.php';  
 
if (file_exists($file)) {  
return true;  
} elseif (file_exists($oldfile)) {  
return true;  
} else {  
return false;  
}  
}  
 
function loadConfigFile() {  
 
/* LOAD CONFIG FILE */  
$file = OWA_DIR.'owa-config.php';  
$oldfile = OWA_BASE_DIR.'/conf/owa-config.php';  
 
if (file_exists($file)) {  
include_once($file);  
$config_file_exists = true;  
} elseif (file_exists($oldfile)) {  
include_once($oldfile);  
$config_file_exists = true;  
} else {  
$config_file_exists = false;  
}  
}  
 
function applyConfigConstants() {  
 
if(!defined('OWA_DATA_DIR')){  
define('OWA_DATA_DIR', OWA_DIR.'owa-data/');  
 
}  
 
if (defined('OWA_DATA_DIR')) {  
$this->set('base', 'data_dir', OWA_DATA_DIR);  
}  
 
if(!defined('OWA_CACHE_DIR')){  
define('OWA_CACHE_DIR', OWA_DATA_DIR.'caches/');  
}  
 
if (defined('OWA_CACHE_DIR')) {  
$this->set('base', 'cache_dir', OWA_CACHE_DIR);  
}  
 
// Looks for log level constant  
if (defined('OWA_ERROR_LOG_LEVEL')) {  
$this->set('base', 'error_log_level', OWA_ERROR_LOG_LEVEL);  
}  
 
/* CONFIGURATION ID */  
 
if (defined('OWA_CONFIGURATION_ID')) {  
$this->set('base', 'configuration_id', OWA_CONFIGURATION_ID);  
}  
 
/* OBJECT CACHING */  
 
// Looks for object cache config constant  
// must comebefore user db values are fetched from db  
if (defined('OWA_CACHE_OBJECTS')) {  
$this->set('base', 'cache_objects', OWA_CACHE_OBJECTS);  
}  
 
/* DATABASE CONFIGURATION */  
 
// This needs to come before the fetch of user overrides from the DB  
// Constants defined in the config file have the final word  
// values passed from calling application must be applied prior  
// to the rest of the caller's overrides  
 
if (defined('OWA_DB_TYPE')) {  
$this->set('base', 'db_type', OWA_DB_TYPE);  
}  
 
if (defined('OWA_DB_NAME')) {  
$this->set('base', 'db_name', OWA_DB_NAME);  
}  
 
if (defined('OWA_DB_HOST')) {  
$this->set('base', 'db_host', OWA_DB_HOST);  
}  
 
if (defined('OWA_DB_USER')) {  
$this->set('base', 'db_user', OWA_DB_USER);  
}  
 
if (defined('OWA_DB_PASSWORD')) {  
$this->set('base', 'db_password', OWA_DB_PASSWORD);  
}  
 
/* SET ERROR HANDLER */  
if (defined('OWA_ERROR_HANDLER')) {  
$this->set('base', 'error_handler', OWA_ERROR_HANDLER);  
}  
 
if (defined('OWA_CONFIG_DO_NOT_FETCH_FROM_DB')) {  
$this->set('base', 'do_not_fetch_config_from_db', OWA_CONFIG_DO_NOT_FETCH_FROM_DB);  
}  
 
if (defined('OWA_PUBLIC_URL')) {  
$this->set('base', 'public_url', OWA_PUBLIC_URL);  
}  
 
if (defined('OWA_PUBLIC_PATH')) {  
$this->set('base', 'public_path', OWA_PUBLIC_PATH);  
}  
 
if (defined('OWA_QUEUE_EVENTS')) {  
$this->set('base', 'queue_events', OWA_QUEUE_EVENTS);  
}  
 
if (defined('OWA_EVENT_QUEUE_TYPE')) {  
$this->set('base', 'event_queue_type', OWA_EVENT_QUEUE_TYPE);  
}  
 
if (defined('OWA_EVENT_SECONDARY_QUEUE_TYPE')) {  
$this->set('base', 'event_secondary_queue_type', OWA_EVENT_SECONDARY_QUEUE_TYPE);  
}  
 
if (defined('OWA_USE_REMOTE_EVENT_QUEUE')) {  
$this->set('base', 'use_remote_event_queue', OWA_USE_REMOTE_EVENT_QUEUE);  
}  
 
if (defined('OWA_REMOTE_EVENT_QUEUE_TYPE')) {  
$this->set('base', 'remote_event_queue_type', OWA_REMOTE_EVENT_QUEUE_TYPE);  
}  
 
if (defined('OWA_REMOTE_EVENT_QUEUE_ENDPOINT')) {  
$this->set('base', 'remote_event_queue_endpoint', OWA_REMOTE_EVENT_QUEUE_ENDPOINT);  
}  
 
}  
 
function applyModuleOverrides($module, $config) {  
 
// merge default config with overrides  
 
if (!empty($config)) {  
 
$in_place_config = $this->config->get('settings');  
 
$old_array = $in_place_config[$module];  
 
$new_array = array_merge($old_array, $config);  
 
$in_place_config[$module] = $new_array;  
 
$this->config->set('settings', $in_place_config);  
 
//print_r($this->config->get('settings'));  
 
}  
}  
 
/**  
* Loads configuration from data store  
*  
* @param string id the id of the configuration array to load  
*/  
function load($id = 1) {  
 
$this->config_id = $id;  
 
$db_config = owa_coreAPI::entityFactory('base.configuration');  
$db_config->getByPk('id', $id);  
$db_settings = unserialize($db_config->get('settings'));  
 
//print $db_settings;  
// store copy of config for use with updates and set a flag  
if (!empty($db_settings)):  
 
// needed to get rid of legacy setting that used to be stored in the DB.  
if (array_key_exists('error_handler', $db_settings['base'])) {  
unset($db_settings['base']['error_handler']);  
}  
 
$this->db_settings = $db_settings;  
$this->config_from_db = true;  
endif;  
 
if (!empty($db_settings)):  
//print_r($db_settings);  
//$db_settings = unserialize($db_settings);  
 
$default = $this->config->get('settings');  
 
// merge default config with overrides fetched from data store  
 
$new_config = array();  
 
foreach ($db_settings as $k => $v) {  
 
if (isset($default[$k]) && is_array($default[$k])):  
$new_config[$k] = array_merge($default[$k], $db_settings[$k]);  
else:  
$new_config[$k] = $db_settings[$k];  
endif;  
}  
 
$this->config->set('settings', $new_config);  
 
 
endif;  
 
$db_id = $db_config->get('id');  
$this->config->set('id', $db_id);  
 
return;  
 
}  
 
/**  
* Fetches a modules entire configuration array  
*  
* @param string $module The name of module whose configuration values you want to fetch  
* @return array Config values  
*/  
function fetch($module = '') {  
$v = $this->config->get('settings');  
 
if (!empty($module)):  
 
return $v[$module];  
else:  
return $v['base'];  
endif;  
}  
 
/**  
* updates or creates configuration values  
*  
* @return boolean  
*/  
function save() {  
 
// serialize array of values prior to update  
 
$config = owa_coreAPI::entityFactory('base.configuration');  
 
// if fetch from db flag is not true, try to fetch the config just in  
// case if was cached or something wen wrong.  
// Then merge the new values into it.  
if ($this->config_from_db != true):  
 
$config->getByPk('id', $this->get('base', 'configuration_id'));  
 
$settings = $config->get('settings');  
 
if (!empty($settings)):  
 
$settings = unserialize($settings);  
 
$new_config = array();  
 
foreach ($this->db_settings as $k => $v) {  
 
if (!is_array($settings[$k])):  
$settings[$k] = array();  
endif;  
 
$new_config[$k] = array_merge($settings[$k], $this->db_settings[$k]);  
 
}  
 
$config->set('settings', serialize($new_config));  
 
//$config->set('settings', serialize(array_merge($settings, $this->db_settings)));  
else:  
$config->set('settings', serialize($this->db_settings));  
endif;  
 
// test to see if object exists  
$id = $config->get('id');  
 
// if it does just update  
if (!empty($id)):  
$status = $config->update();  
 
// else create the object  
else:  
$config->set('id', $this->get('base', 'configuration_id'));  
$status = $config->create();  
endif;  
 
// update the config  
else:  
$config->set('settings', serialize($this->db_settings));  
$config->set('id', $this->get('base', 'configuration_id'));  
$status = $config->update();  
endif;  
 
$this->is_dirty = false;  
 
return $status;  
 
}  
 
/**  
* Accessor Method  
*  
* @param string $module the name of the module  
* @param string $key the configuration key  
* @return unknown  
*/  
function get($module, $key) {  
 
$values = $this->config->get('settings');  
 
if ( isset( $values[$module] ) && array_key_exists($key, $values[$module])) {  
return $values[$module][$key];  
} else {  
return false;  
}  
 
}  
 
/**  
* Sets configuration value. will not be persisted.  
*  
* @param string $module the name of the module  
* @param string $key the configuration key  
* @param string $value the configuration value  
* @return boolean  
*/  
function set($module, $key, $value) {  
 
$values = $this->config->get('settings');  
 
$values[$module][$key] = $value;  
 
$this->config->set('settings', $values);  
}  
 
 
/**  
* Adds Setting value to be configuration and persistant data store  
*  
* @param string $module the name of the module  
* @param string $key the configuration key  
* @param string $value the configuration value  
* @depricated  
*/  
function setSetting($module, $key, $value) {  
 
return $this->set($module, $key, $value);  
 
}  
 
/**  
* Adds Setting value to be configuration and persistant data store  
*  
* @param string $module the name of the module  
* @param string $key the configuration key  
* @param string $value the configuration value  
* @return  
*/  
function persistSetting($module, $key, $value) {  
 
$this->set($module, $key, $value);  
$this->db_settings[$module][$key] = $value;  
$this->is_dirty = true;  
}  
 
function defaultSetting($module, $key) {  
$defaults = $this->getDefaultSettingsArray();  
 
if ( array_key_exists($module, $defaults) && array_key_exists($key, $defaults[$module]) ) {  
$this->set($module, $key, $defaults[$module][$key]);  
 
if ( array_key_exists($module, $this->db_settings) && array_key_exists($key, $this->db_settings[$module]) ) {  
unset($this->db_settings[$module][$key]);  
$this->is_dirty = true;  
}  
}  
}  
 
 
 
/**  
* Adds Setting value to be configuration but DOES NOT add to persistant data store  
*  
* @param string $module the name of the module  
* @param string $key the configuration key  
* @param string $value the configuration value  
* @return  
*/  
function setSettingTemporary($module, $key, $value) {  
 
$this->set($module, $key, $value);  
 
return;  
 
}  
 
/**  
* Replaces all values of a particular module's configuration  
* @todo: search to see where else this is used. If unused then make it for use in persist only.  
*/  
function replace($module, $values, $persist = false) {  
 
if ($persist) {  
$this->db_settings[$module] = $values;  
return;  
}  
 
$settings = $this->config->get('settings');  
 
$settings[$module] = $values;  
 
$this->config->set('settings', $settings);  
}  
 
/**  
* Alternate Constructor for base module settings  
* Needed for backwards compatability with older classes  
*  
*/  
function &get_settings($id = 1) {  
 
 
static $config2;  
 
if (!isset($config2)):  
//print 'hello from alt constructor';  
$config2 = &owa_coreAPI::configSingleton();  
endif;  
 
return $config2->fetch('base');  
 
}  
 
function getDefaultConfig() {  
 
$config = $this->getDefaultSettingsArray();  
// set default values  
$this->config->set('settings', $config);  
}  
 
function getDefaultSettingsArray() {  
 
return array(  
'base' => array(  
'ns' => 'owa_',  
'visitor_param' => 'v',  
'session_param' => 's',  
'site_session_param' => 'ss',  
'last_request_param' => 'last_req',  
'first_hit_param' => 'first_hit',  
'feed_subscription_param' => 'sid',  
'source_param' => 'source',  
'graph_param' => 'graph',  
'period_param' => 'period',  
'document_param' => 'document',  
'referer_param' => 'referer',  
'site_id' => '',  
'configuration_id' => '1',  
'session_length' => 1800,  
'requests_table' => 'request',  
'sessions_table' => 'session',  
'referers_table' => 'referer',  
'ua_table' => 'ua',  
'os_table' => 'os',  
'documents_table' => 'document',  
'sites_table' => 'site',  
'hosts_table' => 'host',  
'config_table' => 'configuration',  
'version_table' => 'version',  
'feed_requests_table' => 'feed_request',  
'visitors_table' => 'visitor',  
'impressions_table' => 'impression',  
'clicks_table' => 'click',  
'exits_table' => 'exit',  
'users_table' => 'user',  
'db_type' => '',  
'db_name' => '',  
'db_host' => '',  
'db_user' => '',  
'db_password' => '',  
'db_force_new_connections' => true,  
'db_make_persistant_connections' => false,  
'resolve_hosts' => true,  
'log_feedreaders' => true,  
'log_robots' => false,  
'log_sessions' => true,  
'log_dom_clicks' => true,  
'delay_first_hit' => false,  
'async_db' => false,  
'clean_query_string' => true,  
'fetch_refering_page_info' => true,  
'query_string_filters' => '', // move to site settings  
'async_log_dir' => '', //OWA_DATA_DIR . 'logs/',  
'async_log_file' => 'events.txt',  
'async_lock_file' => 'owa.lock',  
'async_error_log_file' => 'events_error.txt',  
'notice_email' => '',  
'log_php_errors' => false,  
'error_handler' => 'production',  
'error_log_level' => 0,  
'error_log_file' => '', //OWA_DATA_DIR . 'logs/errors.txt',  
'browscap.ini' => OWA_BASE_DIR . '/modules/base/data/php_browscap.ini',  
'search_engines.ini' => OWA_BASE_DIR . '/conf/search_engines.ini',  
'query_strings.ini' => OWA_BASE_DIR . '/conf/query_strings.ini',  
'db_class_dir' => OWA_BASE_DIR . '/plugins/db/',  
'templates_dir' => OWA_BASE_DIR . '/templates/',  
'plugin_dir' => OWA_BASE_DIR . '/plugins/',  
'module_dir' => OWA_BASE_DIR . '/modules',  
'public_path' => '',  
'geolocation_lookup' => true,  
'geolocation_service' => 'hostip',  
'report_wrapper' => 'wrapper_default.tpl',  
'do_not_fetch_config_from_db' => false,  
'announce_visitors' => false,  
'public_url' => '',  
'base_url' => '',  
'action_url' => '',  
'images_url' => '',  
'reporting_url' => '',  
'p3p_policy' => 'NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM',  
'graph_link_template' => '%s?owa_action=graph&name=%s&%s', //action_url?...  
'link_template' => '%s?%s', // main_url?key=value....  
'owa_user_agent' => 'Open Web Analytics Bot '.OWA_VERSION,  
'fetch_owa_news' => true,  
'owa_rss_url' => 'http://www.openwebanalytics.com/?feed=rss2',  
'use_summary_tables' => false,  
'summary_framework' => '',  
'click_drawing_mode' => 'center_on_page', // remove  
'log_clicks' => true,  
'log_dom_streams' => true,  
'timezone' => 'America/Los_Angeles',  
'log_dom_stream_percentage' => 50,  
'owa_wiki_link_template' => 'http://wiki.openwebanalytics.com/index.php?title=%s',  
'wiki_url' => 'http://wiki.openwebanalytics.com',  
'password_length' => 4,  
'modules' => array('base'),  
'mailer-from' => '',  
'mailer-fromName' => 'OWA Mailer',  
'mailer-host' => '',  
'mailer-port' => '',  
'mailer-smtpAuth' => '',  
'mailer-username' => '',  
'mailer-password' => '',  
'queue_events' => false,  
'event_queue_type' => '',  
'event_secondary_queue_type' => '',  
'use_remote_event_queue' => true,  
'remote_event_queue_type' => 'http',  
'remote_event_queue_endpoint' => '',  
'cookie_domain' => false,  
'ws_timeout' => 10,  
'is_active' => true,  
'per_site_visitors' => false, // remove  
'cache_objects' => true,  
'log_named_users' => true,  
'log_visitor_pii' => true,  
'do_not_log_ips' => '', // move to site settings  
'track_feed_links' => true,  
'theme' => '',  
'reserved_words' => array('do' => 'action'),  
'login_view' => 'base.login',  
'not_capable_view' => 'base.error',  
'start_page' => 'base.reportDashboard',  
'default_action' => 'base.loginForm',  
'default_page' => '', // move to site settings  
'default_cache_expiration_period' => 604800,  
'nonce_expiration_period' => 43200,  
'max_prior_campaigns' => 5,  
'campaign_params' => array(  
'cn' => 'campaign',  
'md' => 'medium',  
'sr' => 'source',  
'tr' => 'search_terms',  
'ad' => 'ad',  
'at' => 'ad_type'),  
'trafficAttributionMode' => 'direct',  
'campaignAttributionWindow' => 60,  
'capabilities' => array(  
'admin' => array(  
'view_reports',  
'edit_settings',  
'edit_sites',  
'edit_users',  
'edit_modules'  
),  
'analyst' => array('view_reports'),  
'viewer' => array('view_reports'),  
'everyone' => array()  
),  
'numGoals' => 15,  
'numGoalGroups' => 5,  
'enableEcommerceReporting' => false, // move to site settings  
'currencyLocal' => 'en_US', // move to site settings  
'memcachedServers' => array(),  
'memcachedPersisantConnections' => true,  
'cacheType' => 'file',  
'disabledEndpoints' => array(),  
'disableAllEndpoints' => false,  
'processQueuesJobSchedule' => '10 * * * *'  
 
)  
);  
 
}  
 
function setupPaths() {  
 
//build base url  
$base_url = '';  
$proto = "http";  
 
if(isset($_SERVER['HTTPS'])) {  
$proto .= 's';  
}  
if(isset($_SERVER['SERVER_NAME'])) {  
$base_url .= $proto.'://'.$_SERVER['SERVER_NAME'];  
}  
 
if(isset($_SERVER['SERVER_PORT'])) {  
if($_SERVER['SERVER_PORT'] != 80) {  
$base_url .= ':'.$_SERVER['SERVER_PORT'];  
}  
}  
// there is some plugin use case where this is needed i think. if not get rid of it.  
if (!defined('OWA_PUBLIC_URL')) {  
define('OWA_PUBLIC_URL', '');  
}  
 
// set base url  
$this->set('base', 'base_url', $base_url);  
 
//set public path if not defined in config file  
$public_path = $this->get('base', 'public_path');  
 
if (empty($public_path)) {  
$public_path = OWA_PATH.'/public/';  
$this->set('base','public_path', $public_path);  
}  
 
// set various paths  
$public_url = $this->get('base', 'public_url');  
$main_url = $public_url.'index.php';  
$this->set('base','main_url', $main_url);  
$this->set('base','main_absolute_url', $main_url);  
$modules_url = $public_url.'modules/';  
$this->set('base','modules_url', $modules_url);  
$this->set('base','action_url',$public_url.'action.php');  
$this->set('base','images_url', $modules_url);  
$this->set('base','images_absolute_url',$modules_url);  
$this->set('base','log_url',$public_url.'log.php');  
$this->set('base','api_url',$public_url.'api.php');  
 
$this->set('base', 'error_log_file', OWA_DATA_DIR . 'logs/errors_'. owa_coreAPI::generateInstanceSpecificHash() .'.txt');  
$this->set('base', 'async_log_dir', OWA_DATA_DIR . 'logs/');  
 
owa_coreAPI::debug('check for http host');  
// Set cookie domain  
if (!empty($_SERVER['HTTP_HOST'])) {  
 
$this->setCookieDomain();  
}  
}  
 
function createConfigFile($config_values) {  
 
if (file_exists(OWA_DIR.'owa-config.php')) {  
owa_coreAPI::error("Your config file already exists. If you need to change your configuration, edit that file at: ".OWA_DIR.'owa-config.php');  
require_once(OWA_DIR . 'owa-config.php');  
return true;  
}  
 
if (!file_exists(OWA_DIR.'owa-config-dist.php')) {  
owa_coreAPI::error("We can't find the configuration file template. Are you sure you installed OWA's files correctly? Exiting.");  
exit;  
} else {  
$configFileTemplate = file(OWA_DIR . 'owa-config-dist.php');  
owa_coreAPI::debug('found sample config file.');  
}  
 
$handle = fopen(OWA_DIR . 'owa-config.php', 'w');  
 
foreach ($configFileTemplate as $line_num => $line) {  
switch (substr($line,0,20)) {  
case "define('OWA_DB_TYPE'":  
fwrite($handle, str_replace("yourdbtypegoeshere", $config_values['db_type'], $line));  
break;  
case "define('OWA_DB_NAME'":  
fwrite($handle, str_replace("yourdbnamegoeshere", $config_values['db_name'], $line));  
break;  
case "define('OWA_DB_USER'":  
fwrite($handle, str_replace("yourdbusergoeshere", $config_values['db_user'], $line));  
break;  
case "define('OWA_DB_PASSW":  
fwrite($handle, str_replace("yourdbpasswordgoeshere", $config_values['db_password'], $line));  
break;  
case "define('OWA_DB_HOST'":  
fwrite($handle, str_replace("yourdbhostgoeshere", $config_values['db_host'], $line));  
break;  
case "define('OWA_PUBLIC_U":  
fwrite($handle, str_replace("http://domain/path/to/owa/", $config_values['public_url'], $line));  
break;  
default:  
fwrite($handle, $line);  
}  
}  
 
fclose($handle);  
chmod(OWA_DIR . 'owa-config.php', 0750);  
owa_coreAPI::debug('Config file created');  
require_once(OWA_DIR . 'owa-config.php');  
return true;  
 
}  
 
function reset($module) {  
 
if ($module) {  
 
$defaults = array();  
$defaults['install_complete'] = true;  
$defaults['schema_version'] = $this->get($module, 'schema_version');  
$this->replace('base', $defaults, true);  
return $this->save();  
} else {  
return false;  
}  
}  
 
function setCookieDomain ($domain = '') {  
 
$explicit = false;  
 
if ( ! $domain ) {  
$domain = $_SERVER['HTTP_HOST'];  
$explicit = true;  
}  
 
$domain = owa_lib::sanitizeCookieDomain($domain);  
 
$period = substr( $domain, 0, 1);  
if ( $period === '.' ) {  
$domain = substr( $domain, 1 );  
}  
 
// unless www.domain.com is passed explicitly  
// strip the www from the domain.  
if ( ! $explicit ) {  
$part = substr( $domain, 0, 4 );  
if ($part === 'www.') {  
$domain = substr( $domain, 4);  
}  
}  
 
$cookie_domain = '.'.$domain;  
 
$this->set('base','cookie_domain', $cookie_domain);  
owa_coreAPI::debug("Set cookie domain to $cookie_domain");  
}  
 
function __destruct() {  
 
if ($this->is_dirty) {  
$this->save();  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Service User Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_state {  
 
var $stores = array();  
var $stores_meta = array();  
var $is_dirty;  
var $dirty_stores;  
var $default_store_type = 'cookie';  
var $stores_with_cdh = array('c','v','s');  
var $store_formats = array ('v' => 'assoc', 's' => 'assoc');  
var $initial_state = array();  
 
function __construct() {  
 
}  
 
function __destruct() {  
 
$this->persistState();  
}  
 
function persistState() {  
 
return false;  
 
}  
 
function get($store, $name = '') {  
owa_coreAPI::debug("Getting state - store: ".$store.' key: '.$name);  
 
if ( ! isset($this->stores[$store] ) ) {  
$this->loadState($store);  
}  
 
if (array_key_exists($store, $this->stores)) {  
 
if (!empty($name)) {  
// check to ensure this is an array, could be a string.  
if (is_array($this->stores[$store]) && array_key_exists($name, $this->stores[$store])) {  
 
return $this->stores[$store][$name];  
} else {  
return false;  
}  
} else {  
 
return $this->stores[$store];  
}  
} else {  
 
return false;  
}  
}  
 
function setState($store, $name = '', $value, $store_type = '', $is_perminent = false) {  
 
owa_coreAPI::debug(sprintf('populating state for store: %s, name: %s, value: %s, store type: %s, is_perm: %s', $store, $name, print_r($value, true), $store_type, $is_perminent));  
 
// first call to set for a store sets the meta  
if (!array_key_exists($store, $this->stores)) {  
 
if (empty($store_type)) {  
$store_type = $this->default_store_type;  
}  
 
$this->stores_meta[$store]['type'] = $store_type;  
 
if ($is_perminent === true) {  
$this->stores_meta[$store]['is_perminent'] = true;  
}  
 
}  
 
// set values  
if (empty($name)) {  
$this->stores[$store] = $value;  
//owa_coreAPI::debug(print_r($this->stores, true));  
} else {  
//just in case the store was set first as a string instead of as an array.  
if ( array_key_exists($store, $this->stores)) {  
 
if ( ! is_array( $this->stores[$store] ) ) {  
$new_store = array();  
// check to see if we need ot ad a cdh  
if ( $this->isCdhRequired($store) ) {  
$new_store['cdh'] = $this->getCookieDomainHash();  
}  
 
$new_store[$name] = $value;  
$this->stores[$store] = $new_store;  
 
} else {  
$this->stores[$store][$name] = $value;  
}  
// if the store does not exist then maybe add a cdh and the value  
} else {  
 
if ( $this->isCdhRequired($store) ) {  
$this->stores[$store]['cdh'] = $this->getCookieDomainHash();  
}  
 
$this->stores[$store][$name] = $value;  
}  
 
}  
 
$this->dirty_stores[] = $store;  
//owa_coreAPI::debug(print_r($this->stores, true));  
}  
 
function isCdhRequired($store_name) {  
 
return in_array( $store_name, $this->stores_with_cdh );  
}  
 
function set($store, $name = '', $value, $store_type = '', $is_perminent = false) {  
 
if ( ! isset($this->stores[$store] ) ) {  
$this->loadState($store);  
}  
 
$this->setState($store, $name, $value, $store_type, $is_perminent);  
 
// persist immeadiately if the store type is cookie  
if ($this->stores_meta[$store]['type'] === 'cookie') {  
 
$time = 0;  
 
// needed? i dont think so.  
if (isset($this->stores_meta[$store]['is_perminent']) && $this->stores_meta[$store]['is_perminent'] === true) {  
$time = $this->getPermExpiration();  
} elseif (isset($this->stores_meta[$store]['is_perminent']) && $this->stores_meta[$store]['is_perminent'] > 0) {  
$time = $this->stores_meta[$store]['is_perminent'] * 3600 * 24;  
}  
 
if ($is_perminent === true) {  
$time = $this->getPermExpiration();  
}  
 
// transform state array into a string using proper format  
if ( is_array( $this->stores[$store] ) ) {  
 
// check for old style assoc format  
if (isset($this->store_formats[$store]) && $this->store_formats[$store] === 'assoc') {  
$cookie_value = owa_lib::implode_assoc('=>', '|||', $this->stores[$store] );  
} else {  
$cookie_value = json_encode( $this->stores[$store] );  
}  
}  
 
 
owa_coreAPI::createCookie($store, $this->stores[$store], $time, "/", owa_coreAPI::getSetting('base', 'cookie_domain'));  
}  
}  
 
function setInitialState($store, $value, $store_type) {  
 
if ($value) {  
$this->initial_state[$store] = $value;  
}  
}  
 
function loadState($store, $name = '', $value = '', $store_type = 'cookie') {  
 
if ( ! $value && isset( $this->initial_state[$store] ) ) {  
$value = $this->initial_state[$store];  
} else {  
return;  
}  
 
// check format of value  
if (strpos($value, "|||")) {  
$value = owa_lib::assocFromString($value);  
} else if (strpos($value, '{')) {  
$value = json_decode($value);  
} else {  
$value = $value;  
}  
 
if ( in_array( $store, $this->stores_with_cdh ) ) {  
 
if ( is_array( $value ) && isset( $value['cdh'] ) ) {  
 
$runtime_cdh = $this->getCookieDomainHash();  
$cdh_from_state = $value['cdh'];  
 
// return as the cdh's do not match  
if ( $cdh_from_state != $runtime_cdh ) {  
// cookie domains do not match so we need to delete the cookie in the offending domain  
// which is always likely to be a sub.domain.com and thus HTTP_HOST.  
// if ccokie is not deleted then new cookies set on .domain.com will never be seen by PHP  
// as only the sub domain cookies are available.  
owa_coreAPI::debug("Not loading state store: $store. Domain hashes do not match - runtime: $runtime_cdh, cookie: $cdh_from_state");  
owa_coreAPI::debug("deleting cookie: owa_$store");  
owa_coreAPI::deleteCookie($store,'/', $_SERVER['HTTP_HOST']);  
unset($this->initial_state[$store]);  
return;  
}  
} else {  
 
owa_coreAPI::debug("Not loading state store: $store. No domain hash found.");  
return;  
 
}  
}  
 
return $this->setState($store, $name, $value, $store_type);  
 
}  
 
function clear($store) {  
 
if ( ! isset($this->stores[$store] ) ) {  
$this->loadState($store);  
}  
 
if (array_key_exists($store, $this->stores)) {  
 
unset($this->stores[$store]);  
 
if ($this->stores_meta[$store]['type'] === 'cookie') {  
 
return owa_coreAPI::deleteCookie($store);  
}  
}  
}  
 
function getPermExpiration() {  
 
$time = time()+3600*24*365*15;  
return $time;  
}  
 
function addStores($array) {  
 
$this->stores = array_merge($this->stores, $array);  
return;  
}  
 
function getCookieDomainHash($domain = '') {  
 
if ( ! $domain ) {  
$domain = owa_coreAPI::getSetting( 'base', 'cookie_domain' );  
}  
 
return owa_lib::crc32AsHex($domain);  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Environment Configuration  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Time Period Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_timePeriod {  
 
var $period;  
var $startDate;  
var $endDate;  
var $label;  
var $diff_years;  
var $diff_months;  
var $diff_days;  
 
function __construct() {  
 
//parent::__construct();  
 
$this->startDate = owa_coreAPI::supportClassFactory('base', 'date');  
$this->endDate = owa_coreAPI::supportClassFactory('base', 'date');  
}  
 
function set($value = '', $map = array()) {  
 
$this->period = $value;  
$this->_setDates($map);  
$this->_setLabel($value);  
$this->_setDifferences();  
}  
 
function getStartDate() {  
return $this->startDate;  
}  
 
function getEndDate() {  
return $this->endDate;  
}  
 
function getLabel() {  
return $this->label;  
}  
 
function get() {  
return $this->period;  
}  
 
function _setLabel($value) {  
 
if ($value === 'date_range') {  
// Set date labels  
$this->label = $this->startDate->getLabel() . ' - ' . $this->endDate->getLabel();  
} elseif ($value === 'day') {  
 
$this->label = $this->startDate->getLabel() . ' - ' . $this->startDate->getLabel();  
 
} else {  
 
$periods = $this->getPeriodLabels();  
$this->label = $periods[$value]['label'];  
}  
}  
 
/**  
* Array of Reporting Periods  
*  
* @return array  
*/  
function getPeriodLabels() {  
 
return array(  
 
'today' => array('label' => 'Today'),  
'yesterday' => array('label' => 'Yesterday'),  
'this_week' => array('label' => 'This Week'),  
'this_month' => array('label' => 'This Month'),  
'this_year' => array('label' => 'This Year'),  
'last_week' => array('label' => 'Last Week'),  
'last_month' => array('label' => 'Last Month'),  
'last_year' => array('label' => 'Last Year'),  
//'last_half_hour' => array('label' => 'The Last 30 Minutes'),  
//'last_hour' => array('label' => 'Last Hour'),  
//'last_24_hours' => array('label' => 'Last 24 Hours'),  
'last_seven_days' => array('label' => 'Last Seven Days'),  
'last_thirty_days' => array('label' => 'Last Thirty Days'),  
'same_day_last_week' => array('label' => 'Same Day last Week'),  
'same_week_last_year' => array('label' => 'Same Week Last Year'),  
'same_month_last_year' => array('label' => 'Same Month Last Year'),  
'date_range' => array('label' => 'Date Range')  
//'time_range' => array('label' => 'Time Range')  
);  
 
}  
 
function _setDates($map = array()) {  
 
$time_now = owa_lib::time_now();  
$nowDate = owa_coreAPI::supportClassFactory('base', 'date');  
$nowDate->set(time(), 'timestamp');  
 
switch ($this->period) {  
 
case "today":  
 
$start = mktime(0, 0, 0, $time_now['month'], $time_now['day'], $time_now['year']);  
$end = $start + 3600 * 24 -1;  
break;  
 
case "last_24_hours":  
$end = $time_now['timestamp'];  
$start = $end - 3600*24;  
break;  
 
case "last_hour":  
$end = $time_now['timestamp'];  
$start = $end - 3600;  
break;  
 
case "last_half_hour":  
$end = $time_now['timestamp'];  
$start = $end - 1800;  
break;  
 
case "last_seven_days":  
//$end = mktime(0, 0, 0, $time_now['month'], $time_now['day']+1, $time_now['year']);  
$end = mktime(23, 59, 59, $time_now['month'], $time_now['day'], $time_now['year']);  
$start = $end - 3600*24*7;  
break;  
 
case "this_week":  
$end = mktime(23, 59, 59, $time_now['month'], $time_now['day'], $time_now['year']) +  
((6 - $nowDate->get('day_of_week')) * 3600 * 24);  
$start = mktime(0, 0, 0, $time_now['month'], $time_now['day'], $time_now['year']) -  
($nowDate->get('day_of_week') * 3600 * 24);  
break;  
 
case "this_month":  
$start = mktime(0, 0, 0, $time_now['month'], 1 , $time_now['year']);  
$end = mktime(23, 59, 59, $time_now['month'], $nowDate->get('num_days_in_month'), $time_now['year']);  
break;  
 
case "this_year":  
$start = mktime(0, 0, 0, 1, 1, $time_now['year']);  
$end = mktime(23, 59, 59, 12, 31, $time_now['year']);  
break;  
 
case "yesterday":  
$end = mktime(0, 0, 0, $time_now['month'], $time_now['day'], $time_now['year']);  
$start = $end - 3600*24;  
$end = $end - 1;  
break;  
 
case "last_week":  
$day = ($time_now['day'] - $time_now['dayofweek']) - 7;  
$start = mktime(0, 0, 0, $time_now['month'], $day, $time_now['year']);  
$end = $start + 3600*24*7;  
break;  
 
case "last_month":  
$month = $time_now['month'] - 1;  
$start = mktime(0, 0, 0, $month, 1, $time_now['year']);  
$last = owa_coreAPI::supportClassFactory('base', 'date');  
$last->set($start, 'timestamp');  
$end = mktime(23, 59, 59, $last->get('month'), $last->get('num_days_in_month'), $last->get('year'));  
break;  
 
case "last_year":  
$year = $time_now['year'] - 1;  
$start = mktime(0, 0, 0, 1, 1, $year);  
$end = mktime(23, 59, 59, 12, 31, $year);  
break;  
 
case "same_day_last_week":  
$start = mktime(0, 0, 0, $time_now['month'], $time_now['day'], $time_now['year']) - 3600*24*7;  
$end = $start + (3600*24) - 1;  
break;  
///  
case "same_month_last_year":  
$year = $time_now['year'] - 1;  
$month = $time_now['month'];  
$start = mktime(0, 0, 0, $month, 1, $year);  
$last = owa_coreAPI::supportClassFactory('base', 'date');  
$last->set($start, 'timestamp');  
$end = mktime(23, 59, 59, $month, $last->get('num_days_in_month'), $year);  
break;  
 
case "all_time":  
$end = time();  
$start = mktime(0, 0, 0, 1, 1, 1969);  
break;  
 
case "last_thirty_days":  
$end = mktime(23, 59, 59, $time_now['month'], $time_now['day'], $time_now['year']);  
$start = ($end + 1) - (30 * 3600 * 24);  
break;  
 
case "date_range":  
list($year, $month, $day) = sscanf($map['startDate'], "%4d%2d%2d");  
$start = mktime(0, 0, 0, $month, $day, $year);  
list($year, $month, $day) = sscanf($map['endDate'], "%4d%2d%2d");  
$end = mktime(23, 59, 59, $month, $day, $year);  
 
break;  
 
case "time_range":  
$start = $map['startTime'];  
$end = $map['endTime'];  
break;  
 
case "day":  
list($year, $month, $day) = sscanf($map['startDate'], "%4d%2d%2d");  
$start = mktime(0, 0, 0, $month, $day, $year);  
$end = mktime(23, 59, 59, $month, $day, $year);  
break;  
 
}  
 
$this->startDate->set($start, 'timestamp');  
$this->endDate->set($end, 'timestamp');  
}  
 
function getPeriodProperties() {  
 
$period_params = array();  
$period_params['period'] = $this->get();  
 
if ($period_params['period'] === 'date_range') {  
 
$period_params['startDate'] = $this->startDate->getYyyymmdd();  
$period_params['endDate'] = $this->endDate->getYyyymmdd();  
 
} elseif ($period_params['period'] === 'time_range') {  
 
$period_params['startTime'] = $this->startDate->getTimestamp();  
$period_params['endTime'] = $this->endDate->getTimestamp();  
}  
 
return $period_params;  
 
}  
 
function getAllInfo() {  
 
$info = array();  
$info['period'] = $this->get();  
$info['startDate'] = $this->startDate->getYyyymmdd();  
$info['endDate'] = $this->endDate->getYyyymmdd();  
$info['startTime'] = $this->startDate->getTimestamp();  
$info['endTime'] = $this->endDate->getTimestamp();  
$info['label'] = $this->getLabel();  
 
return $info;  
}  
 
function _setDifferences() {  
 
// calc years diff  
$start = $this->startDate->getYyyymmdd();  
$end = $this->endDate->getYyyymmdd();  
$diff = $this->getDateDifference($start, $end);  
 
$this->diff_years = $diff['YearsSince'];  
$this->diff_months = $diff['MonthsSince'];  
$this->diff_days = $diff['DaysSince'];  
}  
 
function getMonthsDifference() {  
 
return $this->diff_months;  
}  
 
function getYearsDifference() {  
 
return $this->diff_years;  
}  
 
function getDaysDifference() {  
 
return $this->diff_days;  
}  
 
// Function used to take two date strings, and returns an associative array  
// with different formats for the difference between the dates.  
// based on function by: tchapin at gmail dot com  
// --------------------  
// Variables:  
// StartDateString (String - MM/DD/YYYY)  
// EndDateString (String - MM/DD/YYYY)  
// --------------------  
// Example: $DateDiffAry = GetDateDifference('01/09/2008', '02/11/2009');  
// print_r($DateDiffAry);  
// --------------------  
// Returns Something Like:  
/*  
Array  
(  
[YearsSince] => 1.0931506849315  
[MonthsSince] => 13.117808219178  
[DaysSince] => 399  
[HoursSince] => 9576  
[MinutesSince] => 574560  
[SecondsSince] => 34473600  
[NiceString] => 1 year, 1 month, and 2 days  
[NiceString2] => Years: 1, Months: 1, Days: 2  
)  
*/  
function getDateDifference($StartDateString=NULL, $EndDateString=NULL) {  
$ReturnArray = array();  
 
$SDSplit = sscanf($StartDateString,'%4d%2d%2d');  
$StartDate = mktime(0,0,0,$SDSplit[1],$SDSplit[2],$SDSplit[0]);  
 
$EDSplit = sscanf($EndDateString,'%4d%2d%2d');  
$EndDate = mktime(0,0,0,$EDSplit[1],$EDSplit[2],$EDSplit[0]);  
 
$DateDifference = $EndDate-$StartDate;  
 
$ReturnArray['YearsSince'] = $DateDifference/60/60/24/365;  
$ReturnArray['MonthsSince'] = $DateDifference/60/60/24/365*12;  
$ReturnArray['DaysSince'] = $DateDifference/60/60/24;  
$ReturnArray['HoursSince'] = $DateDifference/60/60;  
$ReturnArray['MinutesSince'] = $DateDifference/60;  
$ReturnArray['SecondsSince'] = $DateDifference;  
 
$y1 = date("Y", $StartDate);  
$m1 = date("m", $StartDate);  
$d1 = date("d", $StartDate);  
$y2 = date("Y", $EndDate);  
$m2 = date("m", $EndDate);  
$d2 = date("d", $EndDate);  
 
$diff = '';  
$diff2 = '';  
if (($EndDate - $StartDate)<=0) {  
// Start date is before or equal to end date!  
$diff = "0 days";  
$diff2 = "Days: 0";  
} else {  
 
$y = $y2 - $y1;  
$m = $m2 - $m1;  
$d = $d2 - $d1;  
$daysInMonth = date("t",$StartDate);  
if ($d<0) {$m--;$d=$daysInMonth+$d;}  
if ($m<0) {$y--;$m=12+$m;}  
$daysInMonth = date("t",$m2);  
 
// Nicestring ("1 year, 1 month, and 5 days")  
if ($y>0) $diff .= $y==1 ? "1 year" : "$y years";  
if ($y>0 && $m>0) $diff .= ", ";  
if ($m>0) $diff .= $m==1? "1 month" : "$m months";  
if (($m>0||$y>0) && $d>0) $diff .= ", and ";  
if ($d>0) $diff .= $d==1 ? "1 day" : "$d days";  
 
// Nicestring 2 ("Years: 1, Months: 1, Days: 1")  
if ($y>0) $diff2 .= $y==1 ? "Years: 1" : "Years: $y";  
if ($y>0 && $m>0) $diff2 .= ", ";  
if ($m>0) $diff2 .= $m==1? "Months: 1" : "Months: $m";  
if (($m>0||$y>0) && $d>0) $diff2 .= ", ";  
if ($d>0) $diff2 .= $d==1 ? "Days: 1" : "Days: $d";  
 
}  
 
$ReturnArray['NiceString'] = $diff;  
$ReturnArray['NiceString2'] = $diff2;  
return $ReturnArray;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 - 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Update Class  
*  
* Performs an Update for a specific module  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2008 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_update extends owa_base {  
 
/**  
* Module Name  
*  
* Name of the module that his update is invoked under. This is set by the  
* factory.  
*  
* @var string  
*/  
var $module_name;  
 
/**  
* Schema Version Number  
*  
* Version number of the schema that will be in place after update is applied.  
*  
* This is set by the module's update method from the concrete class filename  
* when it creates the concrete version of this update class. This ensures  
* that the schema version number is only set in one place (the file name) and  
* that only one concrete update class can ever be applied for a particular  
* schema version.  
*  
* @var integer  
*/  
var $schema_version;  
 
var $is_cli_mode_required;  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function isCliModeRequired() {  
 
return $this->is_cli_mode_required;  
}  
 
/**  
* Applies an update  
*  
* @return boolean  
*/  
function apply() {  
 
// check for schema version. abort if not present or else updates will get out of sync.  
if (empty($this->schema_version)) {  
$this->e->notice(sprintf("Aborting %s Update (%s): Schema Version Number is not set.", get_class(), $this->module_name));  
return false;  
}  
 
$current_version = $this->c->get($this->module_name, 'schema_version');  
 
// check to see that you are applying an update that was successfully applied  
if ($current_version === $this->schema_version) {  
$this->e->notice(sprintf("Aborting %s Update (%s): Update has already ben applied.", get_class(), $this->module_name));  
return false;  
}  
 
// execute pre update proceadure  
$ret = $this->pre();  
 
if ($ret == true):  
 
$this->e->notice("Pre Update Proceadure Suceeded");  
 
// execute actual update proceadure  
$ret = $this->up();  
 
if ($ret == true):  
 
// execute post update proceadure  
$ret = $this->post();  
 
if ($ret == true):  
$this->e->notice("Post Update Proceadure Suceeded");  
$this->c->persistSetting($this->module_name, 'schema_version', $this->schema_version);  
$this->c->save();  
return true;  
else:  
$this->e->notice("Post Update Proceadure Failed");  
return false;  
endif;  
else:  
$this->e->notice("Update Proceadure Failed");  
return false;  
endif;  
else:  
$this->e->notice("Pre Update Proceadure Failed");  
return false;  
endif;  
 
}  
 
 
/**  
* Rollsback an update  
*  
* @return boolean  
*/  
function rollback() {  
 
$current_version = $this->c->get($this->module_name, 'schema_version');  
 
// check to see that you are rolling back either an update that was successfully applied or one that might have failed.  
// we dont want people applying rollbacks out of sequence.  
if ($current_version === $this->schema_version || $current_version === $this->schema_version - 1) {  
$ret = $this->down();  
if ($ret) {  
// only touch the current schema number if needed  
 
$prior_version = $current_version - 1;  
 
if ($current_version === $this->schema_version) {  
$this->c->persistSetting($this->module_name, 'schema_version', $prior_version);  
$this->c->save();  
$this->e->notice("Rollback succeeded to version: $prior_version.");  
} else {  
$this->e->notice("Rollback succeeded to version: $current_version.");  
}  
 
} else {  
$this->e->notice("Rollback failed.");  
}  
} else {  
$this->e->notice(sprintf('Rollback of update %s cannot be applied because it does not appear that it update %s has been applied to your instance. Your current schema version is only %s', $this->schema_version, $this->schema_version, $current_version));  
}  
 
return true;  
}  
 
/**  
* Abstract Pre-update hook  
*  
* @return boolean  
*/  
function pre() {  
 
return true;  
}  
 
/**  
* Abstract Post-update hook  
*  
* @return boolean  
*/  
function post() {  
 
return true;  
}  
 
/**  
* Abstract Method for update  
*  
* @return boolean  
*/  
function up() {  
 
return false;  
}  
 
/**  
* Abstract Method for reversing an update  
*  
* @return boolean  
*/  
function down() {  
 
return false;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* User Manager Class  
*  
* handels the common tasks associated with creating and manipulating user accounts  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
 
 
class owa_userManager extends owa_base {  
 
function __construct() {  
 
$this->owa_base();  
 
return;  
}  
 
function owa_userManager() {  
 
return $this->__construct();  
}  
 
function createNewUser($user_params) {  
 
// save new user to db  
$auth = &owa_auth::get_instance();  
$temp_passkey = $auth->generateTempPasskey($this->params['user_id']);  
$u = owa_coreAPI::entityFactory('base.user');  
$u->set('user_id', $user_params['user_id']);  
$u->set('role', $user_params['role']);  
$u->set('real_name', $user_params['real_name']);  
$u->set('email_address', $user_params['email_address']);  
$u->set('temp_passkey', $temp_passkey);  
$u->set('creation_date', time());  
$u->set('last_update_date', time());  
$ret = $u->create();  
 
if ($ret == true):  
return $temp_passkey;  
else:  
return false;  
endif;  
 
}  
 
function deleteUser($user_id) {  
 
$u = owa_coreAPI::entityFactory('base.user');  
 
$ret = $u->delete($user_id, 'user_id');  
 
if ($ret == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Validation Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_validation {  
 
// hold config  
var $conf;  
 
// hold values to validate  
var $values;  
 
var $hasError;  
 
var $errorMsg;  
 
var $errorMsgTemplate;  
 
function __construct($conf = array()) {  
 
if (array_key_exists('errorMsgTemplate', $conf)):  
$this->errorMsgTemplate = $conf['errorMsgTemplate'];  
endif;  
 
}  
 
function validate() {  
 
return false;  
}  
 
function getErrorMsg() {  
 
return $this->errorMsg;  
}  
 
function setErrorMsgTemplate($string) {  
 
$this->errorMsgTemplate = $string;  
 
return;  
}  
 
// depricated  
function setErrorMsg($msg) {  
 
$this->errorMsg = $msg;  
$this->hasError = true;  
 
return;  
 
}  
 
function setErrorMessage($msg) {  
$this->errorMsg = $msg;  
}  
 
function isValid() {  
 
if ($this->hasError == true):  
return false;  
else:  
return true;  
endif;  
}  
 
function setConfig($name, $value) {  
 
$this->conf[$name] = $value;  
return;  
}  
 
function setConfigArray($array) {  
 
$this->conf = $array;  
return;  
}  
 
function getConfig($name) {  
 
return $this->conf[$name];  
}  
 
function setValues($values) {  
 
$this->values = $values;  
return;  
}  
 
function getValues() {  
 
return $this->values;  
 
}  
 
function hasError() {  
 
$this->hasError = true;  
return;  
}  
 
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Data Validator Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_validator extends owa_base {  
 
/**  
* Flag for whether or not a validation run produces errors  
*  
* @var boolean  
*/  
var $hasErrors;  
 
/**  
* Error Msgs produced by Validations  
*  
* @var array  
*/  
var $errorMsgs;  
 
/**  
* Validations to be performed in next validation run  
*  
* @var array  
*/  
var $validations;  
 
function __construct() {  
 
return parent::__construct();  
}  
 
/**  
* Adds a validation to be performed in next run  
*  
* @param string $name the name to be given to the validation and its results  
* @param unknown $value the data value that is to be validated  
* @param string $validation the name of the validation to run  
* @param array $conf configuration array for the object being created  
*/  
function addValidation($name, $value, $validation, $conf) {  
 
// Construct validatation obj  
$obj = $this->validationFactory($validation);  
$obj->setValues($value);  
$obj->setConfigArray($conf);  
 
$this->validations[] = array('name' => $name, 'obj' => $obj);  
 
return;  
 
}  
 
function setValidation($name, $obj) {  
 
$this->validations[] = array('name' => $name, 'obj' => $obj);  
return;  
}  
 
/**  
* Factory method for producing validation objects  
*  
* @return Object  
*/  
function validationFactory($class_file) {  
 
return owa_coreAPI::validationFactory($class_file, $conf);  
}  
 
/**  
* Performs a validation run  
*  
*/  
function doValidations() {  
 
foreach ($this->validations as $k) {  
 
$k['obj']->validate();  
 
if ($k['obj']->hasError === true) {  
 
$this->hasErrors = true;  
$this->errorMsgs[$k['name']] = $k['obj']->getErrorMsg();  
 
if ($k['obj']->conf['stopOnError'] === true) {  
break;  
}  
 
}  
}  
}  
 
/**  
* Check to see if the validation run was successful.  
*  
* @return boolean  
*/  
function isValid() {  
 
if ($this->hasErrors == true):  
return false;  
else:  
return true;  
endif;  
}  
 
/**  
* Accessor method for retrieving the error msgs produced by a validation run  
*  
* @return array  
*/  
function getErrorMsgs() {  
 
return $this->errorMsgs;  
}  
 
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Abstract Widget Controller Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_widgetController extends owa_controller {  
 
var $default_format = 'graph';  
var $dom_id;  
 
/**  
* holding tank or metrics that need  
* to be shared between action methods  
*/  
var $metrics = array();  
 
function __construct($params) {  
 
$this->type = 'widget';  
//$this->setRequiredCapability('view_reports');  
//print_r($params);  
return parent::__construct($params);  
}  
 
function pre() {  
 
 
$this->setPeriod($this->getParam('period'));  
 
// create dom safe id from do action param  
$this->dom_id = str_replace('.', '-', $this->params['do']);  
$this->data['dom_id'] = $this->dom_id;  
 
if (!array_key_exists('format', $this->params)):  
 
$this->params['format'] = $this->default_format;  
 
else:  
if (empty($this->params['format'])):  
$this->params['format'] = $this->default_format;  
endif;  
endif;  
 
return;  
}  
 
function post() {  
 
// calls widget format specific functions  
 
$this->doFormatAction($this->params['format']);  
 
// used to add outer wrapper to widget if it's the first view.  
$iv = $this->getParam('initial_view');  
if ($iv == true):  
$this->data['subview'] = $this->data['view'];  
$this->data['view'] = 'base.widget';  
// we dont want to keep passing this.  
unset($this->data['params']['initial_view']);  
endif;  
 
 
$this->data['wrapper'] = $this->getParam('wrapper');  
$this->data['widget'] = $this->params['do'];  
$this->data['do'] = $this->params['do'];  
 
// set default dimensions  
 
if (array_key_exists('width', $this->params)):  
$this->setWidth($this->params['width']);  
endif;  
 
if (array_key_exists('height', $this->params)):  
$this->setHeight($this->params['height']);  
endif;  
 
}  
 
function enableFormat($name, $label = '') {  
 
if (empty($label)):  
$label = ucwords($name);  
endif;  
 
$this->data['widget_views'][$name] = $label;  
return;  
 
}  
 
function setHeight($height) {  
 
$this->data['height'] = $height;  
 
return;  
}  
 
function setWidth($width) {  
 
$this->data['width'] = $width;  
 
return;  
}  
 
function setDefaultFormat($format) {  
 
$this->default_format = $format;  
 
return;  
 
}  
 
function doFormatAction($format = '') {  
 
 
$method = $this->params['format'].'Action';  
 
if (method_exists($this, $method)) {  
$this->$method();  
} else {  
$this->e->debug("Widget format not implemented. No method named $method");  
}  
 
}  
 
function setMetric($name, $obj) {  
$this->metrics[$name] = $obj;  
return;  
}  
 
function getMetric($name) {  
return $this->metrics[$name];  
}  
 
}  
 
/**  
* Widget View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_widgetView extends owa_view {  
 
function owa_widgetView() {  
 
$this->owa_view();  
 
return;  
}  
 
function render($data) {  
 
// load template  
 
if (array_key_exists('is_external', $data['params'])):  
if ($data['params']['is_external'] == true):  
$this->t->set_template('wrapper_widget.tpl');  
else:  
$this->t->set_template('wrapper_blank.tpl');  
endif;  
else:  
$this->t->set_template('wrapper_blank.tpl');  
endif;  
 
if (array_key_exists('width', $data)):  
$data['params']['width'] = $data['width'];  
endif;  
 
if (array_key_exists('height', $data)):  
$data['params']['height'] = $data['height'];  
endif;  
 
$this->_setLinkState();  
 
if ($data['wrapper'] === true):  
$this->body->set_template('widget.tpl');  
elseif ($data['wrapper'] === 'inpage'):  
$this->body->set_template('widget_inpage.tpl');  
endif;  
 
if (array_key_exists('format', $data['params'])):  
$this->body->set('format', $data['params']['format']);  
endif;  
 
$this->body->set('widget', str_replace('.', '-', $data['widget']));  
$this->body->set('params', $data['params']);  
$this->body->set('title', $data['title']);  
$this->body->set('widget_views', $data['widget_views']);  
$this->body->set('widget_views_count', count($data['widget_views']));  
$this->body->set('do', $data['widget']);  
 
return;  
}  
 
 
}  
 
 
 
 
?>  
.ui-accordion { margin: 0; padding: 0; list-style-type: none; }  
.ui-accordion li { margin: 0; margin-bottom: 2px; padding: 0; }  
.ui-accordion li .ui-accordion-header {  
display: block;  
padding-left: 5px;  
margin-right: 3px;  
height: 28px;  
background-image: url(i/accordion-middle.png);  
color: #000;  
text-decoration: none;  
line-height: 28px;  
position: relative;  
left: 3px;  
}  
.ui-accordion li .ui-accordion-right {  
display: block;  
background-image: url(i/accordion-right.png);  
position: absolute;  
top: 0px;  
right: -3px;  
height: 28px;  
width: 3px;  
}  
.ui-accordion li .ui-accordion-left {  
display: block;  
background-image: url(i/accordion-left.png);  
background-repeat: no-repeat;  
position: absolute;  
height: 28px;  
width: 3px;  
}  
 
.ui-accordion li:hover .ui-accordion-left { background-image: url(i/accordion-left-over.png); }  
.ui-accordion li:hover .ui-accordion-header { background-image: url(i/accordion-middle-over.png); }  
.ui-accordion li:hover .ui-accordion-right { background-image: url(i/accordion-right-over.png); }  
 
.ui-accordion li.selected .ui-accordion-left { background-image: url(i/accordion-left-act.png); }  
.ui-accordion li.selected .ui-accordion-header { background-image: url(i/accordion-middle-act.png); }  
.ui-accordion li.selected .ui-accordion-right { background-image: url(i/accordion-right-act.png); }  
 
@import "flora.css";  
@import "flora.accordion.css";  
@import "flora.datepicker.css";  
@import "flora.dialog.css";  
@import "flora.resizable.css";  
@import "flora.slider.css";  
@import "flora.tabs.css";  
 
.ui-wrapper { border: 1px solid #50A029; }  
.ui-wrapper input, .ui-wrapper textarea { border: 0; }  
 
/* Main Flora Style Sheet for jQuery UI ui-datepicker */  
#ui-datepicker-div, .ui-datepicker-inline {  
font-family: Arial,Helvetica,sans-serif;  
font-size: 14px;  
padding: 0;  
margin: 0;  
background: #E0F4D7;  
width: 185px;  
}  
#ui-datepicker-div {  
display: none;  
border: 1px solid #FF9900;  
z-index: 10;  
}  
.ui-datepicker-inline {  
float: left;  
display: block;  
border: 0;  
}  
.ui-datepicker-rtl {  
direction: rtl;  
}  
.ui-datepicker-dialog {  
padding: 5px !important;  
border: 4px ridge #83C948 !important;  
}  
button.ui-datepicker-trigger {  
width: 25px;  
}  
img.ui-datepicker-trigger {  
margin: 2px;  
vertical-align: middle;  
}  
.ui-datepicker-prompt {  
float: left;  
padding: 2px;  
background: #E0F4D7;  
color: #000;  
}  
*html .ui-datepicker-prompt {  
width: 185px;  
}  
.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {  
clear: both;  
float: left;  
width: 100%;  
color: #FFF;  
}  
.ui-datepicker-control {  
background: #FF9900;  
padding: 2px 0px;  
}  
.ui-datepicker-links {  
background: #E0F4D7;  
padding: 2px 0px;  
}  
.ui-datepicker-control, .ui-datepicker-links {  
font-weight: bold;  
font-size: 80%;  
letter-spacing: 1px;  
}  
.ui-datepicker-links label {  
padding: 2px 5px;  
color: #888;  
}  
.ui-datepicker-clear, .ui-datepicker-prev {  
float: left;  
width: 34%;  
}  
.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {  
float: right;  
text-align: right;  
}  
.ui-datepicker-current {  
float: left;  
width: 30%;  
text-align: center;  
}  
.ui-datepicker-close, .ui-datepicker-next {  
float: right;  
width: 34%;  
text-align: right;  
}  
.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {  
float: left;  
text-align: left;  
}  
.ui-datepicker-header {  
padding: 1px 0 3px;  
background: #83C948;  
text-align: center;  
font-weight: bold;  
height: 1.3em;  
}  
.ui-datepicker-header select {  
background: #83C948;  
color: #000;  
border: 0px;  
font-weight: bold;  
}  
.ui-datepicker {  
background: #CCC;  
text-align: center;  
font-size: 100%;  
}  
.ui-datepicker a {  
display: block;  
width: 100%;  
}  
.ui-datepicker-title-row {  
background: #B1DB87;  
color: #000;  
}  
.ui-datepicker-title-row .ui-datepicker-week-end-cell {  
background: #B1DB87;  
}  
.ui-datepicker-days-row {  
background: #FFF;  
color: #666;  
}  
.ui-datepicker-week-col {  
background: #B1DB87;  
color: #000;  
}  
.ui-datepicker-days-cell {  
color: #000;  
border: 1px solid #DDD;  
}  
.ui-datepicker-days-cell a {  
display: block;  
}  
.ui-datepicker-week-end-cell {  
background: #E0F4D7;  
}  
.ui-datepicker-unselectable {  
color: #888;  
}  
.ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {  
background: #B1DB87 !important;  
}  
.ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {  
background: #FFF !important;  
border: 1px solid #777;  
}  
* html .ui-datepicker-title-row .ui-datepicker-week-end-cell {  
background: #B1DB87 !important;  
}  
* html .ui-datepicker-week-end-cell {  
background: #E0F4D7 !important;  
border: 1px solid #DDD !important;  
}  
* html .ui-datepicker-days-cell-over {  
background: #FFF !important;  
border: 1px solid #777 !important;  
}  
* html .ui-datepicker-current-day {  
background: #83C948 !important;  
}  
.ui-datepicker-today {  
background: #B1DB87 !important;  
}  
.ui-datepicker-current-day {  
background: #83C948 !important;  
}  
.ui-datepicker-status {  
background: #E0F4D7;  
width: 100%;  
font-size: 80%;  
text-align: center;  
}  
#ui-datepicker-div a, .ui-datepicker-inline a {  
cursor: pointer;  
margin: 0;  
padding: 0;  
background: none;  
color: #000;  
}  
.ui-datepicker-inline .ui-datepicker-links a {  
padding: 0 5px !important;  
}  
.ui-datepicker-control a, .ui-datepicker-links a {  
padding: 2px 5px !important;  
color: #000 !important;  
}  
.ui-datepicker-title-row a {  
color: #000 !important;  
}  
.ui-datepicker-control a:hover {  
background: #FDD !important;  
color: #333 !important;  
}  
.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {  
background: #FFF !important;  
color: #333 !important;  
}  
.ui-datepicker-multi .ui-datepicker {  
border: 1px solid #83C948;  
}  
.ui-datepicker-one-month {  
float: left;  
width: 185px;  
}  
.ui-datepicker-new-row {  
clear: left;  
}  
.ui-datepicker-cover {  
display: none;  
display/**/: block;  
position: absolute;  
z-index: -1;  
filter: mask();  
top: -4px;  
left: -4px;  
width: 193px;  
height: 200px;  
}  
 
/* This file skins dialog */  
 
.flora .ui-dialog,  
.flora.ui-dialog {  
background-color: #e6f7d4;  
}  
 
.flora .ui-dialog .ui-dialog-titlebar,  
.flora.ui-dialog .ui-dialog-titlebar {  
border-bottom: 1px solid #d8d2aa;  
background: #ff9900 url(i/dialog-title.gif) repeat-x;  
padding: 0px;  
height: 28px;  
_height: 29px;  
}  
 
.flora .ui-draggable .ui-dialog-titlebar,  
.flora.ui-draggable .ui-dialog-titlebar {  
cursor: move;  
}  
 
.flora .ui-draggable-disabled .ui-dialog-titlebar,  
.flora.ui-draggable-disabled .ui-dialog-titlebar {  
cursor: default;  
}  
 
.flora .ui-dialog .ui-dialog-titlebar-close,  
.flora.ui-dialog .ui-dialog-titlebar-close {  
width: 16px;  
height: 16px;  
background: url(i/dialog-titlebar-close.png) no-repeat;  
position:absolute;  
top: 6px;  
right: 7px;  
cursor: default;  
}  
 
.flora .ui-dialog .ui-dialog-titlebar-close span,  
.flora.ui-dialog .ui-dialog-titlebar-close span {  
display: none;  
}  
 
.flora .ui-dialog .ui-dialog-titlebar-close-hover,  
.flora.ui-dialog .ui-dialog-titlebar-close-hover {  
background: url(i/dialog-titlebar-close-hover.png) no-repeat;  
}  
 
.flora .ui-dialog .ui-dialog-title,  
.flora.ui-dialog .ui-dialog-title {  
margin-left: 5px;  
color: white;  
font-weight: bold;  
position: relative;  
top: 7px;  
left: 4px;  
}  
 
.flora .ui-dialog .ui-dialog-content,  
.flora.ui-dialog .ui-dialog-content {  
margin: 1.2em;  
}  
 
.flora .ui-dialog .ui-dialog-buttonpane,  
.flora.ui-dialog .ui-dialog-buttonpane {  
position: absolute;  
bottom: 8px;  
right: 12px;  
width: 100%;  
text-align: right;  
}  
 
.flora .ui-dialog .ui-dialog-buttonpane button,  
.flora.ui-dialog .ui-dialog-buttonpane button {  
margin: 6px;  
}  
 
/* Dialog handle styles */  
.flora .ui-dialog .ui-resizable-n,  
.flora.ui-dialog .ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: transparent url(i/dialog-n.gif) repeat scroll center top; }  
 
.flora .ui-dialog .ui-resizable-s,  
.flora.ui-dialog .ui-resizable-s { cursor: s-resize; height: 8px; width: 100%; bottom: 0px; left: 0px; background: transparent url(i/dialog-s.gif) repeat scroll center top; }  
 
.flora .ui-dialog .ui-resizable-e,  
.flora.ui-dialog .ui-resizable-e { cursor: e-resize; width: 7px; right: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-e.gif) repeat scroll right center; }  
 
.flora .ui-dialog .ui-resizable-w,  
.flora.ui-dialog .ui-resizable-w { cursor: w-resize; width: 7px; left: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-w.gif) repeat scroll right center; }  
 
.flora .ui-dialog .ui-resizable-se,  
.flora.ui-dialog .ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: transparent url(i/dialog-se.gif); }  
 
.flora .ui-dialog .ui-resizable-sw,  
.flora.ui-dialog .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: transparent url(i/dialog-sw.gif); }  
 
.flora .ui-dialog .ui-resizable-nw,  
.flora.ui-dialog .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 29px; left: 0px; top: 0px; background: transparent url(i/dialog-nw.gif); }  
 
.flora .ui-dialog .ui-resizable-ne,  
.flora.ui-dialog .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 29px; right: 0px; top: 0px; background: transparent url(i/dialog-ne.gif); }  
 
/* This file skins resizables */  
 
.ui-resizable { position: relative; }  
 
/* Global handle styles */  
.ui-resizable-handle { position: absolute; display: none; font-size: 0.1px; }  
.ui-resizable .ui-resizable-handle { display: block; }  
body .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */  
body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */  
 
.ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: transparent url(i/resizable-n.gif) repeat scroll center top; }  
.ui-resizable-s { cursor: s-resize; height: 6px; width: 100%; bottom: 0px; left: 0px; background: transparent url(i/resizable-s.gif) repeat scroll center top; }  
 
.ui-resizable-e { cursor: e-resize; width: 6px; right: 0px; top: 0px; height: 100%; background: transparent url(i/resizable-e.gif) repeat scroll right center; }  
.ui-resizable-w { cursor: w-resize; width: 6px; left: 0px; top: 0px; height: 100%; background: transparent url(i/resizable-w.gif) repeat scroll right center; }  
 
.ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: transparent url(i/resizable-se.gif); }  
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: transparent url(i/resizable-sw.gif); }  
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: 0px; top: 0px; background: transparent url(i/resizable-nw.gif); }  
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: 0px; top: 0px; background: transparent url(i/resizable-ne.gif); }  
 
/* This file skins sliders */  
 
.ui-slider { width: 200px; height: 23px; position: relative; background-repeat: no-repeat; background-position: center center; }  
.ui-slider-handle { position: absolute; z-index: 1; height: 23px; width: 12px; top: 0px; left: 0px; background-image: url(i/slider-handle.gif); }  
.ui-slider-handle-active { border: 1px dotted black; }  
.ui-slider-disabled .ui-slider-handle { opacity: 0.5; filter: alpha(opacity=50); }  
.ui-slider-range { position: absolute; background: #50A029; opacity: 0.3; filter: alpha(opacity=30); width: 100%; height: 100%; }  
 
/* Default slider backgrounds */  
.ui-slider, .ui-slider-1 { background-image: url(i/slider-bg-1.png); }  
.ui-slider-2 { background-image: url(i/slider-bg-2.png); }  
 
@import "flora.css";  
 
/* Caution! Ensure accessibility in print and other media types... */  
@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */  
.ui-tabs-hide {  
display: none !important;  
}  
}  
 
/* Hide useless elements in print layouts... */  
@media print {  
.ui-tabs-nav {  
display: none;  
}  
}  
 
/* Skin */  
.ui-tabs-nav, .ui-tabs-panel {  
font-family: "Trebuchet MS", Trebuchet, Verdana, Helvetica, Arial, sans-serif;  
font-size: 12px;  
}  
.ui-tabs-nav {  
list-style: none;  
margin: 0;  
padding: 0 0 0 3px;  
}  
.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */  
display: block;  
clear: both;  
content: " ";  
}  
.ui-tabs-nav li {  
float: left;  
margin: 0 0 0 2px;  
font-weight: bold;  
}  
.ui-tabs-nav a, .ui-tabs-nav a span {  
float: left; /* fixes dir=ltr problem and other quirks IE */  
padding: 0 12px;  
background: url(i/tabs.png) no-repeat;  
}  
.ui-tabs-nav a {  
margin: 5px 0 0; /* position: relative makes opacity fail for disabled tab in IE */  
padding-left: 0;  
background-position: 100% 0;  
text-decoration: none;  
white-space: nowrap; /* @ IE 6 */  
outline: 0; /* @ Firefox, prevent dotted border after click */  
}  
.ui-tabs-nav a:link, .ui-tabs-nav a:visited {  
color: #fff;  
}  
.ui-tabs-nav .ui-tabs-selected a {  
position: relative;  
top: 1px;  
z-index: 2;  
margin-top: 0;  
background-position: 100% -23px;  
}  
.ui-tabs-nav a span {  
padding-top: 1px;  
padding-right: 0;  
height: 20px;  
background-position: 0 0;  
line-height: 20px;  
}  
.ui-tabs-nav .ui-tabs-selected a span {  
padding-top: 0;  
height: 27px;  
background-position: 0 -23px;  
line-height: 27px;  
}  
.ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited,  
.ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */  
cursor: text;  
}  
.ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active,  
.ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */  
cursor: pointer;  
}  
.ui-tabs-disabled {  
opacity: .4;  
filter: alpha(opacity=40);  
}  
.ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited {  
color: #000;  
}  
.ui-tabs-panel {  
border: 1px solid #519e2d;  
padding: 10px;  
background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */  
}  
/*.ui-tabs-loading em {  
padding: 0 0 0 20px;  
background: url(loading.gif) no-repeat 0 50%;  
}*/  
 
/* Additional IE specific bug fixes... */  
* html .ui-tabs-nav { /* auto clear @ IE 6 & IE 7 Quirks Mode */  
display: inline-block;  
}  
*:first-child+html .ui-tabs-nav { /* auto clear @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */  
display: inline-block;  
}  
 
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-left-act.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-left-over.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-left.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-middle-act.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-middle-over.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-middle.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-right-act.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-right-over.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/accordion-right.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-e.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-n.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-ne.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-nw.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-s.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-se.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-sw.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-title.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-titlebar-close-hover.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-titlebar-close.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/dialog-w.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-e.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-n.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-ne.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-nw.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-s.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-se.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-sw.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/resizable-w.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/slider-bg-1.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/slider-bg-2.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/slider-handle.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/flora/i/tabs.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_arrows_leftright.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_arrows_updown.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_close.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_doc.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_folder_closed.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_folder_open.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_minus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_plus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_11x11_icon_resize_se.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_35x9_colorpicker_indicator.gif.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_7x7_arrow_down.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_7x7_arrow_left.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_7x7_arrow_right.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/222222_7x7_arrow_up.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_arrows_leftright.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_arrows_updown.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_close.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_doc.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_folder_closed.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_folder_open.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_minus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_11x11_icon_plus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_7x7_arrow_down.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_7x7_arrow_left.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_7x7_arrow_right.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/454545_7x7_arrow_up.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_arrows_leftright.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_arrows_updown.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_close.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_doc.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_folder_closed.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_folder_open.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_minus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_11x11_icon_plus.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_7x7_arrow_down.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_7x7_arrow_left.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_7x7_arrow_right.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/888888_7x7_arrow_up.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/_x_. and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/e6e6e6_40x100_textures_02_glass_75.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/ffa20a_40x100_textures_05_inset_soft_75.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/ffffff_40x100_textures_01_flat_0.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/images/ffffff_40x100_textures_02_glass_65.png and /dev/null differ
<?php  
// ...  
?>  
/*  
* jQuery UI screen structure and presentation  
* This CSS file was generated by ThemeRoller, a Filament Group Project for jQuery UI  
* Author: Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com  
* Visit ThemeRoller.com  
*/  
 
/*  
* Note: If your ThemeRoller settings have a font size set in ems, your components will scale according to their parent element's font size.  
* As a rule of thumb, set your body's font size to 62.5% to make 1em = 10px.  
* body {font-size: 62.5%;}  
*/  
 
 
 
/*UI accordion*/  
.ui-accordion {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
border-bottom: 1px solid #d3d3d3;  
}  
.ui-accordion-group {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
border: 1px solid #d3d3d3;  
border-bottom: none;  
}  
.ui-accordion-header {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
cursor: pointer;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
}  
.ui-accordion-header a {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
display: block;  
font-size: 1em;  
font-weight: normal;  
text-decoration: none;  
padding: .5em .5em .5em 1.7em;  
color: #555555;  
background: url(images/888888_7x7_arrow_right.gif) .5em 50% no-repeat;  
}  
.ui-accordion-header a:hover {  
background: url(images/454545_7x7_arrow_right.gif) .5em 50% no-repeat;  
color: #212121;  
}  
.ui-accordion-header:hover {  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
color: #212121;  
}  
.selected .ui-accordion-header, .selected .ui-accordion-header:hover {  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
}  
.selected .ui-accordion-header a, .selected .ui-accordion-header a:hover {  
color: #222222;  
background: url(images/222222_7x7_arrow_down.gif) .5em 50% no-repeat;  
}  
.ui-accordion-content {  
padding: 1.5em 1.7em;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
color: #222222;  
font-size: 1em;  
}  
 
 
 
 
 
 
 
 
/*UI tabs*/  
.ui-tabs-nav {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
float: left;  
position: relative;  
z-index: 1;  
border-right: 1px solid #d3d3d3;  
bottom: -1px;  
}  
.ui-tabs-nav li {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
float: left;  
border: 1px solid #d3d3d3;  
border-right: none;  
}  
.ui-tabs-nav li a {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
float: left;  
font-size: 1em;  
font-weight: normal;  
text-decoration: none;  
padding: .5em 1.7em;  
color: #555555;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
}  
.ui-tabs-nav li a:hover, .ui-tabs-nav li a:focus, .ui-tabs-nav li a:active { /* order: LVHFA */  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
color: #212121;  
}  
.ui-tabs-nav li.ui-tabs-selected {  
border-bottom-color: #ffffff;  
}  
.ui-tabs-nav li.ui-tabs-selected a, .ui-tabs-nav li.ui-tabs-selected a:hover,  
.ui-tabs-nav li.ui-tabs-selected a:focus, .ui-tabs-nav li.ui-tabs-selected a:active {  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
color: #222222;  
}  
.ui-tabs-panel {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
clear:left;  
border: 1px solid #d3d3d3;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
color: #222222;  
padding: 1.5em 1.7em;  
font-size: 1.1em;  
min-width: 0; /* => IE7 trigger hasLayout (while maintaining valid CSS) to prevent margins pushed here from preceding elements */  
}  
* html .ui-tabs-panel {  
display: inline-block; /* => IE6 trigger hasLayout (while maintaining valid CSS) in IE6 to prevent margins pushed here from preceding elements */  
}  
.ui-tabs-hide {  
display: none !important/*for accessible hiding: position: absolute; left: -99999999px;*/;  
}  
 
 
 
 
 
 
 
 
 
/*slider*/  
.ui-slider {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
border: 1px solid #dddddd;  
height: .8em;  
position: relative;  
}  
.ui-slider-handle {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
position: absolute;  
z-index: 2;  
top: -3px;  
width: 1.2em;  
height: 1.2em;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
border: 1px solid #d3d3d3;  
}  
.ui-slider-handle:hover {  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
border: 1px solid #999999;  
}  
.ui-slider-handle-active, .ui-slider-handle-active:hover {  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
border: 1px solid #dddddd;  
}  
.ui-slider-range {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
height: .8em;  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
position: absolute;  
border: 1px solid #d3d3d3;  
border-left: 0;  
border-right: 0;  
top: -1px;  
z-index: 1;  
opacity:.7;  
filter:Alpha(Opacity=70);  
}  
 
 
 
 
 
 
/*dialog*/  
.ui-dialog {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
color: #222222;  
border: 4px solid #dddddd;  
position: relative;  
}  
.ui-resizable-handle {  
position: absolute;  
font-size: 0.1px;  
z-index: 99999;  
}  
.ui-resizable .ui-resizable-handle {  
display: block;  
}  
body .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */  
body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */  
.ui-resizable-n {  
cursor: n-resize;  
height: 7px;  
width: 100%;  
top: -5px;  
left: 0px;  
}  
.ui-resizable-s {  
cursor: s-resize;  
height: 7px;  
width: 100%;  
bottom: -5px;  
left: 0px;  
}  
.ui-resizable-e {  
cursor: e-resize;  
width: 7px;  
right: -5px;  
top: 0px;  
height: 100%;  
}  
.ui-resizable-w {  
cursor: w-resize;  
width: 7px;  
left: -5px;  
top: 0px;  
height: 100%;  
}  
.ui-resizable-se {  
cursor: se-resize;  
width: 18px;  
height: 18px;  
right: -5px;  
bottom: -5px;  
background: url(images/222222_11x11_icon_resize_se.gif) no-repeat 0 0;  
}  
.ui-resizable-sw {  
cursor: sw-resize;  
width: 9px;  
height: 9px;  
left: -5px;  
bottom: -5px;  
}  
.ui-resizable-nw {  
cursor: nw-resize;  
width: 9px;  
height: 9px;  
left: -5px;  
top: -5px;  
}  
.ui-resizable-ne {  
cursor: ne-resize;  
width: 9px;  
height: 9px;  
right: -5px;  
top: -5px;  
}  
.ui-dialog-titlebar {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
padding: .5em 1.5em .5em 1em;  
color: #555555;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
border-bottom: 1px solid #d3d3d3;  
font-size: 1em;  
font-weight: normal;  
position: relative;  
}  
.ui-dialog-title {}  
.ui-dialog-titlebar-close {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
background: url(images/888888_11x11_icon_close.gif) 0 0 no-repeat;  
position: absolute;  
right: 8px;  
top: .7em;  
width: 11px;  
height: 11px;  
z-index: 100;  
}  
.ui-dialog-titlebar-close-hover, .ui-dialog-titlebar-close:hover {  
background: url(images/454545_11x11_icon_close.gif) 0 0 no-repeat;  
}  
.ui-dialog-titlebar-close:active {  
background: url(images/222222_11x11_icon_close.gif) 0 0 no-repeat;  
}  
.ui-dialog-titlebar-close span {  
display: none;  
}  
.ui-dialog-content {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
color: #222222;  
padding: 1.5em 1.7em;  
}  
.ui-dialog-buttonpane {  
position: absolute;  
bottom: 0;  
width: 100%;  
text-align: left;  
border-top: 1px solid #dddddd;  
background: #ffffff;  
}  
.ui-dialog-buttonpane button {  
margin: .5em 0 .5em 8px;  
color: #555555;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
font-size: 1em;  
border: 1px solid #d3d3d3;  
cursor: pointer;  
padding: .2em .6em .3em .6em;  
line-height: 1.4em;  
}  
.ui-dialog-buttonpane button:hover {  
color: #212121;  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
border: 1px solid #999999;  
}  
.ui-dialog-buttonpane button:active {  
color: #222222;  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
border: 1px solid #dddddd;  
}  
/* This file skins dialog */  
.ui-dialog.ui-draggable .ui-dialog-titlebar,  
.ui-dialog.ui-draggable .ui-dialog-titlebar {  
cursor: move;  
}  
 
 
 
 
 
 
 
/*datepicker*/  
/* Main Style Sheet for jQuery UI date picker */  
.ui-datepicker-div, .ui-datepicker-inline, #ui-datepicker-div {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
font-size: 1.1em;  
border: 4px solid #dddddd;  
width: 15.5em;  
padding: 2.5em .5em .5em .5em;  
position: relative;  
}  
.ui-datepicker-div, #ui-datepicker-div {  
z-index: 9999; /*must have*/  
display: none;  
}  
.ui-datepicker-inline {  
float: left;  
display: block;  
}  
.ui-datepicker-control {  
display: none;  
}  
.ui-datepicker-current {  
display: none;  
}  
.ui-datepicker-next, .ui-datepicker-prev {  
position: absolute;  
left: .5em;  
top: .5em;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
}  
.ui-datepicker-next {  
left: 14.6em;  
}  
.ui-datepicker-next:hover, .ui-datepicker-prev:hover {  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
}  
.ui-datepicker-next a, .ui-datepicker-prev a {  
text-indent: -999999px;  
width: 1.3em;  
height: 1.4em;  
display: block;  
font-size: 1em;  
background: url(images/888888_7x7_arrow_left.gif) 50% 50% no-repeat;  
border: 1px solid #d3d3d3;  
cursor: pointer;  
}  
.ui-datepicker-next a {  
background: url(images/888888_7x7_arrow_right.gif) 50% 50% no-repeat;  
}  
.ui-datepicker-prev a:hover {  
background: url(images/454545_7x7_arrow_left.gif) 50% 50% no-repeat;  
}  
.ui-datepicker-next a:hover {  
background: url(images/454545_7x7_arrow_right.gif) 50% 50% no-repeat;  
}  
.ui-datepicker-prev a:active {  
background: url(images/222222_7x7_arrow_left.gif) 50% 50% no-repeat;  
}  
.ui-datepicker-next a:active {  
background: url(images/222222_7x7_arrow_right.gif) 50% 50% no-repeat;  
}  
.ui-datepicker-header select {  
border: 1px solid #d3d3d3;  
color: #555555;  
background: #e6e6e6;  
font-size: 1em;  
line-height: 1.4em;  
position: absolute;  
top: .5em;  
margin: 0 !important;  
}  
.ui-datepicker-header option:focus, .ui-datepicker-header option:hover {  
background: #ffa20a;  
}  
.ui-datepicker-header select.ui-datepicker-new-month {  
width: 7em;  
left: 2.2em;  
}  
.ui-datepicker-header select.ui-datepicker-new-year {  
width: 5em;  
left: 9.4em;  
}  
table.ui-datepicker {  
width: 15.5em;  
text-align: right;  
}  
table.ui-datepicker td a {  
padding: .1em .3em .1em 0;  
display: block;  
color: #555555;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
cursor: pointer;  
border: 1px solid #ffffff;  
text-decoration: none;  
}  
table.ui-datepicker td a:hover {  
border: 1px solid #999999;  
color: #212121;  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
}  
table.ui-datepicker td.ui-datepicker-today a {  
border: 1px solid #d3d3d3;  
}  
table.ui-datepicker td a:active, table.ui-datepicker td.ui-datepicker-current-day a {  
border: 1px solid #dddddd;  
color: #222222;  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
}  
table.ui-datepicker .ui-datepicker-title-row td {  
padding: .3em 0;  
text-align: center;  
font-size: .9em;  
color: #222222;  
text-transform: uppercase;  
}  
table.ui-datepicker .ui-datepicker-title-row td a {  
color: #222222;  
background: none;  
}  
.ui-datepicker-cover {  
display: none;  
display/**/: block;  
position: absolute;  
z-index: -1;  
filter: mask();  
top: -4px;  
left: -4px;  
width: 193px;  
height: 200px;  
}  
 
 
 
 
 
 
/* ui-autocomplete */  
.ui-autocomplete-results {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
z-index: 9999;  
}  
.ui-autocomplete-results ul, .ui-autocomplete-results li {  
margin: 0;  
padding: 0;  
list-style: none;  
}  
.ui-autocomplete-results ul {  
border: 1px solid #d3d3d3;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
color: #222222;  
margin-bottom: -1px;  
}  
.ui-autocomplete-results li {  
padding: .4em .5em;  
color: #555555;  
font-size: 1em;  
font-weight: normal;  
position: relative;  
border-left: 0;  
border-right: 0;  
margin: 1px 0;  
}  
.ui-autocomplete-results li.ui-hover-state, .ui-autocomplete-results li.ui-active-state {  
margin: 0;  
}  
.ui-autocomplete-results li.ui-autocomplete-over {  
border: 1px solid #999999;  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
color: #212121 !important;  
}  
.ui-autocomplete-results li.ui-autocomplete-active {  
border: 1px solid #dddddd;  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
color: #222222 !important;  
outline: none;  
}  
.ui-autocomplete-results li:first-child {  
margin-top: 0;  
}  
.ui-autocomplete-results li:last-child {  
margin-bottom: 0;  
}  
 
 
 
 
 
 
/*UI ProgressBar */  
.ui-progressbar {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
border: 1px solid #dddddd;  
position: relative;  
}  
.ui-progressbar-bar {  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
overflow: visible;  
position: relative;  
border: 1px solid #d3d3d3;  
margin-top: -1px;  
margin-left: -1px;  
margin-bottom: -1px;  
}  
.ui-progressbar-text {  
color: #555555;  
padding: .2em .5em;  
font-weight: normal;  
}  
.ui-progressbar-text-back {  
position: absolute;  
top: 1px;  
left: 0px;  
font-weight: normal;  
color:#000;  
padding-top: 1px;  
padding-bottom: 1px;  
padding-right: 1px;  
}  
.ui-progressbar-disabled {  
opacity:.5;  
filter:Alpha(Opacity=50);  
}  
 
 
 
 
 
 
/*UI Colorpicker */  
.ui-colorpicker {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
border: 4px solid #dddddd;  
padding: 5px;  
width: 360px;  
position: relative;  
}  
.ui-colorpicker-color {  
float: left;  
width: 150px;  
height: 150px;  
margin-right: 15px;  
}  
.ui-colorpicker-color div { /* is this extra div needed? why not just .ui-colorpicker-color ? */  
border: 1px solid #d3d3d3;  
height: 150px;  
background: url(images/_x_.);  
position: relative;  
}  
.ui-colorpicker-color div div {/* shouldn't this have a class like ui-colorpicker-selector ? */  
width: 11px;  
height: 11px;  
background: url(images/_x_.);  
position: absolute;  
border: 0;  
margin: -5px 0 0 -5px;  
float: none;  
}  
.ui-colorpicker-hue {  
border: 1px solid #d3d3d3;  
float: left;  
width: 17px;  
height: 150px;  
background: url(images/_x_.);  
position: relative;  
margin-right: 15px;  
}  
.ui-colorpicker-hue div {  
background:transparent url(images/222222_35x9_colorpicker_indicator.gif.gif); /*this image should be themerollable*/  
height:9px;  
left:-9px;  
margin:-4px 0 0;  
position:absolute;  
width:35px;  
cursor: ns-resize;  
}  
.ui-colorpicker-new-color, .ui-colorpicker-current-color {  
float: left;  
width: 70px;  
height: 30px;  
border: 1px solid #d3d3d3;  
margin-right: 5px;  
}  
.ui-colorpicker-current-color {  
margin-right: 0;  
}  
 
.ui-colorpicker-field, .ui-colorpicker-hex {  
position: absolute;  
width: 70px;  
}  
.ui-colorpicker-field label, .ui-colorpicker-field input,  
.ui-colorpicker-hex label, .ui-colorpicker-hex input {  
font-size: 1em;  
color: #222222;  
}  
.ui-colorpicker-field label, .ui-colorpicker-hex label {  
width: 1em;  
margin-right: .3em;  
}  
.ui-colorpicker-field input, .ui-colorpicker-hex input {  
border: 1px solid #d3d3d3;  
width: 52px;  
}  
.ui-colorpicker-hex input {  
width: 50px;  
}  
.ui-colorpicker-hex {  
left: 205px;  
top: 134px;  
}  
.ui-colorpicker-rgb-r {  
top: 52px;  
left: 205px;  
}  
.ui-colorpicker-rgb-g {  
top: 78px;  
left: 205px;  
}  
.ui-colorpicker-rgb-b {  
top: 105px;  
left: 205px;  
}  
.ui-colorpicker-hsb-h {  
top: 52px;  
left: 290px;  
}  
.ui-colorpicker-hsb-s {  
top: 78px;  
left: 290px;  
}  
.ui-colorpicker-hsb-b {  
top: 105px;  
left: 290px;  
}  
 
.ui-colorpicker-field label {  
font-weight: normal;  
}  
.ui-colorpicker-field span {  
width: 7px;  
background: url(images/888888_11x11_icon_arrows_updown.gif) 50% 50% no-repeat;  
right: 8px;  
top: 0;  
height: 20px;  
position: absolute;  
}  
.ui-colorpicker-field span:hover {  
background: url(images/454545_11x11_icon_arrows_updown.gif) 50% 50% no-repeat;  
}  
 
.ui-colorpicker-submit {  
right: 14px;  
top: 134px;  
position: absolute;  
cursor: pointer;  
}  
 
 
 
 
 
 
 
 
/*  
Generic ThemeRoller Classes  
>> Make your jQuery Components ThemeRoller-Compatible!  
*/  
 
/*component global class*/  
.ui-component {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
font-family: Verdana, Arial, sans-serif;  
font-size: 1.1em;  
}  
/*component content styles*/  
.ui-component-content {  
border: 1px solid #dddddd;  
background: #ffffff url(images/ffffff_40x100_textures_01_flat_0.png) 0 0 repeat-x;  
color: #222222;  
}  
.ui-component-content a {  
color: #222222;  
text-decoration: underline;  
}  
/*component states*/  
.ui-default-state {  
border: 1px solid #d3d3d3;  
background: #e6e6e6 url(images/e6e6e6_40x100_textures_02_glass_75.png) 0 50% repeat-x;  
font-weight: normal;  
color: #555555 !important;  
}  
.ui-default-state a {  
color: #555555;  
}  
.ui-default-state:hover, .ui-hover-state {  
border: 1px solid #999999;  
background: #ffa20a url(images/ffa20a_40x100_textures_05_inset_soft_75.png) 0 50% repeat-x;  
font-weight: normal;  
color: #212121 !important;  
}  
.ui-hover-state a {  
color: #212121;  
}  
.ui-default-state:active, .ui-active-state {  
border: 1px solid #dddddd;  
background: #ffffff url(images/ffffff_40x100_textures_02_glass_65.png) 0 50% repeat-x;  
font-weight: normal;  
color: #222222 !important;  
outline: none;  
}  
.ui-active-state a {  
color: #222222;  
outline: none;  
}  
/*icons*/  
.ui-arrow-right-default {background: url(images/888888_7x7_arrow_right.gif) no-repeat 50% 50%;}  
.ui-arrow-right-default:hover, .ui-arrow-right-hover {background: url(images/454545_7x7_arrow_right.gif) no-repeat 50% 50%;}  
.ui-arrow-right-default:active, .ui-arrow-right-active {background: url(images/222222_7x7_arrow_right.gif) no-repeat 50% 50%;}  
.ui-arrow-right-content {background: url(images/222222_7x7_arrow_right.gif) no-repeat 50% 50%;}  
 
.ui-arrow-left-default {background: url(images/888888_7x7_arrow_left.gif) no-repeat 50% 50%;}  
.ui-arrow-left-default:hover, .ui-arrow-left-hover {background: url(images/454545_7x7_arrow_left.gif) no-repeat 50% 50%;}  
.ui-arrow-left-default:active, .ui-arrow-left-active {background: url(images/222222_7x7_arrow_left.gif) no-repeat 50% 50%;}  
.ui-arrow-left-content {background: url(images/222222_7x7_arrow_left.gif) no-repeat 50% 50%;}  
 
.ui-arrow-down-default {background: url(images/888888_7x7_arrow_down.gif) no-repeat 50% 50%;}  
.ui-arrow-down-default:hover, .ui-arrow-down-hover {background: url(images/454545_7x7_arrow_down.gif) no-repeat 50% 50%;}  
.ui-arrow-down-default:active, .ui-arrow-down-active {background: url(images/222222_7x7_arrow_down.gif) no-repeat 50% 50%;}  
.ui-arrow-down-content {background: url(images/222222_7x7_arrow_down.gif) no-repeat 50% 50%;}  
 
.ui-arrow-up-default {background: url(images/888888_7x7_arrow_up.gif) no-repeat 50% 50%;}  
.ui-arrow-up-default:hover, .ui-arrow-up-hover {background: url(images/454545_7x7_arrow_up.gif) no-repeat 50% 50%;}  
.ui-arrow-up-default:active, .ui-arrow-up-active {background: url(images/222222_7x7_arrow_up.gif) no-repeat 50% 50%;}  
.ui-arrow-up-content {background: url(images/222222_7x7_arrow_up.gif) no-repeat 50% 50%;}  
 
.ui-close-default {background: url(images/888888_11x11_icon_close.gif) no-repeat 50% 50%;}  
.ui-close-default:hover, .ui-close-hover {background: url(images/454545_11x11_icon_close.gif) no-repeat 50% 50%;}  
.ui-close-default:active, .ui-close-active {background: url(images/222222_11x11_icon_close.gif) no-repeat 50% 50%;}  
.ui-close-content {background: url(images/222222_11x11_icon_close.gif) no-repeat 50% 50%;}  
 
.ui-folder-closed-default {background: url(images/888888_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}  
.ui-folder-closed-default:hover, .ui-folder-closed-hover {background: url(images/454545_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}  
.ui-folder-closed-default:active, .ui-folder-closed-active {background: url(images/222222_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}  
.ui-folder-closed-content {background: url(images/888888_11x11_icon_folder_closed.gif) no-repeat 50% 50%;}  
 
.ui-folder-open-default {background: url(images/888888_11x11_icon_folder_open.gif) no-repeat 50% 50%;}  
.ui-folder-open-default:hover, .ui-folder-open-hover {background: url(images/454545_11x11_icon_folder_open.gif) no-repeat 50% 50%;}  
.ui-folder-open-default:active, .ui-folder-open-active {background: url(images/222222_11x11_icon_folder_open.gif) no-repeat 50% 50%;}  
.ui-folder-open-content {background: url(images/222222_11x11_icon_folder_open.gif) no-repeat 50% 50%;}  
 
.ui-doc-default {background: url(images/888888_11x11_icon_doc.gif) no-repeat 50% 50%;}  
.ui-doc-default:hover, .ui-doc-hover {background: url(images/454545_11x11_icon_doc.gif) no-repeat 50% 50%;}  
.ui-doc-default:active, .ui-doc-active {background: url(images/222222_11x11_icon_doc.gif) no-repeat 50% 50%;}  
.ui-doc-content {background: url(images/222222_11x11_icon_doc.gif) no-repeat 50% 50%;}  
 
.ui-arrows-leftright-default {background: url(images/888888_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}  
.ui-arrows-leftright-default:hover, .ui-arrows-leftright-hover {background: url(images/454545_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}  
.ui-arrows-leftright-default:active, .ui-arrows-leftright-active {background: url(images/222222_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}  
.ui-arrows-leftright-content {background: url(images/222222_11x11_icon_arrows_leftright.gif) no-repeat 50% 50%;}  
 
.ui-arrows-updown-default {background: url(images/888888_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}  
.ui-arrows-updown-default:hover, .ui-arrows-updown-hover {background: url(images/454545_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}  
.ui-arrows-updown-default:active, .ui-arrows-updown-active {background: url(images/222222_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}  
.ui-arrows-updown-content {background: url(images/222222_11x11_icon_arrows_updown.gif) no-repeat 50% 50%;}  
 
.ui-minus-default {background: url(images/888888_11x11_icon_minus.gif) no-repeat 50% 50%;}  
.ui-minus-default:hover, .ui-minus-hover {background: url(images/454545_11x11_icon_minus.gif) no-repeat 50% 50%;}  
.ui-minus-default:active, .ui-minus-active {background: url(images/222222_11x11_icon_minus.gif) no-repeat 50% 50%;}  
.ui-minus-content {background: url(images/222222_11x11_icon_minus.gif) no-repeat 50% 50%;}  
 
.ui-plus-default {background: url(images/888888_11x11_icon_plus.gif) no-repeat 50% 50%;}  
.ui-plus-default:hover, .ui-plus-hover {background: url(images/454545_11x11_icon_plus.gif) no-repeat 50% 50%;}  
.ui-plus-default:active, .ui-plus-active {background: url(images/222222_11x11_icon_plus.gif) no-repeat 50% 50%;}  
.ui-plus-content {background: url(images/222222_11x11_icon_plus.gif) no-repeat 50% 50%;}  
 
/*hidden elements*/  
.ui-hidden {  
display: none/*for accessible hiding: position: absolute; left: -99999999px;*/;  
}  
.ui-accessible-hidden {  
position: absolute; left: -99999999px;  
}  
/*reset styles*/  
.ui-reset {  
/*resets*/margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none;  
}  
/*clearfix class*/  
.ui-clearfix:after {  
content: ".";  
display: block;  
height: 0;  
clear: both;  
visibility: hidden;  
}  
.ui-clearfix {display: inline-block;}  
/* Hides from IE-mac \*/  
* html .ui-clearfix {height: 1%;}  
.ui-clearfix {display: block;}  
/* End hide from IE-mac */  
 
/* Note: for resizable styles, use the styles listed above in the dialog section */  
 
 
 
 
 
 
 
 
 
 
 
 
 
div.jGrowl {  
padding: 10px;  
z-index: 9999;  
}  
 
/** Special IE6 Style Positioning **/  
div.ie6 {  
position: absolute;  
}  
 
div.ie6.top-right {  
right: auto;  
bottom: auto;  
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );  
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );  
}  
 
div.ie6.top-left {  
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );  
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );  
}  
 
div.ie6.bottom-right {  
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );  
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );  
}  
 
div.ie6.bottom-left {  
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );  
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );  
}  
 
div.ie6.center {  
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );  
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );  
width: 100%;  
}  
 
/** Normal Style Positions **/  
body > div.jGrowl {  
position: fixed;  
}  
 
body > div.jGrowl.top-left {  
left: 0px;  
top: 0px;  
}  
 
body > div.jGrowl.top-right {  
right: 0px;  
top: 0px;  
}  
 
body > div.jGrowl.bottom-left {  
left: 0px;  
bottom: 0px;  
}  
 
body > div.jGrowl.bottom-right {  
right: 0px;  
bottom: 0px;  
}  
 
body > div.jGrowl.center {  
top: 0px;  
width: 50%;  
left: 25%;  
}  
 
/** Cross Browser Styling **/  
div.center div.jGrowl-notification, div.center div.jGrowl-closer {  
margin-left: auto;  
margin-right: auto;  
}  
 
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {  
background-color: #000;  
color: #fff;  
opacity: .85;  
filter: alpha(opacity = 85);  
zoom: 1;  
width: 235px;  
padding: 10px;  
margin-top: 5px;  
margin-bottom: 5px;  
font-family: Tahoma, Arial, Helvetica, sans-serif;  
font-size: 12px;  
text-align: left;  
display: none;  
-moz-border-radius: 5px;  
-webkit-border-radius: 5px;  
}  
 
div.jGrowl div.jGrowl-notification {  
min-height: 40px;  
}  
 
div.jGrowl div.jGrowl-notification div.header {  
font-weight: bold;  
font-size: 10px;  
}  
 
div.jGrowl div.jGrowl-notification div.close {  
z-index: 99;  
float: right;  
font-weight: bold;  
font-size: 12px;  
cursor: pointer;  
}  
 
div.jGrowl div.jGrowl-closer {  
height: 15px;  
padding-top: 4px;  
padding-bottom: 4px;  
cursor: pointer;  
font-size: 11px;  
font-weight: bold;  
text-align: center;  
}  
 
/** Hide jGrowl when printing **/  
@media print {  
div.jGrowl {  
display: none;  
}  
}  
.owa {background-color: #fffff;}  
 
/* management table */  
.owa table.management {  
border:1px solid #9f9f9f;  
border-spacing: 0px;  
width: 100%;  
 
}  
 
.owa table.management th{  
background-color: #efefef;  
min-width: 200px;  
border-bottom:1px solid #cecece;  
border-right:1px solid #cecece;  
}  
 
.owa table.management td{  
background-color: #ffffff;  
font-size: 12px;  
padding: 7px 7px 7px 7px;  
border:0px;  
}  
.owa .genericHorizontalList {}  
.owa .genericHorizontalList ul {list-style: none; padding: 0; margin: 0;float:left;padding-top:0px;}  
.owa .genericHorizontalList li {text-decoration: none; float:left; margin: 0px; padding:0px 5px 0px 5px;}  
.owa .genericHorizontalList li a {  
 
height:;  
line-height:;  
float: left;  
width: ;  
display: block;  
text-decoration: none;  
text-align: center;  
}  
 
.owa .genericHorizontalList li a:hover {  
 
border-bottom: 2px solid orange;  
}  
 
.owa .user-greating {  
 
color: #9f9f9f;  
font-weight: normal;  
float:right;  
vertical-align:middle;  
}  
 
.owa a.login {  
font-size: 12px;  
text-decoration: none;  
}  
#owa_overlay {  
position: fixed;  
top:10px;  
right:0px;  
padding:3px;  
margin: 0px;  
background-color:#ffffff;  
border: 2px solid orange;  
border-right:0px;  
opacity: 1;  
z-index: 100;  
width:auto;  
vertical-align: bottom;  
font-family: sans-serif;  
font-size: 14px;  
}  
 
 
#owa_overlay_logo {background-image:url('../i/owa_logo_72w.jpg'); width:62px;height:35px; float:left; padding-right:10px; margin-right:5px;}  
.owa_overlay_control {vertical-align:middle; height:auto; float:left; padding:0 10px 0 10px; border-left:1px solid #9f9f9f; font-weight: bold; color: #9f9f9f; font-family: sans-serif;}  
.active {color: #FF8C00;}  
div.owa_overlay_control:hover {  
color:#FF8C00;  
}  
 
div.jGrowl div.jGrowl-notification {  
font-size: 24px;  
}  
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-notification div.close {  
background-color:#303030;  
opacity: 0.7;  
}  
 
div.jGrowl div.jGrowl-notification div.header {  
font-size: 16px;  
}  
 
body > div.jGrowl.center {  
top: 0px;  
width: 50%;  
left: 25%;  
}  
 
#owa-latest-click {  
background-color: red;  
padding: 5px;  
color: white;  
display: none;  
font-size: 10px;  
font-weight: bold;  
position: absolute;  
}  
 
.owa-click-marker {  
background-color: red;  
width:5px;  
height:5px;  
 
}  
 
#owa-cursor {  
position:absolute;  
z-index:99;  
}  
 
#owa-overlay-status {  
font-size:10px;  
color: #9f9f9f;  
margin-top:5px;  
padding:6px;  
font-family: sans-serif;  
}  
 
#owa_overlay_hidden {  
position:fixed;  
top:10px;  
right:0px;  
background-image:url('../i/owa_logo_72w.jpg'); width:70px;height:35px;  
border: 2px solid orange;  
border-right:0px;  
}  
/* REPORT CSS */  
 
ul {margin-left:10px;}  
.owa {font-family: Helvetica, Arial, sans-serif; width:auto;}  
#report_header {width:100%; margin: 0 0 20px 0; }  
 
.owa_reportTitle, .report_headline {  
font-size:26px;  
padding:5px 5px 5px 0px;  
font-weight:bold;  
color:#505050;  
margin-bottom:20px;  
}  
 
.titleSuffix {  
 
font-weight: normal;  
font-size: 20px;  
}  
 
.owa_reportContainer {width:auto; background-color: ; height:;}  
.owa_reportElement {width:100%; text-align:center; vertical-align: top;}  
.owa_reportSectionHeader, .section_header {  
width:auto;  
padding-top:5px;  
padding-bottom:10px;  
margin: 10px 0 10px 0;  
font-size: 18px;  
font-weight: ;  
color: #666666;  
border-top: 4px solid #cccccc;  
}  
 
.owa_reportHeadline {  
font-weight:bold;  
font-family: Helvetica, Arial, sans-serif;  
font-size:20px;  
margin: 10px 0 10px 0;  
color: #505050;  
}  
 
.reportSectionContainer {  
margin: 10px;  
padding:7px 7px 7px 7px;  
background-color: #ffffff;  
-moz-border-radius:5px 5px 5px 5px;  
-moz-box-shadow:2px 2px 2px 1px #9f9f9f;  
border-radius:5px 5px 5px 5px;  
box-shadow:2px 2px 2px 1px #9f9f9f;  
-webkit-border-radius:5px 5px 5px 5px;  
-webkit-box-shadow:2px 2px 2px 1px #9f9f9f;  
 
}  
 
.owa_reportSectionContent {  
margin: 0 10px 0 10px;  
padding:0px 7px 7px 0px;  
background-color: #ffffff;  
width:auto;  
}  
 
#owa_reportHeader {  
color:#505050; background-color:#cccccc;  
}  
 
.ui-jqgrid tr.jqgrow td {  
font-size:10px;  
}  
 
.ui-jqgrid .ui-jqgrid-htable th.ui-th-column {  
font-size:10px;  
}  
 
.clear {  
float:none;  
clear:both;  
}  
 
.owa_reportSubSectionLabel {  
color: #666666;  
border-top:2px solid #cccccc;  
font-size: 12px;  
padding-left:2px;  
width:80%;  
}  
 
.owa .moreLink, .owa_moreLinks {  
 
text-align:left;  
margin-top:6px;  
padding:2px;  
 
 
}  
 
.owa_moreLinks li {  
border-bottom:0px solid #cccccc;  
text-align: right;  
padding: 0px 0px 0px 0px;  
list-style-type: none;  
 
}  
.owa_moreLinks a:hover, .owa .moreLink a:hover {  
border-bottom:2px solid orange;  
}  
 
.owa_moreLinks li a, .owa_moreLinks a, .owa .moreLink a {  
border:0px solid #ffffff;  
font-size:10px;  
text-decoration: none;  
padding-left:0px;  
}  
 
.data_table {border-collapse: collapse;margin:0;width:100%;}  
.data_table td {border:2px solid #CCCCCC; min-width:80px;padding:10px;}  
.col_item_label {background-color:#CCCCCC; font-weight:bold; border-bottom: 2px solid #999999;}  
.col_label {background-color:#CCCCCC; font-weight:bold; border-bottom: 2px solid #999999; text-align:center;}  
.data_cell {text-align:center; vertical-align:center;}  
.item_cell {}  
 
.owa_reportHeaderControls {background-color:#ffffff; border-bottom: 1px solid #a0a0a0;height:60px;margin-bottom:20px;}  
 
.owa_reportHeaderControls li {  
 
border-right: 1px solid #efefef;  
padding: 30px;  
}  
 
.owa_reportControl {  
 
border: 1px solid #cccccc;  
background-color: #ffffff;  
height: 30px;  
padding:5px;  
}  
 
#owa_reportSiteFilter {text-align:;}  
#owa_reportSiteFilterSelect {font-size: 12px;}  
#owa_reportSiteFilterSelect span {font-size: 18px; font-weight: bold; vertical-align: baseline;}  
 
.owa_reportRevealControl, .owa_reportHideControl {width: 15px; background-color: #efefef; text-align: center;}  
.owa_reportRevealControl {background-image: url(../i/15px-TriangleArrow-Down.png); background-repeat: no-repeat; background-position: center;}  
.owa_reportHideControl {background-image: url(../i/15px-TriangleArrow-up.png.gif); background-repeat: no-repeat; background-position: center;}  
.owa_reportPeriod {text-align: right;}  
#owa_reportPeriodControl table {border: 1px solid #cccccc; padding: 0px; border-collapse: collapse;}  
 
 
#owa_reportPeriodFiltersContainer {background-color: #efefef; width:100%;}  
#owa_reportPeriodFiltersContainer table {width:100%;}  
#owa_reportPeriodFiltersContainer td, th {padding:7px; text-align: left;}  
 
#owa_reportPeriodLabelContainer {border: 1px solid #cccccc; padding: 0px; width:100%;}  
.owa_reportPeriodLabelText {padding:5px; font-size:14px; color:#999999; text-align: center;}  
 
#owa_reportNavPanel {width:150px;}  
#report_top_level_nav_ul {width:;}  
 
.owa_reportLeftNavColumn {width:150px; margin-right:0px; border-right: 0px solid orange; padding: 5px 5px 5px 5px;}  
.owa_reportLeftNavColumn a {  
text-decoration: none;  
color:;  
 
}  
 
.owa_visitSummaryInfobox {border: 1px solid #cccccc; border-left: 5px solid orange; text-align: left; padding:5px; margin-bottom:5px;}  
 
.owa_metricInfobox {  
color:#505050;  
background-color: #ffffff;  
text-align: left;  
border: 1px solid #cccccc;  
padding:0px;  
margin:3px;  
min-width:110px;  
width:100%;  
float:left;  
 
}  
 
.owa_metricInfobox p,span {  
padding:0px 7px 0px 7px;  
margin:0px;  
 
}  
 
p.owa_metricInfoboxLabel, span.owa_metricInfoboxLabel {  
color:#666666;  
font-size:12px;  
padding-top:6px;  
margin-bottom:0px;  
}  
 
p.owa_metricInfoboxLargeNumber, span.owa_metricInfoboxLargeNumber {  
color:#505050;  
font-size:28px;  
padding-bottom: 0px;  
font-family: "Helvetica";  
margin-top:5px;  
font-weight: bold;  
line-height: normal;  
}  
 
.owa_infobox {width:auto; padding:10px; border:1px solid #efefef; border-left:5px solid orange;}  
 
.owa_admin_nav ul {list-style:none; margin:0px; padding:0px; }  
.owa_admin_nav li {list-style:none; margin:0px; padding:3px 3px 3px 3px;font-size:10px;}  
.owa_admin_nav_topmenu {  
padding:0px;  
border:1px solid #cccccc;  
background-color:#ffffff;  
-moz-border-radius: 5px 5px;  
}  
 
.owa_admin_nav_subgroup_item {  
padding:3px 3px 3px 10px;  
}  
.owa_admin_nav_topmenu_container {background-color: #efefef;}  
.owa_admin_nav_topmenu_item {border-bottom: 1px solid #cccccc;background-color: #efefef;padding:0px;height:20px; vertical-align: middle; font-weight: bold; font-size:12px; }  
.owa_admin_nav_topmenu_toggle {border-left:1px solid #cfcfcf;width:25px;height:20px;float:right;background-image: url(../i/15px-TriangleArrow-Down.png); background-repeat: no-repeat; background-position: center;}  
/*  
.owa_document {  
border: 1px solid #efefef;  
padding: 13px 10px 10px 63px;  
}  
 
.owa_document div {  
padding:2px;  
}  
 
.owa_document .title {  
font-size:22px;  
}  
 
.owa_document .url, .owa .refererDetailPanel .url {  
font-size:14px;  
color: #0E774A;  
padding-bottom:5px;  
}  
 
.owa_document .pagetype {  
font-size:12px;  
}  
*/  
.owa_visitInfobox {  
color:#9f9f9f;  
background-color: #505050;  
border:1px solid #cccccc;  
text-align: left;  
padding:5px;  
margin:5px;  
width:350px;  
border-collapse: collapse;  
padding:0;  
margin:0;  
 
}  
 
.owa_visitInfoboxItemContainer, .owa_visitInfoboxItem {  
background-color: #ffffff;  
border: 0px solid #A0A0A0;  
border-collapse: collapse;  
}  
 
.owa_visitInfoboxItem {  
width: 50px;  
}  
 
.owa_visitInfoboxItem {  
text-align:center;  
border-left: 1px solid #efefef;  
border-right: 1px solid #efefef;  
}  
 
.owa_visitInfoboxTitle {  
color:#A0A0A0;  
padding:6px;  
font-size:12px;  
margin:0px;  
}  
 
.owa_userInfobox {  
background-color: #ffffff;  
}  
 
.owa_avatar {  
height: 30px;  
width: 30px;  
border: 1px solid #efefef;  
padding: 2px;  
 
}  
 
.owa_userLabel {  
width:100px;  
height:50px;  
}  
 
.owa_userNameLabel {  
font-size: 14px;  
 
}  
 
.owa_userGeoLabel {  
font-size: 10px;  
line-height: 13px;  
}  
 
.owa_largeNumber {  
color:#505050;  
font-size:20px;  
}  
 
.owa_visitInfoboxDocContainer {  
background-color: #efefef;  
border: 1px solid #E0E0E0;  
border-collapse: collapse;  
width:100%;  
font-size: 10px;  
}  
 
.owa_icon16x16 {  
width:auto;  
padding:3px;  
}  
 
.owa_secondaryText {  
font-size: 10px;  
color:#505050;  
}  
 
/* keep this */  
.owa_genericHorizontalList ul {list-style: none; padding: 0; margin: 0;float:left;padding-top:5px;}  
.owa_genericHorizontalList li {text-decoration: none; float:left; margin: 2px; padding:3px;}  
.owa_genericHorizontalList li a {  
 
height:;  
line-height:;  
float: left;  
width: ;  
display: block;  
text-decoration: none;  
text-align: center;  
}  
 
.owa .relatedReports li {  
padding-bottom: 10px;  
}  
 
.owa_resultsExplorerBottomControls {  
background-color: #9f9f9f;  
 
}  
 
.owa_resultsExplorerBottomControls li a {  
border: 1px solid #efefef;  
}  
 
 
 
.owa_resultsExplorerBottomControls ul {  
 
float:right;  
 
}  
.owa_rowCount {  
 
font-size:12px;  
color: #9f9f9f;  
margin-right:30px;  
}  
 
.owa_nextPageControl:hover, .owa_previousPageControl:hover{  
color: orange;  
padding:;  
border: 1px solid orange;  
}  
 
.owa_nextPageControl, .owa_previousPageControl {  
background-color: #efefef;  
border: 1px solid #505050;  
color: #505050;  
padding:5px;  
font-size: 12px;  
}  
 
.owa_metricGridCell {  
padding-right: 20px;  
}  
 
.owa_dimensionGridCell td {  
padding-left: 30px;  
}  
 
.owa_dimensionGridCell a {  
text-decoration: none;  
color: blue;  
}  
 
.owa_dimensionGridCell a:hover{  
text-decoration: underline;  
color: blue;  
}  
 
.simpleTable {  
font-size:12px;  
width:100%;  
}  
 
.simpleTable th {  
background-color: #efefef;  
border-bottom: 1px solid #cccccc;  
border-right: 1px solid #cccccc;  
padding: 4px 5px 4px 5px;  
}  
 
.simpleTable td {  
padding:3px 5px 3px 5px;  
font-size:10px;  
 
}  
 
.metriccell {  
text-align:right;  
width:100px;  
}  
 
.owa_dimensionDetail {  
border: 1px solid #cccccc;  
width:inherit;  
height:auto;  
padding:10px;  
}  
 
.owa_dimensionDetail .title {  
 
font-size:22px;  
padding-bottom: 7px;  
}  
 
.owa_dimensionDetail .url {  
 
font-size:14px;  
color: #0E774A;  
padding-bottom:5px;  
}  
 
.owa_dimensionDetail .icon {  
 
padding-right:10px;  
}  
 
.owa .refererDetailPanel {  
 
height:auto;  
}  
 
.owa .refererDetailPanel .snippet {  
font-size:10px;  
color: #9f9f9f;  
 
}  
 
.owa .ui-widget {  
font-size: 12px;  
}  
 
.owa .ui-tabs-nav {  
font-size:14px;  
}  
 
.owa .funnel {  
padding: 0px;  
margin: 0px;  
}  
 
.owa .funnel td {  
 
padding: 10px;  
}  
 
.owa .funnel .funnelMiddle {  
 
text-align: center;  
}  
 
.owa .funnel .funnelLargeNumber {  
 
font-size:20px;  
font-weight: bold;  
padding-bottom:10px;  
}  
 
.owa .funnel .funnelStepName {  
 
font-size:18px;  
font-weight: bold;  
color:;  
padding-bottom:5px;  
}  
 
.owa .funnel .funnelStepUrl {  
 
font-size:12px;  
font-weight:;  
color: #707070;  
padding-bottom:5px;  
}  
 
.owa .funnel .funnelStepCount {  
 
font-size:26px;  
font-weight: bold;  
color:;  
padding:10px 0px 10px 0px;  
}  
 
.owa .funnel span.visitorCountLabel {  
 
vertical-align:middle;  
font-size:12px;  
font-weight:normal;  
color: #9f9f9f;  
}  
 
.owa .funnel .funnelStep {  
 
background-color: #D6F5FF;  
padding: 15px;  
}  
 
.owa .funnel .funnelFlow {  
background-image: url('../i/funnel_flow.png');  
height: 150px;  
background-repeat: no-repeat;  
background-position: center;  
}  
 
.owa .funnel .funnelFlow {  
background-image: url('../i/funnel_flow.png');  
height: 150px;  
background-repeat: no-repeat;  
background-position: center;  
}  
 
.owa .funnel .entranceCount {  
 
padding: 0px 30px 0px 0px;  
margin-bottom: 10px;  
background-image: url('../i/funnel_entrance_arrow.png');  
height: 27px;  
font-size: 26px;  
background-repeat: no-repeat;  
background-position: right;  
 
}  
 
.owa .funnel .exitCount {  
 
padding: 0px 0px 0px 30px;  
margin-bottom: 10px;  
background-image: url('../i/funnel_exit_arrow.png');  
height: 27px;  
font-size: 26px;  
background-repeat: no-repeat;  
background-position: left;  
}  
 
.owa .secondaryText {  
 
font-size:14px;  
color: #9f9f9f;  
}  
/* OWA Widget CSS Declarations */  
 
.owa_widget-container {border:1px solid #cccccc; width:auto; margin:0px;}  
.owa_widget-header {color: white;background-color:orange; padding:2px;text-align:left; width:;}  
.owa_widget-title {font-size:16px;text-align:right;font-weight:bold;}  
.owa_widget-title a {color: white;}  
.owa_widget-title-controls {font-size:14px;text-align:right;}  
.owa_widget-controls {text-align:right;padding:0 10px 5px 10px}  
.owa_widget-content {padding:5px; width:auto;}  
.owa_widget-pagination {padding:0 10px 0 10px; visibility: ;}  
.owa_widget-innercontainer {width:100%;margin:0px;}  
.owa_ofcChart {width:100%; margin:0px;padding:0px;}  
#flashcontent {margin: 0; width:;}  
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-icons_222222_256x240.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-icons_2e83ff_256x240.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-icons_454545_256x240.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-icons_888888_256x240.png and /dev/null differ
 Binary files a/busui/owa/modules/base/css/smoothness/images/ui-icons_cd0a0a_256x240.png and /dev/null differ
/*  
* jQuery UI CSS Framework  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.  
*/  
 
/* Layout helpers  
----------------------------------*/  
.ui-helper-hidden { display: none; }  
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }  
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }  
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }  
.ui-helper-clearfix { display: inline-block; }  
/* required comment for clearfix to work in Opera \*/  
* html .ui-helper-clearfix { height:1%; }  
.ui-helper-clearfix { display:block; }  
/* end clearfix */  
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }  
 
 
/* Interaction Cues  
----------------------------------*/  
.ui-state-disabled { cursor: default !important; }  
 
 
/* Icons  
----------------------------------*/  
 
/* states and images */  
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }  
 
 
/* Misc visuals  
----------------------------------*/  
 
/* Overlays */  
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }  
 
 
/*  
* jQuery UI CSS Framework  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.  
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px  
*/  
 
 
/* Component containers  
----------------------------------*/  
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }  
.ui-widget .ui-widget { font-size: 1em; }  
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }  
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }  
.ui-widget-content a { color: #222222; }  
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }  
.ui-widget-header a { color: #222222; }  
 
/* Interaction states  
----------------------------------*/  
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }  
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }  
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }  
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }  
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }  
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }  
.ui-widget :active { outline: none; }  
 
/* Interaction Cues  
----------------------------------*/  
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }  
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }  
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }  
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }  
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }  
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }  
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }  
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }  
 
/* Icons  
----------------------------------*/  
 
/* states and images */  
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }  
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }  
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }  
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }  
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }  
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }  
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }  
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }  
 
/* positioning */  
.ui-icon-carat-1-n { background-position: 0 0; }  
.ui-icon-carat-1-ne { background-position: -16px 0; }  
.ui-icon-carat-1-e { background-position: -32px 0; }  
.ui-icon-carat-1-se { background-position: -48px 0; }  
.ui-icon-carat-1-s { background-position: -64px 0; }  
.ui-icon-carat-1-sw { background-position: -80px 0; }  
.ui-icon-carat-1-w { background-position: -96px 0; }  
.ui-icon-carat-1-nw { background-position: -112px 0; }  
.ui-icon-carat-2-n-s { background-position: -128px 0; }  
.ui-icon-carat-2-e-w { background-position: -144px 0; }  
.ui-icon-triangle-1-n { background-position: 0 -16px; }  
.ui-icon-triangle-1-ne { background-position: -16px -16px; }  
.ui-icon-triangle-1-e { background-position: -32px -16px; }  
.ui-icon-triangle-1-se { background-position: -48px -16px; }  
.ui-icon-triangle-1-s { background-position: -64px -16px; }  
.ui-icon-triangle-1-sw { background-position: -80px -16px; }  
.ui-icon-triangle-1-w { background-position: -96px -16px; }  
.ui-icon-triangle-1-nw { background-position: -112px -16px; }  
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }  
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }  
.ui-icon-arrow-1-n { background-position: 0 -32px; }  
.ui-icon-arrow-1-ne { background-position: -16px -32px; }  
.ui-icon-arrow-1-e { background-position: -32px -32px; }  
.ui-icon-arrow-1-se { background-position: -48px -32px; }  
.ui-icon-arrow-1-s { background-position: -64px -32px; }  
.ui-icon-arrow-1-sw { background-position: -80px -32px; }  
.ui-icon-arrow-1-w { background-position: -96px -32px; }  
.ui-icon-arrow-1-nw { background-position: -112px -32px; }  
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }  
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }  
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }  
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }  
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }  
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }  
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }  
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }  
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }  
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }  
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }  
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }  
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }  
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }  
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }  
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }  
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }  
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }  
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }  
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }  
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }  
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }  
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }  
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }  
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }  
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }  
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }  
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }  
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }  
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }  
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }  
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }  
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }  
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }  
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }  
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }  
.ui-icon-arrow-4 { background-position: 0 -80px; }  
.ui-icon-arrow-4-diag { background-position: -16px -80px; }  
.ui-icon-extlink { background-position: -32px -80px; }  
.ui-icon-newwin { background-position: -48px -80px; }  
.ui-icon-refresh { background-position: -64px -80px; }  
.ui-icon-shuffle { background-position: -80px -80px; }  
.ui-icon-transfer-e-w { background-position: -96px -80px; }  
.ui-icon-transferthick-e-w { background-position: -112px -80px; }  
.ui-icon-folder-collapsed { background-position: 0 -96px; }  
.ui-icon-folder-open { background-position: -16px -96px; }  
.ui-icon-document { background-position: -32px -96px; }  
.ui-icon-document-b { background-position: -48px -96px; }  
.ui-icon-note { background-position: -64px -96px; }  
.ui-icon-mail-closed { background-position: -80px -96px; }  
.ui-icon-mail-open { background-position: -96px -96px; }  
.ui-icon-suitcase { background-position: -112px -96px; }  
.ui-icon-comment { background-position: -128px -96px; }  
.ui-icon-person { background-position: -144px -96px; }  
.ui-icon-print { background-position: -160px -96px; }  
.ui-icon-trash { background-position: -176px -96px; }  
.ui-icon-locked { background-position: -192px -96px; }  
.ui-icon-unlocked { background-position: -208px -96px; }  
.ui-icon-bookmark { background-position: -224px -96px; }  
.ui-icon-tag { background-position: -240px -96px; }  
.ui-icon-home { background-position: 0 -112px; }  
.ui-icon-flag { background-position: -16px -112px; }  
.ui-icon-calendar { background-position: -32px -112px; }  
.ui-icon-cart { background-position: -48px -112px; }  
.ui-icon-pencil { background-position: -64px -112px; }  
.ui-icon-clock { background-position: -80px -112px; }  
.ui-icon-disk { background-position: -96px -112px; }  
.ui-icon-calculator { background-position: -112px -112px; }  
.ui-icon-zoomin { background-position: -128px -112px; }  
.ui-icon-zoomout { background-position: -144px -112px; }  
.ui-icon-search { background-position: -160px -112px; }  
.ui-icon-wrench { background-position: -176px -112px; }  
.ui-icon-gear { background-position: -192px -112px; }  
.ui-icon-heart { background-position: -208px -112px; }  
.ui-icon-star { background-position: -224px -112px; }  
.ui-icon-link { background-position: -240px -112px; }  
.ui-icon-cancel { background-position: 0 -128px; }  
.ui-icon-plus { background-position: -16px -128px; }  
.ui-icon-plusthick { background-position: -32px -128px; }  
.ui-icon-minus { background-position: -48px -128px; }  
.ui-icon-minusthick { background-position: -64px -128px; }  
.ui-icon-close { background-position: -80px -128px; }  
.ui-icon-closethick { background-position: -96px -128px; }  
.ui-icon-key { background-position: -112px -128px; }  
.ui-icon-lightbulb { background-position: -128px -128px; }  
.ui-icon-scissors { background-position: -144px -128px; }  
.ui-icon-clipboard { background-position: -160px -128px; }  
.ui-icon-copy { background-position: -176px -128px; }  
.ui-icon-contact { background-position: -192px -128px; }  
.ui-icon-image { background-position: -208px -128px; }  
.ui-icon-video { background-position: -224px -128px; }  
.ui-icon-script { background-position: -240px -128px; }  
.ui-icon-alert { background-position: 0 -144px; }  
.ui-icon-info { background-position: -16px -144px; }  
.ui-icon-notice { background-position: -32px -144px; }  
.ui-icon-help { background-position: -48px -144px; }  
.ui-icon-check { background-position: -64px -144px; }  
.ui-icon-bullet { background-position: -80px -144px; }  
.ui-icon-radio-off { background-position: -96px -144px; }  
.ui-icon-radio-on { background-position: -112px -144px; }  
.ui-icon-pin-w { background-position: -128px -144px; }  
.ui-icon-pin-s { background-position: -144px -144px; }  
.ui-icon-play { background-position: 0 -160px; }  
.ui-icon-pause { background-position: -16px -160px; }  
.ui-icon-seek-next { background-position: -32px -160px; }  
.ui-icon-seek-prev { background-position: -48px -160px; }  
.ui-icon-seek-end { background-position: -64px -160px; }  
.ui-icon-seek-start { background-position: -80px -160px; }  
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */  
.ui-icon-seek-first { background-position: -80px -160px; }  
.ui-icon-stop { background-position: -96px -160px; }  
.ui-icon-eject { background-position: -112px -160px; }  
.ui-icon-volume-off { background-position: -128px -160px; }  
.ui-icon-volume-on { background-position: -144px -160px; }  
.ui-icon-power { background-position: 0 -176px; }  
.ui-icon-signal-diag { background-position: -16px -176px; }  
.ui-icon-signal { background-position: -32px -176px; }  
.ui-icon-battery-0 { background-position: -48px -176px; }  
.ui-icon-battery-1 { background-position: -64px -176px; }  
.ui-icon-battery-2 { background-position: -80px -176px; }  
.ui-icon-battery-3 { background-position: -96px -176px; }  
.ui-icon-circle-plus { background-position: 0 -192px; }  
.ui-icon-circle-minus { background-position: -16px -192px; }  
.ui-icon-circle-close { background-position: -32px -192px; }  
.ui-icon-circle-triangle-e { background-position: -48px -192px; }  
.ui-icon-circle-triangle-s { background-position: -64px -192px; }  
.ui-icon-circle-triangle-w { background-position: -80px -192px; }  
.ui-icon-circle-triangle-n { background-position: -96px -192px; }  
.ui-icon-circle-arrow-e { background-position: -112px -192px; }  
.ui-icon-circle-arrow-s { background-position: -128px -192px; }  
.ui-icon-circle-arrow-w { background-position: -144px -192px; }  
.ui-icon-circle-arrow-n { background-position: -160px -192px; }  
.ui-icon-circle-zoomin { background-position: -176px -192px; }  
.ui-icon-circle-zoomout { background-position: -192px -192px; }  
.ui-icon-circle-check { background-position: -208px -192px; }  
.ui-icon-circlesmall-plus { background-position: 0 -208px; }  
.ui-icon-circlesmall-minus { background-position: -16px -208px; }  
.ui-icon-circlesmall-close { background-position: -32px -208px; }  
.ui-icon-squaresmall-plus { background-position: -48px -208px; }  
.ui-icon-squaresmall-minus { background-position: -64px -208px; }  
.ui-icon-squaresmall-close { background-position: -80px -208px; }  
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }  
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }  
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }  
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }  
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }  
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }  
 
 
/* Misc visuals  
----------------------------------*/  
 
/* Corner radius */  
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }  
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }  
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }  
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }  
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }  
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }  
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }  
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }  
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }  
 
/* Overlays */  
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }  
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Resizable  
----------------------------------*/  
.ui-resizable { position: relative;}  
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}  
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }  
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }  
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }  
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }  
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }  
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }  
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }  
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }  
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Accordion  
----------------------------------*/  
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }  
.ui-accordion .ui-accordion-li-fix { display: inline; }  
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }  
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }  
/* IE7-/Win - Fix extra vertical space in lists */  
.ui-accordion a { zoom: 1; }  
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }  
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }  
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }  
.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete  
----------------------------------*/  
.ui-autocomplete { position: absolute; cursor: default; }  
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }  
 
/* workarounds */  
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */  
 
/* Menu  
----------------------------------*/  
.ui-menu {  
list-style:none;  
padding: 2px;  
margin: 0;  
display:block;  
}  
.ui-menu .ui-menu {  
margin-top: -3px;  
}  
.ui-menu .ui-menu-item {  
margin:0;  
padding: 0;  
zoom: 1;  
float: left;  
clear: left;  
width: 100%;  
}  
.ui-menu .ui-menu-item a {  
text-decoration:none;  
display:block;  
padding:.2em .4em;  
line-height:1.5;  
zoom:1;  
}  
.ui-menu .ui-menu-item a.ui-state-hover,  
.ui-menu .ui-menu-item a.ui-state-active {  
font-weight: normal;  
margin: -1px;  
}  
/* Button  
----------------------------------*/  
 
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */  
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */  
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */  
.ui-button-icons-only { width: 3.4em; }  
button.ui-button-icons-only { width: 3.7em; }  
 
/*button text element */  
.ui-button .ui-button-text { display: block; line-height: 1.4; }  
.ui-button-text-only .ui-button-text { padding: .4em 1em; }  
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }  
.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }  
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }  
/* no icon support for input elements, provide padding by default */  
input.ui-button { padding: .4em 1em; }  
 
/*button icon element(s) */  
.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }  
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }  
.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }  
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }  
 
/*button sets*/  
.ui-buttonset { margin-right: 7px; }  
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }  
 
/* workarounds */  
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */  
 
 
 
 
 
/* Dialog  
----------------------------------*/  
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }  
.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; }  
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; }  
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }  
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }  
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }  
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }  
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }  
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }  
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }  
.ui-draggable .ui-dialog-titlebar { cursor: move; }  
/* Slider  
----------------------------------*/  
.ui-slider { position: relative; text-align: left; }  
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }  
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }  
 
.ui-slider-horizontal { height: .8em; }  
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }  
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }  
.ui-slider-horizontal .ui-slider-range-min { left: 0; }  
.ui-slider-horizontal .ui-slider-range-max { right: 0; }  
 
.ui-slider-vertical { width: .8em; height: 100px; }  
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }  
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }  
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }  
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs  
----------------------------------*/  
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */  
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }  
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }  
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }  
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }  
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }  
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */  
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }  
.ui-tabs .ui-tabs-hide { display: none !important; }  
/* Datepicker  
----------------------------------*/  
.ui-datepicker { width: 17em; padding: .2em .2em 0; }  
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }  
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }  
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }  
.ui-datepicker .ui-datepicker-prev { left:2px; }  
.ui-datepicker .ui-datepicker-next { right:2px; }  
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }  
.ui-datepicker .ui-datepicker-next-hover { right:1px; }  
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }  
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }  
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }  
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}  
.ui-datepicker select.ui-datepicker-month,  
.ui-datepicker select.ui-datepicker-year { width: 49%;}  
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }  
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }  
.ui-datepicker td { border: 0; padding: 1px; }  
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }  
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }  
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }  
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }  
 
/* with multiple calendars */  
.ui-datepicker.ui-datepicker-multi { width:auto; }  
.ui-datepicker-multi .ui-datepicker-group { float:left; }  
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }  
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }  
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }  
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }  
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }  
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }  
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }  
.ui-datepicker-row-break { clear:both; width:100%; }  
 
/* RTL support */  
.ui-datepicker-rtl { direction: rtl; }  
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }  
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }  
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }  
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }  
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }  
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }  
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }  
.ui-datepicker-rtl .ui-datepicker-group { float:right; }  
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }  
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }  
 
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */  
.ui-datepicker-cover {  
display: none; /*sorry for IE5*/  
display/**/: block; /*sorry for IE5*/  
position: absolute; /*must have*/  
z-index: -1; /*must have*/  
filter: mask(); /*must have*/  
top: -4px; /*must have*/  
left: -4px; /*must have*/  
width: 200px; /*must have*/  
height: 200px; /*must have*/  
}/* Progressbar  
----------------------------------*/  
.ui-progressbar { height:2em; text-align: left; }  
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }  
.ui-datepicker table, td {  
font-size:;  
padding:0px;  
width:;  
margin:0px;  
 
}  
 
 
/* Main Style Sheet for jQuery UI date picker */  
#ui-datepicker-div, .ui-datepicker-inline {  
font-family: Arial, Helvetica, sans-serif;  
font-size: 14px;  
padding: 0;  
margin: 0;  
background: #ddd;  
width: 185px;  
}  
#ui-datepicker-div {  
display: none;  
border: 1px solid #777;  
z-index: 9999; /*must have*/  
}  
.ui-datepicker-inline {  
float: left;  
display: block;  
border: 0;  
}  
.ui-datepicker-rtl {  
direction: rtl;  
}  
.ui-datepicker-dialog {  
padding: 5px !important;  
border: 4px ridge #ddd !important;  
}  
button.ui-datepicker-trigger {  
width: 25px;  
}  
img.ui-datepicker-trigger {  
margin: 2px;  
vertical-align: middle;  
}  
.ui-datepicker-prompt {  
float: left;  
padding: 2px;  
background: #ddd;  
color: #000;  
}  
* html .ui-datepicker-prompt {  
width: 185px;  
}  
.ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {  
clear: both;  
float: left;  
width: 100%;  
color: #fff;  
}  
.ui-datepicker-control {  
background: #400;  
padding: 2px 0px;  
}  
.ui-datepicker-links {  
background: #000;  
padding: 2px 0px;  
}  
.ui-datepicker-control, .ui-datepicker-links {  
font-weight: bold;  
font-size: 80%;  
}  
.ui-datepicker-links label { /* disabled links */  
padding: 2px 5px;  
color: #888;  
}  
.ui-datepicker-clear, .ui-datepicker-prev {  
float: left;  
width: 34%;  
}  
.ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {  
float: right;  
text-align: right;  
}  
.ui-datepicker-current {  
float: left;  
width: 30%;  
text-align: center;  
}  
.ui-datepicker-close, .ui-datepicker-next {  
float: right;  
width: 34%;  
text-align: right;  
}  
.ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {  
float: left;  
text-align: left;  
}  
.ui-datepicker-header {  
padding: 1px 0 3px;  
background: #333;  
text-align: center;  
font-weight: bold;  
height: 1.3em;  
 
}  
.ui-datepicker-header select {  
background: #333;  
color: #fff;  
border: 0px;  
font-weight: bold;  
}  
.ui-datepicker {  
background: #ccc;  
text-align: center;  
font-size: 100%;  
}  
.ui-datepicker a {  
display: block;  
width: 100%;  
}  
 
.ui-datepicker-title-row {  
background: #777;  
}  
.ui-datepicker-days-row {  
background: #eee;  
color: #666;  
}  
.ui-datepicker-week-col {  
background: #777;  
color: #fff;  
}  
.ui-datepicker-days-cell {  
color: #000;  
border: 1px solid #ddd;  
}  
 
.ui-datepicker-days-cell a{  
display: block;  
}  
.ui-datepicker-week-end-cell {  
background: #ddd;  
}  
.ui-datepicker-title-row .ui-datepicker-week-end-cell {  
background: #777;  
}  
.ui-datepicker-days-cell-over {  
background: #fff;  
border: 1px solid #777;  
}  
.ui-datepicker-unselectable {  
color: #888;  
}  
.ui-datepicker-today {  
background: #fcc !important;  
}  
.ui-datepicker-current-day {  
background: #999 !important;  
}  
.ui-datepicker-status {  
background: #ddd;  
width: 100%;  
font-size: 80%;  
text-align: center;  
}  
 
/* ________ Datepicker Links _______  
 
** Reset link properties and then override them with !important */  
#ui-datepicker-div a, .ui-datepicker-inline a {  
cursor: pointer;  
margin: 0;  
padding: 0;  
background: none;  
color: #000;  
}  
.ui-datepicker-inline .ui-datepicker-links a {  
padding: 0 5px !important;  
}  
.ui-datepicker-control a, .ui-datepicker-links a {  
padding: 2px 5px !important;  
color: #eee !important;  
}  
.ui-datepicker-title-row a {  
color: #eee !important;  
}  
.ui-datepicker-control a:hover {  
background: #fdd !important;  
color: #333 !important;  
}  
.ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {  
background: #ddd !important;  
color: #333 !important;  
}  
 
/* ___________ MULTIPLE MONTHS _________*/  
 
.ui-datepicker-multi .ui-datepicker {  
border: 1px solid #777;  
}  
.ui-datepicker-one-month {  
float: left;  
width: 185px;  
}  
.ui-datepicker-new-row {  
clear: left;  
}  
 
/* ___________ IE6 IFRAME FIX ________ */  
 
.ui-datepicker-cover {  
display: none; /*sorry for IE5*/  
display/**/: block; /*sorry for IE5*/  
position: absolute; /*must have*/  
z-index: -1; /*must have*/  
filter: mask(); /*must have*/  
top: -4px; /*must have*/  
left: -4px; /*must have*/  
width: 200px; /*must have*/  
height: 200px; /*must have*/  
}  
 
.ui-jqgrid{position:relative;font-size:11px;}.ui-jqgrid .ui-jqgrid-view{position:relative;left:0;top:0;padding:.0em;}.ui-jqgrid .ui-jqgrid-titlebar{padding:.3em .2em .2em .3em;position:relative;border-left:0 none;border-right:0 none;border-top:0 none;}.ui-jqgrid .ui-jqgrid-title{float:left;margin:.1em 0 .2em;}.ui-jqgrid .ui-jqgrid-titlebar-close{position:absolute;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span{display:block;margin:1px;}.ui-jqgrid .ui-jqgrid-titlebar-close:hover{padding:0;}.ui-jqgrid .ui-jqgrid-hdiv{position:relative;margin:0;padding:0;overflow-x:hidden;overflow-y:auto;border-left:0 none!important;border-top:0 none!important;border-right:0 none!important;}.ui-jqgrid .ui-jqgrid-hbox{float:left;padding-right:20px;}.ui-jqgrid .ui-jqgrid-htable{table-layout:fixed;margin:0;}.ui-jqgrid .ui-jqgrid-htable th{height:22px;padding:0 2px 0 2px;}.ui-jqgrid .ui-jqgrid-htable th div{overflow:hidden;position:relative;height:17px;}.ui-th-column,.ui-jqgrid .ui-jqgrid-htable th.ui-th-column{overflow:hidden;white-space:nowrap;text-align:center;border-top:0 none;border-bottom:0 none;}.ui-th-ltr,.ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr{border-left:0 none;}.ui-th-rtl,.ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl{border-right:0 none;}.ui-jqgrid .ui-th-div-ie{white-space:nowrap;zoom:1;height:17px;}.ui-jqgrid .ui-jqgrid-resize{height:20px!important;position:relative;cursor:e-resize;display:inline;overflow:hidden;}.ui-jqgrid .ui-grid-ico-sort{overflow:hidden;position:absolute;display:inline;cursor:pointer!important;}.ui-jqgrid .ui-icon-asc{margin-top:-3px;height:12px;}.ui-jqgrid .ui-icon-desc{margin-top:3px;height:12px;}.ui-jqgrid .ui-i-asc{margin-top:0;height:16px;}.ui-jqgrid .ui-i-desc{margin-top:0;margin-left:13px;height:16px;}.ui-jqgrid .ui-jqgrid-sortable{cursor:pointer;}.ui-jqgrid tr.ui-search-toolbar th{border-top-width:1px!important;border-top-color:inherit!important;border-top-style:ridge!important;}tr.ui-search-toolbar input{margin:1px 0 0 0;}tr.ui-search-toolbar select{margin:1px 0 0 0;}.ui-jqgrid .ui-jqgrid-bdiv{position:relative;margin:0;padding:0;overflow:auto;text-align:left;}.ui-jqgrid .ui-jqgrid-btable{table-layout:fixed;margin:0;}.ui-jqgrid tr.jqgrow td{font-weight:normal;overflow:hidden;white-space:pre;height:22px;padding:0 2px 0 2px;border-bottom-width:1px;border-bottom-color:inherit;border-bottom-style:solid;}.ui-jqgrid tr.ui-row-ltr td{text-align:left;border-right-width:1px;border-right-color:inherit;border-right-style:solid;}.ui-jqgrid tr.ui-row-rtl td{text-align:right;border-left-width:1px;border-left-color:inherit;border-left-style:solid;}.ui-jqgrid td.jqgrid-rownum{padding:0 2px 0 2px;margin:0;border:0 none;}.ui-jqgrid .ui-jqgrid-resize-mark{width:2px;left:0;background-color:#777;cursor:e-resize;cursor:col-resize;position:absolute;top:0;height:100px;overflow:hidden;display:none;border:0 none;}.ui-jqgrid .ui-jqgrid-sdiv{position:relative;margin:0;padding:0;overflow:hidden;border-left:0 none!important;border-top:0 none!important;border-right:0 none!important;}.ui-jqgrid .ui-jqgrid-ftable{table-layout:fixed;margin-bottom:0;}.ui-jqgrid tr.footrow td{font-weight:bold;overflow:hidden;white-space:nowrap;height:21px;padding:0 2px 0 2px;border-top-width:1px;border-top-color:inherit;border-top-style:solid;}.ui-jqgrid tr.footrow-ltr td{text-align:left;border-right-width:1px;border-right-color:inherit;border-right-style:solid;}.ui-jqgrid tr.footrow-rtl td{text-align:right;border-left-width:1px;border-left-color:inherit;border-left-style:solid;}.ui-jqgrid .ui-jqgrid-pager{border-left:0 none!important;border-right:0 none!important;border-bottom:0 none!important;margin:0!important;padding:0!important;position:relative;height:25px;white-space:nowrap;overflow:hidden;}.ui-jqgrid .ui-pager-control{position:relative;}.ui-jqgrid .ui-pg-table{position:relative;padding-bottom:2px;width:auto;margin:0;}.ui-jqgrid .ui-pg-table td{font-weight:normal;vertical-align:middle;padding:1px;}.ui-jqgrid .ui-pg-button{height:19px!important;}.ui-jqgrid .ui-pg-button span{display:block;margin:1px;float:left;}.ui-jqgrid .ui-pg-button:hover{padding:0;}.ui-jqgrid .ui-state-disabled:hover{padding:1px;}.ui-jqgrid .ui-pg-input{height:13px;font-size:.8em;margin:0;}.ui-jqgrid .ui-pg-selbox{font-size:.8em;line-height:18px;display:block;height:18px;margin:0;}.ui-jqgrid .ui-separator{height:18px;border-left:1px solid #ccc;border-right:1px solid #ccc;margin:1px;float:right;}.ui-jqgrid .ui-paging-info{font-weight:normal;height:19px;margin-top:3px;margin-right:4px;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-div{padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-button{cursor:pointer;}.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon{float:left;margin:0 2px;}.ui-jqgrid td input,.ui-jqgrid td select .ui-jqgrid td textarea{margin:0;}.ui-jqgrid td textarea{width:auto;height:auto;}.ui-jqgrid .ui-jqgrid-toppager{border-left:0 none!important;border-right:0 none!important;border-top:0 none!important;margin:0!important;padding:0!important;position:relative;height:25px!important;white-space:nowrap;overflow:hidden;}.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span{display:block;}.ui-jqgrid .ui-subgrid{margin:0;padding:0;width:100%;}.ui-jqgrid .ui-subgrid table{table-layout:fixed;}.ui-jqgrid .ui-subgrid tr.ui-subtblcell td{height:18px;border-right-width:1px;border-right-color:inherit;border-right-style:solid;border-bottom-width:1px;border-bottom-color:inherit;border-bottom-style:solid;}.ui-jqgrid .ui-subgrid td.subgrid-data{border-top:0 none!important;}.ui-jqgrid .ui-subgrid td.subgrid-cell{border-width:0 0 1px 0;}.ui-jqgrid .ui-th-subgrid{height:20px;}.ui-jqgrid .loading{position:absolute;top:45%;left:45%;width:auto;z-index:101;padding:6px;margin:5px;text-align:center;font-weight:bold;display:none;border-width:2px!important;}.ui-jqgrid .jqgrid-overlay{display:none;z-index:100;}* html .jqgrid-overlay{width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}* .jqgrid-overlay iframe{position:absolute;top:0;left:0;z-index:-1;width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}.ui-jqgrid .ui-userdata{border-left:0 none;border-right:0 none;height:21px;overflow:hidden;}.ui-jqdialog{display:none;width:300px;position:absolute;padding:.2em;font-size:11px;overflow:visible;}.ui-jqdialog .ui-jqdialog-titlebar{padding:.3em .2em;position:relative;}.ui-jqdialog .ui-jqdialog-title{margin:.1em 0 .2em;}.ui-jqdialog .ui-jqdialog-titlebar-close{position:absolute;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px;}.ui-jqdialog .ui-jqdialog-titlebar-close span{display:block;margin:1px;}.ui-jqdialog .ui-jqdialog-titlebar-close:hover,.ui-jqdialog .ui-jqdialog-titlebar-close:focus{padding:0;}.ui-jqdialog-content,.ui-jqdialog .ui-jqdialog-content{border:0;padding:.3em .2em;background:none;height:auto;}.ui-jqdialog .ui-jqconfirm{padding:.4em 1em;border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}.ui-jqdialog-content .FormGrid{margin:0;}.ui-jqdialog-content .EditTable{width:100%;margin-bottom:0;}.ui-jqdialog-content .DelTable{width:100%;margin-bottom:0;}.EditTable td input,.EditTable td select,.EditTable td textarea{margin:0;}.EditTable td textarea{width:auto;height:auto;}.ui-jqdialog-content td.EditButton{text-align:right;border-top:0 none;border-left:0 none;border-right:0 none;padding-bottom:5px;padding-top:5px;}.ui-jqdialog-content td.navButton{text-align:center;border-left:0 none;border-top:0 none;border-right:0 none;padding-bottom:5px;padding-top:5px;}.ui-jqdialog-content .CaptionTD{text-align:left;vertical-align:top;border-left:0 none;border-right:0 none;border-bottom:0 none;padding:1px;white-space:nowrap;}.ui-jqdialog-content .DataTD{padding:1px;border-left:0 none;border-right:0 none;border-bottom:0 none;vertical-align:top;}.ui-jqdialog-content .form-view-data{white-space:pre;}.fm-button{display:inline-block;margin:0 4px 0 0;padding:.4em .5em;text-decoration:none!important;cursor:pointer;position:relative;text-align:center;zoom:1;}.fm-button-icon-left{padding-left:1.9em;}.fm-button-icon-right{padding-right:1.9em;}.fm-button-icon-left .ui-icon{right:auto;left:.2em;margin-left:0;position:absolute;top:50%;margin-top:-8px;}.fm-button-icon-right .ui-icon{left:auto;right:.2em;margin-left:0;position:absolute;top:50%;margin-top:-8px;}#nData,#pData{float:left;margin:3px;padding:0;width:15px;}.ui-jqgrid .selected-row,div.ui-jqgrid .selected-row td{font-style:normal;border-left:0 none;}.ui-jqgrid .tree-wrap{float:left;position:relative;height:18px;white-space:nowrap;overflow:hidden;}.ui-jqgrid .tree-minus{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .tree-plus{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .tree-leaf{position:absolute;height:18px;width:18px;overflow:hidden;}.ui-jqgrid .treeclick{cursor:pointer;}.jqmOverlay{background-color:#000;}* iframe.jqm{position:absolute;top:0;left:0;z-index:-1;width:expression(this.parentNode.offsetWidth+'px');height:expression(this.parentNode.offsetHeight+'px');}.ui-jqgrid-dnd tr td{border-right-width:1px;border-right-color:inherit;border-right-style:solid;height:20px;}.ui-jqgrid .ui-jqgrid-title-rtl{float:right;margin:.1em 0 .2em;}.ui-jqgrid .ui-jqgrid-hbox-rtl{float:right;padding-left:20px;}.ui-jqgrid .ui-jqgrid-resize-ltr{float:right;margin:-2px -2px -2px 0;}.ui-jqgrid .ui-jqgrid-resize-rtl{float:left;margin:-2px 0 -1px -3px;}.ui-jqgrid .ui-sort-rtl{left:0;}.ui-jqgrid .tree-wrap-ltr{float:left;}.ui-jqgrid .tree-wrap-rtl{float:right;}.ui-jqgrid .ui-ellipsis{text-overflow:ellipsis;-moz-binding:url('ellipsis-xbl.xml#ellipsis');}  
.ui-searchFilter{display:none;position:absolute;z-index:770;overflow:visible;}.ui-searchFilter table{position:relative;margin:0;width:auto;}.ui-searchFilter table td{margin:0;padding:1px;}.ui-searchFilter table td input,.ui-searchFilter table td select{margin:.1em;}.ui-searchFilter .ui-state-default{cursor:pointer;}.ui-searchFilter .divider{height:1px;}.ui-searchFilter .divider div{background-color:black;height:1px;}  
<?php  
// ...  
?>  
;;; Provided courtesy of http://browsers.garykeith.com  
;;; Created on Thursday, December 23, 2010 at 9:05 PM GMT  
 
[GJK_Browscap_Version]  
Version=4604  
Released=Thu, 23 Dec 2010 21:05:08 -0000  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DefaultProperties  
 
[DefaultProperties]  
Browser="DefaultProperties"  
Version=0  
MajorVer=0  
MinorVer=0  
Platform=unknown  
Alpha=false  
Beta=false  
Win16=false  
Win32=false  
Win64=false  
Frames=false  
IFrames=false  
Tables=false  
Cookies=false  
BackgroundSounds=false  
CDF=false  
VBScript=false  
JavaApplets=false  
JavaScript=false  
ActiveXControls=false  
isBanned=false  
isMobileDevice=false  
isSyndicationReader=false  
Crawler=false  
CssVersion=0  
supportsCSS=false  
AOL=false  
aolVersion=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ask  
 
[Ask]  
Parent=DefaultProperties  
Browser="Ask"  
Frames=true  
Tables=true  
Crawler=true  
 
[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]  
Parent=Ask  
Browser="Teoma"  
 
[Mozilla/2.0 (compatible; Ask Jeeves)]  
Parent=Ask  
Browser="AskJeeves"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Baidu  
 
[Baidu]  
Parent=DefaultProperties  
Browser="Baidu"  
Frames=true  
Tables=true  
Crawler=true  
 
[AC-BaiduBot/1.*]  
Parent=Baidu  
Browser="AC-BaiduBot"  
 
[BaiduImageSpider*]  
Parent=Baidu  
Browser="BaiduImageSpider"  
 
[Baiduspider*]  
Parent=Baidu  
Browser="BaiDu"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Google  
 
[Google]  
Parent=DefaultProperties  
Browser="Google"  
Frames=true  
IFrames=true  
Tables=true  
JavaScript=true  
Crawler=true  
 
[* (compatible; Googlebot-Mobile/2.*; *http://www.google.com/bot.html)]  
Parent=Google  
Browser="Googlebot-Mobile"  
Frames=false  
IFrames=false  
Tables=false  
 
[*Google Wireless Transcoder*]  
Parent=Google  
Browser="Google Wireless Transcoder"  
 
[AdsBot-Google (?http://www.google.com/adsbot.html)]  
Parent=Google  
Browser="AdsBot-Google"  
 
[AdsBot-Google-Mobile (?http://www.google.com/mobile/adsbot.html) Mozilla (iPhone; U; CPU iPhone OS 3 0 like Mac OS X) AppleWebKit (KHTML, like Gecko) Mobile Safari]  
Parent=Google  
Browser="AdsBot-Google-Mobile"  
 
[AppEngine-Google*]  
Parent=Google  
Browser="AppEngine-Google"  
 
[Feedfetcher-Google-iGoogleGadgets;*]  
Parent=Google  
Browser="iGoogleGadgets"  
isBanned=true  
isSyndicationReader=true  
 
[Feedfetcher-Google;*]  
Parent=Google  
Browser="Feedfetcher-Google"  
isBanned=true  
isSyndicationReader=true  
 
[Google OpenSocial agent (http://www.google.com/feedfetcher.html)]  
Parent=Google  
Browser="Google OpenSocial"  
 
[Google-Site-Verification/*]  
Parent=Google  
Browser="Google-Site-Verification"  
 
[Google-Sitemaps/*]  
Parent=Google  
Browser="Google-Sitemaps"  
 
[Googlebot-Image/*]  
Parent=Google  
Browser="Googlebot-Image"  
CDF=true  
 
[Googlebot-News/*]  
Parent=Google  
Browser="Googlebot-News"  
 
[googlebot-urlconsole]  
Parent=Google  
Browser="googlebot-urlconsole"  
 
[Googlebot-Video/*]  
Parent=Google  
Browser="Google-Video"  
 
[Googlebot/2.1 (?http://www.google.com/bot.html)]  
Parent=Google  
Browser="Googlebot"  
 
[Googlebot/2.1 (?http://www.googlebot.com/bot.html)]  
Parent=Google  
Browser="Googlebot"  
 
[Googlebot/Test*]  
Parent=Google  
Browser="Googlebot/Test"  
 
[GoogleFriendConnect/*]  
Parent=Google  
Browser="Google Friend Connect"  
 
[gsa-crawler*]  
Parent=Google  
Browser="Google Search Appliance"  
isBanned=true  
 
[Mediapartners-Google*]  
Parent=Google  
Browser="Mediapartners-Google"  
 
[Mozilla/?.0 (compatible; Google Desktop*)]  
Parent=Google  
Browser="Google Desktop"  
 
[Mozilla/5.0 (*) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13]  
Parent=Google  
Browser="Google Web Preview"  
 
[Mozilla/5.0 (compatible) Feedfetcher-Google; ( http://www.google.com/feedfetcher.html)]  
Parent=Google  
Browser="Google Feedfetcher"  
 
[Mozilla/5.0 (compatible; Google Keyword Tool;*)]  
Parent=Google  
Browser="Google Keyword Tool"  
 
[Mozilla/5.0 (compatible; Googlebot/2.1; ?http://www.google.com/bot.html)]  
Parent=Google  
Browser="Google Webmaster Tools"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Inktomi  
 
[Inktomi]  
Parent=DefaultProperties  
Browser="Inktomi"  
Frames=true  
Tables=true  
Crawler=true  
 
[* (compatible;YahooSeeker/M1A1-R2D2; *)]  
Parent=Inktomi  
Browser="YahooSeeker-Mobile"  
Frames=false  
Tables=false  
 
[Mozilla/4.0]  
Parent=Inktomi  
 
[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)]  
Parent=Inktomi  
Win32=true  
 
[Mozilla/4.0 (compatible; Yahoo Japan; for robot study; kasugiya)]  
Parent=Inktomi  
Browser="Yahoo! RobotStudy"  
isBanned=true  
 
[Mozilla/5.0 (compatible; BMC/* (Y!J-AGENT))]  
Parent=Inktomi  
Browser="Y!J-AGENT/BMC"  
 
[Mozilla/5.0 (compatible; BMF/* (Y!J-AGENT))]  
Parent=Inktomi  
Browser="Y!J-AGENT/BMF"  
 
[Mozilla/5.0 (compatible; BMI/* (Y!J-AGENT; 1.0))]  
Parent=Inktomi  
Browser="Y!J-AGENT/BMI"  
 
[Mozilla/5.0 (compatible; Yahoo! DE Slurp; http://help.yahoo.com/help/us/ysearch/slurp)]  
Parent=Inktomi  
Browser="Yahoo! Directory Engine"  
 
[Mozilla/5.0 (compatible; Yahoo! SearchMonkey*)]  
Parent=Inktomi  
Browser="Yahoo! Search Monkey"  
 
[Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)]  
Parent=Inktomi  
Browser="Yahoo! Slurp China"  
 
[Mozilla/5.0 (compatible; Yahoo! Slurp/*; http://help.yahoo.com/help/us/ysearch/slurp)]  
Parent=Inktomi  
Browser="Yahoo! Slurp"  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)]  
Parent=Inktomi  
Browser="Yahoo! Slurp"  
 
[Mozilla/5.0 (compatible; Yahoo! Verifier/*)]  
Parent=Inktomi  
Browser="Yahoo! Verifier"  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[Mozilla/5.0 (Slurp/cat; slurp@inktomi.com; http://www.inktomi.com/slurp.html)]  
Parent=Inktomi  
Browser="Slurp/cat"  
 
[Mozilla/5.0 (Slurp/si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)]  
Parent=Inktomi  
 
[Mozilla/5.0 (Yahoo-MMCrawler/*; mailto:vertical-crawl-support@yahoo-inc.com)]  
Parent=Inktomi  
Browser="Yahoo-MMCrawler"  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/5.0 (YahooYSMcm/*; http://help.yahoo.com)]  
Parent=Inktomi  
 
[Scooter/*]  
Parent=Inktomi  
Browser="Scooter"  
 
[Scooter/*Y!CrawlX]  
Parent=Inktomi  
Browser="Scooter/3.3Y!CrawlX"  
Version=3.3  
MajorVer=3  
MinorVer=3  
 
[slurp]  
Parent=Inktomi  
Browser="slurp"  
 
[Y!J SearchMonkey/*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRE*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRG/GSC*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRI*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRO/YFSJ*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRP/YFSBJ*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BRQ/DLCK*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-BSC/*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
Version=1.0  
MajorVer=1  
MinorVer=0  
isSyndicationReader=true  
 
[Y!J-DSC*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-NSC/*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-PSC*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Y!J-SRD/*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Y!J-VSC/ViSe*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
 
[Yahoo Mindset]  
Parent=Inktomi  
Browser="Yahoo Mindset"  
 
[Yahoo Pipes*]  
Parent=Inktomi  
Browser="Yahoo Pipes"  
 
[Yahoo! Mindset]  
Parent=Inktomi  
Browser="Yahoo! Mindset"  
 
[Yahoo! Slurp/Site Explorer]  
Parent=Inktomi  
Browser="Yahoo! Site Explorer"  
 
[Yahoo-Blogs/*]  
Parent=Inktomi  
Browser="Yahoo-Blogs"  
 
[Yahoo-MMAudVid*]  
Parent=Inktomi  
Browser="Yahoo-MMAudVid"  
 
[Yahoo-MMCrawler*]  
Parent=Inktomi  
Browser="Yahoo-MMCrawler"  
isBanned=true  
 
[YahooExternalCache]  
Parent=Inktomi  
Browser="YahooExternalCache"  
 
[YahooFeedSeeker*]  
Parent=Inktomi  
Browser="YahooFeedSeeker"  
isSyndicationReader=true  
Crawler=false  
 
[YahooSeeker/*]  
Parent=Inktomi  
Browser="YahooSeeker"  
isMobileDevice=true  
 
[YahooSeeker/CafeKelsa (compatible; Konqueror/3.2; FreeBSD*) (KHTML, like Gecko)]  
Parent=Inktomi  
Browser="YahooSeeker/CafeKelsa"  
 
[YahooSeeker/CafeKelsa-dev (compatible; Konqueror/3.2; FreeBSD*) (KHTML, like Gecko)]  
Parent=Inktomi  
 
[YahooVideoSearch*]  
Parent=Inktomi  
Browser="YahooVideoSearch"  
 
[YahooYSMcm*]  
Parent=Inktomi  
Browser="YahooYSMcm"  
 
[ytndemo bergum@yahoo-inc.com]  
Parent=Inktomi  
Browser="ytndemo"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MSN  
 
[MSN]  
Parent=DefaultProperties  
Browser="MSN"  
Frames=true  
Tables=true  
Crawler=true  
 
[adidxbot/1.1 (?http://search.msn.com/msnbot.htm)]  
Parent=MSN  
Browser="adidxbot"  
 
[librabot/1.0 (*)]  
Parent=MSN  
Browser="librabot"  
 
[llssbot/1.0]  
Parent=MSN  
Browser="llssbot"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Microsoft Bing Mobile SocialStreams Bot]  
Parent=MSN  
Browser="Microsoft Bing Mobile SocialStreams Bot"  
 
[Mozilla/5.0 (compatible; bingbot/2.*http://www.bing.com/bingbot.htm)]  
Parent=MSN  
Browser="BingBot"  
 
[Mozilla/5.0 (Danger hiptop 3.*; U; rv:1.7.*) Gecko/*]  
Parent=MSN  
Browser="Danger"  
 
[MSMOBOT/1.1*]  
Parent=MSN  
Browser="msnbot-mobile"  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[MSNBot-Academic/1.0*]  
Parent=MSN  
Browser="MSNBot-Academic"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[msnbot-media/1.0*]  
Parent=MSN  
Browser="msnbot-media"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[msnbot-media/1.1*]  
Parent=MSN  
Browser="msnbot-media"  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[MSNBot-News/1.0*]  
Parent=MSN  
Browser="MSNBot-News"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[MSNBot-NewsBlogs/1.0*]  
Parent=MSN  
Browser="MSNBot-NewsBlogs"  
Version=1  
MajorVer=1  
MinorVer=0  
 
[msnbot-products]  
Parent=MSN  
Browser="msnbot-products"  
 
[msnbot-webmaster/1.0 (*http://search.msn.com/msnbot.htm)]  
Parent=MSN  
Browser="msnbot-webmaster tools"  
 
[msnbot/1.0*]  
Parent=MSN  
Browser="msnbot"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[msnbot/1.1*]  
Parent=MSN  
Browser="msnbot"  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[msnbot/2.0b*]  
Parent=MSN  
Version=2.0  
MajorVer=2  
MinorVer=0  
Beta=true  
 
[MSR-ISRCCrawler]  
Parent=MSN  
Browser="MSR-ISRCCrawler"  
 
[MSRBOT*]  
Parent=MSN  
Browser="MSRBOT"  
 
[renlifangbot/1.0 (?http://search.msn.com/msnbot.htm)]  
Parent=MSN  
Browser="renlifangbot"  
 
[T-Mobile Dash Mozilla/4.0 (*) MSNBOT-MOBILE/1.1 (*)]  
Parent=MSN  
Browser="msnbot-mobile"  
 
[Vancouver*]  
Parent=MSN  
Browser="Vancouver"  
isSyndicationReader=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Yahoo  
 
[Yahoo]  
Parent=DefaultProperties  
Browser="Yahoo"  
Frames=true  
Tables=true  
Crawler=true  
 
[Mozilla/4.0 (compatible; Y!J; for robot study*)]  
Parent=Yahoo  
Browser="Y!J"  
 
[Mozilla/5.0 (Yahoo-Test/4.0*)]  
Parent=Yahoo  
Browser="Yahoo-Test"  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[mp3Spider cn-search-devel at yahoo-inc dot com]  
Parent=Yahoo  
Browser="Yahoo! Media"  
isBanned=true  
 
[My Browser]  
Parent=Yahoo  
Browser="Yahoo! My Browser"  
 
[Y!OASIS/*]  
Parent=Yahoo  
Browser="Y!OASIS"  
isBanned=true  
 
[YahooYSMcm/2.0.0]  
Parent=Yahoo  
Browser="YahooYSMcm"  
Version=2.0  
MajorVer=2  
MinorVer=0  
isBanned=true  
 
[YRL_ODP_CRAWLER]  
Parent=Yahoo  
Browser="YRL_ODP_CRAWLER"  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Yandex  
 
[Yandex]  
Parent=DefaultProperties  
Browser="Yandex"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
Crawler=true  
 
[Mozilla/5.0 (compatible; YandexAddurl/*)*]  
Parent=Yandex  
Browser="YandexAddURL"  
 
[Mozilla/5.0 (compatible; YandexBlogs/*; robot)]  
Parent=Yandex  
Browser="YandexBlogs"  
 
[Mozilla/5.0 (compatible; YandexBot/*)*]  
Parent=Yandex  
Browser="YandexBot"  
 
[Mozilla/5.0 (compatible; YandexBot/*; MirrorDetector)]  
Parent=Yandex  
Browser="Yandex MirrorDetector"  
 
[Mozilla/5.0 (compatible; YandexCatalog/*)*]  
Parent=Yandex  
Browser="YandexCatalog"  
 
[Mozilla/5.0 (compatible; YandexDirect/*)*]  
Parent=Yandex  
Browser="YandexDirect-Dyatel"  
 
[Mozilla/5.0 (compatible; YandexFavicons/*)*]  
Parent=Yandex  
Browser="YandexFavicons"  
 
[Mozilla/5.0 (compatible; YandexImageResizer/*)*]  
Parent=Yandex  
Browser="YandexImageResizer"  
 
[Mozilla/5.0 (compatible; YandexImages/*)*]  
Parent=Yandex  
Browser="YandexImages"  
 
[Mozilla/5.0 (compatible; YandexMedia/*)*]  
Parent=Yandex  
Browser="YandexMedia"  
 
[Mozilla/5.0 (compatible; YandexMetrika/*)*]  
Parent=Yandex  
Browser="YandexMetrika"  
 
[Mozilla/5.0 (compatible; YandexNews/*)*]  
Parent=Yandex  
Browser="YandexNews"  
 
[Mozilla/5.0 (compatible; YandexVideo/*)*]  
Parent=Yandex  
Browser="YandexVideo"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Best of the Web  
 
[Best of the Web]  
Parent=DefaultProperties  
Browser="Best of the Web"  
Frames=true  
Tables=true  
 
[Mozilla/4.0 (compatible; BOTW Feed Grabber; *http://botw.org)]  
Parent=Best of the Web  
Browser="BOTW Feed Grabber"  
isSyndicationReader=true  
Crawler=false  
 
[Mozilla/4.0 (compatible; BOTW Spider; *http://botw.org)]  
Parent=Best of the Web  
Browser="BOTW Spider"  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Boitho  
 
[Boitho]  
Parent=DefaultProperties  
Browser="Boitho"  
Frames=true  
Tables=true  
Crawler=true  
 
[boitho.com-dc/*]  
Parent=Boitho  
Browser="boitho.com-dc"  
 
[boitho.com-robot/*]  
Parent=Boitho  
Browser="boitho.com-robot"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Convera  
 
[Convera]  
Parent=DefaultProperties  
Browser="Convera"  
Frames=true  
Tables=true  
Crawler=true  
 
[ConveraCrawler/*]  
Parent=Convera  
Browser="ConveraCrawler"  
 
[ConveraMultiMediaCrawler/0.1*]  
Parent=Convera  
Browser="ConveraMultiMediaCrawler"  
Version=0.1  
MajorVer=0  
MinorVer=1  
 
[CrawlConvera*]  
Parent=Convera  
Browser="CrawlConvera"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DotBot  
 
[DotBot]  
Parent=DefaultProperties  
Browser="DotBot"  
Frames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[DotBot/* (http://www.dotnetdotcom.org/*)]  
Parent=DotBot  
 
[Mozilla/5.0 (compatible; DotBot/*; http://www.dotnetdotcom.org/*)]  
Parent=DotBot  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Entireweb  
 
[Entireweb]  
Parent=DefaultProperties  
Browser="Entireweb"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[Mozilla/5.0 (compatible; Speedy Spider; http://www.entireweb.com/about/search_tech/speedy_spider/)]  
Parent=Entireweb  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Speedy Spider (http://www.entireweb.com/about/search_tech/speedy_spider/)]  
Parent=Entireweb  
 
[Speedy Spider (http://www.entireweb.com/about/search_tech/speedy_spider/)]  
Parent=Entireweb  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Envolk  
 
[Envolk]  
Parent=DefaultProperties  
Browser="Envolk"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[envolk/* (?http://www.envolk.com/envolk*)]  
Parent=Envolk  
 
[envolk?ITS?spider/* (?http://www.envolk.com/envolk*)]  
Parent=Envolk  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exalead  
 
[Exalead]  
Parent=DefaultProperties  
Browser="Exalead"  
Frames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[Exabot-Images/1.0]  
Parent=Exalead  
Browser="Exabot-Images"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Exabot-Test/*]  
Parent=Exalead  
Browser="Exabot-Test"  
 
[Exabot/2.0]  
Parent=Exalead  
Browser="Exabot"  
 
[Exabot/3.0]  
Parent=Exalead  
Browser="Exabot"  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Liberate  
 
[Exalead NG/*]  
Parent=Exalead  
Browser="Exalead NG"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Exabot-Images/3.0;*)]  
Parent=Exalead  
Browser="Exabot-Images"  
 
[Mozilla/5.0 (compatible; Exabot/3.0 (BiggerBetter); *)]  
Parent=Exalead  
Browser="Exabot/BiggerBetter"  
 
[Mozilla/5.0 (compatible; Exabot/3.0;*)]  
Parent=Exalead  
Browser="Exabot"  
isBanned=false  
 
[Mozilla/5.0 (compatible; NGBot/*)]  
Parent=Exalead  
 
[ng/*]  
Parent=Exalead  
Browser="Exalead Previewer"  
Version=1.0  
MajorVer=1  
MinorVer=0  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Facebook  
 
[Facebook]  
Parent=DefaultProperties  
Browser="Facebook"  
Frames=true  
Tables=true  
Crawler=true  
 
[facebookexternalhit/* (?http://www.facebook.com/externalhit_uatext.php)*]  
Parent=Facebook  
Browser="FacebookExternalHit"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Fast/AllTheWeb  
 
[Fast/AllTheWeb]  
Parent=DefaultProperties  
Browser="Fast/AllTheWeb"  
Alpha=true  
Beta=true  
Win16=true  
Win32=true  
Win64=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
isBanned=true  
isMobileDevice=true  
isSyndicationReader=true  
Crawler=true  
 
[*FAST Enterprise Crawler*]  
Parent=Fast/AllTheWeb  
Browser="FAST Enterprise Crawler"  
 
[FAST Data Search Document Retriever/4.0*]  
Parent=Fast/AllTheWeb  
Browser="FAST Data Search Document Retriever"  
 
[FAST MetaWeb Crawler (helpdesk at fastsearch dot com)]  
Parent=Fast/AllTheWeb  
Browser="FAST MetaWeb Crawler"  
 
[Fast PartnerSite Crawler*]  
Parent=Fast/AllTheWeb  
Browser="FAST PartnerSite"  
 
[FAST-WebCrawler/*]  
Parent=Fast/AllTheWeb  
Browser="FAST-WebCrawler"  
 
[FAST-WebCrawler/*/FirstPage*]  
Parent=Fast/AllTheWeb  
Browser="FAST-WebCrawler/FirstPage"  
 
[FAST-WebCrawler/*/Fresh*]  
Parent=Fast/AllTheWeb  
Browser="FAST-WebCrawler/Fresh"  
 
[FAST-WebCrawler/*/PartnerSite*]  
Parent=Fast/AllTheWeb  
Browser="FAST PartnerSite"  
 
[FAST-WebCrawler/*?Multimedia*]  
Parent=Fast/AllTheWeb  
Browser="FAST-WebCrawler/Multimedia"  
 
[FastSearch Web Crawler for*]  
Parent=Fast/AllTheWeb  
Browser="FastSearch Web Crawler"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Gigabot  
 
[Gigabot]  
Parent=DefaultProperties  
Browser="Gigabot"  
Frames=true  
IFrames=true  
Tables=true  
Crawler=true  
 
[Gigabot*]  
Parent=Gigabot  
 
[GigabotSiteSearch/*]  
Parent=Gigabot  
Browser="GigabotSiteSearch"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ilse  
 
[Ilse]  
Parent=DefaultProperties  
Browser="Ilse"  
Frames=true  
Tables=true  
Crawler=true  
 
[IlseBot/*]  
Parent=Ilse  
 
[INGRID/?.0*]  
Parent=Ilse  
Browser="Ilse"  
 
[Mozilla/3.0 (INGRID/*]  
Parent=Ilse  
Browser="Ilse"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iVia Project  
 
[iVia Project]  
Parent=DefaultProperties  
Browser="iVia Project"  
Frames=true  
IFrames=true  
Tables=true  
Crawler=true  
 
[DataFountains/DMOZ Downloader*]  
Parent=iVia Project  
Browser="DataFountains/DMOZ Downloader"  
isBanned=true  
 
[DataFountains/DMOZ Feature Vector Corpus Creator*]  
Parent=iVia Project  
Browser="DataFountains/DMOZ Feature Vector Corpus"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Jayde Online  
 
[Jayde Online]  
Parent=DefaultProperties  
Browser="Jayde Online"  
Frames=true  
Tables=true  
Crawler=true  
 
[ExactSeek Crawler/*]  
Parent=Jayde Online  
Browser="ExactSeek Crawler"  
 
[exactseek-pagereaper-* (crawler@exactseek.com)]  
Parent=Jayde Online  
Browser="exactseek-pagereaper"  
isBanned=true  
 
[exactseek.com]  
Parent=Jayde Online  
Browser="exactseek.com"  
 
[Jayde Crawler*]  
Parent=Jayde Online  
Browser="Jayde Crawler"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lycos  
 
[Lycos]  
Parent=DefaultProperties  
Browser="Lycos"  
Frames=true  
Tables=true  
Crawler=true  
 
[Lycos*]  
Parent=Lycos  
Browser="Lycos"  
 
[Lycos-Proxy]  
Parent=Lycos  
Browser="Lycos-Proxy"  
 
[Lycos-Spider_(modspider)]  
Parent=Lycos  
Browser="Lycos-Spider_(modspider)"  
 
[Lycos-Spider_(T-Rex)]  
Parent=Lycos  
Browser="Lycos-Spider_(T-Rex)"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Naver  
 
[Naver]  
Parent=DefaultProperties  
Browser="Naver"  
isBanned=true  
Crawler=true  
 
[Cowbot-* (NHN Corp*naver.com)]  
Parent=Naver  
Browser="Naver Cowbot"  
 
[Mozilla/4.0 (compatible; NaverBot/*; *)]  
Parent=Naver  
 
[Mozilla/4.0 (compatible; NaverBot/*; nhnbot@naver.com)]  
Parent=Naver  
Browser="Naver NaverBot"  
 
[NaverBot-* (NHN Corp*naver.com)]  
Parent=Naver  
Browser="Naver NHN Corp"  
 
[Yeti/*]  
Parent=Naver  
Browser="Yeti"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Snap  
 
[Snap]  
Parent=DefaultProperties  
Browser="Snap"  
isBanned=true  
Crawler=true  
 
[Mozilla/5.0 (SnapPreviewBot) Gecko/* Firefox/*]  
Parent=Snap  
 
[Snapbot/*]  
Parent=Snap  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Sogou  
 
[Sogou]  
Parent=DefaultProperties  
Browser="Sogou"  
Frames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[shaboyi spider]  
Parent=Sogou  
Browser="Sogou/Shaboyi Spider"  
 
[Sogou develop spider/*]  
Parent=Sogou  
Browser="Sogou Develop Spider"  
 
[Sogou head spider*]  
Parent=Sogou  
Browser="Sogou/HEAD Spider"  
 
[sogou js robot(*)]  
Parent=Sogou  
 
[Sogou Orion spider/*]  
Parent=Sogou  
Browser="Sogou Orion spider"  
 
[Sogou Pic Agent]  
Parent=Sogou  
Browser="Sogou/Image Crawler"  
 
[Sogou Pic Spider]  
Parent=Sogou  
Browser="Sogou Pic Spider"  
 
[Sogou Push Spider/*]  
Parent=Sogou  
Browser="Sogou Push Spider"  
 
[sogou spider]  
Parent=Sogou  
Browser="Sogou/Spider"  
 
[sogou web spider*]  
Parent=Sogou  
Browser="sogou web spider"  
 
[Sogou-Test-Spider/*]  
Parent=Sogou  
Browser="Sogou-Test-Spider"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; YodaoBot  
 
[YodaoBot]  
Parent=DefaultProperties  
Browser="YodaoBot"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[Mozilla/5.0 (compatible; YodaoBot/1.*)]  
Parent=YodaoBot  
 
[Mozilla/5.0 (compatible;YodaoBot-Image/1.*)]  
Parent=YodaoBot  
Browser="YodaoBot-Image"  
 
[WAP_Browser/5.0 (compatible; YodaoBot/1.*)]  
Parent=YodaoBot  
 
[YodaoBot/1.* (*)]  
Parent=YodaoBot  
 
[Best Whois (http://www.bestwhois.net/)]  
Parent=DNS Tools  
Browser="Best Whois"  
 
[DNSGroup/*]  
Parent=DNS Tools  
Browser="DNS Group Crawler"  
 
[NG-Search/*]  
Parent=Exalead  
Browser="NG-SearchBot"  
 
[TouchStone]  
Parent=Feeds Syndicators  
Browser="TouchStone"  
isSyndicationReader=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; General Crawlers  
 
[General Crawlers]  
Parent=DefaultProperties  
Browser="General Crawlers"  
Crawler=true  
 
[A .NET Web Crawler]  
Parent=General Crawlers  
isBanned=true  
 
[BabalooSpider/1.*]  
Parent=General Crawlers  
Browser="BabalooSpider"  
 
[BilgiBot/*]  
Parent=General Crawlers  
Browser="BilgiBot"  
isBanned=true  
 
[bitlybot/2.*]  
Parent=General Crawlers  
Browser="BitlyBot"  
 
[bot/* (bot; *bot@bot.bot)]  
Parent=General Crawlers  
Browser="bot"  
isBanned=true  
 
[CyberPatrol*]  
Parent=General Crawlers  
Browser="CyberPatrol"  
isBanned=true  
 
[Cynthia 1.0]  
Parent=General Crawlers  
Browser="Cynthia"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[cz32ts]  
Parent=General Crawlers  
Browser="cz32ts"  
isBanned=true  
 
[ddetailsbot (http://www.displaydetails.com)]  
Parent=General Crawlers  
Browser="ddetailsbot"  
 
[DomainCrawler/1.0 (info@domaincrawler.com; http://www.domaincrawler.com/domains/view/*)]  
Parent=General Crawlers  
Browser="DomainCrawler"  
 
[DomainsBotBot/1.*]  
Parent=General Crawlers  
Browser="DomainsBotBot"  
isBanned=true  
 
[DomainsDB.net MetaCrawler*]  
Parent=General Crawlers  
Browser="DomainsDB"  
 
[Drupal (*)]  
Parent=General Crawlers  
Browser="Drupal"  
 
[Dumbot (version *)*]  
Parent=General Crawlers  
Browser="Dumbfind"  
 
[EuripBot/*]  
Parent=General Crawlers  
Browser="Europe Internet Portal"  
 
[eventax/*]  
Parent=General Crawlers  
Browser="eventax"  
 
[FANGCrawl/*]  
Parent=General Crawlers  
Browser="Safe-t.net Web Filtering Service"  
isBanned=true  
 
[favorstarbot/*]  
Parent=General Crawlers  
Browser="favorstarbot"  
isBanned=true  
 
[FollowSite.com (*)]  
Parent=General Crawlers  
Browser="FollowSite"  
isBanned=true  
 
[Gaisbot*]  
Parent=General Crawlers  
Browser="Gaisbot"  
 
[Healthbot/Health_and_Longevity_Project_(HealthHaven.com) ]  
Parent=General Crawlers  
Browser="Healthbot"  
isBanned=true  
 
[hitcrawler_0.*]  
Parent=General Crawlers  
Browser="hitcrawler"  
isBanned=true  
 
[htdig/*]  
Parent=General Crawlers  
Browser="ht://Dig"  
 
[http://hilfe.acont.de/bot.html ACONTBOT]  
Parent=General Crawlers  
Browser="ACONTBOT"  
isBanned=true  
 
[HuaweiSymantecSpider/*]  
Parent=General Crawlers  
Browser="HuaweiSymantecSpider"  
 
[JetBrains*]  
Parent=General Crawlers  
Browser="Omea Pro"  
 
[JS-Kit URL Resolver, http://js-kit.com/]  
Parent=General Crawlers  
Browser="JS-Kit/Echo"  
 
[KakleBot - www.kakle.com/0.1]  
Parent=General Crawlers  
Browser="KakleBot"  
 
[KBeeBot/0.*]  
Parent=General Crawlers  
Browser="KBeeBot"  
isBanned=true  
 
[Keyword Density/*]  
Parent=General Crawlers  
Browser="Keyword Density"  
 
[LetsCrawl.com/1.0*]  
Parent=General Crawlers  
Browser="LetsCrawl.com"  
isBanned=true  
 
[Lincoln State Web Browser]  
Parent=General Crawlers  
Browser="Lincoln State Web Browser"  
isBanned=true  
 
[LinkedInBot/1.*]  
Parent=General Crawlers  
Browser="LinkedInBot"  
 
[Links4US-Crawler,*]  
Parent=General Crawlers  
Browser="Links4US-Crawler"  
isBanned=true  
 
[Lorkyll *.* -- lorkyll@444.net]  
Parent=General Crawlers  
Browser="Lorkyll"  
isBanned=true  
 
[Lsearch/sondeur]  
Parent=General Crawlers  
Browser="Lsearch/sondeur"  
isBanned=true  
 
[LucidMedia ClickSense/4.?]  
Parent=General Crawlers  
Browser="LucidMedia-ClickSense"  
isBanned=true  
 
[Made by ZmEu @ WhiteHat v0.* (www.WhiteHat.ro)]  
Parent=General Crawlers  
Browser="ZmEu"  
isBanned=true  
 
[magpie-crawler/1.*]  
Parent=General Crawlers  
Browser="magpie-crawler"  
 
[Mahalobot/1.0 (?http://www.mahalo.com/)]  
Parent=General Crawlers  
Browser="Mahalobot"  
 
[MapoftheInternet.com?(?http://MapoftheInternet.com)]  
Parent=General Crawlers  
Browser="MapoftheInternet"  
isBanned=true  
 
[Marvin v0.3]  
Parent=General Crawlers  
Browser="MedHunt"  
Version=0.3  
MajorVer=0  
MinorVer=3  
 
[masidani_bot_v0.6*]  
Parent=General Crawlers  
Browser="masidani_bot"  
 
[Metaspinner/0.01 (Metaspinner; http://www.meta-spinner.de/; support@meta-spinner.de/)]  
Parent=General Crawlers  
Browser="Metaspinner/0.01"  
Version=0.01  
MajorVer=0  
MinorVer=01  
 
[metatagsdir/*]  
Parent=General Crawlers  
Browser="metatagsdir"  
isBanned=true  
 
[Microsoft Windows Network Diagnostics]  
Parent=General Crawlers  
Browser="Microsoft Windows Network Diagnostics"  
isBanned=true  
 
[Miva (AlgoFeedback@miva.com)]  
Parent=General Crawlers  
Browser="Miva"  
 
[moget/*]  
Parent=General Crawlers  
Browser="Goo"  
 
[Mozdex/0.7.2*]  
Parent=General Crawlers  
Browser="Mozdex"  
 
[Mozilla Compatible (MS IE 3.01 WinNT)]  
Parent=General Crawlers  
isBanned=true  
 
[Mozilla/* (compatible; WebCapture*)]  
Parent=General Crawlers  
Browser="WebCapture"  
 
[Mozilla/4.0 (compatible; DepSpid/*)]  
Parent=General Crawlers  
Browser="DepSpid"  
 
[Mozilla/4.0 (compatible; MSIE 4.01; Vonna.com b o t)]  
Parent=General Crawlers  
Browser="Vonna.com"  
isBanned=true  
 
[Mozilla/4.0 (compatible; MSIE 4.01; Windows95)]  
Parent=General Crawlers  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 4.5; Windows 98; )]  
Parent=General Crawlers  
Win32=true  
 
[Mozilla/4.0 (compatible; MyFamilyBot/*)]  
Parent=General Crawlers  
Browser="MyFamilyBot"  
 
[Mozilla/4.0 (compatible; N-Stealth)]  
Parent=General Crawlers  
Browser="N-Stealth"  
 
[Mozilla/4.0 (compatible; Scumbot/*; Linux/*)]  
Parent=General Crawlers  
isBanned=true  
 
[Mozilla/4.0 (compatible; Spider; Linux)]  
Parent=General Crawlers  
isBanned=true  
 
[Mozilla/4.0 (compatible; Win32)]  
Parent=General Crawlers  
Browser="Unknown Crawler"  
isBanned=true  
 
[Mozilla/4.1]  
Parent=General Crawlers  
isBanned=true  
 
[Mozilla/4.5]  
Parent=General Crawlers  
isBanned=true  
 
[Mozilla/5.0 (*http://gnomit.com/) Gecko/* Gnomit/1.0]  
Parent=General Crawlers  
Browser="Gnomit"  
isBanned=true  
 
[Mozilla/5.0 (compatible; *; http://www.80legs.com/spider.html;) Gecko/*]  
Parent=General Crawlers  
Browser="80Legs"  
 
[Mozilla/5.0 (compatible; AboutUsBot/*)]  
Parent=General Crawlers  
Browser="AboutUsBot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; AdHitz; http://adhitz.com/)]  
Parent=General Crawlers  
Browser="AdHitz"  
 
[Mozilla/5.0 (compatible; aiHitBot*/*; +http://www.aihit.com/)]  
Parent=General Crawlers  
Browser="aiHitBot"  
 
[Mozilla/5.0 (compatible; BuzzRankingBot/*)]  
Parent=General Crawlers  
Browser="BuzzRankingBot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Crawly/1.*; +http://*/crawler.html)]  
Parent=General Crawlers  
Browser="Crawly"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Diffbot/0.1; +http://www.diffbot.com)]  
Parent=General Crawlers  
Browser="Diffbot"  
 
[Mozilla/5.0 (compatible; FirstSearchBot/1.0; *)]  
Parent=General Crawlers  
Browser="FirstSearchBot"  
 
[mozilla/5.0 (compatible; genevabot +http://www.healthdash.com)]  
Parent=General Crawlers  
Browser="Healthdash"  
 
[Mozilla/5.0 (compatible; JadynAveBot; *http://www.jadynave.com/robot*]  
Parent=General Crawlers  
Browser="JadynAveBot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Kyluka crawl; http://www.kyluka.com/crawl.html; crawl@kyluka.com)]  
Parent=General Crawlers  
Browser="Kyluka"  
 
[Mozilla/5.0 (compatible; LegalAnalysisAgent/1.*; http://www.legalx.net)]  
Parent=General Crawlers  
Browser="LegalAnalysisAgent"  
isBanned=true  
 
[Mozilla/5.0 (compatible; MJ12bot/v1.*)]  
Parent=General Crawlers  
Browser="MJ12bot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; MSIE 7.0 ?http://www.europarchive.org)]  
Parent=General Crawlers  
Browser="Europe Web Archive"  
 
[Mozilla/5.0 (compatible; Plukkie/1.?; http://www.botje.com/plukkie.htm)]  
Parent=General Crawlers  
Browser="Plukkie"  
 
[Mozilla/5.0 (compatible; Seznam screenshot-generator 2.0;*)]  
Parent=General Crawlers  
Browser="Seznam screenshot-generator"  
isBanned=true  
 
[Mozilla/5.0 (compatible; spbot/*; +http://www.seoprofiler.com/bot/ )]  
Parent=General Crawlers  
Browser="SEOprofiler"  
 
[Mozilla/5.0 (compatible; SuchbaerBot/0.*; +http://bot.suchbaer.de/info.html)]  
Parent=General Crawlers  
Browser="SuchbaerBot"  
 
[Mozilla/5.0 (compatible; Twingly Recon; http://www.twingly.com/)]  
Parent=General Crawlers  
Browser="Twingly Recon"  
 
[Mozilla/5.0 (compatible; unwrapbot/2.*; +http://www.unwrap.jp*)]  
Parent=General Crawlers  
Browser="UnWrap"  
 
[Mozilla/5.0 (compatible; Vermut*)]  
Parent=General Crawlers  
Browser="Vermut"  
 
[Mozilla/5.0 (compatible; Viralheat Bot/*) ]  
Parent=General Crawlers  
Browser="Viralheat"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Webbot/*)]  
Parent=General Crawlers  
Browser="Webbot.ru"  
isBanned=true  
 
[n4p_bot*]  
Parent=General Crawlers  
Browser="n4p_bot"  
 
[nabot*]  
Parent=General Crawlers  
Browser="Nabot"  
 
[NetCarta_WebMapper/*]  
Parent=General Crawlers  
Browser="NetCarta_WebMapper"  
isBanned=true  
 
[Netchart Adv Crawler*]  
Parent=General Crawlers  
Browser="Netchart Adv Crawler"  
isBanned=true  
 
[NetID.com Bot*]  
Parent=General Crawlers  
Browser="NetID.com Bot"  
isBanned=true  
 
[neTVision AG andreas.heidoetting@thomson-webcast.net]  
Parent=General Crawlers  
Browser="neTVision"  
 
[NextopiaBOT*]  
Parent=General Crawlers  
Browser="NextopiaBOT"  
 
[nicebot]  
Parent=General Crawlers  
Browser="nicebot"  
isBanned=true  
 
[niXXieBot?Foster*]  
Parent=General Crawlers  
Browser="niXXiebot-Foster"  
 
[Nozilla/P.N (Just for IDS woring)]  
Parent=General Crawlers  
Browser="Nozilla/P.N"  
isBanned=true  
 
[NSO_Debugger_User/2.0]  
Parent=General Crawlers  
Browser="NSO_Debugger_User"  
isBanned=true  
 
[Nudelsalat/*]  
Parent=General Crawlers  
Browser="Nudelsalat"  
isBanned=true  
 
[NV32ts]  
Parent=General Crawlers  
Browser="NV32ts"  
isBanned=true  
 
[Ocelli/*]  
Parent=General Crawlers  
Browser="Ocelli"  
 
[OpenTaggerBot (http://www.opentagger.com/opentaggerbot.htm)]  
Parent=General Crawlers  
Browser="OpenTaggerBot"  
 
[Oracle Enterprise Search]  
Parent=General Crawlers  
Browser="Oracle Enterprise Search"  
isBanned=true  
 
[Oracle Ultra Search]  
Parent=General Crawlers  
Browser="Oracle Ultra Search"  
 
[Pajaczek/*]  
Parent=General Crawlers  
Browser="Pajaczek"  
isBanned=true  
 
[panscient.com]  
Parent=General Crawlers  
Browser="panscient.com"  
isBanned=true  
 
[Patwebbot (http://www.herz-power.de/technik.html)]  
Parent=General Crawlers  
Browser="Patwebbot"  
 
[PDFBot (crawler@pdfind.com)]  
Parent=General Crawlers  
Browser="PDFBot"  
 
[Pete-Spider/1.*]  
Parent=General Crawlers  
Browser="Pete-Spider"  
isBanned=true  
 
[PhpDig/*]  
Parent=General Crawlers  
Browser="PhpDig"  
 
[PlantyNet_WebRobot*]  
Parent=General Crawlers  
Browser="PlantyNet"  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PluckIt  
 
[PluckItCrawler/1.0 (*)]  
Parent=General Crawlers  
isMobileDevice=true  
 
[PMAFind]  
Parent=General Crawlers  
Browser="PMAFind"  
isBanned=true  
 
[Poodle_predictor_1.0]  
Parent=General Crawlers  
Browser="Poodle Predictor"  
 
[QuickFinder Crawler]  
Parent=General Crawlers  
Browser="QuickFinder"  
isBanned=true  
 
[Radiation Retriever*]  
Parent=General Crawlers  
Browser="Radiation Retriever"  
isBanned=true  
 
[RedCarpet/*]  
Parent=General Crawlers  
Browser="RedCarpet"  
isBanned=true  
 
[RixBot (http://babelserver.org/rix)]  
Parent=General Crawlers  
Browser="RixBot"  
 
[roboobot/1.* (roboo; http://wap.roboo.com; winter.pi@roboo.com)]  
Parent=General Crawlers  
Browser="roboo"  
 
[Rome Client (http://tinyurl.com/64t5n) Ver: 0.*]  
Parent=General Crawlers  
Browser="TinyURL"  
 
[SBIder/*]  
Parent=General Crawlers  
Browser="SiteSell"  
 
[ScollSpider/2.*]  
Parent=General Crawlers  
Browser="ScollSpider"  
isBanned=true  
 
[Search Fst]  
Parent=General Crawlers  
Browser="Search Fst"  
 
[searchbot admin@google.com]  
Parent=General Crawlers  
Browser="searchbot"  
isBanned=true  
 
[Seeker.lookseek.com]  
Parent=General Crawlers  
Browser="LookSeek"  
isBanned=true  
 
[semanticdiscovery/*]  
Parent=General Crawlers  
Browser="Semantic Discovery"  
 
[SeznamBot/*]  
Parent=General Crawlers  
Browser="SeznamBot"  
isBanned=true  
 
[Shelob (shelob@gmx.net)]  
Parent=General Crawlers  
Browser="Shelob"  
isBanned=true  
 
[shelob v1.*]  
Parent=General Crawlers  
Browser="shelob"  
isBanned=true  
 
[ShopWiki/1.0*]  
Parent=General Crawlers  
Browser="ShopWiki"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[ShowXML/1.0 libwww/5.4.0]  
Parent=General Crawlers  
Browser="ShowXML"  
isBanned=true  
 
[sitecheck.internetseer.com*]  
Parent=General Crawlers  
Browser="Internetseer"  
 
[SMBot/*]  
Parent=General Crawlers  
Browser="SMBot"  
 
[sohu*]  
Parent=General Crawlers  
Browser="sohu-search"  
isBanned=true  
 
[SpankBot*]  
Parent=General Crawlers  
Browser="SpankBot"  
isBanned=true  
 
[spider (tspyyp@tom.com)]  
Parent=General Crawlers  
Browser="spider (tspyyp@tom.com)"  
isBanned=true  
 
[Sunrise/0.*]  
Parent=General Crawlers  
Browser="Sunrise"  
isBanned=true  
 
[Superpages URL Verification Engine]  
Parent=General Crawlers  
Browser="Superpages"  
 
[Surf Knight]  
Parent=General Crawlers  
Browser="Surf Knight"  
isBanned=true  
 
[SurveyBot/*]  
Parent=General Crawlers  
Browser="SurveyBot"  
isBanned=true  
 
[SynapticSearch/AI Crawler 1.?]  
Parent=General Crawlers  
Browser="SynapticSearch"  
isBanned=true  
 
[SyncMgr]  
Parent=General Crawlers  
Browser="SyncMgr"  
 
[Tagyu Agent/1.0]  
Parent=General Crawlers  
Browser="Tagyu"  
 
[Talkro Web-Shot/*]  
Parent=General Crawlers  
Browser="Talkro Web-Shot"  
isBanned=true  
 
[Tasap-image-robot/0.* (http://www.tasap.com)]  
Parent=General Crawlers  
Browser="Tasap-image-robot"  
isBanned=true  
 
[Tecomi Bot (http://www.tecomi.com/bot.htm)]  
Parent=General Crawlers  
Browser="Tecomi"  
 
[TencentTraveler*]  
Parent=General Crawlers  
Browser="TencentTraveler"  
 
[TheInformant*]  
Parent=General Crawlers  
Browser="TheInformant"  
isBanned=true  
 
[Toata dragostea*]  
Parent=General Crawlers  
Browser="Toata dragostea"  
isBanned=true  
 
[Tutorial Crawler*]  
Parent=General Crawlers  
isBanned=true  
 
[Twitterbot/0.*]  
Parent=General Crawlers  
Browser="Twitterbot"  
 
[UbiCrawler/*]  
Parent=General Crawlers  
Browser="UbiCrawler"  
 
[UCmore]  
Parent=General Crawlers  
Browser="UCmore"  
 
[User*Agent:*]  
Parent=General Crawlers  
isBanned=true  
 
[USER_AGENT]  
Parent=General Crawlers  
Browser="USER_AGENT"  
isBanned=true  
 
[VadixBot]  
Parent=General Crawlers  
Browser="VadixBot"  
 
[VengaBot/*]  
Parent=General Crawlers  
Browser="VengaBot"  
isBanned=true  
 
[Visicom Toolbar]  
Parent=General Crawlers  
Browser="Visicom Toolbar"  
 
[Visited by http://tools.geek-tools.org]  
Parent=General Crawlers  
Browser="geek-tools.org"  
 
[Webclipping.com]  
Parent=General Crawlers  
Browser="Webclipping.com"  
isBanned=true  
 
[webcollage/*]  
Parent=General Crawlers  
Browser="WebCollage"  
isBanned=true  
 
[WebCrawler_1.*]  
Parent=General Crawlers  
Browser="WebCrawler"  
 
[WebFilter Robot*]  
Parent=General Crawlers  
Browser="WebFilter Robot"  
 
[WeBoX/*]  
Parent=General Crawlers  
Browser="WeBoX"  
 
[WebTrends/*]  
Parent=General Crawlers  
Browser="WebTrends"  
 
[West Wind Internet Protocols*]  
Parent=General Crawlers  
Browser="Versatel"  
isBanned=true  
 
[WhizBang]  
Parent=General Crawlers  
Browser="WhizBang"  
 
[Willow Internet Crawler by Twotrees V*]  
Parent=General Crawlers  
Browser="Willow Internet Crawler"  
 
[WIRE/* (Linux*Bot,Robot,Spider,Crawler)]  
Parent=General Crawlers  
Browser="WIRE"  
isBanned=true  
 
[www.fi crawler, contact crawler@www.fi]  
Parent=General Crawlers  
Browser="www.fi crawler"  
 
[Xerka WebBot v1.*]  
Parent=General Crawlers  
Browser="Xerka"  
isBanned=true  
 
[XML Sitemaps Generator*]  
Parent=General Crawlers  
Browser="XML Sitemaps Generator"  
 
[XSpider*]  
Parent=General Crawlers  
Browser="XSpider"  
isBanned=true  
 
[YooW!/* (?http://www.yoow.eu)]  
Parent=General Crawlers  
Browser="YooW!"  
isBanned=true  
 
[HiddenMarket-*]  
Parent=General RSS  
Browser="HiddenMarket"  
isBanned=true  
 
[FOTOCHECKER]  
Parent=Image Crawlers  
Browser="FOTOCHECKER"  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Search Engines  
 
[Search Engines]  
Parent=DefaultProperties  
Browser="Search Engines"  
Crawler=true  
 
[*FDSE robot*]  
Parent=Search Engines  
Browser="FDSE Robot"  
 
[*Fluffy the spider*]  
Parent=Search Engines  
Browser="SearchHippo"  
 
[Abacho*]  
Parent=Search Engines  
Browser="Abacho"  
 
[ah-ha.com crawler (crawler@ah-ha.com)]  
Parent=Search Engines  
Browser="Ah-Ha"  
 
[AIBOT/*]  
Parent=Search Engines  
Browser="21Seek.Com"  
 
[ALeadSoftbot/*]  
Parent=Search Engines  
Browser="ALeadSoftbot"  
 
[Amfibibot/*]  
Parent=Search Engines  
Browser="Amfibi"  
 
[AnswerBus (http://www.answerbus.com/)]  
Parent=Search Engines  
 
[antibot-V*]  
Parent=Search Engines  
Browser="antibot"  
 
[appie*(www.walhello.com)]  
Parent=Search Engines  
Browser="Walhello"  
 
[ASPSeek/*]  
Parent=Search Engines  
Browser="ASPSeek"  
 
[Atrax Solutions atraxbot/0.*; http://www.atraxsolutions.com/atraxbot]  
Parent=Search Engines  
Browser="Atrax Solutions"  
 
[BigCliqueBOT/*]  
Parent=Search Engines  
Browser="BigClique.com/BigClic.com"  
 
[Blaiz-Bee/*]  
Parent=Search Engines  
Browser="RawGrunt"  
 
[btbot/*]  
Parent=Search Engines  
Browser="Bit Torrent Search Engine"  
 
[Busiversebot/v1.0 (http://www.busiverse.com/bot.php)]  
Parent=Search Engines  
Browser="Busiversebot"  
isBanned=true  
 
[CatchBot/*; +http://www.catchbot.com]  
Parent=Search Engines  
Browser="CatchBot"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[CipinetBot (http://www.cipinet.com/bot.html)]  
Parent=Search Engines  
Browser="CipinetBot"  
 
[Cogentbot/1.?*]  
Parent=Search Engines  
Browser="Cogentbot"  
 
[compatible; Mozilla 4.0; MSIE 5.5; (SqwidgeBot v1.01 - http://www.sqwidge.com/bot/)]  
Parent=Search Engines  
Browser="SqwidgeBot"  
 
[cosmos*]  
Parent=Search Engines  
Browser="Xyleme"  
 
[Deepindex]  
Parent=Search Engines  
Browser="Deepindex"  
 
[DiamondBot]  
Parent=Search Engines  
Browser="DiamondBot"  
 
[DuckDuckBot/*; (?http://duckduckgo.com/duckduckbot.html)]  
Parent=Search Engines  
Browser="DuckDuckBot"  
 
[Dumbot*]  
Parent=Search Engines  
Browser="Dumbot"  
Version=0.2  
MajorVer=0  
MinorVer=2  
Beta=true  
 
[Eule?Robot*]  
Parent=Search Engines  
Browser="Eule-Robot"  
 
[Faxobot/*]  
Parent=Search Engines  
Browser="Faxo"  
 
[Filangy/*]  
Parent=Search Engines  
Browser="Filangy"  
 
[flatlandbot/*]  
Parent=Search Engines  
Browser="Flatland"  
 
[Fooky.com/ScorpionBot/ScoutOut;*]  
Parent=Search Engines  
Browser="ScorpionBot"  
isBanned=true  
 
[FyberSpider*]  
Parent=Search Engines  
Browser="FyberSpider"  
isBanned=true  
 
[Gaisbot/*]  
Parent=Search Engines  
Browser="Gaisbot"  
 
[gazz/*(gazz@nttr.co.jp)]  
Parent=Search Engines  
Browser="gazz"  
 
[geniebot*]  
Parent=Search Engines  
Browser="GenieKnows"  
 
[GOFORITBOT (?http://www.goforit.com/about/?)]  
Parent=Search Engines  
Browser="GoForIt"  
 
[GoGuidesBot/*]  
Parent=Search Engines  
Browser="GoGuidesBot"  
 
[GroschoBot/*]  
Parent=Search Engines  
Browser="GroschoBot"  
 
[GurujiBot/1.*]  
Parent=Search Engines  
Browser="GurujiBot"  
isBanned=true  
 
[HenryTheMiragoRobot*]  
Parent=Search Engines  
Browser="Mirago"  
 
[HolmesBot (http://holmes.ge)]  
Parent=Search Engines  
Browser="HolmesBot"  
 
[Hotzonu/*]  
Parent=Search Engines  
Browser="Hotzonu"  
 
[HyperEstraier/*]  
Parent=Search Engines  
Browser="HyperEstraier"  
isBanned=true  
 
[i1searchbot/*]  
Parent=Search Engines  
Browser="i1searchbot"  
 
[IIITBOT/1.*]  
Parent=Search Engines  
Browser="Indian Language Web Search Engine"  
 
[Iltrovatore-?etaccio/*]  
Parent=Search Engines  
Browser="Iltrovatore-Setaccio"  
 
[InfociousBot (?http://corp.infocious.com/tech_crawler.php)]  
Parent=Search Engines  
Browser="InfociousBot"  
isBanned=true  
 
[Infoseek SideWinder/*]  
Parent=Search Engines  
Browser="Infoseek"  
 
[iSEEKbot/*]  
Parent=Search Engines  
Browser="iSEEKbot"  
 
[Knight/0.? (Zook Knight; http://knight.zook.in/; knight@zook.in)]  
Parent=Search Engines  
Browser="Knight"  
 
[Kolinka Forum Search (www.kolinka.com)]  
Parent=Search Engines  
Browser="Kolinka Forum Search"  
isBanned=true  
 
[KRetrieve/]  
Parent=Search Engines  
Browser="KRetrieve"  
isBanned=true  
 
[LapozzBot/*]  
Parent=Search Engines  
Browser="LapozzBot"  
 
[Linguee Bot (http://www.linguee.com/bot; bot@linguee.com)]  
Parent=Search Engines  
Browser="Linguee Bot"  
 
[Linknzbot*]  
Parent=Search Engines  
Browser="Linknzbot"  
 
[LocalcomBot/*]  
Parent=Search Engines  
Browser="LocalcomBot"  
 
[Mail.Ru/1.0]  
Parent=Search Engines  
Browser="Mail.Ru"  
 
[MaSagool/*]  
Parent=Search Engines  
Browser="Sagoo"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[miniRank/*]  
Parent=Search Engines  
Browser="miniRank"  
 
[Mnogosearch*]  
Parent=Search Engines  
Browser="Mnogosearch"  
 
[Mozilla/0.9* no dos :) (Linux*)]  
Parent=Search Engines  
Browser="goliat"  
isBanned=true  
 
[Mozilla/4.0 (compatible; *Vagabondo/*; webcrawler at wise-guys dot nl; *)]  
Parent=Search Engines  
Browser="Vagabondo"  
 
[Mozilla/4.0 (compatible; Arachmo)]  
Parent=Search Engines  
Browser="Arachmo"  
 
[Mozilla/4.0 (compatible; http://search.thunderstone.com/texis/websearch/about.html)]  
Parent=Search Engines  
Browser="ThunderStone"  
isBanned=true  
 
[Mozilla/4.0 (compatible; MSIE *; Windows NT; Girafabot; girafabot at girafa dot com; http://www.girafa.com)]  
Parent=Search Engines  
Browser="Girafabot"  
Win32=true  
 
[Mozilla/4.0(?compatible; MSIE 6.0; Qihoo *)]  
Parent=Search Engines  
Browser="Qihoo"  
 
[Mozilla/4.7 (compatible; WhizBang; http://www.whizbang.com/crawler)]  
Parent=Search Engines  
Browser="Inxight Software"  
 
[Mozilla/5.0 (*) VoilaBot*]  
Parent=Search Engines  
Browser="VoilaBot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; ActiveTouristBot*; http://www.activetourist.com)]  
Parent=Search Engines  
Browser="ActiveTouristBot"  
 
[Mozilla/5.0 (compatible; ayna-crawler*)]  
Parent=Search Engines  
Browser="ayna-crawler"  
 
[Mozilla/5.0 (compatible; Butterfly/1.0; *)*]  
Parent=Search Engines  
Browser="Butterfly"  
 
[Mozilla/5.0 (compatible; Charlotte/*; *)]  
Parent=Search Engines  
Browser="Charlotte"  
Beta=true  
isBanned=true  
 
[Mozilla/5.0 (compatible; CXL-FatAssANT*)]  
Parent=Search Engines  
Browser="FatAssANT"  
 
[Mozilla/5.0 (compatible; DBLBot/1.0; ?http://www.dontbuylists.com/)]  
Parent=Search Engines  
Browser="DBLBot"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (compatible; EARTHCOM.info/*)]  
Parent=Search Engines  
Browser="EARTHCOM"  
 
[Mozilla/5.0 (compatible; Lipperhey Spider; http://www.lipperhey.com/)]  
Parent=Search Engines  
Browser="Lipperhey Spider"  
 
[Mozilla/5.0 (compatible; MojeekBot/*; http://www.mojeek.com/bot.html)]  
Parent=Search Engines  
Browser="MojeekBot"  
 
[Mozilla/5.0 (compatible; NLCrawler/*]  
Parent=Search Engines  
Browser="Northern Light Web Search"  
 
[Mozilla/5.0 (compatible; OsO;*]  
Parent=Search Engines  
Browser="Octopodus"  
isBanned=true  
 
[Mozilla/5.0 (compatible; ParchBot/1.0;*)]  
Parent=Search Engines  
Browser="ParchBot"  
 
[Mozilla/5.0 (compatible; Pogodak.*)]  
Parent=Search Engines  
Browser="Pogodak"  
 
[Mozilla/5.0 (compatible; Quantcastbot/1.*)]  
Parent=Search Engines  
Browser="Quantcastbot"  
 
[Mozilla/5.0 (compatible; ScoutJet; +http://www.scoutjet.com/)]  
Parent=Search Engines  
Browser="ScoutJet"  
isBanned=true  
 
[Mozilla/5.0 (compatible; Scrubby/*; +http://www.scrubtheweb.com/abs/meta-check.html)]  
Parent=Search Engines  
Browser="Scrubby"  
isBanned=true  
 
[Mozilla/5.0 (compatible; YoudaoBot/1.*; http://www.youdao.com/help/webmaster/spider/*)]  
Parent=Search Engines  
Browser="YoudaoBot"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (Twiceler*)]  
Parent=Search Engines  
Browser="Twiceler"  
isBanned=true  
 
[Mozilla/5.0 CostaCider Search*]  
Parent=Search Engines  
Browser="CostaCider Search"  
 
[Mozilla/5.0 GurujiBot/1.0 (*)]  
Parent=Search Engines  
Browser="GurujiBot"  
 
[NavissoBot]  
Parent=Search Engines  
Browser="NavissoBot"  
 
[NextGenSearchBot*(for information visit *)]  
Parent=Search Engines  
Browser="ZoomInfo"  
isBanned=true  
 
[Norbert the Spider(Burf.com)]  
Parent=Search Engines  
Browser="Norbert the Spider"  
 
[NuSearch Spider*]  
Parent=Search Engines  
Browser="nuSearch"  
 
[ObjectsSearch/*]  
Parent=Search Engines  
Browser="ObjectsSearch"  
 
[OOZBOT/0.20 ( http://www.setooz.com/oozbot.html ; agentname at setooz dot_com )]  
Parent=Search Engines  
Browser="Setooz"  
 
[OpenISearch/1.*]  
Parent=Search Engines  
Browser="OpenISearch (Amazon)"  
 
[Pagebull http://www.pagebull.com/]  
Parent=Search Engines  
Browser="Pagebull"  
 
[PEERbot*]  
Parent=Search Engines  
Browser="PEERbot"  
 
[Pompos/*]  
Parent=Search Engines  
Browser="Pompos"  
 
[Popdexter/*]  
Parent=Search Engines  
Browser="Popdex"  
 
[Qweery*]  
Parent=Search Engines  
Browser="QweeryBot"  
 
[RedCell/* (*)]  
Parent=Search Engines  
Browser="RedCell"  
 
[SaladSpoon/ShopSalad 1.* (Search Engine crawler for ShopSalad.com; *; crawler@shopsalad.com)]  
Parent=Search Engines  
Browser="ShopSalad"  
 
[Scrubby/*]  
Parent=Search Engines  
Browser="Scrub The Web"  
 
[Search-10/*]  
Parent=Search Engines  
Browser="Search-10"  
 
[search.ch*]  
Parent=Search Engines  
Browser="Swiss Search Engine"  
 
[Searchmee! Spider*]  
Parent=Search Engines  
Browser="Searchmee!"  
 
[Seekbot/*]  
Parent=Search Engines  
Browser="Seekbot"  
 
[SiteSpider]  
Parent=Search Engines  
Browser="SiteSpider"  
 
[Sosospider?(+http://help.soso.com/webspider.htm)]  
Parent=Search Engines  
Browser="Sosospider"  
 
[Spinne/*]  
Parent=Search Engines  
Browser="Spinne"  
 
[sproose/*]  
Parent=Search Engines  
Browser="Sproose"  
 
[Sqeobot/0.*]  
Parent=Search Engines  
Browser="Branzel"  
isBanned=true  
 
[SquigglebotBot/*]  
Parent=Search Engines  
Browser="SquigglebotBot"  
isBanned=true  
 
[StackRambler/*]  
Parent=Search Engines  
Browser="StackRambler"  
 
[SygolBot*]  
Parent=Search Engines  
Browser="SygolBot"  
 
[SynoBot]  
Parent=Search Engines  
Browser="SynoBot"  
 
[Szukacz/*]  
Parent=Search Engines  
Browser="Szukacz"  
 
[Tarantula/*]  
Parent=Search Engines  
Browser="Tarantula"  
isBanned=true  
 
[TerrawizBot/*]  
Parent=Search Engines  
Browser="TerrawizBot"  
isBanned=true  
 
[Tkensaku/*]  
Parent=Search Engines  
Browser="Tkensaku"  
 
[TMCrawler]  
Parent=Search Engines  
Browser="TMCrawler"  
isBanned=true  
 
[TwengaBot-Discover (http://www.twenga.fr/bot-discover.html)]  
Parent=Search Engines  
Browser="TwengaBot-Discover"  
 
[Twingly Recon]  
Parent=Search Engines  
Browser="Twingly Recon"  
isBanned=true  
 
[updated/*]  
Parent=Search Engines  
Browser="Updated!"  
 
[URL Spider Pro/*]  
Parent=Search Engines  
Browser="URL Spider Pro"  
 
[URL Spider SQL*]  
Parent=Search Engines  
Browser="Innerprise Enterprise Search"  
 
[VMBot/*]  
Parent=Search Engines  
Browser="VMBot"  
 
[voyager/2.0 (http://www.kosmix.com/html/crawler.html)]  
Parent=Search Engines  
Browser="Voyager"  
 
[wadaino.jp-crawler*]  
Parent=Search Engines  
Browser="wadaino.jp"  
isBanned=true  
 
[WebAlta Crawler/*]  
Parent=Search Engines  
Browser="WebAlta Crawler"  
isBanned=true  
 
[WebCorp/*]  
Parent=Search Engines  
Browser="WebCorp"  
isBanned=true  
 
[webcrawl.net]  
Parent=Search Engines  
Browser="webcrawl.net"  
 
[WISEbot/*]  
Parent=Search Engines  
Browser="WISEbot"  
isBanned=true  
 
[Wotbox/*]  
Parent=Search Engines  
Browser="Wotbox"  
 
[www.zatka.com]  
Parent=Search Engines  
Browser="Zatka"  
 
[WWWeasel Robot v*]  
Parent=Search Engines  
Browser="World Wide Weasel"  
 
[YadowsCrawler*]  
Parent=Search Engines  
Browser="YadowsCrawler"  
 
[YodaoBot/*]  
Parent=Search Engines  
Browser="YodaoBot"  
isBanned=true  
 
[ZeBot_www.ze.bz*]  
Parent=Search Engines  
Browser="ZE.bz"  
 
[zibber-v*]  
Parent=Search Engines  
Browser="Zibb"  
 
[ZipppBot/*]  
Parent=Search Engines  
Browser="ZipppBot"  
 
[ATA-Translation-Service]  
Parent=Translators  
Browser="ATA-Translation-Service"  
 
[GJK_Browser_Check]  
Parent=Version Checkers  
Browser="GJK_Browser_Check"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hatena  
 
[Hatena]  
Parent=DefaultProperties  
Browser="Hatena"  
isBanned=true  
Crawler=true  
 
[Feed::Find/*]  
Parent=Hatena  
Browser="Feed Find"  
isSyndicationReader=true  
 
[Hatena Antenna/*]  
Parent=Hatena  
Browser="Hatena Antenna"  
 
[Hatena Bookmark/*]  
Parent=Hatena  
Browser="Hatena Bookmark"  
 
[Hatena RSS/*]  
Parent=Hatena  
Browser="Hatena RSS"  
isSyndicationReader=true  
 
[Hatena::Crawler/*]  
Parent=Hatena  
Browser="Hatena Crawler"  
 
[HatenaScreenshot*]  
Parent=Hatena  
Browser="HatenaScreenshot"  
 
[URI::Fetch/*]  
Parent=Hatena  
Browser="URI::Fetch"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Internet Archive  
 
[Internet Archive]  
Parent=DefaultProperties  
Browser="Internet Archive"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[*heritrix*]  
Parent=Internet Archive  
Browser="Heritrix"  
isBanned=true  
 
[ia_archiver*]  
Parent=Internet Archive  
Browser="Internet Archive"  
 
[InternetArchive/*]  
Parent=Internet Archive  
Browser="InternetArchive"  
 
[Mozilla/5.0 (compatible; archive.org_bot*)]  
Parent=Internet Archive  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nutch  
 
[Nutch]  
Parent=DefaultProperties  
Browser="Nutch"  
isBanned=true  
Crawler=true  
 
[*Nutch*]  
Parent=Nutch  
isBanned=true  
 
[CazoodleBot/*]  
Parent=Nutch  
Browser="CazoodleBot"  
 
[LOOQ/0.1*]  
Parent=Nutch  
Browser="LOOQ"  
 
[Nutch/0.? (OpenX Spider)]  
Parent=Nutch  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Webaroo  
 
[Webaroo]  
Parent=DefaultProperties  
Browser="Webaroo"  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Webaroo/*)]  
Parent=Webaroo  
Browser="Webaroo"  
 
[Mozilla/5.0 (Windows; U; Windows *; *; rv:*) Gecko/* Firefox/* webaroo/*]  
Parent=Webaroo  
Browser="Webaroo"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Word Press  
 
[Word Press]  
Parent=DefaultProperties  
Browser="Word Press"  
Alpha=true  
Beta=true  
Win16=true  
Win32=true  
Win64=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
isBanned=true  
isMobileDevice=true  
isSyndicationReader=true  
Crawler=true  
 
[WordPress-B-/2.*]  
Parent=Word Press  
Browser="WordPress-B"  
 
[WordPress-Do-P-/2.*]  
Parent=Word Press  
Browser="WordPress-Do-P"  
 
[BlueCoat ProxySG]  
Parent=Blue Coat Systems  
Browser="BlueCoat ProxySG"  
 
[CerberianDrtrs/*]  
Parent=Blue Coat Systems  
Browser="Cerberian"  
 
[Inne: Mozilla/4.0 (compatible; Cerberian Drtrs*)]  
Parent=Blue Coat Systems  
Browser="Cerberian"  
 
[Mozilla/4.0 (compatible; Cerberian Drtrs*)]  
Parent=Blue Coat Systems  
Browser="Cerberian"  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Bluecoat DRTR)]  
Parent=Blue Coat Systems  
Browser="Bluecoat"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Copyright/Plagiarism  
 
[Copyright/Plagiarism]  
Parent=DefaultProperties  
Browser="Copyright/Plagiarism"  
isBanned=true  
Crawler=true  
 
[BDFetch]  
Parent=Copyright/Plagiarism  
Browser="BDFetch"  
 
[copyright sheriff (*)]  
Parent=Copyright/Plagiarism  
Browser="copyright sheriff"  
 
[CopyRightCheck*]  
Parent=Copyright/Plagiarism  
Browser="CopyRightCheck"  
 
[FairAd Client*]  
Parent=Copyright/Plagiarism  
Browser="FairAd Client"  
 
[iCopyright Conductor*]  
Parent=Copyright/Plagiarism  
Browser="iCopyright Conductor"  
 
[IPiumBot laurion(dot)com]  
Parent=Copyright/Plagiarism  
Browser="IPiumBot"  
 
[IWAgent/*]  
Parent=Copyright/Plagiarism  
Browser="Brand Protect"  
 
[Mozilla/5.0 (compatible; DKIMRepBot/*)]  
Parent=Copyright/Plagiarism  
Browser="DKIMRepBot"  
 
[oBot]  
Parent=Copyright/Plagiarism  
Browser="oBot"  
 
[SlySearch/*]  
Parent=Copyright/Plagiarism  
Browser="SlySearch"  
 
[TurnitinBot/*]  
Parent=Copyright/Plagiarism  
Browser="TurnitinBot"  
 
[TutorGigBot/*]  
Parent=Copyright/Plagiarism  
Browser="TutorGig"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DNS Tools  
 
[DNS Tools]  
Parent=DefaultProperties  
Browser="DNS Tools"  
Crawler=true  
 
[Domain Dossier utility*]  
Parent=DNS Tools  
Browser="Domain Dossier"  
 
[Mozilla/5.0 (compatible; DNS-Digger/*)]  
Parent=DNS Tools  
Browser="DNS-Digger"  
 
[OpenDNS Domain Crawler noc@opendns.com]  
Parent=DNS Tools  
Browser="OpenDNS Domain Crawler"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Download Managers  
 
[Download Managers]  
Parent=DefaultProperties  
Browser="Download Managers"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[A1 Website Download/1.* (*) miggibot]  
Parent=Download Managers  
Browser="A1 Website Download"  
 
[AndroidDownloadManager]  
Parent=Download Managers  
Browser="Android Download Manager"  
 
[AutoMate5]  
Parent=Download Managers  
Browser="AutoMate5"  
 
[Beamer*]  
Parent=Download Managers  
Browser="Beamer"  
 
[BitBeamer/*]  
Parent=Download Managers  
Browser="BitBeamer"  
 
[BitTorrent/*]  
Parent=Download Managers  
Browser="BitTorrent"  
 
[DA *]  
Parent=Download Managers  
Browser="Download Accelerator"  
 
[Download Demon*]  
Parent=Download Managers  
Browser="Download Demon"  
 
[Download Express*]  
Parent=Download Managers  
Browser="Download Express"  
 
[Download Master*]  
Parent=Download Managers  
Browser="Download Master"  
 
[Download Ninja*]  
Parent=Download Managers  
Browser="Download Ninja"  
 
[Download Wonder*]  
Parent=Download Managers  
Browser="Download Wonder"  
 
[DownloadSession*]  
Parent=Download Managers  
Browser="DownloadSession"  
 
[EasyDL/*]  
Parent=Download Managers  
Browser="EasyDL"  
 
[FDM 1.x]  
Parent=Download Managers  
Browser="Free Download Manager"  
 
[FlashGet]  
Parent=Download Managers  
Browser="FlashGet"  
 
[FreshDownload/*]  
Parent=Download Managers  
Browser="FreshDownload"  
 
[GetRight/*]  
Parent=Download Managers  
Browser="GetRight"  
 
[GetRightPro/*]  
Parent=Download Managers  
Browser="GetRightPro"  
 
[GetSmart/*]  
Parent=Download Managers  
Browser="GetSmart"  
 
[Go!Zilla*]  
Parent=Download Managers  
Browser="GoZilla"  
 
[Gozilla/*]  
Parent=Download Managers  
Browser="Gozilla"  
 
[Internet Ninja*]  
Parent=Download Managers  
Browser="Internet Ninja"  
 
[Kontiki Client*]  
Parent=Download Managers  
Browser="Kontiki Client"  
 
[lftp/3.2.1]  
Parent=Download Managers  
Browser="lftp"  
 
[LightningDownload/*]  
Parent=Download Managers  
Browser="LightningDownload"  
 
[LMQueueBot/*]  
Parent=Download Managers  
Browser="LMQueueBot"  
 
[MetaProducts Download Express/*]  
Parent=Download Managers  
Browser="Download Express"  
 
[Mozilla/4.0 (compatible; Getleft*)]  
Parent=Download Managers  
Browser="Getleft"  
 
[Myzilla]  
Parent=Download Managers  
Browser="Myzilla"  
 
[Net Vampire/*]  
Parent=Download Managers  
Browser="Net Vampire"  
 
[Net_Vampire*]  
Parent=Download Managers  
Browser="Net_Vampire"  
 
[NetAnts*]  
Parent=Download Managers  
Browser="NetAnts"  
 
[NetPumper*]  
Parent=Download Managers  
Browser="NetPumper"  
 
[NetSucker*]  
Parent=Download Managers  
Browser="NetSucker"  
 
[NetZip Downloader*]  
Parent=Download Managers  
Browser="NetZip Downloader"  
 
[NexTools WebAgent*]  
Parent=Download Managers  
Browser="NexTools WebAgent"  
 
[Offline Downloader*]  
Parent=Download Managers  
Browser="Offline Downloader"  
 
[P3P Client]  
Parent=Download Managers  
Browser="P3P Client"  
 
[PageDown*]  
Parent=Download Managers  
Browser="PageDown"  
 
[PicaLoader*]  
Parent=Download Managers  
Browser="PicaLoader"  
 
[Prozilla*]  
Parent=Download Managers  
Browser="Prozilla"  
 
[RealDownload/*]  
Parent=Download Managers  
Browser="RealDownload"  
 
[sEasyDL/*]  
Parent=Download Managers  
Browser="EasyDL"  
 
[shareaza*]  
Parent=Download Managers  
Browser="shareaza"  
 
[SmartDownload/*]  
Parent=Download Managers  
Browser="SmartDownload"  
 
[SpeedDownload/*]  
Parent=Download Managers  
Browser="Speed Download"  
 
[Star*Downloader/*]  
Parent=Download Managers  
Browser="StarDownloader"  
 
[STEROID Download]  
Parent=Download Managers  
Browser="STEROID Download"  
 
[SuperBot/*]  
Parent=Download Managers  
Browser="SuperBot"  
 
[Vegas95/*]  
Parent=Download Managers  
Browser="Vegas95"  
 
[WebZIP*]  
Parent=Download Managers  
Browser="WebZIP"  
 
[Wget*]  
Parent=Download Managers  
Browser="Wget"  
 
[WinTools]  
Parent=Download Managers  
Browser="WinTools"  
 
[Xaldon WebSpider*]  
Parent=Download Managers  
Browser="Xaldon WebSpider"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; E-Mail Harvesters  
 
[E-Mail Harvesters]  
Parent=DefaultProperties  
Browser="E-Mail Harvesters"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[*E-Mail Address Extractor*]  
Parent=E-Mail Harvesters  
Browser="E-Mail Address Extractor"  
 
[*Larbin*]  
Parent=E-Mail Harvesters  
Browser="Larbin"  
 
[*www4mail/*]  
Parent=E-Mail Harvesters  
Browser="www4mail"  
 
[8484 Boston Project*]  
Parent=E-Mail Harvesters  
Browser="8484 Boston Project"  
 
[Atomic_Email]  
Parent=E-Mail Harvesters  
Browser="Atomic_Email"  
 
[Atomic_Email_Hunter/*]  
Parent=E-Mail Harvesters  
Browser="Atomic Email Hunter"  
 
[CherryPicker*/*]  
Parent=E-Mail Harvesters  
Browser="CherryPickerElite"  
 
[Chilkat/*]  
Parent=E-Mail Harvesters  
Browser="Chilkat"  
 
[ContactBot/*]  
Parent=E-Mail Harvesters  
Browser="ContactBot"  
 
[eCatch*]  
Parent=E-Mail Harvesters  
Browser="eCatch"  
 
[EmailCollector*]  
Parent=E-Mail Harvesters  
Browser="E-Mail Collector"  
 
[EMAILsearcher]  
Parent=E-Mail Harvesters  
Browser="EMAILsearcher"  
 
[EmailSiphon*]  
Parent=E-Mail Harvesters  
Browser="E-Mail Siphon"  
 
[EmailWolf*]  
Parent=E-Mail Harvesters  
Browser="EMailWolf"  
 
[Epsilon SoftWorks' MailMunky]  
Parent=E-Mail Harvesters  
Browser="MailMunky"  
 
[ExtractorPro*]  
Parent=E-Mail Harvesters  
Browser="ExtractorPro"  
 
[Franklin Locator*]  
Parent=E-Mail Harvesters  
Browser="Franklin Locator"  
 
[Missigua Locator*]  
Parent=E-Mail Harvesters  
Browser="Missigua Locator"  
 
[Mozilla/4.0 (compatible; Advanced Email Extractor*)]  
Parent=E-Mail Harvesters  
Browser="Advanced Email Extractor"  
 
[Netprospector*]  
Parent=E-Mail Harvesters  
Browser="Netprospector"  
 
[ProWebWalker*]  
Parent=E-Mail Harvesters  
Browser="ProWebWalker"  
 
[sna-0.0.*]  
Parent=E-Mail Harvesters  
Browser="Mike Elliott's E-Mail Harvester"  
 
[WebEnhancer*]  
Parent=E-Mail Harvesters  
Browser="WebEnhancer"  
 
[WebMiner*]  
Parent=E-Mail Harvesters  
Browser="WebMiner"  
 
[ZIBB Crawler (email address / WWW address)]  
Parent=E-Mail Harvesters  
Browser="ZIBB Crawler"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Feeds Blogs  
 
[Feeds Blogs]  
Parent=DefaultProperties  
Browser="Feeds Blogs"  
isSyndicationReader=true  
Crawler=true  
 
[Bloglines Title Fetch/*]  
Parent=Feeds Blogs  
Browser="Bloglines Title Fetch"  
 
[Bloglines/* (http://www.bloglines.com*)]  
Parent=Feeds Blogs  
Browser="BlogLines Web"  
 
[BlogPulse (ISSpider-3.*)]  
Parent=Feeds Blogs  
Browser="BlogPulse"  
 
[BlogPulseLive (support@blogpulse.com)]  
Parent=Feeds Blogs  
Browser="BlogPulseLive"  
 
[blogsearchbot-pumpkin-2]  
Parent=Feeds Blogs  
Browser="blogsearchbot-pumpkin"  
isSyndicationReader=false  
 
[Irish Blogs Aggregator/*1.0*]  
Parent=Feeds Blogs  
Browser="Irish Blogs Aggregator"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[kinjabot (http://www.kinja.com; *)]  
Parent=Feeds Blogs  
Browser="kinjabot"  
 
[Net::Trackback/*]  
Parent=Feeds Blogs  
Browser="Net::Trackback"  
 
[Reblog*]  
Parent=Feeds Blogs  
Browser="Reblog"  
 
[WordPress/*]  
Parent=Feeds Blogs  
Browser="WordPress"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Feeds Syndicators  
 
[Feeds Syndicators]  
Parent=DefaultProperties  
Browser="Feeds Syndicators"  
isSyndicationReader=true  
 
[*LinkLint*]  
Parent=Feeds Syndicators  
Browser="LinkLint"  
 
[*NetNewsWire/*]  
Parent=Feeds Syndicators  
 
[*NetVisualize*]  
Parent=Feeds Syndicators  
Browser="NetVisualize"  
 
[AideRSS 2.* (postrank.com)]  
Parent=Feeds Syndicators  
Browser="AideRSS"  
 
[AideRSS/2.0 (aiderss.com)]  
Parent=Feeds Syndicators  
Browser="AideRSS"  
isBanned=true  
 
[Akregator/*]  
Parent=Feeds Syndicators  
Browser="Akregator"  
 
[Apple-PubSub/*]  
Parent=Feeds Syndicators  
Browser="Apple-PubSub"  
 
[AppleSyndication/*]  
Parent=Feeds Syndicators  
Browser="Safari RSS"  
Platform=MacOSX  
 
[Cocoal.icio.us/* (*)*]  
Parent=Feeds Syndicators  
Browser="Cocoal.icio.us"  
isBanned=true  
 
[Feed43 Proxy/* (*)]  
Parent=Feeds Syndicators  
Browser="Feed For Free"  
 
[FeedBurner/*]  
Parent=Feeds Syndicators  
Browser="FeedBurner"  
 
[FeedDemon/* (*)]  
Parent=Feeds Syndicators  
Browser="FeedDemon"  
Platform=Win32  
 
[FeedDigest/* (*)]  
Parent=Feeds Syndicators  
Browser="FeedDigest"  
 
[FeedGhost/1.*]  
Parent=Feeds Syndicators  
Browser="FeedGhost"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[FeedOnFeeds/0.1.* ( http://minutillo.com/steve/feedonfeeds/)]  
Parent=Feeds Syndicators  
Browser="FeedOnFeeds"  
Version=0.1  
MajorVer=0  
MinorVer=1  
 
[Feedreader * (Powered by Newsbrain)]  
Parent=Feeds Syndicators  
Browser="Newsbrain"  
 
[Feedshow/* (*)]  
Parent=Feeds Syndicators  
Browser="Feedshow"  
 
[Feedster Crawler/?.0; Feedster, Inc.]  
Parent=Feeds Syndicators  
Browser="Feedster"  
 
[GreatNews/1.0]  
Parent=Feeds Syndicators  
Browser="GreatNews"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Gregarius/*]  
Parent=Feeds Syndicators  
Browser="Gregarius"  
 
[intraVnews/*]  
Parent=Feeds Syndicators  
Browser="intraVnews"  
 
[JetBrains Omea Reader*]  
Parent=Feeds Syndicators  
Browser="Omea Reader"  
isBanned=true  
 
[Liferea/1.* (Linux; *; http://liferea.sf.net/)]  
Parent=Feeds Syndicators  
Browser="Liferea"  
isBanned=true  
 
[livedoor FeedFetcher/0.0* (http://reader.livedoor.com/;*)]  
Parent=Feeds Syndicators  
Browser="FeedFetcher"  
Version=0.0  
MajorVer=0  
MinorVer=0  
 
[MagpieRSS/* (*)]  
Parent=Feeds Syndicators  
Browser="MagpieRSS"  
 
[Mobitype * (compatible; Mozilla/*; MSIE *.*; Windows *)]  
Parent=Feeds Syndicators  
Browser="Mobitype"  
Platform=Win32  
 
[Mozilla/5.0 (*; Rojo *; http://www.rojo.com/corporate/help/agg; *)*]  
Parent=Feeds Syndicators  
Browser="Rojo"  
 
[Mozilla/5.0 (*aggregator:TailRank; http://tailrank.com/robot)*]  
Parent=Feeds Syndicators  
Browser="TailRank"  
 
[Mozilla/5.0 (compatible; MSIE 6.0; Podtech Network; crawler_admin@podtech.net)]  
Parent=Feeds Syndicators  
Browser="Podtech Network"  
 
[Mozilla/5.0 (compatible; Newz Crawler *; http://www.newzcrawler.com/?)]  
Parent=Feeds Syndicators  
Browser="Newz Crawler"  
 
[Mozilla/5.0 (compatible; RSSMicro.com RSS/Atom Feed Robot)]  
Parent=Feeds Syndicators  
Browser="RSSMicro"  
 
[Mozilla/5.0 (compatible;*newstin.com;*)]  
Parent=Feeds Syndicators  
Browser="NewsTin"  
 
[Mozilla/5.0 (RSS Reader Panel)]  
Parent=Feeds Syndicators  
Browser="RSS Reader Panel"  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:FeedParser; *) Gecko/*]  
Parent=Feeds Syndicators  
Browser="FeedParser"  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:NewsMonster; *) Gecko/*]  
Parent=Feeds Syndicators  
Browser="NewsMonster"  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.*; aggregator:Rojo; *) Gecko/*]  
Parent=Feeds Syndicators  
Browser="Rojo"  
 
[Mozilla/5.0 NewsFox/*]  
Parent=Feeds Syndicators  
Browser="NewsFox"  
 
[Netvibes (*)]  
Parent=Feeds Syndicators  
Browser="Netvibes"  
 
[NewsAlloy/* (*)]  
Parent=Feeds Syndicators  
Browser="NewsAlloy"  
 
[Omnipelagos*]  
Parent=Feeds Syndicators  
Browser="Omnipelagos"  
 
[Particls]  
Parent=Feeds Syndicators  
Browser="Particls"  
 
[Protopage/* (*)]  
Parent=Feeds Syndicators  
Browser="Protopage"  
 
[PubSub-RSS-Reader/* (*)]  
Parent=Feeds Syndicators  
Browser="PubSub-RSS-Reader"  
 
[RSS Menu/*]  
Parent=Feeds Syndicators  
Browser="RSS Menu"  
 
[RssBandit/*]  
Parent=Feeds Syndicators  
Browser="RssBandit"  
 
[RssBar/1.2*]  
Parent=Feeds Syndicators  
Browser="RssBar"  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[SharpReader/*]  
Parent=Feeds Syndicators  
Browser="SharpReader"  
 
[SimplePie/*]  
Parent=Feeds Syndicators  
Browser="SimplePie"  
 
[Strategic Board Bot (?http://www.strategicboard.com)]  
Parent=Feeds Syndicators  
Browser="Strategic Board Bot"  
isBanned=true  
 
[TargetYourNews.com bot]  
Parent=Feeds Syndicators  
Browser="TargetYourNews"  
 
[Technoratibot/*]  
Parent=Feeds Syndicators  
Browser="Technoratibot"  
 
[Tumblr/* RSS syndication ( http://www.tumblr.com/) (support@tumblr.com)]  
Parent=Feeds Syndicators  
Browser="Tumblr RSS syndication"  
 
[Windows-RSS-Platform/1.0*]  
Parent=Feeds Syndicators  
Browser="Windows-RSS-Platform"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Win32=true  
 
[Wizz RSS News Reader]  
Parent=Feeds Syndicators  
Browser="Wizz"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; General RSS  
 
[General RSS]  
Parent=DefaultProperties  
Browser="General RSS"  
isSyndicationReader=true  
 
[AideRSS/1.0 (aiderss.com); * subscribers]  
Parent=General RSS  
Browser="AideRSS"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[CC Metadata Scaper http://wiki.creativecommons.org/Metadata_Scraper]  
Parent=General RSS  
Browser="CC Metadata Scaper"  
 
[Mozilla/5.0 (compatible) GM RSS Panel]  
Parent=General RSS  
Browser="RSS Panel"  
 
[Mozilla/5.0 http://www.inclue.com; graeme@inclue.com]  
Parent=General RSS  
Browser="Inclue"  
 
[Runnk online rss reader : http://www.runnk.com/ : RSS favorites : RSS ranking : RSS aggregator*]  
Parent=General RSS  
Browser="Ruunk"  
 
[UniversalFeedParser/4.* +http://feedparser.org/]  
Parent=General RSS  
Browser="UniversalFeedParser"  
 
[Windows-RSS-Platform/2.0 (MSIE 8.0; Windows NT 6.0)]  
Parent=General RSS  
Browser="Windows-RSS-Platform"  
Platform=WinVista  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Validation Checkers  
 
[HTML Validators]  
Parent=DefaultProperties  
Browser="HTML Validators"  
Frames=true  
IFrames=true  
Tables=true  
Crawler=true  
 
[(HTML Validator http://www.searchengineworld.com/validator/)]  
Parent=HTML Validators  
Browser="Search Engine World HTML Validator"  
 
[FeedValidator/1.3]  
Parent=HTML Validators  
Browser="FeedValidator"  
Version=1.3  
MajorVer=1  
MinorVer=3  
 
[Search Engine World Robots.txt Validator*]  
Parent=HTML Validators  
Browser="Search Engine World Robots.txt Validator"  
 
[Weblide/2.? beta*]  
Parent=HTML Validators  
Browser="Weblide"  
Version=2.0  
MajorVer=2  
MinorVer=0  
Beta=true  
 
[WebmasterWorld StickyMail Server Header Checker*]  
Parent=HTML Validators  
Browser="WebmasterWorld Server Header Checker"  
 
[WWWC/*]  
Parent=HTML Validators  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Image Crawlers  
 
[Image Crawlers]  
Parent=DefaultProperties  
Browser="Image Crawlers"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[*CFNetwork*]  
Parent=Image Crawlers  
Browser="CFNetwork"  
 
[*PhotoStickies/*]  
Parent=Image Crawlers  
Browser="PhotoStickies"  
 
[Camcrawler*]  
Parent=Image Crawlers  
Browser="Camcrawler"  
 
[CydralSpider/*]  
Parent=Image Crawlers  
Browser="Cydral Web Image Search"  
isBanned=true  
 
[Der gro\xdfe BilderSauger*]  
Parent=Image Crawlers  
Browser="Gallery Grabber"  
 
[Extreme Picture Finder]  
Parent=Image Crawlers  
Browser="Extreme Picture Finder"  
 
[FLATARTS_FAVICO]  
Parent=Image Crawlers  
Browser="FlatArts Favorites Icon Tool"  
 
[HTML2JPG Blackbox, http://www.html2jpg.com]  
Parent=Image Crawlers  
Browser="HTML2JPG"  
 
[IconSurf/2.*]  
Parent=Image Crawlers  
Browser="IconSurf"  
 
[Mister PIX*]  
Parent=Image Crawlers  
Browser="Mister PIX"  
 
[Mozilla/5.0 (compatible; KaloogaBot; http://www.kalooga.com/info.html?page=crawler)]  
Parent=Image Crawlers  
Browser="KaloogaBot"  
 
[Mozilla/5.0 (Macintosh; U; *Mac OS X; *) AppleWebKit/* (*) Pandora/2.*]  
Parent=Image Crawlers  
Browser="Pandora"  
 
[naoFavicon4IE*]  
Parent=Image Crawlers  
Browser="naoFavicon4IE"  
 
[pixfinder/*]  
Parent=Image Crawlers  
Browser="pixfinder"  
 
[psbot/* (?http://www.picsearch.com/bot.html)]  
Parent=Image Crawlers  
Browser="PicSearchBot"  
 
[rssImagesBot/0.1 (*http://herbert.groot.jebbink.nl/?app=rssImages)]  
Parent=Image Crawlers  
Browser="rssImagesBot"  
 
[Web Image Collector*]  
Parent=Image Crawlers  
Browser="Web Image Collector"  
 
[WebImages * (?http://herbert.groot.jebbink.nl/?app=WebImages?)]  
Parent=Image Crawlers  
Browser="WebImages"  
 
[WebPix*]  
Parent=Image Crawlers  
Browser="Custo"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Link Checkers  
 
[Link Checkers]  
Parent=DefaultProperties  
Browser="Link Checkers"  
Frames=true  
IFrames=true  
Tables=true  
Crawler=true  
 
[!Susie (http://www.sync2it.com/susie)]  
Parent=Link Checkers  
Browser="!Susie"  
 
[*AgentName/*]  
Parent=Link Checkers  
Browser="AgentName"  
 
[*Linkman*]  
Parent=Link Checkers  
Browser="Linkman"  
 
[*LinksManager.com*]  
Parent=Link Checkers  
Browser="LinksManager"  
 
[*Powermarks/*]  
Parent=Link Checkers  
Browser="Powermarks"  
 
[*Web Link Validator*]  
Parent=Link Checkers  
Browser="Web Link Validator"  
 
[*Zeus*]  
Parent=Link Checkers  
Browser="Zeus"  
isBanned=true  
 
[ActiveBookmark *]  
Parent=Link Checkers  
Browser="ActiveBookmark"  
 
[Bookdog/*]  
Parent=Link Checkers  
Browser="Bookdog"  
 
[Bookmark Buddy*]  
Parent=Link Checkers  
Browser="Bookmark Buddy"  
 
[Bookmark Renewal Check Agent*]  
Parent=Link Checkers  
Browser="Bookmark Renewal Check Agent"  
 
[Bookmark search tool*]  
Parent=Link Checkers  
Browser="Bookmark search tool"  
 
[Bookmark-Manager]  
Parent=Link Checkers  
Browser="Bookmark-Manager"  
 
[Checkbot*]  
Parent=Link Checkers  
Browser="Checkbot"  
 
[CheckLinks/*]  
Parent=Link Checkers  
Browser="CheckLinks"  
 
[CyberSpyder Link Test/*]  
Parent=Link Checkers  
Browser="CyberSpyder Link Test"  
 
[DLC/*]  
Parent=Link Checkers  
Browser="DLC"  
 
[DocWeb Link Crawler (http://doc.php.net)]  
Parent=Link Checkers  
Browser="DocWeb Link Crawler"  
 
[FavOrg]  
Parent=Link Checkers  
Browser="FavOrg"  
 
[Favorites Sweeper v.3.*]  
Parent=Link Checkers  
Browser="Favorites Sweeper"  
 
[FindLinks/*]  
Parent=Link Checkers  
Browser="FindLinks"  
 
[Funnel Web Profiler*]  
Parent=Link Checkers  
Browser="Funnel Web Profiler"  
 
[Html Link Validator (www.lithopssoft.com)]  
Parent=Link Checkers  
Browser="HTML Link Validator"  
 
[IECheck]  
Parent=Link Checkers  
Browser="IECheck"  
 
[JCheckLinks/*]  
Parent=Link Checkers  
Browser="JCheckLinks"  
 
[JRTwine Software Check Favorites Utility]  
Parent=Link Checkers  
Browser="JRTwine"  
 
[Link Valet Online*]  
Parent=Link Checkers  
Browser="Link Valet"  
isBanned=true  
 
[LinkAlarm/*]  
Parent=Link Checkers  
Browser="LinkAlarm"  
 
[Linkbot*]  
Parent=Link Checkers  
Browser="Linkbot"  
 
[LinkChecker/*]  
Parent=Link Checkers  
Browser="LinkChecker"  
 
[LinkextractorPro*]  
Parent=Link Checkers  
Browser="LinkextractorPro"  
isBanned=true  
 
[LinkLint-checkonly/*]  
Parent=Link Checkers  
Browser="LinkLint"  
 
[LinkScan/*]  
Parent=Link Checkers  
Browser="LinkScan"  
 
[LinkSweeper/*]  
Parent=Link Checkers  
Browser="LinkSweeper"  
 
[LinkWalker*]  
Parent=Link Checkers  
Browser="LinkWalker"  
 
[MetaGer-LinkChecker]  
Parent=Link Checkers  
Browser="MetaGer-LinkChecker"  
 
[Mozilla/* (compatible; linktiger/*; *http://www.linktiger.com*)]  
Parent=Link Checkers  
Browser="LinkTiger"  
isBanned=true  
 
[Mozilla/4.0 (Compatible); URLBase*]  
Parent=Link Checkers  
Browser="URLBase"  
 
[Mozilla/4.0 (compatible; Link Utility; http://net-promoter.com)]  
Parent=Link Checkers  
Browser="NetPromoter Link Utility"  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Web Link Validator*]  
Parent=Link Checkers  
Browser="Web Link Validator"  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Win32) Link Commander 3.0]  
Parent=Link Checkers  
Browser="Link Commander"  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Win32  
 
[Mozilla/4.0 (compatible; smartBot/1.*; checking links; *)]  
Parent=Link Checkers  
Browser="smartBot"  
 
[Mozilla/4.0 (compatible; SuperCleaner*;*)]  
Parent=Link Checkers  
Browser="SuperCleaner"  
 
[Mozilla/5.0 gURLChecker/*]  
Parent=Link Checkers  
Browser="gURLChecker"  
isBanned=true  
 
[Newsgroupreporter LinkCheck]  
Parent=Link Checkers  
Browser="Newsgroupreporter LinkCheck"  
 
[onCHECK Linkchecker von www.scientec.de fuer www.onsinn.de]  
Parent=Link Checkers  
Browser="onCHECK Linkchecker"  
 
[online link validator (http://www.dead-links.com/)]  
Parent=Link Checkers  
Browser="Dead-Links.com"  
isBanned=true  
 
[REL Link Checker*]  
Parent=Link Checkers  
Browser="REL Link Checker"  
 
[RLinkCheker*]  
Parent=Link Checkers  
Browser="RLinkCheker"  
 
[Robozilla/*]  
Parent=Link Checkers  
Browser="Robozilla"  
 
[RPT-HTTPClient/*]  
Parent=Link Checkers  
Browser="RPT-HTTPClient"  
isBanned=true  
 
[SafariBookmarkChecker*(?http://www.coriolis.ch/)]  
Parent=Link Checkers  
Browser="SafariBookmarkChecker"  
Platform=MacOSX  
CssVersion=2  
supportsCSS=true  
 
[Simpy/* (Simpy; http://www.simpy.com/?ref=bot; feedback at simpy dot com)]  
Parent=Link Checkers  
Browser="Simpy"  
 
[SiteBar/*]  
Parent=Link Checkers  
Browser="SiteBar"  
 
[Susie (http://www.sync2it.com/bms/susie.php]  
Parent=Link Checkers  
Browser="Susie"  
 
[URLBase/6.*]  
Parent=Link Checkers  
 
[VSE/*]  
Parent=Link Checkers  
Browser="VSE Link Tester"  
 
[WebTrends Link Analyzer]  
Parent=Link Checkers  
Browser="WebTrends Link Analyzer"  
 
[WorQmada/*]  
Parent=Link Checkers  
Browser="WorQmada"  
 
[Xenu* Link Sleuth*]  
Parent=Link Checkers  
Browser="Xenu's Link Sleuth"  
isBanned=true  
 
[Z-Add Link Checker*]  
Parent=Link Checkers  
Browser="Z-Add Link Checker"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft  
 
[Microsoft]  
Parent=DefaultProperties  
Browser="Microsoft"  
isBanned=true  
 
[Live (http://www.live.com/)]  
Parent=Microsoft  
Browser="Microsoft Live"  
isBanned=false  
isSyndicationReader=true  
 
[MFC Foundation Class Library*]  
Parent=Microsoft  
Browser="MFC Foundation Class Library"  
 
[MFHttpScan]  
Parent=Microsoft  
Browser="MFHttpScan"  
 
[Microsoft BITS/*]  
Parent=Microsoft  
Browser="BITS"  
 
[Microsoft Data Access Internet Publishing Provider Cache Manager]  
Parent=Microsoft  
Browser="MS IPP"  
 
[Microsoft Data Access Internet Publishing Provider DAV*]  
Parent=Microsoft  
Browser="MS IPP DAV"  
 
[Microsoft Data Access Internet Publishing Provider Protocol Discovery]  
Parent=Microsoft  
Browser="MS IPPPD"  
 
[Microsoft Internet Explorer]  
Parent=Microsoft  
Browser="Fake IE"  
 
[Microsoft Office Existence Discovery]  
Parent=Microsoft  
Browser="Microsoft Office Existence Discovery"  
 
[Microsoft Office Protocol Discovery]  
Parent=Microsoft  
Browser="MS OPD"  
 
[Microsoft Office/* (*Picture Manager*)]  
Parent=Microsoft  
Browser="Microsoft Office Picture Manager"  
 
[Microsoft URL Control*]  
Parent=Microsoft  
Browser="Microsoft URL Control"  
 
[Microsoft Visio MSIE]  
Parent=Microsoft  
Browser="Microsoft Visio"  
 
[Microsoft-WebDAV-MiniRedir/*]  
Parent=Microsoft  
Browser="Microsoft-WebDAV"  
 
[Mozilla/5.0 (Macintosh; Intel Mac OS X) Excel/12.*]  
Parent=Microsoft  
Browser="Microsoft Excel"  
Version=12.0  
MajorVer=12  
MinorVer=0  
Platform=MacOSX  
 
[MSN Feed Manager]  
Parent=Microsoft  
Browser="MSN Feed Manager"  
isBanned=false  
isSyndicationReader=true  
 
[MSProxy/*]  
Parent=Microsoft  
Browser="MS Proxy"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Miscellaneous Browsers  
 
[Miscellaneous Browsers]  
Parent=DefaultProperties  
Browser="Miscellaneous Browsers"  
Frames=true  
Tables=true  
Cookies=true  
 
[*Amiga*]  
Parent=Miscellaneous Browsers  
Browser="Amiga"  
Platform=Amiga  
 
[*avantbrowser*]  
Parent=Miscellaneous Browsers  
Browser="Avant Browser"  
 
[12345]  
Parent=Miscellaneous Browsers  
Browser="12345"  
isBanned=true  
 
[1st ZipCommander (Net) - http://www.zipcommander.com/]  
Parent=Miscellaneous Browsers  
Browser="1st ZipCommander"  
 
[Ace Explorer]  
Parent=Miscellaneous Browsers  
Browser="Ace Explorer"  
 
[Enigma Browser*]  
Parent=Miscellaneous Browsers  
Browser="Enigma Browser"  
 
[EVE-minibrowser/*]  
Parent=Miscellaneous Browsers  
Browser="EVE-minibrowser"  
IFrames=false  
Tables=false  
BackgroundSounds=false  
VBScript=false  
JavaApplets=false  
JavaScript=false  
ActiveXControls=false  
isBanned=false  
Crawler=false  
 
[Godzilla/* (Basic*; *; Commodore C=64; *; rv:1.*)*]  
Parent=Miscellaneous Browsers  
Browser="Godzilla"  
 
[GreenBrowser]  
Parent=Miscellaneous Browsers  
Browser="GreenBrowser"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Kopiczek/* (WyderOS*; *)]  
Parent=Miscellaneous Browsers  
Browser="Kopiczek"  
Platform=WyderOS  
IFrames=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (*) - BrowseX (*)]  
Parent=Miscellaneous Browsers  
Browser="BrowseX"  
 
[Mozilla/* (Win32;*Escape?*; ?)]  
Parent=Miscellaneous Browsers  
Browser="Escape"  
Platform=Win32  
 
[Mozilla/4.0 (compatible; ibisBrowser)]  
Parent=Miscellaneous Browsers  
Browser="ibisBrowser"  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) AppleWebKit/* (*) HistoryHound/*]  
Parent=Miscellaneous Browsers  
Browser="HistoryHound"  
 
[NetRecorder*]  
Parent=Miscellaneous Browsers  
Browser="NetRecorder"  
 
[NetSurf*]  
Parent=Miscellaneous Browsers  
Browser="NetSurf"  
 
[ogeb browser , Version 1.1.0]  
Parent=Miscellaneous Browsers  
Browser="ogeb browser"  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[SCEJ PSP BROWSER 0102pspNavigator]  
Parent=Miscellaneous Browsers  
Browser="Wipeout Pure"  
 
[SlimBrowser]  
Parent=Miscellaneous Browsers  
Browser="SlimBrowser"  
 
[WWW_Browser/*]  
Parent=Miscellaneous Browsers  
Browser="WWW Browser"  
Version=1.69  
MajorVer=1  
MinorVer=69  
Platform=Win16  
CssVersion=3  
supportsCSS=true  
 
[*Netcraft Webserver Survey*]  
Parent=Netcraft  
Browser="Netcraft Webserver Survey"  
isBanned=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Offline Browsers  
 
[Offline Browsers]  
Parent=DefaultProperties  
Browser="Offline Browsers"  
Frames=true  
Tables=true  
Cookies=true  
isBanned=true  
Crawler=true  
 
[*Check&Get*]  
Parent=Offline Browsers  
Browser="Check&Get"  
 
[*HTTrack*]  
Parent=Offline Browsers  
Browser="HTTrack"  
 
[*MSIECrawler*]  
Parent=Offline Browsers  
Browser="IE Offline Browser"  
 
[*TweakMASTER*]  
Parent=Offline Browsers  
Browser="TweakMASTER"  
 
[BackStreet Browser *]  
Parent=Offline Browsers  
Browser="BackStreet Browser"  
 
[Go-Ahead-Got-It*]  
Parent=Offline Browsers  
Browser="Go Ahead Got-It"  
 
[iGetter/*]  
Parent=Offline Browsers  
Browser="iGetter"  
 
[Teleport*]  
Parent=Offline Browsers  
Browser="Teleport"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Online Scanners  
 
[Online Scanners]  
Parent=DefaultProperties  
Browser="Online Scanners"  
isBanned=true  
 
[JoeDog/* (X11; I; Siege *)]  
Parent=Online Scanners  
Browser="JoeDog"  
isBanned=false  
 
[Morfeus Fucking Scanner]  
Parent=Online Scanners  
Browser="Morfeus Fucking Scanner"  
 
[Mozilla/4.0 (compatible; Trend Micro tmdr 1.*]  
Parent=Online Scanners  
Browser="Trend Micro"  
 
[Titanium 2005 (4.02.01)]  
Parent=Online Scanners  
Browser="Panda Antivirus Titanium"  
 
[virus_detector*]  
Parent=Online Scanners  
Browser="Secure Computing Corporation"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Proxy Servers  
 
[Proxy Servers]  
Parent=DefaultProperties  
Browser="Proxy Servers"  
isBanned=true  
 
[*squid*]  
Parent=Proxy Servers  
Browser="Squid"  
 
[Anonymisiert*]  
Parent=Proxy Servers  
Browser="Anonymizied"  
 
[Anonymizer/*]  
Parent=Proxy Servers  
Browser="Anonymizer"  
 
[Anonymizied*]  
Parent=Proxy Servers  
Browser="Anonymizied"  
 
[Anonymous*]  
Parent=Proxy Servers  
Browser="Anonymous"  
 
[Anonymous/*]  
Parent=Proxy Servers  
Browser="Anonymous"  
 
[CE-Preload]  
Parent=Proxy Servers  
Browser="CE-Preload"  
 
[http://Anonymouse.org/*]  
Parent=Proxy Servers  
Browser="Anonymouse"  
 
[IE/6.01 (CP/M; 8-bit*)]  
Parent=Proxy Servers  
Browser="Squid"  
 
[Mozilla/* (TuringOS; Turing Machine; 0.0)]  
Parent=Proxy Servers  
Browser="Anonymizer"  
 
[Mozilla/4.0 (compatible; MSIE ?.0; SaferSurf*)]  
Parent=Proxy Servers  
Browser="SaferSurf"  
 
[Mozilla/5.0 (compatible; del.icio.us-thumbnails/*; *) KHTML/* (like Gecko)]  
Parent=Proxy Servers  
Browser="Yahoo!"  
isBanned=true  
Crawler=true  
 
[Nutscrape]  
Parent=Proxy Servers  
Browser="Squid"  
 
[Nutscrape/* (CP/M; 8-bit*)]  
Parent=Proxy Servers  
Browser="Squid"  
 
[Privoxy/*]  
Parent=Proxy Servers  
Browser="Privoxy"  
 
[ProxyTester*]  
Parent=Proxy Servers  
Browser="ProxyTester"  
isBanned=true  
Crawler=true  
 
[SilentSurf*]  
Parent=Proxy Servers  
Browser="SilentSurf"  
 
[SmallProxy*]  
Parent=Proxy Servers  
Browser="SmallProxy"  
 
[Space*Bison/*]  
Parent=Proxy Servers  
Browser="Proxomitron"  
 
[Sqworm/*]  
Parent=Proxy Servers  
Browser="Websense"  
 
[SurfControl]  
Parent=Proxy Servers  
Browser="SurfControl"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Research Projects  
 
[Research Projects]  
Parent=DefaultProperties  
Browser="Research Projects"  
isBanned=true  
Crawler=true  
 
[*research*]  
Parent=Research Projects  
 
[AcadiaUniversityWebCensusClient]  
Parent=Research Projects  
Browser="AcadiaUniversityWebCensusClient"  
 
[Amico Alpha * (*) Gecko/* AmicoAlpha/*]  
Parent=Research Projects  
Browser="Amico Alpha"  
 
[annotate_google; http://ponderer.org/*]  
Parent=Research Projects  
Browser="Annotate Google"  
 
[CMS crawler (?http://buytaert.net/crawler/)]  
Parent=Research Projects  
 
[e-SocietyRobot(http://www.yama.info.waseda.ac.jp/~yamana/es/)]  
Parent=Research Projects  
Browser="e-SocietyRobot"  
 
[Forschungsportal/*]  
Parent=Research Projects  
Browser="Forschungsportal"  
 
[Gulper Web *]  
Parent=Research Projects  
Browser="Gulper Web Bot"  
 
[HooWWWer/*]  
Parent=Research Projects  
Browser="HooWWWer"  
 
[http://buytaert.net/crawler]  
Parent=Research Projects  
 
[inetbot/* (?http://www.inetbot.com/bot.html)]  
Parent=Research Projects  
Browser="inetbot"  
 
[IRLbot/*]  
Parent=Research Projects  
Browser="IRLbot"  
 
[JUST-CRAWLER(*)]  
Parent=Research Projects  
Browser="JUST-CRAWLER"  
 
[Lachesis]  
Parent=Research Projects  
Browser="Lachesis"  
 
[Mozilla/5.0 (compatible; nextthing.org/*)]  
Parent=Research Projects  
Browser="nextthing.org"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (compatible; Theophrastus/*)]  
Parent=Research Projects  
Browser="Theophrastus"  
 
[Mozilla/5.0 (compatible; Webscan v0.*; +http://otc.dyndns.org/webscan/)]  
Parent=Research Projects  
Browser="Webscan"  
 
[MQbot*]  
Parent=Research Projects  
Browser="MQbot"  
 
[OutfoxBot/*]  
Parent=Research Projects  
Browser="OutfoxBot"  
 
[polybot?*]  
Parent=Research Projects  
Browser="Polybot"  
 
[Shim?Crawler*]  
Parent=Research Projects  
Browser="Shim Crawler"  
 
[Steeler/*]  
Parent=Research Projects  
Browser="Steeler"  
 
[Taiga web spider]  
Parent=Research Projects  
Browser="Taiga"  
 
[Theme Spider*]  
Parent=Research Projects  
Browser="Theme Spider"  
 
[UofTDB_experiment* (leehyun@cs.toronto.edu)]  
Parent=Research Projects  
Browser="UofTDB Experiment"  
 
[USyd-NLP-Spider*]  
Parent=Research Projects  
Browser="USyd-NLP-Spider"  
 
[woriobot*]  
Parent=Research Projects  
Browser="woriobot"  
 
[wwwster/* (Beta, mailto:gue@cis.uni-muenchen.de)]  
Parent=Research Projects  
Browser="wwwster"  
Beta=true  
 
[Zao-Crawler]  
Parent=Research Projects  
Browser="Zao-Crawler"  
 
[Zao/*]  
Parent=Research Projects  
Browser="Zao"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Rippers  
 
[Rippers]  
Parent=DefaultProperties  
Browser="Rippers"  
Frames=true  
IFrames=true  
Tables=true  
isBanned=true  
Crawler=true  
 
[*grub*]  
Parent=Rippers  
Browser="grub"  
 
[*ickHTTP*]  
Parent=Rippers  
Browser="IP*Works"  
 
[*java*]  
Parent=Rippers  
 
[*libwww-perl*]  
Parent=Rippers  
Browser="libwww-perl"  
 
[*WebGrabber*]  
Parent=Rippers  
 
[*WinHttpRequest*]  
Parent=Rippers  
Browser="WinHttp"  
 
[3D-FTP/*]  
Parent=Rippers  
Browser="3D-FTP"  
 
[3wGet/*]  
Parent=Rippers  
Browser="3wGet"  
 
[ActiveRefresh*]  
Parent=Rippers  
Browser="ActiveRefresh"  
 
[Ad Muncher*]  
Parent=Rippers  
Browser="Ad Muncher"  
 
[Artera (Version *)]  
Parent=Rippers  
Browser="Artera"  
 
[AutoHotkey]  
Parent=Rippers  
Browser="AutoHotkey"  
 
[b2w/*]  
Parent=Rippers  
Browser="b2w"  
 
[BasicHTTP/*]  
Parent=Rippers  
Browser="BasicHTTP"  
 
[BlockNote.Net]  
Parent=Rippers  
Browser="BlockNote.Net"  
 
[CAST]  
Parent=Rippers  
Browser="CAST"  
 
[CFNetwork/*]  
Parent=Rippers  
Browser="CFNetwork"  
 
[CFSCHEDULE*]  
Parent=Rippers  
Browser="ColdFusion Task Scheduler"  
 
[CobWeb/*]  
Parent=Rippers  
Browser="CobWeb"  
 
[ColdFusion*]  
Parent=Rippers  
Browser="ColdFusion"  
 
[Crawl_Application]  
Parent=Rippers  
Browser="Crawl_Application"  
 
[CTerm/*]  
Parent=Rippers  
Browser="CTerm"  
 
[curl*]  
Parent=Rippers  
Browser="cURL"  
 
[Custo*]  
Parent=Rippers  
Browser="Custo"  
 
[DataCha0s/*]  
Parent=Rippers  
Browser="DataCha0s"  
 
[DeepIndexer*]  
Parent=Rippers  
Browser="DeepIndexer"  
 
[DISCo Pump *]  
Parent=Rippers  
Browser="DISCo Pump"  
 
[eStyleSearch * (compatible; MSIE 6.0; Windows NT 5.0)]  
Parent=Rippers  
Browser="eStyleSearch"  
Win32=true  
 
[ezic.com http agent *]  
Parent=Rippers  
Browser="Ezic.com"  
 
[fetch libfetch/*]  
Parent=Rippers  
 
[FGet*]  
Parent=Rippers  
Browser="FGet"  
 
[Flaming AttackBot*]  
Parent=Rippers  
Browser="Flaming AttackBot"  
 
[Foobot*]  
Parent=Rippers  
Browser="Foobot"  
 
[GameSpyHTTP/*]  
Parent=Rippers  
Browser="GameSpyHTTP"  
 
[gnome-vfs/*]  
Parent=Rippers  
Browser="gnome-vfs"  
 
[Harvest/*]  
Parent=Rippers  
Browser="Harvest"  
 
[hcat/*]  
Parent=Rippers  
Browser="hcat"  
 
[HLoader]  
Parent=Rippers  
Browser="HLoader"  
 
[Holmes/*]  
Parent=Rippers  
Browser="Holmes"  
 
[HTMLParser/*]  
Parent=Rippers  
Browser="HTMLParser"  
 
[http generic]  
Parent=Rippers  
Browser="http generic"  
 
[http://arachnode.net*]  
Parent=Rippers  
Browser="arachnode"  
 
[httpclient*]  
Parent=Rippers  
 
[httperf/*]  
Parent=Rippers  
Browser="httperf"  
 
[HTTPFetch/*]  
Parent=Rippers  
Browser="HTTPFetch"  
 
[HTTPGrab]  
Parent=Rippers  
Browser="HTTPGrab"  
 
[HttpSession]  
Parent=Rippers  
Browser="HttpSession"  
 
[httpunit/*]  
Parent=Rippers  
Browser="HttpUnit"  
 
[ICE_GetFile]  
Parent=Rippers  
Browser="ICE_GetFile"  
 
[iexplore.exe]  
Parent=Rippers  
 
[Inet - Eureka App]  
Parent=Rippers  
Browser="Inet - Eureka App"  
 
[INetURL/*]  
Parent=Rippers  
Browser="INetURL"  
 
[InetURL:/*]  
Parent=Rippers  
Browser="InetURL"  
 
[Internet Exploiter/*]  
Parent=Rippers  
 
[Internet Explore *]  
Parent=Rippers  
Browser="Fake IE"  
 
[Internet Explorer *]  
Parent=Rippers  
Browser="Fake IE"  
 
[IP*Works!*/*]  
Parent=Rippers  
Browser="IP*Works!"  
 
[IrssiUrlLog/*]  
Parent=Rippers  
Browser="IrssiUrlLog"  
 
[JPluck/*]  
Parent=Rippers  
Browser="JPluck"  
 
[Kapere (http://www.kapere.com)]  
Parent=Rippers  
Browser="Kapere"  
 
[LeechFTP]  
Parent=Rippers  
Browser="LeechFTP"  
 
[LeechGet*]  
Parent=Rippers  
Browser="LeechGet"  
 
[libcurl-agent/*]  
Parent=Rippers  
Browser="libcurl"  
 
[libWeb/clsHTTP*]  
Parent=Rippers  
Browser="libWeb/clsHTTP"  
 
[lwp*]  
Parent=Rippers  
 
[MFC_Tear_Sample]  
Parent=Rippers  
Browser="MFC_Tear_Sample"  
 
[Moozilla]  
Parent=Rippers  
Browser="Moozilla"  
 
[MovableType/*]  
Parent=Rippers  
Browser="MovableType Web Log"  
 
[Mozilla/* (compatible; OffByOne; Windows*) Webster Pro V3.*]  
Parent=Rippers  
Browser="OffByOne"  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/2.0 (compatible; NEWT ActiveX; Win32)]  
Parent=Rippers  
Browser="NEWT ActiveX"  
Platform=Win32  
 
[Mozilla/3.0 (compatible)]  
Parent=Rippers  
 
[Mozilla/3.0 (compatible; Indy Library)]  
Parent=Rippers  
Cookies=true  
 
[Mozilla/3.01 (compatible;)]  
Parent=Rippers  
 
[Mozilla/4.0 (compatible; BorderManager*)]  
Parent=Rippers  
Browser="Novell BorderManager"  
 
[Mozilla/4.0 (compatible;)]  
Parent=Rippers  
 
[Mozilla/5.0 (compatible; IPCheck Server Monitor*)]  
Parent=Rippers  
Browser="IPCheck Server Monitor"  
 
[OCN-SOC/*]  
Parent=Rippers  
Browser="OCN-SOC"  
 
[Offline Explorer*]  
Parent=Rippers  
Browser="Offline Explorer"  
 
[Open Web Analytics Bot*]  
Parent=Rippers  
Browser="Open Web Analytics Bot"  
 
[OSSProxy*]  
Parent=Rippers  
Browser="OSSProxy"  
 
[Pageload*]  
Parent=Rippers  
Browser="PageLoad"  
 
[PageNest/*]  
Parent=Rippers  
Browser="PageNest"  
 
[pavuk/*]  
Parent=Rippers  
Browser="Pavuk"  
 
[PEAR HTTP_Request*]  
Parent=Rippers  
Browser="PEAR-PHP"  
 
[PHP*]  
Parent=Rippers  
Browser="PHP"  
 
[PigBlock (Windows NT 5.1; U)*]  
Parent=Rippers  
Browser="PigBlock"  
Win32=true  
 
[Pockey*]  
Parent=Rippers  
Browser="Pockey-GetHTML"  
 
[POE-Component-Client-HTTP/*]  
Parent=Rippers  
Browser="POE-Component-Client-HTTP"  
 
[PycURL/*]  
Parent=Rippers  
Browser="PycURL"  
 
[Python*]  
Parent=Rippers  
Browser="Python"  
 
[RepoMonkey*]  
Parent=Rippers  
Browser="RepoMonkey"  
 
[SBL-BOT*]  
Parent=Rippers  
Browser="BlackWidow"  
 
[ScoutAbout*]  
Parent=Rippers  
Browser="ScoutAbout"  
 
[sherlock/*]  
Parent=Rippers  
Browser="Sherlock"  
 
[SiteParser/*]  
Parent=Rippers  
Browser="SiteParser"  
 
[SiteSnagger*]  
Parent=Rippers  
Browser="SiteSnagger"  
 
[SiteSucker/*]  
Parent=Rippers  
Browser="SiteSucker"  
 
[SiteWinder*]  
Parent=Rippers  
Browser="SiteWinder"  
 
[Snoopy*]  
Parent=Rippers  
Browser="Snoopy"  
 
[SOFTWING_TEAR_AGENT*]  
Parent=Rippers  
Browser="AspTear"  
 
[SuperHTTP/*]  
Parent=Rippers  
Browser="SuperHTTP"  
 
[Tcl http client package*]  
Parent=Rippers  
Browser="Tcl http client package"  
 
[Twisted PageGetter]  
Parent=Rippers  
Browser="Twisted PageGetter"  
 
[URL2File/*]  
Parent=Rippers  
Browser="URL2File"  
 
[UtilMind HTTPGet]  
Parent=Rippers  
Browser="UtilMind HTTPGet"  
 
[VCI WebViewer*]  
Parent=Rippers  
Browser="VCI WebViewer"  
 
[Web Downloader*]  
Parent=Rippers  
Browser="Web Downloader"  
 
[Web Downloader/*]  
Parent=Rippers  
Browser="Web Downloader"  
 
[Web Magnet*]  
Parent=Rippers  
Browser="Web Magnet"  
 
[WebAuto/*]  
Parent=Rippers  
 
[webbandit/*]  
Parent=Rippers  
Browser="webbandit"  
 
[WebCopier*]  
Parent=Rippers  
Browser="WebCopier"  
 
[WebDownloader*]  
Parent=Rippers  
Browser="WebDownloader"  
 
[WebFetch]  
Parent=Rippers  
Browser="WebFetch"  
 
[webfetch/*]  
Parent=Rippers  
Browser="WebFetch"  
 
[WebGatherer*]  
Parent=Rippers  
Browser="WebGatherer"  
 
[WebGet]  
Parent=Rippers  
Browser="WebGet"  
 
[WebReaper*]  
Parent=Rippers  
Browser="WebReaper"  
 
[WebRipper]  
Parent=Rippers  
Browser="WebRipper"  
 
[WebSauger*]  
Parent=Rippers  
Browser="WebSauger"  
 
[Website Downloader*]  
Parent=Rippers  
Browser="Website Downloader"  
 
[Website eXtractor*]  
Parent=Rippers  
Browser="Website eXtractor"  
 
[Website Quester]  
Parent=Rippers  
Browser="Website Quester"  
 
[WebsiteExtractor*]  
Parent=Rippers  
Browser="Website eXtractor"  
 
[WebSnatcher*]  
Parent=Rippers  
Browser="WebSnatcher"  
 
[Webster Pro*]  
Parent=Rippers  
Browser="Webster Pro"  
 
[WebStripper*]  
Parent=Rippers  
Browser="WebStripper"  
 
[WebWhacker*]  
Parent=Rippers  
Browser="WebWhacker"  
 
[WinHttp*]  
Parent=Rippers  
 
[WinScripter iNet Tools]  
Parent=Rippers  
Browser="WinScripter iNet Tools"  
 
[WWW-Mechanize/*]  
Parent=Rippers  
Browser="WWW-Mechanize"  
 
[Zend_Http_Client]  
Parent=Rippers  
Browser="Zend_Http_Client"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Site Monitors  
 
[Site Monitors]  
Parent=DefaultProperties  
Browser="Site Monitors"  
Crawler=true  
 
[*EasyRider*]  
Parent=Site Monitors  
Browser="EasyRider"  
 
[*maxamine.com--robot*]  
Parent=Site Monitors  
Browser="maxamine.com--robot"  
isBanned=true  
 
[*WebMon ?.*]  
Parent=Site Monitors  
Browser="WebMon"  
 
[Kenjin Spider*]  
Parent=Site Monitors  
Browser="Kenjin Spider"  
 
[Kevin http://*]  
Parent=Site Monitors  
Browser="Kevin"  
isBanned=true  
 
[Mozilla/4.0 (compatible; ChangeDetection/*]  
Parent=Site Monitors  
Browser="ChangeDetection"  
 
[Mozilla/4.0 (compatible; MSIE ?.0; GomezAgent ?.0; Windows NT)]  
Parent=Site Monitors  
Browser="Gomez Site Monitor"  
 
[Mozilla/5.0 (compatible; Chirp/1.0; +http://www.binarycanary.com/chirp.cfm)]  
Parent=Site Monitors  
Browser="BinaryCanary"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Myst Monitor Service v*]  
Parent=Site Monitors  
Browser="Myst Monitor Service"  
 
[Net Probe]  
Parent=Site Monitors  
Browser="Net Probe"  
 
[NetMechanic*]  
Parent=Site Monitors  
Browser="NetMechanic"  
 
[NetReality*]  
Parent=Site Monitors  
Browser="NetReality"  
 
[Pingdom GIGRIB*]  
Parent=Site Monitors  
Browser="Pingdom"  
 
[Site Valet Online*]  
Parent=Site Monitors  
Browser="Site Valet"  
isBanned=true  
 
[SITECHECKER]  
Parent=Site Monitors  
Browser="SITECHECKER"  
 
[sitemonitor@dnsvr.com/*]  
Parent=Site Monitors  
Browser="ZoneEdit Failover Monitor"  
isBanned=false  
 
[UpTime Checker*]  
Parent=Site Monitors  
Browser="UpTime Checker"  
 
[URL Control*]  
Parent=Site Monitors  
Browser="URL Control"  
 
[URL_Access/*]  
Parent=Site Monitors  
 
[URLCHECK]  
Parent=Site Monitors  
Browser="URLCHECK"  
 
[URLy Warning*]  
Parent=Site Monitors  
Browser="URLy Warning"  
 
[Webcheck *]  
Parent=Site Monitors  
Browser="Webcheck"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[WebPatrol/*]  
Parent=Site Monitors  
Browser="WebPatrol"  
 
[websitepulse checker/*]  
Parent=Site Monitors  
Browser="websitepulse checker"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Social Bookmarkers  
 
[Social Networking]  
Parent=DefaultProperties  
Browser="Social Bookmarkers"  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[BookmarkBase(2/;http://bookmarkbase.com)]  
Parent=Social Networking  
Browser="BookmarkBase"  
 
[Cocoal.icio.us/1.0 (v43) (Mac OS X; http://www.scifihifi.com/cocoalicious)]  
Parent=Social Networking  
Browser="Cocoalicious"  
 
[Mozilla/5.0 (*) Gecko/* Firefox/2.0 OneRiot/1.0 (http://www.oneriot.com) ]  
Parent=Social Networking  
Browser="OneRiot"  
isBanned=true  
 
[Mozilla/5.0 (compatible; FriendFeedBot/0.*; +Http://friendfeed.com/about/bot)]  
Parent=Social Networking  
Browser="FriendFeedBot"  
 
[Mozilla/5.0 (compatible; Twitturls; +http://twitturls.com)]  
Parent=Social Networking  
Browser="Twitturls"  
isBanned=true  
 
[SocialSpider-Finder/0.*]  
Parent=Social Networking  
Browser="SocialSpider-Finder"  
 
[Twitturly*]  
Parent=Social Networking  
Browser="Twitturly"  
isBanned=true  
 
[WinkBot/*]  
Parent=Social Networking  
Browser="WinkBot"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Translators  
 
[Translators]  
Parent=DefaultProperties  
Browser="Translators"  
Frames=true  
Tables=true  
Cookies=true  
 
[Seram Server]  
Parent=Translators  
Browser="Seram Server"  
 
[TeragramWebcrawler/*]  
Parent=Translators  
Browser="TeragramWebcrawler"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[WebIndexer/* (Web Indexer; *)]  
Parent=Translators  
Browser="WorldLingo"  
 
[WebTrans]  
Parent=Translators  
Browser="WebTrans"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Version Checkers  
 
[Version Checkers]  
Parent=DefaultProperties  
Browser="Version Checkers"  
Crawler=true  
 
[Automated Browscap.ini Updater. To report issues contact us at http://www.skycomp.ca]  
Parent=Version Checkers  
Browser="Automated Browscap.ini Updater"  
 
[BMC Link Validator (http://www.briansmodelcars.com/links/)]  
Parent=Version Checkers  
Browser="BMC Link Validator"  
MajorVer=1  
MinorVer=0  
Platform=Win2000  
 
[Browscap Mirror System/1.* (browscap.giantrealm.com)]  
Parent=Version Checkers  
Browser="Browscap Mirror"  
 
[Browscap Mirror v1.30]  
Parent=Version Checkers  
Browser="Browscap Mirror"  
 
[Browscap updater]  
Parent=Version Checkers  
Browser="Browscap updater"  
 
[BrowscapUpdater1.0]  
Parent=Version Checkers  
 
[Browser Capabilities Project (http://browsers.garykeith.com; http://browsers.garykeith.com/sitemail/contact-me.asp)]  
Parent=Version Checkers  
Browser="Gary Keith's Version Checker"  
 
[Browser Capabilities Project AutoDownloader; created by Tom Kelleher Consulting, Inc. (tkelleher.com); used with special permission from Gary Joel Keith; uses Microsoft's WinHTTP component]  
Parent=Version Checkers  
Browser="TKC AutoDownloader"  
 
[browsers.garykeith.com browscap.ini bot BETA]  
Parent=Version Checkers  
 
[Code Sample Web Client]  
Parent=Version Checkers  
Browser="Code Sample Web Client"  
 
[Decode Framework 0.* browscap library]  
Parent=Version Checkers  
Browser="Decode Framework browscap library"  
 
[Desktop Sidebar*]  
Parent=Version Checkers  
Browser="Desktop Sidebar"  
isBanned=true  
 
[Mono Browser Capabilities Updater*]  
Parent=Version Checkers  
Browser="Mono Browser Capabilities Updater"  
isBanned=true  
 
[PHP Browser Capabilities Project/0.7 socket]  
Parent=Version Checkers  
Browser="PHP Browser Capabilities Project"  
 
[Rewmi/*]  
Parent=Version Checkers  
isBanned=true  
 
[Subtext Version 1.9* - http://subtextproject.com/ (Microsoft Windows NT 5.2.*)]  
Parent=Version Checkers  
Browser="Subtext"  
 
[TherapeuticResearch]  
Parent=Version Checkers  
Browser="TherapeuticResearch"  
 
[UpdateBrowscap*]  
Parent=Version Checkers  
Browser="UpdateBrowscap"  
 
[www.garykeith.com browscap.ini bot*]  
Parent=Version Checkers  
Browser="clarkson.edu "  
 
[www.substancia.com AutoHTTPAgent (ver *)]  
Parent=Version Checkers  
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; W3C  
 
[W3C]  
Parent=DefaultProperties  
Browser="W3C"  
Crawler=true  
 
[*W3C-checklink/*]  
Parent=W3C  
Browser="W3C-checklink"  
 
[Jigsaw/* W3C_CSS_Validator*/*]  
Parent=W3C  
Browser="Jigsaw_W3C_CSS_Validator"  
 
[P3P Validator]  
Parent=W3C  
Browser="P3P Validator"  
 
[W3C-mobileOK/DDC-*]  
Parent=W3C  
Browser="W3C-mobileOK/DDC"  
isMobileDevice=true  
 
[W3C-WebCon/*]  
Parent=W3C  
Browser="W3C-WebCon"  
 
[W3C_Validator/*]  
Parent=W3C  
Browser="W3C_Validator"  
 
[W3CLineMode/*]  
Parent=W3C  
Browser="W3CLineMode"  
 
[W3CRobot/*]  
Parent=W3C  
Browser="W3CRobot"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Become  
 
[Become]  
Parent=DefaultProperties  
Browser="Become"  
Frames=true  
Tables=true  
isSyndicationReader=true  
Crawler=true  
 
[*BecomeBot/*]  
Parent=Become  
Browser="BecomeBot"  
 
[*BecomeBot@exava.com*]  
Parent=Become  
Browser="BecomeBot"  
 
[*Exabot@exava.com*]  
Parent=Become  
Browser="Exabot"  
 
[MonkeyCrawl/*]  
Parent=Become  
Browser="MonkeyCrawl"  
 
[Mozilla/5.0 (compatible; BecomeJPBot/2.3; *)]  
Parent=Become  
Browser="BecomeJPBot"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Blue Coat Systems  
 
[Blue Coat Systems]  
Parent=DefaultProperties  
Browser="Blue Coat Systems"  
isBanned=true  
Crawler=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FeedHub  
 
[FeedHub]  
Parent=DefaultProperties  
Browser="FeedHub"  
isSyndicationReader=true  
 
[FeedHub FeedDiscovery/1.0 (http://www.feedhub.com)]  
Parent=FeedHub  
Browser="FeedHub FeedDiscovery"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[FeedHub FeedFetcher/1.0 (http://www.feedhub.com)]  
Parent=FeedHub  
Browser="FeedHub FeedFetcher"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[FeedHub MetaDataFetcher/1.0 (http://www.feedhub.com)]  
Parent=FeedHub  
Browser="FeedHub MetaDataFetcher"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Internet Content Rating Association  
 
[Internet Content Rating Association]  
Parent=DefaultProperties  
Browser=""  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
Crawler=true  
 
[ICRA_label_generator/1.?]  
Parent=Internet Content Rating Association  
Browser="ICRA_label_generator"  
 
[ICRA_Semantic_spider/0.?]  
Parent=Internet Content Rating Association  
Browser="ICRA_Semantic_spider"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NameProtect  
 
[NameProtect]  
Parent=DefaultProperties  
Browser="NameProtect"  
isBanned=true  
Crawler=true  
 
[abot/*]  
Parent=NameProtect  
Browser="NameProtect"  
 
[NP/*]  
Parent=NameProtect  
Browser="NameProtect"  
 
[NPBot*]  
Parent=NameProtect  
Browser="NameProtect"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netcraft  
 
[Netcraft]  
Parent=DefaultProperties  
Browser="Netcraft"  
isBanned=true  
Crawler=true  
 
[*Netcraft Web Server Survey*]  
Parent=Netcraft  
Browser="Netcraft Webserver Survey"  
isBanned=true  
 
[Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; *info@netcraft.com)]  
Parent=Netcraft  
Browser="NetcraftSurveyAgent"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NewsGator  
 
[NewsGator]  
Parent=DefaultProperties  
Browser="NewsGator"  
isSyndicationReader=true  
 
[MarsEdit*]  
Parent=NewsGator  
Browser="MarsEdit"  
 
[NetNewsWire*/*]  
Parent=NewsGator  
Browser="NetNewsWire"  
Platform=MacOSX  
 
[NewsFire/*]  
Parent=NewsGator  
Browser="NewsFire"  
 
[NewsGator FetchLinks extension/*]  
Parent=NewsGator  
Browser="NewsGator FetchLinks"  
 
[NewsGator/*]  
Parent=NewsGator  
Browser="NewsGator"  
isBanned=true  
 
[NewsGatorOnline/*]  
Parent=NewsGator  
Browser="NewsGatorOnline"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 10.0  
 
[Chromium 10.0]  
Parent=DefaultProperties  
Browser="Chromium"  
Version=10.0  
MajorVer=10  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/10.* Chrome/10.* Safari/*]  
Parent=Chromium 10.0  
Browser="Chromium"  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko)*Chromium/10.* Chrome/10.* Safari/*]  
Parent=Chromium 10.0  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 5.0  
 
[Chromium 5.0]  
Parent=DefaultProperties  
Browser="Chromium"  
Version=5.0  
MajorVer=5  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/5.* Chrome/5.* Safari/*]  
Parent=Chromium 5.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 6.0  
 
[Chromium 6.0]  
Parent=DefaultProperties  
Browser="Chromium"  
Version=6.0  
MajorVer=6  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/6.* Chrome/6.* Safari/*]  
Parent=Chromium 6.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 7.0  
 
[Chromium 7.0]  
Parent=DefaultProperties  
Browser="Chromium"  
Version=7.0  
MajorVer=7  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/7.* Chrome/7.* Safari/*]  
Parent=Chromium 7.0  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko)*Chromium/7.* Chrome/7.* Safari/*]  
Parent=Chromium 7.0  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 8.0  
 
[Chromium 8.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=8.0  
MajorVer=8  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/8.* Chrome/8.* Safari/*]  
Parent=Chromium 8.0  
Browser="Chrome"  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Ubuntu/* Chromium/8.* Chrome/8.* Safari/*]  
Parent=Chromium 8.0  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chromium 9.0  
 
[Chromium 9.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=9.0  
MajorVer=9  
Platform=Linux  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; *Linux i686*) AppleWebKit/* (KHTML, like Gecko)*Chromium/9.* Chrome/9.* Safari/*]  
Parent=Chromium 9.0  
Browser="Chrome"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 1.0  
 
[Chrome 1.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=1.0  
MajorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/1.* Safari/*]  
Parent=Chrome 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/1.* Safari/*]  
Parent=Chrome 1.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/1.* Safari/*]  
Parent=Chrome 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/1.* Safari/*]  
Parent=Chrome 1.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 10.0  
 
[Chrome 10.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=10.0  
MajorVer=10  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/10.* Safari/*]  
Parent=Chrome 10.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 2.0  
 
[Chrome 2.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=2.0  
MajorVer=2  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/2.* Safari/*]  
Parent=Chrome 2.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/2.* Safari/*]  
Parent=Chrome 2.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/2.* Safari/*]  
Parent=Chrome 2.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/2.* Safari/*]  
Parent=Chrome 2.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/2.* Safari/*]  
Parent=Chrome 2.0  
Platform=Linux  
Win32=false  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 3.0  
 
[Chrome 3.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=3.0  
MajorVer=3  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/3.* Safari/*]  
Parent=Chrome 3.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/3.* Safari/*]  
Parent=Chrome 3.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/3.* Safari/*]  
Parent=Chrome 3.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/3.* Safari/*]  
Parent=Chrome 3.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/3.* Safari/*]  
Parent=Chrome 3.0  
Platform=Linux  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 4.0  
 
[Chrome 4.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=4.0  
MajorVer=4  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/4.* Safari/*]  
Parent=Chrome 4.0  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 5.0  
 
[Chrome 5.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=5.0  
MajorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/5.* Safari/*]  
Parent=Chrome 5.0  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 6.0  
 
[Chrome 6.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=6.0  
MajorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/6.* Safari/*]  
Parent=Chrome 6.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 7.0  
 
[Chrome 7.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/7.* Safari/*]  
Parent=Chrome 7.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 8.0  
 
[Chrome 8.0]  
Parent=DefaultProperties  
Browser="Chrome"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/8.* Safari/*]  
Parent=Chrome 8.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chrome 9.0  
 
[Chrome 9.0]  
Parent=DefaultProperties  
Browser="Chrome"  
MajorVer=9  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=MacOSX  
Win32=false  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
 
[Mozilla/5.0 (X11; U; Linux x86_64; *) AppleWebKit/* (KHTML, like Gecko) Chrome/9.* Safari/*]  
Parent=Chrome 9.0  
Browser="Chrome"  
Platform=Linux  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Google Code  
 
[Google Code]  
Parent=DefaultProperties  
Browser="Google Code"  
Tables=true  
Cookies=true  
JavaApplets=true  
 
[Mozilla/5.0 (Windows; U; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Arora/0.6*]  
Parent=Google Code  
Browser="Arora"  
Version=0.6  
MajorVer=0  
MinorVer=6  
Platform=Win32  
 
[Mozilla/5.0 (Windows; U; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Arora/0.8.*]  
Parent=Google Code  
Browser="Arora"  
Version=0.8.0  
MajorVer=0  
MinorVer=8.0  
Platform=Win32  
 
[Mozilla/5.0 (X11; U; Linux; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Arora/0.6*]  
Parent=Google Code  
Browser="Arora"  
Version=0.6  
MajorVer=0  
MinorVer=6  
Platform=Linux  
 
[Mozilla/5.0 (X11; U; Linux; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Arora/0.8.*]  
Parent=Google Code  
Browser="Arora"  
Version=0.8.0  
MajorVer=0  
MinorVer=8.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 1.0  
 
[Iron 1.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=1.0  
MajorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/1.0.* Safari/*]  
Parent=Iron 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/1.0.* Safari/*]  
Parent=Iron 1.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/1.0.* Safari/*]  
Parent=Iron 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/1.0.* Safari/*]  
Parent=Iron 1.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 10.0  
 
[Iron 10.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=10.0  
MajorVer=10  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/10.* Safari/*]  
Parent=Iron 10.0  
Browser="Iron"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/10.* Safari/*]  
Parent=Iron 10.0  
Browser="Iron"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/10.* Safari/*]  
Parent=Iron 10.0  
Browser="Iron"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/10.* Safari/*]  
Parent=Iron 10.0  
Browser="Iron"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/10.0* Chrome/10.0* Safari/*]  
Parent=Iron 10.0  
Browser="Iron"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 2.0  
 
[Iron 2.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=2.0  
MajorVer=2  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/2.0.* Safari/*]  
Parent=Iron 2.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/2.0.* Safari/*]  
Parent=Iron 2.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/2.0.* Safari/*]  
Parent=Iron 2.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/2.0.* Safari/*]  
Parent=Iron 2.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 3.0  
 
[Iron 3.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=3.0  
MajorVer=3  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/3.* Safari/*]  
Parent=Iron 3.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/3.* Safari/*]  
Parent=Iron 3.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/3.* Safari/*]  
Parent=Iron 3.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/3.* Safari/*]  
Parent=Iron 3.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 4.0  
 
[Iron 4.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=4.0  
MajorVer=4  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/4.* Safari/*]  
Parent=Iron 4.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/4.* Safari/*]  
Parent=Iron 4.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/4.* Safari/*]  
Parent=Iron 4.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/4.* Safari/*]  
Parent=Iron 4.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 5.0  
 
[Iron 5.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=5.0  
MajorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/5.* Safari/*]  
Parent=Iron 5.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/5.* Safari/*]  
Parent=Iron 5.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/5.* Safari/*]  
Parent=Iron 5.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/5.* Safari/*]  
Parent=Iron 5.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/5.0* Chrome/5.0* Safari/*]  
Parent=Iron 5.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 6.0  
 
[Iron 6.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=6.0  
MajorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/6.* Safari/*]  
Parent=Iron 6.0  
Browser="Iron"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/6.* Safari/*]  
Parent=Iron 6.0  
Browser="Iron"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/6.* Safari/*]  
Parent=Iron 6.0  
Browser="Iron"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/6.* Safari/*]  
Parent=Iron 6.0  
Browser="Iron"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/6.0* Chrome/6.0* Safari/*]  
Parent=Iron 6.0  
Browser="Iron"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 7.0  
 
[Iron 7.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/7.* Safari/*]  
Parent=Iron 7.0  
Browser="Iron"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/7.* Safari/*]  
Parent=Iron 7.0  
Browser="Iron"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/7.* Safari/*]  
Parent=Iron 7.0  
Browser="Iron"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/7.* Safari/*]  
Parent=Iron 7.0  
Browser="Iron"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/7.0* Chrome/7.0* Safari/*]  
Parent=Iron 7.0  
Browser="Iron"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 8.0  
 
[Iron 8.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/8.* Safari/*]  
Parent=Iron 8.0  
Browser="Iron"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/8.* Safari/*]  
Parent=Iron 8.0  
Browser="Iron"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/8.* Safari/*]  
Parent=Iron 8.0  
Browser="Iron"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/8.* Safari/*]  
Parent=Iron 8.0  
Browser="Iron"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/8.0* Chrome/8.0* Safari/*]  
Parent=Iron 8.0  
Browser="Iron"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iron 9.0  
 
[Iron 9.0]  
Parent=DefaultProperties  
Browser="Iron"  
Version=9.0  
MajorVer=9  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/9.* Safari/*]  
Parent=Iron 9.0  
Browser="Iron"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *) AppleWebKit/* (KHTML, like Gecko) Iron/9.* Safari/*]  
Parent=Iron 9.0  
Browser="Iron"  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) Iron/9.* Safari/*]  
Parent=Iron 9.0  
Browser="Iron"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) Iron/9.* Safari/*]  
Parent=Iron 9.0  
Browser="Iron"  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686; *) AppleWebKit/533.5 (KHTML, like Gecko) Iron/9.0* Chrome/9.0* Safari/*]  
Parent=Iron 9.0  
Browser="Iron"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RockMelt Beta  
 
[RockMelt Beta]  
Parent=DefaultProperties  
Browser="RockMelt"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5*; *) AppleWebKit/* (KHTML, like Gecko) RockMelt/0.* Chrome/7.* Safari/*]  
Parent=RockMelt Beta  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *) AppleWebKit/* (KHTML, like Gecko) RockMelt/0.* Chrome/7.* Safari/*]  
Parent=RockMelt Beta  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *) AppleWebKit/* (KHTML, like Gecko) RockMelt/0.* Chrome/7.* Safari/*]  
Parent=RockMelt Beta  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *) AppleWebKit/* (KHTML, like Gecko) RockMelt/0.* Chrome/7.* Safari/*]  
Parent=RockMelt Beta  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Media Players  
 
[Media Players]  
Parent=DefaultProperties  
Browser="Media Players"  
Cookies=true  
 
[Microsoft NetShow(TM) Player with RealVideo(R)]  
Parent=Media Players  
Browser="Microsoft NetShow"  
 
[Mozilla/5.0 (Macintosh; U; PPC Mac OS X; *) AppleWebKit/* RealPlayer]  
Parent=Media Players  
Browser="RealPlayer"  
Platform=MacOSX  
 
[MPlayer 0.9*]  
Parent=Media Players  
Browser="MPlayer"  
Version=0.9  
MajorVer=0  
MinorVer=9  
 
[MPlayer 1.*]  
Parent=Media Players  
Browser="MPlayer"  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[MPlayer HEAD CVS]  
Parent=Media Players  
Browser="MPlayer"  
 
[RealPlayer*]  
Parent=Media Players  
Browser="RealPlayer"  
 
[RMA/*]  
Parent=Media Players  
Browser="RMA"  
 
[VLC media player*]  
Parent=Media Players  
Browser="VLC"  
 
[vobsub]  
Parent=Media Players  
Browser="vobsub"  
isBanned=true  
 
[WinampMPEG/*]  
Parent=Media Players  
Browser="WinAmp"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft Zune  
 
[Microsoft Zune]  
Parent=DefaultProperties  
Browser=""  
Cookies=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Microsoft ZuneHD 4.*)]  
Parent=Microsoft Zune  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/4.0 (compatible; ZuneHD 4.*)]  
Parent=Microsoft Zune  
Browser="ZuneHD"  
Version=4  
MajorVer=4  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nintendo  
 
[Nintendo Wii]  
Parent=DefaultProperties  
Browser=""  
isMobileDevice=true  
 
[Opera/* (Nintendo DSi; Opera/*; *; *)]  
Parent=Nintendo Wii  
Browser="DSi"  
 
[Opera/* (Nintendo Wii; U; *)]  
Parent=Nintendo Wii  
Browser="Wii"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Windows Media Player  
 
[Windows Media Player]  
Parent=DefaultProperties  
Browser="Windows Media Player"  
Cookies=true  
 
[NSPlayer/10.*]  
Parent=Windows Media Player  
Version=10.0  
MajorVer=10  
MinorVer=0  
 
[NSPlayer/11.*]  
Parent=Windows Media Player  
Version=11.0  
MajorVer=11  
MinorVer=0  
 
[NSPlayer/4.*]  
Parent=Windows Media Player  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[NSPlayer/7.*]  
Parent=Windows Media Player  
Version=7.0  
MajorVer=7  
MinorVer=0  
 
[NSPlayer/8.*]  
Parent=Windows Media Player  
Version=8.0  
MajorVer=8  
MinorVer=0  
 
[NSPlayer/9.*]  
Parent=Windows Media Player  
Version=9.0  
MajorVer=9  
MinorVer=0  
 
[Windows-Media-Player/10.*]  
Parent=Windows Media Player  
Version=10.0  
MajorVer=10  
MinorVer=0  
Win32=true  
 
[Windows-Media-Player/11.*]  
Parent=Windows Media Player  
Version=11.0  
MajorVer=11  
MinorVer=0  
Win32=true  
 
[Windows-Media-Player/7.*]  
Parent=Windows Media Player  
Version=7.0  
MajorVer=7  
MinorVer=0  
Win32=true  
 
[Windows-Media-Player/8.*]  
Parent=Windows Media Player  
Version=8.0  
MajorVer=8  
MinorVer=0  
Win32=true  
 
[Windows-Media-Player/9.*]  
Parent=Windows Media Player  
Version=9.0  
MajorVer=9  
MinorVer=0  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.0  
 
[QuickTime 7.0]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.0  
MajorVer=7  
Cookies=true  
 
[QuickTime (qtver=7.0*;cpu=PPC;os=Mac 10.*)]  
Parent=QuickTime 7.0  
Platform=MacOSX  
 
[QuickTime (qtver=7.0*;cpu=PPC;os=Mac 9.*)]  
Parent=QuickTime 7.0  
Platform=MacPPC  
 
[QuickTime (qtver=7.0*;os=Windows 95*)]  
Parent=QuickTime 7.0  
Platform=Win95  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows 98*)]  
Parent=QuickTime 7.0  
Platform=Win98  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows Me*)]  
Parent=QuickTime 7.0  
Platform=WinME  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows NT 4.0*)]  
Parent=QuickTime 7.0  
Platform=WinNT  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows NT 5.0*)]  
Parent=QuickTime 7.0  
Platform=Win2000  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows NT 5.1*)]  
Parent=QuickTime 7.0  
Platform=WinXP  
Win32=true  
 
[QuickTime (qtver=7.0*;os=Windows NT 5.2*)]  
Parent=QuickTime 7.0  
Platform=Win2003  
Win32=true  
 
[QuickTime/7.0.* (qtver=7.0.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.0  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.1  
 
[QuickTime 7.1]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.1  
MajorVer=7  
MinorVer=1  
Cookies=true  
 
[QuickTime (qtver=7.1*;cpu=PPC;os=Mac 10.*)]  
Parent=QuickTime 7.1  
Platform=MacOSX  
 
[QuickTime (qtver=7.1*;cpu=PPC;os=Mac 9.*)]  
Parent=QuickTime 7.1  
Platform=MacPPC  
 
[QuickTime (qtver=7.1*;os=Windows 98*)]  
Parent=QuickTime 7.1  
Platform=Win98  
Win32=true  
 
[QuickTime (qtver=7.1*;os=Windows NT 4.0*)]  
Parent=QuickTime 7.1  
Platform=WinNT  
Win32=true  
 
[QuickTime (qtver=7.1*;os=Windows NT 5.0*)]  
Parent=QuickTime 7.1  
Platform=Win2000  
Win32=true  
 
[QuickTime (qtver=7.1*;os=Windows NT 5.1*)]  
Parent=QuickTime 7.1  
Platform=WinXP  
Win32=true  
 
[QuickTime (qtver=7.1*;os=Windows NT 5.2*)]  
Parent=QuickTime 7.1  
Platform=Win2003  
Win32=true  
 
[QuickTime/7.1.* (qtver=7.1.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.1  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.2  
 
[QuickTime 7.2]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.2  
MajorVer=7  
MinorVer=2  
Platform=MacOSX  
Cookies=true  
 
[QuickTime (qtver=7.2*;cpu=PPC;os=Mac 10.*)]  
Parent=QuickTime 7.2  
Platform=MacOSX  
 
[QuickTime (qtver=7.2*;cpu=PPC;os=Mac 9.*)]  
Parent=QuickTime 7.2  
Platform=MacPPC  
 
[QuickTime (qtver=7.2*;os=Windows 98*)]  
Parent=QuickTime 7.2  
Platform=Win98  
Win32=true  
 
[QuickTime (qtver=7.2*;os=Windows NT 4.0*)]  
Parent=QuickTime 7.2  
Platform=WinNT  
Win32=true  
 
[QuickTime (qtver=7.2*;os=Windows NT 5.0*)]  
Parent=QuickTime 7.2  
Platform=Win2000  
Win32=true  
 
[QuickTime (qtver=7.2*;os=Windows NT 5.1*)]  
Parent=QuickTime 7.2  
Platform=WinXP  
Win32=true  
 
[QuickTime (qtver=7.2*;os=Windows NT 5.2*)]  
Parent=QuickTime 7.2  
Platform=Win2003  
Win32=true  
 
[QuickTime/7.2.* (qtver=7.2.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.2  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.3  
 
[QuickTime 7.3]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.3  
MajorVer=7  
MinorVer=3  
Platform=MacOSX  
Cookies=true  
 
[QuickTime (qtver=7.3*;cpu=PPC;os=Mac 10.*)]  
Parent=QuickTime 7.3  
Platform=MacOSX  
 
[QuickTime (qtver=7.3*;cpu=PPC;os=Mac 9.*)]  
Parent=QuickTime 7.3  
Platform=MacPPC  
 
[QuickTime (qtver=7.3*;os=Windows 98*)]  
Parent=QuickTime 7.3  
Platform=Win98  
Win32=true  
 
[QuickTime (qtver=7.3*;os=Windows NT 4.0*)]  
Parent=QuickTime 7.3  
Platform=WinNT  
Win32=true  
 
[QuickTime (qtver=7.3*;os=Windows NT 5.0*)]  
Parent=QuickTime 7.3  
Platform=Win2000  
Win32=true  
 
[QuickTime (qtver=7.3*;os=Windows NT 5.1*)]  
Parent=QuickTime 7.3  
Platform=WinXP  
Win32=true  
 
[QuickTime (qtver=7.3*;os=Windows NT 5.2*)]  
Parent=QuickTime 7.3  
Platform=Win2003  
Win32=true  
 
[QuickTime/7.3.* (qtver=7.3.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.3  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.4  
 
[QuickTime 7.4]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.4  
MajorVer=7  
MinorVer=4  
Platform=MacOSX  
Cookies=true  
 
[QuickTime (qtver=7.4*;cpu=PPC;os=Mac 10.*)]  
Parent=QuickTime 7.4  
Platform=MacOSX  
 
[QuickTime (qtver=7.4*;cpu=PPC;os=Mac 9.*)]  
Parent=QuickTime 7.4  
Platform=MacPPC  
 
[QuickTime (qtver=7.4*;os=Windows 98*)]  
Parent=QuickTime 7.4  
Platform=Win98  
Win32=true  
 
[QuickTime (qtver=7.4*;os=Windows NT 4.0*)]  
Parent=QuickTime 7.4  
Platform=WinNT  
Win32=true  
 
[QuickTime (qtver=7.4*;os=Windows NT 5.0*)]  
Parent=QuickTime 7.4  
Platform=Win2000  
Win32=true  
 
[QuickTime (qtver=7.4*;os=Windows NT 5.1*)]  
Parent=QuickTime 7.4  
Platform=WinXP  
Win32=true  
 
[QuickTime (qtver=7.4*;os=Windows NT 5.2*)]  
Parent=QuickTime 7.4  
Platform=Win2003  
Win32=true  
 
[QuickTime/7.4.* (qtver=7.4.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.4  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QuickTime 7.6  
 
[QuickTime 7.6]  
Parent=DefaultProperties  
Browser="QuickTime"  
Version=7.6  
MajorVer=7  
MinorVer=6  
Platform=MacOSX  
Cookies=true  
 
[QuickTime/7.6* (qtver=7.6*;os=Windows NT 5.1)]  
Parent=QuickTime 7.6  
Platform=WinXP  
 
[QuickTime/7.6* (qtver=7.6*;os=Windows NT 5.2)]  
Parent=QuickTime 7.6  
Platform=Win2003  
 
[QuickTime/7.6* (qtver=7.6*;os=Windows NT 6.0)]  
Parent=QuickTime 7.6  
Platform=WinVista  
 
[QuickTime/7.6* (qtver=7.6*;os=Windows NT 6.1)]  
Parent=QuickTime 7.6  
Platform=Win7  
 
[QuickTime/7.6.* (qtver=7.6.*;*;os=Mac 10.*)*]  
Parent=QuickTime 7.6  
Browser="QuickTime"  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lotus Notes 5.0  
 
[Lotus Notes 5.0]  
Parent=DefaultProperties  
Browser="Lotus Notes"  
Version=5.0  
MajorVer=5  
Tables=true  
 
[Mozilla/4.0 (compatible; Lotus-Notes/5.0; Macintosh PPC)]  
Parent=Lotus Notes 5.0  
Platform=MacOSX  
 
[Mozilla/4.0 (compatible; Lotus-Notes/5.0; Windows-NT)]  
Parent=Lotus Notes 5.0  
Platform=WinNT  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lotus Notes 6.0  
 
[Lotus Notes 6.0]  
Parent=DefaultProperties  
Browser="Lotus Notes"  
Version=6.0  
MajorVer=6  
Tables=true  
 
[Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT)]  
Parent=Lotus Notes 6.0  
Platform=WinNT  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft Outlook 2007  
 
[Microsoft Outlook 2007]  
Parent=DefaultProperties  
Browser="Microsoft Outlook"  
Version=2007  
MajorVer=2007  
Tables=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.0; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=WinVista  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; *MSOffice 12)]  
Parent=Microsoft Outlook 2007  
Platform=Win7  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Microsoft Outlook 2010  
 
[Microsoft Outlook 2010]  
Parent=DefaultProperties  
Browser="Microsoft Outlook"  
Version=2010  
MajorVer=2010  
Tables=true  
CssVersion=2  
supportsCSS=true  
 
[Microsoft Office/14.0 (Windows NT 5.1; Microsoft Outlook 14.*; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=WinXP  
 
[Microsoft Office/14.0 (Windows NT 6.1; Microsoft Outlook 14.*; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/4.0; *MSOffice 14)]  
Parent=Microsoft Outlook 2010  
Platform=Win7  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Windows Live Mail  
 
[Windows Live Mail]  
Parent=DefaultProperties  
Browser="Windows Live Mail"  
Version=7.0  
MajorVer=7  
Tables=true  
CssVersion=2  
supportsCSS=true  
 
[Outlook-Express/7.0 (MSIE 7.0; Windows NT 5.1; Trident/4.0; *)]  
Parent=Windows Live Mail  
Platform=WinXP  
 
[Outlook-Express/7.0 (MSIE 7.0; Windows NT 6.1; Trident/4.0; *)]  
Parent=Windows Live Mail  
Platform=Win7  
 
[Outlook-Express/7.0 (MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; *)]  
Parent=Windows Live Mail  
Platform=Win7  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Google Android  
 
[Android]  
Parent=DefaultProperties  
Browser="Android"  
Platform=Android  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Mozilla/5.0 (Linux; U; Android 1.0*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/3.0* Mobile Safari/5*]  
Parent=Android  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (Linux; U; Android 1.5*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/3.1.2* Mobile Safari/5*]  
Parent=Android  
Version=1.5  
MajorVer=1  
MinorVer=5  
 
[Mozilla/5.0 (Linux; U; Android 1.6*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/3.1.2* Mobile Safari/5*]  
Parent=Android  
Version=1.6  
MajorVer=1  
MinorVer=6  
 
[Mozilla/5.0 (Linux; U; Android 2.0*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.0  
MajorVer=2  
MinorVer=0  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Linux; U; Android 2.0.1; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.0.1  
MajorVer=2  
MinorVer=0.1  
 
[Mozilla/5.0 (Linux; U; Android 2.1**; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.1  
MajorVer=2  
MinorVer=1  
 
[Mozilla/5.0 (Linux; U; Android 2.1-update1; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.1.1  
MajorVer=2  
MinorVer=1.1  
 
[Mozilla/5.0 (Linux; U; Android 2.2*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
[Mozilla/5.0 (Linux; U; Android 2.3*; *; *) AppleWebKit/5* (KHTML, like Gecko) Version/4.0 Mobile Safari/5*]  
Parent=Android  
Version=2.3  
MajorVer=2  
MinorVer=3  
CssVersion=2  
supportsCSS=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BlackBerry  
 
[BlackBerry]  
Parent=DefaultProperties  
Browser="BlackBerry"  
Platform=BlackBerry OS  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
isMobileDevice=true  
 
[*BlackBerry*]  
Parent=BlackBerry  
 
[*BlackBerrySimulator/*]  
Parent=BlackBerry  
 
[Mozilla/5.0 (BlackBerry; U; BlackBerry*) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.* Mobile Safari/534.1+]  
Parent=BlackBerry  
Version=6.0  
MajorVer=6  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Handspring Blazer  
 
[Blazer]  
Parent=DefaultProperties  
Browser="Handspring Blazer"  
Platform=Palm  
Frames=true  
Tables=true  
Cookies=true  
isMobileDevice=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 95; PalmSource; Blazer 3.0) 16;160x160]  
Parent=Blazer  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/*; Blazer/4.0) 16;320x448]  
Parent=Blazer  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/*; Blazer/4.1) 16;320x320]  
Parent=Blazer  
Version=4.1  
MajorVer=4  
MinorVer=1  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/*; Blazer/4.2) 16;320x320]  
Parent=Blazer  
Version=4.2  
MajorVer=4  
MinorVer=2  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/*; Blazer/4.4) 16;320x320]  
Parent=Blazer  
Version=4.4  
MajorVer=4  
MinorVer=4  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/*; Blazer/4.5) 16;320x320]  
Parent=Blazer  
Version=4.5  
MajorVer=4  
MinorVer=5  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Brew  
 
[Brew]  
Parent=DefaultProperties  
Browser="Brew"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[*-*/1.0 BREW/2.0* Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1]  
Parent=Brew  
Version=2.0  
MajorVer=2  
MinorVer=0  
CssVersion=1  
supportsCSS=true  
 
[*-*/1.0 BREW/2.1* Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1]  
Parent=Brew  
Version=2.1  
MajorVer=2  
MinorVer=1  
CssVersion=1  
supportsCSS=true  
 
[*-*/1.0 BREW/3.0* Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1]  
Parent=Brew  
Version=3.0  
MajorVer=3  
MinorVer=1  
CssVersion=1  
supportsCSS=true  
 
[*-*/1.0 BREW/3.1* Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1]  
Parent=Brew  
Version=3.1  
MajorVer=3  
MinorVer=1  
CssVersion=1  
supportsCSS=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IEMobile  
 
[IEMobile]  
Parent=DefaultProperties  
Browser="IEMobile"  
Platform=WinCE  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
VBScript=true  
JavaScript=true  
ActiveXControls=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.*)*]  
Parent=IEMobile  
Version=6.0  
MajorVer=6  
MinorVer=0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.*)*]  
Parent=IEMobile  
Version=7.0  
MajorVer=7  
MinorVer=0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 8.*)*]  
Parent=IEMobile  
Version=8.0  
MajorVer=8  
MinorVer=0  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0*)*]  
Parent=IEMobile  
Version=7.0  
MajorVer=7  
MinorVer=0  
Platform=WinPhone7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iPad  
 
[iPad]  
Parent=DefaultProperties  
Browser="iPad"  
Platform=iPhone OSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (iPad; U; CPU OS 4_0* like Mac OS X; *)*]  
Parent=iPad  
Browser="iPad"  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/5.0 (iPad; U; CPU OS 4_1* like Mac OS X; *)*]  
Parent=iPad  
Version=4.1  
MajorVer=4  
MinorVer=1  
 
[Mozilla/5.0 (iPad; U; CPU OS 4_2* like Mac OS X; *)*]  
Parent=iPad  
Version=4.2  
MajorVer=4  
MinorVer=2  
 
[Mozilla/5.0 (iPad; U; CPU*OS 3_2* like Mac OS X; *)*]  
Parent=iPad  
Version=3.2  
MajorVer=3  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iPhone  
 
[iPhone]  
Parent=DefaultProperties  
Browser="iPhone"  
Platform=iPhone OSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 2_* like Mac OS X; *)*]  
Parent=iPhone  
Browser="iPhone Simulator"  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 3_0* like Mac OS X; *)*]  
Parent=iPhone  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 3_1* like Mac OS X; *)*]  
Parent=iPhone  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 3_2* like Mac OS X; *)*]  
Parent=iPhone  
Version=3.2  
MajorVer=3  
MinorVer=2  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_0* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_1* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.1  
MajorVer=4  
MinorVer=1  
 
[Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_2* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.2  
MajorVer=4  
MinorVer=2  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_* like Mac OS X; *)*]  
Parent=iPhone  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0* like Mac OS X; *)*]  
Parent=iPhone  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1* like Mac OS X; *)*]  
Parent=iPhone  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2* like Mac OS X; *)*]  
Parent=iPhone  
Version=3.2  
MajorVer=3  
MinorVer=2  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.1  
MajorVer=4  
MinorVer=1  
 
[Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2* like Mac OS X; *)*]  
Parent=iPhone  
Version=4.2  
MajorVer=4  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iPod Touch  
 
[iPod Touch]  
Parent=DefaultProperties  
Browser="iPod Touch"  
Platform=iPhone OSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 2_* like Mac OS X; *)*]  
Parent=iPod Touch  
Browser="iPod Touch"  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 3_0* like Mac OS X; *)*]  
Parent=iPod Touch  
Browser="iPod Touch"  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1* like Mac OS X; *)*]  
Parent=iPod Touch  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 3_2* like Mac OS X; *)*]  
Parent=iPod Touch  
Version=3.2  
MajorVer=3  
MinorVer=2  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0* like Mac OS X; *)*]  
Parent=iPod Touch  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 4_1* like Mac OS X; *)*]  
Parent=iPod Touch  
Version=4.1  
MajorVer=4  
MinorVer=1  
 
[Mozilla/5.0 (iPod; U; CPU iPhone OS 4_2* like Mac OS X; *)*]  
Parent=iPod Touch  
Version=4.2  
MajorVer=4  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KDDI  
 
[KDDI]  
Parent=DefaultProperties  
Browser="KDDI"  
Frames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
VBScript=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=1  
supportsCSS=true  
 
[KDDI-* UP.Browser/* (GUI) MMP/*]  
Parent=KDDI  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Kindle  
 
[Kindle]  
Parent=DefaultProperties  
Browser="Kindle"  
Platform=Linux  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
VBScript=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; Linux*) NetFront/3.* Kindle/1.0 (screen 600x800)]  
Parent=Kindle  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/4.0 (compatible; Linux*) NetFront/3.* Kindle/1.0 (screen 600x800)]  
Parent=Kindle  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Linux; U; *) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/538.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)]  
Parent=Kindle  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Maemo Browser  
 
[Maemo]  
Parent=DefaultProperties  
Browser="Maemo"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.9.*) Gecko/* Firefox/* Maemo Browser 1.7.*]  
Parent=Maemo  
Version=1.7  
MajorVer=1  
MinorVer=7  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Motorola Internet Browser  
 
[Motorola Internet Browser]  
Parent=DefaultProperties  
Browser="Motorola Internet Browser"  
Frames=true  
Tables=true  
Cookies=true  
isMobileDevice=true  
 
[MOT-*/*]  
Parent=Motorola Internet Browser  
 
[MOT-1*/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-8700_/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-A-0A/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-A-2B/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-A-88/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-C???/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-GATW_/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-L6/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-L7/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-M*/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-MP*/* Mozilla/* (compatible; MSIE *; Windows CE; *)]  
Parent=Motorola Internet Browser  
Win32=true  
 
[MOT-MP*/* Mozilla/4.0 (compatible; MSIE *; Windows CE; *)]  
Parent=Motorola Internet Browser  
Win32=true  
 
[MOT-SAP4_/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-T*/*]  
Parent=Motorola Internet Browser  
 
[MOT-T7*/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-T721*]  
Parent=Motorola Internet Browser  
 
[MOT-TA02/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-V*/*]  
Parent=Motorola Internet Browser  
 
[MOT-V*/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-V*/* UP.Browser/*]  
Parent=Motorola Internet Browser  
 
[MOT-V3/* MIB/*]  
Parent=Motorola Internet Browser  
 
[MOT-V4*/* MIB/*]  
Parent=Motorola Internet Browser  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nokia  
 
[Nokia]  
Parent=DefaultProperties  
Browser="Nokia"  
Tables=true  
Cookies=true  
isMobileDevice=true  
 
[*Nokia*/*]  
Parent=Nokia  
 
[Mozilla/* (SymbianOS/*; ?; *) AppleWebKit/* (KHTML, like Gecko) Safari/*]  
Parent=Nokia  
Platform=SymbianOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Openwave Mobile Browser  
 
[Openwave Mobile Browser]  
Parent=DefaultProperties  
Browser="Openwave Mobile Browser"  
Alpha=true  
Win32=true  
Win64=true  
Frames=true  
Tables=true  
Cookies=true  
isMobileDevice=true  
 
[*UP.Browser/*]  
Parent=Openwave Mobile Browser  
 
[*UP.Link/*]  
Parent=Openwave Mobile Browser  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mobile  
 
[Opera Mobile]  
Parent=DefaultProperties  
Browser="Opera Mobi"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.* (*SymbOS; Opera Mobi/*; U; *) Presto/2.* Version/10.*]  
Parent=Opera Mobile  
Version=10.0  
MajorVer=10  
MinorVer=0  
Platform=SymbianOS  
 
[Opera/9.* (Microsoft Windows; PPC; Opera Mobi/*; U; *)]  
Parent=Opera Mobile  
Version=9.0  
MajorVer=9  
MinorVer=0  
Platform=Win  
 
[Opera/9.* (Windows Mobile; *; Opera Mobi/*; U; *) Presto/2.*]  
Parent=Opera Mobile  
Version=9.0  
MajorVer=9  
MinorVer=0  
Platform=Win  
 
[Opera/9.5 (Microsoft Windows; PPC; *Opera Mobile/*)]  
Parent=Opera Mobile  
Version=9.5  
MajorVer=9  
MinorVer=5  
 
[Opera/9.5 (Microsoft Windows; PPC; Opera Mobi/*)]  
Parent=Opera Mobile  
Version=9.5  
MajorVer=9  
MinorVer=5  
 
[Opera/9.51 Beta (Microsoft Windows; PPC; Opera Mobi/*)*]  
Parent=Opera Mobile  
Version=9.51  
MajorVer=9  
MinorVer=51  
Beta=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Palm  
 
[Palm]  
Parent=DefaultProperties  
Browser=""  
Platform=webOS  
Win32=true  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
ActiveXControls=true  
isMobileDevice=true  
 
[Mozilla/5.0 (webOS/1.0*; U; *) AppleWebKit/525.* (KHTML, like Gecko) Version/1.0 Safari/525.* Pre/1.*]  
Parent=Palm  
Browser="Palm Pre"  
Version=1.0  
MajorVer=1  
MinorVer=0  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (webOS/1.1*; U; *) AppleWebKit/525.* (KHTML, like Gecko) Version/1.0 Safari/525.* Pre/1.*]  
Parent=Palm  
Browser="Palm Pre"  
Version=1.1  
MajorVer=1  
MinorVer=1  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (webOS/1.2*; U; *) AppleWebKit/525.* (KHTML, like Gecko) Version/1.0 Safari/525.* Pre/1.*]  
Parent=Palm  
Browser="Palm Pre"  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[Mozilla/5.0 (webOS/1.3*; U; *) AppleWebKit/525.* (KHTML, like Gecko) Version/1.0 Safari/525.* Pre/1.*]  
Parent=Palm  
Browser="Palm Pre"  
Version=1.3  
MajorVer=1  
MinorVer=3  
 
[Mozilla/5.0 (webOS/1.4*; U; *) AppleWebKit/532.* (KHTML, like Gecko) Version/1.0 Safari/532.* Pre/1.*]  
Parent=Palm  
Browser="Palm Pre"  
Version=1.4  
MajorVer=1  
MinorVer=4  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Playstation  
 
[Playstation]  
Parent=DefaultProperties  
Browser="Playstation"  
Platform=WAP  
Frames=true  
Tables=true  
Cookies=true  
isMobileDevice=true  
 
[Mozilla/* (PLAYSTATION *; *)]  
Parent=Playstation  
Browser="PlayStation 3"  
Frames=false  
 
[Mozilla/* (PSP (PlayStation Portable); *)]  
Parent=Playstation  
 
[Sony PS2 (Linux)]  
Parent=Playstation  
Browser="Sony PS2"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Pocket PC  
 
[Pocket PC]  
Parent=DefaultProperties  
Browser="Pocket PC"  
Platform=WinCE  
Win32=true  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
ActiveXControls=true  
isMobileDevice=true  
CssVersion=1  
supportsCSS=true  
 
[*(compatible; MSIE *.*; Windows CE; PPC; *)]  
Parent=Pocket PC  
 
[HTC-*/* Mozilla/* (compatible; MSIE *.*; Windows CE*)*]  
Parent=Pocket PC  
Win32=true  
 
[Mozilla/* (compatible; MSPIE *.*; *Windows CE*)*]  
Parent=Pocket PC  
Win32=true  
 
[T-Mobile* Mozilla/* (compatible; MSIE *.*; Windows CE; *)]  
Parent=Pocket PC  
 
[Vodafone* Mozilla/* (compatible; MSIE *.*; Windows CE; *)*]  
Parent=Pocket PC  
 
[Windows CE (Pocket PC) - Version *.*]  
Parent=Pocket PC  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Polaris  
 
[Polaris]  
Parent=DefaultProperties  
Browser="Polaris"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[LG-* Polaris/5.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris LG"  
Version=5.0  
MajorVer=5  
MinorVer=0  
 
[LG-* Polaris/6.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris LG"  
Version=6.0  
MajorVer=6  
MinorVer=0  
 
[LG-* Polaris/7.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris LG"  
Version=7.0  
MajorVer=7  
MinorVer=0  
 
[Samsung-* Polaris/5.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris Samsung"  
Version=5.0  
MajorVer=5  
MinorVer=0  
 
[Samsung-* Polaris/6.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris Samsung"  
Version=6.0  
MajorVer=6  
MinorVer=0  
 
[Samsung-* Polaris/7.* MMP/2.*]  
Parent=Polaris  
Browser="Polaris Samsung"  
Version=7.0  
MajorVer=7  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SEMC Browser  
 
[SEMC Browser]  
Parent=DefaultProperties  
Browser="SEMC Browser"  
Platform=JAVA  
Tables=true  
isMobileDevice=true  
CssVersion=1  
supportsCSS=true  
 
[*SEMC-Browser/*]  
Parent=SEMC Browser  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Teleca  
 
[Teleca]  
Parent=DefaultProperties  
Browser="Teleca"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Teleca *; Brew 3.0*; U; *)*]  
Parent=Teleca  
Version=3.0  
MajorVer=3  
MinorVer=0  
 
[Mozilla/5.0 (compatible; Teleca *; Brew 3.1*; U; *)*]  
Parent=Teleca  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 2.0  
 
[Opera Mini 2.0]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=2.0  
MajorVer=2  
Platform=JAVA  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/8.01 (J2ME/MIDP; Opera Mini/2.0*; *; U; ssr)*]  
Parent=Opera Mini 2.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 3.0  
 
[Opera Mini 3.0]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=3.0  
MajorVer=3  
Platform=JAVA  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/8.01 (J2ME/MIDP; Opera Mini/3.0*; *; U; ssr)*]  
Parent=Opera Mini 3.0  
 
[Opera/8.01 (J2ME/MIDP; Opera Mini/3.1*; *; U; ssr)*]  
Parent=Opera Mini 3.0  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 4.0  
 
[Opera Mini 4.0]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=4.0  
MajorVer=4  
Platform=JAVA  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.50 (J2ME/MIDP; Opera Mini/4.0*; U; *)*]  
Parent=Opera Mini 4.0  
 
[Opera/9.60 (J2ME/MIDP; Opera Mini/4.0.*; U; *) Presto/2.2.0*]  
Parent=Opera Mini 4.0  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/4.0.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 4.1  
 
[Opera Mini 4.1]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=4.1  
MajorVer=4  
MinorVer=1  
Platform=JAVA  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.50 (J2ME/MIDP; Opera Mini/4.1*; U; *)*]  
Parent=Opera Mini 4.1  
 
[Opera/9.60 (J2ME/MIDP; Opera Mini/4.1.*; U; *) Presto/2.2.0*]  
Parent=Opera Mini 4.1  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/4.1.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 4.2  
 
[Opera Mini 4.2]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=4.2  
MajorVer=4  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.50 (J2ME/MIDP; Opera Mini/4.2*; U; *)*]  
Parent=Opera Mini 4.2  
Platform=JAVA  
 
[Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.*; U; *) Presto/2.2.0*]  
Parent=Opera Mini 4.2  
Platform=JAVA  
 
[Opera/9.80 (Android; Opera Mini/4.2.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.2  
Platform=Android  
 
[Opera/9.80 (BlackBerry; Opera Mini/4.2.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 4.2  
Platform=BlackBerry OS  
 
[Opera/9.80 (iPhone; Opera Mini/4.2.*; U; *) Presto/2.4.15]  
Parent=Opera Mini 4.2  
Platform=iPhone OSX  
 
[Opera/9.80 (iPhone; Opera Mini/4.2.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 4.2  
Platform=iPhone OSX  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.2  
Platform=JAVA  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 4.3  
 
[Opera Mini 4.3]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=4.3  
MajorVer=4  
MinorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.60 (J2ME/MIDP; Opera Mini/4.3.*; U; *) Presto/2.2.0*]  
Parent=Opera Mini 4.3  
Platform=JAVA  
 
[Opera/9.80 (Android; Opera Mini/4.3.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.3  
Platform=Android  
 
[Opera/9.80 (BlackBerry; Opera Mini/4.3.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 4.3  
Platform=BlackBerry OS  
 
[Opera/9.80 (iPhone; Opera Mini/4.3.*; U; *) Presto/2.4.15]  
Parent=Opera Mini 4.3  
Platform=iPhone OSX  
 
[Opera/9.80 (iPhone; Opera Mini/4.3.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 4.3  
Platform=iPhone OSX  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/4.3.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 4.3  
Platform=JAVA  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 5.0  
 
[Opera Mini 5.0]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=5.0  
MajorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.50 (J2ME/MIDP; Opera Mini/5.0*; U; *)*]  
Parent=Opera Mini 5.0  
Platform=JAVA  
 
[Opera/9.60 (J2ME/MIDP; Opera Mini/5.0.*; U; *) Presto/2.2.0*]  
Parent=Opera Mini 5.0  
Platform=JAVA  
 
[Opera/9.80 (Android; Opera Mini/5.0.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 5.0  
Platform=Android  
 
[Opera/9.80 (BlackBerry; Opera Mini/5.0.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 5.0  
Platform=BlackBerry OS  
 
[Opera/9.80 (iPhone; Opera Mini/5.0.*; U; *) Presto/2.4.15]  
Parent=Opera Mini 5.0  
Platform=iPhone OSX  
 
[Opera/9.80 (iPhone; Opera Mini/5.0.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 5.0  
Platform=iPhone OSX  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 5.0  
Platform=JAVA  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera Mini 5.1  
 
[Opera Mini 5.1]  
Parent=DefaultProperties  
Browser="Opera Mini"  
Version=5.1  
MajorVer=5  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
 
[Opera/9.80 (Android; Opera Mini/5.1.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 5.1  
Platform=Android  
 
[Opera/9.80 (BlackBerry; Opera Mini/5.1.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 5.1  
Platform=BlackBerry OS  
 
[Opera/9.80 (iPhone; Opera Mini/5.1.*; U; *) Presto/2.4.15]  
Parent=Opera Mini 5.1  
Platform=iPhone OSX  
 
[Opera/9.80 (iPhone; Opera Mini/5.1.*; U; *) Presto/2.5.25]  
Parent=Opera Mini 5.1  
Platform=iPhone OSX  
 
[Opera/9.80 (J2ME/MIDP; Opera Mini/5.1.*; U; *) Presto/2.5.25*]  
Parent=Opera Mini 5.1  
Platform=JAVA  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 2.0  
 
[NetFront 2.0]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=1  
supportsCSS=true  
 
[*NetFront/2.*]  
Parent=NetFront 2.0  
 
[*SonyEricsson*/* Browser/NetFront/2* Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 2.0  
 
[Mozilla/4.0 (BREW *.*; U; *; *; NetFront/2.*/*)*]  
Parent=NetFront 2.0  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/2.? MMP/2.0*]  
Parent=NetFront 2.0  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/2.0*]  
Parent=NetFront 2.0  
 
[SAMSUNG-*?NetFront/2.* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 2.0  
 
[SEC-SGH*/1.0 NetFront/2.? Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 2.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.0  
 
[NetFront 3.0]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.0  
MajorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.0*]  
Parent=NetFront 3.0  
 
[*SonyEricsson*/* Browser/NetFront/3.0 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.0  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.0*/*)*]  
Parent=NetFront 3.0  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.0 MMP/2.0*]  
Parent=NetFront 3.0  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.0*]  
Parent=NetFront 3.0  
 
[SAMSUNG-*?NetFront/3.0* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.0  
 
[SEC-SGH*/1.0 NetFront/3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.1  
 
[NetFront 3.1]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.1  
MajorVer=3  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.1*]  
Parent=NetFront 3.1  
 
[*SonyEricsson*/* Browser/NetFront/3.1 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.1  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.1*/*)*]  
Parent=NetFront 3.1  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.1 MMP/2.0*]  
Parent=NetFront 3.1  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.1*]  
Parent=NetFront 3.1  
 
[SAMSUNG-*?NetFront/3.1* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.1  
 
[SEC-SGH*/1.0 NetFront/3.1 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.2  
 
[NetFront 3.2]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.2  
MajorVer=3  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.2*]  
Parent=NetFront 3.2  
 
[*SonyEricsson*/* Browser/NetFront/3.2 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.2  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.2*/*)*]  
Parent=NetFront 3.2  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.1 MMP/2.0*]  
Parent=NetFront 3.2  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.2*]  
Parent=NetFront 3.2  
 
[SAMSUNG-*?NetFront/3.2* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.2  
 
[SEC-SGH*/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.3  
 
[NetFront 3.3]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.3  
MajorVer=3  
MinorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.3*]  
Parent=NetFront 3.3  
 
[*SonyEricsson*/* Browser/NetFront/3.3 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.3  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.3*/*)*]  
Parent=NetFront 3.3  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.3 MMP/2.0*]  
Parent=NetFront 3.3  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.3*]  
Parent=NetFront 3.3  
 
[SAMSUNG-*?NetFront/3.3* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.3  
 
[SEC-SGH*/1.0 NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.3  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.4  
 
[NetFront 3.4]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.4  
MajorVer=3  
MinorVer=4  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.4*]  
Parent=NetFront 3.4  
 
[*SonyEricsson*/* Browser/NetFront/3.4 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.4  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.4*/*)*]  
Parent=NetFront 3.4  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.4 MMP/2.0*]  
Parent=NetFront 3.4  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.4*]  
Parent=NetFront 3.4  
 
[SAMSUNG-*?NetFront/3.4* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.4  
 
[SEC-SGH*/1.0 NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.4  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetFront 3.5  
 
[NetFront 3.5]  
Parent=DefaultProperties  
Browser="NetFront"  
Version=3.5  
MajorVer=3  
MinorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[*NetFront/3.5*]  
Parent=NetFront 3.5  
 
[*SonyEricsson*/* Browser/NetFront/3.5 Profile/MIDP-2.? Configuration/CLDC-1.1*]  
Parent=NetFront 3.5  
 
[Mozilla/4.0 (BREW 3.*; U; *; *; NetFront/3.5*/*)*]  
Parent=NetFront 3.5  
 
[Mozilla/4.0 (MobilePhone */*) NetFront/3.5 MMP/2.0*]  
Parent=NetFront 3.5  
 
[Mozilla/4.0 (MobilePhone; BREW/*.*) NetFront/3.5*]  
Parent=NetFront 3.5  
 
[SAMSUNG-*?NetFront/3.5* profile/MIDP-2.0 configuration/CLDC-1.1*]  
Parent=NetFront 3.5  
 
[SEC-SGH*/1.0 NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1*]  
Parent=NetFront 3.5  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netbox  
 
[Netbox]  
Parent=DefaultProperties  
Browser="Netbox"  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/3.01 (compatible; Netbox/*; Linux*)]  
Parent=Netbox  
Browser="Netbox"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PowerTV  
 
[PowerTV]  
Parent=DefaultProperties  
Browser="PowerTV"  
Platform=PowerTV  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[Mozilla/4.0 PowerTV/1.5 (Compatible; Spyglass DM 3.2.1, EXPLORER)]  
Parent=PowerTV  
Version=1.5  
MajorVer=1  
MinorVer=5  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WebTV/MSNTV  
 
[WebTV]  
Parent=DefaultProperties  
Browser="WebTV/MSNTV"  
Platform=WebTV  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[Mozilla/3.0 WebTV/1.*(compatible; MSIE 2.0)]  
Parent=WebTV  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/4.0 WebTV/2.0*(compatible; MSIE 3.0)]  
Parent=WebTV  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/4.0 WebTV/2.1*(compatible; MSIE 3.0)]  
Parent=WebTV  
Version=2.1  
MajorVer=2  
MinorVer=1  
 
[Mozilla/4.0 WebTV/2.2*(compatible; MSIE 3.0)]  
Parent=WebTV  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
[Mozilla/4.0 WebTV/2.3*(compatible; MSIE 3.0)]  
Parent=WebTV  
Version=2.3  
MajorVer=2  
MinorVer=3  
 
[Mozilla/4.0 WebTV/2.4*(compatible; MSIE 3.0)]  
Parent=WebTV  
Version=2.4  
MajorVer=2  
MinorVer=4  
 
[Mozilla/4.0 WebTV/2.5*(compatible; MSIE 4.0)]  
Parent=WebTV  
Version=2.5  
MajorVer=2  
MinorVer=5  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.0 WebTV/2.6*(compatible; MSIE 4.0)]  
Parent=WebTV  
Version=2.6  
MajorVer=2  
MinorVer=6  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.0 WebTV/2.7*(compatible; MSIE 4.0)]  
Parent=WebTV  
Version=2.7  
MajorVer=2  
MinorVer=7  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.0 WebTV/2.8*(compatible; MSIE 4.0)]  
Parent=WebTV  
Version=2.8  
MajorVer=2  
MinorVer=8  
JavaApplets=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.0 WebTV/2.9*(compatible; MSIE 4.0)]  
Parent=WebTV  
Version=2.9  
MajorVer=2  
MinorVer=9  
JavaApplets=true  
CssVersion=1  
supportsCSS=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Amaya  
 
[Amaya]  
Parent=DefaultProperties  
Browser="Amaya"  
Tables=true  
Cookies=true  
 
[amaya/10.*]  
Parent=Amaya  
Version=10.0  
MajorVer=10  
MinorVer=0  
 
[amaya/11.*]  
Parent=Amaya  
Version=11.0  
MajorVer=11  
MinorVer=0  
 
[amaya/7.*]  
Parent=Amaya  
Version=7.0  
MajorVer=7  
MinorVer=0  
 
[amaya/8.*]  
Parent=Amaya  
Version=8.0  
MajorVer=8  
MinorVer=0  
CssVersion=2  
supportsCSS=true  
 
[amaya/9.*]  
Parent=Amaya  
Version=9.0  
MajorVer=9  
MinorVer=0  
 
[Emacs-w3m/*]  
Parent=Emacs/W3  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Links  
 
[Links]  
Parent=DefaultProperties  
Browser="Links"  
Frames=true  
Tables=true  
 
[Links (0.9*; CYGWIN_NT-5.1*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=WinXP  
 
[Links (0.9*; Darwin*)]  
Parent=Links  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=MacPPC  
 
[Links (0.9*; FreeBSD*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=FreeBSD  
 
[Links (0.9*; Linux*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=Linux  
 
[Links (0.9*; OS/2*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=OS/2  
 
[Links (0.9*; Unix*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=Unix  
 
[Links (0.9*; Win32*)]  
Parent=Links  
Browser="Links"  
Version=0.9  
MajorVer=0  
MinorVer=9  
Platform=Win32  
Win32=true  
 
[Links (1.0*; CYGWIN_NT-5.1*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinXP  
 
[Links (1.0*; FreeBSD*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=FreeBSD  
 
[Links (1.0*; Linux*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Linux  
 
[Links (1.0*; OS/2*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=OS/2  
 
[Links (1.0*; Unix*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Unix  
 
[Links (1.0*; Win32*)]  
Parent=Links  
Browser="Links"  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win32  
Win32=true  
 
[Links (2.0*; Linux*)]  
Parent=Links  
Browser="Links"  
Version=2.0  
MajorVer=2  
MinorVer=0  
Platform=Linux  
 
[Links (2.1*; FreeBSD*)]  
Parent=Links  
Browser="Links"  
Version=2.1  
MajorVer=2  
MinorVer=1  
Platform=FreeBSD  
 
[Links (2.1*; Linux *)]  
Parent=Links  
Browser="Links"  
Version=2.1  
MajorVer=2  
MinorVer=1  
Platform=Linux  
 
[Links (2.1*; OpenBSD*)]  
Parent=Links  
Browser="Links"  
Version=2.1  
MajorVer=2  
MinorVer=1  
Platform=OpenBSD  
 
[Links (2.2*; FreeBSD*)]  
Parent=Links  
Version=2.2  
MajorVer=2  
MinorVer=2  
Platform=FreeBSD  
 
[Links (2.2*; Linux *)]  
Parent=Links  
Version=2.2  
MajorVer=2  
MinorVer=2  
Platform=Linux  
 
[Links (2.2*; OpenBSD*)]  
Parent=Links  
Version=2.2  
MajorVer=2  
MinorVer=2  
Platform=OpenBSD  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lynx  
 
[Lynx]  
Parent=DefaultProperties  
Browser="Lynx"  
Frames=true  
Tables=true  
 
[Lynx *]  
Parent=Lynx  
Browser="Lynx"  
 
[Lynx/2.3*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.3  
MajorVer=2  
MinorVer=3  
 
[Lynx/2.4*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.4  
MajorVer=2  
MinorVer=4  
 
[Lynx/2.5*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.5  
MajorVer=2  
MinorVer=5  
 
[Lynx/2.6*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.6  
MajorVer=2  
MinorVer=6  
 
[Lynx/2.7*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.7  
MajorVer=2  
MinorVer=7  
 
[Lynx/2.8*]  
Parent=Lynx  
Browser="Lynx"  
Version=2.8  
MajorVer=2  
MinorVer=8  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NCSA Mosaic  
 
[Mosaic]  
Parent=DefaultProperties  
Browser="Mosaic"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; w3m  
 
[w3m]  
Parent=DefaultProperties  
Browser="w3m"  
Frames=true  
Tables=true  
 
[w3m/0.1*]  
Parent=w3m  
Browser="w3m"  
Version=0.1  
MajorVer=0  
MinorVer=1  
 
[w3m/0.2*]  
Parent=w3m  
Browser="w3m"  
Version=0.2  
MajorVer=0  
MinorVer=2  
 
[w3m/0.3*]  
Parent=w3m  
Browser="w3m"  
Version=0.3  
MajorVer=0  
MinorVer=3  
 
[w3m/0.4*]  
Parent=w3m  
Browser="w3m"  
Version=0.4  
MajorVer=0  
MinorVer=4  
Cookies=true  
 
[w3m/0.5*]  
Parent=w3m  
Browser="w3m"  
Version=0.5  
MajorVer=0  
MinorVer=5  
Cookies=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.10  
 
[ELinks 0.10]  
Parent=DefaultProperties  
Browser="ELinks"  
Version=0.10  
MinorVer=10  
Frames=true  
Tables=true  
 
[ELinks (0.10*; *AIX*)]  
Parent=ELinks 0.10  
Platform=AIX  
 
[ELinks (0.10*; *BeOS*)]  
Parent=ELinks 0.10  
Platform=BeOS  
 
[ELinks (0.10*; *CygWin*)]  
Parent=ELinks 0.10  
Platform=CygWin  
 
[ELinks (0.10*; *Darwin*)]  
Parent=ELinks 0.10  
Platform=Darwin  
 
[ELinks (0.10*; *Digital Unix*)]  
Parent=ELinks 0.10  
Platform=Digital Unix  
 
[ELinks (0.10*; *FreeBSD*)]  
Parent=ELinks 0.10  
Platform=FreeBSD  
 
[ELinks (0.10*; *HPUX*)]  
Parent=ELinks 0.10  
Platform=HP-UX  
 
[ELinks (0.10*; *IRIX*)]  
Parent=ELinks 0.10  
Platform=IRIX  
 
[ELinks (0.10*; *Linux*)]  
Parent=ELinks 0.10  
Platform=Linux  
 
[ELinks (0.10*; *NetBSD*)]  
Parent=ELinks 0.10  
Platform=NetBSD  
 
[ELinks (0.10*; *OpenBSD*)]  
Parent=ELinks 0.10  
Platform=OpenBSD  
 
[ELinks (0.10*; *OS/2*)]  
Parent=ELinks 0.10  
Platform=OS/2  
 
[ELinks (0.10*; *RISC*)]  
Parent=ELinks 0.10  
Platform=RISC OS  
 
[ELinks (0.10*; *Solaris*)]  
Parent=ELinks 0.10  
Platform=Solaris  
 
[ELinks (0.10*; *Unix*)]  
Parent=ELinks 0.10  
Platform=Unix  
 
[ELinks/0.10* (*AIX*)]  
Parent=ELinks 0.10  
Platform=AIX  
 
[ELinks/0.10* (*BeOS*)]  
Parent=ELinks 0.10  
Platform=BeOS  
 
[ELinks/0.10* (*CygWin*)]  
Parent=ELinks 0.10  
Platform=CygWin  
 
[ELinks/0.10* (*Darwin*)]  
Parent=ELinks 0.10  
Platform=Darwin  
 
[ELinks/0.10* (*Digital Unix*)]  
Parent=ELinks 0.10  
Platform=Digital Unix  
 
[ELinks/0.10* (*FreeBSD*)]  
Parent=ELinks 0.10  
Platform=FreeBSD  
 
[ELinks/0.10* (*HPUX*)]  
Parent=ELinks 0.10  
Platform=HP-UX  
 
[ELinks/0.10* (*IRIX*)]  
Parent=ELinks 0.10  
Platform=IRIX  
 
[ELinks/0.10* (*Linux*)]  
Parent=ELinks 0.10  
Platform=Linux  
 
[ELinks/0.10* (*NetBSD*)]  
Parent=ELinks 0.10  
Platform=NetBSD  
 
[ELinks/0.10* (*OpenBSD*)]  
Parent=ELinks 0.10  
Platform=OpenBSD  
 
[ELinks/0.10* (*OS/2*)]  
Parent=ELinks 0.10  
Platform=OS/2  
 
[ELinks/0.10* (*RISC*)]  
Parent=ELinks 0.10  
Platform=RISC OS  
 
[ELinks/0.10* (*Solaris*)]  
Parent=ELinks 0.10  
Platform=Solaris  
 
[ELinks/0.10* (*Unix*)]  
Parent=ELinks 0.10  
Platform=Unix  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.11  
 
[ELinks 0.11]  
Parent=DefaultProperties  
Browser="ELinks"  
Version=0.11  
MinorVer=11  
Frames=true  
Tables=true  
 
[ELinks (0.11*; *AIX*)]  
Parent=ELinks 0.11  
Platform=AIX  
 
[ELinks (0.11*; *BeOS*)]  
Parent=ELinks 0.11  
Platform=BeOS  
 
[ELinks (0.11*; *CygWin*)]  
Parent=ELinks 0.11  
Platform=CygWin  
 
[ELinks (0.11*; *Darwin*)]  
Parent=ELinks 0.11  
Platform=Darwin  
 
[ELinks (0.11*; *Digital Unix*)]  
Parent=ELinks 0.11  
Platform=Digital Unix  
 
[ELinks (0.11*; *FreeBSD*)]  
Parent=ELinks 0.11  
Platform=FreeBSD  
 
[ELinks (0.11*; *HPUX*)]  
Parent=ELinks 0.11  
Platform=HP-UX  
 
[ELinks (0.11*; *IRIX*)]  
Parent=ELinks 0.11  
Platform=IRIX  
 
[ELinks (0.11*; *Linux*)]  
Parent=ELinks 0.11  
Platform=Linux  
 
[ELinks (0.11*; *NetBSD*)]  
Parent=ELinks 0.11  
Platform=NetBSD  
 
[ELinks (0.11*; *OpenBSD*)]  
Parent=ELinks 0.11  
Platform=OpenBSD  
 
[ELinks (0.11*; *OS/2*)]  
Parent=ELinks 0.11  
Platform=OS/2  
 
[ELinks (0.11*; *RISC*)]  
Parent=ELinks 0.11  
Platform=RISC OS  
 
[ELinks (0.11*; *Solaris*)]  
Parent=ELinks 0.11  
Platform=Solaris  
 
[ELinks (0.11*; *Unix*)]  
Parent=ELinks 0.11  
Platform=Unix  
 
[ELinks/0.11* (*AIX*)]  
Parent=ELinks 0.11  
Platform=AIX  
 
[ELinks/0.11* (*BeOS*)]  
Parent=ELinks 0.11  
Platform=BeOS  
 
[ELinks/0.11* (*CygWin*)]  
Parent=ELinks 0.11  
Platform=CygWin  
 
[ELinks/0.11* (*Darwin*)]  
Parent=ELinks 0.11  
Platform=Darwin  
 
[ELinks/0.11* (*Digital Unix*)]  
Parent=ELinks 0.11  
Platform=Digital Unix  
 
[ELinks/0.11* (*FreeBSD*)]  
Parent=ELinks 0.11  
Platform=FreeBSD  
 
[ELinks/0.11* (*HPUX*)]  
Parent=ELinks 0.11  
Platform=HP-UX  
 
[ELinks/0.11* (*IRIX*)]  
Parent=ELinks 0.11  
Platform=IRIX  
 
[ELinks/0.11* (*Linux*)]  
Parent=ELinks 0.11  
Platform=Linux  
 
[ELinks/0.11* (*NetBSD*)]  
Parent=ELinks 0.11  
Platform=NetBSD  
 
[ELinks/0.11* (*OpenBSD*)]  
Parent=ELinks 0.11  
Platform=OpenBSD  
 
[ELinks/0.11* (*OS/2*)]  
Parent=ELinks 0.11  
Platform=OS/2  
 
[ELinks/0.11* (*RISC*)]  
Parent=ELinks 0.11  
Platform=RISC OS  
 
[ELinks/0.11* (*Solaris*)]  
Parent=ELinks 0.11  
Platform=Solaris  
 
[ELinks/0.11* (*Unix*)]  
Parent=ELinks 0.11  
Platform=Unix  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.12  
 
[ELinks 0.12]  
Parent=DefaultProperties  
Browser="ELinks"  
Version=0.12  
MinorVer=12  
Frames=true  
Tables=true  
 
[ELinks (0.12*; *AIX*)]  
Parent=ELinks 0.12  
Platform=AIX  
 
[ELinks (0.12*; *BeOS*)]  
Parent=ELinks 0.12  
Platform=BeOS  
 
[ELinks (0.12*; *CygWin*)]  
Parent=ELinks 0.12  
Platform=CygWin  
 
[ELinks (0.12*; *Darwin*)]  
Parent=ELinks 0.12  
Platform=Darwin  
 
[ELinks (0.12*; *Digital Unix*)]  
Parent=ELinks 0.12  
Platform=Digital Unix  
 
[ELinks (0.12*; *FreeBSD*)]  
Parent=ELinks 0.12  
Platform=FreeBSD  
 
[ELinks (0.12*; *HPUX*)]  
Parent=ELinks 0.12  
Platform=HP-UX  
 
[ELinks (0.12*; *IRIX*)]  
Parent=ELinks 0.12  
Platform=IRIX  
 
[ELinks (0.12*; *Linux*)]  
Parent=ELinks 0.12  
Platform=Linux  
 
[ELinks (0.12*; *NetBSD*)]  
Parent=ELinks 0.12  
Platform=NetBSD  
 
[ELinks (0.12*; *OpenBSD*)]  
Parent=ELinks 0.12  
Platform=OpenBSD  
 
[ELinks (0.12*; *OS/2*)]  
Parent=ELinks 0.12  
Platform=OS/2  
 
[ELinks (0.12*; *RISC*)]  
Parent=ELinks 0.12  
Platform=RISC OS  
 
[ELinks (0.12*; *Solaris*)]  
Parent=ELinks 0.12  
Platform=Solaris  
 
[ELinks (0.12*; *Unix*)]  
Parent=ELinks 0.12  
Platform=Unix  
 
[ELinks/0.12* (*AIX*)]  
Parent=ELinks 0.12  
Platform=AIX  
 
[ELinks/0.12* (*BeOS*)]  
Parent=ELinks 0.12  
Platform=BeOS  
 
[ELinks/0.12* (*CygWin*)]  
Parent=ELinks 0.12  
Platform=CygWin  
 
[ELinks/0.12* (*Darwin*)]  
Parent=ELinks 0.12  
Platform=Darwin  
 
[ELinks/0.12* (*Digital Unix*)]  
Parent=ELinks 0.12  
Platform=Digital Unix  
 
[ELinks/0.12* (*FreeBSD*)]  
Parent=ELinks 0.12  
Platform=FreeBSD  
 
[ELinks/0.12* (*HPUX*)]  
Parent=ELinks 0.12  
Platform=HP-UX  
 
[ELinks/0.12* (*IRIX*)]  
Parent=ELinks 0.12  
Platform=IRIX  
 
[ELinks/0.12* (*Linux*)]  
Parent=ELinks 0.12  
Platform=Linux  
 
[ELinks/0.12* (*NetBSD*)]  
Parent=ELinks 0.12  
Platform=NetBSD  
 
[ELinks/0.12* (*OpenBSD*)]  
Parent=ELinks 0.12  
Platform=OpenBSD  
 
[ELinks/0.12* (*OS/2*)]  
Parent=ELinks 0.12  
Platform=OS/2  
 
[ELinks/0.12* (*RISC*)]  
Parent=ELinks 0.12  
Platform=RISC OS  
 
[ELinks/0.12* (*Solaris*)]  
Parent=ELinks 0.12  
Platform=Solaris  
 
[ELinks/0.12* (*Unix*)]  
Parent=ELinks 0.12  
Platform=Unix  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.13  
 
[ELinks 0.13]  
Parent=DefaultProperties  
Browser="ELinks"  
Version=0.13  
MinorVer=13  
Frames=true  
Tables=true  
 
[ELinks (0.13*; *AIX*)]  
Parent=ELinks 0.13  
Platform=AIX  
 
[ELinks (0.13*; *BeOS*)]  
Parent=ELinks 0.13  
Platform=BeOS  
 
[ELinks (0.13*; *CygWin*)]  
Parent=ELinks 0.13  
Platform=CygWin  
 
[ELinks (0.13*; *Darwin*)]  
Parent=ELinks 0.13  
Platform=Darwin  
 
[ELinks (0.13*; *Digital Unix*)]  
Parent=ELinks 0.13  
Platform=Digital Unix  
 
[ELinks (0.13*; *FreeBSD*)]  
Parent=ELinks 0.13  
Platform=FreeBSD  
 
[ELinks (0.13*; *HPUX*)]  
Parent=ELinks 0.13  
Platform=HP-UX  
 
[ELinks (0.13*; *IRIX*)]  
Parent=ELinks 0.13  
Platform=IRIX  
 
[ELinks (0.13*; *Linux*)]  
Parent=ELinks 0.13  
Platform=Linux  
 
[ELinks (0.13*; *NetBSD*)]  
Parent=ELinks 0.13  
Platform=NetBSD  
 
[ELinks (0.13*; *OpenBSD*)]  
Parent=ELinks 0.13  
Platform=OpenBSD  
 
[ELinks (0.13*; *OS/2*)]  
Parent=ELinks 0.13  
Platform=OS/2  
 
[ELinks (0.13*; *RISC*)]  
Parent=ELinks 0.13  
Platform=RISC OS  
 
[ELinks (0.13*; *Solaris*)]  
Parent=ELinks 0.13  
Platform=Solaris  
 
[ELinks (0.13*; *Unix*)]  
Parent=ELinks 0.13  
Platform=Unix  
 
[ELinks/0.13* (*AIX*)]  
Parent=ELinks 0.13  
Platform=AIX  
 
[ELinks/0.13* (*BeOS*)]  
Parent=ELinks 0.13  
Platform=BeOS  
 
[ELinks/0.13* (*CygWin*)]  
Parent=ELinks 0.13  
Platform=CygWin  
 
[ELinks/0.13* (*Darwin*)]  
Parent=ELinks 0.13  
Platform=Darwin  
 
[ELinks/0.13* (*Digital Unix*)]  
Parent=ELinks 0.13  
Platform=Digital Unix  
 
[ELinks/0.13* (*FreeBSD*)]  
Parent=ELinks 0.13  
Platform=FreeBSD  
 
[ELinks/0.13* (*HPUX*)]  
Parent=ELinks 0.13  
Platform=HP-UX  
 
[ELinks/0.13* (*IRIX*)]  
Parent=ELinks 0.13  
Platform=IRIX  
 
[ELinks/0.13* (*Linux*)]  
Parent=ELinks 0.13  
Platform=Linux  
 
[ELinks/0.13* (*NetBSD*)]  
Parent=ELinks 0.13  
Platform=NetBSD  
 
[ELinks/0.13* (*OpenBSD*)]  
Parent=ELinks 0.13  
Platform=OpenBSD  
 
[ELinks/0.13* (*OS/2*)]  
Parent=ELinks 0.13  
Platform=OS/2  
 
[ELinks/0.13* (*RISC*)]  
Parent=ELinks 0.13  
Platform=RISC OS  
 
[ELinks/0.13* (*Solaris*)]  
Parent=ELinks 0.13  
Platform=Solaris  
 
[ELinks/0.13* (*Unix*)]  
Parent=ELinks 0.13  
Platform=Unix  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELinks 0.9  
 
[ELinks 0.9]  
Parent=DefaultProperties  
Browser="ELinks"  
Version=0.9  
MinorVer=9  
Frames=true  
Tables=true  
 
[ELinks (0.9*; *AIX*)]  
Parent=ELinks 0.9  
Platform=AIX  
 
[ELinks (0.9*; *BeOS*)]  
Parent=ELinks 0.9  
Platform=BeOS  
 
[ELinks (0.9*; *CygWin*)]  
Parent=ELinks 0.9  
Platform=CygWin  
 
[ELinks (0.9*; *Darwin*)]  
Parent=ELinks 0.9  
Platform=Darwin  
 
[ELinks (0.9*; *Digital Unix*)]  
Parent=ELinks 0.9  
Platform=Digital Unix  
 
[ELinks (0.9*; *FreeBSD*)]  
Parent=ELinks 0.9  
Platform=FreeBSD  
 
[ELinks (0.9*; *HPUX*)]  
Parent=ELinks 0.9  
Platform=HP-UX  
 
[ELinks (0.9*; *IRIX*)]  
Parent=ELinks 0.9  
Platform=IRIX  
 
[ELinks (0.9*; *Linux*)]  
Parent=ELinks 0.9  
Platform=Linux  
 
[ELinks (0.9*; *NetBSD*)]  
Parent=ELinks 0.9  
Platform=NetBSD  
 
[ELinks (0.9*; *OpenBSD*)]  
Parent=ELinks 0.9  
Platform=OpenBSD  
 
[ELinks (0.9*; *OS/2*)]  
Parent=ELinks 0.9  
Platform=OS/2  
 
[ELinks (0.9*; *RISC*)]  
Parent=ELinks 0.9  
Platform=RISC OS  
 
[ELinks (0.9*; *Solaris*)]  
Parent=ELinks 0.9  
Platform=Solaris  
 
[ELinks (0.9*; *Unix*)]  
Parent=ELinks 0.9  
Platform=Unix  
 
[ELinks/0.9* (*AIX*)]  
Parent=ELinks 0.9  
Platform=AIX  
 
[ELinks/0.9* (*BeOS*)]  
Parent=ELinks 0.9  
Platform=BeOS  
 
[ELinks/0.9* (*CygWin*)]  
Parent=ELinks 0.9  
Platform=CygWin  
 
[ELinks/0.9* (*Darwin*)]  
Parent=ELinks 0.9  
Platform=Darwin  
 
[ELinks/0.9* (*Digital Unix*)]  
Parent=ELinks 0.9  
Platform=Digital Unix  
 
[ELinks/0.9* (*FreeBSD*)]  
Parent=ELinks 0.9  
Platform=FreeBSD  
 
[ELinks/0.9* (*HPUX*)]  
Parent=ELinks 0.9  
Platform=HP-UX  
 
[ELinks/0.9* (*IRIX*)]  
Parent=ELinks 0.9  
Platform=IRIX  
 
[ELinks/0.9* (*Linux*)]  
Parent=ELinks 0.9  
Platform=Linux  
 
[ELinks/0.9* (*NetBSD*)]  
Parent=ELinks 0.9  
Platform=NetBSD  
 
[ELinks/0.9* (*OpenBSD*)]  
Parent=ELinks 0.9  
Platform=OpenBSD  
 
[ELinks/0.9* (*OS/2*)]  
Parent=ELinks 0.9  
Platform=OS/2  
 
[ELinks/0.9* (*RISC*)]  
Parent=ELinks 0.9  
Platform=RISC OS  
 
[ELinks/0.9* (*Solaris*)]  
Parent=ELinks 0.9  
Platform=Solaris  
 
[ELinks/0.9* (*Unix*)]  
Parent=ELinks 0.9  
Platform=Unix  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AppleWebKit  
 
[AppleWebKit]  
Parent=DefaultProperties  
Browser="AppleWebKit"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (KHTML, like Gecko)]  
Parent=AppleWebKit  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Camino  
 
[Camino]  
Parent=DefaultProperties  
Browser="Camino"  
Platform=MacOSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *Intel Mac OS X*; *; rv:1.9.*) Gecko/* Camino/2.0*]  
Parent=Camino  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.7*]  
Parent=Camino  
Version=0.7  
MajorVer=0  
MinorVer=7  
Beta=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.8*]  
Parent=Camino  
Version=0.8  
MajorVer=0  
MinorVer=8  
Beta=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/0.9*]  
Parent=Camino  
Version=0.9  
MajorVer=0  
MinorVer=9  
Beta=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.0*]  
Parent=Camino  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.2*]  
Parent=Camino  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.3*]  
Parent=Camino  
Version=1.3  
MajorVer=1  
MinorVer=3  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.4*]  
Parent=Camino  
Version=1.4  
MajorVer=1  
MinorVer=4  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.5*]  
Parent=Camino  
Version=1.5  
MajorVer=1  
MinorVer=5  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) Gecko/* Camino/1.6*]  
Parent=Camino  
Version=1.6  
MajorVer=1  
MinorVer=6  
Platform=MacOSX  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Chimera  
 
[Chimera]  
Parent=DefaultProperties  
Browser="Chimera"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/5.0 (Macintosh; U; *Mac OS X*; *; rv:1.*) Gecko/* Chimera/*]  
Parent=Chimera  
Platform=MacOSX  
 
[Mozilla/5.0 Gecko/* Chimera/*]  
Parent=Chimera  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dillo  
 
[Dillo]  
Parent=DefaultProperties  
Browser="Dillo"  
Platform=Linux  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
CssVersion=2  
supportsCSS=true  
 
[Dillo/0.6*]  
Parent=Dillo  
Version=0.6  
MajorVer=0  
MinorVer=6  
 
[Dillo/0.7*]  
Parent=Dillo  
Version=0.7  
MajorVer=0  
MinorVer=7  
 
[Dillo/0.8*]  
Parent=Dillo  
Version=0.8  
MajorVer=0  
MinorVer=8  
 
[Dillo/2.0]  
Parent=Dillo  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Emacs/W3  
 
[Emacs/W3]  
Parent=DefaultProperties  
Browser="Emacs/W3"  
Frames=true  
Tables=true  
Cookies=true  
 
[Emacs/W3/2.* (Unix*]  
Parent=Emacs/W3  
Version=2.0  
MajorVer=2  
MinorVer=0  
Platform=Unix  
 
[Emacs/W3/2.* (X11*]  
Parent=Emacs/W3  
Version=2.0  
MajorVer=2  
MinorVer=0  
Platform=Linux  
 
[Emacs/W3/3.* (Unix*]  
Parent=Emacs/W3  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Unix  
 
[Emacs/W3/3.* (X11*]  
Parent=Emacs/W3  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Linux  
 
[Emacs/W3/4.* (Unix*]  
Parent=Emacs/W3  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=Unix  
 
[Emacs/W3/4.* (X11*]  
Parent=Emacs/W3  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; fantomas  
 
[fantomas]  
Parent=DefaultProperties  
Browser="fantomas"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[Mozilla/4.0 (cloakBrowser)]  
Parent=fantomas  
Browser="fantomas cloakBrowser"  
 
[Mozilla/4.0 (fantomas shadowMaker Browser)]  
Parent=fantomas  
Browser="fantomas shadowMaker Browser"  
 
[Mozilla/4.0 (fantomBrowser)]  
Parent=fantomas  
Browser="fantomas fantomBrowser"  
 
[Mozilla/4.0 (fantomCrew Browser)]  
Parent=fantomas  
Browser="fantomas fantomCrew Browser"  
 
[Mozilla/4.0 (stealthBrowser)]  
Parent=fantomas  
Browser="fantomas stealthBrowser"  
 
[multiBlocker browser*]  
Parent=fantomas  
Browser="fantomas multiBlocker browser"  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FrontPage  
 
[FrontPage]  
Parent=DefaultProperties  
Browser="FrontPage"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[Mozilla/?* (compatible; MS FrontPage*)]  
Parent=FrontPage  
 
[MSFrontPage/*]  
Parent=FrontPage  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Galeon  
 
[Galeon]  
Parent=DefaultProperties  
Browser="Galeon"  
Platform=Linux  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/1.*]  
Parent=Galeon  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (X11; U; Linux*) Gecko/* Galeon/2.*]  
Parent=Galeon  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 Galeon/1.* (X11; Linux*)*]  
Parent=Galeon  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 Galeon/2.* (X11; Linux*)*]  
Parent=Galeon  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HP Secure Web Browser  
 
[HP Secure Web Browser]  
Parent=DefaultProperties  
Browser="HP Secure Web Browser"  
Platform=OpenVMS  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.0*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.1*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.2*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.3*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.3  
MajorVer=1  
MinorVer=3  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.4*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.4  
MajorVer=1  
MinorVer=4  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.5*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.5  
MajorVer=1  
MinorVer=5  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.6*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.6  
MajorVer=1  
MinorVer=6  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.7*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.7  
MajorVer=1  
MinorVer=7  
 
[Mozilla/5.0 (X11; U; OpenVMS*; *; rv:1.8*) Gecko/*]  
Parent=HP Secure Web Browser  
Version=1.8  
MajorVer=1  
MinorVer=8  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IBrowse  
 
[IBrowse]  
Parent=DefaultProperties  
Browser="IBrowse"  
Platform=Amiga  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
 
[Arexx (compatible; MSIE 6.0; AmigaOS5.0) IBrowse 4.0]  
Parent=IBrowse  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[IBrowse/1.22 (AmigaOS *)]  
Parent=IBrowse  
Version=1.22  
MajorVer=1  
MinorVer=22  
 
[IBrowse/2.1 (AmigaOS *)]  
Parent=IBrowse  
Version=2.1  
MajorVer=2  
MinorVer=1  
 
[IBrowse/2.2 (AmigaOS *)]  
Parent=IBrowse  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
[IBrowse/2.3 (AmigaOS *)]  
Parent=IBrowse  
Version=2.2  
MajorVer=2  
MinorVer=3  
 
[Mozilla/* (Win98; I) IBrowse/2.1 (AmigaOS 3.1)]  
Parent=IBrowse  
Version=2.1  
MajorVer=2  
MinorVer=1  
 
[Mozilla/* (Win98; I) IBrowse/2.2 (AmigaOS 3.1)]  
Parent=IBrowse  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
[Mozilla/* (Win98; I) IBrowse/2.3 (AmigaOS 3.1)]  
Parent=IBrowse  
Version=2.3  
MajorVer=2  
MinorVer=3  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iCab  
 
[iCab]  
Parent=DefaultProperties  
Browser="iCab"  
Frames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[iCab/2.7* (Macintosh; ?; 68K*)]  
Parent=iCab  
Version=2.7  
MajorVer=2  
MinorVer=7  
Platform=Mac68K  
 
[iCab/2.7* (Macintosh; ?; PPC*)]  
Parent=iCab  
Version=2.7  
MajorVer=2  
MinorVer=7  
Platform=MacPPC  
 
[iCab/2.8* (Macintosh; ?; *Mac OS X*)]  
Parent=iCab  
Version=2.8  
MajorVer=2  
MinorVer=8  
Platform=MacOSX  
 
[iCab/2.8* (Macintosh; ?; 68K*)]  
Parent=iCab  
Version=2.8  
MajorVer=2  
MinorVer=8  
Platform=Mac68K  
 
[iCab/2.8* (Macintosh; ?; PPC)]  
Parent=iCab  
Version=2.8  
MajorVer=2  
MinorVer=8  
Platform=MacPPC  
 
[iCab/2.9* (Macintosh; ?; *Mac OS X*)]  
Parent=iCab  
Version=2.9  
MajorVer=2  
MinorVer=9  
Platform=MacOSX  
 
[iCab/2.9* (Macintosh; ?; 68K*)]  
Parent=iCab  
Version=2.9  
MajorVer=2  
MinorVer=9  
Platform=Mac68K  
 
[iCab/2.9* (Macintosh; ?; PPC*)]  
Parent=iCab  
Version=2.9  
MajorVer=2  
MinorVer=9  
Platform=MacPPC  
 
[iCab/3.0* (Macintosh; ?; *Mac OS X*)]  
Parent=iCab  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=MacOSX  
CssVersion=2  
supportsCSS=true  
 
[iCab/3.0* (Macintosh; ?; PPC*)]  
Parent=iCab  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=MacPPC  
CssVersion=2  
supportsCSS=true  
 
[iCab/4.0 (Macintosh; U; *Mac OS X)]  
Parent=iCab  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=MacOSX  
 
[Mozilla/* (compatible; iCab 3.0*; Macintosh; *Mac OS X*)]  
Parent=iCab  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=MacOSX  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; iCab 3.0*; Macintosh; ?; PPC*)]  
Parent=iCab  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=MacPPC  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.5 (compatible; iCab 2.7*; Macintosh; ?; 68K*)]  
Parent=iCab  
Version=2.7  
MajorVer=2  
MinorVer=7  
Platform=Mac68K  
 
[Mozilla/4.5 (compatible; iCab 2.7*; Macintosh; ?; PPC*)]  
Parent=iCab  
Version=2.7  
MajorVer=2  
MinorVer=7  
Platform=MacPPC  
 
[Mozilla/4.5 (compatible; iCab 2.8*; Macintosh; ?; *Mac OS X*)]  
Parent=iCab  
Version=2.8  
MajorVer=2  
MinorVer=8  
Platform=MacOSX  
 
[Mozilla/4.5 (compatible; iCab 2.8*; Macintosh; ?; PPC*)]  
Parent=iCab  
Version=2.8  
MajorVer=2  
MinorVer=8  
Platform=MacPPC  
 
[Mozilla/4.5 (compatible; iCab 2.9*; Macintosh; *Mac OS X*)]  
Parent=iCab  
Version=2.9  
MajorVer=2  
MinorVer=9  
Platform=MacOSX  
 
[Mozilla/4.5 (compatible; iCab 2.9*; Macintosh; ?; PPC*)]  
Parent=iCab  
Version=2.9  
MajorVer=2  
MinorVer=9  
Platform=MacPPC  
 
[Mozilla/4.5 (compatible; iCab 4.2*; Macintosh; *Mac OS X*)]  
Parent=iCab  
Version=4.2  
MajorVer=4  
MinorVer=2  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X*; *) AppleWebKit/* (KHTML, like Gecko) iCab/4.7 Safari/*]  
Parent=iCab  
Version=4.7  
MajorVer=4  
MinorVer=7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iSiloX  
 
[iSiloX]  
Parent=DefaultProperties  
Browser="iSiloX"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
Crawler=true  
CssVersion=2  
supportsCSS=true  
 
[iSiloX/4.0* MacOS]  
Parent=iSiloX  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=MacPPC  
 
[iSiloX/4.0* Windows/32]  
Parent=iSiloX  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=Win32  
Win32=true  
 
[iSiloX/4.1* MacOS]  
Parent=iSiloX  
Version=4.1  
MajorVer=4  
MinorVer=1  
Platform=MacPPC  
 
[iSiloX/4.1* Windows/32]  
Parent=iSiloX  
Version=4.1  
MajorVer=4  
MinorVer=1  
Platform=Win32  
Win32=true  
 
[iSiloX/4.2* MacOS]  
Parent=iSiloX  
Version=4.2  
MajorVer=4  
MinorVer=2  
Platform=MacPPC  
 
[iSiloX/4.2* Windows/32]  
Parent=iSiloX  
Version=4.2  
MajorVer=4  
MinorVer=2  
Platform=Win32  
Win32=true  
 
[iSiloX/4.3* MacOS]  
Parent=iSiloX  
Version=4.3  
MajorVer=4  
MinorVer=4  
Platform=MacOSX  
 
[iSiloX/4.3* Windows/32]  
Parent=iSiloX  
Version=4.3  
MajorVer=4  
MinorVer=3  
Platform=Win32  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lycoris Desktop/LX  
 
[Lycoris Desktop/LX]  
Parent=DefaultProperties  
Browser="Lycoris Desktop/LX"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
Crawler=true  
 
[Mozilla/5.0 (X11; U; Linux i686*; en-US; rv:1.*: Desktop/LX Amethyst) Gecko/*]  
Parent=Lycoris Desktop/LX  
Version=1.1  
MajorVer=1  
MinorVer=1  
Platform=Linux  
 
[Mozilla/5.0 (X11; U; Linux i686*; en-US; rv:1.*; Desktop/LX Amethyst) Gecko/*]  
Parent=Lycoris Desktop/LX  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Linux  
 
[Mozilla/4.0 (VMS_Mosaic)]  
Parent=Mosaic  
Platform=OpenVMS  
 
[VMS_Mosaic/3.7*]  
Parent=Mosaic  
Version=3.7  
MajorVer=3  
MinorVer=7  
Platform=OpenVMS  
 
[VMS_Mosaic/3.8*]  
Parent=Mosaic  
Version=3.8  
MajorVer=3  
MinorVer=8  
Platform=OpenVMS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NetPositive  
 
[NetPositive]  
Parent=DefaultProperties  
Browser="NetPositive"  
Platform=BeOS  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
 
[*NetPositive/2.2*]  
Parent=NetPositive  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
[*NetPositive/2.2*BeOS*]  
Parent=NetPositive  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OmniWeb  
 
[OmniWeb]  
Parent=DefaultProperties  
Browser="OmniWeb"  
Platform=MacOSX  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
isMobileDevice=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) OmniWeb/v4*]  
Parent=OmniWeb  
Version=4.5  
MajorVer=4  
MinorVer=5  
Platform=MacOSX  
 
[Mozilla/* (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) OmniWeb/v5*]  
Parent=OmniWeb  
Version=5.  
MajorVer=5  
MinorVer=0  
Platform=MacOSX  
 
[Mozilla/* (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) OmniWeb/v6*]  
Parent=OmniWeb  
Version=6.0  
MajorVer=6  
MinorVer=0  
Platform=MacOSX  
 
[Mozilla/* (Macintosh; ?; PPC) OmniWeb/4*]  
Parent=OmniWeb  
Version=4.0  
MajorVer=4  
MinorVer=0  
Platform=MacPPC  
 
[Mozilla/* (Macintosh; ?; PPC) OmniWeb/5*]  
Parent=OmniWeb  
Version=5.0  
MajorVer=5  
MinorVer=0  
Platform=MacOSX  
 
[Mozilla/* (Macintosh; ?; PPC) OmniWeb/6*]  
Parent=OmniWeb  
Version=6.0  
MajorVer=6  
MinorVer=0  
Platform=MacPPC  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10*; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Version/5.10* OmniWeb/*]  
Parent=OmniWeb  
Version=5.10  
MajorVer=5  
MinorVer=10  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10*; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Version/5.11* OmniWeb/*]  
Parent=OmniWeb  
Version=5.11  
MajorVer=5  
MinorVer=11  
 
[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10*; *) AppleWebKit/* (KHTML, like Gecko, Safari/*) Version/5.8* OmniWeb/*]  
Parent=OmniWeb  
Version=5.8  
MajorVer=5  
MinorVer=8  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Shiira  
 
[Shiira]  
Parent=DefaultProperties  
Browser="Shiira"  
Platform=MacOSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/0.9*]  
Parent=Shiira  
Version=0.9  
MajorVer=0  
MinorVer=9  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.0*]  
Parent=Shiira  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.1*]  
Parent=Shiira  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/1.2*]  
Parent=Shiira  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/2.1*]  
Parent=Shiira  
Version=2.1  
MajorVer=2  
MinorVer=1  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Shiira/2.2*]  
Parent=Shiira  
Version=2.2  
MajorVer=2  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; K-Meleon 1.0  
 
[K-Meleon 1.0]  
Parent=DefaultProperties  
Browser="K-Meleon"  
Version=1.0  
MajorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/1.0*]  
Parent=K-Meleon 1.0  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinNT  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; K-Meleon 1.1  
 
[K-Meleon 1.1]  
Parent=DefaultProperties  
Browser="K-Meleon"  
Version=1.1  
MajorVer=1  
MinorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/1.1*]  
Parent=K-Meleon 1.1  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinNT  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; K-Meleon 1.5  
 
[K-Meleon 1.5]  
Parent=DefaultProperties  
Browser="K-Meleon"  
Version=1.5  
MajorVer=1  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* K-Meleon?1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Platform=Win7  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* K-Meleon/1.5*]  
Parent=K-Meleon 1.5  
Version=1.0  
MajorVer=1  
MinorVer=0  
Platform=WinNT  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 3.0  
 
[Konqueror 3.0]  
Parent=DefaultProperties  
Browser="Konqueror"  
Platform=Linux  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[*Konqueror/3.0*]  
Parent=Konqueror 3.0  
Version=3.0  
MajorVer=3  
MinorVer=0  
IFrames=false  
 
[*Konqueror/3.0*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=FreeBSD  
IFrames=false  
 
[*Konqueror/3.0*Linux*]  
Parent=Konqueror 3.0  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Linux  
IFrames=false  
 
[*Konqueror/3.1*]  
Parent=Konqueror 3.0  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
[*Konqueror/3.1*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.1  
MajorVer=3  
MinorVer=1  
Platform=FreeBSD  
 
[*Konqueror/3.1*Linux*]  
Parent=Konqueror 3.0  
Version=3.1  
MajorVer=3  
MinorVer=1  
 
[*Konqueror/3.2*]  
Parent=Konqueror 3.0  
Version=3.2  
MajorVer=3  
MinorVer=2  
 
[*Konqueror/3.2*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.2  
MajorVer=3  
MinorVer=2  
Platform=FreeBSD  
 
[*Konqueror/3.2*Linux*]  
Parent=Konqueror 3.0  
Version=3.2  
MajorVer=3  
MinorVer=2  
Platform=Linux  
 
[*Konqueror/3.3*]  
Parent=Konqueror 3.0  
Version=3.3  
MajorVer=3  
MinorVer=3  
 
[*Konqueror/3.3*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.3  
MajorVer=3  
MinorVer=3  
Platform=FreeBSD  
 
[*Konqueror/3.3*Linux*]  
Parent=Konqueror 3.0  
Version=3.3  
MajorVer=3  
MinorVer=3  
Platform=Linux  
 
[*Konqueror/3.3*OpenBSD*]  
Parent=Konqueror 3.0  
Version=3.3  
MajorVer=3  
MinorVer=3  
Platform=OpenBSD  
 
[*Konqueror/3.4*]  
Parent=Konqueror 3.0  
Version=3.4  
MajorVer=3  
MinorVer=4  
 
[*Konqueror/3.4*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.4  
MajorVer=3  
MinorVer=4  
Platform=FreeBSD  
 
[*Konqueror/3.4*Linux*]  
Parent=Konqueror 3.0  
Version=3.4  
MajorVer=3  
MinorVer=4  
Platform=Linux  
 
[*Konqueror/3.4*OpenBSD*]  
Parent=Konqueror 3.0  
Version=3.4  
MajorVer=3  
MinorVer=4  
Platform=OpenBSD  
 
[*Konqueror/3.5*]  
Parent=Konqueror 3.0  
Version=3.5  
MajorVer=3  
MinorVer=5  
 
[*Konqueror/3.5*FreeBSD*]  
Parent=Konqueror 3.0  
Version=3.5  
MajorVer=3  
MinorVer=5  
Platform=FreeBSD  
 
[*Konqueror/3.5*Linux*]  
Parent=Konqueror 3.0  
Version=3.5  
MajorVer=3  
MinorVer=5  
Platform=Linux  
 
[*Konqueror/3.5*OpenBSD*]  
Parent=Konqueror 3.0  
Version=3.5  
MajorVer=3  
MinorVer=5  
Platform=OpenBSD  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.0  
 
[Konqueror 4.0]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.0  
MajorVer=4  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.0*) KHTML/4.0* (like Gecko)]  
Parent=Konqueror 4.0  
 
[Mozilla/5.0 (compatible; Konqueror/4.0*; Debian) KHTML/4.0* (like Gecko)]  
Parent=Konqueror 4.0  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.0.*; *Linux) KHTML/4.0* (like Gecko)]  
Parent=Konqueror 4.0  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.0.*; FreeBSD) KHTML/4.0* (like Gecko)]  
Parent=Konqueror 4.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.0.*; NetBSD) KHTML/4.0* (like Gecko)]  
Parent=Konqueror 4.0  
Platform=NetBSD  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.1  
 
[Konqueror 4.1]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.1  
MajorVer=4  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.1*) KHTML/4.1* (like Gecko)*]  
Parent=Konqueror 4.1  
 
[Mozilla/5.0 (compatible; Konqueror/4.1*; *Linux*) KHTML/4.1* (like Gecko)*]  
Parent=Konqueror 4.1  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.1*; Debian) KHTML/4.1* (like Gecko)*]  
Parent=Konqueror 4.1  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.1*; FreeBSD) KHTML/4.1* (like Gecko)*]  
Parent=Konqueror 4.1  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.1*; NetBSD) KHTML/4.1* (like Gecko)*]  
Parent=Konqueror 4.1  
Platform=NetBSD  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.2  
 
[Konqueror 4.2]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.2  
MajorVer=4  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*) KHTML/4.2* (like Gecko)*]  
Parent=Konqueror 4.2  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*; *Linux*) KHTML/4.2* (like Gecko)*]  
Parent=Konqueror 4.2  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*; Debian) KHTML/4.2* (like Gecko)*]  
Parent=Konqueror 4.2  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*; FreeBSD) KHTML/4.2* (like Gecko)*]  
Parent=Konqueror 4.2  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*; NetBSD) KHTML/4.2* (like Gecko)*]  
Parent=Konqueror 4.2  
Platform=NetBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.2*; Windows) KHTML/4.2* (like Gecko)]  
Parent=Konqueror 4.2  
Platform=Win  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.3  
 
[Konqueror 4.3]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.3  
MajorVer=4  
MinorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*) KHTML/4.3* (like Gecko)*]  
Parent=Konqueror 4.3  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*; *Linux*) KHTML/4.3* (like Gecko)*]  
Parent=Konqueror 4.3  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*; Debian) KHTML/4.3* (like Gecko)*]  
Parent=Konqueror 4.3  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*; FreeBSD) KHTML/4.3* (like Gecko)*]  
Parent=Konqueror 4.3  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*; NetBSD) KHTML/4.3* (like Gecko)*]  
Parent=Konqueror 4.3  
Platform=NetBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.3*; Windows) KHTML/4.3* (like Gecko)]  
Parent=Konqueror 4.3  
Platform=Win  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.4  
 
[Konqueror 4.4]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.4  
MajorVer=4  
MinorVer=4  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*) KHTML/4.4* (like Gecko)*]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*; *Linux*) KHTML/4.4* (like Gecko)*]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*; Debian) KHTML/4.4* (like Gecko)*]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*; FreeBSD) KHTML/4.4* (like Gecko)*]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*; NetBSD) KHTML/4.4* (like Gecko)*]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
Platform=NetBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.4*; Windows) KHTML/4.4* (like Gecko)]  
Parent=Konqueror 4.4  
Browser="Konqueror"  
Platform=Win  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.5  
 
[Konqueror 4.5]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.5  
MajorVer=4  
MinorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*) KHTML/4.5* (like Gecko)*]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*; *Linux*) KHTML/4.5* (like Gecko)*]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*; Debian) KHTML/4.5* (like Gecko)*]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*; FreeBSD) KHTML/4.5* (like Gecko)*]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*; NetBSD) KHTML/4.5* (like Gecko)*]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
Platform=NetBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.5*; Windows) KHTML/4.5* (like Gecko)]  
Parent=Konqueror 4.5  
Browser="Konqueror"  
Platform=Win  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Konqueror 4.6  
 
[Konqueror 4.6]  
Parent=DefaultProperties  
Browser="Konqueror"  
Version=4.6  
MajorVer=4  
MinorVer=6  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*) KHTML/4.6* (like Gecko)*]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*; *Linux*) KHTML/4.6* (like Gecko)*]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
Platform=Linux  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*; Debian) KHTML/4.6* (like Gecko)*]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
Platform=Debian  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*; FreeBSD) KHTML/4.6* (like Gecko)*]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
Platform=FreeBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*; NetBSD) KHTML/4.6* (like Gecko)*]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
Platform=NetBSD  
 
[Mozilla/5.0 (compatible; Konqueror/4.6*; Windows) KHTML/4.6* (like Gecko)]  
Parent=Konqueror 4.6  
Browser="Konqueror"  
Platform=Win  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari  
 
[Safari]  
Parent=DefaultProperties  
Browser="Safari"  
Platform=MacOSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/100*]  
Parent=Safari  
Version=1.1  
MajorVer=1  
MinorVer=1  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/125*]  
Parent=Safari  
Version=1.2  
MajorVer=1  
MinorVer=2  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/312*]  
Parent=Safari  
Version=1.3  
MajorVer=1  
MinorVer=3  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/412*]  
Parent=Safari  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/416*]  
Parent=Safari  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/417*]  
Parent=Safari  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/418*]  
Parent=Safari  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/419*]  
Parent=Safari  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/52*]  
Parent=Safari  
Beta=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*) AppleWebKit/* (*) Safari/85*]  
Parent=Safari  
Version=1.0  
MajorVer=1  
MinorVer=0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 3.0  
 
[Safari 3.0]  
Parent=DefaultProperties  
Browser="Safari"  
Version=3.0  
MajorVer=3  
Platform=MacOSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.0* Safari/*]  
Parent=Safari 3.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/3.0* Safari/*]  
Parent=Safari 3.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/3.0* Safari/*]  
Parent=Safari 3.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.0* Safari/*]  
Parent=Safari 3.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) AppleWebKit/* (*) Version/3.0* Safari/*]  
Parent=Safari 3.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 3.1  
 
[Safari 3.1]  
Parent=DefaultProperties  
Browser="Safari"  
Version=3.1  
MajorVer=3  
MinorVer=1  
Platform=MacOSX  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.1* Safari/*]  
Parent=Safari 3.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/3.1* Safari/*]  
Parent=Safari 3.1  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/3.1* Safari/*]  
Parent=Safari 3.1  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.1* Safari/*]  
Parent=Safari 3.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) AppleWebKit/* (*) Version/3.1* Safari/*]  
Parent=Safari 3.1  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 3.2  
 
[Safari 3.2]  
Parent=DefaultProperties  
Browser="Safari"  
Version=3.2  
MajorVer=3  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.2* Safari/*]  
Parent=Safari 3.2  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/3.2* Safari/*]  
Parent=Safari 3.2  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/3.2* Safari/*]  
Parent=Safari 3.2  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/3.2* Safari/*]  
Parent=Safari 3.2  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) AppleWebKit/* (*) Version/3.2* Safari/*]  
Parent=Safari 3.2  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 4.0  
 
[Safari 4.0]  
Parent=DefaultProperties  
Browser="Safari"  
Version=4.0  
MajorVer=4  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (KHTML, like Gecko) Version/4*Safari/*]  
Parent=Safari 4.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1*) AppleWebKit/* (*) Version/4*Safari/*]  
Parent=Safari 4.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2*) AppleWebKit/* (*) Version/4*Safari/*]  
Parent=Safari 4.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0*) AppleWebKit/* (*) Version/4*Safari/*]  
Parent=Safari 4.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1) AppleWebKit/* (*) Version/4*Safari/*]  
Parent=Safari 4.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Safari 5.0  
 
[Safari 5.0]  
Parent=DefaultProperties  
Browser="Safari"  
Version=5.0  
MajorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (KHTML, like Gecko) Version/5*Safari/*]  
Parent=Safari 5.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) AppleWebKit/* (*) Version/5*Safari/*]  
Parent=Safari 5.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) AppleWebKit/* (*) Version/5*Safari/*]  
Parent=Safari 5.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) AppleWebKit/* (*) Version/5*Safari/*]  
Parent=Safari 5.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) AppleWebKit/* (*) Version/5*Safari/*]  
Parent=Safari 5.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lunascape 5.0  
 
[Lunascape 5.0]  
Parent=DefaultProperties  
Browser="Lunascape"  
Version=5.0  
MajorVer=5  
Platform=Win32  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT *Lunascape 5.0*)*]  
Parent=Lunascape 5.0  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *) AppleWebKit/* (KHTML, like Gecko*) Lunascape/5.0*]  
Parent=Lunascape 5.0  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *; rv:1.9.*) Gecko/* Firefox/3.* Lunascape/5.0*]  
Parent=Lunascape 5.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lunascape 5.1  
 
[Lunascape 5.1]  
Parent=DefaultProperties  
Browser="Lunascape"  
Version=5.1  
MajorVer=5  
MinorVer=1  
Platform=Win32  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT *Lunascape 5.1*)*]  
Parent=Lunascape 5.1  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *) AppleWebKit/* (KHTML, like Gecko*) Lunascape/5.1*]  
Parent=Lunascape 5.1  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *; rv:1.9.*) Gecko/* Firefox/3.* Lunascape/5.1*]  
Parent=Lunascape 5.1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Lunascape 6.0  
 
[Lunascape 6.0]  
Parent=DefaultProperties  
Browser="Lunascape"  
Version=6.0  
MajorVer=6  
Platform=Win32  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT *Lunascape 6.0*)*]  
Parent=Lunascape 6.0  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *) AppleWebKit/* (KHTML, like Gecko*) Lunascape/6.0*]  
Parent=Lunascape 6.0  
 
[Mozilla/5.0 (Windows; U; Windows NT *; *; rv:1.9.*) Gecko/* Firefox/3.* Lunascape/6.0*]  
Parent=Lunascape 6.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 10.0  
 
[Opera 10.0]  
Parent=DefaultProperties  
Browser="Opera"  
Version=10.0  
MajorVer=10  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; FreeBSD*) Opera 10.*]  
Parent=Opera 10.0  
Platform=FreeBSD  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; Linux*; *) Opera 10.*]  
Parent=Opera 10.0  
Platform=Linux  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; SunOS*) Opera 10.*]  
Parent=Opera 10.0  
Platform=SunOS  
 
[Opera/10.* (Macintosh; *Mac OS X*; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=MacOSX  
 
[Opera/10.* (Windows NT 5.0; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=Win2000  
 
[Opera/10.* (Windows NT 5.1; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=WinXP  
 
[Opera/10.* (Windows NT 5.2; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=Win2003  
 
[Opera/10.* (Windows NT 6.0; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=WinVista  
 
[Opera/10.* (Windows NT 6.1; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=Win7  
 
[Opera/10.* (X11; FreeBSD; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=FreeBSD  
 
[Opera/10.* (X11; Linux*; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=Linux  
 
[Opera/10.* (X11; SunOS; U; *) Presto/2.2.*]  
Parent=Opera 10.0  
Platform=SunOS  
 
[Opera/9.80 (Macintosh; *Mac OS X; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=MacOSX  
 
[Opera/9.80 (Windows NT 5.0; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=Win2000  
 
[Opera/9.80 (Windows NT 5.1; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=WinXP  
 
[Opera/9.80 (Windows NT 5.2; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=Win2003  
 
[Opera/9.80 (Windows NT 6.0; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=WinVista  
 
[Opera/9.80 (Windows NT 6.1; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=Win7  
 
[Opera/9.80 (X11; FreeBSD; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=FreeBSD  
 
[Opera/9.80 (X11; Linux*; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=Linux  
 
[Opera/9.80 (X11; SunOS; U; *) Presto/2.2.* Version/10.*]  
Parent=Opera 10.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 10.50  
 
[Opera 10.50]  
Parent=DefaultProperties  
Browser="Opera"  
Version=10.50  
MajorVer=10  
MinorVer=50  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; FreeBSD*) Opera 10.5*]  
Parent=Opera 10.50  
Platform=FreeBSD  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; Linux*; *) Opera 10.5*]  
Parent=Opera 10.50  
Platform=Linux  
 
[Opera/10.5* (Macintosh; *Mac OS X*; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=MacOSX  
 
[Opera/10.5* (Windows NT 5.0; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=Win2000  
 
[Opera/10.5* (Windows NT 5.1; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=WinXP  
 
[Opera/10.5* (Windows NT 5.2; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=Win2003  
 
[Opera/10.5* (Windows NT 6.0; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=WinVista  
 
[Opera/10.5* (Windows NT 6.1; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=Win7  
 
[Opera/10.5* (X11; FreeBSD; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=FreeBSD  
 
[Opera/10.5* (X11; Linux*; U; *) Presto/2.5.*]  
Parent=Opera 10.50  
Platform=Linux  
 
[Opera/9.80 (Macintosh; *Mac OS X; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=MacOSX  
 
[Opera/9.80 (Windows NT 5.0; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=Win2000  
 
[Opera/9.80 (Windows NT 5.1; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=WinXP  
 
[Opera/9.80 (Windows NT 5.2; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=Win2003  
 
[Opera/9.80 (Windows NT 6.0; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=WinVista  
 
[Opera/9.80 (Windows NT 6.1; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=Win7  
 
[Opera/9.80 (X11; FreeBSD; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=FreeBSD  
 
[Opera/9.80 (X11; Linux*; U; *) Presto/2.5.* Version/10.5*]  
Parent=Opera 10.50  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 10.60  
 
[Opera 10.60]  
Parent=DefaultProperties  
Browser="Opera"  
Version=10.60  
MajorVer=10  
MinorVer=60  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; FreeBSD*) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=FreeBSD  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; Linux*; *) Opera 10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Linux  
 
[Opera/10.6* (Macintosh; *Mac OS X*; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/10.6* (Windows NT 5.0; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2000  
 
[Opera/10.6* (Windows NT 5.1; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinXP  
 
[Opera/10.6* (Windows NT 5.2; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2003  
 
[Opera/10.6* (Windows NT 6.0; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinVista  
 
[Opera/10.6* (Windows NT 6.1; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win7  
 
[Opera/10.6* (X11; FreeBSD; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/10.6* (X11; Linux*; U; *) Presto/2.6.*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Linux  
 
[Opera/9.80 (Macintosh; *Mac OS X; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/9.80 (Windows NT 5.0; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2000  
 
[Opera/9.80 (Windows NT 5.1; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinXP  
 
[Opera/9.80 (Windows NT 5.2; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win2003  
 
[Opera/9.80 (Windows NT 6.0; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=WinVista  
 
[Opera/9.80 (Windows NT 6.1; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Win7  
 
[Opera/9.80 (X11; FreeBSD; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/9.80 (X11; Linux*; U; *) Presto/2.6.* Version/10.6*]  
Parent=Opera 10.60  
Browser="Opera"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 10.70  
 
[Opera 10.70]  
Parent=DefaultProperties  
Browser="Opera"  
Version=10.70  
MajorVer=10  
MinorVer=70  
Alpha=true  
Beta=true  
Win16=true  
Win32=true  
Win64=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
isBanned=true  
isMobileDevice=true  
isSyndicationReader=true  
Crawler=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; FreeBSD*) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=FreeBSD  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; Linux*; *) Opera 10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Linux  
 
[Opera/10.7* (Macintosh; *Mac OS X; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/10.7* (Windows NT 5.0; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2000  
 
[Opera/10.7* (Windows NT 5.1; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinXP  
 
[Opera/10.7* (Windows NT 5.2; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2003  
 
[Opera/10.7* (Windows NT 6.0; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinVista  
 
[Opera/10.7* (Windows NT 6.1; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win7  
 
[Opera/10.7* (X11; FreeBSD; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/10.7* (X11; Linux*; U; *) Presto/2.6.*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Linux  
 
[Opera/9.80 (Macintosh; *Mac OS X*; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/9.80 (Windows NT 5.0; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2000  
 
[Opera/9.80 (Windows NT 5.1; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinXP  
 
[Opera/9.80 (Windows NT 5.2; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win2003  
 
[Opera/9.80 (Windows NT 6.0; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=WinVista  
 
[Opera/9.80 (Windows NT 6.1; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Win7  
 
[Opera/9.80 (X11; FreeBSD; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/9.80 (X11; Linux*; U; *) Presto/2.6.* Version/10.7*]  
Parent=Opera 10.70  
Browser="Opera"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 11.00  
 
[Opera 11.00]  
Parent=DefaultProperties  
Browser="Opera"  
Version=11.00  
MajorVer=11  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; FreeBSD*) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=FreeBSD  
 
[Mozilla/4.0 (compatible; MSIE ?.0; X11; Linux*; *) Opera 11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Linux  
 
[Opera/11.0* (Macintosh; *Mac OS X; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/11.0* (Windows NT 5.0; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2000  
 
[Opera/11.0* (Windows NT 5.1; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinXP  
 
[Opera/11.0* (Windows NT 5.2; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2003  
 
[Opera/11.0* (Windows NT 6.0; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinVista  
 
[Opera/11.0* (Windows NT 6.1; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win7  
 
[Opera/11.0* (X11; FreeBSD; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/11.0* (X11; Linux*; U; *) Presto/2.7.*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Linux  
 
[Opera/9.80 (Macintosh; *Mac OS X*; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=MacOSX  
 
[Opera/9.80 (Windows NT 5.0; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2000  
 
[Opera/9.80 (Windows NT 5.1; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinXP  
 
[Opera/9.80 (Windows NT 5.2; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win2003  
 
[Opera/9.80 (Windows NT 6.0; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=WinVista  
 
[Opera/9.80 (Windows NT 6.1; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Win7  
 
[Opera/9.80 (X11; FreeBSD; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=FreeBSD  
 
[Opera/9.80 (X11; Linux*; U; *) Presto/2.7.* Version/11.0*]  
Parent=Opera 11.00  
Browser="Opera"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.0  
 
[Opera 7.0]  
Parent=DefaultProperties  
Browser="Opera"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/3.0 (Windows 2000; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/3.0 (Windows 95; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win95  
Win32=true  
 
[Mozilla/3.0 (Windows 98; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win98  
Win32=true  
 
[Mozilla/3.0 (Windows ME; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinME  
Win32=true  
 
[Mozilla/3.0 (Windows NT 4.0; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/3.0 (Windows XP; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 2000) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 95) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win95  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win98  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinME  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows XP) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.78 (Windows 2000; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.78 (Windows 95; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win95  
Win32=true  
 
[Mozilla/4.78 (Windows 98; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win98  
Win32=true  
 
[Mozilla/4.78 (Windows ME; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinME  
Win32=true  
 
[Mozilla/4.78 (Windows NT 4.0; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.78 (Windows NT 5.1; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.78 (Windows Windows NT 5.0; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.78 (Windows XP; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows 2000; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows 95; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows 98; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows ME; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows NT 4.0; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows NT 5.1; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows XP; ?) Opera 7.0*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Opera/7.0* (Windows 2000; ?)*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Opera/7.0* (Windows 95; ?)*]  
Parent=Opera 7.0  
Platform=Win95  
Win32=true  
 
[Opera/7.0* (Windows 98; ?)*]  
Parent=Opera 7.0  
Platform=Win98  
Win32=true  
 
[Opera/7.0* (Windows ME; ?)*]  
Parent=Opera 7.0  
Platform=WinME  
Win32=true  
 
[Opera/7.0* (Windows NT 4.0; ?)*]  
Parent=Opera 7.0  
Platform=WinNT  
Win32=true  
 
[Opera/7.0* (Windows NT 5.0; ?)*]  
Parent=Opera 7.0  
Platform=Win2000  
Win32=true  
 
[Opera/7.0* (Windows NT 5.1; ?)*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
[Opera/7.0* (Windows XP; ?)*]  
Parent=Opera 7.0  
Platform=WinXP  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.1  
 
[Opera 7.1]  
Parent=DefaultProperties  
Browser="Opera"  
Version=7.1  
MajorVer=7  
MinorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows 2000; ?) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; ?) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; ?) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; ?) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; U) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; U) Opera 7.1*]  
Parent=Opera 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.1*]  
Parent=Opera 7.1  
Platform=WinXP  
Win32=true  
 
[Opera/7.1* (Linux*; ?)*]  
Parent=Opera 7.1  
Platform=Linux  
 
[Opera/7.1* (Windows 95; ?)*]  
Parent=Opera 7.1  
Platform=Win95  
Win32=true  
 
[Opera/7.1* (Windows 98; ?)*]  
Parent=Opera 7.1  
Platform=Win98  
Win32=true  
 
[Opera/7.1* (Windows ME; ?)*]  
Parent=Opera 7.1  
Platform=WinME  
Win32=true  
 
[Opera/7.1* (Windows NT 4.0; ?)*]  
Parent=Opera 7.1  
Platform=WinNT  
Win32=true  
 
[Opera/7.1* (Windows NT 5.0; ?)*]  
Parent=Opera 7.1  
Platform=Win2000  
Win32=true  
 
[Opera/7.1* (Windows NT 5.1; ?)*]  
Parent=Opera 7.1  
Platform=WinXP  
Win32=true  
 
[Opera/7.1* (Windows XP; ?)*]  
Parent=Opera 7.1  
Platform=WinXP  
Win32=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.2  
 
[Opera 7.2]  
Parent=DefaultProperties  
Browser="Opera"  
Version=7.2  
MajorVer=7  
MinorVer=2  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows 2000; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; U) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; U) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.2*]  
Parent=Opera 7.2  
Platform=Win2003  
Win32=true  
 
[Opera/7.2* (Linux*; ?)*]  
Parent=Opera 7.2  
Platform=Linux  
 
[Opera/7.2* (Windows 95; ?)*]  
Parent=Opera 7.2  
Platform=Win95  
Win32=true  
 
[Opera/7.2* (Windows 98; ?)*]  
Parent=Opera 7.2  
Platform=Win98  
Win32=true  
 
[Opera/7.2* (Windows ME; ?)*]  
Parent=Opera 7.2  
Platform=WinME  
Win32=true  
 
[Opera/7.2* (Windows NT 4.0; ?)*]  
Parent=Opera 7.2  
Platform=WinNT  
Win32=true  
 
[Opera/7.2* (Windows NT 5.0; ?)*]  
Parent=Opera 7.2  
Platform=Win2000  
Win32=true  
 
[Opera/7.2* (Windows NT 5.1; ?)*]  
Parent=Opera 7.2  
Platform=WinXP  
Win32=true  
 
[Opera/7.2* (Windows NT 5.2; ?)*]  
Parent=Opera 7.2  
Platform=Win2003  
Win32=true  
 
[Opera/7.2* (Windows XP; ?)*]  
Parent=Opera 7.2  
Platform=WinXP  
Win32=true  
 
[Opera/7.2* (X11; FreeBSD*; ?)*]  
Parent=Opera 7.2  
Platform=FreeBSD  
 
[Opera/7.2* (X11; Linux*; ?)*]  
Parent=Opera 7.2  
Platform=Linux  
 
[Opera/7.2* (X11; SunOS*)*]  
Parent=Opera 7.2  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.5  
 
[Opera 7.5]  
Parent=DefaultProperties  
Browser="Opera"  
Version=7.5  
MajorVer=7  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 7.5*]  
Parent=Opera 7.5  
Platform=MacPPC  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Linux  
 
[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=MacOSX  
 
[Mozilla/?.* (Windows 2000; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; U) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; U) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (X11; Linux*; ?) Opera 7.5*]  
Parent=Opera 7.5  
Platform=Linux  
 
[Opera/7.5* (Linux*; ?)*]  
Parent=Opera 7.5  
Platform=Linux  
 
[Opera/7.5* (Macintosh; *Mac OS X; ?)*]  
Parent=Opera 7.5  
Platform=MacOSX  
 
[Opera/7.5* (Windows 95; ?)*]  
Parent=Opera 7.5  
Platform=Win95  
Win32=true  
 
[Opera/7.5* (Windows 98; ?)*]  
Parent=Opera 7.5  
Platform=Win98  
Win32=true  
 
[Opera/7.5* (Windows ME; ?)*]  
Parent=Opera 7.5  
Platform=WinME  
Win32=true  
 
[Opera/7.5* (Windows NT 4.0; ?)*]  
Parent=Opera 7.5  
Platform=WinNT  
Win32=true  
 
[Opera/7.5* (Windows NT 5.0; ?)*]  
Parent=Opera 7.5  
Platform=Win2000  
Win32=true  
 
[Opera/7.5* (Windows NT 5.1; ?)*]  
Parent=Opera 7.5  
Platform=WinXP  
Win32=true  
 
[Opera/7.5* (Windows NT 5.2; ?)*]  
Parent=Opera 7.5  
Platform=Win2003  
Win32=true  
 
[Opera/7.5* (Windows XP; ?)*]  
Parent=Opera 7.5  
Platform=WinXP  
Win32=true  
 
[Opera/7.5* (X11; FreeBSD*; ?)*]  
Parent=Opera 7.5  
Platform=FreeBSD  
 
[Opera/7.5* (X11; Linux*; ?)*]  
Parent=Opera 7.5  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 7.6  
 
[Opera 7.6]  
Parent=DefaultProperties  
Browser="Opera"  
Version=7.6  
MajorVer=7  
MinorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 7.6*]  
Parent=Opera 7.6  
Platform=MacPPC  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Linux  
 
[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=MacOSX  
 
[Mozilla/?.* (Windows 2000; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; U) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; U) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (X11; Linux*; ?) Opera 7.6*]  
Parent=Opera 7.6  
Platform=Linux  
 
[Opera/7.6* (Linux*)*]  
Parent=Opera 7.6  
Platform=Linux  
 
[Opera/7.6* (Macintosh; *Mac OS X; ?)*]  
Parent=Opera 7.6  
Platform=MacOSX  
 
[Opera/7.6* (Windows 95*)*]  
Parent=Opera 7.6  
Platform=Win95  
Win32=true  
 
[Opera/7.6* (Windows 98*)*]  
Parent=Opera 7.6  
Platform=Win98  
Win32=true  
 
[Opera/7.6* (Windows ME*)*]  
Parent=Opera 7.6  
Platform=WinME  
Win32=true  
 
[Opera/7.6* (Windows NT 4.0*)*]  
Parent=Opera 7.6  
Platform=WinNT  
Win32=true  
 
[Opera/7.6* (Windows NT 5.0*)*]  
Parent=Opera 7.6  
Platform=Win2000  
Win32=true  
 
[Opera/7.6* (Windows NT 5.1*)*]  
Parent=Opera 7.6  
Platform=WinXP  
Win32=true  
 
[Opera/7.6* (Windows NT 5.2*)*]  
Parent=Opera 7.6  
Platform=Win2003  
Win32=true  
 
[Opera/7.6* (Windows XP*)*]  
Parent=Opera 7.6  
Platform=WinXP  
Win32=true  
 
[Opera/7.6* (X11; FreeBSD*)*]  
Parent=Opera 7.6  
Platform=FreeBSD  
 
[Opera/7.6* (X11; Linux*)*]  
Parent=Opera 7.6  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.0  
 
[Opera 8.0]  
Parent=DefaultProperties  
Browser="Opera"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC Mac OS X; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=MacOSX  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.0*]  
Parent=Opera 8.0  
Platform=MacPPC  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinCE  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=FreeBSD  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Linux  
 
[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.0*]  
Parent=Opera 8.0  
Platform=MacOSX  
 
[Mozilla/?.* (Windows 2000; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (X11; Linux*; *) Opera 8.0*]  
Parent=Opera 8.0  
Platform=Linux  
 
[Opera/8.0* (Linux*)*]  
Parent=Opera 8.0  
Platform=Linux  
 
[Opera/8.0* (Macintosh; *Mac OS X; *)*]  
Parent=Opera 8.0  
Platform=MacOSX  
 
[Opera/8.0* (Windows 95*)*]  
Parent=Opera 8.0  
Platform=Win95  
Win32=true  
 
[Opera/8.0* (Windows 98*)*]  
Parent=Opera 8.0  
Platform=Win98  
Win32=true  
 
[Opera/8.0* (Windows CE*)*]  
Parent=Opera 8.0  
Platform=WinCE  
Win32=true  
 
[Opera/8.0* (Windows ME*)*]  
Parent=Opera 8.0  
Platform=WinME  
Win32=true  
 
[Opera/8.0* (Windows NT 4.0*)*]  
Parent=Opera 8.0  
Platform=WinNT  
Win32=true  
 
[Opera/8.0* (Windows NT 5.0*)*]  
Parent=Opera 8.0  
Platform=Win2000  
Win32=true  
 
[Opera/8.0* (Windows NT 5.1*)*]  
Parent=Opera 8.0  
Platform=WinXP  
Win32=true  
 
[Opera/8.0* (Windows NT 5.2*)*]  
Parent=Opera 8.0  
Platform=Win2003  
Win32=true  
 
[Opera/8.0* (Windows XP*)*]  
Parent=Opera 8.0  
Platform=WinXP  
Win32=true  
 
[Opera/8.0* (X11; FreeBSD*)*]  
Parent=Opera 8.0  
Platform=FreeBSD  
 
[Opera/8.0* (X11; Linux*)*]  
Parent=Opera 8.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.1  
 
[Opera 8.1]  
Parent=DefaultProperties  
Browser="Opera"  
Version=8.1  
MajorVer=8  
MinorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.1*]  
Parent=Opera 8.1  
Platform=MacPPC  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinCE  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=FreeBSD  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Linux  
 
[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.1*]  
Parent=Opera 8.1  
Platform=MacOSX  
 
[Mozilla/?.* (Windows 2000; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (X11; Linux*; *) Opera 8.1*]  
Parent=Opera 8.1  
Platform=Linux  
 
[Opera/8.1* (Linux*)*]  
Parent=Opera 8.1  
Platform=Linux  
 
[Opera/8.1* (Macintosh; *Mac OS X; *)*]  
Parent=Opera 8.1  
Platform=MacOSX  
 
[Opera/8.1* (Windows 95*)*]  
Parent=Opera 8.1  
Platform=Win95  
Win32=true  
 
[Opera/8.1* (Windows 98*)*]  
Parent=Opera 8.1  
Platform=Win98  
Win32=true  
 
[Opera/8.1* (Windows CE*)*]  
Parent=Opera 8.1  
Platform=WinCE  
Win32=true  
 
[Opera/8.1* (Windows ME*)*]  
Parent=Opera 8.1  
Platform=WinME  
Win32=true  
 
[Opera/8.1* (Windows NT 4.0*)*]  
Parent=Opera 8.1  
Platform=WinNT  
Win32=true  
 
[Opera/8.1* (Windows NT 5.0*)*]  
Parent=Opera 8.1  
Platform=Win2000  
Win32=true  
 
[Opera/8.1* (Windows NT 5.1*)*]  
Parent=Opera 8.1  
Platform=WinXP  
Win32=true  
 
[Opera/8.1* (Windows NT 5.2*)*]  
Parent=Opera 8.1  
Platform=Win2003  
Win32=true  
 
[Opera/8.1* (Windows XP*)*]  
Parent=Opera 8.1  
Platform=WinXP  
Win32=true  
 
[Opera/8.1* (X11; FreeBSD*)*]  
Parent=Opera 8.1  
Platform=FreeBSD  
 
[Opera/8.1* (X11; Linux*)*]  
Parent=Opera 8.1  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 8.5  
 
[Opera 8.5]  
Parent=DefaultProperties  
Browser="Opera"  
Version=8.5  
MajorVer=8  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Linux*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Linux  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC Mac OS X;*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=MacOSX  
 
[Mozilla/?.* (compatible; MSIE ?.*; Mac_PowerPC) Opera 8.5*]  
Parent=Opera 8.5  
Platform=MacPPC  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 2000*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 95*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows 98*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows CE) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinCE  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows ME*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 4.0*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.0*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.1*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows NT 5.2*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; Windows XP*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; FreeBSD*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=FreeBSD  
 
[Mozilla/?.* (compatible; MSIE ?.*; X11; Linux*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Linux  
 
[Mozilla/?.* (Macintosh; *Mac OS X; ?) Opera 8.5*]  
Parent=Opera 8.5  
Platform=MacOSX  
 
[Mozilla/?.* (Macintosh; PPC Mac OS X;*) Opera 8.5*]  
Parent=Opera 8.5  
Platform=MacOSX  
 
[Mozilla/?.* (Windows 2000; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows 95; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win95  
Win32=true  
 
[Mozilla/?.* (Windows 98; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win98  
Win32=true  
 
[Mozilla/?.* (Windows ME; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinME  
Win32=true  
 
[Mozilla/?.* (Windows NT 4.0; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.0; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.1; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/?.* (Windows NT 5.2; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/?.* (X11; Linux*; *) Opera 8.5*]  
Parent=Opera 8.5  
Platform=Linux  
 
[Opera/8.5* (Linux*)*]  
Parent=Opera 8.5  
Platform=Linux  
 
[Opera/8.5* (Macintosh; *Mac OS X; *)*]  
Parent=Opera 8.5  
Platform=MacOSX  
 
[Opera/8.5* (Windows 95*)*]  
Parent=Opera 8.5  
Platform=Win95  
Win32=true  
 
[Opera/8.5* (Windows 98*)*]  
Parent=Opera 8.5  
Platform=Win98  
Win32=true  
 
[Opera/8.5* (Windows CE*)*]  
Parent=Opera 8.5  
Platform=WinCE  
Win32=true  
 
[Opera/8.5* (Windows ME*)*]  
Parent=Opera 8.5  
Platform=WinME  
Win32=true  
 
[Opera/8.5* (Windows NT 4.0*)*]  
Parent=Opera 8.5  
Platform=WinNT  
Win32=true  
 
[Opera/8.5* (Windows NT 5.0*)*]  
Parent=Opera 8.5  
Platform=Win2000  
Win32=true  
 
[Opera/8.5* (Windows NT 5.1*)*]  
Parent=Opera 8.5  
Platform=WinXP  
Win32=true  
 
[Opera/8.5* (Windows NT 5.2*)*]  
Parent=Opera 8.5  
Platform=Win2003  
Win32=true  
 
[Opera/8.5* (Windows XP*)*]  
Parent=Opera 8.5  
Platform=WinXP  
Win32=true  
 
[Opera/8.5* (X11; FreeBSD*)*]  
Parent=Opera 8.5  
Platform=FreeBSD  
 
[Opera/8.5* (X11; Linux*)*]  
Parent=Opera 8.5  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.0  
 
[Opera 9.0]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.0  
MajorVer=9  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.0*]  
Parent=Opera 9.0  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.0*]  
Parent=Opera 9.0  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (X11; Linux*) Opera 9.0*]  
Parent=Opera 9.0  
Platform=Linux  
 
[Opera/9.0* (Linux*)*]  
Parent=Opera 9.0  
Platform=Linux  
 
[Opera/9.0* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.0  
Platform=MacOSX  
 
[Opera/9.0* (Windows 95*)*]  
Parent=Opera 9.0  
Platform=Win95  
Win32=true  
 
[Opera/9.0* (Windows 98*)*]  
Parent=Opera 9.0  
Platform=Win98  
Win32=true  
 
[Opera/9.0* (Windows CE*)*]  
Parent=Opera 9.0  
Platform=WinCE  
Win32=true  
 
[Opera/9.0* (Windows ME*)*]  
Parent=Opera 9.0  
Platform=WinME  
Win32=true  
 
[Opera/9.0* (Windows NT 4.0*)*]  
Parent=Opera 9.0  
Platform=WinNT  
Win32=true  
 
[Opera/9.0* (Windows NT 5.0*)*]  
Parent=Opera 9.0  
Platform=Win2000  
Win32=true  
 
[Opera/9.0* (Windows NT 5.1*)*]  
Parent=Opera 9.0  
Platform=WinXP  
Win32=true  
 
[Opera/9.0* (Windows NT 5.2*)*]  
Parent=Opera 9.0  
Platform=Win2003  
Win32=true  
 
[Opera/9.0* (Windows NT 6.0*)*]  
Parent=Opera 9.0  
Platform=WinVista  
Win32=true  
 
[Opera/9.0* (Windows XP*)*]  
Parent=Opera 9.0  
Platform=WinXP  
Win32=true  
 
[Opera/9.0* (X11; FreeBSD*)*]  
Parent=Opera 9.0  
Platform=FreeBSD  
 
[Opera/9.0* (X11; Linux*)*]  
Parent=Opera 9.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.1  
 
[Opera 9.1]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.1  
MajorVer=9  
MinorVer=1  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.1*]  
Parent=Opera 9.1  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (X11; Linux*) Opera 9.1*]  
Parent=Opera 9.1  
Platform=Linux  
 
[Opera/9.1* (Linux*)*]  
Parent=Opera 9.1  
Platform=Linux  
 
[Opera/9.1* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.1  
Platform=MacOSX  
 
[Opera/9.1* (Windows 95*)*]  
Parent=Opera 9.1  
Platform=Win95  
Win32=true  
 
[Opera/9.1* (Windows 98*)*]  
Parent=Opera 9.1  
Platform=Win98  
Win32=true  
 
[Opera/9.1* (Windows CE*)*]  
Parent=Opera 9.1  
Platform=WinCE  
Win32=true  
 
[Opera/9.1* (Windows ME*)*]  
Parent=Opera 9.1  
Platform=WinME  
Win32=true  
 
[Opera/9.1* (Windows NT 4.0*)*]  
Parent=Opera 9.1  
Platform=WinNT  
Win32=true  
 
[Opera/9.1* (Windows NT 5.0*)*]  
Parent=Opera 9.1  
Platform=Win2000  
Win32=true  
 
[Opera/9.1* (Windows NT 5.1*)*]  
Parent=Opera 9.1  
Platform=WinXP  
Win32=true  
 
[Opera/9.1* (Windows NT 5.2*)*]  
Parent=Opera 9.1  
Platform=Win2003  
Win32=true  
 
[Opera/9.1* (Windows NT 6.0*)*]  
Parent=Opera 9.1  
Platform=WinVista  
Win32=true  
 
[Opera/9.1* (Windows XP*)*]  
Parent=Opera 9.1  
Platform=WinXP  
Win32=true  
 
[Opera/9.1* (X11; FreeBSD*)*]  
Parent=Opera 9.1  
Platform=FreeBSD  
 
[Opera/9.1* (X11; Linux*)*]  
Parent=Opera 9.1  
Platform=Linux  
 
[Opera/9.1* (X11; SunOS*)*]  
Parent=Opera 9.1  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.2  
 
[Opera 9.2]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.2  
MajorVer=9  
MinorVer=2  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.2*]  
Parent=Opera 9.2  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.1*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win7  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.2*]  
Parent=Opera 9.2  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (Windows NT 6.0;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=WinVista  
 
[Mozilla/* (Windows NT 6.1;*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Win7  
 
[Mozilla/* (X11; Linux*) Opera 9.2*]  
Parent=Opera 9.2  
Platform=Linux  
 
[Opera/9.2* (Linux*)*]  
Parent=Opera 9.2  
Platform=Linux  
 
[Opera/9.2* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.2  
Platform=MacOSX  
 
[Opera/9.2* (Windows 95*)*]  
Parent=Opera 9.2  
Platform=Win95  
Win32=true  
 
[Opera/9.2* (Windows 98*)*]  
Parent=Opera 9.2  
Platform=Win98  
Win32=true  
 
[Opera/9.2* (Windows CE*)*]  
Parent=Opera 9.2  
Platform=WinCE  
Win32=true  
 
[Opera/9.2* (Windows ME*)*]  
Parent=Opera 9.2  
Platform=WinME  
Win32=true  
 
[Opera/9.2* (Windows NT 4.0*)*]  
Parent=Opera 9.2  
Platform=WinNT  
Win32=true  
 
[Opera/9.2* (Windows NT 5.0*)*]  
Parent=Opera 9.2  
Platform=Win2000  
Win32=true  
 
[Opera/9.2* (Windows NT 5.1*)*]  
Parent=Opera 9.2  
Platform=WinXP  
Win32=true  
 
[Opera/9.2* (Windows NT 5.2*)*]  
Parent=Opera 9.2  
Platform=Win2003  
Win32=true  
 
[Opera/9.2* (Windows NT 6.0*)*]  
Parent=Opera 9.2  
Platform=WinVista  
Win32=true  
 
[Opera/9.2* (Windows NT 6.1*)*]  
Parent=Opera 9.2  
Platform=Win7  
 
[Opera/9.2* (Windows XP*)*]  
Parent=Opera 9.2  
Platform=WinXP  
Win32=true  
 
[Opera/9.2* (X11; FreeBSD*)*]  
Parent=Opera 9.2  
Platform=FreeBSD  
 
[Opera/9.2* (X11; Linux*)*]  
Parent=Opera 9.2  
Platform=Linux  
 
[Opera/9.2* (X11; SunOS*)*]  
Parent=Opera 9.2  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.3  
 
[Opera 9.3]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.3  
MajorVer=9  
MinorVer=3  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.3*]  
Parent=Opera 9.3  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.1*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win7  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.3*]  
Parent=Opera 9.3  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (Windows NT 6.0;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=WinVista  
 
[Mozilla/* (Windows NT 6.1;*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Win7  
 
[Mozilla/* (X11; Linux*) Opera 9.3*]  
Parent=Opera 9.3  
Platform=Linux  
 
[Opera/9.3* (Linux*)*]  
Parent=Opera 9.3  
Platform=Linux  
 
[Opera/9.3* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.3  
Platform=MacOSX  
 
[Opera/9.3* (Windows 95*)*]  
Parent=Opera 9.3  
Platform=Win95  
Win32=true  
 
[Opera/9.3* (Windows 98*)*]  
Parent=Opera 9.3  
Platform=Win98  
Win32=true  
 
[Opera/9.3* (Windows CE*)*]  
Parent=Opera 9.3  
Platform=WinCE  
Win32=true  
 
[Opera/9.3* (Windows ME*)*]  
Parent=Opera 9.3  
Platform=WinME  
Win32=true  
 
[Opera/9.3* (Windows NT 4.0*)*]  
Parent=Opera 9.3  
Platform=WinNT  
Win32=true  
 
[Opera/9.3* (Windows NT 5.0*)*]  
Parent=Opera 9.3  
Platform=Win2000  
Win32=true  
 
[Opera/9.3* (Windows NT 5.1*)*]  
Parent=Opera 9.3  
Platform=WinXP  
Win32=true  
 
[Opera/9.3* (Windows NT 5.2*)*]  
Parent=Opera 9.3  
Platform=Win2003  
Win32=true  
 
[Opera/9.3* (Windows NT 6.0*)*]  
Parent=Opera 9.3  
Platform=WinVista  
Win32=true  
 
[Opera/9.3* (Windows NT 6.1*)*]  
Parent=Opera 9.3  
Platform=Win7  
 
[Opera/9.3* (Windows XP*)*]  
Parent=Opera 9.3  
Platform=WinXP  
Win32=true  
 
[Opera/9.3* (X11; FreeBSD*)*]  
Parent=Opera 9.3  
Platform=FreeBSD  
 
[Opera/9.3* (X11; Linux*)*]  
Parent=Opera 9.3  
Platform=Linux  
 
[Opera/9.3* (X11; SunOS*)*]  
Parent=Opera 9.3  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.4  
 
[Opera 9.4]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.4  
MajorVer=9  
MinorVer=4  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.4*]  
Parent=Opera 9.4  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.1*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win7  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.4*]  
Parent=Opera 9.4  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (Windows NT 6.0;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=WinVista  
 
[Mozilla/* (Windows NT 6.1;*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Win7  
 
[Mozilla/* (X11; Linux*) Opera 9.4*]  
Parent=Opera 9.4  
Platform=Linux  
 
[Opera/9.4* (Linux*)*]  
Parent=Opera 9.4  
Platform=Linux  
 
[Opera/9.4* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.4  
Platform=MacOSX  
 
[Opera/9.4* (Windows 95*)*]  
Parent=Opera 9.4  
Platform=Win95  
Win32=true  
 
[Opera/9.4* (Windows 98*)*]  
Parent=Opera 9.4  
Platform=Win98  
Win32=true  
 
[Opera/9.4* (Windows CE*)*]  
Parent=Opera 9.4  
Platform=WinCE  
Win32=true  
 
[Opera/9.4* (Windows ME*)*]  
Parent=Opera 9.4  
Platform=WinME  
Win32=true  
 
[Opera/9.4* (Windows NT 4.0*)*]  
Parent=Opera 9.4  
Platform=WinNT  
Win32=true  
 
[Opera/9.4* (Windows NT 5.0*)*]  
Parent=Opera 9.4  
Platform=Win2000  
Win32=true  
 
[Opera/9.4* (Windows NT 5.1*)*]  
Parent=Opera 9.4  
Platform=WinXP  
Win32=true  
 
[Opera/9.4* (Windows NT 5.2*)*]  
Parent=Opera 9.4  
Platform=Win2003  
Win32=true  
 
[Opera/9.4* (Windows NT 6.0*)*]  
Parent=Opera 9.4  
Platform=WinVista  
Win32=true  
 
[Opera/9.4* (Windows NT 6.1*)*]  
Parent=Opera 9.4  
Platform=Win7  
 
[Opera/9.4* (Windows XP*)*]  
Parent=Opera 9.4  
Platform=WinXP  
Win32=true  
 
[Opera/9.4* (X11; FreeBSD*)*]  
Parent=Opera 9.4  
Platform=FreeBSD  
 
[Opera/9.4* (X11; Linux*)*]  
Parent=Opera 9.4  
Platform=Linux  
 
[Opera/9.4* (X11; SunOS*)*]  
Parent=Opera 9.4  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.5  
 
[Opera 9.5]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.5  
MajorVer=9  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.5*]  
Parent=Opera 9.5  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.1*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win7  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.5*]  
Parent=Opera 9.5  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (Windows NT 6.0;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=WinVista  
 
[Mozilla/* (Windows NT 6.1;*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Win7  
 
[Mozilla/* (X11; Linux*) Opera 9.5*]  
Parent=Opera 9.5  
Platform=Linux  
 
[Opera/9.5* (Linux*)*]  
Parent=Opera 9.5  
Platform=Linux  
 
[Opera/9.5* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.5  
Platform=MacOSX  
 
[Opera/9.5* (Windows 95*)*]  
Parent=Opera 9.5  
Platform=Win95  
Win32=true  
 
[Opera/9.5* (Windows 98*)*]  
Parent=Opera 9.5  
Platform=Win98  
Win32=true  
 
[Opera/9.5* (Windows CE*)*]  
Parent=Opera 9.5  
Platform=WinCE  
Win32=true  
 
[Opera/9.5* (Windows ME*)*]  
Parent=Opera 9.5  
Platform=WinME  
Win32=true  
 
[Opera/9.5* (Windows NT 4.0*)*]  
Parent=Opera 9.5  
Platform=WinNT  
Win32=true  
 
[Opera/9.5* (Windows NT 5.0*)*]  
Parent=Opera 9.5  
Platform=Win2000  
Win32=true  
 
[Opera/9.5* (Windows NT 5.1*)*]  
Parent=Opera 9.5  
Platform=WinXP  
Win32=true  
 
[Opera/9.5* (Windows NT 5.2*)*]  
Parent=Opera 9.5  
Platform=Win2003  
Win32=true  
 
[Opera/9.5* (Windows NT 6.0*)*]  
Parent=Opera 9.5  
Platform=WinVista  
Win32=true  
 
[Opera/9.5* (Windows NT 6.1*)*]  
Parent=Opera 9.5  
Platform=Win7  
 
[Opera/9.5* (Windows XP*)*]  
Parent=Opera 9.5  
Platform=WinXP  
Win32=true  
 
[Opera/9.5* (X11; FreeBSD*)*]  
Parent=Opera 9.5  
Platform=FreeBSD  
 
[Opera/9.5* (X11; Linux*)*]  
Parent=Opera 9.5  
Platform=Linux  
 
[Opera/9.5* (X11; SunOS*)*]  
Parent=Opera 9.5  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opera 9.6  
 
[Opera 9.6]  
Parent=DefaultProperties  
Browser="Opera"  
Version=9.6  
MajorVer=9  
MinorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/* (compatible; MSIE*; Linux*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC Mac OS X;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=MacOSX  
 
[Mozilla/* (compatible; MSIE*; Mac_PowerPC) Opera 9.6*]  
Parent=Opera 9.6  
Platform=MacPPC  
 
[Mozilla/* (compatible; MSIE*; Windows 2000*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 95*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win95  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows 98*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win98  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows CE*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinCE  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows ME*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinME  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 4.0*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.0*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.1*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 5.2*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.0*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinVista  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; Windows NT 6.1*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win7  
 
[Mozilla/* (compatible; MSIE*; Windows XP*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (compatible; MSIE*; X11; FreeBSD*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=FreeBSD  
 
[Mozilla/* (compatible; MSIE*; X11; Linux*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Linux  
 
[Mozilla/* (compatible; MSIE*; X11; SunOS*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=SunOS  
 
[Mozilla/* (Macintosh; *Mac OS X; ?) Opera 9.6*]  
Parent=Opera 9.6  
Platform=MacOSX  
 
[Mozilla/* (Windows 2000;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows 95;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win95  
Win32=true  
 
[Mozilla/* (Windows 98;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win98  
Win32=true  
 
[Mozilla/* (Windows ME;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinME  
Win32=true  
 
[Mozilla/* (Windows NT 4.0;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinNT  
Win32=true  
 
[Mozilla/* (Windows NT 5.0;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/* (Windows NT 5.1;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/* (Windows NT 5.2;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win2003  
Win32=true  
 
[Mozilla/* (Windows NT 6.0;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=WinVista  
 
[Mozilla/* (Windows NT 6.1;*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Win7  
 
[Mozilla/* (X11; Linux*) Opera 9.6*]  
Parent=Opera 9.6  
Platform=Linux  
 
[Opera/9.6* (Linux*)*]  
Parent=Opera 9.6  
Platform=Linux  
 
[Opera/9.6* (Macintosh; *Mac OS X;*)*]  
Parent=Opera 9.6  
Platform=MacOSX  
 
[Opera/9.6* (Windows 95*)*]  
Parent=Opera 9.6  
Platform=Win95  
Win32=true  
 
[Opera/9.6* (Windows 98*)*]  
Parent=Opera 9.6  
Platform=Win98  
Win32=true  
 
[Opera/9.6* (Windows CE*)*]  
Parent=Opera 9.6  
Platform=WinCE  
Win32=true  
 
[Opera/9.6* (Windows ME*)*]  
Parent=Opera 9.6  
Platform=WinME  
Win32=true  
 
[Opera/9.6* (Windows NT 4.0*)*]  
Parent=Opera 9.6  
Platform=WinNT  
Win32=true  
 
[Opera/9.6* (Windows NT 5.0*)*]  
Parent=Opera 9.6  
Platform=Win2000  
Win32=true  
 
[Opera/9.6* (Windows NT 5.1*)*]  
Parent=Opera 9.6  
Platform=WinXP  
Win32=true  
 
[Opera/9.6* (Windows NT 5.2*)*]  
Parent=Opera 9.6  
Platform=Win2003  
Win32=true  
 
[Opera/9.6* (Windows NT 6.0*)*]  
Parent=Opera 9.6  
Platform=WinVista  
Win32=true  
 
[Opera/9.6* (Windows NT 6.1*)*]  
Parent=Opera 9.6  
Platform=Win7  
 
[Opera/9.6* (Windows XP*)*]  
Parent=Opera 9.6  
Platform=WinXP  
Win32=true  
 
[Opera/9.6* (X11; FreeBSD*)*]  
Parent=Opera 9.6  
Platform=FreeBSD  
 
[Opera/9.6* (X11; Linux*)*]  
Parent=Opera 9.6  
Platform=Linux  
 
[Opera/9.6* (X11; SunOS*)*]  
Parent=Opera 9.6  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.0  
 
[Netscape 4.0]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=4.0  
MajorVer=4  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.0*(Macintosh*]  
Parent=Netscape 4.0  
Version=4.03  
MinorVer=03  
Platform=MacPPC  
 
[Mozilla/4.0*(Win95;*]  
Parent=Netscape 4.0  
Platform=Win95  
 
[Mozilla/4.0*(Win98;*]  
Parent=Netscape 4.0  
Version=4.03  
MinorVer=03  
Platform=Win98  
 
[Mozilla/4.0*(WinNT*]  
Parent=Netscape 4.0  
Version=4.03  
MinorVer=03  
Platform=WinNT  
 
[Mozilla/4.0*(X11;*)]  
Parent=Netscape 4.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.5  
 
[Netscape 4.5]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=4.5  
MajorVer=4  
MinorVer=5  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.5*(Macintosh; ?; PPC)]  
Parent=Netscape 4.5  
Platform=MacPPC  
 
[Mozilla/4.5*(Win2000; ?)]  
Parent=Netscape 4.5  
Platform=Win2000  
 
[Mozilla/4.5*(Win95; ?)]  
Parent=Netscape 4.5  
Platform=Win95  
 
[Mozilla/4.5*(Win98; ?)]  
Parent=Netscape 4.5  
Platform=Win98  
 
[Mozilla/4.5*(WinME; ?)]  
Parent=Netscape 4.5  
Platform=WinME  
 
[Mozilla/4.5*(WinNT; ?)]  
Parent=Netscape 4.5  
Platform=WinNT  
 
[Mozilla/4.5*(WinXP; ?)]  
Parent=Netscape 4.5  
Platform=WinXP  
 
[Mozilla/4.5*(X11*)]  
Parent=Netscape 4.5  
Platform=Linux  
 
[Mozilla/4.51*(Macintosh; ?; PPC)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
 
[Mozilla/4.51*(Win2000; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=Win2000  
 
[Mozilla/4.51*(Win95; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=Win95  
 
[Mozilla/4.51*(Win98; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=Win98  
 
[Mozilla/4.51*(WinME; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=WinME  
 
[Mozilla/4.51*(WinNT; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=WinNT  
 
[Mozilla/4.51*(WinXP; ?)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=WinXP  
 
[Mozilla/4.51*(X11*)]  
Parent=Netscape 4.5  
Version=4.51  
MinorVer=51  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.6  
 
[Netscape 4.6]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=4.6  
MajorVer=4  
MinorVer=6  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.6 * (OS/2; ?)]  
Parent=Netscape 4.6  
Platform=OS/2  
 
[Mozilla/4.6*(Macintosh; ?; PPC)]  
Parent=Netscape 4.6  
Platform=MacPPC  
 
[Mozilla/4.6*(Win95; ?)]  
Parent=Netscape 4.6  
Platform=Win95  
 
[Mozilla/4.6*(Win98; ?)]  
Parent=Netscape 4.6  
Platform=Win98  
 
[Mozilla/4.6*(WinNT; ?)]  
Parent=Netscape 4.6  
Platform=WinNT  
 
[Mozilla/4.61*(Macintosh; ?; PPC)]  
Parent=Netscape 4.6  
Version=4.61  
MajorVer=4  
MinorVer=61  
Platform=MacPPC  
 
[Mozilla/4.61*(OS/2; ?)]  
Parent=Netscape 4.6  
Version=4.61  
MajorVer=4  
MinorVer=61  
Platform=OS/2  
 
[Mozilla/4.61*(Win95; ?)]  
Parent=Netscape 4.6  
Version=4.61  
MajorVer=4  
MinorVer=61  
Platform=Win95  
 
[Mozilla/4.61*(Win98; ?)]  
Parent=Netscape 4.6  
Version=4.61  
Platform=Win98  
 
[Mozilla/4.61*(WinNT; ?)]  
Parent=Netscape 4.6  
Version=4.61  
MajorVer=4  
MinorVer=61  
Platform=WinNT  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.7  
 
[Netscape 4.7]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=4.7  
MajorVer=4  
MinorVer=7  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.7 * (Win2000; ?)]  
Parent=Netscape 4.7  
Platform=Win2000  
 
[Mozilla/4.7*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=MacPPC  
 
[Mozilla/4.7*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=Win95  
 
[Mozilla/4.7*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=Win98  
 
[Mozilla/4.7*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.7*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.7*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=7  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.7*(WinNT; ?)*]  
Parent=Netscape 4.7  
Platform=WinNT  
 
[Mozilla/4.7*(X11*)*]  
Parent=Netscape 4.7  
Platform=Linux  
 
[Mozilla/4.7*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
Platform=SunOS  
 
[Mozilla/4.71*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=MacPPC  
 
[Mozilla/4.71*(Win95; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=Win95  
 
[Mozilla/4.71*(Win98; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=Win98  
 
[Mozilla/4.71*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.71*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.71*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.71*(WinNT; ?)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=WinNT  
 
[Mozilla/4.71*(X11*)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=Linux  
 
[Mozilla/4.71*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
Version=4.71  
MinorVer=71  
Platform=SunOS  
 
[Mozilla/4.72*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=MacPPC  
 
[Mozilla/4.72*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=Win95  
 
[Mozilla/4.72*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=Win98  
 
[Mozilla/4.72*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.72*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.72*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.72*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=WinNT  
 
[Mozilla/4.72*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=Linux  
 
[Mozilla/4.72*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=72  
Platform=SunOS  
 
[Mozilla/4.73*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=MacPPC  
 
[Mozilla/4.73*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=Win95  
 
[Mozilla/4.73*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=Win98  
 
[Mozilla/4.73*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.73*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.73*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.73*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=WinNT  
 
[Mozilla/4.73*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=Linux  
 
[Mozilla/4.73*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=73  
Platform=SunOS  
 
[Mozilla/4.74*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=MacPPC  
 
[Mozilla/4.74*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=Win95  
 
[Mozilla/4.74*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=Win98  
 
[Mozilla/4.74*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.74*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.74*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.74*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=WinNT  
 
[Mozilla/4.74*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=Linux  
 
[Mozilla/4.74*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=74  
Platform=SunOS  
 
[Mozilla/4.75*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=MacPPC  
 
[Mozilla/4.75*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=Win95  
 
[Mozilla/4.75*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=Win98  
 
[Mozilla/4.75*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.75*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.75*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.75*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=WinNT  
 
[Mozilla/4.75*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=Linux  
 
[Mozilla/4.75*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=75  
Platform=SunOS  
 
[Mozilla/4.76*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=MacPPC  
 
[Mozilla/4.76*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=Win95  
 
[Mozilla/4.76*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=Win98  
 
[Mozilla/4.76*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.76*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.76*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.76*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=WinNT  
 
[Mozilla/4.76*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=Linux  
 
[Mozilla/4.76*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=76  
Platform=SunOS  
 
[Mozilla/4.77*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=MacPPC  
 
[Mozilla/4.77*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=Win95  
 
[Mozilla/4.77*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=Win98  
 
[Mozilla/4.77*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.77*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.77*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.77*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=WinNT  
 
[Mozilla/4.77*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=Linux  
 
[Mozilla/4.77*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=77  
Platform=SunOS  
 
[Mozilla/4.78*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=MacPPC  
 
[Mozilla/4.78*(Win95; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=Win95  
 
[Mozilla/4.78*(Win98; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=Win98  
 
[Mozilla/4.78*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.78*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.78*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.78*(WinNT; ?)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=WinNT  
 
[Mozilla/4.78*(X11*)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=Linux  
 
[Mozilla/4.78*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
MinorVer=78  
Platform=SunOS  
 
[Mozilla/4.79*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=MacPPC  
 
[Mozilla/4.79*(Win95; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=Win95  
 
[Mozilla/4.79*(Win98; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=Win98  
 
[Mozilla/4.79*(Windows NT 4.0; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.79*(Windows NT 5.0; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.79*(Windows NT 5.1; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.79*(WinNT; ?)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=WinNT  
 
[Mozilla/4.79*(X11*)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=Linux  
 
[Mozilla/4.79*(X11; ?; SunOS*)*]  
Parent=Netscape 4.7  
Version=4.79  
MinorVer=79  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 4.8  
 
[Netscape 4.8]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=4.8  
MajorVer=4  
MinorVer=8  
Frames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/4.8*(Macintosh; ?; MacPPC)*]  
Parent=Netscape 4.8  
Platform=MacPPC  
 
[Mozilla/4.8*(Macintosh; ?; PPC Mac OS X*]  
Parent=Netscape 4.8  
Platform=MacOSX  
 
[Mozilla/4.8*(Macintosh; ?; PPC)*]  
Parent=Netscape 4.8  
Platform=MacPPC  
 
[Mozilla/4.8*(Win95; *)*]  
Parent=Netscape 4.8  
 
[Mozilla/4.8*(Win98; *)*]  
Parent=Netscape 4.8  
Platform=Win98  
 
[Mozilla/4.8*(Windows NT 4.0; *)*]  
Parent=Netscape 4.8  
Platform=WinNT  
Win32=true  
 
[Mozilla/4.8*(Windows NT 5.0; *)*]  
Parent=Netscape 4.8  
Platform=Win2000  
Win32=true  
 
[Mozilla/4.8*(Windows NT 5.1; *)*]  
Parent=Netscape 4.8  
Platform=WinXP  
Win32=true  
 
[Mozilla/4.8*(WinNT; *)*]  
Parent=Netscape 4.8  
Platform=WinNT  
 
[Mozilla/4.8*(X11; *)*]  
Parent=Netscape 4.8  
Platform=Linux  
 
[Mozilla/4.8*(X11; *SunOS*)*]  
Parent=Netscape 4.8  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.0  
 
[Netscape 6.0]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=6.0  
MajorVer=6  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.0*]  
Parent=Netscape 6.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.1  
 
[Netscape 6.1]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=6.1  
MajorVer=6  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.1*]  
Parent=Netscape 6.1  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 6.2  
 
[Netscape 6.2]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=6.2  
MajorVer=6  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X*) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape6/6.2*]  
Parent=Netscape 6.2  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.0  
 
[Netscape 7.0]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=7.0  
MajorVer=7  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win*9x 4.90; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.0*]  
Parent=Netscape 7.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.1  
 
[Netscape 7.1]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=7.1  
MajorVer=7  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/7.1]  
Parent=Netscape 7.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.1*]  
Parent=Netscape 7.1  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 7.2  
 
[Netscape 7.2]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=7.2  
MajorVer=7  
MinorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/7.2*]  
Parent=Netscape 7.2  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 8.0  
 
[Netscape 8.0]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=8.0  
MajorVer=8  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X Mach-O; *; rv:*) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC Mac OS X;*) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/8.0*]  
Parent=Netscape 8.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 8.1  
 
[Netscape 8.1]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=8.1  
MajorVer=8  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/8.1*]  
Parent=Netscape 8.1  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Netscape 9.0  
 
[Netscape 9.0]  
Parent=DefaultProperties  
Browser="Netscape"  
Version=9.0  
MajorVer=9  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=MacOSX  
 
[Mozilla/5.0 (Macintosh; ?; PPC;*) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=MacPPC  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95;*) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win9x 4.90; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 4.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win7  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.1; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT5.2; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.0; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT6.1; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; *) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*) Gecko/* Netscape*/9.0*]  
Parent=Netscape 9.0  
Browser="Netscape"  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PaleMoon 3.6  
 
[Palemoon]  
Parent=DefaultProperties  
Browser="PaleMoon"  
Version=3.6  
MajorVer=3  
MinorVer=6  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0; *; rv:1.9.*) Gecko/20100403 Firefox/3.6.* (Palemoon/3.6.*)]  
Parent=Palemoon  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9.*) Gecko/20100403 Firefox/3.6.* (Palemoon/3.6.*)]  
Parent=Palemoon  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *; rv:1.9.*) Gecko/20100403 Firefox/3.6.* (Palemoon/3.6.*)]  
Parent=Palemoon  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9.*) Gecko/20100403 Firefox/3.6.* (Palemoon/3.6.*)]  
Parent=Palemoon  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9.*) Gecko/20100403 Firefox/3.6.* (Palemoon/3.6.*)]  
Parent=Palemoon  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 1.0  
 
[SeaMonkey 1.0]  
Parent=DefaultProperties  
Browser="SeaMonkey"  
Version=1.0  
MajorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=WinME  
 
[Mozilla/5.0 (Windows; ?; Win98; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=Win98  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; FreeBSD*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; ?; Linux*; *; rv:1.8*) Gecko/20060221 SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*; *; rv:1.8*) Gecko/* SeaMonkey/1.0*]  
Parent=SeaMonkey 1.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 1.1  
 
[SeaMonkey 1.1]  
Parent=DefaultProperties  
Browser="SeaMonkey"  
Version=1.1  
MajorVer=1  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=WinME  
 
[Mozilla/5.0 (Windows; ?; Win98; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=Win98  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; FreeBSD*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; ?; Linux*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*; *; rv:1.8*) Gecko/* SeaMonkey/1.1*]  
Parent=SeaMonkey 1.1  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 2.0  
 
[SeaMonkey 2.0]  
Parent=DefaultProperties  
Browser="SeaMonkey"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=WinME  
 
[Mozilla/5.0 (Windows; ?; Win98; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=Win98  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.0; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; ?; Windows NT 6.1; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; ?; FreeBSD*; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; ?; Linux*; *; rv:1.9*) Gecko/20060221 SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; ?; SunOS*; *; rv:1.9*) Gecko/* SeaMonkey/2.0*]  
Parent=SeaMonkey 2.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SeaMonkey 2.1  
 
[SeaMonkey 2.1]  
Parent=DefaultProperties  
Browser="SeaMonkey"  
Version=2.1  
MajorVer=2  
MinorVer=1  
Beta=true  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows NT 5.1; rv:2.*) Gecko/* Firefox/4.* SeaMonkey/2.1*]  
Parent=SeaMonkey 2.1  
Platform=WinXP  
 
[Mozilla/5.0 (Windows NT 6.0; rv:2.*) Gecko/* Firefox/4.* SeaMonkey/2.1*]  
Parent=SeaMonkey 2.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows NT 6.1; rv:2.*) Gecko/* Firefox/4.* SeaMonkey/2.1*]  
Parent=SeaMonkey 2.1  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flock 1.0  
 
[Flock 1.0]  
Parent=DefaultProperties  
Browser="Flock"  
Version=1.0  
MajorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=WinME  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]  
Parent=Flock 1.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flock 2.0  
 
[Flock 2.0]  
Parent=DefaultProperties  
Browser="Flock"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; U; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=WinME  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1*; *; rv:1.*) Gecko/* Firefox/3.* Flock/2.*]  
Parent=Flock 2.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Sleipnir 2.0  
 
[Sleipnir]  
Parent=DefaultProperties  
Browser="Sleipnir"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.0*) Sleipnir/2.*]  
Parent=Sleipnir  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.1*) Sleipnir/2.*]  
Parent=Sleipnir  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 5.2*) Sleipnir/2.*]  
Parent=Sleipnir  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.0*) Sleipnir/2.*]  
Parent=Sleipnir  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE ?.0; Windows NT 6.1*) Sleipnir/2.*]  
Parent=Sleipnir  
Platform=Win7  
 
[Sleipnir*]  
Parent=Sleipnir  
 
[Sleipnir/2.*]  
Parent=Sleipnir  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Fennec 1.0  
 
[Fennec 1.0]  
Parent=DefaultProperties  
Browser="Firefox Mobile"  
Version=1.0  
MajorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9*) Gecko/* Fennec/1.0*]  
Parent=Fennec 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9*) Gecko/* Fennec/1.0*]  
Parent=Fennec 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9*) Gecko/* Fennec/1.0*]  
Parent=Fennec 1.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Fennec 1.1  
 
[Fennec 1.1]  
Parent=DefaultProperties  
Browser="Fennec"  
Version=1.1  
MajorVer=1  
MinorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9*) Gecko/* Fennec/1.1*]  
Parent=Fennec 1.1  
Browser="Fennec"  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9*) Gecko/* Fennec/1.1*]  
Parent=Fennec 1.1  
Browser="Fennec"  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9*) Gecko/* Fennec/1.1*]  
Parent=Fennec 1.1  
Browser="Fennec"  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.0  
 
[Firefox 1.0]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=1.0  
MajorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=MacPPC  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=MacOSX  
 
[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=OS/2  
 
[Mozilla/5.0 (Windows; *; Win 9x 4.90*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; *Linux*; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; DragonFly*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.0*]  
Parent=Firefox 1.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.4  
 
[Firefox 1.4]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=1.4  
MajorVer=1  
MinorVer=4  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Linux  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=MacOSX  
 
[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=OS/2  
 
[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win95*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.4*]  
Parent=Firefox 1.4  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 1.5  
 
[Firefox 1.5]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=1.5  
MajorVer=1  
MinorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Linux  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=MacOSX  
 
[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=OS/2  
 
[Mozilla/5.0 (rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
 
[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2 x64; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.*) Gecko/* Firefox/1.5*]  
Parent=Firefox 1.5  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 2.0  
 
[Firefox 2.0]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (Linux; *; PPC*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Linux  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=MacOSX  
 
[Mozilla/5.0 (OS/2; *; Warp*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=OS/2  
 
[Mozilla/5.0 (Windows; *; Win 9x 4.90; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win95; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Win98; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Win7  
 
[Mozilla/5.0 (Windows; *; WinNT4.0; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.8*) Gecko/* Firefox/2.0*]  
Parent=Firefox 2.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.0  
 
[Firefox 3.0]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=3.0  
MajorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Win7  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Win2003  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1 x64; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9*) Gecko/* Firefox/3.0*]  
Parent=Firefox 3.0  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.1  
 
[Firefox 3.1]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=3.1  
MajorVer=3  
MinorVer=1  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Win7  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Win2003  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1 x64; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Win7  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9*) Gecko/* Firefox/3.1*]  
Parent=Firefox 3.1  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.5  
 
[Firefox 3.5]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=3.5  
MajorVer=3  
MinorVer=5  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Win7  
Win32=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Win2003  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=WinVista  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1 x64; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Win7  
Win64=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9.*) Gecko/* Firefox/3.5*]  
Parent=Firefox 3.5  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.6  
 
[Firefox 3.6]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=3.6  
MajorVer=3  
MinorVer=6  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Win7  
Win32=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=WinXP  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Win2003  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=WinVista  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1 x64; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Win7  
Win64=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9.2*) Gecko/* Firefox/3.6*]  
Parent=Firefox 3.6  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 3.7  
 
[Firefox 3.7]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=3.7  
MajorVer=3  
MinorVer=7  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (Macintosh; *; *Mac OS X*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.0; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.1; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 5.2; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.0; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (Windows; *; Windows NT 6.1; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Win7  
Win32=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1 x64; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=WinXP  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2 x64; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Win2003  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=WinVista  
Win64=true  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1 x64; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Win7  
Win64=true  
 
[Mozilla/5.0 (X11; *; *Linux*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=Linux  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:1.9.3) Gecko/* Minefield/3.7*]  
Parent=Firefox 3.7  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Firefox 4.0  
 
[Firefox 4.0]  
Parent=DefaultProperties  
Browser="Firefox"  
Version=4.0  
MajorVer=4  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (*Windows NT 5.0*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (*Windows NT 5.1*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (*Windows NT 5.1*WOW64*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=WinXP  
Win64=true  
 
[Mozilla/5.0 (*Windows NT 5.2*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (*Windows NT 5.2*WOW64*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Win2003  
Win64=true  
 
[Mozilla/5.0 (*Windows NT 6.0*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=WinVista  
Win32=true  
 
[Mozilla/5.0 (*Windows NT 6.0*WOW64*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=WinVista  
Win64=true  
 
[Mozilla/5.0 (*Windows NT 6.1 WOW64*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Win7  
Win64=true  
 
[Mozilla/5.0 (*Windows NT 6.1*rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Win7  
Win32=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X*; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=MacOSX  
 
[Mozilla/5.0 (X11; *; FreeBSD*; *; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *; HP-UX*; *; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=HP-UX  
 
[Mozilla/5.0 (X11; *; IRIX64*; *; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=IRIX64  
 
[Mozilla/5.0 (X11; *; OpenBSD*; *; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *; SunOS*; *; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=SunOS  
 
[Mozilla/5.0 (X11; *Linux*; rv:2.0*) Gecko/* Firefox/4.0*]  
Parent=Firefox 4.0  
Browser="Firefox"  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Thunderbird 1.0  
 
[Thunderbird 1.0]  
Parent=DefaultProperties  
Browser="Thunderbird"  
Version=1.0  
MajorVer=1  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X; U; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *; rv:1.9.*) Gecko/* Thunderbird/1.*]  
Parent=Thunderbird 1.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Thunderbird 2.0  
 
[Thunderbird 2.0]  
Parent=DefaultProperties  
Browser="Thunderbird"  
Version=2.0  
MajorVer=2  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X; U; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *; rv:1.9.*) Gecko/* Thunderbird/2.*]  
Parent=Thunderbird 2.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Thunderbird 3.0  
 
[Thunderbird 3.0]  
Parent=DefaultProperties  
Browser="Thunderbird"  
Version=3.0  
MajorVer=3  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
 
[Mozilla/5.0 (Macintosh; *Mac OS X; U; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.0; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=Win2000  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.1; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=WinXP  
 
[Mozilla/5.0 (Windows; U; Windows NT 5.2; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=Win2003  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.0; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=WinVista  
 
[Mozilla/5.0 (Windows; U; Windows NT 6.1; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=Win7  
 
[Mozilla/5.0 (X11; U; Linux i686*; *; rv:1.9.*) Gecko/* Thunderbird/3.*]  
Parent=Thunderbird 3.0  
Platform=Linux  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Iceweasel  
 
[Iceweasel]  
Parent=DefaultProperties  
Browser="Iceweasel"  
Platform=Debian  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.8.*) Gecko/* Iceweasel/2.0* (Debian-*)*]  
Parent=Iceweasel  
Version=2.0  
MajorVer=2  
MinorVer=0  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.9.*) Gecko/* Iceweasel/3.0* (Debian-*)*]  
Parent=Iceweasel  
Version=3.0  
MajorVer=3  
MinorVer=0  
Platform=Debian  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (X11; U; Linux*; *; rv:1.9.*) Gecko/* Iceweasel/3.5* (Debian-*)]  
Parent=Iceweasel  
Version=3.5  
MajorVer=3  
MinorVer=5  
 
[Mozilla/5.0 (X11; U; Linux; *; rv:1.9.*) Gecko/* Iceweasel/3.6* (like Firefox/3.6)*]  
Parent=Iceweasel  
Version=3.6  
MajorVer=3  
MinorVer=6  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.0  
 
[Mozilla 1.0]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.0  
MajorVer=1  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.0.*) Gecko/*]  
Parent=Mozilla 1.0  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.1  
 
[Mozilla 1.1]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.1  
MajorVer=1  
MinorVer=1  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.1.*) Gecko/*]  
Parent=Mozilla 1.1  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.2  
 
[Mozilla 1.2]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.2  
MajorVer=1  
MinorVer=2  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.2.*) Gecko/*]  
Parent=Mozilla 1.2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.3  
 
[Mozilla 1.3]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.3  
MajorVer=1  
MinorVer=3  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.3.*) Gecko/*]  
Parent=Mozilla 1.3  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.4  
 
[Mozilla 1.4]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.4  
MajorVer=1  
MinorVer=4  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Win31  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.4*) Gecko/*]  
Parent=Mozilla 1.4  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.5  
 
[Mozilla 1.5]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.5  
MajorVer=1  
MinorVer=5  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Win31  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.5*) Gecko/*]  
Parent=Mozilla 1.5  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.6  
 
[Mozilla 1.6]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.6  
MajorVer=1  
MinorVer=6  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Win31  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.6*) Gecko/*]  
Parent=Mozilla 1.6  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.7  
 
[Mozilla 1.7]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.7  
MajorVer=1  
MinorVer=7  
Beta=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win31  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.7*) Gecko/*]  
Parent=Mozilla 1.7  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.8  
 
[Mozilla 1.8]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.8  
MajorVer=1  
MinorVer=8  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.8*) Gecko/*]  
Parent=Mozilla 1.8  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mozilla 1.9  
 
[Mozilla 1.9]  
Parent=DefaultProperties  
Browser="Mozilla"  
Version=1.9  
MajorVer=1  
MinorVer=9  
Alpha=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
JavaApplets=true  
JavaScript=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/5.0 (*rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
 
[Mozilla/5.0 (Macintosh; ?; *Mac OS X*; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=MacOSX  
 
[Mozilla/5.0 (Windows; ?; Win 9x 4.90; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=WinME  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.1; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win3.11; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Win31  
Win16=true  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win95; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Win95  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Win98; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Win98  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.0; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Win2000  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=WinXP  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; Windows NT 5.2; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Win2003  
Win32=true  
 
[Mozilla/5.0 (Windows; ?; WinNT4.0; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=WinNT  
Win32=true  
 
[Mozilla/5.0 (X11; *FreeBSD*; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=FreeBSD  
 
[Mozilla/5.0 (X11; *Linux*; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=Linux  
 
[Mozilla/5.0 (X11; *OpenBSD*; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=OpenBSD  
 
[Mozilla/5.0 (X11; *SunOS*; *rv:1.9*) Gecko/*]  
Parent=Mozilla 1.9  
Platform=SunOS  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE Mac  
 
[IE Mac]  
Parent=DefaultProperties  
Browser="IE"  
Platform=MacPPC  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
JavaApplets=true  
JavaScript=true  
CssVersion=1  
supportsCSS=true  
 
[Mozilla/?.? (compatible; MSIE 4.0*; *Mac_PowerPC*]  
Parent=IE Mac  
Version=4.0  
MajorVer=4  
MinorVer=0  
 
[Mozilla/?.? (compatible; MSIE 4.5*; *Mac_PowerPC*]  
Parent=IE Mac  
Version=4.5  
MajorVer=4  
MinorVer=5  
 
[Mozilla/?.? (compatible; MSIE 5.0*; *Mac_PowerPC*]  
Parent=IE Mac  
Version=5.0  
MajorVer=5  
MinorVer=0  
 
[Mozilla/?.? (compatible; MSIE 5.1*; *Mac_PowerPC*]  
Parent=IE Mac  
Version=5.1  
MajorVer=5  
MinorVer=1  
 
[Mozilla/?.? (compatible; MSIE 5.2*; *Mac_PowerPC*]  
Parent=IE Mac  
Version=5.2  
MajorVer=5  
MinorVer=2  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 5.5  
 
[AOL 9.0/IE 5.5]  
Parent=DefaultProperties  
Browser="AOL"  
Version=5.5  
MajorVer=5  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.0  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Win 9x 4.90*]  
Parent=AOL 9.0/IE 5.5  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows 95*]  
Parent=AOL 9.0/IE 5.5  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows 98*]  
Parent=AOL 9.0/IE 5.5  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.0/IE 5.5  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows NT 4.0*]  
Parent=AOL 9.0/IE 5.5  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows NT 5.0*]  
Parent=AOL 9.0/IE 5.5  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows NT 5.1*]  
Parent=AOL 9.0/IE 5.5  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows NT 5.2*]  
Parent=AOL 9.0/IE 5.5  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *AOL 9.0*; *Windows NT 6.0*]  
Parent=AOL 9.0/IE 5.5  
Platform=WinVista  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 6.0  
 
[AOL 9.0/IE 6.0]  
Parent=DefaultProperties  
Browser="AOL"  
Version=6.0  
MajorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Win 9x 4.90*]  
Parent=AOL 9.0/IE 6.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows 95*]  
Parent=AOL 9.0/IE 6.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows 98*]  
Parent=AOL 9.0/IE 6.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.0/IE 6.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 4.0*]  
Parent=AOL 9.0/IE 6.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 5.0*]  
Parent=AOL 9.0/IE 6.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 5.1*]  
Parent=AOL 9.0/IE 6.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 5.2*]  
Parent=AOL 9.0/IE 6.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 6.0*]  
Parent=AOL 9.0/IE 6.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *AOL 9.0*; *Windows NT 6.1*]  
Parent=AOL 9.0/IE 6.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 7.0  
 
[AOL 9.0/IE 7.0]  
Parent=DefaultProperties  
Browser="AOL"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.0  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Win 9x 4.90*]  
Parent=AOL 9.0/IE 7.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows 95*]  
Parent=AOL 9.0/IE 7.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows 98*]  
Parent=AOL 9.0/IE 7.0  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.0/IE 7.0  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 4.0*]  
Parent=AOL 9.0/IE 7.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 5.0*]  
Parent=AOL 9.0/IE 7.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 5.1*]  
Parent=AOL 9.0/IE 7.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 5.2*]  
Parent=AOL 9.0/IE 7.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 6.0*]  
Parent=AOL 9.0/IE 7.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.0*; *Windows NT 6.1*]  
Parent=AOL 9.0/IE 7.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.0/IE 8.0  
 
[AOL 9.0/IE 8.0]  
Parent=DefaultProperties  
Browser="AOL"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.0  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Win 9x 4.90*]  
Parent=AOL 9.0/IE 8.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows 95*]  
Parent=AOL 9.0/IE 8.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows 98*]  
Parent=AOL 9.0/IE 8.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.0/IE 8.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 4.0*]  
Parent=AOL 9.0/IE 8.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 5.0*]  
Parent=AOL 9.0/IE 8.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 5.1*]  
Parent=AOL 9.0/IE 8.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 5.2*]  
Parent=AOL 9.0/IE 8.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 6.0*]  
Parent=AOL 9.0/IE 8.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.0*; *Windows NT 6.1*]  
Parent=AOL 9.0/IE 8.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.1/IE 7.0  
 
[AOL 9.1/IE 7.0]  
Parent=DefaultProperties  
Browser="AOL"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.1  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Win 9x 4.90*]  
Parent=AOL 9.1/IE 7.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows 95*]  
Parent=AOL 9.1/IE 7.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows 98*]  
Parent=AOL 9.1/IE 7.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.1/IE 7.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 4.0*]  
Parent=AOL 9.1/IE 7.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 5.0*]  
Parent=AOL 9.1/IE 7.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 5.1*]  
Parent=AOL 9.1/IE 7.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 5.2*]  
Parent=AOL 9.1/IE 7.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 6.0*]  
Parent=AOL 9.1/IE 7.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *AOL 9.1*; *Windows NT 6.1*]  
Parent=AOL 9.1/IE 7.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.1/IE 8.0  
 
[AOL 9.1/IE 8.0]  
Parent=DefaultProperties  
Browser="AOL"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
AOL=true  
aolVersion=9.1  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Win 9x 4.90*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows 95*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows 98*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows 98; Win 9x 4.90*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 4.0*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 5.0*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 5.1*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 5.2*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 6.0*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 8.0; *AOL 9.1*; *Windows NT 6.1*]  
Parent=AOL 9.1/IE 8.0  
Browser="AOL"  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AOL 9.5  
 
[AOL 9.5]  
Parent=DefaultProperties  
Browser="AOL"  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=3  
supportsCSS=true  
AOL=true  
aolVersion=9.5  
 
[Mozilla/4.0 (compatible; MSIE 8.0; AOL 9.5; AOLBuild*; Windows NT 5.1; Trident/4.0;*)]  
Parent=AOL 9.5  
Browser="IE"  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 8.0; AOL 9.5; AOLBuild*; Windows NT 6.0; Trident/4.0;*)]  
Parent=AOL 9.5  
Browser="IE"  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 8.0; AOL 9.5; AOLBuild*; Windows NT 6.1; Trident/4.0;*)]  
Parent=AOL 9.5  
Browser="IE"  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Avant Browser  
 
[Avant Browser]  
Parent=DefaultProperties  
Browser="Avant Browser"  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Advanced Browser (http://www.avantbrowser.com)]  
Parent=Avant Browser  
 
[Avant Browser*]  
Parent=Avant Browser  
 
[Avant Browser/*]  
Parent=Avant Browser  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 4.01  
 
[IE 4.01]  
Parent=DefaultProperties  
Browser="IE"  
Version=4.01  
MajorVer=4  
MinorVer=01  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 4.01*)*]  
Parent=IE 4.01  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows 95*)*]  
Parent=IE 4.01  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows 98*)*]  
Parent=IE 4.01  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows 98; Win 9x 4.90;*)*]  
Parent=IE 4.01  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 4.0*)*]  
Parent=IE 4.01  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 5.0*)*]  
Parent=IE 4.01  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 4.01; *Windows NT 5.01*)*]  
Parent=IE 4.01  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)]  
Parent=IE 4.01  
Platform=WinNT  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.0  
 
[IE 5.0]  
Parent=DefaultProperties  
Browser="IE"  
Version=5.0  
MajorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 5.0*)*]  
Parent=IE 5.0  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 95*)*]  
Parent=IE 5.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 98*)*]  
Parent=IE 5.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows 98; Win 9x 4.90;*)*]  
Parent=IE 5.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 4.0*)*]  
Parent=IE 5.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 5.0*)*]  
Parent=IE 5.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 5.0; *Windows NT 5.01*)*]  
Parent=IE 5.0  
Platform=Win2000  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.01  
 
[IE 5.01]  
Parent=DefaultProperties  
Browser="IE"  
Version=5.01  
MajorVer=5  
MinorVer=01  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 5.01*)*]  
Parent=IE 5.01  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 95*)*]  
Parent=IE 5.01  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 98*)*]  
Parent=IE 5.01  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows 98; Win 9x 4.90;*)*]  
Parent=IE 5.01  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 4.0*)*]  
Parent=IE 5.01  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 5.0*)*]  
Parent=IE 5.01  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 5.01; *Windows NT 5.01*)*]  
Parent=IE 5.01  
Platform=Win2000  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 5.5  
 
[IE 5.5]  
Parent=DefaultProperties  
Browser="IE"  
Version=5.5  
MajorVer=5  
MinorVer=5  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 5.5*)*]  
Parent=IE 5.5  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 95*)*]  
Parent=IE 5.5  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 98*)*]  
Parent=IE 5.5  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows 98; Win 9x 4.90*)*]  
Parent=IE 5.5  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 4.0*)*]  
Parent=IE 5.5  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.0*)*]  
Parent=IE 5.5  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.01*)*]  
Parent=IE 5.5  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.1*)*]  
Parent=IE 5.5  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 5.5; *Windows NT 5.2*)*]  
Parent=IE 5.5  
Platform=Win2003  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 6.0  
 
[IE 6.0]  
Parent=DefaultProperties  
Browser="IE"  
Version=6.0  
MajorVer=6  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 6.0*)*]  
Parent=IE 6.0  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 95*)*]  
Parent=IE 6.0  
Platform=Win95  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 98*)*]  
Parent=IE 6.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows 98; Win 9x 4.90*)*]  
Parent=IE 6.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 4.0*)*]  
Parent=IE 6.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.0*)*]  
Parent=IE 6.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.01*)*]  
Parent=IE 6.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.1*)*]  
Parent=IE 6.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2*)*]  
Parent=IE 6.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2;*Win64;*)*]  
Parent=IE 6.0  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 5.2;*WOW64;*)*]  
Parent=IE 6.0  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 6.0; *Windows NT 6.0*)*]  
Parent=IE 6.0  
Platform=WinVista  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 7.0  
 
[IE 7.0]  
Parent=DefaultProperties  
Browser="IE"  
Version=7.0  
MajorVer=7  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=2  
supportsCSS=true  
 
[Mozilla/?.* (?compatible; *MSIE 7.0*)*]  
Parent=IE 7.0  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows 98*)*]  
Parent=IE 7.0  
Platform=Win98  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows 98; Win 9x 4.90;*)*]  
Parent=IE 7.0  
Platform=WinME  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 4.0*)*]  
Parent=IE 7.0  
Platform=WinNT  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.0*)*]  
Parent=IE 7.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.01*)*]  
Parent=IE 7.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.1*)*]  
Parent=IE 7.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2*)*]  
Parent=IE 7.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2;*Win64;*)*]  
Parent=IE 7.0  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2;*WOW64; Trident/4.0*)*]  
Parent=IE 7.0  
Platform=Win2003  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2;*WOW64;*)*]  
Parent=IE 7.0  
Platform=WinXP  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 6.0*)*]  
Parent=IE 7.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 6.1*)*]  
Parent=IE 7.0  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0*)*]  
Parent=IE 7.0  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.0*)*]  
Parent=IE 7.0  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0*)*]  
Parent=IE 7.0  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; *)*]  
Parent=IE 7.0  
Version=8.0  
MajorVer=8  
MinorVer=0  
Platform=Win7  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 8.0  
 
[IE 8.0]  
Parent=DefaultProperties  
Browser="IE"  
Version=8.0  
MajorVer=8  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Win32*)*]  
Parent=IE 8.0  
Platform=Win32  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.0*)*]  
Parent=IE 8.0  
Platform=Win2000  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1*)*]  
Parent=IE 8.0  
Platform=WinXP  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2*)*]  
Parent=IE 8.0  
Platform=Win2003  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0*)*]  
Parent=IE 8.0  
Platform=WinVista  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=WinVista  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=WinVista  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1*)*]  
Parent=IE 8.0  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=Win7  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=Win7  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=Win7  
Win32=false  
Win64=true  
 
[Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 7.0; Trident/4.0*)*]  
Parent=IE 8.0  
Platform=Win7  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IE 9.0  
 
[IE 9.0]  
Parent=DefaultProperties  
Browser="IE"  
Version=9.0  
MajorVer=9  
Beta=true  
Win32=true  
Frames=true  
IFrames=true  
Tables=true  
Cookies=true  
BackgroundSounds=true  
CDF=true  
VBScript=true  
JavaApplets=true  
JavaScript=true  
ActiveXControls=true  
CssVersion=3  
supportsCSS=true  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.2; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=Win2003  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=WinVista  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Win64; x64; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=WinVista  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; WOW64; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=WinVista  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=Win7  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=Win7  
Win32=false  
Win64=true  
 
[Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)*]  
Parent=IE 9.0  
Browser="IE"  
Platform=Win7  
Win32=false  
Win64=true  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Default Browser  
 
[*]  
Browser="Default Browser"  
Version=0  
MajorVer=0  
MinorVer=0  
Platform=unknown  
Alpha=false  
Beta=false  
Win16=false  
Win32=false  
Win64=false  
Frames=true  
IFrames=false  
Tables=true  
Cookies=false  
BackgroundSounds=false  
CDF=false  
VBScript=false  
JavaApplets=false  
JavaScript=false  
ActiveXControls=false  
isBanned=false  
isMobileDevice=false  
isSyndicationReader=false  
Crawler=false  
CssVersion=0  
supportsCSS=false  
AOL=false  
aolVersion=0  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Action Event Fact Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_action_fact extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('action_fact');  
 
$id = new owa_dbColumn('id', OWA_DTD_BIGINT);  
$id->setPrimaryKey();  
$this->setProperty($id);  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
// wrong data type  
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_BIGINT);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$host_id = new owa_dbColumn('host_id', OWA_DTD_BIGINT);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
// wrong data type  
$os_id = new owa_dbColumn('os_id', OWA_DTD_BIGINT);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
 
$timestamp = new owa_dbColumn('timestamp', OWA_DTD_INT);  
$this->setProperty($timestamp);  
 
$yyyymmdd = new owa_dbColumn('yyyymmdd', OWA_DTD_INT);  
$this->setProperty($yyyymmdd);  
 
$action_name = new owa_dbColumn('action_name', OWA_DTD_VARCHAR255);  
$this->setProperty($action_name);  
 
$action_label = new owa_dbColumn('action_label', OWA_DTD_VARCHAR255);  
$this->setProperty($action_label);  
 
$action_group = new owa_dbColumn('action_group', OWA_DTD_VARCHAR255);  
$this->setProperty($action_group);  
 
$numeric_value = new owa_dbColumn('numeric_value', OWA_DTD_INT);  
$this->setProperty($numeric_value);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ad Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_ad_dim extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('ad_dim');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['name'] = new owa_dbColumn;  
$this->properties['name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['type'] = new owa_dbColumn;  
$this->properties['type']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Campaign Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_campaign_dim extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('campaign_dim');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['name'] = new owa_dbColumn;  
$this->properties['name']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Click Request Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_click extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('click');  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['last_impression_id'] = new owa_dbColumn;  
$this->properties['last_impression_id']->setDataType(OWA_DTD_BIGINT);  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$this->properties['target_id'] = new owa_dbColumn;  
$this->properties['target_id']->setDataType(OWA_DTD_BIGINT);  
 
$this->properties['target_url'] = new owa_dbColumn;  
$this->properties['target_url']->setDataType(OWA_DTD_BIGINT);  
$this->properties['timestamp'] = new owa_dbColumn;  
$this->properties['timestamp']->setDataType(OWA_DTD_INT);  
$this->properties['year'] = new owa_dbColumn;  
$this->properties['year']->setDataType(OWA_DTD_INT);  
$this->properties['month'] = new owa_dbColumn;  
$this->properties['month']->setDataType(OWA_DTD_INT);  
$this->properties['day'] = new owa_dbColumn;  
$this->properties['day']->setDataType(OWA_DTD_INT);  
$this->properties['dayofyear'] = new owa_dbColumn;  
$this->properties['dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['weekofyear'] = new owa_dbColumn;  
$this->properties['weekofyear']->setDataType(OWA_DTD_INT);  
$this->properties['hour'] = new owa_dbColumn;  
$this->properties['hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['minute'] = new owa_dbColumn;  
$this->properties['minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['second'] = new owa_dbColumn;  
$this->properties['second']->setDataType(OWA_DTD_INT);  
$this->properties['msec'] = new owa_dbColumn;  
$this->properties['msec']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['click_x'] = new owa_dbColumn;  
$this->properties['click_x']->setDataType(OWA_DTD_INT);  
$this->properties['click_y'] = new owa_dbColumn;  
$this->properties['click_y']->setDataType(OWA_DTD_INT);  
$this->properties['page_width'] = new owa_dbColumn;  
$this->properties['page_width']->setDataType(OWA_DTD_INT);  
$this->properties['page_height'] = new owa_dbColumn;  
$this->properties['page_height']->setDataType(OWA_DTD_INT);  
$this->properties['position'] = new owa_dbColumn;  
$this->properties['position']->setDataType(OWA_DTD_INT);  
$this->properties['approx_position'] = new owa_dbColumn;  
$this->properties['approx_position']->setDataType(OWA_DTD_BIGINT);  
$this->properties['dom_element_x'] = new owa_dbColumn;  
$this->properties['dom_element_x']->setDataType(OWA_DTD_INT);  
$this->properties['dom_element_y'] = new owa_dbColumn;  
$this->properties['dom_element_y']->setDataType(OWA_DTD_INT);  
$this->properties['dom_element_name'] = new owa_dbColumn;  
$this->properties['dom_element_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_id'] = new owa_dbColumn;  
$this->properties['dom_element_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_value'] = new owa_dbColumn;  
$this->properties['dom_element_value']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_tag'] = new owa_dbColumn;  
$this->properties['dom_element_tag']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_text'] = new owa_dbColumn;  
$this->properties['dom_element_text']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_class'] = new owa_dbColumn;  
$this->properties['dom_element_class']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['dom_element_parent_id'] = new owa_dbColumn;  
$this->properties['dom_element_parent_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['tag_id'] = new owa_dbColumn;  
$this->properties['tag_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['placement_id'] = new owa_dbColumn;  
$this->properties['placement_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['campaign_id'] = new owa_dbColumn;  
$this->properties['campaign_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['ad_group_id'] = new owa_dbColumn;  
$this->properties['ad_group_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['ad_id'] = new owa_dbColumn;  
$this->properties['ad_id']->setDataType(OWA_DTD_BIGINT);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_BIGINT);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$this->properties['ip_address'] = new owa_dbColumn;  
$this->properties['ip_address']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['host'] = new owa_dbColumn;  
$this->properties['host']->setDataType(OWA_DTD_VARCHAR255);  
 
//wrong data type  
$host_id = new owa_dbColumn('host_id', OWA_DTD_VARCHAR255);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
$yyyymmdd = new owa_dbColumn;  
$yyyymmdd->setName('yyyymmdd');  
$yyyymmdd->setDataType(OWA_DTD_INT);  
$yyyymmdd->setIndex();  
$this->setProperty($yyyymmdd);  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Commerce Transaction Line Item Fact Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_commerce_line_item_fact extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('commerce_line_item_fact');  
 
$id = new owa_dbColumn('id', OWA_DTD_BIGINT);  
$id->setPrimaryKey();  
$this->setProperty($id);  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_BIGINT);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$host_id = new owa_dbColumn('host_id', OWA_DTD_BIGINT);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
$os_id = new owa_dbColumn('os_id', OWA_DTD_BIGINT);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
 
$location_id = new owa_dbColumn('location_id', OWA_DTD_BIGINT);  
$location_id->setForeignKey('base.location_dim');  
$this->setProperty($location_id);  
 
$medium = new owa_dbColumn('medium',OWA_DTD_VARCHAR255);  
$this->setProperty($medium);  
 
$source_id = new owa_dbColumn('source_id', OWA_DTD_BIGINT);  
$source_id->setForeignKey('base.source_dim');  
$this->setProperty($source_id);  
 
$ad_id = new owa_dbColumn('ad_id', OWA_DTD_BIGINT);  
$ad_id->setForeignKey('base.ad_dim');  
$this->setProperty($ad_id);  
 
$campaign_id = new owa_dbColumn('campaign_id', OWA_DTD_BIGINT);  
$campaign_id->setForeignKey('base.campaign_dim');  
$this->setProperty($campaign_id);  
 
$referring_search_term_id = new owa_dbColumn('referring_search_term_id', OWA_DTD_BIGINT);  
$referring_search_term_id->setForeignKey('base.search_term_dim');  
$this->setProperty($referring_search_term_id);  
 
$timestamp = new owa_dbColumn('timestamp', OWA_DTD_INT);  
$this->setProperty($timestamp);  
 
$yyyymmdd = new owa_dbColumn('yyyymmdd', OWA_DTD_INT);  
$this->setProperty($yyyymmdd);  
 
$order_id = new owa_dbColumn('order_id', OWA_DTD_VARCHAR255);  
$order_id->setIndex();  
$this->setProperty($order_id);  
 
$sku = new owa_dbColumn('sku', OWA_DTD_VARCHAR255);  
$this->setProperty($sku);  
 
$product_name = new owa_dbColumn('product_name', OWA_DTD_VARCHAR255);  
$this->setProperty($product_name);  
 
$category = new owa_dbColumn('category', OWA_DTD_VARCHAR255);  
$this->setProperty($category);  
 
$unit_price = new owa_dbColumn('unit_price', OWA_DTD_BIGINT);  
$this->setProperty($unit_price);  
 
$quantity = new owa_dbColumn('quantity', OWA_DTD_INT);  
$this->setProperty($quantity);  
 
$item_revenue = new owa_dbColumn('item_revenue', OWA_DTD_BIGINT);  
$this->setProperty($item_revenue);  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Commerce Transaction Fact Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_commerce_transaction_fact extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('commerce_transaction_fact');  
 
$id = new owa_dbColumn('id', OWA_DTD_BIGINT);  
$id->setPrimaryKey();  
$this->setProperty($id);  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_BIGINT);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$host_id = new owa_dbColumn('host_id', OWA_DTD_BIGINT);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
$os_id = new owa_dbColumn('os_id', OWA_DTD_BIGINT);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
 
$location_id = new owa_dbColumn('location_id', OWA_DTD_BIGINT);  
$location_id->setForeignKey('base.location_dim');  
$this->setProperty($location_id);  
 
$medium = new owa_dbColumn('medium',OWA_DTD_VARCHAR255);  
$this->setProperty($medium);  
 
$source_id = new owa_dbColumn('source_id', OWA_DTD_BIGINT);  
$source_id->setForeignKey('base.source_dim');  
$this->setProperty($source_id);  
 
$ad_id = new owa_dbColumn('ad_id', OWA_DTD_BIGINT);  
$ad_id->setForeignKey('base.ad_dim');  
$this->setProperty($ad_id);  
 
$campaign_id = new owa_dbColumn('campaign_id', OWA_DTD_BIGINT);  
$campaign_id->setForeignKey('base.campaign_dim');  
$this->setProperty($campaign_id);  
 
$referring_search_term_id = new owa_dbColumn('referring_search_term_id', OWA_DTD_BIGINT);  
$referring_search_term_id->setForeignKey('base.search_term_dim');  
$this->setProperty($referring_search_term_id);  
 
$referer_id = new owa_dbColumn('referer_id', OWA_DTD_BIGINT);  
$referer_id->setForeignKey('base.referer');  
$this->setProperty($referer_id);  
 
$timestamp = new owa_dbColumn('timestamp', OWA_DTD_INT);  
$this->setProperty($timestamp);  
 
$yyyymmdd = new owa_dbColumn('yyyymmdd', OWA_DTD_INT);  
$this->setProperty($yyyymmdd);  
 
$order_id = new owa_dbColumn('order_id', OWA_DTD_VARCHAR255);  
$order_id->setIndex();  
$this->setProperty($order_id);  
 
$order_source = new owa_dbColumn('order_source', OWA_DTD_VARCHAR255);  
$this->setProperty($order_source);  
 
$gateway = new owa_dbColumn('gateway', OWA_DTD_VARCHAR255);  
$this->setProperty($gateway);  
 
$total = new owa_dbColumn('total_revenue', OWA_DTD_BIGINT);  
$this->setProperty($total);  
 
$tax = new owa_dbColumn('tax_revenue', OWA_DTD_BIGINT);  
$this->setProperty($tax);  
 
$shipping = new owa_dbColumn('shipping_revenue', OWA_DTD_BIGINT);  
$this->setProperty($shipping);  
 
$days_since_first_session = new owa_dbColumn('days_since_first_session', OWA_DTD_INT);  
$this->setProperty($days_since_first_session);  
 
$nps = new owa_dbColumn('num_prior_sessions', OWA_DTD_INT);  
$this->setProperty($nps);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Configuration Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_configuration extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('configuration');  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['settings'] = new owa_dbColumn;  
$this->properties['settings']->setDataType(OWA_DTD_TEXT);  
$this->setCachable();  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Document Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_document extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('document');  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['url'] = new owa_dbColumn;  
$this->properties['url']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['uri'] = new owa_dbColumn;  
$this->properties['uri']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['page_title'] = new owa_dbColumn;  
$this->properties['page_title']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['page_type'] = new owa_dbColumn;  
$this->properties['page_type']->setDataType(OWA_DTD_VARCHAR255);  
$this->setCachable();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* DOM Stream Fact Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_domstream extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('domstream');  
 
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$domstream_guid = new owa_dbColumn('domstream_guid', OWA_DTD_BIGINT);  
$this->setProperty($domstream_guid);  
 
$this->properties['events'] = new owa_dbColumn;  
$this->properties['events']->setDataType(OWA_DTD_TEXT);  
$this->properties['duration'] = new owa_dbColumn;  
$this->properties['duration']->setDataType(OWA_DTD_INT);  
$this->properties['timestamp'] = new owa_dbColumn;  
$this->properties['timestamp']->setDataType(OWA_DTD_INT);  
$this->properties['yyyymmdd'] = new owa_dbColumn;  
$this->properties['yyyymmdd']->setDataType(OWA_DTD_INT);  
$this->properties['page_url'] = new owa_dbColumn;  
$this->properties['page_url']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visitor Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_exit extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('exit');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['url'] = new owa_dbColumn;  
$this->properties['url']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['site_name'] = new owa_dbColumn;  
$this->properties['site_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['site'] = new owa_dbColumn;  
$this->properties['site']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['anchortext'] = new owa_dbColumn;  
$this->properties['anchortext']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['page_title'] = new owa_dbColumn;  
$this->properties['page_title']->setDataType(OWA_DTD_VARCHAR255);  
 
}  
 
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Feed Request Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_feed_request extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('feed_request');  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$document_id = new owa_dbColumn('document_id', OWA_DTD_BIGINT);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
// wrong data type  
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_VARCHAR255);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$host_id = new owa_dbColumn('host_id', OWA_DTD_BIGINT);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
// wrong data type  
$os_id = new owa_dbColumn('os_id', OWA_DTD_VARCHAR255);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
 
//drop  
$this->properties['site'] = new owa_dbColumn;  
$this->properties['site']->setDataType(OWA_DTD_VARCHAR255);  
 
//drop  
$this->properties['host'] = new owa_dbColumn;  
$this->properties['host']->setDataType(OWA_DTD_VARCHAR255);  
 
$this->properties['feed_reader_guid'] = new owa_dbColumn;  
$this->properties['feed_reader_guid']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['subscription_id'] = new owa_dbColumn;  
$this->properties['subscription_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['timestamp'] = new owa_dbColumn;  
$this->properties['timestamp']->setDataType(OWA_DTD_BIGINT);  
$yyyymmdd = new owa_dbColumn;  
$yyyymmdd->setName('yyyymmdd');  
$yyyymmdd->setDataType(OWA_DTD_INT);  
$yyyymmdd->setIndex();  
$this->setProperty($yyyymmdd);  
$this->properties['month'] = new owa_dbColumn;  
$this->properties['month']->setDataType(OWA_DTD_INT);  
$this->properties['day'] = new owa_dbColumn;  
$this->properties['day']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['dayofweek'] = new owa_dbColumn;  
$this->properties['dayofweek']->setDataType(OWA_DTD_VARCHAR10);  
$this->properties['dayofyear'] = new owa_dbColumn;  
$this->properties['dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['weekofyear'] = new owa_dbColumn;  
$this->properties['weekofyear']->setDataType(OWA_DTD_INT);  
$this->properties['year'] = new owa_dbColumn;  
$this->properties['year']->setDataType(OWA_DTD_INT);  
$this->properties['hour'] = new owa_dbColumn;  
$this->properties['hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['minute'] = new owa_dbColumn;  
$this->properties['minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['second'] = new owa_dbColumn;  
$this->properties['second']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['msec'] = new owa_dbColumn;  
$this->properties['msec']->setDataType(OWA_DTD_INT);  
$this->properties['last_req'] = new owa_dbColumn;  
$this->properties['last_req']->setDataType(OWA_DTD_BIGINT);  
$this->properties['feed_format'] = new owa_dbColumn;  
$this->properties['feed_format']->setDataType(OWA_DTD_VARCHAR255);  
//drop  
$this->properties['ip_address'] = new owa_dbColumn;  
$this->properties['ip_address']->setDataType(OWA_DTD_VARCHAR255);  
//drop  
$this->properties['os'] = new owa_dbColumn;  
$this->properties['os']->setDataType(OWA_DTD_VARCHAR255);  
 
$yyyymmdd = new owa_dbColumn;  
$yyyymmdd->setName('yyyymmdd');  
$yyyymmdd->setDataType(OWA_DTD_INT);  
$yyyymmdd->setIndex();  
$this->setProperty($yyyymmdd);  
 
}  
 
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Host Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_host extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('host');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['ip_address'] = new owa_dbColumn;  
$this->properties['ip_address']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['host'] = new owa_dbColumn;  
$this->properties['host']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['full_host'] = new owa_dbColumn;  
$this->properties['full_host']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['city'] = new owa_dbColumn;  
$this->properties['city']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['country'] = new owa_dbColumn;  
$this->properties['country']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['latitude'] = new owa_dbColumn;  
$this->properties['latitude']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['longitude'] = new owa_dbColumn;  
$this->properties['longitude']->setDataType(OWA_DTD_VARCHAR255);  
}  
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visitor Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_impression extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('impression');  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['visitor_id'] = new owa_dbColumn;  
$this->properties['visitor_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['session_id'] = new owa_dbColumn;  
$this->properties['session_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['tag_id'] = new owa_dbColumn;  
$this->properties['tag_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['placement_id'] = new owa_dbColumn;  
$this->properties['placement_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['campaign_id'] = new owa_dbColumn;  
$this->properties['campaign_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['ad_group_id'] = new owa_dbColumn;  
$this->properties['ad_group_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['ad_id'] = new owa_dbColumn;  
$this->properties['ad_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['site_id'] = new owa_dbColumn;  
$this->properties['site_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['last_impression_id'] = new owa_dbColumn;  
$this->properties['last_impression_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['last_impression_timestamp'] = new owa_dbColumn;  
$this->properties['last_impression_timestamp']->setDataType(OWA_DTD_BIGINT);  
$this->properties['timestamp'] = new owa_dbColumn;  
$this->properties['timestamp']->setDataType(OWA_DTD_BIGINT);  
$this->properties['year'] = new owa_dbColumn;  
$this->properties['year']->setDataType(OWA_DTD_INT);  
$this->properties['month'] = new owa_dbColumn;  
$this->properties['month']->setDataType(OWA_DTD_INT);  
$this->properties['day'] = new owa_dbColumn;  
$this->properties['day']->setDataType(OWA_DTD_INT);  
$this->properties['dayofyear'] = new owa_dbColumn;  
$this->properties['dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['weekofyear'] = new owa_dbColumn;  
$this->properties['weekofyear']->setDataType(OWA_DTD_INT);  
$this->properties['hour'] = new owa_dbColumn;  
$this->properties['hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['minute'] = new owa_dbColumn;  
$this->properties['minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['msec'] = new owa_dbColumn;  
$this->properties['msec']->setDataType(OWA_DTD_BIGINT);  
$this->properties['url'] = new owa_dbColumn;  
$this->properties['url']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['ua_id'] = new owa_dbColumn;  
$this->properties['ua_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['ip_address'] = new owa_dbColumn;  
$this->properties['ip_address']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['host_id'] = new owa_dbColumn;  
$this->properties['host_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['host'] = new owa_dbColumn;  
$this->properties['host']->setDataType(OWA_DTD_VARCHAR255);  
}  
 
 
 
}  
 
 
 
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Location Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_location_dim extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('location_dim');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['country'] = new owa_dbColumn;  
$this->properties['country']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['country_code'] = new owa_dbColumn;  
$this->properties['country_code']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['state'] = new owa_dbColumn;  
$this->properties['state']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['city'] = new owa_dbColumn;  
$this->properties['city']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['latitude'] = new owa_dbColumn;  
$this->properties['latitude']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['longitude'] = new owa_dbColumn;  
$this->properties['longitude']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Operating System Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_os extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('os');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['name'] = new owa_dbColumn;  
$this->properties['name']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Queued Event Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_queue_item extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('queue_item');  
//$this->setCachable();  
 
// properties  
$id = new owa_dbColumn( 'id', OWA_DTD_BIGINT );  
$id->setPrimaryKey();  
$this->setProperty($id);  
$event_type = new owa_dbColumn( 'event_type', OWA_DTD_VARCHAR255 );  
$this->setProperty($event_type);  
$priority = new owa_dbColumn( 'priority', OWA_DTD_INT );  
$this->setProperty($priority);  
$status = new owa_dbColumn( 'status', OWA_DTD_VARCHAR255 );  
$this->setProperty($status);  
$event = new owa_dbColumn( 'event', OWA_DTD_BLOB );  
$this->setProperty($event);  
$insertion_datestamp = new owa_dbColumn( 'insertion_datestamp', OWA_DTD_TIMESTAMP );  
$this->setProperty($insertion_datestamp);  
$insertion_timestamp = new owa_dbColumn( 'insertion_timestamp', OWA_DTD_INT );  
$this->setProperty($insertion_timestamp);  
$handled_timestamp = new owa_dbColumn( 'handled_timestamp', OWA_DTD_INT );  
$this->setProperty($handled_timestamp);  
$last_attempt_timestamp = new owa_dbColumn( 'last_attempt_timestamp', OWA_DTD_INT );  
$this->setProperty($last_attempt_timestamp);  
$not_before_timestamp = new owa_dbColumn( 'not_before_timestamp', OWA_DTD_INT );  
$this->setProperty($not_before_timestamp);  
$failed_attempt_count = new owa_dbColumn( 'failed_attempt_count', OWA_DTD_INT );  
$this->setProperty($failed_attempt_count);  
$is_assigned = new owa_dbColumn( 'is_assigned', OWA_DTD_BOOLEAN );  
$this->setProperty($is_assigned);  
$last_error_msg = new owa_dbColumn( 'last_error_msg', OWA_DTD_VARCHAR255 );  
$this->setProperty($last_error_msg);  
$handled_by = new owa_dbColumn( 'handled_by', OWA_DTD_VARCHAR255 );  
$this->setProperty($handled_by);  
$handler_duration = new owa_dbColumn( 'handler_duration', OWA_DTD_INT );  
$this->setProperty($handler_duration);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Referer Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_referer extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('referer');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['url'] = new owa_dbColumn;  
$this->properties['url']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['site_name'] = new owa_dbColumn;  
$this->properties['site_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['site'] = new owa_dbColumn;  
$this->properties['site']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['query_terms'] = new owa_dbColumn;  
$this->properties['query_terms']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['refering_anchortext'] = new owa_dbColumn;  
$this->properties['refering_anchortext']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['page_title'] = new owa_dbColumn;  
$this->properties['page_title']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['snippet'] = new owa_dbColumn;  
$this->properties['snippet']->setDataType(OWA_DTD_TEXT);  
$this->properties['is_searchengine'] = new owa_dbColumn;  
$this->properties['is_searchengine']->setDataType(OWA_DTD_TINYINT);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* page Request Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_request extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('request');  
$this->setSummaryLevel(0);  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$session_id = new owa_dbColumn('session_id', OWA_DTD_BIGINT);  
//$session_id->setForeignKey('base.session');  
$this->setProperty($session_id);  
 
$inbound_visitor_id = new owa_dbColumn('inbound_visitor_id', OWA_DTD_BIGINT);  
$inbound_visitor_id->setForeignKey('base.visitor');  
$this->setProperty($inbound_visitor_id);  
 
$inbound_session_id = new owa_dbColumn('inbound_session_id', OWA_DTD_BIGINT);  
//$inbound_session_id->setForeignKey('base.session');  
$this->setProperty($inbound_session_id);  
 
$this->properties['feed_subscription_id'] = new owa_dbColumn;  
$this->properties['feed_subscription_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['user_name'] = new owa_dbColumn;  
$this->properties['user_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['user_email'] = new owa_dbColumn;  
$this->properties['user_email']->setDataType(OWA_DTD_VARCHAR255);  
$ts = new owa_dbColumn;  
$ts->setName('timestamp');  
$ts->setDataType(OWA_DTD_BIGINT);  
$ts->setIndex();  
$this->setProperty($ts);  
$yyyymmdd = new owa_dbColumn;  
$yyyymmdd->setName('yyyymmdd');  
$yyyymmdd->setDataType(OWA_DTD_INT);  
$yyyymmdd->setIndex();  
$this->setProperty($yyyymmdd);  
$this->properties['last_req'] = new owa_dbColumn;  
$this->properties['last_req']->setDataType(OWA_DTD_BIGINT);  
$this->properties['year'] = new owa_dbColumn;  
$this->properties['year']->setDataType(OWA_DTD_INT);  
$this->properties['month'] = new owa_dbColumn;  
$this->properties['month']->setDataType(OWA_DTD_INT);  
$this->properties['day'] = new owa_dbColumn;  
$this->properties['day']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['dayofweek'] = new owa_dbColumn;  
$this->properties['dayofweek']->setDataType(OWA_DTD_VARCHAR10);  
$this->properties['dayofyear'] = new owa_dbColumn;  
$this->properties['dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['weekofyear'] = new owa_dbColumn;  
$this->properties['weekofyear']->setDataType(OWA_DTD_INT);  
$this->properties['hour'] = new owa_dbColumn;  
$this->properties['hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['minute'] = new owa_dbColumn;  
$this->properties['minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['second'] = new owa_dbColumn;  
$this->properties['second']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['msec'] = new owa_dbColumn;  
$this->properties['msec']->setDataType(OWA_DTD_INT);  
// wrong data type  
$referer_id = new owa_dbColumn('referer_id', OWA_DTD_VARCHAR255);  
$referer_id->setForeignKey('base.referer');  
$this->setProperty($referer_id);  
// wrong data type  
$document_id = new owa_dbColumn('document_id', OWA_DTD_VARCHAR255);  
$document_id->setForeignKey('base.document');  
$this->setProperty($document_id);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$this->properties['site'] = new owa_dbColumn;  
$this->properties['site']->setDataType(OWA_DTD_VARCHAR255);  
 
$this->properties['ip_address'] = new owa_dbColumn;  
$this->properties['ip_address']->setDataType(OWA_DTD_VARCHAR255);  
// wrong data type  
$host_id = new owa_dbColumn('host_id', OWA_DTD_VARCHAR255);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
// wrong data type  
$os_id = new owa_dbColumn('os_id', OWA_DTD_VARCHAR255);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
//drop  
$this->properties['os'] = new owa_dbColumn;  
$this->properties['os']->setDataType(OWA_DTD_VARCHAR255);  
// wrong data type  
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_VARCHAR255);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
//prior page  
$prior_document_id = new owa_dbColumn('prior_document_id', OWA_DTD_BIGINT);  
$prior_document_id->setForeignKey('base.document');  
$this->setProperty($prior_document_id);  
 
$nps = new owa_dbColumn('num_prior_sessions', OWA_DTD_INT);  
$this->setProperty($nps);  
 
$this->properties['is_new_visitor'] = new owa_dbColumn;  
$this->properties['is_new_visitor']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_repeat_visitor'] = new owa_dbColumn;  
$this->properties['is_repeat_visitor']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_comment'] = new owa_dbColumn;  
$this->properties['is_comment']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_entry_page'] = new owa_dbColumn;  
$this->properties['is_entry_page']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_browser'] = new owa_dbColumn;  
$this->properties['is_browser']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_robot'] = new owa_dbColumn;  
$this->properties['is_robot']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_feedreader'] = new owa_dbColumn;  
$this->properties['is_feedreader']->setDataType(OWA_DTD_TINYINT);  
 
//location  
$location_id = new owa_dbColumn('location_id', OWA_DTD_BIGINT);  
$location_id->setForeignKey('base.location_dim');  
$this->setProperty($location_id);  
 
//language  
$language = new owa_dbColumn('language', OWA_DTD_VARCHAR255);  
$this->setProperty($language);  
}  
 
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Search Term Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_search_term_dim extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('search_term_dim');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['terms'] = new owa_dbColumn;  
$this->properties['terms']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['term_count'] = new owa_dbColumn;  
$this->properties['term_count']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Session Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_session extends owa_entity {  
 
function __construct() {  
 
// table name  
$this->setTableName('session');  
$this->setSummaryLevel(1);  
 
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
 
$visitor_id = new owa_dbColumn('visitor_id', OWA_DTD_BIGINT);  
$visitor_id->setForeignKey('base.visitor');  
$this->setProperty($visitor_id);  
 
$ts = new owa_dbColumn;  
$ts->setName('timestamp');  
$ts->setDataType(OWA_DTD_BIGINT);  
$ts->setIndex();  
$this->setProperty($ts);  
 
$yyyymmdd = new owa_dbColumn;  
$yyyymmdd->setName('yyyymmdd');  
$yyyymmdd->setDataType(OWA_DTD_INT);  
$yyyymmdd->setIndex();  
$this->setProperty($yyyymmdd);  
 
$this->properties['user_name'] = new owa_dbColumn;  
$this->properties['user_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['user_email'] = new owa_dbColumn;  
$this->properties['user_email']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['year'] = new owa_dbColumn;  
$this->properties['year']->setDataType(OWA_DTD_INT);  
$this->properties['month'] = new owa_dbColumn;  
$this->properties['month']->setDataType(OWA_DTD_INT);  
$this->properties['day'] = new owa_dbColumn;  
$this->properties['day']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['dayofweek'] = new owa_dbColumn;  
$this->properties['dayofweek']->setDataType(OWA_DTD_VARCHAR10);  
$this->properties['dayofyear'] = new owa_dbColumn;  
$this->properties['dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['weekofyear'] = new owa_dbColumn;  
$this->properties['weekofyear']->setDataType(OWA_DTD_INT);  
$this->properties['hour'] = new owa_dbColumn;  
$this->properties['hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['minute'] = new owa_dbColumn;  
$this->properties['minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['last_req'] = new owa_dbColumn;  
$this->properties['last_req']->setDataType(OWA_DTD_BIGINT);  
$this->properties['num_pageviews'] = new owa_dbColumn;  
$this->properties['num_pageviews']->setDataType(OWA_DTD_INT);  
$this->properties['num_comments'] = new owa_dbColumn;  
$this->properties['num_comments']->setDataType(OWA_DTD_INT);  
$this->properties['is_repeat_visitor'] = new owa_dbColumn;  
$this->properties['is_repeat_visitor']->setDataType(OWA_DTD_TINYINT);  
 
$is_bounce = new owa_dbColumn;  
$is_bounce->setName('is_bounce');  
$is_bounce->setDataType(OWA_DTD_TINYINT);  
$this->setProperty($is_bounce);  
 
$this->properties['is_new_visitor'] = new owa_dbColumn;  
$this->properties['is_new_visitor']->setDataType(OWA_DTD_TINYINT);  
$this->properties['prior_session_lastreq'] = new owa_dbColumn;  
$this->properties['prior_session_lastreq']->setDataType(OWA_DTD_BIGINT);  
 
$prior_session_id = new owa_dbColumn('prior_session_id', OWA_DTD_BIGINT);  
$this->setProperty($prior_session_id);  
 
$this->properties['time_sinse_priorsession'] = new owa_dbColumn;  
$this->properties['time_sinse_priorsession']->setDataType(OWA_DTD_INT);  
$this->properties['prior_session_year'] = new owa_dbColumn;  
$this->properties['prior_session_year']->setDataType(OWA_DTD_TINYINT4);  
$this->properties['prior_session_month'] = new owa_dbColumn;  
$this->properties['prior_session_month']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['prior_session_day'] = new owa_dbColumn;  
$this->properties['prior_session_day']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['prior_session_dayofweek'] = new owa_dbColumn;  
$this->properties['prior_session_dayofweek']->setDataType(OWA_DTD_INT);  
$this->properties['prior_session_hour'] = new owa_dbColumn;  
$this->properties['prior_session_hour']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['prior_session_minute'] = new owa_dbColumn;  
$this->properties['prior_session_minute']->setDataType(OWA_DTD_TINYINT2);  
$this->properties['days_since_prior_session'] = new owa_dbColumn;  
$this->properties['days_since_prior_session']->setDataType(OWA_DTD_INT);  
$this->properties['days_since_first_session'] = new owa_dbColumn;  
$this->properties['days_since_first_session']->setDataType(OWA_DTD_INT);  
$this->properties['os'] = new owa_dbColumn;  
$this->properties['os']->setDataType(OWA_DTD_VARCHAR255);  
 
// wrong data type  
$os_id = new owa_dbColumn('os_id', OWA_DTD_VARCHAR255);  
$os_id->setForeignKey('base.os');  
$this->setProperty($os_id);  
 
// wrong data type  
$ua_id = new owa_dbColumn('ua_id', OWA_DTD_VARCHAR255);  
$ua_id->setForeignKey('base.ua');  
$this->setProperty($ua_id);  
 
$first_page_id = new owa_dbColumn('first_page_id', OWA_DTD_BIGINT);  
$first_page_id->setForeignKey('base.document');  
$this->setProperty($first_page_id);  
 
$last_page_id = new owa_dbColumn('last_page_id', OWA_DTD_BIGINT);  
$last_page_id->setForeignKey('base.document');  
$this->setProperty($last_page_id);  
 
$referer_id = new owa_dbColumn('referer_id', OWA_DTD_BIGINT);  
$referer_id->setForeignKey('base.referer');  
$this->setProperty($referer_id);  
 
$referring_search_term_id = new owa_dbColumn('referring_search_term_id', OWA_DTD_BIGINT);  
$referring_search_term_id->setForeignKey('base.search_term_dim');  
$this->setProperty($referring_search_term_id);  
 
$ip_address = new owa_dbColumn('ip_address', OWA_DTD_VARCHAR255);  
$this->setProperty($ip_address);  
 
$this->properties['host'] = new owa_dbColumn;  
$this->properties['host']->setDataType(OWA_DTD_VARCHAR255);  
 
// wrong data type  
$host_id = new owa_dbColumn('host_id', OWA_DTD_VARCHAR255);  
$host_id->setForeignKey('base.host');  
$this->setProperty($host_id);  
 
$this->properties['city'] = new owa_dbColumn;  
$this->properties['city']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['country'] = new owa_dbColumn;  
$this->properties['country']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['site'] = new owa_dbColumn;  
$this->properties['site']->setDataType(OWA_DTD_VARCHAR255);  
 
$site_id = new owa_dbColumn('site_id', OWA_DTD_VARCHAR255);  
$site_id->setForeignKey('base.site', 'site_id');  
$this->setProperty($site_id);  
 
$nps = new owa_dbColumn('num_prior_sessions', OWA_DTD_INT);  
$this->setProperty($nps);  
 
$this->properties['is_robot'] = new owa_dbColumn;  
$this->properties['is_robot']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_browser'] = new owa_dbColumn;  
$this->properties['is_browser']->setDataType(OWA_DTD_TINYINT);  
$this->properties['is_feedreader'] = new owa_dbColumn;  
$this->properties['is_feedreader']->setDataType(OWA_DTD_TINYINT);  
 
//$this->properties['source'] = new owa_dbColumn;  
//$this->properties['source']->setDataType(OWA_DTD_VARCHAR255);  
 
 
$medium = new owa_dbColumn('medium',OWA_DTD_VARCHAR255);  
$this->setProperty($medium);  
 
$source_id = new owa_dbColumn('source_id', OWA_DTD_BIGINT);  
$source_id->setForeignKey('base.source_dim');  
$this->setProperty($source_id);  
 
$ad_id = new owa_dbColumn('ad_id', OWA_DTD_BIGINT);  
$ad_id->setForeignKey('base.ad_dim');  
$this->setProperty($ad_id);  
 
$campaign_id = new owa_dbColumn('campaign_id', OWA_DTD_BIGINT);  
$campaign_id->setForeignKey('base.campaign_dim');  
$this->setProperty($campaign_id);  
 
$this->properties['latest_attributions'] = new owa_dbColumn;  
$this->properties['latest_attributions']->setDataType(OWA_DTD_TEXT);  
 
// create goal related columns  
$gcount = owa_coreAPI::getSetting('base', 'numGoals');  
for ($num = 1; $num <= $gcount;$num++) {  
$col_name = 'goal_'.$num;  
$goal_col = new owa_dbColumn($col_name, OWA_DTD_TINYINT);  
$this->setProperty($goal_col);  
$col_name = 'goal_'.$num.'_start';  
$goal_col = new owa_dbColumn($col_name, OWA_DTD_TINYINT);  
$this->setProperty($goal_col);  
$col_name = 'goal_'.$num.'_value';  
$goal_col = new owa_dbColumn($col_name, OWA_DTD_BIGINT);  
$this->setProperty($goal_col);  
}  
 
$num_goals = new owa_dbColumn('num_goals', OWA_DTD_TINYINT);  
$this->setProperty($num_goals);  
 
$num_goal_starts = new owa_dbColumn('num_goal_starts', OWA_DTD_TINYINT);  
$this->setProperty($num_goal_starts);  
 
$goals_value = new owa_dbColumn('goals_value', OWA_DTD_BIGINT);  
$this->setProperty($goals_value);  
 
//location  
$location_id = new owa_dbColumn('location_id', OWA_DTD_BIGINT);  
$location_id->setForeignKey('base.location_dim');  
$this->setProperty($location_id);  
 
// language  
$language = new owa_dbColumn('language', OWA_DTD_VARCHAR255);  
$this->setProperty($language);  
 
// transaction count  
$commerce_trans_count = new owa_dbColumn('commerce_trans_count', OWA_DTD_INT);  
$this->setProperty($commerce_trans_count);  
// revenue including tax and shipping  
$commerce_trans_revenue = new owa_dbColumn('commerce_trans_revenue', OWA_DTD_BIGINT);  
$this->setProperty($commerce_trans_revenue);  
// revenue excluding tax and shipping  
$commerce_items_revenue = new owa_dbColumn('commerce_items_revenue', OWA_DTD_BIGINT);  
$this->setProperty($commerce_items_revenue);  
// distinct number of items  
$commerce_items_count = new owa_dbColumn('commerce_items_count', OWA_DTD_INT);  
$this->setProperty($commerce_items_count);  
// total quantity of all items  
$commerce_items_quantity = new owa_dbColumn('commerce_items_quantity', OWA_DTD_INT);  
$this->setProperty($commerce_items_quantity);  
// shipping revenue  
$commerce_shipping_revenue = new owa_dbColumn('commerce_shipping_revenue', OWA_DTD_BIGINT);  
$this->setProperty($commerce_shipping_revenue);  
// tax revenue  
$commerce_tax_revenue = new owa_dbColumn('commerce_tax_revenue', OWA_DTD_BIGINT);  
$this->setProperty($commerce_tax_revenue);  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
 
 
/**  
* Site Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_site extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('site');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['site_id'] = new owa_dbColumn;  
$this->properties['site_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['domain'] = new owa_dbColumn;  
$this->properties['domain']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['name'] = new owa_dbColumn;  
$this->properties['name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['description'] = new owa_dbColumn;  
$this->properties['description']->setDataType(OWA_DTD_TEXT);  
$this->properties['site_family'] = new owa_dbColumn;  
$this->properties['site_family']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['settings'] = new owa_dbColumn;  
$this->properties['settings']->setDataType(OWA_DTD_TEXT);  
}  
 
function generateSiteId($domain) {  
 
return md5($domain);  
}  
 
function settingsGetFilter($value) {  
if ($value) {  
return unserialize($value);  
}  
}  
 
function settingsSetFilter($value) {  
owa_coreAPI::debug('hello rom setFilter');  
$value = serialize($value);  
owa_coreAPI::debug($value);  
return $value;  
}  
 
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Source Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_source_dim extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('source_dim');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['source_domain'] = new owa_dbColumn;  
$this->properties['source_domain']->setDataType(OWA_DTD_VARCHAR255);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* User Agent Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_ua extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('ua');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['ua'] = new owa_dbColumn;  
$this->properties['ua']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['browser_type'] = new owa_dbColumn;  
$this->properties['browser_type']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['browser'] = new owa_dbColumn;  
$this->properties['browser']->setDataType(OWA_DTD_VARCHAR255);  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* User Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_user extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('user');  
$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_SERIAL);  
$this->properties['id']->setAutoIncrement();  
$this->properties['user_id'] = new owa_dbColumn;  
$this->properties['user_id']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['user_id']->setPrimaryKey();  
$this->properties['password'] = new owa_dbColumn;  
$this->properties['password']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['role'] = new owa_dbColumn;  
$this->properties['role']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['real_name'] = new owa_dbColumn;  
$this->properties['real_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['email_address'] = new owa_dbColumn;  
$this->properties['email_address']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['temp_passkey'] = new owa_dbColumn;  
$this->properties['temp_passkey']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['creation_date'] = new owa_dbColumn;  
$this->properties['creation_date']->setDataType(OWA_DTD_BIGINT);  
$this->properties['last_update_date'] = new owa_dbColumn;  
$this->properties['last_update_date']->setDataType(OWA_DTD_BIGINT);  
$apiKey = new owa_dbColumn;  
$apiKey->setName('api_key');  
$apiKey->setDataType(OWA_DTD_VARCHAR255);  
$this->setProperty($apiKey);  
}  
 
function createNewUser($user_id, $role, $password = '', $email_address = '', $real_name = '') {  
 
if (!$password) {  
$password = $this->generateRandomPassword();  
}  
 
$this->set('user_id', $user_id);  
$this->set('role', $role);  
$this->set('real_name', $real_name);  
$this->set('email_address', $email_address);  
$this->set('temp_passkey', $this->generateTempPasskey($user_id));  
$this->set('password', owa_lib::encryptPassword($password));  
$this->set('creation_date', time());  
$this->set('last_update_date', time());  
$this->set('api_key', $this->generateTempPasskey($user_id));  
$ret = $this->create();  
 
return $ret;  
}  
 
function generateTempPasskey($seed) {  
 
return md5($seed.time().rand());  
}  
 
function generateRandomPassword() {  
 
return substr(owa_lib::encryptPassword(microtime()),0,6);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visitor Entity  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_visitor extends owa_entity {  
 
function __construct() {  
 
$this->setTableName('visitor');  
//$this->setCachable();  
// properties  
$this->properties['id'] = new owa_dbColumn;  
$this->properties['id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['id']->setPrimaryKey();  
$this->properties['user_name'] = new owa_dbColumn;  
$this->properties['user_name']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['user_email'] = new owa_dbColumn;  
$this->properties['user_email']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['first_session_id'] = new owa_dbColumn;  
$this->properties['first_session_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['first_session_year'] = new owa_dbColumn;  
$this->properties['first_session_year']->setDataType(OWA_DTD_INT);  
$this->properties['first_session_month'] = new owa_dbColumn;  
$this->properties['first_session_month']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['first_session_day'] = new owa_dbColumn;  
$this->properties['first_session_day']->setDataType(OWA_DTD_INT);  
$this->properties['first_session_dayofyear'] = new owa_dbColumn;  
$this->properties['first_session_dayofyear']->setDataType(OWA_DTD_INT);  
$this->properties['first_session_timestamp'] = new owa_dbColumn;  
$this->properties['first_session_timestamp']->setDataType(OWA_DTD_BIGINT);  
$this->properties['first_session_yyyymmdd'] = new owa_dbColumn;  
$this->properties['first_session_yyyymmdd']->setDataType(OWA_DTD_BIGINT);  
$this->properties['last_session_id'] = new owa_dbColumn;  
$this->properties['last_session_id']->setDataType(OWA_DTD_BIGINT);  
$this->properties['last_session_year'] = new owa_dbColumn;  
$this->properties['last_session_year']->setDataType(OWA_DTD_INT);  
$this->properties['last_session_month'] = new owa_dbColumn;  
$this->properties['last_session_month']->setDataType(OWA_DTD_VARCHAR255);  
$this->properties['last_session_day'] = new owa_dbColumn;  
$this->properties['last_session_day']->setDataType(OWA_DTD_INT);  
$this->properties['last_session_dayofyear'] = new owa_dbColumn;  
$this->properties['last_session_dayofyear']->setDataType(OWA_DTD_INT);  
$num_prior_sessions = new owa_dbColumn;  
$num_prior_sessions->setName('num_prior_sessions');  
$num_prior_sessions->setDataType(OWA_DTD_INT);  
$this->setProperty($num_prior_sessions);  
}  
 
function getVisitorName() {  
 
if ($this->get('user_name')) {  
return $this->get('user_name');  
} elseif ($this->get('user_email')) {  
return $this->get('user_email');  
} else {  
return $this->get('id');  
}  
}  
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Entity Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_entityInstallController extends owa_cliController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$e = owa_coreAPI::entityFactory($this->getParam('entity'));  
$e->createTable();  
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
 
/**  
* View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_errorView extends owa_view {  
 
function owa_errorView() {  
 
return owa_errorView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
// Set Page title  
$this->t->set('page_title', 'Error');  
 
if($this->is_subview === true):  
$this->t->set_template('wrapper_blank.tpl');  
endif;  
 
// load body template  
$this->body->set_template('generic_error.tpl');  
 
return;  
}  
 
 
}  
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Flush Cache CLI Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_flushCacheCliController extends owa_cliController {  
 
function action() {  
 
$cache = &owa_coreAPI::cacheSingleton();  
$cache->flush();  
 
$this->e->notice("Cache Flushed");  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
/**  
* Action Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_actionHandler extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$a = owa_coreAPI::entityFactory('base.action_fact');  
 
$a->load( $event->get( 'guid' ) );  
 
if ( ! $a->wasPersisted() ) {  
 
$a->set('id', $event->get( 'guid' ) );  
$a->set('visitor_id', $event->get('visitor_id'));  
$a->set( 'session_id', $event->get( 'session_id' ) );  
$a->set('site_id', $event->get('site_id'));  
$a->set('document_id', $a->generateId($event->get('page_url')));  
$a->set('ua_id', $a->generateId($event->get('HTTP_USER_AGENT')));  
$a->set('host_id', $a->generateId($event->get('full_host')));  
$a->set('os_id', $a->generateId($event->get('os')));  
$a->set('timestamp', $event->get('timestamp'));  
$a->set('yyyymmdd', $event->get('yyyymmdd'));  
$a->set('action_name', strtolower(trim($event->get('action_name'))));  
$a->set('action_group', strtolower(trim($event->get('action_group'))));  
$a->set('action_label', strtolower(trim($event->get('action_label'))));  
$a->set('numeric_value', $event->get('numeric_value') * 1);  
 
$ret = $a->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
/**  
* Ad Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_adHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
if ($event->get('ad')) {  
$d = owa_coreAPI::entityFactory('base.ad_dim');  
 
$new_id = $d->generateId( trim( strtolower( $event->get( 'ad' ) ) ) );  
$d->getByPk('id', $new_id);  
$id = $d->get('id');  
 
if (!$id) {  
 
$d->set('id', $new_id);  
$d->set('name', trim( strtolower( $event->get('ad') ) ) );  
$d->set('type', trim( strtolower( $event->get('ad_type') ) ) );  
$ret = $d->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Persisting. Ad already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
} else {  
owa_coreAPI::debug('Noting to handle. No Ad properties found on event.');  
return OWA_EHS_EVENT_HANDLED;  
}  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
/**  
* Campaign Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_campaignHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
if ($event->get('campaign')) {  
$d = owa_coreAPI::entityFactory('base.campaign_dim');  
 
$new_id = $d->generateId(trim( strtolower( $event->get('campaign') ) ) );  
$d->getByPk('id', $new_id);  
$id = $d->get('id');  
 
if (!$id) {  
 
$d->set('id', $new_id);  
$d->set('name', $event->get('campaign'));  
$ret = $d->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Persisting. Campaign already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
} else {  
owa_coreAPI::debug('Noting to handle. No Campaign properties found on event.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Click Event Handler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_clickHandlers extends owa_observer {  
 
/**  
* Notify Handler  
*  
* @access public  
* @param object $event  
*/  
function notify($event) {  
 
$c = owa_coreAPI::entityFactory('base.click');  
 
$c->load( $event->get( 'guid' ) );  
 
if (! $c->wasPersisted() ) {  
$c->set('id', $event->get('guid') );  
$c->setProperties($event->getProperties());  
$c->set('visitor_id', $event->get('visitor_id'));  
$c->set('session_id', $event->get('session_id'));  
$c->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));  
 
// Make document id  
$c->set('document_id', owa_lib::setStringGuid($event->get('page_url')));  
 
// Make Target page id  
$c->set('target_id', owa_lib::setStringGuid($c->get('target_url')));  
 
// Make position id used for group bys  
$c->set('position', $c->get('click_x').$c->get('click_y'));  
 
$ret = $c->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
require_once(OWA_DIR.'owa_lib.php');  
 
/**  
* Commerce Transaction Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_commerceTransactionHandlers extends owa_observer {  
 
/**  
* Notify handler method  
*  
* @param object $event  
* @access public  
*/  
function notify($event) {  
 
$dispatch = owa_coreAPI::getEventDispatch();  
$ct = owa_coreAPI::entityFactory('base.commerce_transaction_fact');  
$pk = $ct->generateId( $event->get( 'ct_order_id' ) );  
$ct->getByPk( 'id', $pk );  
$id = $ct->get('id');  
 
if (!$id) {  
 
// set missing properties from associated session  
// this is needed becuase the ecommerce transaction PHP API allows for  
// events to be fired into OWA from a non-web request by passing  
// the session_id.  
$original_session_id = $event->get( 'original_session_id' );  
if ( $original_session_id ) {  
$s = owa_coreAPI::entityFactory( 'base.session' );  
$s->load( $original_session_id );  
 
// override the session id with original session id  
// this is needed for downstream events  
$event->set('session_id', $original_session_id);  
 
if ( $s->get( 'id' ) ) {  
$ct->setProperties( $s->_getProperties() );  
$ct->set( 'session_id', $original_session_id );  
} else {  
owa_coreAPI::debug('Cannot find original session with id: '.$original_session_id);  
return OWA_EHS_EVENT_FAILED;  
}  
 
}  
 
$ct->setProperties($event->getProperties());  
 
$ct->set( 'id', $pk );  
 
// Generate Location Id. Location data is comming from user input NOT ip address  
if ( $event->get( 'country' ) ) {  
$s = owa_coreAPI::serviceSingleton();  
$location_id = $s->geolocation->generateId($event->get( 'country' ), $event->get( 'state' ), $event->get( 'city' ) );  
$ct->set( 'location_id', $location_id );  
}  
// set entity properties  
$ct->set( 'order_id', trim( $event->get( 'ct_order_id' ) ) );  
$ct->set( 'order_source', trim( strtolower( $event->get( 'ct_order_source' ) ) ) );  
$ct->set( 'gateway', trim( strtolower( $event->get( 'ct_gateway' ) ) ) );  
$ct->set( 'total_revenue', owa_lib::prepareCurrencyValue( round( $event->get( 'ct_total' ), 2 ) ) );  
$ct->set( 'tax_revenue', owa_lib::prepareCurrencyValue( round( $event->get( 'ct_tax' ), 2 ) ) );  
$ct->set( 'shipping_revenue', owa_lib::prepareCurrencyValue( round( $event->get( 'ct_shipping' ), 2 ) ) );  
$ct->set( 'days_since_first_session', $event->get('days_since_first_session') );  
$ct->set( 'num_prior_sessions', $event->get('num_prior_sessions') );  
 
$ret = $ct->create();  
 
// persist line items  
if ($ret) {  
$items = $event->get('ct_line_items');  
if ( $items ) {  
 
foreach ($items as $item) {  
$ret = $this->persistLineItem($item, $event);  
}  
}  
}  
 
if ($ret) {  
 
$sce = $dispatch->makeEvent( 'ecommerce.transaction_persisted' );  
$sce->setProperties( $event->getProperties() );  
$dispatch->asyncNotify( $sce );  
}  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
// dispatch event just incase downstream handlers need to be triggered.  
$sce = $dispatch->makeEvent( 'ecommerce.transaction_persisted' );  
$sce->setProperties( $event->getProperties() );  
$dispatch->asyncNotify( $sce );  
owa_coreAPI::debug('Not Persisting. Transaction already exists');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
 
 
function persistLineItem($item, $parent) {  
 
$ct = owa_coreAPI::entityFactory('base.commerce_line_item_fact');  
$guid = $item['li_order_id'] . $item['li_sku'];  
$pk = $ct->generateId( $guid );  
$ct->getByPk( 'id', $pk );  
$id = $ct->get( 'id' );  
 
if ( ! $id ) {  
 
$ct->setProperties( $parent->getProperties() );  
 
$ct->set( 'id', $pk );  
 
// Generate Location Id. Location data is comming from user input  
$ct->set( 'order_id', trim( $item['li_order_id'] ) );  
$ct->set( 'sku', trim( $item['li_sku'] ) );  
$ct->set( 'product_name', trim( strtolower( $item['li_product_name'] ) ) );  
$ct->set( 'category', $item['li_category'] );  
$ct->set( 'unit_price', owa_lib::prepareCurrencyValue( round($item['li_unit_price'], 2 ) ) );  
$ct->set( 'quantity', round( $item['li_quantity'] ) );  
$revenue = round( $item['li_quantity'] * $item['li_unit_price'] , 2 );  
$ct->set( 'item_revenue', owa_lib::prepareCurrencyValue( $revenue ) );  
$ret = $ct->create();  
 
if ($ret) {  
return true;  
} else {  
return false;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Persisting. line item already exists');  
return false;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
/**  
* Conversion Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_conversionHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$update = false;  
$conversion_info = $this->checkForConversion($event);  
 
if ($conversion_info) {  
$s = owa_coreAPI::entityFactory('base.session');  
 
$new_id = $s->generateId(trim( strtolower( $event->get('campaign') ) ) );  
$s->getByPk('id', $event->get('session_id'));  
$id = $s->get('id');  
 
// only record one goal of a particular type per session  
if ($id) {  
//record conversion  
if ( !empty( $conversion_info['conversion'] ) ) {  
$goal_column = 'goal_'.$conversion_info['conversion'];  
$already = $s->get( $goal_column );  
// see if an existing value has been set goal value  
$goal_value_column = 'goal_'.$conversion_info['conversion'].'_value';  
$existing_value = $s->get( $goal_value_column );  
$value = $conversion_info['value'];  
 
// determin is we have a conversion event worth updating  
if ( $already != true ) {  
// there is a goal conversion  
$s->set( $goal_column , true );  
$update = true;  
owa_coreAPI::debug( "$goal_column was achieved." );  
} else {  
// goal already happened but check to see if we need to add a value to it.  
// happens in the case of ecommerce transaction where the value  
// can come in a secondary request. if no value then return.  
if ( ! $value ) {  
owa_coreAPI::debug( 'Not updating session. Goal was already achieved and in same session.' );  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
// Allow a value to be set if one has not be set already.  
// this is needed to support dynamic values passed by commerce transaction events  
if ( $value && ! $existing_value ) {  
$s->set( $goal_value_column, owa_lib::prepareCurrencyValue( $value ) );  
$update = true;  
}  
}  
//record goal start  
if ( !empty($conversion_info['start'] ) ) {  
$goal_start_column = 'goal_'.$conversion_info['start'].'_start';  
$already_started = $s->get( $goal_start_column );  
 
if ( $already_started != true ) {  
 
$s->set( $goal_start_column, true );  
$update = true;  
owa_coreAPI::debug( "$goal_start_column was started." );  
 
} else {  
owa_coreAPI::debug( "$goal_start_column was already started." );  
}  
}  
 
//update object  
if ( $update ) {  
 
// summarize goal conversions  
$s->set('num_goals', $this->countGoalConversions($s));  
 
// summarize goal conversion value  
$s->set('goals_value', $this->sumGoalValues($s));  
 
// summarize goal starts  
$s->set('num_goal_starts', $this->countGoalStarts($s));  
 
$ret = $s->update();  
if ( $ret ) {  
// create a new_conversion event so that the total conversion  
// metrics can be resummarized  
$this->dispatchNewConversionEvent($event);  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug( "nothing about this conversion is worth updating." );  
return OWA_EHS_EVENT_HANDLED;  
}  
 
} else {  
owa_coreAPI::debug("Conversion processing aborted. No session could be found.");  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug('No goal start or conversion detected.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
// create a new_conversion event so that the total conversion  
// metrics can be resummarized  
function dispatchNewConversionEvent($event) {  
 
$dispatch = owa_coreAPI::getEventDispatch();  
$ce = $dispatch->makeEvent( 'new_conversion' );  
$ce->set( 'session_id', $event->get( 'session_id' ) );  
$dispatch->asyncNotify( $ce );  
}  
 
function checkForConversion($event) {  
 
$goal_info = array('conversion' => '', 'value' => '', 'start' => '');  
$siteId = $event->get('siteId');  
 
if ( ! $siteId ) {  
$siteId = $event->get('site_id');  
}  
 
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goals = $gm->getActiveGoals();  
owa_coreAPI::debug('active goals: '.print_r($goals, true));  
if (empty($goals)) {  
return;  
}  
 
$is_match = false;  
 
foreach ($goals as $num => $goal) {  
 
if (!empty($goal)) {  
 
if (array_key_exists('goal_status', $goal) && $goal['goal_status'] === 'active') {  
switch ($goal['goal_type']) {  
 
case 'url_destination':  
 
$match = $this->checkUrlDestinationGoal($event, $goal);  
$start = $this->checkGoalStart($event, $goal);  
break;  
 
case 'pages_per_visit':  
 
$match = $this->checkPagesPerVisitGoal($event, $goal);  
break;  
 
case 'visit_duration':  
 
$match = $this->checkPagesPerVisitGoal($event, $goal);  
break;  
}  
 
if ($match) {  
$goal_info['conversion'] = $match;  
}  
 
if ($start) {  
$goal_info['start'] = $start;  
}  
 
//check for dynamic value from commerce transaction  
 
if ($event->get('ct_total')) {  
$goal_value = $event->get('ct_total');  
} else {  
// else just use the static value if one is set.  
if ( array_key_exists('goal_value', $goal) ) {  
$goal_value = $goal['goal_value'];  
}  
}  
 
$goal_info['value'] = $goal_value;  
} else {  
owa_coreAPI::debug("Goal $num not active.");  
}  
}  
}  
owa_coreAPI::debug('conversion info: '.print_r($goal_info, true));  
return $goal_info;  
}  
 
function checkPagesPerVisitGoal($event, $goal) {  
 
$num = $event->get('npvs');  
 
if ($num) {  
$operator = $goal['details']['operator'];  
$req = $goal['details']['num_pageviews'];  
 
switch ($operator) {  
 
case '=':  
if ($num === $req) {  
return $goal['goal_number'];  
}  
 
case '<':  
if ($num < $req) {  
return $goal['goal_number'];  
}  
 
case '>':  
if ($num > $req) {  
return $goal['goal_number'];  
}  
}  
}  
return false;  
}  
 
function checkVisitDurationGoal($event, $goal) {  
 
$num = $event->get('session_duration');  
$operator = $goal['details']['operator'];  
$req = $goal['details']['duration'];  
 
switch ($operator) {  
 
case '=':  
if ($num === $req) {  
return $goal['goal_number'];  
}  
 
case '<':  
if ($num < $req) {  
return $goal['goal_number'];  
}  
 
case '>':  
if ($num > $req) {  
return $goal['goal_number'];  
}  
}  
 
return false;  
}  
 
function checkUrlDestinationGoal($event, $goal) {  
$match = '';  
$page_uri = $event->get('page_uri');  
 
switch ($goal['details']['match_type']) {  
 
case 'exact':  
 
if ( $page_uri === $goal['details']['goal_url'] ) {  
$match = $goal['goal_number'];  
}  
break;  
 
case 'begins':  
 
$length = strlen( $goal['details']['goal_url'] );  
$check = strpos( $page_uri, $goal['details']['goal_url']);  
if ( $check === 0 ) {  
$match = $goal['goal_number'];  
}  
break;  
 
case 'regex':  
 
$pattern = sprintf('@%s@i', $goal['details']['goal_url']);  
$check = preg_match( $pattern, $page_uri );  
if ( $check > 0 ) {  
$match = $goal['goal_number'];  
}  
break;  
}  
 
return $match;  
}  
 
function checkGoalStart($event, $goal) {  
$page_uri = $event->get('page_uri');  
// check for goal start  
if ( array_key_exists( 'funnel_steps', $goal['details'] ) ) {  
// check the first step  
$step = $goal['details']['funnel_steps'][1];  
$pattern = sprintf('@%s@i', $step['url']);  
$check = preg_match($pattern, $page_uri );  
if ($check > 0) {  
return $goal['goal_number'];  
}  
}  
}  
 
function countGoalConversions($session) {  
 
$num = owa_coreAPI::getSetting('base', 'numGoals');  
$count = 0;  
for ($i = 0;$i < $num;$i++) {  
$col_name = 'goal_'.$i;  
$count = $count + $session->get($col_name);  
 
}  
owa_coreAPI::debug('session total goal count: '.$count);  
return $count;  
}  
 
function countGoalStarts($session) {  
 
$num = owa_coreAPI::getSetting('base', 'numGoals');  
$count = 0;  
for ($i = 0;$i < $num;$i++) {  
$col_name = 'goal_'.$i.'_start';  
$count = $count + $session->get($col_name);  
}  
owa_coreAPI::debug('session total goal starts: '.$count);  
return $count;  
}  
 
function sumGoalValues($session) {  
 
$num = owa_coreAPI::getSetting('base', 'numGoals');  
$sum = 0;  
for ($i = 0;$i < $num;$i++) {  
$col_name = 'goal_'.$i.'_value';  
$sum = $sum + $session->get($col_name);  
}  
owa_coreAPI::debug('session total goal value: '.$sum);  
return $sum;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA Document Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_documentHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$d = owa_coreAPI::entityFactory('base.document');  
$id = owa_lib::setStringGuid($event->get('page_url'));  
$d->load($id);  
 
if ( ! $d->get('id') ) {  
 
$d->setProperties($event->getProperties());  
$d->set('url', $event->get('page_url'));  
$d->set('uri', $event->get('page_uri'));  
$d->set('id', $id);  
$ret = $d->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug('Not logging Document, already exists');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA user management Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
class owa_domstreamHandlers extends owa_observer {  
 
/**  
* Notify method  
*  
* @param object $event  
* @access public  
*/  
function notify($event) {  
 
$ds = owa_coreAPI::entityFactory('base.domstream');  
$ds->load( $event->get('guid') );  
 
if ( ! $ds->wasPersisted() ) {  
 
$ds->set('id', $event->get('guid') );  
$ds->set('domstream_guid', $event->get('domstream_guid'));  
$ds->set('visitor_id', $event->get('visitor_id'));  
$ds->set('session_id', $event->get('session_id'));  
$ds->set('site_id', $event->get('site_id'));  
$ds->set('document_id', $ds->generateId($event->get('page_url')));  
$ds->set('page_url', $event->get('page_url'));  
$ds->set('events', $event->get('stream_events'));  
$ds->set('duration', $event->get('duration'));  
$ds->set('timestamp', $event->get('timestamp'));  
$ds->set('yyyymmdd', owa_lib::timestampToYyyymmdd($event->get('timestamp')));  
$ret = $ds->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug('No persisting. Domsteam already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* Feed Request handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_feedRequestHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
// Make entity  
$f = owa_coreAPI::entityFactory('base.feed_request');  
 
$f->load( $event->get('guid') );  
 
if ( ! $f->wasPersisted() ) {  
$f->setProperties($event->getProperties());  
 
// Set Primary Key  
$f->set( 'id', $event->get('guid') );  
 
// Make ua id  
$f->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));  
 
// Make OS id  
$f->set('os_id', owa_lib::setStringGuid($event->get('os')));  
 
// Make document id  
$f->set('document_id', owa_lib::setStringGuid($event->get('page_url')));  
 
// Generate Host id  
$f->set('host_id', owa_lib::setStringGuid($event->get('host')));  
 
$f->set('subscription_id', $event->get( 'feed_subscription_id' ) );  
// Persist to database  
$ret = $f->create();  
 
if ( $ret ) {  
 
$eq = owa_coreAPI::getEventDispatch();  
$nevent = $eq->makeEvent($event->getEventType().'_persisted');  
$nevent->setProperties($event->getProperties());  
$eq->notify($nevent);  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
} else {  
owa_coreAPI::debug('Not persisting. Feed request already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
require_once(OWA_DIR.'owa_lib.php');  
 
/**  
* Host Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_hostHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$h = owa_coreAPI::entityFactory('base.host');  
 
$h->getByPk('id', owa_lib::setStringGuid($event->get('full_host')));  
$id = $h->get('id');  
 
if (!$id) {  
 
$h->setProperties($event->getProperties());  
$h->set('id', owa_lib::setStringGuid($event->get('full_host')));  
$ret = $h->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Persisting. Host already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
require_once(OWA_DIR.'owa_lib.php');  
 
/**  
* Location Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_locationHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$h = owa_coreAPI::entityFactory('base.location_dim');  
 
// look for location id on the event. This happens when  
// another event has already created it.  
if ($event->get('location_id')) {  
$location_id = $event->get('location_id');  
// else look to see if he event has the minimal geo properties  
// if it does then assume that geo properties are set.  
} elseif ( $event->get('country') ) {  
$key = $event->get('country').$event->get('city');  
$location_id = $h->generateId($key);  
// load the geo properties from the geo service.  
} else {  
$location = owa_coreAPI::getGeolocationFromIpAddress($event->get('ip_address'));  
owa_coreAPI::debug('geolocation: ' .print_r($location, true));  
//set properties of the session  
$event->set('country', $location->getCountry());  
$event->set('city', $location->getCity());  
$event->set('latitude', $location->getLatitude());  
$event->set('longitude', $location->getLongitude());  
$event->set('country_code', $location->getCountryCode());  
$event->set('state', $location->getState());  
$key = $event->get('country').$event->get('city');  
$location_id = $h->generateId($key);  
}  
 
// look up the county code if it's missing  
if ( ! $event->get('country_code') && $event->get('country') ) {  
$event->set( 'country_code', $this->lookupCountryCodeFromName( $event->get('country') ) );  
}  
 
$h->getByPk('id', $location_id );  
$id = $h->get('id');  
 
if (!$id) {  
 
$location = owa_coreAPI::getGeolocationFromIpAddress($event->get('ip_address'));  
owa_coreAPI::debug('geolocation: ' .print_r($location, true));  
 
//set properties of the session  
$h->set('country', $event->get('country'));  
$h->set('city', $event->get('city'));  
$h->set('latitude', $event->get('latitude'));  
$h->set('longitude', $event->get('longitude'));  
$h->set('country_code', $event->get('country_code'));  
$h->set('state', $event->get('state'));  
$h->set('id', $location_id);  
$ret = $h->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Logging. Location already exists');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
function lookupCountryCodeFromName($name) {  
include_once(OWA_DIR.'conf/countryNames2Codes.php');  
$name = trim(strtolower($name));  
if (array_key_exists($name, $countryName2Code)) {  
return $countryName2Code[$name];  
}  
return false;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* Click Event Handler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_notifyHandlers extends owa_observer {  
 
/**  
* Notify Handler  
*  
* @access public  
* @param object $event  
*/  
function notify($event) {  
 
$this->m = $event;  
 
switch ($event->getEventType()) {  
 
case "base.new_session":  
if (owa_coreAPI::getSetting('base', 'announce_visitors')) {  
$this->handleEvent('base.notifyNewSession');  
}  
break;  
}  
 
return;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA Operating System Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_osHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$os = owa_coreAPI::entityFactory('base.os');  
 
$os->getByColumn('id', owa_lib::setStringGuid($event->get('os')));  
 
if (!$os->get('id')) {  
 
$os->set('name', $event->get('os'));  
$os->set('id', owa_lib::setStringGuid($event->get('os')));  
$ret = $os->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not persistig. Operating system already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'ini_db.php');  
 
if (!class_exists('owa_http')) {  
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'owa_httpRequest.php');  
}  
 
/**  
* OWA Referer Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_refererHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
if (!$event->get('external_referer')) {  
return;  
}  
 
// Make entity  
$r = owa_coreAPI::entityFactory('base.referer');  
 
$r->load( $r->generateId( $event->get( 'HTTP_REFERER' ) ) );  
 
if ( ! $r->wasPersisted() ) {  
 
// set referer url  
$r->set('url', $event->get('HTTP_REFERER'));  
 
// check for search engine  
$se_info = $this->lookupSearchEngine($event->get('HTTP_REFERER'));  
if (!empty($se_info)) {  
$r->set('is_searchengine', true);  
$r->set('site_name', $se_info->name);  
}  
 
// Set site  
$url = parse_url($event->get('HTTP_REFERER'));  
$r->set('site', $url['host']);  
 
if ($event->get('source') === 'organic-search') {  
$r->set('is_searchengine', true);  
}  
 
// set title. this will be updated later by the crawler.  
$r->set('page_title', '(not set)');  
// Set id  
$r->set('id', owa_lib::setStringGuid($event->get('HTTP_REFERER')));  
 
// Crawl and analyze refering page  
if (owa_coreAPI::getSetting('base', 'fetch_refering_page_info')) {  
//owa_coreAPI::debug('hello from logReferer');  
$crawler = new owa_http;  
//$crawler->fetch($this->params['HTTP_REFERER']);  
$res = $crawler->getRequest($event->get('HTTP_REFERER'));  
owa_coreAPI::debug('http request response: '.print_r($res, true));  
//Extract Title  
 
$title = trim($crawler->extract_title());  
 
if ($title) {  
 
$r->set('page_title', owa_lib::utf8Encode( $title ) );  
}  
 
$se = $r->get('is_searchengine');  
//Extract anchortext and page snippet but not if it's a search engine...  
if ($se != true) {  
 
$snippet = $crawler->extract_anchor_snippet($event->get('inbound_page_url'));  
 
if ($snippet) {  
if (function_exists('iconv')) {  
$snippet = iconv('UTF-8','UTF-8//TRANSLIT',$snippet);  
}  
$r->set('snippet', $snippet);  
}  
 
$anchortext = $crawler->anchor_info['anchor_text'];  
 
if ($anchortext) {  
 
$r->set('refering_anchortext', owa_lib::utf8Encode( $anchortext ) );  
}  
}  
}  
 
// Persist to database  
$ret = $r->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug('Not Persisting. Referrer already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
/**  
* Lookup info about referring domain  
*  
* @param string $referer  
* @return object  
* @access private  
*/  
function lookupSearchEngine($referer) {  
 
/* Look for match against Search engine groups */  
$db = new ini_db(owa_coreAPI::getSetting('base', 'search_engines.ini'), $sections = true);  
 
$se_info = $db->fetch($referer);  
 
if (!empty($se_info->name)):  
return $se_info;  
else:  
return false;  
endif;  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
 
/**  
* Request Event Handler  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_requestHandlers extends owa_observer {  
 
/**  
* Notify Handler  
*  
* @access public  
* @param object $event  
*/  
function notify($event) {  
 
$r = owa_coreAPI::entityFactory('base.request');  
 
$r->load( $event->get('guid') );  
 
if ( ! $r->wasPersisted() ) {  
 
$r->setProperties($event->getProperties());  
 
// Set Primary Key  
$r->set('id', $event->get('guid'));  
 
// Make ua id  
$r->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));  
 
// Make OS id  
$r->set('os_id', owa_lib::setStringGuid($event->get('os')));  
 
// Make document id  
$r->set('document_id', owa_lib::setStringGuid($event->get('page_url')));  
 
// Make prior document id  
$r->set('prior_document_id', owa_lib::setStringGuid($event->get('prior_page')));  
 
// Generate Referer id  
$r->set('referer_id', owa_lib::setStringGuid($event->get('HTTP_REFERER')));  
 
// Generate Host id  
$r->set('host_id', owa_lib::setStringGuid($event->get('full_host')));  
 
// Generate Host id  
$r->set('num_prior_sessions', $event->get('num_prior_sessions'));  
 
$r->set('language', $event->get('language'));  
 
if ( ! $event->get( 'country' ) ) {  
 
$location = owa_coreAPI::getGeolocationFromIpAddress( $event->get( 'ip_address' ) );  
owa_coreAPI::debug( 'geolocation: ' .print_r( $location, true ) );  
$event->set( 'country', $location->getCountry() );  
$event->set( 'city', $location->getCity() );  
$event->set( 'latitude', $location->getLatitude() );  
$event->set( 'longitude', $location->getLongitude() );  
$event->set( 'country_code', $location->getCountryCode() );  
$event->set( 'state', $location->getState() );  
$location_id = $location->generateId();  
 
} else {  
$s = owa_coreAPI::serviceSingleton();  
$location_id = $s->geolocation->generateId($event->get( 'country' ), $event->get( 'state' ), $event->get( 'city' ) );  
}  
 
if ($location_id) {  
$event->set( 'location_id', $location_id );  
$r->set( 'location_id', $event->get( 'location_id' ) );  
}  
 
$result = $r->create();  
 
if ($result == true) {  
 
$eq = owa_coreAPI::getEventDispatch();  
$nevent = $eq->makeEvent($event->getEventType().'_logged');  
$nevent->setProperties($event->getProperties());  
$eq->asyncNotify($nevent);  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
} else {  
owa_coreAPI::debug('Not persisting. Request already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
 
/**  
* Search Term Handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_searchTermHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$terms = trim(strtolower($event->get('search_terms')));  
 
if ($terms) {  
 
$st = owa_coreAPI::entityFactory('base.search_term_dim');  
$st_id = owa_lib::setStringGuid($terms);  
$st->getByPk('id', $st_id);  
$id = $st->get('id');  
 
if (!$id) {  
 
$st->set('id', $st_id);  
$st->set('terms', $terms);  
$ret = str_replace("","",$terms,$count);  
$st->set('term_count', $count);  
$ret = $st->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Logging. Search term already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
require_once(OWA_DIR.'owa_lib.php');  
 
/**  
* Session Commerce Summary Event handlers  
*  
* Listens for commerce.transaction event and does an idempotent update of the session's  
* commerce realted summary columns.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_sessionCommerceSummaryHandlers extends owa_observer {  
 
/**  
* Notify handler method  
*  
* @param object $event  
* @access public  
* @return boolean  
*/  
function notify($event) {  
 
$s = owa_coreAPI::entityFactory( 'base.session' );  
$pk = $event->get( 'session_id' );  
 
// just in case events slip thorugh that have no session_id  
// look for the original session id param  
if ( ! $pk ) {  
$pk = $event->get( 'original_session_id' );  
if ($pk) {  
$event->set('session_id', $pk);  
}  
}  
 
$s->getByPk( 'id', $pk );  
$id = $s->get('id');  
 
if ($id) {  
// summarze the transaction  
$summary = owa_coreAPI::summarize(array(  
'entity' => 'base.commerce_transaction_fact',  
'columns' => array(  
'id' => 'count',  
'total_revenue' => 'sum',  
'tax_revenue' => 'sum',  
'shipping_revenue' => 'sum'),  
'constraints' => array( 'session_id' => $id ) ) );  
 
$s->set( 'commerce_trans_count', $summary['id_count'] );  
$s->set( 'commerce_trans_revenue', $summary['total_revenue_sum'] );  
$s->set( 'commerce_tax_revenue', $summary['tax_revenue_sum'] );  
$s->set( 'commerce_shipping_revenue', $summary['shipping_revenue_sum'] );  
 
// check for items and summarize if needed.  
$items = $event->get('ct_line_items');  
 
if ( ! empty( $items ) ) {  
$summary = owa_coreAPI::summarize(array(  
'entity' => 'base.commerce_line_item_fact',  
'columns' => array(  
'sku' => 'count_distinct',  
'item_revenue' => 'sum',  
'quantity' => 'sum'),  
'constraints' => array( 'session_id' => $id ) ) );  
 
$s->set( 'commerce_items_count', $summary['sku_dcount'] );  
$s->set( 'commerce_items_revenue', $summary['item_revenue_sum'] );  
$s->set( 'commerce_items_quantity', $summary['quantity_sum'] );  
}  
 
$ret = $s->update();  
 
if ($ret) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Updating session commerce transaction properties. Session does not exist yet.');  
return OWA_EHS_EVENT_FAILED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006-2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA Session Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sessionHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
if ($event->get('is_new_session')) {  
return $this->logSession($event);  
} else {  
return $this->logSessionUpdate($event);  
}  
}  
 
function logSession($event) {  
 
// Control logic  
 
$s = owa_coreAPI::entityFactory('base.session');  
 
$s->load( $event->get('session_id') );  
 
if ( ! $s->wasPersisted() ) {  
 
$s->setProperties($event->getProperties());  
 
// Set Primary Key  
$s->set( 'id', $event->get('session_id') );  
 
// set initial number of page views  
$s->set('num_pageviews', 1);  
$s->set('is_bounce', true);  
 
// set prior session time properties  
$s->set('prior_session_lastreq', $event->get('last_req'));  
 
$s->set('prior_session_id', $event->get('prior_session_id'));  
 
if ($s->get('prior_session_lastreq') > 0) {  
$s->set('time_sinse_priorsession', $s->get('timestamp') - $event->get('last_req'));  
$s->set('prior_session_year', date("Y", $event->get('last_req')));  
$s->set('prior_session_month', date("M", $event->get('last_req')));  
$s->set('prior_session_day', date("d", $event->get('last_req')));  
$s->set('prior_session_hour', date("G", $event->get('last_req')));  
$s->set('prior_session_minute', date("i", $event->get('last_req')));  
$s->set('prior_session_dayofweek', date("w", $event->get('last_req')));  
}  
 
// set last_req to be the timestamp of the event that triggered this session.  
$s->set('last_req', $event->get('timestamp'));  
$s->set('days_since_first_session', $event->get('days_since_first_session'));  
$s->set('days_since_prior_session', $event->get('days_since_prior_session'));  
$s->set('num_prior_sessions', $event->get('num_prior_sessions'));  
 
// set medium  
//$s->set('medium', $event->get('medium'));  
 
// set campaign touches  
$s->set( 'latest_attributions' , $event->get( 'attribs' ) );  
 
// Make document ids  
$s->set('first_page_id', owa_lib::setStringGuid($event->get('page_url')));  
 
$s->set('last_page_id', $s->get('first_page_id'));  
 
// Generate Referer id  
 
if ($event->get('external_referer')) {  
$s->set('referer_id', owa_lib::setStringGuid($event->get('HTTP_REFERER')));  
}  
 
// this should already be set by the request handler.  
$s->set( 'location_id', $event->get( 'location_id' ) );  
 
$ret = $s->create();  
 
// create event message  
$session = $s->_getProperties();  
$properties = array_merge($event->getProperties(), $session);  
$properties['request_id'] = $event->get('guid');  
$ne = owa_coreAPI::supportClassFactory('base', 'event');  
$ne->setProperties($properties);  
$ne->setEventType('base.new_session');  
 
// log the new session event to the event queue  
$eq = owa_coreAPI::getEventDispatch();  
$eq->notify($ne);  
 
if ($ret) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
} else {  
owa_coreAPI::debug('Not persisting new session. Session already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
function logSessionUpdate($event) {  
 
// Make entity  
$s = owa_coreAPI::entityFactory('base.session');  
 
// Fetch from session from database  
$s->getByPk('id', $event->get('session_id'));  
 
$id = $s->get('id');  
// fail safe for when there is no existing session in DB  
if (empty($id)) {  
 
owa_coreAPI::debug("Aborting session update as no existing session was found");  
return OWA_EHS_EVENT_FAILED;  
}  
 
// idempotent check needed in case updates are processed out of order.  
// dont update the database if the event timestamp is older that the last_req  
// timestamp that is already set on the session object.  
$last_req_time = $s->get('last_req');  
$event_req_time = $event->get('timestamp');  
 
$ret = false;  
 
if ($event_req_time > $last_req_time) {  
 
// increment number of page views  
$s->set('num_pageviews', $this->summarizePageviews($id));  
$s->set('is_bounce', 'false');  
 
// update timestamp of latest request that triggered the session update  
$s->set('last_req', $event->get('timestamp'));  
 
// update last page id  
$s->set('last_page_id', owa_lib::setStringGuid($event->get('page_url')));  
 
// set medium  
$s->set('medium', $event->get('medium'));  
 
// set source  
if ($event->get('source_id')) {  
$s->set('source_id', $event->get('source_id') );  
}  
 
// set search terms  
if ($event->get('referring_search_term_id')) {  
$s->set('referring_search_term_id', $event->get('referring_search_term_id') );  
}  
 
// set campaign  
if ($event->get('campaign_id')) {  
$s->set('campaign_id', $event->get('campaign_id') );  
}  
 
// set ad  
if ($event->get('ad_id')) {  
$s->set('ad_id', $event->get('ad_id') );  
}  
 
// set campaign touches  
$s->set( 'latest_attributions' , $event->get( 'attribs' ) );  
 
// Persist to database  
$ret = $s->update();  
}  
 
// setup event message  
$session = $s->_getProperties();  
$properties = array_merge($event->getProperties(), $session);  
$properties['request_id'] = $event->get('guid');  
$ne = owa_coreAPI::supportClassFactory('base', 'event');  
$ne->setProperties($properties);  
$ne->setEventType('base.session_update');  
// Log session update event to event queue  
$eq = owa_coreAPI::getEventDispatch();  
$ret = $eq->notify( $ne );  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
}  
 
function summarizePageviews($id) {  
 
$ret = owa_coreAPI::summarize(array(  
'entity' => 'base.request',  
'columns' => array('id' => 'count_distinct'),  
'constraints' => array( 'session_id' => $id ) ) );  
 
return $ret['id_dcount'];  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_DIR.'owa_observer.php');  
}  
 
/**  
* Source Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_sourceHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
if ($event->get('source')) {  
$s = owa_coreAPI::entityFactory('base.source_dim');  
 
$new_id = $s->generateId( trim( strtolower( $event->get('source') ) ) );  
$s->getByPk('id', $new_id);  
$id = $s->get('id');  
 
if (!$id) {  
 
$s->set('id', $new_id);  
$s->set('source_domain', $event->get('source'));  
$ret = $s->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('Not Persisting. Source already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
} else {  
owa_coreAPI::debug('Noting to handle. No source properties found on event.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA User Agent Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_userAgentHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$ua = owa_coreAPI::entityFactory('base.ua');  
 
$ua->getByColumn('id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));  
 
if (!$ua->get('id')) {  
 
$ua->setProperties($event->getProperties());  
$ua->set('ua', $event->get('HTTP_USER_AGENT'));  
$ua->set('id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));  
$ret = $ua->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
 
owa_coreAPI::debug('not logging, user agent already exists.');  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
/**  
* OWA user management Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_userHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
$this->m = $event;  
 
switch ($event->getEventType()) {  
case "base.reset_password":  
$this->handleEvent('base.usersResetPassword');  
break;  
case "base.set_password":  
$this->handleEvent('base.usersSetPassword');  
break;  
case "base.new_user_account":  
$this->handleEvent('base.usersNewAccount');  
break;  
}  
 
return OWA_EHS_EVENT_HANDLED;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('owa_observer')) {  
require_once(OWA_BASE_DIR.'owa_observer.php');  
}  
 
 
/**  
* OWA Visitor Event handlers  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_visitorHandlers extends owa_observer {  
 
/**  
* Notify Event Handler  
*  
* @param unknown_type $event  
* @access public  
*/  
function notify($event) {  
 
switch ($event->get('is_new_visitor')) {  
 
case true:  
return $this->logVisitor($event);  
 
case false:  
return $this->logVisitorUpdate($event);  
break;  
}  
}  
 
function logVisitor($event) {  
 
$v = owa_coreAPI::entityFactory('base.visitor');  
 
$v->load( $event->get( 'visitor_id' ) );  
 
if ( ! $v->wasPersisted() ) {  
 
$v->setProperties($event->getProperties());  
 
// Set Primary Key  
$v->set( 'id', $event->get('visitor_id') );  
 
$v->set('user_name', $event->get('user_name'));  
$v->set('user_email', $event->get('user_email'));  
$v->set('first_session_id', $event->get('session_id'));  
$v->set('first_session_year', $event->get('year'));  
$v->set('first_session_month', $event->get('month'));  
$v->set('first_session_day', $event->get('day'));  
$v->set('first_session_dayofyear', $event->get('dayofyear'));  
$v->set('first_session_timestamp', $event->get('timestamp'));  
$v->set('num_prior_sessions', $event->get('num_prior_sessions'));  
$ret = $v->create();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug("Not persisting. Visitor already exists.");  
return OWA_EHS_EVENT_HANDLED;  
}  
}  
 
function logVisitorUpdate($event) {  
 
$v = owa_coreAPI::entityFactory('base.visitor');  
 
$v->load( $event->get('visitor_id' ) );  
 
if ( $v->wasPersisted() ) {  
if ( $event->get( 'user_name' ) ) {  
$v->set( 'user_name', $event->get( 'user_name' ) );  
}  
 
if ($event->get('user_email')) {  
$v->set('user_email', $event->get('user_email'));  
}  
$v->set('last_session_id', $event->get('session_id'));  
$v->set('last_session_year', $event->get('year'));  
$v->set('last_session_month', $event->get('month'));  
$v->set('last_session_day', $event->get('day'));  
$v->set('last_session_dayofyear', $event->get('dayofyear'));  
$v->set('num_prior_sessions', $event->get('num_prior_sessions'));  
$ret = $v->update();  
 
if ( $ret ) {  
return OWA_EHS_EVENT_HANDLED;  
} else {  
return OWA_EHS_EVENT_FAILED;  
}  
 
} else {  
owa_coreAPI::debug("Not updating visitor. Visitor does not exists, adding it now.");  
return $this->logVisitor($event);  
//return OWA_EHS_EVENT_FAILED;  
}  
}  
}  
 
?>  
 Binary files a/busui/owa/modules/base/i/15px-TriangleArrow-Down.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/15px-TriangleArrow-Up.svg.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/aol.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/camino.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/chrome.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/default.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/firefox.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/flock.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/galeon.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/icab.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie4.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie5-mac.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie5.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie6.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/ie7.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/konqueror.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/netscape.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/netscape8.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/netscape9.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/omniweb.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/opera.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/safari.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/seamonkey.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/shiira.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/browsers/128x128/swift.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/camino.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/comment_background.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/cursor.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/cursor2.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/default_browser.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/default_user_50x50.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/document_icon.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/i/document_icon_128.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/document_icon_64.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/firefox.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/funnel_entrance_arrow.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/funnel_exit_arrow.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/funnel_flow.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/funnel_step.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/icon_new.png and /dev/null differ
<?php  
// ...  
?>  
 Binary files a/busui/owa/modules/base/i/kml_feed_small.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/kon.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/linux.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/loading.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/i/mac.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/mediawiki_icon_50h.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/mozilla.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/msie.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/netscape.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/newuser_icon_small.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/opera.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/owa-logo-100w.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/owa_logo_150w.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/owa_logo_72w.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/referer_icon.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/i/referral_icon_64.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/safari.png and /dev/null differ
<svg xmlns="http://www.w3.org/2000/svg">  
 
 
<filter id="f1">  
<feGaussianBlur stdDeviation="4" result="blur"/>  
</filter>  
 
</svg>  
 
 Binary files a/busui/owa/modules/base/i/user_icon_large.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/user_icon_small.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/i/user_icon_small.jpg and /dev/null differ
 Binary files a/busui/owa/modules/base/i/user_icon_small.png and /dev/null differ
 Binary files a/busui/owa/modules/base/i/winxp.png and /dev/null differ
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Installation View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installView extends owa_view {  
 
function __construct() {  
 
$this->default_subview = 'base.installStart';  
return parent::__construct();  
}  
 
function render($data) {  
 
//page title  
$this->t->set('page_title', 'Installation');  
 
// load wrapper template  
$this->t->set_template('wrapper_public.tpl');  
// load body template  
$this->body->set_template('install.tpl');  
 
// fetch admin links from all modules  
//  
 
$this->body->set('headline', 'Welcome to the Open Web Analytics Installation Wizard');  
$this->body->set('step', $data['subview']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* base Schema Installation Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installBaseController extends owa_installController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
// require nonce  
$this->setNonceRequired();  
 
// validations  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($this->getParam('domain'));  
$v1->setErrorMessage($this->getMsg(3309));  
$this->setValidation('domain', $v1);  
 
// validations  
$v2 = owa_coreAPI::validationFactory('required');  
$v2->setValues($this->getParam('email_address'));  
$v2->setErrorMessage($this->getMsg(3310));  
$this->setValidation('email_address', $v2);  
 
// Check entity exists  
$v3 = owa_coreAPI::validationFactory('entityDoesNotExist');  
$v3->setConfig('entity', 'base.site');  
$v3->setConfig('column', 'domain');  
$v3->setValues($this->getParam('protocol').$this->getParam('domain'));  
$v3->setErrorMessage($this->getMsg(3206));  
$this->setValidation('domain', $v3);  
 
// Config for the domain validation  
$v4 = owa_coreAPI::validationFactory('subStringPosition');  
$v4->setConfig('subString', 'http');  
$v4->setValues($this->getParam('domain'));  
$v4->setConfig('position', 0);  
$v4->setConfig('operator', '!=');  
$v4->setErrorMessage($this->getMsg(3208));  
$this->setValidation('domain', $v4);  
}  
 
function action() {  
 
$status = $this->installSchema();  
 
if ($status == true) {  
$this->set('status_code', 3305);  
 
$password = $this->createAdminUser($this->getParam('email_address'));  
 
$site_id = $this->createDefaultSite($this->getParam('protocol').$this->getParam('domain'));  
 
// Set install complete flag.  
$this->c->persistSetting('base', 'install_complete', true);  
$save_status = $this->c->save();  
 
if ($save_status == true) {  
$this->e->notice('Install Complete Flag added to configuration');  
} else {  
$this->e->notice('Could not add Install Complete Flag to configuration.');  
}  
 
// fire install complete event.  
$eq = &eventQueue::get_instance();  
$event = $eq->eventFactory();  
$event->set('u', 'admin');  
$event->set('p', $password);  
$event->set('site_id', $site_id);  
$event->setEventType('install_complete');  
$eq->notify($event);  
 
// set view  
$this->set('u', 'admin');  
$this->set('p', $password);  
$this->set('site_id', $site_id);  
$this->setView('base.install');  
$this->setSubview('base.installFinish');  
//$this->set('status_code', 3304);  
 
} else {  
 
$this->set('error_msg', $this->getMsg(3302));  
$this->errorAction();  
}  
 
return;  
}  
 
function errorAction() {  
 
$this->set('defaults', $this->params);  
$this->setView('base.install');  
$this->setSubView('base.installDefaultsEntry');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* Server Environment Check Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installCheckEnvController extends owa_installController {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$errors = array();  
$bad_environment = false;  
$config_file_present = false;  
 
// check PHP version  
$version = split('\.',phpversion());  
 
if ($version[0] < 5) {  
$errors['php_version']['name'] = 'PHP Version';  
$errors['php_version']['value'] = phpversion();  
$errors['php_version']['msg'] = $this->getMsg(3301);  
$bad_environment = true;  
}  
 
// Check permissions on log directory  
 
// Check for Windows OS  
$os = php_uname("s");  
if (strtoupper(substr($os, 0, 3)) === 'WIN') {  
$errors['php_os']['value'] = 'Operating System';  
$errors['php_os']['value'] = $os;  
$errors['php_os']['msg'] = 'You are running PHP on an Operating System that OWA does not support.';  
$bad_environment = true;  
}  
 
// Check for config file and then test the db connection  
if ($this->c->isConfigFilePresent()) {  
$config_file_present = true;  
$conn = $this->checkDbConnection();  
if ($conn != true) {  
$errors['db']['name'] = 'Database Connection';  
$errors['db']['value'] = 'Connection failed';  
$errors['db']['msg'] = 'Check the connection settings in your configuration file.' ;  
$bad_environment = true;  
}  
}  
 
// if the environment is good  
if ($bad_environment != true) {  
// and the config file is present  
if ($config_file_present === true) {  
//skip to defaults entry step  
$this->setRedirectAction('base.installDefaultsEntry');  
return;  
} else {  
// otherwise show config file entry form  
$this->setView('base.install');  
// Todo: prepopulate public URL.  
//$config = array('public_url', $url);  
//$this->set('config', $config);  
$this->setSubview('base.installConfigEntry');  
return;  
}  
// if the environment is bad, then show environment error details.  
} else {  
$this->set('errors', $errors);  
$this->setView('base.install');  
$this->setSubview('base.installCheckEnv');  
}  
}  
}  
 
/**  
* Installer Server Environment Setup Check View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installCheckEnvView extends owa_view {  
 
function render($data) {  
 
//page title  
$this->t->set('page_title', 'Server Environment Check');  
$this->body->set('errors', $this->get('errors'));  
// load body template  
$this->body->set_template('install_check_env.tpl');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Installation CLI Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installCliController extends owa_cliController {  
 
function __construct($params) {  
define('OWA_INSTALLING', true);  
return parent::__construct($params);  
}  
 
function action() {  
 
$service = &owa_coreAPI::serviceSingleton();  
$im = owa_coreAPI::supportClassFactory('base', 'installManager');  
$this->e->notice('Starting OWA Install from command line.');  
 
//create config file  
$present = $this->c->isConfigFilePresent();  
 
if ( $present ) {  
 
$this->c->applyConfigConstants();  
 
// install schema  
$status = $im->installSchema();  
 
// schema was installed successfully  
if ($status === true) {  
 
//create admin user  
//owa_coreAPI::debug('password: '.owa_lib::encryptPassword( $this->c->get('base', 'db_password') ) );  
$im->createAdminUser($this->getParam('email_address'), $this->getParam('real_name'), $this->c->get('base', 'db_password') );  
 
// create default site  
$im->createDefaultSite(  
$this->getParam('domain'),  
$this->getParam('domain'),  
$this->getParam('description'),  
$this->getParam('site_family')  
);  
 
// Persist install complete flag.  
$this->c->persistSetting('base', 'install_complete', true);  
$save_status = $this->c->save();  
 
if ($save_status === true) {  
$this->e->notice('Install Completed.');  
} else {  
$this->e->notice('Could not persist Install Complete Flag to the Database');  
}  
 
// schema was not installed successfully  
} else {  
$this->e->notice('Aborting embedded install due to errors installing schema. Try dropping all OWA tables and try again.');  
return false;  
}  
 
 
} else {  
$this->e->notice("Could not locate config file. Aborting installation.");  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* Install Configuration Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installConfigController extends owa_installController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
// require nonce  
$this->setNonceRequired();  
 
//required params  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($this->getParam('db_host'));  
$v1->setErrorMessage("Database host is required.");  
$this->setValidation('db_host', $v1);  
 
$v2 = owa_coreAPI::validationFactory('required');  
$v2->setValues($this->getParam('db_name'));  
$v2->setErrorMessage("Database name is required.");  
$this->setValidation('db_name', $v2);  
 
$v3 = owa_coreAPI::validationFactory('required');  
$v3->setValues($this->getParam('db_user'));  
$v3->setErrorMessage("Database user is required.");  
$this->setValidation('db_user', $v3);  
 
$v4 = owa_coreAPI::validationFactory('required');  
$v4->setValues($this->getParam('db_password'));  
$v4->setErrorMessage("Database password is required.");  
$this->setValidation('db_password', $v4);  
 
$v7 = owa_coreAPI::validationFactory('required');  
$v7->setValues($this->getParam('db_type'));  
$v7->setErrorMessage("Database type is required.");  
$this->setValidation('db_type', $v7);  
 
// Config for the public_url validation  
$v5 = owa_coreAPI::validationFactory('subStringMatch');  
$v5->setConfig('match', '/');  
$v5->setConfig('length', 1);  
$v5->setValues($this->getParam('public_url'));  
$v5->setConfig('position', -1);  
$v5->setConfig('operator', '=');  
$v5->setErrorMessage("Your URL of OWA's base directory must end with a slash.");  
$this->setValidation('public_url', $v5);  
 
// Config for the domain validation  
$v6 = owa_coreAPI::validationFactory('subStringPosition');  
$v6->setConfig('subString', 'http');  
$v6->setValues($this->getParam('public_url'));  
$v6->setConfig('position', 0);  
$v6->setConfig('operator', '=');  
$v6->setErrorMessage("Please add http:// or https:// to the beginning of your public url.");  
$this->setValidation('public_url', $v6);  
}  
 
function action() {  
 
// define db connection constants using values submitted  
if ( ! defined( 'OWA_DB_TYPE' ) ) {  
define( 'OWA_DB_TYPE', $this->getParam( 'db_type' ) );  
}  
 
if ( ! defined( 'OWA_DB_HOST' ) ) {  
define('OWA_DB_HOST', $this->getParam( 'db_host' ) );  
}  
 
if ( ! defined( 'OWA_DB_NAME' ) ) {  
define('OWA_DB_NAME', $this->getParam( 'db_name' ) );  
}  
 
if ( ! defined( 'OWA_DB_USER' ) ) {  
define('OWA_DB_USER', $this->getParam( 'db_user' ) );  
}  
 
if ( ! defined( 'OWA_DB_PASSWORD' ) ) {  
define('OWA_DB_PASSWORD', $this->getParam( 'db_password' ) );  
}  
 
owa_coreAPI::setSetting('base', 'db_type', OWA_DB_TYPE);  
owa_coreAPI::setSetting('base', 'db_host', OWA_DB_HOST);  
owa_coreAPI::setSetting('base', 'db_name', OWA_DB_NAME);  
owa_coreAPI::setSetting('base', 'db_user', OWA_DB_USER);  
owa_coreAPI::setSetting('base', 'db_password', OWA_DB_PASSWORD);  
 
// Check DB connection status  
$db = &owa_coreAPI::dbSingleton();  
$db->connect();  
if ($db->connection_status != true) {  
$this->set('error_msg', $this->getMsg(3012));  
$this->set('config', $this->params);  
$this->setView('base.install');  
$this->setSubview('base.installConfigEntry');  
 
} else {  
//create config file  
$this->c->createConfigFile($this->params);  
$this->setRedirectAction('base.installDefaultsEntry');  
}  
 
// Check socket connection  
 
// Check permissions on log directory  
 
 
return;  
}  
 
function errorAction() {  
$this->set('config', $this->params);  
$this->setView('base.install');  
$this->setSubview('base.installConfigEntry');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Installer Configuration Entry View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installConfigEntryView extends owa_view {  
 
function render($data) {  
 
//page title  
$this->t->set('page_title', 'Configuration File Generator');  
// load body template  
$this->body->set('config', $this->get('config'));  
$this->body->set_template('install_config_entry.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* Install Configuration Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installDefaultsEntryController extends owa_installController {  
 
function action() {  
 
$this->setView('base.install');  
$this->setSubview('base.installDefaultsEntry');  
}  
}  
 
/**  
* Installer Defaults Entry  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
class owa_installDefaultsEntryView extends owa_view {  
 
function render($data) {  
 
// page title  
$this->t->set('page_title', 'OWA User / Site Setup');  
// set defaults  
$this->body->set('defaults', $this->get('defaults'));  
// load body template  
$this->body->set_template('install_defaults_entry.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
 
class owa_installDetectedController extends owa_controller {  
 
function action() {  
 
$this->setView('base.install');  
$this->setSubview('base.installDetected');  
}  
}  
 
/**  
* Installation Detected View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_installDetectedView extends owa_view {  
 
function render() {  
 
$this->body->set_template('install_schema_detected.tpl');  
 
//page title  
$this->t->set('page_title', 'OWA Installation Detected');  
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* Embedded Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installEmbeddedController extends owa_installController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
 
}  
 
function action() {  
 
$service = &owa_coreAPI::serviceSingleton();  
 
$this->e->notice('starting Embedded install');  
 
//create config file  
 
$this->c->createConfigFile($this->params);  
$this->c->applyConfigConstants();  
// install schema  
$base = $service->getModule('base');  
$status = $base->install();  
 
// schema was installed successfully  
if ($status === true) {  
 
//create admin user  
$cu = owa_coreAPI::getCurrentUser();  
$this->createAdminUser($cu->getUserData('email_address'), $cu->getUserData('real_name'));  
 
// create default site  
$this->createDefaultSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'), $this->getParam('site_id'));  
 
// Persist install complete flag.  
$this->c->persistSetting('base', 'install_complete', true);  
$save_status = $this->c->save();  
 
if ($save_status === true) {  
$this->e->notice('Install Complete Flag added to configuration');  
} else {  
$this->e->notice('Could not persist Install Complete Flag to the Database');  
}  
 
$this->setView('base.installFinishEmbedded');  
 
// schema was not installed successfully  
} else {  
$this->e->notice('Aborting embedded install due to errors installing schema. Try dropping all OWA tables and try again.');  
return false;  
}  
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
 
/**  
* Installation Finish  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
// needed??  
class owa_installFinishController extends owa_installController {  
 
function action() {  
 
// Persist install complete flag.  
$this->c->setSetting('base', 'install_complete', true);  
$save_status = $this->c->save();  
 
if ($save_status == true) {  
$this->e->notice('Install Complete Flag added to configuration');  
} else {  
$this->e->notice('Could not persist Install Complete Flag to the Database');  
}  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->getByPk('id', '1');  
$this->setView('base.install');  
$this->setSubview('base.installFinish');  
$this->set('site_id', $site->get('site_id'));  
$this->set('u', $this->getParam('u'));  
$this->set('p', $this->getParam('p'));  
}  
}  
 
 
class owa_installFinishView extends owa_view {  
 
function render($data) {  
 
// Set Page title  
$this->t->set('page_title', 'Installation Complete');  
 
// Set Page headline  
$this->body->set('headline', 'Installation is Complete');  
 
$this->body->set('site_id', $this->get('site_id'));  
$this->body->set('u', $this->get('u'));  
$this->body->set('p', $this->get('p'));  
// load body template  
$this->body->set_template('install_finish.tpl');  
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Installation Finish Embedded Configuration  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_installFinishEmbeddedView extends owa_view {  
 
function __construct() {  
 
$this->priviledge_level = 'guest';  
return parent::__construct();  
}  
 
function render($data) {  
 
// Set Page title  
$this->t->set('page_title', 'Installation Complete');  
 
// Set Page headline  
$this->body->set('headline', 'Installation is Complete');  
 
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('install_finish_embedded.tpl');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'installController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
 
class owa_installStartController extends owa_installController {  
 
function action() {  
 
$this->setView('base.install');  
$this->setSubview('base.installStart');  
}  
}  
 
/**  
* Installation View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_installStartView extends owa_view {  
 
function render() {  
 
$this->body->set_template('install_start.tpl');  
//page title  
$this->t->set('page_title', 'OWA Installation Start');  
// fetch admin links from all modules  
$this->body->set('headline', 'Get Started...');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
/**  
* Installation Start Controller for Embedded Configurations  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_installStartEmbeddedController extends owa_controller {  
 
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$this->set('site_id', $this->getParam('site_id'));  
$this->set('name', $this->getParam('name'));  
$this->set('domain', $this->getParam('domain'));  
$this->set('description', $this->getParam('description'));  
 
$this->set('db_type', $this->getParam('db_type'));  
$this->set('db_user', $this->getParam('db_user'));  
$this->set('db_password', $this->getParam('db_password'));  
$this->set('db_host', $this->getParam('db_host'));  
$this->set('db_name', $this->getParam('db_name'));  
$this->set('public_url', $this->getParam('public_url'));  
 
$this->setView('base.installStartEmbedded');  
}  
}  
 
/**  
* Installation Start View for Embedded Configurations  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_installStartEmbeddedView extends owa_view {  
 
function render() {  
 
$this->body->set_template('install_start_embedded.tpl');  
 
//page title  
$this->t->set_template('wrapper_public.tpl');  
$this->t->set('page_title', 'Open Web Analytics Installation');  
 
// assign data  
$this->body->set('headline', 'Shall we install Open Web Analytics?');  
$this->body->set('site_id', $this->get('site_id'));  
$this->body->set('domain', $this->get('domain'));  
$this->body->set('name', $this->get('name'));  
$this->body->set('description', $this->get('description'));  
 
$this->body->set('db_type', $this->get('db_type'));  
$this->body->set('db_user', $this->get('db_user'));  
$this->body->set('db_password', $this->get('db_password'));  
$this->body->set('db_host', $this->get('db_host'));  
$this->body->set('db_name', $this->get('db_name'));  
$this->body->set('public_url', $this->get('public_url'));  
}  
}  
 
?>  
/*************************************************************  
* DYNIFS - Dynamic IFrame Auto Size v1.0.0  
*  
* Copyright (C) 2006, Markus (phpMiX)  
* This script is released under GPL License.  
* Feel free to use this script (or part of it) wherever you need  
* it ...but please, give credit to original author. Thank you. :-)  
* We will also appreciate any links you could give us.  
* http://www.phpmix.org  
*  
* Enjoy! ;-)  
*************************************************************/  
 
var DYNIFS = {  
// Storage for known IFrames.  
iframes: {},  
// Here we save any previously installed onresize handler.  
oldresize: null,  
// Flag that tell us if we have already installed our onresize handler.  
ready: false,  
// The document dimensions last time onresize was executed.  
dim: [-1,-1],  
// Timer ID used to defer the actual resize action.  
timerID: 0,  
// Obtain the dimensions (width,height) of the given document.  
getDim: function(d) {  
var w=200, h=200, scr_h, off_h;  
if( d.height ) { return [d.width,d.height]; }  
with( d.body ) {  
if( scrollHeight ) { h=scr_h=scrollHeight; w=scrollWidth; }  
if( offsetHeight ) { h=off_h=offsetHeight; w=offsetWidth; }  
if( scr_h && off_h ) h=Math.max(scr_h, off_h);  
}  
return [w,h];  
},  
// This is our window.onresize handler.  
onresize: function() {  
// Invoke any previously installed onresize handler.  
if( typeof this.oldresize == 'function' ) { this.oldresize(); }  
// Check if the document dimensions really changed.  
var dim = this.getDim(document);  
if( this.dim[0] == dim[0] && this.dim[1] == dim[1] ) return;  
// Defer the resize action to prevent endless loop in quirksmode.  
if( this.timerID ) return;  
this.timerID = setTimeout('DYNIFS.deferred_resize();', 10);  
},  
// This is where the actual IFrame resize is invoked.  
deferred_resize: function() {  
// Walk the list of known IFrames to see if they need to be resized.  
for( var id in this.iframes ) this.resize(id);  
// Store resulting document dimensions.  
this.dim = this.getDim(document);  
// Clear the timer flag.  
this.timerID = 0;  
},  
// This is invoked when the IFrame is loaded or when the main window is resized.  
resize: function(id) {  
// Browser compatibility check.  
if( !window.frames || !window.frames[id] || !document.getElementById || !document.body )  
return;  
// Get references to the IFrame window and layer.  
var iframe = window.frames[id];  
var div = document.getElementById(id);  
if( !div ) return;  
// Save the IFrame id for later use in our onresize handler.  
if( !this.iframes[id] ) {  
this.iframes[id] = true;  
}  
// Should we inject our onresize event handler?  
if( !this.ready ) {  
this.ready = true;  
this.oldresize = window.onresize;  
window.onresize = new Function('DYNIFS.onresize();');  
}  
// This appears to be necessary in MSIE to compute the height  
// when the IFrame'd document is in quirksmode.  
// OTOH, it doesn't seem to break anything in standards mode, so...  
if( document.all ) div.style.height = '0px';  
// Resize the IFrame container.  
var dim = this.getDim(iframe.document);  
div.style.height = (dim[1]+30) + 'px';  
}  
};  
// Copyright 2006 Google Inc.  
//  
// Licensed under the Apache License, Version 2.0 (the "License");  
// you may not use this file except in compliance with the License.  
// You may obtain a copy of the License at  
//  
// http://www.apache.org/licenses/LICENSE-2.0  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||  
b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])},  
initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case "width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect();  
break;case "height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]=  
h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+  
1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b;  
var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};  
i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+  
0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b,  
a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b,  
a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length==  
5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=",  
this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src,  
'"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="',  
!b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case "moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case "lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case "close":a.push(" x ");e=null;break;case "bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case "at":case "wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius),  
" ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),  
z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+  
o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap),  
'"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),  
this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,  
0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=  
M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();  
 
<?php  
// ...  
?>  
Flot Reference  
--------------  
 
Consider a call to the plot function:  
 
var plot = $.plot(placeholder, data, options)  
 
The placeholder is a jQuery object or DOM element or jQuery expression  
that the plot will be put into. This placeholder needs to have its  
width and height set as explained in the README (go read that now if  
you haven't, it's short). The plot will modify some properties of the  
placeholder so it's recommended you simply pass in a div that you  
don't use for anything else. Make sure you check any fancy styling  
you apply to the div, e.g. background images have been reported to be a  
problem on IE 7.  
 
The format of the data is documented below, as is the available  
options. The "plot" object returned has some methods you can call.  
These are documented separately below.  
 
Note that in general Flot gives no guarantees if you change any of the  
objects you pass in to the plot function or get out of it since  
they're not necessarily deep-copied.  
 
 
Data Format  
-----------  
 
The data is an array of data series:  
 
[ series1, series2, ... ]  
 
A series can either be raw data or an object with properties. The raw  
data format is an array of points:  
 
[ [x1, y1], [x2, y2], ... ]  
 
E.g.  
 
[ [1, 3], [2, 14.01], [3.5, 3.14] ]  
 
Note that to simplify the internal logic in Flot both the x and y  
values must be numbers (even if specifying time series, see below for  
how to do this). This is a common problem because you might retrieve  
data from the database and serialize them directly to JSON without  
noticing the wrong type. If you're getting mysterious errors, double  
check that you're inputting numbers and not strings.  
 
If a null is specified as a point or if one of the coordinates is null  
or couldn't be converted to a number, the point is ignored when  
drawing. As a special case, a null value for lines is interpreted as a  
line segment end, i.e. the points before and after the null value are  
not connected.  
 
Lines and points take two coordinates. For bars, you can specify a  
third coordinate which is the bottom of the bar (defaults to 0).  
 
The format of a single series object is as follows:  
 
{  
color: color or number  
data: rawdata  
label: string  
lines: specific lines options  
bars: specific bars options  
points: specific points options  
xaxis: 1 or 2  
yaxis: 1 or 2  
clickable: boolean  
hoverable: boolean  
shadowSize: number  
}  
 
You don't have to specify any of them except the data, the rest are  
options that will get default values. Typically you'd only specify  
label and data, like this:  
 
{  
label: "y = 3",  
data: [[0, 3], [10, 3]]  
}  
 
The label is used for the legend, if you don't specify one, the series  
will not show up in the legend.  
 
If you don't specify color, the series will get a color from the  
auto-generated colors. The color is either a CSS color specification  
(like "rgb(255, 100, 123)") or an integer that specifies which of  
auto-generated colors to select, e.g. 0 will get color no. 0, etc.  
 
The latter is mostly useful if you let the user add and remove series,  
in which case you can hard-code the color index to prevent the colors  
from jumping around between the series.  
 
The "xaxis" and "yaxis" options specify which axis to use, specify 2  
to get the secondary axis (x axis at top or y axis to the right).  
E.g., you can use this to make a dual axis plot by specifying  
{ yaxis: 2 } for one data series.  
 
"clickable" and "hoverable" can be set to false to disable  
interactivity for specific series if interactivity is turned on in  
the plot, see below.  
 
The rest of the options are all documented below as they are the same  
as the default options passed in via the options parameter in the plot  
commmand. When you specify them for a specific data series, they will  
override the default options for the plot for that data series.  
 
Here's a complete example of a simple data specification:  
 
[ { label: "Foo", data: [ [10, 1], [17, -14], [30, 5] ] },  
{ label: "Bar", data: [ [11, 13], [19, 11], [30, -7] ] } ]  
 
 
Plot Options  
------------  
 
All options are completely optional. They are documented individually  
below, to change them you just specify them in an object, e.g.  
 
var options = {  
series: {  
lines: { show: true },  
points: { show: true }  
}  
};  
 
$.plot(placeholder, data, options);  
 
 
Customizing the legend  
======================  
 
legend: {  
show: boolean  
labelFormatter: null or (fn: string, series object -> string)  
labelBoxBorderColor: color  
noColumns: number  
position: "ne" or "nw" or "se" or "sw"  
margin: number of pixels or [x margin, y margin]  
backgroundColor: null or color  
backgroundOpacity: number between 0 and 1  
container: null or jQuery object/DOM element/jQuery expression  
}  
 
The legend is generated as a table with the data series labels and  
small label boxes with the color of the series. If you want to format  
the labels in some way, e.g. make them to links, you can pass in a  
function for "labelFormatter". Here's an example that makes them  
clickable:  
 
labelFormatter: function(label, series) {  
// series is the series object for the label  
return '<a href="#' + label + '">' + label + '</a>';  
}  
 
"noColumns" is the number of columns to divide the legend table into.  
"position" specifies the overall placement of the legend within the  
plot (top-right, top-left, etc.) and margin the distance to the plot  
edge (this can be either a number or an array of two numbers like [x,  
y]). "backgroundColor" and "backgroundOpacity" specifies the  
background. The default is a partly transparent auto-detected  
background.  
 
If you want the legend to appear somewhere else in the DOM, you can  
specify "container" as a jQuery object/expression to put the legend  
table into. The "position" and "margin" etc. options will then be  
ignored. Note that Flot will overwrite the contents of the container.  
 
 
Customizing the axes  
====================  
 
xaxis, yaxis, x2axis, y2axis: {  
mode: null or "time"  
min: null or number  
max: null or number  
autoscaleMargin: null or number  
 
labelWidth: null or number  
labelHeight: null or number  
 
transform: null or fn: number -> number  
inverseTransform: null or fn: number -> number  
 
ticks: null or number or ticks array or (fn: range -> ticks array)  
tickSize: number or array  
minTickSize: number or array  
tickFormatter: (fn: number, object -> string) or string  
tickDecimals: null or number  
}  
 
All axes have the same kind of options. The "mode" option  
determines how the data is interpreted, the default of null means as  
decimal numbers. Use "time" for time series data, see the next section.  
 
The options "min"/"max" are the precise minimum/maximum value on the  
scale. If you don't specify either of them, a value will automatically  
be chosen based on the minimum/maximum data values.  
 
The "autoscaleMargin" is a bit esoteric: it's the fraction of margin  
that the scaling algorithm will add to avoid that the outermost points  
ends up on the grid border. Note that this margin is only applied  
when a min or max value is not explicitly set. If a margin is  
specified, the plot will furthermore extend the axis end-point to the  
nearest whole tick. The default value is "null" for the x axis and  
0.02 for the y axis which seems appropriate for most cases.  
 
"labelWidth" and "labelHeight" specifies a fixed size of the tick  
labels in pixels. They're useful in case you need to align several  
plots.  
 
"transform" and "inverseTransform" are callbacks you can put in to  
change the way the data is drawn. You can design a function to  
compress or expand certain parts of the axis non-linearly, e.g.  
suppress weekends or compress far away points with a logarithm or some  
other means. When Flot draws the plot, each value is first put through  
the transform function. Here's an example, the x axis can be turned  
into a natural logarithm axis with the following code:  
 
xaxis: {  
transform: function (v) { return Math.log(v); },  
inverseTransform: function (v) { return Math.exp(v); }  
}  
 
Note that for finding extrema, Flot assumes that the transform  
function does not reorder values (monotonicity is assumed).  
 
The inverseTransform is simply the inverse of the transform function  
(so v == inverseTransform(transform(v)) for all relevant v). It is  
required for converting from canvas coordinates to data coordinates,  
e.g. for a mouse interaction where a certain pixel is clicked. If you  
don't use any interactive features of Flot, you may not need it.  
 
 
The rest of the options deal with the ticks.  
 
If you don't specify any ticks, a tick generator algorithm will make  
some for you. The algorithm has two passes. It first estimates how  
many ticks would be reasonable and uses this number to compute a nice  
round tick interval size. Then it generates the ticks.  
 
You can specify how many ticks the algorithm aims for by setting  
"ticks" to a number. The algorithm always tries to generate reasonably  
round tick values so even if you ask for three ticks, you might get  
five if that fits better with the rounding. If you don't want any  
ticks at all, set "ticks" to 0 or an empty array.  
 
Another option is to skip the rounding part and directly set the tick  
interval size with "tickSize". If you set it to 2, you'll get ticks at  
2, 4, 6, etc. Alternatively, you can specify that you just don't want  
ticks at a size less than a specific tick size with "minTickSize".  
Note that for time series, the format is an array like [2, "month"],  
see the next section.  
 
If you want to completely override the tick algorithm, you can specify  
an array for "ticks", either like this:  
 
ticks: [0, 1.2, 2.4]  
 
Or like this where the labels are also customized:  
 
ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]]  
 
You can mix the two if you like.  
 
For extra flexibility you can specify a function as the "ticks"  
parameter. The function will be called with an object with the axis  
min and max and should return a ticks array. Here's a simplistic tick  
generator that spits out intervals of pi, suitable for use on the x  
axis for trigonometric functions:  
 
function piTickGenerator(axis) {  
var res = [], i = Math.floor(axis.min / Math.PI);  
do {  
var v = i * Math.PI;  
res.push([v, i + "\u03c0"]);  
++i;  
} while (v < axis.max);  
 
return res;  
}  
 
 
You can control how the ticks look like with "tickDecimals", the  
number of decimals to display (default is auto-detected).  
 
Alternatively, for ultimate control over how ticks look like you can  
provide a function to "tickFormatter". The function is passed two  
parameters, the tick value and an "axis" object with information, and  
should return a string. The default formatter looks like this:  
 
function formatter(val, axis) {  
return val.toFixed(axis.tickDecimals);  
}  
 
The axis object has "min" and "max" with the range of the axis,  
"tickDecimals" with the number of decimals to round the value to and  
"tickSize" with the size of the interval between ticks as calculated  
by the automatic axis scaling algorithm (or specified by you). Here's  
an example of a custom formatter:  
 
function suffixFormatter(val, axis) {  
if (val > 1000000)  
return (val / 1000000).toFixed(axis.tickDecimals) + " MB";  
else if (val > 1000)  
return (val / 1000).toFixed(axis.tickDecimals) + " kB";  
else  
return val.toFixed(axis.tickDecimals) + " B";  
}  
 
Time series data  
================  
 
Time series are a bit more difficult than scalar data because  
calendars don't follow a simple base 10 system. For many cases, Flot  
abstracts most of this away, but it can still be a bit difficult to  
get the data into Flot. So we'll first discuss the data format.  
 
The time series support in Flot is based on Javascript timestamps,  
i.e. everywhere a time value is expected or handed over, a Javascript  
timestamp number is used. This is a number, not a Date object. A  
Javascript timestamp is the number of milliseconds since January 1,  
1970 00:00:00 UTC. This is almost the same as Unix timestamps, except it's  
in milliseconds, so remember to multiply by 1000!  
 
You can see a timestamp like this  
 
alert((new Date()).getTime())  
 
Normally you want the timestamps to be displayed according to a  
certain time zone, usually the time zone in which the data has been  
produced. However, Flot always displays timestamps according to UTC.  
It has to as the only alternative with core Javascript is to interpret  
the timestamps according to the time zone that the visitor is in,  
which means that the ticks will shift unpredictably with the time zone  
and daylight savings of each visitor.  
 
So given that there's no good support for custom time zones in  
Javascript, you'll have to take care of this server-side.  
 
The easiest way to think about it is to pretend that the data  
production time zone is UTC, even if it isn't. So if you have a  
datapoint at 2002-02-20 08:00, you can generate a timestamp for eight  
o'clock UTC even if it really happened eight o'clock UTC+0200.  
 
In PHP you can get an appropriate timestamp with  
'strtotime("2002-02-20 UTC") * 1000', in Python with  
'calendar.timegm(datetime_object.timetuple()) * 1000', in .NET with  
something like:  
 
public static int GetJavascriptTimestamp(System.DateTime input)  
{  
System.TimeSpan span = new System.TimeSpan(System.DateTime.Parse("1/1/1970").Ticks);  
System.DateTime time = input.Subtract(span);  
return (long)(time.Ticks / 10000);  
}  
 
Javascript also has some support for parsing date strings, so it is  
possible to generate the timestamps manually client-side.  
 
If you've already got the real UTC timestamp, it's too late to use the  
pretend trick described above. But you can fix up the timestamps by  
adding the time zone offset, e.g. for UTC+0200 you would add 2 hours  
to the UTC timestamp you got. Then it'll look right on the plot. Most  
programming environments have some means of getting the timezone  
offset for a specific date (note that you need to get the offset for  
each individual timestamp to account for daylight savings).  
 
Once you've gotten the timestamps into the data and specified "time"  
as the axis mode, Flot will automatically generate relevant ticks and  
format them. As always, you can tweak the ticks via the "ticks" option  
- just remember that the values should be timestamps (numbers), not  
Date objects.  
 
Tick generation and formatting can also be controlled separately  
through the following axis options:  
 
minTickSize: array  
timeformat: null or format string  
monthNames: null or array of size 12 of strings  
twelveHourClock: boolean  
 
Here "timeformat" is a format string to use. You might use it like  
this:  
 
xaxis: {  
mode: "time"  
timeformat: "%y/%m/%d"  
}  
 
This will result in tick labels like "2000/12/24". The following  
specifiers are supported  
 
%h: hours  
%H: hours (left-padded with a zero)  
%M: minutes (left-padded with a zero)  
%S: seconds (left-padded with a zero)  
%d: day of month (1-31)  
%m: month (1-12)  
%y: year (four digits)  
%b: month name (customizable)  
%p: am/pm, additionally switches %h/%H to 12 hour instead of 24  
%P: AM/PM (uppercase version of %p)  
 
You can customize the month names with the "monthNames" option. For  
instance, for Danish you might specify:  
 
monthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]  
 
If you set "twelveHourClock" to true, the autogenerated timestamps  
will use 12 hour AM/PM timestamps instead of 24 hour.  
 
The format string and month names are used by a very simple built-in  
format function that takes a date object, a format string (and  
optionally an array of month names) and returns the formatted string.  
If needed, you can access it as $.plot.formatDate(date, formatstring,  
monthNames) or even replace it with another more advanced function  
from a date library if you're feeling adventurous.  
 
If everything else fails, you can control the formatting by specifying  
a custom tick formatter function as usual. Here's a simple example  
which will format December 24 as 24/12:  
 
tickFormatter: function (val, axis) {  
var d = new Date(val);  
return d.getUTCDate() + "/" + (d.getUTCMonth() + 1);  
}  
 
Note that for the time mode "tickSize" and "minTickSize" are a bit  
special in that they are arrays on the form "[value, unit]" where unit  
is one of "second", "minute", "hour", "day", "month" and "year". So  
you can specify  
 
minTickSize: [1, "month"]  
 
to get a tick interval size of at least 1 month and correspondingly,  
if axis.tickSize is [2, "day"] in the tick formatter, the ticks have  
been produced with two days in-between.  
 
 
 
Customizing the data series  
===========================  
 
series: {  
lines, points, bars: {  
show: boolean  
lineWidth: number  
fill: boolean or number  
fillColor: null or color/gradient  
}  
 
points: {  
radius: number  
}  
 
bars: {  
barWidth: number  
align: "left" or "center"  
horizontal: boolean  
}  
 
lines: {  
steps: boolean  
}  
 
shadowSize: number  
}  
 
colors: [ color1, color2, ... ]  
 
The options inside "series: {}" are copied to each of the series. So  
you can specify that all series should have bars by putting it in the  
global options, or override it for individual series by specifying  
bars in a particular the series object in the array of data.  
 
The most important options are "lines", "points" and "bars" that  
specify whether and how lines, points and bars should be shown for  
each data series. In case you don't specify anything at all, Flot will  
default to showing lines (you can turn this off with  
lines: { show: false}). You can specify the various types  
independently of each other, and Flot will happily draw each of them  
in turn (this is probably only useful for lines and points), e.g.  
 
var options = {  
series: {  
lines: { show: true, fill: true, fillColor: "rgba(255, 255, 255, 0.8)" },  
points: { show: true, fill: false }  
}  
};  
 
"lineWidth" is the thickness of the line or outline in pixels. You can  
set it to 0 to prevent a line or outline from being drawn; this will  
also hide the shadow.  
 
"fill" is whether the shape should be filled. For lines, this produces  
area graphs. You can use "fillColor" to specify the color of the fill.  
If "fillColor" evaluates to false (default for everything except  
points which are filled with white), the fill color is auto-set to the  
color of the data series. You can adjust the opacity of the fill by  
setting fill to a number between 0 (fully transparent) and 1 (fully  
opaque).  
 
For bars, fillColor can be a gradient, see the gradient documentation  
below. "barWidth" is the width of the bars in units of the x axis (or  
the y axis if "horizontal" is true), contrary to most other measures  
that are specified in pixels. For instance, for time series the unit  
is milliseconds so 24 * 60 * 60 * 1000 produces bars with the width of  
a day. "align" specifies whether a bar should be left-aligned  
(default) or centered on top of the value it represents. When  
"horizontal" is on, the bars are drawn horizontally, i.e. from the y  
axis instead of the x axis; note that the bar end points are still  
defined in the same way so you'll probably want to swap the  
coordinates if you've been plotting vertical bars first.  
 
For lines, "steps" specifies whether two adjacent data points are  
connected with a straight (possibly diagonal) line or with first a  
horizontal and then a vertical line. Note that this transforms the  
data by adding extra points.  
 
"shadowSize" is the default size of shadows in pixels. Set it to 0 to  
remove shadows.  
 
The "colors" array specifies a default color theme to get colors for  
the data series from. You can specify as many colors as you like, like  
this:  
 
colors: ["#d18b2c", "#dba255", "#919733"]  
 
If there are more data series than colors, Flot will try to generate  
extra colors by lightening and darkening colors in the theme.  
 
 
Customizing the grid  
====================  
 
grid: {  
show: boolean  
aboveData: boolean  
color: color  
backgroundColor: color/gradient or null  
tickColor: color  
labelMargin: number  
markings: array of markings or (fn: axes -> array of markings)  
borderWidth: number  
borderColor: color or null  
clickable: boolean  
hoverable: boolean  
autoHighlight: boolean  
mouseActiveRadius: number  
}  
 
The grid is the thing with the axes and a number of ticks. "color" is  
the color of the grid itself whereas "backgroundColor" specifies the  
background color inside the grid area. The default value of null means  
that the background is transparent. You can also set a gradient, see  
the gradient documentation below.  
 
You can turn off the whole grid including tick labels by setting  
"show" to false. "aboveData" determines whether the grid is drawn on  
above the data or below (below is default).  
 
"tickColor" is the color of the ticks and "labelMargin" is the spacing  
between tick labels and the grid. Note that you can style the tick  
labels with CSS, e.g. to change the color. They have class "tickLabel".  
"borderWidth" is the width of the border around the plot. Set it to 0  
to disable the border. You can also set "borderColor" if you want the  
border to have a different color than the grid lines.  
 
"markings" is used to draw simple lines and rectangular areas in the  
background of the plot. You can either specify an array of ranges on  
the form { xaxis: { from, to }, yaxis: { from, to } } (secondary axis  
coordinates with x2axis/y2axis) or with a function that returns such  
an array given the axes for the plot in an object as the first  
parameter.  
 
You can set the color of markings by specifying "color" in the ranges  
object. Here's an example array:  
 
markings: [ { xaxis: { from: 0, to: 2 }, yaxis: { from: 10, to: 10 }, color: "#bb0000" }, ... ]  
 
If you leave out one of the values, that value is assumed to go to the  
border of the plot. So for example if you only specify { xaxis: {  
from: 0, to: 2 } } it means an area that extends from the top to the  
bottom of the plot in the x range 0-2.  
 
A line is drawn if from and to are the same, e.g.  
 
markings: [ { yaxis: { from: 1, to: 1 } }, ... ]  
 
would draw a line parallel to the x axis at y = 1. You can control the  
line width with "lineWidth" in the range object.  
 
An example function might look like this:  
 
markings: function (axes) {  
var markings = [];  
for (var x = Math.floor(axes.xaxis.min); x < axes.xaxis.max; x += 2)  
markings.push({ xaxis: { from: x, to: x + 1 } });  
return markings;  
}  
 
 
If you set "clickable" to true, the plot will listen for click events  
on the plot area and fire a "plotclick" event on the placeholder with  
a position and a nearby data item object as parameters. The coordinates  
are available both in the unit of the axes (not in pixels) and in  
global screen coordinates.  
 
Likewise, if you set "hoverable" to true, the plot will listen for  
mouse move events on the plot area and fire a "plothover" event with  
the same parameters as the "plotclick" event. If "autoHighlight" is  
true (the default), nearby data items are highlighted automatically.  
If needed, you can disable highlighting and control it yourself with  
the highlight/unhighlight plot methods described elsewhere.  
 
You can use "plotclick" and "plothover" events like this:  
 
$.plot($("#placeholder"), [ d ], { grid: { clickable: true } });  
 
$("#placeholder").bind("plotclick", function (event, pos, item) {  
alert("You clicked at " + pos.x + ", " + pos.y);  
// secondary axis coordinates if present are in pos.x2, pos.y2,  
// if you need global screen coordinates, they are pos.pageX, pos.pageY  
 
if (item) {  
highlight(item.series, item.datapoint);  
alert("You clicked a point!");  
}  
});  
 
The item object in this example is either null or a nearby object on the form:  
 
item: {  
datapoint: the point, e.g. [0, 2]  
dataIndex: the index of the point in the data array  
series: the series object  
seriesIndex: the index of the series  
pageX, pageY: the global screen coordinates of the point  
}  
 
For instance, if you have specified the data like this  
 
$.plot($("#placeholder"), [ { label: "Foo", data: [[0, 10], [7, 3]] } ], ...);  
 
and the mouse is near the point (7, 3), "datapoint" is [7, 3],  
"dataIndex" will be 1, "series" is a normalized series object with  
among other things the "Foo" label in series.label and the color in  
series.color, and "seriesIndex" is 0. Note that plugins and options  
that transform the data can shift the indexes from what you specified  
in the original data array.  
 
If you use the above events to update some other information and want  
to clear out that info in case the mouse goes away, you'll probably  
also need to listen to "mouseout" events on the placeholder div.  
 
"mouseActiveRadius" specifies how far the mouse can be from an item  
and still activate it. If there are two or more points within this  
radius, Flot chooses the closest item. For bars, the top-most bar  
(from the latest specified data series) is chosen.  
 
If you want to disable interactivity for a specific data series, you  
can set "hoverable" and "clickable" to false in the options for that  
series, like this { data: [...], label: "Foo", clickable: false }.  
 
 
Specifying gradients  
====================  
 
A gradient is specified like this:  
 
{ colors: [ color1, color2, ... ] }  
 
For instance, you might specify a background on the grid going from  
black to gray like this:  
 
grid: {  
backgroundColor: { colors: ["#000", "#999"] }  
}  
 
For the series you can specify the gradient as an object that  
specifies the scaling of the brightness and the opacity of the series  
color, e.g.  
 
{ colors: [{ opacity: 0.8 }, { brightness: 0.6, opacity: 0.8 } ] }  
 
where the first color simply has its alpha scaled, whereas the second  
is also darkened. For instance, for bars the following makes the bars  
gradually disappear, without outline:  
 
bars: {  
show: true,  
lineWidth: 0,  
fill: true,  
fillColor: { colors: [ { opacity: 0.8 }, { opacity: 0.1 } ] }  
}  
 
Flot currently only supports vertical gradients drawn from top to  
bottom because that's what works with IE.  
 
 
Plot Methods  
------------  
 
The Plot object returned from the plot function has some methods you  
can call:  
 
- highlight(series, datapoint)  
 
Highlight a specific datapoint in the data series. You can either  
specify the actual objects, e.g. if you got them from a  
"plotclick" event, or you can specify the indices, e.g.  
highlight(1, 3) to highlight the fourth point in the second series  
(remember, zero-based indexing).  
 
 
- unhighlight(series, datapoint) or unhighlight()  
 
Remove the highlighting of the point, same parameters as  
highlight.  
 
If you call unhighlight with no parameters, e.g. as  
plot.unhighlight(), all current highlights are removed.  
 
 
- setData(data)  
 
You can use this to reset the data used. Note that axis scaling,  
ticks, legend etc. will not be recomputed (use setupGrid() to do  
that). You'll probably want to call draw() afterwards.  
 
You can use this function to speed up redrawing a small plot if  
you know that the axes won't change. Put in the new data with  
setData(newdata), call draw(), and you're good to go. Note that  
for large datasets, almost all the time is consumed in draw()  
plotting the data so in this case don't bother.  
 
 
- setupGrid()  
 
Recalculate and set axis scaling, ticks, legend etc.  
 
Note that because of the drawing model of the canvas, this  
function will immediately redraw (actually reinsert in the DOM)  
the labels and the legend, but not the actual tick lines because  
they're drawn on the canvas. You need to call draw() to get the  
canvas redrawn.  
 
- draw()  
 
Redraws the plot canvas.  
 
- triggerRedrawOverlay()  
 
Schedules an update of an overlay canvas used for drawing  
interactive things like a selection and point highlights. This  
is mostly useful for writing plugins. The redraw doesn't happen  
immediately, instead a timer is set to catch multiple successive  
redraws (e.g. from a mousemove).  
 
- width()/height()  
 
Gets the width and height of the plotting area inside the grid.  
This is smaller than the canvas or placeholder dimensions as some  
extra space is needed (e.g. for labels).  
 
- offset()  
 
Returns the offset of the plotting area inside the grid relative  
to the document, useful for instance for calculating mouse  
positions (event.pageX/Y minus this offset is the pixel position  
inside the plot).  
 
- pointOffset({ x: xpos, y: ypos })  
 
Returns the calculated offset of the data point at (x, y) in data  
space within the placeholder div. If you are working with dual axes, you  
can specify the x and y axis references, e.g.  
 
o = pointOffset({ x: xpos, y: ypos, xaxis: 2, yaxis: 2 })  
// o.left and o.top now contains the offset within the div  
 
 
There are also some members that let you peek inside the internal  
workings of Flot which is useful in some cases. Note that if you change  
something in the objects returned, you're changing the objects used by  
Flot to keep track of its state, so be careful.  
 
- getData()  
 
Returns an array of the data series currently used in normalized  
form with missing settings filled in according to the global  
options. So for instance to find out what color Flot has assigned  
to the data series, you could do this:  
 
var series = plot.getData();  
for (var i = 0; i < series.length; ++i)  
alert(series[i].color);  
 
A notable other interesting field besides color is datapoints  
which has a field "points" with the normalized data points in a  
flat array (the field "pointsize" is the increment in the flat  
array to get to the next point so for a dataset consisting only of  
(x,y) pairs it would be 2).  
 
- getAxes()  
 
Gets an object with the axes settings as { xaxis, yaxis, x2axis,  
y2axis }.  
 
Various things are stuffed inside an axis object, e.g. you could  
use getAxes().xaxis.ticks to find out what the ticks are for the  
xaxis. Two other useful attributes are p2c and c2p, functions for  
transforming from data point space to the canvas plot space and  
back. Both returns values that are offset with the plot offset.  
 
- getPlaceholder()  
 
Returns placeholder that the plot was put into. This can be useful  
for plugins for adding DOM elements or firing events.  
 
- getCanvas()  
 
Returns the canvas used for drawing in case you need to hack on it  
yourself. You'll probably need to get the plot offset too.  
 
- getPlotOffset()  
 
Gets the offset that the grid has within the canvas as an object  
with distances from the canvas edges as "left", "right", "top",  
"bottom". I.e., if you draw a circle on the canvas with the center  
placed at (left, top), its center will be at the top-most, left  
corner of the grid.  
 
- getOptions()  
 
Gets the options for the plot, in a normalized format with default  
values filled in.  
 
 
Hooks  
=====  
 
In addition to the public methods, the Plot object also has some hooks  
that can be used to modify the plotting process. You can install a  
callback function at various points in the process, the function then  
gets access to the internal data structures in Flot.  
 
Here's an overview of the phases Flot goes through:  
 
1. Plugin initialization, parsing options  
 
2. Constructing the canvases used for drawing  
 
3. Set data: parsing data specification, calculating colors,  
copying raw data points into internal format,  
normalizing them, finding max/min for axis auto-scaling  
 
4. Grid setup: calculating axis spacing, ticks, inserting tick  
labels, the legend  
 
5. Draw: drawing the grid, drawing each of the series in turn  
 
6. Setting up event handling for interactive features  
 
7. Responding to events, if any  
 
Each hook is simply a function which is put in the appropriate array.  
You can add them through the "hooks" option, and they are also available  
after the plot is constructed as the "hooks" attribute on the returned  
plot object, e.g.  
 
// define a simple draw hook  
function hellohook(plot, canvascontext) { alert("hello!"); };  
 
// pass it in, in an array since we might want to specify several  
var plot = $.plot(placeholder, data, { hooks: { draw: [hellohook] } });  
 
// we can now find it again in plot.hooks.draw[0] unless a plugin  
// has added other hooks  
 
The available hooks are described below. All hook callbacks get the  
plot object as first parameter. You can find some examples of defined  
hooks in the plugins bundled with Flot.  
 
- processOptions [phase 1]  
 
function(plot, options)  
 
Called after Flot has parsed and merged options. Useful in the  
instance where customizations beyond simple merging of default  
values is needed. A plugin might use it to detect that it has been  
enabled and then turn on or off other options.  
 
 
- processRawData [phase 3]  
 
function(plot, series, data, datapoints)  
 
Called before Flot copies and normalizes the raw data for the given  
series. If the function fills in datapoints.points with normalized  
points and sets datapoints.pointsize to the size of the points,  
Flot will skip the copying/normalization step for this series.  
 
In any case, you might be interested in setting datapoints.format,  
an array of objects for specifying how a point is normalized and  
how it interferes with axis scaling.  
 
The default format array for points is something along the lines of:  
 
[  
{ x: true, number: true, required: true },  
{ y: true, number: true, required: true }  
]  
 
The first object means that for the first coordinate it should be  
taken into account when scaling the x axis, that it must be a  
number, and that it is required - so if it is null or cannot be  
converted to a number, the whole point will be zeroed out with  
nulls. Beyond these you can also specify "defaultValue", a value to  
use if the coordinate is null. This is for instance handy for bars  
where one can omit the third coordinate (the bottom of the bar)  
which then defaults to 0.  
 
 
- processDatapoints [phase 3]  
 
function(plot, series, datapoints)  
 
Called after normalization of the given series but before finding  
min/max of the data points. This hook is useful for implementing data  
transformations. "datapoints" contains the normalized data points in  
a flat array as datapoints.points with the size of a single point  
given in datapoints.pointsize. Here's a simple transform that  
multiplies all y coordinates by 2:  
 
function multiply(plot, series, datapoints) {  
var points = datapoints.points, ps = datapoints.pointsize;  
for (var i = 0; i < points.length; i += ps)  
points[i + 1] *= 2;  
}  
 
Note that you must leave datapoints in a good condition as Flot  
doesn't check it or do any normalization on it afterwards.  
 
 
- draw [phase 5]  
 
function(plot, canvascontext)  
 
Hook for drawing on the canvas. Called after the grid is drawn  
(unless it's disabled) and the series have been plotted (in case  
any points, lines or bars have been turned on). For examples of how  
to draw things, look at the source code.  
 
 
- bindEvents [phase 6]  
 
function(plot, eventHolder)  
 
Called after Flot has setup its event handlers. Should set any  
necessary event handlers on eventHolder, a jQuery object with the  
canvas, e.g.  
 
function (plot, eventHolder) {  
eventHolder.mousedown(function (e) {  
alert("You pressed the mouse at " + e.pageX + " " + e.pageY);  
});  
}  
 
Interesting events include click, mousemove, mouseup/down. You can  
use all jQuery events. Usually, the event handlers will update the  
state by drawing something (add a drawOverlay hook and call  
triggerRedrawOverlay) or firing an externally visible event for  
user code. See the crosshair plugin for an example.  
 
Currently, eventHolder actually contains both the static canvas  
used for the plot itself and the overlay canvas used for  
interactive features because some versions of IE get the stacking  
order wrong. The hook only gets one event, though (either for the  
overlay or for the static canvas).  
 
 
- drawOverlay [phase 7]  
 
function (plot, canvascontext)  
 
The drawOverlay hook is used for interactive things that need a  
canvas to draw on. The model currently used by Flot works the way  
that an extra overlay canvas is positioned on top of the static  
canvas. This overlay is cleared and then completely redrawn  
whenever something interesting happens. This hook is called when  
the overlay canvas is to be redrawn.  
 
"canvascontext" is the 2D context of the overlay canvas. You can  
use this to draw things. You'll most likely need some of the  
metrics computed by Flot, e.g. plot.width()/plot.height(). See the  
crosshair plugin for an example.  
 
 
 
Plugins  
-------  
 
Plugins extend the functionality of Flot. To use a plugin, simply  
include its Javascript file after Flot in the HTML page.  
 
If you're worried about download size/latency, you can concatenate all  
the plugins you use, and Flot itself for that matter, into one big file  
(make sure you get the order right), then optionally run it through a  
Javascript minifier such as YUI Compressor.  
 
Here's a brief explanation of how the plugin plumbings work:  
 
Each plugin registers itself in the global array $.plot.plugins. When  
you make a new plot object with $.plot, Flot goes through this array  
calling the "init" function of each plugin and merging default options  
from its "option" attribute. The init function gets a reference to the  
plot object created and uses this to register hooks and add new public  
methods if needed.  
 
See the PLUGINS.txt file for details on how to write a plugin. As the  
above description hints, it's actually pretty easy.  
 
Frequently asked questions  
--------------------------  
 
Q: How much data can Flot cope with?  
 
A: Flot will happily draw everything you send to it so the answer  
depends on the browser. The excanvas emulation used for IE (built with  
VML) makes IE by far the slowest browser so be sure to test with that  
if IE users are in your target group.  
 
1000 points is not a problem, but as soon as you start having more  
points than the pixel width, you should probably start thinking about  
downsampling/aggregation as this is near the resolution limit of the  
chart anyway. If you downsample server-side, you also save bandwidth.  
 
 
Q: Flot isn't working when I'm using JSON data as source!  
 
A: Actually, Flot loves JSON data, you just got the format wrong.  
Double check that you're not inputting strings instead of numbers,  
like [["0", "-2.13"], ["5", "4.3"]]. This is most common mistake, and  
the error might not show up immediately because Javascript can do some  
conversion automatically.  
 
 
Q: Can I export the graph?  
 
A: This is a limitation of the canvas technology. There's a hook in  
the canvas object for getting an image out, but you won't get the tick  
labels. And it's not likely to be supported by IE. At this point, your  
best bet is probably taking a screenshot, e.g. with PrtScn.  
 
 
Q: The bars are all tiny in time mode?  
 
A: It's not really possible to determine the bar width automatically.  
So you have to set the width with the barWidth option which is NOT in  
pixels, but in the units of the x axis (or the y axis for horizontal  
bars). For time mode that's milliseconds so the default value of 1  
makes the bars 1 millisecond wide.  
 
 
Q: Can I use Flot with libraries like Mootools or Prototype?  
 
A: Yes, Flot supports it out of the box and it's easy! Just use jQuery  
instead of $, e.g. call jQuery.plot instead of $.plot and use  
jQuery(something) instead of $(something). As a convenience, you can  
put in a DOM element for the graph placeholder where the examples and  
the API documentation are using jQuery objects.  
 
Depending on how you include jQuery, you may have to add one line of  
code to prevent jQuery from overwriting functions from the other  
libraries, see the documentation in jQuery ("Using jQuery with other  
libraries") for details.  
 
 
Q: Flot doesn't work with [widget framework xyz]!  
 
A: The problem is most likely within the framework, or your use of the  
framework.  
 
The only non-standard thing used by Flot is the canvas tag; otherwise  
it is simply a series of absolute positioned divs within the  
placeholder tag you put in. If this is not working, it's probably  
because the framework you're using is doing something weird with the  
DOM. As a last resort, you might try replotting and see if it helps.  
 
If you find there's a specific thing we can do to Flot to help, feel  
free to submit a bug report. Otherwise, you're welcome to ask for help  
on the mailing list, but please don't submit a bug report to Flot -  
try the framework instead.  
 
Copyright (c) 2007-2009 IOLA and Ole Laursen  
 
Permission is hereby granted, free of charge, to any person  
obtaining a copy of this software and associated documentation  
files (the "Software"), to deal in the Software without  
restriction, including without limitation the rights to use,  
copy, modify, merge, publish, distribute, sublicense, and/or sell  
copies of the Software, and to permit persons to whom the  
Software is furnished to do so, subject to the following  
conditions:  
 
The above copyright notice and this permission notice shall be  
included in all copies or substantial portions of the Software.  
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES  
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,  
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR  
OTHER DEALINGS IN THE SOFTWARE.  
 
# Makefile for generating minified files  
 
YUICOMPRESSOR_PATH=../yuicompressor-2.3.5.jar  
 
# if you need another compressor path, just copy the above line to a  
# file called Makefile.local, customize it and you're good to go  
-include Makefile.local  
 
.PHONY: all  
 
# we cheat and process all .js files instead of listing them  
all: $(patsubst %.js,%.min.js,$(filter-out %.min.js,$(wildcard *.js)))  
 
%.min.js: %.js  
java -jar $(YUICOMPRESSOR_PATH) $< -o $@  
 
Flot 0.6  
--------  
 
API changes:  
 
1. Selection support has been moved to a plugin. Thus if you're  
passing selection: { mode: something }, you MUST include the file  
jquery.flot.selection.js after jquery.flot.js. This reduces the size  
of base Flot and makes it easier to customize the selection as well as  
improving code clarity. The change is based on patch from andershol.  
 
2. In the global options specified in the $.plot command,  
"lines", "points", "bars" and "shadowSize" have been moved to a  
sub-object called "series", i.e.  
 
$.plot(placeholder, data, { lines: { show: true }})  
 
should be changed to  
 
$.plot(placeholder, data, { series: { lines: { show: true }}})  
 
All future series-specific options will go into this sub-object to  
simplify plugin writing. Backward-compatibility code is in place, so  
old code should not break.  
 
3. "plothover" no longer provides the original data point, but instead  
a normalized one, since there may be no corresponding original point.  
 
4. Due to a bug in previous versions of jQuery, you now need at least  
jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some  
improvements in event handling speed.  
 
 
Changes:  
 
- Added support for disabling interactivity for specific data series  
(request from Ronald Schouten and Steve Upton).  
 
- Flot now calls $() on the placeholder and optional legend container  
passed in so you can specify DOM elements or CSS expressions to make  
it easier to use Flot with libraries like Prototype or Mootools or  
through raw JSON from Ajax responses.  
 
- A new "plotselecting" event is now emitted while the user is making  
a selection.  
 
- The "plothover" event is now emitted immediately instead of at most  
10 times per second, you'll have to put in a setTimeout yourself if  
you're doing something really expensive on this event.  
 
- The built-in date formatter can now be accessed as  
$.plot.formatDate(...) (suggestion by Matt Manela) and even  
replaced.  
 
- Added "borderColor" option to the grid (patch from Amaury Chamayou  
and patch from Mike R. Williamson).  
 
- Added support for gradient backgrounds for the grid, take a look at  
the "setting options" example (based on patch from Amaury Chamayou,  
issue 90).  
 
- Gradient bars (suggestion by stefpet).  
 
- Added a "plotunselected" event which is triggered when the selection  
is removed, see "selection" example (suggestion by Meda Ugo);  
 
- The option legend.margin can now specify horizontal and vertical  
margins independently (suggestion by someone who's annoyed).  
 
- Data passed into Flot is now copied to a new canonical format to  
enable further processing before it hits the drawing routines. As a  
side-effect, this should make Flot more robust in the face of bad  
data (and fixes issue 112).  
 
- Step-wise charting: line charts have a new option "steps" that when  
set to true connects the points with horizontal/vertical steps  
instead of diagonal lines.  
 
- The legend labelFormatter now passes the series in addition to just  
the label (suggestion by Vincent Lemeltier).  
 
- Horizontal bars (based on patch by Jason LeBrun).  
 
- Support for partial bars by specifying a third coordinate, i.e. they  
don't have to start from the axis. This can be used to make stacked  
bars.  
 
- New option to disable the (grid.show).  
 
- Added pointOffset method for converting a point in data space to an  
offset within the placeholder.  
 
- Plugin system: register an init method in the $.flot.plugins array  
to get started, see PLUGINS.txt for details on how to write plugins  
(it's easy). There are also some extra methods to enable access to  
internal state.  
 
- Hooks: you can register functions that are called while Flot is  
crunching the data and doing the plot. This can be used to modify  
Flot without changing the source, useful for writing plugins. Some  
hooks are defined, more are likely to come.  
 
- Threshold plugin: you can set a threshold and a color, and the data  
points below that threshold will then get the color. Useful for  
marking data below 0, for instance.  
 
- Stack plugin: you can specify a stack key for each series to have  
them summed. This is useful for drawing additive/cumulative graphs  
with bars and (currently unfilled) lines.  
 
- Crosshairs plugin: trace the mouse position on the axes, enable with  
crosshair: { mode: "x"} (see the new tracking example for a use).  
 
- Image plugin: plot prerendered images.  
 
- Navigation plugin for panning and zooming a plot.  
 
- More configurable grid.  
 
- Axis transformation support, useful for non-linear plots, e.g. log  
axes and compressed time axes (like omitting weekends).  
 
- Support for twelve-hour date formatting (patch by Forrest Aldridge).  
 
- The color parsing code in Flot has been cleaned up and split out so  
it's now available as a separate jQuery plugin. It's included inline  
in the Flot source to make dependency managing easier. This also  
makes it really easy to use the color helpers in Flot plugins.  
 
Bug fixes:  
 
- Fixed two corner-case bugs when drawing filled curves (report and  
analysis by Joshua Varner).  
- Fix auto-adjustment code when setting min to 0 for an axis where the  
dataset is completely flat on that axis (report by chovy).  
- Fixed a bug with passing in data from getData to setData when the  
secondary axes are used (issue 65, reported by nperelman).  
- Fixed so that it is possible to turn lines off when no other chart  
type is shown (based on problem reported by Glenn Vanderburg), and  
fixed so that setting lineWidth to 0 also hides the shadow (based on  
problem reported by Sergio Nunes).  
- Updated mousemove position expression to the latest from jQuery (bug  
reported by meyuchas).  
- Use CSS borders instead of background in legend (fix printing issue 25  
and 45).  
- Explicitly convert axis min/max to numbers.  
- Fixed a bug with drawing marking lines with different colors  
(reported by Khurram).  
- Fixed a bug with returning y2 values in the selection event (fix  
by exists, issue 75).  
- Only set position relative on placeholder if it hasn't already a  
position different from static (reported by kyberneticist, issue 95).  
- Don't round markings to prevent sub-pixel problems (reported by Dan  
Lipsitt).  
- Make the grid border act similarly to a regular CSS border, i.e.  
prevent it from overlapping the plot itself. This also fixes a  
problem with anti-aliasing when the width is 1 pixel (reported by  
Anthony Ettinger).  
- Imported version 3 of excanvas and fixed two issues with the newer  
version. Hopefully, this will make Flot work with IE8 (nudge by  
Fabien Menager, further analysis by Booink, issue 133).  
- Changed the shadow code for lines to hopefully look a bit better  
with vertical lines.  
- Round tick positions to avoid possible problems with fractions  
(suggestion by Fred, issue 130).  
- Made the heuristic for determining how many ticks to aim for a bit  
smarter.  
- Fix for uneven axis margins (report and patch by Paul Kienzle) and  
snapping to ticks (concurrent report and patch by lifthrasiir).  
- Fixed bug with slicing in findNearbyItems (patch by zollman).  
- Make heuristic for x axis label widths more dynamic (patch by  
rickinhethuis).  
- Make sure points on top take precedence when finding nearby points  
when hovering (reported by didroe, issue 224).  
 
Flot 0.5  
--------  
 
Backwards API change summary: Timestamps are now in UTC. Also  
"selected" event -> becomes "plotselected" with new data, the  
parameters for setSelection are now different (but backwards  
compatibility hooks are in place), coloredAreas becomes markings with  
a new interface (but backwards compatibility hooks are in place).  
 
 
Interactivity: added a new "plothover" event and this and the  
"plotclick" event now returns the closest data item (based on patch by  
/david, patch by Mark Byers for bar support). See the revamped  
"interacting with the data" example for some hints on what you can do.  
 
Highlighting: you can now highlight points and datapoints are  
autohighlighted when you hover over them (if hovering is turned on).  
 
Support for dual axis has been added (based on patch by someone who's  
annoyed and /david). For each data series you can specify which axes  
it belongs to, and there are two more axes, x2axis and y2axis, to  
customize. This affects the "selected" event which has been renamed to  
"plotselected" and spews out { xaxis: { from: -10, to: 20 } ... },  
setSelection in which the parameters are on a new form (backwards  
compatible hooks are in place so old code shouldn't break) and  
markings (formerly coloredAreas).  
 
Timestamps in time mode are now displayed according to  
UTC instead of the time zone of the visitor. This affects the way the  
timestamps should be input; you'll probably have to offset the  
timestamps according to your local time zone. It also affects any  
custom date handling code (which basically now should use the  
equivalent UTC date mehods, e.g. .setUTCMonth() instead of  
.setMonth().  
 
Added support for specifying the size of tick labels (axis.labelWidth,  
axis.labelHeight). Useful for specifying a max label size to keep  
multiple plots aligned.  
 
Markings, previously coloredAreas, are now specified as ranges on the  
axes, like { xaxis: { from: 0, to: 10 }}. Furthermore with markings  
you can now draw horizontal/vertical lines by setting from and to to  
the same coordinate (idea from line support patch by by Ryan Funduk).  
 
The "fill" option can now be a number that specifies the opacity of  
the fill.  
 
You can now specify a coordinate as null (like [2, null]) and Flot  
will take the other coordinate into account when scaling the axes  
(based on patch by joebno).  
 
New option for bars "align". Set it to "center" to center the bars on  
the value they represent.  
 
setSelection now takes a second parameter which you can use to prevent  
the method from firing the "plotselected" handler.  
 
Using the "container" option in legend now overwrites the container  
element instead of just appending to it (fixes infinite legend bug,  
reported by several people, fix by Brad Dewey).  
 
Fixed a bug in calculating spacing around the plot (reported by  
timothytoe). Fixed a bug in finding max values for all-negative data  
sets. Prevent the possibility of eternal looping in tick calculations.  
Fixed a bug when borderWidth is set to 0 (reported by  
Rob/sanchothefat). Fixed a bug with drawing bars extending below 0  
(reported by James Hewitt, patch by Ryan Funduk). Fixed a  
bug with line widths of bars (reported by MikeM). Fixed a bug with  
'nw' and 'sw' legend positions. Improved the handling of axis  
auto-scaling with bars. Fixed a bug with multi-line x-axis tick  
labels (reported by Luca Ciano). IE-fix help by Savage Zhang.  
 
 
Flot 0.4  
--------  
 
API changes: deprecated axis.noTicks in favor of just specifying the  
number as axis.ticks. So "xaxis: { noTicks: 10 }" becomes  
"xaxis: { ticks: 10 }"  
 
Time series support. Specify axis.mode: "time", put in Javascript  
timestamps as data, and Flot will automatically spit out sensible  
ticks. Take a look at the two new examples. The format can be  
customized with axis.timeformat and axis.monthNames, or if that fails  
with axis.tickFormatter.  
 
Support for colored background areas via grid.coloredAreas. Specify an  
array of { x1, y1, x2, y2 } objects or a function that returns these  
given { xmin, xmax, ymin, ymax }.  
 
More members on the plot object (report by Chris Davies and others).  
"getData" for inspecting the assigned settings on data series (e.g.  
color) and "setData", "setupGrid" and "draw" for updating the contents  
without a total replot.  
 
The default number of ticks to aim for is now dependent on the size of  
the plot in pixels. Support for customizing tick interval sizes  
directly with axis.minTickSize and axis.tickSize.  
 
Cleaned up the automatic axis scaling algorithm and fixed how it  
interacts with ticks. Also fixed a couple of tick-related corner case  
bugs (one reported by mainstreetmark, another reported by timothytoe).  
 
The option axis.tickFormatter now takes a function with two  
parameters, the second parameter is an optional object with  
information about the axis. It has min, max, tickDecimals, tickSize.  
 
Added support for segmented lines (based on patch from Michael  
MacDonald) and for ignoring null and bad values (suggestion from Nick  
Konidaris and joshwaihi).  
 
Added support for changing the border width (joebno and safoo).  
Label colors can be changed via CSS by selecting the tickLabel class.  
 
Fixed a bug in handling single-item bar series (reported by Emil  
Filipov). Fixed erratic behaviour when interacting with the plot  
with IE 7 (reported by Lau Bech Lauritzen). Prevent IE/Safari text  
selection when selecting stuff on the canvas.  
 
 
 
Flot 0.3  
--------  
 
This is mostly a quick-fix release because jquery.js wasn't included  
in the previous zip/tarball.  
 
Support clicking on the plot. Turn it on with grid: { clickable: true },  
then you get a "plotclick" event on the graph placeholder with the  
position in units of the plot.  
 
Fixed a bug in dealing with data where min = max, thanks to Michael  
Messinides.  
 
Include jquery.js in the zip/tarball.  
 
 
Flot 0.2  
--------  
 
Added support for putting a background behind the default legend. The  
default is the partly transparent background color. Added  
backgroundColor and backgroundOpacity to the legend options to control  
this.  
 
The ticks options can now be a callback function that takes one  
parameter, an object with the attributes min and max. The function  
should return a ticks array.  
 
Added labelFormatter option in legend, useful for turning the legend  
labels into links.  
 
Fixed a couple of bugs.  
 
The API should now be fully documented.  
 
Patch from Guy Fraser to make parts of the code smaller.  
 
API changes: Moved labelMargin option to grid from x/yaxis.  
 
 
Flot 0.1  
--------  
 
First public release.  
 
Writing plugins  
---------------  
 
To make a new plugin, create an init function and a set of options (if  
needed), stuff it into an object and put it in the $.plot.plugins  
array. For example:  
 
function myCoolPluginInit(plot) { plot.coolstring = "Hello!" };  
var myCoolOptions = { coolstuff: { show: true } }  
$.plot.plugins.push({ init: myCoolPluginInit, options: myCoolOptions });  
 
// now when $.plot is called, the returned object will have the  
// attribute "coolstring"  
 
Now, given that the plugin might run in many different places, it's  
a good idea to avoid leaking names. We can avoid this by wrapping the  
above lines in an anonymous function which we call immediately, like  
this: (function () { inner code ... })(). To make it even more robust  
in case $ is not bound to jQuery but some other Javascript library, we  
can write it as  
 
(function ($) {  
// plugin definition  
// ...  
})(jQuery);  
 
Here is a simple debug plugin which alerts each of the series in the  
plot. It has a single option that control whether it is enabled and  
how much info to output:  
 
(function ($) {  
function init(plot) {  
var debugLevel = 1;  
 
function checkDebugEnabled(plot, options) {  
if (options.debug) {  
debugLevel = options.debug;  
 
plot.hooks.processDatapoints.push(alertSeries);  
}  
}  
 
function alertSeries(plot, series, datapoints) {  
var msg = "series " + series.label;  
if (debugLevel > 1)  
msg += " with " + series.data.length + " points";  
alert(msg);  
}  
 
plot.hooks.processOptions.push(checkDebugEnabled);  
}  
 
var options = { debug: 0 };  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: "simpledebug",  
version: "0.1"  
});  
})(jQuery);  
 
We also define "name" and "version". It's not used by Flot, but might  
be helpful for other plugins in resolving dependencies.  
 
Put the above in a file named "jquery.flot.debug.js", include it in an  
HTML page and then it can be used with:  
 
$.plot($("#placeholder"), [...], { debug: 2 });  
 
This simple plugin illustrates a couple of points:  
 
- It uses the anonymous function trick to avoid name pollution.  
- It can be enabled/disabled through an option.  
- Variables in the init function can be used to store plot-specific  
state between the hooks.  
 
 
Options guidelines  
==================  
 
Plugins should always support appropriate options to enable/disable  
them because the plugin user may have several plots on the same page  
where only one should use the plugin.  
 
If the plugin needs series-specific options, you can put them in  
"series" in the options object, e.g.  
 
var options = {  
series: {  
downsample: {  
algorithm: null,  
maxpoints: 1000  
}  
}  
}  
 
Then they will be copied by Flot into each series, providing the  
defaults in case the plugin user doesn't specify any. Again, in most  
cases it's probably a good idea if the plugin is turned off rather  
than on per default, just like most of the powerful features in Flot.  
 
Think hard and long about naming the options. These names are going to  
be public API, and code is going to depend on them if the plugin is  
successful.  
 
About  
-----  
 
Flot is a Javascript plotting library for jQuery. Read more at the  
website:  
 
http://code.google.com/p/flot/  
 
Take a look at the examples linked from above, they should give a good  
impression of what Flot can do and the source code of the examples is  
probably the fastest way to learn how to use Flot.  
 
 
Installation  
------------  
 
Just include the Javascript file after you've included jQuery.  
 
Note that you need to get a version of Excanvas (e.g. the one bundled  
with Flot) which is canvas emulation on Internet Explorer. You can  
include the excanvas script like this:  
 
<!--[if IE]><script language="javascript" type="text/javascript" src="excanvas.pack.js"></script><![endif]-->  
 
If it's not working on your development IE 6.0, check that it has  
support for VML which excanvas is relying on. It appears that some  
stripped down versions used for test environments on virtual machines  
lack the VML support.  
 
Also note that you need at least jQuery 1.2.6 (but at least jQuery  
1.3.2 is recommended for interactive charts because of performance  
improvements in event handling).  
 
 
Basic usage  
-----------  
 
Create a placeholder div to put the graph in:  
 
<div id="placeholder"></div>  
 
You need to set the width and height of this div, otherwise the plot  
library doesn't know how to scale the graph. You can do it inline like  
this:  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
You can also do it with an external stylesheet. Make sure that the  
placeholder isn't within something with a display:none CSS property -  
in that case, Flot has trouble measuring label dimensions which  
results in garbled looks and might have trouble measuring the  
placeholder dimensions which is fatal (it'll throw an exception).  
 
Then when the div is ready in the DOM, which is usually on document  
ready, run the plot function:  
 
$.plot($("#placeholder"), data, options);  
 
Here, data is an array of data series and options is an object with  
settings if you want to customize the plot. Take a look at the  
examples for some ideas of what to put in or look at the reference  
in the file "API.txt". Here's a quick example that'll draw a line from  
(0, 0) to (1, 1):  
 
$.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });  
 
The plot function immediately draws the chart and then returns a plot  
object with a couple of methods.  
 
 
What's with the name?  
---------------------  
 
First: it's pronounced with a short o, like "plot". Not like "flawed".  
 
So "Flot" rhymes with "plot".  
 
And if you look up "flot" in a Danish-to-English dictionary, some up  
the words that come up are "good-looking", "attractive", "stylish",  
"smart", "impressive", "extravagant". One of the main goals with Flot  
is pretty looks.  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Example of loading data dynamically with AJAX. Percentage change in GDP (source: <a href="http://epp.eurostat.ec.europa.eu/tgm/table.do?tab=table&init=1&plugin=1&language=en&pcode=tsieb020">Eurostat</a>). Click the buttons below.</p>  
 
<p>The data is fetched over HTTP, in this case directly from text  
files. Usually the URL would point to some web server handler  
(e.g. a PHP page or Java/.NET/Python/Ruby on Rails handler) that  
extracts it from a database and serializes it to JSON.</p>  
 
<p>  
<input class="fetchSeries" type="button" value="First dataset"> -  
<a href="data-eu-gdp-growth.json">data</a> -  
<span></span>  
</p>  
 
<p>  
<input class="fetchSeries" type="button" value="Second dataset"> -  
<a href="data-japan-gdp-growth.json">data</a> -  
<span></span>  
</p>  
 
<p>  
<input class="fetchSeries" type="button" value="Third dataset"> -  
<a href="data-usa-gdp-growth.json">data</a> -  
<span></span>  
</p>  
 
<p>If you combine AJAX with setTimeout, you can poll the server  
for new data.</p>  
 
<p>  
<input class="dataUpdate" type="button" value="Poll for data">  
</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var options = {  
lines: { show: true },  
points: { show: true },  
xaxis: { tickDecimals: 0, tickSize: 1 }  
};  
var data = [];  
var placeholder = $("#placeholder");  
 
$.plot(placeholder, data, options);  
 
 
// fetch one series, adding to what we got  
var alreadyFetched = {};  
 
$("input.fetchSeries").click(function () {  
var button = $(this);  
 
// find the URL in the link right next to us  
var dataurl = button.siblings('a').attr('href');  
 
// then fetch the data with jQuery  
function onDataReceived(series) {  
// extract the first coordinate pair so you can see that  
// data is now an ordinary Javascript object  
var firstcoordinate = '(' + series.data[0][0] + ', ' + series.data[0][1] + ')';  
 
button.siblings('span').text('Fetched ' + series.label + ', first point: ' + firstcoordinate);  
 
// let's add it to our current data  
if (!alreadyFetched[series.label]) {  
alreadyFetched[series.label] = true;  
data.push(series);  
}  
 
// and plot all we got  
$.plot(placeholder, data, options);  
}  
 
$.ajax({  
url: dataurl,  
method: 'GET',  
dataType: 'json',  
success: onDataReceived  
});  
});  
 
 
// initiate a recurring data update  
$("input.dataUpdate").click(function () {  
// reset data  
data = [];  
alreadyFetched = {};  
 
$.plot(placeholder, data, options);  
 
var iteration = 0;  
 
function fetchData() {  
++iteration;  
 
function onDataReceived(series) {  
// we get all the data in one go, if we only got partial  
// data, we could merge it with what we already got  
data = [ series ];  
 
$.plot($("#placeholder"), data, options);  
}  
 
$.ajax({  
// usually, we'll just call the same URL, a script  
// connected to a database, but in this case we only  
// have static example files so we need to modify the  
// URL  
url: "data-eu-gdp-growth-" + iteration + ".json",  
method: 'GET',  
dataType: 'json',  
success: onDataReceived  
});  
 
if (iteration < 5)  
setTimeout(fetchData, 1000);  
else {  
data = [];  
alreadyFetched = {};  
}  
}  
 
setTimeout(fetchData, 1000);  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Flot has support for simple background decorations such as  
lines and rectangles. They can be useful for marking up certain  
areas. You can easily add any HTML you need with standard DOM  
manipulation, e.g. for labels. For drawing custom shapes there is  
also direct access to the canvas.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
// generate a dataset  
var d1 = [];  
for (var i = 0; i < 20; ++i)  
d1.push([i, Math.sin(i)]);  
 
var data = [{ data: d1, label: "Pressure", color: "#333" }];  
 
// setup background areas  
var markings = [  
{ color: '#f6f6f6', yaxis: { from: 1 } },  
{ color: '#f6f6f6', yaxis: { to: -1 } },  
{ color: '#000', lineWidth: 1, xaxis: { from: 2, to: 2 } },  
{ color: '#000', lineWidth: 1, xaxis: { from: 8, to: 8 } }  
];  
 
var placeholder = $("#placeholder");  
 
// plot it  
var plot = $.plot(placeholder, data, {  
bars: { show: true, barWidth: 0.5, fill: 0.9 },  
xaxis: { ticks: [], autoscaleMargin: 0.02 },  
yaxis: { min: -2, max: 2 },  
grid: { markings: markings }  
});  
 
// add labels  
var o;  
 
o = plot.pointOffset({ x: 2, y: -1.2});  
// we just append it to the placeholder which Flot already uses  
// for positioning  
placeholder.append('<div style="position:absolute;left:' + (o.left + 4) + 'px;top:' + o.top + 'px;color:#666;font-size:smaller">Warming up</div>');  
 
o = plot.pointOffset({ x: 8, y: -1.2});  
placeholder.append('<div style="position:absolute;left:' + (o.left + 4) + 'px;top:' + o.top + 'px;color:#666;font-size:smaller">Actual measurements</div>');  
 
// draw a little arrow on top of the last label to demonstrate  
// canvas drawing  
var ctx = plot.getCanvas().getContext("2d");  
ctx.beginPath();  
o.left += 4;  
ctx.moveTo(o.left, o.top);  
ctx.lineTo(o.left, o.top - 10);  
ctx.lineTo(o.left + 10, o.top - 5);  
ctx.lineTo(o.left, o.top);  
ctx.fillStyle = "#000";  
ctx.fill();  
});  
</script>  
 
</body>  
</html>  
 
 Binary files a/busui/owa/modules/base/js/includes/jquery/flot/examples/arrow-down.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/js/includes/jquery/flot/examples/arrow-left.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/js/includes/jquery/flot/examples/arrow-right.gif and /dev/null differ
 Binary files a/busui/owa/modules/base/js/includes/jquery/flot/examples/arrow-up.gif and /dev/null differ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Simple example. You don't need to specify much to get an  
attractive look. Put in a placeholder, make sure you set its  
dimensions (otherwise the plot library will barf) and call the  
plot function with the data. The axes are automatically  
scaled.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var d1 = [];  
for (var i = 0; i < 14; i += 0.5)  
d1.push([i, Math.sin(i)]);  
 
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];  
 
// a null signifies separate line segments  
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];  
 
$.plot($("#placeholder"), [ d1, d2, d3 ]);  
});  
</script>  
 
</body>  
</html>  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9]]  
}  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2]]  
}  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5]]  
}  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1]]  
}  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1], [2007, 2.9], [2008, 0.9]]  
}  
 
{  
label: 'Europe (EU27)',  
data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1], [2007, 2.9], [2008, 0.9]]  
}  
 
{  
label: 'Japan',  
data: [[1999, -0.1], [2000, 2.9], [2001, 0.2], [2002, 0.3], [2003, 1.4], [2004, 2.7], [2005, 1.9], [2006, 2.0], [2007, 2.3], [2008, -0.7]]  
}  
 
{  
label: 'USA',  
data: [[1999, 4.4], [2000, 3.7], [2001, 0.8], [2002, 1.6], [2003, 2.5], [2004, 3.6], [2005, 2.9], [2006, 2.8], [2007, 2.0], [2008, 1.1]]  
}  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Dual axis support showing the raw oil price in US $/barrel of  
crude oil (left axis) vs. the exchange rate from US $ to € (right  
axis).</p>  
 
<p>As illustrated, you can put in secondary y and x axes if you  
need to. For each data series, simply specify the axis number.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var oilprices = [[1167692400000,61.05], [1167778800000,58.32], [1167865200000,57.35], [1167951600000,56.31], [1168210800000,55.55], [1168297200000,55.64], [1168383600000,54.02], [1168470000000,51.88], [1168556400000,52.99], [1168815600000,52.99], [1168902000000,51.21], [1168988400000,52.24], [1169074800000,50.48], [1169161200000,51.99], [1169420400000,51.13], [1169506800000,55.04], [1169593200000,55.37], [1169679600000,54.23], [1169766000000,55.42], [1170025200000,54.01], [1170111600000,56.97], [1170198000000,58.14], [1170284400000,58.14], [1170370800000,59.02], [1170630000000,58.74], [1170716400000,58.88], [1170802800000,57.71], [1170889200000,59.71], [1170975600000,59.89], [1171234800000,57.81], [1171321200000,59.06], [1171407600000,58.00], [1171494000000,57.99], [1171580400000,59.39], [1171839600000,59.39], [1171926000000,58.07], [1172012400000,60.07], [1172098800000,61.14], [1172444400000,61.39], [1172530800000,61.46], [1172617200000,61.79], [1172703600000,62.00], [1172790000000,60.07], [1173135600000,60.69], [1173222000000,61.82], [1173308400000,60.05], [1173654000000,58.91], [1173740400000,57.93], [1173826800000,58.16], [1173913200000,57.55], [1173999600000,57.11], [1174258800000,56.59], [1174345200000,59.61], [1174518000000,61.69], [1174604400000,62.28], [1174860000000,62.91], [1174946400000,62.93], [1175032800000,64.03], [1175119200000,66.03], [1175205600000,65.87], [1175464800000,64.64], [1175637600000,64.38], [1175724000000,64.28], [1175810400000,64.28], [1176069600000,61.51], [1176156000000,61.89], [1176242400000,62.01], [1176328800000,63.85], [1176415200000,63.63], [1176674400000,63.61], [1176760800000,63.10], [1176847200000,63.13], [1176933600000,61.83], [1177020000000,63.38], [1177279200000,64.58], [1177452000000,65.84], [1177538400000,65.06], [1177624800000,66.46], [1177884000000,64.40], [1178056800000,63.68], [1178143200000,63.19], [1178229600000,61.93], [1178488800000,61.47], [1178575200000,61.55], [1178748000000,61.81], [1178834400000,62.37], [1179093600000,62.46], [1179180000000,63.17], [1179266400000,62.55], [1179352800000,64.94], [1179698400000,66.27], [1179784800000,65.50], [1179871200000,65.77], [1179957600000,64.18], [1180044000000,65.20], [1180389600000,63.15], [1180476000000,63.49], [1180562400000,65.08], [1180908000000,66.30], [1180994400000,65.96], [1181167200000,66.93], [1181253600000,65.98], [1181599200000,65.35], [1181685600000,66.26], [1181858400000,68.00], [1182117600000,69.09], [1182204000000,69.10], [1182290400000,68.19], [1182376800000,68.19], [1182463200000,69.14], [1182722400000,68.19], [1182808800000,67.77], [1182895200000,68.97], [1182981600000,69.57], [1183068000000,70.68], [1183327200000,71.09], [1183413600000,70.92], [1183586400000,71.81], [1183672800000,72.81], [1183932000000,72.19], [1184018400000,72.56], [1184191200000,72.50], [1184277600000,74.15], [1184623200000,75.05], [1184796000000,75.92], [1184882400000,75.57], [1185141600000,74.89], [1185228000000,73.56], [1185314400000,75.57], [1185400800000,74.95], [1185487200000,76.83], [1185832800000,78.21], [1185919200000,76.53], [1186005600000,76.86], [1186092000000,76.00], [1186437600000,71.59], [1186696800000,71.47], [1186956000000,71.62], [1187042400000,71.00], [1187301600000,71.98], [1187560800000,71.12], [1187647200000,69.47], [1187733600000,69.26], [1187820000000,69.83], [1187906400000,71.09], [1188165600000,71.73], [1188338400000,73.36], [1188511200000,74.04], [1188856800000,76.30], [1189116000000,77.49], [1189461600000,78.23], [1189548000000,79.91], [1189634400000,80.09], [1189720800000,79.10], [1189980000000,80.57], [1190066400000,81.93], [1190239200000,83.32], [1190325600000,81.62], [1190584800000,80.95], [1190671200000,79.53], [1190757600000,80.30], [1190844000000,82.88], [1190930400000,81.66], [1191189600000,80.24], [1191276000000,80.05], [1191362400000,79.94], [1191448800000,81.44], [1191535200000,81.22], [1191794400000,79.02], [1191880800000,80.26], [1191967200000,80.30], [1192053600000,83.08], [1192140000000,83.69], [1192399200000,86.13], [1192485600000,87.61], [1192572000000,87.40], [1192658400000,89.47], [1192744800000,88.60], [1193004000000,87.56], [1193090400000,87.56], [1193176800000,87.10], [1193263200000,91.86], [1193612400000,93.53], [1193698800000,94.53], [1193871600000,95.93], [1194217200000,93.98], [1194303600000,96.37], [1194476400000,95.46], [1194562800000,96.32], [1195081200000,93.43], [1195167600000,95.10], [1195426800000,94.64], [1195513200000,95.10], [1196031600000,97.70], [1196118000000,94.42], [1196204400000,90.62], [1196290800000,91.01], [1196377200000,88.71], [1196636400000,88.32], [1196809200000,90.23], [1196982000000,88.28], [1197241200000,87.86], [1197327600000,90.02], [1197414000000,92.25], [1197586800000,90.63], [1197846000000,90.63], [1197932400000,90.49], [1198018800000,91.24], [1198105200000,91.06], [1198191600000,90.49], [1198710000000,96.62], [1198796400000,96.00], [1199142000000,99.62], [1199314800000,99.18], [1199401200000,95.09], [1199660400000,96.33], [1199833200000,95.67], [1200351600000,91.90], [1200438000000,90.84], [1200524400000,90.13], [1200610800000,90.57], [1200956400000,89.21], [1201042800000,86.99], [1201129200000,89.85], [1201474800000,90.99], [1201561200000,91.64], [1201647600000,92.33], [1201734000000,91.75], [1202079600000,90.02], [1202166000000,88.41], [1202252400000,87.14], [1202338800000,88.11], [1202425200000,91.77], [1202770800000,92.78], [1202857200000,93.27], [1202943600000,95.46], [1203030000000,95.46], [1203289200000,101.74], [1203462000000,98.81], [1203894000000,100.88], [1204066800000,99.64], [1204153200000,102.59], [1204239600000,101.84], [1204498800000,99.52], [1204585200000,99.52], [1204671600000,104.52], [1204758000000,105.47], [1204844400000,105.15], [1205103600000,108.75], [1205276400000,109.92], [1205362800000,110.33], [1205449200000,110.21], [1205708400000,105.68], [1205967600000,101.84], [1206313200000,100.86], [1206399600000,101.22], [1206486000000,105.90], [1206572400000,107.58], [1206658800000,105.62], [1206914400000,101.58], [1207000800000,100.98], [1207173600000,103.83], [1207260000000,106.23], [1207605600000,108.50], [1207778400000,110.11], [1207864800000,110.14], [1208210400000,113.79], [1208296800000,114.93], [1208383200000,114.86], [1208728800000,117.48], [1208815200000,118.30], [1208988000000,116.06], [1209074400000,118.52], [1209333600000,118.75], [1209420000000,113.46], [1209592800000,112.52], [1210024800000,121.84], [1210111200000,123.53], [1210197600000,123.69], [1210543200000,124.23], [1210629600000,125.80], [1210716000000,126.29], [1211148000000,127.05], [1211320800000,129.07], [1211493600000,132.19], [1211839200000,128.85], [1212357600000,127.76], [1212703200000,138.54], [1212962400000,136.80], [1213135200000,136.38], [1213308000000,134.86], [1213653600000,134.01], [1213740000000,136.68], [1213912800000,135.65], [1214172000000,134.62], [1214258400000,134.62], [1214344800000,134.62], [1214431200000,139.64], [1214517600000,140.21], [1214776800000,140.00], [1214863200000,140.97], [1214949600000,143.57], [1215036000000,145.29], [1215381600000,141.37], [1215468000000,136.04], [1215727200000,146.40], [1215986400000,145.18], [1216072800000,138.74], [1216159200000,134.60], [1216245600000,129.29], [1216332000000,130.65], [1216677600000,127.95], [1216850400000,127.95], [1217282400000,122.19], [1217455200000,124.08], [1217541600000,125.10], [1217800800000,121.41], [1217887200000,119.17], [1217973600000,118.58], [1218060000000,120.02], [1218405600000,114.45], [1218492000000,113.01], [1218578400000,116.00], [1218751200000,113.77], [1219010400000,112.87], [1219096800000,114.53], [1219269600000,114.98], [1219356000000,114.98], [1219701600000,116.27], [1219788000000,118.15], [1219874400000,115.59], [1219960800000,115.46], [1220306400000,109.71], [1220392800000,109.35], [1220565600000,106.23], [1220824800000,106.34]];  
var exchangerates = [[1167606000000,0.7580], [1167692400000,0.7580], [1167778800000,0.75470], [1167865200000,0.75490], [1167951600000,0.76130], [1168038000000,0.76550], [1168124400000,0.76930], [1168210800000,0.76940], [1168297200000,0.76880], [1168383600000,0.76780], [1168470000000,0.77080], [1168556400000,0.77270], [1168642800000,0.77490], [1168729200000,0.77410], [1168815600000,0.77410], [1168902000000,0.77320], [1168988400000,0.77270], [1169074800000,0.77370], [1169161200000,0.77240], [1169247600000,0.77120], [1169334000000,0.7720], [1169420400000,0.77210], [1169506800000,0.77170], [1169593200000,0.77040], [1169679600000,0.7690], [1169766000000,0.77110], [1169852400000,0.7740], [1169938800000,0.77450], [1170025200000,0.77450], [1170111600000,0.7740], [1170198000000,0.77160], [1170284400000,0.77130], [1170370800000,0.76780], [1170457200000,0.76880], [1170543600000,0.77180], [1170630000000,0.77180], [1170716400000,0.77280], [1170802800000,0.77290], [1170889200000,0.76980], [1170975600000,0.76850], [1171062000000,0.76810], [1171148400000,0.7690], [1171234800000,0.7690], [1171321200000,0.76980], [1171407600000,0.76990], [1171494000000,0.76510], [1171580400000,0.76130], [1171666800000,0.76160], [1171753200000,0.76140], [1171839600000,0.76140], [1171926000000,0.76070], [1172012400000,0.76020], [1172098800000,0.76110], [1172185200000,0.76220], [1172271600000,0.76150], [1172358000000,0.75980], [1172444400000,0.75980], [1172530800000,0.75920], [1172617200000,0.75730], [1172703600000,0.75660], [1172790000000,0.75670], [1172876400000,0.75910], [1172962800000,0.75820], [1173049200000,0.75850], [1173135600000,0.76130], [1173222000000,0.76310], [1173308400000,0.76150], [1173394800000,0.760], [1173481200000,0.76130], [1173567600000,0.76270], [1173654000000,0.76270], [1173740400000,0.76080], [1173826800000,0.75830], [1173913200000,0.75750], [1173999600000,0.75620], [1174086000000,0.7520], [1174172400000,0.75120], [1174258800000,0.75120], [1174345200000,0.75170], [1174431600000,0.7520], [1174518000000,0.75110], [1174604400000,0.7480], [1174690800000,0.75090], [1174777200000,0.75310], [1174860000000,0.75310], [1174946400000,0.75270], [1175032800000,0.74980], [1175119200000,0.74930], [1175205600000,0.75040], [1175292000000,0.750], [1175378400000,0.74910], [1175464800000,0.74910], [1175551200000,0.74850], [1175637600000,0.74840], [1175724000000,0.74920], [1175810400000,0.74710], [1175896800000,0.74590], [1175983200000,0.74770], [1176069600000,0.74770], [1176156000000,0.74830], [1176242400000,0.74580], [1176328800000,0.74480], [1176415200000,0.7430], [1176501600000,0.73990], [1176588000000,0.73950], [1176674400000,0.73950], [1176760800000,0.73780], [1176847200000,0.73820], [1176933600000,0.73620], [1177020000000,0.73550], [1177106400000,0.73480], [1177192800000,0.73610], [1177279200000,0.73610], [1177365600000,0.73650], [1177452000000,0.73620], [1177538400000,0.73310], [1177624800000,0.73390], [1177711200000,0.73440], [1177797600000,0.73270], [1177884000000,0.73270], [1177970400000,0.73360], [1178056800000,0.73330], [1178143200000,0.73590], [1178229600000,0.73590], [1178316000000,0.73720], [1178402400000,0.7360], [1178488800000,0.7360], [1178575200000,0.7350], [1178661600000,0.73650], [1178748000000,0.73840], [1178834400000,0.73950], [1178920800000,0.74130], [1179007200000,0.73970], [1179093600000,0.73960], [1179180000000,0.73850], [1179266400000,0.73780], [1179352800000,0.73660], [1179439200000,0.740], [1179525600000,0.74110], [1179612000000,0.74060], [1179698400000,0.74050], [1179784800000,0.74140], [1179871200000,0.74310], [1179957600000,0.74310], [1180044000000,0.74380], [1180130400000,0.74430], [1180216800000,0.74430], [1180303200000,0.74430], [1180389600000,0.74340], [1180476000000,0.74290], [1180562400000,0.74420], [1180648800000,0.7440], [1180735200000,0.74390], [1180821600000,0.74370], [1180908000000,0.74370], [1180994400000,0.74290], [1181080800000,0.74030], [1181167200000,0.73990], [1181253600000,0.74180], [1181340000000,0.74680], [1181426400000,0.7480], [1181512800000,0.7480], [1181599200000,0.7490], [1181685600000,0.74940], [1181772000000,0.75220], [1181858400000,0.75150], [1181944800000,0.75020], [1182031200000,0.74720], [1182117600000,0.74720], [1182204000000,0.74620], [1182290400000,0.74550], [1182376800000,0.74490], [1182463200000,0.74670], [1182549600000,0.74580], [1182636000000,0.74270], [1182722400000,0.74270], [1182808800000,0.7430], [1182895200000,0.74290], [1182981600000,0.7440], [1183068000000,0.7430], [1183154400000,0.74220], [1183240800000,0.73880], [1183327200000,0.73880], [1183413600000,0.73690], [1183500000000,0.73450], [1183586400000,0.73450], [1183672800000,0.73450], [1183759200000,0.73520], [1183845600000,0.73410], [1183932000000,0.73410], [1184018400000,0.7340], [1184104800000,0.73240], [1184191200000,0.72720], [1184277600000,0.72640], [1184364000000,0.72550], [1184450400000,0.72580], [1184536800000,0.72580], [1184623200000,0.72560], [1184709600000,0.72570], [1184796000000,0.72470], [1184882400000,0.72430], [1184968800000,0.72440], [1185055200000,0.72350], [1185141600000,0.72350], [1185228000000,0.72350], [1185314400000,0.72350], [1185400800000,0.72620], [1185487200000,0.72880], [1185573600000,0.73010], [1185660000000,0.73370], [1185746400000,0.73370], [1185832800000,0.73240], [1185919200000,0.72970], [1186005600000,0.73170], [1186092000000,0.73150], [1186178400000,0.72880], [1186264800000,0.72630], [1186351200000,0.72630], [1186437600000,0.72420], [1186524000000,0.72530], [1186610400000,0.72640], [1186696800000,0.7270], [1186783200000,0.73120], [1186869600000,0.73050], [1186956000000,0.73050], [1187042400000,0.73180], [1187128800000,0.73580], [1187215200000,0.74090], [1187301600000,0.74540], [1187388000000,0.74370], [1187474400000,0.74240], [1187560800000,0.74240], [1187647200000,0.74150], [1187733600000,0.74190], [1187820000000,0.74140], [1187906400000,0.73770], [1187992800000,0.73550], [1188079200000,0.73150], [1188165600000,0.73150], [1188252000000,0.7320], [1188338400000,0.73320], [1188424800000,0.73460], [1188511200000,0.73280], [1188597600000,0.73230], [1188684000000,0.7340], [1188770400000,0.7340], [1188856800000,0.73360], [1188943200000,0.73510], [1189029600000,0.73460], [1189116000000,0.73210], [1189202400000,0.72940], [1189288800000,0.72660], [1189375200000,0.72660], [1189461600000,0.72540], [1189548000000,0.72420], [1189634400000,0.72130], [1189720800000,0.71970], [1189807200000,0.72090], [1189893600000,0.7210], [1189980000000,0.7210], [1190066400000,0.7210], [1190152800000,0.72090], [1190239200000,0.71590], [1190325600000,0.71330], [1190412000000,0.71050], [1190498400000,0.70990], [1190584800000,0.70990], [1190671200000,0.70930], [1190757600000,0.70930], [1190844000000,0.70760], [1190930400000,0.7070], [1191016800000,0.70490], [1191103200000,0.70120], [1191189600000,0.70110], [1191276000000,0.70190], [1191362400000,0.70460], [1191448800000,0.70630], [1191535200000,0.70890], [1191621600000,0.70770], [1191708000000,0.70770], [1191794400000,0.70770], [1191880800000,0.70910], [1191967200000,0.71180], [1192053600000,0.70790], [1192140000000,0.70530], [1192226400000,0.7050], [1192312800000,0.70550], [1192399200000,0.70550], [1192485600000,0.70450], [1192572000000,0.70510], [1192658400000,0.70510], [1192744800000,0.70170], [1192831200000,0.70], [1192917600000,0.69950], [1193004000000,0.69940], [1193090400000,0.70140], [1193176800000,0.70360], [1193263200000,0.70210], [1193349600000,0.70020], [1193436000000,0.69670], [1193522400000,0.6950], [1193612400000,0.6950], [1193698800000,0.69390], [1193785200000,0.6940], [1193871600000,0.69220], [1193958000000,0.69190], [1194044400000,0.69140], [1194130800000,0.68940], [1194217200000,0.68910], [1194303600000,0.69040], [1194390000000,0.6890], [1194476400000,0.68340], [1194562800000,0.68230], [1194649200000,0.68070], [1194735600000,0.68150], [1194822000000,0.68150], [1194908400000,0.68470], [1194994800000,0.68590], [1195081200000,0.68220], [1195167600000,0.68270], [1195254000000,0.68370], [1195340400000,0.68230], [1195426800000,0.68220], [1195513200000,0.68220], [1195599600000,0.67920], [1195686000000,0.67460], [1195772400000,0.67350], [1195858800000,0.67310], [1195945200000,0.67420], [1196031600000,0.67440], [1196118000000,0.67390], [1196204400000,0.67310], [1196290800000,0.67610], [1196377200000,0.67610], [1196463600000,0.67850], [1196550000000,0.68180], [1196636400000,0.68360], [1196722800000,0.68230], [1196809200000,0.68050], [1196895600000,0.67930], [1196982000000,0.68490], [1197068400000,0.68330], [1197154800000,0.68250], [1197241200000,0.68250], [1197327600000,0.68160], [1197414000000,0.67990], [1197500400000,0.68130], [1197586800000,0.68090], [1197673200000,0.68680], [1197759600000,0.69330], [1197846000000,0.69330], [1197932400000,0.69450], [1198018800000,0.69440], [1198105200000,0.69460], [1198191600000,0.69640], [1198278000000,0.69650], [1198364400000,0.69560], [1198450800000,0.69560], [1198537200000,0.6950], [1198623600000,0.69480], [1198710000000,0.69280], [1198796400000,0.68870], [1198882800000,0.68240], [1198969200000,0.67940], [1199055600000,0.67940], [1199142000000,0.68030], [1199228400000,0.68550], [1199314800000,0.68240], [1199401200000,0.67910], [1199487600000,0.67830], [1199574000000,0.67850], [1199660400000,0.67850], [1199746800000,0.67970], [1199833200000,0.680], [1199919600000,0.68030], [1200006000000,0.68050], [1200092400000,0.6760], [1200178800000,0.6770], [1200265200000,0.6770], [1200351600000,0.67360], [1200438000000,0.67260], [1200524400000,0.67640], [1200610800000,0.68210], [1200697200000,0.68310], [1200783600000,0.68420], [1200870000000,0.68420], [1200956400000,0.68870], [1201042800000,0.69030], [1201129200000,0.68480], [1201215600000,0.68240], [1201302000000,0.67880], [1201388400000,0.68140], [1201474800000,0.68140], [1201561200000,0.67970], [1201647600000,0.67690], [1201734000000,0.67650], [1201820400000,0.67330], [1201906800000,0.67290], [1201993200000,0.67580], [1202079600000,0.67580], [1202166000000,0.6750], [1202252400000,0.6780], [1202338800000,0.68330], [1202425200000,0.68560], [1202511600000,0.69030], [1202598000000,0.68960], [1202684400000,0.68960], [1202770800000,0.68820], [1202857200000,0.68790], [1202943600000,0.68620], [1203030000000,0.68520], [1203116400000,0.68230], [1203202800000,0.68130], [1203289200000,0.68130], [1203375600000,0.68220], [1203462000000,0.68020], [1203548400000,0.68020], [1203634800000,0.67840], [1203721200000,0.67480], [1203807600000,0.67470], [1203894000000,0.67470], [1203980400000,0.67480], [1204066800000,0.67330], [1204153200000,0.6650], [1204239600000,0.66110], [1204326000000,0.65830], [1204412400000,0.6590], [1204498800000,0.6590], [1204585200000,0.65810], [1204671600000,0.65780], [1204758000000,0.65740], [1204844400000,0.65320], [1204930800000,0.65020], [1205017200000,0.65140], [1205103600000,0.65140], [1205190000000,0.65070], [1205276400000,0.6510], [1205362800000,0.64890], [1205449200000,0.64240], [1205535600000,0.64060], [1205622000000,0.63820], [1205708400000,0.63820], [1205794800000,0.63410], [1205881200000,0.63440], [1205967600000,0.63780], [1206054000000,0.64390], [1206140400000,0.64780], [1206226800000,0.64810], [1206313200000,0.64810], [1206399600000,0.64940], [1206486000000,0.64380], [1206572400000,0.63770], [1206658800000,0.63290], [1206745200000,0.63360], [1206831600000,0.63330], [1206914400000,0.63330], [1207000800000,0.6330], [1207087200000,0.63710], [1207173600000,0.64030], [1207260000000,0.63960], [1207346400000,0.63640], [1207432800000,0.63560], [1207519200000,0.63560], [1207605600000,0.63680], [1207692000000,0.63570], [1207778400000,0.63540], [1207864800000,0.6320], [1207951200000,0.63320], [1208037600000,0.63280], [1208124000000,0.63310], [1208210400000,0.63420], [1208296800000,0.63210], [1208383200000,0.63020], [1208469600000,0.62780], [1208556000000,0.63080], [1208642400000,0.63240], [1208728800000,0.63240], [1208815200000,0.63070], [1208901600000,0.62770], [1208988000000,0.62690], [1209074400000,0.63350], [1209160800000,0.63920], [1209247200000,0.640], [1209333600000,0.64010], [1209420000000,0.63960], [1209506400000,0.64070], [1209592800000,0.64230], [1209679200000,0.64290], [1209765600000,0.64720], [1209852000000,0.64850], [1209938400000,0.64860], [1210024800000,0.64670], [1210111200000,0.64440], [1210197600000,0.64670], [1210284000000,0.65090], [1210370400000,0.64780], [1210456800000,0.64610], [1210543200000,0.64610], [1210629600000,0.64680], [1210716000000,0.64490], [1210802400000,0.6470], [1210888800000,0.64610], [1210975200000,0.64520], [1211061600000,0.64220], [1211148000000,0.64220], [1211234400000,0.64250], [1211320800000,0.64140], [1211407200000,0.63660], [1211493600000,0.63460], [1211580000000,0.6350], [1211666400000,0.63460], [1211752800000,0.63460], [1211839200000,0.63430], [1211925600000,0.63460], [1212012000000,0.63790], [1212098400000,0.64160], [1212184800000,0.64420], [1212271200000,0.64310], [1212357600000,0.64310], [1212444000000,0.64350], [1212530400000,0.6440], [1212616800000,0.64730], [1212703200000,0.64690], [1212789600000,0.63860], [1212876000000,0.63560], [1212962400000,0.6340], [1213048800000,0.63460], [1213135200000,0.6430], [1213221600000,0.64520], [1213308000000,0.64670], [1213394400000,0.65060], [1213480800000,0.65040], [1213567200000,0.65030], [1213653600000,0.64810], [1213740000000,0.64510], [1213826400000,0.6450], [1213912800000,0.64410], [1213999200000,0.64140], [1214085600000,0.64090], [1214172000000,0.64090], [1214258400000,0.64280], [1214344800000,0.64310], [1214431200000,0.64180], [1214517600000,0.63710], [1214604000000,0.63490], [1214690400000,0.63330], [1214776800000,0.63340], [1214863200000,0.63380], [1214949600000,0.63420], [1215036000000,0.6320], [1215122400000,0.63180], [1215208800000,0.6370], [1215295200000,0.63680], [1215381600000,0.63680], [1215468000000,0.63830], [1215554400000,0.63710], [1215640800000,0.63710], [1215727200000,0.63550], [1215813600000,0.6320], [1215900000000,0.62770], [1215986400000,0.62760], [1216072800000,0.62910], [1216159200000,0.62740], [1216245600000,0.62930], [1216332000000,0.63110], [1216418400000,0.6310], [1216504800000,0.63120], [1216591200000,0.63120], [1216677600000,0.63040], [1216764000000,0.62940], [1216850400000,0.63480], [1216936800000,0.63780], [1217023200000,0.63680], [1217109600000,0.63680], [1217196000000,0.63680], [1217282400000,0.6360], [1217368800000,0.6370], [1217455200000,0.64180], [1217541600000,0.64110], [1217628000000,0.64350], [1217714400000,0.64270], [1217800800000,0.64270], [1217887200000,0.64190], [1217973600000,0.64460], [1218060000000,0.64680], [1218146400000,0.64870], [1218232800000,0.65940], [1218319200000,0.66660], [1218405600000,0.66660], [1218492000000,0.66780], [1218578400000,0.67120], [1218664800000,0.67050], [1218751200000,0.67180], [1218837600000,0.67840], [1218924000000,0.68110], [1219010400000,0.68110], [1219096800000,0.67940], [1219183200000,0.68040], [1219269600000,0.67810], [1219356000000,0.67560], [1219442400000,0.67350], [1219528800000,0.67630], [1219615200000,0.67620], [1219701600000,0.67770], [1219788000000,0.68150], [1219874400000,0.68020], [1219960800000,0.6780], [1220047200000,0.67960], [1220133600000,0.68170], [1220220000000,0.68170], [1220306400000,0.68320], [1220392800000,0.68770], [1220479200000,0.69120], [1220565600000,0.69140], [1220652000000,0.70090], [1220738400000,0.70120], [1220824800000,0.7010], [1220911200000,0.70050]];  
 
$.plot($("#placeholder"),  
[ { data: oilprices, label: "Oil price ($)" },  
{ data: exchangerates, label: "USD/EUR exchange rate", yaxis: 2 }],  
{  
xaxis: { mode: 'time' },  
yaxis: { min: 0 },  
y2axis: { tickFormatter: function (v, axis) { return v.toFixed(axis.tickDecimals) +"€" }},  
legend: { position: 'sw' } });  
});  
</script>  
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
<p>Flot supports lines, points, filled areas, bars and any  
combinations of these, in the same plot and even on the same data  
series.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var d1 = [];  
for (var i = 0; i < 14; i += 0.5)  
d1.push([i, Math.sin(i)]);  
 
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];  
 
var d3 = [];  
for (var i = 0; i < 14; i += 0.5)  
d3.push([i, Math.cos(i)]);  
 
var d4 = [];  
for (var i = 0; i < 14; i += 0.1)  
d4.push([i, Math.sqrt(i * 10)]);  
 
var d5 = [];  
for (var i = 0; i < 14; i += 0.5)  
d5.push([i, Math.sqrt(i)]);  
 
var d6 = [];  
for (var i = 0; i < 14; i += 0.5 + Math.random())  
d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);  
 
$.plot($("#placeholder"), [  
{  
data: d1,  
lines: { show: true, fill: true }  
},  
{  
data: d2,  
bars: { show: true }  
},  
{  
data: d3,  
points: { show: true }  
},  
{  
data: d4,  
lines: { show: true }  
},  
{  
data: d5,  
lines: { show: true },  
points: { show: true }  
},  
{  
data: d6,  
lines: { show: true, steps: true }  
}  
]);  
});  
</script>  
 
</body>  
</html>  
 
 Binary files a/busui/owa/modules/base/js/includes/jquery/flot/examples/hs-2004-27-a-large_web.jpg and /dev/null differ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.image.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:400px;height:400px;"></div>  
 
<p>The Cat's Eye Nebula (<a href="http://hubblesite.org/gallery/album/nebula/pr2004027a/">picture from Hubble</a>).</p>  
 
<p>With the image plugin, you can plot images. This is for example  
useful for getting ticks on complex prerendered visualizations.  
Instead of inputting data points, you put in the images and where  
their two opposite corners are supposed to be in plot space.</p>  
 
<p>Images represent a little further complication because you need  
to make sure they are loaded before you can use them (Flot skips  
incomplete images). The plugin comes with a couple of helpers  
for doing that.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var data = [ [ ["hs-2004-27-a-large_web.jpg", -10, -10, 10, 10] ] ];  
var options = {  
series: { images: { show: true } },  
xaxis: { min: -8, max: 4 },  
yaxis: { min: -8, max: 4 }  
};  
 
$.plot.image.loadDataImages(data, options, function () {  
$.plot($("#placeholder"), data, options);  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<p>Here are some examples for <a href="http://code.google.com/p/flot/">Flot</a>, the Javascript charting library for jQuery:</p>  
 
<ul>  
<li><a href="basic.html">Basic example</a></li>  
<li><a href="graph-types.html">Different graph types</a></li>  
<li><a href="setting-options.html">Setting various options</a> and <a href="annotating.html">annotating a chart</a></li>  
<li><a href="ajax.html">Updating graphs with AJAX</a></li>  
</ul>  
 
<p>Being interactive:</p>  
 
<ul>  
<li><a href="turning-series.html">Turning series on/off</a></li>  
<li><a href="selection.html">Rectangular selection support and zooming</a> and <a href="zooming.html">zooming with overview</a></li> (both with selection plugin)  
<li><a href="interacting.html">Interacting with the data points</a></li>  
<li><a href="navigate.html">Panning and zooming</a> (with navigation plugin)</li>  
</ul>  
 
<p>Some more esoteric features:</p>  
 
<ul>  
<li><a href="time.html">Plotting time series</a> and <a href="visitors.html">visitors per day with zooming and weekends</a> (with selection plugin)</li>  
<li><a href="dual-axis.html">Dual axis support</a></li>  
<li><a href="thresholding.html">Thresholding the data</a> (with threshold plugin)</li>  
<li><a href="stacking.html">Stacked charts</a> (with stacking plugin)</li>  
<li><a href="tracking.html">Tracking curves with crosshair</a> (with crosshair plugin)</li>  
<li><a href="image.html">Plotting prerendered images</a> (with image plugin)</li>  
</ul>  
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
<p>One of the goals of Flot is to support user interactions. Try  
pointing and clicking on the points.</p>  
 
<p id="hoverdata">Mouse hovers at  
(<span id="x">0</span>, <span id="y">0</span>). <span id="clickdata"></span></p>  
 
<p>A tooltip is easy to build with a bit of jQuery code and the  
data returned from the plot.</p>  
 
<p><input id="enableTooltip" type="checkbox">Enable tooltip</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var sin = [], cos = [];  
for (var i = 0; i < 14; i += 0.5) {  
sin.push([i, Math.sin(i)]);  
cos.push([i, Math.cos(i)]);  
}  
 
var plot = $.plot($("#placeholder"),  
[ { data: sin, label: "sin(x)"}, { data: cos, label: "cos(x)" } ], {  
series: {  
lines: { show: true },  
points: { show: true }  
},  
grid: { hoverable: true, clickable: true },  
yaxis: { min: -1.2, max: 1.2 }  
});  
 
function showTooltip(x, y, contents) {  
$('<div id="tooltip">' + contents + '</div>').css( {  
position: 'absolute',  
display: 'none',  
top: y + 5,  
left: x + 5,  
border: '1px solid #fdd',  
padding: '2px',  
'background-color': '#fee',  
opacity: 0.80  
}).appendTo("body").fadeIn(200);  
}  
 
var previousPoint = null;  
$("#placeholder").bind("plothover", function (event, pos, item) {  
$("#x").text(pos.x.toFixed(2));  
$("#y").text(pos.y.toFixed(2));  
 
if ($("#enableTooltip:checked").length > 0) {  
if (item) {  
if (previousPoint != item.datapoint) {  
previousPoint = item.datapoint;  
 
$("#tooltip").remove();  
var x = item.datapoint[0].toFixed(2),  
y = item.datapoint[1].toFixed(2);  
 
showTooltip(item.pageX, item.pageY,  
item.series.label + " of " + x + " = " + y);  
}  
}  
else {  
$("#tooltip").remove();  
previousPoint = null;  
}  
}  
});  
 
$("#placeholder").bind("plotclick", function (event, pos, item) {  
if (item) {  
$("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + ".");  
plot.highlight(item.series, item.datapoint);  
}  
});  
});  
</script>  
 
</body>  
</html>  
 
body {  
font-family: sans-serif;  
font-size: 16px;  
margin: 50px;  
max-width: 800px;  
}  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.navigate.js"></script>  
<style>  
#placeholder .button {  
position: absolute;  
cursor: pointer;  
}  
#placeholder div.button {  
font-size: smaller;  
color: #999;  
background-color: #eee;  
padding: 2px;  
}  
.message {  
padding-left: 50px;  
font-size: smaller;  
}  
</style>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p class="message"></p>  
 
<p>With the navigate plugin it is easy to add panning and zooming.  
Drag to pan, double click to zoom (or use the mouse scrollwheel).</p>  
 
<p>The plugin fires events (useful for synchronizing several  
plots) and adds a couple of public methods so you can easily build  
a little user interface around it, like the little buttons at the  
top right in the plot.</p>  
 
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
// generate data set from a parametric function with a fractal  
// look  
function sumf(f, t, m) {  
var res = 0;  
for (var i = 1; i < m; ++i)  
res += f(i * i * t) / (i * i);  
return res;  
}  
 
var d1 = [];  
for (var t = 0; t <= 2 * Math.PI; t += 0.01)  
d1.push([sumf(Math.cos, t, 10), sumf(Math.sin, t, 10)]);  
var data = [ d1 ];  
 
 
var placeholder = $("#placeholder");  
var options = {  
series: { lines: { show: true }, shadowSize: 0 },  
xaxis: { zoomRange: [0.1, 10], panRange: [-10, 10] },  
yaxis: { zoomRange: [0.1, 10], panRange: [-10, 10] },  
zoom: {  
interactive: true  
},  
pan: {  
interactive: true  
}  
};  
 
var plot = $.plot(placeholder, data, options);  
 
// show pan/zoom messages to illustrate events  
placeholder.bind('plotpan', function (event, plot) {  
var axes = plot.getAxes();  
$(".message").html("Panning to x: " + axes.xaxis.min.toFixed(2)  
+ " &ndash; " + axes.xaxis.max.toFixed(2)  
+ " and y: " + axes.yaxis.min.toFixed(2)  
+ " &ndash; " + axes.yaxis.max.toFixed(2));  
});  
 
placeholder.bind('plotzoom', function (event, plot) {  
var axes = plot.getAxes();  
$(".message").html("Zooming to x: " + axes.xaxis.min.toFixed(2)  
+ " &ndash; " + axes.xaxis.max.toFixed(2)  
+ " and y: " + axes.yaxis.min.toFixed(2)  
+ " &ndash; " + axes.yaxis.max.toFixed(2));  
});  
 
// add zoom out button  
$('<div class="button" style="right:20px;top:20px">zoom out</div>').appendTo(placeholder).click(function (e) {  
e.preventDefault();  
plot.zoomOut();  
});  
 
// and add panning buttons  
 
// little helper for taking the repetitive work out of placing  
// panning arrows  
function addArrow(dir, right, top, offset) {  
$('<img class="button" src="arrow-' + dir + '.gif" style="right:' + right + 'px;top:' + top + 'px">').appendTo(placeholder).click(function (e) {  
e.preventDefault();  
plot.pan(offset);  
});  
}  
 
addArrow('left', 55, 60, { left: -100 });  
addArrow('right', 25, 60, { left: 100 });  
addArrow('up', 40, 45, { top: -100 });  
addArrow('down', 40, 75, { top: 100 });  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.selection.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
<p>1000 kg. CO<sub>2</sub> emissions per year per capita for various countries (source: <a href="http://en.wikipedia.org/wiki/List_of_countries_by_carbon_dioxide_emissions_per_capita">Wikipedia</a>).</p>  
 
<p>Flot supports selections through the selection plugin.  
You can enable rectangular selection  
or one-dimensional selection if the user should only be able to  
select on one axis. Try left-click and drag on the plot above  
where selection on the x axis is enabled.</p>  
 
<p>You selected: <span id="selection"></span></p>  
 
<p>The plot command returns a plot object you can use to control  
the selection. Click the buttons below.</p>  
 
<p><input id="clearSelection" type="button" value="Clear selection" />  
<input id="setSelection" type="button" value="Select year 1994" /></p>  
 
<p>Selections are really useful for zooming. Just replot the  
chart with min and max values for the axes set to the values  
in the "plotselected" event triggered. Enable the checkbox  
below and select a region again.</p>  
 
<p><input id="zoom" type="checkbox">Zoom to selection.</input></p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var data = [  
{  
label: "United States",  
data: [[1990, 18.9], [1991, 18.7], [1992, 18.4], [1993, 19.3], [1994, 19.5], [1995, 19.3], [1996, 19.4], [1997, 20.2], [1998, 19.8], [1999, 19.9], [2000, 20.4], [2001, 20.1], [2002, 20.0], [2003, 19.8], [2004, 20.4]]  
},  
{  
label: "Russia",  
data: [[1992, 13.4], [1993, 12.2], [1994, 10.6], [1995, 10.2], [1996, 10.1], [1997, 9.7], [1998, 9.5], [1999, 9.7], [2000, 9.9], [2001, 9.9], [2002, 9.9], [2003, 10.3], [2004, 10.5]]  
},  
{  
label: "United Kingdom",  
data: [[1990, 10.0], [1991, 11.3], [1992, 9.9], [1993, 9.6], [1994, 9.5], [1995, 9.5], [1996, 9.9], [1997, 9.3], [1998, 9.2], [1999, 9.2], [2000, 9.5], [2001, 9.6], [2002, 9.3], [2003, 9.4], [2004, 9.79]]  
},  
{  
label: "Germany",  
data: [[1990, 12.4], [1991, 11.2], [1992, 10.8], [1993, 10.5], [1994, 10.4], [1995, 10.2], [1996, 10.5], [1997, 10.2], [1998, 10.1], [1999, 9.6], [2000, 9.7], [2001, 10.0], [2002, 9.7], [2003, 9.8], [2004, 9.79]]  
},  
{  
label: "Denmark",  
data: [[1990, 9.7], [1991, 12.1], [1992, 10.3], [1993, 11.3], [1994, 11.7], [1995, 10.6], [1996, 12.8], [1997, 10.8], [1998, 10.3], [1999, 9.4], [2000, 8.7], [2001, 9.0], [2002, 8.9], [2003, 10.1], [2004, 9.80]]  
},  
{  
label: "Sweden",  
data: [[1990, 5.8], [1991, 6.0], [1992, 5.9], [1993, 5.5], [1994, 5.7], [1995, 5.3], [1996, 6.1], [1997, 5.4], [1998, 5.4], [1999, 5.1], [2000, 5.2], [2001, 5.4], [2002, 6.2], [2003, 5.9], [2004, 5.89]]  
},  
{  
label: "Norway",  
data: [[1990, 8.3], [1991, 8.3], [1992, 7.8], [1993, 8.3], [1994, 8.4], [1995, 5.9], [1996, 6.4], [1997, 6.7], [1998, 6.9], [1999, 7.6], [2000, 7.4], [2001, 8.1], [2002, 12.5], [2003, 9.9], [2004, 19.0]]  
}  
];  
 
var options = {  
series: {  
lines: { show: true },  
points: { show: true }  
},  
legend: { noColumns: 2 },  
xaxis: { tickDecimals: 0 },  
yaxis: { min: 0 },  
selection: { mode: "x" }  
};  
 
var placeholder = $("#placeholder");  
 
placeholder.bind("plotselected", function (event, ranges) {  
$("#selection").text(ranges.xaxis.from.toFixed(1) + " to " + ranges.xaxis.to.toFixed(1));  
 
var zoom = $("#zoom").attr("checked");  
if (zoom)  
plot = $.plot(placeholder, data,  
$.extend(true, {}, options, {  
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }  
}));  
});  
 
placeholder.bind("plotunselected", function (event) {  
$("#selection").text("");  
});  
 
var plot = $.plot(placeholder, data, options);  
 
$("#clearSelection").click(function () {  
plot.clearSelection();  
});  
 
$("#setSelection").click(function () {  
plot.setSelection({ x1: 1994, x2: 1995 });  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
<p>There are plenty of options you can set to control the precise  
looks of your plot. You can control the axes, the legend, the  
default graph type, the look of grid, etc.</p>  
 
<p>The idea is that Flot goes to great lengths to provide <b>sensible  
defaults</b> which you can then customize as needed for your  
particular application. If you've found a use case where the  
defaults can be improved, please don't hesitate to give your  
feedback.</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var d1 = [];  
for (var i = 0; i < Math.PI * 2; i += 0.25)  
d1.push([i, Math.sin(i)]);  
 
var d2 = [];  
for (var i = 0; i < Math.PI * 2; i += 0.25)  
d2.push([i, Math.cos(i)]);  
 
var d3 = [];  
for (var i = 0; i < Math.PI * 2; i += 0.1)  
d3.push([i, Math.tan(i)]);  
 
$.plot($("#placeholder"), [  
{ label: "sin(x)", data: d1},  
{ label: "cos(x)", data: d2},  
{ label: "tan(x)", data: d3}  
], {  
series: {  
lines: { show: true },  
points: { show: true }  
},  
xaxis: {  
ticks: [0, [Math.PI/2, "\u03c0/2"], [Math.PI, "\u03c0"], [Math.PI * 3/2, "3\u03c0/2"], [Math.PI * 2, "2\u03c0"]]  
},  
yaxis: {  
ticks: 10,  
min: -2,  
max: 2  
},  
grid: {  
backgroundColor: { colors: ["#fff", "#eee"] }  
}  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.stack.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>With the stack plugin, you can have Flot stack the  
series. This is useful if you wish to display both a total and the  
constituents it is made of. The only requirement is that you provide  
the input sorted on x.</p>  
 
<p class="stackControls">  
<input type="button" value="With stacking">  
<input type="button" value="Without stacking">  
</p>  
 
<p class="graphControls">  
<input type="button" value="Bars">  
<input type="button" value="Lines">  
<input type="button" value="Lines with steps">  
</p>  
 
<script id="source">  
$(function () {  
var d1 = [];  
for (var i = 0; i <= 10; i += 1)  
d1.push([i, parseInt(Math.random() * 30)]);  
 
var d2 = [];  
for (var i = 0; i <= 10; i += 1)  
d2.push([i, parseInt(Math.random() * 30)]);  
 
var d3 = [];  
for (var i = 0; i <= 10; i += 1)  
d3.push([i, parseInt(Math.random() * 30)]);  
 
var stack = 0, bars = true, lines = false, steps = false;  
 
function plotWithOptions() {  
$.plot($("#placeholder"), [ d1, d2, d3 ], {  
series: {  
stack: stack,  
lines: { show: lines, steps: steps },  
bars: { show: bars, barWidth: 0.6 }  
}  
});  
}  
 
plotWithOptions();  
 
$(".stackControls input").click(function (e) {  
e.preventDefault();  
stack = $(this).val() == "With stacking" ? true : null;  
plotWithOptions();  
});  
$(".graphControls input").click(function (e) {  
e.preventDefault();  
bars = $(this).val().indexOf("Bars") != -1;  
lines = $(this).val().indexOf("Lines") != -1;  
steps = $(this).val().indexOf("steps") != -1;  
plotWithOptions();  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.threshold.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>With the threshold plugin, you can apply a specific color to  
the part of a data series below a threshold. This is can be useful  
for highlighting negative values, e.g. when displaying net results  
or what's in stock.</p>  
 
<p class="controls">  
<input type="button" value="Threshold at 5">  
<input type="button" value="Threshold at 0">  
<input type="button" value="Threshold at -2.5">  
</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var d1 = [];  
for (var i = 0; i <= 60; i += 1)  
d1.push([i, parseInt(Math.random() * 30 - 10)]);  
 
function plotWithOptions(t) {  
$.plot($("#placeholder"), [ {  
data: d1,  
color: "rgb(30, 180, 20)",  
threshold: { below: t, color: "rgb(200, 20, 30)" },  
lines: { steps: true }  
} ]);  
}  
 
plotWithOptions(0);  
 
$(".controls input").click(function (e) {  
e.preventDefault();  
var t = parseFloat($(this).val().replace('Threshold at ', ''));  
plotWithOptions(t);  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Monthly mean atmospheric CO<sub>2</sub> in PPM at Mauna Loa, Hawaii (source: <a href="http://www.esrl.noaa.gov/gmd/ccgg/trends/">NOAA/ESRL</a>).</p>  
 
<p>If you tell Flot that an axis represents time, the data will  
be interpreted as timestamps and the ticks adjusted and  
formatted accordingly.</p>  
 
<p>Zoom to: <button id="whole">Whole period</button>  
<button id="nineties">1990-2000</button>  
<button id="ninetynine">1999</button></p>  
 
<p>The timestamps must be specified as Javascript timestamps, as  
milliseconds since January 1, 1970 00:00. This is like Unix  
timestamps, but in milliseconds instead of seconds (remember to  
multiply with 1000!).</p>  
 
<p>As an extra caveat, the timestamps are interpreted according to  
UTC to avoid having the graph shift with each visitor's local  
time zone. So you might have to add your local time zone offset  
to the timestamps or simply pretend that the data was produced  
in UTC instead of your local time zone.</p>  
 
<script id="source">  
$(function () {  
var d = [[-373597200000, 315.71], [-370918800000, 317.45], [-368326800000, 317.50], [-363056400000, 315.86], [-360378000000, 314.93], [-357699600000, 313.19], [-352429200000, 313.34], [-349837200000, 314.67], [-347158800000, 315.58], [-344480400000, 316.47], [-342061200000, 316.65], [-339382800000, 317.71], [-336790800000, 318.29], [-334112400000, 318.16], [-331520400000, 316.55], [-328842000000, 314.80], [-326163600000, 313.84], [-323571600000, 313.34], [-320893200000, 314.81], [-318301200000, 315.59], [-315622800000, 316.43], [-312944400000, 316.97], [-310438800000, 317.58], [-307760400000, 319.03], [-305168400000, 320.03], [-302490000000, 319.59], [-299898000000, 318.18], [-297219600000, 315.91], [-294541200000, 314.16], [-291949200000, 313.83], [-289270800000, 315.00], [-286678800000, 316.19], [-284000400000, 316.89], [-281322000000, 317.70], [-278902800000, 318.54], [-276224400000, 319.48], [-273632400000, 320.58], [-270954000000, 319.78], [-268362000000, 318.58], [-265683600000, 316.79], [-263005200000, 314.99], [-260413200000, 315.31], [-257734800000, 316.10], [-255142800000, 317.01], [-252464400000, 317.94], [-249786000000, 318.56], [-247366800000, 319.69], [-244688400000, 320.58], [-242096400000, 321.01], [-239418000000, 320.61], [-236826000000, 319.61], [-234147600000, 317.40], [-231469200000, 316.26], [-228877200000, 315.42], [-226198800000, 316.69], [-223606800000, 317.69], [-220928400000, 318.74], [-218250000000, 319.08], [-215830800000, 319.86], [-213152400000, 321.39], [-210560400000, 322.24], [-207882000000, 321.47], [-205290000000, 319.74], [-202611600000, 317.77], [-199933200000, 316.21], [-197341200000, 315.99], [-194662800000, 317.07], [-192070800000, 318.36], [-189392400000, 319.57], [-178938000000, 322.23], [-176259600000, 321.89], [-173667600000, 320.44], [-170989200000, 318.70], [-168310800000, 316.70], [-165718800000, 316.87], [-163040400000, 317.68], [-160448400000, 318.71], [-157770000000, 319.44], [-155091600000, 320.44], [-152672400000, 320.89], [-149994000000, 322.13], [-147402000000, 322.16], [-144723600000, 321.87], [-142131600000, 321.21], [-139453200000, 318.87], [-136774800000, 317.81], [-134182800000, 317.30], [-131504400000, 318.87], [-128912400000, 319.42], [-126234000000, 320.62], [-123555600000, 321.59], [-121136400000, 322.39], [-118458000000, 323.70], [-115866000000, 324.07], [-113187600000, 323.75], [-110595600000, 322.40], [-107917200000, 320.37], [-105238800000, 318.64], [-102646800000, 318.10], [-99968400000, 319.79], [-97376400000, 321.03], [-94698000000, 322.33], [-92019600000, 322.50], [-89600400000, 323.04], [-86922000000, 324.42], [-84330000000, 325.00], [-81651600000, 324.09], [-79059600000, 322.55], [-76381200000, 320.92], [-73702800000, 319.26], [-71110800000, 319.39], [-68432400000, 320.72], [-65840400000, 321.96], [-63162000000, 322.57], [-60483600000, 323.15], [-57978000000, 323.89], [-55299600000, 325.02], [-52707600000, 325.57], [-50029200000, 325.36], [-47437200000, 324.14], [-44758800000, 322.11], [-42080400000, 320.33], [-39488400000, 320.25], [-36810000000, 321.32], [-34218000000, 322.90], [-31539600000, 324.00], [-28861200000, 324.42], [-26442000000, 325.64], [-23763600000, 326.66], [-21171600000, 327.38], [-18493200000, 326.70], [-15901200000, 325.89], [-13222800000, 323.67], [-10544400000, 322.38], [-7952400000, 321.78], [-5274000000, 322.85], [-2682000000, 324.12], [-3600000, 325.06], [2674800000, 325.98], [5094000000, 326.93], [7772400000, 328.13], [10364400000, 328.07], [13042800000, 327.66], [15634800000, 326.35], [18313200000, 324.69], [20991600000, 323.10], [23583600000, 323.07], [26262000000, 324.01], [28854000000, 325.13], [31532400000, 326.17], [34210800000, 326.68], [36630000000, 327.18], [39308400000, 327.78], [41900400000, 328.92], [44578800000, 328.57], [47170800000, 327.37], [49849200000, 325.43], [52527600000, 323.36], [55119600000, 323.56], [57798000000, 324.80], [60390000000, 326.01], [63068400000, 326.77], [65746800000, 327.63], [68252400000, 327.75], [70930800000, 329.72], [73522800000, 330.07], [76201200000, 329.09], [78793200000, 328.05], [81471600000, 326.32], [84150000000, 324.84], [86742000000, 325.20], [89420400000, 326.50], [92012400000, 327.55], [94690800000, 328.54], [97369200000, 329.56], [99788400000, 330.30], [102466800000, 331.50], [105058800000, 332.48], [107737200000, 332.07], [110329200000, 330.87], [113007600000, 329.31], [115686000000, 327.51], [118278000000, 327.18], [120956400000, 328.16], [123548400000, 328.64], [126226800000, 329.35], [128905200000, 330.71], [131324400000, 331.48], [134002800000, 332.65], [136594800000, 333.16], [139273200000, 332.06], [141865200000, 330.99], [144543600000, 329.17], [147222000000, 327.41], [149814000000, 327.20], [152492400000, 328.33], [155084400000, 329.50], [157762800000, 330.68], [160441200000, 331.41], [162860400000, 331.85], [165538800000, 333.29], [168130800000, 333.91], [170809200000, 333.40], [173401200000, 331.78], [176079600000, 329.88], [178758000000, 328.57], [181350000000, 328.46], [184028400000, 329.26], [189298800000, 331.71], [191977200000, 332.76], [194482800000, 333.48], [197161200000, 334.78], [199753200000, 334.78], [202431600000, 334.17], [205023600000, 332.78], [207702000000, 330.64], [210380400000, 328.95], [212972400000, 328.77], [215650800000, 330.23], [218242800000, 331.69], [220921200000, 332.70], [223599600000, 333.24], [226018800000, 334.96], [228697200000, 336.04], [231289200000, 336.82], [233967600000, 336.13], [236559600000, 334.73], [239238000000, 332.52], [241916400000, 331.19], [244508400000, 331.19], [247186800000, 332.35], [249778800000, 333.47], [252457200000, 335.11], [255135600000, 335.26], [257554800000, 336.60], [260233200000, 337.77], [262825200000, 338.00], [265503600000, 337.99], [268095600000, 336.48], [270774000000, 334.37], [273452400000, 332.27], [276044400000, 332.41], [278722800000, 333.76], [281314800000, 334.83], [283993200000, 336.21], [286671600000, 336.64], [289090800000, 338.12], [291769200000, 339.02], [294361200000, 339.02], [297039600000, 339.20], [299631600000, 337.58], [302310000000, 335.55], [304988400000, 333.89], [307580400000, 334.14], [310258800000, 335.26], [312850800000, 336.71], [315529200000, 337.81], [318207600000, 338.29], [320713200000, 340.04], [323391600000, 340.86], [325980000000, 341.47], [328658400000, 341.26], [331250400000, 339.29], [333928800000, 337.60], [336607200000, 336.12], [339202800000, 336.08], [341881200000, 337.22], [344473200000, 338.34], [347151600000, 339.36], [349830000000, 340.51], [352249200000, 341.57], [354924000000, 342.56], [357516000000, 343.01], [360194400000, 342.47], [362786400000, 340.71], [365464800000, 338.52], [368143200000, 336.96], [370738800000, 337.13], [373417200000, 338.58], [376009200000, 339.89], [378687600000, 340.93], [381366000000, 341.69], [383785200000, 342.69], [389052000000, 344.30], [391730400000, 343.43], [394322400000, 341.88], [397000800000, 339.89], [399679200000, 337.95], [402274800000, 338.10], [404953200000, 339.27], [407545200000, 340.67], [410223600000, 341.42], [412902000000, 342.68], [415321200000, 343.46], [417996000000, 345.10], [420588000000, 345.76], [423266400000, 345.36], [425858400000, 343.91], [428536800000, 342.05], [431215200000, 340.00], [433810800000, 340.12], [436489200000, 341.33], [439081200000, 342.94], [441759600000, 343.87], [444438000000, 344.60], [446943600000, 345.20], [452210400000, 347.36], [454888800000, 346.74], [457480800000, 345.41], [460159200000, 343.01], [462837600000, 341.23], [465433200000, 341.52], [468111600000, 342.86], [470703600000, 344.41], [473382000000, 345.09], [476060400000, 345.89], [478479600000, 347.49], [481154400000, 348.00], [483746400000, 348.75], [486424800000, 348.19], [489016800000, 346.54], [491695200000, 344.63], [494373600000, 343.03], [496969200000, 342.92], [499647600000, 344.24], [502239600000, 345.62], [504918000000, 346.43], [507596400000, 346.94], [510015600000, 347.88], [512690400000, 349.57], [515282400000, 350.35], [517960800000, 349.72], [520552800000, 347.78], [523231200000, 345.86], [525909600000, 344.84], [528505200000, 344.32], [531183600000, 345.67], [533775600000, 346.88], [536454000000, 348.19], [539132400000, 348.55], [541551600000, 349.52], [544226400000, 351.12], [546818400000, 351.84], [549496800000, 351.49], [552088800000, 349.82], [554767200000, 347.63], [557445600000, 346.38], [560041200000, 346.49], [562719600000, 347.75], [565311600000, 349.03], [567990000000, 350.20], [570668400000, 351.61], [573174000000, 352.22], [575848800000, 353.53], [578440800000, 354.14], [581119200000, 353.62], [583711200000, 352.53], [586389600000, 350.41], [589068000000, 348.84], [591663600000, 348.94], [594342000000, 350.04], [596934000000, 351.29], [599612400000, 352.72], [602290800000, 353.10], [604710000000, 353.65], [607384800000, 355.43], [609976800000, 355.70], [612655200000, 355.11], [615247200000, 353.79], [617925600000, 351.42], [620604000000, 349.81], [623199600000, 350.11], [625878000000, 351.26], [628470000000, 352.63], [631148400000, 353.64], [633826800000, 354.72], [636246000000, 355.49], [638920800000, 356.09], [641512800000, 357.08], [644191200000, 356.11], [646783200000, 354.70], [649461600000, 352.68], [652140000000, 351.05], [654735600000, 351.36], [657414000000, 352.81], [660006000000, 354.22], [662684400000, 354.85], [665362800000, 355.66], [667782000000, 357.04], [670456800000, 358.40], [673048800000, 359.00], [675727200000, 357.99], [678319200000, 356.00], [680997600000, 353.78], [683676000000, 352.20], [686271600000, 352.22], [688950000000, 353.70], [691542000000, 354.98], [694220400000, 356.09], [696898800000, 356.85], [699404400000, 357.73], [702079200000, 358.91], [704671200000, 359.45], [707349600000, 359.19], [709941600000, 356.72], [712620000000, 354.79], [715298400000, 352.79], [717894000000, 353.20], [720572400000, 354.15], [723164400000, 355.39], [725842800000, 356.77], [728521200000, 357.17], [730940400000, 358.26], [733615200000, 359.16], [736207200000, 360.07], [738885600000, 359.41], [741477600000, 357.44], [744156000000, 355.30], [746834400000, 353.87], [749430000000, 354.04], [752108400000, 355.27], [754700400000, 356.70], [757378800000, 358.00], [760057200000, 358.81], [762476400000, 359.68], [765151200000, 361.13], [767743200000, 361.48], [770421600000, 360.60], [773013600000, 359.20], [775692000000, 357.23], [778370400000, 355.42], [780966000000, 355.89], [783644400000, 357.41], [786236400000, 358.74], [788914800000, 359.73], [791593200000, 360.61], [794012400000, 361.58], [796687200000, 363.05], [799279200000, 363.62], [801957600000, 363.03], [804549600000, 361.55], [807228000000, 358.94], [809906400000, 357.93], [812502000000, 357.80], [815180400000, 359.22], [817772400000, 360.44], [820450800000, 361.83], [823129200000, 362.95], [825634800000, 363.91], [828309600000, 364.28], [830901600000, 364.94], [833580000000, 364.70], [836172000000, 363.31], [838850400000, 361.15], [841528800000, 359.40], [844120800000, 359.34], [846802800000, 360.62], [849394800000, 361.96], [852073200000, 362.81], [854751600000, 363.87], [857170800000, 364.25], [859845600000, 366.02], [862437600000, 366.46], [865116000000, 365.32], [867708000000, 364.07], [870386400000, 361.95], [873064800000, 360.06], [875656800000, 360.49], [878338800000, 362.19], [880930800000, 364.12], [883609200000, 364.99], [886287600000, 365.82], [888706800000, 366.95], [891381600000, 368.42], [893973600000, 369.33], [896652000000, 368.78], [899244000000, 367.59], [901922400000, 365.84], [904600800000, 363.83], [907192800000, 364.18], [909874800000, 365.34], [912466800000, 366.93], [915145200000, 367.94], [917823600000, 368.82], [920242800000, 369.46], [922917600000, 370.77], [925509600000, 370.66], [928188000000, 370.10], [930780000000, 369.08], [933458400000, 366.66], [936136800000, 364.60], [938728800000, 365.17], [941410800000, 366.51], [944002800000, 367.89], [946681200000, 369.04], [949359600000, 369.35], [951865200000, 370.38], [954540000000, 371.63], [957132000000, 371.32], [959810400000, 371.53], [962402400000, 369.75], [965080800000, 368.23], [967759200000, 366.87], [970351200000, 366.94], [973033200000, 368.27], [975625200000, 369.64], [978303600000, 370.46], [980982000000, 371.44], [983401200000, 372.37], [986076000000, 373.33], [988668000000, 373.77], [991346400000, 373.09], [993938400000, 371.51], [996616800000, 369.55], [999295200000, 368.12], [1001887200000, 368.38], [1004569200000, 369.66], [1007161200000, 371.11], [1009839600000, 372.36], [1012518000000, 373.09], [1014937200000, 373.81], [1017612000000, 374.93], [1020204000000, 375.58], [1022882400000, 375.44], [1025474400000, 373.86], [1028152800000, 371.77], [1030831200000, 370.73], [1033423200000, 370.50], [1036105200000, 372.18], [1038697200000, 373.70], [1041375600000, 374.92], [1044054000000, 375.62], [1046473200000, 376.51], [1049148000000, 377.75], [1051740000000, 378.54], [1054418400000, 378.20], [1057010400000, 376.68], [1059688800000, 374.43], [1062367200000, 373.11], [1064959200000, 373.10], [1067641200000, 374.77], [1070233200000, 375.97], [1072911600000, 377.03], [1075590000000, 377.87], [1078095600000, 378.88], [1080770400000, 380.42], [1083362400000, 380.62], [1086040800000, 379.70], [1088632800000, 377.43], [1091311200000, 376.32], [1093989600000, 374.19], [1096581600000, 374.47], [1099263600000, 376.15], [1101855600000, 377.51], [1104534000000, 378.43], [1107212400000, 379.70], [1109631600000, 380.92], [1112306400000, 382.18], [1114898400000, 382.45], [1117576800000, 382.14], [1120168800000, 380.60], [1122847200000, 378.64], [1125525600000, 376.73], [1128117600000, 376.84], [1130799600000, 378.29], [1133391600000, 380.06], [1136070000000, 381.40], [1138748400000, 382.20], [1141167600000, 382.66], [1143842400000, 384.69], [1146434400000, 384.94], [1149112800000, 384.01], [1151704800000, 382.14], [1154383200000, 380.31], [1157061600000, 378.81], [1159653600000, 379.03], [1162335600000, 380.17], [1164927600000, 381.85], [1167606000000, 382.94], [1170284400000, 383.86], [1172703600000, 384.49], [1175378400000, 386.37], [1177970400000, 386.54], [1180648800000, 385.98], [1183240800000, 384.36], [1185919200000, 381.85], [1188597600000, 380.74], [1191189600000, 381.15], [1193871600000, 382.38], [1196463600000, 383.94], [1199142000000, 385.44]];  
 
$.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });  
 
$("#whole").click(function () {  
$.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });  
});  
 
$("#nineties").click(function () {  
$.plot($("#placeholder"), [d], {  
xaxis: {  
mode: "time",  
min: (new Date("1990/01/01")).getTime(),  
max: (new Date("2000/01/01")).getTime()  
}  
});  
});  
 
$("#ninetynine").click(function () {  
$.plot($("#placeholder"), [d], {  
xaxis: {  
mode: "time",  
minTickSize: [1, "month"],  
min: (new Date("1999/01/01")).getTime(),  
max: (new Date("2000/01/01")).getTime()  
}  
});  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.crosshair.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px"></div>  
 
<p>You can add crosshairs that'll track the mouse position, either  
on both axes or as here on only one.</p>  
 
<p>If you combine it with listening on hover events, you can use  
it to track the intersection on the curves by interpolating  
the data points (look at the legend).</p>  
 
<p id="hoverdata"></p>  
 
<script id="source" language="javascript" type="text/javascript">  
var plot;  
$(function () {  
var sin = [], cos = [];  
for (var i = 0; i < 14; i += 0.1) {  
sin.push([i, Math.sin(i)]);  
cos.push([i, Math.cos(i)]);  
}  
 
plot = $.plot($("#placeholder"),  
[ { data: sin, label: "sin(x) = -0.00"},  
{ data: cos, label: "cos(x) = -0.00" } ], {  
series: {  
lines: { show: true }  
},  
crosshair: { mode: "x" },  
grid: { hoverable: true, autoHighlight: false },  
yaxis: { min: -1.2, max: 1.2 }  
});  
var legends = $("#placeholder .legendLabel");  
legends.each(function () {  
// fix the widths so they don't jump around  
$(this).css('width', $(this).width());  
});  
 
var updateLegendTimeout = null;  
var latestPosition = null;  
 
function updateLegend() {  
updateLegendTimeout = null;  
 
var pos = latestPosition;  
 
var axes = plot.getAxes();  
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||  
pos.y < axes.yaxis.min || pos.y > axes.yaxis.max)  
return;  
 
var i, j, dataset = plot.getData();  
for (i = 0; i < dataset.length; ++i) {  
var series = dataset[i];  
 
// find the nearest points, x-wise  
for (j = 0; j < series.data.length; ++j)  
if (series.data[j][0] > pos.x)  
break;  
 
// now interpolate  
var y, p1 = series.data[j - 1], p2 = series.data[j];  
if (p1 == null)  
y = p2[1];  
else if (p2 == null)  
y = p1[1];  
else  
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);  
 
legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));  
}  
}  
 
$("#placeholder").bind("plothover", function (event, pos, item) {  
latestPosition = pos;  
if (!updateLegendTimeout)  
updateLegendTimeout = setTimeout(updateLegend, 50);  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Here is an example with real data: military budgets for  
various countries in constant (2005) million US dollars (source: <a href="http://www.sipri.org/">SIPRI</a>).</p>  
 
<p>Since all data is available client-side, it's pretty easy to  
make the plot interactive. Try turning countries on/off with the  
checkboxes below.</p>  
 
<p id="choices">Show:</p>  
 
<script id="source" language="javascript" type="text/javascript">  
$(function () {  
var datasets = {  
"usa": {  
label: "USA",  
data: [[1988, 483994], [1989, 479060], [1990, 457648], [1991, 401949], [1992, 424705], [1993, 402375], [1994, 377867], [1995, 357382], [1996, 337946], [1997, 336185], [1998, 328611], [1999, 329421], [2000, 342172], [2001, 344932], [2002, 387303], [2003, 440813], [2004, 480451], [2005, 504638], [2006, 528692]]  
},  
"russia": {  
label: "Russia",  
data: [[1988, 218000], [1989, 203000], [1990, 171000], [1992, 42500], [1993, 37600], [1994, 36600], [1995, 21700], [1996, 19200], [1997, 21300], [1998, 13600], [1999, 14000], [2000, 19100], [2001, 21300], [2002, 23600], [2003, 25100], [2004, 26100], [2005, 31100], [2006, 34700]]  
},  
"uk": {  
label: "UK",  
data: [[1988, 62982], [1989, 62027], [1990, 60696], [1991, 62348], [1992, 58560], [1993, 56393], [1994, 54579], [1995, 50818], [1996, 50554], [1997, 48276], [1998, 47691], [1999, 47529], [2000, 47778], [2001, 48760], [2002, 50949], [2003, 57452], [2004, 60234], [2005, 60076], [2006, 59213]]  
},  
"germany": {  
label: "Germany",  
data: [[1988, 55627], [1989, 55475], [1990, 58464], [1991, 55134], [1992, 52436], [1993, 47139], [1994, 43962], [1995, 43238], [1996, 42395], [1997, 40854], [1998, 40993], [1999, 41822], [2000, 41147], [2001, 40474], [2002, 40604], [2003, 40044], [2004, 38816], [2005, 38060], [2006, 36984]]  
},  
"denmark": {  
label: "Denmark",  
data: [[1988, 3813], [1989, 3719], [1990, 3722], [1991, 3789], [1992, 3720], [1993, 3730], [1994, 3636], [1995, 3598], [1996, 3610], [1997, 3655], [1998, 3695], [1999, 3673], [2000, 3553], [2001, 3774], [2002, 3728], [2003, 3618], [2004, 3638], [2005, 3467], [2006, 3770]]  
},  
"sweden": {  
label: "Sweden",  
data: [[1988, 6402], [1989, 6474], [1990, 6605], [1991, 6209], [1992, 6035], [1993, 6020], [1994, 6000], [1995, 6018], [1996, 3958], [1997, 5780], [1998, 5954], [1999, 6178], [2000, 6411], [2001, 5993], [2002, 5833], [2003, 5791], [2004, 5450], [2005, 5521], [2006, 5271]]  
},  
"norway": {  
label: "Norway",  
data: [[1988, 4382], [1989, 4498], [1990, 4535], [1991, 4398], [1992, 4766], [1993, 4441], [1994, 4670], [1995, 4217], [1996, 4275], [1997, 4203], [1998, 4482], [1999, 4506], [2000, 4358], [2001, 4385], [2002, 5269], [2003, 5066], [2004, 5194], [2005, 4887], [2006, 4891]]  
}  
};  
 
// hard-code color indices to prevent them from shifting as  
// countries are turned on/off  
var i = 0;  
$.each(datasets, function(key, val) {  
val.color = i;  
++i;  
});  
 
// insert checkboxes  
var choiceContainer = $("#choices");  
$.each(datasets, function(key, val) {  
choiceContainer.append('<br/><input type="checkbox" name="' + key +  
'" checked="checked" id="id' + key + '">' +  
'<label for="id' + key + '">'  
+ val.label + '</label>');  
});  
choiceContainer.find("input").click(plotAccordingToChoices);  
 
 
function plotAccordingToChoices() {  
var data = [];  
 
choiceContainer.find("input:checked").each(function () {  
var key = $(this).attr("name");  
if (key && datasets[key])  
data.push(datasets[key]);  
});  
 
if (data.length > 0)  
$.plot($("#placeholder"), data, {  
yaxis: { min: 0 },  
xaxis: { tickDecimals: 0 }  
});  
}  
 
plotAccordingToChoices();  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.selection.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div id="placeholder" style="width:600px;height:300px;"></div>  
 
<p>Visitors per day to the Flot homepage. Weekends are colored. Try zooming.  
The plot below shows an overview.</p>  
 
<div id="overview" style="margin-left:50px;margin-top:20px;width:400px;height:50px"></div>  
 
<script id="source">  
$(function () {  
var d = [[1196463600000, 0], [1196550000000, 0], [1196636400000, 0], [1196722800000, 77], [1196809200000, 3636], [1196895600000, 3575], [1196982000000, 2736], [1197068400000, 1086], [1197154800000, 676], [1197241200000, 1205], [1197327600000, 906], [1197414000000, 710], [1197500400000, 639], [1197586800000, 540], [1197673200000, 435], [1197759600000, 301], [1197846000000, 575], [1197932400000, 481], [1198018800000, 591], [1198105200000, 608], [1198191600000, 459], [1198278000000, 234], [1198364400000, 1352], [1198450800000, 686], [1198537200000, 279], [1198623600000, 449], [1198710000000, 468], [1198796400000, 392], [1198882800000, 282], [1198969200000, 208], [1199055600000, 229], [1199142000000, 177], [1199228400000, 374], [1199314800000, 436], [1199401200000, 404], [1199487600000, 253], [1199574000000, 218], [1199660400000, 476], [1199746800000, 462], [1199833200000, 448], [1199919600000, 442], [1200006000000, 403], [1200092400000, 204], [1200178800000, 194], [1200265200000, 327], [1200351600000, 374], [1200438000000, 507], [1200524400000, 546], [1200610800000, 482], [1200697200000, 283], [1200783600000, 221], [1200870000000, 483], [1200956400000, 523], [1201042800000, 528], [1201129200000, 483], [1201215600000, 452], [1201302000000, 270], [1201388400000, 222], [1201474800000, 439], [1201561200000, 559], [1201647600000, 521], [1201734000000, 477], [1201820400000, 442], [1201906800000, 252], [1201993200000, 236], [1202079600000, 525], [1202166000000, 477], [1202252400000, 386], [1202338800000, 409], [1202425200000, 408], [1202511600000, 237], [1202598000000, 193], [1202684400000, 357], [1202770800000, 414], [1202857200000, 393], [1202943600000, 353], [1203030000000, 364], [1203116400000, 215], [1203202800000, 214], [1203289200000, 356], [1203375600000, 399], [1203462000000, 334], [1203548400000, 348], [1203634800000, 243], [1203721200000, 126], [1203807600000, 157], [1203894000000, 288]];  
 
// first correct the timestamps - they are recorded as the daily  
// midnights in UTC+0100, but Flot always displays dates in UTC  
// so we have to add one hour to hit the midnights in the plot  
for (var i = 0; i < d.length; ++i)  
d[i][0] += 60 * 60 * 1000;  
 
// helper for returning the weekends in a period  
function weekendAreas(axes) {  
var markings = [];  
var d = new Date(axes.xaxis.min);  
// go to the first Saturday  
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))  
d.setUTCSeconds(0);  
d.setUTCMinutes(0);  
d.setUTCHours(0);  
var i = d.getTime();  
do {  
// when we don't set yaxis, the rectangle automatically  
// extends to infinity upwards and downwards  
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });  
i += 7 * 24 * 60 * 60 * 1000;  
} while (i < axes.xaxis.max);  
 
return markings;  
}  
 
var options = {  
xaxis: { mode: "time" },  
selection: { mode: "x" },  
grid: { markings: weekendAreas }  
};  
 
var plot = $.plot($("#placeholder"), [d], options);  
 
var overview = $.plot($("#overview"), [d], {  
series: {  
lines: { show: true, lineWidth: 1 },  
shadowSize: 0  
},  
xaxis: { ticks: [], mode: "time" },  
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },  
selection: { mode: "x" }  
});  
 
// now connect the two  
 
$("#placeholder").bind("plotselected", function (event, ranges) {  
// do the zooming  
plot = $.plot($("#placeholder"), [d],  
$.extend(true, {}, options, {  
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }  
}));  
 
// don't fire event on the overview to prevent eternal loop  
overview.setSelection(ranges, true);  
});  
 
$("#overview").bind("plotselected", function (event, ranges) {  
plot.setSelection(ranges);  
});  
});  
</script>  
 
</body>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>Flot Examples</title>  
<link href="layout.css" rel="stylesheet" type="text/css"></link>  
<!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->  
<script language="javascript" type="text/javascript" src="../jquery.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>  
<script language="javascript" type="text/javascript" src="../jquery.flot.selection.js"></script>  
</head>  
<body>  
<h1>Flot Examples</h1>  
 
<div style="float:left">  
<div id="placeholder" style="width:500px;height:300px"></div>  
</div>  
 
<div id="miniature" style="float:left;margin-left:20px;margin-top:50px">  
<div id="overview" style="width:166px;height:100px"></div>  
 
<p id="overviewLegend" style="margin-left:10px"></p>  
</div>  
 
<p style="clear:left"> The selection support makes  
pretty advanced zooming schemes possible. With a few lines of code,  
the small overview plot to the right has been connected to the large  
plot. Try selecting a rectangle on either of them.</p>  
 
<script id="source">  
$(function () {  
// setup plot  
function getData(x1, x2) {  
var d = [];  
for (var i = 0; i <= 100; ++i) {  
var x = x1 + i * (x2 - x1) / 100;  
d.push([x, Math.sin(x * Math.sin(x))]);  
}  
 
return [  
{ label: "sin(x sin(x))", data: d }  
];  
}  
 
var options = {  
legend: { show: false },  
series: {  
lines: { show: true },  
points: { show: true }  
},  
yaxis: { ticks: 10 },  
selection: { mode: "xy" }  
};  
 
var startData = getData(0, 3 * Math.PI);  
 
var plot = $.plot($("#placeholder"), startData, options);  
 
// setup overview  
var overview = $.plot($("#overview"), startData, {  
legend: { show: true, container: $("#overviewLegend") },  
series: {  
lines: { show: true, lineWidth: 1 },  
shadowSize: 0  
},  
xaxis: { ticks: 4 },  
yaxis: { ticks: 3, min: -2, max: 2 },  
grid: { color: "#999" },  
selection: { mode: "xy" }  
});  
 
// now connect the two  
 
$("#placeholder").bind("plotselected", function (event, ranges) {  
// clamp the zooming to prevent eternal zoom  
if (ranges.xaxis.to - ranges.xaxis.from < 0.00001)  
ranges.xaxis.to = ranges.xaxis.from + 0.00001;  
if (ranges.yaxis.to - ranges.yaxis.from < 0.00001)  
ranges.yaxis.to = ranges.yaxis.from + 0.00001;  
 
// do the zooming  
plot = $.plot($("#placeholder"), getData(ranges.xaxis.from, ranges.xaxis.to),  
$.extend(true, {}, options, {  
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },  
yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }  
}));  
 
// don't fire event on the overview to prevent eternal loop  
overview.setSelection(ranges, true);  
});  
$("#overview").bind("plotselected", function (event, ranges) {  
plot.setSelection(ranges);  
});  
});  
</script>  
 
</body>  
</html>  
 
// Copyright 2006 Google Inc.  
//  
// Licensed under the Apache License, Version 2.0 (the "License");  
// you may not use this file except in compliance with the License.  
// You may obtain a copy of the License at  
//  
// http://www.apache.org/licenses/LICENSE-2.0  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
 
 
// Known Issues:  
//  
// * Patterns only support repeat.  
// * Radial gradient are not implemented. The VML version of these look very  
// different from the canvas one.  
// * Clipping paths are not implemented.  
// * Coordsize. The width and height attribute have higher priority than the  
// width and height style values which isn't correct.  
// * Painting mode isn't implemented.  
// * Canvas width/height should is using content-box by default. IE in  
// Quirks mode will draw the canvas using border-box. Either change your  
// doctype to HTML5  
// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)  
// or use Box Sizing Behavior from WebFX  
// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)  
// * Non uniform scaling does not correctly scale strokes.  
// * Filling very large shapes (above 5000 points) is buggy.  
// * Optimize. There is always room for speed improvements.  
 
// Only add this code if we do not already have a canvas implementation  
if (!document.createElement('canvas').getContext) {  
 
(function() {  
 
// alias some functions to make (compiled) code shorter  
var m = Math;  
var mr = m.round;  
var ms = m.sin;  
var mc = m.cos;  
var abs = m.abs;  
var sqrt = m.sqrt;  
 
// this is used for sub pixel precision  
var Z = 10;  
var Z2 = Z / 2;  
 
/**  
* This funtion is assigned to the <canvas> elements as element.getContext().  
* @this {HTMLElement}  
* @return {CanvasRenderingContext2D_}  
*/  
function getContext() {  
return this.context_ ||  
(this.context_ = new CanvasRenderingContext2D_(this));  
}  
 
var slice = Array.prototype.slice;  
 
/**  
* Binds a function to an object. The returned function will always use the  
* passed in {@code obj} as {@code this}.  
*  
* Example:  
*  
* g = bind(f, obj, a, b)  
* g(c, d) // will do f.call(obj, a, b, c, d)  
*  
* @param {Function} f The function to bind the object to  
* @param {Object} obj The object that should act as this when the function  
* is called  
* @param {*} var_args Rest arguments that will be used as the initial  
* arguments when the function is called  
* @return {Function} A new function that has bound this  
*/  
function bind(f, obj, var_args) {  
var a = slice.call(arguments, 2);  
return function() {  
return f.apply(obj, a.concat(slice.call(arguments)));  
};  
}  
 
function encodeHtmlAttribute(s) {  
return String(s).replace(/&/g, '&amp;').replace(/"/g, '&quot;');  
}  
 
function addNamespacesAndStylesheet(doc) {  
// create xmlns  
if (!doc.namespaces['g_vml_']) {  
doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml',  
'#default#VML');  
 
}  
if (!doc.namespaces['g_o_']) {  
doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office',  
'#default#VML');  
}  
 
// Setup default CSS. Only add one style sheet per document  
if (!doc.styleSheets['ex_canvas_']) {  
var ss = doc.createStyleSheet();  
ss.owningElement.id = 'ex_canvas_';  
ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +  
// default size is 300x150 in Gecko and Opera  
'text-align:left;width:300px;height:150px}';  
}  
}  
 
// Add namespaces and stylesheet at startup.  
addNamespacesAndStylesheet(document);  
 
var G_vmlCanvasManager_ = {  
init: function(opt_doc) {  
if (/MSIE/.test(navigator.userAgent) && !window.opera) {  
var doc = opt_doc || document;  
// Create a dummy element so that IE will allow canvas elements to be  
// recognized.  
doc.createElement('canvas');  
doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));  
}  
},  
 
init_: function(doc) {  
// find all canvas elements  
var els = doc.getElementsByTagName('canvas');  
for (var i = 0; i < els.length; i++) {  
this.initElement(els[i]);  
}  
},  
 
/**  
* Public initializes a canvas element so that it can be used as canvas  
* element from now on. This is called automatically before the page is  
* loaded but if you are creating elements using createElement you need to  
* make sure this is called on the element.  
* @param {HTMLElement} el The canvas element to initialize.  
* @return {HTMLElement} the element that was created.  
*/  
initElement: function(el) {  
if (!el.getContext) {  
el.getContext = getContext;  
 
// Add namespaces and stylesheet to document of the element.  
addNamespacesAndStylesheet(el.ownerDocument);  
 
// Remove fallback content. There is no way to hide text nodes so we  
// just remove all childNodes. We could hide all elements and remove  
// text nodes but who really cares about the fallback content.  
el.innerHTML = '';  
 
// do not use inline function because that will leak memory  
el.attachEvent('onpropertychange', onPropertyChange);  
el.attachEvent('onresize', onResize);  
 
var attrs = el.attributes;  
if (attrs.width && attrs.width.specified) {  
// TODO: use runtimeStyle and coordsize  
// el.getContext().setWidth_(attrs.width.nodeValue);  
el.style.width = attrs.width.nodeValue + 'px';  
} else {  
el.width = el.clientWidth;  
}  
if (attrs.height && attrs.height.specified) {  
// TODO: use runtimeStyle and coordsize  
// el.getContext().setHeight_(attrs.height.nodeValue);  
el.style.height = attrs.height.nodeValue + 'px';  
} else {  
el.height = el.clientHeight;  
}  
//el.getContext().setCoordsize_()  
}  
return el;  
}  
};  
 
function onPropertyChange(e) {  
var el = e.srcElement;  
 
switch (e.propertyName) {  
case 'width':  
el.getContext().clearRect();  
el.style.width = el.attributes.width.nodeValue + 'px';  
// In IE8 this does not trigger onresize.  
el.firstChild.style.width = el.clientWidth + 'px';  
break;  
case 'height':  
el.getContext().clearRect();  
el.style.height = el.attributes.height.nodeValue + 'px';  
el.firstChild.style.height = el.clientHeight + 'px';  
break;  
}  
}  
 
function onResize(e) {  
var el = e.srcElement;  
if (el.firstChild) {  
el.firstChild.style.width = el.clientWidth + 'px';  
el.firstChild.style.height = el.clientHeight + 'px';  
}  
}  
 
G_vmlCanvasManager_.init();  
 
// precompute "00" to "FF"  
var decToHex = [];  
for (var i = 0; i < 16; i++) {  
for (var j = 0; j < 16; j++) {  
decToHex[i * 16 + j] = i.toString(16) + j.toString(16);  
}  
}  
 
function createMatrixIdentity() {  
return [  
[1, 0, 0],  
[0, 1, 0],  
[0, 0, 1]  
];  
}  
 
function matrixMultiply(m1, m2) {  
var result = createMatrixIdentity();  
 
for (var x = 0; x < 3; x++) {  
for (var y = 0; y < 3; y++) {  
var sum = 0;  
 
for (var z = 0; z < 3; z++) {  
sum += m1[x][z] * m2[z][y];  
}  
 
result[x][y] = sum;  
}  
}  
return result;  
}  
 
function copyState(o1, o2) {  
o2.fillStyle = o1.fillStyle;  
o2.lineCap = o1.lineCap;  
o2.lineJoin = o1.lineJoin;  
o2.lineWidth = o1.lineWidth;  
o2.miterLimit = o1.miterLimit;  
o2.shadowBlur = o1.shadowBlur;  
o2.shadowColor = o1.shadowColor;  
o2.shadowOffsetX = o1.shadowOffsetX;  
o2.shadowOffsetY = o1.shadowOffsetY;  
o2.strokeStyle = o1.strokeStyle;  
o2.globalAlpha = o1.globalAlpha;  
o2.font = o1.font;  
o2.textAlign = o1.textAlign;  
o2.textBaseline = o1.textBaseline;  
o2.arcScaleX_ = o1.arcScaleX_;  
o2.arcScaleY_ = o1.arcScaleY_;  
o2.lineScale_ = o1.lineScale_;  
}  
 
var colorData = {  
aliceblue: '#F0F8FF',  
antiquewhite: '#FAEBD7',  
aquamarine: '#7FFFD4',  
azure: '#F0FFFF',  
beige: '#F5F5DC',  
bisque: '#FFE4C4',  
black: '#000000',  
blanchedalmond: '#FFEBCD',  
blueviolet: '#8A2BE2',  
brown: '#A52A2A',  
burlywood: '#DEB887',  
cadetblue: '#5F9EA0',  
chartreuse: '#7FFF00',  
chocolate: '#D2691E',  
coral: '#FF7F50',  
cornflowerblue: '#6495ED',  
cornsilk: '#FFF8DC',  
crimson: '#DC143C',  
cyan: '#00FFFF',  
darkblue: '#00008B',  
darkcyan: '#008B8B',  
darkgoldenrod: '#B8860B',  
darkgray: '#A9A9A9',  
darkgreen: '#006400',  
darkgrey: '#A9A9A9',  
darkkhaki: '#BDB76B',  
darkmagenta: '#8B008B',  
darkolivegreen: '#556B2F',  
darkorange: '#FF8C00',  
darkorchid: '#9932CC',  
darkred: '#8B0000',  
darksalmon: '#E9967A',  
darkseagreen: '#8FBC8F',  
darkslateblue: '#483D8B',  
darkslategray: '#2F4F4F',  
darkslategrey: '#2F4F4F',  
darkturquoise: '#00CED1',  
darkviolet: '#9400D3',  
deeppink: '#FF1493',  
deepskyblue: '#00BFFF',  
dimgray: '#696969',  
dimgrey: '#696969',  
dodgerblue: '#1E90FF',  
firebrick: '#B22222',  
floralwhite: '#FFFAF0',  
forestgreen: '#228B22',  
gainsboro: '#DCDCDC',  
ghostwhite: '#F8F8FF',  
gold: '#FFD700',  
goldenrod: '#DAA520',  
grey: '#808080',  
greenyellow: '#ADFF2F',  
honeydew: '#F0FFF0',  
hotpink: '#FF69B4',  
indianred: '#CD5C5C',  
indigo: '#4B0082',  
ivory: '#FFFFF0',  
khaki: '#F0E68C',  
lavender: '#E6E6FA',  
lavenderblush: '#FFF0F5',  
lawngreen: '#7CFC00',  
lemonchiffon: '#FFFACD',  
lightblue: '#ADD8E6',  
lightcoral: '#F08080',  
lightcyan: '#E0FFFF',  
lightgoldenrodyellow: '#FAFAD2',  
lightgreen: '#90EE90',  
lightgrey: '#D3D3D3',  
lightpink: '#FFB6C1',  
lightsalmon: '#FFA07A',  
lightseagreen: '#20B2AA',  
lightskyblue: '#87CEFA',  
lightslategray: '#778899',  
lightslategrey: '#778899',  
lightsteelblue: '#B0C4DE',  
lightyellow: '#FFFFE0',  
limegreen: '#32CD32',  
linen: '#FAF0E6',  
magenta: '#FF00FF',  
mediumaquamarine: '#66CDAA',  
mediumblue: '#0000CD',  
mediumorchid: '#BA55D3',  
mediumpurple: '#9370DB',  
mediumseagreen: '#3CB371',  
mediumslateblue: '#7B68EE',  
mediumspringgreen: '#00FA9A',  
mediumturquoise: '#48D1CC',  
mediumvioletred: '#C71585',  
midnightblue: '#191970',  
mintcream: '#F5FFFA',  
mistyrose: '#FFE4E1',  
moccasin: '#FFE4B5',  
navajowhite: '#FFDEAD',  
oldlace: '#FDF5E6',  
olivedrab: '#6B8E23',  
orange: '#FFA500',  
orangered: '#FF4500',  
orchid: '#DA70D6',  
palegoldenrod: '#EEE8AA',  
palegreen: '#98FB98',  
paleturquoise: '#AFEEEE',  
palevioletred: '#DB7093',  
papayawhip: '#FFEFD5',  
peachpuff: '#FFDAB9',  
peru: '#CD853F',  
pink: '#FFC0CB',  
plum: '#DDA0DD',  
powderblue: '#B0E0E6',  
rosybrown: '#BC8F8F',  
royalblue: '#4169E1',  
saddlebrown: '#8B4513',  
salmon: '#FA8072',  
sandybrown: '#F4A460',  
seagreen: '#2E8B57',  
seashell: '#FFF5EE',  
sienna: '#A0522D',  
skyblue: '#87CEEB',  
slateblue: '#6A5ACD',  
slategray: '#708090',  
slategrey: '#708090',  
snow: '#FFFAFA',  
springgreen: '#00FF7F',  
steelblue: '#4682B4',  
tan: '#D2B48C',  
thistle: '#D8BFD8',  
tomato: '#FF6347',  
turquoise: '#40E0D0',  
violet: '#EE82EE',  
wheat: '#F5DEB3',  
whitesmoke: '#F5F5F5',  
yellowgreen: '#9ACD32'  
};  
 
 
function getRgbHslContent(styleString) {  
var start = styleString.indexOf('(', 3);  
var end = styleString.indexOf(')', start + 1);  
var parts = styleString.substring(start + 1, end).split(',');  
// add alpha if needed  
if (parts.length == 4 && styleString.substr(3, 1) == 'a') {  
alpha = Number(parts[3]);  
} else {  
parts[3] = 1;  
}  
return parts;  
}  
 
function percent(s) {  
return parseFloat(s) / 100;  
}  
 
function clamp(v, min, max) {  
return Math.min(max, Math.max(min, v));  
}  
 
function hslToRgb(parts){  
var r, g, b;  
h = parseFloat(parts[0]) / 360 % 360;  
if (h < 0)  
h++;  
s = clamp(percent(parts[1]), 0, 1);  
l = clamp(percent(parts[2]), 0, 1);  
if (s == 0) {  
r = g = b = l; // achromatic  
} else {  
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;  
var p = 2 * l - q;  
r = hueToRgb(p, q, h + 1 / 3);  
g = hueToRgb(p, q, h);  
b = hueToRgb(p, q, h - 1 / 3);  
}  
 
return '#' + decToHex[Math.floor(r * 255)] +  
decToHex[Math.floor(g * 255)] +  
decToHex[Math.floor(b * 255)];  
}  
 
function hueToRgb(m1, m2, h) {  
if (h < 0)  
h++;  
if (h > 1)  
h--;  
 
if (6 * h < 1)  
return m1 + (m2 - m1) * 6 * h;  
else if (2 * h < 1)  
return m2;  
else if (3 * h < 2)  
return m1 + (m2 - m1) * (2 / 3 - h) * 6;  
else  
return m1;  
}  
 
function processStyle(styleString) {  
var str, alpha = 1;  
 
styleString = String(styleString);  
if (styleString.charAt(0) == '#') {  
str = styleString;  
} else if (/^rgb/.test(styleString)) {  
var parts = getRgbHslContent(styleString);  
var str = '#', n;  
for (var i = 0; i < 3; i++) {  
if (parts[i].indexOf('%') != -1) {  
n = Math.floor(percent(parts[i]) * 255);  
} else {  
n = Number(parts[i]);  
}  
str += decToHex[clamp(n, 0, 255)];  
}  
alpha = parts[3];  
} else if (/^hsl/.test(styleString)) {  
var parts = getRgbHslContent(styleString);  
str = hslToRgb(parts);  
alpha = parts[3];  
} else {  
str = colorData[styleString] || styleString;  
}  
return {color: str, alpha: alpha};  
}  
 
var DEFAULT_STYLE = {  
style: 'normal',  
variant: 'normal',  
weight: 'normal',  
size: 10,  
family: 'sans-serif'  
};  
 
// Internal text style cache  
var fontStyleCache = {};  
 
function processFontStyle(styleString) {  
if (fontStyleCache[styleString]) {  
return fontStyleCache[styleString];  
}  
 
var el = document.createElement('div');  
var style = el.style;  
try {  
style.font = styleString;  
} catch (ex) {  
// Ignore failures to set to invalid font.  
}  
 
return fontStyleCache[styleString] = {  
style: style.fontStyle || DEFAULT_STYLE.style,  
variant: style.fontVariant || DEFAULT_STYLE.variant,  
weight: style.fontWeight || DEFAULT_STYLE.weight,  
size: style.fontSize || DEFAULT_STYLE.size,  
family: style.fontFamily || DEFAULT_STYLE.family  
};  
}  
 
function getComputedStyle(style, element) {  
var computedStyle = {};  
 
for (var p in style) {  
computedStyle[p] = style[p];  
}  
 
// Compute the size  
var canvasFontSize = parseFloat(element.currentStyle.fontSize),  
fontSize = parseFloat(style.size);  
 
if (typeof style.size == 'number') {  
computedStyle.size = style.size;  
} else if (style.size.indexOf('px') != -1) {  
computedStyle.size = fontSize;  
} else if (style.size.indexOf('em') != -1) {  
computedStyle.size = canvasFontSize * fontSize;  
} else if(style.size.indexOf('%') != -1) {  
computedStyle.size = (canvasFontSize / 100) * fontSize;  
} else if (style.size.indexOf('pt') != -1) {  
computedStyle.size = fontSize / .75;  
} else {  
computedStyle.size = canvasFontSize;  
}  
 
// Different scaling between normal text and VML text. This was found using  
// trial and error to get the same size as non VML text.  
computedStyle.size *= 0.981;  
 
return computedStyle;  
}  
 
function buildStyle(style) {  
return style.style + ' ' + style.variant + ' ' + style.weight + ' ' +  
style.size + 'px ' + style.family;  
}  
 
function processLineCap(lineCap) {  
switch (lineCap) {  
case 'butt':  
return 'flat';  
case 'round':  
return 'round';  
case 'square':  
default:  
return 'square';  
}  
}  
 
/**  
* This class implements CanvasRenderingContext2D interface as described by  
* the WHATWG.  
* @param {HTMLElement} surfaceElement The element that the 2D context should  
* be associated with  
*/  
function CanvasRenderingContext2D_(surfaceElement) {  
this.m_ = createMatrixIdentity();  
 
this.mStack_ = [];  
this.aStack_ = [];  
this.currentPath_ = [];  
 
// Canvas context properties  
this.strokeStyle = '#000';  
this.fillStyle = '#000';  
 
this.lineWidth = 1;  
this.lineJoin = 'miter';  
this.lineCap = 'butt';  
this.miterLimit = Z * 1;  
this.globalAlpha = 1;  
this.font = '10px sans-serif';  
this.textAlign = 'left';  
this.textBaseline = 'alphabetic';  
this.canvas = surfaceElement;  
 
var el = surfaceElement.ownerDocument.createElement('div');  
el.style.width = surfaceElement.clientWidth + 'px';  
el.style.height = surfaceElement.clientHeight + 'px';  
el.style.overflow = 'hidden';  
el.style.position = 'absolute';  
surfaceElement.appendChild(el);  
 
this.element_ = el;  
this.arcScaleX_ = 1;  
this.arcScaleY_ = 1;  
this.lineScale_ = 1;  
}  
 
var contextPrototype = CanvasRenderingContext2D_.prototype;  
contextPrototype.clearRect = function() {  
if (this.textMeasureEl_) {  
this.textMeasureEl_.removeNode(true);  
this.textMeasureEl_ = null;  
}  
this.element_.innerHTML = '';  
};  
 
contextPrototype.beginPath = function() {  
// TODO: Branch current matrix so that save/restore has no effect  
// as per safari docs.  
this.currentPath_ = [];  
};  
 
contextPrototype.moveTo = function(aX, aY) {  
var p = this.getCoords_(aX, aY);  
this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});  
this.currentX_ = p.x;  
this.currentY_ = p.y;  
};  
 
contextPrototype.lineTo = function(aX, aY) {  
var p = this.getCoords_(aX, aY);  
this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});  
 
this.currentX_ = p.x;  
this.currentY_ = p.y;  
};  
 
contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,  
aCP2x, aCP2y,  
aX, aY) {  
var p = this.getCoords_(aX, aY);  
var cp1 = this.getCoords_(aCP1x, aCP1y);  
var cp2 = this.getCoords_(aCP2x, aCP2y);  
bezierCurveTo(this, cp1, cp2, p);  
};  
 
// Helper function that takes the already fixed cordinates.  
function bezierCurveTo(self, cp1, cp2, p) {  
self.currentPath_.push({  
type: 'bezierCurveTo',  
cp1x: cp1.x,  
cp1y: cp1.y,  
cp2x: cp2.x,  
cp2y: cp2.y,  
x: p.x,  
y: p.y  
});  
self.currentX_ = p.x;  
self.currentY_ = p.y;  
}  
 
contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {  
// the following is lifted almost directly from  
// http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes  
 
var cp = this.getCoords_(aCPx, aCPy);  
var p = this.getCoords_(aX, aY);  
 
var cp1 = {  
x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),  
y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)  
};  
var cp2 = {  
x: cp1.x + (p.x - this.currentX_) / 3.0,  
y: cp1.y + (p.y - this.currentY_) / 3.0  
};  
 
bezierCurveTo(this, cp1, cp2, p);  
};  
 
contextPrototype.arc = function(aX, aY, aRadius,  
aStartAngle, aEndAngle, aClockwise) {  
aRadius *= Z;  
var arcType = aClockwise ? 'at' : 'wa';  
 
var xStart = aX + mc(aStartAngle) * aRadius - Z2;  
var yStart = aY + ms(aStartAngle) * aRadius - Z2;  
 
var xEnd = aX + mc(aEndAngle) * aRadius - Z2;  
var yEnd = aY + ms(aEndAngle) * aRadius - Z2;  
 
// IE won't render arches drawn counter clockwise if xStart == xEnd.  
if (xStart == xEnd && !aClockwise) {  
xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something  
// that can be represented in binary  
}  
 
var p = this.getCoords_(aX, aY);  
var pStart = this.getCoords_(xStart, yStart);  
var pEnd = this.getCoords_(xEnd, yEnd);  
 
this.currentPath_.push({type: arcType,  
x: p.x,  
y: p.y,  
radius: aRadius,  
xStart: pStart.x,  
yStart: pStart.y,  
xEnd: pEnd.x,  
yEnd: pEnd.y});  
 
};  
 
contextPrototype.rect = function(aX, aY, aWidth, aHeight) {  
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
};  
 
contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {  
var oldPath = this.currentPath_;  
this.beginPath();  
 
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
this.stroke();  
 
this.currentPath_ = oldPath;  
};  
 
contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {  
var oldPath = this.currentPath_;  
this.beginPath();  
 
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
this.fill();  
 
this.currentPath_ = oldPath;  
};  
 
contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {  
var gradient = new CanvasGradient_('gradient');  
gradient.x0_ = aX0;  
gradient.y0_ = aY0;  
gradient.x1_ = aX1;  
gradient.y1_ = aY1;  
return gradient;  
};  
 
contextPrototype.createRadialGradient = function(aX0, aY0, aR0,  
aX1, aY1, aR1) {  
var gradient = new CanvasGradient_('gradientradial');  
gradient.x0_ = aX0;  
gradient.y0_ = aY0;  
gradient.r0_ = aR0;  
gradient.x1_ = aX1;  
gradient.y1_ = aY1;  
gradient.r1_ = aR1;  
return gradient;  
};  
 
contextPrototype.drawImage = function(image, var_args) {  
var dx, dy, dw, dh, sx, sy, sw, sh;  
 
// to find the original width we overide the width and height  
var oldRuntimeWidth = image.runtimeStyle.width;  
var oldRuntimeHeight = image.runtimeStyle.height;  
image.runtimeStyle.width = 'auto';  
image.runtimeStyle.height = 'auto';  
 
// get the original size  
var w = image.width;  
var h = image.height;  
 
// and remove overides  
image.runtimeStyle.width = oldRuntimeWidth;  
image.runtimeStyle.height = oldRuntimeHeight;  
 
if (arguments.length == 3) {  
dx = arguments[1];  
dy = arguments[2];  
sx = sy = 0;  
sw = dw = w;  
sh = dh = h;  
} else if (arguments.length == 5) {  
dx = arguments[1];  
dy = arguments[2];  
dw = arguments[3];  
dh = arguments[4];  
sx = sy = 0;  
sw = w;  
sh = h;  
} else if (arguments.length == 9) {  
sx = arguments[1];  
sy = arguments[2];  
sw = arguments[3];  
sh = arguments[4];  
dx = arguments[5];  
dy = arguments[6];  
dw = arguments[7];  
dh = arguments[8];  
} else {  
throw Error('Invalid number of arguments');  
}  
 
var d = this.getCoords_(dx, dy);  
 
var w2 = sw / 2;  
var h2 = sh / 2;  
 
var vmlStr = [];  
 
var W = 10;  
var H = 10;  
 
// For some reason that I've now forgotten, using divs didn't work  
vmlStr.push(' <g_vml_:group',  
' coordsize="', Z * W, ',', Z * H, '"',  
' coordorigin="0,0"' ,  
' style="width:', W, 'px;height:', H, 'px;position:absolute;');  
 
// If filters are necessary (rotation exists), create them  
// filters are bog-slow, so only create them if abbsolutely necessary  
// The following check doesn't account for skews (which don't exist  
// in the canvas spec (yet) anyway.  
 
if (this.m_[0][0] != 1 || this.m_[0][1] ||  
this.m_[1][1] != 1 || this.m_[1][0]) {  
var filter = [];  
 
// Note the 12/21 reversal  
filter.push('M11=', this.m_[0][0], ',',  
'M12=', this.m_[1][0], ',',  
'M21=', this.m_[0][1], ',',  
'M22=', this.m_[1][1], ',',  
'Dx=', mr(d.x / Z), ',',  
'Dy=', mr(d.y / Z), '');  
 
// Bounding box calculation (need to minimize displayed area so that  
// filters don't waste time on unused pixels.  
var max = d;  
var c2 = this.getCoords_(dx + dw, dy);  
var c3 = this.getCoords_(dx, dy + dh);  
var c4 = this.getCoords_(dx + dw, dy + dh);  
 
max.x = m.max(max.x, c2.x, c3.x, c4.x);  
max.y = m.max(max.y, c2.y, c3.y, c4.y);  
 
vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z),  
'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',  
filter.join(''), ", sizingmethod='clip');");  
 
} else {  
vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;');  
}  
 
vmlStr.push(' ">' ,  
'<g_vml_:image src="', image.src, '"',  
' style="width:', Z * dw, 'px;',  
' height:', Z * dh, 'px"',  
' cropleft="', sx / w, '"',  
' croptop="', sy / h, '"',  
' cropright="', (w - sx - sw) / w, '"',  
' cropbottom="', (h - sy - sh) / h, '"',  
' />',  
'</g_vml_:group>');  
 
this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));  
};  
 
contextPrototype.stroke = function(aFill) {  
var W = 10;  
var H = 10;  
// Divide the shape into chunks if it's too long because IE has a limit  
// somewhere for how long a VML shape can be. This simple division does  
// not work with fills, only strokes, unfortunately.  
var chunkSize = 5000;  
 
var min = {x: null, y: null};  
var max = {x: null, y: null};  
 
for (var j = 0; j < this.currentPath_.length; j += chunkSize) {  
var lineStr = [];  
var lineOpen = false;  
 
lineStr.push('<g_vml_:shape',  
' filled="', !!aFill, '"',  
' style="position:absolute;width:', W, 'px;height:', H, 'px;"',  
' coordorigin="0,0"',  
' coordsize="', Z * W, ',', Z * H, '"',  
' stroked="', !aFill, '"',  
' path="');  
 
var newSeq = false;  
 
for (var i = j; i < Math.min(j + chunkSize, this.currentPath_.length); i++) {  
if (i % chunkSize == 0 && i > 0) { // move into position for next chunk  
lineStr.push(' m ', mr(this.currentPath_[i-1].x), ',', mr(this.currentPath_[i-1].y));  
}  
 
var p = this.currentPath_[i];  
var c;  
 
switch (p.type) {  
case 'moveTo':  
c = p;  
lineStr.push(' m ', mr(p.x), ',', mr(p.y));  
break;  
case 'lineTo':  
lineStr.push(' l ', mr(p.x), ',', mr(p.y));  
break;  
case 'close':  
lineStr.push(' x ');  
p = null;  
break;  
case 'bezierCurveTo':  
lineStr.push(' c ',  
mr(p.cp1x), ',', mr(p.cp1y), ',',  
mr(p.cp2x), ',', mr(p.cp2y), ',',  
mr(p.x), ',', mr(p.y));  
break;  
case 'at':  
case 'wa':  
lineStr.push(' ', p.type, ' ',  
mr(p.x - this.arcScaleX_ * p.radius), ',',  
mr(p.y - this.arcScaleY_ * p.radius), ' ',  
mr(p.x + this.arcScaleX_ * p.radius), ',',  
mr(p.y + this.arcScaleY_ * p.radius), ' ',  
mr(p.xStart), ',', mr(p.yStart), ' ',  
mr(p.xEnd), ',', mr(p.yEnd));  
break;  
}  
 
 
// TODO: Following is broken for curves due to  
// move to proper paths.  
 
// Figure out dimensions so we can do gradient fills  
// properly  
if (p) {  
if (min.x == null || p.x < min.x) {  
min.x = p.x;  
}  
if (max.x == null || p.x > max.x) {  
max.x = p.x;  
}  
if (min.y == null || p.y < min.y) {  
min.y = p.y;  
}  
if (max.y == null || p.y > max.y) {  
max.y = p.y;  
}  
}  
}  
lineStr.push(' ">');  
 
if (!aFill) {  
appendStroke(this, lineStr);  
} else {  
appendFill(this, lineStr, min, max);  
}  
 
lineStr.push('</g_vml_:shape>');  
 
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));  
}  
};  
 
function appendStroke(ctx, lineStr) {  
var a = processStyle(ctx.strokeStyle);  
var color = a.color;  
var opacity = a.alpha * ctx.globalAlpha;  
var lineWidth = ctx.lineScale_ * ctx.lineWidth;  
 
// VML cannot correctly render a line if the width is less than 1px.  
// In that case, we dilute the color to make the line look thinner.  
if (lineWidth < 1) {  
opacity *= lineWidth;  
}  
 
lineStr.push(  
'<g_vml_:stroke',  
' opacity="', opacity, '"',  
' joinstyle="', ctx.lineJoin, '"',  
' miterlimit="', ctx.miterLimit, '"',  
' endcap="', processLineCap(ctx.lineCap), '"',  
' weight="', lineWidth, 'px"',  
' color="', color, '" />'  
);  
}  
 
function appendFill(ctx, lineStr, min, max) {  
var fillStyle = ctx.fillStyle;  
var arcScaleX = ctx.arcScaleX_;  
var arcScaleY = ctx.arcScaleY_;  
var width = max.x - min.x;  
var height = max.y - min.y;  
if (fillStyle instanceof CanvasGradient_) {  
// TODO: Gradients transformed with the transformation matrix.  
var angle = 0;  
var focus = {x: 0, y: 0};  
 
// additional offset  
var shift = 0;  
// scale factor for offset  
var expansion = 1;  
 
if (fillStyle.type_ == 'gradient') {  
var x0 = fillStyle.x0_ / arcScaleX;  
var y0 = fillStyle.y0_ / arcScaleY;  
var x1 = fillStyle.x1_ / arcScaleX;  
var y1 = fillStyle.y1_ / arcScaleY;  
var p0 = ctx.getCoords_(x0, y0);  
var p1 = ctx.getCoords_(x1, y1);  
var dx = p1.x - p0.x;  
var dy = p1.y - p0.y;  
angle = Math.atan2(dx, dy) * 180 / Math.PI;  
 
// The angle should be a non-negative number.  
if (angle < 0) {  
angle += 360;  
}  
 
// Very small angles produce an unexpected result because they are  
// converted to a scientific notation string.  
if (angle < 1e-6) {  
angle = 0;  
}  
} else {  
var p0 = ctx.getCoords_(fillStyle.x0_, fillStyle.y0_);  
focus = {  
x: (p0.x - min.x) / width,  
y: (p0.y - min.y) / height  
};  
 
width /= arcScaleX * Z;  
height /= arcScaleY * Z;  
var dimension = m.max(width, height);  
shift = 2 * fillStyle.r0_ / dimension;  
expansion = 2 * fillStyle.r1_ / dimension - shift;  
}  
 
// We need to sort the color stops in ascending order by offset,  
// otherwise IE won't interpret it correctly.  
var stops = fillStyle.colors_;  
stops.sort(function(cs1, cs2) {  
return cs1.offset - cs2.offset;  
});  
 
var length = stops.length;  
var color1 = stops[0].color;  
var color2 = stops[length - 1].color;  
var opacity1 = stops[0].alpha * ctx.globalAlpha;  
var opacity2 = stops[length - 1].alpha * ctx.globalAlpha;  
 
var colors = [];  
for (var i = 0; i < length; i++) {  
var stop = stops[i];  
colors.push(stop.offset * expansion + shift + ' ' + stop.color);  
}  
 
// When colors attribute is used, the meanings of opacity and o:opacity2  
// are reversed.  
lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"',  
' method="none" focus="100%"',  
' color="', color1, '"',  
' color2="', color2, '"',  
' colors="', colors.join(','), '"',  
' opacity="', opacity2, '"',  
' g_o_:opacity2="', opacity1, '"',  
' angle="', angle, '"',  
' focusposition="', focus.x, ',', focus.y, '" />');  
} else if (fillStyle instanceof CanvasPattern_) {  
if (width && height) {  
var deltaLeft = -min.x;  
var deltaTop = -min.y;  
lineStr.push('<g_vml_:fill',  
' position="',  
deltaLeft / width * arcScaleX * arcScaleX, ',',  
deltaTop / height * arcScaleY * arcScaleY, '"',  
' type="tile"',  
// TODO: Figure out the correct size to fit the scale.  
//' size="', w, 'px ', h, 'px"',  
' src="', fillStyle.src_, '" />');  
}  
} else {  
var a = processStyle(ctx.fillStyle);  
var color = a.color;  
var opacity = a.alpha * ctx.globalAlpha;  
lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,  
'" />');  
}  
}  
 
contextPrototype.fill = function() {  
this.stroke(true);  
};  
 
contextPrototype.closePath = function() {  
this.currentPath_.push({type: 'close'});  
};  
 
/**  
* @private  
*/  
contextPrototype.getCoords_ = function(aX, aY) {  
var m = this.m_;  
return {  
x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,  
y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2  
};  
};  
 
contextPrototype.save = function() {  
var o = {};  
copyState(this, o);  
this.aStack_.push(o);  
this.mStack_.push(this.m_);  
this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);  
};  
 
contextPrototype.restore = function() {  
if (this.aStack_.length) {  
copyState(this.aStack_.pop(), this);  
this.m_ = this.mStack_.pop();  
}  
};  
 
function matrixIsFinite(m) {  
return isFinite(m[0][0]) && isFinite(m[0][1]) &&  
isFinite(m[1][0]) && isFinite(m[1][1]) &&  
isFinite(m[2][0]) && isFinite(m[2][1]);  
}  
 
function setM(ctx, m, updateLineScale) {  
if (!matrixIsFinite(m)) {  
return;  
}  
ctx.m_ = m;  
 
if (updateLineScale) {  
// Get the line scale.  
// Determinant of this.m_ means how much the area is enlarged by the  
// transformation. So its square root can be used as a scale factor  
// for width.  
var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];  
ctx.lineScale_ = sqrt(abs(det));  
}  
}  
 
contextPrototype.translate = function(aX, aY) {  
var m1 = [  
[1, 0, 0],  
[0, 1, 0],  
[aX, aY, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), false);  
};  
 
contextPrototype.rotate = function(aRot) {  
var c = mc(aRot);  
var s = ms(aRot);  
 
var m1 = [  
[c, s, 0],  
[-s, c, 0],  
[0, 0, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), false);  
};  
 
contextPrototype.scale = function(aX, aY) {  
this.arcScaleX_ *= aX;  
this.arcScaleY_ *= aY;  
var m1 = [  
[aX, 0, 0],  
[0, aY, 0],  
[0, 0, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), true);  
};  
 
contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {  
var m1 = [  
[m11, m12, 0],  
[m21, m22, 0],  
[dx, dy, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), true);  
};  
 
contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {  
var m = [  
[m11, m12, 0],  
[m21, m22, 0],  
[dx, dy, 1]  
];  
 
setM(this, m, true);  
};  
 
/**  
* The text drawing function.  
* The maxWidth argument isn't taken in account, since no browser supports  
* it yet.  
*/  
contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {  
var m = this.m_,  
delta = 1000,  
left = 0,  
right = delta,  
offset = {x: 0, y: 0},  
lineStr = [];  
 
var fontStyle = getComputedStyle(processFontStyle(this.font),  
this.element_);  
 
var fontStyleString = buildStyle(fontStyle);  
 
var elementStyle = this.element_.currentStyle;  
var textAlign = this.textAlign.toLowerCase();  
switch (textAlign) {  
case 'left':  
case 'center':  
case 'right':  
break;  
case 'end':  
textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left';  
break;  
case 'start':  
textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left';  
break;  
default:  
textAlign = 'left';  
}  
 
// 1.75 is an arbitrary number, as there is no info about the text baseline  
switch (this.textBaseline) {  
case 'hanging':  
case 'top':  
offset.y = fontStyle.size / 1.75;  
break;  
case 'middle':  
break;  
default:  
case null:  
case 'alphabetic':  
case 'ideographic':  
case 'bottom':  
offset.y = -fontStyle.size / 2.25;  
break;  
}  
 
switch(textAlign) {  
case 'right':  
left = delta;  
right = 0.05;  
break;  
case 'center':  
left = right = delta / 2;  
break;  
}  
 
var d = this.getCoords_(x + offset.x, y + offset.y);  
 
lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ',  
' coordsize="100 100" coordorigin="0 0"',  
' filled="', !stroke, '" stroked="', !!stroke,  
'" style="position:absolute;width:1px;height:1px;">');  
 
if (stroke) {  
appendStroke(this, lineStr);  
} else {  
// TODO: Fix the min and max params.  
appendFill(this, lineStr, {x: -left, y: 0},  
{x: right, y: fontStyle.size});  
}  
 
var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' +  
m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0';  
 
var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z);  
 
lineStr.push('<g_vml_:skew on="t" matrix="', skewM ,'" ',  
' offset="', skewOffset, '" origin="', left ,' 0" />',  
'<g_vml_:path textpathok="true" />',  
'<g_vml_:textpath on="true" string="',  
encodeHtmlAttribute(text),  
'" style="v-text-align:', textAlign,  
';font:', encodeHtmlAttribute(fontStyleString),  
'" /></g_vml_:line>');  
 
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));  
};  
 
contextPrototype.fillText = function(text, x, y, maxWidth) {  
this.drawText_(text, x, y, maxWidth, false);  
};  
 
contextPrototype.strokeText = function(text, x, y, maxWidth) {  
this.drawText_(text, x, y, maxWidth, true);  
};  
 
contextPrototype.measureText = function(text) {  
if (!this.textMeasureEl_) {  
var s = '<span style="position:absolute;' +  
'top:-20000px;left:0;padding:0;margin:0;border:none;' +  
'white-space:pre;"></span>';  
this.element_.insertAdjacentHTML('beforeEnd', s);  
this.textMeasureEl_ = this.element_.lastChild;  
}  
var doc = this.element_.ownerDocument;  
this.textMeasureEl_.innerHTML = '';  
this.textMeasureEl_.style.font = this.font;  
// Don't use innerHTML or innerText because they allow markup/whitespace.  
this.textMeasureEl_.appendChild(doc.createTextNode(text));  
return {width: this.textMeasureEl_.offsetWidth};  
};  
 
/******** STUBS ********/  
contextPrototype.clip = function() {  
// TODO: Implement  
};  
 
contextPrototype.arcTo = function() {  
// TODO: Implement  
};  
 
contextPrototype.createPattern = function(image, repetition) {  
return new CanvasPattern_(image, repetition);  
};  
 
// Gradient / Pattern Stubs  
function CanvasGradient_(aType) {  
this.type_ = aType;  
this.x0_ = 0;  
this.y0_ = 0;  
this.r0_ = 0;  
this.x1_ = 0;  
this.y1_ = 0;  
this.r1_ = 0;  
this.colors_ = [];  
}  
 
CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {  
aColor = processStyle(aColor);  
this.colors_.push({offset: aOffset,  
color: aColor.color,  
alpha: aColor.alpha});  
};  
 
function CanvasPattern_(image, repetition) {  
assertImageIsValid(image);  
switch (repetition) {  
case 'repeat':  
case null:  
case '':  
this.repetition_ = 'repeat';  
break  
case 'repeat-x':  
case 'repeat-y':  
case 'no-repeat':  
this.repetition_ = repetition;  
break;  
default:  
throwException('SYNTAX_ERR');  
}  
 
this.src_ = image.src;  
this.width_ = image.width;  
this.height_ = image.height;  
}  
 
function throwException(s) {  
throw new DOMException_(s);  
}  
 
function assertImageIsValid(img) {  
if (!img || img.nodeType != 1 || img.tagName != 'IMG') {  
throwException('TYPE_MISMATCH_ERR');  
}  
if (img.readyState != 'complete') {  
throwException('INVALID_STATE_ERR');  
}  
}  
 
function DOMException_(s) {  
this.code = this[s];  
this.message = s +': DOM Exception ' + this.code;  
}  
var p = DOMException_.prototype = new Error;  
p.INDEX_SIZE_ERR = 1;  
p.DOMSTRING_SIZE_ERR = 2;  
p.HIERARCHY_REQUEST_ERR = 3;  
p.WRONG_DOCUMENT_ERR = 4;  
p.INVALID_CHARACTER_ERR = 5;  
p.NO_DATA_ALLOWED_ERR = 6;  
p.NO_MODIFICATION_ALLOWED_ERR = 7;  
p.NOT_FOUND_ERR = 8;  
p.NOT_SUPPORTED_ERR = 9;  
p.INUSE_ATTRIBUTE_ERR = 10;  
p.INVALID_STATE_ERR = 11;  
p.SYNTAX_ERR = 12;  
p.INVALID_MODIFICATION_ERR = 13;  
p.NAMESPACE_ERR = 14;  
p.INVALID_ACCESS_ERR = 15;  
p.VALIDATION_ERR = 16;  
p.TYPE_MISMATCH_ERR = 17;  
 
// set up externs  
G_vmlCanvasManager = G_vmlCanvasManager_;  
CanvasRenderingContext2D = CanvasRenderingContext2D_;  
CanvasGradient = CanvasGradient_;  
CanvasPattern = CanvasPattern_;  
DOMException = DOMException_;  
})();  
 
} // if  
 
/* Plugin for jQuery for working with colors.  
*  
* Version 1.0.  
*  
* Inspiration from jQuery color animation plugin by John Resig.  
*  
* Released under the MIT license by Ole Laursen, October 2009.  
*  
* Examples:  
*  
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()  
* var c = $.color.extract($("#mydiv"), 'background-color');  
* console.log(c.r, c.g, c.b, c.a);  
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"  
*  
* Note that .scale() and .add() work in-place instead of returning  
* new objects.  
*/  
 
(function() {  
jQuery.color = {};  
 
// construct color object with some convenient chainable helpers  
jQuery.color.make = function (r, g, b, a) {  
var o = {};  
o.r = r || 0;  
o.g = g || 0;  
o.b = b || 0;  
o.a = a != null ? a : 1;  
 
o.add = function (c, d) {  
for (var i = 0; i < c.length; ++i)  
o[c.charAt(i)] += d;  
return o.normalize();  
};  
 
o.scale = function (c, f) {  
for (var i = 0; i < c.length; ++i)  
o[c.charAt(i)] *= f;  
return o.normalize();  
};  
 
o.toString = function () {  
if (o.a >= 1.0) {  
return "rgb("+[o.r, o.g, o.b].join(",")+")";  
} else {  
return "rgba("+[o.r, o.g, o.b, o.a].join(",")+")";  
}  
};  
 
o.normalize = function () {  
function clamp(min, value, max) {  
return value < min ? min: (value > max ? max: value);  
}  
 
o.r = clamp(0, parseInt(o.r), 255);  
o.g = clamp(0, parseInt(o.g), 255);  
o.b = clamp(0, parseInt(o.b), 255);  
o.a = clamp(0, o.a, 1);  
return o;  
};  
 
o.clone = function () {  
return jQuery.color.make(o.r, o.b, o.g, o.a);  
};  
 
return o.normalize();  
}  
 
// extract CSS color property from element, going up in the DOM  
// if it's "transparent"  
jQuery.color.extract = function (elem, css) {  
var c;  
do {  
c = elem.css(css).toLowerCase();  
// keep going until we find an element that has color, or  
// we hit the body  
if (c != '' && c != 'transparent')  
break;  
elem = elem.parent();  
} while (!jQuery.nodeName(elem.get(0), "body"));  
 
// catch Safari's way of signalling transparent  
if (c == "rgba(0, 0, 0, 0)")  
c = "transparent";  
 
return jQuery.color.parse(c);  
}  
 
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),  
// returns color object  
jQuery.color.parse = function (str) {  
var res, m = jQuery.color.make;  
 
// Look for rgb(num,num,num)  
if (res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))  
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));  
 
// Look for rgba(num,num,num,num)  
if (res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))  
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));  
 
// Look for rgb(num%,num%,num%)  
if (res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))  
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55);  
 
// Look for rgba(num%,num%,num%,num)  
if (res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))  
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4]));  
 
// Look for #a0b1c2  
if (res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))  
return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16));  
 
// Look for #fff  
if (res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))  
return m(parseInt(res[1]+res[1], 16), parseInt(res[2]+res[2], 16), parseInt(res[3]+res[3], 16));  
 
// Otherwise, we're most likely dealing with a named color  
var name = jQuery.trim(str).toLowerCase();  
if (name == "transparent")  
return m(255, 255, 255, 0);  
else {  
res = lookupColors[name];  
return m(res[0], res[1], res[2]);  
}  
}  
 
var lookupColors = {  
aqua:[0,255,255],  
azure:[240,255,255],  
beige:[245,245,220],  
black:[0,0,0],  
blue:[0,0,255],  
brown:[165,42,42],  
cyan:[0,255,255],  
darkblue:[0,0,139],  
darkcyan:[0,139,139],  
darkgrey:[169,169,169],  
darkgreen:[0,100,0],  
darkkhaki:[189,183,107],  
darkmagenta:[139,0,139],  
darkolivegreen:[85,107,47],  
darkorange:[255,140,0],  
darkorchid:[153,50,204],  
darkred:[139,0,0],  
darksalmon:[233,150,122],  
darkviolet:[148,0,211],  
fuchsia:[255,0,255],  
gold:[255,215,0],  
green:[0,128,0],  
indigo:[75,0,130],  
khaki:[240,230,140],  
lightblue:[173,216,230],  
lightcyan:[224,255,255],  
lightgreen:[144,238,144],  
lightgrey:[211,211,211],  
lightpink:[255,182,193],  
lightyellow:[255,255,224],  
lime:[0,255,0],  
magenta:[255,0,255],  
maroon:[128,0,0],  
navy:[0,0,128],  
olive:[128,128,0],  
orange:[255,165,0],  
pink:[255,192,203],  
purple:[128,0,128],  
violet:[128,0,128],  
red:[255,0,0],  
silver:[192,192,192],  
white:[255,255,255],  
yellow:[255,255,0]  
};  
})();  
 
(function(){jQuery.color={};jQuery.color.make=function(E,D,B,C){var F={};F.r=E||0;F.g=D||0;F.b=B||0;F.a=C!=null?C:1;F.add=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]+=H}return F.normalize()};F.scale=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]*=H}return F.normalize()};F.toString=function(){if(F.a>=1){return"rgb("+[F.r,F.g,F.b].join(",")+")"}else{return"rgba("+[F.r,F.g,F.b,F.a].join(",")+")"}};F.normalize=function(){function G(I,J,H){return J<I?I:(J>H?H:J)}F.r=G(0,parseInt(F.r),255);F.g=G(0,parseInt(F.g),255);F.b=G(0,parseInt(F.b),255);F.a=G(0,F.a,1);return F};F.clone=function(){return jQuery.color.make(F.r,F.b,F.g,F.a)};return F.normalize()};jQuery.color.extract=function(C,B){var D;do{D=C.css(B).toLowerCase();if(D!=""&&D!="transparent"){break}C=C.parent()}while(!jQuery.nodeName(C.get(0),"body"));if(D=="rgba(0, 0, 0, 0)"){D="transparent"}return jQuery.color.parse(D)};jQuery.color.parse=function(E){var D,B=jQuery.color.make;if(D=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10))}if(D=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10),parseFloat(D[4]))}if(D=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55)}if(D=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55,parseFloat(D[4]))}if(D=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(E)){return B(parseInt(D[1],16),parseInt(D[2],16),parseInt(D[3],16))}if(D=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(E)){return B(parseInt(D[1]+D[1],16),parseInt(D[2]+D[2],16),parseInt(D[3]+D[3],16))}var C=jQuery.trim(E).toLowerCase();if(C=="transparent"){return B(255,255,255,0)}else{D=A[C];return B(D[0],D[1],D[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();  
/*  
Flot plugin for showing a crosshair, thin lines, when the mouse hovers  
over the plot.  
 
crosshair: {  
mode: null or "x" or "y" or "xy"  
color: color  
lineWidth: number  
}  
 
Set the mode to one of "x", "y" or "xy". The "x" mode enables a  
vertical crosshair that lets you trace the values on the x axis, "y"  
enables a horizontal crosshair and "xy" enables them both. "color" is  
the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"),  
"lineWidth" is the width of the drawn lines (default is 1).  
 
The plugin also adds four public methods:  
 
- setCrosshair(pos)  
 
Set the position of the crosshair. Note that this is cleared if  
the user moves the mouse. "pos" should be on the form { x: xpos,  
y: ypos } (or x2 and y2 if you're using the secondary axes), which  
is coincidentally the same format as what you get from a "plothover"  
event. If "pos" is null, the crosshair is cleared.  
 
- clearCrosshair()  
 
Clear the crosshair.  
 
- lockCrosshair(pos)  
 
Cause the crosshair to lock to the current location, no longer  
updating if the user moves the mouse. Optionally supply a position  
(passed on to setCrosshair()) to move it to.  
 
Example usage:  
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };  
$("#graph").bind("plothover", function (evt, position, item) {  
if (item) {  
// Lock the crosshair to the data point being hovered  
myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] });  
}  
else {  
// Return normal crosshair operation  
myFlot.unlockCrosshair();  
}  
});  
 
- unlockCrosshair()  
 
Free the crosshair to move again after locking it.  
*/  
 
(function ($) {  
var options = {  
crosshair: {  
mode: null, // one of null, "x", "y" or "xy",  
color: "rgba(170, 0, 0, 0.80)",  
lineWidth: 1  
}  
};  
 
function init(plot) {  
// position of crosshair in pixels  
var crosshair = { x: -1, y: -1, locked: false };  
 
plot.setCrosshair = function setCrosshair(pos) {  
if (!pos)  
crosshair.x = -1;  
else {  
var axes = plot.getAxes();  
 
crosshair.x = Math.max(0, Math.min(pos.x != null ? axes.xaxis.p2c(pos.x) : axes.x2axis.p2c(pos.x2), plot.width()));  
crosshair.y = Math.max(0, Math.min(pos.y != null ? axes.yaxis.p2c(pos.y) : axes.y2axis.p2c(pos.y2), plot.height()));  
}  
 
plot.triggerRedrawOverlay();  
};  
 
plot.clearCrosshair = plot.setCrosshair; // passes null for pos  
 
plot.lockCrosshair = function lockCrosshair(pos) {  
if (pos)  
plot.setCrosshair(pos);  
crosshair.locked = true;  
}  
 
plot.unlockCrosshair = function unlockCrosshair() {  
crosshair.locked = false;  
}  
 
plot.hooks.bindEvents.push(function (plot, eventHolder) {  
if (!plot.getOptions().crosshair.mode)  
return;  
 
eventHolder.mouseout(function () {  
if (crosshair.x != -1) {  
crosshair.x = -1;  
plot.triggerRedrawOverlay();  
}  
});  
 
eventHolder.mousemove(function (e) {  
if (plot.getSelection && plot.getSelection()) {  
crosshair.x = -1; // hide the crosshair while selecting  
return;  
}  
 
if (crosshair.locked)  
return;  
 
var offset = plot.offset();  
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));  
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));  
plot.triggerRedrawOverlay();  
});  
});  
 
plot.hooks.drawOverlay.push(function (plot, ctx) {  
var c = plot.getOptions().crosshair;  
if (!c.mode)  
return;  
 
var plotOffset = plot.getPlotOffset();  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
if (crosshair.x != -1) {  
ctx.strokeStyle = c.color;  
ctx.lineWidth = c.lineWidth;  
ctx.lineJoin = "round";  
 
ctx.beginPath();  
if (c.mode.indexOf("x") != -1) {  
ctx.moveTo(crosshair.x, 0);  
ctx.lineTo(crosshair.x, plot.height());  
}  
if (c.mode.indexOf("y") != -1) {  
ctx.moveTo(0, crosshair.y);  
ctx.lineTo(plot.width(), crosshair.y);  
}  
ctx.stroke();  
}  
ctx.restore();  
});  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'crosshair',  
version: '1.0'  
});  
})(jQuery);  
 
(function(B){var A={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function C(G){var H={x:-1,y:-1,locked:false};G.setCrosshair=function D(J){if(!J){H.x=-1}else{var I=G.getAxes();H.x=Math.max(0,Math.min(J.x!=null?I.xaxis.p2c(J.x):I.x2axis.p2c(J.x2),G.width()));H.y=Math.max(0,Math.min(J.y!=null?I.yaxis.p2c(J.y):I.y2axis.p2c(J.y2),G.height()))}G.triggerRedrawOverlay()};G.clearCrosshair=G.setCrosshair;G.lockCrosshair=function E(I){if(I){G.setCrosshair(I)}H.locked=true};G.unlockCrosshair=function F(){H.locked=false};G.hooks.bindEvents.push(function(J,I){if(!J.getOptions().crosshair.mode){return }I.mouseout(function(){if(H.x!=-1){H.x=-1;J.triggerRedrawOverlay()}});I.mousemove(function(K){if(J.getSelection&&J.getSelection()){H.x=-1;return }if(H.locked){return }var L=J.offset();H.x=Math.max(0,Math.min(K.pageX-L.left,J.width()));H.y=Math.max(0,Math.min(K.pageY-L.top,J.height()));J.triggerRedrawOverlay()})});G.hooks.drawOverlay.push(function(K,I){var L=K.getOptions().crosshair;if(!L.mode){return }var J=K.getPlotOffset();I.save();I.translate(J.left,J.top);if(H.x!=-1){I.strokeStyle=L.color;I.lineWidth=L.lineWidth;I.lineJoin="round";I.beginPath();if(L.mode.indexOf("x")!=-1){I.moveTo(H.x,0);I.lineTo(H.x,K.height())}if(L.mode.indexOf("y")!=-1){I.moveTo(0,H.y);I.lineTo(K.width(),H.y)}I.stroke()}I.restore()})}B.plot.plugins.push({init:C,options:A,name:"crosshair",version:"1.0"})})(jQuery);  
/*  
Flot plugin for plotting images, e.g. useful for putting ticks on a  
prerendered complex visualization.  
 
The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and  
(x2, y2) are where you intend the two opposite corners of the image to  
end up in the plot. Image must be a fully loaded Javascript image (you  
can make one with new Image()). If the image is not complete, it's  
skipped when plotting.  
 
There are two helpers included for retrieving images. The easiest work  
the way that you put in URLs instead of images in the data (like  
["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data,  
options, callback) where data and options are the same as you pass in  
to $.plot. This loads the images, replaces the URLs in the data with  
the corresponding images and calls "callback" when all images are  
loaded (or failed loading). In the callback, you can then call $.plot  
with the data set. See the included example.  
 
A more low-level helper, $.plot.image.load(urls, callback) is also  
included. Given a list of URLs, it calls callback with an object  
mapping from URL to Image object when all images are loaded or have  
failed loading.  
 
Options for the plugin are  
 
series: {  
images: {  
show: boolean  
anchor: "corner" or "center"  
alpha: [0,1]  
}  
}  
 
which can be specified for a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ])  
 
Note that because the data format is different from usual data points,  
you can't use images with anything else in a specific data series.  
 
Setting "anchor" to "center" causes the pixels in the image to be  
anchored at the corner pixel centers inside of at the pixel corners,  
effectively letting half a pixel stick out to each side in the plot.  
 
 
A possible future direction could be support for tiling for large  
images (like Google Maps).  
 
*/  
 
(function ($) {  
var options = {  
series: {  
images: {  
show: false,  
alpha: 1,  
anchor: "corner" // or "center"  
}  
}  
};  
 
$.plot.image = {};  
 
$.plot.image.loadDataImages = function (series, options, callback) {  
var urls = [], points = [];  
 
var defaultShow = options.series.images.show;  
 
$.each(series, function (i, s) {  
if (!(defaultShow || s.images.show))  
return;  
 
if (s.data)  
s = s.data;  
 
$.each(s, function (i, p) {  
if (typeof p[0] == "string") {  
urls.push(p[0]);  
points.push(p);  
}  
});  
});  
 
$.plot.image.load(urls, function (loadedImages) {  
$.each(points, function (i, p) {  
var url = p[0];  
if (loadedImages[url])  
p[0] = loadedImages[url];  
});  
 
callback();  
});  
}  
 
$.plot.image.load = function (urls, callback) {  
var missing = urls.length, loaded = {};  
if (missing == 0)  
callback({});  
 
$.each(urls, function (i, url) {  
var handler = function () {  
--missing;  
 
loaded[url] = this;  
 
if (missing == 0)  
callback(loaded);  
};  
 
$('<img />').load(handler).error(handler).attr('src', url);  
});  
}  
 
function draw(plot, ctx) {  
var plotOffset = plot.getPlotOffset();  
 
$.each(plot.getData(), function (i, series) {  
var points = series.datapoints.points,  
ps = series.datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
var img = points[i],  
x1 = points[i + 1], y1 = points[i + 2],  
x2 = points[i + 3], y2 = points[i + 4],  
xaxis = series.xaxis, yaxis = series.yaxis,  
tmp;  
 
// actually we should check img.complete, but it  
// appears to be a somewhat unreliable indicator in  
// IE6 (false even after load event)  
if (!img || img.width <= 0 || img.height <= 0)  
continue;  
 
if (x1 > x2) {  
tmp = x2;  
x2 = x1;  
x1 = tmp;  
}  
if (y1 > y2) {  
tmp = y2;  
y2 = y1;  
y1 = tmp;  
}  
 
// if the anchor is at the center of the pixel, expand the  
// image by 1/2 pixel in each direction  
if (series.images.anchor == "center") {  
tmp = 0.5 * (x2-x1) / (img.width - 1);  
x1 -= tmp;  
x2 += tmp;  
tmp = 0.5 * (y2-y1) / (img.height - 1);  
y1 -= tmp;  
y2 += tmp;  
}  
 
// clip  
if (x1 == x2 || y1 == y2 ||  
x1 >= xaxis.max || x2 <= xaxis.min ||  
y1 >= yaxis.max || y2 <= yaxis.min)  
continue;  
 
var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height;  
if (x1 < xaxis.min) {  
sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1);  
x1 = xaxis.min;  
}  
 
if (x2 > xaxis.max) {  
sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1);  
x2 = xaxis.max;  
}  
 
if (y1 < yaxis.min) {  
sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1);  
y1 = yaxis.min;  
}  
 
if (y2 > yaxis.max) {  
sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1);  
y2 = yaxis.max;  
}  
 
x1 = xaxis.p2c(x1);  
x2 = xaxis.p2c(x2);  
y1 = yaxis.p2c(y1);  
y2 = yaxis.p2c(y2);  
 
// the transformation may have swapped us  
if (x1 > x2) {  
tmp = x2;  
x2 = x1;  
x1 = tmp;  
}  
if (y1 > y2) {  
tmp = y2;  
y2 = y1;  
y1 = tmp;  
}  
 
tmp = ctx.globalAlpha;  
ctx.globalAlpha *= series.images.alpha;  
ctx.drawImage(img,  
sx1, sy1, sx2 - sx1, sy2 - sy1,  
x1 + plotOffset.left, y1 + plotOffset.top,  
x2 - x1, y2 - y1);  
ctx.globalAlpha = tmp;  
}  
});  
}  
 
function processRawData(plot, series, data, datapoints) {  
if (!series.images.show)  
return;  
 
// format is Image, x1, y1, x2, y2 (opposite corners)  
datapoints.format = [  
{ required: true },  
{ x: true, number: true, required: true },  
{ y: true, number: true, required: true },  
{ x: true, number: true, required: true },  
{ y: true, number: true, required: true }  
];  
}  
 
function init(plot) {  
plot.hooks.processRawData.push(processRawData);  
plot.hooks.draw.push(draw);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'image',  
version: '1.1'  
});  
})(jQuery);  
 
(function(D){var B={series:{images:{show:false,alpha:1,anchor:"corner"}}};D.plot.image={};D.plot.image.loadDataImages=function(G,F,K){var J=[],H=[];var I=F.series.images.show;D.each(G,function(L,M){if(!(I||M.images.show)){return }if(M.data){M=M.data}D.each(M,function(N,O){if(typeof O[0]=="string"){J.push(O[0]);H.push(O)}})});D.plot.image.load(J,function(L){D.each(H,function(N,O){var M=O[0];if(L[M]){O[0]=L[M]}});K()})};D.plot.image.load=function(H,I){var G=H.length,F={};if(G==0){I({})}D.each(H,function(K,J){var L=function(){--G;F[J]=this;if(G==0){I(F)}};D("<img />").load(L).error(L).attr("src",J)})};function A(H,F){var G=H.getPlotOffset();D.each(H.getData(),function(O,P){var X=P.datapoints.points,I=P.datapoints.pointsize;for(var O=0;O<X.length;O+=I){var Q=X[O],M=X[O+1],V=X[O+2],K=X[O+3],T=X[O+4],W=P.xaxis,S=P.yaxis,N;if(!Q||Q.width<=0||Q.height<=0){continue}if(M>K){N=K;K=M;M=N}if(V>T){N=T;T=V;V=N}if(P.images.anchor=="center"){N=0.5*(K-M)/(Q.width-1);M-=N;K+=N;N=0.5*(T-V)/(Q.height-1);V-=N;T+=N}if(M==K||V==T||M>=W.max||K<=W.min||V>=S.max||T<=S.min){continue}var L=0,U=0,J=Q.width,R=Q.height;if(M<W.min){L+=(J-L)*(W.min-M)/(K-M);M=W.min}if(K>W.max){J+=(J-L)*(W.max-K)/(K-M);K=W.max}if(V<S.min){R+=(U-R)*(S.min-V)/(T-V);V=S.min}if(T>S.max){U+=(U-R)*(S.max-T)/(T-V);T=S.max}M=W.p2c(M);K=W.p2c(K);V=S.p2c(V);T=S.p2c(T);if(M>K){N=K;K=M;M=N}if(V>T){N=T;T=V;V=N}N=F.globalAlpha;F.globalAlpha*=P.images.alpha;F.drawImage(Q,L,U,J-L,R-U,M+G.left,V+G.top,K-M,T-V);F.globalAlpha=N}})}function C(I,F,G,H){if(!F.images.show){return }H.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function E(F){F.hooks.processRawData.push(C);F.hooks.draw.push(A)}D.plot.plugins.push({init:E,options:B,name:"image",version:"1.1"})})(jQuery);  
/* Javascript plotting library for jQuery, v. 0.6.  
*  
* Released under the MIT license by IOLA, December 2007.  
*  
*/  
 
// first an inline dependency, jquery.colorhelpers.js, we inline it here  
// for convenience  
 
/* Plugin for jQuery for working with colors.  
*  
* Version 1.0.  
*  
* Inspiration from jQuery color animation plugin by John Resig.  
*  
* Released under the MIT license by Ole Laursen, October 2009.  
*  
* Examples:  
*  
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()  
* var c = $.color.extract($("#mydiv"), 'background-color');  
* console.log(c.r, c.g, c.b, c.a);  
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"  
*  
* Note that .scale() and .add() work in-place instead of returning  
* new objects.  
*/  
(function(){jQuery.color={};jQuery.color.make=function(E,D,B,C){var F={};F.r=E||0;F.g=D||0;F.b=B||0;F.a=C!=null?C:1;F.add=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]+=H}return F.normalize()};F.scale=function(I,H){for(var G=0;G<I.length;++G){F[I.charAt(G)]*=H}return F.normalize()};F.toString=function(){if(F.a>=1){return"rgb("+[F.r,F.g,F.b].join(",")+")"}else{return"rgba("+[F.r,F.g,F.b,F.a].join(",")+")"}};F.normalize=function(){function G(I,J,H){return J<I?I:(J>H?H:J)}F.r=G(0,parseInt(F.r),255);F.g=G(0,parseInt(F.g),255);F.b=G(0,parseInt(F.b),255);F.a=G(0,F.a,1);return F};F.clone=function(){return jQuery.color.make(F.r,F.b,F.g,F.a)};return F.normalize()};jQuery.color.extract=function(C,B){var D;do{D=C.css(B).toLowerCase();if(D!=""&&D!="transparent"){break}C=C.parent()}while(!jQuery.nodeName(C.get(0),"body"));if(D=="rgba(0, 0, 0, 0)"){D="transparent"}return jQuery.color.parse(D)};jQuery.color.parse=function(E){var D,B=jQuery.color.make;if(D=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10))}if(D=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseInt(D[1],10),parseInt(D[2],10),parseInt(D[3],10),parseFloat(D[4]))}if(D=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55)}if(D=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(E)){return B(parseFloat(D[1])*2.55,parseFloat(D[2])*2.55,parseFloat(D[3])*2.55,parseFloat(D[4]))}if(D=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(E)){return B(parseInt(D[1],16),parseInt(D[2],16),parseInt(D[3],16))}if(D=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(E)){return B(parseInt(D[1]+D[1],16),parseInt(D[2]+D[2],16),parseInt(D[3]+D[3],16))}var C=jQuery.trim(E).toLowerCase();if(C=="transparent"){return B(255,255,255,0)}else{D=A[C];return B(D[0],D[1],D[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();  
 
// the actual Flot code  
(function($) {  
function Plot(placeholder, data_, options_, plugins) {  
// data is on the form:  
// [ series1, series2 ... ]  
// where series is either just the data as [ [x1, y1], [x2, y2], ... ]  
// or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }  
 
var series = [],  
options = {  
// the color theme used for graphs  
colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],  
legend: {  
show: true,  
noColumns: 1, // number of colums in legend table  
labelFormatter: null, // fn: string -> string  
labelBoxBorderColor: "#ccc", // border color for the little label boxes  
container: null, // container (as jQuery object) to put legend in, null means default on top of graph  
position: "ne", // position of default legend container within plot  
margin: 5, // distance from grid edge to default legend container within plot  
backgroundColor: null, // null means auto-detect  
backgroundOpacity: 0.85 // set to 0 to avoid background  
},  
xaxis: {  
mode: null, // null or "time"  
transform: null, // null or f: number -> number to transform axis  
inverseTransform: null, // if transform is set, this should be the inverse function  
min: null, // min. value to show, null means set automatically  
max: null, // max. value to show, null means set automatically  
autoscaleMargin: null, // margin in % to add if auto-setting min/max  
ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks  
tickFormatter: null, // fn: number -> string  
labelWidth: null, // size of tick labels in pixels  
labelHeight: null,  
 
// mode specific options  
tickDecimals: null, // no. of decimals, null means auto  
tickSize: null, // number or [number, "unit"]  
minTickSize: null, // number or [number, "unit"]  
monthNames: null, // list of names of months  
timeformat: null, // format string to use  
twelveHourClock: false // 12 or 24 time in time mode  
},  
yaxis: {  
autoscaleMargin: 0.02  
},  
x2axis: {  
autoscaleMargin: null  
},  
y2axis: {  
autoscaleMargin: 0.02  
},  
series: {  
points: {  
show: false,  
radius: 3,  
lineWidth: 2, // in pixels  
fill: true,  
fillColor: "#ffffff"  
},  
lines: {  
// we don't put in show: false so we can see  
// whether lines were actively disabled  
lineWidth: 2, // in pixels  
fill: false,  
fillColor: null,  
steps: false  
},  
bars: {  
show: false,  
lineWidth: 2, // in pixels  
barWidth: 1, // in units of the x axis  
fill: true,  
fillColor: null,  
align: "left", // or "center"  
horizontal: false // when horizontal, left is now top  
},  
shadowSize: 3  
},  
grid: {  
show: true,  
aboveData: false,  
color: "#545454", // primary color used for outline and labels  
backgroundColor: null, // null for transparent, else color  
tickColor: "rgba(0,0,0,0.15)", // color used for the ticks  
labelMargin: 5, // in pixels  
borderWidth: 2, // in pixels  
borderColor: null, // set if different from the grid color  
markings: null, // array of ranges or fn: axes -> array of ranges  
markingsColor: "#f4f4f4",  
markingsLineWidth: 2,  
// interactive stuff  
clickable: false,  
hoverable: false,  
autoHighlight: true, // highlight in case mouse is near  
mouseActiveRadius: 10 // how far the mouse can be away to activate an item  
},  
hooks: {}  
},  
canvas = null, // the canvas for the plot itself  
overlay = null, // canvas for interactive stuff on top of plot  
eventHolder = null, // jQuery object that events should be bound to  
ctx = null, octx = null,  
axes = { xaxis: {}, yaxis: {}, x2axis: {}, y2axis: {} },  
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},  
canvasWidth = 0, canvasHeight = 0,  
plotWidth = 0, plotHeight = 0,  
hooks = {  
processOptions: [],  
processRawData: [],  
processDatapoints: [],  
draw: [],  
bindEvents: [],  
drawOverlay: []  
},  
plot = this;  
 
// public functions  
plot.setData = setData;  
plot.setupGrid = setupGrid;  
plot.draw = draw;  
plot.getPlaceholder = function() { return placeholder; };  
plot.getCanvas = function() { return canvas; };  
plot.getPlotOffset = function() { return plotOffset; };  
plot.width = function () { return plotWidth; };  
plot.height = function () { return plotHeight; };  
plot.offset = function () {  
var o = eventHolder.offset();  
o.left += plotOffset.left;  
o.top += plotOffset.top;  
return o;  
};  
plot.getData = function() { return series; };  
plot.getAxes = function() { return axes; };  
plot.getOptions = function() { return options; };  
plot.highlight = highlight;  
plot.unhighlight = unhighlight;  
plot.triggerRedrawOverlay = triggerRedrawOverlay;  
plot.pointOffset = function(point) {  
return { left: parseInt(axisSpecToRealAxis(point, "xaxis").p2c(+point.x) + plotOffset.left),  
top: parseInt(axisSpecToRealAxis(point, "yaxis").p2c(+point.y) + plotOffset.top) };  
};  
 
 
// public attributes  
plot.hooks = hooks;  
 
// initialize  
initPlugins(plot);  
parseOptions(options_);  
constructCanvas();  
setData(data_);  
setupGrid();  
draw();  
bindEvents();  
 
 
function executeHooks(hook, args) {  
args = [plot].concat(args);  
for (var i = 0; i < hook.length; ++i)  
hook[i].apply(this, args);  
}  
 
function initPlugins() {  
for (var i = 0; i < plugins.length; ++i) {  
var p = plugins[i];  
p.init(plot);  
if (p.options)  
$.extend(true, options, p.options);  
}  
}  
 
function parseOptions(opts) {  
$.extend(true, options, opts);  
if (options.grid.borderColor == null)  
options.grid.borderColor = options.grid.color;  
// backwards compatibility, to be removed in future  
if (options.xaxis.noTicks && options.xaxis.ticks == null)  
options.xaxis.ticks = options.xaxis.noTicks;  
if (options.yaxis.noTicks && options.yaxis.ticks == null)  
options.yaxis.ticks = options.yaxis.noTicks;  
if (options.grid.coloredAreas)  
options.grid.markings = options.grid.coloredAreas;  
if (options.grid.coloredAreasColor)  
options.grid.markingsColor = options.grid.coloredAreasColor;  
if (options.lines)  
$.extend(true, options.series.lines, options.lines);  
if (options.points)  
$.extend(true, options.series.points, options.points);  
if (options.bars)  
$.extend(true, options.series.bars, options.bars);  
if (options.shadowSize)  
options.series.shadowSize = options.shadowSize;  
 
for (var n in hooks)  
if (options.hooks[n] && options.hooks[n].length)  
hooks[n] = hooks[n].concat(options.hooks[n]);  
 
executeHooks(hooks.processOptions, [options]);  
}  
 
function setData(d) {  
series = parseData(d);  
fillInSeriesOptions();  
processData();  
}  
 
function parseData(d) {  
var res = [];  
for (var i = 0; i < d.length; ++i) {  
var s = $.extend(true, {}, options.series);  
 
if (d[i].data) {  
s.data = d[i].data; // move the data instead of deep-copy  
delete d[i].data;  
 
$.extend(true, s, d[i]);  
 
d[i].data = s.data;  
}  
else  
s.data = d[i];  
res.push(s);  
}  
 
return res;  
}  
 
function axisSpecToRealAxis(obj, attr) {  
var a = obj[attr];  
if (!a || a == 1)  
return axes[attr];  
if (typeof a == "number")  
return axes[attr.charAt(0) + a + attr.slice(1)];  
return a; // assume it's OK  
}  
 
function fillInSeriesOptions() {  
var i;  
 
// collect what we already got of colors  
var neededColors = series.length,  
usedColors = [],  
assignedColors = [];  
for (i = 0; i < series.length; ++i) {  
var sc = series[i].color;  
if (sc != null) {  
--neededColors;  
if (typeof sc == "number")  
assignedColors.push(sc);  
else  
usedColors.push($.color.parse(series[i].color));  
}  
}  
 
// we might need to generate more colors if higher indices  
// are assigned  
for (i = 0; i < assignedColors.length; ++i) {  
neededColors = Math.max(neededColors, assignedColors[i] + 1);  
}  
 
// produce colors as needed  
var colors = [], variation = 0;  
i = 0;  
while (colors.length < neededColors) {  
var c;  
if (options.colors.length == i) // check degenerate case  
c = $.color.make(100, 100, 100);  
else  
c = $.color.parse(options.colors[i]);  
 
// vary color if needed  
var sign = variation % 2 == 1 ? -1 : 1;  
c.scale('rgb', 1 + sign * Math.ceil(variation / 2) * 0.2)  
 
// FIXME: if we're getting to close to something else,  
// we should probably skip this one  
colors.push(c);  
 
++i;  
if (i >= options.colors.length) {  
i = 0;  
++variation;  
}  
}  
 
// fill in the options  
var colori = 0, s;  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
// assign colors  
if (s.color == null) {  
s.color = colors[colori].toString();  
++colori;  
}  
else if (typeof s.color == "number")  
s.color = colors[s.color].toString();  
 
// turn on lines automatically in case nothing is set  
if (s.lines.show == null) {  
var v, show = true;  
for (v in s)  
if (s[v].show) {  
show = false;  
break;  
}  
if (show)  
s.lines.show = true;  
}  
 
// setup axes  
s.xaxis = axisSpecToRealAxis(s, "xaxis");  
s.yaxis = axisSpecToRealAxis(s, "yaxis");  
}  
}  
 
function processData() {  
var topSentry = Number.POSITIVE_INFINITY,  
bottomSentry = Number.NEGATIVE_INFINITY,  
i, j, k, m, length,  
s, points, ps, x, y, axis, val, f, p;  
 
for (axis in axes) {  
axes[axis].datamin = topSentry;  
axes[axis].datamax = bottomSentry;  
axes[axis].used = false;  
}  
 
function updateAxis(axis, min, max) {  
if (min < axis.datamin)  
axis.datamin = min;  
if (max > axis.datamax)  
axis.datamax = max;  
}  
 
for (i = 0; i < series.length; ++i) {  
s = series[i];  
s.datapoints = { points: [] };  
 
executeHooks(hooks.processRawData, [ s, s.data, s.datapoints ]);  
}  
 
// first pass: clean and copy data  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
var data = s.data, format = s.datapoints.format;  
 
if (!format) {  
format = [];  
// find out how to copy  
format.push({ x: true, number: true, required: true });  
format.push({ y: true, number: true, required: true });  
 
if (s.bars.show)  
format.push({ y: true, number: true, required: false, defaultValue: 0 });  
 
s.datapoints.format = format;  
}  
 
if (s.datapoints.pointsize != null)  
continue; // already filled in  
 
if (s.datapoints.pointsize == null)  
s.datapoints.pointsize = format.length;  
 
ps = s.datapoints.pointsize;  
points = s.datapoints.points;  
 
insertSteps = s.lines.show && s.lines.steps;  
s.xaxis.used = s.yaxis.used = true;  
 
for (j = k = 0; j < data.length; ++j, k += ps) {  
p = data[j];  
 
var nullify = p == null;  
if (!nullify) {  
for (m = 0; m < ps; ++m) {  
val = p[m];  
f = format[m];  
 
if (f) {  
if (f.number && val != null) {  
val = +val; // convert to number  
if (isNaN(val))  
val = null;  
}  
 
if (val == null) {  
if (f.required)  
nullify = true;  
 
if (f.defaultValue != null)  
val = f.defaultValue;  
}  
}  
 
points[k + m] = val;  
}  
}  
 
if (nullify) {  
for (m = 0; m < ps; ++m) {  
val = points[k + m];  
if (val != null) {  
f = format[m];  
// extract min/max info  
if (f.x)  
updateAxis(s.xaxis, val, val);  
if (f.y)  
updateAxis(s.yaxis, val, val);  
}  
points[k + m] = null;  
}  
}  
else {  
// a little bit of line specific stuff that  
// perhaps shouldn't be here, but lacking  
// better means...  
if (insertSteps && k > 0  
&& points[k - ps] != null  
&& points[k - ps] != points[k]  
&& points[k - ps + 1] != points[k + 1]) {  
// copy the point to make room for a middle point  
for (m = 0; m < ps; ++m)  
points[k + ps + m] = points[k + m];  
 
// middle point has same y  
points[k + 1] = points[k - ps + 1];  
 
// we've added a point, better reflect that  
k += ps;  
}  
}  
}  
}  
 
// give the hooks a chance to run  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
executeHooks(hooks.processDatapoints, [ s, s.datapoints]);  
}  
 
// second pass: find datamax/datamin for auto-scaling  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
points = s.datapoints.points,  
ps = s.datapoints.pointsize;  
 
var xmin = topSentry, ymin = topSentry,  
xmax = bottomSentry, ymax = bottomSentry;  
 
for (j = 0; j < points.length; j += ps) {  
if (points[j] == null)  
continue;  
 
for (m = 0; m < ps; ++m) {  
val = points[j + m];  
f = format[m];  
if (!f)  
continue;  
 
if (f.x) {  
if (val < xmin)  
xmin = val;  
if (val > xmax)  
xmax = val;  
}  
if (f.y) {  
if (val < ymin)  
ymin = val;  
if (val > ymax)  
ymax = val;  
}  
}  
}  
 
if (s.bars.show) {  
// make sure we got room for the bar on the dancing floor  
var delta = s.bars.align == "left" ? 0 : -s.bars.barWidth/2;  
if (s.bars.horizontal) {  
ymin += delta;  
ymax += delta + s.bars.barWidth;  
}  
else {  
xmin += delta;  
xmax += delta + s.bars.barWidth;  
}  
}  
 
updateAxis(s.xaxis, xmin, xmax);  
updateAxis(s.yaxis, ymin, ymax);  
}  
 
for (axis in axes) {  
if (axes[axis].datamin == topSentry)  
axes[axis].datamin = null;  
if (axes[axis].datamax == bottomSentry)  
axes[axis].datamax = null;  
}  
}  
 
function constructCanvas() {  
function makeCanvas(width, height) {  
var c = document.createElement('canvas');  
c.width = width;  
c.height = height;  
if ($.browser.msie) // excanvas hack  
c = window.G_vmlCanvasManager.initElement(c);  
return c;  
}  
 
canvasWidth = placeholder.width();  
canvasHeight = placeholder.height();  
placeholder.html(""); // clear placeholder  
if (placeholder.css("position") == 'static')  
placeholder.css("position", "relative"); // for positioning labels and overlay  
 
if (canvasWidth <= 0 || canvasHeight <= 0)  
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight;  
 
if ($.browser.msie) // excanvas hack  
window.G_vmlCanvasManager.init_(document); // make sure everything is setup  
 
// the canvas  
canvas = $(makeCanvas(canvasWidth, canvasHeight)).appendTo(placeholder).get(0);  
ctx = canvas.getContext("2d");  
 
// overlay canvas for interactive features  
overlay = $(makeCanvas(canvasWidth, canvasHeight)).css({ position: 'absolute', left: 0, top: 0 }).appendTo(placeholder).get(0);  
octx = overlay.getContext("2d");  
octx.stroke();  
}  
 
function bindEvents() {  
// we include the canvas in the event holder too, because IE 7  
// sometimes has trouble with the stacking order  
eventHolder = $([overlay, canvas]);  
 
// bind events  
if (options.grid.hoverable)  
eventHolder.mousemove(onMouseMove);  
 
if (options.grid.clickable)  
eventHolder.click(onClick);  
 
executeHooks(hooks.bindEvents, [eventHolder]);  
}  
 
function setupGrid() {  
function setTransformationHelpers(axis, o) {  
function identity(x) { return x; }  
 
var s, m, t = o.transform || identity,  
it = o.inverseTransform;  
 
// add transformation helpers  
if (axis == axes.xaxis || axis == axes.x2axis) {  
// precompute how much the axis is scaling a point  
// in canvas space  
s = axis.scale = plotWidth / (t(axis.max) - t(axis.min));  
m = t(axis.min);  
 
// data point to canvas coordinate  
if (t == identity) // slight optimization  
axis.p2c = function (p) { return (p - m) * s; };  
else  
axis.p2c = function (p) { return (t(p) - m) * s; };  
// canvas coordinate to data point  
if (!it)  
axis.c2p = function (c) { return m + c / s; };  
else  
axis.c2p = function (c) { return it(m + c / s); };  
}  
else {  
s = axis.scale = plotHeight / (t(axis.max) - t(axis.min));  
m = t(axis.max);  
 
if (t == identity)  
axis.p2c = function (p) { return (m - p) * s; };  
else  
axis.p2c = function (p) { return (m - t(p)) * s; };  
if (!it)  
axis.c2p = function (c) { return m - c / s; };  
else  
axis.c2p = function (c) { return it(m - c / s); };  
}  
}  
 
function measureLabels(axis, axisOptions) {  
var i, labels = [], l;  
 
axis.labelWidth = axisOptions.labelWidth;  
axis.labelHeight = axisOptions.labelHeight;  
 
if (axis == axes.xaxis || axis == axes.x2axis) {  
// to avoid measuring the widths of the labels, we  
// construct fixed-size boxes and put the labels inside  
// them, we don't need the exact figures and the  
// fixed-size box content is easy to center  
if (axis.labelWidth == null)  
axis.labelWidth = canvasWidth / (axis.ticks.length > 0 ? axis.ticks.length : 1);  
 
// measure x label heights  
if (axis.labelHeight == null) {  
labels = [];  
for (i = 0; i < axis.ticks.length; ++i) {  
l = axis.ticks[i].label;  
if (l)  
labels.push('<div class="tickLabel" style="float:left;width:' + axis.labelWidth + 'px">' + l + '</div>');  
}  
 
if (labels.length > 0) {  
var dummyDiv = $('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'  
+ labels.join("") + '<div style="clear:left"></div></div>').appendTo(placeholder);  
axis.labelHeight = dummyDiv.height();  
dummyDiv.remove();  
}  
}  
}  
else if (axis.labelWidth == null || axis.labelHeight == null) {  
// calculate y label dimensions  
for (i = 0; i < axis.ticks.length; ++i) {  
l = axis.ticks[i].label;  
if (l)  
labels.push('<div class="tickLabel">' + l + '</div>');  
}  
 
if (labels.length > 0) {  
var dummyDiv = $('<div style="position:absolute;top:-10000px;font-size:smaller">'  
+ labels.join("") + '</div>').appendTo(placeholder);  
if (axis.labelWidth == null)  
axis.labelWidth = dummyDiv.width();  
if (axis.labelHeight == null)  
axis.labelHeight = dummyDiv.find("div").height();  
dummyDiv.remove();  
}  
 
}  
 
if (axis.labelWidth == null)  
axis.labelWidth = 0;  
if (axis.labelHeight == null)  
axis.labelHeight = 0;  
}  
 
function setGridSpacing() {  
// get the most space needed around the grid for things  
// that may stick out  
var maxOutset = options.grid.borderWidth;  
for (i = 0; i < series.length; ++i)  
maxOutset = Math.max(maxOutset, 2 * (series[i].points.radius + series[i].points.lineWidth/2));  
 
plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = maxOutset;  
 
var margin = options.grid.labelMargin + options.grid.borderWidth;  
 
if (axes.xaxis.labelHeight > 0)  
plotOffset.bottom = Math.max(maxOutset, axes.xaxis.labelHeight + margin);  
if (axes.yaxis.labelWidth > 0)  
plotOffset.left = Math.max(maxOutset, axes.yaxis.labelWidth + margin);  
if (axes.x2axis.labelHeight > 0)  
plotOffset.top = Math.max(maxOutset, axes.x2axis.labelHeight + margin);  
if (axes.y2axis.labelWidth > 0)  
plotOffset.right = Math.max(maxOutset, axes.y2axis.labelWidth + margin);  
 
plotWidth = canvasWidth - plotOffset.left - plotOffset.right;  
plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top;  
}  
 
var axis;  
for (axis in axes)  
setRange(axes[axis], options[axis]);  
 
if (options.grid.show) {  
for (axis in axes) {  
prepareTickGeneration(axes[axis], options[axis]);  
setTicks(axes[axis], options[axis]);  
measureLabels(axes[axis], options[axis]);  
}  
 
setGridSpacing();  
}  
else {  
plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = 0;  
plotWidth = canvasWidth;  
plotHeight = canvasHeight;  
}  
 
for (axis in axes)  
setTransformationHelpers(axes[axis], options[axis]);  
 
if (options.grid.show)  
insertLabels();  
 
insertLegend();  
}  
 
function setRange(axis, axisOptions) {  
var min = +(axisOptions.min != null ? axisOptions.min : axis.datamin),  
max = +(axisOptions.max != null ? axisOptions.max : axis.datamax),  
delta = max - min;  
 
if (delta == 0.0) {  
// degenerate case  
var widen = max == 0 ? 1 : 0.01;  
 
if (axisOptions.min == null)  
min -= widen;  
// alway widen max if we couldn't widen min to ensure we  
// don't fall into min == max which doesn't work  
if (axisOptions.max == null || axisOptions.min != null)  
max += widen;  
}  
else {  
// consider autoscaling  
var margin = axisOptions.autoscaleMargin;  
if (margin != null) {  
if (axisOptions.min == null) {  
min -= delta * margin;  
// make sure we don't go below zero if all values  
// are positive  
if (min < 0 && axis.datamin != null && axis.datamin >= 0)  
min = 0;  
}  
if (axisOptions.max == null) {  
max += delta * margin;  
if (max > 0 && axis.datamax != null && axis.datamax <= 0)  
max = 0;  
}  
}  
}  
axis.min = min;  
axis.max = max;  
}  
 
function prepareTickGeneration(axis, axisOptions) {  
// estimate number of ticks  
var noTicks;  
if (typeof axisOptions.ticks == "number" && axisOptions.ticks > 0)  
noTicks = axisOptions.ticks;  
else if (axis == axes.xaxis || axis == axes.x2axis)  
// heuristic based on the model a*sqrt(x) fitted to  
// some reasonable data points  
noTicks = 0.3 * Math.sqrt(canvasWidth);  
else  
noTicks = 0.3 * Math.sqrt(canvasHeight);  
 
var delta = (axis.max - axis.min) / noTicks,  
size, generator, unit, formatter, i, magn, norm;  
 
if (axisOptions.mode == "time") {  
// pretty handling of time  
 
// map of app. size of time units in milliseconds  
var timeUnitSize = {  
"second": 1000,  
"minute": 60 * 1000,  
"hour": 60 * 60 * 1000,  
"day": 24 * 60 * 60 * 1000,  
"month": 30 * 24 * 60 * 60 * 1000,  
"year": 365.2425 * 24 * 60 * 60 * 1000  
};  
 
 
// the allowed tick sizes, after 1 year we use  
// an integer algorithm  
var spec = [  
[1, "second"], [2, "second"], [5, "second"], [10, "second"],  
[30, "second"],  
[1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],  
[30, "minute"],  
[1, "hour"], [2, "hour"], [4, "hour"],  
[8, "hour"], [12, "hour"],  
[1, "day"], [2, "day"], [3, "day"],  
[0.25, "month"], [0.5, "month"], [1, "month"],  
[2, "month"], [3, "month"], [6, "month"],  
[1, "year"]  
];  
 
var minSize = 0;  
if (axisOptions.minTickSize != null) {  
if (typeof axisOptions.tickSize == "number")  
minSize = axisOptions.tickSize;  
else  
minSize = axisOptions.minTickSize[0] * timeUnitSize[axisOptions.minTickSize[1]];  
}  
 
for (i = 0; i < spec.length - 1; ++i)  
if (delta < (spec[i][0] * timeUnitSize[spec[i][1]]  
+ spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2  
&& spec[i][0] * timeUnitSize[spec[i][1]] >= minSize)  
break;  
size = spec[i][0];  
unit = spec[i][1];  
 
// special-case the possibility of several years  
if (unit == "year") {  
magn = Math.pow(10, Math.floor(Math.log(delta / timeUnitSize.year) / Math.LN10));  
norm = (delta / timeUnitSize.year) / magn;  
if (norm < 1.5)  
size = 1;  
else if (norm < 3)  
size = 2;  
else if (norm < 7.5)  
size = 5;  
else  
size = 10;  
 
size *= magn;  
}  
 
if (axisOptions.tickSize) {  
size = axisOptions.tickSize[0];  
unit = axisOptions.tickSize[1];  
}  
 
generator = function(axis) {  
var ticks = [],  
tickSize = axis.tickSize[0], unit = axis.tickSize[1],  
d = new Date(axis.min);  
 
var step = tickSize * timeUnitSize[unit];  
 
if (unit == "second")  
d.setUTCSeconds(floorInBase(d.getUTCSeconds(), tickSize));  
if (unit == "minute")  
d.setUTCMinutes(floorInBase(d.getUTCMinutes(), tickSize));  
if (unit == "hour")  
d.setUTCHours(floorInBase(d.getUTCHours(), tickSize));  
if (unit == "month")  
d.setUTCMonth(floorInBase(d.getUTCMonth(), tickSize));  
if (unit == "year")  
d.setUTCFullYear(floorInBase(d.getUTCFullYear(), tickSize));  
 
// reset smaller components  
d.setUTCMilliseconds(0);  
if (step >= timeUnitSize.minute)  
d.setUTCSeconds(0);  
if (step >= timeUnitSize.hour)  
d.setUTCMinutes(0);  
if (step >= timeUnitSize.day)  
d.setUTCHours(0);  
if (step >= timeUnitSize.day * 4)  
d.setUTCDate(1);  
if (step >= timeUnitSize.year)  
d.setUTCMonth(0);  
 
 
var carry = 0, v = Number.NaN, prev;  
do {  
prev = v;  
v = d.getTime();  
ticks.push({ v: v, label: axis.tickFormatter(v, axis) });  
if (unit == "month") {  
if (tickSize < 1) {  
// a bit complicated - we'll divide the month  
// up but we need to take care of fractions  
// so we don't end up in the middle of a day  
d.setUTCDate(1);  
var start = d.getTime();  
d.setUTCMonth(d.getUTCMonth() + 1);  
var end = d.getTime();  
d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);  
carry = d.getUTCHours();  
d.setUTCHours(0);  
}  
else  
d.setUTCMonth(d.getUTCMonth() + tickSize);  
}  
else if (unit == "year") {  
d.setUTCFullYear(d.getUTCFullYear() + tickSize);  
}  
else  
d.setTime(v + step);  
} while (v < axis.max && v != prev);  
 
return ticks;  
};  
 
formatter = function (v, axis) {  
var d = new Date(v);  
 
// first check global format  
if (axisOptions.timeformat != null)  
return $.plot.formatDate(d, axisOptions.timeformat, axisOptions.monthNames);  
 
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];  
var span = axis.max - axis.min;  
var suffix = (axisOptions.twelveHourClock) ? " %p" : "";  
 
if (t < timeUnitSize.minute)  
fmt = "%h:%M:%S" + suffix;  
else if (t < timeUnitSize.day) {  
if (span < 2 * timeUnitSize.day)  
fmt = "%h:%M" + suffix;  
else  
fmt = "%b %d %h:%M" + suffix;  
}  
else if (t < timeUnitSize.month)  
fmt = "%b %d";  
else if (t < timeUnitSize.year) {  
if (span < timeUnitSize.year)  
fmt = "%b";  
else  
fmt = "%b %y";  
}  
else  
fmt = "%y";  
 
return $.plot.formatDate(d, fmt, axisOptions.monthNames);  
};  
}  
else {  
// pretty rounding of base-10 numbers  
var maxDec = axisOptions.tickDecimals;  
var dec = -Math.floor(Math.log(delta) / Math.LN10);  
if (maxDec != null && dec > maxDec)  
dec = maxDec;  
 
magn = Math.pow(10, -dec);  
norm = delta / magn; // norm is between 1.0 and 10.0  
 
if (norm < 1.5)  
size = 1;  
else if (norm < 3) {  
size = 2;  
// special case for 2.5, requires an extra decimal  
if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) {  
size = 2.5;  
++dec;  
}  
}  
else if (norm < 7.5)  
size = 5;  
else  
size = 10;  
 
size *= magn;  
 
if (axisOptions.minTickSize != null && size < axisOptions.minTickSize)  
size = axisOptions.minTickSize;  
 
if (axisOptions.tickSize != null)  
size = axisOptions.tickSize;  
 
axis.tickDecimals = Math.max(0, (maxDec != null) ? maxDec : dec);  
 
generator = function (axis) {  
var ticks = [];  
 
// spew out all possible ticks  
var start = floorInBase(axis.min, axis.tickSize),  
i = 0, v = Number.NaN, prev;  
do {  
prev = v;  
v = start + i * axis.tickSize;  
ticks.push({ v: v, label: axis.tickFormatter(v, axis) });  
++i;  
} while (v < axis.max && v != prev);  
return ticks;  
};  
 
formatter = function (v, axis) {  
return v.toFixed(axis.tickDecimals);  
};  
}  
 
axis.tickSize = unit ? [size, unit] : size;  
axis.tickGenerator = generator;  
if ($.isFunction(axisOptions.tickFormatter))  
axis.tickFormatter = function (v, axis) { return "" + axisOptions.tickFormatter(v, axis); };  
else  
axis.tickFormatter = formatter;  
}  
 
function setTicks(axis, axisOptions) {  
axis.ticks = [];  
 
if (!axis.used)  
return;  
 
if (axisOptions.ticks == null)  
axis.ticks = axis.tickGenerator(axis);  
else if (typeof axisOptions.ticks == "number") {  
if (axisOptions.ticks > 0)  
axis.ticks = axis.tickGenerator(axis);  
}  
else if (axisOptions.ticks) {  
var ticks = axisOptions.ticks;  
 
if ($.isFunction(ticks))  
// generate the ticks  
ticks = ticks({ min: axis.min, max: axis.max });  
 
// clean up the user-supplied ticks, copy them over  
var i, v;  
for (i = 0; i < ticks.length; ++i) {  
var label = null;  
var t = ticks[i];  
if (typeof t == "object") {  
v = t[0];  
if (t.length > 1)  
label = t[1];  
}  
else  
v = t;  
if (label == null)  
label = axis.tickFormatter(v, axis);  
axis.ticks[i] = { v: v, label: label };  
}  
}  
 
if (axisOptions.autoscaleMargin != null && axis.ticks.length > 0) {  
// snap to ticks  
if (axisOptions.min == null)  
axis.min = Math.min(axis.min, axis.ticks[0].v);  
if (axisOptions.max == null && axis.ticks.length > 1)  
axis.max = Math.max(axis.max, axis.ticks[axis.ticks.length - 1].v);  
}  
}  
 
function draw() {  
ctx.clearRect(0, 0, canvasWidth, canvasHeight);  
 
var grid = options.grid;  
 
if (grid.show && !grid.aboveData)  
drawGrid();  
 
for (var i = 0; i < series.length; ++i)  
drawSeries(series[i]);  
 
executeHooks(hooks.draw, [ctx]);  
 
if (grid.show && grid.aboveData)  
drawGrid();  
}  
 
function extractRange(ranges, coord) {  
var firstAxis = coord + "axis",  
secondaryAxis = coord + "2axis",  
axis, from, to, reverse;  
 
if (ranges[firstAxis]) {  
axis = axes[firstAxis];  
from = ranges[firstAxis].from;  
to = ranges[firstAxis].to;  
}  
else if (ranges[secondaryAxis]) {  
axis = axes[secondaryAxis];  
from = ranges[secondaryAxis].from;  
to = ranges[secondaryAxis].to;  
}  
else {  
// backwards-compat stuff - to be removed in future  
axis = axes[firstAxis];  
from = ranges[coord + "1"];  
to = ranges[coord + "2"];  
}  
 
// auto-reverse as an added bonus  
if (from != null && to != null && from > to)  
return { from: to, to: from, axis: axis };  
 
return { from: from, to: to, axis: axis };  
}  
 
function drawGrid() {  
var i;  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
// draw background, if any  
if (options.grid.backgroundColor) {  
ctx.fillStyle = getColorOrGradient(options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)");  
ctx.fillRect(0, 0, plotWidth, plotHeight);  
}  
 
// draw markings  
var markings = options.grid.markings;  
if (markings) {  
if ($.isFunction(markings))  
// xmin etc. are backwards-compatible, to be removed in future  
markings = markings({ xmin: axes.xaxis.min, xmax: axes.xaxis.max, ymin: axes.yaxis.min, ymax: axes.yaxis.max, xaxis: axes.xaxis, yaxis: axes.yaxis, x2axis: axes.x2axis, y2axis: axes.y2axis });  
 
for (i = 0; i < markings.length; ++i) {  
var m = markings[i],  
xrange = extractRange(m, "x"),  
yrange = extractRange(m, "y");  
 
// fill in missing  
if (xrange.from == null)  
xrange.from = xrange.axis.min;  
if (xrange.to == null)  
xrange.to = xrange.axis.max;  
if (yrange.from == null)  
yrange.from = yrange.axis.min;  
if (yrange.to == null)  
yrange.to = yrange.axis.max;  
 
// clip  
if (xrange.to < xrange.axis.min || xrange.from > xrange.axis.max ||  
yrange.to < yrange.axis.min || yrange.from > yrange.axis.max)  
continue;  
 
xrange.from = Math.max(xrange.from, xrange.axis.min);  
xrange.to = Math.min(xrange.to, xrange.axis.max);  
yrange.from = Math.max(yrange.from, yrange.axis.min);  
yrange.to = Math.min(yrange.to, yrange.axis.max);  
 
if (xrange.from == xrange.to && yrange.from == yrange.to)  
continue;  
 
// then draw  
xrange.from = xrange.axis.p2c(xrange.from);  
xrange.to = xrange.axis.p2c(xrange.to);  
yrange.from = yrange.axis.p2c(yrange.from);  
yrange.to = yrange.axis.p2c(yrange.to);  
 
if (xrange.from == xrange.to || yrange.from == yrange.to) {  
// draw line  
ctx.beginPath();  
ctx.strokeStyle = m.color || options.grid.markingsColor;  
ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth;  
//ctx.moveTo(Math.floor(xrange.from), yrange.from);  
//ctx.lineTo(Math.floor(xrange.to), yrange.to);  
ctx.moveTo(xrange.from, yrange.from);  
ctx.lineTo(xrange.to, yrange.to);  
ctx.stroke();  
}  
else {  
// fill area  
ctx.fillStyle = m.color || options.grid.markingsColor;  
ctx.fillRect(xrange.from, yrange.to,  
xrange.to - xrange.from,  
yrange.from - yrange.to);  
}  
}  
}  
 
// draw the inner grid  
ctx.lineWidth = 1;  
ctx.strokeStyle = options.grid.tickColor;  
ctx.beginPath();  
var v, axis = axes.xaxis;  
for (i = 0; i < axis.ticks.length; ++i) {  
v = axis.ticks[i].v;  
if (v <= axis.min || v >= axes.xaxis.max)  
continue; // skip those lying on the axes  
 
ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 0);  
ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, plotHeight);  
}  
 
axis = axes.yaxis;  
for (i = 0; i < axis.ticks.length; ++i) {  
v = axis.ticks[i].v;  
if (v <= axis.min || v >= axis.max)  
continue;  
 
ctx.moveTo(0, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);  
ctx.lineTo(plotWidth, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);  
}  
 
axis = axes.x2axis;  
for (i = 0; i < axis.ticks.length; ++i) {  
v = axis.ticks[i].v;  
if (v <= axis.min || v >= axis.max)  
continue;  
 
ctx.moveTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, -5);  
ctx.lineTo(Math.floor(axis.p2c(v)) + ctx.lineWidth/2, 5);  
}  
 
axis = axes.y2axis;  
for (i = 0; i < axis.ticks.length; ++i) {  
v = axis.ticks[i].v;  
if (v <= axis.min || v >= axis.max)  
continue;  
 
ctx.moveTo(plotWidth-5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);  
ctx.lineTo(plotWidth+5, Math.floor(axis.p2c(v)) + ctx.lineWidth/2);  
}  
 
ctx.stroke();  
 
if (options.grid.borderWidth) {  
// draw border  
var bw = options.grid.borderWidth;  
ctx.lineWidth = bw;  
ctx.strokeStyle = options.grid.borderColor;  
ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw);  
}  
 
ctx.restore();  
}  
 
function insertLabels() {  
placeholder.find(".tickLabels").remove();  
 
var html = ['<div class="tickLabels" style="font-size:smaller;color:' + options.grid.color + '">'];  
 
function addLabels(axis, labelGenerator) {  
for (var i = 0; i < axis.ticks.length; ++i) {  
var tick = axis.ticks[i];  
if (!tick.label || tick.v < axis.min || tick.v > axis.max)  
continue;  
html.push(labelGenerator(tick, axis));  
}  
}  
 
var margin = options.grid.labelMargin + options.grid.borderWidth;  
 
addLabels(axes.xaxis, function (tick, axis) {  
return '<div style="position:absolute;top:' + (plotOffset.top + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";  
});  
 
 
addLabels(axes.yaxis, function (tick, axis) {  
return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;right:' + (plotOffset.right + plotWidth + margin) + 'px;width:' + axis.labelWidth + 'px;text-align:right" class="tickLabel">' + tick.label + "</div>";  
});  
 
addLabels(axes.x2axis, function (tick, axis) {  
return '<div style="position:absolute;bottom:' + (plotOffset.bottom + plotHeight + margin) + 'px;left:' + Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2) + 'px;width:' + axis.labelWidth + 'px;text-align:center" class="tickLabel">' + tick.label + "</div>";  
});  
 
addLabels(axes.y2axis, function (tick, axis) {  
return '<div style="position:absolute;top:' + Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2) + 'px;left:' + (plotOffset.left + plotWidth + margin) +'px;width:' + axis.labelWidth + 'px;text-align:left" class="tickLabel">' + tick.label + "</div>";  
});  
 
html.push('</div>');  
 
placeholder.append(html.join(""));  
}  
 
function drawSeries(series) {  
if (series.lines.show)  
drawSeriesLines(series);  
if (series.bars.show)  
drawSeriesBars(series);  
if (series.points.show)  
drawSeriesPoints(series);  
}  
 
function drawSeriesLines(series) {  
function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {  
var points = datapoints.points,  
ps = datapoints.pointsize,  
prevx = null, prevy = null;  
 
ctx.beginPath();  
for (var i = ps; i < points.length; i += ps) {  
var x1 = points[i - ps], y1 = points[i - ps + 1],  
x2 = points[i], y2 = points[i + 1];  
 
if (x1 == null || x2 == null)  
continue;  
 
// clip with ymin  
if (y1 <= y2 && y1 < axisy.min) {  
if (y2 < axisy.min)  
continue; // line segment is outside  
// compute new intersection point  
x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.min;  
}  
else if (y2 <= y1 && y2 < axisy.min) {  
if (y1 < axisy.min)  
continue;  
x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.min;  
}  
 
// clip with ymax  
if (y1 >= y2 && y1 > axisy.max) {  
if (y2 > axisy.max)  
continue;  
x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.max;  
}  
else if (y2 >= y1 && y2 > axisy.max) {  
if (y1 > axisy.max)  
continue;  
x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.max;  
}  
 
// clip with xmin  
if (x1 <= x2 && x1 < axisx.min) {  
if (x2 < axisx.min)  
continue;  
y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.min;  
}  
else if (x2 <= x1 && x2 < axisx.min) {  
if (x1 < axisx.min)  
continue;  
y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.min;  
}  
 
// clip with xmax  
if (x1 >= x2 && x1 > axisx.max) {  
if (x2 > axisx.max)  
continue;  
y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.max;  
}  
else if (x2 >= x1 && x2 > axisx.max) {  
if (x1 > axisx.max)  
continue;  
y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.max;  
}  
 
if (x1 != prevx || y1 != prevy)  
ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset);  
 
prevx = x2;  
prevy = y2;  
ctx.lineTo(axisx.p2c(x2) + xoffset, axisy.p2c(y2) + yoffset);  
}  
ctx.stroke();  
}  
 
function plotLineArea(datapoints, axisx, axisy) {  
var points = datapoints.points,  
ps = datapoints.pointsize,  
bottom = Math.min(Math.max(0, axisy.min), axisy.max),  
top, lastX = 0, areaOpen = false;  
 
for (var i = ps; i < points.length; i += ps) {  
var x1 = points[i - ps], y1 = points[i - ps + 1],  
x2 = points[i], y2 = points[i + 1];  
 
if (areaOpen && x1 != null && x2 == null) {  
// close area  
ctx.lineTo(axisx.p2c(lastX), axisy.p2c(bottom));  
ctx.fill();  
areaOpen = false;  
continue;  
}  
 
if (x1 == null || x2 == null)  
continue;  
 
// clip x values  
 
// clip with xmin  
if (x1 <= x2 && x1 < axisx.min) {  
if (x2 < axisx.min)  
continue;  
y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.min;  
}  
else if (x2 <= x1 && x2 < axisx.min) {  
if (x1 < axisx.min)  
continue;  
y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.min;  
}  
 
// clip with xmax  
if (x1 >= x2 && x1 > axisx.max) {  
if (x2 > axisx.max)  
continue;  
y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.max;  
}  
else if (x2 >= x1 && x2 > axisx.max) {  
if (x1 > axisx.max)  
continue;  
y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.max;  
}  
 
if (!areaOpen) {  
// open area  
ctx.beginPath();  
ctx.moveTo(axisx.p2c(x1), axisy.p2c(bottom));  
areaOpen = true;  
}  
 
// now first check the case where both is outside  
if (y1 >= axisy.max && y2 >= axisy.max) {  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.max));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.max));  
lastX = x2;  
continue;  
}  
else if (y1 <= axisy.min && y2 <= axisy.min) {  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.min));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.min));  
lastX = x2;  
continue;  
}  
 
// else it's a bit more complicated, there might  
// be two rectangles and two triangles we need to fill  
// in; to find these keep track of the current x values  
var x1old = x1, x2old = x2;  
 
// and clip the y values, without shortcutting  
 
// clip with ymin  
if (y1 <= y2 && y1 < axisy.min && y2 >= axisy.min) {  
x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.min;  
}  
else if (y2 <= y1 && y2 < axisy.min && y1 >= axisy.min) {  
x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.min;  
}  
 
// clip with ymax  
if (y1 >= y2 && y1 > axisy.max && y2 <= axisy.max) {  
x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.max;  
}  
else if (y2 >= y1 && y2 > axisy.max && y1 <= axisy.max) {  
x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.max;  
}  
 
 
// if the x value was changed we got a rectangle  
// to fill  
if (x1 != x1old) {  
if (y1 <= axisy.min)  
top = axisy.min;  
else  
top = axisy.max;  
 
ctx.lineTo(axisx.p2c(x1old), axisy.p2c(top));  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(top));  
}  
 
// fill the triangles  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(y1));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));  
 
// fill the other rectangle if it's there  
if (x2 != x2old) {  
if (y2 <= axisy.min)  
top = axisy.min;  
else  
top = axisy.max;  
 
ctx.lineTo(axisx.p2c(x2), axisy.p2c(top));  
ctx.lineTo(axisx.p2c(x2old), axisy.p2c(top));  
}  
 
lastX = Math.max(x2, x2old);  
}  
 
if (areaOpen) {  
ctx.lineTo(axisx.p2c(lastX), axisy.p2c(bottom));  
ctx.fill();  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
ctx.lineJoin = "round";  
 
var lw = series.lines.lineWidth,  
sw = series.shadowSize;  
// FIXME: consider another form of shadow when filling is turned on  
if (lw > 0 && sw > 0) {  
// draw shadow as a thick and thin line with transparency  
ctx.lineWidth = sw;  
ctx.strokeStyle = "rgba(0,0,0,0.1)";  
// position shadow at angle from the mid of line  
var angle = Math.PI/18;  
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/2), Math.cos(angle) * (lw/2 + sw/2), series.xaxis, series.yaxis);  
ctx.lineWidth = sw/2;  
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4), series.xaxis, series.yaxis);  
}  
 
ctx.lineWidth = lw;  
ctx.strokeStyle = series.color;  
var fillStyle = getFillStyle(series.lines, series.color, 0, plotHeight);  
if (fillStyle) {  
ctx.fillStyle = fillStyle;  
plotLineArea(series.datapoints, series.xaxis, series.yaxis);  
}  
 
if (lw > 0)  
plotLine(series.datapoints, 0, 0, series.xaxis, series.yaxis);  
ctx.restore();  
}  
 
function drawSeriesPoints(series) {  
function plotPoints(datapoints, radius, fillStyle, offset, circumference, axisx, axisy) {  
var points = datapoints.points, ps = datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
var x = points[i], y = points[i + 1];  
if (x == null || x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)  
continue;  
 
ctx.beginPath();  
ctx.arc(axisx.p2c(x), axisy.p2c(y) + offset, radius, 0, circumference, false);  
if (fillStyle) {  
ctx.fillStyle = fillStyle;  
ctx.fill();  
}  
ctx.stroke();  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
var lw = series.lines.lineWidth,  
sw = series.shadowSize,  
radius = series.points.radius;  
if (lw > 0 && sw > 0) {  
// draw shadow in two steps  
var w = sw / 2;  
ctx.lineWidth = w;  
ctx.strokeStyle = "rgba(0,0,0,0.1)";  
plotPoints(series.datapoints, radius, null, w + w/2, Math.PI,  
series.xaxis, series.yaxis);  
 
ctx.strokeStyle = "rgba(0,0,0,0.2)";  
plotPoints(series.datapoints, radius, null, w/2, Math.PI,  
series.xaxis, series.yaxis);  
}  
 
ctx.lineWidth = lw;  
ctx.strokeStyle = series.color;  
plotPoints(series.datapoints, radius,  
getFillStyle(series.points, series.color), 0, 2 * Math.PI,  
series.xaxis, series.yaxis);  
ctx.restore();  
}  
 
function drawBar(x, y, b, barLeft, barRight, offset, fillStyleCallback, axisx, axisy, c, horizontal) {  
var left, right, bottom, top,  
drawLeft, drawRight, drawTop, drawBottom,  
tmp;  
 
if (horizontal) {  
drawBottom = drawRight = drawTop = true;  
drawLeft = false;  
left = b;  
right = x;  
top = y + barLeft;  
bottom = y + barRight;  
 
// account for negative bars  
if (right < left) {  
tmp = right;  
right = left;  
left = tmp;  
drawLeft = true;  
drawRight = false;  
}  
}  
else {  
drawLeft = drawRight = drawTop = true;  
drawBottom = false;  
left = x + barLeft;  
right = x + barRight;  
bottom = b;  
top = y;  
 
// account for negative bars  
if (top < bottom) {  
tmp = top;  
top = bottom;  
bottom = tmp;  
drawBottom = true;  
drawTop = false;  
}  
}  
 
// clip  
if (right < axisx.min || left > axisx.max ||  
top < axisy.min || bottom > axisy.max)  
return;  
 
if (left < axisx.min) {  
left = axisx.min;  
drawLeft = false;  
}  
 
if (right > axisx.max) {  
right = axisx.max;  
drawRight = false;  
}  
 
if (bottom < axisy.min) {  
bottom = axisy.min;  
drawBottom = false;  
}  
 
if (top > axisy.max) {  
top = axisy.max;  
drawTop = false;  
}  
 
left = axisx.p2c(left);  
bottom = axisy.p2c(bottom);  
right = axisx.p2c(right);  
top = axisy.p2c(top);  
 
// fill the bar  
if (fillStyleCallback) {  
c.beginPath();  
c.moveTo(left, bottom);  
c.lineTo(left, top);  
c.lineTo(right, top);  
c.lineTo(right, bottom);  
c.fillStyle = fillStyleCallback(bottom, top);  
c.fill();  
}  
 
// draw outline  
if (drawLeft || drawRight || drawTop || drawBottom) {  
c.beginPath();  
 
// FIXME: inline moveTo is buggy with excanvas  
c.moveTo(left, bottom + offset);  
if (drawLeft)  
c.lineTo(left, top + offset);  
else  
c.moveTo(left, top + offset);  
if (drawTop)  
c.lineTo(right, top + offset);  
else  
c.moveTo(right, top + offset);  
if (drawRight)  
c.lineTo(right, bottom + offset);  
else  
c.moveTo(right, bottom + offset);  
if (drawBottom)  
c.lineTo(left, bottom + offset);  
else  
c.moveTo(left, bottom + offset);  
c.stroke();  
}  
}  
 
function drawSeriesBars(series) {  
function plotBars(datapoints, barLeft, barRight, offset, fillStyleCallback, axisx, axisy) {  
var points = datapoints.points, ps = datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
if (points[i] == null)  
continue;  
drawBar(points[i], points[i + 1], points[i + 2], barLeft, barRight, offset, fillStyleCallback, axisx, axisy, ctx, series.bars.horizontal);  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
// FIXME: figure out a way to add shadows (for instance along the right edge)  
ctx.lineWidth = series.bars.lineWidth;  
ctx.strokeStyle = series.color;  
var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;  
var fillStyleCallback = series.bars.fill ? function (bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;  
plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth, 0, fillStyleCallback, series.xaxis, series.yaxis);  
ctx.restore();  
}  
 
function getFillStyle(filloptions, seriesColor, bottom, top) {  
var fill = filloptions.fill;  
if (!fill)  
return null;  
 
if (filloptions.fillColor)  
return getColorOrGradient(filloptions.fillColor, bottom, top, seriesColor);  
 
var c = $.color.parse(seriesColor);  
c.a = typeof fill == "number" ? fill : 0.4;  
c.normalize();  
return c.toString();  
}  
 
function insertLegend() {  
placeholder.find(".legend").remove();  
 
if (!options.legend.show)  
return;  
 
var fragments = [], rowStarted = false,  
lf = options.legend.labelFormatter, s, label;  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
label = s.label;  
if (!label)  
continue;  
 
if (i % options.legend.noColumns == 0) {  
if (rowStarted)  
fragments.push('</tr>');  
fragments.push('<tr>');  
rowStarted = true;  
}  
 
if (lf)  
label = lf(label, s);  
 
fragments.push(  
'<td class="legendColorBox"><div style="border:1px solid ' + options.legend.labelBoxBorderColor + ';padding:1px"><div style="width:4px;height:0;border:5px solid ' + s.color + ';overflow:hidden"></div></div></td>' +  
'<td class="legendLabel">' + label + '</td>');  
}  
if (rowStarted)  
fragments.push('</tr>');  
 
if (fragments.length == 0)  
return;  
 
var table = '<table style="font-size:smaller;color:' + options.grid.color + '">' + fragments.join("") + '</table>';  
if (options.legend.container != null)  
$(options.legend.container).html(table);  
else {  
var pos = "",  
p = options.legend.position,  
m = options.legend.margin;  
if (m[0] == null)  
m = [m, m];  
if (p.charAt(0) == "n")  
pos += 'top:' + (m[1] + plotOffset.top) + 'px;';  
else if (p.charAt(0) == "s")  
pos += 'bottom:' + (m[1] + plotOffset.bottom) + 'px;';  
if (p.charAt(1) == "e")  
pos += 'right:' + (m[0] + plotOffset.right) + 'px;';  
else if (p.charAt(1) == "w")  
pos += 'left:' + (m[0] + plotOffset.left) + 'px;';  
var legend = $('<div class="legend">' + table.replace('style="', 'style="position:absolute;' + pos +';') + '</div>').appendTo(placeholder);  
if (options.legend.backgroundOpacity != 0.0) {  
// put in the transparent background  
// separately to avoid blended labels and  
// label boxes  
var c = options.legend.backgroundColor;  
if (c == null) {  
c = options.grid.backgroundColor;  
if (c && typeof c == "string")  
c = $.color.parse(c);  
else  
c = $.color.extract(legend, 'background-color');  
c.a = 1;  
c = c.toString();  
}  
var div = legend.children();  
$('<div style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);  
}  
}  
}  
 
 
// interactive features  
 
var highlights = [],  
redrawTimeout = null;  
 
// returns the data item the mouse is over, or null if none is found  
function findNearbyItem(mouseX, mouseY, seriesFilter) {  
var maxDistance = options.grid.mouseActiveRadius,  
smallestDistance = maxDistance * maxDistance + 1,  
item = null, foundPoint = false, i, j;  
 
for (i = 0; i < series.length; ++i) {  
if (!seriesFilter(series[i]))  
continue;  
 
var s = series[i],  
axisx = s.xaxis,  
axisy = s.yaxis,  
points = s.datapoints.points,  
ps = s.datapoints.pointsize,  
mx = axisx.c2p(mouseX), // precompute some stuff to make the loop faster  
my = axisy.c2p(mouseY),  
maxx = maxDistance / axisx.scale,  
maxy = maxDistance / axisy.scale;  
 
if (s.lines.show || s.points.show) {  
for (j = 0; j < points.length; j += ps) {  
var x = points[j], y = points[j + 1];  
if (x == null)  
continue;  
 
// For points and lines, the cursor must be within a  
// certain distance to the data point  
if (x - mx > maxx || x - mx < -maxx ||  
y - my > maxy || y - my < -maxy)  
continue;  
 
// We have to calculate distances in pixels, not in  
// data units, because the scales of the axes may be different  
var dx = Math.abs(axisx.p2c(x) - mouseX),  
dy = Math.abs(axisy.p2c(y) - mouseY),  
dist = dx * dx + dy * dy; // we save the sqrt  
 
// use <= to ensure last point takes precedence  
// (last generally means on top of)  
if (dist <= smallestDistance) {  
smallestDistance = dist;  
item = [i, j / ps];  
}  
}  
}  
 
if (s.bars.show && !item) { // no other point can be nearby  
var barLeft = s.bars.align == "left" ? 0 : -s.bars.barWidth/2,  
barRight = barLeft + s.bars.barWidth;  
 
for (j = 0; j < points.length; j += ps) {  
var x = points[j], y = points[j + 1], b = points[j + 2];  
if (x == null)  
continue;  
 
// for a bar graph, the cursor must be inside the bar  
if (series[i].bars.horizontal ?  
(mx <= Math.max(b, x) && mx >= Math.min(b, x) &&  
my >= y + barLeft && my <= y + barRight) :  
(mx >= x + barLeft && mx <= x + barRight &&  
my >= Math.min(b, y) && my <= Math.max(b, y)))  
item = [i, j / ps];  
}  
}  
}  
 
if (item) {  
i = item[0];  
j = item[1];  
ps = series[i].datapoints.pointsize;  
 
return { datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),  
dataIndex: j,  
series: series[i],  
seriesIndex: i };  
}  
 
return null;  
}  
 
function onMouseMove(e) {  
if (options.grid.hoverable)  
triggerClickHoverEvent("plothover", e,  
function (s) { return s["hoverable"] != false; });  
}  
 
function onClick(e) {  
triggerClickHoverEvent("plotclick", e,  
function (s) { return s["clickable"] != false; });  
}  
 
// trigger click or hover event (they send the same parameters  
// so we share their code)  
function triggerClickHoverEvent(eventname, event, seriesFilter) {  
var offset = eventHolder.offset(),  
pos = { pageX: event.pageX, pageY: event.pageY },  
canvasX = event.pageX - offset.left - plotOffset.left,  
canvasY = event.pageY - offset.top - plotOffset.top;  
 
if (axes.xaxis.used)  
pos.x = axes.xaxis.c2p(canvasX);  
if (axes.yaxis.used)  
pos.y = axes.yaxis.c2p(canvasY);  
if (axes.x2axis.used)  
pos.x2 = axes.x2axis.c2p(canvasX);  
if (axes.y2axis.used)  
pos.y2 = axes.y2axis.c2p(canvasY);  
 
var item = findNearbyItem(canvasX, canvasY, seriesFilter);  
 
if (item) {  
// fill in mouse pos for any listeners out there  
item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left);  
item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top + plotOffset.top);  
}  
 
if (options.grid.autoHighlight) {  
// clear auto-highlights  
for (var i = 0; i < highlights.length; ++i) {  
var h = highlights[i];  
if (h.auto == eventname &&  
!(item && h.series == item.series && h.point == item.datapoint))  
unhighlight(h.series, h.point);  
}  
 
if (item)  
highlight(item.series, item.datapoint, eventname);  
}  
 
placeholder.trigger(eventname, [ pos, item ]);  
}  
 
function triggerRedrawOverlay() {  
if (!redrawTimeout)  
redrawTimeout = setTimeout(drawOverlay, 30);  
}  
 
function drawOverlay() {  
redrawTimeout = null;  
 
// draw highlights  
octx.save();  
octx.clearRect(0, 0, canvasWidth, canvasHeight);  
octx.translate(plotOffset.left, plotOffset.top);  
 
var i, hi;  
for (i = 0; i < highlights.length; ++i) {  
hi = highlights[i];  
 
if (hi.series.bars.show)  
drawBarHighlight(hi.series, hi.point);  
else  
drawPointHighlight(hi.series, hi.point);  
}  
octx.restore();  
 
executeHooks(hooks.drawOverlay, [octx]);  
}  
 
function highlight(s, point, auto) {  
if (typeof s == "number")  
s = series[s];  
 
if (typeof point == "number")  
point = s.data[point];  
 
var i = indexOfHighlight(s, point);  
if (i == -1) {  
highlights.push({ series: s, point: point, auto: auto });  
 
triggerRedrawOverlay();  
}  
else if (!auto)  
highlights[i].auto = false;  
}  
 
function unhighlight(s, point) {  
if (s == null && point == null) {  
highlights = [];  
triggerRedrawOverlay();  
}  
 
if (typeof s == "number")  
s = series[s];  
 
if (typeof point == "number")  
point = s.data[point];  
 
var i = indexOfHighlight(s, point);  
if (i != -1) {  
highlights.splice(i, 1);  
 
triggerRedrawOverlay();  
}  
}  
 
function indexOfHighlight(s, p) {  
for (var i = 0; i < highlights.length; ++i) {  
var h = highlights[i];  
if (h.series == s && h.point[0] == p[0]  
&& h.point[1] == p[1])  
return i;  
}  
return -1;  
}  
 
function drawPointHighlight(series, point) {  
var x = point[0], y = point[1],  
axisx = series.xaxis, axisy = series.yaxis;  
 
if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)  
return;  
 
var pointRadius = series.points.radius + series.points.lineWidth / 2;  
octx.lineWidth = pointRadius;  
octx.strokeStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var radius = 1.5 * pointRadius;  
octx.beginPath();  
octx.arc(axisx.p2c(x), axisy.p2c(y), radius, 0, 2 * Math.PI, false);  
octx.stroke();  
}  
 
function drawBarHighlight(series, point) {  
octx.lineWidth = series.bars.lineWidth;  
octx.strokeStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var fillStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;  
drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,  
0, function () { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal);  
}  
 
function getColorOrGradient(spec, bottom, top, defaultColor) {  
if (typeof spec == "string")  
return spec;  
else {  
// assume this is a gradient spec; IE currently only  
// supports a simple vertical gradient properly, so that's  
// what we support too  
var gradient = ctx.createLinearGradient(0, top, 0, bottom);  
 
for (var i = 0, l = spec.colors.length; i < l; ++i) {  
var c = spec.colors[i];  
if (typeof c != "string") {  
c = $.color.parse(defaultColor).scale('rgb', c.brightness);  
c.a *= c.opacity;  
c = c.toString();  
}  
gradient.addColorStop(i / (l - 1), c);  
}  
 
return gradient;  
}  
}  
}  
 
$.plot = function(placeholder, data, options) {  
var plot = new Plot($(placeholder), data, options, $.plot.plugins);  
/*var t0 = new Date();  
var t1 = new Date();  
var tstr = "time used (msecs): " + (t1.getTime() - t0.getTime())  
if (window.console)  
console.log(tstr);  
else  
alert(tstr);*/  
return plot;  
};  
 
$.plot.plugins = [];  
 
// returns a string with the date d formatted according to fmt  
$.plot.formatDate = function(d, fmt, monthNames) {  
var leftPad = function(n) {  
n = "" + n;  
return n.length == 1 ? "0" + n : n;  
};  
 
var r = [];  
var escape = false;  
var hours = d.getUTCHours();  
var isAM = hours < 12;  
if (monthNames == null)  
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];  
 
if (fmt.search(/%p|%P/) != -1) {  
if (hours > 12) {  
hours = hours - 12;  
} else if (hours == 0) {  
hours = 12;  
}  
}  
for (var i = 0; i < fmt.length; ++i) {  
var c = fmt.charAt(i);  
 
if (escape) {  
switch (c) {  
case 'h': c = "" + hours; break;  
case 'H': c = leftPad(hours); break;  
case 'M': c = leftPad(d.getUTCMinutes()); break;  
case 'S': c = leftPad(d.getUTCSeconds()); break;  
case 'd': c = "" + d.getUTCDate(); break;  
case 'm': c = "" + (d.getUTCMonth() + 1); break;  
case 'y': c = "" + d.getUTCFullYear(); break;  
case 'b': c = "" + monthNames[d.getUTCMonth()]; break;  
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;  
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;  
}  
r.push(c);  
escape = false;  
}  
else {  
if (c == "%")  
escape = true;  
else  
r.push(c);  
}  
}  
return r.join("");  
};  
 
// round to nearby lower multiple of base  
function floorInBase(n, base) {  
return base * Math.floor(n / base);  
}  
 
})(jQuery);  
 
(function(){jQuery.color={};jQuery.color.make=function(G,H,J,I){var A={};A.r=G||0;A.g=H||0;A.b=J||0;A.a=I!=null?I:1;A.add=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]+=D}return A.normalize()};A.scale=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]*=D}return A.normalize()};A.toString=function(){if(A.a>=1){return"rgb("+[A.r,A.g,A.b].join(",")+")"}else{return"rgba("+[A.r,A.g,A.b,A.a].join(",")+")"}};A.normalize=function(){function C(E,D,F){return D<E?E:(D>F?F:D)}A.r=C(0,parseInt(A.r),255);A.g=C(0,parseInt(A.g),255);A.b=C(0,parseInt(A.b),255);A.a=C(0,A.a,1);return A};A.clone=function(){return jQuery.color.make(A.r,A.b,A.g,A.a)};return A.normalize()};jQuery.color.extract=function(E,F){var A;do{A=E.css(F).toLowerCase();if(A!=""&&A!="transparent"){break}E=E.parent()}while(!jQuery.nodeName(E.get(0),"body"));if(A=="rgba(0, 0, 0, 0)"){A="transparent"}return jQuery.color.parse(A)};jQuery.color.parse=function(A){var F,H=jQuery.color.make;if(F=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10))}if(F=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10),parseFloat(F[4]))}if(F=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55)}if(F=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55,parseFloat(F[4]))}if(F=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(A)){return H(parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16))}if(F=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(A)){return H(parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16))}var G=jQuery.trim(A).toLowerCase();if(G=="transparent"){return H(255,255,255,0)}else{F=B[G];return H(F[0],F[1],F[2])}};var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();(function(C){function B(l,W,X,E){var O=[],g={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02},x2axis:{autoscaleMargin:null},y2axis:{autoscaleMargin:0.02},series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454",backgroundColor:null,tickColor:"rgba(0,0,0,0.15)",labelMargin:5,borderWidth:2,borderColor:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},P=null,AC=null,AD=null,Y=null,AJ=null,s={xaxis:{},yaxis:{},x2axis:{},y2axis:{}},e={left:0,right:0,top:0,bottom:0},y=0,Q=0,I=0,t=0,L={processOptions:[],processRawData:[],processDatapoints:[],draw:[],bindEvents:[],drawOverlay:[]},G=this;G.setData=f;G.setupGrid=k;G.draw=AH;G.getPlaceholder=function(){return l};G.getCanvas=function(){return P};G.getPlotOffset=function(){return e};G.width=function(){return I};G.height=function(){return t};G.offset=function(){var AK=AD.offset();AK.left+=e.left;AK.top+=e.top;return AK};G.getData=function(){return O};G.getAxes=function(){return s};G.getOptions=function(){return g};G.highlight=AE;G.unhighlight=x;G.triggerRedrawOverlay=q;G.pointOffset=function(AK){return{left:parseInt(T(AK,"xaxis").p2c(+AK.x)+e.left),top:parseInt(T(AK,"yaxis").p2c(+AK.y)+e.top)}};G.hooks=L;b(G);r(X);c();f(W);k();AH();AG();function Z(AM,AK){AK=[G].concat(AK);for(var AL=0;AL<AM.length;++AL){AM[AL].apply(this,AK)}}function b(){for(var AK=0;AK<E.length;++AK){var AL=E[AK];AL.init(G);if(AL.options){C.extend(true,g,AL.options)}}}function r(AK){C.extend(true,g,AK);if(g.grid.borderColor==null){g.grid.borderColor=g.grid.color}if(g.xaxis.noTicks&&g.xaxis.ticks==null){g.xaxis.ticks=g.xaxis.noTicks}if(g.yaxis.noTicks&&g.yaxis.ticks==null){g.yaxis.ticks=g.yaxis.noTicks}if(g.grid.coloredAreas){g.grid.markings=g.grid.coloredAreas}if(g.grid.coloredAreasColor){g.grid.markingsColor=g.grid.coloredAreasColor}if(g.lines){C.extend(true,g.series.lines,g.lines)}if(g.points){C.extend(true,g.series.points,g.points)}if(g.bars){C.extend(true,g.series.bars,g.bars)}if(g.shadowSize){g.series.shadowSize=g.shadowSize}for(var AL in L){if(g.hooks[AL]&&g.hooks[AL].length){L[AL]=L[AL].concat(g.hooks[AL])}}Z(L.processOptions,[g])}function f(AK){O=M(AK);U();m()}function M(AN){var AL=[];for(var AK=0;AK<AN.length;++AK){var AM=C.extend(true,{},g.series);if(AN[AK].data){AM.data=AN[AK].data;delete AN[AK].data;C.extend(true,AM,AN[AK]);AN[AK].data=AM.data}else{AM.data=AN[AK]}AL.push(AM)}return AL}function T(AM,AK){var AL=AM[AK];if(!AL||AL==1){return s[AK]}if(typeof AL=="number"){return s[AK.charAt(0)+AL+AK.slice(1)]}return AL}function U(){var AP;var AV=O.length,AK=[],AN=[];for(AP=0;AP<O.length;++AP){var AS=O[AP].color;if(AS!=null){--AV;if(typeof AS=="number"){AN.push(AS)}else{AK.push(C.color.parse(O[AP].color))}}}for(AP=0;AP<AN.length;++AP){AV=Math.max(AV,AN[AP]+1)}var AL=[],AO=0;AP=0;while(AL.length<AV){var AR;if(g.colors.length==AP){AR=C.color.make(100,100,100)}else{AR=C.color.parse(g.colors[AP])}var AM=AO%2==1?-1:1;AR.scale("rgb",1+AM*Math.ceil(AO/2)*0.2);AL.push(AR);++AP;if(AP>=g.colors.length){AP=0;++AO}}var AQ=0,AW;for(AP=0;AP<O.length;++AP){AW=O[AP];if(AW.color==null){AW.color=AL[AQ].toString();++AQ}else{if(typeof AW.color=="number"){AW.color=AL[AW.color].toString()}}if(AW.lines.show==null){var AU,AT=true;for(AU in AW){if(AW[AU].show){AT=false;break}}if(AT){AW.lines.show=true}}AW.xaxis=T(AW,"xaxis");AW.yaxis=T(AW,"yaxis")}}function m(){var AW=Number.POSITIVE_INFINITY,AQ=Number.NEGATIVE_INFINITY,Ac,Aa,AZ,AV,AL,AR,Ab,AX,AP,AO,AK,Ai,Af,AT;for(AK in s){s[AK].datamin=AW;s[AK].datamax=AQ;s[AK].used=false}function AN(Al,Ak,Aj){if(Ak<Al.datamin){Al.datamin=Ak}if(Aj>Al.datamax){Al.datamax=Aj}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];AR.datapoints={points:[]};Z(L.processRawData,[AR,AR.data,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];var Ah=AR.data,Ae=AR.datapoints.format;if(!Ae){Ae=[];Ae.push({x:true,number:true,required:true});Ae.push({y:true,number:true,required:true});if(AR.bars.show){Ae.push({y:true,number:true,required:false,defaultValue:0})}AR.datapoints.format=Ae}if(AR.datapoints.pointsize!=null){continue}if(AR.datapoints.pointsize==null){AR.datapoints.pointsize=Ae.length}AX=AR.datapoints.pointsize;Ab=AR.datapoints.points;insertSteps=AR.lines.show&&AR.lines.steps;AR.xaxis.used=AR.yaxis.used=true;for(Aa=AZ=0;Aa<Ah.length;++Aa,AZ+=AX){AT=Ah[Aa];var AM=AT==null;if(!AM){for(AV=0;AV<AX;++AV){Ai=AT[AV];Af=Ae[AV];if(Af){if(Af.number&&Ai!=null){Ai=+Ai;if(isNaN(Ai)){Ai=null}}if(Ai==null){if(Af.required){AM=true}if(Af.defaultValue!=null){Ai=Af.defaultValue}}}Ab[AZ+AV]=Ai}}if(AM){for(AV=0;AV<AX;++AV){Ai=Ab[AZ+AV];if(Ai!=null){Af=Ae[AV];if(Af.x){AN(AR.xaxis,Ai,Ai)}if(Af.y){AN(AR.yaxis,Ai,Ai)}}Ab[AZ+AV]=null}}else{if(insertSteps&&AZ>0&&Ab[AZ-AX]!=null&&Ab[AZ-AX]!=Ab[AZ]&&Ab[AZ-AX+1]!=Ab[AZ+1]){for(AV=0;AV<AX;++AV){Ab[AZ+AX+AV]=Ab[AZ+AV]}Ab[AZ+1]=Ab[AZ-AX+1];AZ+=AX}}}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Z(L.processDatapoints,[AR,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Ab=AR.datapoints.points,AX=AR.datapoints.pointsize;var AS=AW,AY=AW,AU=AQ,Ad=AQ;for(Aa=0;Aa<Ab.length;Aa+=AX){if(Ab[Aa]==null){continue}for(AV=0;AV<AX;++AV){Ai=Ab[Aa+AV];Af=Ae[AV];if(!Af){continue}if(Af.x){if(Ai<AS){AS=Ai}if(Ai>AU){AU=Ai}}if(Af.y){if(Ai<AY){AY=Ai}if(Ai>Ad){Ad=Ai}}}}if(AR.bars.show){var Ag=AR.bars.align=="left"?0:-AR.bars.barWidth/2;if(AR.bars.horizontal){AY+=Ag;Ad+=Ag+AR.bars.barWidth}else{AS+=Ag;AU+=Ag+AR.bars.barWidth}}AN(AR.xaxis,AS,AU);AN(AR.yaxis,AY,Ad)}for(AK in s){if(s[AK].datamin==AW){s[AK].datamin=null}if(s[AK].datamax==AQ){s[AK].datamax=null}}}function c(){function AK(AM,AL){var AN=document.createElement("canvas");AN.width=AM;AN.height=AL;if(C.browser.msie){AN=window.G_vmlCanvasManager.initElement(AN)}return AN}y=l.width();Q=l.height();l.html("");if(l.css("position")=="static"){l.css("position","relative")}if(y<=0||Q<=0){throw"Invalid dimensions for plot, width = "+y+", height = "+Q}if(C.browser.msie){window.G_vmlCanvasManager.init_(document)}P=C(AK(y,Q)).appendTo(l).get(0);Y=P.getContext("2d");AC=C(AK(y,Q)).css({position:"absolute",left:0,top:0}).appendTo(l).get(0);AJ=AC.getContext("2d");AJ.stroke()}function AG(){AD=C([AC,P]);if(g.grid.hoverable){AD.mousemove(D)}if(g.grid.clickable){AD.click(d)}Z(L.bindEvents,[AD])}function k(){function AL(AT,AU){function AP(AV){return AV}var AS,AO,AQ=AU.transform||AP,AR=AU.inverseTransform;if(AT==s.xaxis||AT==s.x2axis){AS=AT.scale=I/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.min);if(AQ==AP){AT.p2c=function(AV){return(AV-AO)*AS}}else{AT.p2c=function(AV){return(AQ(AV)-AO)*AS}}if(!AR){AT.c2p=function(AV){return AO+AV/AS}}else{AT.c2p=function(AV){return AR(AO+AV/AS)}}}else{AS=AT.scale=t/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.max);if(AQ==AP){AT.p2c=function(AV){return(AO-AV)*AS}}else{AT.p2c=function(AV){return(AO-AQ(AV))*AS}}if(!AR){AT.c2p=function(AV){return AO-AV/AS}}else{AT.c2p=function(AV){return AR(AO-AV/AS)}}}}function AN(AR,AT){var AQ,AS=[],AP;AR.labelWidth=AT.labelWidth;AR.labelHeight=AT.labelHeight;if(AR==s.xaxis||AR==s.x2axis){if(AR.labelWidth==null){AR.labelWidth=y/(AR.ticks.length>0?AR.ticks.length:1)}if(AR.labelHeight==null){AS=[];for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel" style="float:left;width:'+AR.labelWidth+'px">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'+AS.join("")+'<div style="clear:left"></div></div>').appendTo(l);AR.labelHeight=AO.height();AO.remove()}}}else{if(AR.labelWidth==null||AR.labelHeight==null){for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;font-size:smaller">'+AS.join("")+"</div>").appendTo(l);if(AR.labelWidth==null){AR.labelWidth=AO.width()}if(AR.labelHeight==null){AR.labelHeight=AO.find("div").height()}AO.remove()}}}if(AR.labelWidth==null){AR.labelWidth=0}if(AR.labelHeight==null){AR.labelHeight=0}}function AM(){var AP=g.grid.borderWidth;for(i=0;i<O.length;++i){AP=Math.max(AP,2*(O[i].points.radius+O[i].points.lineWidth/2))}e.left=e.right=e.top=e.bottom=AP;var AO=g.grid.labelMargin+g.grid.borderWidth;if(s.xaxis.labelHeight>0){e.bottom=Math.max(AP,s.xaxis.labelHeight+AO)}if(s.yaxis.labelWidth>0){e.left=Math.max(AP,s.yaxis.labelWidth+AO)}if(s.x2axis.labelHeight>0){e.top=Math.max(AP,s.x2axis.labelHeight+AO)}if(s.y2axis.labelWidth>0){e.right=Math.max(AP,s.y2axis.labelWidth+AO)}I=y-e.left-e.right;t=Q-e.bottom-e.top}var AK;for(AK in s){K(s[AK],g[AK])}if(g.grid.show){for(AK in s){F(s[AK],g[AK]);p(s[AK],g[AK]);AN(s[AK],g[AK])}AM()}else{e.left=e.right=e.top=e.bottom=0;I=y;t=Q}for(AK in s){AL(s[AK],g[AK])}if(g.grid.show){h()}AI()}function K(AN,AQ){var AM=+(AQ.min!=null?AQ.min:AN.datamin),AK=+(AQ.max!=null?AQ.max:AN.datamax),AP=AK-AM;if(AP==0){var AL=AK==0?1:0.01;if(AQ.min==null){AM-=AL}if(AQ.max==null||AQ.min!=null){AK+=AL}}else{var AO=AQ.autoscaleMargin;if(AO!=null){if(AQ.min==null){AM-=AP*AO;if(AM<0&&AN.datamin!=null&&AN.datamin>=0){AM=0}}if(AQ.max==null){AK+=AP*AO;if(AK>0&&AN.datamax!=null&&AN.datamax<=0){AK=0}}}}AN.min=AM;AN.max=AK}function F(AP,AS){var AO;if(typeof AS.ticks=="number"&&AS.ticks>0){AO=AS.ticks}else{if(AP==s.xaxis||AP==s.x2axis){AO=0.3*Math.sqrt(y)}else{AO=0.3*Math.sqrt(Q)}}var AX=(AP.max-AP.min)/AO,AZ,AT,AV,AW,AR,AM,AL;if(AS.mode=="time"){var AU={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var AY=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var AN=0;if(AS.minTickSize!=null){if(typeof AS.tickSize=="number"){AN=AS.tickSize}else{AN=AS.minTickSize[0]*AU[AS.minTickSize[1]]}}for(AR=0;AR<AY.length-1;++AR){if(AX<(AY[AR][0]*AU[AY[AR][1]]+AY[AR+1][0]*AU[AY[AR+1][1]])/2&&AY[AR][0]*AU[AY[AR][1]]>=AN){break}}AZ=AY[AR][0];AV=AY[AR][1];if(AV=="year"){AM=Math.pow(10,Math.floor(Math.log(AX/AU.year)/Math.LN10));AL=(AX/AU.year)/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM}if(AS.tickSize){AZ=AS.tickSize[0];AV=AS.tickSize[1]}AT=function(Ac){var Ah=[],Af=Ac.tickSize[0],Ai=Ac.tickSize[1],Ag=new Date(Ac.min);var Ab=Af*AU[Ai];if(Ai=="second"){Ag.setUTCSeconds(A(Ag.getUTCSeconds(),Af))}if(Ai=="minute"){Ag.setUTCMinutes(A(Ag.getUTCMinutes(),Af))}if(Ai=="hour"){Ag.setUTCHours(A(Ag.getUTCHours(),Af))}if(Ai=="month"){Ag.setUTCMonth(A(Ag.getUTCMonth(),Af))}if(Ai=="year"){Ag.setUTCFullYear(A(Ag.getUTCFullYear(),Af))}Ag.setUTCMilliseconds(0);if(Ab>=AU.minute){Ag.setUTCSeconds(0)}if(Ab>=AU.hour){Ag.setUTCMinutes(0)}if(Ab>=AU.day){Ag.setUTCHours(0)}if(Ab>=AU.day*4){Ag.setUTCDate(1)}if(Ab>=AU.year){Ag.setUTCMonth(0)}var Ak=0,Aj=Number.NaN,Ad;do{Ad=Aj;Aj=Ag.getTime();Ah.push({v:Aj,label:Ac.tickFormatter(Aj,Ac)});if(Ai=="month"){if(Af<1){Ag.setUTCDate(1);var Aa=Ag.getTime();Ag.setUTCMonth(Ag.getUTCMonth()+1);var Ae=Ag.getTime();Ag.setTime(Aj+Ak*AU.hour+(Ae-Aa)*Af);Ak=Ag.getUTCHours();Ag.setUTCHours(0)}else{Ag.setUTCMonth(Ag.getUTCMonth()+Af)}}else{if(Ai=="year"){Ag.setUTCFullYear(Ag.getUTCFullYear()+Af)}else{Ag.setTime(Aj+Ab)}}}while(Aj<Ac.max&&Aj!=Ad);return Ah};AW=function(Aa,Ad){var Af=new Date(Aa);if(AS.timeformat!=null){return C.plot.formatDate(Af,AS.timeformat,AS.monthNames)}var Ab=Ad.tickSize[0]*AU[Ad.tickSize[1]];var Ac=Ad.max-Ad.min;var Ae=(AS.twelveHourClock)?" %p":"";if(Ab<AU.minute){fmt="%h:%M:%S"+Ae}else{if(Ab<AU.day){if(Ac<2*AU.day){fmt="%h:%M"+Ae}else{fmt="%b %d %h:%M"+Ae}}else{if(Ab<AU.month){fmt="%b %d"}else{if(Ab<AU.year){if(Ac<AU.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return C.plot.formatDate(Af,fmt,AS.monthNames)}}else{var AK=AS.tickDecimals;var AQ=-Math.floor(Math.log(AX)/Math.LN10);if(AK!=null&&AQ>AK){AQ=AK}AM=Math.pow(10,-AQ);AL=AX/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2;if(AL>2.25&&(AK==null||AQ+1<=AK)){AZ=2.5;++AQ}}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM;if(AS.minTickSize!=null&&AZ<AS.minTickSize){AZ=AS.minTickSize}if(AS.tickSize!=null){AZ=AS.tickSize}AP.tickDecimals=Math.max(0,(AK!=null)?AK:AQ);AT=function(Ac){var Ae=[];var Af=A(Ac.min,Ac.tickSize),Ab=0,Aa=Number.NaN,Ad;do{Ad=Aa;Aa=Af+Ab*Ac.tickSize;Ae.push({v:Aa,label:Ac.tickFormatter(Aa,Ac)});++Ab}while(Aa<Ac.max&&Aa!=Ad);return Ae};AW=function(Aa,Ab){return Aa.toFixed(Ab.tickDecimals)}}AP.tickSize=AV?[AZ,AV]:AZ;AP.tickGenerator=AT;if(C.isFunction(AS.tickFormatter)){AP.tickFormatter=function(Aa,Ab){return""+AS.tickFormatter(Aa,Ab)}}else{AP.tickFormatter=AW}}function p(AO,AQ){AO.ticks=[];if(!AO.used){return }if(AQ.ticks==null){AO.ticks=AO.tickGenerator(AO)}else{if(typeof AQ.ticks=="number"){if(AQ.ticks>0){AO.ticks=AO.tickGenerator(AO)}}else{if(AQ.ticks){var AP=AQ.ticks;if(C.isFunction(AP)){AP=AP({min:AO.min,max:AO.max})}var AN,AK;for(AN=0;AN<AP.length;++AN){var AL=null;var AM=AP[AN];if(typeof AM=="object"){AK=AM[0];if(AM.length>1){AL=AM[1]}}else{AK=AM}if(AL==null){AL=AO.tickFormatter(AK,AO)}AO.ticks[AN]={v:AK,label:AL}}}}}if(AQ.autoscaleMargin!=null&&AO.ticks.length>0){if(AQ.min==null){AO.min=Math.min(AO.min,AO.ticks[0].v)}if(AQ.max==null&&AO.ticks.length>1){AO.max=Math.max(AO.max,AO.ticks[AO.ticks.length-1].v)}}}function AH(){Y.clearRect(0,0,y,Q);var AL=g.grid;if(AL.show&&!AL.aboveData){S()}for(var AK=0;AK<O.length;++AK){AA(O[AK])}Z(L.draw,[Y]);if(AL.show&&AL.aboveData){S()}}function N(AL,AR){var AO=AR+"axis",AK=AR+"2axis",AN,AQ,AP,AM;if(AL[AO]){AN=s[AO];AQ=AL[AO].from;AP=AL[AO].to}else{if(AL[AK]){AN=s[AK];AQ=AL[AK].from;AP=AL[AK].to}else{AN=s[AO];AQ=AL[AR+"1"];AP=AL[AR+"2"]}}if(AQ!=null&&AP!=null&&AQ>AP){return{from:AP,to:AQ,axis:AN}}return{from:AQ,to:AP,axis:AN}}function S(){var AO;Y.save();Y.translate(e.left,e.top);if(g.grid.backgroundColor){Y.fillStyle=R(g.grid.backgroundColor,t,0,"rgba(255, 255, 255, 0)");Y.fillRect(0,0,I,t)}var AL=g.grid.markings;if(AL){if(C.isFunction(AL)){AL=AL({xmin:s.xaxis.min,xmax:s.xaxis.max,ymin:s.yaxis.min,ymax:s.yaxis.max,xaxis:s.xaxis,yaxis:s.yaxis,x2axis:s.x2axis,y2axis:s.y2axis})}for(AO=0;AO<AL.length;++AO){var AK=AL[AO],AQ=N(AK,"x"),AN=N(AK,"y");if(AQ.from==null){AQ.from=AQ.axis.min}if(AQ.to==null){AQ.to=AQ.axis.max}if(AN.from==null){AN.from=AN.axis.min}if(AN.to==null){AN.to=AN.axis.max}if(AQ.to<AQ.axis.min||AQ.from>AQ.axis.max||AN.to<AN.axis.min||AN.from>AN.axis.max){continue}AQ.from=Math.max(AQ.from,AQ.axis.min);AQ.to=Math.min(AQ.to,AQ.axis.max);AN.from=Math.max(AN.from,AN.axis.min);AN.to=Math.min(AN.to,AN.axis.max);if(AQ.from==AQ.to&&AN.from==AN.to){continue}AQ.from=AQ.axis.p2c(AQ.from);AQ.to=AQ.axis.p2c(AQ.to);AN.from=AN.axis.p2c(AN.from);AN.to=AN.axis.p2c(AN.to);if(AQ.from==AQ.to||AN.from==AN.to){Y.beginPath();Y.strokeStyle=AK.color||g.grid.markingsColor;Y.lineWidth=AK.lineWidth||g.grid.markingsLineWidth;Y.moveTo(AQ.from,AN.from);Y.lineTo(AQ.to,AN.to);Y.stroke()}else{Y.fillStyle=AK.color||g.grid.markingsColor;Y.fillRect(AQ.from,AN.to,AQ.to-AQ.from,AN.from-AN.to)}}}Y.lineWidth=1;Y.strokeStyle=g.grid.tickColor;Y.beginPath();var AM,AP=s.xaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=s.xaxis.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,0);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,t)}AP=s.yaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(0,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}AP=s.x2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,-5);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,5)}AP=s.y2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(I-5,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I+5,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}Y.stroke();if(g.grid.borderWidth){var AR=g.grid.borderWidth;Y.lineWidth=AR;Y.strokeStyle=g.grid.borderColor;Y.strokeRect(-AR/2,-AR/2,I+AR,t+AR)}Y.restore()}function h(){l.find(".tickLabels").remove();var AK=['<div class="tickLabels" style="font-size:smaller;color:'+g.grid.color+'">'];function AM(AP,AQ){for(var AO=0;AO<AP.ticks.length;++AO){var AN=AP.ticks[AO];if(!AN.label||AN.v<AP.min||AN.v>AP.max){continue}AK.push(AQ(AN,AP))}}var AL=g.grid.labelMargin+g.grid.borderWidth;AM(s.xaxis,function(AN,AO){return'<div style="position:absolute;top:'+(e.top+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.yaxis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;right:"+(e.right+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:right" class="tickLabel">'+AN.label+"</div>"});AM(s.x2axis,function(AN,AO){return'<div style="position:absolute;bottom:'+(e.bottom+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.y2axis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;left:"+(e.left+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:left" class="tickLabel">'+AN.label+"</div>"});AK.push("</div>");l.append(AK.join(""))}function AA(AK){if(AK.lines.show){a(AK)}if(AK.bars.show){n(AK)}if(AK.points.show){o(AK)}}function a(AN){function AM(AY,AZ,AR,Ad,Ac){var Ae=AY.points,AS=AY.pointsize,AW=null,AV=null;Y.beginPath();for(var AX=AS;AX<Ae.length;AX+=AS){var AU=Ae[AX-AS],Ab=Ae[AX-AS+1],AT=Ae[AX],Aa=Ae[AX+1];if(AU==null||AT==null){continue}if(Ab<=Aa&&Ab<Ac.min){if(Aa<Ac.min){continue}AU=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(Aa<=Ab&&Aa<Ac.min){if(Ab<Ac.min){continue}AT=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.min}}if(Ab>=Aa&&Ab>Ac.max){if(Aa>Ac.max){continue}AU=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(Aa>=Ab&&Aa>Ac.max){if(Ab>Ac.max){continue}AT=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.max}}if(AU<=AT&&AU<Ad.min){if(AT<Ad.min){continue}Ab=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.min}else{if(AT<=AU&&AT<Ad.min){if(AU<Ad.min){continue}Aa=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.min}}if(AU>=AT&&AU>Ad.max){if(AT>Ad.max){continue}Ab=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.max}else{if(AT>=AU&&AT>Ad.max){if(AU>Ad.max){continue}Aa=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.max}}if(AU!=AW||Ab!=AV){Y.moveTo(Ad.p2c(AU)+AZ,Ac.p2c(Ab)+AR)}AW=AT;AV=Aa;Y.lineTo(Ad.p2c(AT)+AZ,Ac.p2c(Aa)+AR)}Y.stroke()}function AO(AX,Ae,Ac){var Af=AX.points,AR=AX.pointsize,AS=Math.min(Math.max(0,Ac.min),Ac.max),Aa,AV=0,Ad=false;for(var AW=AR;AW<Af.length;AW+=AR){var AU=Af[AW-AR],Ab=Af[AW-AR+1],AT=Af[AW],AZ=Af[AW+1];if(Ad&&AU!=null&&AT==null){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill();Ad=false;continue}if(AU==null||AT==null){continue}if(AU<=AT&&AU<Ae.min){if(AT<Ae.min){continue}Ab=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.min}else{if(AT<=AU&&AT<Ae.min){if(AU<Ae.min){continue}AZ=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.min}}if(AU>=AT&&AU>Ae.max){if(AT>Ae.max){continue}Ab=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.max}else{if(AT>=AU&&AT>Ae.max){if(AU>Ae.max){continue}AZ=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.max}}if(!Ad){Y.beginPath();Y.moveTo(Ae.p2c(AU),Ac.p2c(AS));Ad=true}if(Ab>=Ac.max&&AZ>=Ac.max){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.max));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.max));AV=AT;continue}else{if(Ab<=Ac.min&&AZ<=Ac.min){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.min));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.min));AV=AT;continue}}var Ag=AU,AY=AT;if(Ab<=AZ&&Ab<Ac.min&&AZ>=Ac.min){AU=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(AZ<=Ab&&AZ<Ac.min&&Ab>=Ac.min){AT=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.min}}if(Ab>=AZ&&Ab>Ac.max&&AZ<=Ac.max){AU=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(AZ>=Ab&&AZ>Ac.max&&Ab<=Ac.max){AT=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.max}}if(AU!=Ag){if(Ab<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(Ag),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AU),Ac.p2c(Aa))}Y.lineTo(Ae.p2c(AU),Ac.p2c(Ab));Y.lineTo(Ae.p2c(AT),Ac.p2c(AZ));if(AT!=AY){if(AZ<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(AT),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AY),Ac.p2c(Aa))}AV=Math.max(AT,AY)}if(Ad){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill()}}Y.save();Y.translate(e.left,e.top);Y.lineJoin="round";var AP=AN.lines.lineWidth,AK=AN.shadowSize;if(AP>0&&AK>0){Y.lineWidth=AK;Y.strokeStyle="rgba(0,0,0,0.1)";var AQ=Math.PI/18;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/2),Math.cos(AQ)*(AP/2+AK/2),AN.xaxis,AN.yaxis);Y.lineWidth=AK/2;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/4),Math.cos(AQ)*(AP/2+AK/4),AN.xaxis,AN.yaxis)}Y.lineWidth=AP;Y.strokeStyle=AN.color;var AL=V(AN.lines,AN.color,0,t);if(AL){Y.fillStyle=AL;AO(AN.datapoints,AN.xaxis,AN.yaxis)}if(AP>0){AM(AN.datapoints,0,0,AN.xaxis,AN.yaxis)}Y.restore()}function o(AN){function AP(AU,AT,Ab,AR,AV,AZ,AY){var Aa=AU.points,AQ=AU.pointsize;for(var AS=0;AS<Aa.length;AS+=AQ){var AX=Aa[AS],AW=Aa[AS+1];if(AX==null||AX<AZ.min||AX>AZ.max||AW<AY.min||AW>AY.max){continue}Y.beginPath();Y.arc(AZ.p2c(AX),AY.p2c(AW)+AR,AT,0,AV,false);if(Ab){Y.fillStyle=Ab;Y.fill()}Y.stroke()}}Y.save();Y.translate(e.left,e.top);var AO=AN.lines.lineWidth,AL=AN.shadowSize,AK=AN.points.radius;if(AO>0&&AL>0){var AM=AL/2;Y.lineWidth=AM;Y.strokeStyle="rgba(0,0,0,0.1)";AP(AN.datapoints,AK,null,AM+AM/2,Math.PI,AN.xaxis,AN.yaxis);Y.strokeStyle="rgba(0,0,0,0.2)";AP(AN.datapoints,AK,null,AM/2,Math.PI,AN.xaxis,AN.yaxis)}Y.lineWidth=AO;Y.strokeStyle=AN.color;AP(AN.datapoints,AK,V(AN.points,AN.color),0,2*Math.PI,AN.xaxis,AN.yaxis);Y.restore()}function AB(AV,AU,Ad,AQ,AY,AN,AL,AT,AS,Ac,AZ){var AM,Ab,AR,AX,AO,AK,AW,AP,Aa;if(AZ){AP=AK=AW=true;AO=false;AM=Ad;Ab=AV;AX=AU+AQ;AR=AU+AY;if(Ab<AM){Aa=Ab;Ab=AM;AM=Aa;AO=true;AK=false}}else{AO=AK=AW=true;AP=false;AM=AV+AQ;Ab=AV+AY;AR=Ad;AX=AU;if(AX<AR){Aa=AX;AX=AR;AR=Aa;AP=true;AW=false}}if(Ab<AT.min||AM>AT.max||AX<AS.min||AR>AS.max){return }if(AM<AT.min){AM=AT.min;AO=false}if(Ab>AT.max){Ab=AT.max;AK=false}if(AR<AS.min){AR=AS.min;AP=false}if(AX>AS.max){AX=AS.max;AW=false}AM=AT.p2c(AM);AR=AS.p2c(AR);Ab=AT.p2c(Ab);AX=AS.p2c(AX);if(AL){Ac.beginPath();Ac.moveTo(AM,AR);Ac.lineTo(AM,AX);Ac.lineTo(Ab,AX);Ac.lineTo(Ab,AR);Ac.fillStyle=AL(AR,AX);Ac.fill()}if(AO||AK||AW||AP){Ac.beginPath();Ac.moveTo(AM,AR+AN);if(AO){Ac.lineTo(AM,AX+AN)}else{Ac.moveTo(AM,AX+AN)}if(AW){Ac.lineTo(Ab,AX+AN)}else{Ac.moveTo(Ab,AX+AN)}if(AK){Ac.lineTo(Ab,AR+AN)}else{Ac.moveTo(Ab,AR+AN)}if(AP){Ac.lineTo(AM,AR+AN)}else{Ac.moveTo(AM,AR+AN)}Ac.stroke()}}function n(AM){function AL(AS,AR,AU,AP,AT,AW,AV){var AX=AS.points,AO=AS.pointsize;for(var AQ=0;AQ<AX.length;AQ+=AO){if(AX[AQ]==null){continue}AB(AX[AQ],AX[AQ+1],AX[AQ+2],AR,AU,AP,AT,AW,AV,Y,AM.bars.horizontal)}}Y.save();Y.translate(e.left,e.top);Y.lineWidth=AM.bars.lineWidth;Y.strokeStyle=AM.color;var AK=AM.bars.align=="left"?0:-AM.bars.barWidth/2;var AN=AM.bars.fill?function(AO,AP){return V(AM.bars,AM.color,AO,AP)}:null;AL(AM.datapoints,AK,AK+AM.bars.barWidth,0,AN,AM.xaxis,AM.yaxis);Y.restore()}function V(AM,AK,AL,AO){var AN=AM.fill;if(!AN){return null}if(AM.fillColor){return R(AM.fillColor,AL,AO,AK)}var AP=C.color.parse(AK);AP.a=typeof AN=="number"?AN:0.4;AP.normalize();return AP.toString()}function AI(){l.find(".legend").remove();if(!g.legend.show){return }var AP=[],AN=false,AV=g.legend.labelFormatter,AU,AR;for(i=0;i<O.length;++i){AU=O[i];AR=AU.label;if(!AR){continue}if(i%g.legend.noColumns==0){if(AN){AP.push("</tr>")}AP.push("<tr>");AN=true}if(AV){AR=AV(AR,AU)}AP.push('<td class="legendColorBox"><div style="border:1px solid '+g.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+AU.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+AR+"</td>")}if(AN){AP.push("</tr>")}if(AP.length==0){return }var AT='<table style="font-size:smaller;color:'+g.grid.color+'">'+AP.join("")+"</table>";if(g.legend.container!=null){C(g.legend.container).html(AT)}else{var AQ="",AL=g.legend.position,AM=g.legend.margin;if(AM[0]==null){AM=[AM,AM]}if(AL.charAt(0)=="n"){AQ+="top:"+(AM[1]+e.top)+"px;"}else{if(AL.charAt(0)=="s"){AQ+="bottom:"+(AM[1]+e.bottom)+"px;"}}if(AL.charAt(1)=="e"){AQ+="right:"+(AM[0]+e.right)+"px;"}else{if(AL.charAt(1)=="w"){AQ+="left:"+(AM[0]+e.left)+"px;"}}var AS=C('<div class="legend">'+AT.replace('style="','style="position:absolute;'+AQ+";")+"</div>").appendTo(l);if(g.legend.backgroundOpacity!=0){var AO=g.legend.backgroundColor;if(AO==null){AO=g.grid.backgroundColor;if(AO&&typeof AO=="string"){AO=C.color.parse(AO)}else{AO=C.color.extract(AS,"background-color")}AO.a=1;AO=AO.toString()}var AK=AS.children();C('<div style="position:absolute;width:'+AK.width()+"px;height:"+AK.height()+"px;"+AQ+"background-color:"+AO+';"> </div>').prependTo(AS).css("opacity",g.legend.backgroundOpacity)}}}var w=[],J=null;function AF(AR,AP,AM){var AX=g.grid.mouseActiveRadius,Aj=AX*AX+1,Ah=null,Aa=false,Af,Ad;for(Af=0;Af<O.length;++Af){if(!AM(O[Af])){continue}var AY=O[Af],AQ=AY.xaxis,AO=AY.yaxis,Ae=AY.datapoints.points,Ac=AY.datapoints.pointsize,AZ=AQ.c2p(AR),AW=AO.c2p(AP),AL=AX/AQ.scale,AK=AX/AO.scale;if(AY.lines.show||AY.points.show){for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1];if(AT==null){continue}if(AT-AZ>AL||AT-AZ<-AL||AS-AW>AK||AS-AW<-AK){continue}var AV=Math.abs(AQ.p2c(AT)-AR),AU=Math.abs(AO.p2c(AS)-AP),Ab=AV*AV+AU*AU;if(Ab<=Aj){Aj=Ab;Ah=[Af,Ad/Ac]}}}if(AY.bars.show&&!Ah){var AN=AY.bars.align=="left"?0:-AY.bars.barWidth/2,Ag=AN+AY.bars.barWidth;for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1],Ai=Ae[Ad+2];if(AT==null){continue}if(O[Af].bars.horizontal?(AZ<=Math.max(Ai,AT)&&AZ>=Math.min(Ai,AT)&&AW>=AS+AN&&AW<=AS+Ag):(AZ>=AT+AN&&AZ<=AT+Ag&&AW>=Math.min(Ai,AS)&&AW<=Math.max(Ai,AS))){Ah=[Af,Ad/Ac]}}}}if(Ah){Af=Ah[0];Ad=Ah[1];Ac=O[Af].datapoints.pointsize;return{datapoint:O[Af].datapoints.points.slice(Ad*Ac,(Ad+1)*Ac),dataIndex:Ad,series:O[Af],seriesIndex:Af}}return null}function D(AK){if(g.grid.hoverable){H("plothover",AK,function(AL){return AL.hoverable!=false})}}function d(AK){H("plotclick",AK,function(AL){return AL.clickable!=false})}function H(AL,AK,AM){var AN=AD.offset(),AS={pageX:AK.pageX,pageY:AK.pageY},AQ=AK.pageX-AN.left-e.left,AO=AK.pageY-AN.top-e.top;if(s.xaxis.used){AS.x=s.xaxis.c2p(AQ)}if(s.yaxis.used){AS.y=s.yaxis.c2p(AO)}if(s.x2axis.used){AS.x2=s.x2axis.c2p(AQ)}if(s.y2axis.used){AS.y2=s.y2axis.c2p(AO)}var AT=AF(AQ,AO,AM);if(AT){AT.pageX=parseInt(AT.series.xaxis.p2c(AT.datapoint[0])+AN.left+e.left);AT.pageY=parseInt(AT.series.yaxis.p2c(AT.datapoint[1])+AN.top+e.top)}if(g.grid.autoHighlight){for(var AP=0;AP<w.length;++AP){var AR=w[AP];if(AR.auto==AL&&!(AT&&AR.series==AT.series&&AR.point==AT.datapoint)){x(AR.series,AR.point)}}if(AT){AE(AT.series,AT.datapoint,AL)}}l.trigger(AL,[AS,AT])}function q(){if(!J){J=setTimeout(v,30)}}function v(){J=null;AJ.save();AJ.clearRect(0,0,y,Q);AJ.translate(e.left,e.top);var AL,AK;for(AL=0;AL<w.length;++AL){AK=w[AL];if(AK.series.bars.show){z(AK.series,AK.point)}else{u(AK.series,AK.point)}}AJ.restore();Z(L.drawOverlay,[AJ])}function AE(AM,AK,AN){if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL==-1){w.push({series:AM,point:AK,auto:AN});q()}else{if(!AN){w[AL].auto=false}}}function x(AM,AK){if(AM==null&&AK==null){w=[];q()}if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL!=-1){w.splice(AL,1);q()}}function j(AM,AN){for(var AK=0;AK<w.length;++AK){var AL=w[AK];if(AL.series==AM&&AL.point[0]==AN[0]&&AL.point[1]==AN[1]){return AK}}return -1}function u(AN,AM){var AL=AM[0],AR=AM[1],AQ=AN.xaxis,AP=AN.yaxis;if(AL<AQ.min||AL>AQ.max||AR<AP.min||AR>AP.max){return }var AO=AN.points.radius+AN.points.lineWidth/2;AJ.lineWidth=AO;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AK=1.5*AO;AJ.beginPath();AJ.arc(AQ.p2c(AL),AP.p2c(AR),AK,0,2*Math.PI,false);AJ.stroke()}function z(AN,AK){AJ.lineWidth=AN.bars.lineWidth;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AM=C.color.parse(AN.color).scale("a",0.5).toString();var AL=AN.bars.align=="left"?0:-AN.bars.barWidth/2;AB(AK[0],AK[1],AK[2]||0,AL,AL+AN.bars.barWidth,0,function(){return AM},AN.xaxis,AN.yaxis,AJ,AN.bars.horizontal)}function R(AM,AL,AQ,AO){if(typeof AM=="string"){return AM}else{var AP=Y.createLinearGradient(0,AQ,0,AL);for(var AN=0,AK=AM.colors.length;AN<AK;++AN){var AR=AM.colors[AN];if(typeof AR!="string"){AR=C.color.parse(AO).scale("rgb",AR.brightness);AR.a*=AR.opacity;AR=AR.toString()}AP.addColorStop(AN/(AK-1),AR)}return AP}}}C.plot=function(G,E,D){var F=new B(C(G),E,D,C.plot.plugins);return F};C.plot.plugins=[];C.plot.formatDate=function(H,E,G){var L=function(N){N=""+N;return N.length==1?"0"+N:N};var D=[];var M=false;var K=H.getUTCHours();var I=K<12;if(G==null){G=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}if(E.search(/%p|%P/)!=-1){if(K>12){K=K-12}else{if(K==0){K=12}}}for(var F=0;F<E.length;++F){var J=E.charAt(F);if(M){switch(J){case"h":J=""+K;break;case"H":J=L(K);break;case"M":J=L(H.getUTCMinutes());break;case"S":J=L(H.getUTCSeconds());break;case"d":J=""+H.getUTCDate();break;case"m":J=""+(H.getUTCMonth()+1);break;case"y":J=""+H.getUTCFullYear();break;case"b":J=""+G[H.getUTCMonth()];break;case"p":J=(I)?("am"):("pm");break;case"P":J=(I)?("AM"):("PM");break}D.push(J);M=false}else{if(J=="%"){M=true}else{D.push(J)}}}return D.join("")};function A(E,D){return D*Math.floor(E/D)}})(jQuery);  
/*  
Flot plugin for adding panning and zooming capabilities to a plot.  
 
The default behaviour is double click and scrollwheel up/down to zoom  
in, drag to pan. The plugin defines plot.zoom({ center }),  
plot.zoomOut() and plot.pan(offset) so you easily can add custom  
controls. It also fires a "plotpan" and "plotzoom" event when  
something happens, useful for synchronizing plots.  
 
Example usage:  
 
plot = $.plot(...);  
 
// zoom default amount in on the pixel (100, 200)  
plot.zoom({ center: { left: 10, top: 20 } });  
 
// zoom out again  
plot.zoomOut({ center: { left: 10, top: 20 } });  
 
// pan 100 pixels to the left and 20 down  
plot.pan({ left: -100, top: 20 })  
 
 
Options:  
 
zoom: {  
interactive: false  
trigger: "dblclick" // or "click" for single click  
amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out)  
}  
 
pan: {  
interactive: false  
}  
 
xaxis, yaxis, x2axis, y2axis: {  
zoomRange: null // or [number, number] (min range, max range)  
panRange: null // or [number, number] (min, max)  
}  
 
"interactive" enables the built-in drag/click behaviour. "amount" is  
the amount to zoom the viewport relative to the current range, so 1 is  
100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is 70% (zoom out).  
 
"zoomRange" is the interval in which zooming can happen, e.g. with  
zoomRange: [1, 100] the zoom will never scale the axis so that the  
difference between min and max is smaller than 1 or larger than 100.  
You can set either of them to null to ignore.  
 
"panRange" confines the panning to stay within a range, e.g. with  
panRange: [-10, 20] panning stops at -10 in one end and at 20 in the  
other. Either can be null.  
*/  
 
 
// First two dependencies, jquery.event.drag.js and  
// jquery.mousewheel.js, we put them inline here to save people the  
// effort of downloading them.  
 
/*  
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)  
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt  
*/  
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);  
 
 
/* jquery.mousewheel.min.js  
* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)  
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)  
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.  
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.  
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.  
*  
* Version: 3.0.2  
*  
* Requires: 1.2.2+  
*/  
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);  
 
 
 
 
(function ($) {  
var options = {  
xaxis: {  
zoomRange: null, // or [number, number] (min range, max range)  
panRange: null // or [number, number] (min, max)  
},  
zoom: {  
interactive: false,  
trigger: "dblclick", // or "click" for single click  
amount: 1.5 // how much to zoom relative to current position, 2 = 200% (zoom in), 0.5 = 50% (zoom out)  
},  
pan: {  
interactive: false  
}  
};  
 
function init(plot) {  
function bindEvents(plot, eventHolder) {  
var o = plot.getOptions();  
if (o.zoom.interactive) {  
function clickHandler(e, zoomOut) {  
var c = plot.offset();  
c.left = e.pageX - c.left;  
c.top = e.pageY - c.top;  
if (zoomOut)  
plot.zoomOut({ center: c });  
else  
plot.zoom({ center: c });  
}  
 
eventHolder[o.zoom.trigger](clickHandler);  
 
eventHolder.mousewheel(function (e, delta) {  
clickHandler(e, delta < 0);  
return false;  
});  
}  
if (o.pan.interactive) {  
var prevCursor = 'default', pageX = 0, pageY = 0;  
 
eventHolder.bind("dragstart", { distance: 10 }, function (e) {  
if (e.which != 1) // only accept left-click  
return false;  
eventHolderCursor = eventHolder.css('cursor');  
eventHolder.css('cursor', 'move');  
pageX = e.pageX;  
pageY = e.pageY;  
});  
eventHolder.bind("drag", function (e) {  
// unused at the moment, but we need it here to  
// trigger the dragstart/dragend events  
});  
eventHolder.bind("dragend", function (e) {  
eventHolder.css('cursor', prevCursor);  
plot.pan({ left: pageX - e.pageX,  
top: pageY - e.pageY });  
});  
}  
}  
 
plot.zoomOut = function (args) {  
if (!args)  
args = {};  
 
if (!args.amount)  
args.amount = plot.getOptions().zoom.amount  
 
args.amount = 1 / args.amount;  
plot.zoom(args);  
}  
 
plot.zoom = function (args) {  
if (!args)  
args = {};  
 
var axes = plot.getAxes(),  
options = plot.getOptions(),  
c = args.center,  
amount = args.amount ? args.amount : options.zoom.amount,  
w = plot.width(), h = plot.height();  
 
if (!c)  
c = { left: w / 2, top: h / 2 };  
 
var xf = c.left / w,  
x1 = c.left - xf * w / amount,  
x2 = c.left + (1 - xf) * w / amount,  
yf = c.top / h,  
y1 = c.top - yf * h / amount,  
y2 = c.top + (1 - yf) * h / amount;  
 
function scaleAxis(min, max, name) {  
var axis = axes[name],  
axisOptions = options[name];  
 
if (!axis.used)  
return;  
 
min = axis.c2p(min);  
max = axis.c2p(max);  
if (max < min) { // make sure min < max  
var tmp = min  
min = max;  
max = tmp;  
}  
 
var range = max - min, zr = axisOptions.zoomRange;  
if (zr &&  
((zr[0] != null && range < zr[0]) ||  
(zr[1] != null && range > zr[1])))  
return;  
 
axisOptions.min = min;  
axisOptions.max = max;  
}  
 
scaleAxis(x1, x2, 'xaxis');  
scaleAxis(x1, x2, 'x2axis');  
scaleAxis(y1, y2, 'yaxis');  
scaleAxis(y1, y2, 'y2axis');  
 
plot.setupGrid();  
plot.draw();  
 
if (!args.preventEvent)  
plot.getPlaceholder().trigger("plotzoom", [ plot ]);  
}  
 
plot.pan = function (args) {  
var l = +args.left, t = +args.top,  
axes = plot.getAxes(), options = plot.getOptions();  
 
if (isNaN(l))  
l = 0;  
if (isNaN(t))  
t = 0;  
 
function panAxis(delta, name) {  
var axis = axes[name],  
axisOptions = options[name],  
min, max;  
 
if (!axis.used)  
return;  
 
min = axis.c2p(axis.p2c(axis.min) + delta),  
max = axis.c2p(axis.p2c(axis.max) + delta);  
 
var pr = axisOptions.panRange;  
if (pr) {  
// check whether we hit the wall  
if (pr[0] != null && pr[0] > min) {  
delta = pr[0] - min;  
min += delta;  
max += delta;  
}  
 
if (pr[1] != null && pr[1] < max) {  
delta = pr[1] - max;  
min += delta;  
max += delta;  
}  
}  
 
axisOptions.min = min;  
axisOptions.max = max;  
}  
 
panAxis(l, 'xaxis');  
panAxis(l, 'x2axis');  
panAxis(t, 'yaxis');  
panAxis(t, 'y2axis');  
 
plot.setupGrid();  
plot.draw();  
 
if (!args.preventEvent)  
plot.getPlaceholder().trigger("plotpan", [ plot ]);  
}  
 
plot.hooks.bindEvents.push(bindEvents);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'navigate',  
version: '1.1'  
});  
})(jQuery);  
 
(function(R){R.fn.drag=function(A,B,C){if(B){this.bind("dragstart",A)}if(C){this.bind("dragend",C)}return !A?this.trigger("drag"):this.bind("drag",B?B:A)};var M=R.event,L=M.special,Q=L.drag={not:":input",distance:0,which:1,dragging:false,setup:function(A){A=R.extend({distance:Q.distance,which:Q.which,not:Q.not},A||{});A.distance=N(A.distance);M.add(this,"mousedown",O,A);if(this.attachEvent){this.attachEvent("ondragstart",J)}},teardown:function(){M.remove(this,"mousedown",O);if(this===Q.dragging){Q.dragging=Q.proxy=false}P(this,true);if(this.detachEvent){this.detachEvent("ondragstart",J)}}};L.dragstart=L.dragend={setup:function(){},teardown:function(){}};function O(A){var B=this,C,D=A.data||{};if(D.elem){B=A.dragTarget=D.elem;A.dragProxy=Q.proxy||B;A.cursorOffsetX=D.pageX-D.left;A.cursorOffsetY=D.pageY-D.top;A.offsetX=A.pageX-A.cursorOffsetX;A.offsetY=A.pageY-A.cursorOffsetY}else{if(Q.dragging||(D.which>0&&A.which!=D.which)||R(A.target).is(D.not)){return }}switch(A.type){case"mousedown":R.extend(D,R(B).offset(),{elem:B,target:A.target,pageX:A.pageX,pageY:A.pageY});M.add(document,"mousemove mouseup",O,D);P(B,false);Q.dragging=null;return false;case !Q.dragging&&"mousemove":if(N(A.pageX-D.pageX)+N(A.pageY-D.pageY)<D.distance){break}A.target=D.target;C=K(A,"dragstart",B);if(C!==false){Q.dragging=B;Q.proxy=A.dragProxy=R(C||B)[0]}case"mousemove":if(Q.dragging){C=K(A,"drag",B);if(L.drop){L.drop.allowed=(C!==false);L.drop.handler(A)}if(C!==false){break}A.type="mouseup"}case"mouseup":M.remove(document,"mousemove mouseup",O);if(Q.dragging){if(L.drop){L.drop.handler(A)}K(A,"dragend",B)}P(B,true);Q.dragging=Q.proxy=D.elem=false;break}return true}function K(D,B,A){D.type=B;var C=R.event.handle.call(A,D);return C===false?false:C||D.result}function N(A){return Math.pow(A,2)}function J(){return(Q.dragging===false)}function P(A,B){if(!A){return }A.unselectable=B?"off":"on";A.onselectstart=function(){return B};if(A.style){A.style.MozUserSelect=B?"":"none"}}})(jQuery);(function(C){var B=["DOMMouseScroll","mousewheel"];C.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var D=B.length;D;){this.addEventListener(B[--D],A,false)}}else{this.onmousewheel=A}},teardown:function(){if(this.removeEventListener){for(var D=B.length;D;){this.removeEventListener(B[--D],A,false)}}else{this.onmousewheel=null}}};C.fn.extend({mousewheel:function(D){return D?this.bind("mousewheel",D):this.trigger("mousewheel")},unmousewheel:function(D){return this.unbind("mousewheel",D)}});function A(E){var G=[].slice.call(arguments,1),D=0,F=true;E=C.event.fix(E||window.event);E.type="mousewheel";if(E.wheelDelta){D=E.wheelDelta/120}if(E.detail){D=-E.detail/3}G.unshift(E,D);return C.event.handle.apply(this,G)}})(jQuery);(function(B){var A={xaxis:{zoomRange:null,panRange:null},zoom:{interactive:false,trigger:"dblclick",amount:1.5},pan:{interactive:false}};function C(D){function E(J,F){var K=J.getOptions();if(K.zoom.interactive){function L(N,M){var O=J.offset();O.left=N.pageX-O.left;O.top=N.pageY-O.top;if(M){J.zoomOut({center:O})}else{J.zoom({center:O})}}F[K.zoom.trigger](L);F.mousewheel(function(M,N){L(M,N<0);return false})}if(K.pan.interactive){var I="default",H=0,G=0;F.bind("dragstart",{distance:10},function(M){if(M.which!=1){return false}eventHolderCursor=F.css("cursor");F.css("cursor","move");H=M.pageX;G=M.pageY});F.bind("drag",function(M){});F.bind("dragend",function(M){F.css("cursor",I);J.pan({left:H-M.pageX,top:G-M.pageY})})}}D.zoomOut=function(F){if(!F){F={}}if(!F.amount){F.amount=D.getOptions().zoom.amount}F.amount=1/F.amount;D.zoom(F)};D.zoom=function(M){if(!M){M={}}var L=D.getAxes(),S=D.getOptions(),N=M.center,J=M.amount?M.amount:S.zoom.amount,R=D.width(),I=D.height();if(!N){N={left:R/2,top:I/2}}var Q=N.left/R,G=N.left-Q*R/J,F=N.left+(1-Q)*R/J,H=N.top/I,P=N.top-H*I/J,O=N.top+(1-H)*I/J;function K(X,T,V){var Y=L[V],a=S[V];if(!Y.used){return }X=Y.c2p(X);T=Y.c2p(T);if(T<X){var W=X;X=T;T=W}var U=T-X,Z=a.zoomRange;if(Z&&((Z[0]!=null&&U<Z[0])||(Z[1]!=null&&U>Z[1]))){return }a.min=X;a.max=T}K(G,F,"xaxis");K(G,F,"x2axis");K(P,O,"yaxis");K(P,O,"y2axis");D.setupGrid();D.draw();if(!M.preventEvent){D.getPlaceholder().trigger("plotzoom",[D])}};D.pan=function(I){var F=+I.left,J=+I.top,K=D.getAxes(),H=D.getOptions();if(isNaN(F)){F=0}if(isNaN(J)){J=0}function G(R,M){var O=K[M],Q=H[M],N,L;if(!O.used){return }N=O.c2p(O.p2c(O.min)+R),L=O.c2p(O.p2c(O.max)+R);var P=Q.panRange;if(P){if(P[0]!=null&&P[0]>N){R=P[0]-N;N+=R;L+=R}if(P[1]!=null&&P[1]<L){R=P[1]-L;N+=R;L+=R}}Q.min=N;Q.max=L}G(F,"xaxis");G(F,"x2axis");G(J,"yaxis");G(J,"y2axis");D.setupGrid();D.draw();if(!I.preventEvent){D.getPlaceholder().trigger("plotpan",[D])}};D.hooks.bindEvents.push(E)}B.plot.plugins.push({init:C,options:A,name:"navigate",version:"1.1"})})(jQuery);  
/*  
Flot plugin for rendering pie charts. The plugin assumes the data is  
coming is as a single data value for each series, and each of those  
values is a positive value or zero (negative numbers don't make  
any sense and will cause strange effects). The data values do  
NOT need to be passed in as percentage values because it  
internally calculates the total and percentages.  
 
* Created by Brian Medendorp, June 2009  
* Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars  
 
* Changes:  
2009-10-22: lineJoin set to round  
2009-10-23: IE full circle fix, donut  
2009-11-11: Added basic hover from btburnett3 - does not work in IE, and center is off in Chrome and Opera  
2009-11-17: Added IE hover capability submitted by Anthony Aragues  
2009-11-18: Added bug fix submitted by Xavi Ivars (issues with arrays when other JS libraries are included as well)  
 
 
Available options are:  
series: {  
pie: {  
show: true/false  
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'  
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect  
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result  
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)  
offset: {  
top: integer value to move the pie up or down  
left: integer value to move the pie left or right, or 'auto'  
},  
stroke: {  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')  
width: integer pixel width of the stroke  
},  
label: {  
show: true/false, or 'auto'  
formatter: a user-defined function that modifies the text/style of the label text  
radius: 0-1 for percentage of fullsize, or a specified pixel length  
background: {  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')  
opacity: 0-1  
},  
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)  
},  
combine: {  
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined  
label: any text value of what the combined slice should be labeled  
}  
highlight: {  
opacity: 0-1  
}  
}  
}  
 
More detail and specific examples can be found in the included HTML file.  
 
*/  
 
(function ($)  
{  
function init(plot) // this is the "body" of the plugin  
{  
var canvas = null;  
var target = null;  
var maxRadius = null;  
var centerLeft = null;  
var centerTop = null;  
var total = 0;  
var redraw = true;  
var redrawAttempts = 10;  
var shrink = 0.95;  
var legendWidth = 0;  
var processed = false;  
var raw = false;  
 
// interactive variables  
var highlights = [];  
 
// add hook to determine if pie plugin in enabled, and then perform necessary operations  
plot.hooks.processOptions.push(checkPieEnabled);  
plot.hooks.bindEvents.push(bindEvents);  
 
// check to see if the pie plugin is enabled  
function checkPieEnabled(plot, options)  
{  
if (options.series.pie.show)  
{  
//disable grid  
options.grid.show = false;  
 
// set labels.show  
if (options.series.pie.label.show=='auto')  
if (options.legend.show)  
options.series.pie.label.show = false;  
else  
options.series.pie.label.show = true;  
 
// set radius  
if (options.series.pie.radius=='auto')  
if (options.series.pie.label.show)  
options.series.pie.radius = 3/4;  
else  
options.series.pie.radius = 1;  
 
// ensure sane tilt  
if (options.series.pie.tilt>1)  
options.series.pie.tilt=1;  
if (options.series.pie.tilt<0)  
options.series.pie.tilt=0;  
 
// add processData hook to do transformations on the data  
plot.hooks.processDatapoints.push(processDatapoints);  
plot.hooks.drawOverlay.push(drawOverlay);  
 
// add draw hook  
plot.hooks.draw.push(draw);  
}  
}  
 
// bind hoverable events  
function bindEvents(plot, eventHolder)  
{  
var options = plot.getOptions();  
 
if (options.series.pie.show && options.grid.hoverable)  
eventHolder.unbind('mousemove').mousemove(onMouseMove);  
 
if (options.series.pie.show && options.grid.clickable)  
eventHolder.unbind('click').click(onClick);  
}  
 
 
// debugging function that prints out an object  
function alertObject(obj)  
{  
var msg = '';  
function traverse(obj, depth)  
{  
if (!depth)  
depth = 0;  
for (var i = 0; i < obj.length; ++i)  
{  
for (var j=0; j<depth; j++)  
msg += '\t';  
 
if( typeof obj[i] == "object")  
{ // its an object  
msg += ''+i+':\n';  
traverse(obj[i], depth+1);  
}  
else  
{ // its a value  
msg += ''+i+': '+obj[i]+'\n';  
}  
}  
}  
traverse(obj);  
alert(msg);  
}  
 
function calcTotal(data)  
{  
for (var i = 0; i < data.length; ++i)  
{  
var item = parseFloat(data[i].data[0][1]);  
if (item)  
total += item;  
}  
}  
 
function processDatapoints(plot, series, data, datapoints)  
{  
if (!processed)  
{  
processed = true;  
 
canvas = plot.getCanvas();  
target = $(canvas).parent();  
options = plot.getOptions();  
 
plot.setData(combine(plot.getData()));  
}  
}  
 
function setupPie()  
{  
legendWidth = target.children().filter('.legend').children().width();  
 
// calculate maximum radius and center point  
maxRadius = Math.min(canvas.width,(canvas.height/options.series.pie.tilt))/2;  
centerTop = (canvas.height/2)+options.series.pie.offset.top;  
centerLeft = (canvas.width/2);  
 
if (options.series.pie.offset.left=='auto')  
if (options.legend.position.match('w'))  
centerLeft += legendWidth/2;  
else  
centerLeft -= legendWidth/2;  
else  
centerLeft += options.series.pie.offset.left;  
 
if (centerLeft<maxRadius)  
centerLeft = maxRadius;  
else if (centerLeft>canvas.width-maxRadius)  
centerLeft = canvas.width-maxRadius;  
}  
 
function fixData(data)  
{  
for (var i = 0; i < data.length; ++i)  
{  
if (typeof(data[i].data)=='number')  
data[i].data = [[1,data[i].data]];  
else if (typeof(data[i].data)=='undefined' || typeof(data[i].data[0])=='undefined')  
{  
if (typeof(data[i].data)!='undefined' && typeof(data[i].data.label)!='undefined')  
data[i].label = data[i].data.label; // fix weirdness coming from flot  
data[i].data = [[1,0]];  
 
}  
}  
return data;  
}  
 
function combine(data)  
{  
data = fixData(data);  
calcTotal(data);  
var combined = 0;  
var numCombined = 0;  
var color = options.series.pie.combine.color;  
 
var newdata = [];  
for (var i = 0; i < data.length; ++i)  
{  
// make sure its a number  
data[i].data[0][1] = parseFloat(data[i].data[0][1]);  
if (!data[i].data[0][1])  
data[i].data[0][1] = 0;  
 
if (data[i].data[0][1]/total<=options.series.pie.combine.threshold)  
{  
combined += data[i].data[0][1];  
numCombined++;  
if (!color)  
color = data[i].color;  
}  
else  
{  
newdata.push({  
data: [[1,data[i].data[0][1]]],  
color: data[i].color,  
label: data[i].label,  
angle: (data[i].data[0][1]*(Math.PI*2))/total,  
percent: (data[i].data[0][1]/total*100)  
});  
}  
}  
if (numCombined>0)  
newdata.push({  
data: [[1,combined]],  
color: color,  
label: options.series.pie.combine.label,  
angle: (combined*(Math.PI*2))/total,  
percent: (combined/total*100)  
});  
return newdata;  
}  
 
function draw(plot, newCtx)  
{  
if (!target) return; // if no series were passed  
ctx = newCtx;  
 
setupPie();  
var slices = plot.getData();  
 
var attempts = 0;  
while (redraw && attempts<redrawAttempts)  
{  
redraw = false;  
if (attempts>0)  
maxRadius *= shrink;  
attempts += 1;  
clear();  
if (options.series.pie.tilt<=0.8)  
drawShadow();  
drawPie();  
}  
if (attempts >= redrawAttempts) {  
clear();  
target.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>');  
}  
 
if ( plot.setSeries && plot.insertLegend )  
{  
plot.setSeries(slices);  
plot.insertLegend();  
}  
 
// we're actually done at this point, just defining internal functions at this point  
 
function clear()  
{  
ctx.clearRect(0,0,canvas.width,canvas.height);  
target.children().filter('.pieLabel, .pieLabelBackground').remove();  
}  
 
function drawShadow()  
{  
var shadowLeft = 5;  
var shadowTop = 15;  
var edge = 10;  
var alpha = 0.02;  
 
// set radius  
if (options.series.pie.radius>1)  
var radius = options.series.pie.radius;  
else  
var radius = maxRadius * options.series.pie.radius;  
 
if (radius>=(canvas.width/2)-shadowLeft || radius*options.series.pie.tilt>=(canvas.height/2)-shadowTop || radius<=edge)  
return; // shadow would be outside canvas, so don't draw it  
 
ctx.save();  
ctx.translate(shadowLeft,shadowTop);  
ctx.globalAlpha = alpha;  
ctx.fillStyle = '#000';  
 
// center and rotate to starting position  
ctx.translate(centerLeft,centerTop);  
ctx.scale(1, options.series.pie.tilt);  
 
//radius -= edge;  
for (var i=1; i<=edge; i++)  
{  
ctx.beginPath();  
ctx.arc(0,0,radius,0,Math.PI*2,false);  
ctx.fill();  
radius -= i;  
}  
 
ctx.restore();  
}  
 
function drawPie()  
{  
startAngle = Math.PI*options.series.pie.startAngle;  
 
// set radius  
if (options.series.pie.radius>1)  
var radius = options.series.pie.radius;  
else  
var radius = maxRadius * options.series.pie.radius;  
 
// center and rotate to starting position  
ctx.save();  
ctx.translate(centerLeft,centerTop);  
ctx.scale(1, options.series.pie.tilt);  
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera  
 
// draw slices  
ctx.save();  
var currentAngle = startAngle;  
for (var i = 0; i < slices.length; ++i)  
{  
slices[i].startAngle = currentAngle;  
drawSlice(slices[i].angle, slices[i].color, true);  
}  
ctx.restore();  
 
// draw slice outlines  
ctx.save();  
ctx.lineWidth = options.series.pie.stroke.width;  
currentAngle = startAngle;  
for (var i = 0; i < slices.length; ++i)  
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);  
ctx.restore();  
 
// draw donut hole  
drawDonutHole(ctx);  
 
// draw labels  
if (options.series.pie.label.show)  
drawLabels();  
 
// restore to original state  
ctx.restore();  
 
function drawSlice(angle, color, fill)  
{  
if (angle<=0)  
return;  
 
if (fill)  
ctx.fillStyle = color;  
else  
{  
ctx.strokeStyle = color;  
ctx.lineJoin = 'round';  
}  
 
ctx.beginPath();  
if (angle!=Math.PI*2)  
ctx.moveTo(0,0); // Center of the pie  
else if ($.browser.msie)  
angle -= 0.0001;  
//ctx.arc(0,0,radius,0,angle,false); // This doesn't work properly in Opera  
ctx.arc(0,0,radius,currentAngle,currentAngle+angle,false);  
ctx.closePath();  
//ctx.rotate(angle); // This doesn't work properly in Opera  
currentAngle += angle;  
 
if (fill)  
ctx.fill();  
else  
ctx.stroke();  
}  
 
function drawLabels()  
{  
var currentAngle = startAngle;  
 
// set radius  
if (options.series.pie.label.radius>1)  
var radius = options.series.pie.label.radius;  
else  
var radius = maxRadius * options.series.pie.label.radius;  
 
for (var i = 0; i < slices.length; ++i)  
{  
if (slices[i].percent >= options.series.pie.label.threshold*100)  
drawLabel(slices[i], currentAngle, i);  
currentAngle += slices[i].angle;  
}  
 
function drawLabel(slice, startAngle, index)  
{  
if (slice.data[0][1]==0)  
return;  
 
// format label text  
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;  
if (lf)  
text = lf(slice.label, slice);  
else  
text = slice.label;  
if (plf)  
text = plf(text, slice);  
 
var halfAngle = ((startAngle+slice.angle) + startAngle)/2;  
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);  
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;  
 
var html = '<span class="pieLabel" id="pieLabel'+index+'" style="position:absolute;top:' + y + 'px;left:' + x + 'px;">' + text + "</span>";  
target.append(html);  
var label = target.children('#pieLabel'+index);  
var labelTop = (y - label.height()/2);  
var labelLeft = (x - label.width()/2);  
label.css('top', labelTop);  
label.css('left', labelLeft);  
 
// check to make sure that the label is not outside the canvas  
if (0-labelTop>0 || 0-labelLeft>0 || canvas.height-(labelTop+label.height())<0 || canvas.width-(labelLeft+label.width())<0)  
redraw = true;  
 
if (options.series.pie.label.background.opacity != 0) {  
// put in the transparent background separately to avoid blended labels and label boxes  
var c = options.series.pie.label.background.color;  
if (c == null) {  
c = slice.color;  
}  
var pos = 'top:'+labelTop+'px;left:'+labelLeft+'px;';  
$('<div class="pieLabelBackground" style="position:absolute;width:' + label.width() + 'px;height:' + label.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').insertBefore(label).css('opacity', options.series.pie.label.background.opacity);  
}  
} // end individual label function  
} // end drawLabels function  
} // end drawPie function  
} // end draw function  
 
// Placed here because it needs to be accessed from multiple locations  
function drawDonutHole(layer)  
{  
// draw donut hole  
if(options.series.pie.innerRadius > 0)  
{  
// subtract the center  
layer.save();  
innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;  
layer.globalCompositeOperation = 'destination-out'; // this does not work with excanvas, but it will fall back to using the stroke color  
layer.beginPath();  
layer.fillStyle = options.series.pie.stroke.color;  
layer.arc(0,0,innerRadius,0,Math.PI*2,false);  
layer.fill();  
layer.closePath();  
layer.restore();  
 
// add inner stroke  
layer.save();  
layer.beginPath();  
layer.strokeStyle = options.series.pie.stroke.color;  
layer.arc(0,0,innerRadius,0,Math.PI*2,false);  
layer.stroke();  
layer.closePath();  
layer.restore();  
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.  
}  
}  
 
//-- Additional Interactive related functions --  
 
function isPointInPoly(poly, pt)  
{  
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)  
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))  
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])  
&& (c = !c);  
return c;  
}  
 
function findNearbySlice(mouseX, mouseY)  
{  
var slices = plot.getData(),  
options = plot.getOptions(),  
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;  
 
for (var i = 0; i < slices.length; ++i)  
{  
var s = slices[i];  
 
if(s.pie.show)  
{  
ctx.save();  
ctx.beginPath();  
ctx.moveTo(0,0); // Center of the pie  
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.  
ctx.arc(0,0,radius,s.startAngle,s.startAngle+s.angle,false);  
ctx.closePath();  
x = mouseX-centerLeft;  
y = mouseY-centerTop;  
if(ctx.isPointInPath)  
{  
if (ctx.isPointInPath(mouseX-centerLeft, mouseY-centerTop))  
{  
//alert('found slice!');  
ctx.restore();  
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};  
}  
}  
else  
{  
// excanvas for IE doesn;t support isPointInPath, this is a workaround.  
p1X = (radius * Math.cos(s.startAngle));  
p1Y = (radius * Math.sin(s.startAngle));  
p2X = (radius * Math.cos(s.startAngle+(s.angle/4)));  
p2Y = (radius * Math.sin(s.startAngle+(s.angle/4)));  
p3X = (radius * Math.cos(s.startAngle+(s.angle/2)));  
p3Y = (radius * Math.sin(s.startAngle+(s.angle/2)));  
p4X = (radius * Math.cos(s.startAngle+(s.angle/1.5)));  
p4Y = (radius * Math.sin(s.startAngle+(s.angle/1.5)));  
p5X = (radius * Math.cos(s.startAngle+s.angle));  
p5Y = (radius * Math.sin(s.startAngle+s.angle));  
arrPoly = [[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]];  
arrPoint = [x,y];  
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?  
if(isPointInPoly(arrPoly, arrPoint))  
{  
ctx.restore();  
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};  
}  
}  
ctx.restore();  
}  
}  
 
return null;  
}  
 
function onMouseMove(e)  
{  
triggerClickHoverEvent('plothover', e);  
}  
 
function onClick(e)  
{  
triggerClickHoverEvent('plotclick', e);  
}  
 
// trigger click or hover event (they send the same parameters so we share their code)  
function triggerClickHoverEvent(eventname, e)  
{  
var offset = plot.offset(),  
canvasX = parseInt(e.pageX - offset.left),  
canvasY = parseInt(e.pageY - offset.top),  
item = findNearbySlice(canvasX, canvasY);  
 
if (options.grid.autoHighlight)  
{  
// clear auto-highlights  
for (var i = 0; i < highlights.length; ++i)  
{  
var h = highlights[i];  
if (h.auto == eventname && !(item && h.series == item.series))  
unhighlight(h.series);  
}  
}  
 
// if no slice was found, quit  
if (!item)  
return;  
 
// highlight the slice  
highlight(item.series, eventname);  
 
// trigger any hover bind events  
var pos = { pageX: e.pageX, pageY: e.pageY };  
target.trigger(eventname, [ pos, item ]);  
}  
 
function highlight(s, auto)  
{  
if (typeof s == "number")  
s = series[s];  
 
var i = indexOfHighlight(s);  
if (i == -1)  
{  
highlights.push({ series: s, auto: auto });  
plot.triggerRedrawOverlay();  
}  
else if (!auto)  
highlights[i].auto = false;  
}  
 
function unhighlight(s)  
{  
if (s == null)  
{  
highlights = [];  
plot.triggerRedrawOverlay();  
}  
 
if (typeof s == "number")  
s = series[s];  
 
var i = indexOfHighlight(s);  
if (i != -1)  
{  
highlights.splice(i, 1);  
plot.triggerRedrawOverlay();  
}  
}  
 
function indexOfHighlight(s)  
{  
for (var i = 0; i < highlights.length; ++i)  
{  
var h = highlights[i];  
if (h.series == s)  
return i;  
}  
return -1;  
}  
 
function drawOverlay(plot, octx)  
{  
//alert(options.series.pie.radius);  
var options = plot.getOptions();  
//alert(options.series.pie.radius);  
 
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;  
 
octx.save();  
octx.translate(centerLeft, centerTop);  
octx.scale(1, options.series.pie.tilt);  
 
for (i = 0; i < highlights.length; ++i)  
drawHighlight(highlights[i].series);  
 
drawDonutHole(octx);  
 
octx.restore();  
 
function drawHighlight(series)  
{  
if (series.angle < 0) return;  
 
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();  
octx.fillStyle = "rgba(255, 255, 255, "+options.series.pie.highlight.opacity+")"; // this is temporary until we have access to parseColor  
 
octx.beginPath();  
if (series.angle!=Math.PI*2)  
octx.moveTo(0,0); // Center of the pie  
octx.arc(0,0,radius,series.startAngle,series.startAngle+series.angle,false);  
octx.closePath();  
octx.fill();  
}  
 
}  
 
} // end init (plugin body)  
 
// define pie specific options and their default values  
var options = {  
series: {  
pie: {  
show: false,  
radius: 'auto', // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)  
innerRadius:0, /* for donut */  
startAngle: 3/2,  
tilt: 1,  
offset: {  
top: 0,  
left: 'auto'  
},  
stroke: {  
color: '#FFF',  
width: 1  
},  
label: {  
show: 'auto',  
formatter: function(label, slice){  
return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+label+'<br/>'+Math.round(slice.percent)+'%</div>';  
}, // formatter function  
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)  
background: {  
color: null,  
opacity: 0  
},  
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)  
},  
combine: {  
threshold: -1, // percentage at which to combine little slices into one larger slice  
color: null, // color to give the new slice (auto-generated if null)  
label: 'Other' // label to give the new slice  
},  
highlight: {  
//color: '#FFF', // will add this functionality once parseColor is available  
opacity: 0.5  
}  
}  
}  
};  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: "pie",  
version: "1.0"  
});  
})(jQuery);  
/*  
Flot plugin for selecting regions.  
 
The plugin defines the following options:  
 
selection: {  
mode: null or "x" or "y" or "xy",  
color: color  
}  
 
You enable selection support by setting the mode to one of "x", "y" or  
"xy". In "x" mode, the user will only be able to specify the x range,  
similarly for "y" mode. For "xy", the selection becomes a rectangle  
where both ranges can be specified. "color" is color of the selection.  
 
When selection support is enabled, a "plotselected" event will be emitted  
on the DOM element you passed into the plot function. The event  
handler gets one extra parameter with the ranges selected on the axes,  
like this:  
 
placeholder.bind("plotselected", function(event, ranges) {  
alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)  
// similar for yaxis, secondary axes are in x2axis  
// and y2axis if present  
});  
 
The "plotselected" event is only fired when the user has finished  
making the selection. A "plotselecting" event is fired during the  
process with the same parameters as the "plotselected" event, in case  
you want to know what's happening while it's happening,  
 
A "plotunselected" event with no arguments is emitted when the user  
clicks the mouse to remove the selection.  
 
The plugin allso adds the following methods to the plot object:  
 
- setSelection(ranges, preventEvent)  
 
Set the selection rectangle. The passed in ranges is on the same  
form as returned in the "plotselected" event. If the selection  
mode is "x", you should put in either an xaxis (or x2axis) object,  
if the mode is "y" you need to put in an yaxis (or y2axis) object  
and both xaxis/x2axis and yaxis/y2axis if the selection mode is  
"xy", like this:  
 
setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });  
 
setSelection will trigger the "plotselected" event when called. If  
you don't want that to happen, e.g. if you're inside a  
"plotselected" handler, pass true as the second parameter.  
 
- clearSelection(preventEvent)  
 
Clear the selection rectangle. Pass in true to avoid getting a  
"plotunselected" event.  
 
- getSelection()  
 
Returns the current selection in the same format as the  
"plotselected" event. If there's currently no selection, the  
function returns null.  
 
*/  
 
(function ($) {  
function init(plot) {  
var selection = {  
first: { x: -1, y: -1}, second: { x: -1, y: -1},  
show: false,  
active: false  
};  
 
// FIXME: The drag handling implemented here should be  
// abstracted out, there's some similar code from a library in  
// the navigation plugin, this should be massaged a bit to fit  
// the Flot cases here better and reused. Doing this would  
// make this plugin much slimmer.  
var savedhandlers = {};  
 
function onMouseMove(e) {  
if (selection.active) {  
plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]);  
 
updateSelection(e);  
}  
}  
 
function onMouseDown(e) {  
if (e.which != 1) // only accept left-click  
return;  
 
// cancel out any text selections  
document.body.focus();  
 
// prevent text selection and drag in old-school browsers  
if (document.onselectstart !== undefined && savedhandlers.onselectstart == null) {  
savedhandlers.onselectstart = document.onselectstart;  
document.onselectstart = function () { return false; };  
}  
if (document.ondrag !== undefined && savedhandlers.ondrag == null) {  
savedhandlers.ondrag = document.ondrag;  
document.ondrag = function () { return false; };  
}  
 
setSelectionPos(selection.first, e);  
 
selection.active = true;  
 
$(document).one("mouseup", onMouseUp);  
}  
 
function onMouseUp(e) {  
// revert drag stuff for old-school browsers  
if (document.onselectstart !== undefined)  
document.onselectstart = savedhandlers.onselectstart;  
if (document.ondrag !== undefined)  
document.ondrag = savedhandlers.ondrag;  
 
// no more draggy-dee-drag  
selection.active = false;  
updateSelection(e);  
 
if (selectionIsSane())  
triggerSelectedEvent();  
else {  
// this counts as a clear  
plot.getPlaceholder().trigger("plotunselected", [ ]);  
plot.getPlaceholder().trigger("plotselecting", [ null ]);  
}  
 
return false;  
}  
 
function getSelection() {  
if (!selectionIsSane())  
return null;  
 
var x1 = Math.min(selection.first.x, selection.second.x),  
x2 = Math.max(selection.first.x, selection.second.x),  
y1 = Math.max(selection.first.y, selection.second.y),  
y2 = Math.min(selection.first.y, selection.second.y);  
 
var r = {};  
var axes = plot.getAxes();  
if (axes.xaxis.used)  
r.xaxis = { from: axes.xaxis.c2p(x1), to: axes.xaxis.c2p(x2) };  
if (axes.x2axis.used)  
r.x2axis = { from: axes.x2axis.c2p(x1), to: axes.x2axis.c2p(x2) };  
if (axes.yaxis.used)  
r.yaxis = { from: axes.yaxis.c2p(y1), to: axes.yaxis.c2p(y2) };  
if (axes.y2axis.used)  
r.y2axis = { from: axes.y2axis.c2p(y1), to: axes.y2axis.c2p(y2) };  
return r;  
}  
 
function triggerSelectedEvent() {  
var r = getSelection();  
 
plot.getPlaceholder().trigger("plotselected", [ r ]);  
 
// backwards-compat stuff, to be removed in future  
var axes = plot.getAxes();  
if (axes.xaxis.used && axes.yaxis.used)  
plot.getPlaceholder().trigger("selected", [ { x1: r.xaxis.from, y1: r.yaxis.from, x2: r.xaxis.to, y2: r.yaxis.to } ]);  
}  
 
function clamp(min, value, max) {  
return value < min? min: (value > max? max: value);  
}  
 
function setSelectionPos(pos, e) {  
var o = plot.getOptions();  
var offset = plot.getPlaceholder().offset();  
var plotOffset = plot.getPlotOffset();  
pos.x = clamp(0, e.pageX - offset.left - plotOffset.left, plot.width());  
pos.y = clamp(0, e.pageY - offset.top - plotOffset.top, plot.height());  
 
if (o.selection.mode == "y")  
pos.x = pos == selection.first? 0: plot.width();  
 
if (o.selection.mode == "x")  
pos.y = pos == selection.first? 0: plot.height();  
}  
 
function updateSelection(pos) {  
if (pos.pageX == null)  
return;  
 
setSelectionPos(selection.second, pos);  
if (selectionIsSane()) {  
selection.show = true;  
plot.triggerRedrawOverlay();  
}  
else  
clearSelection(true);  
}  
 
function clearSelection(preventEvent) {  
if (selection.show) {  
selection.show = false;  
plot.triggerRedrawOverlay();  
if (!preventEvent)  
plot.getPlaceholder().trigger("plotunselected", [ ]);  
}  
}  
 
function setSelection(ranges, preventEvent) {  
var axis, range, axes = plot.getAxes();  
var o = plot.getOptions();  
 
if (o.selection.mode == "y") {  
selection.first.x = 0;  
selection.second.x = plot.width();  
}  
else {  
axis = ranges["xaxis"]? axes["xaxis"]: (ranges["x2axis"]? axes["x2axis"]: axes["xaxis"]);  
range = ranges["xaxis"] || ranges["x2axis"] || { from:ranges["x1"], to:ranges["x2"] }  
selection.first.x = axis.p2c(Math.min(range.from, range.to));  
selection.second.x = axis.p2c(Math.max(range.from, range.to));  
}  
 
if (o.selection.mode == "x") {  
selection.first.y = 0;  
selection.second.y = plot.height();  
}  
else {  
axis = ranges["yaxis"]? axes["yaxis"]: (ranges["y2axis"]? axes["y2axis"]: axes["yaxis"]);  
range = ranges["yaxis"] || ranges["y2axis"] || { from:ranges["y1"], to:ranges["y2"] }  
selection.first.y = axis.p2c(Math.min(range.from, range.to));  
selection.second.y = axis.p2c(Math.max(range.from, range.to));  
}  
 
selection.show = true;  
plot.triggerRedrawOverlay();  
if (!preventEvent)  
triggerSelectedEvent();  
}  
 
function selectionIsSane() {  
var minSize = 5;  
return Math.abs(selection.second.x - selection.first.x) >= minSize &&  
Math.abs(selection.second.y - selection.first.y) >= minSize;  
}  
 
plot.clearSelection = clearSelection;  
plot.setSelection = setSelection;  
plot.getSelection = getSelection;  
 
plot.hooks.bindEvents.push(function(plot, eventHolder) {  
var o = plot.getOptions();  
if (o.selection.mode != null)  
eventHolder.mousemove(onMouseMove);  
 
if (o.selection.mode != null)  
eventHolder.mousedown(onMouseDown);  
});  
 
 
plot.hooks.drawOverlay.push(function (plot, ctx) {  
// draw selection  
if (selection.show && selectionIsSane()) {  
var plotOffset = plot.getPlotOffset();  
var o = plot.getOptions();  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
var c = $.color.parse(o.selection.color);  
 
ctx.strokeStyle = c.scale('a', 0.8).toString();  
ctx.lineWidth = 1;  
ctx.lineJoin = "round";  
ctx.fillStyle = c.scale('a', 0.4).toString();  
 
var x = Math.min(selection.first.x, selection.second.x),  
y = Math.min(selection.first.y, selection.second.y),  
w = Math.abs(selection.second.x - selection.first.x),  
h = Math.abs(selection.second.y - selection.first.y);  
 
ctx.fillRect(x, y, w, h);  
ctx.strokeRect(x, y, w, h);  
 
ctx.restore();  
}  
});  
}  
 
$.plot.plugins.push({  
init: init,  
options: {  
selection: {  
mode: null, // one of null, "x", "y" or "xy"  
color: "#e8cfac"  
}  
},  
name: 'selection',  
version: '1.0'  
});  
})(jQuery);  
 
(function(A){function B(J){var O={first:{x:-1,y:-1},second:{x:-1,y:-1},show:false,active:false};var L={};function D(Q){if(O.active){J.getPlaceholder().trigger("plotselecting",[F()]);K(Q)}}function M(Q){if(Q.which!=1){return }document.body.focus();if(document.onselectstart!==undefined&&L.onselectstart==null){L.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&L.ondrag==null){L.ondrag=document.ondrag;document.ondrag=function(){return false}}C(O.first,Q);O.active=true;A(document).one("mouseup",I)}function I(Q){if(document.onselectstart!==undefined){document.onselectstart=L.onselectstart}if(document.ondrag!==undefined){document.ondrag=L.ondrag}O.active=false;K(Q);if(E()){H()}else{J.getPlaceholder().trigger("plotunselected",[]);J.getPlaceholder().trigger("plotselecting",[null])}return false}function F(){if(!E()){return null}var R=Math.min(O.first.x,O.second.x),Q=Math.max(O.first.x,O.second.x),T=Math.max(O.first.y,O.second.y),S=Math.min(O.first.y,O.second.y);var U={};var V=J.getAxes();if(V.xaxis.used){U.xaxis={from:V.xaxis.c2p(R),to:V.xaxis.c2p(Q)}}if(V.x2axis.used){U.x2axis={from:V.x2axis.c2p(R),to:V.x2axis.c2p(Q)}}if(V.yaxis.used){U.yaxis={from:V.yaxis.c2p(T),to:V.yaxis.c2p(S)}}if(V.y2axis.used){U.y2axis={from:V.y2axis.c2p(T),to:V.y2axis.c2p(S)}}return U}function H(){var Q=F();J.getPlaceholder().trigger("plotselected",[Q]);var R=J.getAxes();if(R.xaxis.used&&R.yaxis.used){J.getPlaceholder().trigger("selected",[{x1:Q.xaxis.from,y1:Q.yaxis.from,x2:Q.xaxis.to,y2:Q.yaxis.to}])}}function G(R,S,Q){return S<R?R:(S>Q?Q:S)}function C(U,R){var T=J.getOptions();var S=J.getPlaceholder().offset();var Q=J.getPlotOffset();U.x=G(0,R.pageX-S.left-Q.left,J.width());U.y=G(0,R.pageY-S.top-Q.top,J.height());if(T.selection.mode=="y"){U.x=U==O.first?0:J.width()}if(T.selection.mode=="x"){U.y=U==O.first?0:J.height()}}function K(Q){if(Q.pageX==null){return }C(O.second,Q);if(E()){O.show=true;J.triggerRedrawOverlay()}else{P(true)}}function P(Q){if(O.show){O.show=false;J.triggerRedrawOverlay();if(!Q){J.getPlaceholder().trigger("plotunselected",[])}}}function N(R,Q){var T,S,U=J.getAxes();var V=J.getOptions();if(V.selection.mode=="y"){O.first.x=0;O.second.x=J.width()}else{T=R.xaxis?U.xaxis:(R.x2axis?U.x2axis:U.xaxis);S=R.xaxis||R.x2axis||{from:R.x1,to:R.x2};O.first.x=T.p2c(Math.min(S.from,S.to));O.second.x=T.p2c(Math.max(S.from,S.to))}if(V.selection.mode=="x"){O.first.y=0;O.second.y=J.height()}else{T=R.yaxis?U.yaxis:(R.y2axis?U.y2axis:U.yaxis);S=R.yaxis||R.y2axis||{from:R.y1,to:R.y2};O.first.y=T.p2c(Math.min(S.from,S.to));O.second.y=T.p2c(Math.max(S.from,S.to))}O.show=true;J.triggerRedrawOverlay();if(!Q){H()}}function E(){var Q=5;return Math.abs(O.second.x-O.first.x)>=Q&&Math.abs(O.second.y-O.first.y)>=Q}J.clearSelection=P;J.setSelection=N;J.getSelection=F;J.hooks.bindEvents.push(function(R,Q){var S=R.getOptions();if(S.selection.mode!=null){Q.mousemove(D)}if(S.selection.mode!=null){Q.mousedown(M)}});J.hooks.drawOverlay.push(function(T,Y){if(O.show&&E()){var R=T.getPlotOffset();var Q=T.getOptions();Y.save();Y.translate(R.left,R.top);var U=A.color.parse(Q.selection.color);Y.strokeStyle=U.scale("a",0.8).toString();Y.lineWidth=1;Y.lineJoin="round";Y.fillStyle=U.scale("a",0.4).toString();var W=Math.min(O.first.x,O.second.x),V=Math.min(O.first.y,O.second.y),X=Math.abs(O.second.x-O.first.x),S=Math.abs(O.second.y-O.first.y);Y.fillRect(W,V,X,S);Y.strokeRect(W,V,X,S);Y.restore()}})}A.plot.plugins.push({init:B,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.0"})})(jQuery);  
/*  
Flot plugin for stacking data sets, i.e. putting them on top of each  
other, for accumulative graphs. Note that the plugin assumes the data  
is sorted on x. Also note that stacking a mix of positive and negative  
values in most instances doesn't make sense (so it looks weird).  
 
Two or more series are stacked when their "stack" attribute is set to  
the same key (which can be any number or string or just "true"). To  
specify the default stack, you can set  
 
series: {  
stack: null or true or key (number/string)  
}  
 
or specify it for a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], stack: true ])  
 
The stacking order is determined by the order of the data series in  
the array (later series end up on top of the previous).  
 
Internally, the plugin modifies the datapoints in each series, adding  
an offset to the y value. For line series, extra data points are  
inserted through interpolation. For bar charts, the second y value is  
also adjusted.  
*/  
 
(function ($) {  
var options = {  
series: { stack: null } // or number/string  
};  
 
function init(plot) {  
function findMatchingSeries(s, allseries) {  
var res = null  
for (var i = 0; i < allseries.length; ++i) {  
if (s == allseries[i])  
break;  
 
if (allseries[i].stack == s.stack)  
res = allseries[i];  
}  
 
return res;  
}  
 
function stackData(plot, s, datapoints) {  
if (s.stack == null)  
return;  
 
var other = findMatchingSeries(s, plot.getData());  
if (!other)  
return;  
 
var ps = datapoints.pointsize,  
points = datapoints.points,  
otherps = other.datapoints.pointsize,  
otherpoints = other.datapoints.points,  
newpoints = [],  
px, py, intery, qx, qy, bottom,  
withlines = s.lines.show, withbars = s.bars.show,  
withsteps = withlines && s.lines.steps,  
i = 0, j = 0, l;  
 
while (true) {  
if (i >= points.length)  
break;  
 
l = newpoints.length;  
 
if (j >= otherpoints.length  
|| otherpoints[j] == null  
|| points[i] == null) {  
// degenerate cases  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
i += ps;  
}  
else {  
// cases where we actually got two points  
px = points[i];  
py = points[i + 1];  
qx = otherpoints[j];  
qy = otherpoints[j + 1];  
bottom = 0;  
 
if (px == qx) {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
newpoints[l + 1] += qy;  
bottom = qy;  
 
i += ps;  
j += otherps;  
}  
else if (px > qx) {  
// we got past point below, might need to  
// insert interpolated extra point  
if (withlines && i > 0 && points[i - ps] != null) {  
intery = py + (points[i - ps + 1] - py) * (qx - px) / (points[i - ps] - px);  
newpoints.push(qx);  
newpoints.push(intery + qy)  
for (m = 2; m < ps; ++m)  
newpoints.push(points[i + m]);  
bottom = qy;  
}  
 
j += otherps;  
}  
else {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
// we might be able to interpolate a point below,  
// this can give us a better y  
if (withlines && j > 0 && otherpoints[j - ps] != null)  
bottom = qy + (otherpoints[j - ps + 1] - qy) * (px - qx) / (otherpoints[j - ps] - qx);  
 
newpoints[l + 1] += bottom;  
 
i += ps;  
}  
 
if (l != newpoints.length && withbars)  
newpoints[l + 2] += bottom;  
}  
 
// maintain the line steps invariant  
if (withsteps && l != newpoints.length && l > 0  
&& newpoints[l] != null  
&& newpoints[l] != newpoints[l - ps]  
&& newpoints[l + 1] != newpoints[l - ps + 1]) {  
for (m = 0; m < ps; ++m)  
newpoints[l + ps + m] = newpoints[l + m];  
newpoints[l + 1] = newpoints[l - ps + 1];  
}  
}  
 
datapoints.points = newpoints;  
}  
 
plot.hooks.processDatapoints.push(stackData);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'stack',  
version: '1.0'  
});  
})(jQuery);  
 
(function(B){var A={series:{stack:null}};function C(F){function D(J,I){var H=null;for(var G=0;G<I.length;++G){if(J==I[G]){break}if(I[G].stack==J.stack){H=I[G]}}return H}function E(W,P,G){if(P.stack==null){return }var L=D(P,W.getData());if(!L){return }var T=G.pointsize,Y=G.points,H=L.datapoints.pointsize,S=L.datapoints.points,N=[],R,Q,I,a,Z,M,O=P.lines.show,K=P.bars.show,J=O&&P.lines.steps,X=0,V=0,U;while(true){if(X>=Y.length){break}U=N.length;if(V>=S.length||S[V]==null||Y[X]==null){for(m=0;m<T;++m){N.push(Y[X+m])}X+=T}else{R=Y[X];Q=Y[X+1];a=S[V];Z=S[V+1];M=0;if(R==a){for(m=0;m<T;++m){N.push(Y[X+m])}N[U+1]+=Z;M=Z;X+=T;V+=H}else{if(R>a){if(O&&X>0&&Y[X-T]!=null){I=Q+(Y[X-T+1]-Q)*(a-R)/(Y[X-T]-R);N.push(a);N.push(I+Z);for(m=2;m<T;++m){N.push(Y[X+m])}M=Z}V+=H}else{for(m=0;m<T;++m){N.push(Y[X+m])}if(O&&V>0&&S[V-T]!=null){M=Z+(S[V-T+1]-Z)*(R-a)/(S[V-T]-a)}N[U+1]+=M;X+=T}}if(U!=N.length&&K){N[U+2]+=M}}if(J&&U!=N.length&&U>0&&N[U]!=null&&N[U]!=N[U-T]&&N[U+1]!=N[U-T+1]){for(m=0;m<T;++m){N[U+T+m]=N[U+m]}N[U+1]=N[U-T+1]}}G.points=N}F.hooks.processDatapoints.push(E)}B.plot.plugins.push({init:C,options:A,name:"stack",version:"1.0"})})(jQuery);  
/*  
Flot plugin for thresholding data. Controlled through the option  
"threshold" in either the global series options  
 
series: {  
threshold: {  
below: number  
color: colorspec  
}  
}  
 
or in a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], threshold: { ... }}])  
 
The data points below "below" are drawn with the specified color. This  
makes it easy to mark points below 0, e.g. for budget data.  
 
Internally, the plugin works by splitting the data into two series,  
above and below the threshold. The extra series below the threshold  
will have its label cleared and the special "originSeries" attribute  
set to the original series. You may need to check for this in hover  
events.  
*/  
 
(function ($) {  
var options = {  
series: { threshold: null } // or { below: number, color: color spec}  
};  
 
function init(plot) {  
function thresholdData(plot, s, datapoints) {  
if (!s.threshold)  
return;  
 
var ps = datapoints.pointsize, i, x, y, p, prevp,  
thresholded = $.extend({}, s); // note: shallow copy  
 
thresholded.datapoints = { points: [], pointsize: ps };  
thresholded.label = null;  
thresholded.color = s.threshold.color;  
thresholded.threshold = null;  
thresholded.originSeries = s;  
thresholded.data = [];  
 
var below = s.threshold.below,  
origpoints = datapoints.points,  
addCrossingPoints = s.lines.show;  
 
threspoints = [];  
newpoints = [];  
 
for (i = 0; i < origpoints.length; i += ps) {  
x = origpoints[i]  
y = origpoints[i + 1];  
 
prevp = p;  
if (y < below)  
p = threspoints;  
else  
p = newpoints;  
 
if (addCrossingPoints && prevp != p && x != null  
&& i > 0 && origpoints[i - ps] != null) {  
var interx = (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]) * (below - y) + x;  
prevp.push(interx);  
prevp.push(below);  
for (m = 2; m < ps; ++m)  
prevp.push(origpoints[i + m]);  
 
p.push(null); // start new segment  
p.push(null);  
for (m = 2; m < ps; ++m)  
p.push(origpoints[i + m]);  
p.push(interx);  
p.push(below);  
for (m = 2; m < ps; ++m)  
p.push(origpoints[i + m]);  
}  
 
p.push(x);  
p.push(y);  
}  
 
datapoints.points = newpoints;  
thresholded.datapoints.points = threspoints;  
 
if (thresholded.datapoints.points.length > 0)  
plot.getData().push(thresholded);  
 
// FIXME: there are probably some edge cases left in bars  
}  
 
plot.hooks.processDatapoints.push(thresholdData);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'threshold',  
version: '1.0'  
});  
})(jQuery);  
 
(function(B){var A={series:{threshold:null}};function C(D){function E(L,S,M){if(!S.threshold){return }var F=M.pointsize,I,O,N,G,K,H=B.extend({},S);H.datapoints={points:[],pointsize:F};H.label=null;H.color=S.threshold.color;H.threshold=null;H.originSeries=S;H.data=[];var P=S.threshold.below,Q=M.points,R=S.lines.show;threspoints=[];newpoints=[];for(I=0;I<Q.length;I+=F){O=Q[I];N=Q[I+1];K=G;if(N<P){G=threspoints}else{G=newpoints}if(R&&K!=G&&O!=null&&I>0&&Q[I-F]!=null){var J=(O-Q[I-F])/(N-Q[I-F+1])*(P-N)+O;K.push(J);K.push(P);for(m=2;m<F;++m){K.push(Q[I+m])}G.push(null);G.push(null);for(m=2;m<F;++m){G.push(Q[I+m])}G.push(J);G.push(P);for(m=2;m<F;++m){G.push(Q[I+m])}}G.push(O);G.push(N)}M.points=newpoints;H.datapoints.points=threspoints;if(H.datapoints.points.length>0){L.getData().push(H)}}D.hooks.processDatapoints.push(E)}B.plot.plugins.push({init:C,options:A,name:"threshold",version:"1.0"})})(jQuery);  
/*!  
* 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  
// Will speed up references to window, and allows munging its name.  
window = this,  
// Will speed up references to undefined, and allows munging its name.  
undefined,  
// Map over jQuery in case of overwrite  
_jQuery = window.jQuery,  
// Map over the $ in case of overwrite  
_$ = window.$,  
 
jQuery = window.jQuery = window.$ = function( selector, context ) {  
// The jQuery object is actually just the init constructor 'enhanced'  
return new jQuery.fn.init( selector, context );  
},  
 
// A simple way to check for HTML strings or ID strings  
// (both of which we optimize for)  
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,  
// Is it a simple selector  
isSimple = /^.[^:#\[\.,]*$/;  
 
jQuery.fn = jQuery.prototype = {  
init: function( selector, context ) {  
// Make sure that a selection was provided  
selector = selector || document;  
 
// Handle $(DOMElement)  
if ( selector.nodeType ) {  
this[0] = selector;  
this.length = 1;  
this.context = selector;  
return this;  
}  
// Handle HTML strings  
if ( typeof selector === "string" ) {  
// Are we dealing with HTML string or an ID?  
var match = quickExpr.exec( selector );  
 
// Verify a match, and that no context was specified for #id  
if ( match && (match[1] || !context) ) {  
 
// HANDLE: $(html) -> $(array)  
if ( match[1] )  
selector = jQuery.clean( [ match[1] ], context );  
 
// HANDLE: $("#id")  
else {  
var elem = document.getElementById( match[3] );  
 
// Handle the case where IE and Opera return items  
// by name instead of ID  
if ( elem && elem.id != match[3] )  
return jQuery().find( selector );  
 
// Otherwise, we inject the element directly into the jQuery object  
var ret = jQuery( elem || [] );  
ret.context = document;  
ret.selector = selector;  
return ret;  
}  
 
// HANDLE: $(expr, [context])  
// (which is just equivalent to: $(content).find(expr)  
} else  
return jQuery( context ).find( selector );  
 
// HANDLE: $(function)  
// Shortcut for document ready  
} else if ( jQuery.isFunction( selector ) )  
return jQuery( document ).ready( selector );  
 
// Make sure that old selector state is passed along  
if ( selector.selector && selector.context ) {  
this.selector = selector.selector;  
this.context = selector.context;  
}  
 
return this.setArray(jQuery.isArray( selector ) ?  
selector :  
jQuery.makeArray(selector));  
},  
 
// Start with an empty selector  
selector: "",  
 
// The current version of jQuery being used  
jquery: "1.3.2",  
 
// The number of elements contained in the matched element set  
size: function() {  
return this.length;  
},  
 
// Get the Nth element in the matched element set OR  
// Get the whole matched element set as a clean array  
get: function( num ) {  
return num === undefined ?  
 
// Return a 'clean' array  
Array.prototype.slice.call( this ) :  
 
// Return just the object  
this[ num ];  
},  
 
// Take an array of elements and push it onto the stack  
// (returning the new matched element set)  
pushStack: function( elems, name, selector ) {  
// Build a new jQuery matched element set  
var ret = jQuery( elems );  
 
// Add the old object onto the stack (as a reference)  
ret.prevObject = this;  
 
ret.context = this.context;  
 
if ( name === "find" )  
ret.selector = this.selector + (this.selector ? " " : "") + selector;  
else if ( name )  
ret.selector = this.selector + "." + name + "(" + selector + ")";  
 
// Return the newly-formed element set  
return ret;  
},  
 
// Force the current matched set of elements to become  
// the specified array of elements (destroying the stack in the process)  
// You should use pushStack() in order to do this, but maintain the stack  
setArray: function( elems ) {  
// Resetting the length to 0, then using the native Array push  
// is a super-fast way to populate an object with array-like properties  
this.length = 0;  
Array.prototype.push.apply( this, elems );  
 
return this;  
},  
 
// Execute a callback for every element in the matched set.  
// (You can seed the arguments with an array of args, but this is  
// only used internally.)  
each: function( callback, args ) {  
return jQuery.each( this, callback, args );  
},  
 
// Determine the position of an element within  
// the matched set of elements  
index: function( elem ) {  
// Locate the position of the desired element  
return jQuery.inArray(  
// If it receives a jQuery object, the first element is used  
elem && elem.jquery ? elem[0] : elem  
, this );  
},  
 
attr: function( name, value, type ) {  
var options = name;  
 
// Look for the case where we're accessing a style value  
if ( typeof name === "string" )  
if ( value === undefined )  
return this[0] && jQuery[ type || "attr" ]( this[0], name );  
 
else {  
options = {};  
options[ name ] = value;  
}  
 
// Check to see if we're setting style values  
return this.each(function(i){  
// Set all the styles  
for ( name in options )  
jQuery.attr(  
type ?  
this.style :  
this,  
name, jQuery.prop( this, options[ name ], type, i, name )  
);  
});  
},  
 
css: function( key, value ) {  
// ignore negative width and height values  
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )  
value = undefined;  
return this.attr( key, value, "curCSS" );  
},  
 
text: function( text ) {  
if ( typeof text !== "object" && text != null )  
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );  
 
var ret = "";  
 
jQuery.each( text || this, function(){  
jQuery.each( this.childNodes, function(){  
if ( this.nodeType != 8 )  
ret += this.nodeType != 1 ?  
this.nodeValue :  
jQuery.fn.text( [ this ] );  
});  
});  
 
return ret;  
},  
 
wrapAll: function( html ) {  
if ( this[0] ) {  
// The elements to wrap the target around  
var wrap = jQuery( html, this[0].ownerDocument ).clone();  
 
if ( this[0].parentNode )  
wrap.insertBefore( this[0] );  
 
wrap.map(function(){  
var elem = this;  
 
while ( elem.firstChild )  
elem = elem.firstChild;  
 
return elem;  
}).append(this);  
}  
 
return this;  
},  
 
wrapInner: function( html ) {  
return this.each(function(){  
jQuery( this ).contents().wrapAll( html );  
});  
},  
 
wrap: function( html ) {  
return this.each(function(){  
jQuery( this ).wrapAll( html );  
});  
},  
 
append: function() {  
return this.domManip(arguments, true, function(elem){  
if (this.nodeType == 1)  
this.appendChild( elem );  
});  
},  
 
prepend: function() {  
return this.domManip(arguments, true, function(elem){  
if (this.nodeType == 1)  
this.insertBefore( elem, this.firstChild );  
});  
},  
 
before: function() {  
return this.domManip(arguments, false, function(elem){  
this.parentNode.insertBefore( elem, this );  
});  
},  
 
after: function() {  
return this.domManip(arguments, false, function(elem){  
this.parentNode.insertBefore( elem, this.nextSibling );  
});  
},  
 
end: function() {  
return this.prevObject || jQuery( [] );  
},  
 
// For internal use only.  
// Behaves like an Array's method, not like a jQuery method.  
push: [].push,  
sort: [].sort,  
splice: [].splice,  
 
find: function( selector ) {  
if ( this.length === 1 ) {  
var ret = this.pushStack( [], "find", selector );  
ret.length = 0;  
jQuery.find( selector, this[0], ret );  
return ret;  
} else {  
return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){  
return jQuery.find( selector, elem );  
})), "find", selector );  
}  
},  
 
clone: function( events ) {  
// Do the clone  
var ret = this.map(function(){  
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {  
// IE copies events bound via attachEvent when  
// using cloneNode. Calling detachEvent on the  
// clone will also remove the events from the orignal  
// In order to get around this, we use innerHTML.  
// Unfortunately, this means some modifications to  
// attributes in IE that are actually only stored  
// as properties will not be copied (such as the  
// the name attribute on an input).  
var html = this.outerHTML;  
if ( !html ) {  
var div = this.ownerDocument.createElement("div");  
div.appendChild( this.cloneNode(true) );  
html = div.innerHTML;  
}  
 
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];  
} else  
return this.cloneNode(true);  
});  
 
// Copy the events from the original to the clone  
if ( events === true ) {  
var orig = this.find("*").andSelf(), i = 0;  
 
ret.find("*").andSelf().each(function(){  
if ( this.nodeName !== orig[i].nodeName )  
return;  
 
var events = jQuery.data( orig[i], "events" );  
 
for ( var type in events ) {  
for ( var handler in events[ type ] ) {  
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );  
}  
}  
 
i++;  
});  
}  
 
// Return the cloned set  
return ret;  
},  
 
filter: function( selector ) {  
return this.pushStack(  
jQuery.isFunction( selector ) &&  
jQuery.grep(this, function(elem, i){  
return selector.call( elem, i );  
}) ||  
 
jQuery.multiFilter( selector, jQuery.grep(this, function(elem){  
return elem.nodeType === 1;  
}) ), "filter", selector );  
},  
 
closest: function( selector ) {  
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,  
closer = 0;  
 
return this.map(function(){  
var cur = this;  
while ( cur && cur.ownerDocument ) {  
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {  
jQuery.data(cur, "closest", closer);  
return cur;  
}  
cur = cur.parentNode;  
closer++;  
}  
});  
},  
 
not: function( selector ) {  
if ( typeof selector === "string" )  
// test special case where just one selector is passed in  
if ( isSimple.test( selector ) )  
return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );  
else  
selector = jQuery.multiFilter( selector, this );  
 
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;  
return this.filter(function() {  
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;  
});  
},  
 
add: function( selector ) {  
return this.pushStack( jQuery.unique( jQuery.merge(  
this.get(),  
typeof selector === "string" ?  
jQuery( selector ) :  
jQuery.makeArray( selector )  
)));  
},  
 
is: function( selector ) {  
return !!selector && jQuery.multiFilter( selector, this ).length > 0;  
},  
 
hasClass: function( selector ) {  
return !!selector && this.is( "." + selector );  
},  
 
val: function( value ) {  
if ( value === undefined ) {  
var elem = this[0];  
 
if ( elem ) {  
if( jQuery.nodeName( elem, 'option' ) )  
return (elem.attributes.value || {}).specified ? elem.value : elem.text;  
 
// We need to handle select boxes special  
if ( jQuery.nodeName( elem, "select" ) ) {  
var index = elem.selectedIndex,  
values = [],  
options = elem.options,  
one = elem.type == "select-one";  
 
// Nothing was selected  
if ( index < 0 )  
return null;  
 
// Loop through all the selected options  
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {  
var option = options[ i ];  
 
if ( option.selected ) {  
// Get the specifc value for the option  
value = jQuery(option).val();  
 
// We don't need an array for one selects  
if ( one )  
return value;  
 
// Multi-Selects return an array  
values.push( value );  
}  
}  
 
return values;  
}  
 
// Everything else, we just grab the value  
return (elem.value || "").replace(/\r/g, "");  
 
}  
 
return undefined;  
}  
 
if ( typeof value === "number" )  
value += '';  
 
return this.each(function(){  
if ( this.nodeType != 1 )  
return;  
 
if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )  
this.checked = (jQuery.inArray(this.value, value) >= 0 ||  
jQuery.inArray(this.name, value) >= 0);  
 
else if ( jQuery.nodeName( this, "select" ) ) {  
var values = jQuery.makeArray(value);  
 
jQuery( "option", this ).each(function(){  
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||  
jQuery.inArray( this.text, values ) >= 0);  
});  
 
if ( !values.length )  
this.selectedIndex = -1;  
 
} else  
this.value = value;  
});  
},  
 
html: function( value ) {  
return value === undefined ?  
(this[0] ?  
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :  
null) :  
this.empty().append( value );  
},  
 
replaceWith: function( value ) {  
return this.after( value ).remove();  
},  
 
eq: function( i ) {  
return this.slice( i, +i + 1 );  
},  
 
slice: function() {  
return this.pushStack( Array.prototype.slice.apply( this, arguments ),  
"slice", Array.prototype.slice.call(arguments).join(",") );  
},  
 
map: function( callback ) {  
return this.pushStack( jQuery.map(this, function(elem, i){  
return callback.call( elem, i, elem );  
}));  
},  
 
andSelf: function() {  
return this.add( this.prevObject );  
},  
 
domManip: function( args, table, callback ) {  
if ( this[0] ) {  
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),  
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),  
first = fragment.firstChild;  
 
if ( first )  
for ( var i = 0, l = this.length; i < l; i++ )  
callback.call( root(this[i], first), this.length > 1 || i > 0 ?  
fragment.cloneNode(true) : fragment );  
 
if ( scripts )  
jQuery.each( scripts, evalScript );  
}  
 
return this;  
 
function root( elem, cur ) {  
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?  
(elem.getElementsByTagName("tbody")[0] ||  
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :  
elem;  
}  
}  
};  
 
// Give the init function the jQuery prototype for later instantiation  
jQuery.fn.init.prototype = jQuery.fn;  
 
function evalScript( i, elem ) {  
if ( elem.src )  
jQuery.ajax({  
url: elem.src,  
async: false,  
dataType: "script"  
});  
 
else  
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );  
 
if ( elem.parentNode )  
elem.parentNode.removeChild( elem );  
}  
 
function now(){  
return +new Date;  
}  
 
jQuery.extend = jQuery.fn.extend = function() {  
// copy reference to target object  
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;  
 
// Handle a deep copy situation  
if ( typeof target === "boolean" ) {  
deep = target;  
target = arguments[1] || {};  
// skip the boolean and the target  
i = 2;  
}  
 
// Handle case when target is a string or something (possible in deep copy)  
if ( typeof target !== "object" && !jQuery.isFunction(target) )  
target = {};  
 
// extend jQuery itself if only one argument is passed  
if ( length == i ) {  
target = this;  
--i;  
}  
 
for ( ; i < length; i++ )  
// Only deal with non-null/undefined values  
if ( (options = arguments[ i ]) != null )  
// Extend the base object  
for ( var name in options ) {  
var src = target[ name ], copy = options[ name ];  
 
// Prevent never-ending loop  
if ( target === copy )  
continue;  
 
// Recurse if we're merging object values  
if ( deep && copy && typeof copy === "object" && !copy.nodeType )  
target[ name ] = jQuery.extend( deep,  
// Never move original objects, clone them  
src || ( copy.length != null ? [ ] : { } )  
, copy );  
 
// Don't bring in undefined values  
else if ( copy !== undefined )  
target[ name ] = copy;  
 
}  
 
// Return the modified object  
return target;  
};  
 
// exclude the following css properties to add px  
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,  
// cache defaultView  
defaultView = document.defaultView || {},  
toString = Object.prototype.toString;  
 
jQuery.extend({  
noConflict: function( deep ) {  
window.$ = _$;  
 
if ( deep )  
window.jQuery = _jQuery;  
 
return jQuery;  
},  
 
// See test/unit/core.js for details concerning isFunction.  
// Since version 1.3, DOM methods and functions like alert  
// aren't supported. They return false on IE (#2968).  
isFunction: function( obj ) {  
return toString.call(obj) === "[object Function]";  
},  
 
isArray: function( obj ) {  
return toString.call(obj) === "[object Array]";  
},  
 
// check if an element is in a (or is an) XML document  
isXMLDoc: function( elem ) {  
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||  
!!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );  
},  
 
// Evalulates a script in a global context  
globalEval: function( data ) {  
if ( data && /\S/.test(data) ) {  
// Inspired by code by Andrea Giammarchi  
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html  
var head = document.getElementsByTagName("head")[0] || document.documentElement,  
script = document.createElement("script");  
 
script.type = "text/javascript";  
if ( jQuery.support.scriptEval )  
script.appendChild( document.createTextNode( data ) );  
else  
script.text = data;  
 
// Use insertBefore instead of appendChild to circumvent an IE6 bug.  
// This arises when a base node is used (#2709).  
head.insertBefore( script, head.firstChild );  
head.removeChild( script );  
}  
},  
 
nodeName: function( elem, name ) {  
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();  
},  
 
// args is for internal usage only  
each: function( object, callback, args ) {  
var name, i = 0, length = object.length;  
 
if ( args ) {  
if ( length === undefined ) {  
for ( name in object )  
if ( callback.apply( object[ name ], args ) === false )  
break;  
} else  
for ( ; i < length; )  
if ( callback.apply( object[ i++ ], args ) === false )  
break;  
 
// A special, fast, case for the most common use of each  
} else {  
if ( length === undefined ) {  
for ( name in object )  
if ( callback.call( object[ name ], name, object[ name ] ) === false )  
break;  
} else  
for ( var value = object[0];  
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}  
}  
 
return object;  
},  
 
prop: function( elem, value, type, i, name ) {  
// Handle executable functions  
if ( jQuery.isFunction( value ) )  
value = value.call( elem, i );  
 
// Handle passing in a number to a CSS property  
return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?  
value + "px" :  
value;  
},  
 
className: {  
// internal only, use addClass("class")  
add: function( elem, classNames ) {  
jQuery.each((classNames || "").split(/\s+/), function(i, className){  
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )  
elem.className += (elem.className ? " " : "") + className;  
});  
},  
 
// internal only, use removeClass("class")  
remove: function( elem, classNames ) {  
if (elem.nodeType == 1)  
elem.className = classNames !== undefined ?  
jQuery.grep(elem.className.split(/\s+/), function(className){  
return !jQuery.className.has( classNames, className );  
}).join(" ") :  
"";  
},  
 
// internal only, use hasClass("class")  
has: function( elem, className ) {  
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;  
}  
},  
 
// A method for quickly swapping in/out CSS properties to get correct calculations  
swap: function( elem, options, callback ) {  
var old = {};  
// Remember the old values, and insert the new ones  
for ( var name in options ) {  
old[ name ] = elem.style[ name ];  
elem.style[ name ] = options[ name ];  
}  
 
callback.call( elem );  
 
// Revert the old values  
for ( var name in options )  
elem.style[ name ] = old[ name ];  
},  
 
css: function( elem, name, force, extra ) {  
if ( name == "width" || name == "height" ) {  
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];  
 
function getWH() {  
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;  
 
if ( extra === "border" )  
return;  
 
jQuery.each( which, function() {  
if ( !extra )  
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;  
if ( extra === "margin" )  
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;  
else  
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;  
});  
}  
 
if ( elem.offsetWidth !== 0 )  
getWH();  
else  
jQuery.swap( elem, props, getWH );  
 
return Math.max(0, Math.round(val));  
}  
 
return jQuery.curCSS( elem, name, force );  
},  
 
curCSS: function( elem, name, force ) {  
var ret, style = elem.style;  
 
// We need to handle opacity special in IE  
if ( name == "opacity" && !jQuery.support.opacity ) {  
ret = jQuery.attr( style, "opacity" );  
 
return ret == "" ?  
"1" :  
ret;  
}  
 
// Make sure we're using the right name for getting the float value  
if ( name.match( /float/i ) )  
name = styleFloat;  
 
if ( !force && style && style[ name ] )  
ret = style[ name ];  
 
else if ( defaultView.getComputedStyle ) {  
 
// Only "float" is needed here  
if ( name.match( /float/i ) )  
name = "float";  
 
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();  
 
var computedStyle = defaultView.getComputedStyle( elem, null );  
 
if ( computedStyle )  
ret = computedStyle.getPropertyValue( name );  
 
// We should always get a number back from opacity  
if ( name == "opacity" && ret == "" )  
ret = "1";  
 
} else if ( elem.currentStyle ) {  
var camelCase = name.replace(/\-(\w)/g, function(all, letter){  
return letter.toUpperCase();  
});  
 
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];  
 
// From the awesome hack by Dean Edwards  
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291  
 
// If we're not dealing with a regular pixel number  
// but a number that has a weird ending, we need to convert it to pixels  
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {  
// Remember the original values  
var left = style.left, rsLeft = elem.runtimeStyle.left;  
 
// Put in the new values to get a computed value out  
elem.runtimeStyle.left = elem.currentStyle.left;  
style.left = ret || 0;  
ret = style.pixelLeft + "px";  
 
// Revert the changed values  
style.left = left;  
elem.runtimeStyle.left = rsLeft;  
}  
}  
 
return ret;  
},  
 
clean: function( elems, context, fragment ) {  
context = context || document;  
 
// !context.createElement fails in IE with an error but returns typeof 'object'  
if ( typeof context.createElement === "undefined" )  
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;  
 
// If a single string is passed in and it's a single tag  
// just do a createElement and skip the rest  
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {  
var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);  
if ( match )  
return [ context.createElement( match[1] ) ];  
}  
 
var ret = [], scripts = [], div = context.createElement("div");  
 
jQuery.each(elems, function(i, elem){  
if ( typeof elem === "number" )  
elem += '';  
 
if ( !elem )  
return;  
 
// Convert html string into DOM nodes  
if ( typeof elem === "string" ) {  
// Fix "XHTML"-style tags in all browsers  
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){  
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?  
all :  
front + "></" + tag + ">";  
});  
 
// Trim whitespace, otherwise indexOf won't work as expected  
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();  
 
var wrap =  
// option or optgroup  
!tags.indexOf("<opt") &&  
[ 1, "<select multiple='multiple'>", "</select>" ] ||  
 
!tags.indexOf("<leg") &&  
[ 1, "<fieldset>", "</fieldset>" ] ||  
 
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&  
[ 1, "<table>", "</table>" ] ||  
 
!tags.indexOf("<tr") &&  
[ 2, "<table><tbody>", "</tbody></table>" ] ||  
 
// <thead> matched above  
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&  
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||  
 
!tags.indexOf("<col") &&  
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||  
 
// IE can't serialize <link> and <script> tags normally  
!jQuery.support.htmlSerialize &&  
[ 1, "div<div>", "</div>" ] ||  
 
[ 0, "", "" ];  
 
// Go to html and back, then peel off extra wrappers  
div.innerHTML = wrap[1] + elem + wrap[2];  
 
// Move to the right depth  
while ( wrap[0]-- )  
div = div.lastChild;  
 
// Remove IE's autoinserted <tbody> from table fragments  
if ( !jQuery.support.tbody ) {  
 
// String was a <table>, *may* have spurious <tbody>  
var hasBody = /<tbody/i.test(elem),  
tbody = !tags.indexOf("<table") && !hasBody ?  
div.firstChild && div.firstChild.childNodes :  
 
// String was a bare <thead> or <tfoot>  
wrap[1] == "<table>" && !hasBody ?  
div.childNodes :  
[];  
 
for ( var j = tbody.length - 1; j >= 0 ; --j )  
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )  
tbody[ j ].parentNode.removeChild( tbody[ j ] );  
 
}  
 
// IE completely kills leading whitespace when innerHTML is used  
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )  
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );  
 
elem = jQuery.makeArray( div.childNodes );  
}  
 
if ( elem.nodeType )  
ret.push( elem );  
else  
ret = jQuery.merge( ret, elem );  
 
});  
 
if ( fragment ) {  
for ( var i = 0; ret[i]; i++ ) {  
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {  
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );  
} else {  
if ( ret[i].nodeType === 1 )  
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );  
fragment.appendChild( ret[i] );  
}  
}  
 
return scripts;  
}  
 
return ret;  
},  
 
attr: function( elem, name, value ) {  
// don't set attributes on text and comment nodes  
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)  
return undefined;  
 
var notxml = !jQuery.isXMLDoc( elem ),  
// Whether we are setting (or getting)  
set = value !== undefined;  
 
// Try to normalize/fix the name  
name = notxml && jQuery.props[ name ] || name;  
 
// Only do all the following if this is a node (faster for style)  
// IE elem.getAttribute passes even for style  
if ( elem.tagName ) {  
 
// These attributes require special treatment  
var special = /href|src|style/.test( name );  
 
// Safari mis-reports the default selected property of a hidden option  
// Accessing the parent's selectedIndex property fixes it  
if ( name == "selected" && elem.parentNode )  
elem.parentNode.selectedIndex;  
 
// If applicable, access the attribute via the DOM 0 way  
if ( name in elem && notxml && !special ) {  
if ( set ){  
// We can't allow the type property to be changed (since it causes problems in IE)  
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )  
throw "type property can't be changed";  
 
elem[ name ] = value;  
}  
 
// browsers index elements by id/name on forms, give priority to attributes.  
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )  
return elem.getAttributeNode( name ).nodeValue;  
 
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set  
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/  
if ( name == "tabIndex" ) {  
var attributeNode = elem.getAttributeNode( "tabIndex" );  
return attributeNode && attributeNode.specified  
? attributeNode.value  
: elem.nodeName.match(/(button|input|object|select|textarea)/i)  
? 0  
: elem.nodeName.match(/^(a|area)$/i) && elem.href  
? 0  
: undefined;  
}  
 
return elem[ name ];  
}  
 
if ( !jQuery.support.style && notxml && name == "style" )  
return jQuery.attr( elem.style, "cssText", value );  
 
if ( set )  
// convert the value to a string (all browsers do this but IE) see #1070  
elem.setAttribute( name, "" + value );  
 
var attr = !jQuery.support.hrefNormalized && notxml && special  
// Some attributes require a special call on IE  
? elem.getAttribute( name, 2 )  
: elem.getAttribute( name );  
 
// Non-existent attributes return null, we normalize to undefined  
return attr === null ? undefined : attr;  
}  
 
// elem is actually elem.style ... set the style  
 
// IE uses filters for opacity  
if ( !jQuery.support.opacity && name == "opacity" ) {  
if ( set ) {  
// IE has trouble with opacity if it does not have layout  
// Force it by setting the zoom level  
elem.zoom = 1;  
 
// Set the alpha filter to set the opacity  
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +  
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");  
}  
 
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?  
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':  
"";  
}  
 
name = name.replace(/-([a-z])/ig, function(all, letter){  
return letter.toUpperCase();  
});  
 
if ( set )  
elem[ name ] = value;  
 
return elem[ name ];  
},  
 
trim: function( text ) {  
return (text || "").replace( /^\s+|\s+$/g, "" );  
},  
 
makeArray: function( array ) {  
var ret = [];  
 
if( array != null ){  
var i = array.length;  
// The window, strings (and functions) also have 'length'  
if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )  
ret[0] = array;  
else  
while( i )  
ret[--i] = array[i];  
}  
 
return ret;  
},  
 
inArray: function( elem, array ) {  
for ( var i = 0, length = array.length; i < length; i++ )  
// Use === because on IE, window == document  
if ( array[ i ] === elem )  
return i;  
 
return -1;  
},  
 
merge: function( first, second ) {  
// We have to loop this way because IE & Opera overwrite the length  
// expando of getElementsByTagName  
var i = 0, elem, pos = first.length;  
// Also, we need to make sure that the correct elements are being returned  
// (IE returns comment nodes in a '*' query)  
if ( !jQuery.support.getAll ) {  
while ( (elem = second[ i++ ]) != null )  
if ( elem.nodeType != 8 )  
first[ pos++ ] = elem;  
 
} else  
while ( (elem = second[ i++ ]) != null )  
first[ pos++ ] = elem;  
 
return first;  
},  
 
unique: function( array ) {  
var ret = [], done = {};  
 
try {  
 
for ( var i = 0, length = array.length; i < length; i++ ) {  
var id = jQuery.data( array[ i ] );  
 
if ( !done[ id ] ) {  
done[ id ] = true;  
ret.push( array[ i ] );  
}  
}  
 
} catch( e ) {  
ret = array;  
}  
 
return ret;  
},  
 
grep: function( elems, callback, inv ) {  
var ret = [];  
 
// Go through the array, only saving the items  
// that pass the validator function  
for ( var i = 0, length = elems.length; i < length; i++ )  
if ( !inv != !callback( elems[ i ], i ) )  
ret.push( elems[ i ] );  
 
return ret;  
},  
 
map: function( elems, callback ) {  
var ret = [];  
 
// Go through the array, translating each of the items to their  
// new value (or values).  
for ( var i = 0, length = elems.length; i < length; i++ ) {  
var value = callback( elems[ i ], i );  
 
if ( value != null )  
ret[ ret.length ] = value;  
}  
 
return ret.concat.apply( [], ret );  
}  
});  
 
// Use of jQuery.browser is deprecated.  
// It's included for backwards compatibility and plugins,  
// although they should work to migrate away.  
 
var userAgent = navigator.userAgent.toLowerCase();  
 
// Figure out what browser is being used  
jQuery.browser = {  
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],  
safari: /webkit/.test( userAgent ),  
opera: /opera/.test( userAgent ),  
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),  
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )  
};  
 
jQuery.each({  
parent: function(elem){return elem.parentNode;},  
parents: function(elem){return jQuery.dir(elem,"parentNode");},  
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},  
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},  
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},  
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},  
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},  
children: function(elem){return jQuery.sibling(elem.firstChild);},  
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}  
}, function(name, fn){  
jQuery.fn[ name ] = function( selector ) {  
var ret = jQuery.map( this, fn );  
 
if ( selector && typeof selector == "string" )  
ret = jQuery.multiFilter( selector, ret );  
 
return this.pushStack( jQuery.unique( ret ), name, selector );  
};  
});  
 
jQuery.each({  
appendTo: "append",  
prependTo: "prepend",  
insertBefore: "before",  
insertAfter: "after",  
replaceAll: "replaceWith"  
}, function(name, original){  
jQuery.fn[ name ] = function( selector ) {  
var ret = [], insert = jQuery( selector );  
 
for ( var i = 0, l = insert.length; i < l; i++ ) {  
var elems = (i > 0 ? this.clone(true) : this).get();  
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );  
ret = ret.concat( elems );  
}  
 
return this.pushStack( ret, name, selector );  
};  
});  
 
jQuery.each({  
removeAttr: function( name ) {  
jQuery.attr( this, name, "" );  
if (this.nodeType == 1)  
this.removeAttribute( name );  
},  
 
addClass: function( classNames ) {  
jQuery.className.add( this, classNames );  
},  
 
removeClass: function( classNames ) {  
jQuery.className.remove( this, classNames );  
},  
 
toggleClass: function( classNames, state ) {  
if( typeof state !== "boolean" )  
state = !jQuery.className.has( this, classNames );  
jQuery.className[ state ? "add" : "remove" ]( this, classNames );  
},  
 
remove: function( selector ) {  
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {  
// Prevent memory leaks  
jQuery( "*", this ).add([this]).each(function(){  
jQuery.event.remove(this);  
jQuery.removeData(this);  
});  
if (this.parentNode)  
this.parentNode.removeChild( this );  
}  
},  
 
empty: function() {  
// Remove element nodes and prevent memory leaks  
jQuery(this).children().remove();  
 
// Remove any remaining nodes  
while ( this.firstChild )  
this.removeChild( this.firstChild );  
}  
}, function(name, fn){  
jQuery.fn[ name ] = function(){  
return this.each( fn, arguments );  
};  
});  
 
// Helper function used by the dimensions and offset modules  
function num(elem, prop) {  
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;  
}  
var expando = "jQuery" + now(), uuid = 0, windowData = {};  
 
jQuery.extend({  
cache: {},  
 
data: function( elem, name, data ) {  
elem = elem == window ?  
windowData :  
elem;  
 
var id = elem[ expando ];  
 
// Compute a unique ID for the element  
if ( !id )  
id = elem[ expando ] = ++uuid;  
 
// Only generate the data cache if we're  
// trying to access or manipulate it  
if ( name && !jQuery.cache[ id ] )  
jQuery.cache[ id ] = {};  
 
// Prevent overriding the named cache with undefined values  
if ( data !== undefined )  
jQuery.cache[ id ][ name ] = data;  
 
// Return the named cache data, or the ID for the element  
return name ?  
jQuery.cache[ id ][ name ] :  
id;  
},  
 
removeData: function( elem, name ) {  
elem = elem == window ?  
windowData :  
elem;  
 
var id = elem[ expando ];  
 
// If we want to remove a specific section of the element's data  
if ( name ) {  
if ( jQuery.cache[ id ] ) {  
// Remove the section of cache data  
delete jQuery.cache[ id ][ name ];  
 
// If we've removed all the data, remove the element's cache  
name = "";  
 
for ( name in jQuery.cache[ id ] )  
break;  
 
if ( !name )  
jQuery.removeData( elem );  
}  
 
// Otherwise, we want to remove all of the element's data  
} else {  
// Clean up the element expando  
try {  
delete elem[ expando ];  
} catch(e){  
// IE has trouble directly removing the expando  
// but it's ok with using removeAttribute  
if ( elem.removeAttribute )  
elem.removeAttribute( expando );  
}  
 
// Completely remove the data cache  
delete jQuery.cache[ id ];  
}  
},  
queue: function( elem, type, data ) {  
if ( elem ){  
 
type = (type || "fx") + "queue";  
 
var q = jQuery.data( elem, type );  
 
if ( !q || jQuery.isArray(data) )  
q = jQuery.data( elem, type, jQuery.makeArray(data) );  
else if( data )  
q.push( data );  
 
}  
return q;  
},  
 
dequeue: function( elem, type ){  
var queue = jQuery.queue( elem, type ),  
fn = queue.shift();  
 
if( !type || type === "fx" )  
fn = queue[0];  
 
if( fn !== undefined )  
fn.call(elem);  
}  
});  
 
jQuery.fn.extend({  
data: function( key, value ){  
var parts = key.split(".");  
parts[1] = parts[1] ? "." + parts[1] : "";  
 
if ( value === undefined ) {  
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);  
 
if ( data === undefined && this.length )  
data = jQuery.data( this[0], key );  
 
return data === undefined && parts[1] ?  
this.data( parts[0] ) :  
data;  
} else  
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){  
jQuery.data( this, key, value );  
});  
},  
 
removeData: function( key ){  
return this.each(function(){  
jQuery.removeData( this, key );  
});  
},  
queue: function(type, data){  
if ( typeof type !== "string" ) {  
data = type;  
type = "fx";  
}  
 
if ( data === undefined )  
return jQuery.queue( this[0], type );  
 
return this.each(function(){  
var queue = jQuery.queue( this, type, data );  
 
if( type == "fx" && queue.length == 1 )  
queue[0].call(this);  
});  
},  
dequeue: function(type){  
return this.each(function(){  
jQuery.dequeue( this, type );  
});  
}  
});/*!  
* Sizzle CSS Selector Engine - v0.9.3  
* Copyright 2009, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
* More information: http://sizzlejs.com/  
*/  
(function(){  
 
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,  
done = 0,  
toString = Object.prototype.toString;  
 
var Sizzle = function(selector, context, results, seed) {  
results = results || [];  
context = context || document;  
 
if ( context.nodeType !== 1 && context.nodeType !== 9 )  
return [];  
 
if ( !selector || typeof selector !== "string" ) {  
return results;  
}  
 
var parts = [], m, set, checkSet, check, mode, extra, prune = true;  
 
// Reset the position of the chunker regexp (start from head)  
chunker.lastIndex = 0;  
 
while ( (m = chunker.exec(selector)) !== null ) {  
parts.push( m[1] );  
 
if ( m[2] ) {  
extra = RegExp.rightContext;  
break;  
}  
}  
 
if ( parts.length > 1 && origPOS.exec( selector ) ) {  
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {  
set = posProcess( parts[0] + parts[1], context );  
} else {  
set = Expr.relative[ parts[0] ] ?  
[ context ] :  
Sizzle( parts.shift(), context );  
 
while ( parts.length ) {  
selector = parts.shift();  
 
if ( Expr.relative[ selector ] )  
selector += parts.shift();  
 
set = posProcess( selector, set );  
}  
}  
} else {  
var ret = seed ?  
{ expr: parts.pop(), set: makeArray(seed) } :  
Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );  
set = Sizzle.filter( ret.expr, ret.set );  
 
if ( parts.length > 0 ) {  
checkSet = makeArray(set);  
} else {  
prune = false;  
}  
 
while ( parts.length ) {  
var cur = parts.pop(), pop = cur;  
 
if ( !Expr.relative[ cur ] ) {  
cur = "";  
} else {  
pop = parts.pop();  
}  
 
if ( pop == null ) {  
pop = context;  
}  
 
Expr.relative[ cur ]( checkSet, pop, isXML(context) );  
}  
}  
 
if ( !checkSet ) {  
checkSet = set;  
}  
 
if ( !checkSet ) {  
throw "Syntax error, unrecognized expression: " + (cur || selector);  
}  
 
if ( toString.call(checkSet) === "[object Array]" ) {  
if ( !prune ) {  
results.push.apply( results, checkSet );  
} else if ( context.nodeType === 1 ) {  
for ( var i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {  
results.push( set[i] );  
}  
}  
} else {  
for ( var i = 0; checkSet[i] != null; i++ ) {  
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {  
results.push( set[i] );  
}  
}  
}  
} else {  
makeArray( checkSet, results );  
}  
 
if ( extra ) {  
Sizzle( extra, context, results, seed );  
 
if ( sortOrder ) {  
hasDuplicate = false;  
results.sort(sortOrder);  
 
if ( hasDuplicate ) {  
for ( var i = 1; i < results.length; i++ ) {  
if ( results[i] === results[i-1] ) {  
results.splice(i--, 1);  
}  
}  
}  
}  
}  
 
return results;  
};  
 
Sizzle.matches = function(expr, set){  
return Sizzle(expr, null, null, set);  
};  
 
Sizzle.find = function(expr, context, isXML){  
var set, match;  
 
if ( !expr ) {  
return [];  
}  
 
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {  
var type = Expr.order[i], match;  
 
if ( (match = Expr.match[ type ].exec( expr )) ) {  
var left = RegExp.leftContext;  
 
if ( left.substr( left.length - 1 ) !== "\\" ) {  
match[1] = (match[1] || "").replace(/\\/g, "");  
set = Expr.find[ type ]( match, context, isXML );  
if ( set != null ) {  
expr = expr.replace( Expr.match[ type ], "" );  
break;  
}  
}  
}  
}  
 
if ( !set ) {  
set = context.getElementsByTagName("*");  
}  
 
return {set: set, expr: expr};  
};  
 
Sizzle.filter = function(expr, set, inplace, not){  
var old = expr, result = [], curLoop = set, match, anyFound,  
isXMLFilter = set && set[0] && isXML(set[0]);  
 
while ( expr && set.length ) {  
for ( var type in Expr.filter ) {  
if ( (match = Expr.match[ type ].exec( expr )) != null ) {  
var filter = Expr.filter[ type ], found, item;  
anyFound = false;  
 
if ( curLoop == result ) {  
result = [];  
}  
 
if ( Expr.preFilter[ type ] ) {  
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );  
 
if ( !match ) {  
anyFound = found = true;  
} else if ( match === true ) {  
continue;  
}  
}  
 
if ( match ) {  
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {  
if ( item ) {  
found = filter( item, match, i, curLoop );  
var pass = not ^ !!found;  
 
if ( inplace && found != null ) {  
if ( pass ) {  
anyFound = true;  
} else {  
curLoop[i] = false;  
}  
} else if ( pass ) {  
result.push( item );  
anyFound = true;  
}  
}  
}  
}  
 
if ( found !== undefined ) {  
if ( !inplace ) {  
curLoop = result;  
}  
 
expr = expr.replace( Expr.match[ type ], "" );  
 
if ( !anyFound ) {  
return [];  
}  
 
break;  
}  
}  
}  
 
// Improper expression  
if ( expr == old ) {  
if ( anyFound == null ) {  
throw "Syntax error, unrecognized expression: " + expr;  
} else {  
break;  
}  
}  
 
old = expr;  
}  
 
return curLoop;  
};  
 
var Expr = Sizzle.selectors = {  
order: [ "ID", "NAME", "TAG" ],  
match: {  
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,  
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,  
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,  
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,  
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,  
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,  
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,  
PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/  
},  
attrMap: {  
"class": "className",  
"for": "htmlFor"  
},  
attrHandle: {  
href: function(elem){  
return elem.getAttribute("href");  
}  
},  
relative: {  
"+": function(checkSet, part, isXML){  
var isPartStr = typeof part === "string",  
isTag = isPartStr && !/\W/.test(part),  
isPartStrNotTag = isPartStr && !isTag;  
 
if ( isTag && !isXML ) {  
part = part.toUpperCase();  
}  
 
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {  
if ( (elem = checkSet[i]) ) {  
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}  
 
checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?  
elem || false :  
elem === part;  
}  
}  
 
if ( isPartStrNotTag ) {  
Sizzle.filter( part, checkSet, true );  
}  
},  
">": function(checkSet, part, isXML){  
var isPartStr = typeof part === "string";  
 
if ( isPartStr && !/\W/.test(part) ) {  
part = isXML ? part : part.toUpperCase();  
 
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
if ( elem ) {  
var parent = elem.parentNode;  
checkSet[i] = parent.nodeName === part ? parent : false;  
}  
}  
} else {  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
if ( elem ) {  
checkSet[i] = isPartStr ?  
elem.parentNode :  
elem.parentNode === part;  
}  
}  
 
if ( isPartStr ) {  
Sizzle.filter( part, checkSet, true );  
}  
}  
},  
"": function(checkSet, part, isXML){  
var doneName = done++, checkFn = dirCheck;  
 
if ( !part.match(/\W/) ) {  
var nodeCheck = part = isXML ? part : part.toUpperCase();  
checkFn = dirNodeCheck;  
}  
 
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);  
},  
"~": function(checkSet, part, isXML){  
var doneName = done++, checkFn = dirCheck;  
 
if ( typeof part === "string" && !part.match(/\W/) ) {  
var nodeCheck = part = isXML ? part : part.toUpperCase();  
checkFn = dirNodeCheck;  
}  
 
checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);  
}  
},  
find: {  
ID: function(match, context, isXML){  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
return m ? [m] : [];  
}  
},  
NAME: function(match, context, isXML){  
if ( typeof context.getElementsByName !== "undefined" ) {  
var ret = [], results = context.getElementsByName(match[1]);  
 
for ( var i = 0, l = results.length; i < l; i++ ) {  
if ( results[i].getAttribute("name") === match[1] ) {  
ret.push( results[i] );  
}  
}  
 
return ret.length === 0 ? null : ret;  
}  
},  
TAG: function(match, context){  
return context.getElementsByTagName(match[1]);  
}  
},  
preFilter: {  
CLASS: function(match, curLoop, inplace, result, not, isXML){  
match = " " + match[1].replace(/\\/g, "") + " ";  
 
if ( isXML ) {  
return match;  
}  
 
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {  
if ( elem ) {  
if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {  
if ( !inplace )  
result.push( elem );  
} else if ( inplace ) {  
curLoop[i] = false;  
}  
}  
}  
 
return false;  
},  
ID: function(match){  
return match[1].replace(/\\/g, "");  
},  
TAG: function(match, curLoop){  
for ( var i = 0; curLoop[i] === false; i++ ){}  
return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();  
},  
CHILD: function(match){  
if ( match[1] == "nth" ) {  
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'  
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(  
match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||  
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);  
 
// calculate the numbers (first)n+(last) including if they are negative  
match[2] = (test[1] + (test[2] || 1)) - 0;  
match[3] = test[3] - 0;  
}  
 
// TODO: Move to normal caching system  
match[0] = done++;  
 
return match;  
},  
ATTR: function(match, curLoop, inplace, result, not, isXML){  
var name = match[1].replace(/\\/g, "");  
 
if ( !isXML && Expr.attrMap[name] ) {  
match[1] = Expr.attrMap[name];  
}  
 
if ( match[2] === "~=" ) {  
match[4] = " " + match[4] + " ";  
}  
 
return match;  
},  
PSEUDO: function(match, curLoop, inplace, result, not){  
if ( match[1] === "not" ) {  
// If we're dealing with a complex expression, or a simple one  
if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {  
match[3] = Sizzle(match[3], null, null, curLoop);  
} else {  
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);  
if ( !inplace ) {  
result.push.apply( result, ret );  
}  
return false;  
}  
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {  
return true;  
}  
 
return match;  
},  
POS: function(match){  
match.unshift( true );  
return match;  
}  
},  
filters: {  
enabled: function(elem){  
return elem.disabled === false && elem.type !== "hidden";  
},  
disabled: function(elem){  
return elem.disabled === true;  
},  
checked: function(elem){  
return elem.checked === true;  
},  
selected: function(elem){  
// Accessing this property makes selected-by-default  
// options in Safari work properly  
elem.parentNode.selectedIndex;  
return elem.selected === true;  
},  
parent: function(elem){  
return !!elem.firstChild;  
},  
empty: function(elem){  
return !elem.firstChild;  
},  
has: function(elem, i, match){  
return !!Sizzle( match[3], elem ).length;  
},  
header: function(elem){  
return /h\d/i.test( elem.nodeName );  
},  
text: function(elem){  
return "text" === elem.type;  
},  
radio: function(elem){  
return "radio" === elem.type;  
},  
checkbox: function(elem){  
return "checkbox" === elem.type;  
},  
file: function(elem){  
return "file" === elem.type;  
},  
password: function(elem){  
return "password" === elem.type;  
},  
submit: function(elem){  
return "submit" === elem.type;  
},  
image: function(elem){  
return "image" === elem.type;  
},  
reset: function(elem){  
return "reset" === elem.type;  
},  
button: function(elem){  
return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";  
},  
input: function(elem){  
return /input|select|textarea|button/i.test(elem.nodeName);  
}  
},  
setFilters: {  
first: function(elem, i){  
return i === 0;  
},  
last: function(elem, i, match, array){  
return i === array.length - 1;  
},  
even: function(elem, i){  
return i % 2 === 0;  
},  
odd: function(elem, i){  
return i % 2 === 1;  
},  
lt: function(elem, i, match){  
return i < match[3] - 0;  
},  
gt: function(elem, i, match){  
return i > match[3] - 0;  
},  
nth: function(elem, i, match){  
return match[3] - 0 == i;  
},  
eq: function(elem, i, match){  
return match[3] - 0 == i;  
}  
},  
filter: {  
PSEUDO: function(elem, match, i, array){  
var name = match[1], filter = Expr.filters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
} else if ( name === "contains" ) {  
return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;  
} else if ( name === "not" ) {  
var not = match[3];  
 
for ( var i = 0, l = not.length; i < l; i++ ) {  
if ( not[i] === elem ) {  
return false;  
}  
}  
 
return true;  
}  
},  
CHILD: function(elem, match){  
var type = match[1], node = elem;  
switch (type) {  
case 'only':  
case 'first':  
while (node = node.previousSibling) {  
if ( node.nodeType === 1 ) return false;  
}  
if ( type == 'first') return true;  
node = elem;  
case 'last':  
while (node = node.nextSibling) {  
if ( node.nodeType === 1 ) return false;  
}  
return true;  
case 'nth':  
var first = match[2], last = match[3];  
 
if ( first == 1 && last == 0 ) {  
return true;  
}  
 
var doneName = match[0],  
parent = elem.parentNode;  
 
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {  
var count = 0;  
for ( node = parent.firstChild; node; node = node.nextSibling ) {  
if ( node.nodeType === 1 ) {  
node.nodeIndex = ++count;  
}  
}  
parent.sizcache = doneName;  
}  
 
var diff = elem.nodeIndex - last;  
if ( first == 0 ) {  
return diff == 0;  
} else {  
return ( diff % first == 0 && diff / first >= 0 );  
}  
}  
},  
ID: function(elem, match){  
return elem.nodeType === 1 && elem.getAttribute("id") === match;  
},  
TAG: function(elem, match){  
return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;  
},  
CLASS: function(elem, match){  
return (" " + (elem.className || elem.getAttribute("class")) + " ")  
.indexOf( match ) > -1;  
},  
ATTR: function(elem, match){  
var name = match[1],  
result = Expr.attrHandle[ name ] ?  
Expr.attrHandle[ name ]( elem ) :  
elem[ name ] != null ?  
elem[ name ] :  
elem.getAttribute( name ),  
value = result + "",  
type = match[2],  
check = match[4];  
 
return result == null ?  
type === "!=" :  
type === "=" ?  
value === check :  
type === "*=" ?  
value.indexOf(check) >= 0 :  
type === "~=" ?  
(" " + value + " ").indexOf(check) >= 0 :  
!check ?  
value && result !== false :  
type === "!=" ?  
value != check :  
type === "^=" ?  
value.indexOf(check) === 0 :  
type === "$=" ?  
value.substr(value.length - check.length) === check :  
type === "|=" ?  
value === check || value.substr(0, check.length + 1) === check + "-" :  
false;  
},  
POS: function(elem, match, i, array){  
var name = match[2], filter = Expr.setFilters[ name ];  
 
if ( filter ) {  
return filter( elem, i, match, array );  
}  
}  
}  
};  
 
var origPOS = Expr.match.POS;  
 
for ( var type in Expr.match ) {  
Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );  
}  
 
var makeArray = function(array, results) {  
array = Array.prototype.slice.call( array );  
 
if ( results ) {  
results.push.apply( results, array );  
return results;  
}  
 
return array;  
};  
 
// Perform a simple check to determine if the browser is capable of  
// converting a NodeList to an array using builtin methods.  
try {  
Array.prototype.slice.call( document.documentElement.childNodes );  
 
// Provide a fallback method if it does not work  
} catch(e){  
makeArray = function(array, results) {  
var ret = results || [];  
 
if ( toString.call(array) === "[object Array]" ) {  
Array.prototype.push.apply( ret, array );  
} else {  
if ( typeof array.length === "number" ) {  
for ( var i = 0, l = array.length; i < l; i++ ) {  
ret.push( array[i] );  
}  
} else {  
for ( var i = 0; array[i]; i++ ) {  
ret.push( array[i] );  
}  
}  
}  
 
return ret;  
};  
}  
 
var sortOrder;  
 
if ( document.documentElement.compareDocumentPosition ) {  
sortOrder = function( a, b ) {  
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;  
if ( ret === 0 ) {  
hasDuplicate = true;  
}  
return ret;  
};  
} else if ( "sourceIndex" in document.documentElement ) {  
sortOrder = function( a, b ) {  
var ret = a.sourceIndex - b.sourceIndex;  
if ( ret === 0 ) {  
hasDuplicate = true;  
}  
return ret;  
};  
} else if ( document.createRange ) {  
sortOrder = function( a, b ) {  
var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();  
aRange.selectNode(a);  
aRange.collapse(true);  
bRange.selectNode(b);  
bRange.collapse(true);  
var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);  
if ( ret === 0 ) {  
hasDuplicate = true;  
}  
return ret;  
};  
}  
 
// Check to see if the browser returns elements by name when  
// querying by getElementById (and provide a workaround)  
(function(){  
// We're going to inject a fake input element with a specified name  
var form = document.createElement("form"),  
id = "script" + (new Date).getTime();  
form.innerHTML = "<input name='" + id + "'/>";  
 
// Inject it into the root element, check its status, and remove it quickly  
var root = document.documentElement;  
root.insertBefore( form, root.firstChild );  
 
// The workaround has to do additional checks after a getElementById  
// Which slows things down for other browsers (hence the branching)  
if ( !!document.getElementById( id ) ) {  
Expr.find.ID = function(match, context, isXML){  
if ( typeof context.getElementById !== "undefined" && !isXML ) {  
var m = context.getElementById(match[1]);  
return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];  
}  
};  
 
Expr.filter.ID = function(elem, match){  
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");  
return elem.nodeType === 1 && node && node.nodeValue === match;  
};  
}  
 
root.removeChild( form );  
})();  
 
(function(){  
// Check to see if the browser returns only elements  
// when doing getElementsByTagName("*")  
 
// Create a fake element  
var div = document.createElement("div");  
div.appendChild( document.createComment("") );  
 
// Make sure no comments are found  
if ( div.getElementsByTagName("*").length > 0 ) {  
Expr.find.TAG = function(match, context){  
var results = context.getElementsByTagName(match[1]);  
 
// Filter out possible comments  
if ( match[1] === "*" ) {  
var tmp = [];  
 
for ( var i = 0; results[i]; i++ ) {  
if ( results[i].nodeType === 1 ) {  
tmp.push( results[i] );  
}  
}  
 
results = tmp;  
}  
 
return results;  
};  
}  
 
// Check to see if an attribute returns normalized href attributes  
div.innerHTML = "<a href='#'></a>";  
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&  
div.firstChild.getAttribute("href") !== "#" ) {  
Expr.attrHandle.href = function(elem){  
return elem.getAttribute("href", 2);  
};  
}  
})();  
 
if ( document.querySelectorAll ) (function(){  
var oldSizzle = Sizzle, div = document.createElement("div");  
div.innerHTML = "<p class='TEST'></p>";  
 
// Safari can't handle uppercase or unicode characters when  
// in quirks mode.  
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {  
return;  
}  
 
Sizzle = function(query, context, extra, seed){  
context = context || document;  
 
// Only use querySelectorAll on non-XML documents  
// (ID selectors don't work in non-HTML documents)  
if ( !seed && context.nodeType === 9 && !isXML(context) ) {  
try {  
return makeArray( context.querySelectorAll(query), extra );  
} catch(e){}  
}  
 
return oldSizzle(query, context, extra, seed);  
};  
 
Sizzle.find = oldSizzle.find;  
Sizzle.filter = oldSizzle.filter;  
Sizzle.selectors = oldSizzle.selectors;  
Sizzle.matches = oldSizzle.matches;  
})();  
 
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){  
var div = document.createElement("div");  
div.innerHTML = "<div class='test e'></div><div class='test'></div>";  
 
// Opera can't find a second classname (in 9.6)  
if ( div.getElementsByClassName("e").length === 0 )  
return;  
 
// Safari caches class attributes, doesn't catch changes (in 3.2)  
div.lastChild.className = "e";  
 
if ( div.getElementsByClassName("e").length === 1 )  
return;  
 
Expr.order.splice(1, 0, "CLASS");  
Expr.find.CLASS = function(match, context, isXML) {  
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {  
return context.getElementsByClassName(match[1]);  
}  
};  
})();  
 
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
var sibDir = dir == "previousSibling" && !isXML;  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
if ( elem ) {  
if ( sibDir && elem.nodeType === 1 ){  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
elem = elem[dir];  
var match = false;  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 && !isXML ){  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
 
if ( elem.nodeName === cur ) {  
match = elem;  
break;  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {  
var sibDir = dir == "previousSibling" && !isXML;  
for ( var i = 0, l = checkSet.length; i < l; i++ ) {  
var elem = checkSet[i];  
if ( elem ) {  
if ( sibDir && elem.nodeType === 1 ) {  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
elem = elem[dir];  
var match = false;  
 
while ( elem ) {  
if ( elem.sizcache === doneName ) {  
match = checkSet[elem.sizset];  
break;  
}  
 
if ( elem.nodeType === 1 ) {  
if ( !isXML ) {  
elem.sizcache = doneName;  
elem.sizset = i;  
}  
if ( typeof cur !== "string" ) {  
if ( elem === cur ) {  
match = true;  
break;  
}  
 
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {  
match = elem;  
break;  
}  
}  
 
elem = elem[dir];  
}  
 
checkSet[i] = match;  
}  
}  
}  
 
var contains = document.compareDocumentPosition ? function(a, b){  
return a.compareDocumentPosition(b) & 16;  
} : function(a, b){  
return a !== b && (a.contains ? a.contains(b) : true);  
};  
 
var isXML = function(elem){  
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||  
!!elem.ownerDocument && isXML( elem.ownerDocument );  
};  
 
var posProcess = function(selector, context){  
var tmpSet = [], later = "", match,  
root = context.nodeType ? [context] : context;  
 
// Position selectors must be done after the filter  
// And so must :not(positional) so we move all PSEUDOs to the end  
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {  
later += match[0];  
selector = selector.replace( Expr.match.PSEUDO, "" );  
}  
 
selector = Expr.relative[selector] ? selector + "*" : selector;  
 
for ( var i = 0, l = root.length; i < l; i++ ) {  
Sizzle( selector, root[i], tmpSet );  
}  
 
return Sizzle.filter( later, tmpSet );  
};  
 
// EXPOSE  
jQuery.find = Sizzle;  
jQuery.filter = Sizzle.filter;  
jQuery.expr = Sizzle.selectors;  
jQuery.expr[":"] = jQuery.expr.filters;  
 
Sizzle.selectors.filters.hidden = function(elem){  
return elem.offsetWidth === 0 || elem.offsetHeight === 0;  
};  
 
Sizzle.selectors.filters.visible = function(elem){  
return elem.offsetWidth > 0 || elem.offsetHeight > 0;  
};  
 
Sizzle.selectors.filters.animated = function(elem){  
return jQuery.grep(jQuery.timers, function(fn){  
return elem === fn.elem;  
}).length;  
};  
 
jQuery.multiFilter = function( expr, elems, not ) {  
if ( not ) {  
expr = ":not(" + expr + ")";  
}  
 
return Sizzle.matches(expr, elems);  
};  
 
jQuery.dir = function( elem, dir ){  
var matched = [], cur = elem[dir];  
while ( cur && cur != document ) {  
if ( cur.nodeType == 1 )  
matched.push( cur );  
cur = cur[dir];  
}  
return matched;  
};  
 
jQuery.nth = function(cur, result, dir, elem){  
result = result || 1;  
var num = 0;  
 
for ( ; cur; cur = cur[dir] )  
if ( cur.nodeType == 1 && ++num == result )  
break;  
 
return cur;  
};  
 
jQuery.sibling = function(n, elem){  
var r = [];  
 
for ( ; n; n = n.nextSibling ) {  
if ( n.nodeType == 1 && n != elem )  
r.push( n );  
}  
 
return r;  
};  
 
return;  
 
window.Sizzle = Sizzle;  
 
})();  
/*  
* A number of helper functions used for managing events.  
* Many of the ideas behind this code originated from  
* Dean Edwards' addEvent library.  
*/  
jQuery.event = {  
 
// Bind an event to an element  
// Original by Dean Edwards  
add: function(elem, types, handler, data) {  
if ( elem.nodeType == 3 || elem.nodeType == 8 )  
return;  
 
// For whatever reason, IE has trouble passing the window object  
// around, causing it to be cloned in the process  
if ( elem.setInterval && elem != window )  
elem = window;  
 
// Make sure that the function being executed has a unique ID  
if ( !handler.guid )  
handler.guid = this.guid++;  
 
// if data is passed, bind to handler  
if ( data !== undefined ) {  
// Create temporary function pointer to original handler  
var fn = handler;  
 
// Create unique handler function, wrapped around original handler  
handler = this.proxy( fn );  
 
// Store data in unique handler  
handler.data = data;  
}  
 
// Init the element's event structure  
var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),  
handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){  
// Handle the second event of a trigger and when  
// an event is called after a page has unloaded  
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?  
jQuery.event.handle.apply(arguments.callee.elem, arguments) :  
undefined;  
});  
// Add elem as a property of the handle function  
// This is to prevent a memory leak with non-native  
// event in IE.  
handle.elem = elem;  
 
// Handle multiple events separated by a space  
// jQuery(...).bind("mouseover mouseout", fn);  
jQuery.each(types.split(/\s+/), function(index, type) {  
// Namespaced event handlers  
var namespaces = type.split(".");  
type = namespaces.shift();  
handler.type = namespaces.slice().sort().join(".");  
 
// Get the current list of functions bound to this event  
var handlers = events[type];  
 
if ( jQuery.event.specialAll[type] )  
jQuery.event.specialAll[type].setup.call(elem, data, namespaces);  
 
// Init the event handler queue  
if (!handlers) {  
handlers = events[type] = {};  
 
// Check for a special event handler  
// Only use addEventListener/attachEvent if the special  
// events handler returns false  
if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {  
// Bind the global event handler to the element  
if (elem.addEventListener)  
elem.addEventListener(type, handle, false);  
else if (elem.attachEvent)  
elem.attachEvent("on" + type, handle);  
}  
}  
 
// Add the function to the element's handler list  
handlers[handler.guid] = handler;  
 
// Keep track of which events have been used, for global triggering  
jQuery.event.global[type] = true;  
});  
 
// Nullify elem to prevent memory leaks in IE  
elem = null;  
},  
 
guid: 1,  
global: {},  
 
// Detach an event or set of events from an element  
remove: function(elem, types, handler) {  
// don't do events on text and comment nodes  
if ( elem.nodeType == 3 || elem.nodeType == 8 )  
return;  
 
var events = jQuery.data(elem, "events"), ret, index;  
 
if ( events ) {  
// Unbind all events for the element  
if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )  
for ( var type in events )  
this.remove( elem, type + (types || "") );  
else {  
// types is actually an event object here  
if ( types.type ) {  
handler = types.handler;  
types = types.type;  
}  
 
// Handle multiple events seperated by a space  
// jQuery(...).unbind("mouseover mouseout", fn);  
jQuery.each(types.split(/\s+/), function(index, type){  
// Namespaced event handlers  
var namespaces = type.split(".");  
type = namespaces.shift();  
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");  
 
if ( events[type] ) {  
// remove the given handler for the given type  
if ( handler )  
delete events[type][handler.guid];  
 
// remove all handlers for the given type  
else  
for ( var handle in events[type] )  
// Handle the removal of namespaced events  
if ( namespace.test(events[type][handle].type) )  
delete events[type][handle];  
 
if ( jQuery.event.specialAll[type] )  
jQuery.event.specialAll[type].teardown.call(elem, namespaces);  
 
// remove generic event handler if no more handlers exist  
for ( ret in events[type] ) break;  
if ( !ret ) {  
if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {  
if (elem.removeEventListener)  
elem.removeEventListener(type, jQuery.data(elem, "handle"), false);  
else if (elem.detachEvent)  
elem.detachEvent("on" + type, jQuery.data(elem, "handle"));  
}  
ret = null;  
delete events[type];  
}  
}  
});  
}  
 
// Remove the expando if it's no longer used  
for ( ret in events ) break;  
if ( !ret ) {  
var handle = jQuery.data( elem, "handle" );  
if ( handle ) handle.elem = null;  
jQuery.removeData( elem, "events" );  
jQuery.removeData( elem, "handle" );  
}  
}  
},  
 
// bubbling is internal  
trigger: function( event, data, elem, bubbling ) {  
// Event object or event type  
var type = event.type || event;  
 
if( !bubbling ){  
event = typeof event === "object" ?  
// jQuery.Event object  
event[expando] ? event :  
// Object literal  
jQuery.extend( jQuery.Event(type), event ) :  
// Just the event type (string)  
jQuery.Event(type);  
 
if ( type.indexOf("!") >= 0 ) {  
event.type = type = type.slice(0, -1);  
event.exclusive = true;  
}  
 
// Handle a global trigger  
if ( !elem ) {  
// Don't bubble custom events when global (to avoid too much overhead)  
event.stopPropagation();  
// Only trigger if we've ever bound an event for it  
if ( this.global[type] )  
jQuery.each( jQuery.cache, function(){  
if ( this.events && this.events[type] )  
jQuery.event.trigger( event, data, this.handle.elem );  
});  
}  
 
// Handle triggering a single element  
 
// don't do events on text and comment nodes  
if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )  
return undefined;  
 
// Clean up in case it is reused  
event.result = undefined;  
event.target = elem;  
 
// Clone the incoming data, if any  
data = jQuery.makeArray(data);  
data.unshift( event );  
}  
 
event.currentTarget = elem;  
 
// Trigger the event, it is assumed that "handle" is a function  
var handle = jQuery.data(elem, "handle");  
if ( handle )  
handle.apply( elem, data );  
 
// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)  
if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )  
event.result = false;  
 
// Trigger the native events (except for clicks on links)  
if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {  
this.triggered = true;  
try {  
elem[ type ]();  
// prevent IE from throwing an error for some hidden elements  
} catch (e) {}  
}  
 
this.triggered = false;  
 
if ( !event.isPropagationStopped() ) {  
var parent = elem.parentNode || elem.ownerDocument;  
if ( parent )  
jQuery.event.trigger(event, data, parent, true);  
}  
},  
 
handle: function(event) {  
// returned undefined or false  
var all, handlers;  
 
event = arguments[0] = jQuery.event.fix( event || window.event );  
event.currentTarget = this;  
 
// Namespaced event handlers  
var namespaces = event.type.split(".");  
event.type = namespaces.shift();  
 
// Cache this now, all = true means, any handler  
all = !namespaces.length && !event.exclusive;  
 
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");  
 
handlers = ( jQuery.data(this, "events") || {} )[event.type];  
 
for ( var j in handlers ) {  
var handler = handlers[j];  
 
// Filter the functions by class  
if ( all || namespace.test(handler.type) ) {  
// Pass in a reference to the handler function itself  
// So that we can later remove it  
event.handler = handler;  
event.data = handler.data;  
 
var ret = handler.apply(this, arguments);  
 
if( ret !== undefined ){  
event.result = ret;  
if ( ret === false ) {  
event.preventDefault();  
event.stopPropagation();  
}  
}  
 
if( event.isImmediatePropagationStopped() )  
break;  
 
}  
}  
},  
 
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),  
 
fix: function(event) {  
if ( event[expando] )  
return event;  
 
// store a copy of the original event object  
// and "clone" to set read-only properties  
var originalEvent = event;  
event = jQuery.Event( originalEvent );  
 
for ( var i = this.props.length, prop; i; ){  
prop = this.props[ --i ];  
event[ prop ] = originalEvent[ prop ];  
}  
 
// Fix target property, if necessary  
if ( !event.target )  
event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either  
 
// check if target is a textnode (safari)  
if ( event.target.nodeType == 3 )  
event.target = event.target.parentNode;  
 
// Add relatedTarget, if necessary  
if ( !event.relatedTarget && event.fromElement )  
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;  
 
// Calculate pageX/Y if missing and clientX/Y available  
if ( event.pageX == null && event.clientX != null ) {  
var doc = document.documentElement, body = document.body;  
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);  
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);  
}  
 
// Add which for key events  
if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )  
event.which = event.charCode || event.keyCode;  
 
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)  
if ( !event.metaKey && event.ctrlKey )  
event.metaKey = event.ctrlKey;  
 
// Add which for click: 1 == left; 2 == middle; 3 == right  
// Note: button is not normalized, so don't use it  
if ( !event.which && event.button )  
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));  
 
return event;  
},  
 
proxy: function( fn, proxy ){  
proxy = proxy || function(){ return fn.apply(this, arguments); };  
// Set the guid of unique handler to the same of original handler, so it can be removed  
proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;  
// So proxy can be declared as an argument  
return proxy;  
},  
 
special: {  
ready: {  
// Make sure the ready event is setup  
setup: bindReady,  
teardown: function() {}  
}  
},  
 
specialAll: {  
live: {  
setup: function( selector, namespaces ){  
jQuery.event.add( this, namespaces[0], liveHandler );  
},  
teardown: function( namespaces ){  
if ( namespaces.length ) {  
var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");  
 
jQuery.each( (jQuery.data(this, "events").live || {}), function(){  
if ( name.test(this.type) )  
remove++;  
});  
 
if ( remove < 1 )  
jQuery.event.remove( this, namespaces[0], liveHandler );  
}  
}  
}  
}  
};  
 
jQuery.Event = function( src ){  
// Allow instantiation without the 'new' keyword  
if( !this.preventDefault )  
return new jQuery.Event(src);  
 
// Event object  
if( src && src.type ){  
this.originalEvent = src;  
this.type = src.type;  
// Event type  
}else  
this.type = src;  
 
// timeStamp is buggy for some events on Firefox(#3843)  
// So we won't rely on the native value  
this.timeStamp = now();  
 
// Mark it as fixed  
this[expando] = true;  
};  
 
function returnFalse(){  
return false;  
}  
function returnTrue(){  
return true;  
}  
 
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding  
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html  
jQuery.Event.prototype = {  
preventDefault: function() {  
this.isDefaultPrevented = returnTrue;  
 
var e = this.originalEvent;  
if( !e )  
return;  
// if preventDefault exists run it on the original event  
if (e.preventDefault)  
e.preventDefault();  
// otherwise set the returnValue property of the original event to false (IE)  
e.returnValue = false;  
},  
stopPropagation: function() {  
this.isPropagationStopped = returnTrue;  
 
var e = this.originalEvent;  
if( !e )  
return;  
// if stopPropagation exists run it on the original event  
if (e.stopPropagation)  
e.stopPropagation();  
// otherwise set the cancelBubble property of the original event to true (IE)  
e.cancelBubble = true;  
},  
stopImmediatePropagation:function(){  
this.isImmediatePropagationStopped = returnTrue;  
this.stopPropagation();  
},  
isDefaultPrevented: returnFalse,  
isPropagationStopped: returnFalse,  
isImmediatePropagationStopped: returnFalse  
};  
// Checks if an event happened on an element within another element  
// Used in jQuery.event.special.mouseenter and mouseleave handlers  
var withinElement = function(event) {  
// Check if mouse(over|out) are still within the same parent element  
var parent = event.relatedTarget;  
// Traverse up the tree  
while ( parent && parent != this )  
try { parent = parent.parentNode; }  
catch(e) { parent = this; }  
 
if( parent != this ){  
// set the correct event type  
event.type = event.data;  
// handle event if we actually just moused on to a non sub-element  
jQuery.event.handle.apply( this, arguments );  
}  
};  
 
jQuery.each({  
mouseover: 'mouseenter',  
mouseout: 'mouseleave'  
}, function( orig, fix ){  
jQuery.event.special[ fix ] = {  
setup: function(){  
jQuery.event.add( this, orig, withinElement, fix );  
},  
teardown: function(){  
jQuery.event.remove( this, orig, withinElement );  
}  
};  
});  
 
jQuery.fn.extend({  
bind: function( type, data, fn ) {  
return type == "unload" ? this.one(type, data, fn) : this.each(function(){  
jQuery.event.add( this, type, fn || data, fn && data );  
});  
},  
 
one: function( type, data, fn ) {  
var one = jQuery.event.proxy( fn || data, function(event) {  
jQuery(this).unbind(event, one);  
return (fn || data).apply( this, arguments );  
});  
return this.each(function(){  
jQuery.event.add( this, type, one, fn && data);  
});  
},  
 
unbind: function( type, fn ) {  
return this.each(function(){  
jQuery.event.remove( this, type, fn );  
});  
},  
 
trigger: function( type, data ) {  
return this.each(function(){  
jQuery.event.trigger( type, data, this );  
});  
},  
 
triggerHandler: function( type, data ) {  
if( this[0] ){  
var event = jQuery.Event(type);  
event.preventDefault();  
event.stopPropagation();  
jQuery.event.trigger( event, data, this[0] );  
return event.result;  
}  
},  
 
toggle: function( fn ) {  
// Save reference to arguments for access in closure  
var args = arguments, i = 1;  
 
// link all the functions, so any of them can unbind this click handler  
while( i < args.length )  
jQuery.event.proxy( fn, args[i++] );  
 
return this.click( jQuery.event.proxy( fn, function(event) {  
// Figure out which function to execute  
this.lastToggle = ( this.lastToggle || 0 ) % i;  
 
// Make sure that clicks stop  
event.preventDefault();  
 
// and execute the function  
return args[ this.lastToggle++ ].apply( this, arguments ) || false;  
}));  
},  
 
hover: function(fnOver, fnOut) {  
return this.mouseenter(fnOver).mouseleave(fnOut);  
},  
 
ready: function(fn) {  
// Attach the listeners  
bindReady();  
 
// If the DOM is already ready  
if ( jQuery.isReady )  
// Execute the function immediately  
fn.call( document, jQuery );  
 
// Otherwise, remember the function for later  
else  
// Add the function to the wait list  
jQuery.readyList.push( fn );  
 
return this;  
},  
 
live: function( type, fn ){  
var proxy = jQuery.event.proxy( fn );  
proxy.guid += this.selector + type;  
 
jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );  
 
return this;  
},  
 
die: function( type, fn ){  
jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );  
return this;  
}  
});  
 
function liveHandler( event ){  
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),  
stop = true,  
elems = [];  
 
jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){  
if ( check.test(fn.type) ) {  
var elem = jQuery(event.target).closest(fn.data)[0];  
if ( elem )  
elems.push({ elem: elem, fn: fn });  
}  
});  
 
elems.sort(function(a,b) {  
return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");  
});  
 
jQuery.each(elems, function(){  
if ( this.fn.call(this.elem, event, this.fn.data) === false )  
return (stop = false);  
});  
 
return stop;  
}  
 
function liveConvert(type, selector){  
return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");  
}  
 
jQuery.extend({  
isReady: false,  
readyList: [],  
// Handle when the DOM is ready  
ready: function() {  
// Make sure that the DOM is not already loaded  
if ( !jQuery.isReady ) {  
// Remember that the DOM is ready  
jQuery.isReady = true;  
 
// If there are functions bound, to execute  
if ( jQuery.readyList ) {  
// Execute all of them  
jQuery.each( jQuery.readyList, function(){  
this.call( document, jQuery );  
});  
 
// Reset the list of functions  
jQuery.readyList = null;  
}  
 
// Trigger any bound ready events  
jQuery(document).triggerHandler("ready");  
}  
}  
});  
 
var readyBound = false;  
 
function bindReady(){  
if ( readyBound ) return;  
readyBound = true;  
 
// Mozilla, Opera and webkit nightlies currently support this event  
if ( document.addEventListener ) {  
// Use the handy event callback  
document.addEventListener( "DOMContentLoaded", function(){  
document.removeEventListener( "DOMContentLoaded", arguments.callee, false );  
jQuery.ready();  
}, false );  
 
// If IE event model is used  
} else if ( document.attachEvent ) {  
// ensure firing before onload,  
// maybe late but safe also for iframes  
document.attachEvent("onreadystatechange", function(){  
if ( document.readyState === "complete" ) {  
document.detachEvent( "onreadystatechange", arguments.callee );  
jQuery.ready();  
}  
});  
 
// If IE and not an iframe  
// continually check to see if the document is ready  
if ( document.documentElement.doScroll && window == window.top ) (function(){  
if ( jQuery.isReady ) return;  
 
try {  
// If IE is used, use the trick by Diego Perini  
// http://javascript.nwbox.com/IEContentLoaded/  
document.documentElement.doScroll("left");  
} catch( error ) {  
setTimeout( arguments.callee, 0 );  
return;  
}  
 
// and execute any waiting functions  
jQuery.ready();  
})();  
}  
 
// A fallback to window.onload, that will always work  
jQuery.event.add( window, "load", jQuery.ready );  
}  
 
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +  
"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +  
"change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){  
 
// Handle event binding  
jQuery.fn[name] = function(fn){  
return fn ? this.bind(name, fn) : this.trigger(name);  
};  
});  
 
// Prevent memory leaks in IE  
// And prevent errors on refresh with events like mouseover in other browsers  
// Window isn't included so as not to unbind existing unload events  
jQuery( window ).bind( 'unload', function(){  
for ( var id in jQuery.cache )  
// Skip the window  
if ( id != 1 && jQuery.cache[ id ].handle )  
jQuery.event.remove( jQuery.cache[ id ].handle.elem );  
});  
(function(){  
 
jQuery.support = {};  
 
var root = document.documentElement,  
script = document.createElement("script"),  
div = document.createElement("div"),  
id = "script" + (new Date).getTime();  
 
div.style.display = "none";  
div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';  
 
var all = div.getElementsByTagName("*"),  
a = div.getElementsByTagName("a")[0];  
 
// Can't get basic test support  
if ( !all || !all.length || !a ) {  
return;  
}  
 
jQuery.support = {  
// IE strips leading whitespace when .innerHTML is used  
leadingWhitespace: div.firstChild.nodeType == 3,  
 
// Make sure that tbody elements aren't automatically inserted  
// IE will insert them into empty tables  
tbody: !div.getElementsByTagName("tbody").length,  
 
// Make sure that you can get all elements in an <object> element  
// IE 7 always returns no results  
objectAll: !!div.getElementsByTagName("object")[0]  
.getElementsByTagName("*").length,  
 
// Make sure that link elements get serialized correctly by innerHTML  
// This requires a wrapper element in IE  
htmlSerialize: !!div.getElementsByTagName("link").length,  
 
// Get the style information from getAttribute  
// (IE uses .cssText insted)  
style: /red/.test( a.getAttribute("style") ),  
 
// Make sure that URLs aren't manipulated  
// (IE normalizes it by default)  
hrefNormalized: a.getAttribute("href") === "/a",  
 
// Make sure that element opacity exists  
// (IE uses filter instead)  
opacity: a.style.opacity === "0.5",  
 
// Verify style float existence  
// (IE uses styleFloat instead of cssFloat)  
cssFloat: !!a.style.cssFloat,  
 
// Will be defined later  
scriptEval: false,  
noCloneEvent: true,  
boxModel: null  
};  
 
script.type = "text/javascript";  
try {  
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );  
} catch(e){}  
 
root.insertBefore( script, root.firstChild );  
 
// Make sure that the execution of code works by injecting a script  
// tag with appendChild/createTextNode  
// (IE doesn't support this, fails, and uses .text instead)  
if ( window[ id ] ) {  
jQuery.support.scriptEval = true;  
delete window[ id ];  
}  
 
root.removeChild( script );  
 
if ( div.attachEvent && div.fireEvent ) {  
div.attachEvent("onclick", function(){  
// Cloning a node shouldn't copy over any  
// bound event handlers (IE does this)  
jQuery.support.noCloneEvent = false;  
div.detachEvent("onclick", arguments.callee);  
});  
div.cloneNode(true).fireEvent("onclick");  
}  
 
// Figure out if the W3C box model works as expected  
// document.body must exist before we can do this  
jQuery(function(){  
var div = document.createElement("div");  
div.style.width = div.style.paddingLeft = "1px";  
 
document.body.appendChild( div );  
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;  
document.body.removeChild( div ).style.display = 'none';  
});  
})();  
 
var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";  
 
jQuery.props = {  
"for": "htmlFor",  
"class": "className",  
"float": styleFloat,  
cssFloat: styleFloat,  
styleFloat: styleFloat,  
readonly: "readOnly",  
maxlength: "maxLength",  
cellspacing: "cellSpacing",  
rowspan: "rowSpan",  
tabindex: "tabIndex"  
};  
jQuery.fn.extend({  
// Keep a copy of the old load  
_load: jQuery.fn.load,  
 
load: function( url, params, callback ) {  
if ( typeof url !== "string" )  
return this._load( url );  
 
var off = url.indexOf(" ");  
if ( off >= 0 ) {  
var selector = url.slice(off, url.length);  
url = url.slice(0, off);  
}  
 
// Default to a GET request  
var type = "GET";  
 
// If the second parameter was provided  
if ( params )  
// If it's a function  
if ( jQuery.isFunction( params ) ) {  
// We assume that it's the callback  
callback = params;  
params = null;  
 
// Otherwise, build a param string  
} else if( typeof params === "object" ) {  
params = jQuery.param( params );  
type = "POST";  
}  
 
var self = this;  
 
// Request the remote document  
jQuery.ajax({  
url: url,  
type: type,  
dataType: "html",  
data: params,  
complete: function(res, status){  
// If successful, inject the HTML into all the matched elements  
if ( status == "success" || status == "notmodified" )  
// See if a selector was specified  
self.html( selector ?  
// Create a dummy div to hold the results  
jQuery("<div/>")  
// inject the contents of the document in, removing the scripts  
// to avoid any 'Permission Denied' errors in IE  
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))  
 
// Locate the specified elements  
.find(selector) :  
 
// If not, just inject the full result  
res.responseText );  
 
if( callback )  
self.each( callback, [res.responseText, status, res] );  
}  
});  
return this;  
},  
 
serialize: function() {  
return jQuery.param(this.serializeArray());  
},  
serializeArray: function() {  
return this.map(function(){  
return this.elements ? jQuery.makeArray(this.elements) : this;  
})  
.filter(function(){  
return this.name && !this.disabled &&  
(this.checked || /select|textarea/i.test(this.nodeName) ||  
/text|hidden|password|search/i.test(this.type));  
})  
.map(function(i, elem){  
var val = jQuery(this).val();  
return val == null ? null :  
jQuery.isArray(val) ?  
jQuery.map( val, function(val, i){  
return {name: elem.name, value: val};  
}) :  
{name: elem.name, value: val};  
}).get();  
}  
});  
 
// Attach a bunch of functions for handling common AJAX events  
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){  
jQuery.fn[o] = function(f){  
return this.bind(o, f);  
};  
});  
 
var jsc = now();  
 
jQuery.extend({  
 
get: function( url, data, callback, type ) {  
// shift arguments if data argument was ommited  
if ( jQuery.isFunction( data ) ) {  
callback = data;  
data = null;  
}  
 
return jQuery.ajax({  
type: "GET",  
url: url,  
data: data,  
success: callback,  
dataType: type  
});  
},  
 
getScript: function( url, callback ) {  
return jQuery.get(url, null, callback, "script");  
},  
 
getJSON: function( url, data, callback ) {  
return jQuery.get(url, data, callback, "json");  
},  
 
post: function( url, data, callback, type ) {  
if ( jQuery.isFunction( data ) ) {  
callback = data;  
data = {};  
}  
 
return jQuery.ajax({  
type: "POST",  
url: url,  
data: data,  
success: callback,  
dataType: type  
});  
},  
 
ajaxSetup: function( settings ) {  
jQuery.extend( jQuery.ajaxSettings, settings );  
},  
 
ajaxSettings: {  
url: location.href,  
global: true,  
type: "GET",  
contentType: "application/x-www-form-urlencoded",  
processData: true,  
async: true,  
/*  
timeout: 0,  
data: null,  
username: null,  
password: null,  
*/  
// Create the request object; Microsoft failed to properly  
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available  
// This function can be overriden by calling jQuery.ajaxSetup  
xhr:function(){  
return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();  
},  
accepts: {  
xml: "application/xml, text/xml",  
html: "text/html",  
script: "text/javascript, application/javascript",  
json: "application/json, text/javascript",  
text: "text/plain",  
_default: "*/*"  
}  
},  
 
// Last-Modified header cache for next request  
lastModified: {},  
 
ajax: function( s ) {  
// Extend the settings, but re-extend 's' so that it can be  
// checked again later (in the test suite, specifically)  
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));  
 
var jsonp, jsre = /=\?(&|$)/g, status, data,  
type = s.type.toUpperCase();  
 
// convert data if not already a string  
if ( s.data && s.processData && typeof s.data !== "string" )  
s.data = jQuery.param(s.data);  
 
// Handle JSONP Parameter Callbacks  
if ( s.dataType == "jsonp" ) {  
if ( type == "GET" ) {  
if ( !s.url.match(jsre) )  
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";  
} else if ( !s.data || !s.data.match(jsre) )  
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";  
s.dataType = "json";  
}  
 
// Build temporary JSONP function  
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {  
jsonp = "jsonp" + jsc++;  
 
// Replace the =? sequence both in the query string and the data  
if ( s.data )  
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");  
s.url = s.url.replace(jsre, "=" + jsonp + "$1");  
 
// We need to make sure  
// that a JSONP style response is executed properly  
s.dataType = "script";  
 
// Handle JSONP-style loading  
window[ jsonp ] = function(tmp){  
data = tmp;  
success();  
complete();  
// Garbage collect  
window[ jsonp ] = undefined;  
try{ delete window[ jsonp ]; } catch(e){}  
if ( head )  
head.removeChild( script );  
};  
}  
 
if ( s.dataType == "script" && s.cache == null )  
s.cache = false;  
 
if ( s.cache === false && type == "GET" ) {  
var ts = now();  
// try replacing _= if it is there  
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");  
// if nothing was replaced, add timestamp to the end  
s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");  
}  
 
// If data is available, append data to url for get requests  
if ( s.data && type == "GET" ) {  
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;  
 
// IE likes to send both get and post data, prevent this  
s.data = null;  
}  
 
// Watch for a new set of requests  
if ( s.global && ! jQuery.active++ )  
jQuery.event.trigger( "ajaxStart" );  
 
// Matches an absolute URL, and saves the domain  
var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );  
 
// If we're requesting a remote document  
// and trying to load JSON or Script with a GET  
if ( s.dataType == "script" && type == "GET" && parts  
&& ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){  
 
var head = document.getElementsByTagName("head")[0];  
var script = document.createElement("script");  
script.src = s.url;  
if (s.scriptCharset)  
script.charset = s.scriptCharset;  
 
// Handle Script loading  
if ( !jsonp ) {  
var done = false;  
 
// Attach handlers for all browsers  
script.onload = script.onreadystatechange = function(){  
if ( !done && (!this.readyState ||  
this.readyState == "loaded" || this.readyState == "complete") ) {  
done = true;  
success();  
complete();  
 
// Handle memory leak in IE  
script.onload = script.onreadystatechange = null;  
head.removeChild( script );  
}  
};  
}  
 
head.appendChild(script);  
 
// We handle everything using the script element injection  
return undefined;  
}  
 
var requestDone = false;  
 
// Create the request object  
var xhr = s.xhr();  
 
// Open the socket  
// Passing null username, generates a login popup on Opera (#2865)  
if( s.username )  
xhr.open(type, s.url, s.async, s.username, s.password);  
else  
xhr.open(type, s.url, s.async);  
 
// Need an extra try/catch for cross domain requests in Firefox 3  
try {  
// Set the correct header, if data is being sent  
if ( s.data )  
xhr.setRequestHeader("Content-Type", s.contentType);  
 
// Set the If-Modified-Since header, if ifModified mode.  
if ( s.ifModified )  
xhr.setRequestHeader("If-Modified-Since",  
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );  
 
// Set header so the called script knows that it's an XMLHttpRequest  
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");  
 
// Set the Accepts header for the server, depending on the dataType  
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?  
s.accepts[ s.dataType ] + ", */*" :  
s.accepts._default );  
} catch(e){}  
 
// Allow custom headers/mimetypes and early abort  
if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {  
// Handle the global AJAX counter  
if ( s.global && ! --jQuery.active )  
jQuery.event.trigger( "ajaxStop" );  
// close opended socket  
xhr.abort();  
return false;  
}  
 
if ( s.global )  
jQuery.event.trigger("ajaxSend", [xhr, s]);  
 
// Wait for a response to come back  
var onreadystatechange = function(isTimeout){  
// The request was aborted, clear the interval and decrement jQuery.active  
if (xhr.readyState == 0) {  
if (ival) {  
// clear poll interval  
clearInterval(ival);  
ival = null;  
// Handle the global AJAX counter  
if ( s.global && ! --jQuery.active )  
jQuery.event.trigger( "ajaxStop" );  
}  
// The transfer is complete and the data is available, or the request timed out  
} else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {  
requestDone = true;  
 
// clear poll interval  
if (ival) {  
clearInterval(ival);  
ival = null;  
}  
 
status = isTimeout == "timeout" ? "timeout" :  
!jQuery.httpSuccess( xhr ) ? "error" :  
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :  
"success";  
 
if ( status == "success" ) {  
// Watch for, and catch, XML document parse errors  
try {  
// process the data (runs the xml through httpData regardless of callback)  
data = jQuery.httpData( xhr, s.dataType, s );  
} catch(e) {  
status = "parsererror";  
}  
}  
 
// Make sure that the request was successful or notmodified  
if ( status == "success" ) {  
// Cache Last-Modified header, if ifModified mode.  
var modRes;  
try {  
modRes = xhr.getResponseHeader("Last-Modified");  
} catch(e) {} // swallow exception thrown by FF if header is not available  
 
if ( s.ifModified && modRes )  
jQuery.lastModified[s.url] = modRes;  
 
// JSONP handles its own success callback  
if ( !jsonp )  
success();  
} else  
jQuery.handleError(s, xhr, status);  
 
// Fire the complete handlers  
complete();  
 
if ( isTimeout )  
xhr.abort();  
 
// Stop memory leaks  
if ( s.async )  
xhr = null;  
}  
};  
 
if ( s.async ) {  
// don't attach the handler to the request, just poll it instead  
var ival = setInterval(onreadystatechange, 13);  
 
// Timeout checker  
if ( s.timeout > 0 )  
setTimeout(function(){  
// Check to see if the request is still happening  
if ( xhr && !requestDone )  
onreadystatechange( "timeout" );  
}, s.timeout);  
}  
 
// Send the data  
try {  
xhr.send(s.data);  
} catch(e) {  
jQuery.handleError(s, xhr, null, e);  
}  
 
// firefox 1.5 doesn't fire statechange for sync requests  
if ( !s.async )  
onreadystatechange();  
 
function success(){  
// If a local callback was specified, fire it and pass it the data  
if ( s.success )  
s.success( data, status );  
 
// Fire the global callback  
if ( s.global )  
jQuery.event.trigger( "ajaxSuccess", [xhr, s] );  
}  
 
function complete(){  
// Process result  
if ( s.complete )  
s.complete(xhr, status);  
 
// The request was completed  
if ( s.global )  
jQuery.event.trigger( "ajaxComplete", [xhr, s] );  
 
// Handle the global AJAX counter  
if ( s.global && ! --jQuery.active )  
jQuery.event.trigger( "ajaxStop" );  
}  
 
// return XMLHttpRequest to allow aborting the request etc.  
return xhr;  
},  
 
handleError: function( s, xhr, status, e ) {  
// If a local callback was specified, fire it  
if ( s.error ) s.error( xhr, status, e );  
 
// Fire the global callback  
if ( s.global )  
jQuery.event.trigger( "ajaxError", [xhr, s, e] );  
},  
 
// Counter for holding the number of active queries  
active: 0,  
 
// Determines if an XMLHttpRequest was successful or not  
httpSuccess: function( xhr ) {  
try {  
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450  
return !xhr.status && location.protocol == "file:" ||  
( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;  
} catch(e){}  
return false;  
},  
 
// Determines if an XMLHttpRequest returns NotModified  
httpNotModified: function( xhr, url ) {  
try {  
var xhrRes = xhr.getResponseHeader("Last-Modified");  
 
// Firefox always returns 200. check Last-Modified date  
return xhr.status == 304 || xhrRes == jQuery.lastModified[url];  
} catch(e){}  
return false;  
},  
 
httpData: function( xhr, type, s ) {  
var ct = xhr.getResponseHeader("content-type"),  
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,  
data = xml ? xhr.responseXML : xhr.responseText;  
 
if ( xml && data.documentElement.tagName == "parsererror" )  
throw "parsererror";  
 
// Allow a pre-filtering function to sanitize the response  
// s != null is checked to keep backwards compatibility  
if( s && s.dataFilter )  
data = s.dataFilter( data, type );  
 
// The filter can actually parse the response  
if( typeof data === "string" ){  
 
// If the type is "script", eval it in global context  
if ( type == "script" )  
jQuery.globalEval( data );  
 
// Get the JavaScript object, if JSON is used.  
if ( type == "json" )  
data = window["eval"]("(" + data + ")");  
}  
 
return data;  
},  
 
// Serialize an array of form elements or a set of  
// key/values into a query string  
param: function( a ) {  
var s = [ ];  
 
function add( key, value ){  
s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);  
};  
 
// If an array was passed in, assume that it is an array  
// of form elements  
if ( jQuery.isArray(a) || a.jquery )  
// Serialize the form elements  
jQuery.each( a, function(){  
add( this.name, this.value );  
});  
 
// Otherwise, assume that it's an object of key/value pairs  
else  
// Serialize the key/values  
for ( var j in a )  
// If the value is an array then the key names need to be repeated  
if ( jQuery.isArray(a[j]) )  
jQuery.each( a[j], function(){  
add( j, this );  
});  
else  
add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );  
 
// Return the resulting serialization  
return s.join("&").replace(/%20/g, "+");  
}  
 
});  
var elemdisplay = {},  
timerId,  
fxAttrs = [  
// height animations  
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],  
// width animations  
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],  
// opacity animations  
[ "opacity" ]  
];  
 
function genFx( type, num ){  
var obj = {};  
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){  
obj[ this ] = type;  
});  
return obj;  
}  
 
jQuery.fn.extend({  
show: function(speed,callback){  
if ( speed ) {  
return this.animate( genFx("show", 3), speed, callback);  
} else {  
for ( var i = 0, l = this.length; i < l; i++ ){  
var old = jQuery.data(this[i], "olddisplay");  
 
this[i].style.display = old || "";  
 
if ( jQuery.css(this[i], "display") === "none" ) {  
var tagName = this[i].tagName, display;  
 
if ( elemdisplay[ tagName ] ) {  
display = elemdisplay[ tagName ];  
} else {  
var elem = jQuery("<" + tagName + " />").appendTo("body");  
 
display = elem.css("display");  
if ( display === "none" )  
display = "block";  
 
elem.remove();  
 
elemdisplay[ tagName ] = display;  
}  
 
jQuery.data(this[i], "olddisplay", display);  
}  
}  
 
// Set the display of the elements in a second loop  
// to avoid the constant reflow  
for ( var i = 0, l = this.length; i < l; i++ ){  
this[i].style.display = jQuery.data(this[i], "olddisplay") || "";  
}  
 
return this;  
}  
},  
 
hide: function(speed,callback){  
if ( speed ) {  
return this.animate( genFx("hide", 3), speed, callback);  
} else {  
for ( var i = 0, l = this.length; i < l; i++ ){  
var old = jQuery.data(this[i], "olddisplay");  
if ( !old && old !== "none" )  
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));  
}  
 
// Set the display of the elements in a second loop  
// to avoid the constant reflow  
for ( var i = 0, l = this.length; i < l; i++ ){  
this[i].style.display = "none";  
}  
 
return this;  
}  
},  
 
// Save the old toggle function  
_toggle: jQuery.fn.toggle,  
 
toggle: function( fn, fn2 ){  
var bool = typeof fn === "boolean";  
 
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?  
this._toggle.apply( this, arguments ) :  
fn == null || bool ?  
this.each(function(){  
var state = bool ? fn : jQuery(this).is(":hidden");  
jQuery(this)[ state ? "show" : "hide" ]();  
}) :  
this.animate(genFx("toggle", 3), fn, fn2);  
},  
 
fadeTo: function(speed,to,callback){  
return this.animate({opacity: to}, speed, callback);  
},  
 
animate: function( prop, speed, easing, callback ) {  
var optall = jQuery.speed(speed, easing, callback);  
 
return this[ optall.queue === false ? "each" : "queue" ](function(){  
 
var opt = jQuery.extend({}, optall), p,  
hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),  
self = this;  
 
for ( p in prop ) {  
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )  
return opt.complete.call(this);  
 
if ( ( p == "height" || p == "width" ) && this.style ) {  
// Store display property  
opt.display = jQuery.css(this, "display");  
 
// Make sure that nothing sneaks out  
opt.overflow = this.style.overflow;  
}  
}  
 
if ( opt.overflow != null )  
this.style.overflow = "hidden";  
 
opt.curAnim = jQuery.extend({}, prop);  
 
jQuery.each( prop, function(name, val){  
var e = new jQuery.fx( self, opt, name );  
 
if ( /toggle|show|hide/.test(val) )  
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );  
else {  
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),  
start = e.cur(true) || 0;  
 
if ( parts ) {  
var end = parseFloat(parts[2]),  
unit = parts[3] || "px";  
 
// We need to compute starting value  
if ( unit != "px" ) {  
self.style[ name ] = (end || 1) + unit;  
start = ((end || 1) / e.cur(true)) * start;  
self.style[ name ] = start + unit;  
}  
 
// If a +=/-= token was provided, we're doing a relative animation  
if ( parts[1] )  
end = ((parts[1] == "-=" ? -1 : 1) * end) + start;  
 
e.custom( start, end, unit );  
} else  
e.custom( start, val, "" );  
}  
});  
 
// For JS strict compliance  
return true;  
});  
},  
 
stop: function(clearQueue, gotoEnd){  
var timers = jQuery.timers;  
 
if (clearQueue)  
this.queue([]);  
 
this.each(function(){  
// go in reverse order so anything added to the queue during the loop is ignored  
for ( var i = timers.length - 1; i >= 0; i-- )  
if ( timers[i].elem == this ) {  
if (gotoEnd)  
// force the next step to be the last  
timers[i](true);  
timers.splice(i, 1);  
}  
});  
 
// start the next in the queue if the last step wasn't forced  
if (!gotoEnd)  
this.dequeue();  
 
return this;  
}  
 
});  
 
// Generate shortcuts for custom animations  
jQuery.each({  
slideDown: genFx("show", 1),  
slideUp: genFx("hide", 1),  
slideToggle: genFx("toggle", 1),  
fadeIn: { opacity: "show" },  
fadeOut: { opacity: "hide" }  
}, function( name, props ){  
jQuery.fn[ name ] = function( speed, callback ){  
return this.animate( props, speed, callback );  
};  
});  
 
jQuery.extend({  
 
speed: function(speed, easing, fn) {  
var opt = typeof speed === "object" ? speed : {  
complete: fn || !fn && easing ||  
jQuery.isFunction( speed ) && speed,  
duration: speed,  
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing  
};  
 
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :  
jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;  
 
// Queueing  
opt.old = opt.complete;  
opt.complete = function(){  
if ( opt.queue !== false )  
jQuery(this).dequeue();  
if ( jQuery.isFunction( opt.old ) )  
opt.old.call( this );  
};  
 
return opt;  
},  
 
easing: {  
linear: function( p, n, firstNum, diff ) {  
return firstNum + diff * p;  
},  
swing: function( p, n, firstNum, diff ) {  
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;  
}  
},  
 
timers: [],  
 
fx: function( elem, options, prop ){  
this.options = options;  
this.elem = elem;  
this.prop = prop;  
 
if ( !options.orig )  
options.orig = {};  
}  
 
});  
 
jQuery.fx.prototype = {  
 
// Simple function for setting a style value  
update: function(){  
if ( this.options.step )  
this.options.step.call( this.elem, this.now, this );  
 
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );  
 
// Set display property to block for height/width animations  
if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )  
this.elem.style.display = "block";  
},  
 
// Get the current size  
cur: function(force){  
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )  
return this.elem[ this.prop ];  
 
var r = parseFloat(jQuery.css(this.elem, this.prop, force));  
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;  
},  
 
// Start an animation from one number to another  
custom: function(from, to, unit){  
this.startTime = now();  
this.start = from;  
this.end = to;  
this.unit = unit || this.unit || "px";  
this.now = this.start;  
this.pos = this.state = 0;  
 
var self = this;  
function t(gotoEnd){  
return self.step(gotoEnd);  
}  
 
t.elem = this.elem;  
 
if ( t() && jQuery.timers.push(t) && !timerId ) {  
timerId = setInterval(function(){  
var timers = jQuery.timers;  
 
for ( var i = 0; i < timers.length; i++ )  
if ( !timers[i]() )  
timers.splice(i--, 1);  
 
if ( !timers.length ) {  
clearInterval( timerId );  
timerId = undefined;  
}  
}, 13);  
}  
},  
 
// Simple 'show' function  
show: function(){  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );  
this.options.show = true;  
 
// Begin the animation  
// Make sure that we start at a small width/height to avoid any  
// flash of content  
this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());  
 
// Start by showing the element  
jQuery(this.elem).show();  
},  
 
// Simple 'hide' function  
hide: function(){  
// Remember where we started, so that we can go back to it later  
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );  
this.options.hide = true;  
 
// Begin the animation  
this.custom(this.cur(), 0);  
},  
 
// Each step of an animation  
step: function(gotoEnd){  
var t = now();  
 
if ( gotoEnd || t >= this.options.duration + this.startTime ) {  
this.now = this.end;  
this.pos = this.state = 1;  
this.update();  
 
this.options.curAnim[ this.prop ] = true;  
 
var done = true;  
for ( var i in this.options.curAnim )  
if ( this.options.curAnim[i] !== true )  
done = false;  
 
if ( done ) {  
if ( this.options.display != null ) {  
// Reset the overflow  
this.elem.style.overflow = this.options.overflow;  
 
// Reset the display  
this.elem.style.display = this.options.display;  
if ( jQuery.css(this.elem, "display") == "none" )  
this.elem.style.display = "block";  
}  
 
// Hide the element if the "hide" operation was done  
if ( this.options.hide )  
jQuery(this.elem).hide();  
 
// Reset the properties, if the item has been hidden or shown  
if ( this.options.hide || this.options.show )  
for ( var p in this.options.curAnim )  
jQuery.attr(this.elem.style, p, this.options.orig[p]);  
 
// Execute the complete function  
this.options.complete.call( this.elem );  
}  
 
return false;  
} else {  
var n = t - this.startTime;  
this.state = n / this.options.duration;  
 
// Perform the easing function, defaults to swing  
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);  
this.now = this.start + ((this.end - this.start) * this.pos);  
 
// Perform the next step of the animation  
this.update();  
}  
 
return true;  
}  
 
};  
 
jQuery.extend( jQuery.fx, {  
speeds:{  
slow: 600,  
fast: 200,  
// Default speed  
_default: 400  
},  
step: {  
 
opacity: function(fx){  
jQuery.attr(fx.elem.style, "opacity", fx.now);  
},  
 
_default: function(fx){  
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )  
fx.elem.style[ fx.prop ] = fx.now + fx.unit;  
else  
fx.elem[ fx.prop ] = fx.now;  
}  
}  
});  
if ( document.documentElement["getBoundingClientRect"] )  
jQuery.fn.offset = function() {  
if ( !this[0] ) return { top: 0, left: 0 };  
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );  
var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,  
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,  
top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,  
left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;  
return { top: top, left: left };  
};  
else  
jQuery.fn.offset = function() {  
if ( !this[0] ) return { top: 0, left: 0 };  
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );  
jQuery.offset.initialized || jQuery.offset.initialize();  
 
var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,  
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,  
body = doc.body, defaultView = doc.defaultView,  
prevComputedStyle = defaultView.getComputedStyle(elem, null),  
top = elem.offsetTop, left = elem.offsetLeft;  
 
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {  
computedStyle = defaultView.getComputedStyle(elem, null);  
top -= elem.scrollTop, left -= elem.scrollLeft;  
if ( elem === offsetParent ) {  
top += elem.offsetTop, left += elem.offsetLeft;  
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )  
top += parseInt( computedStyle.borderTopWidth, 10) || 0,  
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;  
prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;  
}  
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )  
top += parseInt( computedStyle.borderTopWidth, 10) || 0,  
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;  
prevComputedStyle = computedStyle;  
}  
 
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )  
top += body.offsetTop,  
left += body.offsetLeft;  
 
if ( prevComputedStyle.position === "fixed" )  
top += Math.max(docElem.scrollTop, body.scrollTop),  
left += Math.max(docElem.scrollLeft, body.scrollLeft);  
 
return { top: top, left: left };  
};  
 
jQuery.offset = {  
initialize: function() {  
if ( this.initialized ) return;  
var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,  
html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';  
 
rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };  
for ( prop in rules ) container.style[prop] = rules[prop];  
 
container.innerHTML = html;  
body.insertBefore(container, body.firstChild);  
innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;  
 
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);  
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);  
 
innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';  
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);  
 
body.style.marginTop = '1px';  
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);  
body.style.marginTop = bodyMarginTop;  
 
body.removeChild(container);  
this.initialized = true;  
},  
 
bodyOffset: function(body) {  
jQuery.offset.initialized || jQuery.offset.initialize();  
var top = body.offsetTop, left = body.offsetLeft;  
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )  
top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,  
left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;  
return { top: top, left: left };  
}  
};  
 
 
jQuery.fn.extend({  
position: function() {  
var left = 0, top = 0, results;  
 
if ( this[0] ) {  
// Get *real* offsetParent  
var offsetParent = this.offsetParent(),  
 
// Get correct offsets  
offset = this.offset(),  
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();  
 
// Subtract element margins  
// note: when an element has margin: auto the offsetLeft and marginLeft  
// are the same in Safari causing offset.left to incorrectly be 0  
offset.top -= num( this, 'marginTop' );  
offset.left -= num( this, 'marginLeft' );  
 
// Add offsetParent borders  
parentOffset.top += num( offsetParent, 'borderTopWidth' );  
parentOffset.left += num( offsetParent, 'borderLeftWidth' );  
 
// Subtract the two offsets  
results = {  
top: offset.top - parentOffset.top,  
left: offset.left - parentOffset.left  
};  
}  
 
return results;  
},  
 
offsetParent: function() {  
var offsetParent = this[0].offsetParent || document.body;  
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )  
offsetParent = offsetParent.offsetParent;  
return jQuery(offsetParent);  
}  
});  
 
 
// Create scrollLeft and scrollTop methods  
jQuery.each( ['Left', 'Top'], function(i, name) {  
var method = 'scroll' + name;  
 
jQuery.fn[ method ] = function(val) {  
if (!this[0]) return null;  
 
return val !== undefined ?  
 
// Set the scroll offset  
this.each(function() {  
this == window || this == document ?  
window.scrollTo(  
!i ? val : jQuery(window).scrollLeft(),  
i ? val : jQuery(window).scrollTop()  
) :  
this[ method ] = val;  
}) :  
 
// Return the scroll offset  
this[0] == window || this[0] == document ?  
self[ i ? 'pageYOffset' : 'pageXOffset' ] ||  
jQuery.boxModel && document.documentElement[ method ] ||  
document.body[ method ] :  
this[0][ method ];  
};  
});  
// Create innerHeight, innerWidth, outerHeight and outerWidth methods  
jQuery.each([ "Height", "Width" ], function(i, name){  
 
var tl = i ? "Left" : "Top", // top or left  
br = i ? "Right" : "Bottom", // bottom or right  
lower = name.toLowerCase();  
 
// innerHeight and innerWidth  
jQuery.fn["inner" + name] = function(){  
return this[0] ?  
jQuery.css( this[0], lower, false, "padding" ) :  
null;  
};  
 
// outerHeight and outerWidth  
jQuery.fn["outer" + name] = function(margin) {  
return this[0] ?  
jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :  
null;  
};  
 
var type = name.toLowerCase();  
 
jQuery.fn[ type ] = function( size ) {  
// Get window width or height  
return this[0] == window ?  
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode  
document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||  
document.body[ "client" + name ] :  
 
// Get document width or height  
this[0] == document ?  
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater  
Math.max(  
document.documentElement["client" + name],  
document.body["scroll" + name], document.documentElement["scroll" + name],  
document.body["offset" + name], document.documentElement["offset" + name]  
) :  
 
// Get or set width or height on the element  
size === undefined ?  
// Get width or height on the element  
(this.length ? jQuery.css( this[0], type ) : null) :  
 
// Set the width or height on the element (default to pixels if value is unitless)  
this.css( type, typeof size === "string" ? size : size + "px" );  
};  
 
});  
})();  
 
/*  
* 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 window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this}if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){selector=jQuery.clean([match[1]],context)}else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3]){return jQuery().find(selector)}var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret}}else{return jQuery(context).find(selector)}}else{if(jQuery.isFunction(selector)){return jQuery(document).ready(selector)}}if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector}else{if(name){ret.selector=this.selector+"."+name+"("+selector+")"}}return ret},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this},each:function(callback,args){return jQuery.each(this,callback,args)},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(typeof name==="string"){if(value===undefined){return this[0]&&jQuery[type||"attr"](this[0],name)}else{options={};options[name]=value}}return this.each(function(i){for(name in options){jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))}})},css:function(key,value){if((key=="width"||key=="height")&&parseFloat(value)<0){value=undefined}return this.attr(key,value,"curCSS")},text:function(text){if(typeof text!=="object"&&text!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text))}var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8){ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])}})});return ret},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstChild){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1){this.insertBefore(elem,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)})),"find",selector)}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName){return }var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)}}i++})}return ret},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1})),"filter",selector)},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur}cur=cur.parentNode;closer++}})},not:function(selector){if(typeof selector==="string"){if(isSimple.test(selector)){return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector)}else{selector=jQuery.multiFilter(selector,this)}}var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector})},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))))},is:function(selector){return !!selector&&jQuery.multiFilter(selector,this).length>0},hasClass:function(selector){return !!selector&&this.is("."+selector)},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text}if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0){return null}for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one){return value}values.push(value)}}return values}return(elem.value||"").replace(/\r/g,"")}return undefined}if(typeof value==="number"){value+=""}return this.each(function(){if(this.nodeType!=1){return }if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type)){this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0)}else{if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)});if(!values.length){this.selectedIndex=-1}}else{this.value=value}}})},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value)},replaceWith:function(value){return this.after(value).remove()},eq:function(i){return this.slice(i,+i+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first){for(var i=0,l=this.length;i<l;i++){callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment)}}if(scripts){jQuery.each(scripts,evalScript)}}return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"})}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"")}if(elem.parentNode){elem.parentNode.removeChild(elem)}}function now(){return +new Date}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(length==i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(var name in options){var src=target[name],copy=options[name];if(target===copy){continue}if(deep&&copy&&typeof copy==="object"&&!copy.nodeType){target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy)}else{if(copy!==undefined){target[name]=copy}}}}}return target};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery}return jQuery},isFunction:function(obj){return toString.call(obj)==="[object Function]"},isArray:function(obj){return toString.call(obj)==="[object Array]"},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data))}else{script.text=data}head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object){if(callback.apply(object[name],args)===false){break}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break}}}}else{if(length===undefined){for(name in object){if(callback.call(object[name],name,object[name])===false){break}}}else{for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}return object},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value)){value=value.call(elem,i)}return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)){elem.className+=(elem.className?" ":"")+className}})},remove:function(elem,classNames){if(elem.nodeType==1){elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return !jQuery.className.has(classNames,className)}).join(" "):""}},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name]}callback.call(elem);for(var name in options){elem.style[name]=old[name]}},css:function(elem,name,force,extra){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return }jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0}if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0}})}if(elem.offsetWidth!==0){getWH()}else{jQuery.swap(elem,props,getWH)}return Math.max(0,Math.round(val))}return jQuery.curCSS(elem,name,force)},curCSS:function(elem,name,force){var ret,style=elem.style;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret}if(name.match(/float/i)){name=styleFloat}if(!force&&style&&style[name]){ret=style[name]}else{if(defaultView.getComputedStyle){if(name.match(/float/i)){name="float"}name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle){ret=computedStyle.getPropertyValue(name)}if(name=="opacity"&&ret==""){ret="1"}}else{if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft}}}}return ret},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document}if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match){return[context.createElement(match[1])]}}var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number"){elem+=""}if(!elem){return }if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"});var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--){div=div.lastChild}if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])}}}if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem)){div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild)}elem=jQuery.makeArray(div.childNodes)}if(elem.nodeType){ret.push(elem)}else{ret=jQuery.merge(ret,elem)}});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))))}fragment.appendChild(ret[i])}}return scripts}return ret},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined}var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode){elem.parentNode.selectedIndex}if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode){throw"type property can't be changed"}elem[name]=value}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue}if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined}return elem[name]}if(!jQuery.support.style&&notxml&&name=="style"){return jQuery.attr(elem.style,"cssText",value)}if(set){elem.setAttribute(name,""+value)}var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr}if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+""=="NaN"?"":"alpha(opacity="+value*100+")")}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase()});if(set){elem[name]=value}return elem[name]},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"")},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval){ret[0]=array}else{while(i){ret[--i]=array[i]}}}return ret},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i}}return -1},merge:function(first,second){var i=0,elem,pos=first.length;if(!jQuery.support.getAll){while((elem=second[i++])!=null){if(elem.nodeType!=8){first[pos++]=elem}}}else{while((elem=second[i++])!=null){first[pos++]=elem}}return first},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i])}}}catch(e){ret=array}return ret},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!=!callback(elems[i],i)){ret.push(elems[i])}}return ret},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null){ret[ret.length]=value}}return ret.concat.apply([],ret)}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};jQuery.each({parent:function(elem){return elem.parentNode},parents:function(elem){return jQuery.dir(elem,"parentNode")},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string"){ret=jQuery.multiFilter(selector,ret)}return this.pushStack(jQuery.unique(ret),name,selector)}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems)}return this.pushStack(ret,name,selector)}});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1){this.removeAttribute(name)}},addClass:function(classNames){jQuery.className.add(this,classNames)},removeClass:function(classNames){jQuery.className.remove(this,classNames)},toggleClass:function(classNames,state){if(typeof state!=="boolean"){state=!jQuery.className.has(this,classNames)}jQuery.className[state?"add":"remove"](this,classNames)},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);jQuery.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){jQuery(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)}});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0}var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id){id=elem[expando]=++uuid}if(name&&!jQuery.cache[id]){jQuery.cache[id]={}}if(data!==undefined){jQuery.cache[id][name]=data}return name?jQuery.cache[id][name]:id},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id]){break}if(!name){jQuery.removeData(elem)}}}else{try{delete elem[expando]}catch(e){if(elem.removeAttribute){elem.removeAttribute(expando)}}delete jQuery.cache[id]}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data))}else{if(data){q.push(data)}}}return q},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx"){fn=queue[0]}if(fn!==undefined){fn.call(elem)}}});jQuery.fn.extend({data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key)}return data===undefined&&parts[1]?this.data(parts[0]):data}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value)})}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx"}if(data===undefined){return jQuery.queue(this[0],type)}return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1){queue[0].call(this)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})}});  
/*  
* Sizzle CSS Selector Engine - v0.9.3  
* Copyright 2009, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
* More information: http://sizzlejs.com/  
*/  
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[]}if(!selector||typeof selector!=="string"){return results}var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift()}set=posProcess(selector,set)}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set)}else{prune=false}while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur=""}else{pop=parts.pop()}if(pop==null){pop=context}Expr.relative[cur](checkSet,pop,isXML(context))}}if(!checkSet){checkSet=set}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)}else{if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])}}}}}else{makeArray(checkSet,results)}if(extra){Sizzle(extra,context,results,seed);if(sortOrder){hasDuplicate=false;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1)}}}}}return results};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[]}for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break}}}}if(!set){set=context.getElementsByTagName("*")}return{set:set,expr:expr}};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[]}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true}else{if(match===true){continue}}}if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true}else{curLoop[i]=false}}else{if(pass){result.push(item);anyFound=true}}}}}if(found!==undefined){if(!inplace){curLoop=result}expr=expr.replace(Expr.match[type],"");if(!anyFound){return[]}break}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr}else{break}}old=expr}return curLoop};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase()}for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part}}if(isPartStr){Sizzle.filter(part,checkSet,true)}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[]}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])}}return ret.length===0?null:ret}},TAG:function(match,context){return context.getElementsByTagName(match[1])}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match}for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)}}else{if(inplace){curLoop[i]=false}}}}return false},ID:function(match){return match[1].replace(/\\/g,"")},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0}match[0]=done++;return match},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]}if(match[2]==="~="){match[4]=" "+match[4]+" "}return match},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret)}return false}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true}}return match},POS:function(match){match.unshift(true);return match}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"},disabled:function(elem){return elem.disabled===true},checked:function(elem){return elem.checked===true},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true},parent:function(elem){return !!elem.firstChild},empty:function(elem){return !elem.firstChild},has:function(elem,i,match){return !!Sizzle(match[3],elem).length},header:function(elem){return/h\d/i.test(elem.nodeName)},text:function(elem){return"text"===elem.type},radio:function(elem){return"radio"===elem.type},checkbox:function(elem){return"checkbox"===elem.type},file:function(elem){return"file"===elem.type},password:function(elem){return"password"===elem.type},submit:function(elem){return"submit"===elem.type},image:function(elem){return"image"===elem.type},reset:function(elem){return"reset"===elem.type},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)}},setFilters:{first:function(elem,i){return i===0},last:function(elem,i,match,array){return i===array.length-1},even:function(elem,i){return i%2===0},odd:function(elem,i){return i%2===1},lt:function(elem,i,match){return i<match[3]-0},gt:function(elem,i,match){return i>match[3]-0},nth:function(elem,i,match){return match[3]-0==i},eq:function(elem,i,match){return match[3]-0==i}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array)}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0}else{if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false}}return true}}}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false}}if(type=="first"){return true}node=elem;case"last":while(node=node.nextSibling){if(node.nodeType===1){return false}}return true;case"nth":var first=match[2],last=match[3];if(first==1&&last==0){return true}var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count}}parent.sizcache=doneName}var diff=elem.nodeIndex-last;if(first==0){return diff==0}else{return(diff%first==0&&diff/first>=0)}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array)}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results}return array};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i])}}else{for(var i=0;array[i];i++){ret.push(array[i])}}}return ret}}var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true}return ret}}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true}return ret}}else{if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.selectNode(a);aRange.collapse(true);bRange.selectNode(b);bRange.collapse(true);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true}return ret}}}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match}}root.removeChild(form)})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i])}}results=tmp}return results}}div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return }Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)}catch(e){}}return oldSizzle(query,context,extra,seed)};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0){return }div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return }Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])}}})()}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i}elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i}if(elem.nodeName===cur){match=elem;break}elem=elem[dir]}checkSet[i]=match}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i}elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i}if(typeof cur!=="string"){if(elem===cur){match=true;break}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;break}}}elem=elem[dir]}checkSet[i]=match}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"")}selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet)}return Sizzle.filter(later,tmpSet)};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0};Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"}return Sizzle.matches(expr,elems)};jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1){matched.push(cur)}cur=cur[dir]}return matched};jQuery.nth=function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType==1&&++num==result){break}}return cur};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem){r.push(n)}}return r};return ;window.Sizzle=Sizzle})();jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8){return }if(elem.setInterval&&elem!=window){elem=window}if(!handler.guid){handler.guid=this.guid++}if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].setup.call(elem,data,namespaces)}if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener){elem.addEventListener(type,handle,false)}else{if(elem.attachEvent){elem.attachEvent("on"+type,handle)}}}}handlers[handler.guid]=handler;jQuery.event.global[type]=true});elem=null},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8){return }var events=jQuery.data(elem,"events"),ret,index;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)==".")){for(var type in events){this.remove(elem,type+(types||""))}}else{if(types.type){handler=types.handler;types=types.type}jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler){delete events[type][handler.guid]}else{for(var handle in events[type]){if(namespace.test(events[type][handle].type)){delete events[type][handle]}}}if(jQuery.event.specialAll[type]){jQuery.event.specialAll[type].teardown.call(elem,namespaces)}for(ret in events[type]){break}if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener){elem.removeEventListener(type,jQuery.data(elem,"handle"),false)}else{if(elem.detachEvent){elem.detachEvent("on"+type,jQuery.data(elem,"handle"))}}}ret=null;delete events[type]}}})}for(ret in events){break}if(!ret){var handle=jQuery.data(elem,"handle");if(handle){handle.elem=null}jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle")}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true}if(!elem){event.stopPropagation();if(this.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem)}})}}if(!elem||elem.nodeType==3||elem.nodeType==8){return undefined}event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event)}event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle){handle.apply(elem,data)}if((!elem[type]||(jQuery.nodeName(elem,"a")&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false}if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,"a")&&type=="click")){this.triggered=true;try{elem[type]()}catch(e){}}this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent){jQuery.event.trigger(event,data,parent,true)}}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation()}}if(event.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event}var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop]}if(!event.target){event.target=event.srcElement||document}if(event.target.nodeType==3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0)}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))}return event},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments)};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type)){remove++}});if(remove<1){jQuery.event.remove(this,namespaces[0],liveHandler)}}}}}};jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src)}if(src&&src.type){this.originalEvent=src;this.type=src.type}else{this.type=src}this.timeStamp=now();this[expando]=true};function returnFalse(){return false}function returnTrue(){return true}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return }if(e.preventDefault){e.preventDefault()}e.returnValue=false},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return }if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!=this){try{parent=parent.parentNode}catch(e){parent=this}}if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments)}};jQuery.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)},teardown:function(){jQuery.event.remove(this,orig,withinElement)}}});jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data)})},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments)});return this.each(function(){jQuery.event.add(this,type,one,fn&&data)})},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn)})},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result}},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.event.proxy(fn,args[i++])}return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false}))},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut)},ready:function(fn){bindReady();if(jQuery.isReady){fn.call(document,jQuery)}else{jQuery.readyList.push(fn)}return this},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem){elems.push({elem:elem,fn:fn})}}});elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest")});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false){return(stop=false)}});return stop}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")}jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery)});jQuery.readyList=null}jQuery(document).triggerHandler("ready")}}});var readyBound=false;function bindReady(){if(readyBound){return }readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(jQuery.isReady){return }try{document.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return }jQuery.ready()})()}}}jQuery.event.add(window,"load",jQuery.ready)}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)}});jQuery(window).bind("unload",function(){for(var id in jQuery.cache){if(id!=1&&jQuery.cache[id].handle){jQuery.event.remove(jQuery.cache[id].handle.elem)}}});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();div.style.display="none";div.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return }jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"))}catch(e){}root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id]}root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee)});div.cloneNode(true).fireEvent("onclick")}jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display="none"})})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string"){return this._load(url)}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null}else{if(typeof params==="object"){params=jQuery.param(params);type="POST"}}}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified"){self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText)}if(callback){self.each(callback,[res.responseText,status,res])}}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val}}):{name:elem.name,value:val}}).get()}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)}});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})},getScript:function(url,callback){return jQuery.get(url,null,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={}}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type})},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data)}if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre)){s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?"}}else{if(!s.data||!s.data.match(jsre)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"}}s.dataType="json"}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1")}s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp]}catch(e){}if(head){head.removeChild(script)}}}if(s.dataType=="script"&&s.cache==null){s.cache=false}if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"")}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null}if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")}var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset}if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;head.removeChild(script)}}}head.appendChild(script);return undefined}var requestDone=false;var xhr=s.xhr();if(s.username){xhr.open(type,s.url,s.async,s.username,s.password)}else{xhr.open(type,s.url,s.async)}try{if(s.data){xhr.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}xhr.abort();return false}if(s.global){jQuery.event.trigger("ajaxSend",[xhr,s])}var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}else{if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null}status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s)}catch(e){status="parsererror"}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified")}catch(e){}if(s.ifModified&&modRes){jQuery.lastModified[s.url]=modRes}if(!jsonp){success()}}else{jQuery.handleError(s,xhr,status)}complete();if(isTimeout){xhr.abort()}if(s.async){xhr=null}}}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0){setTimeout(function(){if(xhr&&!requestDone){onreadystatechange("timeout")}},s.timeout)}}try{xhr.send(s.data)}catch(e){jQuery.handleError(s,xhr,null,e)}if(!s.async){onreadystatechange()}function success(){if(s.success){s.success(data,status)}if(s.global){jQuery.event.trigger("ajaxSuccess",[xhr,s])}}function complete(){if(s.complete){s.complete(xhr,status)}if(s.global){jQuery.event.trigger("ajaxComplete",[xhr,s])}if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}}return xhr},handleError:function(s,xhr,status,e){if(s.error){s.error(xhr,status,e)}if(s.global){jQuery.event.trigger("ajaxError",[xhr,s,e])}},active:0,httpSuccess:function(xhr){try{return !xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223}catch(e){}return false},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]}catch(e){}return false},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror"){throw"parsererror"}if(s&&s.dataFilter){data=s.dataFilter(data,type)}if(typeof data==="string"){if(type=="script"){jQuery.globalEval(data)}if(type=="json"){data=window["eval"]("("+data+")")}}return data},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)}if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value)})}else{for(var j in a){if(jQuery.isArray(a[j])){jQuery.each(a[j],function(){add(j,this)})}else{add(j,jQuery.isFunction(a[j])?a[j]():a[j])}}}return s.join("&").replace(/%20/g,"+")}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type});return obj}jQuery.fn.extend({show:function(speed,callback){if(speed){return this.animate(genFx("show",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName]}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none"){display="block"}elem.remove();elemdisplay[tagName]=display}jQuery.data(this[i],"olddisplay",display)}}for(var i=0,l=this.length;i<l;i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||""}return this}},hide:function(speed,callback){if(speed){return this.animate(genFx("hide",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))}}for(var i=0,l=this.length;i<l;i++){this[i].style.display="none"}return this}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]()}):this.animate(genFx("toggle",3),fn,fn2)},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback)},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden){return opt.complete.call(this)}if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow}}if(opt.overflow!=null){this.style.overflow="hidden"}opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val)){e[val=="toggle"?hidden?"show":"hide":val](prop)}else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit}if(parts[1]){end=((parts[1]=="-="?-1:1)*end)+start}e.custom(start,end,unit)}else{e.custom(start,val,"")}}});return true})},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([])}this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem==this){if(gotoEnd){timers[i](true)}timers.splice(i,1)}}});if(!gotoEnd){this.dequeue()}return this}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)}});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue()}if(jQuery.isFunction(opt.old)){opt.old.call(this)}};return opt},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={}}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1)}}if(!timers.length){clearInterval(timerId);timerId=undefined}},13)}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(gotoEnd){var t=now();if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false}}if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){jQuery(this.elem).hide()}if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.attr(this.elem.style,p,this.options.orig[p])}}this.options.complete.call(this.elem)}return false}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=fx.now+fx.unit}else{fx.elem[fx.prop]=fx.now}}}});if(document.documentElement.getBoundingClientRect){jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])}var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left}}}else{jQuery.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.offset.bodyOffset(this[0])}jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName))){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0}prevOffsetParent=offsetParent,offsetParent=elem.offsetParent}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0}prevComputedStyle=computedStyle}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop,left+=body.offsetLeft}if(prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft)}return{top:top,left:left}}}jQuery.offset={initialize:function(){if(this.initialized){return }var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(prop in rules){container.style[prop]=rules[prop]}container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow="hidden",innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseInt(jQuery.curCSS(body,"marginTop",true),10)||0,left+=parseInt(jQuery.curCSS(body,"marginLeft",true),10)||0}return{top:top,left:left}}};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,"marginTop");offset.left-=num(this,"marginLeft");parentOffset.top+=num(offsetParent,"borderTopWidth");parentOffset.left+=num(offsetParent,"borderLeftWidth");results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}}return results},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,"position")=="static")){offsetParent=offsetParent.offsetParent}return jQuery(offsetParent)}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){if(!this[0]){return null}return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val}):this[0]==window||this[0]==document?self[i?"pageYOffset":"pageXOffset"]||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method]}});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")}})})();  
<?php  
// ...  
?>  
/*!  
* jQuery JavaScript Library v1.4.2  
* http://jquery.com/  
*  
* Copyright 2010, John Resig  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* Includes Sizzle.js  
* http://sizzlejs.com/  
* Copyright 2010, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
*  
* Date: Sat Feb 13 22:33:48 2010 -0500  
*/  
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?  
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=  
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,  
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=  
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,  
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&  
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,  
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===  
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,  
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||  
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",  
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,  
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+  
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],  
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===  
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&  
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=  
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";  
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,  
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=  
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=  
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,  
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];  
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,  
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===  
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,  
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",  
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",  
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=  
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=  
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=  
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");  
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,  
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");  
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),  
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=  
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=  
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&  
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;  
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),  
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||  
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,  
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=  
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,  
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=  
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};  
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",  
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,  
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,  
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&  
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},  
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,  
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),  
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];  
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,  
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();  
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||  
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];  
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-  
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,  
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},  
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=  
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];  
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},  
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,  
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},  
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},  
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=  
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=  
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===  
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,  
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||  
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=  
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&  
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";  
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();  
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:  
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,  
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;  
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=  
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===  
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",  
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?  
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===  
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?  
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=  
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},  
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},  
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,  
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);  
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,  
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&  
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||  
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===  
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);  
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",  
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=  
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?  
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=  
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=  
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,  
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=  
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=  
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==  
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},  
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),  
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,  
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&  
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?  
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===  
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=  
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",  
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||  
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);  
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===  
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===  
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;  
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");  
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],  
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},  
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=  
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);  
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===  
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||  
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;  
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=  
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,  
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||  
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?  
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=  
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;  
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&  
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";  
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);  
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,  
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-  
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":  
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in  
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);  
 
// based on methodology developed by PPK:  
// http://www.quirksmode.org/blog/archives/2009/08/when_to_read_ou.html  
(function($){  
$.benchmark = function(n, contestant, test){  
var startTime = new Date().getTime();  
 
while (n--)  
contestant.benchmarks[test].call(contestant.templates);  
 
setTimeout(function () {  
var endTime = new Date().getTime();  
var result = (endTime-startTime)/1000;  
contestant.results.push(result);  
},10);  
};  
})(jQuery);  
 
(function(){jQuery.color={};jQuery.color.make=function(G,H,J,I){var A={};A.r=G||0;A.g=H||0;A.b=J||0;A.a=I!=null?I:1;A.add=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]+=D}return A.normalize()};A.scale=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]*=D}return A.normalize()};A.toString=function(){if(A.a>=1){return"rgb("+[A.r,A.g,A.b].join(",")+")"}else{return"rgba("+[A.r,A.g,A.b,A.a].join(",")+")"}};A.normalize=function(){function C(E,D,F){return D<E?E:(D>F?F:D)}A.r=C(0,parseInt(A.r),255);A.g=C(0,parseInt(A.g),255);A.b=C(0,parseInt(A.b),255);A.a=C(0,A.a,1);return A};A.clone=function(){return jQuery.color.make(A.r,A.b,A.g,A.a)};return A.normalize()};jQuery.color.extract=function(E,F){var A;do{A=E.css(F).toLowerCase();if(A!=""&&A!="transparent"){break}E=E.parent()}while(!jQuery.nodeName(E.get(0),"body"));if(A=="rgba(0, 0, 0, 0)"){A="transparent"}return jQuery.color.parse(A)};jQuery.color.parse=function(A){var F,H=jQuery.color.make;if(F=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10))}if(F=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10),parseFloat(F[4]))}if(F=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55)}if(F=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55,parseFloat(F[4]))}if(F=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(A)){return H(parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16))}if(F=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(A)){return H(parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16))}var G=jQuery.trim(A).toLowerCase();if(G=="transparent"){return H(255,255,255,0)}else{F=B[G];return H(F[0],F[1],F[2])}};var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();(function(C){function B(l,W,X,E){var O=[],g={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02},x2axis:{autoscaleMargin:null},y2axis:{autoscaleMargin:0.02},series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454",backgroundColor:null,tickColor:"rgba(0,0,0,0.15)",labelMargin:5,borderWidth:2,borderColor:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},P=null,AC=null,AD=null,Y=null,AJ=null,s={xaxis:{},yaxis:{},x2axis:{},y2axis:{}},e={left:0,right:0,top:0,bottom:0},y=0,Q=0,I=0,t=0,L={processOptions:[],processRawData:[],processDatapoints:[],draw:[],bindEvents:[],drawOverlay:[]},G=this;G.setData=f;G.setupGrid=k;G.draw=AH;G.getPlaceholder=function(){return l};G.getCanvas=function(){return P};G.getPlotOffset=function(){return e};G.width=function(){return I};G.height=function(){return t};G.offset=function(){var AK=AD.offset();AK.left+=e.left;AK.top+=e.top;return AK};G.getData=function(){return O};G.getAxes=function(){return s};G.getOptions=function(){return g};G.highlight=AE;G.unhighlight=x;G.triggerRedrawOverlay=q;G.pointOffset=function(AK){return{left:parseInt(T(AK,"xaxis").p2c(+AK.x)+e.left),top:parseInt(T(AK,"yaxis").p2c(+AK.y)+e.top)}};G.hooks=L;b(G);r(X);c();f(W);k();AH();AG();function Z(AM,AK){AK=[G].concat(AK);for(var AL=0;AL<AM.length;++AL){AM[AL].apply(this,AK)}}function b(){for(var AK=0;AK<E.length;++AK){var AL=E[AK];AL.init(G);if(AL.options){C.extend(true,g,AL.options)}}}function r(AK){C.extend(true,g,AK);if(g.grid.borderColor==null){g.grid.borderColor=g.grid.color}if(g.xaxis.noTicks&&g.xaxis.ticks==null){g.xaxis.ticks=g.xaxis.noTicks}if(g.yaxis.noTicks&&g.yaxis.ticks==null){g.yaxis.ticks=g.yaxis.noTicks}if(g.grid.coloredAreas){g.grid.markings=g.grid.coloredAreas}if(g.grid.coloredAreasColor){g.grid.markingsColor=g.grid.coloredAreasColor}if(g.lines){C.extend(true,g.series.lines,g.lines)}if(g.points){C.extend(true,g.series.points,g.points)}if(g.bars){C.extend(true,g.series.bars,g.bars)}if(g.shadowSize){g.series.shadowSize=g.shadowSize}for(var AL in L){if(g.hooks[AL]&&g.hooks[AL].length){L[AL]=L[AL].concat(g.hooks[AL])}}Z(L.processOptions,[g])}function f(AK){O=M(AK);U();m()}function M(AN){var AL=[];for(var AK=0;AK<AN.length;++AK){var AM=C.extend(true,{},g.series);if(AN[AK].data){AM.data=AN[AK].data;delete AN[AK].data;C.extend(true,AM,AN[AK]);AN[AK].data=AM.data}else{AM.data=AN[AK]}AL.push(AM)}return AL}function T(AM,AK){var AL=AM[AK];if(!AL||AL==1){return s[AK]}if(typeof AL=="number"){return s[AK.charAt(0)+AL+AK.slice(1)]}return AL}function U(){var AP;var AV=O.length,AK=[],AN=[];for(AP=0;AP<O.length;++AP){var AS=O[AP].color;if(AS!=null){--AV;if(typeof AS=="number"){AN.push(AS)}else{AK.push(C.color.parse(O[AP].color))}}}for(AP=0;AP<AN.length;++AP){AV=Math.max(AV,AN[AP]+1)}var AL=[],AO=0;AP=0;while(AL.length<AV){var AR;if(g.colors.length==AP){AR=C.color.make(100,100,100)}else{AR=C.color.parse(g.colors[AP])}var AM=AO%2==1?-1:1;AR.scale("rgb",1+AM*Math.ceil(AO/2)*0.2);AL.push(AR);++AP;if(AP>=g.colors.length){AP=0;++AO}}var AQ=0,AW;for(AP=0;AP<O.length;++AP){AW=O[AP];if(AW.color==null){AW.color=AL[AQ].toString();++AQ}else{if(typeof AW.color=="number"){AW.color=AL[AW.color].toString()}}if(AW.lines.show==null){var AU,AT=true;for(AU in AW){if(AW[AU].show){AT=false;break}}if(AT){AW.lines.show=true}}AW.xaxis=T(AW,"xaxis");AW.yaxis=T(AW,"yaxis")}}function m(){var AW=Number.POSITIVE_INFINITY,AQ=Number.NEGATIVE_INFINITY,Ac,Aa,AZ,AV,AL,AR,Ab,AX,AP,AO,AK,Ai,Af,AT;for(AK in s){s[AK].datamin=AW;s[AK].datamax=AQ;s[AK].used=false}function AN(Al,Ak,Aj){if(Ak<Al.datamin){Al.datamin=Ak}if(Aj>Al.datamax){Al.datamax=Aj}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];AR.datapoints={points:[]};Z(L.processRawData,[AR,AR.data,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];var Ah=AR.data,Ae=AR.datapoints.format;if(!Ae){Ae=[];Ae.push({x:true,number:true,required:true});Ae.push({y:true,number:true,required:true});if(AR.bars.show){Ae.push({y:true,number:true,required:false,defaultValue:0})}AR.datapoints.format=Ae}if(AR.datapoints.pointsize!=null){continue}if(AR.datapoints.pointsize==null){AR.datapoints.pointsize=Ae.length}AX=AR.datapoints.pointsize;Ab=AR.datapoints.points;insertSteps=AR.lines.show&&AR.lines.steps;AR.xaxis.used=AR.yaxis.used=true;for(Aa=AZ=0;Aa<Ah.length;++Aa,AZ+=AX){AT=Ah[Aa];var AM=AT==null;if(!AM){for(AV=0;AV<AX;++AV){Ai=AT[AV];Af=Ae[AV];if(Af){if(Af.number&&Ai!=null){Ai=+Ai;if(isNaN(Ai)){Ai=null}}if(Ai==null){if(Af.required){AM=true}if(Af.defaultValue!=null){Ai=Af.defaultValue}}}Ab[AZ+AV]=Ai}}if(AM){for(AV=0;AV<AX;++AV){Ai=Ab[AZ+AV];if(Ai!=null){Af=Ae[AV];if(Af.x){AN(AR.xaxis,Ai,Ai)}if(Af.y){AN(AR.yaxis,Ai,Ai)}}Ab[AZ+AV]=null}}else{if(insertSteps&&AZ>0&&Ab[AZ-AX]!=null&&Ab[AZ-AX]!=Ab[AZ]&&Ab[AZ-AX+1]!=Ab[AZ+1]){for(AV=0;AV<AX;++AV){Ab[AZ+AX+AV]=Ab[AZ+AV]}Ab[AZ+1]=Ab[AZ-AX+1];AZ+=AX}}}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Z(L.processDatapoints,[AR,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Ab=AR.datapoints.points,AX=AR.datapoints.pointsize;var AS=AW,AY=AW,AU=AQ,Ad=AQ;for(Aa=0;Aa<Ab.length;Aa+=AX){if(Ab[Aa]==null){continue}for(AV=0;AV<AX;++AV){Ai=Ab[Aa+AV];Af=Ae[AV];if(!Af){continue}if(Af.x){if(Ai<AS){AS=Ai}if(Ai>AU){AU=Ai}}if(Af.y){if(Ai<AY){AY=Ai}if(Ai>Ad){Ad=Ai}}}}if(AR.bars.show){var Ag=AR.bars.align=="left"?0:-AR.bars.barWidth/2;if(AR.bars.horizontal){AY+=Ag;Ad+=Ag+AR.bars.barWidth}else{AS+=Ag;AU+=Ag+AR.bars.barWidth}}AN(AR.xaxis,AS,AU);AN(AR.yaxis,AY,Ad)}for(AK in s){if(s[AK].datamin==AW){s[AK].datamin=null}if(s[AK].datamax==AQ){s[AK].datamax=null}}}function c(){function AK(AM,AL){var AN=document.createElement("canvas");AN.width=AM;AN.height=AL;if(C.browser.msie){AN=window.G_vmlCanvasManager.initElement(AN)}return AN}y=l.width();Q=l.height();l.html("");if(l.css("position")=="static"){l.css("position","relative")}if(y<=0||Q<=0){throw"Invalid dimensions for plot, width = "+y+", height = "+Q}if(C.browser.msie){window.G_vmlCanvasManager.init_(document)}P=C(AK(y,Q)).appendTo(l).get(0);Y=P.getContext("2d");AC=C(AK(y,Q)).css({position:"absolute",left:0,top:0}).appendTo(l).get(0);AJ=AC.getContext("2d");AJ.stroke()}function AG(){AD=C([AC,P]);if(g.grid.hoverable){AD.mousemove(D)}if(g.grid.clickable){AD.click(d)}Z(L.bindEvents,[AD])}function k(){function AL(AT,AU){function AP(AV){return AV}var AS,AO,AQ=AU.transform||AP,AR=AU.inverseTransform;if(AT==s.xaxis||AT==s.x2axis){AS=AT.scale=I/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.min);if(AQ==AP){AT.p2c=function(AV){return(AV-AO)*AS}}else{AT.p2c=function(AV){return(AQ(AV)-AO)*AS}}if(!AR){AT.c2p=function(AV){return AO+AV/AS}}else{AT.c2p=function(AV){return AR(AO+AV/AS)}}}else{AS=AT.scale=t/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.max);if(AQ==AP){AT.p2c=function(AV){return(AO-AV)*AS}}else{AT.p2c=function(AV){return(AO-AQ(AV))*AS}}if(!AR){AT.c2p=function(AV){return AO-AV/AS}}else{AT.c2p=function(AV){return AR(AO-AV/AS)}}}}function AN(AR,AT){var AQ,AS=[],AP;AR.labelWidth=AT.labelWidth;AR.labelHeight=AT.labelHeight;if(AR==s.xaxis||AR==s.x2axis){if(AR.labelWidth==null){AR.labelWidth=y/(AR.ticks.length>0?AR.ticks.length:1)}if(AR.labelHeight==null){AS=[];for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel" style="float:left;width:'+AR.labelWidth+'px">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'+AS.join("")+'<div style="clear:left"></div></div>').appendTo(l);AR.labelHeight=AO.height();AO.remove()}}}else{if(AR.labelWidth==null||AR.labelHeight==null){for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;font-size:smaller">'+AS.join("")+"</div>").appendTo(l);if(AR.labelWidth==null){AR.labelWidth=AO.width()}if(AR.labelHeight==null){AR.labelHeight=AO.find("div").height()}AO.remove()}}}if(AR.labelWidth==null){AR.labelWidth=0}if(AR.labelHeight==null){AR.labelHeight=0}}function AM(){var AP=g.grid.borderWidth;for(i=0;i<O.length;++i){AP=Math.max(AP,2*(O[i].points.radius+O[i].points.lineWidth/2))}e.left=e.right=e.top=e.bottom=AP;var AO=g.grid.labelMargin+g.grid.borderWidth;if(s.xaxis.labelHeight>0){e.bottom=Math.max(AP,s.xaxis.labelHeight+AO)}if(s.yaxis.labelWidth>0){e.left=Math.max(AP,s.yaxis.labelWidth+AO)}if(s.x2axis.labelHeight>0){e.top=Math.max(AP,s.x2axis.labelHeight+AO)}if(s.y2axis.labelWidth>0){e.right=Math.max(AP,s.y2axis.labelWidth+AO)}I=y-e.left-e.right;t=Q-e.bottom-e.top}var AK;for(AK in s){K(s[AK],g[AK])}if(g.grid.show){for(AK in s){F(s[AK],g[AK]);p(s[AK],g[AK]);AN(s[AK],g[AK])}AM()}else{e.left=e.right=e.top=e.bottom=0;I=y;t=Q}for(AK in s){AL(s[AK],g[AK])}if(g.grid.show){h()}AI()}function K(AN,AQ){var AM=+(AQ.min!=null?AQ.min:AN.datamin),AK=+(AQ.max!=null?AQ.max:AN.datamax),AP=AK-AM;if(AP==0){var AL=AK==0?1:0.01;if(AQ.min==null){AM-=AL}if(AQ.max==null||AQ.min!=null){AK+=AL}}else{var AO=AQ.autoscaleMargin;if(AO!=null){if(AQ.min==null){AM-=AP*AO;if(AM<0&&AN.datamin!=null&&AN.datamin>=0){AM=0}}if(AQ.max==null){AK+=AP*AO;if(AK>0&&AN.datamax!=null&&AN.datamax<=0){AK=0}}}}AN.min=AM;AN.max=AK}function F(AP,AS){var AO;if(typeof AS.ticks=="number"&&AS.ticks>0){AO=AS.ticks}else{if(AP==s.xaxis||AP==s.x2axis){AO=0.3*Math.sqrt(y)}else{AO=0.3*Math.sqrt(Q)}}var AX=(AP.max-AP.min)/AO,AZ,AT,AV,AW,AR,AM,AL;if(AS.mode=="time"){var AU={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var AY=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var AN=0;if(AS.minTickSize!=null){if(typeof AS.tickSize=="number"){AN=AS.tickSize}else{AN=AS.minTickSize[0]*AU[AS.minTickSize[1]]}}for(AR=0;AR<AY.length-1;++AR){if(AX<(AY[AR][0]*AU[AY[AR][1]]+AY[AR+1][0]*AU[AY[AR+1][1]])/2&&AY[AR][0]*AU[AY[AR][1]]>=AN){break}}AZ=AY[AR][0];AV=AY[AR][1];if(AV=="year"){AM=Math.pow(10,Math.floor(Math.log(AX/AU.year)/Math.LN10));AL=(AX/AU.year)/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM}if(AS.tickSize){AZ=AS.tickSize[0];AV=AS.tickSize[1]}AT=function(Ac){var Ah=[],Af=Ac.tickSize[0],Ai=Ac.tickSize[1],Ag=new Date(Ac.min);var Ab=Af*AU[Ai];if(Ai=="second"){Ag.setUTCSeconds(A(Ag.getUTCSeconds(),Af))}if(Ai=="minute"){Ag.setUTCMinutes(A(Ag.getUTCMinutes(),Af))}if(Ai=="hour"){Ag.setUTCHours(A(Ag.getUTCHours(),Af))}if(Ai=="month"){Ag.setUTCMonth(A(Ag.getUTCMonth(),Af))}if(Ai=="year"){Ag.setUTCFullYear(A(Ag.getUTCFullYear(),Af))}Ag.setUTCMilliseconds(0);if(Ab>=AU.minute){Ag.setUTCSeconds(0)}if(Ab>=AU.hour){Ag.setUTCMinutes(0)}if(Ab>=AU.day){Ag.setUTCHours(0)}if(Ab>=AU.day*4){Ag.setUTCDate(1)}if(Ab>=AU.year){Ag.setUTCMonth(0)}var Ak=0,Aj=Number.NaN,Ad;do{Ad=Aj;Aj=Ag.getTime();Ah.push({v:Aj,label:Ac.tickFormatter(Aj,Ac)});if(Ai=="month"){if(Af<1){Ag.setUTCDate(1);var Aa=Ag.getTime();Ag.setUTCMonth(Ag.getUTCMonth()+1);var Ae=Ag.getTime();Ag.setTime(Aj+Ak*AU.hour+(Ae-Aa)*Af);Ak=Ag.getUTCHours();Ag.setUTCHours(0)}else{Ag.setUTCMonth(Ag.getUTCMonth()+Af)}}else{if(Ai=="year"){Ag.setUTCFullYear(Ag.getUTCFullYear()+Af)}else{Ag.setTime(Aj+Ab)}}}while(Aj<Ac.max&&Aj!=Ad);return Ah};AW=function(Aa,Ad){var Af=new Date(Aa);if(AS.timeformat!=null){return C.plot.formatDate(Af,AS.timeformat,AS.monthNames)}var Ab=Ad.tickSize[0]*AU[Ad.tickSize[1]];var Ac=Ad.max-Ad.min;var Ae=(AS.twelveHourClock)?" %p":"";if(Ab<AU.minute){fmt="%h:%M:%S"+Ae}else{if(Ab<AU.day){if(Ac<2*AU.day){fmt="%h:%M"+Ae}else{fmt="%b %d %h:%M"+Ae}}else{if(Ab<AU.month){fmt="%b %d"}else{if(Ab<AU.year){if(Ac<AU.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return C.plot.formatDate(Af,fmt,AS.monthNames)}}else{var AK=AS.tickDecimals;var AQ=-Math.floor(Math.log(AX)/Math.LN10);if(AK!=null&&AQ>AK){AQ=AK}AM=Math.pow(10,-AQ);AL=AX/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2;if(AL>2.25&&(AK==null||AQ+1<=AK)){AZ=2.5;++AQ}}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM;if(AS.minTickSize!=null&&AZ<AS.minTickSize){AZ=AS.minTickSize}if(AS.tickSize!=null){AZ=AS.tickSize}AP.tickDecimals=Math.max(0,(AK!=null)?AK:AQ);AT=function(Ac){var Ae=[];var Af=A(Ac.min,Ac.tickSize),Ab=0,Aa=Number.NaN,Ad;do{Ad=Aa;Aa=Af+Ab*Ac.tickSize;Ae.push({v:Aa,label:Ac.tickFormatter(Aa,Ac)});++Ab}while(Aa<Ac.max&&Aa!=Ad);return Ae};AW=function(Aa,Ab){return Aa.toFixed(Ab.tickDecimals)}}AP.tickSize=AV?[AZ,AV]:AZ;AP.tickGenerator=AT;if(C.isFunction(AS.tickFormatter)){AP.tickFormatter=function(Aa,Ab){return""+AS.tickFormatter(Aa,Ab)}}else{AP.tickFormatter=AW}}function p(AO,AQ){AO.ticks=[];if(!AO.used){return }if(AQ.ticks==null){AO.ticks=AO.tickGenerator(AO)}else{if(typeof AQ.ticks=="number"){if(AQ.ticks>0){AO.ticks=AO.tickGenerator(AO)}}else{if(AQ.ticks){var AP=AQ.ticks;if(C.isFunction(AP)){AP=AP({min:AO.min,max:AO.max})}var AN,AK;for(AN=0;AN<AP.length;++AN){var AL=null;var AM=AP[AN];if(typeof AM=="object"){AK=AM[0];if(AM.length>1){AL=AM[1]}}else{AK=AM}if(AL==null){AL=AO.tickFormatter(AK,AO)}AO.ticks[AN]={v:AK,label:AL}}}}}if(AQ.autoscaleMargin!=null&&AO.ticks.length>0){if(AQ.min==null){AO.min=Math.min(AO.min,AO.ticks[0].v)}if(AQ.max==null&&AO.ticks.length>1){AO.max=Math.max(AO.max,AO.ticks[AO.ticks.length-1].v)}}}function AH(){Y.clearRect(0,0,y,Q);var AL=g.grid;if(AL.show&&!AL.aboveData){S()}for(var AK=0;AK<O.length;++AK){AA(O[AK])}Z(L.draw,[Y]);if(AL.show&&AL.aboveData){S()}}function N(AL,AR){var AO=AR+"axis",AK=AR+"2axis",AN,AQ,AP,AM;if(AL[AO]){AN=s[AO];AQ=AL[AO].from;AP=AL[AO].to}else{if(AL[AK]){AN=s[AK];AQ=AL[AK].from;AP=AL[AK].to}else{AN=s[AO];AQ=AL[AR+"1"];AP=AL[AR+"2"]}}if(AQ!=null&&AP!=null&&AQ>AP){return{from:AP,to:AQ,axis:AN}}return{from:AQ,to:AP,axis:AN}}function S(){var AO;Y.save();Y.translate(e.left,e.top);if(g.grid.backgroundColor){Y.fillStyle=R(g.grid.backgroundColor,t,0,"rgba(255, 255, 255, 0)");Y.fillRect(0,0,I,t)}var AL=g.grid.markings;if(AL){if(C.isFunction(AL)){AL=AL({xmin:s.xaxis.min,xmax:s.xaxis.max,ymin:s.yaxis.min,ymax:s.yaxis.max,xaxis:s.xaxis,yaxis:s.yaxis,x2axis:s.x2axis,y2axis:s.y2axis})}for(AO=0;AO<AL.length;++AO){var AK=AL[AO],AQ=N(AK,"x"),AN=N(AK,"y");if(AQ.from==null){AQ.from=AQ.axis.min}if(AQ.to==null){AQ.to=AQ.axis.max}if(AN.from==null){AN.from=AN.axis.min}if(AN.to==null){AN.to=AN.axis.max}if(AQ.to<AQ.axis.min||AQ.from>AQ.axis.max||AN.to<AN.axis.min||AN.from>AN.axis.max){continue}AQ.from=Math.max(AQ.from,AQ.axis.min);AQ.to=Math.min(AQ.to,AQ.axis.max);AN.from=Math.max(AN.from,AN.axis.min);AN.to=Math.min(AN.to,AN.axis.max);if(AQ.from==AQ.to&&AN.from==AN.to){continue}AQ.from=AQ.axis.p2c(AQ.from);AQ.to=AQ.axis.p2c(AQ.to);AN.from=AN.axis.p2c(AN.from);AN.to=AN.axis.p2c(AN.to);if(AQ.from==AQ.to||AN.from==AN.to){Y.beginPath();Y.strokeStyle=AK.color||g.grid.markingsColor;Y.lineWidth=AK.lineWidth||g.grid.markingsLineWidth;Y.moveTo(AQ.from,AN.from);Y.lineTo(AQ.to,AN.to);Y.stroke()}else{Y.fillStyle=AK.color||g.grid.markingsColor;Y.fillRect(AQ.from,AN.to,AQ.to-AQ.from,AN.from-AN.to)}}}Y.lineWidth=1;Y.strokeStyle=g.grid.tickColor;Y.beginPath();var AM,AP=s.xaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=s.xaxis.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,0);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,t)}AP=s.yaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(0,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}AP=s.x2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,-5);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,5)}AP=s.y2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(I-5,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I+5,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}Y.stroke();if(g.grid.borderWidth){var AR=g.grid.borderWidth;Y.lineWidth=AR;Y.strokeStyle=g.grid.borderColor;Y.strokeRect(-AR/2,-AR/2,I+AR,t+AR)}Y.restore()}function h(){l.find(".tickLabels").remove();var AK=['<div class="tickLabels" style="font-size:smaller;color:'+g.grid.color+'">'];function AM(AP,AQ){for(var AO=0;AO<AP.ticks.length;++AO){var AN=AP.ticks[AO];if(!AN.label||AN.v<AP.min||AN.v>AP.max){continue}AK.push(AQ(AN,AP))}}var AL=g.grid.labelMargin+g.grid.borderWidth;AM(s.xaxis,function(AN,AO){return'<div style="position:absolute;top:'+(e.top+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.yaxis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;right:"+(e.right+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:right" class="tickLabel">'+AN.label+"</div>"});AM(s.x2axis,function(AN,AO){return'<div style="position:absolute;bottom:'+(e.bottom+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.y2axis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;left:"+(e.left+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:left" class="tickLabel">'+AN.label+"</div>"});AK.push("</div>");l.append(AK.join(""))}function AA(AK){if(AK.lines.show){a(AK)}if(AK.bars.show){n(AK)}if(AK.points.show){o(AK)}}function a(AN){function AM(AY,AZ,AR,Ad,Ac){var Ae=AY.points,AS=AY.pointsize,AW=null,AV=null;Y.beginPath();for(var AX=AS;AX<Ae.length;AX+=AS){var AU=Ae[AX-AS],Ab=Ae[AX-AS+1],AT=Ae[AX],Aa=Ae[AX+1];if(AU==null||AT==null){continue}if(Ab<=Aa&&Ab<Ac.min){if(Aa<Ac.min){continue}AU=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(Aa<=Ab&&Aa<Ac.min){if(Ab<Ac.min){continue}AT=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.min}}if(Ab>=Aa&&Ab>Ac.max){if(Aa>Ac.max){continue}AU=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(Aa>=Ab&&Aa>Ac.max){if(Ab>Ac.max){continue}AT=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.max}}if(AU<=AT&&AU<Ad.min){if(AT<Ad.min){continue}Ab=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.min}else{if(AT<=AU&&AT<Ad.min){if(AU<Ad.min){continue}Aa=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.min}}if(AU>=AT&&AU>Ad.max){if(AT>Ad.max){continue}Ab=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.max}else{if(AT>=AU&&AT>Ad.max){if(AU>Ad.max){continue}Aa=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.max}}if(AU!=AW||Ab!=AV){Y.moveTo(Ad.p2c(AU)+AZ,Ac.p2c(Ab)+AR)}AW=AT;AV=Aa;Y.lineTo(Ad.p2c(AT)+AZ,Ac.p2c(Aa)+AR)}Y.stroke()}function AO(AX,Ae,Ac){var Af=AX.points,AR=AX.pointsize,AS=Math.min(Math.max(0,Ac.min),Ac.max),Aa,AV=0,Ad=false;for(var AW=AR;AW<Af.length;AW+=AR){var AU=Af[AW-AR],Ab=Af[AW-AR+1],AT=Af[AW],AZ=Af[AW+1];if(Ad&&AU!=null&&AT==null){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill();Ad=false;continue}if(AU==null||AT==null){continue}if(AU<=AT&&AU<Ae.min){if(AT<Ae.min){continue}Ab=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.min}else{if(AT<=AU&&AT<Ae.min){if(AU<Ae.min){continue}AZ=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.min}}if(AU>=AT&&AU>Ae.max){if(AT>Ae.max){continue}Ab=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.max}else{if(AT>=AU&&AT>Ae.max){if(AU>Ae.max){continue}AZ=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.max}}if(!Ad){Y.beginPath();Y.moveTo(Ae.p2c(AU),Ac.p2c(AS));Ad=true}if(Ab>=Ac.max&&AZ>=Ac.max){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.max));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.max));AV=AT;continue}else{if(Ab<=Ac.min&&AZ<=Ac.min){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.min));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.min));AV=AT;continue}}var Ag=AU,AY=AT;if(Ab<=AZ&&Ab<Ac.min&&AZ>=Ac.min){AU=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(AZ<=Ab&&AZ<Ac.min&&Ab>=Ac.min){AT=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.min}}if(Ab>=AZ&&Ab>Ac.max&&AZ<=Ac.max){AU=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(AZ>=Ab&&AZ>Ac.max&&Ab<=Ac.max){AT=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.max}}if(AU!=Ag){if(Ab<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(Ag),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AU),Ac.p2c(Aa))}Y.lineTo(Ae.p2c(AU),Ac.p2c(Ab));Y.lineTo(Ae.p2c(AT),Ac.p2c(AZ));if(AT!=AY){if(AZ<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(AT),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AY),Ac.p2c(Aa))}AV=Math.max(AT,AY)}if(Ad){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill()}}Y.save();Y.translate(e.left,e.top);Y.lineJoin="round";var AP=AN.lines.lineWidth,AK=AN.shadowSize;if(AP>0&&AK>0){Y.lineWidth=AK;Y.strokeStyle="rgba(0,0,0,0.1)";var AQ=Math.PI/18;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/2),Math.cos(AQ)*(AP/2+AK/2),AN.xaxis,AN.yaxis);Y.lineWidth=AK/2;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/4),Math.cos(AQ)*(AP/2+AK/4),AN.xaxis,AN.yaxis)}Y.lineWidth=AP;Y.strokeStyle=AN.color;var AL=V(AN.lines,AN.color,0,t);if(AL){Y.fillStyle=AL;AO(AN.datapoints,AN.xaxis,AN.yaxis)}if(AP>0){AM(AN.datapoints,0,0,AN.xaxis,AN.yaxis)}Y.restore()}function o(AN){function AP(AU,AT,Ab,AR,AV,AZ,AY){var Aa=AU.points,AQ=AU.pointsize;for(var AS=0;AS<Aa.length;AS+=AQ){var AX=Aa[AS],AW=Aa[AS+1];if(AX==null||AX<AZ.min||AX>AZ.max||AW<AY.min||AW>AY.max){continue}Y.beginPath();Y.arc(AZ.p2c(AX),AY.p2c(AW)+AR,AT,0,AV,false);if(Ab){Y.fillStyle=Ab;Y.fill()}Y.stroke()}}Y.save();Y.translate(e.left,e.top);var AO=AN.lines.lineWidth,AL=AN.shadowSize,AK=AN.points.radius;if(AO>0&&AL>0){var AM=AL/2;Y.lineWidth=AM;Y.strokeStyle="rgba(0,0,0,0.1)";AP(AN.datapoints,AK,null,AM+AM/2,Math.PI,AN.xaxis,AN.yaxis);Y.strokeStyle="rgba(0,0,0,0.2)";AP(AN.datapoints,AK,null,AM/2,Math.PI,AN.xaxis,AN.yaxis)}Y.lineWidth=AO;Y.strokeStyle=AN.color;AP(AN.datapoints,AK,V(AN.points,AN.color),0,2*Math.PI,AN.xaxis,AN.yaxis);Y.restore()}function AB(AV,AU,Ad,AQ,AY,AN,AL,AT,AS,Ac,AZ){var AM,Ab,AR,AX,AO,AK,AW,AP,Aa;if(AZ){AP=AK=AW=true;AO=false;AM=Ad;Ab=AV;AX=AU+AQ;AR=AU+AY;if(Ab<AM){Aa=Ab;Ab=AM;AM=Aa;AO=true;AK=false}}else{AO=AK=AW=true;AP=false;AM=AV+AQ;Ab=AV+AY;AR=Ad;AX=AU;if(AX<AR){Aa=AX;AX=AR;AR=Aa;AP=true;AW=false}}if(Ab<AT.min||AM>AT.max||AX<AS.min||AR>AS.max){return }if(AM<AT.min){AM=AT.min;AO=false}if(Ab>AT.max){Ab=AT.max;AK=false}if(AR<AS.min){AR=AS.min;AP=false}if(AX>AS.max){AX=AS.max;AW=false}AM=AT.p2c(AM);AR=AS.p2c(AR);Ab=AT.p2c(Ab);AX=AS.p2c(AX);if(AL){Ac.beginPath();Ac.moveTo(AM,AR);Ac.lineTo(AM,AX);Ac.lineTo(Ab,AX);Ac.lineTo(Ab,AR);Ac.fillStyle=AL(AR,AX);Ac.fill()}if(AO||AK||AW||AP){Ac.beginPath();Ac.moveTo(AM,AR+AN);if(AO){Ac.lineTo(AM,AX+AN)}else{Ac.moveTo(AM,AX+AN)}if(AW){Ac.lineTo(Ab,AX+AN)}else{Ac.moveTo(Ab,AX+AN)}if(AK){Ac.lineTo(Ab,AR+AN)}else{Ac.moveTo(Ab,AR+AN)}if(AP){Ac.lineTo(AM,AR+AN)}else{Ac.moveTo(AM,AR+AN)}Ac.stroke()}}function n(AM){function AL(AS,AR,AU,AP,AT,AW,AV){var AX=AS.points,AO=AS.pointsize;for(var AQ=0;AQ<AX.length;AQ+=AO){if(AX[AQ]==null){continue}AB(AX[AQ],AX[AQ+1],AX[AQ+2],AR,AU,AP,AT,AW,AV,Y,AM.bars.horizontal)}}Y.save();Y.translate(e.left,e.top);Y.lineWidth=AM.bars.lineWidth;Y.strokeStyle=AM.color;var AK=AM.bars.align=="left"?0:-AM.bars.barWidth/2;var AN=AM.bars.fill?function(AO,AP){return V(AM.bars,AM.color,AO,AP)}:null;AL(AM.datapoints,AK,AK+AM.bars.barWidth,0,AN,AM.xaxis,AM.yaxis);Y.restore()}function V(AM,AK,AL,AO){var AN=AM.fill;if(!AN){return null}if(AM.fillColor){return R(AM.fillColor,AL,AO,AK)}var AP=C.color.parse(AK);AP.a=typeof AN=="number"?AN:0.4;AP.normalize();return AP.toString()}function AI(){l.find(".legend").remove();if(!g.legend.show){return }var AP=[],AN=false,AV=g.legend.labelFormatter,AU,AR;for(i=0;i<O.length;++i){AU=O[i];AR=AU.label;if(!AR){continue}if(i%g.legend.noColumns==0){if(AN){AP.push("</tr>")}AP.push("<tr>");AN=true}if(AV){AR=AV(AR,AU)}AP.push('<td class="legendColorBox"><div style="border:1px solid '+g.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+AU.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+AR+"</td>")}if(AN){AP.push("</tr>")}if(AP.length==0){return }var AT='<table style="font-size:smaller;color:'+g.grid.color+'">'+AP.join("")+"</table>";if(g.legend.container!=null){C(g.legend.container).html(AT)}else{var AQ="",AL=g.legend.position,AM=g.legend.margin;if(AM[0]==null){AM=[AM,AM]}if(AL.charAt(0)=="n"){AQ+="top:"+(AM[1]+e.top)+"px;"}else{if(AL.charAt(0)=="s"){AQ+="bottom:"+(AM[1]+e.bottom)+"px;"}}if(AL.charAt(1)=="e"){AQ+="right:"+(AM[0]+e.right)+"px;"}else{if(AL.charAt(1)=="w"){AQ+="left:"+(AM[0]+e.left)+"px;"}}var AS=C('<div class="legend">'+AT.replace('style="','style="position:absolute;'+AQ+";")+"</div>").appendTo(l);if(g.legend.backgroundOpacity!=0){var AO=g.legend.backgroundColor;if(AO==null){AO=g.grid.backgroundColor;if(AO&&typeof AO=="string"){AO=C.color.parse(AO)}else{AO=C.color.extract(AS,"background-color")}AO.a=1;AO=AO.toString()}var AK=AS.children();C('<div style="position:absolute;width:'+AK.width()+"px;height:"+AK.height()+"px;"+AQ+"background-color:"+AO+';"> </div>').prependTo(AS).css("opacity",g.legend.backgroundOpacity)}}}var w=[],J=null;function AF(AR,AP,AM){var AX=g.grid.mouseActiveRadius,Aj=AX*AX+1,Ah=null,Aa=false,Af,Ad;for(Af=0;Af<O.length;++Af){if(!AM(O[Af])){continue}var AY=O[Af],AQ=AY.xaxis,AO=AY.yaxis,Ae=AY.datapoints.points,Ac=AY.datapoints.pointsize,AZ=AQ.c2p(AR),AW=AO.c2p(AP),AL=AX/AQ.scale,AK=AX/AO.scale;if(AY.lines.show||AY.points.show){for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1];if(AT==null){continue}if(AT-AZ>AL||AT-AZ<-AL||AS-AW>AK||AS-AW<-AK){continue}var AV=Math.abs(AQ.p2c(AT)-AR),AU=Math.abs(AO.p2c(AS)-AP),Ab=AV*AV+AU*AU;if(Ab<=Aj){Aj=Ab;Ah=[Af,Ad/Ac]}}}if(AY.bars.show&&!Ah){var AN=AY.bars.align=="left"?0:-AY.bars.barWidth/2,Ag=AN+AY.bars.barWidth;for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1],Ai=Ae[Ad+2];if(AT==null){continue}if(O[Af].bars.horizontal?(AZ<=Math.max(Ai,AT)&&AZ>=Math.min(Ai,AT)&&AW>=AS+AN&&AW<=AS+Ag):(AZ>=AT+AN&&AZ<=AT+Ag&&AW>=Math.min(Ai,AS)&&AW<=Math.max(Ai,AS))){Ah=[Af,Ad/Ac]}}}}if(Ah){Af=Ah[0];Ad=Ah[1];Ac=O[Af].datapoints.pointsize;return{datapoint:O[Af].datapoints.points.slice(Ad*Ac,(Ad+1)*Ac),dataIndex:Ad,series:O[Af],seriesIndex:Af}}return null}function D(AK){if(g.grid.hoverable){H("plothover",AK,function(AL){return AL.hoverable!=false})}}function d(AK){H("plotclick",AK,function(AL){return AL.clickable!=false})}function H(AL,AK,AM){var AN=AD.offset(),AS={pageX:AK.pageX,pageY:AK.pageY},AQ=AK.pageX-AN.left-e.left,AO=AK.pageY-AN.top-e.top;if(s.xaxis.used){AS.x=s.xaxis.c2p(AQ)}if(s.yaxis.used){AS.y=s.yaxis.c2p(AO)}if(s.x2axis.used){AS.x2=s.x2axis.c2p(AQ)}if(s.y2axis.used){AS.y2=s.y2axis.c2p(AO)}var AT=AF(AQ,AO,AM);if(AT){AT.pageX=parseInt(AT.series.xaxis.p2c(AT.datapoint[0])+AN.left+e.left);AT.pageY=parseInt(AT.series.yaxis.p2c(AT.datapoint[1])+AN.top+e.top)}if(g.grid.autoHighlight){for(var AP=0;AP<w.length;++AP){var AR=w[AP];if(AR.auto==AL&&!(AT&&AR.series==AT.series&&AR.point==AT.datapoint)){x(AR.series,AR.point)}}if(AT){AE(AT.series,AT.datapoint,AL)}}l.trigger(AL,[AS,AT])}function q(){if(!J){J=setTimeout(v,30)}}function v(){J=null;AJ.save();AJ.clearRect(0,0,y,Q);AJ.translate(e.left,e.top);var AL,AK;for(AL=0;AL<w.length;++AL){AK=w[AL];if(AK.series.bars.show){z(AK.series,AK.point)}else{u(AK.series,AK.point)}}AJ.restore();Z(L.drawOverlay,[AJ])}function AE(AM,AK,AN){if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL==-1){w.push({series:AM,point:AK,auto:AN});q()}else{if(!AN){w[AL].auto=false}}}function x(AM,AK){if(AM==null&&AK==null){w=[];q()}if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL!=-1){w.splice(AL,1);q()}}function j(AM,AN){for(var AK=0;AK<w.length;++AK){var AL=w[AK];if(AL.series==AM&&AL.point[0]==AN[0]&&AL.point[1]==AN[1]){return AK}}return -1}function u(AN,AM){var AL=AM[0],AR=AM[1],AQ=AN.xaxis,AP=AN.yaxis;if(AL<AQ.min||AL>AQ.max||AR<AP.min||AR>AP.max){return }var AO=AN.points.radius+AN.points.lineWidth/2;AJ.lineWidth=AO;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AK=1.5*AO;AJ.beginPath();AJ.arc(AQ.p2c(AL),AP.p2c(AR),AK,0,2*Math.PI,false);AJ.stroke()}function z(AN,AK){AJ.lineWidth=AN.bars.lineWidth;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AM=C.color.parse(AN.color).scale("a",0.5).toString();var AL=AN.bars.align=="left"?0:-AN.bars.barWidth/2;AB(AK[0],AK[1],AK[2]||0,AL,AL+AN.bars.barWidth,0,function(){return AM},AN.xaxis,AN.yaxis,AJ,AN.bars.horizontal)}function R(AM,AL,AQ,AO){if(typeof AM=="string"){return AM}else{var AP=Y.createLinearGradient(0,AQ,0,AL);for(var AN=0,AK=AM.colors.length;AN<AK;++AN){var AR=AM.colors[AN];if(typeof AR!="string"){AR=C.color.parse(AO).scale("rgb",AR.brightness);AR.a*=AR.opacity;AR=AR.toString()}AP.addColorStop(AN/(AK-1),AR)}return AP}}}C.plot=function(G,E,D){var F=new B(C(G),E,D,C.plot.plugins);return F};C.plot.plugins=[];C.plot.formatDate=function(H,E,G){var L=function(N){N=""+N;return N.length==1?"0"+N:N};var D=[];var M=false;var K=H.getUTCHours();var I=K<12;if(G==null){G=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}if(E.search(/%p|%P/)!=-1){if(K>12){K=K-12}else{if(K==0){K=12}}}for(var F=0;F<E.length;++F){var J=E.charAt(F);if(M){switch(J){case"h":J=""+K;break;case"H":J=L(K);break;case"M":J=L(H.getUTCMinutes());break;case"S":J=L(H.getUTCSeconds());break;case"d":J=""+H.getUTCDate();break;case"m":J=""+(H.getUTCMonth()+1);break;case"y":J=""+H.getUTCFullYear();break;case"b":J=""+G[H.getUTCMonth()];break;case"p":J=(I)?("am"):("pm");break;case"P":J=(I)?("AM"):("PM");break}D.push(J);M=false}else{if(J=="%"){M=true}else{D.push(J)}}}return D.join("")};function A(E,D){return D*Math.floor(E/D)}})(jQuery);  
/*  
Shameless port of a shameless port  
@defunkt => @janl => @aq  
 
See http://github.com/defunkt/mustache for more info.  
*/  
 
;(function($) {  
/*  
Shamless port of http://github.com/defunkt/mustache  
by Jan Lehnardt <jan@apache.org>,  
Alexander Lang <alex@upstream-berlin.com>,  
Sebastian Cohnen <sebastian.cohnen@googlemail.com>  
 
Thanks @defunkt for the awesome code.  
 
See http://github.com/defunkt/mustache for more info.  
*/  
 
var Mustache = function() {  
var Renderer = function() {};  
 
Renderer.prototype = {  
otag: "{{",  
ctag: "}}",  
pragmas: {},  
buffer: [],  
pragmas_parsed: false,  
 
render: function(template, context, partials, in_recursion) {  
// fail fast  
if(template.indexOf(this.otag) == -1) {  
if(in_recursion) {  
return template;  
} else {  
this.send(template);  
return;  
}  
}  
 
if(!in_recursion) {  
this.buffer = [];  
}  
 
if(!this.pragmas_parsed) {  
template = this.render_pragmas(template);  
}  
var html = this.render_section(template, context, partials);  
if(in_recursion) {  
return this.render_tags(html, context, partials, in_recursion);  
}  
 
this.render_tags(html, context, partials, in_recursion);  
},  
 
/*  
Sends parsed lines  
*/  
send: function(line) {  
if(line != "") {  
this.buffer.push(line);  
}  
},  
 
/*  
Looks for %PRAGMAS  
*/  
render_pragmas: function(template) {  
this.pragmas_parsed = true;  
// no pragmas  
if(template.indexOf(this.otag + "%") == -1) {  
return template;  
}  
 
var that = this;  
var regex = new RegExp(this.otag + "%([\\w_-]+) ?([\\w]+=[\\w]+)?"  
+ this.ctag);  
return template.replace(regex, function(match, pragma, options) {  
that.pragmas[pragma] = {};  
if(options) {  
var opts = options.split("=");  
that.pragmas[pragma][opts[0]] = opts[1];  
}  
return "";  
// ignore unknown pragmas silently  
});  
},  
 
/*  
Tries to find a partial in the global scope and render it  
*/  
render_partial: function(name, context, partials) {  
if(typeof(context[name]) != "object") {  
throw({message: "subcontext for '" + name + "' is not an object"});  
}  
if(!partials || !partials[name]) {  
throw({message: "unknown_partial '" + name + "'"});  
}  
return this.render(partials[name], context[name], partials, true);  
},  
 
/*  
Renders boolean and enumerable sections  
*/  
render_section: function(template, context, partials) {  
if(template.indexOf(this.otag + "#") == -1) {  
return template;  
}  
var that = this;  
// CSW - Added "+?" so it finds the tighest bound, not the widest  
var regex = new RegExp(this.otag + "\\#(.+)" + this.ctag +  
"\\s*([\\s\\S]+?)" + this.otag + "\\/\\1" + this.ctag + "\\s*", "mg");  
 
// for each {{#foo}}{{/foo}} section do...  
return template.replace(regex, function(match, name, content) {  
var value = that.find(name, context);  
if(that.is_array(value)) { // Enumerable, Let's loop!  
return that.map(value, function(row) {  
return that.render(content, that.merge(context,  
that.create_context(row)), partials, true);  
}).join("");  
} else if(value) { // boolean section  
return that.render(content, context, partials, true);  
} else {  
return "";  
}  
});  
},  
 
/*  
Replace {{foo}} and friends with values from our view  
*/  
render_tags: function(template, context, partials, in_recursion) {  
// tit for tat  
var that = this;  
 
var new_regex = function() {  
return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\/#]+?)\\1?" +  
that.ctag + "+", "g");  
};  
 
var regex = new_regex();  
var lines = template.split("\n");  
for (var i=0; i < lines.length; i++) {  
lines[i] = lines[i].replace(regex, function(match, operator, name) {  
switch(operator) {  
case "!": // ignore comments  
return match;  
case "=": // set new delimiters, rebuild the replace regexp  
that.set_delimiters(name);  
regex = new_regex();  
return "";  
case ">": // render partial  
return that.render_partial(name, context, partials);  
case "{": // the triple mustache is unescaped  
return that.find(name, context);  
default: // escape the value  
return that.escape(that.find(name, context));  
}  
}, this);  
if(!in_recursion) {  
this.send(lines[i]);  
}  
}  
 
if(in_recursion) {  
return lines.join("\n");  
}  
},  
 
set_delimiters: function(delimiters) {  
var dels = delimiters.split(" ");  
this.otag = this.escape_regex(dels[0]);  
this.ctag = this.escape_regex(dels[1]);  
},  
 
escape_regex: function(text) {  
// thank you Simon Willison  
if(!arguments.callee.sRE) {  
var specials = [  
'/', '.', '*', '+', '?', '|',  
'(', ')', '[', ']', '{', '}', '\\'  
];  
arguments.callee.sRE = new RegExp(  
'(\\' + specials.join('|\\') + ')', 'g'  
);  
}  
return text.replace(arguments.callee.sRE, '\\$1');  
},  
 
/*  
find `name` in current `context`. That is find me a value  
from the view object  
*/  
find: function(name, context) {  
name = this.trim(name);  
if(typeof context[name] === "function") {  
return context[name].apply(context);  
}  
if(context[name] !== undefined) {  
return context[name];  
}  
// silently ignore unkown variables  
return "";  
},  
 
// Utility methods  
 
/*  
Does away with nasty characters  
*/  
escape: function(s) {  
return ((s == null) ? "" : s).toString().replace(/[&"<>\\]/g, function(s) {  
switch(s) {  
case "&": return "&amp;";  
case "\\": return "\\\\";;  
case '"': return '\"';;  
case "<": return "&lt;";  
case ">": return "&gt;";  
default: return s;  
}  
});  
},  
 
/*  
Merges all properties of object `b` into object `a`.  
`b.property` overwrites a.property`  
*/  
merge: function(a, b) {  
var _new = {};  
for(var name in a) {  
if(a.hasOwnProperty(name)) {  
_new[name] = a[name];  
}  
};  
for(var name in b) {  
if(b.hasOwnProperty(name)) {  
_new[name] = b[name];  
}  
};  
return _new;  
},  
 
// by @langalex, support for arrays of strings  
create_context: function(_context) {  
if(this.is_object(_context)) {  
return _context;  
} else if(this.pragmas["IMPLICIT-ITERATOR"]) {  
var iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator || ".";  
var ctx = {};  
ctx[iterator] = _context  
return ctx;  
}  
},  
 
is_object: function(a) {  
return a && typeof a == "object";  
},  
 
is_array: function(a) {  
return Object.prototype.toString.call(a) === '[object Array]';  
},  
 
/*  
Gets rid of leading and trailing whitespace  
*/  
trim: function(s) {  
return s.replace(/^\s*|\s*$/g, "");  
},  
 
/*  
Why, why, why? Because IE. Cry, cry cry.  
*/  
map: function(array, fn) {  
if (typeof array.map == "function") {  
return array.map(fn)  
} else {  
var r = [];  
var l = array.length;  
for(i=0;i<l;i++) {  
r.push(fn(array[i]));  
}  
return r;  
}  
}  
};  
 
return({  
name: "mustache.js",  
version: "0.2.3-dev",  
 
/*  
Turns a template and view into HTML  
*/  
to_html: function(template, view, partials, send_fun) {  
var renderer = new Renderer();  
if(send_fun) {  
renderer.send = send_fun;  
}  
renderer.render(template, view, partials);  
if(!send_fun) {  
return renderer.buffer.join("\n");  
}  
}  
});  
}();  
 
$.mustache = Mustache.to_html;  
 
})(jQuery);  
 
/* Nano Templates (Tomasz Mazur, Jacek Becela) */  
 
(function($){  
$.nano = function(template, data){  
return template.replace(/\{([\w\.]*)}/g, function(str, key){  
var keys = key.split("."), value = data[keys.shift()]  
$.each(keys, function(){ value = value[this] })  
return value  
})  
}  
})(jQuery)  
// Simple JavaScript Templating  
// John Resig - http://ejohn.org/ - MIT Licensed  
// adapted from: http://ejohn.org/blog/javascript-micro-templating/  
// by Greg Borenstein http://ideasfordozens.com in Feb 2009  
jQuery.srender = function(template, data, target){  
jQuery.srender.cache = {};  
// target is an optional element; if provided, the result will be inserted into it  
// otherwise the result will simply be returned to the caller  
if(jQuery.srender.cache[template]){  
fn = jQuery.srender.cache[template];  
}  
else{  
// Generate a reusable function that will serve as a template  
// generator (and which will be cached).  
fn = jQuery.srender.cache[template] = new Function("obj",  
"var p=[],print=function(){p.push.apply(p,arguments);};" +  
 
// Introduce the data as local variables using with(){}  
"with(obj){p.push('" +  
 
// Convert the template into pure JavaScript  
template  
.replace(/[\r\t\n]/g, " ")  
.split("<%").join("\t")  
.replace(/((^|%>)[^\t]*)'/g, "$1\r")  
.replace(/\t=(.*?)%>/g, "',$1,'")  
.split("\t").join("');")  
.split("%>").join("p.push('")  
.split("\r").join("\\'")  
+ "');}return p.join('');");  
}  
 
// populate the optional element  
// or return the result  
if(target){  
target.html(fn(data));  
return false;  
} else{  
return fn(data);  
}  
};  
 
// Tempest jQuery Templating Plugin  
// ================================  
//  
// Copyright (c) 2009 Nick Fitzgerald - http://fitzgeraldnick.com/  
//  
// Permission is hereby granted, free of charge, to any person obtaining a copy  
// of this software and associated documentation files (the "Software"), to deal  
// in the Software without restriction, including without limitation the rights  
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
// copies of the Software, and to permit persons to whom the Software is  
// furnished to do so, subject to the following conditions:  
//  
// The above copyright notice and this permission notice shall be included in  
// all copies or substantial portions of the Software.  
//  
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
// THE SOFTWARE.  
 
// JSLint  
"use strict";  
 
(function ($) {  
// PRIVATE VARIABLES  
var templateCache = {},  
 
// TAG REGULAR EXPRESSIONS  
// Overwrite these if you want, but don't blame me when stuff goes wrong.  
OPEN_VAR_TAG = /\{\{[\s]*?/g,  
CLOSE_VAR_TAG = /[\s]*?\}\}/g,  
OPEN_BLOCK_TAG = /\{%[\s]*?/g,  
CLOSE_BLOCK_TAG = /[\s]*?%\}/g,  
 
// Probably, you don't want to mess with these, as they are built from  
// the ones above.  
VAR_TAG = new RegExp(OPEN_VAR_TAG.source +  
"[\\w\\-\\.]+?" +  
CLOSE_VAR_TAG.source, "g"),  
 
BLOCK_TAG = new RegExp(OPEN_BLOCK_TAG.source +  
"[\\w]+?(?:[ ]+?[\\w\\-\\.]*?)*?" +  
CLOSE_BLOCK_TAG.source, "g"),  
 
END_BLOCK_TAG = new RegExp(OPEN_BLOCK_TAG.source +  
"end[\\w]*?" +  
CLOSE_BLOCK_TAG.source, "g"),  
 
// All block tags stored in here. Tags have a couple things to work  
// with:  
//  
// * "args" property is set before render:  
// - Example: {% tag_type arg1 arg2 foo bar %}  
// * The "args" property would be set to  
// ["arg1", "arg2", "foo", "bar"]  
// in this example. The tag's render method could look them  
// up in the context object, or could do whatever it wanted  
// to do with it.  
// * "subNodes" property which is an array of all the nodes between  
// the block tag and it's corresponding {% end... %} tag  
// - NOTE: This property is only set for a block if it has the  
// "expectsEndTag" property set to true.  
// * Every block tag should have a "render" method that takes one  
// argument: a context object. It should return a string.  
BLOCK_NODES = {  
"for": {  
expectsEndTag: true,  
render: function (context) {  
var args = this.args,  
subNodes = this.subNodes,  
renderedNodes = [],  
i, itemName, arrName, arr, forContext, tmpObj;  
 
if (args.length === 3 && args[1] === "in") {  
itemName = args[0];  
arrName = args[2];  
arr = getValFromObj(arrName, context);  
 
for (i = 0; i < arr.length; i++) {  
tmpObj = {};  
tmpObj[itemName] = arr[i];  
tmpObj._index = i;  
forContext = $.extend(true, {}, context, tmpObj);  
 
$.each(subNodes, function (j, node) {  
renderedNodes.push(  
node.render(forContext)  
);  
});  
}  
 
return renderedNodes.join("");  
}  
else {  
throw new TemplateSyntaxError(  
"Bad for tag syntax. Use {% for <item> in <array> %}"  
);  
}  
}  
},  
"if": {  
expectsEndTag: true,  
render: function (context) {  
var rendered_nodes = [],  
subNodes = this.subNodes;  
 
// Check the truthiness of the argument.  
if (!!context[this.args[0]]) {  
$.each(subNodes, function (i, node) {  
rendered_nodes.push(node.render(context));  
});  
}  
 
return rendered_nodes.join("");  
}  
}  
},  
 
// Base text node object for prototyping.  
baseTextNode = {  
render: function (context) {  
return this.text || "";  
}  
},  
 
// Base variable node object for prototyping.  
baseVarNode = {  
render: function (context) {  
var val = context[this.name] === undefined ?  
"" :  
context[this.name];  
if (val === "" && this.name.search(/\./) !== -1) {  
return getValFromObj(this.name, context);  
}  
return cleanVal(val);  
}  
};  
 
// CUSTOM ERRORS  
 
function TemplateSyntaxError(message) {  
if (!(this instanceof TemplateSyntaxError)) {  
return new TemplateSyntaxError(message);  
}  
this.message = message;  
return this;  
}  
TemplateSyntaxError.prototype = new SyntaxError();  
TemplateSyntaxError.prototype.name = "TemplateSyntaxError";  
 
// PRIVATE FUNCTIONS  
 
// Some browsers don't return the grouped part of the RegExp with the array,  
// so we must accomodate them.  
var split = (function () {  
if ("abc".split(/(b)/).length === 3) {  
return function (str, delimiter) {  
return String.prototype  
.split  
.call(str, delimiter);  
};  
} else {  
return function (str, delimiter) {  
if (Object.prototype  
.toString  
.call(delimiter) === "[object RegExp]") {  
var regex = delimiter.ignoreCase ?  
new RegExp(delimiter.source, "gi") :  
new RegExp(delimiter.source, "g"),  
match,  
match_str = "",  
arr = [],  
i,  
len = str.length;  
 
for (i = 0; i < len; i++) {  
match_str += str.charAt(i);  
match = match_str.match(regex);  
if (match !== null && match.length > 0) {  
arr.push(match_str.replace(match[0], ""));  
arr.push(match[0]);  
match_str = "";  
}  
}  
 
if (match_str !== "") {  
arr.push(match_str);  
}  
 
return arr;  
} else {  
return String.prototype  
.split  
.call(str, delimiter);  
}  
};  
}  
}());  
 
function isBlockTag(token) {  
return token.search(BLOCK_TAG) !== -1;  
}  
function isEndTag(token) {  
return token.search(END_BLOCK_TAG) !== -1;  
}  
function isVarTag(token) {  
return token.search(VAR_TAG) !== -1;  
}  
 
function strip(str) {  
return str.replace(/^[\s]+/, "").replace(/[\s]+$/, "");  
}  
 
// Clean the passed value the best we can.  
function cleanVal(val) {  
if (val instanceof $) {  
return jQueryToString(val);  
} else if (val !== null && !isArray(val) && typeof(val) === "object") {  
if (typeof(val.toHTML) === "function") {  
return cleanVal(val.toHTML());  
} else {  
return val.toString();  
}  
} else {  
return val;  
}  
}  
 
// Traverse a path of an obj from a string representation,  
// for example "object.child.attr".  
function getValFromObj(str, obj) {  
var path = split(str, "."),  
val = obj[path[0]],  
i;  
for (i = 1; i < path.length; i++) {  
// Return an empty string if the lookup ever hits undefined.  
if (val !== undefined) {  
val = val[path[i]];  
} else {  
return "";  
}  
}  
 
// Make sure the last piece did not end up undefined.  
val = val === undefined ? "" : val;  
return cleanVal(val);  
}  
 
// Hack to get the HTML of a jquery object as a string.  
function jQueryToString(jq) {  
return $(document.createElement("div")).append(jq).html();  
}  
 
// Make a new copy of a given object.  
function makeObj(obj) {  
if (obj === undefined) {  
return obj;  
}  
var O = function () {};  
O.prototype = obj;  
return new O();  
}  
 
// Return an array of key/template pairs.  
function storedTemplates() {  
var cache = [];  
$.each(templateCache, function (key, templ) {  
cache.push([ key, templ ]);  
});  
return cache;  
}  
 
// Determine if the string is a key to a stored template or a  
// one-time-use template.  
function chooseTemplate(str) {  
return typeof templateCache[str] === "string" ?  
templateCache[str] :  
str;  
}  
 
// Return true if (and only if) an object is an array.  
function isArray(objToTest) {  
return Object.prototype  
.toString  
.apply(objToTest) === "[object Array]";  
}  
 
// Call a rendering function on arrays of objects or just a single  
// object seamlessly.  
function renderEach(data, f) {  
return isArray(data) ?  
$.each(data, f) :  
f(0, data);  
}  
 
// Split a template in to tokens which will eventually be converted to  
// nodes and then rendered.  
function tokenize(templ) {  
return (function (arr) {  
var tokens = [];  
for (i = 0; i < arr.length; i++) {  
(function (token) {  
return token === "" ?  
null :  
tokens.push(token);  
}(arr[i]));  
}  
return tokens;  
}(split(templ, new RegExp("(" + VAR_TAG.source + "|" +  
BLOCK_TAG.source + "|" +  
END_BLOCK_TAG.source + ")"))));  
}  
 
// "Lisp in C's clothing." - Douglas Crockford  
function cdr(arr) {  
return arr.slice(1);  
}  
 
// Array.push changes the original array in place and returns the new  
// length of the array rather than the the actual array itself. This  
// makes it unchainable, which is ridiculous.  
function append(item, list) {  
return list.concat([item]);  
}  
 
// Take a token and create a variable node from it.  
function makeVarNode(token) {  
var node = makeObj(baseVarNode);  
node.name = strip(token.replace(OPEN_VAR_TAG, "")  
.replace(CLOSE_VAR_TAG, ""));  
return node;  
}  
 
// Take a token and create a text node from it.  
function makeTextNode(token) {  
var node = makeObj(baseTextNode);  
node.text = token;  
return node;  
}  
 
// A recursive function that terminates either when all tokens have  
// been converted to nodes or an end-block tag is found.  
function makeNodes(tokens) {  
return (function (nodes, tokens) {  
var token = tokens[0];  
return tokens.length === 0 ?  
[nodes, [], true] :  
isEndTag(token) ?  
[nodes, cdr(tokens)] :  
isVarTag(token) ?  
arguments.callee(append(makeVarNode(token), nodes), cdr(tokens)) :  
isBlockTag(token) ?  
makeBlockNode(nodes, tokens, arguments.callee) :  
// Else assume it is a text node.  
arguments.callee(append(makeTextNode(token), nodes), cdr(tokens));  
 
}([], tokens));  
}  
 
// Split a block tags contents in to an array of bits that contains the  
// type of block node, and any arguments that were passed to the block  
// node if they exist.  
function makeBits(blockToken) {  
return (function (bits, split) {  
// Remove empty strings and strip whitespace.  
for (i = 0; i < split.length; i++) {  
(function (bit) {  
return bit === "" ? null : bits.push(bit);  
}(strip(split[i])));  
}  
return bits;  
}([], split(blockToken.replace(OPEN_BLOCK_TAG, "")  
.replace(CLOSE_BLOCK_TAG, ""),  
/[\s]+?/)));  
}  
 
// Create a block tag's node by hijacking the "makeNodes" function  
// until an end-block is found.  
function makeBlockNode(nodes, tokens, f) {  
// Remove the templating syntax and split the type of block tag and  
// its arguments.  
var bits = makeBits(tokens[0]),  
 
// The type of block tag is the first of the bits, the rest  
// (if present) are args  
type = bits[0],  
args = cdr(bits),  
 
// Make the node from the set of block tags that Tempest knows  
// about.  
node = makeObj(BLOCK_NODES[type]),  
resultsArray;  
 
// Ensure that the type of block tag is one that is defined in  
// BLOCK_NODES  
if (node === undefined) {  
throw new TemplateSyntaxError("Unknown Block Tag.");  
}  
 
node.args = args;  
tokens = cdr(tokens);  
 
if (node.expectsEndTag === true) {  
resultsArray = makeNodes(tokens);  
 
if (resultsArray[2] !== undefined) {  
// The third item in the array returned by makeNodes is  
// only defined if the last of the tokens was made in to a  
// node and it wasn't an end-block tag.  
throw new TemplateSyntaxError(  
"A block tag was expecting an ending tag but it was not found."  
);  
}  
node.subNodes = resultsArray[0];  
tokens = resultsArray[1];  
}  
 
// Add the newly created node to the nodes list.  
nodes = append(node, nodes);  
 
// Continue where we were before the block node.  
return f(nodes, tokens);  
}  
 
// Return the template rendered with the given object(s) as a jQuery  
// object.  
function renderToJQ(str, objects) {  
var template = chooseTemplate(str),  
lines = [];  
 
renderEach(objects, function (i, obj) {  
var resultsArray = makeNodes(tokenize(template), obj),  
nodes = resultsArray[0];  
 
// Check for tokens left over in the results array, this means  
// that not all tokens were rendered because there are more  
// end-block tagss than block tags that expect an end.  
if (resultsArray[1].length !== 0) {  
throw new TemplateSyntaxError(  
"An unexpected end tag was found."  
);  
}  
 
// Render each node and push it to the lines.  
$.each(nodes, function (i, node) {  
lines.push(node.render(obj));  
});  
});  
 
// Return the joined templates as jQuery objects if it appears to start  
// with an HTML tag, otherwise just return the string itself.  
return (function (str) {  
return str.charAt(0) === "<" ?  
$(str) :  
str;  
}(strip(lines.join(""))));  
}  
 
// EXTEND JQUERY OBJECT  
$.extend({  
tempest: function () {  
var args = arguments;  
 
if (args.length === 0) {  
 
// Return key/template pairs of all stored templates.  
return storedTemplates();  
 
} else if (args.length === 2 &&  
typeof(args[0]) === "string" &&  
typeof(args[1]) === "object") {  
 
// Render the supplied template (args[0], template name of  
// existing or one-time-use template) with the context data  
// (args[1]).  
return renderToJQ(args[0], args[1]);  
 
} else if (args.length === 1 && typeof(args[0]) === "string") {  
 
// Template getter.  
return templateCache[args[0]];  
 
} else if (args.length === 2 &&  
typeof(args[0]) === "string" &&  
typeof(args[1]) === "string") {  
 
// Template setter.  
templateCache[args[0]] = args[1].replace(/^\s+/g, "")  
.replace(/\s+$/g, "")  
.replace(/[\n\r]+/g, "");  
return templateCache[args[0]];  
 
} else {  
 
// Raise an exception because the arguments did not match the  
// API.  
throw new TypeError(  
"jQuery.tempest can't handle the given arguments."  
);  
 
}  
}  
});  
 
// Extend jQuery("selector").tempest using the existing jQuery.tempest API.  
$.fn.tempest = function() {  
var args = Array.prototype.slice.call(arguments, 0);  
var f = null;  
 
if (args.length == 2 &&  
typeof args[0] == "string" &&  
typeof args[1] == "object") {  
// Inserts the result of rendering the specified template on the  
// specified data into the set of matched elements.  
f = function () {  
$(this).html($.tempest(args[0], args[1]));  
};  
} else if (args.length == 3 &&  
typeof args[0] == "string" &&  
typeof args[1] == "string" &&  
typeof args[2] == "object") {  
// Calls the appropriate jQuery function, passing it the result of  
// rendering the given template on the data provided.  
f = function () {  
$(this)[args[0]]($.tempest(args[1], args[2]));  
};  
} else {  
throw new TypeError([  
"jQuery(selector).tempest was passed the wrong number or type",  
"of arguments. Received " + args  
].join(" "));  
}  
 
return this.each(f);  
};  
 
// EXPOSE BLOCK_NODES OBJECT TO ALLOW EXTENSION WITH CUSTOM TAGS  
$.tempest.tags = BLOCK_NODES;  
 
// EXPOSE PRIVATE FUNCTIONS FOR TESTING  
if (window.testTempestPrivates === true) {  
$.tempest._test = {};  
 
// Make it easier to attach the private methods methods to the public  
// object.  
function a(name, fn) {  
$.tempest._test[name] = fn;  
}  
a("isBlockTag", isBlockTag);  
a("isEndTag", isEndTag);  
a("isVarTag", isVarTag);  
a("cleanVal", cleanVal);  
a("getValFromObj", getValFromObj);  
a("jQueryToString", jQueryToString);  
a("makeObj", makeObj);  
a("storedTemplates", storedTemplates);  
a("chooseTemplate", chooseTemplate);  
a("isArray", isArray);  
a("renderEach", renderEach);  
a("tokenize", tokenize);  
a("cdr", cdr);  
a("append", append);  
a("makeVarNode", makeVarNode);  
a("makeTextNode", makeTextNode);  
a("makeNodes", makeNodes);  
a("makeBits", makeBits);  
a("makeBlockNode", makeBlockNode);  
a("renderToJQ", renderToJQ);  
a("strip", strip);  
}  
 
// GET ALL TEXTAREA TEMPLATES ON READY  
$(document).ready(function () {  
$(".tempest-template").each(function (obj) {  
templateCache[$(this).attr('title')] = strip(($(this).val() || $(this).html()).replace(/[\n\r]+/g, " "));  
$(this).remove();  
});  
});  
}(jQuery));  
 
$.templates = {};  
// wycats' templating plugin  
// (c) Yehuda Katz  
// You may distribute this code under the same license as jQuery (BSD or GPL)  
(function ($) {  
$.compileTemplate = function (template, begin, end) {  
var rebegin = begin.replace(/([\]{}[\\])/g, '\\$1');  
var reend = end.replace(/([\]{}[\\])/g, '\\$1');  
 
var code = "self = self || {}; with ($.templates.helpers) { with (self) {" +  
"var _result = '';" +  
template  
.replace(/[\t\r\n]/g, ' ')  
.replace(/^(.*)$/, end + '$1' + begin)  
.replace(new RegExp(reend + "(.*?)" + rebegin, "g"), function (text) {  
return text  
.replace(new RegExp("^" + reend + "(.*)" + rebegin + "$"), "$1")  
.replace(/\\/g, "\\\\")  
.replace(/'/g, "\\'")  
.replace(/^(.*)$/, end + "_result += '$1';" + begin);  
})  
.replace(new RegExp(rebegin + "=(.*?)" + reend, "g"),  
"_result += (function() { if(typeof($1) == 'undefined' || ($1) == null) return ''; else return ($1) })(); ")  
.replace(new RegExp(rebegin + "(.*?)" + reend, "g"), ' $1 ')  
.replace(new RegExp("^" + reend + "(.*)" + rebegin + "$"), '$1') +  
"_result = _result.replace(/^\\s*/, '').replace(/\\s*$/, '');\n" +  
"if (_rawText) {return _result};\n"+  
"var ret = $(_result).data('template_obj', self);\n" +  
"jQuery(document).trigger('template.created.' + this.templateName, [{ctx: self, el: ret}]);\n" +  
"return ret;" +  
"}}";  
 
return new Function("self", "_rawText", code);  
};  
 
/* Some supplemental useful snippets that help build the widget system */  
$(function() {  
$("script[type=text/x-jquery-template]").each(function() {  
$.templates[this.title] = $.compileTemplate(this.innerHTML, "<%", "%>");  
$.templates[this.title].templateName = this.title;  
});  
});  
 
$.fn.fn = function(name, func) {  
return this.each(function() {  
var meths = $(this).data("methods") || $.data(this, "methods", {});  
meths[name] = func;  
});  
};  
 
$.fn.invoke = function(name, rest) {  
meth = $(this).data("methods")[name];  
if(!meth)  
throw new Error("No method by the name of " + name + " exists on this element");  
else  
return meth.apply(this[0], Array.prototype.slice.call(arguments, 1, -1));  
};  
 
$.templates = {  
helpers: {  
partial: function(name, json) {  
return $.templates[name](json || {}, true);  
}  
}  
}  
 
$.loadTemplates = function() {  
$.templates = $.templates || {};  
$("script[type=text/x-jquery-template]").each(function() {  
$.templates[this.title] = $.compileTemplate(this.innerHTML, "<%", "%>");  
});  
}  
 
})(jQuery);  
 
/*  
* jQuery Templating Plugin  
* NOTE: Created for demonstration purposes.  
* Copyright 2010, John Resig  
* Dual licensed under the MIT or GPL Version 2 licenses.  
*/  
(function(jQuery){  
// Override the DOM manipulation function  
var oldManip = jQuery.fn.domManip,  
htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$/;  
 
jQuery.fn.extend({  
render: function( data, options ) {  
return this.map(function(i, tmpl){  
return jQuery.render( tmpl, data, options );  
});  
},  
 
// This will allow us to do: .append( "template", dataObject )  
domManip: function( args ) {  
// This appears to be a bug in the appendTo, etc. implementation  
// it should be doing .call() instead of .apply(). See #6227  
if ( args.length > 1 && args[0].nodeType ) {  
arguments[0] = [ jQuery.makeArray(args) ];  
}  
 
if ( args.length >= 2 && typeof args[0] === "string" && typeof args[1] !== "string" ) {  
arguments[0] = [ jQuery.render( args[0], args[1], args[2] ) ];  
}  
 
return oldManip.apply( this, arguments );  
}  
});  
 
jQuery.extend({  
render: function( tmpl, data, options ) {  
var fn, node;  
 
if ( typeof tmpl === "string" ) {  
// Use a pre-defined template, if available  
fn = jQuery.templates[ tmpl ];  
if ( !fn && !htmlExpr.test( tmpl ) ) {  
// it is a selector  
node = jQuery( tmpl ).get( 0 );  
}  
else {  
fn = jQuery.tmpl( tmpl );  
}  
} else if ( tmpl instanceof jQuery ) {  
node = tmpl.get( 0 );  
} else if ( tmpl.nodeType ) {  
node = tmpl;  
}  
 
if ( !fn && node ) {  
var elemData = jQuery.data( node );  
fn = elemData.tmpl || (elemData.tmpl = jQuery.tmpl( node.innerHTML ));  
}  
 
// We assume that if the template string is being passed directly  
// in the user doesn't want it cached. They can stick it in  
// jQuery.templates to cache it.  
 
var context = {  
data: data,  
index: 0,  
dataItem: data,  
options: options || {}  
};  
 
if ( jQuery.isArray( data ) ) {  
return jQuery.map( data, function( data, i ) {  
context.index = i;  
context.dataItem = data;  
return fn.call( data, jQuery, context );  
});  
 
} else {  
return fn.call( data, jQuery, context );  
}  
},  
 
// You can stick pre-built template functions here  
templates: {},  
 
/*  
* For example, someone could do:  
* jQuery.templates.foo = jQuery.tmpl("some long templating string");  
* $("#test").append("foo", data);  
*/  
 
tmplcmd: {  
"each": {  
_default: [ null, "$i" ],  
prefix: "jQuery.each($1,function($2){with(this){",  
suffix: "}});"  
},  
"if": {  
prefix: "if($1){",  
suffix: "}"  
},  
"else": {  
prefix: "}else{"  
},  
"html": {  
prefix: "_.push(typeof ($1)==='function'?($1).call(this):$1);"  
},  
"=": {  
_default: [ "this" ],  
prefix: "_.push($.encode(typeof ($1)==='function'?($1).call(this):$1));"  
}  
},  
 
encode: function( text ) {  
return text != null ? document.createTextNode( text.toString() ).nodeValue : "";  
},  
 
tmpl: function(str, data, i, options) {  
// Generate a reusable function that will serve as a template  
// generator (and which will be cached).  
 
var fn = new Function("jQuery","$context",  
"var $=jQuery,$data=$context.dataItem,$i=$context.index,_=[];_.data=$data;_.index=$i;" +  
 
// Introduce the data as local variables using with(){}  
"with($data){_.push('" +  
 
// Convert the template into pure JavaScript  
str  
.replace(/[\r\t\n]/g, " ")  
.replace(/\${([^}]*)}/g, "{{= $1}}")  
.replace(/{{(\/?)(\w+|.)(?:\((.*?)\))?(?: (.*?))?}}/g, function(all, slash, type, fnargs, args) {  
var tmpl = jQuery.tmplcmd[ type ];  
 
if ( !tmpl ) {  
throw "Template not found: " + type;  
}  
 
var def = tmpl._default;  
 
return "');" + tmpl[slash ? "suffix" : "prefix"]  
.split("$1").join(args || (def ? def[0] : ""))  
.split("$2").join(fnargs || (def ? def[1] : "")) + "_.push('";  
})  
+ "');};return _.join('');");  
 
// Provide some basic currying to the user  
// TODO: When currying, the fact that only the dataItem and index are passed  
// in means we cannot know the value of 'data' although we know 'dataItem' and 'index'  
// If this api took the array and index, we could know all 3 values.  
// e.g. instead of this:  
// tmpl(tmpl, foo[i], i) // foo[i] passed in is the dataItem  
// this:  
// tmpl(tmpl, foo, i) // foo[i] used internally to get dataItem  
// If you intend data to be as is,  
// tmpl(tmpl, foo) or tmpl(tmpl, foo, null, options)  
return data ? fn.call( this, jQuery, { data: null, dataItem: data, index: i, options: options } ) : fn;  
}  
});  
})(jQuery);  
 
 
ol#qunit-tests {  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
margin:0;  
padding:0;  
list-style-position:inside;  
 
font-size: smaller;  
}  
ol#qunit-tests li{  
padding:0.4em 0.5em 0.4em 2.5em;  
border-bottom:1px solid #fff;  
font-size:small;  
list-style-position:inside;  
}  
ol#qunit-tests li ol{  
box-shadow: inset 0px 2px 13px #999;  
-moz-box-shadow: inset 0px 2px 13px #999;  
-webkit-box-shadow: inset 0px 2px 13px #999;  
margin-top:0.5em;  
margin-left:0;  
padding:0.5em;  
background-color:#fff;  
border-radius:15px;  
-moz-border-radius: 15px;  
-webkit-border-radius: 15px;  
}  
ol#qunit-tests li li{  
border-bottom:none;  
margin:0.5em;  
background-color:#fff;  
list-style-position: inside;  
padding:0.4em 0.5em 0.4em 0.5em;  
}  
 
ol#qunit-tests li li.pass{  
border-left:26px solid #C6E746;  
background-color:#fff;  
color:#5E740B;  
}  
ol#qunit-tests li li.fail{  
border-left:26px solid #EE5757;  
background-color:#fff;  
color:#710909;  
}  
ol#qunit-tests li.pass{  
background-color:#C6E746;  
color:#000;  
}  
ol#qunit-tests li.fail{  
background-color:#EE5757;  
color:#000;  
}  
ol#qunit-tests li strong {  
cursor:pointer;  
}  
h1#qunit-header{  
background-color:#0d3349;  
margin:0;  
padding:0.5em 0 0.5em 1em;  
color:#fff;  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
border-top-right-radius:15px;  
border-top-left-radius:15px;  
-moz-border-radius-topright:15px;  
-moz-border-radius-topleft:15px;  
-webkit-border-top-right-radius:15px;  
-webkit-border-top-left-radius:15px;  
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;  
}  
h2#qunit-banner{  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
height:5px;  
margin:0;  
padding:0;  
}  
h2#qunit-banner.qunit-pass{  
background-color:#C6E746;  
}  
h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {  
background-color:#EE5757;  
}  
#qunit-testrunner-toolbar {  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
padding:0;  
/*width:80%;*/  
padding:0em 0 0.5em 2em;  
font-size: small;  
}  
h2#qunit-userAgent {  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
background-color:#2b81af;  
margin:0;  
padding:0;  
color:#fff;  
font-size: small;  
padding:0.5em 0 0.5em 2.5em;  
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;  
}  
p#qunit-testresult{  
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
margin:0;  
font-size: small;  
color:#2b81af;  
border-bottom-right-radius:15px;  
border-bottom-left-radius:15px;  
-moz-border-radius-bottomright:15px;  
-moz-border-radius-bottomleft:15px;  
-webkit-border-bottom-right-radius:15px;  
-webkit-border-bottom-left-radius:15px;  
background-color:#D2E0E6;  
padding:0.5em 0.5em 0.5em 2.5em;  
}  
strong b.fail{  
color:#710909;  
}  
strong b.pass{  
color:#5E740B;  
}  
 
/*  
* QUnit - A JavaScript Unit Testing Framework  
*  
* http://docs.jquery.com/QUnit  
*  
* Copyright (c) 2009 John Resig, Jörn Zaefferer  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*/  
 
(function(window) {  
 
var QUnit = {  
 
// Initialize the configuration options  
init: function() {  
config = {  
stats: { all: 0, bad: 0 },  
moduleStats: { all: 0, bad: 0 },  
started: +new Date,  
blocking: false,  
autorun: false,  
assertions: [],  
filters: [],  
queue: []  
};  
 
var tests = id("qunit-tests"),  
banner = id("qunit-banner"),  
result = id("qunit-testresult");  
 
if ( tests ) {  
tests.innerHTML = "";  
}  
 
if ( banner ) {  
banner.className = "";  
}  
 
if ( result ) {  
result.parentNode.removeChild( result );  
}  
},  
 
// call on start of module test to prepend name to all tests  
module: function(name, testEnvironment) {  
config.currentModule = name;  
 
synchronize(function() {  
if ( config.currentModule ) {  
QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );  
}  
 
config.currentModule = name;  
config.moduleTestEnvironment = testEnvironment;  
config.moduleStats = { all: 0, bad: 0 };  
 
QUnit.moduleStart( name, testEnvironment );  
});  
},  
 
asyncTest: function(testName, expected, callback) {  
if ( arguments.length === 2 ) {  
callback = expected;  
expected = 0;  
}  
 
QUnit.test(testName, expected, callback, true);  
},  
 
test: function(testName, expected, callback, async) {  
var name = testName, testEnvironment, testEnvironmentArg;  
 
if ( arguments.length === 2 ) {  
callback = expected;  
expected = null;  
}  
// is 2nd argument a testEnvironment?  
if ( expected && typeof expected === 'object') {  
testEnvironmentArg = expected;  
expected = null;  
}  
 
if ( config.currentModule ) {  
name = config.currentModule + " module: " + name;  
}  
 
if ( !validTest(name) ) {  
return;  
}  
 
synchronize(function() {  
QUnit.testStart( testName );  
 
testEnvironment = extend({  
setup: function() {},  
teardown: function() {}  
}, config.moduleTestEnvironment);  
if (testEnvironmentArg) {  
extend(testEnvironment,testEnvironmentArg);  
}  
 
// allow utility functions to access the current test environment  
QUnit.current_testEnvironment = testEnvironment;  
 
config.assertions = [];  
config.expected = expected;  
 
try {  
if ( !config.pollution ) {  
saveGlobal();  
}  
 
testEnvironment.setup.call(testEnvironment);  
} catch(e) {  
QUnit.ok( false, "Setup failed on " + name + ": " + e.message );  
}  
 
if ( async ) {  
QUnit.stop();  
}  
 
try {  
callback.call(testEnvironment);  
} catch(e) {  
fail("Test " + name + " died, exception and test follows", e, callback);  
QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );  
// else next test will carry the responsibility  
saveGlobal();  
 
// Restart the tests if they're blocking  
if ( config.blocking ) {  
start();  
}  
}  
});  
 
synchronize(function() {  
try {  
checkPollution();  
testEnvironment.teardown.call(testEnvironment);  
} catch(e) {  
QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );  
}  
 
try {  
QUnit.reset();  
} catch(e) {  
fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);  
}  
 
if ( config.expected && config.expected != config.assertions.length ) {  
QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );  
}  
 
var good = 0, bad = 0,  
tests = id("qunit-tests");  
 
config.stats.all += config.assertions.length;  
config.moduleStats.all += config.assertions.length;  
 
if ( tests ) {  
var ol = document.createElement("ol");  
ol.style.display = "none";  
 
for ( var i = 0; i < config.assertions.length; i++ ) {  
var assertion = config.assertions[i];  
 
var li = document.createElement("li");  
li.className = assertion.result ? "pass" : "fail";  
li.appendChild(document.createTextNode(assertion.message || "(no message)"));  
ol.appendChild( li );  
 
if ( assertion.result ) {  
good++;  
} else {  
bad++;  
config.stats.bad++;  
config.moduleStats.bad++;  
}  
}  
 
var b = document.createElement("strong");  
b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>";  
 
addEvent(b, "click", function() {  
var next = b.nextSibling, display = next.style.display;  
next.style.display = display === "none" ? "block" : "none";  
});  
 
addEvent(b, "dblclick", function(e) {  
var target = e && e.target ? e.target : window.event.srcElement;  
if ( target.nodeName.toLowerCase() === "strong" ) {  
var text = "", node = target.firstChild;  
 
while ( node.nodeType === 3 ) {  
text += node.nodeValue;  
node = node.nextSibling;  
}  
 
text = text.replace(/(^\s*|\s*$)/g, "");  
 
if ( window.location ) {  
window.location.href = window.location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text);  
}  
}  
});  
 
var li = document.createElement("li");  
li.className = bad ? "fail" : "pass";  
li.appendChild( b );  
li.appendChild( ol );  
tests.appendChild( li );  
 
if ( bad ) {  
var toolbar = id("qunit-testrunner-toolbar");  
if ( toolbar ) {  
toolbar.style.display = "block";  
id("qunit-filter-pass").disabled = null;  
id("qunit-filter-missing").disabled = null;  
}  
}  
 
} else {  
for ( var i = 0; i < config.assertions.length; i++ ) {  
if ( !config.assertions[i].result ) {  
bad++;  
config.stats.bad++;  
config.moduleStats.bad++;  
}  
}  
}  
 
QUnit.testDone( testName, bad, config.assertions.length );  
 
if ( !window.setTimeout && !config.queue.length ) {  
done();  
}  
});  
 
if ( window.setTimeout && !config.doneTimer ) {  
config.doneTimer = window.setTimeout(function(){  
if ( !config.queue.length ) {  
done();  
} else {  
synchronize( done );  
}  
}, 13);  
}  
},  
 
/**  
* Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.  
*/  
expect: function(asserts) {  
config.expected = asserts;  
},  
 
/**  
* Asserts true.  
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );  
*/  
ok: function(a, msg) {  
QUnit.log(a, msg);  
 
config.assertions.push({  
result: !!a,  
message: msg  
});  
},  
 
/**  
* Checks that the first two arguments are equal, with an optional message.  
* Prints out both actual and expected values.  
*  
* Prefered to ok( actual == expected, message )  
*  
* @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );  
*  
* @param Object actual  
* @param Object expected  
* @param String message (optional)  
*/  
equal: function(actual, expected, message) {  
push(expected == actual, actual, expected, message);  
},  
 
notEqual: function(actual, expected, message) {  
push(expected != actual, actual, expected, message);  
},  
 
deepEqual: function(a, b, message) {  
push(QUnit.equiv(a, b), a, b, message);  
},  
 
notDeepEqual: function(a, b, message) {  
push(!QUnit.equiv(a, b), a, b, message);  
},  
 
strictEqual: function(actual, expected, message) {  
push(expected === actual, actual, expected, message);  
},  
 
notStrictEqual: function(actual, expected, message) {  
push(expected !== actual, actual, expected, message);  
},  
 
start: function() {  
// A slight delay, to avoid any current callbacks  
if ( window.setTimeout ) {  
window.setTimeout(function() {  
if ( config.timeout ) {  
clearTimeout(config.timeout);  
}  
 
config.blocking = false;  
process();  
}, 13);  
} else {  
config.blocking = false;  
process();  
}  
},  
 
stop: function(timeout) {  
config.blocking = true;  
 
if ( timeout && window.setTimeout ) {  
config.timeout = window.setTimeout(function() {  
QUnit.ok( false, "Test timed out" );  
QUnit.start();  
}, timeout);  
}  
},  
 
/**  
* Resets the test setup. Useful for tests that modify the DOM.  
*/  
reset: function() {  
if ( window.jQuery ) {  
jQuery("#main").html( config.fixture );  
jQuery.event.global = {};  
jQuery.ajaxSettings = extend({}, config.ajaxSettings);  
}  
},  
 
/**  
* Trigger an event on an element.  
*  
* @example triggerEvent( document.body, "click" );  
*  
* @param DOMElement elem  
* @param String type  
*/  
triggerEvent: function( elem, type, event ) {  
if ( document.createEvent ) {  
event = document.createEvent("MouseEvents");  
event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,  
0, 0, 0, 0, 0, false, false, false, false, 0, null);  
elem.dispatchEvent( event );  
 
} else if ( elem.fireEvent ) {  
elem.fireEvent("on"+type);  
}  
},  
 
// Safe object type checking  
is: function( type, obj ) {  
return Object.prototype.toString.call( obj ) === "[object "+ type +"]";  
},  
 
// Logging callbacks  
done: function(failures, total) {},  
log: function(result, message) {},  
testStart: function(name) {},  
testDone: function(name, failures, total) {},  
moduleStart: function(name, testEnvironment) {},  
moduleDone: function(name, failures, total) {}  
};  
 
// Backwards compatibility, deprecated  
QUnit.equals = QUnit.equal;  
QUnit.same = QUnit.deepEqual;  
 
// Maintain internal state  
var config = {  
// The queue of tests to run  
queue: [],  
 
// block until document ready  
blocking: true  
};  
 
// Load paramaters  
(function() {  
var location = window.location || { search: "", protocol: "file:" },  
GETParams = location.search.slice(1).split('&');  
 
for ( var i = 0; i < GETParams.length; i++ ) {  
GETParams[i] = decodeURIComponent( GETParams[i] );  
if ( GETParams[i] === "noglobals" ) {  
GETParams.splice( i, 1 );  
i--;  
config.noglobals = true;  
} else if ( GETParams[i].search('=') > -1 ) {  
GETParams.splice( i, 1 );  
i--;  
}  
}  
 
// restrict modules/tests by get parameters  
config.filters = GETParams;  
 
// Figure out if we're running the tests from a server or not  
QUnit.isLocal = !!(location.protocol === 'file:');  
})();  
 
// Expose the API as global variables, unless an 'exports'  
// object exists, in that case we assume we're in CommonJS  
if ( typeof exports === "undefined" || typeof require === "undefined" ) {  
extend(window, QUnit);  
window.QUnit = QUnit;  
} else {  
extend(exports, QUnit);  
exports.QUnit = QUnit;  
}  
 
if ( typeof document === "undefined" || document.readyState === "complete" ) {  
config.autorun = true;  
}  
 
addEvent(window, "load", function() {  
// Initialize the config, saving the execution queue  
var oldconfig = extend({}, config);  
QUnit.init();  
extend(config, oldconfig);  
 
config.blocking = false;  
 
var userAgent = id("qunit-userAgent");  
if ( userAgent ) {  
userAgent.innerHTML = navigator.userAgent;  
}  
 
var toolbar = id("qunit-testrunner-toolbar");  
if ( toolbar ) {  
toolbar.style.display = "none";  
 
var filter = document.createElement("input");  
filter.type = "checkbox";  
filter.id = "qunit-filter-pass";  
filter.disabled = true;  
addEvent( filter, "click", function() {  
var li = document.getElementsByTagName("li");  
for ( var i = 0; i < li.length; i++ ) {  
if ( li[i].className.indexOf("pass") > -1 ) {  
li[i].style.display = filter.checked ? "none" : "";  
}  
}  
});  
toolbar.appendChild( filter );  
 
var label = document.createElement("label");  
label.setAttribute("for", "qunit-filter-pass");  
label.innerHTML = "Hide passed tests";  
toolbar.appendChild( label );  
 
var missing = document.createElement("input");  
missing.type = "checkbox";  
missing.id = "qunit-filter-missing";  
missing.disabled = true;  
addEvent( missing, "click", function() {  
var li = document.getElementsByTagName("li");  
for ( var i = 0; i < li.length; i++ ) {  
if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) {  
li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block";  
}  
}  
});  
toolbar.appendChild( missing );  
 
label = document.createElement("label");  
label.setAttribute("for", "qunit-filter-missing");  
label.innerHTML = "Hide missing tests (untested code is broken code)";  
toolbar.appendChild( label );  
}  
 
var main = id('main');  
if ( main ) {  
config.fixture = main.innerHTML;  
}  
 
if ( window.jQuery ) {  
config.ajaxSettings = window.jQuery.ajaxSettings;  
}  
 
QUnit.start();  
});  
 
function done() {  
if ( config.doneTimer && window.clearTimeout ) {  
window.clearTimeout( config.doneTimer );  
config.doneTimer = null;  
}  
 
if ( config.queue.length ) {  
config.doneTimer = window.setTimeout(function(){  
if ( !config.queue.length ) {  
done();  
} else {  
synchronize( done );  
}  
}, 13);  
 
return;  
}  
 
config.autorun = true;  
 
// Log the last module results  
if ( config.currentModule ) {  
QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );  
}  
 
var banner = id("qunit-banner"),  
tests = id("qunit-tests"),  
html = ['Tests completed in ',  
+new Date - config.started, ' milliseconds.<br/>',  
'<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join('');  
 
if ( banner ) {  
banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");  
}  
 
if ( tests ) {  
var result = id("qunit-testresult");  
 
if ( !result ) {  
result = document.createElement("p");  
result.id = "qunit-testresult";  
result.className = "result";  
tests.parentNode.insertBefore( result, tests.nextSibling );  
}  
 
result.innerHTML = html;  
}  
 
QUnit.done( config.stats.bad, config.stats.all );  
}  
 
function validTest( name ) {  
var i = config.filters.length,  
run = false;  
 
if ( !i ) {  
return true;  
}  
 
while ( i-- ) {  
var filter = config.filters[i],  
not = filter.charAt(0) == '!';  
 
if ( not ) {  
filter = filter.slice(1);  
}  
 
if ( name.indexOf(filter) !== -1 ) {  
return !not;  
}  
 
if ( not ) {  
run = true;  
}  
}  
 
return run;  
}  
 
function push(result, actual, expected, message) {  
message = message || (result ? "okay" : "failed");  
QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) );  
}  
 
function synchronize( callback ) {  
config.queue.push( callback );  
 
if ( config.autorun && !config.blocking ) {  
process();  
}  
}  
 
function process() {  
while ( config.queue.length && !config.blocking ) {  
config.queue.shift()();  
}  
}  
 
function saveGlobal() {  
config.pollution = [];  
 
if ( config.noglobals ) {  
for ( var key in window ) {  
config.pollution.push( key );  
}  
}  
}  
 
function checkPollution( name ) {  
var old = config.pollution;  
saveGlobal();  
 
var newGlobals = diff( old, config.pollution );  
if ( newGlobals.length > 0 ) {  
ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );  
config.expected++;  
}  
 
var deletedGlobals = diff( config.pollution, old );  
if ( deletedGlobals.length > 0 ) {  
ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );  
config.expected++;  
}  
}  
 
// returns a new Array with the elements that are in a but not in b  
function diff( a, b ) {  
var result = a.slice();  
for ( var i = 0; i < result.length; i++ ) {  
for ( var j = 0; j < b.length; j++ ) {  
if ( result[i] === b[j] ) {  
result.splice(i, 1);  
i--;  
break;  
}  
}  
}  
return result;  
}  
 
function fail(message, exception, callback) {  
if ( typeof console !== "undefined" && console.error && console.warn ) {  
console.error(message);  
console.error(exception);  
console.warn(callback.toString());  
 
} else if ( window.opera && opera.postError ) {  
opera.postError(message, exception, callback.toString);  
}  
}  
 
function extend(a, b) {  
for ( var prop in b ) {  
a[prop] = b[prop];  
}  
 
return a;  
}  
 
function addEvent(elem, type, fn) {  
if ( elem.addEventListener ) {  
elem.addEventListener( type, fn, false );  
} else if ( elem.attachEvent ) {  
elem.attachEvent( "on" + type, fn );  
} else {  
fn();  
}  
}  
 
function id(name) {  
return !!(typeof document !== "undefined" && document && document.getElementById) &&  
document.getElementById( name );  
}  
 
// Test for equality any JavaScript type.  
// Discussions and reference: http://philrathe.com/articles/equiv  
// Test suites: http://philrathe.com/tests/equiv  
// Author: Philippe Rathé <prathe@gmail.com>  
QUnit.equiv = function () {  
 
var innerEquiv; // the real equiv function  
var callers = []; // stack to decide between skip/abort functions  
 
 
// Determine what is o.  
function hoozit(o) {  
if (QUnit.is("String", o)) {  
return "string";  
 
} else if (QUnit.is("Boolean", o)) {  
return "boolean";  
 
} else if (QUnit.is("Number", o)) {  
 
if (isNaN(o)) {  
return "nan";  
} else {  
return "number";  
}  
 
} else if (typeof o === "undefined") {  
return "undefined";  
 
// consider: typeof null === object  
} else if (o === null) {  
return "null";  
 
// consider: typeof [] === object  
} else if (QUnit.is( "Array", o)) {  
return "array";  
 
// consider: typeof new Date() === object  
} else if (QUnit.is( "Date", o)) {  
return "date";  
 
// consider: /./ instanceof Object;  
// /./ instanceof RegExp;  
// typeof /./ === "function"; // => false in IE and Opera,  
// true in FF and Safari  
} else if (QUnit.is( "RegExp", o)) {  
return "regexp";  
 
} else if (typeof o === "object") {  
return "object";  
 
} else if (QUnit.is( "Function", o)) {  
return "function";  
} else {  
return undefined;  
}  
}  
 
// Call the o related callback with the given arguments.  
function bindCallbacks(o, callbacks, args) {  
var prop = hoozit(o);  
if (prop) {  
if (hoozit(callbacks[prop]) === "function") {  
return callbacks[prop].apply(callbacks, args);  
} else {  
return callbacks[prop]; // or undefined  
}  
}  
}  
 
var callbacks = function () {  
 
// for string, boolean, number and null  
function useStrictEquality(b, a) {  
if (b instanceof a.constructor || a instanceof b.constructor) {  
// to catch short annotaion VS 'new' annotation of a declaration  
// e.g. var i = 1;  
// var j = new Number(1);  
return a == b;  
} else {  
return a === b;  
}  
}  
 
return {  
"string": useStrictEquality,  
"boolean": useStrictEquality,  
"number": useStrictEquality,  
"null": useStrictEquality,  
"undefined": useStrictEquality,  
 
"nan": function (b) {  
return isNaN(b);  
},  
 
"date": function (b, a) {  
return hoozit(b) === "date" && a.valueOf() === b.valueOf();  
},  
 
"regexp": function (b, a) {  
return hoozit(b) === "regexp" &&  
a.source === b.source && // the regex itself  
a.global === b.global && // and its modifers (gmi) ...  
a.ignoreCase === b.ignoreCase &&  
a.multiline === b.multiline;  
},  
 
// - skip when the property is a method of an instance (OOP)  
// - abort otherwise,  
// initial === would have catch identical references anyway  
"function": function () {  
var caller = callers[callers.length - 1];  
return caller !== Object &&  
typeof caller !== "undefined";  
},  
 
"array": function (b, a) {  
var i;  
var len;  
 
// b could be an object literal here  
if ( ! (hoozit(b) === "array")) {  
return false;  
}  
 
len = a.length;  
if (len !== b.length) { // safe and faster  
return false;  
}  
for (i = 0; i < len; i++) {  
if ( ! innerEquiv(a[i], b[i])) {  
return false;  
}  
}  
return true;  
},  
 
"object": function (b, a) {  
var i;  
var eq = true; // unless we can proove it  
var aProperties = [], bProperties = []; // collection of strings  
 
// comparing constructors is more strict than using instanceof  
if ( a.constructor !== b.constructor) {  
return false;  
}  
 
// stack constructor before traversing properties  
callers.push(a.constructor);  
 
for (i in a) { // be strict: don't ensures hasOwnProperty and go deep  
 
aProperties.push(i); // collect a's properties  
 
if ( ! innerEquiv(a[i], b[i])) {  
eq = false;  
break;  
}  
}  
 
callers.pop(); // unstack, we are done  
 
for (i in b) {  
bProperties.push(i); // collect b's properties  
}  
 
// Ensures identical properties name  
return eq && innerEquiv(aProperties.sort(), bProperties.sort());  
}  
};  
}();  
 
innerEquiv = function () { // can take multiple arguments  
var args = Array.prototype.slice.apply(arguments);  
if (args.length < 2) {  
return true; // end transition  
}  
 
return (function (a, b) {  
if (a === b) {  
return true; // catch the most you can  
} else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {  
return false; // don't lose time with error prone cases  
} else {  
return bindCallbacks(a, callbacks, [b, a]);  
}  
 
// apply transition with (1..n) arguments  
})(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));  
};  
 
return innerEquiv;  
 
}();  
 
/**  
* jsDump  
* Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com  
* Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)  
* Date: 5/15/2008  
* @projectDescription Advanced and extensible data dumping for Javascript.  
* @version 1.0.0  
* @author Ariel Flesler  
* @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}  
*/  
QUnit.jsDump = (function() {  
function quote( str ) {  
return '"' + str.toString().replace(/"/g, '\\"') + '"';  
};  
function literal( o ) {  
return o + '';  
};  
function join( pre, arr, post ) {  
var s = jsDump.separator(),  
base = jsDump.indent(),  
inner = jsDump.indent(1);  
if ( arr.join )  
arr = arr.join( ',' + s + inner );  
if ( !arr )  
return pre + post;  
return [ pre, inner + arr, base + post ].join(s);  
};  
function array( arr ) {  
var i = arr.length, ret = Array(i);  
this.up();  
while ( i-- )  
ret[i] = this.parse( arr[i] );  
this.down();  
return join( '[', ret, ']' );  
};  
 
var reName = /^function (\w+)/;  
 
var jsDump = {  
parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance  
var parser = this.parsers[ type || this.typeOf(obj) ];  
type = typeof parser;  
 
return type == 'function' ? parser.call( this, obj ) :  
type == 'string' ? parser :  
this.parsers.error;  
},  
typeOf:function( obj ) {  
var type;  
if ( obj === null ) {  
type = "null";  
} else if (typeof obj === "undefined") {  
type = "undefined";  
} else if (QUnit.is("RegExp", obj)) {  
type = "regexp";  
} else if (QUnit.is("Date", obj)) {  
type = "date";  
} else if (QUnit.is("Function", obj)) {  
type = "function";  
} else if (QUnit.is("Array", obj)) {  
type = "array";  
} else if (QUnit.is("Window", obj) || QUnit.is("global", obj)) {  
type = "window";  
} else if (QUnit.is("HTMLDocument", obj)) {  
type = "document";  
} else if (QUnit.is("HTMLCollection", obj) || QUnit.is("NodeList", obj)) {  
type = "nodelist";  
} else if (/^\[object HTML/.test(Object.prototype.toString.call( obj ))) {  
type = "node";  
} else {  
type = typeof obj;  
}  
return type;  
},  
separator:function() {  
return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';  
},  
indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing  
if ( !this.multiline )  
return '';  
var chr = this.indentChar;  
if ( this.HTML )  
chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');  
return Array( this._depth_ + (extra||0) ).join(chr);  
},  
up:function( a ) {  
this._depth_ += a || 1;  
},  
down:function( a ) {  
this._depth_ -= a || 1;  
},  
setParser:function( name, parser ) {  
this.parsers[name] = parser;  
},  
// The next 3 are exposed so you can use them  
quote:quote,  
literal:literal,  
join:join,  
//  
_depth_: 1,  
// This is the list of parsers, to modify them, use jsDump.setParser  
parsers:{  
window: '[Window]',  
document: '[Document]',  
error:'[ERROR]', //when no parser is found, shouldn't happen  
unknown: '[Unknown]',  
'null':'null',  
undefined:'undefined',  
'function':function( fn ) {  
var ret = 'function',  
name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE  
if ( name )  
ret += ' ' + name;  
ret += '(';  
 
ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');  
return join( ret, this.parse(fn,'functionCode'), '}' );  
},  
array: array,  
nodelist: array,  
arguments: array,  
object:function( map ) {  
var ret = [ ];  
this.up();  
for ( var key in map )  
ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );  
this.down();  
return join( '{', ret, '}' );  
},  
node:function( node ) {  
var open = this.HTML ? '&lt;' : '<',  
close = this.HTML ? '&gt;' : '>';  
 
var tag = node.nodeName.toLowerCase(),  
ret = open + tag;  
 
for ( var a in this.DOMAttrs ) {  
var val = node[this.DOMAttrs[a]];  
if ( val )  
ret += ' ' + a + '=' + this.parse( val, 'attribute' );  
}  
return ret + close + open + '/' + tag + close;  
},  
functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function  
var l = fn.length;  
if ( !l ) return '';  
 
var args = Array(l);  
while ( l-- )  
args[l] = String.fromCharCode(97+l);//97 is 'a'  
return ' ' + args.join(', ') + ' ';  
},  
key:quote, //object calls it internally, the key part of an item in a map  
functionCode:'[code]', //function calls it internally, it's the content of the function  
attribute:quote, //node calls it internally, it's an html attribute value  
string:quote,  
date:quote,  
regexp:literal, //regex  
number:literal,  
'boolean':literal  
},  
DOMAttrs:{//attributes to dump from nodes, name=>realName  
id:'id',  
name:'name',  
'class':'className'  
},  
HTML:true,//if true, entities are escaped ( <, >, \t, space and \n )  
indentChar:' ',//indentation unit  
multiline:true //if true, items in a collection, are separated by a \n, else just a space.  
};  
 
return jsDump;  
})();  
 
})(this);  
 
html, body, div, span, applet, object, iframe,  
h1, h2, h3, h4, h5, h6, p, blockquote, pre,  
a, abbr, acronym, address, big, cite, code,  
del, dfn, em, font, img, ins, kbd, q, s, samp,  
small, strike, strong, sub, sup, tt, var,  
b, u, i, center,  
dl, dt, dd, ol, ul, li,  
fieldset, form, label, legend,  
table, caption, tbody, tfoot, thead, tr, th, td {  
margin: 0; padding: 0;  
border: 0; outline: 0;  
text-decoration: none;  
vertical-align: baseline;  
background: transparent;  
font-size: 100%;  
}  
 
acronym {  
border-bottom: 1px dashed #ccc;  
cursor: help;  
}  
 
ol, ul {  
list-style: none;  
}  
 
table {  
border-collapse: collapse;  
border-spacing: 0;  
}  
 
html {  
width: 100%; height: 100%;  
}  
 
body {  
margin: 1em;  
color: #0d3349;  
font: normal .75em/1.5em "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;  
}  
 
h1 {  
margin: 0;  
padding: .5em 1em;  
color: #fff;  
font-size: 2em;  
background-color: #0d3349;  
border-top-right-radius: 1em;  
border-top-left-radius: 1em;  
-moz-border-radius-topright: 1em;  
-moz-border-radius-topleft: 1em;  
-webkit-border-top-right-radius: 1em;  
-webkit-border-top-left-radius: 1em;  
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;  
}  
 
h2 {  
padding: .5em 2em;  
color: #fff;  
background-color: #2b81af;  
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;  
}  
 
hr {  
height: .5em;  
margin: 0; padding: 0;  
border: 0 none;  
background-color: #c6e746;  
}  
 
ul#contestants {  
margin: 0; padding: 0;  
font: normal 1em/1.5em monospace, ffmonobug;  
}  
 
ul#contestants > li{  
padding: .5em 2em;  
#font-weight: bold;  
border-bottom: 1px solid #fff;  
background-color: #c6e746;  
}  
 
ul.progress {  
margin: 0; padding: 0;  
vertical-align: middle;  
display: inline;  
}  
 
ul.progress li {  
width: 1.167em; height: 1.167em;  
margin: 0 1px 0 0; padding: 0;  
display: inline-block;  
background-color: #0d3349;  
}  
 
p.number {  
margin: 0 0 0 .5em;  
display: inline;  
}  
 
ul.srender li {  
background-color: #5b4cd8;  
}  
 
ul.mustache_js li {  
background-color: #8f04a8;  
}  
 
ul.underscore li {  
background-color: #cd0074;  
}  
 
ul.jqote2 li {  
background-color: #70e500;  
}  
 
ul.tempest li {  
background-color: #0d3349;  
}  
 
ul.nano li {  
background-color: #fff800;  
}  
 
ul.tmpl li {  
background-color: #00f8ff;  
}  
 
ul input {  
margin: 0 .5em 0 0;  
vertical-align: middle;  
}  
 
 
#placeholder {  
width: 800px; height: 350px;  
margin: 0 auto;  
}  
 
// Underscore.js  
// (c) 2009 Jeremy Ashkenas, DocumentCloud Inc.  
// Underscore is freely distributable under the terms of the MIT license.  
// Portions of Underscore are inspired by or borrowed from Prototype.js,  
// Oliver Steele's Functional, and John Resig's Micro-Templating.  
// For all details and documentation:  
// http://documentcloud.github.com/underscore/  
 
(function() {  
 
/*------------------------- Baseline setup ---------------------------------*/  
 
// Establish the root object, "window" in the browser, or "global" on the server.  
var root = this;  
 
// Save the previous value of the "_" variable.  
var previousUnderscore = root._;  
 
// If Underscore is called as a function, it returns a wrapped object that  
// can be used OO-style. This wrapper holds altered versions of all the  
// underscore functions. Wrapped objects may be chained.  
var wrapper = function(obj) { this._wrapped = obj; };  
 
// Establish the object that gets thrown to break out of a loop iteration.  
var breaker = typeof StopIteration !== 'undefined' ? StopIteration : '__break__';  
 
// Create a safe reference to the Underscore object for reference below.  
var _ = root._ = function(obj) { return new wrapper(obj); };  
 
// Export the Underscore object for CommonJS.  
if (typeof exports !== 'undefined') exports._ = _;  
 
// Current version.  
_.VERSION = '0.4.3';  
 
/*------------------------ Collection Functions: ---------------------------*/  
 
// The cornerstone, an each implementation.  
// Handles objects implementing forEach, arrays, and raw objects.  
_.each = function(obj, iterator, context) {  
var index = 0;  
try {  
if (obj.forEach) {  
obj.forEach(iterator, context);  
} else if (obj.length) {  
for (var i=0, l = obj.length; i<l; i++) iterator.call(context, obj[i], i, obj);  
} else {  
for (var key in obj) if (Object.prototype.hasOwnProperty.call(obj, key)) {  
iterator.call(context, obj[key], key, obj);  
}  
}  
} catch(e) {  
if (e != breaker) throw e;  
}  
return obj;  
};  
 
// Return the results of applying the iterator to each element. Use JavaScript  
// 1.6's version of map, if possible.  
_.map = function(obj, iterator, context) {  
if (obj && obj.map) return obj.map(iterator, context);  
var results = [];  
_.each(obj, function(value, index, list) {  
results.push(iterator.call(context, value, index, list));  
});  
return results;  
};  
 
// Reduce builds up a single result from a list of values. Also known as  
// inject, or foldl. Uses JavaScript 1.8's version of reduce, if possible.  
_.reduce = function(obj, memo, iterator, context) {  
if (obj && obj.reduce) return obj.reduce(_.bind(iterator, context), memo);  
_.each(obj, function(value, index, list) {  
memo = iterator.call(context, memo, value, index, list);  
});  
return memo;  
};  
 
// The right-associative version of reduce, also known as foldr. Uses  
// JavaScript 1.8's version of reduceRight, if available.  
_.reduceRight = function(obj, memo, iterator, context) {  
if (obj && obj.reduceRight) return obj.reduceRight(_.bind(iterator, context), memo);  
var reversed = _.clone(_.toArray(obj)).reverse();  
_.each(reversed, function(value, index) {  
memo = iterator.call(context, memo, value, index, obj);  
});  
return memo;  
};  
 
// Return the first value which passes a truth test.  
_.detect = function(obj, iterator, context) {  
var result;  
_.each(obj, function(value, index, list) {  
if (iterator.call(context, value, index, list)) {  
result = value;  
_.breakLoop();  
}  
});  
return result;  
};  
 
// Return all the elements that pass a truth test. Use JavaScript 1.6's  
// filter(), if it exists.  
_.select = function(obj, iterator, context) {  
if (obj.filter) return obj.filter(iterator, context);  
var results = [];  
_.each(obj, function(value, index, list) {  
iterator.call(context, value, index, list) && results.push(value);  
});  
return results;  
};  
 
// Return all the elements for which a truth test fails.  
_.reject = function(obj, iterator, context) {  
var results = [];  
_.each(obj, function(value, index, list) {  
!iterator.call(context, value, index, list) && results.push(value);  
});  
return results;  
};  
 
// Determine whether all of the elements match a truth test. Delegate to  
// JavaScript 1.6's every(), if it is present.  
_.all = function(obj, iterator, context) {  
iterator = iterator || _.identity;  
if (obj.every) return obj.every(iterator, context);  
var result = true;  
_.each(obj, function(value, index, list) {  
if (!(result = result && iterator.call(context, value, index, list))) _.breakLoop();  
});  
return result;  
};  
 
// Determine if at least one element in the object matches a truth test. Use  
// JavaScript 1.6's some(), if it exists.  
_.any = function(obj, iterator, context) {  
iterator = iterator || _.identity;  
if (obj.some) return obj.some(iterator, context);  
var result = false;  
_.each(obj, function(value, index, list) {  
if (result = iterator.call(context, value, index, list)) _.breakLoop();  
});  
return result;  
};  
 
// Determine if a given value is included in the array or object,  
// based on '==='.  
_.include = function(obj, target) {  
if (_.isArray(obj)) return _.indexOf(obj, target) != -1;  
var found = false;  
_.each(obj, function(value) {  
if (found = value === target) _.breakLoop();  
});  
return found;  
};  
 
// Invoke a method with arguments on every item in a collection.  
_.invoke = function(obj, method) {  
var args = _.toArray(arguments).slice(2);  
return _.map(obj, function(value) {  
return (method ? value[method] : value).apply(value, args);  
});  
};  
 
// Convenience version of a common use case of map: fetching a property.  
_.pluck = function(obj, key) {  
return _.map(obj, function(value){ return value[key]; });  
};  
 
// Return the maximum item or (item-based computation).  
_.max = function(obj, iterator, context) {  
if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);  
var result = {computed : -Infinity};  
_.each(obj, function(value, index, list) {  
var computed = iterator ? iterator.call(context, value, index, list) : value;  
computed >= result.computed && (result = {value : value, computed : computed});  
});  
return result.value;  
};  
 
// Return the minimum element (or element-based computation).  
_.min = function(obj, iterator, context) {  
if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);  
var result = {computed : Infinity};  
_.each(obj, function(value, index, list) {  
var computed = iterator ? iterator.call(context, value, index, list) : value;  
computed < result.computed && (result = {value : value, computed : computed});  
});  
return result.value;  
};  
 
// Sort the object's values by a criteria produced by an iterator.  
_.sortBy = function(obj, iterator, context) {  
return _.pluck(_.map(obj, function(value, index, list) {  
return {  
value : value,  
criteria : iterator.call(context, value, index, list)  
};  
}).sort(function(left, right) {  
var a = left.criteria, b = right.criteria;  
return a < b ? -1 : a > b ? 1 : 0;  
}), 'value');  
};  
 
// Use a comparator function to figure out at what index an object should  
// be inserted so as to maintain order. Uses binary search.  
_.sortedIndex = function(array, obj, iterator) {  
iterator = iterator || _.identity;  
var low = 0, high = array.length;  
while (low < high) {  
var mid = (low + high) >> 1;  
iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;  
}  
return low;  
};  
 
// Convert anything iterable into a real, live array.  
_.toArray = function(iterable) {  
if (!iterable) return [];  
if (_.isArray(iterable)) return iterable;  
return _.map(iterable, function(val){ return val; });  
};  
 
// Return the number of elements in an object.  
_.size = function(obj) {  
return _.toArray(obj).length;  
};  
 
/*-------------------------- Array Functions: ------------------------------*/  
 
// Get the first element of an array.  
_.first = function(array) {  
return array[0];  
};  
 
// Get the last element of an array.  
_.last = function(array) {  
return array[array.length - 1];  
};  
 
// Trim out all falsy values from an array.  
_.compact = function(array) {  
return _.select(array, function(value){ return !!value; });  
};  
 
// Return a completely flattened version of an array.  
_.flatten = function(array) {  
return _.reduce(array, [], function(memo, value) {  
if (_.isArray(value)) return memo.concat(_.flatten(value));  
memo.push(value);  
return memo;  
});  
};  
 
// Return a version of the array that does not contain the specified value(s).  
_.without = function(array) {  
var values = array.slice.call(arguments, 0);  
return _.select(array, function(value){ return !_.include(values, value); });  
};  
 
// Produce a duplicate-free version of the array. If the array has already  
// been sorted, you have the option of using a faster algorithm.  
_.uniq = function(array, isSorted) {  
return _.reduce(array, [], function(memo, el, i) {  
if (0 == i || (isSorted ? _.last(memo) != el : !_.include(memo, el))) memo.push(el);  
return memo;  
});  
};  
 
// Produce an array that contains every item shared between all the  
// passed-in arrays.  
_.intersect = function(array) {  
var rest = _.toArray(arguments).slice(1);  
return _.select(_.uniq(array), function(item) {  
return _.all(rest, function(other) {  
return _.indexOf(other, item) >= 0;  
});  
});  
};  
 
// Zip together multiple lists into a single array -- elements that share  
// an index go together.  
_.zip = function() {  
var args = _.toArray(arguments);  
var length = _.max(_.pluck(args, 'length'));  
var results = new Array(length);  
for (var i=0; i<length; i++) results[i] = _.pluck(args, String(i));  
return results;  
};  
 
// If the browser doesn't supply us with indexOf (I'm looking at you, MSIE),  
// we need this function. Return the position of the first occurence of an  
// item in an array, or -1 if the item is not included in the array.  
_.indexOf = function(array, item) {  
if (array.indexOf) return array.indexOf(item);  
for (var i=0, l=array.length; i<l; i++) if (array[i] === item) return i;  
return -1;  
};  
 
// Provide JavaScript 1.6's lastIndexOf, delegating to the native function,  
// if possible.  
_.lastIndexOf = function(array, item) {  
if (array.lastIndexOf) return array.lastIndexOf(item);  
var i = array.length;  
while (i--) if (array[i] === item) return i;  
return -1;  
};  
 
/* ----------------------- Function Functions: -----------------------------*/  
 
// Create a function bound to a given object (assigning 'this', and arguments,  
// optionally). Binding with arguments is also known as 'curry'.  
_.bind = function(func, context) {  
context = context || root;  
var args = _.toArray(arguments).slice(2);  
return function() {  
var a = args.concat(_.toArray(arguments));  
return func.apply(context, a);  
};  
};  
 
// Bind all of an object's methods to that object. Useful for ensuring that  
// all callbacks defined on an object belong to it.  
_.bindAll = function() {  
var args = _.toArray(arguments);  
var context = args.pop();  
_.each(args, function(methodName) {  
context[methodName] = _.bind(context[methodName], context);  
});  
};  
 
// Delays a function for the given number of milliseconds, and then calls  
// it with the arguments supplied.  
_.delay = function(func, wait) {  
var args = _.toArray(arguments).slice(2);  
return setTimeout(function(){ return func.apply(func, args); }, wait);  
};  
 
// Defers a function, scheduling it to run after the current call stack has  
// cleared.  
_.defer = function(func) {  
return _.delay.apply(_, [func, 1].concat(_.toArray(arguments).slice(1)));  
};  
 
// Returns the first function passed as an argument to the second,  
// allowing you to adjust arguments, run code before and after, and  
// conditionally execute the original function.  
_.wrap = function(func, wrapper) {  
return function() {  
var args = [func].concat(_.toArray(arguments));  
return wrapper.apply(wrapper, args);  
};  
};  
 
// Returns a function that is the composition of a list of functions, each  
// consuming the return value of the function that follows.  
_.compose = function() {  
var funcs = _.toArray(arguments);  
return function() {  
for (var i=funcs.length-1; i >= 0; i--) {  
arguments = [funcs[i].apply(this, arguments)];  
}  
return arguments[0];  
};  
};  
 
/* ------------------------- Object Functions: ---------------------------- */  
 
// Retrieve the names of an object's properties.  
_.keys = function(obj) {  
return _.map(obj, function(value, key){ return key; });  
};  
 
// Retrieve the values of an object's properties.  
_.values = function(obj) {  
return _.map(obj, _.identity);  
};  
 
// Extend a given object with all of the properties in a source object.  
_.extend = function(destination, source) {  
for (var property in source) destination[property] = source[property];  
return destination;  
};  
 
// Create a (shallow-cloned) duplicate of an object.  
_.clone = function(obj) {  
if (_.isArray(obj)) return obj.slice(0);  
return _.extend({}, obj);  
};  
 
// Perform a deep comparison to check if two objects are equal.  
_.isEqual = function(a, b) {  
// Check object identity.  
if (a === b) return true;  
// Different types?  
var atype = typeof(a), btype = typeof(b);  
if (atype != btype) return false;  
// Basic equality test (watch out for coercions).  
if (a == b) return true;  
// One of them implements an isEqual()?  
if (a.isEqual) return a.isEqual(b);  
// If a is not an object by this point, we can't handle it.  
if (atype !== 'object') return false;  
// Nothing else worked, deep compare the contents.  
var aKeys = _.keys(a), bKeys = _.keys(b);  
// Different object sizes?  
if (aKeys.length != bKeys.length) return false;  
// Recursive comparison of contents.  
for (var key in a) if (!_.isEqual(a[key], b[key])) return false;  
return true;  
};  
 
// Is a given array or object empty?  
_.isEmpty = function(obj) {  
return (_.isArray(obj) ? obj : _.values(obj)).length == 0;  
};  
 
// Is a given value a DOM element?  
_.isElement = function(obj) {  
return !!(obj && obj.nodeType == 1);  
};  
 
// Is a given value a real Array?  
_.isArray = function(obj) {  
return Object.prototype.toString.call(obj) == '[object Array]';  
};  
 
// Is a given value a Function?  
_.isFunction = function(obj) {  
return Object.prototype.toString.call(obj) == '[object Function]';  
};  
 
// Is a given variable undefined?  
_.isUndefined = function(obj) {  
return typeof obj == 'undefined';  
};  
 
/* -------------------------- Utility Functions: -------------------------- */  
 
// Run Underscore.js in noConflict mode, returning the '_' variable to its  
// previous owner. Returns a reference to the Underscore object.  
_.noConflict = function() {  
root._ = previousUnderscore;  
return this;  
};  
 
// Keep the identity function around for default iterators.  
_.identity = function(value) {  
return value;  
};  
 
// Break out of the middle of an iteration.  
_.breakLoop = function() {  
throw breaker;  
};  
 
// Generate a unique integer id (unique within the entire client session).  
// Useful for temporary DOM ids.  
var idCounter = 0;  
_.uniqueId = function(prefix) {  
var id = idCounter++;  
return prefix ? prefix + id : id;  
};  
 
// Return a sorted list of the function names available in Underscore.  
_.functions = function() {  
var functions = [];  
for (var key in _) if (Object.prototype.hasOwnProperty.call(_, key)) functions.push(key);  
return _.without(functions, 'VERSION', 'prototype', 'noConflict').sort();  
};  
 
// JavaScript templating a-la ERB, pilfered from John Resig's  
// "Secrets of the JavaScript Ninja", page 83.  
_.template = function(str, data) {  
var fn = new Function('obj',  
'var p=[],print=function(){p.push.apply(p,arguments);};' +  
'with(obj){p.push(\'' +  
str  
.replace(/[\r\t\n]/g, " ")  
.split("<%").join("\t")  
.replace(/((^|%>)[^\t]*)'/g, "$1\r")  
.replace(/\t=(.*?)%>/g, "',$1,'")  
.split("\t").join("');")  
.split("%>").join("p.push('")  
.split("\r").join("\\'")  
+ "');}return p.join('');");  
return data ? fn(data) : fn;  
};  
 
/*------------------------------- Aliases ----------------------------------*/  
 
_.forEach = _.each;  
_.foldl = _.inject = _.reduce;  
_.foldr = _.reduceRight;  
_.filter = _.select;  
_.every = _.all;  
_.some = _.any;  
_.methods = _.functions;  
 
/*------------------------ Setup the OOP Wrapper: --------------------------*/  
 
// Helper function to continue chaining intermediate results.  
var result = function(obj, chain) {  
return chain ? _(obj).chain() : obj;  
};  
 
// Add all of the Underscore functions to the wrapper object.  
_.each(_.functions(), function(name) {  
wrapper.prototype[name] = function() {  
Array.prototype.unshift.call(arguments, this._wrapped);  
return result(_[name].apply(_, arguments), this._chain);  
};  
});  
 
// Add all mutator Array functions to the wrapper.  
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {  
wrapper.prototype[name] = function() {  
Array.prototype[name].apply(this._wrapped, arguments);  
return result(this._wrapped, this._chain);  
};  
});  
 
// Add all accessor Array functions to the wrapper.  
_.each(['concat', 'join', 'slice'], function(name) {  
wrapper.prototype[name] = function() {  
return result(Array.prototype[name].apply(this._wrapped, arguments), this._chain);  
};  
});  
 
// Start chaining a wrapped Underscore object.  
wrapper.prototype.chain = function() {  
this._chain = true;  
return this;  
};  
 
// Extracts the result from a wrapped and chained object.  
wrapper.prototype.value = function() {  
return this._wrapped;  
};  
 
})();  
 
 Binary files a/busui/owa/modules/base/js/includes/jquery/jQote2/favicon.ico and /dev/null differ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">  
<title>ECMAScript Templating Benchmarks // aefxx.com</title>  
<link type="image/x-icon" href="favicon.ico" rel="Shortcut Icon">  
<link rel="stylesheet" href="external/styles.css" type="text/css"/>  
<script src="external/jquery-1.4.2.min.js" type="text/javascript"></script>  
<script src="external/jquery.benchmark.js" type="text/javascript"></script>  
<script src="external/jquery.flot.min.js" type="text/javascript"></script>  
<script src="external/jquery.mustache.js" type="text/javascript"></script>  
<script src="external/jquery.tempest.js" type="text/javascript"></script>  
<script src="external/jquery.tmpl.js" type="text/javascript"></script>  
<script src="external/underscore.js" type="text/javascript"></script>  
<script src="external/jquery.srender.js" type="text/javascript"></script>  
<script src="external/jquery.nano.js" type="text/javascript"></script>  
<script src="jquery.jqote2.min.js" type="text/javascript"></script>  
</head>  
<body>  
<h1>ECMAScript Templating Benchmarks</h1>  
<hr/>  
<h2>&copy;2010 aefxx // powered by jQuery // idea taken from Brian Landau</h2>  
<ul id="contestants">  
<li>  
<p><input type="checkbox" name="contestant" value="srender"/> srender</p>  
<ul class="progress srender"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="mustache_js"/> mustache.js</p>  
<ul class="progress mustache_js"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="underscore"/> Underscore</p>  
<ul class="progress underscore"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="jqote2"/> jQote2</p>  
<ul class="progress jqote2"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="tempest"/> Tempest</p>  
<ul class="progress tempest"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="nano"/> nano</p>  
<ul class="progress nano"></ul>  
<p class="number"></p>  
</li>  
<li>  
<p><input type="checkbox" name="contestant" value="tmpl"/> jQuery templating</p>  
<ul class="progress tmpl"></ul>  
<p class="number"></p>  
</li>  
<li>  
<input type="checkbox" name="check" value="0"/> Check all  
</li>  
<li>  
<button id="run">RUN</button>  
&#xa0;&#xa0;Cycles:&#xa0;  
5x <input type="radio" name="cycles" value="5" checked="checked"/>  
10x <input type="radio" name="cycles" value="10"/>  
25x <input type="radio" name="cycles" value="25"/>  
50x <input type="radio" name="cycles" value="50"/>  
&#xa0;&#xa0;Types:&#xa0;  
Simple <input type="checkbox" name="simple_test" value="1" checked="checked"/>  
Loop <input type="checkbox" name="loop_test" value="2" checked="checked"/>  
</li>  
</ul>  
<h2>█ Single Passed Run &#xa0;&#xa0; Median in ms [Arithm. AVG in ms]</h2>  
<div id="placeholder"></div>  
<script type="text/javascript">  
var CYCLES = $('input:radio:checked').val(),  
CONVERSIONS = 1000,  
RUN_LEAP = Math.round(CONVERSIONS * 0.5),  
contestants = {};  
 
function shuffle(v) {  
for ( var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x );  
return v;  
};  
 
function mean(array) {  
if ( !array.length ) return 0;  
 
var sum = 0;  
for ( var i=0; i < array.length; i++ )  
sum += parseFloat(array[i], 4);  
return (1/array.length) * sum;  
}  
 
function median(array) {  
if ( !array.length ) return 0;  
 
var s = array.sort(function(a, b) {return a - b;}).length;  
return s % 2 ?  
array[(s-1)/2] : (array[(s/2)-1] + array[s/2]) / 2;  
}  
 
function plot(cons) {  
var data = [], i = 1;  
 
for ( key in cons ) {  
var result = {  
median: median(cons[key].results).toPrecision(2)*1000,  
mean: mean(cons[key].results).toPrecision(2)*1000  
};  
 
data.push({  
label: cons[key].name,  
data: [[i++, result.median], [i++,null]],  
color: cons[key].color,  
bars: {  
show: true,  
barWidth: 1,  
lineWidth: 1,  
fill: 1,  
colors: cons[key].color  
}  
});  
 
if ( cons[key].results.length )  
cons[key].number.text(result.median+' ms ['+result.mean+' ms]');  
}  
 
$.plot($('#placeholder'), data, {  
xaxis: { ticks: [[1.5, 'Srender'], [3.5, 'mustache.js'], [5.5, 'Underscore'], [7.5, 'jQote2'], [9.5, 'Tempest'], [11.5, 'nano']], autoscaleMargin: .02 },  
yaxis: { min: 10, max: 150 },  
legend: { position: 'ne' },  
grid: { backgroundColor: '#ffffff' }  
});  
}  
 
$(function() {  
var benchmarks = {  
srender: {  
simple: function() {$.srender(this.simple, payload.simple);},  
loop: function() {$.srender(this.loop, payload.loop);}  
},  
mustache_js: {  
simple: function() {$.mustache(this.simple, payload.simple);},  
loop: function() {$.mustache(this.loop, payload.loop);}  
},  
underscore: {  
simple: function() {this.simple(payload.simple);},  
loop: function() {this.loop(payload.loop);}  
},  
jqote2: {  
simple: function() {$.jqote(this.simple, payload.simple);},  
loop: function() {$.jqote(this.loop, payload.loop);}  
},  
tempest: {  
simple: function() {$.tempest(this.simple, payload.simple);},  
loop: function() {$.tempest(this.loop, payload.loop);}  
},  
nano: {  
simple: function() {$.nano(this.simple, payload.simple);},  
loop: function() {  
var nano = {comments: '', header: payload.loop.header};  
for ( var i=0; i < payload.loop.comments.length; i++ )  
nano.comments += $.nano(this.loop.comment, payload.loop.comments[i]);  
 
$.nano(this.loop.container, nano);  
}  
},  
tmpl: {  
simple: function() {  
$.templates.simple.call(payload.simple, jQuery, {  
data: payload.simple,  
index: 0,  
dataItem: payload.simple,  
options: {}  
});  
},  
loop: function() {  
$.templates.loop.call(payload.loop, jQuery, {  
data: payload.loop,  
index: 0,  
dataItem: payload.loop,  
options: {}  
});  
}  
}  
};  
 
var templates = {  
mustache_js: {  
simple: '<div class="test"><h2>This is a test of {{name}}</h2><p>The homepage is <a href="{{url}}">{{url}}</a>.</p><p>The sources is: {{source}}</p></div>',  
loop: '<div class="comments"><h3>{{header}}</h3><ul>{{#comments}}<li class="comment"><h5>{{name}}</h5><p>{{body}}</p></li>{{/comments}}</ul></div>'  
},  
underscore: {  
simple: _.template('<div class="test"><h2>This is a test of <%= name %></h2><p>The homepage is <a href="<%= url %>"><%= url %></a>.</p><p>The sources is: <%= source %></p></div>'),  
loop: _.template('<div class="comments"><h3><%= header %></h3><ul><% _.each(comments, function(comment){ %><li class="comment"><h5><%= comment.name %></h5><p><%= comment.body %></p></li><% }); %></ul></div>')  
},  
srender: {  
simple: '<div class="test"><h2>This is a test of <%= name %></h2><p>The homepage is <a href="<%= url %>"><%= url %></a>.</p><p>The sources is: <%= source %></p></div>',  
loop: '<div class="comments"><h3><%= header %></h3><ul><% $.each(comments, function(i, comment){ %><li class="comment"><h5><%= comment.name %></h5><p><%= comment.body %></p></li><% }); %></ul></div>'  
},  
jqote2: {  
simple: $.jqotec('#jqote2_simple'),  
loop: $.jqotec('#jqote2_loop')  
},  
tempest: {  
simple: $.tempest('simple', '<div class="test"><h2>This is a test of {{name}}</h2><p>The homepage is <a href="{{url}}">{{url}}</a>.</p><p>The sources is: {{source}}</p></div>') && 'simple',  
loop: $.tempest('loop', '<div class="comments"><h3>{{header}}</h3><ul>{% for comment in comments %}<li class="comment"<h5>{{comment.name}}</h5><p>{{comment.body}}</p></li>{% endfor %}</ul></div>') && 'loop'  
},  
nano: {  
simple: '<div class="test"><h2>This is a test of {name}</h2><p>The homepage is <a href="{url}">{url}</a>.</p><p>The sources is: {source}</p></div>',  
loop: {  
comment: '<li class="comment"><h5>{name}</h5><p>{body}</p></li>',  
container: '<div class="comments"><h3>{header}</h3><ul>{comments}</ul></div>'  
}  
}  
};  
 
$.templates.simple = $.tmpl('<div class="test"><h2>This is a test of ${name}</h2><p>The homepage is <a href="${url}">${url}</a>.</p><p>The sources is: ${source}</p></div>');  
$.templates.loop = $.tmpl('<div class="comments"><h3>${header}</h3><ul>{{each(i,comment) comments}}<li class="comment"><h5>${comment.name}</h5><p>${comment.body}</p></li>{{/each}}</ul></div>');  
 
var payload = {  
simple: {  
name: 'foo',  
url: 'http://foo.bar/foo',  
source: 'http://foo.bar/jquery.foo.js'  
},  
loop: {  
header: "My Post Comments",  
comments: [  
{name: "Joe", body: "Thanks for this post!"},  
{name: "Sam", body: "Thanks for this post!"},  
{name: "Heather", body: "Thanks for this post!"},  
{name: "Kathy", body: "Thanks for this post!"},  
{name: "George", body: "Thanks for this post!"}  
]  
}  
};  
 
var color = {  
mustache_js: '#8f04a8',  
underscore: '#cd0074',  
srender: '#5b4cd8',  
jqote2: '#70e500',  
tempest: '#0d3349',  
nano: '#fff800',  
tmpl: '#00f8ff'  
};  
 
$('input[name=check]').click(function() {  
var checked = this.checked;  
 
$('input[name=contestant]').each(function() {  
this.checked = checked;  
});  
});  
 
$('input[name=contestant]').each(function(i) {  
var key = this.value;  
 
contestants[key] = {  
name: key,  
results: [],  
input: $(this),  
color: color[key],  
number: $('p.number', $(this).parents('li')[0]),  
progress: $('ul.progress', $(this).parents('li')[0]),  
templates: templates[key],  
benchmarks: benchmarks[key]  
};  
}).click(function() {  
$('input[name=check]')[0].checked = false;  
});  
 
$('#run').click(function() {  
CYCLES = $('input:radio:checked').val();  
$('ul.progress, p.number').empty();  
$(this).trigger('benchmark');  
 
}).bind('benchmark', function() {  
var cons = shuffle($('input[name=contestant]:checked').toArray()),  
runs = cons.length;  
 
if ( !runs ) return;  
 
var test_run = setInterval(function() {  
var contestant = null;  
 
if ( !(contestant = cons.shift()) ) return;  
 
if ( $('input[name=simple_test]:checked').length )  
$.benchmark(CONVERSIONS, contestants[contestant.value], 'simple');  
if ( $('input[name=loop_test]:checked').length )  
$.benchmark(CONVERSIONS, contestants[contestant.value], 'loop');  
 
contestants[contestant.value].progress.append('<li/>');  
}, RUN_LEAP);  
 
setTimeout(function() {  
clearInterval(test_run);  
( --CYCLES ) ? $('#run').trigger('benchmark') : plot(contestants);  
}, RUN_LEAP * runs + 1500);  
});  
});  
</script>  
</body>  
 
<script type="text/x-jqote-template" id="jqote2_simple">  
<![CDATA[<div class="test"><h2>This is a test of <%= this.name %></h2><p>The homepage is <a href="<%= this.url %>"><%= this.url %></a>.</p><p>The sources is: <%= this.source %></p></div>]]>  
</script>  
 
<script type="text/x-jqote-template" id="jqote2_loop">  
<![CDATA[<div class="comments"><h3><%= this.header %></h3><ul><% $.each(this.comments, function(i, comment){ %><li class="comment"><h5><%= comment.name %></h5><p><%= comment.body %></p></li><% }); %></ul></div>]]>  
</script>  
</html>  
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<title>jQote2 QUnit Simple Test Suite // aefxx.com</title>  
<link type="image/x-icon" href="favicon.ico" rel="Shortcut Icon">  
<link rel="stylesheet" href="external/qunit.css" type="text/css"/>  
<script src="external/jquery-1.4.2.min.js" type="text/javascript"></script>  
<script src="external/qunit.js" type="text/javascript"></script>  
<script src="jquery.jqote2.js" type="text/javascript"></script>  
</head>  
<body>  
<h1 id="qunit-header">jQote2 QUnit Simple Test Suite</h1>  
<h2 id="qunit-banner"></h2>  
<h2 id="qunit-userAgent"></h2>  
<ol id="qunit-tests"></ol>  
<script type="text/javascript">  
$(function() {  
module('Core');  
 
test('basic requirements', function() {  
expect(2);  
ok( $.fn.jqote, 'jQqote' );  
ok( $.jqotec, 'jQote compile' );  
});  
 
module('Shorthand tag');  
 
test('basic tests', function() {  
expect(3);  
equal($('#sb1').jqote({str: 'Hello World'}), 'Hello World');  
equal($('#sb2').jqote({a: 25, b: 2}), '25 % 2 = 1');  
equal($('#sb3').jqote({  
a: function(b) {return 'Hello ' + b();},  
b: function() {return 'Mr. O\'Brian';}  
}), '"Hello Mr. O\'Brian"');  
});  
 
test('advanced tests', function() {  
expect(2);  
equal($('#sa1').jqote([{x: 0}]), '0123456789');  
equal($('#sa2').jqote([{n: 7}]), '13');  
});  
 
module('Standard tag');  
 
test('basic tests', function() {  
expect(4);  
equal($('#stdb1').jqote([{name: 'aefxx'}]), 'Hi, my name is aefxx.');  
equal($('#stdb2').jqote([{a: 25, b: 2}]), '25 % 2 = 1');  
equal($('#stdb3').jqote([{x: 3}]), 'IEEE 754');  
equal($('#stdb4').jqote([{x: 3}]), 'GNU is Not Unix');  
});  
});  
</script>  
<script id="sb1" type="text/x-jqote-template">  
<![CDATA[  
<%= this.str %>  
]]>  
</script>  
<script id="sb2" type="text/x-jqote-template">  
<![CDATA[  
<%= this.a %> % <%= this.b %> = <%= this.a % this.b %>  
]]>  
</script>  
<script id="sb3" type="text/x-jqote-template">  
<![CDATA[  
"<%= this.a(this.b) %>"  
]]>  
</script>  
<script id="sa1" type="text/x-jqote-template">  
<![CDATA[  
<%= this.x + ( j < 8 ? data[j+1] = {x: j+1, y: ''} : {y: 9}).y %>  
]]>  
</script>  
<script id="sa2" type="text/x-jqote-template">  
<![CDATA[  
<%= ( ( this.n == 0 ) ?  
0 : ( this.n == 1 || this.n == 2 ) ?  
1 : parseInt($.jqote(fn, {n: this.n-1})) + parseInt($.jqote(fn, {n: this.n-2})) )  
%>  
]]>  
</script>  
<script id="stdb1" type="text/x-jqote-template">  
<![CDATA[  
Hi, my name is <% out += this.name; %>.  
]]>  
</script>  
<script id="stdb2" type="text/x-jqote-template">  
<![CDATA[  
<% out += this.a; %> % <% out += this.b; %> = <% if ( this.a % this.b ) %>1<% else %>0  
]]>  
</script>  
<script id="stdb3" type="text/x-jqote-template">  
<![CDATA[  
I<% while ( this.x-- ) %>E<% ; %> 754  
]]>  
</script>  
<script id="stdb4" type="text/x-jqote-template">  
<![CDATA[  
<% while ( this.x )  
switch ( this.x-- ) {  
case 3:  
%>GNU is <%  
break;  
case 2:  
%>Not <%  
break;  
default:  
%>Unix<%  
} %>  
]]>  
</script>  
</body>  
</html>  
 
/*  
* jQote2 - client-side Javascript templating engine  
* Copyright (C) 2010, aefxx  
* http://aefxx.com/  
*  
* Licensed under the DWTFYWT PUBLIC LICENSE v2  
* Copyright (C) 2004, Sam Hocevar  
*  
* Date: Sun, May 5th, 2010  
* Version: 0.9.2  
*/  
(function($) {  
var ARR = '[object Array]',  
FUNC = '[object Function]',  
STR = '[object String]';  
 
var n = 0,  
tag = '%',  
type_of = Object.prototype.toString;  
 
$.fn.extend({  
jqote: function(data, t) {  
var data = type_of.call(data) === ARR ? data : [data],  
dom = '';  
 
this.each(function(i) {  
var f = ( fn = $.jqotecache[this.jqote] ) ? fn : $.jqotec(this, t || tag);  
 
for ( var j=0; j < data.length; j++ )  
dom += f.call(data[j], i, j, data, f);  
});  
 
return dom;  
},  
 
jqoteapp: function(elem, data, t) {  
var dom = $.jqote(elem, data, t);  
 
return this.each(function() {  
$(this).append(dom);  
});  
},  
 
jqotepre: function(elem, data, t) {  
var dom = $.jqote(elem, data, t);  
 
return this.each(function() {  
$(this).prepend(dom);  
});  
},  
 
jqotesub: function(elem, data, t) {  
var dom = $.jqote(elem, data, t);  
 
return this.each(function() {  
$(this).html(dom);  
});  
}  
});  
 
$.extend({  
jqote: function(elem, data, t) {  
var dom = '', fn = [], t = t || tag, type = type_of.call(elem),  
data = type_of.call(data) === ARR ? data : [data];  
 
if ( type === FUNC )  
fn = [elem];  
 
else if ( type === ARR )  
fn = type_of.call(elem[0]) === FUNC ?  
elem : $.map(elem, function(e) { return $.jqotec(e, t); });  
 
else if ( type === STR )  
fn.push( elem.indexOf('<' + t) < 0 ?  
$.jqotec($(elem), t) : $.jqotec(elem, t));  
 
else fn = $.map($(elem), function(e) { return $.jqotec(e, t); });  
 
for ( var i=0,l=fn.length; i < l; i++ )  
for ( var j=0; j < data.length; j++ )  
dom += fn[i].call(data[j], i, j, data, fn[i]);  
 
return dom;  
},  
 
jqotec: function(elem, t) {  
var fn, str = '', t = t || tag,  
type = type_of.call(elem),  
tmpl = ( type === STR && elem.indexOf('<' + t) >= 0 ) ?  
elem : ( elem = ( type === STR || elem instanceof jQuery ) ?  
$(elem)[0] : elem ).innerHTML;  
 
var arr = tmpl.replace(/\s*<!\[CDATA\[\s*|\s*\]\]>\s*|[\r\n\t]/g, '')  
.split('<'+t).join(t+'>\x1b')  
.split(t+'>');  
 
for ( var i=0,l=arr.length; i < l; i++ )  
str += arr[i].charAt(0) !== '\x1b' ?  
"out+='" + arr[i].replace(/([^\\])?(["'])/g, '$1\\$2') + "'" : (arr[i].charAt(1) === '=' ?  
'+' + arr[i].substr(2) + ';' : ';' + arr[i].substr(1));  
 
fn = new Function('i, j, data, fn', 'var out="";' + str + '; return out;');  
 
return type_of.call(elem) === STR ?  
fn : $.jqotecache[elem.jqote = elem.jqote || n++] = fn;  
},  
 
jqotefn: function(elem) {  
return $.jqotecache[$(elem)[0].jqote] || false;  
},  
 
jqotetag: function(str) {  
tag = str;  
},  
 
jqotecache: []  
});  
})(jQuery);  
 
/*  
* jQote2 - client-side Javascript templating engine  
* Copyright (C) 2010, aefxx  
* http://aefxx.com/  
*  
* Licensed under the DWTFYWT PUBLIC LICENSE v2  
* Copyright (C) 2004, Sam Hocevar  
*  
* Date: Sun, May 5th, 2010  
* Version: 0.9.2  
*/  
(function($){var A='[object Array]',F='[object Function]',S='[object String]',n=0,c='%',ts=Object.prototype.toString;$.fn.extend({jqote:function(x,y){var x=ts.call(x)===A?x:[x],d='';this.each(function(i){var f=(l=$.jqotecache[this.jqote])?l:$.jqotec(this,y||c);for(var j=0;j<x.length;j++)d+=f.call(x[j],i,j,x,f);});return d},jqoteapp:function(e,x,y){var d=$.jqote(e,x,y);return this.each(function(){$(this).append(d)})},jqotepre:function(e,x,y){var d=$.jqote(e,x,y);return this.each(function(){$(this).prepend(d)})},jqotesub:function(e,x,y){var d=$.jqote(e,x,y);return this.each(function(){$(this).html(d)})}});$.extend({jqote:function(e,x,y){var d='',l=[],y=y||c,t=ts.call(e),x=ts.call(x)===A?x:[x];if(t===F)l=[e];else if(t===A)l=ts.call(e[0])===F?e:$.map(e,function(u){return $.jqotec(u,y)});else if(t===S)l.push(e.indexOf('<'+y)<0?$.jqotec($(e),y):$.jqotec(e,y));else l=$.map($(e),function(u){return $.jqotec(u,y)});for(var i=0,q=l.length;i<q;i++)for(var j=0;j<x.length;j++)d+=l[i].call(x[j],i,j,x,l[i]);return d},jqotec: function(e, y) {var l,s='',y=y||c,t=ts.call(e),h=(t===S&&e.indexOf('<'+y)>=0)?e:(e=(t===S||e instanceof jQuery)?$(e)[0]:e).innerHTML;var a=h.replace(/\s*<!\[CDATA\[\s*|\s*\]\]>\s*|[\r\n\t]/g,'').split('<'+y).join(y+'>\x1b').split(y+'>');for(var i=0,q=a.length;i<q;i++)s+=a[i].charAt(0)!=='\x1b'?"out+='"+a[i].replace(/([^\\])?(["'])/g,'$1\\$2')+"'":(a[i].charAt(1)==='='?'+'+a[i].substr(2)+';':';'+a[i].substr(1));l=new Function('i, j, data, fn','var out="";'+s+'; return out;');return ts.call(e)===S?l:$.jqotecache[e.jqote=e.jqote||n++]=l},jqotefn:function(e){return $.jqotecache[$(e)[0].jqote]||false},jqotetag:function(s){c=s},jqotecache:[]});})(jQuery);  
 
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE  
Version 2, December 2004  
 
Copyright (C) 2004 Sam Hocevar  
14 rue de Plaisance, 75014 Paris, France  
Everyone is permitted to copy and distribute verbatim or modified  
copies of this license document, and changing it is allowed as long  
as the name is changed.  
 
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE  
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION  
 
0. You just DO WHAT THE FUCK YOU WANT TO.  
 
/*  
* jQuery 1.2.6 - New Wave Javascript  
*  
* Copyright (c) 2008 John Resig (jquery.com)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $  
* $Rev: 5685 $  
*/  
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else  
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else  
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else  
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else  
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else  
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else  
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else  
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else  
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else  
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else  
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else  
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else  
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else  
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else  
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else  
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else  
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else  
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else  
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else  
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else  
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else  
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();  
/*  
* 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]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});  
/*  
* Sizzle CSS Selector Engine - v0.9.3  
* Copyright 2009, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
* More information: http://sizzlejs.com/  
*/  
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();  
/*!  
* jQuery JavaScript Library v1.4.2  
* http://jquery.com/  
*  
* Copyright 2010, John Resig  
* Dual licensed under the MIT or GPL Version 2 licenses.  
* http://jquery.org/license  
*  
* Includes Sizzle.js  
* http://sizzlejs.com/  
* Copyright 2010, The Dojo Foundation  
* Released under the MIT, BSD, and GPL Licenses.  
*  
* Date: Sat Feb 13 22:33:48 2010 -0500  
*/  
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?  
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=  
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,  
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=  
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,  
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&  
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,  
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===  
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,  
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||  
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",  
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,  
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+  
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],  
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===  
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&  
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=  
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";  
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,  
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=  
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=  
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,  
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];  
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,  
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===  
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,  
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",  
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",  
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=  
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=  
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=  
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");  
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,  
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");  
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),  
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=  
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=  
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&  
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;  
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),  
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||  
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,  
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=  
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,  
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=  
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};  
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",  
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,  
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,  
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&  
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},  
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,  
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),  
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];  
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,  
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();  
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||  
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];  
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-  
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,  
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},  
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=  
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];  
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},  
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,  
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},  
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},  
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=  
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=  
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===  
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,  
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||  
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=  
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&  
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";  
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();  
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:  
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,  
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;  
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=  
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===  
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",  
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?  
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===  
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?  
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=  
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},  
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},  
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,  
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);  
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,  
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&  
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||  
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===  
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);  
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",  
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=  
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?  
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=  
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=  
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,  
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=  
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=  
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==  
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},  
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),  
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,  
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&  
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?  
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===  
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=  
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",  
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||  
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);  
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===  
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===  
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;  
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");  
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],  
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},  
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=  
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);  
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===  
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||  
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;  
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=  
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,  
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||  
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?  
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=  
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;  
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&  
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";  
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);  
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,  
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-  
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":  
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in  
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);  
 
/*!  
* jQuery UI 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI  
*/  
jQuery.ui||function(c){c.ui={version:"1.8.1",plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")=="hidden")return false;  
b=b&&b=="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,f,g){return c.ui.isOverAxis(a,d,f)&&c.ui.isOverAxis(b,e,g)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,  
PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none")},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||  
/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==  
undefined)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b=="absolute"||b=="relative"||b=="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b||"area"==b?a.href||!isNaN(d):!isNaN(d))&&  
!c(a)["area"==b?"parents":"closest"](":hidden").length},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}(jQuery);  
;/*!  
* jQuery UI Widget 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Widget  
*/  
(function(b){var j=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return j.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend({},c.options);b[e][a].prototype=  
b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==undefined){h=i;return false}}):this.each(function(){var g=  
b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();  
this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f,  
h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=  
b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);  
;/*!  
* jQuery UI Mouse 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Mouse  
*  
* Depends:  
* jquery.ui.widget.js  
*/  
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&  
this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();  
return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);c.browser.safari||a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&  
this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-  
a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);  
;/*  
* jQuery UI Position 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Position  
*/  
(function(c){c.ui=c.ui||{};var m=/left|center|right/,n=/top|center|bottom/,p=c.fn.position,q=c.fn.offset;c.fn.position=function(a){if(!a||!a.of)return p.apply(this,arguments);a=c.extend({},a);var b=c(a.of),d=(a.collision||"flip").split(" "),e=a.offset?a.offset.split(" "):[0,0],g,h,i;if(a.of.nodeType===9){g=b.width();h=b.height();i={top:0,left:0}}else if(a.of.scrollTo&&a.of.document){g=b.width();h=b.height();i={top:b.scrollTop(),left:b.scrollLeft()}}else if(a.of.preventDefault){a.at="left top";g=h=  
0;i={top:a.of.pageY,left:a.of.pageX}}else{g=b.outerWidth();h=b.outerHeight();i=b.offset()}c.each(["my","at"],function(){var f=(a[this]||"").split(" ");if(f.length===1)f=m.test(f[0])?f.concat(["center"]):n.test(f[0])?["center"].concat(f):["center","center"];f[0]=m.test(f[0])?f[0]:"center";f[1]=n.test(f[1])?f[1]:"center";a[this]=f});if(d.length===1)d[1]=d[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(a.at[0]==="right")i.left+=g;else if(a.at[0]==="center")i.left+=  
g/2;if(a.at[1]==="bottom")i.top+=h;else if(a.at[1]==="center")i.top+=h/2;i.left+=e[0];i.top+=e[1];return this.each(function(){var f=c(this),k=f.outerWidth(),l=f.outerHeight(),j=c.extend({},i);if(a.my[0]==="right")j.left-=k;else if(a.my[0]==="center")j.left-=k/2;if(a.my[1]==="bottom")j.top-=l;else if(a.my[1]==="center")j.top-=l/2;j.left=parseInt(j.left);j.top=parseInt(j.top);c.each(["left","top"],function(o,r){c.ui.position[d[o]]&&c.ui.position[d[o]][r](j,{targetWidth:g,targetHeight:h,elemWidth:k,  
elemHeight:l,offset:e,my:a.my,at:a.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(j,{using:a.using}))})};c.ui.position={fit:{left:function(a,b){var d=c(window);b=a.left+b.elemWidth-d.width()-d.scrollLeft();a.left=b>0?a.left-b:Math.max(0,a.left)},top:function(a,b){var d=c(window);b=a.top+b.elemHeight-d.height()-d.scrollTop();a.top=b>0?a.top-b:Math.max(0,a.top)}},flip:{left:function(a,b){if(b.at[0]!=="center"){var d=c(window);d=a.left+b.elemWidth-d.width()-d.scrollLeft();var e=b.my[0]==="left"?  
-b.elemWidth:b.my[0]==="right"?b.elemWidth:0,g=-2*b.offset[0];a.left+=a.left<0?e+b.targetWidth+g:d>0?e-b.targetWidth+g:0}},top:function(a,b){if(b.at[1]!=="center"){var d=c(window);d=a.top+b.elemHeight-d.height()-d.scrollTop();var e=b.my[1]==="top"?-b.elemHeight:b.my[1]==="bottom"?b.elemHeight:0,g=b.at[1]==="top"?b.targetHeight:-b.targetHeight,h=-2*b.offset[1];a.top+=a.top<0?e+b.targetHeight+h:d>0?e+g+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(a,b){if(/static/.test(c.curCSS(a,"position")))a.style.position=  
"relative";var d=c(a),e=d.offset(),g=parseInt(c.curCSS(a,"top",true),10)||0,h=parseInt(c.curCSS(a,"left",true),10)||0;e={top:b.top-e.top+g,left:b.left-e.left+h};"using"in b?b.using.call(a,e):d.css(e)};c.fn.offset=function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(){c.offset.setOffset(this,a)});return q.call(this)}}})(jQuery);  
;/*  
* jQuery UI Draggable 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Draggables  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.mouse.js  
* jquery.ui.widget.js  
*/  
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==  
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=  
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-  
this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();  
d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||  
this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,  
b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==  
a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||  
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],  
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-  
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment==  
"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&  
a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),  
10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],  
this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():  
f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+  
this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+  
Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-  
this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=  
this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.1"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");  
if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;  
c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=  
1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;  
this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=  
this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=  
d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;  
if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!=  
"HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-  
b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-  
c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,  
width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&  
o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=  
p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&  
(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),  
10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);  
;/*  
* jQuery UI Droppable 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Droppables  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
* jquery.ui.mouse.js  
* jquery.ui.draggable.js  
*/  
(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);  
a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&  
this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);  
this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=  
d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",  
a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.1"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;  
switch(c){case "fit":return i<e&&g<k&&j<f&&h<l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=i&&  
e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=  
"none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||  
a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=  
d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);  
;/*  
* jQuery UI Resizable 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Resizables  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.mouse.js  
* jquery.ui.widget.js  
*/  
(function(d){d.widget("ui.resizable",d.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");d.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,  
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&d.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(d('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),  
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=  
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!d(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",  
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var e=0;e<c.length;e++){var g=d.trim(c[e]),f=d('<div class="ui-resizable-handle '+("ui-resizable-"+g)+'"></div>');/sw|se|ne|nw/.test(g)&&f.css({zIndex:++a.zIndex});"se"==g&&f.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[g]=".ui-resizable-"+g;this.element.append(f)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==  
String)this.handles[i]=d(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=d(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}d(this.handles[i])}};this._renderAxis(this.element);this._handles=d(".ui-resizable-handle",this.element).disableSelection();  
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();d(this.element).addClass("ui-resizable-autohide").hover(function(){d(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){d(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){d(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};  
if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(d(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),  
e=this.element;this.resizing=true;this.documentScroll={top:d(document).scrollTop(),left:d(document).scrollLeft()};if(e.is(".ui-draggable")||/absolute/.test(e.css("position")))e.css({position:"absolute",top:c.top,left:c.left});d.browser.opera&&/relative/.test(e.css("position"))&&e.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var g=m(this.helper.css("top"));if(a.containment){c+=d(a.containment).scrollLeft()||0;g+=d(a.containment).scrollTop()||0}this.offset=  
this.helper.offset();this.position={left:c,top:g};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:c,top:g};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:  
this.originalSize.width/this.originalSize.height||1;a=d(".ui-resizable-"+this.axis).css("cursor");d("body").css("cursor",a=="auto"?this.axis+"-resize":a);e.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,e=this._change[this.axis];if(!e)return false;c=e.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",  
b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var e=this._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName);e=g&&d.ui.hasScroll(e[0],"left")?0:c.sizeDiff.height;  
g={width:c.size.width-(g?0:c.sizeDiff.width),height:c.size.height-e};e=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var f=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(d.extend(g,{top:f,left:e}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}d("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",  
b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,e=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(e=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(e=="nw"){b.top=  
a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,e=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,g=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,f=k(b.width)&&a.minWidth&&a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(f)b.width=a.minWidth;if(h)b.height=a.minHeight;if(e)b.width=a.maxWidth;if(g)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,  
l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(f&&l)b.left=i-a.minWidth;if(e&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(g&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var e=[c.css("borderTopWidth"),  
c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],g=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=d.map(e,function(f,h){f=parseInt(f,10)||0;h=parseInt(g[h],10)||0;return f+h})}d.browser.msie&&(d(b).is(":hidden")||d(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=  
this.element.offset();if(this._helper){this.helper=this.helper||d('<div style="overflow:hidden;"></div>');var a=d.browser.msie&&d.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+  
a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return d.extend(this._change.n.apply(this,  
arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return d.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){d.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});d.extend(d.ui.resizable,  
{version:"1.8.1"});d.ui.plugin.add("resizable","alsoResize",{start:function(){var b=d(this).data("resizable").options,a=function(c){d(c).each(function(){d(this).data("resizable-alsoresize",{width:parseInt(d(this).width(),10),height:parseInt(d(this).height(),10),left:parseInt(d(this).css("left"),10),top:parseInt(d(this).css("top"),10)})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else d.each(b.alsoResize,function(c){a(c)});  
else a(b.alsoResize)},resize:function(){var b=d(this).data("resizable"),a=b.options,c=b.originalSize,e=b.originalPosition,g={height:b.size.height-c.height||0,width:b.size.width-c.width||0,top:b.position.top-e.top||0,left:b.position.left-e.left||0},f=function(h,i){d(h).each(function(){var j=d(this),l=d(this).data("resizable-alsoresize"),p={};d.each((i&&i.length?i:["width","height","top","left"])||["width","height","top","left"],function(n,o){if((n=(l[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(/relative/.test(j.css("position"))&&  
d.browser.opera){b._revertToRelativePosition=true;j.css({position:"absolute",top:"auto",left:"auto"})}j.css(p)})};typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?d.each(a.alsoResize,function(h,i){f(h,i)}):f(a.alsoResize)},stop:function(){var b=d(this).data("resizable");if(b._revertToRelativePosition&&d.browser.opera){b._revertToRelativePosition=false;el.css({position:"relative"})}d(this).removeData("resizable-alsoresize-start")}});d.ui.plugin.add("resizable","animate",{stop:function(b){var a=  
d(this).data("resizable"),c=a.options,e=a._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName),f=g&&d.ui.hasScroll(e[0],"left")?0:a.sizeDiff.height;g={width:a.size.width-(g?0:a.sizeDiff.width),height:a.size.height-f};f=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(d.extend(g,h&&f?{top:h,left:f}:{}),{duration:c.animateDuration,easing:c.animateEasing,  
step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};e&&e.length&&d(e[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});d.ui.plugin.add("resizable","containment",{start:function(){var b=d(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof d?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=  
d(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:d(document),left:0,top:0,width:d(document).width(),height:d(document).height()||document.body.parentNode.scrollHeight}}else{var e=d(a),g=[];d(["Top","Right","Left","Bottom"]).each(function(i,j){g[i]=m(e.css("padding"+j))});b.containerOffset=e.offset();b.containerPosition=e.position();b.containerSize={height:e.innerHeight()-g[3],width:e.innerWidth()-g[1]};c=b.containerOffset;  
var f=b.containerSize.height,h=b.containerSize.width;h=d.ui.hasScroll(a,"left")?a.scrollWidth:h;f=d.ui.hasScroll(a)?a.scrollHeight:f;b.parentData={element:a,left:c.left,top:c.top,width:h,height:f}}}},resize:function(b){var a=d(this).data("resizable"),c=a.options,e=a.containerOffset,g=a.position;b=a._aspectRatio||b.shiftKey;var f={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))f=e;if(g.left<(a._helper?e.left:0)){a.size.width+=a._helper?a.position.left-e.left:  
a.position.left-f.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?e.left:0}if(g.top<(a._helper?e.top:0)){a.size.height+=a._helper?a.position.top-e.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?e.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-f.left:a.offset.left-f.left)+a.sizeDiff.width);e=Math.abs((a._helper?a.offset.top-f.top:a.offset.top-  
e.top)+a.sizeDiff.height);g=a.containerElement.get(0)==a.element.parent().get(0);f=/relative|absolute/.test(a.containerElement.css("position"));if(g&&f)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(e+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-e;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=d(this).data("resizable"),a=b.options,c=b.containerOffset,e=b.containerPosition,  
g=b.containerElement,f=d(b.helper),h=f.offset(),i=f.outerWidth()-b.sizeDiff.width;f=f.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f});b._helper&&!a.animate&&/static/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f})}});d.ui.plugin.add("resizable","ghost",{start:function(){var b=d(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,  
display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=d(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=d(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});d.ui.plugin.add("resizable","grid",{resize:function(){var b=  
d(this).data("resizable"),a=b.options,c=b.size,e=b.originalSize,g=b.originalPosition,f=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-e.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-e.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a}else if(/^(ne)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}else{if(/^(sw)$/.test(f)){b.size.width=e.width+h;b.size.height=  
e.height+a}else{b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}b.position.left=g.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);  
;/*  
* jQuery UI Selectable 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Selectables  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.mouse.js  
* jquery.ui.widget.js  
*/  
(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var d=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(d.options.filter,d.element[0]);f.each(function(){var c=e(this),b=c.offset();e.data(this,"selectable-item",{element:this,$element:c,left:b.left,top:b.top,right:b.left+c.outerWidth(),bottom:b.top+c.outerHeight(),startselected:false,selected:c.hasClass("ui-selected"),  
selecting:c.hasClass("ui-selecting"),unselecting:c.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},  
_mouseStart:function(d){var f=this;this.opos=[d.pageX,d.pageY];if(!this.options.disabled){var c=this.options;this.selectees=e(c.filter,this.element[0]);this._trigger("start",d);e(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});c.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!d.metaKey){b.$element.removeClass("ui-selected");  
b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",d,{unselecting:b.element})}});e(d.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){b.$element.removeClass("ui-unselecting").addClass("ui-selecting");b.unselecting=false;b.selecting=true;b.selected=true;f._trigger("selecting",d,{selecting:b.element});return false}})}},_mouseDrag:function(d){var f=this;this.dragged=true;if(!this.options.disabled){var c=this.options,  
b=this.opos[0],g=this.opos[1],h=d.pageX,i=d.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(c.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(c.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");  
a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",d,{selecting:a.element})}}else{if(a.selecting)if(d.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",d,{unselecting:a.element})}if(a.selected)if(!d.metaKey&&  
!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",d,{unselecting:a.element})}}}});return false}},_mouseStop:function(d){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var c=e.data(this,"selectable-item");c.$element.removeClass("ui-unselecting");c.unselecting=false;c.startselected=false;f._trigger("unselected",d,{unselected:c.element})});e(".ui-selecting",this.element[0]).each(function(){var c=  
e.data(this,"selectable-item");c.$element.removeClass("ui-selecting").addClass("ui-selected");c.selecting=false;c.selected=true;c.startselected=true;f._trigger("selected",d,{selected:c.element})});this._trigger("stop",d);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.1"})})(jQuery);  
;/*  
* jQuery UI Sortable 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Sortables  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.mouse.js  
* jquery.ui.widget.js  
*/  
(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");  
this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(self,  
arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=  
c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,  
{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();  
if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",  
a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");  
if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+  
this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+  
b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+  
"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,  
c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==  
document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp();this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",  
null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):  
d(this.domPosition.parent).prepend(this.currentItem);return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},  
_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/  
2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=  
d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=  
this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?  
h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),  
b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?  
i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,  
c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=  
this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-  
parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],  
this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=  
1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",  
a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==  
this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||  
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],  
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-  
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;  
if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=  
d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-  
this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+  
this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],  
this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;  
if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-  
this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+  
(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&  
this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||  
this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",  
g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",  
this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=  
0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.1"})})(jQuery);  
;/*  
* jQuery UI Accordion 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Accordion  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
*/  
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},_create:function(){var a=this.options,b=this;this.running=0;this.element.addClass("ui-accordion ui-widget ui-helper-reset");  
this.element[0].nodeName=="UL"&&this.element.children("li").addClass("ui-accordion-li-fix");this.headers=this.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c(this).removeClass("ui-state-focus")});  
this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(a.navigation){var d=this.element.find("a").filter(a.navigationFilter);if(d.length){var f=d.closest(".ui-accordion-header");this.active=f.length?f:d.closest(".ui-accordion-content").prev()}}this.active=this._findActive(this.active||a.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");  
this._createIcons();this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(g){return b._keydown(g)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();this.active.length?this.active.attr("aria-expanded","true").attr("tabIndex","0"):this.headers.eq(0).attr("tabIndex","0");c.browser.safari||this.headers.find("a").attr("tabIndex","-1");a.event&&this.headers.bind(a.event+  
".accordion",function(g){b._clickHandler.call(b,g,this);g.preventDefault()})},_createIcons:function(){var a=this.options;if(a.icons){c("<span/>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");  
this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(a.autoHeight||a.fillHeight)b.css("height",  
"");return this},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();b&&this._createIcons()}},_keydown:function(a){var b=c.ui.keyCode;if(!(this.options.disabled||a.altKey||a.ctrlKey)){var d=this.headers.length,f=this.headers.index(a.target),g=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:g=this.headers[(f+1)%d];break;case b.LEFT:case b.UP:g=this.headers[(f-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},  
a.target);a.preventDefault()}if(g){c(a.target).attr("tabIndex","-1");c(g).attr("tabIndex","0");g.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,  
b-c(this).innerHeight()+c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a=="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=  
this.options;if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]==this.active[0];d.active=d.collapsible&&b?false:c(".ui-accordion-header",this.element).index(a);if(!(this.running||!d.collapsible&&b)){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);  
a.next().addClass("ui-accordion-content-active")}e=a.next();f=this.active.next();g={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):e,oldContent:f};d=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(e,f,g,b,d)}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);  
this.active.next().addClass("ui-accordion-content-active");var f=this.active.next(),g={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:f},e=this.active=c([]);this._toggle(e,f,g)}},_toggle:function(a,b,d,f,g){var e=this.options,k=this;this.toShow=a;this.toHide=b;this.data=d;var i=function(){if(k)return k._completed.apply(k,arguments)};this._trigger("changestart",null,this.data);this.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&f?{toShow:c([]),  
toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:i,down:g,autoHeight:e.autoHeight||e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;f=c.ui.accordion.animations;var h=e.duration,j=e.animated;if(j&&!f[j]&&!c.easing[j])j="slide";f[j]||(f[j]=function(l){this.slide(l,{easing:j,  
duration:h||700})});f[j](d)}else{if(e.collapsible&&f)a.toggle();else{b.hide();a.show()}i(true)}b.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();a.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(a){var b=this.options;this.running=a?0:--this.running;if(!this.running){b.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,  
{version:"1.8.1",animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},e={},k;b=a.toShow;k=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(i,h){e[h]="hide";i=(""+c.css(a.toShow[0],  
h)).match(/^([\d+-.]+)(.*)$/);g[h]={value:i[1],unit:i[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(e,{step:function(i,h){if(h.prop=="height")f=h.end-h.start===0?0:(h.now-h.start)/(h.end-h.start);a.toShow[0].style[h.prop]=f*g[h.prop].value+g[h.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css("width",k);a.toShow.css({overflow:d});a.complete()}})}else a.toHide.animate({height:"hide"},  
a);else a.toShow.animate({height:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);  
;/*  
* jQuery UI Autocomplete 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Autocomplete  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
* jquery.ui.position.js  
*/  
(function(e){e.widget("ui.autocomplete",{options:{minLength:1,delay:300},_create:function(){var a=this,b=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){var d=e.ui.keyCode;switch(c.keyCode){case d.PAGE_UP:a._move("previousPage",c);break;case d.PAGE_DOWN:a._move("nextPage",c);break;case d.UP:a._move("previous",c);c.preventDefault();  
break;case d.DOWN:a._move("next",c);c.preventDefault();break;case d.ENTER:a.menu.active&&c.preventDefault();case d.TAB:if(!a.menu.active)return;a.menu.select(c);break;case d.ESCAPE:a.element.val(a.term);a.close(c);break;case d.LEFT:case d.RIGHT:case d.SHIFT:case d.CONTROL:case d.ALT:break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){a.search(null,c)},a.options.delay);break}}).bind("focus.autocomplete",function(){a.selectedItem=null;a.previous=a.element.val()}).bind("blur.autocomplete",  
function(c){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo("body",b).menu({focus:function(c,d){d=d.item.data("item.autocomplete");false!==a._trigger("focus",null,{item:d})&&/^key/.test(c.originalEvent.type)&&a.element.val(d.value)},selected:function(c,d){d=d.item.data("item.autocomplete");false!==a._trigger("select",  
c,{item:d})&&a.element.val(d.value);a.close(c);c=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=c}a.selectedItem=d},blur:function(){a.menu.element.is(":visible")&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");  
this.menu.element.remove();e.Widget.prototype.destroy.call(this)},_setOption:function(a){e.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource()},_initSource:function(){var a,b;if(e.isArray(this.options.source)){a=this.options.source;this.source=function(c,d){d(e.ui.autocomplete.filter(a,c.term))}}else if(typeof this.options.source==="string"){b=this.options.source;this.source=function(c,d){e.getJSON(b,c,d)}}else this.source=this.options.source},search:function(a,b){a=  
a!=null?a:this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search")!==false)return this._search(a)},_search:function(a){this.term=this.element.addClass("ui-autocomplete-loading").val();this.source({term:a},this.response)},_response:function(a){if(a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);  
if(this.menu.element.is(":visible")){this._trigger("close",a);this.menu.element.hide();this.menu.deactivate()}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return e.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return e.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+  
1),c;this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position({my:"left top",at:"left bottom",of:this.element,collision:"none"});a=b.width("").width();c=this.element.width();b.width(Math.max(a,c))},_renderMenu:function(a,b){var c=this;e.each(b,function(d,f){c._renderItem(a,f)})},_renderItem:function(a,b){return e("<li></li>").data("item.autocomplete",b).append("<a>"+b.label+"</a>").appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&  
/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")},filter:function(a,b){var c=new RegExp(e.ui.autocomplete.escapeRegex(b),"i");return e.grep(a,function(d){return c.test(d.label||d.value||d)})}})})(jQuery);  
(function(e){e.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(b){if(e(b.target).closest(".ui-menu-item a").length){b.preventDefault();a.select(b)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",  
-1).mouseenter(function(b){a.activate(b,e(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.attr("scrollTop"),f=this.element.height();if(c<0)this.element.attr("scrollTop",d+c);else c>f&&this.element.attr("scrollTop",d+c-f+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:b})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");  
this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prev().length},last:function(){return this.active&&!this.active.next().length},move:function(a,b,c){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0);a.length?this.activate(c,a):this.activate(c,this.element.children(b))}else this.activate(c,this.element.children(b))},nextPage:function(a){if(this.hasScroll())if(!this.active||  
this.last())this.activate(a,this.element.children(":first"));else{var b=this.active.offset().top,c=this.element.height(),d=this.element.children("li").filter(function(){var f=e(this).offset().top-b-c+e(this).height();return f<10&&f>-10});d.length||(d=this.element.children(":last"));this.activate(a,d)}else this.activate(a,this.element.children(!this.active||this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(":last"));  
else{var b=this.active.offset().top,c=this.element.height();result=this.element.children("li").filter(function(){var d=e(this).offset().top-b+c-e(this).height();return d<10&&d>-10});result.length||(result=this.element.children(":first"));this.activate(a,result)}else this.activate(a,this.element.children(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})})(jQuery);  
;/*  
* jQuery UI Button 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Button  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
*/  
(function(a){var g,i=function(b){a(":ui-button",b.target.form).each(function(){var c=a(this).data("button");setTimeout(function(){c.refresh()},1)})},h=function(b){var c=b.name,d=b.form,e=a([]);if(c)e=d?a(d).find("[name='"+c+"']"):a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form});return e};a.widget("ui.button",{options:{text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",i);this._determineButtonType();  
this.hasTitle=!!this.buttonElement.attr("title");var b=this,c=this.options,d=this.type==="checkbox"||this.type==="radio",e="ui-state-hover"+(!d?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){a(this).addClass("ui-state-hover");this===g&&a(this).addClass("ui-state-active")}}).bind("mouseleave.button",  
function(){c.disabled||a(this).removeClass(e)}).bind("focus.button",function(){a(this).addClass("ui-state-focus")}).bind("blur.button",function(){a(this).removeClass("ui-state-focus")});d&&this.element.bind("change.button",function(){b.refresh()});if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).toggleClass("ui-state-active");b.buttonElement.attr("aria-pressed",b.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",  
function(){if(c.disabled)return false;a(this).addClass("ui-state-active");b.buttonElement.attr("aria-pressed",true);var f=b.element[0];h(f).not(f).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");g=this;a(document).one("mouseup",function(){g=null})}).bind("mouseup.button",function(){if(c.disabled)return false;a(this).removeClass("ui-state-active")}).bind("keydown.button",  
function(f){if(c.disabled)return false;if(f.keyCode==a.ui.keyCode.SPACE||f.keyCode==a.ui.keyCode.ENTER)a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(f){f.keyCode===a.ui.keyCode.SPACE&&a(this).click()})}this._setOption("disabled",c.disabled)},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?  
"input":"button";if(this.type==="checkbox"||this.type==="radio"){this.buttonElement=this.element.parents().last().find("[for="+this.element.attr("id")+"]");this.element.addClass("ui-helper-hidden-accessible");var b=this.element.is(":checked");b&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",b)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());  
this.hasTitle||this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled")c?this.element.attr("disabled",true):this.element.removeAttr("disabled");this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);if(this.type==="radio")h(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed",  
true):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement,c=a("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),  
d=this.options.icons,e=d.primary&&d.secondary;if(d.primary||d.secondary){b.addClass("ui-button-text-icon"+(e?"s":""));d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>");d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>");if(!this.options.text){b.addClass(e?"ui-button-icons-only":"ui-button-icon-only").removeClass("ui-button-text-icons ui-button-text-icon");this.hasTitle||b.attr("title",c)}}else b.addClass("ui-button-text-only")}}});  
a.widget("ui.buttonset",{_create:function(){this.element.addClass("ui-buttonset");this._init()},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(":button, :submit, :reset, :checkbox, :radio, a, :data(button)").filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},  
destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery);  
;/*  
* jQuery UI Dialog 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Dialog  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
* jquery.ui.button.js  
* jquery.ui.draggable.js  
* jquery.ui.mouse.js  
* jquery.ui.position.js  
* jquery.ui.resizable.js  
*/  
(function(c){c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");var a=this,b=a.options,d=b.title||a.originalTitle||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+  
b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),  
h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",  
e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");  
a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==  
b.uiDialog[0])d=Math.max(d,c(this).css("z-index"))});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",  
c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;d.next().length&&d.appendTo("body");a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===  
f[0]&&e.shiftKey){g.focus(1);return false}}});c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();a._trigger("open");a._isOpen=true;return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,  
function(g,f){g=c('<button type="button"></button>').text(g).click(function(){f.apply(b.element[0],arguments)}).appendTo(e);c.fn.button&&g.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");  
b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,position:f.position,size:f.size}}a=a===undefined?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");  
a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",  
f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0];a=a||c.ui.dialog.prototype.options.position;if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(e,g){if(+b[e]===b[e]){d[e]=b[e];b[e]=  
g}})}else if(typeof a==="object"){if("left"in a){b[0]="left";d[0]=a.left}else if("right"in a){b[0]="right";d[0]=-a.right}if("top"in a){b[1]="top";d[1]=a.top}else if("bottom"in a){b[1]="bottom";d[1]=-a.bottom}}(a=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position({my:b.join(" "),at:b.join(" "),offset:d.join(" "),of:window,collision:"fit",using:function(e){var g=c(this).css(e).offset().top;g<0&&c(this).css("top",e.top-g)}});a||this.uiDialog.hide()},_setOption:function(a,  
b){var d=this,e=d.uiDialog,g=e.is(":data(resizable)"),f=false;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");break;case "draggable":b?d._makeDraggable():e.draggable("destroy");break;  
case "height":f=true;break;case "maxHeight":g&&e.resizable("option","maxHeight",b);f=true;break;case "maxWidth":g&&e.resizable("option","maxWidth",b);f=true;break;case "minHeight":g&&e.resizable("option","minHeight",b);f=true;break;case "minWidth":g&&e.resizable("option","minWidth",b);f=true;break;case "position":d._position(b);break;case "resizable":g&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",  
d.uiDialogTitlebar).html(""+(b||"&#160;"));break;case "width":f=true;break}c.Widget.prototype._setOption.apply(d,arguments);f&&d._size()},_size:function(){var a=this.options,b;this.element.css({width:"auto",minHeight:0,height:0});b=this.uiDialog.css({height:"auto",width:a.width}).height();this.element.css(a.height==="auto"?{minHeight:Math.max(a.minHeight-b,0),height:"auto"}:{minHeight:0,height:Math.max(a.height-b,0)}).show();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",  
this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.1",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&  
c(document).bind(c.ui.dialog.overlay.events,function(d){return c(d.target).zIndex()>=c.ui.dialog.overlay.maxZ})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&  
b.bgiframe();this.instances.push(b);return b},destroy:function(a){this.oldInstances.push(this.instances.splice(c.inArray(a,this.instances),1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var b=0;c.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,  
document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,  
height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);  
;/*  
* jQuery UI Slider 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Slider  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.mouse.js  
* jquery.ui.widget.js  
*/  
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var b=this,a=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");a.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");  
this.range=d([]);if(a.range){if(a.range===true){this.range=d("<div></div>");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");  
if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length<a.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();  
else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),g,h,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e=  
false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");g=b._start(c,f);if(g===false)return}break}i=b.options.step;g=b.options.values&&b.options.values.length?(h=b.values(f)):(h=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:h=b._valueMin();break;case d.ui.keyCode.END:h=b._valueMax();break;case d.ui.keyCode.PAGE_UP:h=g+(b._valueMax()-b._valueMin())/5;break;case d.ui.keyCode.PAGE_DOWN:h=g-(b._valueMax()-b._valueMin())/5;break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(g===  
b._valueMax())return;h=g+i;break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(g===b._valueMin())return;h=g-i;break}b._slide(c,f,h);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");  
this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,g,h,i;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c={x:b.pageX,y:b.pageY};e=this._normValueFromMouse(c);f=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(j){var k=Math.abs(e-h.values(j));if(f>k){f=k;g=d(this);i=j}});if(a.range===true&&this.values(1)===a.min){i+=1;g=d(this.handles[i])}if(this._start(b,  
i)===false)return false;this._mouseSliding=true;h._handleIndex=i;g.addClass("ui-state-active").focus();a=g.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-g.width()/2,top:b.pageY-a.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)};e=this._normValueFromMouse(c);this._slide(b,i,e);return this._animateOff=true},_mouseStart:function(){return true},  
_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;  
if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=  
this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c<e))c=e;if(c!==this.values(a)){e=this.values();e[a]=c;b=this._trigger("slide",b,{handle:this.handles[a],value:c,values:e});this.values(a?0:1);b!==false&&this.values(a,c,true)}}else if(c!==this.value()){b=this._trigger("slide",b,{handle:this.handles[a],  
value:c});b!==false&&this.value(c)}},_stop:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("stop",b,c)},_change:function(b,a){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("change",b,c)}},value:function(b){if(arguments.length){this.options.value=  
this._trimAlignValue(b);this._refreshValue();this._change(null,0)}return this._value()},values:function(b,a){var c,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(b):this.value();  
else return this._values()},_setOption:function(b,a){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":if(a){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();  
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var b=this.options.value;return b=this._trimAlignValue(b)},_values:function(b){var a,c;if(arguments.length){a=this.options.values[b];  
return a=this._trimAlignValue(a)}else{a=this.options.values.slice();for(c=0;c<a.length;c+=1)a[c]=this._trimAlignValue(a[c]);return a}},_trimAlignValue:function(b){if(b<this._valueMin())return this._valueMin();if(b>this._valueMax())return this._valueMax();var a=this.options.step,c=b%a;b=b-c;if(c>=a/2)b+=a;return parseFloat(b.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,a=this.options,c=this,  
e=!this._animateOff?a.animate:false,f,g={},h,i,j,k;if(this.options.values&&this.options.values.length)this.handles.each(function(l){f=(c.values(l)-c._valueMin())/(c._valueMax()-c._valueMin())*100;g[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](g,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(l===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate);if(l===1)c.range[e?"animate":"css"]({width:f-h+"%"},{queue:false,duration:a.animate})}else{if(l===  
0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(l===1)c.range[e?"animate":"css"]({height:f-h+"%"},{queue:false,duration:a.animate})}h=f});else{i=this.value();j=this._valueMin();k=this._valueMax();f=k!==j?(i-j)/(k-j)*100:0;g[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](g,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?  
"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.1"})})(jQuery);  
;/*  
* jQuery UI Tabs 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Tabs  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
*/  
(function(d){var s=0,u=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'},_create:function(){this._tabify(true)},_setOption:function(c,e){if(c=="selected")this.options.collapsible&&e==this.options.selected||  
this.select(e);else{this.options[c]=e;this._tabify()}},_tabId:function(c){return c.title&&c.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+ ++s},_sanitizeSelector:function(c){return c.replace(/:/g,"\\:")},_cookie:function(){var c=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++u);return d.cookie.apply(null,[c].concat(d.makeArray(arguments)))},_ui:function(c,e){return{tab:c,panel:e,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var c=  
d(this);c.html(c.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function e(g,f){g.css({display:""});!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}this.list=this.element.find("ol,ul").eq(0);this.lis=d("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);var a=this,b=this.options,h=/^#.+/;this.anchors.each(function(g,f){var j=d(f).attr("href"),l=j.split("#")[0],p;if(l&&(l===location.toString().split("#")[0]||  
(p=d("base")[0])&&l===p.href)){j=f.hash;f.href=j}if(h.test(j))a.panels=a.panels.add(a._sanitizeSelector(j));else if(j!="#"){d.data(f,"href.tabs",j);d.data(f,"load.tabs",j.replace(/#.*$/,""));j=a._tabId(f);f.href="#"+j;f=d("#"+j);if(!f.length){f=d(b.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else b.disabled.push(g)});if(c){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");  
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(b.selected===undefined){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){b.selected=g;return false}});if(typeof b.selected!="number"&&b.cookie)b.selected=parseInt(a._cookie(),10);if(typeof b.selected!="number"&&this.lis.filter(".ui-tabs-selected").length)b.selected=  
this.lis.index(this.lis.filter(".ui-tabs-selected"));b.selected=b.selected||(this.lis.length?0:-1)}else if(b.selected===null)b.selected=-1;b.selected=b.selected>=0&&this.anchors[b.selected]||b.selected<0?b.selected:0;b.disabled=d.unique(b.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(b.selected,b.disabled)!=-1&&b.disabled.splice(d.inArray(b.selected,b.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");  
if(b.selected>=0&&this.anchors.length){this.panels.eq(b.selected).removeClass("ui-tabs-hide");this.lis.eq(b.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[b.selected],a.panels[b.selected]))});this.load(b.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else b.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));this.element[b.collapsible?"addClass":  
"removeClass"]("ui-tabs-collapsible");b.cookie&&this._cookie(b.selected,b.cookie);c=0;for(var i;i=this.lis[c];c++)d(i)[d.inArray(c,b.disabled)!=-1&&!d(i).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");b.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(b.event!="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+g)};this.lis.bind("mouseover.tabs",  
function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(b.fx)if(d.isArray(b.fx)){m=b.fx[0];o=b.fx[1]}else m=o=b.fx;var q=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",function(){e(f,o);a._trigger("show",  
null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},r=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};this.anchors.bind(b.event+".tabs",  
function(){var g=this,f=d(this).closest("li"),j=a.panels.filter(":not(.ui-tabs-hide)"),l=d(a._sanitizeSelector(this.hash));if(f.hasClass("ui-tabs-selected")&&!b.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}b.selected=a.anchors.index(this);a.abort();if(b.collapsible)if(f.hasClass("ui-tabs-selected")){b.selected=-1;b.cookie&&a._cookie(b.selected,b.cookie);a.element.queue("tabs",function(){r(g,  
j)}).dequeue("tabs");this.blur();return false}else if(!j.length){b.cookie&&a._cookie(b.selected,b.cookie);a.element.queue("tabs",function(){q(g,l)});a.load(a.anchors.index(this));this.blur();return false}b.cookie&&a._cookie(b.selected,b.cookie);if(l.length){j.length&&a.element.queue("tabs",function(){r(g,j)});a.element.queue("tabs",function(){q(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",  
function(){return false})},destroy:function(){var c=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(b,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,  
"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});c.cookie&&this._cookie(null,c.cookie);return this},add:function(c,e,a){if(a===undefined)a=this.anchors.length;var b=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,e));c=!c.indexOf("#")?c.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",  
true);var i=d("#"+c);i.length||(i=d(h.panelTemplate).attr("id",c).data("destroy.tabs",true));i.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);i.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);i.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");i.removeClass("ui-tabs-hide");  
this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(c){var e=this.options,a=this.lis.eq(c).remove(),b=this.panels.eq(c).remove();if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(c+(c+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=c}),function(h){return h>=c?--h:h});this._tabify();this._trigger("remove",  
null,this._ui(a.find("a")[0],b[0]));return this},enable:function(c){var e=this.options;if(d.inArray(c,e.disabled)!=-1){this.lis.eq(c).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=c});this._trigger("enable",null,this._ui(this.anchors[c],this.panels[c]));return this}},disable:function(c){var e=this.options;if(c!=e.selected){this.lis.eq(c).addClass("ui-state-disabled");e.disabled.push(c);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}return this},  
select:function(c){if(typeof c=="string")c=this.anchors.index(this.anchors.filter("[href$="+c+"]"));else if(c===null)c=-1;if(c==-1&&this.options.collapsible)c=this.options.selected;this.anchors.eq(c).trigger(this.options.event+".tabs");return this},load:function(c){var e=this,a=this.options,b=this.anchors.eq(c)[0],h=d.data(b,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(b,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(c).addClass("ui-state-processing");  
if(a.spinner){var i=d("span",b);i.data("label.tabs",i.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){d(e._sanitizeSelector(b.hash)).html(k);e._cleanup();a.cache&&d.data(b,"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[c],e.panels[c]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[c],e.panels[c]));try{a.ajaxOptions.error(k,n,c,b)}catch(m){}}}));e.element.dequeue("tabs");return this}},  
abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},url:function(c,e){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.1"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(c,e){var a=this,b=this.options,h=a._rotate||(a._rotate=  
function(i){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=b.selected;a.select(++k<a.anchors.length?k:0)},c);i&&i.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(i){i.clientX&&a.rotate(null)}:function(){t=b.selected;h()});if(c){this.element.bind("tabsshow",h);this.anchors.bind(b.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(b.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);  
;/*  
* jQuery UI Datepicker 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Datepicker  
*  
* Depends:  
* jquery.ui.core.js  
*/  
(function(d){function J(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=  
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",  
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",  
minDate:null,maxDate:null,duration:"_default",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}function E(a,b){d.extend(a,  
b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.1"}});var y=(new Date).getTime();d.extend(J.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=  
f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id)a.id="dp"+ ++this.uuid;var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},  
_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&  
b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==  
""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,  
c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),  
true);this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){a="dp"+ ++this.uuid;this._dialogInput=d('<input type="text" id="'+a+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{});b=b&&b.constructor==Date?  
this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);  
d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},  
_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=  
d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;  
for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&  
this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&  
!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass,b.dpDiv).add(d("td."+d.datepicker._currentClass,b.dpDiv));c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();  
return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||  
a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,  
a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));  
var c=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||  
a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);  
d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&  
d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=d.datepicker._getBorders(b.dpDiv);b.dpDiv.find("iframe.ui-datepicker-cover").css({left:-i[0],top:-i[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,  
h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");  
this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");  
this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);var e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");  
a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus()},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),  
k=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>k&&k>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];  
a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():  
"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&  
!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;  
b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){a=this._getInst(d(a)[0]);  
a.input&&a._selectingMonthYear&&!d.browser.msie&&a.input.focus();a._selectingMonthYear=!a._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,  
"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||  
this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;  
for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,k=c=-1,l=-1,u=-1,j=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"?4:p=="o"?3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+  
s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,w,G){p=o(p)?G:w;for(w=0;w<p.length;w++)if(b.substr(s,p[w].length)==p[w]){s+=p[w].length;return w+1}throw"Unknown name at position "+s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(j)if(a.charAt(z)=="'"&&!o("'"))j=false;else r();else switch(a.charAt(z)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":k=m("m");break;case "M":k=n("M",i,g);break;  
case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))r();else j=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){k=1;l=u;do{e=this._getDaysInMonth(c,k-1);if(l<=e)break;k++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,  
k-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=k||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?  
c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=j+1<a.length&&a.charAt(j+1)==o)&&j++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},k=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var j=0;j<a.length;j++)if(u)if(a.charAt(j)=="'"&&!i("'"))u=false;else l+=a.charAt(j);else switch(a.charAt(j)){case "d":l+=g("d",b.getDate(),2);break;  
case "D":l+=k("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=k("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(j)}return l},_possibleChars:function(a){for(var b="",c=false,  
e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),  
e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},  
_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,k=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=u.exec(h);j;){switch(j[2]||"d"){case "d":case "D":g+=parseInt(j[1],10);break;case "w":case "W":g+=parseInt(j[1],  
10)*7;break;case "m":case "M":l+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break;case "y":case "Y":k+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break}j=u.exec(h)}return new Date(k,l,g)};if(b=(b=b==null?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):b)&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;  
a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||  
a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),k=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?  
new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),j=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=j&&n<j?j:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-k,1)),this._getFormatConfig(a));  
n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+k+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,  
g+k,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+k+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>";k=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&  
a.currentDay?u:b;k=!h?k:this.formatDate(k,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+  
y+".datepicker._gotoToday('#"+a.id+"');\">"+k+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;k=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),w=this._get(a,"showOtherMonths"),G=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var K=this._getDefaultDate(a),H="",C=0;C<i[0];C++){for(var L=  
"",D=0;D<i[1];D++){var M=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?  
f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,j,o,C>0||D>0,z,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=k?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,  
A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var N=0;N<A;N++){x+="<tr>";var O=!k?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F=p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,I=B&&!G||!F[0]||j&&q<j||o&&q>o;O+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==M.getTime()&&g==a.selectedMonth&&  
a._keyEvent||K.getTime()==q.getTime()&&K.getTime()==M.getTime()?" "+this._dayOverClass:"")+(I?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!w?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!B||w)&&F[2]?' title="'+F[2]+'"':"")+(I?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!w?"&#xa0;":I?'<span class="ui-state-default">'+q.getDate()+  
"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==u.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=O+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");L+=x}H+=L}H+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':  
"");a._keyEvent=false;return H},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var k=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),j='<div class="ui-datepicker-title">',o="";if(h||!k)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+  
a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(j+=o+(h||!(k&&l)?"&#xa0;":""));if(h||!l)j+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,  
i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(j+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)j+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";j+="</select>"}j+=this._get(a,"yearSuffix");if(u)j+=(h||!(k&&l)?"&#xa0;":"")+o;j+="</div>";return j},_adjustInstDate:function(a,b,c){var e=  
a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,  
"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);  
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,  
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=  
function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));  
return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new J;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.1";window["DP_jQuery_"+y]=d})(jQuery);  
;/*  
* jQuery UI Progressbar 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Progressbar  
*  
* Depends:  
* jquery.ui.core.js  
* jquery.ui.widget.js  
*/  
(function(b){b.widget("ui.progressbar",{options:{value:0},_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");  
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===undefined)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){switch(a){case "value":this.options.value=c;this._refreshValue();this._trigger("change");break}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;if(a<this._valueMin())a=this._valueMin();if(a>this._valueMax())a=this._valueMax();return a},  
_valueMin:function(){return 0},_valueMax:function(){return 100},_refreshValue:function(){var a=this.value();this.valueDiv[a===this._valueMax()?"addClass":"removeClass"]("ui-corner-right").width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.1"})})(jQuery);  
;/*  
* jQuery UI Effects 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/  
*/  
jQuery.effects||function(f){function k(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],  
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return l.transparent;return l[f.trim(c).toLowerCase()]}function q(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return k(b)}function m(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,  
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function n(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in r||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function s(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function j(c,a,b,d){if(typeof c=="object"){d=  
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(f.isFunction(b)){d=b;b=null}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=q(b.elem,a);b.end=k(b.end);b.colorInit=  
true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var l={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,  
183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,  
165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},o=["add","remove","toggle"],r={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=n(m.call(this)),p,t=e.attr("className");f.each(o,function(u,  
i){c[i]&&e[i+"Class"](c[i])});p=n(m.call(this));e.attr("className",t);e.animate(s(h,p),a,b,function(){f.each(o,function(u,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?  
f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===undefined?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.1",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==  
null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();  
var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});  
c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=j.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c||  
typeof c=="number"||f.fx.speeds[c])return this._show.apply(this,arguments);else{var a=j.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._hide.apply(this,arguments);else{var a=j.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||typeof c=="boolean"||f.isFunction(c))return this.__toggle.apply(this,  
arguments);else{var a=j.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,  
a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+  
b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,  
10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*  
a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,  
a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==undefined)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==undefined)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,  
a,b,d,e,g){if(g==undefined)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,  
d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);  
;/*  
* jQuery UI Effects Blind 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Blind  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","left"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,g);b.effects.removeWrapper(a);  
c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);  
;/*  
* jQuery UI Effects Bounce 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Bounce  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","left"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/  
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);  
b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);  
;/*  
* jQuery UI Effects Clip 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Clip  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","left","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,c/2)}var h={};h[g.size]=  
f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);  
;/*  
* jQuery UI Effects Drop 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Drop  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","left","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e=="show"?1:  
0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);  
;/*  
* jQuery UI Effects Explode 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Explode  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=  
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+  
e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);  
;/*  
* jQuery UI Effects Fold 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Fold  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","left"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],10)/100*  
f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);  
;/*  
* jQuery UI Effects Highlight 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Highlight  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&  
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);  
;/*  
* jQuery UI Effects Pulsate 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Pulsate  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,  
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);  
;/*  
* jQuery UI Effects Scale 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Scale  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,  
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=  
1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","left","width","height","overflow","opacity"],g=["position","top","left","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=c.effects.setMode(a,  
b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};if(m=="box"||m=="both"){if(d.from.y!=  
d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);a.css("overflow","hidden").css(a.from);  
if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);child.to=c.effects.setTransition(child,  
f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,n?e:g);c.effects.removeWrapper(a);b.callback&&  
b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);  
;/*  
* jQuery UI Effects Shake 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Shake  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","left"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=(h=="pos"?"-=":"+=")+  
e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);  
;/*  
* jQuery UI Effects Slide 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Slide  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?  
"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);  
;/*  
* jQuery UI Effects Transfer 1.8.1  
*  
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)  
* Dual licensed under the MIT (MIT-LICENSE.txt)  
* and GPL (GPL-LICENSE.txt) licenses.  
*  
* http://docs.jquery.com/UI/Effects/Transfer  
*  
* Depends:  
* jquery.effects.core.js  
*/  
(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);  
b.dequeue()})})}})(jQuery);  
;  
;(function($){$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}  
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}  
var tmp=$('<div class="ui-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}  
return $.ui.cssCache[name];},disableSelection:function(el){$(el).attr('unselectable','on').css('MozUserSelect','none');},enableSelection:function(el){$(el).attr('unselectable','off').css('MozUserSelect','');},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments);};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1);}  
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}  
return this.each(function(){var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args);}else if(!isMethodCall){$.data(this,name,new $[namespace][name](this,options));}});};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(key,value);}).bind('getData.'+name,function(e,key){return self.getData(key);}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);};$.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName);},getData:function(key){return this.options[key];},setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled');}},enable:function(){this.setData('disabled',false);},disable:function(){this.setData('disabled',true);}};$.widget.defaults={disabled:false};$.ui.mouse={mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(e){return self.mouseDown(e);});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}  
this.started=false;},mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this.mouseCapture(e)){return true;}  
this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true;},this.options.delay);}  
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true;}}  
this._mouseMoveDelegate=function(e){return self.mouseMove(e);};this._mouseUpDelegate=function(e){return self.mouseUp(e);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);return false;},mouseMove:function(e){if($.browser.msie&&!e.button){return this.mouseUp(e);}  
if(this._mouseStarted){this.mouseDrag(e);return false;}  
if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e));}  
return!this._mouseStarted;},mouseUp:function(e){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e);}  
return false;},mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance);},mouseDelayMet:function(e){return this._mouseDelayMet;},mouseStart:function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{init:function(){var o=this.options;if(o.helper=='original'&&!(/(relative|absolute|fixed)/).test(this.element.css('position')))  
this.element.css('position','relative');this.element.addClass('ui-draggable');(o.disabled&&this.element.addClass('ui-draggable-disabled'));this.mouseInit();},mouseStart:function(e){var o=this.options;if(this.helper||o.disabled||$(e.target).is('.ui-resizable-handle'))return false;var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==e.target)handle=true;});if(!handle)return false;if($.ui.ddmanager)$.ui.ddmanager.current=this;this.helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[e])):(o.helper=='clone'?this.element.clone():this.element);if(!this.helper.parents('body').length)this.helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position")))this.helper.css("position","absolute");this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&$.browser.mozilla)po={top:0,left:0};this.offset.parent={top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var p=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left+this.margins.left;if(o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right+this.margins.left;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top+this.margins.top;if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom+this.margins.top;}  
if(o.containment){if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,co.left+Math.max(ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];}}  
this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.helper.addClass("ui-draggable-dragging");this.mouseDrag(e);return true;},convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;return{top:(pos.top  
+this.offset.relative.top*mod  
+this.offset.parent.top*mod  
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*mod  
+(this.cssPosition=="fixed"?$(document).scrollTop():0)*mod  
+this.margins.top*mod),left:(pos.left  
+this.offset.relative.left*mod  
+this.offset.parent.left*mod  
-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*mod  
+(this.cssPosition=="fixed"?$(document).scrollLeft():0)*mod  
+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY  
-this.offset.click.top  
-this.offset.relative.top  
-this.offset.parent.top  
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)  
-(this.cssPosition=="fixed"?$(document).scrollTop():0)),left:(e.pageX  
-this.offset.click.left  
-this.offset.relative.left  
-this.offset.parent.left  
+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)  
-(this.cssPosition=="fixed"?$(document).scrollLeft():0))};if(!this.originalPosition)return position;if(this.containment){if(position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}  
if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}  
return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",e)||this.position;if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);return false;},mouseStop:function(e){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)  
var dropped=$.ui.ddmanager.drop(this,e);if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){self.propagate("stop",e);self.clear();});}else{this.propagate("stop",e);this.clear();}  
return false;},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!='original'&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},plugins:{},uiHash:function(e){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.uiHash()]);if(n=="drag")this.positionAbs=this.convertPositionTo("absolute");return this.element.triggerHandler(n=="drag"?n:"drag"+n,[e,this.uiHash()],this.options[n]);},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');this.mouseDestroy();}}));$.extend($.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input",delay:0,distance:1,helper:"original"}});$.ui.plugin.add("draggable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("draggable","zIndex",{start:function(e,ui){var t=$(ui.helper);if(t.css("zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add("draggable","opacity",{start:function(e,ui){var t=$(ui.helper);if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("draggable","iframeFix",{start:function(e,ui){$(ui.options.iframeFix===true?"iframe":ui.options.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(e,ui){$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","scroll",{start:function(e,ui){var o=ui.options;var i=$(this).data("draggable");o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;i.overflowY=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(this);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},drag:function(e,ui){var o=ui.options;var i=$(this).data("draggable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)  
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)  
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<o.scrollSensitivity)  
$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)  
$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}  
if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)  
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)  
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft()<o.scrollSensitivity)  
$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)  
$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("draggable","snap",{start:function(e,ui){var inst=$(this).data("draggable");inst.snapElements=[];$(ui.options.snap===true?'.ui-draggable':ui.options.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=inst.element[0])inst.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(e,ui){var inst=$(this).data("draggable");var d=ui.options.snapTolerance||20;var x1=ui.absolutePosition.left,x2=x1+inst.helperProportions.width,y1=ui.absolutePosition.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d)))continue;if(ui.options.snapMode!='inner'){var ts=Math.abs(t-y2)<=20;var bs=Math.abs(b-y1)<=20;var ls=Math.abs(l-x2)<=20;var rs=Math.abs(r-x1)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r}).left;}  
if(ui.options.snapMode!='outer'){var ts=Math.abs(t-y1)<=20;var bs=Math.abs(b-y2)<=20;var ls=Math.abs(l-x1)<=20;var rs=Math.abs(r-x2)<=20;if(ts)ui.position.top=inst.convertPositionTo("relative",{top:t,left:0}).top;if(bs)ui.position.top=inst.convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top;if(ls)ui.position.left=inst.convertPositionTo("relative",{top:0,left:l}).left;if(rs)ui.position.left=inst.convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left;}};}});$.ui.plugin.add("draggable","connectToSortable",{start:function(e,ui){var inst=$(this).data("draggable");inst.sortables=[];$(ui.options.connectToSortable).each(function(){if($.data(this,'sortable')){var sortable=$.data(this,'sortable');inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshItems();sortable.propagate("activate",e,inst);}});},stop:function(e,ui){var inst=$(this).data("draggable");$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance.mouseStop(e);this.instance.element.triggerHandler("sortreceive",[e,$.extend(this.instance.ui(),{sender:inst.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper;}else{this.instance.propagate("deactivate",e,inst);}});},drag:function(e,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var l=o.left,r=l+o.width,t=o.top,b=t+o.height;return(l<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<r&&t<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<b);};$.each(inst.sortables,function(i){if(checkPos.call(inst,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};e.target=this.instance.currentItem[0];this.instance.mouseCapture(e,true);this.instance.mouseStart(e,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst.propagate("toSortable",e);}  
if(this.instance.currentItem)this.instance.mouseDrag(e);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(e,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst.propagate("fromSortable",e);}};});}});$.ui.plugin.add("draggable","stack",{start:function(e,ui){var group=$.makeArray($(ui.options.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||ui.options.stack.min)-(parseInt($(b).css("zIndex"),10)||ui.options.stack.min);});$(group).each(function(i){this.style.zIndex=ui.options.stack.min+i;});this[0].style.zIndex=ui.options.stack.min+group.length;}});})(jQuery);(function($){$.widget("ui.droppable",{init:function(){this.element.addClass("ui-droppable");this.isover=0;this.isout=1;var o=this.options,accept=o.accept;o=$.extend(o,{accept:o.accept&&o.accept.constructor==Function?o.accept:function(d){return $(d).is(accept);}});this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables.push(this);},plugins:{},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,absolutePosition:c.positionAbs,options:this.options,element:this.element};},destroy:function(){var drop=$.ui.ddmanager.droppables;for(var i=0;i<drop.length;i++)  
if(drop[i]==this)  
drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},over:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'over',[e,this.ui(draggable)]);this.element.triggerHandler("dropover",[e,this.ui(draggable)],this.options.over);}},out:function(e){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'out',[e,this.ui(draggable)]);this.element.triggerHandler("dropout",[e,this.ui(draggable)],this.options.out);}},drop:function(e,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection)return false;if(this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){$.ui.plugin.call(this,'drop',[e,this.ui(draggable)]);this.element.triggerHandler("drop",[e,this.ui(draggable)],this.options.drop);return true;}  
return false;},activate:function(e){var draggable=$.ui.ddmanager.current;$.ui.plugin.call(this,'activate',[e,this.ui(draggable)]);if(draggable)this.element.triggerHandler("dropactivate",[e,this.ui(draggable)],this.options.activate);},deactivate:function(e){var draggable=$.ui.ddmanager.current;$.ui.plugin.call(this,'deactivate',[e,this.ui(draggable)]);if(draggable)this.element.triggerHandler("dropdeactivate",[e,this.ui(draggable)],this.options.deactivate);}});$.extend($.ui.droppable,{defaults:{disabled:false,tolerance:'intersect'}});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset)return false;var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;switch(toleranceMode){case'fit':return(l<x1&&x2<r&&t<y1&&y2<b);break;case'intersect':return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);break;case'pointer':return(l<((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left)&&((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left)<r&&t<((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top)&&((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top)<b);break;case'touch':return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(t,e){var m=$.ui.ddmanager.droppables;var type=e?e.type:null;for(var i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].options.accept.call(m[i].element,(t.currentItem||t.element))))continue;m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};if(type=="dragstart"||type=="sortactivate")m[i].activate.call(m[i],e);}},drop:function(draggable,e){var dropped=false;$.each($.ui.ddmanager.droppables,function(){if(!this.options)return;if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance))  
dropped=this.drop.call(this,e);if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element,(draggable.currentItem||draggable.element))){this.isout=1;this.isover=0;this.deactivate.call(this,e);}});return dropped;},drag:function(draggable,e){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,e);$.each($.ui.ddmanager.droppables,function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var intersects=$.ui.intersect(draggable,this,this.options.tolerance);var c=!intersects&&this.isover==1?'isout':(intersects&&this.isover==0?'isover':null);if(!c)return;var parentInstance;if(this.options.greedy){var parent=this.element.parents('.ui-droppable:eq(0)');if(parent.length){parentInstance=$.data(parent[0],'droppable');parentInstance.greedyChild=(c=='isover'?1:0);}}  
if(parentInstance&&c=='isover'){parentInstance['isover']=0;parentInstance['isout']=1;parentInstance.out.call(parentInstance,e);}  
this[c]=1;this[c=='isout'?'isover':'isout']=0;this[c=="isover"?"over":"out"].call(this,e);if(parentInstance&&c=='isout'){parentInstance['isout']=0;parentInstance['isover']=1;parentInstance.over.call(parentInstance,e);}});}};$.ui.plugin.add("droppable","activeClass",{activate:function(e,ui){$(this).addClass(ui.options.activeClass);},deactivate:function(e,ui){$(this).removeClass(ui.options.activeClass);},drop:function(e,ui){$(this).removeClass(ui.options.activeClass);}});$.ui.plugin.add("droppable","hoverClass",{over:function(e,ui){$(this).addClass(ui.options.hoverClass);},out:function(e,ui){$(this).removeClass(ui.options.hoverClass);},drop:function(e,ui){$(this).removeClass(ui.options.hoverClass);}});})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{init:function(){var self=this,o=this.options;var elpos=this.element.css('position');this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(elpos)?'relative':elpos});$.extend(o,{_aspectRatio:!!(o.aspectRatio),helper:o.helper||o.ghost||o.animate?o.helper||'proxy':null,knobHandles:o.knobHandles===true?'ui-resizable-knob-handle':o.knobHandles});var aBorder='1px solid #DEDEDE';o.defaultTheme={'ui-resizable':{display:'block'},'ui-resizable-handle':{position:'absolute',background:'#F2F2F2',fontSize:'0.1px'},'ui-resizable-n':{cursor:'n-resize',height:'4px',left:'0px',right:'0px',borderTop:aBorder},'ui-resizable-s':{cursor:'s-resize',height:'4px',left:'0px',right:'0px',borderBottom:aBorder},'ui-resizable-e':{cursor:'e-resize',width:'4px',top:'0px',bottom:'0px',borderRight:aBorder},'ui-resizable-w':{cursor:'w-resize',width:'4px',top:'0px',bottom:'0px',borderLeft:aBorder},'ui-resizable-se':{cursor:'se-resize',width:'4px',height:'4px',borderRight:aBorder,borderBottom:aBorder},'ui-resizable-sw':{cursor:'sw-resize',width:'4px',height:'4px',borderBottom:aBorder,borderLeft:aBorder},'ui-resizable-ne':{cursor:'ne-resize',width:'4px',height:'4px',borderRight:aBorder,borderTop:aBorder},'ui-resizable-nw':{cursor:'nw-resize',width:'4px',height:'4px',borderLeft:aBorder,borderTop:aBorder}};o.knobTheme={'ui-resizable-handle':{background:'#F2F2F2',border:'1px solid #808080',height:'8px',width:'8px'},'ui-resizable-n':{cursor:'n-resize',top:'0px',left:'45%'},'ui-resizable-s':{cursor:'s-resize',bottom:'0px',left:'45%'},'ui-resizable-e':{cursor:'e-resize',right:'0px',top:'45%'},'ui-resizable-w':{cursor:'w-resize',left:'0px',top:'45%'},'ui-resizable-se':{cursor:'se-resize',right:'0px',bottom:'0px'},'ui-resizable-sw':{cursor:'sw-resize',left:'0px',bottom:'0px'},'ui-resizable-nw':{cursor:'nw-resize',left:'0px',top:'0px'},'ui-resizable-ne':{cursor:'ne-resize',right:'0px',top:'0px'}};o._nodeName=this.element[0].nodeName;if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)){var el=this.element;if(/relative/.test(el.css('position'))&&$.browser.opera)  
el.css({position:'relative',top:'auto',left:'auto'});el.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:el.css('position'),width:el.outerWidth(),height:el.outerHeight(),top:el.css('top'),left:el.css('left')}));var oel=this.element;this.element=this.element.parent();this.element.data('resizable',this);this.element.css({marginLeft:oel.css("marginLeft"),marginTop:oel.css("marginTop"),marginRight:oel.css("marginRight"),marginBottom:oel.css("marginBottom")});oel.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if($.browser.safari&&o.preventDefault)oel.css('resize','none');o.proportionallyResize=oel.css({position:'static',zoom:1,display:'block'});this.element.css({margin:oel.css('margin')});this._proportionallyResize();}  
if(!o.handles)o.handles=!$('.ui-resizable-handle',this.element).length?"e,s,se":{n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'};if(o.handles.constructor==String){o.zIndex=o.zIndex||1000;if(o.handles=='all')o.handles='n,e,s,w,se,sw,ne,nw';var n=o.handles.split(",");o.handles={};var insertionsDefault={handle:'position: absolute; display: none; overflow:hidden;',n:'top: 0pt; width:100%;',e:'right: 0pt; height:100%;',s:'bottom: 0pt; width:100%;',w:'left: 0pt; height:100%;',se:'bottom: 0pt; right: 0px;',sw:'bottom: 0pt; left: 0px;',ne:'top: 0pt; right: 0px;',nw:'top: 0pt; left: 0px;'};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),dt=o.defaultTheme,hname='ui-resizable-'+handle,loadDefault=!$.ui.css(hname)&&!o.knobHandles,userKnobClass=$.ui.css('ui-resizable-knob-handle'),allDefTheme=$.extend(dt[hname],dt['ui-resizable-handle']),allKnobTheme=$.extend(o.knobTheme[hname],!userKnobClass?o.knobTheme['ui-resizable-handle']:{});var applyZIndex=/sw|se|ne|nw/.test(handle)?{zIndex:++o.zIndex}:{};var defCss=(loadDefault?insertionsDefault[handle]:''),axis=$(['<div class="ui-resizable-handle ',hname,'" style="',defCss,insertionsDefault.handle,'"></div>'].join('')).css(applyZIndex);o.handles[handle]='.ui-resizable-'+handle;this.element.append(axis.css(loadDefault?allDefTheme:{}).css(o.knobHandles?allKnobTheme:{}).addClass(o.knobHandles?'ui-resizable-knob-handle':'').addClass(o.knobHandles));}  
if(o.knobHandles)this.element.addClass('ui-resizable-knob').css(!$.ui.css('ui-resizable-knob')?{}:{});}  
this._renderAxis=function(target){target=target||this.element;for(var i in o.handles){if(o.handles[i].constructor==String)  
o.handles[i]=$(o.handles[i],this.element).show();if(o.transparent)  
o.handles[i].css({opacity:0});if(this.element.is('.ui-wrapper')&&o._nodeName.match(/textarea|input|select|button/i)){var axis=$(o.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=['padding',/ne|nw|n/.test(i)?'Top':/se|sw|s/.test(i)?'Bottom':/^e$/.test(i)?'Right':'Left'].join("");if(!o.transparent)  
target.css(padPos,padWrapper);this._proportionallyResize();}  
if(!$(o.handles[i]).length)continue;}};this._renderAxis(this.element);o._handles=$('.ui-resizable-handle',self.element);if(o.disableSelection)  
o._handles.each(function(i,e){$.ui.disableSelection(e);});o._handles.mouseover(function(){if(!o.resizing){if(this.className)  
var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=o.axis=axis&&axis[1]?axis[1]:'se';}});if(o.autoHide){o._handles.hide();$(self.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");o._handles.show();},function(){if(!o.resizing){$(this).addClass("ui-resizable-autohide");o._handles.hide();}});}  
this.mouseInit();},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);if(n!="resize")this.element.triggerHandler(["resize",n].join(""),[e,this.ui()],this.options[n]);},destroy:function(){var el=this.element,wrapped=el.children(".ui-resizable").get(0);this.mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();};_destroy(el);if(el.is('.ui-wrapper')&&wrapped){el.parent().append($(wrapped).css({position:el.css('position'),width:el.outerWidth(),height:el.outerHeight(),top:el.css('top'),left:el.css('left')})).end().remove();_destroy(wrapped);}},mouseStart:function(e){if(this.options.disabled)return false;var handle=false;for(var i in this.options.handles){if($(this.options.handles[i])[0]==e.target)handle=true;}  
if(!handle)return false;var o=this.options,iniPos=this.element.position(),el=this.element,num=function(v){return parseInt(v,10)||0;},ie6=$.browser.msie&&$.browser.version<7;o.resizing=true;o.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is('.ui-draggable')||(/absolute/).test(el.css('position'))){var sOffset=$.browser.msie&&!o.containment&&(/absolute/).test(el.css('position'))&&!(/relative/).test(el.parent().css('position'));var dscrollt=sOffset?o.documentScroll.top:0,dscrolll=sOffset?o.documentScroll.left:0;el.css({position:'absolute',top:(iniPos.top+dscrollt),left:(iniPos.left+dscrolll)});}  
if($.browser.opera&&/relative/.test(el.css('position')))  
el.css({position:'relative',top:'auto',left:'auto'});this._renderProxy();var curleft=num(this.helper.css('left')),curtop=num(this.helper.css('top'));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;}  
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=o.helper||ie6?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=o.helper||ie6?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:e.pageX,top:e.pageY};o.aspectRatio=(typeof o.aspectRatio=='number')?o.aspectRatio:((this.originalSize.height/this.originalSize.width)||1);if(o.preserveCursor)  
$('body').css('cursor',this.axis+'-resize');this.propagate("start",e);return true;},mouseDrag:function(e){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(e.pageX-smp.left)||0,dy=(e.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[e,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(o._aspectRatio||e.shiftKey)  
data=this._updateRatio(data,e);data=this._respectSize(data,e);this.propagate("resize",e);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!o.helper&&o.proportionallyResize)  
this._proportionallyResize();this._updateCache(data);this.element.triggerHandler("resize",[e,this.ui()],this.options["resize"]);return false;},mouseStop:function(e){this.options.resizing=false;var o=this.options,num=function(v){return parseInt(v,10)||0;},self=this;if(o.helper){var pr=o.proportionallyResize,ista=pr&&(/textarea/i).test(pr.get(0).nodeName),soffseth=ista&&$.ui.hasScroll(pr.get(0),'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;if(!o.animate)  
this.element.css($.extend(s,{top:top,left:left}));if(o.helper&&!o.animate)this._proportionallyResize();}  
if(o.preserveCursor)  
$('body').css('cursor','auto');this.propagate("stop",e);if(o.helper)this.helper.remove();return false;},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(data.left)this.position.left=data.left;if(data.top)this.position.top=data.top;if(data.height)this.size.height=data.height;if(data.width)this.size.width=data.width;},_updateRatio:function(data,e){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=(csize.height/o.aspectRatio);else if(data.width)data.height=(csize.width*o.aspectRatio);if(a=='sw'){data.left=cpos.left+(csize.width-data.width);data.top=null;}  
if(a=='nw'){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);}  
return data;},_respectSize:function(data,e){var el=this.helper,o=this.options,pRatio=o._aspectRatio||e.shiftKey,a=this.axis,ismaxw=data.width&&o.maxWidth&&o.maxWidth<data.width,ismaxh=data.height&&o.maxHeight&&o.maxHeight<data.height,isminw=data.width&&o.minWidth&&o.minWidth>data.width,isminh=data.height&&o.minHeight&&o.minHeight>data.height;if(isminw)data.width=o.minWidth;if(isminh)data.height=o.minHeight;if(ismaxw)data.width=o.maxWidth;if(ismaxh)data.height=o.maxHeight;var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw)data.left=dw-o.minWidth;if(ismaxw&&cw)data.left=dw-o.maxWidth;if(isminh&&ch)data.top=dh-o.minHeight;if(ismaxh&&ch)data.top=dh-o.maxHeight;var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top)data.top=null;else if(isNotwh&&!data.top&&data.left)data.left=null;return data;},_proportionallyResize:function(){var o=this.options;if(!o.proportionallyResize)return;var prel=o.proportionallyResize,el=this.helper||this.element;if(!o.borderDif){var b=[prel.css('borderTopWidth'),prel.css('borderRightWidth'),prel.css('borderBottomWidth'),prel.css('borderLeftWidth')],p=[prel.css('paddingTop'),prel.css('paddingRight'),prel.css('paddingBottom'),prel.css('paddingLeft')];o.borderDif=$.map(b,function(v,i){var border=parseInt(v,10)||0,padding=parseInt(p[i],10)||0;return border+padding;});}  
prel.css({height:(el.height()-o.borderDif[0]-o.borderDif[2])+"px",width:(el.width()-o.borderDif[1]-o.borderDif[3])+"px"});},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(o.helper){this.helper=this.helper||$('<div style="overflow:hidden;"></div>');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(o.helper).css({width:el.outerWidth()+pxyoffset,height:el.outerHeight()+pxyoffset,position:'absolute',left:this.elementOffset.left-ie6offset+'px',top:this.elementOffset.top-ie6offset+'px',zIndex:++o.zIndex});this.helper.appendTo("body");if(o.disableSelection)  
$.ui.disableSelection(this.helper.get(0));}else{this.helper=el;}},_change:{e:function(e,dx,dy){return{width:this.originalSize.width+dx};},w:function(e,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(e,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(e,dx,dy){return{height:this.originalSize.height+dy};},se:function(e,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,dx,dy]));},sw:function(e,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,dx,dy]));},ne:function(e,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,dx,dy]));},nw:function(e,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,dx,dy]));}}}));$.extend($.ui.resizable,{defaults:{cancel:":input",distance:1,delay:0,preventDefault:true,transparent:false,minWidth:10,minHeight:10,aspectRatio:false,disableSelection:true,preserveCursor:true,autoHide:false,knobHandles:false}});$.ui.plugin.add("resizable","containment",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),el=self.element;var oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce)return;self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};}  
else{self.containerOffset=$(ce).offset();self.containerPosition=$(ce).position();self.containerSize={height:$(ce).innerHeight(),width:$(ce).innerWidth()};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw),height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=o._aspectRatio||e.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&/static/.test(ce.css('position')))  
cop=self.containerPosition;if(cp.left<(o.helper?co.left:cop.left)){self.size.width=self.size.width+(o.helper?(self.position.left-co.left):(self.position.left-cop.left));if(pRatio)self.size.height=self.size.width*o.aspectRatio;self.position.left=o.helper?co.left:cop.left;}  
if(cp.top<(o.helper?co.top:0)){self.size.height=self.size.height+(o.helper?(self.position.top-co.top):self.position.top);if(pRatio)self.size.width=self.size.height/o.aspectRatio;self.position.top=o.helper?co.top:0;}  
var woset=(o.helper?self.offset.left-co.left:(self.position.left-cop.left))+self.sizeDiff.width,hoset=(o.helper?self.offset.top-co.top:self.position.top)+self.sizeDiff.height;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width*o.aspectRatio;}  
if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height/o.aspectRatio;}},stop:function(e,ui){var o=ui.options,self=$(this).data("resizable"),cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.innerWidth(),h=helper.innerHeight();if(o.helper&&!o.animate&&/relative/.test(ce.css('position')))  
$(this).css({left:(ho.left-co.left),top:(ho.top-co.top),width:w,height:h});if(o.helper&&!o.animate&&/static/.test(ce.css('position')))  
$(this).css({left:cop.left+(ho.left-co.left),top:cop.top+(ho.top-co.top),width:w,height:h});}});$.ui.plugin.add("resizable","grid",{resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||e.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;}  
else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;}  
else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox;}  
else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});$.ui.plugin.add("resizable","animate",{stop:function(e,ui){var o=ui.options,self=$(this).data("resizable");var pr=o.proportionallyResize,ista=pr&&(/textarea/i).test(pr.get(0).nodeName),soffseth=ista&&$.ui.hasScroll(pr.get(0),'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration||"slow",easing:o.animateEasing||"swing",step:function(){var data={width:parseInt(self.element.css('width'),10),height:parseInt(self.element.css('height'),10),top:parseInt(self.element.css('top'),10),left:parseInt(self.element.css('left'),10)};if(pr)pr.css({width:data.width,height:data.height});self._updateCache(data);self.propagate("animate",e);}});}});$.ui.plugin.add("resizable","ghost",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize,cs=self.size;if(!pr)self.ghost=self.element.clone();else self.ghost=pr.clone();self.ghost.css({opacity:.25,display:'block',position:'relative',height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass('ui-resizable-ghost').addClass(typeof o.ghost=='string'?o.ghost:'');self.ghost.appendTo(self.helper);},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(e,ui){var o=ui.options,self=$(this).data("resizable"),pr=o.proportionallyResize;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","alsoResize",{start:function(e,ui){var o=ui.options,self=$(this).data("resizable"),_store=function(exp){$(exp).each(function(){$(this).data("resizable-alsoresize",{width:parseInt($(this).width(),10),height:parseInt($(this).height(),10),left:parseInt($(this).css('left'),10),top:parseInt($(this).css('top'),10)});});};if(typeof(o.alsoResize)=='object'){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize);}  
else{$.each(o.alsoResize,function(exp,c){_store(exp);});}}else{_store(o.alsoResize);}},resize:function(e,ui){var o=ui.options,self=$(this).data("resizable"),os=self.originalSize,op=self.originalPosition;var delta={height:(self.size.height-os.height)||0,width:(self.size.width-os.width)||0,top:(self.position.top-op.top)||0,left:(self.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:['width','height','top','left'];$.each(css||['width','height','top','left'],function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0)  
style[prop]=sum||null;});$(this).css(style);});};if(typeof(o.alsoResize)=='object'){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(e,ui){$(this).removeData("resizable-alsoresize-start");}});})(jQuery);(function($){$.widget("ui.selectable",$.extend({},$.ui.mouse,{init:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;var selectees;this.refresh=function(){selectees=$(self.options.filter,self.element[0]);selectees.each(function(){var $this=$(this);var pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.width(),bottom:pos.top+$this.height(),startselected:false,selected:$this.hasClass('ui-selected'),selecting:$this.hasClass('ui-selecting'),unselecting:$this.hasClass('ui-unselecting')});});};this.refresh();this.selectees=selectees.addClass("ui-selectee");this.mouseInit();this.helper=$(document.createElement('div')).css({border:'1px dotted black'});},toggle:function(){if(this.options.disabled){this.enable();}else{this.disable();}},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this.mouseDestroy();},mouseStart:function(e){var self=this;this.opos=[e.pageX,e.pageY];if(this.options.disabled)  
return;var options=this.options;this.selectees=$(options.filter,this.element[0]);this.element.triggerHandler("selectablestart",[e,{"selectable":this.element[0],"options":options}],options.start);$('body').append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":e.clientX,"top":e.clientY,"width":0,"height":0});if(options.autoRefresh){this.refresh();}  
this.selectees.filter('.ui-selected').each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!e.ctrlKey){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self.element.triggerHandler("selectableunselecting",[e,{selectable:self.element[0],unselecting:selectee.element,options:options}],options.unselecting);}});var isSelectee=false;$(e.target).parents().andSelf().each(function(){if($.data(this,"selectable-item"))isSelectee=true;});return this.options.keyboard?!isSelectee:true;},mouseDrag:function(e){var self=this;this.dragged=true;if(this.options.disabled)  
return;var options=this.options;var x1=this.opos[0],y1=this.opos[1],x2=e.pageX,y2=e.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp;}  
if(y1>y2){var tmp=y2;y2=y1;y1=tmp;}  
this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item");if(!selectee||selectee.element==self.element[0])  
return;var hit=false;if(options.tolerance=='touch'){hit=(!(selectee.left>x2||selectee.right<x1||selectee.top>y2||selectee.bottom<y1));}else if(options.tolerance=='fit'){hit=(selectee.left>x1&&selectee.right<x2&&selectee.top>y1&&selectee.bottom<y2);}  
if(hit){if(selectee.selected){selectee.$element.removeClass('ui-selected');selectee.selected=false;}  
if(selectee.unselecting){selectee.$element.removeClass('ui-unselecting');selectee.unselecting=false;}  
if(!selectee.selecting){selectee.$element.addClass('ui-selecting');selectee.selecting=true;self.element.triggerHandler("selectableselecting",[e,{selectable:self.element[0],selecting:selectee.element,options:options}],options.selecting);}}else{if(selectee.selecting){if(e.ctrlKey&&selectee.startselected){selectee.$element.removeClass('ui-selecting');selectee.selecting=false;selectee.$element.addClass('ui-selected');selectee.selected=true;}else{selectee.$element.removeClass('ui-selecting');selectee.selecting=false;if(selectee.startselected){selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;}  
self.element.triggerHandler("selectableunselecting",[e,{selectable:self.element[0],unselecting:selectee.element,options:options}],options.unselecting);}}  
if(selectee.selected){if(!e.ctrlKey&&!selectee.startselected){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self.element.triggerHandler("selectableunselecting",[e,{selectable:self.element[0],unselecting:selectee.element,options:options}],options.unselecting);}}}});return false;},mouseStop:function(e){var self=this;this.dragged=false;var options=this.options;$('.ui-unselecting',this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass('ui-unselecting');selectee.unselecting=false;selectee.startselected=false;self.element.triggerHandler("selectableunselected",[e,{selectable:self.element[0],unselected:selectee.element,options:options}],options.unselected);});$('.ui-selecting',this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass('ui-selecting').addClass('ui-selected');selectee.selecting=false;selectee.selected=true;selectee.startselected=true;self.element.triggerHandler("selectableselected",[e,{selectable:self.element[0],selected:selectee.element,options:options}],options.selected);});this.element.triggerHandler("selectablestop",[e,{selectable:self.element[0],options:this.options}],this.options.stop);this.helper.remove();return false;}}));$.extend($.ui.selectable,{defaults:{distance:1,delay:0,cancel:":input",appendTo:'body',autoRefresh:true,filter:'*',tolerance:'touch'}});})(jQuery);(function($){function contains(a,b){var safari2=$.browser.safari&&$.browser.version<522;if(a.contains&&!safari2){return a.contains(b);}  
if(a.compareDocumentPosition)  
return!!(a.compareDocumentPosition(b)&16);while(b=b.parentNode)  
if(b==a)return true;return false;};$.widget("ui.sortable",$.extend({},$.ui.mouse,{init:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;if(!(/(relative|absolute|fixed)/).test(this.element.css('position')))this.element.css('position','relative');this.offset=this.element.offset();this.mouseInit();},plugins:{},ui:function(inst){return{helper:(inst||this)["helper"],placeholder:(inst||this)["placeholder"]||$([]),position:(inst||this)["position"],absolutePosition:(inst||this)["positionAbs"],options:this.options,element:this.element,item:(inst||this)["currentItem"],sender:inst?inst.element:null};},propagate:function(n,e,inst,noPropagation){$.ui.plugin.call(this,n,[e,this.ui(inst)]);if(!noPropagation)this.element.triggerHandler(n=="sort"?n:"sort"+n,[e,this.ui(inst)],this.options[n]);},serialize:function(o){var items=($.isFunction(this.options.items)?this.options.items.call(this.element):$(this.options.items,this.element)).not('.ui-sortable-helper');var str=[];o=o||{};items.each(function(){var res=($(this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1])+'[]='+(o.key&&o.expression?res[1]:res[2]));});return str.join('&');},toArray:function(attr){var items=($.isFunction(this.options.items)?this.options.items.call(this.element):$(this.options.items,this.element)).not('.ui-sortable-helper');var ret=[];items.each(function(){ret.push($(this).attr(attr||'id'));});return ret;},intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance=="guess"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return(y1+this.offset.click.top>t&&y1+this.offset.click.top<b&&x1+this.offset.click.left>l&&x1+this.offset.click.left<r);}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},intersectsWithEdge:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;if(this.options.tolerance=="pointer"||(this.options.tolerance=="guess"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){if(!(y1+this.offset.click.top>t&&y1+this.offset.click.top<b&&x1+this.offset.click.left>l&&x1+this.offset.click.left<r))return false;if(this.floating){if(x1+this.offset.click.left>l&&x1+this.offset.click.left<l+item.width/2)return 2;if(x1+this.offset.click.left>l+item.width/2&&x1+this.offset.click.left<r)return 1;}else{if(y1+this.offset.click.top>t&&y1+this.offset.click.top<t+item.height/2)return 2;if(y1+this.offset.click.top>t+item.height/2&&y1+this.offset.click.top<b)return 1;}}else{if(!(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b))return false;if(this.floating){if(x2>l&&x1<l)return 2;if(x1<r&&x2>r)return 1;}else{if(y2>t&&y1<t)return 1;if(y1<b&&y2>b)return 2;}}  
return false;},refresh:function(){this.refreshItems();this.refreshPositions();},refreshItems:function(){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element),this]];if(this.options.connectWith){for(var i=this.options.connectWith.length-1;i>=0;i--){var cur=$(this.options.connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}  
for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){$.data(this,'sortable-item',queries[i][1]);items.push({item:$(this),instance:queries[i][1],width:0,height:0,left:0,top:0});});};},refreshPositions:function(fast){if(this.offsetParent){var po=this.offsetParent.offset();this.offset.parent={top:po.top+this.offsetParentBorders.top,left:po.left+this.offsetParentBorders.left};}  
for(var i=this.items.length-1;i>=0;i--){if(this.items[i].instance!=this.currentContainer&&this.currentContainer&&this.items[i].item[0]!=this.currentItem[0])  
continue;var t=this.options.toleranceElement?$(this.options.toleranceElement,this.items[i].item):this.items[i].item;if(!fast){this.items[i].width=t[0].offsetWidth;this.items[i].height=t[0].offsetHeight;}  
var p=t.offset();this.items[i].left=p.left;this.items[i].top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this.mouseDestroy();for(var i=this.items.length-1;i>=0;i--)  
this.items[i].item.removeData("sortable-item");},createPlaceholder:function(that){var self=that||this,o=self.options;if(o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){return $('<div></div>').addClass(className)[0];},update:function(i,p){p.css(i.offset()).css({width:i.outerWidth(),height:i.outerHeight()});}};}  
self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem)).appendTo('body').css({position:'absolute'});o.placeholder.update.call(self.element,self.currentItem,self.placeholder);},contactContainers:function(e){for(var i=this.containers.length-1;i>=0;i--){if(this.intersectsWith(this.containers[i].containerCache)){if(!this.containers[i].containerCache.over){if(this.currentContainer!=this.containers[i]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[i].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!contains(this.containers[i].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[i].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}  
if(!itemWithLeastDistance&&!this.options.dropOnEmpty)  
continue;if(this.placeholder)this.placeholder.remove();if(this.containers[i].options.placeholder){this.containers[i].createPlaceholder(this);}else{this.placeholder=null;;}  
this.currentContainer=this.containers[i];itemWithLeastDistance?this.rearrange(e,itemWithLeastDistance,null,true):this.rearrange(e,null,this.containers[i].element,true);this.propagate("change",e);this.containers[i].propagate("change",e,this);}  
this.containers[i].propagate("over",e,this);this.containers[i].containerCache.over=1;}}else{if(this.containers[i].containerCache.over){this.containers[i].propagate("out",e,this);this.containers[i].containerCache.over=0;}}};},mouseCapture:function(e,overrideHandle){if(this.options.disabled||this.options.type=='static')return false;this.refreshItems();var currentItem=null,self=this,nodes=$(e.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(e.target,'sortable-item')==self)currentItem=$(e.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==e.target)validHandle=true;});if(!validHandle)return false;}  
this.currentItem=currentItem;return true;},mouseStart:function(e,overrideHandle,noActivation){var o=this.options;this.currentContainer=this;this.refreshPositions();this.helper=typeof o.helper=='function'?$(o.helper.apply(this.element[0],[e,this.currentItem])):this.currentItem.clone();if(!this.helper.parents('body').length)$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(this.helper[0]);this.helper.css({position:'absolute',clear:'both'}).addClass('ui-sortable-helper');this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();this.offsetParentBorders={top:(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};this.offset.parent={top:po.top+this.offsetParentBorders.top,left:po.left+this.offsetParentBorders.left};this.originalPosition=this.generatePosition(e);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.placeholder)this.createPlaceholder();this.propagate("start",e);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(o.cursorAt){if(o.cursorAt.left!=undefined)this.offset.click.left=o.cursorAt.left;if(o.cursorAt.right!=undefined)this.offset.click.left=this.helperProportions.width-o.cursorAt.right;if(o.cursorAt.top!=undefined)this.offset.click.top=o.cursorAt.top;if(o.cursorAt.bottom!=undefined)this.offset.click.top=this.helperProportions.height-o.cursorAt.bottom;}  
if(o.containment){if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.parent.left,0-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.parent.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.parent.top,co.left+Math.max(ce.scrollWidth,ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),co.top+Math.max(ce.scrollHeight,ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)];}}  
if(this.options.placeholder!='clone')  
this.currentItem.css('visibility','hidden');if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i].propagate("activate",e,this);}}  
if($.ui.ddmanager)$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)$.ui.ddmanager.prepareOffsets(this,e);this.dragging=true;this.mouseDrag(e);return true;},convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;return{top:(pos.top  
+this.offset.parent.top*mod  
-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)*mod  
+this.margins.top*mod),left:(pos.left  
+this.offset.parent.left*mod  
-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft)*mod  
+this.margins.left*mod)};},generatePosition:function(e){var o=this.options;var position={top:(e.pageY  
-this.offset.click.top  
-this.offset.parent.top  
+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)),left:(e.pageX  
-this.offset.click.left  
-this.offset.parent.left  
+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft))};if(!this.originalPosition)return position;if(this.containment){if(position.left<this.containment[0])position.left=this.containment[0];if(position.top<this.containment[1])position.top=this.containment[1];if(position.left>this.containment[2])position.left=this.containment[2];if(position.top>this.containment[3])position.top=this.containment[3];}  
if(o.grid){var top=this.originalPosition.top+Math.round((position.top-this.originalPosition.top)/o.grid[1])*o.grid[1];position.top=this.containment?(!(top<this.containment[1]||top>this.containment[3])?top:(!(top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPosition.left+Math.round((position.left-this.originalPosition.left)/o.grid[0])*o.grid[0];position.left=this.containment?(!(left<this.containment[0]||left>this.containment[2])?left:(!(left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}  
return position;},mouseDrag:function(e){this.position=this.generatePosition(e);this.positionAbs=this.convertPositionTo("absolute");$.ui.plugin.call(this,"sort",[e,this.ui()]);this.positionAbs=this.convertPositionTo("absolute");this.helper[0].style.left=this.position.left+'px';this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var intersection=this.intersectsWithEdge(this.items[i]);if(!intersection)continue;if(this.items[i].item[0]!=this.currentItem[0]&&this.currentItem[intersection==1?"next":"prev"]()[0]!=this.items[i].item[0]&&!contains(this.currentItem[0],this.items[i].item[0])&&(this.options.type=='semi-dynamic'?!contains(this.element[0],this.items[i].item[0]):true)){this.direction=intersection==1?"down":"up";this.rearrange(e,this.items[i]);this.propagate("change",e);break;}}  
this.contactContainers(e);if($.ui.ddmanager)$.ui.ddmanager.drag(this,e);this.element.triggerHandler("sort",[e,this.ui()],this.options["sort"]);return false;},rearrange:function(e,i,a,hardRefresh){a?a[0].appendChild(this.currentItem[0]):i.item[0].parentNode.insertBefore(this.currentItem[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);if(this.options.placeholder)  
this.options.placeholder.update.call(this.element,this.currentItem,this.placeholder);},mouseStop:function(e,noPropagation){if($.ui.ddmanager&&!this.options.dropBehaviour)  
$.ui.ddmanager.drop(this,e);if(this.options.revert){var self=this;var cur=self.currentItem.offset();if(self.placeholder)self.placeholder.animate({opacity:'hide'},(parseInt(this.options.revert,10)||500)-50);$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self.clear(e);});}else{this.clear(e,noPropagation);}  
return false;},clear:function(e,noPropagation){if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])this.propagate("update",e,null,noPropagation);if(!contains(this.element[0],this.currentItem[0])){this.propagate("remove",e,null,noPropagation);for(var i=this.containers.length-1;i>=0;i--){if(contains(this.containers[i].element[0],this.currentItem[0])){this.containers[i].propagate("update",e,this,noPropagation);this.containers[i].propagate("receive",e,this,noPropagation);}};};for(var i=this.containers.length-1;i>=0;i--){this.containers[i].propagate("deactivate",e,this,noPropagation);if(this.containers[i].containerCache.over){this.containers[i].propagate("out",e,this);this.containers[i].containerCache.over=0;}}  
this.dragging=false;if(this.cancelHelperRemoval){this.propagate("stop",e,null,noPropagation);return false;}  
$(this.currentItem).css('visibility','');if(this.placeholder)this.placeholder.remove();this.helper.remove();this.helper=null;this.propagate("stop",e,null,noPropagation);return true;}}));$.extend($.ui.sortable,{getter:"serialize toArray",defaults:{helper:"clone",tolerance:"guess",distance:1,delay:0,scroll:true,scrollSensitivity:20,scrollSpeed:20,cancel:":input",items:'> *',zIndex:1000,dropOnEmpty:true,appendTo:"parent"}});$.ui.plugin.add("sortable","cursor",{start:function(e,ui){var t=$('body');if(t.css("cursor"))ui.options._cursor=t.css("cursor");t.css("cursor",ui.options.cursor);},stop:function(e,ui){if(ui.options._cursor)$('body').css("cursor",ui.options._cursor);}});$.ui.plugin.add("sortable","zIndex",{start:function(e,ui){var t=ui.helper;if(t.css("zIndex"))ui.options._zIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);},stop:function(e,ui){if(ui.options._zIndex)$(ui.helper).css('zIndex',ui.options._zIndex);}});$.ui.plugin.add("sortable","opacity",{start:function(e,ui){var t=ui.helper;if(t.css("opacity"))ui.options._opacity=t.css("opacity");t.css('opacity',ui.options.opacity);},stop:function(e,ui){if(ui.options._opacity)$(ui.helper).css('opacity',ui.options._opacity);}});$.ui.plugin.add("sortable","scroll",{start:function(e,ui){var o=ui.options;var i=$(this).data("sortable");i.overflowY=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-y')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(i.currentItem);i.overflowX=function(el){do{if(/auto|scroll/.test(el.css('overflow'))||(/auto|scroll/).test(el.css('overflow-x')))return el;el=el.parent();}while(el[0].parentNode);return $(document);}(i.currentItem);if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML')i.overflowYOffset=i.overflowY.offset();if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML')i.overflowXOffset=i.overflowX.offset();},sort:function(e,ui){var o=ui.options;var i=$(this).data("sortable");if(i.overflowY[0]!=document&&i.overflowY[0].tagName!='HTML'){if((i.overflowYOffset.top+i.overflowY[0].offsetHeight)-e.pageY<o.scrollSensitivity)  
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop+o.scrollSpeed;if(e.pageY-i.overflowYOffset.top<o.scrollSensitivity)  
i.overflowY[0].scrollTop=i.overflowY[0].scrollTop-o.scrollSpeed;}else{if(e.pageY-$(document).scrollTop()<o.scrollSensitivity)  
$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);if($(window).height()-(e.pageY-$(document).scrollTop())<o.scrollSensitivity)  
$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}  
if(i.overflowX[0]!=document&&i.overflowX[0].tagName!='HTML'){if((i.overflowXOffset.left+i.overflowX[0].offsetWidth)-e.pageX<o.scrollSensitivity)  
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft+o.scrollSpeed;if(e.pageX-i.overflowXOffset.left<o.scrollSensitivity)  
i.overflowX[0].scrollLeft=i.overflowX[0].scrollLeft-o.scrollSpeed;}else{if(e.pageX-$(document).scrollLeft()<o.scrollSensitivity)  
$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);if($(window).width()-(e.pageX-$(document).scrollLeft())<o.scrollSensitivity)  
$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}});$.ui.plugin.add("sortable","axis",{sort:function(e,ui){var i=$(this).data("sortable");if(ui.options.axis=="y")i.position.left=i.originalPosition.left;if(ui.options.axis=="x")i.position.top=i.originalPosition.top;}});})(jQuery);(function($){$.widget("ui.accordion",{init:function(){var options=this.options;if(options.navigation){var current=this.element.find("a").filter(options.navigationFilter);if(current.length){if(current.filter(options.header).length){options.active=current;}else{options.active=current.parent().parent().prev();current.addClass("current");}}}  
options.headers=this.element.find(options.header);options.active=findActive(options.headers,options.active);if($.browser.msie){this.element.find('a').css('zoom','1');}  
if(!this.element.hasClass("ui-accordion")){this.element.addClass("ui-accordion");$("<span class='ui-accordion-left'/>").insertBefore(options.headers);$("<span class='ui-accordion-right'/>").appendTo(options.headers);options.headers.addClass("ui-accordion-header").attr("tabindex","0");}  
var maxHeight;if(options.fillSpace){maxHeight=this.element.parent().height();options.headers.each(function(){maxHeight-=$(this).outerHeight();});var maxPadding=0;options.headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height());}).height(maxHeight-maxPadding);}else if(options.autoHeight){maxHeight=0;options.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}  
options.headers.not(options.active||"").next().hide();options.active.parent().andSelf().addClass(options.selectedClass);if(options.event){this.element.bind((options.event)+".accordion",clickHandler);}},activate:function(index){clickHandler.call(this.element[0],{target:findActive(this.options.headers,index)[0]});},destroy:function(){this.options.headers.next().css("display","");if(this.options.fillSpace||this.options.autoHeight){this.options.headers.next().css("height","");}  
$.removeData(this.element[0],"accordion");this.element.removeClass("ui-accordion").unbind(".accordion");}});function scopeCallback(callback,scope){return function(){return callback.apply(scope,arguments);};};function completed(cancel){if(!$.data(this,"accordion")){return;}  
var instance=$.data(this,"accordion");var options=instance.options;options.running=cancel?0:--options.running;if(options.running){return;}  
if(options.clearStyle){options.toShow.add(options.toHide).css({height:"",overflow:""});}  
$(this).triggerHandler("accordionchange",[$.event.fix({type:'accordionchange',target:instance.element[0]}),options.data],options.change);}  
function toggle(toShow,toHide,data,clickedActive,down){var options=$.data(this,"accordion").options;options.toShow=toShow;options.toHide=toHide;options.data=data;var complete=scopeCallback(completed,this);options.running=toHide.size()===0?toShow.size():toHide.size();if(options.animated){if(!options.alwaysOpen&&clickedActive){$.ui.accordion.animations[options.animated]({toShow:jQuery([]),toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight});}else{$.ui.accordion.animations[options.animated]({toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:options.autoHeight});}}else{if(!options.alwaysOpen&&clickedActive){toShow.toggle();}else{toHide.hide();toShow.show();}  
complete(true);}}  
function clickHandler(event){var options=$.data(this,"accordion").options;if(options.disabled){return false;}  
if(!event.target&&!options.alwaysOpen){options.active.parent().andSelf().toggleClass(options.selectedClass);var toHide=options.active.next(),data={options:options,newHeader:jQuery([]),oldHeader:options.active,newContent:jQuery([]),oldContent:toHide},toShow=(options.active=$([]));toggle.call(this,toShow,toHide,data);return false;}  
var clicked=$(event.target);clicked=$(clicked.parents(options.header)[0]||clicked);var clickedActive=clicked[0]==options.active[0];if(options.running||(options.alwaysOpen&&clickedActive)){return false;}  
if(!clicked.is(options.header)){return;}  
options.active.parent().andSelf().toggleClass(options.selectedClass);if(!clickedActive){clicked.parent().andSelf().addClass(options.selectedClass);}  
var toShow=clicked.next(),toHide=options.active.next(),data={options:options,newHeader:clicked,oldHeader:options.active,newContent:toShow,oldContent:toHide},down=options.headers.index(options.active[0])>options.headers.index(clicked[0]);options.active=clickedActive?$([]):clicked;toggle.call(this,toShow,toHide,data,clickedActive,down);return false;};function findActive(headers,selector){return selector!=undefined?typeof selector=="number"?headers.filter(":eq("+selector+")"):headers.not(headers.not(selector)):selector===false?$([]):headers.filter(":eq(0)");}  
$.extend($.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:'slide',event:"click",header:"a",autoHeight:true,running:0,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase();}},animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show"},options);return;}  
var hideHeight=options.toHide.height(),showHeight=options.toShow.height(),difference=showHeight/hideHeight;options.toShow.css({height:0,overflow:'hidden'}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{step:function(now){var current=(hideHeight-now)*difference;if($.browser.msie||$.browser.opera){current=Math.ceil(current);}  
options.toShow.height(current);},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","auto");}  
options.complete();}});},bounceslide:function(options){this.slide(options,{easing:options.down?"bounceout":"swing",duration:options.down?1000:200});},easeslide:function(options){this.slide(options,{easing:"easeinout",duration:700});}}});$.fn.activate=function(index){return this.accordion("activate",index);};})(jQuery);(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};$.widget("ui.dialog",{init:function(){var self=this,options=this.options,resizeHandles=typeof options.resizable=='string'?options.resizable:'n,e,s,w,se,sw,ne,nw',uiDialogContent=this.element.addClass('ui-dialog-content').wrap('<div/>').wrap('<div/>'),uiDialogContainer=(this.uiDialogContainer=uiDialogContent.parent().addClass('ui-dialog-container').css({position:'relative',width:'100%',height:'100%'})),title=options.title||uiDialogContent.attr('title')||'',uiDialogTitlebar=(this.uiDialogTitlebar=$('<div class="ui-dialog-titlebar"/>')).append('<span class="ui-dialog-title">'+title+'</span>').append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>').prependTo(uiDialogContainer),uiDialog=(this.uiDialog=uiDialogContainer.parent()).appendTo(document.body).hide().addClass('ui-dialog').addClass(options.dialogClass).addClass(uiDialogContent.attr('className')).removeClass('ui-dialog-content').css({position:'absolute',width:options.width,height:options.height,overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(ev){if(options.closeOnEscape){var ESC=27;(ev.keyCode&&ev.keyCode==ESC&&self.close());}}).mousedown(function(){self.moveToTop();}),uiDialogButtonPane=(this.uiDialogButtonPane=$('<div/>')).addClass('ui-dialog-buttonpane').css({position:'absolute',bottom:0}).appendTo(uiDialog);this.uiDialogTitlebarClose=$('.ui-dialog-titlebar-close',uiDialogTitlebar).hover(function(){$(this).addClass('ui-dialog-titlebar-close-hover');},function(){$(this).removeClass('ui-dialog-titlebar-close-hover');}).mousedown(function(ev){ev.stopPropagation();}).click(function(){self.close();return false;});this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function(){$.ui.disableSelection(this);});if($.fn.draggable){uiDialog.draggable({cancel:'.ui-dialog-content',helper:options.dragHelper,handle:'.ui-dialog-titlebar',start:function(e,ui){self.moveToTop();(options.dragStart&&options.dragStart.apply(self.element[0],arguments));},drag:function(e,ui){(options.drag&&options.drag.apply(self.element[0],arguments));},stop:function(e,ui){(options.dragStop&&options.dragStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}});(options.draggable||uiDialog.draggable('disable'));}  
if($.fn.resizable){uiDialog.resizable({cancel:'.ui-dialog-content',helper:options.resizeHelper,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight,start:function(){(options.resizeStart&&options.resizeStart.apply(self.element[0],arguments));},resize:function(e,ui){(options.autoResize&&self.size.apply(self));(options.resize&&options.resize.apply(self.element[0],arguments));},handles:resizeHandles,stop:function(e,ui){(options.autoResize&&self.size.apply(self));(options.resizeStop&&options.resizeStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}});(options.resizable||uiDialog.resizable('disable'));}  
this.createButtons(options.buttons);this.isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},setData:function(key,value){(setDataSwitch[key]&&this.uiDialog.data(setDataSwitch[key],value));switch(key){case"buttons":this.createButtons(value);break;case"draggable":this.uiDialog.draggable(value?'enable':'disable');break;case"height":this.uiDialog.height(value);break;case"position":this.position(value);break;case"resizable":(typeof value=='string'&&this.uiDialog.data('handles.resizable',value));this.uiDialog.resizable(value?'enable':'disable');break;case"title":$(".ui-dialog-title",this.uiDialogTitlebar).text(value);break;case"width":this.uiDialog.width(value);break;}  
$.widget.prototype.setData.apply(this,arguments);},position:function(pos){var wnd=$(window),doc=$(document),pTop=doc.scrollTop(),pLeft=doc.scrollLeft(),minTop=pTop;if($.inArray(pos,['center','top','right','bottom','left'])>=0){pos=[pos=='right'||pos=='left'?pos:'center',pos=='top'||pos=='bottom'?pos:'middle'];}  
if(pos.constructor!=Array){pos=['center','middle'];}  
if(pos[0].constructor==Number){pLeft+=pos[0];}else{switch(pos[0]){case'left':pLeft+=0;break;case'right':pLeft+=wnd.width()-this.uiDialog.width();break;default:case'center':pLeft+=(wnd.width()-this.uiDialog.width())/2;}}  
if(pos[1].constructor==Number){pTop+=pos[1];}else{switch(pos[1]){case'top':pTop+=0;break;case'bottom':pTop+=wnd.height()-this.uiDialog.height();break;default:case'middle':pTop+=(wnd.height()-this.uiDialog.height())/2;}}  
pTop=Math.max(pTop,minTop);this.uiDialog.css({top:pTop,left:pLeft});},size:function(){var container=this.uiDialogContainer,titlebar=this.uiDialogTitlebar,content=this.element,tbMargin=parseInt(content.css('margin-top'),10)+parseInt(content.css('margin-bottom'),10),lrMargin=parseInt(content.css('margin-left'),10)+parseInt(content.css('margin-right'),10);content.height(container.height()-titlebar.outerHeight()-tbMargin);content.width(container.width()-lrMargin);},open:function(){if(this.isOpen){return;}  
this.overlay=this.options.modal?new $.ui.dialog.overlay(this):null;(this.uiDialog.next().length>0)&&this.uiDialog.appendTo('body');this.position(this.options.position);this.uiDialog.show(this.options.show);this.options.autoResize&&this.size();this.moveToTop(true);var openEV=null;var openUI={options:this.options};this.uiDialogTitlebarClose.focus();this.element.triggerHandler("dialogopen",[openEV,openUI],this.options.open);this.isOpen=true;},moveToTop:function(force){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus);}  
var maxZ=this.options.zIndex,options=this.options;$('.ui-dialog:visible').each(function(){maxZ=Math.max(maxZ,parseInt($(this).css('z-index'),10)||options.zIndex);});(this.overlay&&this.overlay.$el.css('z-index',++maxZ));this.uiDialog.css('z-index',++maxZ);this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus);},close:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide);var closeEV=null;var closeUI={options:this.options};this.element.triggerHandler("dialogclose",[closeEV,closeUI],this.options.close);$.ui.dialog.overlay.resize();this.isOpen=false;},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content').hide().appendTo('body');this.uiDialog.remove();},createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=this.uiDialogButtonPane;uiDialogButtonPane.empty().hide();$.each(buttons,function(){return!(hasButtons=true);});if(hasButtons){uiDialogButtonPane.show();$.each(buttons,function(name,fn){$('<button/>').text(name).click(function(){fn.apply(self.element[0],arguments);}).appendTo(uiDialogButtonPane);});}}});$.extend($.ui.dialog,{defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:'center',resizable:true,stack:true,width:300,zIndex:1000},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog);}});$.extend($.ui.dialog.overlay,{instances:[],events:$.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(e){return e+'.dialog-overlay';}).join(' '),create:function(dialog){if(this.instances.length===0){setTimeout(function(){$('a, :input').bind($.ui.dialog.overlay.events,function(){var allow=false;var $dialog=$(this).parents('.ui-dialog');if($dialog.length){var $overlays=$('.ui-dialog-overlay');if($overlays.length){var maxZ=parseInt($overlays.css('z-index'),10);$overlays.each(function(){maxZ=Math.max(maxZ,parseInt($(this).css('z-index'),10));});allow=parseInt($dialog.css('z-index'),10)>maxZ;}else{allow=true;}}  
return allow;});},1);$(document).bind('keydown.dialog-overlay',function(e){var ESC=27;(e.keyCode&&e.keyCode==ESC&&dialog.close());});$(window).bind('resize.dialog-overlay',$.ui.dialog.overlay.resize);}  
var $el=$('<div/>').appendTo(document.body).addClass('ui-dialog-overlay').css($.extend({borderWidth:0,margin:0,padding:0,position:'absolute',top:0,left:0,width:this.width(),height:this.height()},dialog.options.overlay));(dialog.options.bgiframe&&$.fn.bgiframe&&$el.bgiframe());this.instances.push($el);return $el;},destroy:function($el){this.instances.splice($.inArray(this.instances,$el),1);if(this.instances.length===0){$('a, :input').add([document,window]).unbind('.dialog-overlay');}  
$el.remove();},height:function(){if($.browser.msie&&$.browser.version<7){var scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight<offsetHeight){return $(window).height()+'px';}else{return scrollHeight+'px';}}else{return $(document).height()+'px';}},width:function(){if($.browser.msie&&$.browser.version<7){var scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(scrollWidth<offsetWidth){return $(window).width()+'px';}else{return scrollWidth+'px';}}else{return $(document).width()+'px';}},resize:function(){var $overlays=$([]);$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this);});$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()});}});$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el);}});})(jQuery);(function($){$.fn.unwrap=$.fn.unwrap||function(expr){return this.each(function(){$(this).parents(expr).eq(0).after(this).remove();});};$.widget("ui.slider",{plugins:{},ui:function(e){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:Math.round(this.value(null,"x")),y:Math.round(this.value(null,"y"))},range:this.getRange()};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);this.element.triggerHandler(n=="slide"?n:"slide"+n,[e,this.ui()],this.options[n]);},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){$(this).data("mouse").mouseDestroy();});}  
this.generated&&this.generated.remove();},setData:function(key,value){$.widget.prototype.setData.apply(this,arguments);if(/min|max|steps/.test(key)){this.initBoundaries();}  
if(key=="range"){value?this.handle.length==2&&this.createRange():this.removeRange();}},init:function(){var self=this;this.element.addClass("ui-slider");this.initBoundaries();this.handle=$(this.options.handle,this.element);if(!this.handle.length){self.handle=self.generated=$(self.options.handles||[0]).map(function(){var handle=$("<div/>").addClass("ui-slider-handle").appendTo(self.element);if(this.id)  
handle.attr("id",this.id);return handle[0];});}  
var handleclass=function(el){this.element=$(el);this.element.data("mouse",this);this.options=self.options;this.element.bind("mousedown",function(){if(self.currentHandle)this.blur(self.currentHandle);self.focus(this,1);});this.mouseInit();};$.extend(handleclass.prototype,$.ui.mouse,{mouseStart:function(e){return self.start.call(self,e,this.element[0]);},mouseStop:function(e){return self.stop.call(self,e,this.element[0]);},mouseDrag:function(e){return self.drag.call(self,e,this.element[0]);},mouseCapture:function(){return true;},trigger:function(e){this.mouseDown(e);}});$(this.handle).each(function(){new handleclass(this);}).wrap('<a href="javascript:void(0)" style="outline:none;border:none;"></a>').parent().bind('focus',function(e){self.focus(this.firstChild);}).bind('blur',function(e){self.blur(this.firstChild);}).bind('keydown',function(e){if(!self.options.noKeyboard)self.keydown(e.keyCode,this.firstChild);});this.element.bind('mousedown.slider',function(e){self.click.apply(self,[e]);self.currentHandle.data("mouse").trigger(e);self.firstValue=self.firstValue+1;});$.each(this.options.handles||[],function(index,handle){self.moveTo(handle.start,index,true);});if(!isNaN(this.options.startValue))  
this.moveTo(this.options.startValue,0,true);this.previousHandle=$(this.handle[0]);if(this.handle.length==2&&this.options.range)this.createRange();},initBoundaries:function(){var element=this.element[0],o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};$.extend(o,{axis:o.axis||(element.offsetWidth<element.offsetHeight?'vertical':'horizontal'),max:!isNaN(parseInt(o.max,10))?{x:parseInt(o.max,10),y:parseInt(o.max,10)}:({x:o.max&&o.max.x||100,y:o.max&&o.max.y||100}),min:!isNaN(parseInt(o.min,10))?{x:parseInt(o.min,10),y:parseInt(o.min,10)}:({x:o.min&&o.min.x||0,y:o.min&&o.min.y||0})});o.realMax={x:o.max.x-o.min.x,y:o.max.y-o.min.y};o.stepping={x:o.stepping&&o.stepping.x||parseInt(o.stepping,10)||(o.steps?o.realMax.x/(o.steps.x||parseInt(o.steps,10)||o.realMax.x):0),y:o.stepping&&o.stepping.y||parseInt(o.stepping,10)||(o.steps?o.realMax.y/(o.steps.y||parseInt(o.steps,10)||o.realMax.y):0)};},keydown:function(keyCode,handle){if(/(37|38|39|40)/.test(keyCode)){this.moveTo({x:/(37|39)/.test(keyCode)?(keyCode==37?'-':'+')+'='+this.oneStep("x"):0,y:/(38|40)/.test(keyCode)?(keyCode==38?'-':'+')+'='+this.oneStep("y"):0},handle);}},focus:function(handle,hard){this.currentHandle=$(handle).addClass('ui-slider-handle-active');if(hard)  
this.currentHandle.parent()[0].focus();},blur:function(handle){$(handle).removeClass('ui-slider-handle-active');if(this.currentHandle&&this.currentHandle[0]==handle){this.previousHandle=this.currentHandle;this.currentHandle=null;};},click:function(e){var pointer=[e.pageX,e.pageY];var clickedHandle=false;this.handle.each(function(){if(this==e.target)  
clickedHandle=true;});if(clickedHandle||this.options.disabled||!(this.currentHandle||this.previousHandle))  
return;if(!this.currentHandle&&this.previousHandle)  
this.focus(this.previousHandle,true);this.offset=this.element.offset();this.moveTo({y:this.convertValue(e.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this.convertValue(e.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance);},createRange:function(){if(this.rangeElement)return;this.rangeElement=$('<div></div>').addClass('ui-slider-range').css({position:'absolute'}).appendTo(this.element);this.updateRange();},removeRange:function(){this.rangeElement.remove();this.rangeElement=null;},updateRange:function(){var prop=this.options.axis=="vertical"?"top":"left";var size=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(prop,(parseInt($(this.handle[0]).css(prop),10)||0)+this.handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(size,(parseInt($(this.handle[1]).css(prop),10)||0)-(parseInt($(this.handle[0]).css(prop),10)||0));},getRange:function(){return this.rangeElement?this.convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10),this.options.axis=="vertical"?"y":"x"):null;},handleIndex:function(){return this.handle.index(this.currentHandle[0]);},value:function(handle,axis){if(this.handle.length==1)this.currentHandle=this.handle;if(!axis)axis=this.options.axis=="vertical"?"y":"x";var curHandle=$(handle!=undefined&&handle!==null?this.handle[handle]||handle:this.currentHandle);if(curHandle.data("mouse").sliderValue){return parseInt(curHandle.data("mouse").sliderValue[axis],10);}else{return parseInt(((parseInt(curHandle.css(axis=="x"?"left":"top"),10)/(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(handle,axis)))*this.options.realMax[axis])+this.options.min[axis],10);}},convertValue:function(value,axis){return this.options.min[axis]+(value/(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis)))*this.options.realMax[axis];},translateValue:function(value,axis){return((value-this.options.min[axis])/this.options.realMax[axis])*(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis));},translateRange:function(value,axis){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&value>=this.translateValue(this.value(1),axis))  
value=this.translateValue(this.value(1,axis)-this.oneStep(axis),axis);if(this.currentHandle[0]==this.handle[1]&&value<=this.translateValue(this.value(0),axis))  
value=this.translateValue(this.value(0,axis)+this.oneStep(axis),axis);}  
if(this.options.handles){var handle=this.options.handles[this.handleIndex()];if(value<this.translateValue(handle.min,axis)){value=this.translateValue(handle.min,axis);}else if(value>this.translateValue(handle.max,axis)){value=this.translateValue(handle.max,axis);}}  
return value;},translateLimits:function(value,axis){if(value>=this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis))  
value=this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis);if(value<=0)  
value=0;return value;},handleSize:function(handle,axis){return $(handle!=undefined&&handle!==null?this.handle[handle]:this.currentHandle)[0]["offset"+(axis=="x"?"Width":"Height")];},oneStep:function(axis){return this.options.stepping[axis]||1;},start:function(e,handle){var o=this.options;if(o.disabled)return false;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle)  
this.focus(this.previousHandle,true);this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:e.pageY-this.handleOffset.top,left:e.pageX-this.handleOffset.left};this.firstValue=this.value();this.propagate('start',e);this.drag(e,handle);return true;},stop:function(e){this.propagate('stop',e);if(this.firstValue!=this.value())  
this.propagate('change',e);this.focus(this.currentHandle,true);return false;},drag:function(e,handle){var o=this.options;var position={top:e.pageY-this.offset.top-this.clickOffset.top,left:e.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle)this.focus(this.previousHandle,true);position.left=this.translateLimits(position.left,"x");position.top=this.translateLimits(position.top,"y");if(o.stepping.x){var value=this.convertValue(position.left,"x");value=Math.round(value/o.stepping.x)*o.stepping.x;position.left=this.translateValue(value,"x");}  
if(o.stepping.y){var value=this.convertValue(position.top,"y");value=Math.round(value/o.stepping.y)*o.stepping.y;position.top=this.translateValue(value,"y");}  
position.left=this.translateRange(position.left,"x");position.top=this.translateRange(position.top,"y");if(o.axis!="vertical")this.currentHandle.css({left:position.left});if(o.axis!="horizontal")this.currentHandle.css({top:position.top});this.currentHandle.data("mouse").sliderValue={x:Math.round(this.convertValue(position.left,"x"))||0,y:Math.round(this.convertValue(position.top,"y"))||0};if(this.rangeElement)  
this.updateRange();this.propagate('slide',e);return false;},moveTo:function(value,handle,noPropagation){var o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(handle==undefined&&!this.currentHandle&&this.handle.length!=1)  
return false;if(handle==undefined&&!this.currentHandle)  
handle=0;if(handle!=undefined)  
this.currentHandle=this.previousHandle=$(this.handle[handle]||handle);if(value.x!==undefined&&value.y!==undefined){var x=value.x,y=value.y;}else{var x=value,y=value;}  
if(x!==undefined&&x.constructor!=Number){var me=/^\-\=/.test(x),pe=/^\+\=/.test(x);if(me||pe){x=this.value(null,"x")+parseInt(x.replace(me?'=':'+=',''),10);}else{x=isNaN(parseInt(x,10))?undefined:parseInt(x,10);}}  
if(y!==undefined&&y.constructor!=Number){var me=/^\-\=/.test(y),pe=/^\+\=/.test(y);if(me||pe){y=this.value(null,"y")+parseInt(y.replace(me?'=':'+=',''),10);}else{y=isNaN(parseInt(y,10))?undefined:parseInt(y,10);}}  
if(o.axis!="vertical"&&x!==undefined){if(o.stepping.x)x=Math.round(x/o.stepping.x)*o.stepping.x;x=this.translateValue(x,"x");x=this.translateLimits(x,"x");x=this.translateRange(x,"x");o.animate?this.currentHandle.stop().animate({left:x},(Math.abs(parseInt(this.currentHandle.css("left"))-x))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({left:x});}  
if(o.axis!="horizontal"&&y!==undefined){if(o.stepping.y)y=Math.round(y/o.stepping.y)*o.stepping.y;y=this.translateValue(y,"y");y=this.translateLimits(y,"y");y=this.translateRange(y,"y");o.animate?this.currentHandle.stop().animate({top:y},(Math.abs(parseInt(this.currentHandle.css("top"))-y))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({top:y});}  
if(this.rangeElement)  
this.updateRange();this.currentHandle.data("mouse").sliderValue={x:Math.round(this.convertValue(x,"x"))||0,y:Math.round(this.convertValue(y,"y"))||0};if(!noPropagation){this.propagate('start',null);this.propagate('stop',null);this.propagate('change',null);this.propagate("slide",null);}}});$.ui.slider.getter="value";$.ui.slider.defaults={handle:".ui-slider-handle",distance:1,animate:false};})(jQuery);(function($){$.widget("ui.tabs",{init:function(){this.options.event+='.tabs';this.tabify(true);},setData:function(key,value){if((/^selected/).test(key))  
this.select(value);else{this.options[key]=value;this.tabify();}},length:function(){return this.$tabs.length;},tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},ui:function(tab,panel){return{options:this.options,tab:tab,panel:panel,index:this.$tabs.index(tab)};},tabify:function(init){this.$lis=$('li:has(a[href])',this.element);this.$tabs=this.$lis.map(function(){return $('a',this)[0];});this.$panels=$([]);var self=this,o=this.options;this.$tabs.each(function(i,a){if(a.hash&&a.hash.replace('#',''))  
self.$panels=self.$panels.add(a.hash);else if($(a).attr('href')!='#'){$.data(a,'href.tabs',a.href);$.data(a,'load.tabs',a.href);var id=self.tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.panelClass).insertAfter(self.$panels[i-1]||self.element);$panel.data('destroy.tabs',true);}  
self.$panels=self.$panels.add($panel);}  
else  
o.disabled.push(i+1);});if(init){this.element.addClass(o.navClass);this.$panels.each(function(){var $this=$(this);$this.addClass(o.panelClass);});if(o.selected===undefined){if(location.hash){this.$tabs.each(function(i,a){if(a.hash==location.hash){o.selected=i;if($.browser.msie||$.browser.opera){var $toShow=$(location.hash),toShowId=$toShow.attr('id');$toShow.attr('id','');setTimeout(function(){$toShow.attr('id',toShowId);},500);}  
scrollTo(0,0);return false;}});}  
else if(o.cookie){var index=parseInt($.cookie('ui-tabs'+$.data(self.element)),10);if(index&&self.$tabs[index])  
o.selected=index;}  
else if(self.$lis.filter('.'+o.selectedClass).length)  
o.selected=self.$lis.index(self.$lis.filter('.'+o.selectedClass)[0]);}  
o.selected=o.selected===null||o.selected!==undefined?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.$lis.filter('.'+o.disabledClass),function(n,i){return self.$lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1)  
o.disabled.splice($.inArray(o.selected,o.disabled),1);this.$panels.addClass(o.hideClass);this.$lis.removeClass(o.selectedClass);if(o.selected!==null){this.$panels.eq(o.selected).show().removeClass(o.hideClass);this.$lis.eq(o.selected).addClass(o.selectedClass);var onShow=function(){$(self.element).triggerHandler('tabsshow',[self.fakeEvent('tabsshow'),self.ui(self.$tabs[o.selected],self.$panels[o.selected])],o.show);};if($.data(this.$tabs[o.selected],'load.tabs'))  
this.load(o.selected,onShow);else  
onShow();}  
$(window).bind('unload',function(){self.$tabs.unbind('.tabs');self.$lis=self.$tabs=self.$panels=null;});}  
for(var i=0,li;li=this.$lis[i];i++)  
$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass(o.selectedClass)?'addClass':'removeClass'](o.disabledClass);if(o.cache===false)  
this.$tabs.removeData('cache.tabs');var hideFx,showFx,baseFx={'min-width':0,duration:1},baseDuration='normal';if(o.fx&&o.fx.constructor==Array)  
hideFx=o.fx[0]||baseFx,showFx=o.fx[1]||baseFx;else  
hideFx=showFx=o.fx||baseFx;var resetCSS={display:'',overflow:'',height:''};if(!$.browser.msie)  
resetCSS.opacity='';function hideTab(clicked,$hide,$show){$hide.animate(hideFx,hideFx.duration||baseDuration,function(){$hide.addClass(o.hideClass).css(resetCSS);if($.browser.msie&&hideFx.opacity)  
$hide[0].style.filter='';if($show)  
showTab(clicked,$show,$hide);});}  
function showTab(clicked,$show,$hide){if(showFx===baseFx)  
$show.css('display','block');$show.animate(showFx,showFx.duration||baseDuration,function(){$show.removeClass(o.hideClass).css(resetCSS);if($.browser.msie&&showFx.opacity)  
$show[0].style.filter='';$(self.element).triggerHandler('tabsshow',[self.fakeEvent('tabsshow'),self.ui(clicked,$show[0])],o.show);});}  
function switchTab(clicked,$li,$hide,$show){$li.addClass(o.selectedClass).siblings().removeClass(o.selectedClass);hideTab(clicked,$hide,$show);}  
this.$tabs.unbind('.tabs').bind(o.event,function(){var $li=$(this).parents('li:eq(0)'),$hide=self.$panels.filter(':visible'),$show=$(this.hash);if(($li.hasClass(o.selectedClass)&&!o.unselect)||$li.hasClass(o.disabledClass)||$(this).hasClass(o.loadingClass)||$(self.element).triggerHandler('tabsselect',[self.fakeEvent('tabsselect'),self.ui(this,$show[0])],o.select)===false){this.blur();return false;}  
self.options.selected=self.$tabs.index(this);if(o.unselect){if($li.hasClass(o.selectedClass)){self.options.selected=null;$li.removeClass(o.selectedClass);self.$panels.stop();hideTab(this,$hide);this.blur();return false;}else if(!$hide.length){self.$panels.stop();var a=this;self.load(self.$tabs.index(this),function(){$li.addClass(o.selectedClass).addClass(o.unselectClass);showTab(a,$show);});this.blur();return false;}}  
if(o.cookie)  
$.cookie('ui-tabs'+$.data(self.element),self.options.selected,o.cookie);self.$panels.stop();if($show.length){var a=this;self.load(self.$tabs.index(this),$hide.length?function(){switchTab(a,$li,$hide,$show);}:function(){$li.addClass(o.selectedClass);showTab(a,$show);});}else  
throw'jQuery UI Tabs: Mismatching fragment identifier.';if($.browser.msie)  
this.blur();return false;});if(!(/^click/).test(o.event))  
this.$tabs.bind('click.tabs',function(){return false;});},add:function(url,label,index){if(index==undefined)  
index=this.$tabs.length;var o=this.options;var $li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label));$li.data('destroy.tabs',true);var id=url.indexOf('#')==0?url.replace('#',''):this.tabId($('a:first-child',$li)[0]);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass(o.hideClass).data('destroy.tabs',true);}  
$panel.addClass(o.panelClass);if(index>=this.$lis.length){$li.appendTo(this.element);$panel.appendTo(this.element[0].parentNode);}else{$li.insertBefore(this.$lis[index]);$panel.insertBefore(this.$panels[index]);}  
o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n});this.tabify();if(this.$tabs.length==1){$li.addClass(o.selectedClass);$panel.removeClass(o.hideClass);var href=$.data(this.$tabs[0],'load.tabs');if(href)  
this.load(index,href);}  
this.element.triggerHandler('tabsadd',[this.fakeEvent('tabsadd'),this.ui(this.$tabs[index],this.$panels[index])],o.add);},remove:function(index){var o=this.options,$li=this.$lis.eq(index).remove(),$panel=this.$panels.eq(index).remove();if($li.hasClass(o.selectedClass)&&this.$tabs.length>1)  
this.select(index+(index+1<this.$tabs.length?1:-1));o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n});this.tabify();this.element.triggerHandler('tabsremove',[this.fakeEvent('tabsremove'),this.ui($li.find('a')[0],$panel[0])],o.remove);},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1)  
return;var $li=this.$lis.eq(index).removeClass(o.disabledClass);if($.browser.safari){$li.css('display','inline-block');setTimeout(function(){$li.css('display','block');},0);}  
o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this.element.triggerHandler('tabsenable',[this.fakeEvent('tabsenable'),this.ui(this.$tabs[index],this.$panels[index])],o.enable);},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.$lis.eq(index).addClass(o.disabledClass);o.disabled.push(index);o.disabled.sort();this.element.triggerHandler('tabsdisable',[this.fakeEvent('tabsdisable'),this.ui(this.$tabs[index],this.$panels[index])],o.disable);}},select:function(index){if(typeof index=='string')  
index=this.$tabs.index(this.$tabs.filter('[href$='+index+']')[0]);this.$tabs.eq(index).trigger(this.options.event);},load:function(index,callback){var self=this,o=this.options,$a=this.$tabs.eq(index),a=$a[0],bypassCache=callback==undefined||callback===false,url=$a.data('load.tabs');callback=callback||function(){};if(!url||!bypassCache&&$.data(a,'cache.tabs')){callback();return;}  
var inner=function(parent){var $parent=$(parent),$inner=$parent.find('*:last');return $inner.length&&$inner.is(':not(img)')&&$inner||$parent;};var cleanup=function(){self.$tabs.filter('.'+o.loadingClass).removeClass(o.loadingClass).each(function(){if(o.spinner)  
inner(this).parent().html(inner(this).data('label.tabs'));});self.xhr=null;};if(o.spinner){var label=inner(a).html();inner(a).wrapInner('<em></em>').find('em').data('label.tabs',label).html(o.spinner);}  
var ajaxOptions=$.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(a.hash).html(r);cleanup();if(o.cache)  
$.data(a,'cache.tabs',true);$(self.element).triggerHandler('tabsload',[self.fakeEvent('tabsload'),self.ui(self.$tabs[index],self.$panels[index])],o.load);o.ajaxOptions.success&&o.ajaxOptions.success(r,s);callback();}});if(this.xhr){this.xhr.abort();cleanup();}  
$a.addClass(o.loadingClass);setTimeout(function(){self.xhr=$.ajax(ajaxOptions);},0);},url:function(index,url){this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs',url);},destroy:function(){var o=this.options;this.element.unbind('.tabs').removeClass(o.navClass).removeData('tabs');this.$tabs.each(function(){var href=$.data(this,'href.tabs');if(href)  
this.href=href;var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.$lis.add(this.$panels).each(function(){if($.data(this,'destroy.tabs'))  
$(this).remove();else  
$(this).removeClass([o.selectedClass,o.unselectClass,o.disabledClass,o.panelClass,o.hideClass].join(' '));});},fakeEvent:function(type){return $.event.fix({type:type,target:this.element[0]});}});$.ui.tabs.defaults={unselect:false,event:'click',disabled:[],cookie:null,spinner:'Loading&#8230;',cache:false,idPrefix:'ui-tabs-',ajaxOptions:{},fx:null,tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>',panelTemplate:'<div></div>',navClass:'ui-tabs-nav',selectedClass:'ui-tabs-selected',unselectClass:'ui-tabs-unselect',disabledClass:'ui-tabs-disabled',panelClass:'ui-tabs-panel',hideClass:'ui-tabs-hide',loadingClass:'ui-tabs-loading'};$.ui.tabs.getter="length";$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){continuing=continuing||false;var self=this,t=this.options.selected;function start(){self.rotation=setInterval(function(){t=++t<self.$tabs.length?t:0;self.select(t);},ms);}  
function stop(e){if(!e||e.clientX){clearInterval(self.rotation);}}  
if(ms){start();if(!continuing)  
this.$tabs.bind(this.options.event,stop);else  
this.$tabs.bind(this.options.event,function(){stop();t=self.options.selected;start();});}  
else{stop();this.$tabs.unbind(this.options.event,stop);}}});})(jQuery);(function($){var PROP_NAME='datepicker';function Datepicker(){this.debug=false;this._curInst=null;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId='ui-datepicker-div';this._appendClass='ui-datepicker-append';this._triggerClass='ui-datepicker-trigger';this._dialogClass='ui-datepicker-dialog';this._promptClass='ui-datepicker-prompt';this._unselectableClass='ui-datepicker-unselectable';this._currentClass='ui-datepicker-current-day';this.regional=[];this.regional['']={clearText:'Clear',clearStatus:'Erase the current date',closeText:'Close',closeStatus:'Close without change',prevText:'&#x3c;Prev',prevStatus:'Show the previous month',nextText:'Next&#x3e;',nextStatus:'Show the next month',currentText:'Today',currentStatus:'Show the current month',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],monthStatus:'Show a different month',yearStatus:'Show a different year',weekHeader:'Wk',weekStatus:'Week of the year',dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dayStatus:'Set DD as first week day',dateStatus:'Select DD, M d',dateFormat:'mm/dd/yy',firstDay:0,initStatus:'Select a date',isRTL:false};this._defaults={showOn:'focus',showAnim:'show',showOptions:{},defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:true,changeYear:true,yearRange:'-10:+10',changeFirstDay:true,highlightWeek:false,showOtherMonths:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,duration:'normal',beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,stepMonths:1,rangeSelect:false,rangeSeparator:' - ',altField:'',altFormat:''};$.extend(this._defaults,this.regional['']);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>');}  
$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug)  
console.log.apply('',arguments);},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(attrName in this._defaults){var attrValue=target.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}}  
var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=='div'||nodeName=='span');if(!target.id)  
target.id='dp'+new Date().getTime();var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=='input'){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){return{id:target[0].id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="ui-datepicker-inline"></div>'))};},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName))  
return;var appendText=this._get(inst,'appendText');var isRTL=this._get(inst,'isRTL');if(appendText)  
input[isRTL?'before':'after']('<span class="'+this._appendClass+'">'+appendText+'</span>');var showOn=this._get(inst,'showOn');if(showOn=='focus'||showOn=='both')  
input.focus(this._showDatepicker);if(showOn=='button'||showOn=='both'){var buttonText=this._get(inst,'buttonText');var buttonImage=this._get(inst,'buttonImage');var trigger=$(this._get(inst,'buttonImageOnly')?$('<img/>').addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==''?buttonText:$('<img/>').attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?'before':'after'](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target)  
$.datepicker._hideDatepicker();else  
$.datepicker._showDatepicker(target);return false;});}  
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);},_inlineDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName))  
return;input.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);},_inlineShow:function(inst){var numMonths=this._getNumberOfMonths(inst);inst.dpDiv.width(numMonths[1]*$('.ui-datepicker',inst.dpDiv[0]).width());},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id='dp'+new Date().getTime();this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst);}  
extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];}  
this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI)  
$.blockUI(this.dpDiv);$.data(this._dialogInput[0],PROP_NAME,inst);return this;},_destroyDatepicker:function(target){var nodeName=target.nodeName.toLowerCase();var $target=$(target);$.removeData(target,PROP_NAME);if(nodeName=='input'){$target.siblings('.'+this._appendClass).remove().end().siblings('.'+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind('focus',this._showDatepicker).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress);}else if(nodeName=='div'||nodeName=='span')  
$target.removeClass(this.markerClassName).empty();},_enableDatepicker:function(target){target.disabled=false;$(target).siblings('button.'+this._triggerClass).each(function(){this.disabled=false;}).end().siblings('img.'+this._triggerClass).css({opacity:'1.0',cursor:''});this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});},_disableDatepicker:function(target){target.disabled=true;$(target).siblings('button.'+this._triggerClass).each(function(){this.disabled=true;}).end().siblings('img.'+this._triggerClass).css({opacity:'0.5',cursor:'default'});this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target)  
return false;for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target)  
return true;}  
return false;},_changeDatepicker:function(target,name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;}  
if(inst=$.data(target,PROP_NAME)){extendRemove(inst.settings,settings);this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date,endDate){var inst=$.data(target,PROP_NAME);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);}},_getDateDatepicker:function(target){var inst=$.data(target,PROP_NAME);if(inst)  
this._setDateFromField(inst);return(inst?this._getDate(inst):null);},_doKeyDown:function(e){var inst=$.data(e.target,PROP_NAME);var handled=true;if($.datepicker._datepickerShowing)  
switch(e.keyCode){case 9:$.datepicker._hideDatepicker(null,'');break;case 13:$.datepicker._selectDay(e.target,inst.selectedMonth,inst.selectedYear,$('td.ui-datepicker-days-cell-over',inst.dpDiv)[0]);return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));break;case 33:$.datepicker._adjustDate(e.target,(e.ctrlKey?-1:-$.datepicker._get(inst,'stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$.datepicker._adjustDate(e.target,(e.ctrlKey?+1:+$.datepicker._get(inst,'stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey)$.datepicker._clearDate(e.target);break;case 36:if(e.ctrlKey)$.datepicker._gotoToday(e.target);break;case 37:if(e.ctrlKey)$.datepicker._adjustDate(e.target,-1,'D');break;case 38:if(e.ctrlKey)$.datepicker._adjustDate(e.target,-7,'D');break;case 39:if(e.ctrlKey)$.datepicker._adjustDate(e.target,+1,'D');break;case 40:if(e.ctrlKey)$.datepicker._adjustDate(e.target,+7,'D');break;default:handled=false;}  
else if(e.keyCode==36&&e.ctrlKey)  
$.datepicker._showDatepicker(this);else  
handled=false;if(handled){e.preventDefault();e.stopPropagation();}},_doKeyPress:function(e){var inst=$.data(e.target,PROP_NAME);var chars=$.datepicker._possibleChars($.datepicker._get(inst,'dateFormat'));var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||(chr<' '||!chars||chars.indexOf(chr)>-1);},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!='input')  
input=$('input',input.parentNode)[0];if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input)  
return;var inst=$.data(input,PROP_NAME);var beforeShow=$.datepicker._get(inst,'beforeShow');extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,'');$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog)  
input.value='';if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;}  
var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css('position')=='fixed';return!isFixed;});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop;}  
var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:'absolute',display:'block',top:'-1000px'});$.datepicker._updateDatepicker(inst);inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1]*$('.ui-datepicker',inst.dpDiv[0])[0].offsetWidth);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?'static':(isFixed?'fixed':'absolute')),display:'none',left:offset.left+'px',top:offset.top+'px'});if(!inst.inline){var showAnim=$.datepicker._get(inst,'showAnim')||'show';var duration=$.datepicker._get(inst,'duration');var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version)<7)  
$('iframe.ui-datepicker-cover').css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4});};if($.effects&&$.effects[showAnim])  
inst.dpDiv.show(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else  
inst.dpDiv[showAnim](duration,postProcess);if(duration=='')  
postProcess();if(inst.input[0].type!='hidden')  
inst.input[0].focus();$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};inst.dpDiv.empty().append(this._generateDatepicker(inst)).find('iframe.ui-datepicker-cover').css({width:dims.width,height:dims.height});var numMonths=this._getNumberOfMonths(inst);inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?'add':'remove')+'Class']('ui-datepicker-multi');inst.dpDiv[(this._get(inst,'isRTL')?'add':'remove')+'Class']('ui-datepicker-rtl');if(inst.input&&inst.input[0].type!='hidden')  
$(inst.input[0]).focus();},_checkOffset:function(inst,offset,isFixed){var pos=inst.input?this._findPos(inst.input[0]):null;var browserWidth=window.innerWidth||document.documentElement.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(inst,'isRTL')||(offset.left+inst.dpDiv.width()-scrollX)>browserWidth)  
offset.left=Math.max((isFixed?0:scrollX),pos[0]+(inst.input?inst.input.width():0)-(isFixed?scrollX:0)-inst.dpDiv.width()-  
(isFixed&&$.browser.opera?document.documentElement.scrollLeft:0));else  
offset.left-=(isFixed?scrollX:0);if((offset.top+inst.dpDiv.height()-scrollY)>browserHeight)  
offset.top=Math.max((isFixed?0:scrollY),pos[1]-(isFixed?scrollY:0)-(this._inDialog?0:inst.dpDiv.height())-  
(isFixed&&$.browser.opera?document.documentElement.scrollTop:0));else  
offset.top-=(isFixed?scrollY:0);return offset;},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;}  
var position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst)  
return;var rangeSelect=this._get(inst,'rangeSelect');if(rangeSelect&&this._stayOpen)  
this._selectDate('#'+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));this._stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,'duration'));var showAnim=this._get(inst,'showAnim');var postProcess=function(){$.datepicker._tidyDialog(inst);};if(duration!=''&&$.effects&&$.effects[showAnim])  
inst.dpDiv.hide(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else  
inst.dpDiv[(duration==''?'hide':(showAnim=='slideDown'?'slideUp':(showAnim=='fadeIn'?'fadeOut':'hide')))](duration,postProcess);if(duration=='')  
this._tidyDialog(inst);var onClose=this._get(inst,'onClose');if(onClose)  
onClose.apply((inst.input?inst.input[0]:null),[this._getDate(inst),inst]);this._datepickerShowing=false;this._lastInput=null;inst.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:'absolute',left:'0',top:'-100px'});if($.blockUI){$.unblockUI();$('body').append(this.dpDiv);}}  
this._inDialog=false;}  
this._curInst=null;},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');$('.'+this._promptClass,inst.dpDiv).remove();},_checkExternalClick:function(event){if(!$.datepicker._curInst)  
return;var $target=$(event.target);if(($target.parents('#'+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI))  
$.datepicker._hideDatepicker(null,'');},_adjustDate:function(id,offset,period){var target=$(id);var inst=$.data(target[0],PROP_NAME);this._adjustInstDate(inst,offset,period);this._updateDatepicker(inst);},_gotoToday:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(this._get(inst,'gotoCurrent')&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;}  
else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();}  
this._adjustDate(target);this._notifyChange(inst);},_selectMonthYear:function(id,select,period){var target=$(id);var inst=$.data(target[0],PROP_NAME);inst._selectingMonthYear=false;inst[period=='M'?'drawMonth':'drawYear']=select.options[select.selectedIndex].value-0;this._adjustDate(target);this._notifyChange(inst);},_clickMonthYear:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie)  
inst.input[0].focus();inst._selectingMonthYear=!inst._selectingMonthYear;},_changeFirstDay:function(id,day){var target=$(id);var inst=$.data(target[0],PROP_NAME);inst.settings.firstDay=day;this._updateDatepicker(inst);},_selectDay:function(id,month,year,td){if($(td).hasClass(this._unselectableClass))  
return;var target=$(id);var inst=$.data(target[0],PROP_NAME);var rangeSelect=this._get(inst,'rangeSelect');if(rangeSelect){this._stayOpen=!this._stayOpen;if(this._stayOpen){$('.ui-datepicker td').removeClass(this._currentClass);$(td).addClass(this._currentClass);}}  
inst.selectedDay=inst.currentDay=$('a',td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(this._stayOpen){inst.endDay=inst.endMonth=inst.endYear=null;}  
else if(rangeSelect){inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear;}  
this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(this._stayOpen){inst.rangeStart=new Date(inst.currentYear,inst.currentMonth,inst.currentDay);this._updateDatepicker(inst);}  
else if(rangeSelect){inst.selectedDay=inst.currentDay=inst.rangeStart.getDate();inst.selectedMonth=inst.currentMonth=inst.rangeStart.getMonth();inst.selectedYear=inst.currentYear=inst.rangeStart.getFullYear();inst.rangeStart=null;if(inst.inline)  
this._updateDatepicker(inst);}},_clearDate:function(id){var target=$(id);var inst=$.data(target[0],PROP_NAME);if(this._get(inst,'mandatory'))  
return;this._stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,'');},_selectDate:function(id,dateStr){var target=$(id);var inst=$.data(target[0],PROP_NAME);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(this._get(inst,'rangeSelect')&&dateStr)  
dateStr=(inst.rangeStart?this._formatDate(inst,inst.rangeStart):dateStr)+this._get(inst,'rangeSeparator')+dateStr;if(inst.input)  
inst.input.val(dateStr);this._updateAlternate(inst);var onSelect=this._get(inst,'onSelect');if(onSelect)  
onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);else if(inst.input)  
inst.input.trigger('change');if(inst.inline)  
this._updateDatepicker(inst);else if(!this._stayOpen){this._hideDatepicker(null,this._get(inst,'duration'));this._lastInput=inst.input[0];if(typeof(inst.input[0])!='object')  
inst.input[0].focus();this._lastInput=null;}},_updateAlternate:function(inst){var altField=this._get(inst,'altField');if(altField){var altFormat=this._get(inst,'altFormat');var date=this._getDate(inst);dateStr=(isArray(date)?(!date[0]&&!date[1]?'':this.formatDate(altFormat,date[0],this._getFormatConfig(inst))+  
this._get(inst,'rangeSeparator')+this.formatDate(altFormat,date[1]||date[0],this._getFormatConfig(inst))):this.formatDate(altFormat,date,this._getFormatConfig(inst)));$(altField).each(function(){$(this).val(dateStr);});}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate(),(date.getTimezoneOffset()/-60));var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate);}else if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){checkDate.setDate(checkDate.getDate()+3);return $.datepicker.iso8601Week(checkDate);}}  
return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},dateStatus:function(date,inst){return $.datepicker.formatDate($.datepicker._get(inst,'dateStatus'),date,$.datepicker._getFormatConfig(inst));},parseDate:function(format,value,settings){if(format==null||value==null)  
throw'Invalid arguments';value=(typeof value=='object'?value.toString():value+'');if(value=='')  
return null;var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches)  
iFormat++;return matches;};var getNumber=function(match){lookAhead(match);var origSize=(match=='@'?14:(match=='y'?4:2));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>='0'&&value.charAt(iValue)<='9'){num=num*10+(value.charAt(iValue++)-0);size--;}  
if(size==origSize)  
throw'Missing number at position '+iValue;return num;};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++)  
size=Math.max(size,names[j].length);var name='';var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++)  
if(name==names[i])  
return i+1;size--;}  
throw'Unknown name at position '+iInit;};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat))  
throw'Unexpected literal at position '+iValue;iValue++;};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)  
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))  
literal=false;else  
checkLiteral();else  
switch(format.charAt(iFormat)){case'd':day=getNumber('d');break;case'D':getName('D',dayNamesShort,dayNames);break;case'm':month=getNumber('m');break;case'M':month=getName('M',monthNamesShort,monthNames);break;case'y':year=getNumber('y');break;case'@':var date=new Date(getNumber('@'));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'"))  
checkLiteral();else  
literal=true;break;default:checkLiteral();}}  
if(year<100)  
year+=new Date().getFullYear()-new Date().getFullYear()%100+  
(year<=shortYearCutoff?0:-100);var date=new Date(year,month-1,day);if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day)  
throw'Invalid date';return date;},ATOM:'yy-mm-dd',COOKIE:'D, dd M yy',ISO_8601:'yy-mm-dd',RFC_822:'D, d M y',RFC_850:'DD, dd-M-y',RFC_1036:'D, d M y',RFC_1123:'D, d M yy',RFC_2822:'D, d M yy',RSS:'D, d M y',TIMESTAMP:'@',W3C:'yy-mm-dd',formatDate:function(format,date,settings){if(!date)  
return'';var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches)  
iFormat++;return matches;};var formatNumber=function(match,value){return(lookAhead(match)&&value<10?'0':'')+value;};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);};var output='';var literal=false;if(date)  
for(var iFormat=0;iFormat<format.length;iFormat++){if(literal)  
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))  
literal=false;else  
output+=format.charAt(iFormat);else  
switch(format.charAt(iFormat)){case'd':output+=formatNumber('d',date.getDate());break;case'D':output+=formatName('D',date.getDay(),dayNamesShort,dayNames);break;case'm':output+=formatNumber('m',date.getMonth()+1);break;case'M':output+=formatName('M',date.getMonth(),monthNamesShort,monthNames);break;case'y':output+=(lookAhead('y')?date.getFullYear():(date.getYear()%100<10?'0':'')+date.getYear()%100);break;case'@':output+=date.getTime();break;case"'":if(lookAhead("'"))  
output+="'";else  
literal=true;break;default:output+=format.charAt(iFormat);}}  
return output;},_possibleChars:function(format){var chars='';var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++)  
if(literal)  
if(format.charAt(iFormat)=="'"&&!lookAhead("'"))  
literal=false;else  
chars+=format.charAt(iFormat);else  
switch(format.charAt(iFormat)){case'd':case'm':case'y':case'@':chars+='0123456789';break;case'D':case'M':return null;case"'":if(lookAhead("'"))  
chars+="'";else  
literal=true;break;default:chars+=format.charAt(iFormat);}  
return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst){var dateFormat=this._get(inst,'dateFormat');var dates=inst.input?inst.input.val().split(this._get(inst,'rangeSeparator')):null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);if(dates.length>0){var settings=this._getFormatConfig(inst);if(dates.length>1){date=this.parseDate(dateFormat,dates[1],settings)||defaultDate;inst.endDay=date.getDate();inst.endMonth=date.getMonth();inst.endYear=date.getFullYear();}  
try{date=this.parseDate(dateFormat,dates[0],settings)||defaultDate;}catch(e){this.log(e);date=defaultDate;}}  
inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates[0]?date.getDate():0);inst.currentMonth=(dates[0]?date.getMonth():0);inst.currentYear=(dates[0]?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,'defaultDate'),new Date());var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date;},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setUTCDate(date.getUTCDate()+offset);return date;};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||'d'){case'd':case'D':day+=(matches[1]-0);break;case'w':case'W':day+=(matches[1]*7);break;case'm':case'M':month+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;case'y':case'Y':year+=(matches[1]-0);day=Math.min(day,getDaysInMonth(year,month));break;}  
matches=pattern.exec(offset);}  
return new Date(year,month,day);};return(date==null?defaultDate:(typeof date=='string'?offsetString(date,this._getDaysInMonth):(typeof date=='number'?offsetNumeric(date):date)));},_setDate:function(inst,date,endDate){var clear=!(date);date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(this._get(inst,'rangeSelect')){if(endDate){endDate=this._determineDate(endDate,null);inst.endDay=endDate.getDate();inst.endMonth=endDate.getMonth();inst.endYear=endDate.getFullYear();}else{inst.endDay=inst.currentDay;inst.endMonth=inst.currentMonth;inst.endYear=inst.currentYear;}}  
this._adjustInstDate(inst);if(inst.input)  
inst.input.val(clear?'':this._formatDate(inst)+  
(!this._get(inst,'rangeSelect')?'':this._get(inst,'rangeSeparator')+  
this._formatDate(inst,inst.endDay,inst.endMonth,inst.endYear)));},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=='')?null:new Date(inst.currentYear,inst.currentMonth,inst.currentDay));if(this._get(inst,'rangeSelect')){return[inst.rangeStart||startDate,(!inst.endYear?null:new Date(inst.endYear,inst.endMonth,inst.endDay))];}else  
return startDate;},_generateDatepicker:function(inst){var today=new Date();today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var showStatus=this._get(inst,'showStatus');var isRTL=this._get(inst,'isRTL');var clear=(this._get(inst,'mandatory')?'':'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#'+inst.id+'\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'clearStatus')||'&#xa0;'):'')+'>'+  
this._get(inst,'clearText')+'</a></div>');var controls='<div class="ui-datepicker-control">'+(isRTL?'':clear)+'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"'+  
(showStatus?this._addStatus(inst,this._get(inst,'closeStatus')||'&#xa0;'):'')+'>'+  
this._get(inst,'closeText')+'</a></div>'+(isRTL?clear:'')+'</div>';var prompt=this._get(inst,'prompt');var closeAtTop=this._get(inst,'closeAtTop');var hideIfNoPrevNext=this._get(inst,'hideIfNoPrevNext');var navigationAsDateFormat=this._get(inst,'navigationAsDateFormat');var numMonths=this._getNumberOfMonths(inst);var stepMonths=this._get(inst,'stepMonths');var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');var drawMonth=inst.drawMonth;var drawYear=inst.drawYear;if(maxDate){var maxDraw=new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate());maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(new Date(drawYear,drawMonth,1)>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}}  
var prevText=this._get(inst,'prevText');prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,new Date(drawYear,drawMonth-stepMonths,1),this._getFormatConfig(inst)));var prev='<div class="ui-datepicker-prev">'+(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a onclick="jQuery.datepicker._adjustDate(\'#'+inst.id+'\', -'+stepMonths+', \'M\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'prevStatus')||'&#xa0;'):'')+'>'+prevText+'</a>':(hideIfNoPrevNext?'':'<label>'+prevText+'</label>'))+'</div>';var nextText=this._get(inst,'nextText');nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,new Date(drawYear,drawMonth+stepMonths,1),this._getFormatConfig(inst)));var next='<div class="ui-datepicker-next">'+(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a onclick="jQuery.datepicker._adjustDate(\'#'+inst.id+'\', +'+stepMonths+', \'M\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'nextStatus')||'&#xa0;'):'')+'>'+nextText+'</a>':(hideIfNoPrevNext?'':'<label>'+nextText+'</label>'))+'</div>';var currentText=this._get(inst,'currentText');currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,today,this._getFormatConfig(inst)));var html=(prompt?'<div class="'+this._promptClass+'">'+prompt+'</div>':'')+  
(closeAtTop&&!inst.inline?controls:'')+'<div class="ui-datepicker-links">'+(isRTL?next:prev)+  
(this._isInRange(inst,(this._get(inst,'gotoCurrent')&&inst.currentDay?currentDate:today))?'<div class="ui-datepicker-current">'+'<a onclick="jQuery.datepicker._gotoToday(\'#'+inst.id+'\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'currentStatus')||'&#xa0;'):'')+'>'+  
currentText+'</a></div>':'')+(isRTL?prev:next)+'</div>';var firstDay=this._get(inst,'firstDay');var changeFirstDay=this._get(inst,'changeFirstDay');var dayNames=this._get(inst,'dayNames');var dayNamesShort=this._get(inst,'dayNamesShort');var dayNamesMin=this._get(inst,'dayNamesMin');var monthNames=this._get(inst,'monthNames');var beforeShowDay=this._get(inst,'beforeShowDay');var highlightWeek=this._get(inst,'highlightWeek');var showOtherMonths=this._get(inst,'showOtherMonths');var showWeeks=this._get(inst,'showWeeks');var calculateWeek=this._get(inst,'calculateWeek')||this.iso8601Week;var status=(showStatus?this._get(inst,'dayStatus')||'&#xa0;':'');var dateStatus=this._get(inst,'statusForDate')||this.dateStatus;var endDate=inst.endDay?new Date(inst.endYear,inst.endMonth,inst.endDay):currentDate;for(var row=0;row<numMonths[0];row++)  
for(var col=0;col<numMonths[1];col++){var selectedDate=new Date(drawYear,drawMonth,inst.selectedDay);html+='<div class="ui-datepicker-one-month'+(col==0?' ui-datepicker-new-row':'')+'">'+  
this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,showStatus,monthNames)+'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>'+'<tr class="ui-datepicker-title-row">'+  
(showWeeks?'<td>'+this._get(inst,'weekHeader')+'</td>':'');for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;var dayStatus=(status.indexOf('DD')>-1?status.replace(/DD/,dayNames[day]):status.replace(/D/,dayNamesShort[day]));html+='<td'+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end-cell"':'')+'>'+  
(!changeFirstDay?'<span':'<a onclick="jQuery.datepicker._changeFirstDay(\'#'+inst.id+'\', '+day+');"')+  
(showStatus?this._addStatus(inst,dayStatus):'')+' title="'+dayNames[day]+'">'+  
dayNamesMin[day]+(changeFirstDay?'</a>':'</span>')+'</td>';}  
html+='</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth)  
inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var printDate=new Date(drawYear,drawMonth,1-leadDays);var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="ui-datepicker-days-row">'+  
(showWeeks?'<td class="ui-datepicker-week-col">'+calculateWeek(printDate)+'</td>':'');for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="ui-datepicker-days-cell'+  
((dow+firstDay+6)%7>=5?' ui-datepicker-week-end-cell':'')+  
(otherMonth?' ui-datepicker-otherMonth':'')+  
(printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth?' ui-datepicker-days-cell-over':'')+  
(unselectable?' '+this._unselectableClass:'')+  
(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+  
(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' '+this._currentClass:'')+  
(printDate.getTime()==today.getTime()?' ui-datepicker-today':''))+'"'+  
((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':'')+  
(unselectable?(highlightWeek?' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"'+' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"':''):' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')'+  
(highlightWeek?'.parent().addClass(\'ui-datepicker-week-over\')':'')+';'+  
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#ui-datepicker-status-'+  
inst.id+'\').html(\''+(dateStatus.apply((inst.input?inst.input[0]:null),[printDate,inst])||'&#xa0;')+'\');')+'"'+' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')'+  
(highlightWeek?'.parent().removeClass(\'ui-datepicker-week-over\')':'')+';'+  
(!showStatus||(otherMonth&&!showOtherMonths)?'':'jQuery(\'#ui-datepicker-status-'+  
inst.id+'\').html(\'&#xa0;\');')+'" onclick="jQuery.datepicker._selectDay(\'#'+  
inst.id+'\','+drawMonth+','+drawYear+', this);"')+'>'+  
(otherMonth?(showOtherMonths?printDate.getDate():'&#xa0;'):(unselectable?printDate.getDate():'<a>'+printDate.getDate()+'</a>'))+'</td>';printDate.setUTCDate(printDate.getUTCDate()+1);}  
html+='</tr>';}  
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}  
html+='</tbody></table></div>';}  
html+=(showStatus?'<div style="clear: both;"></div><div id="ui-datepicker-status-'+inst.id+'" class="ui-datepicker-status">'+(this._get(inst,'initStatus')||'&#xa0;')+'</div>':'')+  
(!closeAtTop&&!inst.inline?controls:'')+'<div style="clear: both;"></div>'+  
($.browser.msie&&parseInt($.browser.version)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>':'');return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,showStatus,monthNames){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var html='<div class="ui-datepicker-header">';if(secondary||!this._get(inst,'changeMonth'))  
html+=monthNames[drawMonth]+'&#xa0;';else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);html+='<select class="ui-datepicker-new-month" '+'onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'M\');" '+'onclick="jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'monthStatus')||'&#xa0;'):'')+'>';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth()))  
html+='<option value="'+month+'"'+  
(month==drawMonth?' selected="selected"':'')+'>'+monthNames[month]+'</option>';}  
html+='</select>';}  
if(secondary||!this._get(inst,'changeYear'))  
html+=drawYear;else{var years=this._get(inst,'yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10;}else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=endYear=new Date().getFullYear();year+=parseInt(years[0],10);endYear+=parseInt(years[1],10);}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);}  
year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-new-year" '+'onchange="jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'Y\');" '+'onclick="jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+  
(showStatus?this._addStatus(inst,this._get(inst,'yearStatus')||'&#xa0;'):'')+'>';for(;year<=endYear;year++){html+='<option value="'+year+'"'+  
(year==drawYear?' selected="selected"':'')+'>'+year+'</option>';}  
html+='</select>';}  
html+='</div>';return html;},_addStatus:function(inst,text){return' onmouseover="jQuery(\'#ui-datepicker-status-'+inst.id+'\').html(\''+text+'\');" '+'onmouseout="jQuery(\'#ui-datepicker-status-'+inst.id+'\').html(\'&#xa0;\');"';},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=='Y'?offset:0);var month=inst.drawMonth+(period=='M'?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+  
(period=='D'?offset:0);var date=new Date(year,month,day);var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=='M'||period=='Y')  
this._notifyChange(inst);},_notifyChange:function(inst){var onChange=this._get(inst,'onChangeMonthYear');if(onChange)  
onChange.apply((inst.input?inst.input[0]:null),[new Date(inst.selectedYear,inst.selectedMonth,1),inst]);},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,'numberOfMonths');return(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+'Date'),null);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);}  
return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date));},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1);if(offset<0)  
date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));return this._isInRange(inst,date);},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,'min');var maxDate=this._getMinMaxDate(inst,'max');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,'shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,'dayNamesShort'),dayNames:this._get(inst,'dayNames'),monthNamesShort:this._get(inst,'monthNamesShort'),monthNames:this._get(inst,'monthNames')};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;}  
var date=(day?(typeof day=='object'?day:new Date(year,month,day)):new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,'dateFormat'),date,this._getFormatConfig(inst));}});function extendRemove(target,props){$.extend(target,props);for(var name in props)  
if(props[name]==null||props[name]==undefined)  
target[name]=props[name];return target;};function isArray(a){return(a&&(($.browser.safari&&typeof a=='object'&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))));};$.fn.datepicker=function(options){var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=='string'&&(options=='isDisabled'||options=='getDate'))  
return $.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this[0]].concat(otherArgs));return this.each(function(){typeof options=='string'?$.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options);});};$.datepicker=new Datepicker();$(document).ready(function(){$(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);});})(jQuery);;(function($){$.effects=$.effects||{};$.extend($.effects,{save:function(el,set){for(var i=0;i<set.length;i++){if(set[i]!==null)$.data(el[0],"ec.storage."+set[i],el[0].style[set[i]]);}},restore:function(el,set){for(var i=0;i<set.length;i++){if(set[i]!==null)el.css(set[i],$.data(el[0],"ec.storage."+set[i]));}},setMode:function(el,mode){if(mode=='toggle')mode=el.is(':hidden')?'show':'hide';return mode;},getBaseline:function(origin,original){var y,x;switch(origin[0]){case'top':y=0;break;case'middle':y=0.5;break;case'bottom':y=1;break;default:y=origin[0]/original.height;};switch(origin[1]){case'left':x=0;break;case'center':x=0.5;break;case'right':x=1;break;default:x=origin[1]/original.width;};return{x:x,y:y};},createWrapper:function(el){if(el.parent().attr('id')=='fxWrapper')  
return el;var props={width:el.outerWidth({margin:true}),height:el.outerHeight({margin:true}),'float':el.css('float')};el.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var wrapper=el.parent();if(el.css('position')=='static'){wrapper.css({position:'relative'});el.css({position:'relative'});}else{var top=el.css('top');if(isNaN(parseInt(top)))top='auto';var left=el.css('left');if(isNaN(parseInt(left)))left='auto';wrapper.css({position:el.css('position'),top:top,left:left,zIndex:el.css('z-index')}).show();el.css({position:'relative',top:0,left:0});}  
wrapper.css(props);return wrapper;},removeWrapper:function(el){if(el.parent().attr('id')=='fxWrapper')  
return el.parent().replaceWith(el);return el;},setTransition:function(el,list,factor,val){val=val||{};$.each(list,function(i,x){unit=el.cssUnit(x);if(unit[0]>0)val[x]=unit[0]*factor+unit[1];});return val;},animateClass:function(value,duration,easing,callback){var cb=(typeof easing=="function"?easing:(callback?callback:null));var ea=(typeof easing=="object"?easing:null);return this.each(function(){var offset={};var that=$(this);var oldStyleAttr=that.attr("style")||'';if(typeof oldStyleAttr=='object')oldStyleAttr=oldStyleAttr["cssText"];if(value.toggle){that.hasClass(value.toggle)?value.remove=value.toggle:value.add=value.toggle;}  
var oldStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.addClass(value.add);if(value.remove)that.removeClass(value.remove);var newStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.removeClass(value.add);if(value.remove)that.addClass(value.remove);for(var n in newStyle){if(typeof newStyle[n]!="function"&&newStyle[n]&&n.indexOf("Moz")==-1&&n.indexOf("length")==-1&&newStyle[n]!=oldStyle[n]&&(n.match(/color/i)||(!n.match(/color/i)&&!isNaN(parseInt(newStyle[n],10))))&&(oldStyle.position!="static"||(oldStyle.position=="static"&&!n.match(/left|top|bottom|right/))))offset[n]=newStyle[n];}  
that.animate(offset,duration,ea,function(){if(typeof $(this).attr("style")=='object'){$(this).attr("style")["cssText"]="";$(this).attr("style")["cssText"]=oldStyleAttr;}else $(this).attr("style",oldStyleAttr);if(value.add)$(this).addClass(value.add);if(value.remove)$(this).removeClass(value.remove);if(cb)cb.apply(this,arguments);});});}});$.fn.extend({_show:$.fn.show,_hide:$.fn.hide,__toggle:$.fn.toggle,_addClass:$.fn.addClass,_removeClass:$.fn.removeClass,_toggleClass:$.fn.toggleClass,effect:function(fx,o,speed,callback){return $.effects[fx]?$.effects[fx].call(this,{method:fx,options:o||{},duration:speed,callback:callback}):null;},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])))  
return this._show.apply(this,arguments);else{var o=arguments[1]||{};o['mode']='show';return this.effect.apply(this,[arguments[0],o,arguments[2]||o.duration,arguments[3]||o.callback]);}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])))  
return this._hide.apply(this,arguments);else{var o=arguments[1]||{};o['mode']='hide';return this.effect.apply(this,[arguments[0],o,arguments[2]||o.duration,arguments[3]||o.callback]);}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0]))||(arguments[0].constructor==Function))  
return this.__toggle.apply(this,arguments);else{var o=arguments[1]||{};o['mode']='toggle';return this.effect.apply(this,[arguments[0],o,arguments[2]||o.duration,arguments[3]||o.callback]);}},addClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{add:classNames},speed,easing,callback]):this._addClass(classNames);},removeClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{remove:classNames},speed,easing,callback]):this._removeClass(classNames);},toggleClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{toggle:classNames},speed,easing,callback]):this._toggleClass(classNames);},morph:function(remove,add,speed,easing,callback){return $.effects.animateClass.apply(this,[{add:add,remove:remove},speed,easing,callback]);},switchClass:function(){return this.morph.apply(this,arguments);},cssUnit:function(key){var style=this.css(key),val=[];$.each(['em','px','%','pt'],function(i,unit){if(style.indexOf(unit)>0)  
val=[parseFloat(style),unit];});return val;}});jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}  
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)  
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))  
return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))  
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))  
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))  
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];if(result=/rgba\(0, 0, 0, 0\)/.exec(color))  
return colors['transparent']  
return colors[jQuery.trim(color).toLowerCase()];}  
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))  
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}  
else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}  
else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;}  
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}});})(jQuery);(function($){$.effects.blind=function(o){return this.queue(function(){var el=$(this),props=['position','top','left'];var mode=$.effects.setMode(el,o.options.mode||'hide');var direction=o.options.direction||'vertical';$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:'hidden'});var ref=(direction=='vertical')?'height':'width';var distance=(direction=='vertical')?wrapper.height():wrapper.width();if(mode=='show')wrapper.css(ref,0);var animation={};animation[ref]=mode=='show'?distance:0;wrapper.animate(animation,o.duration,o.options.easing,function(){if(mode=='hide')el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue();});});};})(jQuery);(function($){$.effects.bounce=function(o){return this.queue(function(){var el=$(this),props=['position','top','left'];var mode=$.effects.setMode(el,o.options.mode||'effect');var direction=o.options.direction||'up';var distance=o.options.distance||20;var times=o.options.times||5;var speed=o.duration||250;if(/show|hide/.test(mode))props.push('opacity');$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=(direction=='up'||direction=='down')?'top':'left';var motion=(direction=='up'||direction=='left')?'pos':'neg';var distance=o.options.distance||(ref=='top'?el.outerHeight({margin:true})/3:el.outerWidth({margin:true})/3);if(mode=='show')el.css('opacity',0).css(ref,motion=='pos'?-distance:distance);if(mode=='hide')distance=distance/(times*2);if(mode!='hide')times--;if(mode=='show'){var animation={opacity:1};animation[ref]=(motion=='pos'?'+=':'-=')+distance;el.animate(animation,speed/2,o.options.easing);distance=distance/2;times--;};for(var i=0;i<times;i++){var animation1={},animation2={};animation1[ref]=(motion=='pos'?'-=':'+=')+distance;animation2[ref]=(motion=='pos'?'+=':'-=')+distance;el.animate(animation1,speed/2,o.options.easing).animate(animation2,speed/2,o.options.easing);distance=(mode=='hide')?distance*2:distance/2;};if(mode=='hide'){var animation={opacity:0};animation[ref]=(motion=='pos'?'-=':'+=')+distance;el.animate(animation,speed/2,o.options.easing,function(){el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);});}else{var animation1={},animation2={};animation1[ref]=(motion=='pos'?'-=':'+=')+distance;animation2[ref]=(motion=='pos'?'+=':'-=')+distance;el.animate(animation1,speed/2,o.options.easing).animate(animation2,speed/2,o.options.easing,function(){$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);});};el.queue('fx',function(){el.dequeue();});el.dequeue();});};})(jQuery);(function($){$.effects.clip=function(o){return this.queue(function(){var el=$(this),props=['position','top','left','height','width'];var mode=$.effects.setMode(el,o.options.mode||'hide');var direction=o.options.direction||'vertical';$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:'hidden'});var animate=el[0].tagName=='IMG'?wrapper:el;var ref={size:(direction=='vertical')?'height':'width',position:(direction=='vertical')?'top':'left'};var distance=(direction=='vertical')?animate.height():animate.width();if(mode=='show'){animate.css(ref.size,0);animate.css(ref.position,distance/2);}  
var animation={};animation[ref.size]=mode=='show'?distance:0;animation[ref.position]=mode=='show'?0:distance/2;animate.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=='hide')el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.drop=function(o){return this.queue(function(){var el=$(this),props=['position','top','left','opacity'];var mode=$.effects.setMode(el,o.options.mode||'hide');var direction=o.options.direction||'left';$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=(direction=='up'||direction=='down')?'top':'left';var motion=(direction=='up'||direction=='left')?'pos':'neg';var distance=o.options.distance||(ref=='top'?el.outerHeight({margin:true})/2:el.outerWidth({margin:true})/2);if(mode=='show')el.css('opacity',0).css(ref,motion=='pos'?-distance:distance);var animation={opacity:mode=='show'?1:0};animation[ref]=(mode=='show'?(motion=='pos'?'+=':'-='):(motion=='pos'?'-=':'+='))+distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=='hide')el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.explode=function(o){return this.queue(function(){var rows=o.options.pieces?Math.round(Math.sqrt(o.options.pieces)):3;var cells=o.options.pieces?Math.round(Math.sqrt(o.options.pieces)):3;o.options.mode=o.options.mode=='toggle'?($(this).is(':visible')?'hide':'show'):o.options.mode;var el=$(this).show().css('visibility','hidden');var offset=el.offset();offset.top-=parseInt(el.css("marginTop"))||0;offset.left-=parseInt(el.css("marginLeft"))||0;var width=el.outerWidth(true);var height=el.outerHeight(true);for(var i=0;i<rows;i++){for(var j=0;j<cells;j++){el.clone().appendTo('body').wrap('<div></div>').css({position:'absolute',visibility:'visible',left:-j*(width/cells),top:-i*(height/rows)}).parent().addClass('effects-explode').css({position:'absolute',overflow:'hidden',width:width/cells,height:height/rows,left:offset.left+j*(width/cells)+(o.options.mode=='show'?(j-Math.floor(cells/2))*(width/cells):0),top:offset.top+i*(height/rows)+(o.options.mode=='show'?(i-Math.floor(rows/2))*(height/rows):0),opacity:o.options.mode=='show'?0:1}).animate({left:offset.left+j*(width/cells)+(o.options.mode=='show'?0:(j-Math.floor(cells/2))*(width/cells)),top:offset.top+i*(height/rows)+(o.options.mode=='show'?0:(i-Math.floor(rows/2))*(height/rows)),opacity:o.options.mode=='show'?1:0},o.duration||500);}}  
setTimeout(function(){o.options.mode=='show'?el.css({visibility:'visible'}):el.css({visibility:'visible'}).hide();if(o.callback)o.callback.apply(el[0]);el.dequeue();$('.effects-explode').remove();},o.duration||500);});};})(jQuery);(function($){$.effects.fold=function(o){return this.queue(function(){var el=$(this),props=['position','top','left'];var mode=$.effects.setMode(el,o.options.mode||'hide');var size=o.options.size||15;var horizFirst=!(!o.options.horizFirst);$.effects.save(el,props);el.show();var wrapper=$.effects.createWrapper(el).css({overflow:'hidden'});var widthFirst=((mode=='show')!=horizFirst);var ref=widthFirst?['width','height']:['height','width'];var distance=widthFirst?[wrapper.width(),wrapper.height()]:[wrapper.height(),wrapper.width()];var percent=/([0-9]+)%/.exec(size);if(percent)size=parseInt(percent[1])/100*distance[mode=='hide'?0:1];if(mode=='show')wrapper.css(horizFirst?{height:0,width:size}:{height:size,width:0});var animation1={},animation2={};animation1[ref[0]]=mode=='show'?distance[0]:size;animation2[ref[1]]=mode=='show'?distance[1]:0;wrapper.animate(animation1,o.duration/2,o.options.easing).animate(animation2,o.duration/2,o.options.easing,function(){if(mode=='hide')el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(el[0],arguments);el.dequeue();});});};})(jQuery);;(function($){$.effects.highlight=function(o){return this.queue(function(){var el=$(this),props=['backgroundImage','backgroundColor','opacity'];var mode=$.effects.setMode(el,o.options.mode||'show');var color=o.options.color||"#ffff99";var oldColor=el.css("backgroundColor");$.effects.save(el,props);el.show();el.css({backgroundImage:'none',backgroundColor:color});var animation={backgroundColor:oldColor};if(mode=="hide")animation['opacity']=0;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide")el.hide();$.effects.restore(el,props);if(mode=="show"&&jQuery.browser.msie)this.style.removeAttribute('filter');if(o.callback)o.callback.apply(this,arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.pulsate=function(o){return this.queue(function(){var el=$(this);var mode=$.effects.setMode(el,o.options.mode||'show');var times=o.options.times||5;if(mode=='hide')times--;if(el.is(':hidden')){el.css('opacity',0);el.show();el.animate({opacity:1},o.duration/2,o.options.easing);times=times-2;}  
for(var i=0;i<times;i++){el.animate({opacity:0},o.duration/2,o.options.easing).animate({opacity:1},o.duration/2,o.options.easing);};if(mode=='hide'){el.animate({opacity:0},o.duration/2,o.options.easing,function(){el.hide();if(o.callback)o.callback.apply(this,arguments);});}else{el.animate({opacity:0},o.duration/2,o.options.easing).animate({opacity:1},o.duration/2,o.options.easing,function(){if(o.callback)o.callback.apply(this,arguments);});};el.queue('fx',function(){el.dequeue();});el.dequeue();});};})(jQuery);(function($){$.effects.puff=function(o){return this.queue(function(){var el=$(this);var options=$.extend(true,{},o.options);var mode=$.effects.setMode(el,o.options.mode||'hide');var percent=parseInt(o.options.percent)||150;options.fade=true;var original={height:el.height(),width:el.width()};var factor=percent/100;el.from=(mode=='hide')?original:{height:original.height*factor,width:original.width*factor};options.from=el.from;options.percent=(mode=='hide')?percent:100;options.mode=mode;el.effect('scale',options,o.duration,o.callback);el.dequeue();});};$.effects.scale=function(o){return this.queue(function(){var el=$(this);var options=$.extend(true,{},o.options);var mode=$.effects.setMode(el,o.options.mode||'effect');var percent=parseInt(o.options.percent)||(parseInt(o.options.percent)==0?0:(mode=='hide'?0:100));var direction=o.options.direction||'both';var origin=o.options.origin;if(mode!='effect'){options.origin=origin||['middle','center'];options.restore=true;}  
var original={height:el.height(),width:el.width()};el.from=o.options.from||(mode=='show'?{height:0,width:0}:original);var factor={y:direction!='horizontal'?(percent/100):1,x:direction!='vertical'?(percent/100):1};el.to={height:original.height*factor.y,width:original.width*factor.x};if(o.options.fade){if(mode=='show'){el.from.opacity=0;el.to.opacity=1;};if(mode=='hide'){el.from.opacity=1;el.to.opacity=0;};};options.from=el.from;options.to=el.to;options.mode=mode;el.effect('size',options,o.duration,o.callback);el.dequeue();});};$.effects.size=function(o){return this.queue(function(){var el=$(this),props=['position','top','left','width','height','overflow','opacity'];var props1=['position','top','left','overflow','opacity'];var props2=['width','height','overflow'];var cProps=['fontSize'];var vProps=['borderTopWidth','borderBottomWidth','paddingTop','paddingBottom'];var hProps=['borderLeftWidth','borderRightWidth','paddingLeft','paddingRight'];var mode=$.effects.setMode(el,o.options.mode||'effect');var restore=o.options.restore||false;var scale=o.options.scale||'both';var origin=o.options.origin;var original={height:el.height(),width:el.width()};el.from=o.options.from||original;el.to=o.options.to||original;if(origin){var baseline=$.effects.getBaseline(origin,original);el.from.top=(original.height-el.from.height)*baseline.y;el.from.left=(original.width-el.from.width)*baseline.x;el.to.top=(original.height-el.to.height)*baseline.y;el.to.left=(original.width-el.to.width)*baseline.x;};var factor={from:{y:el.from.height/original.height,x:el.from.width/original.width},to:{y:el.to.height/original.height,x:el.to.width/original.width}};if(scale=='box'||scale=='both'){if(factor.from.y!=factor.to.y){props=props.concat(vProps);el.from=$.effects.setTransition(el,vProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,vProps,factor.to.y,el.to);};if(factor.from.x!=factor.to.x){props=props.concat(hProps);el.from=$.effects.setTransition(el,hProps,factor.from.x,el.from);el.to=$.effects.setTransition(el,hProps,factor.to.x,el.to);};};if(scale=='content'||scale=='both'){if(factor.from.y!=factor.to.y){props=props.concat(cProps);el.from=$.effects.setTransition(el,cProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,cProps,factor.to.y,el.to);};};$.effects.save(el,restore?props:props1);el.show();$.effects.createWrapper(el);el.css('overflow','hidden').css(el.from);if(scale=='content'||scale=='both'){vProps=vProps.concat(['marginTop','marginBottom']).concat(cProps);hProps=hProps.concat(['marginLeft','marginRight']);props2=props.concat(vProps).concat(hProps);el.find("*[width]").each(function(){child=$(this);if(restore)$.effects.save(child,props2);var c_original={height:child.height(),width:child.width()};child.from={height:c_original.height*factor.from.y,width:c_original.width*factor.from.x};child.to={height:c_original.height*factor.to.y,width:c_original.width*factor.to.x};if(factor.from.y!=factor.to.y){child.from=$.effects.setTransition(child,vProps,factor.from.y,child.from);child.to=$.effects.setTransition(child,vProps,factor.to.y,child.to);};if(factor.from.x!=factor.to.x){child.from=$.effects.setTransition(child,hProps,factor.from.x,child.from);child.to=$.effects.setTransition(child,hProps,factor.to.x,child.to);};child.css(child.from);child.animate(child.to,o.duration,o.options.easing,function(){if(restore)$.effects.restore(child,props2);});});};el.animate(el.to,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=='hide')el.hide();$.effects.restore(el,restore?props:props1);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.shake=function(o){return this.queue(function(){var el=$(this),props=['position','top','left'];var mode=$.effects.setMode(el,o.options.mode||'effect');var direction=o.options.direction||'left';var distance=o.options.distance||20;var times=o.options.times||3;var speed=o.duration||o.options.duration||140;$.effects.save(el,props);el.show();$.effects.createWrapper(el);var ref=(direction=='up'||direction=='down')?'top':'left';var motion=(direction=='up'||direction=='left')?'pos':'neg';var animation={},animation1={},animation2={};animation[ref]=(motion=='pos'?'-=':'+=')+distance;animation1[ref]=(motion=='pos'?'+=':'-=')+distance*2;animation2[ref]=(motion=='pos'?'-=':'+=')+distance*2;el.animate(animation,speed,o.options.easing);for(var i=1;i<times;i++){el.animate(animation1,speed,o.options.easing).animate(animation2,speed,o.options.easing);};el.animate(animation1,speed,o.options.easing).animate(animation,speed/2,o.options.easing,function(){$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);});el.queue('fx',function(){el.dequeue();});el.dequeue();});};})(jQuery);(function($){$.effects.slide=function(o){return this.queue(function(){var el=$(this),props=['position','top','left'];var mode=$.effects.setMode(el,o.options.mode||'show');var direction=o.options.direction||'left';$.effects.save(el,props);el.show();$.effects.createWrapper(el).css({overflow:'hidden'});var ref=(direction=='up'||direction=='down')?'top':'left';var motion=(direction=='up'||direction=='left')?'pos':'neg';var distance=o.options.distance||(ref=='top'?el.outerHeight({margin:true}):el.outerWidth({margin:true}));if(mode=='show')el.css(ref,motion=='pos'?-distance:distance);var animation={};animation[ref]=(mode=='show'?(motion=='pos'?'+=':'-='):(motion=='pos'?'-=':'+='))+distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=='hide')el.hide();$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback)o.callback.apply(this,arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.transfer=function(o){return this.queue(function(){var el=$(this);var mode=$.effects.setMode(el,o.options.mode||'effect');var target=$(o.options.to);var position=el.offset();var transfer=$('<div class="ui-effects-transfer"></div>').appendTo(document.body);if(o.options.className)transfer.addClass(o.options.className);transfer.addClass(o.options.className);transfer.css({top:position.top,left:position.left,height:el.outerHeight()-parseInt(transfer.css('borderTopWidth'))-parseInt(transfer.css('borderBottomWidth')),width:el.outerWidth()-parseInt(transfer.css('borderLeftWidth'))-parseInt(transfer.css('borderRightWidth')),position:'absolute'});position=target.offset();animation={top:position.top,left:position.left,height:target.outerHeight()-parseInt(transfer.css('borderTopWidth'))-parseInt(transfer.css('borderBottomWidth')),width:target.outerWidth()-parseInt(transfer.css('borderLeftWidth'))-parseInt(transfer.css('borderRightWidth'))};transfer.animate(animation,o.duration,o.options.easing,function(){transfer.remove();if(o.callback)o.callback.apply(el[0],arguments);el.dequeue();});});};})(jQuery);  
 
(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);}  
if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications[this.notifications.length]={message:message,options:o};o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification'+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'"><div class="close">'+o.closeTemplate+'</div><div class="header">'+o.header+'</div><div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();(o.glue=='after')?$('div.jGrowl-notification:last',this.element).after(notification):$('div.jGrowl-notification:first',this.element).before(notification);$(notification).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind('jGrowl.beforeOpen',function(){o.beforeOpen.apply(self.element,[self.element,message,o]);}).bind('jGrowl.open',function(){o.open.apply(self.element,[self.element,message,o]);}).bind('jGrowl.beforeClose',function(){o.beforeClose.apply(self.element,[self.element,message,o]);}).bind('jGrowl.close',function(){$(this).data('jGrowl').pause=true;$(this).trigger('jGrowl.beforeClose').animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();o.close.apply(self.element,[self.element,message,o]);});}).trigger('jGrowl.beforeOpen').animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger('jGrowl.open');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',this.element).size()>1&&$('div.jGrowl-closer',this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer))self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).trigger('jGrowl.close');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool)){this.render(this.notifications.shift());}  
if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});};},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"])$(this.element).addClass('ie6');},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);  
/**  
* @classDescription The Mapifies variable is the main class object for jMaps  
*/  
var Mapifies;  
 
if (!Mapifies) Mapifies = {};  
 
/**  
* The main object that holds the maps  
*/  
Mapifies.MapObjects = {};  
 
/**  
* Creates a new map on the passed element with the defined options. Creates a global object that contains the map.  
* @method  
* @namespace Mapifies.MapObjects  
* @id Mapifies.MapObjects.Set  
* @alias Mapifies.MapObjects.Set  
* @param {jQuery} element The element that contains the map.  
* @param {Object} options An object that contains the options.  
* @return {Object} The object that contains the map.  
*/  
Mapifies.MapObjects.Set = function ( element, options ) {  
var mapName = jQuery(element).attr('id');  
var thisMap = new GMap2(element);  
Mapifies.MapObjects[mapName] = thisMap;  
Mapifies.MapObjects[mapName].Options = options;  
return Mapifies.MapObjects[mapName];  
};  
 
/**  
* Adds additional objects and functions to an existing MapObject  
* @method  
* @namespace Mapifies.MapObjects  
* @id Mapifies.MapObjects.Append  
* @alias Mapifies.MapObjects.Append  
* @param {jQuery} element The element that contains the map  
* @param {Object} description The name of the object to create  
* @param {Object} appending The object or function to append  
*/  
Mapifies.MapObjects.Append = function ( element, description, appending ) {  
var mapName = jQuery(element).attr('id');  
Mapifies.MapObjects[mapName][description] = appending;  
};  
 
/**  
* Returns the current map object for the passed element  
* @method  
* @namespace Mapifies.MapObjects  
* @id Mapifies.MapObjects.Get  
* @alias Mapifies.MapObjects.Get  
* @param {jQuery} element The element that contains the map.  
* @return {Object} Mapifies The Mapifies object that contains the map.  
*/  
Mapifies.MapObjects.Get = function ( element ) {  
return Mapifies.MapObjects[jQuery(element).attr('id')];  
};  
 
/**  
* The main function to initialise the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.Initialise  
* @alias Mapifies.Initialise  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Object} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the map object and options.  
*/  
Mapifies.Initialise = function ( element, options, callback ) {  
/**  
* Default options for Initialise  
* @method  
* @namespace Mapifies.Initialise  
* @id Mapifies.Initialise.defaults  
* @alias Mapifies.Initialise.defaults  
* @param {String} language The locale language for the map  
* @param {String} mapType The type of map to create. Options are 'map' (default), 'sat' and 'hybrid'.  
* @param {Object} mapCenter An array that contains the Lat/Lng coordinates of the map center.  
* @param {Number} mapZoom The initial zoom level of the map.  
* @param {String} mapControl The option for the map control. The options are 'small' (default), 'large' or 'none'  
* @param {Boolean} mapEnableType Defines if the buttons for map type are shown. Default false.  
* @param {Boolean} mapEnableOverview Defines if the map overview is shown. Default false.  
* @param {Boolean} mapEnableDragging Defines if the map is draggable or not. Default true.  
* @param {Boolean} mapEnableInfoWindows Defines if info windows are shown on the map or not. Default true.  
* @param {Boolean} mapEnableDoubleClickZoom Defines if double clicking zooms the map. Default false.  
* @param {Boolean} mapEnableSmoothZoom Defines if smooth scrolling is enabled. Default false.  
* @param {Boolean} mapEnableGoogleBar Defines if the google map search tool is enabled. Default false.  
* @param {Boolean} mapEnableScaleControl Defines if the scale bar is shown. Default false.  
* @param {Boolean} mapShowjMapsIcon Defines if the jMaps icon is shown. Default true.  
* @param {Boolean} debugMode Defines if the map object created is returned to the Firebug console. Default false.  
* @return {Object} The options for SearchAddress  
*/  
function defaults() {  
return {  
// Initial type of map to display  
'language': 'en',  
// Options: "map", "sat", "hybrid"  
'mapType': 'map',  
// Initial map center  
'mapCenter': [55.958858,-3.162302],  
// Initial zoom level  
'mapZoom': 12,  
// Initial map control size  
// Options: "large", "small", "none"  
'mapControl': 'small',  
// Initialise type of map control  
'mapEnableType': false,  
// Initialise small map overview  
'mapEnableOverview': false,  
// Enable map dragging when left button held down  
'mapEnableDragging': true,  
// Enable map info windows  
'mapEnableInfoWindows': true,  
// Enable double click zooming  
'mapEnableDoubleClickZoom': false,  
// Enable zooming with scroll wheel  
'mapEnableScrollZoom': false,  
// Enable smooth zoom  
'mapEnableSmoothZoom': false,  
// Enable Google Bar  
'mapEnableGoogleBar': false,  
// Enables scale bar  
'mapEnableScaleControl': false,  
// Enable the Mapifies icon  
'mapShowjMapsIcon': true,  
//Debug Mode  
'debugMode': false  
};  
};  
options = jQuery.extend(defaults(), options);  
 
if (GBrowserIsCompatible()) {  
 
var thisMap = Mapifies.MapObjects.Set(element, options);  
var mapType = Mapifies.GetMapType(options.mapType);  
thisMap.setCenter(new GLatLng(options.mapCenter[0], options.mapCenter[1]), options.mapZoom, mapType);  
 
if (options.mapShowjMapsIcon) {  
Mapifies.AddScreenOverlay(element,  
{  
'imageUrl':'http://hg.digitalspaghetti.me.uk/jmaps/raw-file/3228fade0b3c/docs/images/jmaps-mapicon.png',  
'screenXY':[70,10],  
'overlayXY':[0,0],  
'size':[42,25]  
}  
);  
}  
 
// Attach a controller to the map view  
// Will attach a large or small. If any other value passed (i.e. "none") it is ignored  
switch (options.mapControl) {  
case "small":  
thisMap.addControl(new GSmallMapControl());  
break;  
case "large":  
thisMap.addControl(new GLargeMapControl());  
break;  
};  
// Type of map Control (Map,Sat,Hyb)  
if (options.mapEnableType)  
thisMap.addControl(new GMapTypeControl()); // Off by default  
// Show the small overview map  
if (options.mapEnableOverview)  
thisMap.addControl(new GOverviewMapControl());// Off by default  
// GMap2 Functions (in order of the docs for clarity)  
// Enable a mouse-dragable map  
if (!options.mapEnableDragging)  
thisMap.disableDragging(); // On by default  
// Enable Info Windows  
if (!options.mapEnableInfoWindows)  
thisMap.disableInfoWindow(); // On by default  
// Enable double click zoom on the map  
if (options.mapEnableDoubleClickZoom)  
thisMap.enableDoubleClickZoom(); // On by default  
// Enable scrollwheel on the map  
if (options.mapEnableScrollZoom)  
thisMap.enableScrollWheelZoom(); //Off by default  
// Enable smooth zooming  
if (options.mapEnableSmoothZoom)  
thisMap.enableContinuousZoom(); // Off by default  
// Enable Google Bar  
if (options.mapEnableGoogleBar)  
thisMap.enableGoogleBar(); //Off by default  
// Enables Scale bar  
if (options.mapEnableScaleControl)  
thisMap.addControl(new GScaleControl());  
 
if (options.debugMode)  
console.log(Mapifies);  
 
if (typeof callback == 'function')  
return callback(thisMap, element, options);  
} else {  
jQuery(element).text('Your browser does not support Google Maps.');  
return false;  
}  
return;  
};  
 
/**  
* A function to move a map to a passed position  
* @method  
* @namespace Mapifies  
* @id Mapifies.MoveTo  
* @alias Mapifies.MoveTo  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Object} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the map object and options or true.  
*/  
Mapifies.MoveTo = function ( element, options, callback ) {  
/**  
* Default options for MoveTo  
* @method  
* @namespace Mapifies  
* @id Mapifies.MoveTo  
* @alias Mapifies.MoveTo  
* @param {String} centerMethod The element to initialise the map on.  
* @param {String} mapType The type of map to create. Options are 'map' (default), 'sat' and 'hybrid'.  
* @param {Object} mapCenter An array that contains the Lat/Lng coordinates of the map center.  
* @param {Number} mapZoom The initial zoom level of the map.  
* @return {Function} callback The callback option with the point object and options or true.  
*/  
function defaults() {  
return {  
'centerMethod': 'normal',  
'mapType': null,  
'mapCenter': [],  
'mapZoom': null  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
if (options.mapType)  
var mapType = Mapifies.GetMapType(options.mapType);  
var point = new GLatLng(options.mapCenter[0], options.mapCenter[1]);  
switch (options.centerMethod) {  
case 'normal':  
thisMap.setCenter(point, options.mapZoom, mapType);  
break;  
case 'pan':  
thisMap.panTo(point);  
break;  
}  
if (typeof callback == 'function') return callback(point, options);  
};  
 
/**  
* Save your current position on the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.SavePosition  
* @alias Mapifies.SavePosition  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Object} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the map object and options or true.  
*/  
Mapifies.SavePosition = function( element, options, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.savePosition();  
if (typeof callback == 'function') return callback(thisMap);  
};  
 
/**  
* Goto a previously saved position  
* @method  
* @namespace Mapifies  
* @id Mapifies.GotoSavedPosition  
* @alias Mapifies.GotoSavedPosition  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the map object and options or true.  
*/  
Mapifies.GotoSavedPosition = function ( element, options, callback) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.returnToSavedPosition();  
if (typeof callback == 'function') return callback(thisMap);  
};  
 
/**  
* Create a keyboard handler to handle keyboard navigation  
* @method  
* @namespace Mapifies  
* @id Mapifies.CreateKeyboardHandler  
* @alias Mapifies.CreateKeyboardHandler  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Object} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the keyboard handler.  
*/  
Mapifies.CreateKeyboardHandler = function( element, options, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
var keyboardHandler = new GKeyboardHandler(thisMap);  
if (typeof callback == 'function') return callback(keyboardHandler);  
};  
 
/**  
* Check if a map container element has been resized or toggled from show/hide (Added r68)  
* @method  
* @namespace Mapifies  
* @id Mapifies.CheckResize  
* @alias Mapifies.CheckResize  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Object} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the map object handler.  
*/  
Mapifies.CheckResize = function( element, options, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.checkResize();  
if (typeof callback == 'function') return callback(element);  
};  
 
/**  
* The SearchAddress function takes a map, options and callback function. The options can contain either an address string, to which a point is returned - or reverse geocoding a GLatLng, where an address is returned  
* @method  
* @namespace Mapifies  
* @id Mapifies.SearchAddress  
* @param {jQuery} element The jQuery object containing the map element.  
* @param {Object} options An object of options  
* @param {Function} callback The callback function that returns the result  
* @return {Function} Returns a passed callback function or true if no callback specified  
*/  
Mapifies.SearchAddress = function( element, options, callback) {  
/**  
* Default options for SearchAddress  
* @method  
* @namespace Mapifies.SearchAddress  
* @id Mapifies.SearchAddress.defaults  
* @alias Mapifies.SearchAddress.defaults  
* @param {String} query The Address or GLatLng to query in the geocoder  
* @param {String} returnType The type of value you want to return from Google. This is mapped to the function names available, the options are 'getLatLng' which returns coordinates, and 'getLocations' which returns points.  
* @param {GGeoCache} cache The GGeoCache to store the results in if required  
* @param {String} countryCode The country code to localise results  
* @return {Object} The options for SearchAddress  
*/  
function defaults() {  
return {  
// Address to search for  
'query': null,  
// Return Type  
'returnType': 'getLatLng',  
// Optional Cache to store Geocode Data (not implemented yet)  
'cache': undefined,  
// Country code for localisation (not implemented yet)  
'countryCode': 'uk'  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
// Check to see if the Geocoder already exists in the object  
// or create a temporary locally scoped one.  
if (typeof thisMap.Geocoder === 'undefined') {  
if (typeof options.cache === 'undefined') {  
var geoCoder = new GClientGeocoder();  
} else {  
var geoCoder = new GClientGeocoder(cache);  
}  
Mapifies.MapObjects.Append(element, 'Geocoder', geoCoder);  
// We need to get the map object again, now we have attached the geocoder  
thisMap = Mapifies.MapObjects.Get(element);  
}  
thisMap.Geocoder[options.returnType](options.query, function(result){  
if (typeof callback === 'function') {  
return callback(result, options);  
}  
});  
return;  
};  
 
/**  
* The SearchDirections function allows you to search for directions between two or more points and return it to a map and a directions panel  
* @method  
* @namespace Mapifies  
* @id Mapifies.SearchDirections  
* @param {jQuery} element The jQuery object containing the map element.  
* @param {Object} options An object of options  
* @param {Function} callback The callback function that returns the result  
* @return {Function} Returns a passed callback function or true if no callback specified  
*/  
Mapifies.SearchDirections = function( element, options, callback) {  
/**  
* Default options for SearchDirections  
* @method  
* @namespace Mapifies.SearchDirections  
* @id Mapifies.SearchDirections.defaults  
* @alias Mapifies.SearchDirections.defaults  
* @param {String} query The directions query to parse. Must contain one 'from:' and one 'to:' query, but can contain multiple 'to:' queries.  
* @param {String} panel The ID of the panel that the directions will be sent to.  
* @param {String} local The local for the directions.  
* @param {String} travelMode Allows you to specify the travel mode, either 'driving' or 'walking'. Driving is the default.  
* @param {Boolean} avoidHighways Allows you to avoid Highways/Motorway's on trips. Please note this may not always be possible depending on the route.  
* @param {Boolean} getPolyline Decides if the returned result will draw a polyline on the map on the journey. Default is True.  
* @param {Boolean} getSteps Decides if the textual directions are returned to the directions panel.  
* @param {Boolean} preserveViewport Decides if the map will zoom and center in on the directions results.  
* @param {Boolean} clearLastSearch Clears the last direction search if you do not want to have multiple points.  
* @return {Object} The options for SearchDirections  
*/  
function defaults() {  
return {  
// From address  
'query': null,  
// Optional panel to show text directions  
'panel': null,  
//The locale to use for the directions result.  
'locale': 'en_GB',  
//The mode of travel, such as driving (default) or walking  
'travelMode': 'driving',  
// Option to avoid highways  
'avoidHighways': false,  
// Get polyline  
'getPolyline': true,  
// Get directions  
'getSteps': true,  
// Preserve Viewport  
'preserveViewport' : false,  
// clear last search  
'clearLastSearch' : false  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var queryOptions = {  
'locale': options.locale,  
'travelMode': options.travelMode,  
'avoidHighways': options.avoidHighways,  
'getPolyline': options.getPolyline,  
'getSteps': options.getSteps,  
'preserveViewport' : options.preserveViewport  
};  
 
var panel = $(options.panel).get(0);  
 
if (typeof thisMap.Directions === 'undefined') {  
Mapifies.MapObjects.Append(element, 'Directions', new GDirections(thisMap, panel));  
}  
 
GEvent.addListener(thisMap.Directions, "load", onLoad);  
GEvent.addListener(thisMap.Directions, "error", onError);  
 
if (options.clearLastSearch) {  
thisMap.Directions.clear();  
}  
 
thisMap.Directions.load(options.query, queryOptions);  
 
function onLoad() {  
if (typeof callback == 'function') return callback(thisMap.Directions, options);  
}  
 
function onError() {  
if (typeof callback == 'function') return callback(thisMap.Directions, options);  
}  
 
return;  
};  
 
/**  
* Create an adsense ads manager for the map. The Adsense manager will parse your page and show adverts on the map that relate to this. Requires your adsense publisher id and channel  
* @method  
* @namespace Mapifies  
* @id Mapifies.CreateAdsManager  
* @param {jQuery} element The jQuery object containing the map element.  
* @param {Object} options An object of options  
* @param {Function} callback The callback function that returns the result  
* @return {Function} Returns a passed callback function or true if no callback specified  
*/  
 
Mapifies.CreateAdsManager = function( element, options, callback) {  
/**  
* Default options for CreateAdsManager  
* @method  
* @namespace Mapifies.CreateAdsManager  
* @id Mapifies.CreateAdsManager.defaults  
* @alias Mapifies.CreateAdsManager.defaults  
* @param {String} publisherId Your Adsense publisher ID  
* @param {Number} maxAdsOnMap The maximum number of ads to show on the map at one time  
* @param {Number} channel The AdSense channel this belongs to  
* @param {Number} minZoomLevel The minimum zoom level to begin showing ads at  
* @return {Object} The options for CreateAdsManager  
*/  
function defaults() {  
return {  
'publisherId':'',  
'maxAdsOnMap':3,  
'channel':0,  
'minZoomLevel':6  
}  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var adsOptions = {  
'maxAdsOnMap':options.maxAdsOnMap,  
'channel':options.channel,  
'minZoomLevel':options.minZoomLevel  
}  
 
if (typeof thisMap.AdsManager == 'undefined') {  
Mapifies.MapObjects.Append(element, 'AdsManager', new GAdsManager(thisMap, options.publisherId, adsOptions));  
}  
 
if (typeof callback == 'function') return callback(thisMap.AdsManager, options);  
};  
/**  
* This function allows you to pass a GeoXML or KML feed to a Google map.  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddFeed  
* @alias Mapifies.AddFeed  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Fucntion} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the feed object and options.  
*/  
Mapifies.AddFeed = function( element, options, callback ) {  
/**  
* Default options for AddFeed  
* @method  
* @namespace Mapifies.AddFeed  
* @id Mapifies.AddFeed.defaults  
* @alias Mapifies.AddFeed.defaults  
* @param {String} feedUrl The URL of the GeoXML or KML feed.  
* @param {Object} mapCenter An array with a lat/lng position to center the map on  
* @return {Object} The options for AddFeed  
*/  
function defaults() {  
return {  
// URL of the feed to pass (required)  
'feedUrl': null,  
// Position to center the map on (optional)  
'mapCenter': []  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
// Load feed  
var feed = new GGeoXml(options.feedUrl);  
// Add as overlay  
thisMap.addOverlay(feed);  
 
// If the user has passed the optional mapCenter,  
// then center the map on that point  
if (options.mapCenter[0] && options.mapCenter[1])  
thisMap.setCenter(new GLatLng(options.mapCenter[0], options.mapCenter[1]));  
 
if (typeof callback == 'function') return callback( feed, options );  
return;  
};  
 
/**  
* This function allows you to remove a GeoXML or KML feed from a Google map.  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveFeed  
* @alias Mapifies.RemoveFeed  
* @param {jQuery} element The element to initialise the map on.  
* @param {GGeoXML} feed The feed to remove from the map  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the feed object and options.  
*/  
Mapifies.RemoveFeed = function ( element, feed, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(feed);  
if (typeof callback == 'function') return callback( feed );  
return;  
};  
/**  
* This function allows you to add a ground overlay to a map  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddGroundOverlay  
* @alias Mapifies.AddGroundOverlay  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the feed object and options.  
*/  
Mapifies.AddGroundOverlay = function( element, options, callback) {  
/**  
* Default options for AddGroundOverlay  
* @method  
* @namespace Mapifies.AddGroundOverlay  
* @id Mapifies.AddGroundOverlay.defaults  
* @alias Mapifies.AddGroundOverlay.defaults  
* @param {Object} overlaySouthWestBounds The coordinates of the South West bounds of the image  
* @param {Object} overlayNorthEastBounds The coordinates of the North East bounds of the image  
* @param {String} overlayImage The URL of the image to be loaded  
* @return {Object} The options for AddGroundOverlay  
*/  
function defaults() {  
return {  
// South West Boundry  
'overlaySouthWestBounds': undefined,  
// North East Boundry  
'overlayNorthEastBounds': undefined,  
// Image  
'overlayImage': undefined  
};  
};  
 
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var boundries = new GLatLngBounds(new GLatLng(options.overlaySouthWestBounds[0], options.overlaySouthWestBounds[1]), new GLatLng(options.overlayNorthEastBounds[0], options.overlayNorthEastBounds[1]));  
groundOverlay = new GGroundOverlay(options.overlayImage, boundries);  
 
thisMap.addOverlay(groundOverlay);  
 
if (typeof callback == 'function') return callback( groundOverlay, options );  
return;  
};  
 
/**  
* This function removes an existing ground overlay  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveGroundOverlay  
* @alias Mapifies.RemoveGroundOverlay  
* @param {jQuery} element The element to initialise the map on.  
* @param {GGroundOverlay} groundOverlay The ground overlay to remove.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the feed object and options.  
*/  
Mapifies.RemoveGroundOverlay = function ( element, groundOverlay, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(groundOverlay);  
if (typeof callback === 'function') return callback(groundOverlay);  
return;  
};  
/**  
* This function allows you to add markers to the map with several options  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddMarker  
* @alias Mapifies.AddMarker  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the marker object and options.  
*/  
Mapifies.AddMarker = function ( element, options, callback ) {  
/**  
* Default options for AddGroundOverlay  
* @method  
* @namespace Mapifies.AddGroundOverlay  
* @id Mapifies.AddGroundOverlay.defaults  
* @alias Mapifies.AddGroundOverlay.defaults  
* @param {Object} pointLatLng The Lat/Lng coordinates of the marker.  
* @param {String} pointHTML The HTML to appear in the markers info window.  
* @param {String} pointOpenHTMLEvent The javascript event type to open the marker info window. Default is 'click'.  
* @param {Boolean} pointIsDraggable Defines if the point is draggable by the end user. Default false.  
* @param {Boolean} pointIsRemovable Defines if the point can be removed by the user. Default false.  
* @param {Boolean} pointRemoveEvent The event type to remove a marker. Default 'dblclick'.  
* @param {Number} pointMinZoom The minimum zoom level to display the marker if using a marker manager.  
* @param {Number} pointMaxZoom The maximum zoom level to display the marker if using a marker manager.  
* @param {GIcon} pointIcon A GIcon to display instead of the standard marker graphic.  
* @param {Boolean} centerMap Automatically center the map on the new marker. Default false.  
* @param {String} centerMoveMethod The method in which to move to the marker. Options are 'normal' (default) and 'pan'. Added r64  
* @return {Object} The options for AddGroundOverlay  
*/  
function defaults() {  
var values = {  
'pointLatLng': undefined,  
'pointHTML': undefined,  
'pointOpenHTMLEvent': 'click',  
'pointIsDraggable': false,  
'pointIsRemovable': false,  
'pointRemoveEvent': 'dblclick',  
'pointMinZoom': 4,  
'pointMaxZoom': 17,  
'pointIcon': undefined,  
'centerMap': false,  
'centerMoveMethod':'normal'  
};  
return values;  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend({}, defaults(), options);  
 
var markerOptions = {}  
 
if (typeof options.pointIcon == 'object')  
jQuery.extend(markerOptions, {'icon': options.pointIcon});  
 
if (options.pointIsDraggable)  
jQuery.extend(markerOptions, {'draggable': options.pointIsDraggable});  
 
if (options.centerMap) {  
switch (options.centerMoveMethod) {  
case 'normal':  
thisMap.setCenter(new GLatLng(options.pointLatLng[0],options.pointLatLng[1]));  
break;  
case 'pan':  
thisMap.panTo(new GLatLng(options.pointLatLng[0],options.pointLatLng[1]));  
break;  
}  
}  
 
 
// Create marker, optional parameter to make it draggable  
var marker = new GMarker(new GLatLng(options.pointLatLng[0],options.pointLatLng[1]), markerOptions);  
 
// If it has HTML to pass in, add an event listner for a click  
if(options.pointHTML)  
GEvent.addListener(marker, options.pointOpenHTMLEvent, function(){  
marker.openInfoWindowHtml(options.pointHTML, {maxContent: options.pointMaxContent, maxTitle: options.pointMaxTitle});  
});  
// If it is removable, add dblclick event  
if(options.pointIsRemovable)  
GEvent.addListener(marker, options.pointRemoveEvent, function(){  
thisMap.removeOverlay(marker);  
});  
 
// If the marker manager exists, add it  
if(thisMap.MarkerManager) {  
thisMap.MarkerManager.addMarker(marker, options.pointMinZoom, options.pointMaxZoom);  
} else {  
// Direct rendering to map  
thisMap.addOverlay(marker);  
}  
 
if (typeof callback == 'function') return callback(marker, options);  
return;  
};  
 
 
/**  
* This function allows you to remove markers from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveMarker  
* @alias Mapifies.RemoveMarker  
* @param {jQuery} element The element to initialise the map on.  
* @param {GMarker} options The marker to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the marker object.  
*/  
Mapifies.RemoveMarker = function ( element, marker, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(marker);  
if (typeof callback === 'function') return callback(marker);  
return;  
};  
 
/**  
* This function allows you to create a marker manager to store and manage any markers created on the map. Google recommends not using this marker manager and instead using the open source one.  
* @method  
* @deprecated  
* @namespace Mapifies  
* @id Mapifies.CreateMarkerManager  
* @alias Mapifies.CreateMarkerManager  
* @param {jQuery} element The element to initialise the map on.  
* @param {GMarker} options The marker to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the marker object and options.  
*/  
Mapifies.CreateMarkerManager = function(element, options, callback) {  
/**  
* Default options for CreateMarkerManager  
* @method  
* @namespace Mapifies.CreateMarkerManager  
* @id Mapifies.CreateMarkerManager.defaults  
* @alias Mapifies.CreateMarkerManager.defaults  
* @param {Number} borderPadding Specifies, in pixels, the extra padding outside the map's current viewport monitored by a manager. Markers that fall within this padding are added to the map, even if they are not fully visible.  
* @param {Number} maxZoom The maximum zoom level to show markers at  
* @param {Boolean} trackMarkers Indicates whether or not a marker manager should track markers' movements.  
* @return {Object} The options for CreateMarkerManager  
*/  
function defaults() {  
return {  
'markerManager': 'GMarkerManager',  
// Border Padding in pixels  
'borderPadding': 100,  
// Max zoom level  
'maxZoom': 17,  
// Track markers  
'trackMarkers': false  
}  
}  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var markerManagerOptions = {  
'borderPadding': options.borderPadding,  
'maxZoom': options.maxZoom,  
'trackMarkers': options.trackMarkers  
}  
 
var markerManager = new window[options.markerManager](thisMap, options);  
Mapifies.MapObjects.Append(element, 'MarkerManager',markerManager);  
 
// Return the callback  
if (typeof callback == 'function') return callback( markerManager, options );  
};  
/**  
* This function allows you to add a polygon to a map using GLatLng points  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddPolygon  
* @alias Mapifies.AddPolygon  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the polygon object, polygon options and options.  
*/  
Mapifies.AddPolygon = function( element, options, callback ) {  
/**  
* Default options for AddPolygon  
* @method  
* @namespace Mapifies.AddPolygon  
* @id Mapifies.AddPolygon.defaults  
* @alias Mapifies.AddPolygon.defaults  
* @param {Object} polygonPoints An array of Lat/Lng points that make up the vertexes of the polygon.  
* @param {String} polygonStrokeColor The stroke colour for the polygon.  
* @param {Number} polygonStrokeWeight The thickness of the polygon line.  
* @param {Number} polygonStrokeOpacity A value from 0 to 1 of for the line opacity.  
* @param {String} polygonFillColor The colour of the fill area for the polygon.  
* @param {Number} polygonFillOpacity The value from 0 to 1 for the polygon fill opacity.  
* @param {Object} mapCenter An array containing the LatLng point to center on.  
* @param {Boolean} polygonClickable Defines if the polygon is clickable or not. Default true.  
* @return {Object} The options for AddPolygon  
*/  
function defaults() {  
return {  
// An array of GLatLng objects  
'polygonPoints': [],  
// The outer stroke colour  
'polygonStrokeColor': "#000000",  
// Stroke thickness  
'polygonStrokeWeight': 5,  
// Stroke Opacity  
'polygonStrokeOpacity': 1,  
// Fill colour  
'polygonFillColor': "#ff0000",  
// Fill opacity  
'polygonFillOpacity': 1,  
// Optional center map  
'mapCenter': undefined,  
// Is polygon clickable?  
'polygonClickable': true  
}  
}  
 
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
var polygonOptions = {};  
 
if (!options.polygonClickable)  
polygonOptions = jQuery.extend(polygonOptions, {clickable: false});  
 
if(typeof options.mapCenter !== 'undefined' && options.mapCenter[0] && options.mapCenter[1])  
thisMap.setCenter(new GLatLng(options.mapCenter[0], options.mapCenter[1]));  
 
var allPoints = [];  
jQuery.each(options.polygonPoints, function(i, point) {  
allPoints.push(new GLatLng(point[0],point[1]));  
});  
 
var polygon = new GPolygon(allPoints, options.polygonStrokeColor, options.polygonStrokeWeight, options.polygonStrokeOpacity, options.polygonFillColor, options.polygonFillOpacity, polygonOptions);  
thisMap.addOverlay(polygon);  
 
if (typeof callback == 'function') return callback(polygon, polygonOptions, options);  
return;  
}  
 
/**  
* This function allows you to remove a polygon from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemovePolygon  
* @alias Mapifies.RemovePolygon  
* @param {jQuery} element The element to initialise the map on.  
* @param {GPolygon} polygon The polygon to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the polygon.  
*/  
Mapifies.RemovePolygon = function ( element, polygon, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(polygon);  
if (typeof callback === 'function') return callback(polygon);  
return;  
};  
/**  
* This function allows you to add a polyline to a map using GLatLng points  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddPolyline  
* @alias Mapifies.AddPolyline  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the polygon object, polygon options and options.  
*/  
Mapifies.AddPolyline = function (element, options, callback) {  
/**  
* Default options for AddPolyline  
* @method  
* @namespace Mapifies.AddPolyline  
* @id Mapifies.AddPolygon.defaults  
* @alias Mapifies.AddPolygon.defaults  
* @param {Object} polylinePoints An array of Lat/Lng points that make up the vertexes of the polyline.  
* @param {String} polylineStrokeColor The stroke colour for the polyline.  
* @param {Number} polylineStrokeWidth The thickness of the polyline line.  
* @param {Number} polylineStrokeOpacity A value from 0 to 1 of for the line opacity.  
* @param {Object} mapCenter An array containing the LatLng point to center on.  
* @param {Boolean} polylineGeodesic Defines if the line follows the curve of the earth. Default false.  
* @param {Boolean} polylineClickable Defines if the polygon is clickable or not. Default true.  
* @return {Object} The options for AddPolyline  
*/  
function defaults() {  
return {  
// An array of GLatLng objects  
'polylinePoints': [],  
// Colour of the line  
'polylineStrokeColor': "#ff0000",  
// Width of the line  
'polylineStrokeWidth': 10,  
// Opacity of the line  
'polylineStrokeOpacity': 1,  
// Optional center map  
'mapCenter': [],  
// Is line Geodesic (i.e. bends to the curve of the earth)?  
'polylineGeodesic': false,  
// Is line clickable?  
'polylineClickable': true  
};  
};  
 
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
var polyLineOptions = {};  
if (options.polylineGeodesic)  
jQuery.extend(polyLineOptions, {geodesic: true});  
 
if(!options.polylineClickable)  
jQuery.extend(polyLineOptions, {clickable: false});  
 
if (options.mapCenter[0] && options.mapCenter[1])  
thisMap.setCenter(new GLatLng(options.mapCenter[0], options.mapCenter[1]));  
 
var allPoints = [];  
jQuery.each(options.polylinePoints, function(i, point) {  
allPoints.push(new GLatLng(point[0],point[1]));  
});  
 
var polyline = new GPolyline(allPoints, options.polylineStrokeColor, options.polylineStrokeWidth, options.polylineStrokeOpacity, polyLineOptions);  
thisMap.addOverlay(polyline);  
 
if (typeof callback == 'function') return callback(polyline, polyLineOptions, options);  
return;  
}  
 
/**  
* This function allows you to remove a polyline from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemovePolyline  
* @alias Mapifies.RemovePolyline  
* @param {jQuery} element The element to initialise the map on.  
* @param {GPolyline} polyline The polyline to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the polyline.  
*/  
Mapifies.RemovePolyline = function (element, polyline, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(polyline);  
if (typeof callback === 'function') return callback(polyline);  
return;  
};  
 
/**  
* This function allows you to add a screen overlay to a map.  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddScreenOverlay  
* @alias Mapifies.AddScreenOverlay  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the screen overlay and options.  
*/  
Mapifies.AddScreenOverlay = function( element, options, callback ) {  
/**  
* Default options for AddScreenOverlay  
* @method  
* @namespace Mapifies.AddScreenOverlay  
* @id Mapifies.AddScreenOverlay.defaults  
* @alias Mapifies.AddScreenOverlay.defaults  
* @param {String} imageUrl The URL of the image to load.  
* @param {Object} screenXY The X/Y position in the viewport to place the image.  
* @param {Object} overlayXY The overlay X/Y position in the viewport.  
* @param {Object} size The size of the image, which is converted to a GSize.  
* @return {Object} The options for AddScreenOverlay  
*/  
function defaults() {  
return {  
'imageUrl':'',  
'screenXY':[],  
'overlayXY':[],  
'size':[]  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var overlay = new GScreenOverlay(options.imageUrl, new GScreenPoint(options.screenXY[0],options.screenXY[1]), new GScreenPoint(options.overlayXY[0],options.overlayXY[1]), new GScreenSize(options.size[0],options.size[1]));  
thisMap.addOverlay(overlay);  
 
if (typeof callback == 'function') return callback(overlay, options);  
};  
 
/**  
* This function allows you to remove a screen overlay from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveScreenOverlay  
* @alias Mapifies.RemoveScreenOverlay  
* @param {jQuery} element The element to initialise the map on.  
* @param {GScreenOverlay} overlay The overlay to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the overlay.  
*/  
Mapifies.RemoveScreenOverlay = function ( element, overlay, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(overlay);  
if (typeof callback === 'function') return callback(overlay);  
return;  
};  
 
/**  
* This function allows you to add a Google Streetview  
* @method  
* @namespace Mapifies  
* @id Mapifies.CreateStreetviewPanorama  
* @alias Mapifies.CreateStreetviewPanorama  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the street view.  
*/  
Mapifies.CreateStreetviewPanorama = function( element, options, callback ) {  
/**  
* Default options for CreateStreetviewPanorama  
* @method  
* @namespace Mapifies.CreateStreetviewPanorama  
* @id Mapifies.CreateStreetviewPanorama.defaults  
* @alias Mapifies.CreateStreetviewPanorama.defaults  
* @param {String} overideContainer A ID of a div to put the street view into, otherwise it will default to the map.  
* @param {Object} latlng The starting Lat/Lng of the streetview - this is required.  
* @param {Object} pov The point of view to initialse the map on. This is 3 values, X/Y/Z  
* @return {Object} The options for CreateStreetviewPanorama  
*/  
function defaults() {  
return {  
'overideContainer':'',  
'latlng':[40.75271883902363, -73.98262023925781],  
'pov': []  
}  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
// Create Street View Overlay  
 
var container = null;  
if (options.overideContainer !== '') {  
container = jQuery(options.overideContainer).get(0);  
} else {  
container = jQuery(element).get(0);  
}  
 
var viewOptions = {};  
if (options.pov.length > 0) {  
jQuery.extend(viewOptions, {'pov':new GPov(options.latlng[0],options.latlng[1],options.latlng[2])});  
}  
if (options.latlng.length > 0) {  
jQuery.extend(viewOptions, {'latlng':new GLatLng(options.latlng[0],options.latlng[1])});  
}  
 
var overlay = new GStreetviewPanorama(container, viewOptions);  
if (typeof callback == 'function') return callback(overlay, options);  
return;  
};  
 
/**  
* This function allows you to remove a street view from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveStreetviewPanorama  
* @alias Mapifies.RemoveStreetviewPanorama  
* @param {jQuery} element The element to initialise the map on.  
* @param {GStreetView} view The view to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the view.  
*/  
Mapifies.RemoveStreetviewPanorama = function ( element, view, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
view.remove();  
if (typeof callback == 'function') return callback( view );  
return;  
};  
/**  
* This function allows you to add a Google Traffic Layer  
* @method  
* @namespace Mapifies  
* @id Mapifies.AddTrafficInfo  
* @alias Mapifies.AddTrafficInfo  
* @param {jQuery} element The element to initialise the map on.  
* @param {Object} options The object that contains the options.  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the traffic layer.  
*/  
Mapifies.AddTrafficInfo = function( element, options, callback) {  
/**  
* Default options for AddTrafficInfo  
* @method  
* @namespace Mapifies.AddTrafficInfo  
* @id Mapifies.AddTrafficInfo.defaults  
* @alias Mapifies.AddTrafficInfo.defaults  
* @param {Object} mapCenter The Lat/Lng to center the map on  
* @return {Object} The options for AddTrafficInfo  
*/  
function defaults() {  
return {  
// Center the map on this point (optional)  
'mapCenter': []  
};  
};  
var thisMap = Mapifies.MapObjects.Get(element);  
options = jQuery.extend(defaults(), options);  
 
var trafficOverlay = new GTrafficOverlay;  
// Add overlay  
thisMap.addOverlay(trafficOverlay);  
// If the user has passed the optional mapCenter,  
// then center the map on that point  
if (options.mapCenter[0] && options.mapCenter[1]) {  
thisMap.setCenter(new GLatLng(options.mapCenter[0], options.mapCenter[1]));  
}  
if (typeof callback == 'function') return callback(trafficOverlay, options);  
};  
 
/**  
* This function allows you to remove a traffic layer from the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.RemoveTrafficInfo  
* @alias Mapifies.RemoveTrafficInfo  
* @param {jQuery} element The element to initialise the map on.  
* @param {GTrafficOverlay} trafficOverlay The traffic overlay to be removed  
* @param {Function} callback The callback function to pass out after initialising the map.  
* @return {Function} callback The callback option with the traffic overlay.  
*/  
Mapifies.RemoveTrafficInfo = function ( element, trafficOverlay, callback ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
thisMap.removeOverlay(trafficOverlay);  
if (typeof callback === 'function') return callback(trafficOverlay);  
return;  
};  
/**  
* A helper method that allows you to pass the status code of a search and get back a friendly oject  
* @method  
* @namespace Mapifies  
* @id Mapifies.SearchCode  
* @param {Number} code The status code of the query  
* @return {Object} Returns a friendly object that contains the 'code', a 'success' boolean and a helpful 'message'.  
*/  
Mapifies.SearchCode = function ( code ) {  
switch (code) {  
case G_GEO_SUCCESS:  
return {'code':G_GEO_SUCCESS,'success':true,'message':'Success'};  
case G_GEO_UNKNOWN_ADDRESS:  
return {'code' : G_GEO_UNKNOWN_ADDRESS, 'success' : false, 'message' : 'No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect'};  
break;  
case G_GEO_SERVER_ERROR:  
return {'code' : G_GEO_UNKNOWN_ADDRESS, 'success' : false, 'message' : 'A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.'};  
break;  
case G_GEO_MISSING_QUERY:  
return {'code' : G_GEO_UNKNOWN_ADDRESS, 'success' : false, 'message' : 'The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.'};  
break;  
case G_GEO_BAD_KEY:  
return {'code' : G_GEO_UNKNOWN_ADDRESS, 'success' : false, 'message' : 'The given key is either invalid or does not match the domain for which it was given.'};  
break;  
case G_GEO_BAD_REQUEST:  
return {'code' : G_GEO_UNKNOWN_ADDRESS, 'success' : false, 'message' : 'A directions request could not be successfully parsed.'};  
break;  
default:  
return {  
'code': null,  
'success': false,  
'message': 'An unknown error occurred.'  
};  
break;  
};  
}  
 
/**  
* An internal function to get the google maptype constant  
* @method  
* @namespace Mapifies  
* @id Mapifies.GetMapType  
* @alias Mapifies.GetMapType  
* @param {String} mapType The string of the map type.  
* @return {String} mapType The Google constant for a maptype.  
*/  
Mapifies.GetMapType = function ( mapType ) {  
// Lets set our map type based on the options  
switch(mapType) {  
case 'map': // Normal Map  
mapType = G_NORMAL_MAP;  
break;  
case 'sat': // Satallite Imagery  
mapType = G_SATELLITE_MAP;  
break;  
case 'hybrid': //Hybrid Map  
mapType = G_HYBRID_MAP;  
break;  
};  
return mapType;  
};  
 
/**  
* An internal function to get the google travel mode constant  
* @method  
* @namespace Mapifies  
* @id Mapifies.GetTravelMode  
* @alias Mapifies.GetTravelMode  
* @param {String} travelMode The string of the travel mode.  
* @return {String} travelMode The Google constant for a travel mode.  
*/  
Mapifies.GetTravelMode = function ( travelMode ) {  
switch(travelMode) {  
case 'driving':  
travelMode = G_TRAVEL_MODE_DRIVING;  
break;  
case 'walking':  
travelMode = G_TRAVEL_MODE_WALKING;  
break;  
};  
return travelMode;  
};  
 
/**  
* A helper function to create a google GIcon  
* @method  
* @namespace Mapifies  
* @id Mapifies.createIcon  
* @alias Mapifies.createIcon  
* @param {Object} options The options to create the icon  
* @return {GIcon} A GIcon object  
*/  
Mapifies.createIcon = function (options) {  
/**  
* Default options for createIcon  
* @method  
* @namespace Mapifies.createIcon  
* @id Mapifies.createIcon.defaults  
* @alias Mapifies.createIcon.defaults  
* @param {String} iconImage The foreground image URL of the icon.  
* @param {String} iconShadow The shadow image URL of the icon.  
* @param {GSize} iconSize The pixel size of the foreground image of the icon.  
* @param {GSize} iconShadowSize The pixel size of the shadow image.  
* @param {GPoint} iconAnchor The pixel coordinate relative to the top left corner of the icon image at which this icon is anchored to the map.  
* @param {GPoint} iconInfoWindowAnchor The pixel coordinate relative to the top left corner of the icon image at which the info window is anchored to this icon.  
* @param {String} iconPrintImage The URL of the foreground icon image used for printed maps. It must be the same size as the main icon image given by image.  
* @param {String} iconMozPrintImage The URL of the foreground icon image used for printed maps in Firefox/Mozilla. It must be the same size as the main icon image given by image.  
* @param {String} iconPrintShadow The URL of the shadow image used for printed maps. It should be a GIF image since most browsers cannot print PNG images.  
* @param {String} iconTransparent The URL of a virtually transparent version of the foreground icon image used to capture click events in Internet Explorer. This image should be a 24-bit PNG version of the main icon image with 1% opacity, but the same shape and size as the main icon.  
* @return {Object} The options for createIcon  
*/  
function defaults() {  
return {  
'iconImage': undefined,  
'iconShadow': undefined,  
'iconSize': undefined,  
'iconShadowSize': undefined,  
'iconAnchor': undefined,  
'iconInfoWindowAnchor': undefined,  
'iconPrintImage': undefined,  
'iconMozPrintImage': undefined,  
'iconPrintShadow': undefined,  
'iconTransparent': undefined  
};  
};  
 
options = jQuery.extend(defaults(), options);  
var icon = new GIcon(G_DEFAULT_ICON);  
 
if(options.iconImage)  
icon.image = options.iconImage;  
if(options.iconShadow)  
icon.shadow = options.iconShadow;  
if(options.iconSize)  
icon.iconSize = options.iconSize;  
if(options.iconShadowSize)  
icon.shadowSize = options.iconShadowSize;  
if(options.iconAnchor)  
icon.iconAnchor = options.iconAnchor;  
if(options.iconInfoWindowAnchor)  
icon.infoWindowAnchor = options.iconInfoWindowAnchor;  
return icon;  
};  
 
/**  
* A helper function to get the map center as a GLatLng  
* @method  
* @namespace Mapifies  
* @id Mapifies.getCenter  
* @alias Mapifies.getCenter  
* @param {jQuery} element The element that contains the map.  
* @return {GLatLng} A object containing the center of the map  
*/  
Mapifies.getCenter = function ( element ) {  
var thisMap = Mapifies.MapObjects.Get(element);  
return thisMap.getCenter();  
};  
 
/**  
* A helper function to get the bounds of the map  
* @method  
* @namespace Mapifies  
* @id Mapifies.getBounds  
* @alias Mapifies.getBounds  
* @param {jQuery} element The element that contains the map.  
* @return {GSize} The bounds of the map  
*/  
Mapifies.getBounds = function (element){  
var thisMap = Mapifies.MapObjects.Get(element);  
return thisMap.getBounds();  
};var Mapifies;  
 
if (!Mapifies) Mapifies = {};  
 
(function($){  
$.fn.jmap = function(method, options, callback) {  
return this.each(function(){  
if (method == 'init' && typeof options == 'undefined') {  
new Mapifies.Initialise(this, {}, null);  
} else if (method == 'init' && typeof options == 'object') {  
new Mapifies.Initialise(this, options, callback);  
} else if (method == 'init' && typeof options == 'function') {  
new Mapifies.Initialise(this, {}, options);  
} else if (typeof method == 'object' || method == null) {  
new Mapifies.Initialise(this, method, options);  
} else {  
try {  
new Mapifies[method](this, options, callback);  
} catch(err) {  
throw Error('Mapifies Function Does Not Exist');  
}  
}  
});  
}  
})(jQuery);  
 
/*  
* jqGrid 3.6.5 - jQuery Grid  
* Copyright (c) 2008, Tony Tomov, tony@trirand.com  
* Dual licensed under the MIT and GPL licenses  
* http://www.opensource.org/licenses/mit-license.php  
* http://www.gnu.org/licenses/gpl-2.0.html  
* Date:2010-05-05  
* Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; jquery.searchFilter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.setcolumns.js; grid.postext.js; grid.tbltogrid.js; grid.jqueryui.js;  
*/  
(function(b){b.jgrid=b.jgrid||{};b.extend(b.jgrid,{htmlDecode:function(f){if(f=="&nbsp;"||f=="&#160;"||f.length==1&&f.charCodeAt(0)==160)return"";return!f?f:String(f).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(f){return!f?f:String(f).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(f){var k=b.makeArray(arguments).slice(1);if(f===undefined)f="";return f.replace(/\{(\d+)\}/g,function(i,  
h){return k[h]})},getCellIndex:function(f){f=b(f);f=(!f.is("td")&&!f.is("th")?f.closest("td,th"):f)[0];if(b.browser.msie)return b.inArray(f,f.parentNode.cells);return f.cellIndex},stripHtml:function(f){f+="";var k=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(f)return(f=f.replace(k,""))&&f!=="&nbsp;"&&f!=="&#160;"?f.replace(/\"/g,"'"):"";else return f},stringToDoc:function(f){var k;if(typeof f!=="string")return f;try{k=(new DOMParser).parseFromString(f,"text/xml")}catch(i){k=new ActiveXObject("Microsoft.XMLDOM");  
k.async=false;k.loadXML(f)}return k&&k.documentElement&&k.documentElement.tagName!="parsererror"?k:null},parse:function(f){f=f;if(f.substr(0,9)=="while(1);")f=f.substr(9);if(f.substr(0,2)=="/*")f=f.substr(2,f.length-4);f||(f="{}");return b.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(f):eval("("+f+")")},jqID:function(f){f+="";return f.replace(/([\.\:\[\]])/g,"\\$1")},ajaxOptions:{},extend:function(f){b.extend(b.fn.jqGrid,f);this.no_legacy_api||b.fn.extend(f)}});  
b.fn.jqGrid=function(f){if(typeof f=="string"){var k=b.fn.jqGrid[f];if(!k)throw"jqGrid - No such method: "+f;var i=b.makeArray(arguments).slice(1);return k.apply(this,i)}return this.each(function(){if(!this.grid){var h=b.extend(true,{url:"",height:150,page:1,rowNum:20,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,  
subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,treeGridModel:"nested",  
treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,  
gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:200},b.jgrid.defaults,f||{}),g={headers:[],cols:[],footers:[],dragStart:function(c,d,e){this.resizing={idx:c,startX:d.clientX,sOL:e[0]};this.hDiv.style.cursor="col-resize";  
this.curGbox=b("#rs_m"+h.id,"#gbox_"+h.id);this.curGbox.css({display:"block",left:e[0],top:e[1],height:e[2]});b.isFunction(h.resizeStart)&&h.resizeStart.call(this,d,c);document.onselectstart=function(){return false}},dragMove:function(c){if(this.resizing){var d=c.clientX-this.resizing.startX;c=this.headers[this.resizing.idx];var e=h.direction==="ltr"?c.width+d:c.width-d,l;if(e>33){this.curGbox.css({left:this.resizing.sOL+d});if(h.forceFit===true){l=this.headers[this.resizing.idx+h.nv];d=h.direction===  
"ltr"?l.width-d:l.width+d;if(d>33){c.newWidth=e;l.newWidth=d}}else{this.newWidth=h.direction==="ltr"?h.tblwidth+d:h.tblwidth-d;c.newWidth=e}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,d=this.headers[c].newWidth||this.headers[c].width;d=parseInt(d,10);this.resizing=false;b("#rs_m"+h.id).css("display","none");h.colModel[c].width=d;this.headers[c].width=d;this.headers[c].el.style.width=d+"px";if(this.cols.length>0)this.cols[c].style.width=d+"px";  
if(this.footers.length>0)this.footers[c].style.width=d+"px";if(h.forceFit===true){d=this.headers[c+h.nv].newWidth||this.headers[c+h.nv].width;this.headers[c+h.nv].width=d;this.headers[c+h.nv].el.style.width=d+"px";if(this.cols.length>0)this.cols[c+h.nv].style.width=d+"px";if(this.footers.length>0)this.footers[c+h.nv].style.width=d+"px";h.colModel[c+h.nv].width=d}else{h.tblwidth=this.newWidth||h.tblwidth;b("table:first",this.bDiv).css("width",h.tblwidth+"px");b("table:first",this.hDiv).css("width",  
h.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(h.footerrow){b("table:first",this.sDiv).css("width",h.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}b.isFunction(h.resizeStop)&&h.resizeStop.call(this,d,c)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var c=b(g.bDiv).height();if(c){var d=b("table:first",g.bDiv),e=b("> tbody > tr:visible:first",d).outerHeight()||g.prevRowHeight;if(e){g.prevRowHeight=  
e;var l=h.rowNum,n=g.scrollTop=g.bDiv.scrollTop,o=Math.round(d.position().top)-n,p=o+d.height();e=e*l;var w,y,s;if(o<=0&&(h.lastpage===undefined||parseInt((p+n+e-1)/e,10)<=h.lastpage)){y=parseInt((c-p+e-1)/e,10);if(p>=0||y<2||h.scroll===true){w=Math.round((p+n)/e)+1;o=-1}else o=1}if(o>0){w=parseInt(n/e,10)+1;y=parseInt((n+c)/e,10)+2-w;s=true}if(y)if(!(h.lastpage&&w>h.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,h.scrollTimeout);else{h.page=w;if(s){g.selectionPreserver(d[0]);g.emptyRows(g.bDiv,  
false)}g.populate(y)}}}},scrollGrid:function(){if(h.scroll){var c=g.bDiv.scrollTop;if(c!=g.scrollTop){g.scrollTop=c;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible,200)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(h.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft},selectionPreserver:function(c){var d=c.p,e=d.selrow,l=d.selarrrow?b.makeArray(d.selarrrow):null,n=c.grid.bDiv.scrollLeft,o=d.gridComplete;d.gridComplete=function(){d.selrow=null;d.selarrrow=[];if(d.multiselect&&l&&l.length>  
0)for(var p=0;p<l.length;p++)l[p]!=e&&b(c).jqGrid("setSelection",l[p],false);e&&b(c).jqGrid("setSelection",e,false);c.grid.bDiv.scrollLeft=n;d.gridComplete=o;d.gridComplete&&o()}}};this.p=h;var j,m,a;if(this.p.colNames.length===0)for(j=0;j<this.p.colModel.length;j++)this.p.colNames[j]=this.p.colModel[j].label||this.p.colModel[j].name;if(this.p.colNames.length!==this.p.colModel.length)alert(b.jgrid.errors.model);else{var q=b("<div class='ui-jqgrid-view'></div>"),t,x=b.browser.msie?true:false,C=b.browser.safari?  
true:false;a=this;a.p.direction=b.trim(a.p.direction.toLowerCase());if(b.inArray(a.p.direction,["ltr","rtl"])==-1)a.p.direction="ltr";m=a.p.direction;b(q).insertBefore(this);b(this).appendTo(q).removeClass("scroll");var K=b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");b(K).insertBefore(q).attr({id:"gbox_"+this.id,dir:m});b(q).appendTo(K).attr("id","gview_"+this.id);t=x&&b.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':  
"";b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(t).insertBefore(q);b("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(q);b(this).attr({cellSpacing:"0",cellPadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var J=function(c,d){c=parseInt(c,10);return isNaN(c)?d?d:0:c},F=function(c,d,e){var l=a.p.colModel[c],n=l.align,o='style="',  
p=l.classes,w=l.name;if(n)o+="text-align:"+n+";";if(l.hidden===true)o+="display:none;";if(d===0)o+="width: "+g.headers[c].width+"px;";o+='"'+(p!==undefined?' class="'+p+'"':"")+(l.title&&e?' title="'+b.jgrid.stripHtml(e)+'"':"");o+=' aria-describedby="'+a.p.id+"_"+w+'"';return o},Q=function(c){return c===undefined||c===null||c===""?"&#160;":a.p.autoencode?b.jgrid.htmlEncode(c):c+""},M=function(c,d,e,l,n){e=a.p.colModel[e];if(typeof e.formatter!=="undefined"){c={rowId:c,colModel:e,gid:a.p.id};d=b.isFunction(e.formatter)?  
e.formatter.call(a,d,c,l,n):b.fmatter?b.fn.fmatter(e.formatter,d,c,l,n):Q(d)}else d=Q(d);return d},R=function(c,d,e,l,n){c=M(c,d,e,n,"add");return'<td role="gridcell" '+F(e,l,c)+">"+c+"</td>"},u=function(c,d,e){c='<input role="checkbox" type="checkbox" id="jqg_'+c+'" class="cbox" name="jqg_'+c+'"/>';d=F(d,e,"");return'<td role="gridcell" aria-describedby="'+a.p.id+'_cb" '+d+">"+c+"</td>"},la=function(c,d,e,l){e=(parseInt(e,10)-1)*parseInt(l,10)+1+d;c=F(c,d,"");return'<td role="gridcell" aria-describedby="'+  
a.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+c+">"+e+"</td>"},ca=function(c){var d,e=[],l=0,n;for(n=0;n<a.p.colModel.length;n++){d=a.p.colModel[n];if(d.name!=="cb"&&d.name!=="subgrid"&&d.name!=="rn"){e[l]=c=="xml"?d.xmlmap||d.name:d.jsonmap||d.name;l++}}return e},fa=function(c){var d=a.p.remapColumns;if(!d||!d.length)d=b.map(a.p.colModel,function(e,l){return l});if(c)d=b.map(d,function(e){return e<c?null:e-c});return d},aa=function(c,d){a.p.deepempty?b("tbody:first tr",c).remove():b("tbody:first",  
c).empty();if(d&&a.p.scroll){b(">div:first",c).css({height:"auto"}).children("div:first").css({height:0,display:"none"});c.scrollTop=0}},U=function(c,d){var e,l,n,o;if(typeof d==="function")return d(c);e=c[d];if(e===undefined){if(typeof d==="string")n=d.split(".");try{if(o=n.length)for(e=c;e&&o--;){l=n.shift();e=e[l]}}catch(p){}}return e},ia=function(c,d,e,l,n){var o=new Date;a.p.reccount=0;if(b.isXMLDoc(c)){if(a.p.treeANode===-1&&!a.p.scroll){aa(d,false);e=0}else e=e>0?e:0;var p,w=0,y,s,r=0,v=0,  
z=0,D,N,L=[],P,G={},da=a.rows.length,E,W,B=[],S=0,ga=a.p.altRows===true?" "+a.p.altclass:"";a.p.xmlReader.repeatitems||(L=ca("xml"));D=a.p.keyIndex===false?a.p.xmlReader.id:a.p.keyIndex;if(L.length>0&&!isNaN(D)){if(a.p.remapColumns&&a.p.remapColumns.length)D=b.inArray(D,a.p.remapColumns);D=L[D]}N=(D+"").indexOf("[")===-1?L.length?function(X,V){return b(D,X).text()||V}:function(X,V){return b(a.p.xmlReader.cell,X).eq(D).text()||V}:function(X,V){return X.getAttribute(D.replace(/[\[\]]/g,""))||V};a.p.userData=  
{};b(a.p.xmlReader.page,c).each(function(){a.p.page=this.textContent||this.text||0});b(a.p.xmlReader.total,c).each(function(){a.p.lastpage=this.textContent||this.text;if(a.p.lastpage===undefined)a.p.lastpage=1});b(a.p.xmlReader.records,c).each(function(){a.p.records=this.textContent||this.text||0});b(a.p.xmlReader.userdata,c).each(function(){a.p.userData[this.getAttribute("name")]=this.textContent||this.text});c=b(a.p.xmlReader.root+" "+a.p.xmlReader.row,c);var ha=c.length,O=0;if(c&&ha){var ma=parseInt(a.p.rowNum,  
10),wa=a.p.scroll?(parseInt(a.p.page,10)-1)*ma+1:1;if(n)ma*=n+1;for(n=b.isFunction(a.p.afterInsertRow);O<ha;){E=c[O];W=N(E,wa+O);p=e===0?0:e+1;p=(p+O)%2==1?ga:"";B[S++]='<tr id="'+W+'" role="row" class ="ui-widget-content jqgrow ui-row-'+a.p.direction+""+p+'">';if(a.p.rownumbers===true){B[S++]=la(0,O,a.p.page,a.p.rowNum);z=1}if(a.p.multiselect===true){B[S++]=u(W,z,O);r=1}if(a.p.subGrid===true){B[S++]=b(a).jqGrid("addSubGridCell",r+z,O+e);v=1}if(a.p.xmlReader.repeatitems){P||(P=fa(r+v+z));var za=b(a.p.xmlReader.cell,  
E);b.each(P,function(X){var V=za[this];if(!V)return false;y=V.textContent||V.text;G[a.p.colModel[X+r+v+z].name]=y;B[S++]=R(W,y,X+r+v+z,O+e,E)})}else for(p=0;p<L.length;p++){y=b(L[p],E).text();G[a.p.colModel[p+r+v+z].name]=y;B[S++]=R(W,y,p+r+v+z,O+e,E)}B[S++]="</tr>";if(a.p.gridview===false){if(a.p.treeGrid===true){p=a.p.treeANode>=-1?a.p.treeANode:0;s=b(B.join(""))[0];try{b(a).jqGrid("setTreeNode",G,s)}catch(Fa){}da===0?b("tbody:first",d).append(s):b(a.rows[O+p+e]).after(s)}else b("tbody:first",d).append(B.join(""));  
if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],r+z)}catch(Ga){}n&&a.p.afterInsertRow.call(a,W,G,E);B=[];S=0}G={};w++;O++;if(w==ma)break}}a.p.gridview===true&&b("tbody:first",d).append(B.join(""));a.p.totaltime=new Date-o;if(w>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=ha}B=null;if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=0;a.p.reccount=w;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);l||na(false,true)}},  
ra=function(c,d,e,l,n){var o=new Date;a.p.reccount=0;if(c){if(a.p.treeANode===-1&&!a.p.scroll){aa(d,false);e=0}else e=e>0?e:0;var p=0,w,y,s,r=[],v,z=0,D=0,N=0,L,P,G,da={},E,W=a.rows.length,B;s=[];E=0;var S=a.p.altRows===true?" "+a.p.altclass:"";a.p.page=U(c,a.p.jsonReader.page)||0;G=U(c,a.p.jsonReader.total);a.p.lastpage=G===undefined?1:G;a.p.records=U(c,a.p.jsonReader.records)||0;a.p.userData=U(c,a.p.jsonReader.userdata)||{};a.p.jsonReader.repeatitems||(v=r=ca("json"));G=a.p.keyIndex===false?a.p.jsonReader.id:  
a.p.keyIndex;if(r.length>0&&!isNaN(G)){if(a.p.remapColumns&&a.p.remapColumns.length)G=b.inArray(G,a.p.remapColumns);G=r[G]}if(P=U(c,a.p.jsonReader.root)){L=P.length;c=0;var ga=parseInt(a.p.rowNum,10),ha=a.p.scroll?(parseInt(a.p.page,10)-1)*ga+1:1;if(n)ga*=n+1;for(var O=b.isFunction(a.p.afterInsertRow);c<L;){n=P[c];B=U(n,G);if(B===undefined){B=ha+c;if(r.length===0)if(a.p.jsonReader.cell)B=n[a.p.jsonReader.cell][G]||B}w=e===0?0:e+1;w=(w+c)%2==1?S:"";s[E++]='<tr id="'+B+'" role="row" class= "ui-widget-content jqgrow ui-row-'+  
a.p.direction+""+w+'">';if(a.p.rownumbers===true){s[E++]=la(0,c,a.p.page,a.p.rowNum);N=1}if(a.p.multiselect){s[E++]=u(B,N,c);z=1}if(a.p.subGrid){s[E++]=b(a).jqGrid("addSubGridCell",z+N,c+e);D=1}if(a.p.jsonReader.repeatitems){if(a.p.jsonReader.cell)n=U(n,a.p.jsonReader.cell);v||(v=fa(z+D+N))}for(y=0;y<v.length;y++){w=U(n,v[y]);s[E++]=R(B,w,y+z+D+N,c+e,n);da[a.p.colModel[y+z+D+N].name]=w}s[E++]="</tr>";if(a.p.gridview===false){if(a.p.treeGrid===true){E=a.p.treeANode>=-1?a.p.treeANode:0;s=b(s.join(""))[0];  
try{b(a).jqGrid("setTreeNode",da,s)}catch(ma){}W===0?b("tbody:first",d).append(s):b(a.rows[c+E+e]).after(s)}else b("tbody:first",d).append(s.join(""));if(a.p.subGrid===true)try{b(a).jqGrid("addSubGrid",a.rows[a.rows.length-1],z+N)}catch(wa){}O&&a.p.afterInsertRow.call(a,B,da,n);s=[];E=0}da={};p++;c++;if(p==ga)break}a.p.gridview===true&&b("tbody:first",d).append(s.join(""));a.p.totaltime=new Date-o;if(p>0){a.grid.cols=a.rows[0].cells;if(a.p.records===0)a.p.records=L}}if(!a.p.treeGrid&&!a.p.scroll)a.grid.bDiv.scrollTop=  
0;a.p.reccount=p;a.p.treeANode=-1;a.p.userDataOnFooter&&b(a).jqGrid("footerData","set",a.p.userData,true);l||na(false,true)}},na=function(c,d){var e,l,n,o,p,w,y,s="";n=parseInt(a.p.page,10)-1;if(n<0)n=0;n*=parseInt(a.p.rowNum,10);p=n+a.p.reccount;if(a.p.scroll){e=b("tbody:first > tr",a.grid.bDiv);n=p-e.length;if(l=e.outerHeight()){e=n*l;l=parseInt(a.p.records,10)*l;b(">div:first",a.grid.bDiv).css({height:l}).children("div:first").css({height:e,display:e?"":"none"})}}s=a.p.pager?a.p.pager:"";s+=a.p.toppager?  
s?","+a.p.toppager:a.p.toppager:"";if(s){y=b.jgrid.formatter.integer||{};if(a.p.loadonce){e=l=1;a.p.lastpage=a.page=1;b(".selbox",s).attr("disabled",true)}else{e=J(a.p.page);l=J(a.p.lastpage);b(".selbox",s).attr("disabled",false)}if(a.p.pginput===true){b(".ui-pg-input",s).val(a.p.page);b("#sp_1",s).html(b.fmatter?b.fmatter.util.NumberFormat(a.p.lastpage,y):a.p.lastpage)}if(a.p.viewrecords)if(a.p.reccount===0)b(".ui-paging-info",s).html(a.p.emptyrecords);else{o=n+1;w=a.p.records;if(b.fmatter){o=b.fmatter.util.NumberFormat(o,  
y);p=b.fmatter.util.NumberFormat(p,y);w=b.fmatter.util.NumberFormat(w,y)}b(".ui-paging-info",s).html(b.jgrid.format(a.p.recordtext,o,p,w))}if(a.p.pgbuttons===true){if(e<=0)e=l=0;if(e==1||e===0){b("#first, #prev",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#first, #prev",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#first_t, #prev_t",a.p.toppager).removeClass("ui-state-disabled")}if(e==  
l||e===0){b("#next, #last",a.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{b("#next, #last",a.p.pager).removeClass("ui-state-disabled");a.p.toppager&&b("#next_t, #last_t",a.p.toppager).removeClass("ui-state-disabled")}}}c===true&&a.p.rownumbers===true&&b("td.jqgrid-rownum",a.rows).each(function(r){b(this).html(n+1+r)});d&&a.p.jqgdnd&&b(a).jqGrid("gridDnD","updateDnD");  
b.isFunction(a.p.gridComplete)&&a.p.gridComplete.call(a)},Y=function(c){if(!a.grid.hDiv.loading){var d=a.p.scroll&&c===false,e={},l,n=a.p.prmNames;if(a.p.page<=0)a.p.page=1;if(n.search!==null)e[n.search]=a.p.search;if(n.nd!==null)e[n.nd]=(new Date).getTime();if(n.rows!==null)e[n.rows]=a.p.rowNum;if(n.page!==null)e[n.page]=a.p.page;if(n.sort!==null)e[n.sort]=a.p.sortname;if(n.order!==null)e[n.order]=a.p.sortorder;var o=a.p.loadComplete,p=b.isFunction(o);p||(o=null);var w=0;c=c||1;if(c>1)if(n.npage!==  
null){e[n.npage]=c;w=c-1;c=1}else o=function(s){p&&a.p.loadComplete.call(a,s);a.grid.hDiv.loading=false;a.p.page++;Y(c-1)};else n.npage!==null&&delete a.p.postData[n.npage];b.extend(a.p.postData,e);var y=!a.p.scroll?0:a.rows.length-1;if(b.isFunction(a.p.datatype))a.p.datatype.call(a,a.p.postData,"load_"+a.p.id);else{b.isFunction(a.p.beforeRequest)&&a.p.beforeRequest.call(a);l=a.p.datatype.toLowerCase();switch(l){case "json":case "jsonp":case "xml":case "script":b.ajax(b.extend({url:a.p.url,type:a.p.mtype,  
dataType:l,data:b.isFunction(a.p.serializeGridData)?a.p.serializeGridData.call(a,a.p.postData):a.p.postData,success:function(s){l==="xml"?ia(s,a.grid.bDiv,y,c>1,w):ra(s,a.grid.bDiv,y,c>1,w);o&&o.call(a,s);d&&a.grid.populateVisible();if(a.p.loadonce||a.p.treeGrid)a.p.datatype="local";ja()},error:function(s,r,v){b.isFunction(a.p.loadError)&&a.p.loadError.call(a,s,r,v);ja()},beforeSend:function(s){oa();b.isFunction(a.p.loadBeforeSend)&&a.p.loadBeforeSend.call(a,s)}},b.jgrid.ajaxOptions,a.p.ajaxGridOptions));  
break;case "xmlstring":oa();e=b.jgrid.stringToDoc(a.p.datastr);p&&a.p.loadComplete.call(a,e);ia(e,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;ja();break;case "jsonstring":oa();e=typeof a.p.datastr=="string"?b.jgrid.parse(a.p.datastr):a.p.datastr;p&&a.p.loadComplete.call(a,e);ra(e,a.grid.bDiv);a.p.datatype="local";a.p.datastr=null;ja();break;case "local":case "clientside":oa();a.p.datatype="local";p&&a.p.loadComplete.call(a,"");Aa();na(true,true);ja();break}}}},oa=function(){a.grid.hDiv.loading=  
true;if(!a.p.hiddengrid)switch(a.p.loadui){case "disable":break;case "enable":b("#load_"+a.p.id).show();break;case "block":b("#lui_"+a.p.id).show();b("#load_"+a.p.id).show();break}},ja=function(){a.grid.hDiv.loading=false;switch(a.p.loadui){case "disable":break;case "enable":b("#load_"+a.p.id).hide();break;case "block":b("#lui_"+a.p.id).hide();b("#load_"+a.p.id).hide();break}},Aa=function(){var c=/[\$,%]/g,d=[],e=0,l,n,o,p=a.p.sortorder=="asc"?1:-1,w=false,y;b.each(a.p.colModel,function(r){if(this.index==  
a.p.sortname||this.name==a.p.sortname){if(a.p.lastsort==r)w=true;e=r;l=this.sorttype;return false}});o=l=="float"||l=="number"||l=="currency"?function(r){r=parseFloat(r.replace(c,""));return isNaN(r)?0:r}:l=="int"||l=="integer"?function(r){return J(r.replace(c,""),0)}:l=="date"||l=="datetime"?function(r){return Ba(a.p.colModel[e].datefmt||"Y-m-d",r).getTime()}:b.isFunction(l)?l:function(r){return b.trim(r.toUpperCase())};y=a.p.colModel[e];b.each(a.rows,function(r,v){try{n=b.unformat(b(v).children("td").eq(e),  
{rowId:v.id,colModel:y},e,true)}catch(z){n=b(v).children("td").eq(e).text()}v.sortKey=o(n);d[r]=this});if(a.p.treeGrid)b(a).jqGrid("SortTree",p);else{w?d.reverse():d.sort(function(r,v){if(r.sortKey<v.sortKey)return-p;if(r.sortKey>v.sortKey)return p;return 0});if(d[0]){b("td",d[0]).each(function(r){b(this).css("width",g.headers[r].width+"px")});a.grid.cols=d[0].cells}var s="";if(a.p.altRows)s=a.p.altclass;b.each(d,function(r,v){if(s)r%2==1?b(v).addClass(s):b(v).removeClass(s);b("tbody",a.grid.bDiv).append(v);  
v.sortKey=null})}a.grid.bDiv.scrollTop=0},Ba=function(c,d){var e={m:1,d:1,y:1970,h:0,i:0,s:0},l,n,o;if(d=b.trim(d)){d=d.split(/[\\\/:_;.\t\T\s-]/);c=c.split(/[\\\/:_;.\t\T\s-]/);var p=b.jgrid.formatter.date.monthNames,w=b.jgrid.formatter.date.AmPm,y=function(s,r){if(s===0){if(r==12)r=0}else if(r!=12)r+=12;return r};l=0;for(n=c.length;l<n;l++){if(c[l]=="M"){o=b.inArray(d[l],p);if(o!==-1&&o<12)d[l]=o+1}if(c[l]=="F"){o=b.inArray(d[l],p);if(o!==-1&&o>11)d[l]=o+1-12}if(c[l]=="a"){o=b.inArray(d[l],w);if(o!==  
-1&&o<2&&d[l]==w[o]){d[l]=o;e.h=y(d[l],e.h)}}if(c[l]=="A"){o=b.inArray(d[l],w);if(o!==-1&&o>1&&d[l]==w[o]){d[l]=o-2;e.h=y(d[l],e.h)}}e[c[l].toLowerCase()]=parseInt(d[l],10)}e.m=parseInt(e.m,10)-1;c=e.y;if(c>=70&&c<=99)e.y=1900+e.y;else if(c>=0&&c<=69)e.y=2E3+e.y}return new Date(e.y,e.m,e.d,e.h,e.i,e.s,0)};t=function(c,d){var e="",l="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",n="",o,p,w,y,s=function(r){var v;if(b.isFunction(a.p.onPaging))v=  
a.p.onPaging.call(a,r);a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];if(v=="stop")return false;return true};c=c.substr(1);o="pg_"+c;p=c+"_left";w=c+"_center";y=c+"_right";b("#"+c).append("<div id='"+o+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;' role='row'><tbody><tr><td id='"+p+"' align='left'></td><td id='"+  
w+"' align='center' style='white-space:pre;'></td><td id='"+y+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(a.p.rowList.length>0){n="<td dir='"+m+"'>";n+="<select class='ui-pg-selbox' role='listbox'>";for(p=0;p<a.p.rowList.length;p++)n+="<option role='option' value='"+a.p.rowList[p]+"'"+(a.p.rowNum==a.p.rowList[p]?" selected":"")+">"+a.p.rowList[p]+"</option>";n+="</select></td>"}if(m=="rtl")l+=n;if(a.p.pginput===true)e="<td dir='"+m+"'>"+b.jgrid.format(a.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>",  
"<span id='sp_1'></span>")+"</td>";if(a.p.pgbuttons===true){p=["first"+d,"prev"+d,"next"+d,"last"+d];m=="rtl"&&p.reverse();l+="<td id='"+p[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";l+="<td id='"+p[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";l+=e!=""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+e+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":  
"";l+="<td id='"+p[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";l+="<td id='"+p[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(e!="")l+=e;if(m=="ltr")l+=n;l+="</tr></tbody></table>";a.p.viewrecords===true&&b("td#"+c+"_"+a.p.recordpos,"#"+o).append("<div dir='"+m+"' style='text-align:"+a.p.recordpos+"' class='ui-paging-info'></div>");b("td#"+c+"_"+a.p.pagerpos,"#"+o).append(l);n=b(".ui-jqgrid").css("font-size")||  
"11px";b("body").append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+n+";visibility:hidden;' ></div>");l=b(l).clone().appendTo("#testpg").width();b("#testpg").remove();if(l>0){if(e!="")l+=50;b("td#"+c+"_"+a.p.pagerpos,"#"+o).width(l)}a.p._nvtd=[];a.p._nvtd[0]=l?Math.floor((a.p.width-l)/2):Math.floor(a.p.width/3);a.p._nvtd[1]=0;l=null;b(".ui-pg-selbox","#"+o).bind("change",function(){a.p.page=Math.round(a.p.rowNum*(a.p.page-1)/this.value-0.5)+1;a.p.rowNum=this.value;  
if(d)b(".ui-pg-selbox",a.p.pager).val(this.value);else a.p.toppager&&b(".ui-pg-selbox",a.p.toppager).val(this.value);if(!s("records"))return false;Y();return false});if(a.p.pgbuttons===true){b(".ui-pg-button","#"+o).hover(function(){if(b(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{b(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!b(this).hasClass("ui-state-disabled")){b(this).removeClass("ui-state-hover");this.style.cursor="default"}});b("#first"+  
d+", #prev"+d+", #next"+d+", #last"+d,"#"+c).click(function(){var r=J(a.p.page,1),v=J(a.p.lastpage,1),z=false,D=true,N=true,L=true,P=true;if(v===0||v===1)P=L=N=D=false;else if(v>1&&r>=1)if(r===1)N=D=false;else{if(!(r>1&&r<v))if(r===v)P=L=false}else if(v>1&&r===0){P=L=false;r=v-1}if(this.id==="first"+d&&D){a.p.page=1;z=true}if(this.id==="prev"+d&&N){a.p.page=r-1;z=true}if(this.id==="next"+d&&L){a.p.page=r+1;z=true}if(this.id==="last"+d&&P){a.p.page=v;z=true}if(z){if(!s(this.id))return false;Y()}return false})}a.p.pginput===  
true&&b("input.ui-pg-input","#"+o).keypress(function(r){if((r.charCode?r.charCode:r.keyCode?r.keyCode:0)==13){a.p.page=b(this).val()>0?b(this).val():a.p.page;if(!s("user"))return false;Y();return false}return this})};var xa=function(c,d,e,l){if(a.p.colModel[d].sortable)if(!(a.p.savedRow.length>0)){if(!e){if(a.p.lastsort==d)if(a.p.sortorder=="asc")a.p.sortorder="desc";else{if(a.p.sortorder=="desc")a.p.sortorder="asc"}else a.p.sortorder=a.p.colModel[d].firstsortorder||"asc";a.p.page=1}if(l)if(a.p.lastsort==  
d&&a.p.sortorder==l&&!e)return;else a.p.sortorder=l;e=b("thead:first",a.grid.hDiv).get(0);b("tr th:eq("+a.p.lastsort+") span.ui-grid-ico-sort",e).addClass("ui-state-disabled");b("tr th:eq("+a.p.lastsort+")",e).attr("aria-selected","false");b("tr th:eq("+d+") span.ui-icon-"+a.p.sortorder,e).removeClass("ui-state-disabled");b("tr th:eq("+d+")",e).attr("aria-selected","true");if(!a.p.viewsortcols[0])if(a.p.lastsort!=d){b("tr th:eq("+a.p.lastsort+") span.s-ico",e).hide();b("tr th:eq("+d+") span.s-ico",  
e).show()}c=c.substring(5);a.p.sortname=a.p.colModel[d].index||c;e=a.p.sortorder;if(b.isFunction(a.p.onSortCol))if(a.p.onSortCol.call(a,c,d,e)=="stop"){a.p.lastsort=d;return}if(a.p.datatype=="local")a.p.deselectAfterSort&&b(a).jqGrid("resetSelection");else{a.p.selrow=null;a.p.multiselect&&b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false);a.p.selarrrow=[];a.p.savedRow=[];a.p.scroll&&aa(a.grid.bDiv,true)}a.p.subGrid&&a.p.datatype=="local"&&b("td.sgexpanded","#"+a.p.id).each(function(){b(this).trigger("click")});  
Y();a.p.lastsort=d;if(a.p.sortname!=c&&d)a.p.lastsort=d}},Ca=function(c){var d=c,e;for(e=c+1;e<a.p.colModel.length;e++)if(a.p.colModel[e].hidden!==true){d=e;break}return d-c},Da=function(c){var d,e={},l=C?0:a.p.cellLayout;for(d=e[0]=e[1]=e[2]=0;d<=c;d++)if(a.p.colModel[d].hidden===false)e[0]+=a.p.colModel[d].width+l;if(a.p.direction=="rtl")e[0]=a.p.width-e[0];e[0]-=a.grid.bDiv.scrollLeft;if(b(a.grid.cDiv).is(":visible"))e[1]+=b(a.grid.cDiv).height()+parseInt(b(a.grid.cDiv).css("padding-top"),10)+  
parseInt(b(a.grid.cDiv).css("padding-bottom"),10);if(a.p.toolbar[0]===true&&(a.p.toolbar[1]=="top"||a.p.toolbar[1]=="both"))e[1]+=b(a.grid.uDiv).height()+parseInt(b(a.grid.uDiv).css("border-top-width"),10)+parseInt(b(a.grid.uDiv).css("border-bottom-width"),10);if(a.p.toppager)e[1]+=b(a.grid.topDiv).height()+parseInt(b(a.grid.topDiv).css("border-bottom-width"),10);e[2]+=b(a.grid.bDiv).height()+b(a.grid.hDiv).height();return e};this.p.id=this.id;if(b.inArray(a.p.multikey,["shiftKey","altKey","ctrlKey"])==  
-1)a.p.multikey=false;a.p.keyIndex=false;for(j=0;j<a.p.colModel.length;j++)if(a.p.colModel[j].key===true){a.p.keyIndex=j;break}a.p.sortorder=a.p.sortorder.toLowerCase();if(this.p.treeGrid===true)try{b(this).jqGrid("setTreeGrid")}catch(Ha){}if(this.p.subGrid)try{b(a).jqGrid("setSubGrid")}catch(Ia){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width:C?a.p.multiselectWidth+a.p.cellLayout:  
a.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:a.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}a.p.xmlReader=b.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,  
cell:"cell"}},a.p.xmlReader);a.p.jsonReader=b.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},a.p.jsonReader);if(a.p.scroll){a.p.pgbuttons=false;a.p.pginput=false;a.p.rowList=[]}var H="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",ya,ba,sa,ka,pa,I,A,ea;ba=ea="";if(a.p.shrinkToFit===true&&a.p.forceFit===true)for(j=a.p.colModel.length-1;j>=0;j--)if(!a.p.colModel[j].hidden){a.p.colModel[j].resizable=  
false;break}if(a.p.viewsortcols[1]=="horizontal"){ea=" ui-i-asc";ba=" ui-i-desc"}ya=x?"class='ui-th-div-ie'":"";ea="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+ea+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+m+"'></span>";ea+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ba+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+m+"'></span></span>";for(j=0;j<this.p.colNames.length;j++){ba=a.p.headertitles?' title="'+b.jgrid.stripHtml(a.p.colNames[j])+  
'"':"";H+="<th id='"+a.p.id+"_"+a.p.colModel[j].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+m+"'"+ba+">";ba=a.p.colModel[j].index||a.p.colModel[j].name;H+="<div id='jqgh_"+a.p.colModel[j].name+"' "+ya+">"+a.p.colNames[j];a.p.colModel[j].width=a.p.colModel[j].width?parseInt(a.p.colModel[j].width,10):150;if(typeof a.p.colModel[j].title!=="boolean")a.p.colModel[j].title=true;if(ba==a.p.sortname)a.p.lastsort=j;H+=ea+"</div></th>"}H+="</tr></thead>";b(this).append(H);b("thead tr:first th",  
this).hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});if(this.p.multiselect){var ta=[],qa;b("#cb_"+b.jgrid.jqID(a.p.id),this).bind("click",function(){if(this.checked){b("[id^=jqg_]",a.rows).attr("checked",true);b(a.rows).each(function(c){if(!b(this).hasClass("subgrid")){b(this).addClass("ui-state-highlight").attr("aria-selected","true");a.p.selarrrow[c]=a.p.selrow=this.id}});qa=true;ta=[]}else{b("[id^=jqg_]",a.rows).attr("checked",false);b(a.rows).each(function(c){if(!b(this).hasClass("subgrid")){b(this).removeClass("ui-state-highlight").attr("aria-selected",  
"false");ta[c]=this.id}});a.p.selarrrow=[];a.p.selrow=null;qa=false}if(b.isFunction(a.p.onSelectAll))a.p.onSelectAll.call(a,qa?a.p.selarrrow:ta,qa)})}if(a.p.autowidth===true){H=b(K).innerWidth();a.p.width=H>0?H:"nw"}(function(){var c=0,d=a.p.cellLayout,e=0,l,n=a.p.scrollOffset,o,p=false,w,y=0,s=0,r=0,v;if(C)d=0;b.each(a.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;if(this.hidden===false){c+=J(this.width,0);if(this.fixed){y+=this.width;s+=this.width+d}else e++;r++}});  
if(isNaN(a.p.width))a.p.width=g.width=c;else g.width=a.p.width;a.p.tblwidth=c;if(a.p.shrinkToFit===false&&a.p.forceFit===true)a.p.forceFit=false;if(a.p.shrinkToFit===true&&e>0){w=g.width-d*e-s;if(!isNaN(a.p.height)){w-=n;p=true}c=0;b.each(a.p.colModel,function(z){if(this.hidden===false&&!this.fixed){this.width=o=Math.round(w*this.width/(a.p.tblwidth-y));c+=o;l=z}});v=0;if(p){if(g.width-s-(c+d*e)!==n)v=g.width-s-(c+d*e)-n}else if(!p&&Math.abs(g.width-s-(c+d*e))!==1)v=g.width-s-(c+d*e);a.p.colModel[l].width+=  
v;a.p.tblwidth=c+v+y+r*d;if(a.p.tblwidth>a.p.width){a.p.colModel[l].width-=a.p.tblwidth-parseInt(a.p.width,10);a.p.tblwidth=a.p.width}}})();b(K).css("width",g.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+a.p.id+"'>&#160;</div>");b(q).css("width",g.width+"px");H=b("thead:first",a).get(0);var ua="<table role='grid' style='width:"+a.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+  
m+"'>";q=b("tr:first",H);a.p.disableClick=false;b("th",q).each(function(c){sa=a.p.colModel[c].width;if(typeof a.p.colModel[c].resizable==="undefined")a.p.colModel[c].resizable=true;if(a.p.colModel[c].resizable){ka=document.createElement("span");b(ka).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+m);b.browser.opera||b(ka).css("cursor","col-resize");b(this).addClass(a.p.resizeclass)}else ka="";b(this).css("width",sa+"px").prepend(ka);a.p.colModel[c].hidden&&b(this).css("display","none");  
g.headers[c]={width:sa,el:this};pa=a.p.colModel[c].sortable;if(typeof pa!=="boolean")pa=a.p.colModel[c].sortable=true;var d=a.p.colModel[c].name;d=="cb"||d=="subgrid"||d=="rn"||a.p.viewsortcols[2]&&b("div",this).addClass("ui-jqgrid-sortable");if(pa)if(a.p.viewsortcols[0]){b("div span.s-ico",this).show();c==a.p.lastsort&&b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}else if(c==a.p.lastsort){b("div span.s-ico",this).show();b("div span.ui-icon-"+a.p.sortorder,this).removeClass("ui-state-disabled")}ua+=  
"<td role='gridcell' "+F(c,0,"")+">&#160;</td>"}).mousedown(function(c){if(b(c.target).closest("th>span.ui-jqgrid-resize").length==1){var d=b.jgrid.getCellIndex(this);if(a.p.forceFit===true)a.p.nv=Ca(d);g.dragStart(d,c,Da(d));return false}}).click(function(c){if(a.p.disableClick)return a.p.disableClick=false;var d="th>div.ui-jqgrid-sortable",e,l;a.p.viewsortcols[2]||(d="th>div>span>span.ui-grid-ico-sort");c=b(c.target).closest(d);if(c.length==1){d=b.jgrid.getCellIndex(this);if(!a.p.viewsortcols[2]){e=  
true;l=c.attr("sort")}xa(b("div",this)[0].id,d,e,l);return false}});if(a.p.sortable&&b.fn.sortable)try{b(a).jqGrid("sortableColumns",q)}catch(Ja){}ua+="</tr></tbody></table>";this.appendChild(document.createElement("tbody"));b(this).addClass("ui-jqgrid-btable");q=b("<table class='ui-jqgrid-htable' style='width:"+a.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(H);var T=a.p.caption&&a.p.hiddengrid===true?true:false;H=b("<div class='ui-jqgrid-hbox"+  
(m=="rtl"?"-rtl":"")+"'></div>");g.hDiv=document.createElement("div");b(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(H);b(H).append(q);T&&b(g.hDiv).hide();if(a.p.pager){if(typeof a.p.pager=="string"){if(a.p.pager.substr(0,1)!="#")a.p.pager="#"+a.p.pager}else a.p.pager="#"+b(a.p.pager).attr("id");b(a.p.pager).css({width:g.width+"px"}).appendTo(K).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");T&&b(a.p.pager).hide();t(a.p.pager,"")}a.p.cellEdit===  
false&&a.p.hoverrows===true&&b(a).bind("mouseover",function(c){A=b(c.target).closest("tr.jqgrow");b(A).attr("class")!=="subgrid"&&b(A).addClass("ui-state-hover");return false}).bind("mouseout",function(c){A=b(c.target).closest("tr.jqgrow");b(A).removeClass("ui-state-hover");return false});var Z,$;b(a).before(g.hDiv).click(function(c){I=c.target;var d=b(I).hasClass("cbox");A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===0)return this;var e=true;if(b.isFunction(a.p.beforeSelectRow))e=a.p.beforeSelectRow.call(a,  
A[0].id,c);if(I.tagName=="A"||(I.tagName=="INPUT"||I.tagName=="TEXTAREA"||I.tagName=="OPTION"||I.tagName=="SELECT")&&!d)return this;if(e===true){if(a.p.cellEdit===true)if(a.p.multiselect&&d)b(a).jqGrid("setSelection",A[0].id,true);else{Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);try{b(a).jqGrid("editCell",Z,$,true)}catch(l){}}else if(a.p.multikey)if(c[a.p.multikey])b(a).jqGrid("setSelection",A[0].id,true);else{if(a.p.multiselect&&d){d=b("[id^=jqg_]",A).attr("checked");b("[id^=jqg_]",A).attr("checked",  
!d)}}else{if(a.p.multiselect&&a.p.multiboxonly)if(!d){b(a.p.selarrrow).each(function(n,o){n=a.rows.namedItem(o);b(n).removeClass("ui-state-highlight");b("#jqg_"+b.jgrid.jqID(o),n).attr("checked",false)});a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}b(a).jqGrid("setSelection",A[0].id,true)}if(b.isFunction(a.p.onCellSelect)){Z=A[0].id;$=b.jgrid.getCellIndex(I);a.p.onCellSelect.call(a,Z,$,b(I).html(),c)}c.stopPropagation()}else return this}).bind("reloadGrid",function(c,  
d){if(a.p.treeGrid===true)a.p.datatype=a.p.treedatatype;d&&d.current&&a.grid.selectionPreserver(a);if(a.p.datatype=="local")b(a).jqGrid("resetSelection");else if(!a.p.treeGrid){a.p.selrow=null;if(a.p.multiselect){a.p.selarrrow=[];b("#cb_"+b.jgrid.jqID(a.p.id),a.grid.hDiv).attr("checked",false)}a.p.savedRow=[];a.p.scroll&&aa(a.grid.bDiv,true)}if(d&&d.page){c=d.page;if(c>a.p.lastpage)c=a.p.lastpage;if(c<1)c=1;a.p.page=c;a.grid.bDiv.scrollTop=a.grid.prevRowHeight?(c-1)*a.grid.prevRowHeight*a.p.rowNum:  
0}if(a.grid.prevRowHeight&&a.p.scroll){delete a.p.lastpage;a.grid.populateVisible()}else a.grid.populate();return false});b.isFunction(this.p.ondblClickRow)&&b(this).dblclick(function(c){I=c.target;A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===0)return false;Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);a.p.ondblClickRow.call(a,b(A).attr("id"),Z,$,c);return false});b.isFunction(this.p.onRightClickRow)&&b(this).bind("contextmenu",function(c){I=c.target;A=b(I,a.rows).closest("tr.jqgrow");if(b(A).length===  
0)return false;a.p.multiselect||b(a).jqGrid("setSelection",A[0].id,true);Z=A[0].rowIndex;$=b.jgrid.getCellIndex(I);a.p.onRightClickRow.call(a,b(A).attr("id"),Z,$,c);return false});g.bDiv=document.createElement("div");b(g.bDiv).append(b('<div style="position:relative;'+(x&&b.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:a.p.height+(isNaN(a.p.height)?"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);b("table:first",g.bDiv).css({width:a.p.tblwidth+  
"px"});if(x){b("tbody",this).size()==2&&b("tbody:first",this).remove();a.p.multikey&&b(g.bDiv).bind("selectstart",function(){return false})}else a.p.multikey&&b(g.bDiv).bind("mousedown",function(){return false});T&&b(g.bDiv).hide();g.cDiv=document.createElement("div");var va=a.p.hidegrid===true?b("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){va.addClass("ui-state-hover")},function(){va.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(m==  
"rtl"?"left":"right","0px"):"";b(g.cDiv).append(va).append("<span class='ui-jqgrid-title"+(m=="rtl"?"-rtl":"")+"'>"+a.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");b(g.cDiv).insertBefore(g.hDiv);if(a.p.toolbar[0]){g.uDiv=document.createElement("div");if(a.p.toolbar[1]=="top")b(g.uDiv).insertBefore(g.hDiv);else a.p.toolbar[1]=="bottom"&&b(g.uDiv).insertAfter(g.hDiv);if(a.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");b(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id",  
"t_"+this.id);b(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);T&&b(g.ubDiv).hide()}else b(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);T&&b(g.uDiv).hide()}if(a.p.toppager){a.p.toppager=a.p.id+"_toppager";g.topDiv=b("<div id='"+a.p.toppager+"'></div>")[0];a.p.toppager="#"+a.p.toppager;b(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);t(a.p.toppager,"_t")}if(a.p.footerrow){g.sDiv=  
b("<div class='ui-jqgrid-sdiv'></div>")[0];H=b("<div class='ui-jqgrid-hbox"+(m=="rtl"?"-rtl":"")+"'></div>");b(g.sDiv).append(H).insertAfter(g.hDiv).width(g.width);b(H).append(ua);g.footers=b(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(a.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";T&&b(g.sDiv).hide()}if(a.p.caption){var Ea=a.p.datatype;if(a.p.hidegrid===true){b(".ui-jqgrid-titlebar-close",g.cDiv).click(function(c){var d=b.isFunction(a.p.onHeaderClick);if(a.p.gridstate==  
"visible"){b(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.p.id).slideUp("fast");a.p.pager&&b(a.p.pager).slideUp("fast");a.p.toppager&&b(a.p.toppager).slideUp("fast");if(a.p.toolbar[0]===true){a.p.toolbar[1]=="both"&&b(g.ubDiv).slideUp("fast");b(g.uDiv).slideUp("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+a.p.id).slideUp("fast");b("span",this).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");a.p.gridstate="hidden";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&  
b(".ui-resizable-handle","#gbox_"+a.p.id).hide();if(d)T||a.p.onHeaderClick.call(a,a.p.gridstate,c)}else if(a.p.gridstate=="hidden"){b(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.p.id).slideDown("fast");a.p.pager&&b(a.p.pager).slideDown("fast");a.p.toppager&&b(a.p.toppager).slideDown("fast");if(a.p.toolbar[0]===true){a.p.toolbar[1]=="both"&&b(g.ubDiv).slideDown("fast");b(g.uDiv).slideDown("fast")}a.p.footerrow&&b(".ui-jqgrid-sdiv","#gbox_"+a.p.id).slideDown("fast");b("span",this).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");  
if(T){a.p.datatype=Ea;Y();T=false}a.p.gridstate="visible";b("#gbox_"+a.p.id).hasClass("ui-resizable")&&b(".ui-resizable-handle","#gbox_"+a.p.id).show();d&&a.p.onHeaderClick.call(a,a.p.gridstate,c)}return false});if(T){a.p.datatype="local";b(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else b(g.cDiv).hide();b(g.hDiv).after(g.bDiv).mousemove(function(c){if(g.resizing){g.dragMove(c);return false}});b(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});b(document).mouseup(function(){if(g.resizing){g.dragEnd();  
return false}return true});this.updateColumns=function(){var c=this.rows[0],d=this;if(c){b("td",c).each(function(e){b(this).css("width",d.grid.headers[e].width+"px")});this.grid.cols=c.cells}return this};a.formatCol=F;a.sortData=xa;a.updatepager=na;a.formatter=function(c,d,e,l,n){return M(c,d,e,l,n)};b.extend(g,{populate:Y,emptyRows:aa});this.grid=g;a.addXmlData=function(c){ia(c,a.grid.bDiv)};a.addJSONData=function(c){ra(c,a.grid.bDiv)};Y();a.p.hiddengrid=false;b(window).unload(function(){a=null})}}})};  
b.jgrid.extend({getGridParam:function(f){var k=this[0];if(k.grid)return f?typeof k.p[f]!="undefined"?k.p[f]:null:k.p},setGridParam:function(f){return this.each(function(){this.grid&&typeof f==="object"&&b.extend(true,this.p,f)})},getDataIDs:function(){var f=[],k=0,i;this.each(function(){if((i=this.rows.length)&&i>0)for(;k<i;){f[k]=this.rows[k].id;k++}});return f},setSelection:function(f,k){return this.each(function(){function i(a){var q=b(h.grid.bDiv)[0].clientHeight,t=b(h.grid.bDiv)[0].scrollTop,  
x=h.rows[a].offsetTop;a=h.rows[a].clientHeight;if(x+a>=q+t)b(h.grid.bDiv)[0].scrollTop=x-(q+t)+a+t;else if(x<q+t)if(x<t)b(h.grid.bDiv)[0].scrollTop=x}var h=this,g,j,m;if(f!==undefined){k=k===false?false:true;if(j=h.rows.namedItem(f+"")){if(h.p.scrollrows===true){g=h.rows.namedItem(f).rowIndex;g>=0&&i(g)}if(h.p.multiselect){h.p.selrow=j.id;m=b.inArray(h.p.selrow,h.p.selarrrow);if(m===-1){j.className!=="ui-subgrid"&&b(j).addClass("ui-state-highlight").attr("aria-selected","true");g=true;b("#jqg_"+b.jgrid.jqID(h.p.selrow),  
h.rows[j.rowIndex]).attr("checked",g);h.p.selarrrow.push(h.p.selrow);h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,g)}else{j.className!=="ui-subgrid"&&b(j).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;b("#jqg_"+b.jgrid.jqID(h.p.selrow),h.rows[j.rowIndex]).attr("checked",g);h.p.selarrrow.splice(m,1);h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,g);j=h.p.selarrrow[0];h.p.selrow=j===undefined?null:j}}else if(j.className!=="ui-subgrid"){h.p.selrow&&b(h.rows.namedItem(h.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected",  
"false");h.p.selrow=j.id;b(j).addClass("ui-state-highlight").attr("aria-selected","true");h.p.onSelectRow&&k&&h.p.onSelectRow.call(h,h.p.selrow,true)}}}})},resetSelection:function(){return this.each(function(){var f=this,k;if(f.p.multiselect){b(f.p.selarrrow).each(function(i,h){k=f.rows.namedItem(h);b(k).removeClass("ui-state-highlight").attr("aria-selected","false");b("#jqg_"+b.jgrid.jqID(h),k).attr("checked",false)});b("#cb_"+b.jgrid.jqID(f.p.id),f.grid.hDiv).attr("checked",false);f.p.selarrrow=  
[]}else if(f.p.selrow){b("tr#"+b.jgrid.jqID(f.p.selrow),f.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");f.p.selrow=null}f.p.savedRow=[]})},getRowData:function(f){var k={},i,h=false,g,j=0;this.each(function(){var m=this,a,q;if(typeof f=="undefined"){h=true;i=[];g=m.rows.length}else{q=m.rows.namedItem(f);if(!q)return k;g=1}for(;j<g;){if(h)q=m.rows[j];b("td",q).each(function(t){a=m.p.colModel[t].name;if(a!=="cb"&&a!=="subgrid")if(m.p.treeGrid===true&&a==m.p.ExpandColumn)k[a]=  
b.jgrid.htmlDecode(b("span:first",this).html());else try{k[a]=b.unformat(this,{rowId:q.id,colModel:m.p.colModel[t]},t)}catch(x){k[a]=b.jgrid.htmlDecode(b(this).html())}});j++;if(h){i.push(k);k={}}}});return i?i:k},delRowData:function(f){var k=false,i,h,g;this.each(function(){var j=this;if(i=j.rows.namedItem(f)){g=i.rowIndex;b(i).remove();j.p.records--;j.p.reccount--;j.updatepager(true,false);k=true;if(j.p.multiselect){h=b.inArray(f,j.p.selarrrow);h!=-1&&j.p.selarrrow.splice(h,1)}if(f==j.p.selrow)j.p.selrow=  
null}else return false;g===0&&k&&j.updateColumns();if(j.p.altRows===true&&k){var m=j.p.altclass;b(j.rows).each(function(a){a%2==1?b(this).addClass(m):b(this).removeClass(m)})}});return k},setRowData:function(f,k,i){var h,g=false,j;this.each(function(){var m=this,a,q,t=typeof i;if(!m.grid)return false;q=m.rows.namedItem(f);if(!q)return false;k&&b(this.p.colModel).each(function(x){h=this.name;if(k[h]!==undefined){a=m.formatter(f,k[h],x,k,"edit");j=this.title?{title:b.jgrid.stripHtml(a)}:{};m.p.treeGrid===  
true&&h==m.p.ExpandColumn?b("td:eq("+x+") > span:first",q).html(a).attr(j):b("td:eq("+x+")",q).html(a).attr(j);g=true}});if(t==="string")b(q).addClass(i);else t==="object"&&b(q).css(i)});return g},addRowData:function(f,k,i,h){i||(i="last");var g=false,j,m,a,q,t,x,C,K,J="",F,Q,M,R;if(k){if(b.isArray(k)){F=true;i="last";Q=f}else{k=[k];F=false}this.each(function(){var u=this,la=k.length;t=u.p.rownumbers===true?1:0;a=u.p.multiselect===true?1:0;q=u.p.subGrid===true?1:0;if(!F)if(typeof f!="undefined")f+=  
"";else{f=u.p.records+1+"";if(u.p.keyIndex!==false){Q=u.p.colModel[u.p.keyIndex+a+q+t].name;if(typeof k[0][Q]!="undefined")f=k[0][Q]}}M=u.p.altclass;for(var ca=0,fa="",aa=b.isFunction(u.p.afterInsertRow)?true:false;ca<la;){R=k[ca];m="";if(F){try{f=R[Q]}catch(U){f=u.p.records+1}fa=u.p.altRows===true?(u.rows.length-1)%2===0?M:"":""}if(t){J=u.formatCol(t,1,"");m+='<td role="gridcell" aria-describedby="'+u.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+J+">0</td>"}if(a){K='<input role="checkbox" type="checkbox" id="jqg_'+  
f+'" class="cbox"/>';J=u.formatCol(t,1,"");m+='<td role="gridcell" aria-describedby="'+u.p.id+'_cb" '+J+">"+K+"</td>"}if(q)m+=b(u).jqGrid("addSubGridCell",a+t,1);for(C=a+q+t;C<this.p.colModel.length;C++){j=this.p.colModel[C].name;K=u.formatter(f,R[j],C,R,"add");J=u.formatCol(C,1,K);m+='<td role="gridcell" aria-describedby="'+u.p.id+"_"+j+'" '+J+">"+K+"</td>"}m='<tr id="'+f+'" role="row" class="ui-widget-content jqgrow ui-row-'+u.p.direction+" "+fa+'">'+m+"</tr>";if(u.p.subGrid===true){m=b(m)[0];b(u).jqGrid("addSubGrid",  
m,a+t)}if(u.rows.length===0)b("table:first",u.grid.bDiv).append(m);else switch(i){case "last":b(u.rows[u.rows.length-1]).after(m);break;case "first":b(u.rows[0]).before(m);break;case "after":if(x=u.rows.namedItem(h))b(u.rows[x.rowIndex+1]).hasClass("ui-subgrid")?b(u.rows[x.rowIndex+1]).after(m):b(x).after(m);break;case "before":if(x=u.rows.namedItem(h)){b(x).before(m);x=x.rowIndex}break}u.p.records++;u.p.reccount++;if(!u.grid.cols||!u.grid.cols.length)u.grid.cols=u.rows[0].cells;if(i==="first"||i===  
"before"&&x<=1||u.rows.length===1)u.updateColumns();aa&&u.p.afterInsertRow.call(u,f,R,R);ca++}if(u.p.altRows===true&&!F)if(i=="last")(u.rows.length-1)%2==1&&b(u.rows[u.rows.length-1]).addClass(M);else b(u.rows).each(function(ia){ia%2==1?b(this).addClass(M):b(this).removeClass(M)});u.updatepager(true,true);g=true})}return g},footerData:function(f,k,i){function h(q){for(var t in q)if(q.hasOwnProperty(t))return false;return true}var g,j=false,m={},a;if(typeof f=="undefined")f="get";if(typeof i!="boolean")i=  
true;f=f.toLowerCase();this.each(function(){var q=this,t;if(!q.grid||!q.p.footerrow)return false;if(f=="set")if(h(k))return false;j=true;b(this.p.colModel).each(function(x){g=this.name;if(f=="set"){if(k[g]!==undefined){t=i?q.formatter("",k[g],x,k,"edit"):k[g];a=this.title?{title:b.jgrid.stripHtml(t)}:{};b("tr.footrow td:eq("+x+")",q.grid.sDiv).html(t).attr(a);j=true}}else if(f=="get")m[g]=b("tr.footrow td:eq("+x+")",q.grid.sDiv).html()})});return f=="get"?m:j},ShowHideCol:function(f,k){return this.each(function(){var i=  
this,h=false;if(i.grid){if(typeof f==="string")f=[f];k=k!="none"?"":"none";var g=k==""?true:false;b(this.p.colModel).each(function(j){if(b.inArray(this.name,f)!==-1&&this.hidden===g){b("tr",i.grid.hDiv).each(function(){b("th:eq("+j+")",this).css("display",k)});b(i.rows).each(function(m){b("td:eq("+j+")",i.rows[m]).css("display",k)});i.p.footerrow&&b("td:eq("+j+")",i.grid.sDiv).css("display",k);if(k=="none")i.p.tblwidth-=this.width;else i.p.tblwidth+=this.width;this.hidden=!g;h=true}});if(h===true){b("table:first",  
i.grid.hDiv).width(i.p.tblwidth);b("table:first",i.grid.bDiv).width(i.p.tblwidth);i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;if(i.p.footerrow){b("table:first",i.grid.sDiv).width(i.p.tblwidth);i.grid.sDiv.scrollLeft=i.grid.bDiv.scrollLeft}}}})},hideCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"none")})},showCol:function(f){return this.each(function(){b(this).jqGrid("ShowHideCol",f,"")})},remapColumns:function(f,k,i){function h(m){var a;a=m.length?b.makeArray(m):b.extend({},  
m);b.each(f,function(q){m[q]=a[this]})}function g(m,a){b(">tr"+(a||""),m).each(function(){var q=this,t=b.makeArray(q.cells);b.each(f,function(){var x=t[this];x&&q.appendChild(x)})})}var j=this.get(0);h(j.p.colModel);h(j.p.colNames);h(j.grid.headers);g(b("thead:first",j.grid.hDiv),i&&":not(.ui-jqgrid-labels)");k&&g(b("tbody:first",j.grid.bDiv),".jqgrow");j.p.footerrow&&g(b("tbody:first",j.grid.sDiv));if(j.p.remapColumns)if(j.p.remapColumns.length)h(j.p.remapColumns);else j.p.remapColumns=b.makeArray(f);  
j.p.lastsort=b.inArray(j.p.lastsort,f);if(j.p.treeGrid)j.p.expColInd=b.inArray(j.p.expColInd,f)},setGridWidth:function(f,k){return this.each(function(){var i=this,h,g=0,j=i.p.cellLayout,m,a=0,q=false,t=i.p.scrollOffset,x,C=0,K=0,J=0,F;if(i.grid){if(typeof k!="boolean")k=i.p.shrinkToFit;if(!isNaN(f)){f=parseInt(f,10);i.grid.width=i.p.width=f;b("#gbox_"+i.p.id).css("width",f+"px");b("#gview_"+i.p.id).css("width",f+"px");b(i.grid.bDiv).css("width",f+"px");b(i.grid.hDiv).css("width",f+"px");i.p.pager&&  
b(i.p.pager).css("width",f+"px");i.p.toppager&&b(i.p.toppager).css("width",f+"px");if(i.p.toolbar[0]===true){b(i.grid.uDiv).css("width",f+"px");i.p.toolbar[1]=="both"&&b(i.grid.ubDiv).css("width",f+"px")}i.p.footerrow&&b(i.grid.sDiv).css("width",f+"px");if(k===false&&i.p.forceFit===true)i.p.forceFit=false;if(k===true){if(b.browser.safari)j=0;b.each(i.p.colModel,function(){if(this.hidden===false){g+=parseInt(this.width,10);if(this.fixed){K+=this.width;C+=this.width+j}else a++;J++}});if(a!==0){i.p.tblwidth=  
g;x=f-j*a-C;if(!isNaN(i.p.height))if(b(i.grid.bDiv)[0].clientHeight<b(i.grid.bDiv)[0].scrollHeight){q=true;x-=t}g=0;var Q=i.grid.cols.length>0;b.each(i.p.colModel,function(M){if(this.hidden===false&&!this.fixed){h=Math.round(x*this.width/(i.p.tblwidth-K));if(!(h<0)){this.width=h;g+=h;i.grid.headers[M].width=h;i.grid.headers[M].el.style.width=h+"px";if(i.p.footerrow)i.grid.footers[M].style.width=h+"px";if(Q)i.grid.cols[M].style.width=h+"px";m=M}}});F=0;if(q){if(f-C-(g+j*a)!==t)F=f-C-(g+j*a)-t}else if(Math.abs(f-  
C-(g+j*a))!==1)F=f-C-(g+j*a);i.p.colModel[m].width+=F;i.p.tblwidth=g+F+K+j*J;if(i.p.tblwidth>f){q=i.p.tblwidth-parseInt(f,10);i.p.tblwidth=f;h=i.p.colModel[m].width-=q}else h=i.p.colModel[m].width;i.grid.headers[m].width=h;i.grid.headers[m].el.style.width=h+"px";if(Q)i.grid.cols[m].style.width=h+"px";b("table:first",i.grid.bDiv).css("width",i.p.tblwidth+"px");b("table:first",i.grid.hDiv).css("width",i.p.tblwidth+"px");i.grid.hDiv.scrollLeft=i.grid.bDiv.scrollLeft;if(i.p.footerrow){i.grid.footers[m].style.width=  
h+"px";b("table:first",i.grid.sDiv).css("width",i.p.tblwidth+"px")}}}}}})},setGridHeight:function(f){return this.each(function(){var k=this;if(k.grid){b(k.grid.bDiv).css({height:f+(isNaN(f)?"":"px")});k.p.height=f;k.p.scroll&&k.grid.populateVisible()}})},setCaption:function(f){return this.each(function(){this.p.caption=f;b("span.ui-jqgrid-title",this.grid.cDiv).html(f);b(this.grid.cDiv).show()})},setLabel:function(f,k,i,h){return this.each(function(){var g=this,j=-1;if(g.grid){if(isNaN(f))b(g.p.colModel).each(function(q){if(this.name==  
f){j=q;return false}});else j=parseInt(f,10);if(j>=0){var m=b("tr.ui-jqgrid-labels th:eq("+j+")",g.grid.hDiv);if(k){var a=b(".s-ico",m);b("[id^=jqgh_]",m).empty().html(k).append(a);g.p.colNames[j]=k}if(i)typeof i==="string"?b(m).addClass(i):b(m).css(i);typeof h==="object"&&b(m).attr(h)}}})},setCell:function(f,k,i,h,g,j){return this.each(function(){var m=this,a=-1,q,t;if(m.grid){if(isNaN(k))b(m.p.colModel).each(function(C){if(this.name==k){a=C;return false}});else a=parseInt(k,10);if(a>=0)if(q=m.rows.namedItem(f)){var x=  
b("td:eq("+a+")",q);if(i!==""||j===true){q=m.formatter(f,i,a,q,"edit");t=m.p.colModel[a].title?{title:b.jgrid.stripHtml(q)}:{};m.p.treeGrid&&b(".tree-wrap",b(x)).length>0?b("span",b(x)).html(q).attr(t):b(x).html(q).attr(t)}if(typeof h==="string")b(x).addClass(h);else h&&b(x).css(h);typeof g==="object"&&b(x).attr(g)}}})},getCell:function(f,k){var i=false;this.each(function(){var h=this,g=-1;if(h.grid){if(isNaN(k))b(h.p.colModel).each(function(a){if(this.name===k){g=a;return false}});else g=parseInt(k,  
10);if(g>=0){var j=h.rows.namedItem(f);if(j)try{i=b.unformat(b("td:eq("+g+")",j),{rowId:j.id,colModel:h.p.colModel[g]},g)}catch(m){i=b.jgrid.htmlDecode(b("td:eq("+g+")",j).html())}}}});return i},getCol:function(f,k,i){var h=[],g,j=0;k=typeof k!="boolean"?false:k;if(typeof i=="undefined")i=false;this.each(function(){var m=this,a=-1;if(m.grid){if(isNaN(f))b(m.p.colModel).each(function(C){if(this.name===f){a=C;return false}});else a=parseInt(f,10);if(a>=0){var q=m.rows.length,t=0;if(q&&q>0){for(;t<q;){try{g=  
b.unformat(b(m.rows[t].cells[a]),{rowId:m.rows[t].id,colModel:m.p.colModel[a]},a)}catch(x){g=b.jgrid.htmlDecode(m.rows[t].cells[a].innerHTML)}if(i)j+=parseFloat(g);else if(k)h.push({id:m.rows[t].id,value:g});else h[t]=g;t++}if(i)switch(i.toLowerCase()){case "sum":h=j;break;case "avg":h=j/q;break;case "count":h=q;break}}}}});return h},clearGridData:function(f){return this.each(function(){var k=this;if(k.grid){if(typeof f!="boolean")f=false;b("tbody:first tr",k.grid.bDiv).remove();k.p.footerrow&&f&&  
b(".ui-jqgrid-ftable td",k.grid.sDiv).html("&#160;");k.p.selrow=null;k.p.selarrrow=[];k.p.savedRow=[];k.p.records=0;k.p.page="0";k.p.lastpage="0";k.p.reccount=0;k.updatepager(true,false)}})},getInd:function(f,k){var i=false,h;this.each(function(){if(h=this.rows.namedItem(f))i=k===true?h:h.rowIndex});return i}})})(jQuery);  
(function(c){function u(a,b,d,e,g){var h=b;if(c.fn.fmatter[a])h=c.fn.fmatter[a](b,d,e,g);return h}c.fmatter={};c.fn.fmatter=function(a,b,d,e,g){d=c.extend({},c.jgrid.formatter,d);return u(a,b,d,e,g)};c.fmatter.util={NumberFormat:function(a,b){isNumber(a)||(a*=1);if(isNumber(a)){var d=a<0,e=a+"",g=b.decimalSeparator?b.decimalSeparator:".";if(isNumber(b.decimalPlaces)){var h=b.decimalPlaces;e=Math.pow(10,h);e=Math.round(a*e)/e+"";a=e.lastIndexOf(".");if(h>0){if(a<0){e+=g;a=e.length-1}else if(g!==".")e=  
e.replace(".",g);for(;e.length-1-a<h;)e+="0"}}if(b.thousandsSeparator){h=b.thousandsSeparator;a=e.lastIndexOf(g);a=a>-1?a:e.length;g=e.substring(a);for(var f=-1,i=a;i>0;i--){f++;if(f%3===0&&i!==a&&(!d||i>1))g=h+g;g=e.charAt(i-1)+g}e=g}e=b.prefix?b.prefix+e:e;return e=b.suffix?e+b.suffix:e}else return a},DateFormat:function(a,b,d,e){var g=function(m,r){m=String(m);for(r=parseInt(r,10)||2;m.length<r;)m="0"+m;return m},h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},f=0,i,k,j=["i18n"];j.i18n={dayNames:e.dayNames,  
monthNames:e.monthNames};if(a in e.masks)a=e.masks[a];if(b.constructor===Date)f=b;else{b=b.split(/[\\\/:_;.\t\T\s-]/);a=a.split(/[\\\/:_;.\t\T\s-]/);i=0;for(k=a.length;i<k;i++){if(a[i]=="M"){f=c.inArray(b[i],j.i18n.monthNames);if(f!==-1&&f<12)b[i]=f+1}if(a[i]=="F"){f=c.inArray(b[i],j.i18n.monthNames);if(f!==-1&&f>11)b[i]=f+1-12}h[a[i].toLowerCase()]=parseInt(b[i],10)}h.m=parseInt(h.m,10)-1;f=h.y;if(f>=70&&f<=99)h.y=1900+h.y;else if(f>=0&&f<=69)h.y=2E3+h.y;f=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u)}if(d in  
e.masks)d=e.masks[d];else d||(d="Y-m-d");h=f.getHours();a=f.getMinutes();b=f.getDate();i=f.getMonth()+1;k=f.getTimezoneOffset();var l=f.getSeconds(),o=f.getMilliseconds(),n=f.getDay(),p=f.getFullYear(),q=(n+6)%7+1,s=(new Date(p,i-1,b)-new Date(p,0,1))/864E5,t={d:g(b),D:j.i18n.dayNames[n],j:b,l:j.i18n.dayNames[n+7],N:q,S:e.S(b),w:n,z:s,W:q<5?Math.floor((s+q-1)/7)+1:Math.floor((s+q-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:j.i18n.monthNames[i-1+12],m:g(i),M:j.i18n.monthNames[i-1],n:i,t:"?",  
L:"?",o:"?",Y:p,y:String(p).substring(2),a:h<12?e.AmPm[0]:e.AmPm[1],A:h<12?e.AmPm[2]:e.AmPm[3],B:"?",g:h%12||12,G:h,h:g(h%12||12),H:g(h),i:g(a),s:g(l),u:o,e:"?",I:"?",O:(k>0?"-":"+")+g(Math.floor(Math.abs(k)/60)*100+Math.abs(k)%60,4),P:"?",T:(String(f).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(f/1E3)};return d.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,  
function(m){return m in t?t[m]:m.substring(1)})}};c.fn.fmatter.defaultFormat=function(a,b){return isValue(a)&&a!==""?a:b.defaultValue?b.defaultValue:"&#160;"};c.fn.fmatter.email=function(a,b){return isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):'<a href="mailto:'+a+'">'+a+"</a>"};c.fn.fmatter.checkbox=function(a,b){var d=c.extend({},b.checkbox);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));b=d.disabled===true?"disabled":"";if(isEmpty(a)||isUndefined(a))a=c.fn.fmatter.defaultFormat(a,  
d);a+="";a=a.toLowerCase();return'<input type="checkbox" '+(a.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+a+'" offval="no" '+b+"/>"};c.fn.fmatter.link=function(a,b){var d={target:b.target},e="";isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(d.target)e="target="+d.target;return isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):"<a "+e+' href="'+a+'">'+a+"</a>"};c.fn.fmatter.showlink=function(a,b){var d={baseLinkUrl:b.baseLinkUrl,showAction:b.showAction,  
addParam:b.addParam||"",target:b.target,idName:b.idName},e="";isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(d.target)e="target="+d.target;d=d.baseLinkUrl+d.showAction+"?"+d.idName+"="+b.rowId+d.addParam;return isString(a)?"<a "+e+' href="'+d+'">'+a+"</a>":c.fn.fmatter.defaultFormat(a,b)};c.fn.fmatter.integer=function(a,b){var d=c.extend({},b.integer);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;  
return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.number=function(a,b){var d=c.extend({},b.number);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.currency=function(a,b){var d=c.extend({},b.currency);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));if(isEmpty(a))return d.defaultValue;return c.fmatter.util.NumberFormat(a,d)};c.fn.fmatter.date=  
function(a,b,d,e){d=c.extend({},b.date);isUndefined(b.colModel.formatoptions)||(d=c.extend({},d,b.colModel.formatoptions));return!d.reformatAfterEdit&&e=="edit"?c.fn.fmatter.defaultFormat(a,b):isEmpty(a)?c.fn.fmatter.defaultFormat(a,b):c.fmatter.util.DateFormat(d.srcformat,a,d.newformat,d)};c.fn.fmatter.select=function(a,b){a+="";var d=false,e=[];if(!isUndefined(b.colModel.editoptions))d=b.colModel.editoptions.value;if(d){var g=b.colModel.editoptions.multiple===true?true:false,h=[],f;if(g){h=a.split(",");  
h=c.map(h,function(l){return c.trim(l)})}if(isString(d))for(var i=d.split(";"),k=0,j=0;j<i.length;j++){f=i[j].split(":");if(f.length>2)f[1]=jQuery.map(f,function(l,o){if(o>0)return l}).join(":");if(g){if(jQuery.inArray(f[0],h)>-1){e[k]=f[1];k++}}else if(c.trim(f[0])==c.trim(a)){e[0]=f[1];break}}else if(isObject(d))if(g)e=jQuery.map(h,function(l){return d[l]});else e[0]=d[a]||""}a=e.join(", ");return a==""?c.fn.fmatter.defaultFormat(a,b):a};c.fn.fmatter.rowactions=function(a,b,d,e){switch(d){case "edit":d=  
function(){c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide()};c("#"+b).jqGrid("editRow",a,e,null,null,null,{oper:"edit"},d,null,d);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).hide();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).show();break;case "save":c("#"+b).jqGrid("saveRow",a,null,null);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+  
b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide();break;case "cancel":c("#"+b).jqGrid("restoreRow",a);c("tr#"+a+" div.ui-inline-edit, tr#"+a+" div.ui-inline-del","#"+b).show();c("tr#"+a+" div.ui-inline-save, tr#"+a+" div.ui-inline-cancel","#"+b).hide();break}};c.fn.fmatter.actions=function(a,b){a={keys:false,editbutton:true,delbutton:true};isUndefined(b.colModel.formatoptions)||(a=c.extend(a,b.colModel.formatoptions));var d=b.rowId,e="",g;if(typeof d=="undefined"||  
isEmpty(d))return"";if(a.editbutton){g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','edit',"+a.keys+");";e=e+"<div style='margin-left:8px;'><div title='"+c.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>"}if(a.delbutton){g="onclick=jQuery('#"+b.gid+"').jqGrid('delGridRow','"+d+"');";e=e+"<div title='"+c.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+  
g+"><span class='ui-icon ui-icon-trash'></span></div>"}g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','save',false);";e=e+"<div title='"+c.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+g+"></span></div>";g="onclick=$.fn.fmatter.rowactions('"+d+"','"+b.gid+"','cancel',false);";return e=e+"<div title='"+c.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+  
g+"></span></div></div>"};c.unformat=function(a,b,d,e){var g,h=b.colModel.formatter,f=b.colModel.formatoptions||{},i=/([\.\*\_\'\(\)\{\}\+\?\\])/g;unformatFunc=b.colModel.unformat||c.fn.fmatter[h]&&c.fn.fmatter[h].unformat;if(typeof unformatFunc!=="undefined"&&isFunction(unformatFunc))g=unformatFunc(c(a).text(),b,a);else if(typeof h!=="undefined"&&isString(h)){g=c.jgrid.formatter||{};switch(h){case "integer":f=c.extend({},g.integer,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=  
c(a).text().replace(b,"");break;case "number":f=c.extend({},g.number,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=c(a).text().replace(b,"").replace(f.decimalSeparator,".");break;case "currency":f=c.extend({},g.currency,f);b=f.thousandsSeparator.replace(i,"\\$1");b=new RegExp(b,"g");g=c(a).text().replace(b,"").replace(f.decimalSeparator,".").replace(f.prefix,"").replace(f.suffix,"");break;case "checkbox":f=b.colModel.editoptions?b.colModel.editoptions.value.split(":"):["Yes","No"];  
g=c("input",a).attr("checked")?f[0]:f[1];break;case "select":g=c.unformat.select(a,b,d,e);break;case "actions":return"";default:g=c(a).text()}}return g?g:e===true?c(a).text():c.jgrid.htmlDecode(c(a).html())};c.unformat.select=function(a,b,d,e){d=[];a=c(a).text();if(e===true)return a;b=c.extend({},b.colModel.editoptions);if(b.value){var g=b.value;b=b.multiple===true?true:false;e=[];var h;if(b){e=a.split(",");e=c.map(e,function(j){return c.trim(j)})}if(isString(g))for(var f=g.split(";"),i=0,k=0;k<f.length;k++){h=  
f[k].split(":");if(b){if(jQuery.inArray(h[1],e)>-1){d[i]=h[0];i++}}else if(c.trim(h[1])==c.trim(a)){d[0]=h[0];break}}else if(isObject(g)){b||(e[0]=a);d=jQuery.map(e,function(j){var l;c.each(g,function(o,n){if(n==j){l=o;return false}});if(l)return l})}return d.join(", ")}else return a||""};isValue=function(a){return isObject(a)||isString(a)||isNumber(a)||isBoolean(a)};isBoolean=function(a){return typeof a==="boolean"};isNull=function(a){return a===null};isNumber=function(a){return typeof a==="number"&&  
isFinite(a)};isString=function(a){return typeof a==="string"};isEmpty=function(a){if(!isString(a)&&isValue(a))return false;else if(!isValue(a))return true;a=c.trim(a).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return a===""};isUndefined=function(a){return typeof a==="undefined"};isObject=function(a){return a&&(typeof a==="object"||isFunction(a))||false};isFunction=function(a){return typeof a==="function"}})(jQuery);  
(function(a){a.jgrid.extend({getColProp:function(g){var d={},b=this[0];if(b.grid){b=b.p.colModel;for(var n=0;n<b.length;n++)if(b[n].name==g){d=b[n];break}return d}},setColProp:function(g,d){return this.each(function(){if(this.grid)if(d)for(var b=this.p.colModel,n=0;n<b.length;n++)if(b[n].name==g){a.extend(this.p.colModel[n],d);break}})},sortGrid:function(g,d,b){return this.each(function(){var n=this,s=-1;if(n.grid){if(!g)g=n.p.sortname;for(var q=0;q<n.p.colModel.length;q++)if(n.p.colModel[q].index==  
g||n.p.colModel[q].name==g){s=q;break}if(s!=-1){q=n.p.colModel[s].sortable;if(typeof q!=="boolean")q=true;if(typeof d!=="boolean")d=false;q&&n.sortData("jqgh_"+g,s,d,b)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var g=this.id;try{a("#gbox_"+g).remove()}catch(d){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var g={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");  
var d=document.createElement("table");a(d).attr({id:g.id});d.className=g.cl;g=this.id;a(d).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+g).length===1){a(d).insertBefore("#gbox_"+g).show();a(this.p.pager).insertBefore("#gbox_"+g)}else a(d).insertBefore("#gbox_"+g).show();a("#gbox_"+g).remove()}})},setGridState:function(g){return this.each(function(){if(this.grid){var d=this;if(g=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+d.p.id).slideUp("fast");d.p.pager&&a(d.p.pager).slideUp("fast");  
d.p.toppager&&a(d.p.toppager).slideUp("fast");if(d.p.toolbar[0]===true){d.p.toolbar[1]=="both"&&a(d.grid.ubDiv).slideUp("fast");a(d.grid.uDiv).slideUp("fast")}d.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+d.p.id).slideUp("fast");a(".ui-jqgrid-titlebar-close span",d.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");d.p.gridstate="hidden"}else if(g=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+d.p.id).slideDown("fast");d.p.pager&&a(d.p.pager).slideDown("fast");  
d.p.toppager&&a(d.p.toppager).slideDown("fast");if(d.p.toolbar[0]===true){d.p.toolbar[1]=="both"&&a(d.grid.ubDiv).slideDown("fast");a(d.grid.uDiv).slideDown("fast")}d.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+d.p.id).slideDown("fast");a(".ui-jqgrid-titlebar-close span",d.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");d.p.gridstate="visible"}}})},updateGridRows:function(g,d,b){var n,s=false,q;this.each(function(){var h=this,l,o,c,f;if(!h.grid)return false;  
d||(d="id");g&&g.length>0&&a(g).each(function(){c=this;if(o=h.rows.namedItem(c[d])){f=c[d];if(b===true)if(h.p.jsonReader.repeatitems===true){if(h.p.jsonReader.cell)c=c[h.p.jsonReader.cell];for(var e=0;e<c.length;e++){l=h.formatter(f,c[e],e,c,"edit");q=h.p.colModel[e].title?{title:a.jgrid.stripHtml(l)}:{};h.p.treeGrid===true&&n==h.p.ExpandColumn?a("td:eq("+e+") > span:first",o).html(l).attr(q):a("td:eq("+e+")",o).html(l).attr(q)}return s=true}a(h.p.colModel).each(function(m){n=b===true?this.jsonmap||  
this.name:this.name;if(c[n]!==undefined){l=h.formatter(f,c[n],m,c,"edit");q=this.title?{title:a.jgrid.stripHtml(l)}:{};h.p.treeGrid===true&&n==h.p.ExpandColumn?a("td:eq("+m+") > span:first",o).html(l).attr(q):a("td:eq("+m+")",o).html(l).attr(q);s=true}})}})});return s},filterGrid:function(g,d){d=a.extend({gridModel:false,gridNames:false,gridToolbar:false,filterModel:[],formtype:"horizontal",autosearch:true,formclass:"filterform",tableclass:"filtertable",buttonclass:"filterbutton",searchButton:"Search",  
clearButton:"Clear",enableSearch:false,enableClear:false,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,url:"",marksearched:true},d||{});return this.each(function(){var b=this;this.p=d;if(this.p.filterModel.length===0&&this.p.gridModel===false)alert("No filter is set");else if(g){this.p.gridid=g.indexOf("#")!=-1?g:"#"+g;var n=a(this.p.gridid).jqGrid("getGridParam","colModel");if(n){if(this.p.gridModel===true){var s=a(this.p.gridid)[0],q;a.each(n,function(f){var e=[];this.search=  
this.search===false?false:true;q=this.editrules&&this.editrules.searchhidden===true?true:this.hidden===true?false:true;if(this.search===true&&q===true){e.label=b.p.gridNames===true?s.p.colNames[f]:"";e.name=this.name;e.index=this.index||this.name;e.stype=this.edittype||"text";if(e.stype!="select")e.stype="text";e.defval=this.defval||"";e.surl=this.surl||"";e.sopt=this.editoptions||{};e.width=this.width;b.p.filterModel.push(e)}})}else a.each(b.p.filterModel,function(){for(var f=0;f<n.length;f++)if(this.name==  
n[f].name){this.index=n[f].index||this.name;break}if(!this.index)this.index=this.name});var h=function(){var f={},e=0,m,i=a(b.p.gridid)[0],k;i.p.searchdata={};a.isFunction(b.p.beforeSearch)&&b.p.beforeSearch();a.each(b.p.filterModel,function(){k=this.index;switch(this.stype){case "select":if(m=a("select[name="+k+"]",b).val()){f[k]=m;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");e++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(r){}}break;  
default:if(m=a("input[name="+k+"]",b).val()){f[k]=m;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");e++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(u){}}}});var p=e>0?true:false;a.extend(i.p.postData,f);var j;if(b.p.url){j=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);j&&a(i).jqGrid("setGridParam",  
{url:j});a.isFunction(b.p.afterSearch)&&b.p.afterSearch()},l=function(){var f={},e,m=0,i=a(b.p.gridid)[0],k;a.isFunction(b.p.beforeClear)&&b.p.beforeClear();a.each(b.p.filterModel,function(){k=this.index;e=this.defval?this.defval:"";if(!this.stype)this.stype="text";switch(this.stype){case "select":var r;a("select[name="+k+"] option",b).each(function(v){if(v===0)this.selected=true;if(a(this).text()==e){this.selected=true;r=a(this).val();return false}});if(r){f[k]=r;b.p.marksearched&&a("#jqgh_"+this.name,  
i.grid.hDiv).addClass("dirty-cell");m++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(u){}}break;case "text":a("input[name="+k+"]",b).val(e);if(e){f[k]=e;b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).addClass("dirty-cell");m++}else{b.p.marksearched&&a("#jqgh_"+this.name,i.grid.hDiv).removeClass("dirty-cell");try{delete i.p.postData[this.index]}catch(t){}}break}});var p=m>0?true:false;a.extend(i.p.postData,f);var j;  
if(b.p.url){j=a(i).jqGrid("getGridParam","url");a(i).jqGrid("setGridParam",{url:b.p.url})}a(i).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);j&&a(i).jqGrid("setGridParam",{url:j});a.isFunction(b.p.afterClear)&&b.p.afterClear()},o=a("<form name='SearchForm' style=display:inline;' class='"+this.p.formclass+"'></form>"),c=a("<table class='"+this.p.tableclass+"' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(o).append(c);(function(){var f=document.createElement("tr"),  
e,m,i,k;b.p.formtype=="horizontal"&&a(c).append(f);a.each(b.p.filterModel,function(p){i=document.createElement("td");a(i).append("<label for='"+this.name+"'>"+this.label+"</label>");k=document.createElement("td");var j=this;if(!this.stype)this.stype="text";switch(this.stype){case "select":if(this.surl)a(k).load(this.surl,function(){j.defval&&a("select",this).val(j.defval);a("select",this).attr({name:j.index||j.name,id:"sg_"+j.name});j.sopt&&a("select",this).attr(j.sopt);b.p.gridToolbar===true&&j.width&&  
a("select",this).width(j.width);b.p.autosearch===true&&a("select",this).change(function(){h();return false})});else if(j.sopt.value){var r=j.sopt.value,u=document.createElement("select");a(u).attr({name:j.index||j.name,id:"sg_"+j.name}).attr(j.sopt);var t;if(typeof r==="string"){p=r.split(";");for(var v=0;v<p.length;v++){r=p[v].split(":");t=document.createElement("option");t.value=r[0];t.innerHTML=r[1];if(r[1]==j.defval)t.selected="selected";u.appendChild(t)}}else if(typeof r==="object")for(v in r)if(r.hasOwnProperty(v)){p++;  
t=document.createElement("option");t.value=v;t.innerHTML=r[v];if(r[v]==j.defval)t.selected="selected";u.appendChild(t)}b.p.gridToolbar===true&&j.width&&a(u).width(j.width);a(k).append(u);b.p.autosearch===true&&a(u).change(function(){h();return false})}break;case "text":u=this.defval?this.defval:"";a(k).append("<input type='text' name='"+(this.index||this.name)+"' id='sg_"+this.name+"' value='"+u+"'/>");j.sopt&&a("input",k).attr(j.sopt);if(b.p.gridToolbar===true&&j.width)a.browser.msie?a("input",k).width(j.width-  
4):a("input",k).width(j.width-2);b.p.autosearch===true&&a("input",k).keypress(function(w){if((w.charCode?w.charCode:w.keyCode?w.keyCode:0)==13){h();return false}return this});break}if(b.p.formtype=="horizontal"){b.p.gridToolbar===true&&b.p.gridNames===false?a(f).append(k):a(f).append(i).append(k);a(f).append(k)}else{e=document.createElement("tr");a(e).append(i).append(k);a(c).append(e)}});k=document.createElement("td");if(b.p.enableSearch===true){m="<input type='button' id='sButton' class='"+b.p.buttonclass+  
"' value='"+b.p.searchButton+"'/>";a(k).append(m);a("input#sButton",k).click(function(){h();return false})}if(b.p.enableClear===true){m="<input type='button' id='cButton' class='"+b.p.buttonclass+"' value='"+b.p.clearButton+"'/>";a(k).append(m);a("input#cButton",k).click(function(){l();return false})}if(b.p.enableClear===true||b.p.enableSearch===true)if(b.p.formtype=="horizontal")a(f).append(k);else{e=document.createElement("tr");a(e).append("<td>&#160;</td>").append(k);a(c).append(e)}})();a(this).append(o);  
this.triggerSearch=h;this.clearSearch=l}else alert("Could not get grid colModel")}else alert("No target grid is set!")})},filterToolbar:function(g){g=a.extend({autosearch:true,searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND"},g||{});return this.each(function(){function d(h,l){var o=a(h);o[0]&&jQuery.each(l,function(){this.data!==undefined?o.bind(this.type,this.data,this.fn):o.bind(this.type,this.fn)})}var b=this,n=  
function(){var h={},l=0,o,c,f={};a.each(b.p.colModel,function(){c=this.index||this.name;var j=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"bw";switch(this.stype){case "select":if(o=a("select[name="+c+"]",b.grid.hDiv).val()){h[c]=o;f[c]=j;l++}else try{delete b.p.postData[c]}catch(r){}break;case "text":if(o=a("input[name="+c+"]",b.grid.hDiv).val()){h[c]=o;f[c]=j;l++}else try{delete b.p.postData[c]}catch(u){}break}});var e=l>0?true:false;if(g.stringResult){var m='{"groupOp":"'+  
g.groupOp+'","rules":[',i=0;a.each(h,function(j,r){if(i>0)m+=",";m+='{"field":"'+j+'",';m+='"op":"'+f[j]+'",';m+='"data":"'+r+'"}';i++});m+="]}";a.extend(b.p.postData,{filters:m})}else a.extend(b.p.postData,h);var k;if(b.p.searchurl){k=b.p.url;a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var p=false;if(a.isFunction(g.beforeSearch))p=g.beforeSearch.call(b);p||a(b).jqGrid("setGridParam",{search:e}).trigger("reloadGrid",[{page:1}]);k&&a(b).jqGrid("setGridParam",{url:k});a.isFunction(g.afterSearch)&&  
g.afterSearch()},s=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),q;a.each(b.p.colModel,function(){var h=this,l,o,c,f;o=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");l=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===true&&a(o).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";c=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(f=  
this.surl||c.dataUrl)a.ajax(a.extend({url:f,dataType:"html",complete:function(p){if(c.buildSelect!==undefined)(p=c.buildSelect(p))&&a(l).append(p);else a(l).append(p.responseText);c.defaultValue&&a("select",l).val(c.defaultValue);a("select",l).attr({name:h.index||h.name,id:"gs_"+h.name});c.attr&&a("select",l).attr(c.attr);a("select",l).css({width:"100%"});c.dataInit!==undefined&&c.dataInit(a("select",l)[0]);c.dataEvents!==undefined&&d(a("select",l)[0],c.dataEvents);g.autosearch===true&&a("select",  
l).change(function(){n();return false});p=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var e;if(h.searchoptions&&h.searchoptions.value)e=h.searchoptions.value;else if(h.editoptions&&h.editoptions.value)e=h.editoptions.value;if(e){f=document.createElement("select");f.style.width="100%";a(f).attr({name:h.index||h.name,id:"gs_"+h.name});var m,i;if(typeof e==="string"){e=e.split(";");for(var k=0;k<e.length;k++){m=e[k].split(":");i=document.createElement("option");i.value=m[0];i.innerHTML=  
m[1];f.appendChild(i)}}else if(typeof e==="object")for(m in e)if(e.hasOwnProperty(m)){i=document.createElement("option");i.value=m;i.innerHTML=e[m];f.appendChild(i)}c.defaultValue&&a(f).val(c.defaultValue);c.attr&&a(f).attr(c.attr);c.dataInit!==undefined&&c.dataInit(f);c.dataEvents!==undefined&&d(f,c.dataEvents);a(l).append(f);g.autosearch===true&&a(f).change(function(){n();return false})}}break;case "text":f=c.defaultValue?c.defaultValue:"";a(l).append("<input type='text' style='width:95%;padding:0px;' name='"+  
(h.index||h.name)+"' id='gs_"+h.name+"' value='"+f+"'/>");c.attr&&a("input",l).attr(c.attr);c.dataInit!==undefined&&c.dataInit(a("input",l)[0]);c.dataEvents!==undefined&&d(a("input",l)[0],c.dataEvents);if(g.autosearch===true)g.searchOnEnter?a("input",l).keypress(function(p){if((p.charCode?p.charCode:p.keyCode?p.keyCode:0)==13){n();return false}return this}):a("input",l).keydown(function(p){switch(p.which){case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:q&&clearTimeout(q);q=setTimeout(function(){n()},  
500)}});break}a(o).append(l);a(s).append(o)});a("table thead",b.grid.hDiv).append(s);this.triggerToolbar=n;this.clearToolbar=function(h){var l={},o,c=0,f;h=typeof h!="boolean"?true:h;a.each(b.p.colModel,function(){o=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";f=this.index||this.name;switch(this.stype){case "select":var j;a("select[name="+f+"] option",b.grid.hDiv).each(function(t){if(t===0)this.selected=true;if(a(this).text()==o){this.selected=true;j=a(this).val();  
return false}});if(j){l[f]=j;c++}else try{delete b.p.postData[f]}catch(r){}break;case "text":a("input[name="+f+"]",b.grid.hDiv).val(o);if(o){l[f]=o;c++}else try{delete b.p.postData[f]}catch(u){}break}});var e=c>0?true:false;if(g.stringResult){var m='{"groupOp":"'+g.groupOp+'","rules":[',i=0;a.each(l,function(j,r){if(i>0)m+=",";m+='{"field":"'+j+'",';m+='"op":"eq",';m+='"data":"'+r+'"}';i++});m+="]}";a.extend(b.p.postData,{filters:m})}else a.extend(b.p.postData,l);var k;if(b.p.searchurl){k=b.p.url;  
a(b).jqGrid("setGridParam",{url:b.p.searchurl})}var p=false;if(a.isFunction(g.beforeClear))p=g.beforeClear.call(b);p||h&&a(b).jqGrid("setGridParam",{search:e}).trigger("reloadGrid",[{page:1}]);k&&a(b).jqGrid("setGridParam",{url:k});a.isFunction(g.afterClear)&&g.afterClear()};this.toggleToolbar=function(){var h=a("tr.ui-search-toolbar",b.grid.hDiv);h.css("display")=="none"?h.show():h.hide()}})}})})(jQuery);  
var showModal=function(a){a.w.show()},closeModal=function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal=function(a,b){b=jQuery.extend({jqm:true,gb:""},b||{});if(b.onClose){var c=b.onClose(a);if(typeof c=="boolean"&&!c)return}if(jQuery.fn.jqm&&b.jqm===true)jQuery(a).attr("aria-hidden","true").jqmHide();else{if(b.gb!="")try{jQuery(".jqgrid-overlay:first",b.gb).hide()}catch(e){}jQuery(a).hide().attr("aria-hidden","true")}};  
function findPos(a){var b=0,c=0;if(a.offsetParent){do{b+=a.offsetLeft;c+=a.offsetTop}while(a=a.offsetParent)}return[b,c]}  
var createModal=function(a,b,c,e,f,h){var d=document.createElement("div"),g;g=jQuery(c.gbox).attr("dir")=="rtl"?true:false;d.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";d.id=a.themodal;var i=document.createElement("div");i.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";i.id=a.modalhead;jQuery(i).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var j=jQuery("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){j.addClass("ui-state-hover")},  
function(){j.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");jQuery(i).append(j);if(g){d.dir="rtl";jQuery(".ui-jqdialog-title",i).css("float","right");jQuery(".ui-jqdialog-titlebar-close",i).css("left","0.3em")}else{d.dir="ltr";jQuery(".ui-jqdialog-title",i).css("float","left");jQuery(".ui-jqdialog-titlebar-close",i).css("right","0.3em")}var l=document.createElement("div");jQuery(l).addClass("ui-jqdialog-content ui-widget-content").attr("id",a.modalcontent);  
jQuery(l).append(b);d.appendChild(l);jQuery(d).prepend(i);h===true?jQuery("body").append(d):jQuery(d).insertBefore(e);if(typeof c.jqModal==="undefined")c.jqModal=true;b={};if(jQuery.fn.jqm&&c.jqModal===true){if(c.left===0&&c.top===0){e=[];e=findPos(f);c.left=e[0]+4;c.top=e[1]+4}b.top=c.top+"px";b.left=c.left}else if(c.left!==0||c.top!==0){b.left=c.left;b.top=c.top+"px"}jQuery("a.ui-jqdialog-titlebar-close",i).click(function(){var n=jQuery("#"+a.themodal).data("onClose")||c.onClose,k=jQuery("#"+a.themodal).data("gbox")||  
c.gbox;hideModal("#"+a.themodal,{gb:k,jqm:c.jqModal,onClose:n});return false});if(c.width===0||!c.width)c.width=300;if(c.height===0||!c.height)c.height=200;if(!c.zIndex)c.zIndex=950;f=0;if(g&&b.left&&!h){f=jQuery(c.gbox).width()-(!isNaN(c.width)?parseInt(c.width,10):0)-8;b.left=parseInt(b.left,10)+parseInt(f,10)}if(b.left)b.left+="px";jQuery(d).css(jQuery.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+"px",zIndex:c.zIndex,overflow:"hidden"},b)).attr({tabIndex:"-1",  
role:"dialog","aria-labelledby":a.modalhead,"aria-hidden":"true"});if(typeof c.drag=="undefined")c.drag=true;if(typeof c.resize=="undefined")c.resize=true;if(c.drag){jQuery(i).css("cursor","move");if(jQuery.fn.jqDrag)jQuery(d).jqDrag(i);else try{jQuery(d).draggable({handle:jQuery("#"+i.id)})}catch(q){}}if(c.resize)if(jQuery.fn.jqResize){jQuery(d).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");jQuery("#"+a.themodal).jqResize(".jqResize",  
a.scrollelm?"#"+a.scrollelm:false)}else try{jQuery(d).resizable({handles:"se, sw",alsoResize:a.scrollelm?"#"+a.scrollelm:false})}catch(o){}c.closeOnEscape===true&&jQuery(d).keydown(function(n){if(n.which==27){n=jQuery("#"+a.themodal).data("onClose")||c.onClose;hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:n})}})},viewModal=function(a,b){b=jQuery.extend({toTop:true,overlay:10,modal:false,onShow:showModal,onHide:closeModal,gbox:"",jqm:true,jqM:true},b||{});if(jQuery.fn.jqm&&b.jqm===true)b.jqM?jQuery(a).attr("aria-hidden",  
"false").jqm(b).jqmShow():jQuery(a).attr("aria-hidden","false").jqmShow();else{if(b.gbox!=""){jQuery(".jqgrid-overlay:first",b.gbox).show();jQuery(a).data("gbox",b.gbox)}jQuery(a).show().attr("aria-hidden","false");try{jQuery(":input:visible",a)[0].focus()}catch(c){}}};  
function info_dialog(a,b,c,e){var f={width:290,height:"auto",dataheight:"auto",drag:true,resize:false,caption:"<b>"+a+"</b>",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true,align:"center",buttonalign:"center",buttons:[]};jQuery.extend(f,e||{});var h=f.jqModal;if(jQuery.fn.jqm&&!h)h=false;a="";if(f.buttons.length>0)for(e=0;e<f.buttons.length;e++){if(typeof f.buttons[e].id=="undefined")f.buttons[e].id="info_button_"+e;a+="<a href='javascript:void(0)' id='"+f.buttons[e].id+"' class='fm-button ui-state-default ui-corner-all'>"+  
f.buttons[e].text+"</a>"}e=isNaN(f.dataheight)?f.dataheight:f.dataheight+"px";var d="<div id='info_id'>";d+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+e+";"+("text-align:"+f.align+";")+"'>"+b+"</div>";d+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+f.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+  
c+"</a>"+a+"</div>":a!=""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+f.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+a+"</div>":"";d+="</div>";try{jQuery("#info_dialog").attr("aria-hidden")=="false"&&hideModal("#info_dialog",{jqm:h});jQuery("#info_dialog").remove()}catch(g){}createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},d,f,"","",true);a&&jQuery.each(f.buttons,  
function(j){jQuery("#"+this.id,"#info_id").bind("click",function(){f.buttons[j].onClick.call(jQuery("#info_dialog"));return false})});jQuery("#closedialog","#info_id").click(function(j){hideModal("#info_dialog",{jqm:h});return false});jQuery(".fm-button","#info_dialog").hover(function(){jQuery(this).addClass("ui-state-hover")},function(){jQuery(this).removeClass("ui-state-hover")});viewModal("#info_dialog",{onHide:function(j){j.w.hide().remove();j.o&&j.o.remove()},modal:f.modal,jqm:h});try{$("#info_dialog").focus()}catch(i){}}  
function createEl(a,b,c,e,f){function h(k,m){if(jQuery.isFunction(m.dataInit)){k.id=m.id;m.dataInit(k);delete m.id;delete m.dataInit}if(m.dataEvents){jQuery.each(m.dataEvents,function(){this.data!==undefined?jQuery(k).bind(this.type,this.data,this.fn):jQuery(k).bind(this.type,this.fn)});delete m.dataEvents}return m}var d="";b.defaultValue&&delete b.defaultValue;switch(a){case "textarea":d=document.createElement("textarea");if(e)b.cols||jQuery(d).css({width:"98%"});else if(!b.cols)b.cols=20;if(!b.rows)b.rows=  
2;if(c=="&nbsp;"||c=="&#160;"||c.length==1&&c.charCodeAt(0)==160)c="";d.value=c;b=h(d,b);jQuery(d).attr(b).attr({role:"textbox",multiline:"true"});break;case "checkbox":d=document.createElement("input");d.type="checkbox";if(b.value){var g=b.value.split(":");if(c===g[0]){d.checked=true;d.defaultChecked=true}d.value=g[0];jQuery(d).attr("offval",g[1]);try{delete b.value}catch(i){}}else{g=c.toLowerCase();if(g.search(/(false|0|no|off|undefined)/i)<0&&g!==""){d.checked=true;d.defaultChecked=true;d.value=  
c}else d.value="on";jQuery(d).attr("offval","off")}b=h(d,b);jQuery(d).attr(b).attr("role","checkbox");break;case "select":d=document.createElement("select");d.setAttribute("role","select");var j,l=[];if(b.multiple===true){j=true;d.multiple="multiple";$(d).attr("aria-multiselectable","true")}else j=false;if(typeof b.dataUrl!="undefined")jQuery.ajax(jQuery.extend({url:b.dataUrl,type:"GET",complete:function(k,m){try{delete b.dataUrl;delete b.value}catch(r){}if(typeof b.buildSelect!="undefined"){k=b.buildSelect(k);  
k=jQuery(k).html();delete b.buildSelect}else k=jQuery(k.responseText).html();if(k){jQuery(d).append(k);b=h(d,b);if(typeof b.size==="undefined")b.size=j?3:1;if(j){l=c.split(",");l=jQuery.map(l,function(p){return jQuery.trim(p)})}else l[0]=jQuery.trim(c);jQuery(d).attr(b);setTimeout(function(){jQuery("option",d).each(function(p){if(p===0)this.selected="";$(this).attr("role","option");if(jQuery.inArray(jQuery.trim(jQuery(this).text()),l)>-1||jQuery.inArray(jQuery.trim(jQuery(this).val()),l)>-1){this.selected=  
"selected";if(!j)return false}})},0)}}},f||{}));else if(b.value){if(j){l=c.split(",");l=jQuery.map(l,function(k){return jQuery.trim(k)});if(typeof b.size==="undefined")b.size=3}else b.size=1;if(typeof b.value==="function")b.value=b.value();if(typeof b.value==="string"){e=b.value.split(";");for(g=0;g<e.length;g++){f=e[g].split(":");if(f.length>2)f[1]=jQuery.map(f,function(k,m){if(m>0)return k}).join(":");a=document.createElement("option");a.setAttribute("role","option");a.value=f[0];a.innerHTML=f[1];  
if(!j&&(jQuery.trim(f[0])==jQuery.trim(c)||jQuery.trim(f[1])==jQuery.trim(c)))a.selected="selected";if(j&&(jQuery.inArray(jQuery.trim(f[1]),l)>-1||jQuery.inArray(jQuery.trim(f[0]),l)>-1))a.selected="selected";d.appendChild(a)}}else if(typeof b.value==="object"){e=b.value;for(g in e)if(e.hasOwnProperty(g)){a=document.createElement("option");a.setAttribute("role","option");a.value=g;a.innerHTML=e[g];if(!j&&(jQuery.trim(g)==jQuery.trim(c)||jQuery.trim(e[g])==jQuery.trim(c)))a.selected="selected";if(j&&  
(jQuery.inArray(jQuery.trim(e[g]),l)>-1||jQuery.inArray(jQuery.trim(g),l)>-1))a.selected="selected";d.appendChild(a)}}b=h(d,b);try{delete b.value}catch(q){}jQuery(d).attr(b)}break;case "text":case "password":case "button":g=a=="button"?"button":"textbox";d=document.createElement("input");d.type=a;d.value=c;b=h(d,b);if(a!="button")if(e)b.size||jQuery(d).css({width:"98%"});else if(!b.size)b.size=20;jQuery(d).attr(b).attr("role",g);break;case "image":case "file":d=document.createElement("input");d.type=  
a;b=h(d,b);jQuery(d).attr(b);break;case "custom":d=document.createElement("span");try{if(jQuery.isFunction(b.custom_element)){var o=b.custom_element.call(this,c,b);if(o){o=jQuery(o).addClass("customelement").attr({id:b.id,name:b.name});jQuery(d).empty().append(o)}else throw"e2";}else throw"e1";}catch(n){n=="e1"&&info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+jQuery.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);n=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_element' "+  
jQuery.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,n.message,jQuery.jgrid.edit.bClose)}break}return d}function daysInFebruary(a){return a%4===0&&(a%100!==0||a%400===0)?29:28}function DaysArray(a){for(var b=1;b<=a;b++){this[b]=31;if(b==4||b==6||b==9||b==11)this[b]=30;if(b==2)this[b]=29}return this}  
function checkDate(a,b){var c={},e;a=a.toLowerCase();e=a.indexOf("/")!=-1?"/":a.indexOf("-")!=-1?"-":a.indexOf(".")!=-1?".":"/";a=a.split(e);b=b.split(e);if(b.length!=3)return false;e=-1;for(var f,h=-1,d=-1,g=0;g<a.length;g++){f=isNaN(b[g])?0:parseInt(b[g],10);c[a[g]]=f;f=a[g];if(f.indexOf("y")!=-1)e=g;if(f.indexOf("m")!=-1)d=g;if(f.indexOf("d")!=-1)h=g}f=a[e]=="y"||a[e]=="yyyy"?4:a[e]=="yy"?2:-1;g=DaysArray(12);var i;if(e===-1)return false;else{i=c[a[e]].toString();if(f==2&&i.length==1)f=1;if(i.length!=  
f||c[a[e]]===0&&b[e]!="00")return false}if(d===-1)return false;else{i=c[a[d]].toString();if(i.length<1||c[a[d]]<1||c[a[d]]>12)return false}if(h===-1)return false;else{i=c[a[h]].toString();if(i.length<1||c[a[h]]<1||c[a[h]]>31||c[a[d]]==2&&c[a[h]]>daysInFebruary(c[a[e]])||c[a[h]]>g[c[a[d]]])return false}return true}function isEmpty(a){return a.match(/^s+$/)||a==""?true:false}  
function checkTime(a){var b=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!isEmpty(a))if(a=a.match(b)){if(a[3]){if(a[1]<1||a[1]>12)return false}else if(a[1]>23)return false;if(a[2]>59)return false}else return false;return true}  
function checkValues(a,b,c){var e,f,h;if(typeof b=="string"){f=0;for(len=c.p.colModel.length;f<len;f++)if(c.p.colModel[f].name==b){e=c.p.colModel[f].editrules;b=f;try{h=c.p.colModel[f].formoptions.label}catch(d){}break}}else if(b>=0)e=c.p.colModel[b].editrules;if(e){h||(h=c.p.colNames[b]);if(e.required===true)if(a.match(/^s+$/)||a=="")return[false,h+": "+jQuery.jgrid.edit.msg.required,""];f=e.required===false?false:true;if(e.number===true)if(!(f===false&&isEmpty(a)))if(isNaN(a))return[false,h+": "+  
jQuery.jgrid.edit.msg.number,""];if(typeof e.minValue!="undefined"&&!isNaN(e.minValue))if(parseFloat(a)<parseFloat(e.minValue))return[false,h+": "+jQuery.jgrid.edit.msg.minValue+" "+e.minValue,""];if(typeof e.maxValue!="undefined"&&!isNaN(e.maxValue))if(parseFloat(a)>parseFloat(e.maxValue))return[false,h+": "+jQuery.jgrid.edit.msg.maxValue+" "+e.maxValue,""];var g;if(e.email===true)if(!(f===false&&isEmpty(a))){g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;  
if(!g.test(a))return[false,h+": "+jQuery.jgrid.edit.msg.email,""]}if(e.integer===true)if(!(f===false&&isEmpty(a))){if(isNaN(a))return[false,h+": "+jQuery.jgrid.edit.msg.integer,""];if(a%1!==0||a.indexOf(".")!=-1)return[false,h+": "+jQuery.jgrid.edit.msg.integer,""]}if(e.date===true)if(!(f===false&&isEmpty(a))){b=c.p.colModel[b].datefmt||"Y-m-d";if(!checkDate(b,a))return[false,h+": "+jQuery.jgrid.edit.msg.date+" - "+b,""]}if(e.time===true)if(!(f===false&&isEmpty(a)))if(!checkTime(a))return[false,h+  
": "+jQuery.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(e.url===true)if(!(f===false&&isEmpty(a))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(a))return[false,h+": "+jQuery.jgrid.edit.msg.url,""]}if(e.custom===true)if(!(f===false&&isEmpty(a)))if(jQuery.isFunction(e.custom_func)){a=e.custom_func.call(c,a,h);return jQuery.isArray(a)?a:[false,jQuery.jgrid.edit.msg.customarray,""]}else return[false,jQuery.jgrid.edit.msg.customfcheck,  
""]}return[true,"",""]};  
(function(a){var c=null;a.jgrid.extend({searchGrid:function(d){d=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,cloneSearchRowOnAdd:true,sopt:null,stringResult:undefined,onClose:null,useDataProxy:false,overlay:true},a.jgrid.search,d||{});return this.each(function(){function b(o,  
s){s=o.p.postData[s.sFilter];if(typeof s=="string")s=a.jgrid.parse(s);if(s){s.groupOp&&o.SearchFilter.setGroupOp(s.groupOp);if(s.rules){var y,J=0,k=s.rules.length;for(y=false;J<k;J++){y=s.rules[J];if(y.field!==undefined&&y.op!==undefined&&y.data!==undefined)(y=o.SearchFilter.setFilter({sfref:o.SearchFilter.$.find(".sf:last"),filter:a.extend({},y)}))&&o.SearchFilter.add()}}}}function q(o){var s=o!==undefined,y=a("#"+z.p.id),J={};if(d.multipleSearch===false){J[d.sField]=o.rules[0].field;J[d.sValue]=  
o.rules[0].data;J[d.sOper]=o.rules[0].op}else J[d.sFilter]=o;y[0].p.search=s;a.extend(y[0].p.postData,J);y.trigger("reloadGrid",[{page:1}]);d.closeAfterSearch&&t(a("#"+h))}function D(o){o=o!==undefined;var s=a("#"+z.p.id),y=[];s[0].p.search=o;if(d.multipleSearch===false)y[d.sField]=y[d.sValue]=y[d.sOper]="";else y[d.sFilter]="";a.extend(s[0].p.postData,y);s.trigger("reloadGrid",[{page:1}]);d.closeAfterReset&&t(a("#"+h))}function t(o){if(d.onClose){var s=d.onClose(o);if(typeof s=="boolean"&&!s)return}o.hide();  
d.overlay===true&&a(".jqgrid-overlay:first","#gbox_"+z.p.id).hide()}function F(){var o=a(".ui-searchFilter").length;if(o>1){var s=a("#"+h).css("zIndex");a("#"+h).css({zIndex:parseInt(s,10)+o})}a("#"+h).show();d.overlay===true&&a(".jqgrid-overlay:first","#gbox_"+z.p.id).show();try{a(":input:visible","#"+h)[0].focus()}catch(y){}}var z=this;if(z.grid)if(a.fn.searchFilter){var h="fbox_"+z.p.id;d.recreateFilter===true&&a("#"+h).remove();if(a("#"+h).html()!=null){a.isFunction(d.beforeShowSearch)&&d.beforeShowSearch(a("#"+  
h));F();a.isFunction(d.afterShowSearch)&&d.afterShowSearch(a("#"+h))}else{var p=[],H=a("#"+z.p.id).jqGrid("getGridParam","colNames"),f=a("#"+z.p.id).jqGrid("getGridParam","colModel"),l=["eq","ne","lt","le","gt","ge","bw","bn","in","ni","ew","en","cn","nc"],e,j,m,u=[];if(d.sopt!==null)for(e=m=0;e<d.sopt.length;e++){if((j=a.inArray(d.sopt[e],l))!=-1){u[m]={op:d.sopt[e],text:d.odata[j]};m++}}else for(e=0;e<l.length;e++)u[e]={op:l[e],text:d.odata[e]};a.each(f,function(o,s){var y=typeof s.search==="undefined"?  
true:s.search,J=s.hidden===true;o=a.extend({},{text:H[o],itemval:s.index||s.name},this.searchoptions);s=o.searchhidden===true;if(typeof o.sopt!=="undefined"){m=0;o.ops=[];if(o.sopt.length>0)for(e=0;e<o.sopt.length;e++)if((j=a.inArray(o.sopt[e],l))!=-1){o.ops[m]={op:o.sopt[e],text:d.odata[j]};m++}}if(typeof this.stype==="undefined")this.stype="text";if(this.stype=="select")if(o.dataUrl===undefined){var k;if(o.value)k=o.value;else if(this.editoptions)k=this.editoptions.value;if(k){o.dataValues=[];if(typeof k===  
"string"){k=k.split(";");var i;for(e=0;e<k.length;e++){i=k[e].split(":");o.dataValues[e]={value:i[0],text:i[1]}}}else if(typeof k==="object"){e=0;for(i in k)if(k.hasOwnProperty(i)){o.dataValues[e]={value:i,text:k[i]};e++}}}}if(s&&y||y&&!J)p.push(o)});if(p.length>0){a("<div id='"+h+"' role='dialog' tabindex='-1'></div>").insertBefore("#gview_"+z.p.id);if(d.stringResult===undefined)d.stringResult=d.multipleSearch;z.SearchFilter=a("#"+h).searchFilter(p,{groupOps:d.groupOps,operators:u,onClose:t,resetText:d.Reset,  
searchText:d.Find,windowTitle:d.caption,rulesText:d.rulesText,matchText:d.matchText,onSearch:q,onReset:D,stringResult:d.stringResult,ajaxSelectOptions:a.extend({},a.jgrid.ajaxOptions,z.p.ajaxSelectOptions||{}),clone:d.cloneSearchRowOnAdd});a(".ui-widget-overlay","#"+h).remove();z.p.direction=="rtl"&&a(".ui-closer","#"+h).css("float","left");if(d.drag===true){a("#"+h+" table thead tr:first td:first").css("cursor","move");if(jQuery.fn.jqDrag)a("#"+h).jqDrag(a("#"+h+" table thead tr:first td:first"));  
else try{a("#"+h).draggable({handle:a("#"+h+" table thead tr:first td:first")})}catch(Q){}}if(d.multipleSearch===false){a(".ui-del, .ui-add, .ui-del, .ui-add-last, .matchText, .rulesText","#"+h).hide();a("select[name='groupOp']","#"+h).hide()}d.multipleSearch===true&&d.loadDefaults===true&&b(z,d);a.isFunction(d.onInitializeSearch)&&d.onInitializeSearch(a("#"+h));a.isFunction(d.beforeShowSearch)&&d.beforeShowSearch(a("#"+h));F();a.isFunction(d.afterShowSearch)&&d.afterShowSearch(a("#"+h));d.closeOnEscape===  
true&&a("#"+h).keydown(function(o){o.which==27&&t(a("#"+h))})}}}})},editGridRow:function(d,b){c=b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:false,drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:false,  
jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},a.jgrid.edit,b||{});return this.each(function(){function q(g,n){g===0?a("#pData","#"+j+"_2").addClass("ui-state-disabled"):a("#pData","#"+j+"_2").removeClass("ui-state-disabled");g==n?a("#nData","#"+j+"_2").addClass("ui-state-disabled"):  
a("#nData","#"+j+"_2").removeClass("ui-state-disabled")}function D(){var g=a(f).jqGrid("getDataIDs"),n=a("#id_g","#"+j).val();return[a.inArray(n,g),g]}function t(){var g=true;a("#FormError","#"+j).hide();if(c.checkOnUpdate){k={};i={};F();w=a.extend({},k,i);if(O=H(w,c._savedData)){a("#"+e).data("disabled",true);a(".confirm","#"+m.themodal).show();g=false}}return g}function F(){a(".FormElement","#"+j).each(function(){var g=a(".customelement",this);if(g.length){var n=g[0].name;a.each(f.p.colModel,function(){if(this.name==  
n&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{k[n]=this.editoptions.custom_value(a("#"+n,"#"+j),"get");if(k[n]===undefined)throw"e1";}catch(r){r=="e1"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,r.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).attr("checked"))k[this.name]=a(this).val();else{g=a(this).attr("offval");  
k[this.name]=g}break;case "select-one":k[this.name]=a("option:selected",this).val();i[this.name]=a("option:selected",this).text();break;case "select-multiple":k[this.name]=a(this).val();k[this.name]=k[this.name]?k[this.name].join(","):"";var v=[];a("option:selected",this).each(function(r,E){v[r]=a(E).text()});i[this.name]=v.join(",");break;case "password":case "text":case "textarea":case "button":k[this.name]=a(this).val();break}if(f.p.autoencode)k[this.name]=a.jgrid.htmlEncode(k[this.name])}});return true}  
function z(g,n,v,r){for(var E,A,B,M=0,x,P,C,T=[],G=false,V="",R=1;R<=r;R++)V+="<td class='CaptionTD ui-widget-content'>&#160;</td><td class='DataTD ui-widget-content' style='white-space:pre'>&#160;</td>";if(g!="_empty")G=a(n).jqGrid("getInd",g);a(n.p.colModel).each(function(U){E=this.name;P=(A=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if(E!=="cb"&&E!=="subgrid"&&this.editable===true&&E!=="rn"){if(G===false)x="";else if(E==n.p.ExpandColumn&&  
n.p.treeGrid===true)x=a("td:eq("+U+")",n.rows[G]).text();else try{x=a.unformat(a("td:eq("+U+")",n.rows[G]),{rowId:g,colModel:this},U)}catch(ca){x=a("td:eq("+U+")",n.rows[G]).html()}var W=a.extend({},this.editoptions||{},{id:E,name:E}),X=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),ba=parseInt(X.rowpos,10)||M+1,da=parseInt((parseInt(X.colpos,10)||1)*2,10);if(g=="_empty"&&W.defaultValue)x=a.isFunction(W.defaultValue)?W.defaultValue():W.defaultValue;if(!this.edittype)this.edittype=  
"text";if(f.p.autoencode)x=a.jgrid.htmlDecode(x);C=createEl(this.edittype,W,x,false,a.extend({},a.jgrid.ajaxOptions,n.p.ajaxSelectOptions||{}));if(x==""&&this.edittype=="checkbox")x=a(C).attr("offval");if(x==""&&this.edittype=="select")x=a("option:eq(0)",C).text();if(c.checkOnSubmit||c.checkOnUpdate)c._savedData[E]=x;a(C).addClass("FormElement");B=a(v).find("tr[rowpos="+ba+"]");if(X.rowabove){W=a("<tr><td class='contentinfo' colspan='"+r*2+"'>"+X.rowcontent+"</td></tr>");a(v).append(W);W[0].rp=ba}if(B.length===  
0){B=a("<tr "+P+" rowpos='"+ba+"'></tr>").addClass("FormData").attr("id","tr_"+E);a(B).append(V);a(v).append(B);B[0].rp=ba}a("td:eq("+(da-2)+")",B[0]).html(typeof X.label==="undefined"?n.p.colNames[U]:X.label);a("td:eq("+(da-1)+")",B[0]).append(X.elmprefix).append(C).append(X.elmsuffix);T[M]=U;M++}});if(M>0){R=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(r*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+n.p.id+"_id' value='"+  
g+"'/></td></tr>");R[0].rp=M+999;a(v).append(R);if(c.checkOnSubmit||c.checkOnUpdate)c._savedData[n.p.id+"_id"]=g}return T}function h(g,n,v){var r,E=0,A,B,M,x,P;if(c.checkOnSubmit||c.checkOnUpdate){c._savedData={};c._savedData[n.p.id+"_id"]=g}var C=n.p.colModel;if(g=="_empty"){a(C).each(function(){r=this.name;M=a.extend({},this.editoptions||{});B=a("#"+a.jgrid.jqID(r),"#"+v);if(B[0]!=null){x="";if(M.defaultValue){x=a.isFunction(M.defaultValue)?M.defaultValue():M.defaultValue;if(B[0].type=="checkbox"){P=  
x.toLowerCase();if(P.search(/(false|0|no|off|undefined)/i)<0&&P!==""){B[0].checked=true;B[0].defaultChecked=true;B[0].value=x}else B.attr({checked:"",defaultChecked:""})}else B.val(x)}else if(B[0].type=="checkbox"){B[0].checked=false;B[0].defaultChecked=false;x=a(B).attr("offval")}else if(B[0].type.substr(0,6)=="select")B[0].selectedIndex=0;else B.val(x);if(c.checkOnSubmit===true||c.checkOnUpdate)c._savedData[r]=x}});a("#id_g","#"+v).val(g)}else{var T=a(n).jqGrid("getInd",g,true);if(T){a("td",T).each(function(G){r=  
C[G].name;if(r!=="cb"&&r!=="subgrid"&&r!=="rn"&&C[G].editable===true){if(r==n.p.ExpandColumn&&n.p.treeGrid===true)A=a(this).text();else try{A=a.unformat(this,{rowId:g,colModel:C[G]},G)}catch(V){A=a(this).html()}if(f.p.autoencode)A=a.jgrid.htmlDecode(A);if(c.checkOnSubmit===true||c.checkOnUpdate)c._savedData[r]=A;r=a.jgrid.jqID(r);switch(C[G].edittype){case "password":case "text":case "button":case "image":a("#"+r,"#"+v).val(A);break;case "textarea":if(A=="&nbsp;"||A=="&#160;"||A.length==1&&A.charCodeAt(0)==  
160)A="";a("#"+r,"#"+v).val(A);break;case "select":var R=A.split(",");R=a.map(R,function(ca){return a.trim(ca)});a("#"+r+" option","#"+v).each(function(){this.selected=!C[G].editoptions.multiple&&(R[0]==a.trim(a(this).text())||R[0]==a.trim(a(this).val()))?true:C[G].editoptions.multiple?a.inArray(a.trim(a(this).text()),R)>-1||a.inArray(a.trim(a(this).val()),R)>-1?true:false:false});break;case "checkbox":A+="";if(C[G].editoptions&&C[G].editoptions.value)if(C[G].editoptions.value.split(":")[0]==A){a("#"+  
r,"#"+v).attr("checked",true);a("#"+r,"#"+v).attr("defaultChecked",true)}else{a("#"+r,"#"+v).attr("checked",false);a("#"+r,"#"+v).attr("defaultChecked","")}else{A=A.toLowerCase();if(A.search(/(false|0|no|off|undefined)/i)<0&&A!==""){a("#"+r,"#"+v).attr("checked",true);a("#"+r,"#"+v).attr("defaultChecked",true)}else{a("#"+r,"#"+v).attr("checked",false);a("#"+r,"#"+v).attr("defaultChecked","")}}break;case "custom":try{if(C[G].editoptions&&a.isFunction(C[G].editoptions.custom_value))C[G].editoptions.custom_value(a("#"+  
r,"#"+v),"set",A);else throw"e1";}catch(U){U=="e1"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,U.message,jQuery.jgrid.edit.bClose)}break}E++}});E>0&&a("#id_g","#"+j).val(g)}}}function p(){var g,n=[true,"",""],v={},r=f.p.prmNames,E,A;if(a.isFunction(c.beforeCheckValues)){var B=c.beforeCheckValues(k,a("#"+e),k[f.p.id+"_id"]=="_empty"?r.addoper:r.editoper);if(B&&typeof B==="object")k=B}for(var M in k)if(k.hasOwnProperty(M)){n=  
checkValues(k[M],M,f);if(n[0]===false)break}if(n[0]){if(a.isFunction(c.onclickSubmit))v=c.onclickSubmit(c,k)||{};if(a.isFunction(c.beforeSubmit))n=c.beforeSubmit(k,a("#"+e))}if(n[0]&&!c.processing){c.processing=true;a("#sData","#"+j+"_2").addClass("ui-state-active");A=r.oper;E=r.id;k[A]=a.trim(k[f.p.id+"_id"])=="_empty"?r.addoper:r.editoper;if(k[A]!=r.addoper)k[E]=k[f.p.id+"_id"];else if(k[E]===undefined)k[E]=k[f.p.id+"_id"];delete k[f.p.id+"_id"];k=a.extend(k,c.editData,v);v=a.extend({url:c.url?  
c.url:a(f).jqGrid("getGridParam","editurl"),type:c.mtype,data:a.isFunction(c.serializeEditData)?c.serializeEditData(k):k,complete:function(x,P){if(P!="success"){n[0]=false;n[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(x):P+" Status: '"+x.statusText+"'. Error code: "+x.status}else if(a.isFunction(c.afterSubmit))n=c.afterSubmit(x,k);if(n[0]===false){a("#FormError>td","#"+j).html(n[1]);a("#FormError","#"+j).show()}else{a.each(f.p.colModel,function(){if(i[this.name]&&this.formatter&&this.formatter==  
"select")try{delete i[this.name]}catch(G){}});k=a.extend(k,i);f.p.autoencode&&a.each(k,function(G,V){k[G]=a.jgrid.htmlDecode(V)});if(k[A]==r.addoper){n[2]||(n[2]=parseInt(f.p.records,10)+1);k[E]=n[2];if(c.closeAfterAdd){if(c.reloadAfterSubmit)a(f).trigger("reloadGrid");else{a(f).jqGrid("addRowData",n[2],k,b.addedrow);a(f).jqGrid("setSelection",n[2])}hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose})}else if(c.clearAfterAdd){c.reloadAfterSubmit?a(f).trigger("reloadGrid"):a(f).jqGrid("addRowData",  
n[2],k,b.addedrow);h("_empty",f,e)}else c.reloadAfterSubmit?a(f).trigger("reloadGrid"):a(f).jqGrid("addRowData",n[2],k,b.addedrow)}else{if(c.reloadAfterSubmit){a(f).trigger("reloadGrid");c.closeAfterEdit||setTimeout(function(){a(f).jqGrid("setSelection",k[E])},1E3)}else f.p.treeGrid===true?a(f).jqGrid("setTreeRow",k[E],k):a(f).jqGrid("setRowData",k[E],k);c.closeAfterEdit&&hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose})}if(a.isFunction(c.afterComplete)){g=x;setTimeout(function(){c.afterComplete(g,  
k,a("#"+e));g=null},500)}}c.processing=false;if(c.checkOnSubmit||c.checkOnUpdate){a("#"+e).data("disabled",false);if(c._savedData[f.p.id+"_id"]!="_empty")for(var C in c._savedData)if(k[C])c._savedData[C]=k[C]}a("#sData","#"+j+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+e)[0].focus()}catch(T){}},error:function(x,P,C){a("#FormError>td","#"+j).html(P+" : "+C);a("#FormError","#"+j).show();c.processing=false;a("#"+e).data("disabled",false);a("#sData","#"+j+"_2").removeClass("ui-state-active")}},  
a.jgrid.ajaxOptions,c.ajaxEditOptions);if(!v.url&&!c.useDataProxy)if(a.isFunction(f.p.dataProxy))c.useDataProxy=true;else{n[0]=false;n[1]+=" "+a.jgrid.errors.nourl}if(n[0])c.useDataProxy?f.p.dataProxy.call(f,v,"set_"+f.p.id):a.ajax(v)}if(n[0]===false){a("#FormError>td","#"+j).html(n[1]);a("#FormError","#"+j).show()}}function H(g,n){var v=false,r;for(r in g)if(g[r]!=n[r]){v=true;break}return v}var f=this;if(f.grid&&d){var l=f.p.id,e="FrmGrid_"+l,j="TblGrid_"+l,m={themodal:"editmod"+l,modalhead:"edithd"+  
l,modalcontent:"editcnt"+l,scrollelm:e},u=a.isFunction(c.beforeShowForm)?c.beforeShowForm:false,Q=a.isFunction(c.afterShowForm)?c.afterShowForm:false,o=a.isFunction(c.beforeInitData)?c.beforeInitData:false,s=a.isFunction(c.onInitializeForm)?c.onInitializeForm:false,y=1,J=0,k,i,w,O;if(d=="new"){d="_empty";b.caption=b.addCaption}else b.caption=b.editCaption;b.recreateForm===true&&a("#"+m.themodal).html()!=null&&a("#"+m.themodal).remove();var S=true;if(b.checkOnUpdate&&b.jqModal&&!b.modal)S=false;if(a("#"+  
m.themodal).html()!=null){a(".ui-jqdialog-title","#"+m.modalhead).html(b.caption);a("#FormError","#"+j).hide();if(c.topinfo){a(".topinfo","#"+j+"_2").html(c.topinfo);a(".tinfo","#"+j+"_2").show()}else a(".tinfo","#"+j+"_2").hide();if(c.bottominfo){a(".bottominfo","#"+j+"_2").html(c.bottominfo);a(".binfo","#"+j+"_2").show()}else a(".binfo","#"+j+"_2").hide();o&&o(a("#"+e));h(d,f,e);d=="_empty"||!c.viewPagerButtons?a("#pData, #nData","#"+j+"_2").hide():a("#pData, #nData","#"+j+"_2").show();if(c.processing===  
true){c.processing=false;a("#sData","#"+j+"_2").removeClass("ui-state-active")}if(a("#"+e).data("disabled")===true){a(".confirm","#"+m.themodal).hide();a("#"+e).data("disabled",false)}u&&u(a("#"+e));a("#"+m.themodal).data("onClose",c.onClose);viewModal("#"+m.themodal,{gbox:"#gbox_"+l,jqm:b.jqModal,jqM:false,closeoverlay:S,modal:b.modal});S||a(".jqmOverlay").click(function(){if(!t())return false;hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose});return false});Q&&Q(a("#"+e))}else{a(f.p.colModel).each(function(){var g=  
this.formoptions;y=Math.max(y,g?g.colpos||0:0);J=Math.max(J,g?g.rowpos||0:0)});var I=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",K;I=a("<form name='FormPost' id='"+e+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+I+";'></form>").data("disabled",false);var L=a("<table id='"+j+"' class='EditTable' cellspacing='0' cellpading='0' border='0'><tbody></tbody></table>");a(I).append(L);K=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+  
y*2+"'></td></tr>");K[0].rp=0;a(L).append(K);K=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+y*2+"'>"+c.topinfo+"</td></tr>");K[0].rp=0;a(L).append(K);o&&o(a("#"+e));K=(o=f.p.direction=="rtl"?true:false)?"nData":"pData";var N=o?"pData":"nData";z(d,f,L,y);K="<a href='javascript:void(0)' id='"+K+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>";N="<a href='javascript:void(0)' id='"+N+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>";  
var Z="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",$="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>";K="<table border='0' class='EditTable' id='"+j+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content'>"+(o?N+K:K+N)+"</td><td class='EditButton ui-widget-content'>"+Z+$+"</td></tr>";K+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+  
c.bottominfo+"</td></tr>";K+="</tbody></table>";if(J>0){var aa=[];a.each(a(L)[0].rows,function(g,n){aa[g]=n});aa.sort(function(g,n){if(g.rp>n.rp)return 1;if(g.rp<n.rp)return-1;return 0});a.each(aa,function(g,n){a("tbody",L).append(n)})}b.gbox="#gbox_"+l;var Y=false;if(b.closeOnEscape===true){b.closeOnEscape=false;Y=true}I=a("<span></span>").append(I).append(K);createModal(m,I,b,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);if(o){a("#pData, #nData","#"+j+"_2").css("float","right");a(".EditButton","#"+j+  
"_2").css("text-align","left")}c.topinfo&&a(".tinfo","#"+j+"_2").show();c.bottominfo&&a(".binfo","#"+j+"_2").show();K=I=null;a("#"+m.themodal).keydown(function(g){var n=g.target;if(a("#"+e).data("disabled")===true)return false;if(c.savekey[0]===true&&g.which==c.savekey[1])if(n.tagName!="TEXTAREA"){a("#sData","#"+j+"_2").trigger("click");return false}if(g.which===27){if(!t())return false;Y&&hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:c.onClose});return false}if(c.navkeys[0]===true){if(a("#id_g",  
"#"+j).val()=="_empty")return true;if(g.which==c.navkeys[1]){a("#pData","#"+j+"_2").trigger("click");return false}if(g.which==c.navkeys[2]){a("#nData","#"+j+"_2").trigger("click");return false}}});if(b.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+m.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close","#"+m.themodal).unbind("click").click(function(){if(!t())return false;hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose});return false})}b.saveicon=a.extend([true,  
"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.saveicon[0]===true)a("#sData","#"+j+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");if(b.closeicon[0]===true)a("#cData","#"+j+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");if(c.checkOnSubmit||c.checkOnUpdate){Z=  
"<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>";N="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>";$="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bExit+"</a>";I=b.zIndex||999;I++;a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+I+";display:none;'>&#160;"+  
(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(I+1)+"'>"+b.saveData+"<br/><br/>"+Z+N+$+"</div>").insertAfter("#"+e);a("#sNew","#"+m.themodal).click(function(){p();a("#"+e).data("disabled",false);a(".confirm","#"+m.themodal).hide();return false});a("#nNew","#"+m.themodal).click(function(){a(".confirm","#"+  
m.themodal).hide();a("#"+e).data("disabled",false);setTimeout(function(){a(":input","#"+e)[0].focus()},0);return false});a("#cNew","#"+m.themodal).click(function(){a(".confirm","#"+m.themodal).hide();a("#"+e).data("disabled",false);hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose});return false})}s&&s(a("#"+e));d=="_empty"||!c.viewPagerButtons?a("#pData,#nData","#"+j+"_2").hide():a("#pData,#nData","#"+j+"_2").show();u&&u(a("#"+e));a("#"+m.themodal).data("onClose",c.onClose);  
viewModal("#"+m.themodal,{gbox:"#gbox_"+l,jqm:b.jqModal,closeoverlay:S,modal:b.modal});S||a(".jqmOverlay").click(function(){if(!t())return false;hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose});return false});Q&&Q(a("#"+e));a(".fm-button","#"+m.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+j+"_2").click(function(){k={};i={};a("#FormError","#"+j).hide();F();if(k[f.p.id+"_id"]=="_empty")p();else if(b.checkOnSubmit===  
true){w=a.extend({},k,i);if(O=H(w,c._savedData)){a("#"+e).data("disabled",true);a(".confirm","#"+m.themodal).show()}else p()}else p();return false});a("#cData","#"+j+"_2").click(function(){if(!t())return false;hideModal("#"+m.themodal,{gb:"#gbox_"+l,jqm:b.jqModal,onClose:c.onClose});return false});a("#nData","#"+j+"_2").click(function(){if(!t())return false;a("#FormError","#"+j).hide();var g=D();g[0]=parseInt(g[0],10);if(g[0]!=-1&&g[1][g[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next",  
a("#"+e),g[1][g[0]]);h(g[1][g[0]+1],f,e);a(f).jqGrid("setSelection",g[1][g[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+e),g[1][g[0]+1]);q(g[0]+1,g[1].length-1)}return false});a("#pData","#"+j+"_2").click(function(){if(!t())return false;a("#FormError","#"+j).hide();var g=D();if(g[0]!=-1&&g[1][g[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+e),g[1][g[0]]);h(g[1][g[0]-1],f,e);a(f).jqGrid("setSelection",g[1][g[0]-1]);a.isFunction(b.afterclickPgButtons)&&  
b.afterclickPgButtons("prev",a("#"+e),g[1][g[0]-1]);q(g[0]-1,g[1].length-1)}return false})}u=D();q(u[0],u[1].length-1)}})},viewGridRow:function(d,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,drag:true,resize:true,jqModal:true,closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,viewPagerButtons:true},a.jgrid.view,b||{});return this.each(function(){function q(){if(b.closeOnEscape===true||b.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close",  
"#"+l.modalhead).focus()},0)}function D(i,w){i===0?a("#pData","#"+f+"_2").addClass("ui-state-disabled"):a("#pData","#"+f+"_2").removeClass("ui-state-disabled");i==w?a("#nData","#"+f+"_2").addClass("ui-state-disabled"):a("#nData","#"+f+"_2").removeClass("ui-state-disabled")}function t(){var i=a(h).jqGrid("getDataIDs"),w=a("#id_g","#"+f).val();return[a.inArray(w,i),i]}function F(i,w,O,S){for(var I,K,L,N=0,Z,$,aa=[],Y=false,g="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+  
"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",n="",v=["integer","number","currency"],r=0,E=0,A,B,M,x=1;x<=S;x++)n+=x==1?g:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(w.p.colModel).each(function(){K=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!K&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,v)!==-1)r=  
Math.max(r,parseInt(this.width,10));else E=Math.max(E,parseInt(this.width,10))});A=r!==0?r:E!==0?E:0;Y=a(w).jqGrid("getInd",i);a(w.p.colModel).each(function(P){I=this.name;B=false;$=(K=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";M=typeof this.viewable!="boolean"?true:this.viewable;if(I!=="cb"&&I!=="subgrid"&&I!=="rn"&&M){Z=Y===false?"":I==w.p.ExpandColumn&&w.p.treeGrid===true?a("td:eq("+P+")",w.rows[Y]).text():a("td:eq("+P+")",w.rows[Y]).html();  
B=this.align==="right"&&A!==0?true:false;a.extend({},this.editoptions||{},{id:I,name:I});var C=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),T=parseInt(C.rowpos,10)||N+1,G=parseInt((parseInt(C.colpos,10)||1)*2,10);if(C.rowabove){var V=a("<tr><td class='contentinfo' colspan='"+S*2+"'>"+C.rowcontent+"</td></tr>");a(O).append(V);V[0].rp=T}L=a(O).find("tr[rowpos="+T+"]");if(L.length===0){L=a("<tr "+$+" rowpos='"+T+"'></tr>").addClass("FormData").attr("id","trv_"+I);a(L).append(n);a(O).append(L);  
L[0].rp=T}a("td:eq("+(G-2)+")",L[0]).html("<b>"+(typeof C.label==="undefined"?w.p.colNames[P]:C.label)+"</b>");a("td:eq("+(G-1)+")",L[0]).append("<span>"+Z+"</span>").attr("id","v_"+I);B&&a("td:eq("+(G-1)+") span",L[0]).css({"text-align":"right",width:A+"px"});aa[N]=P;N++}});if(N>0){i=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(S*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+i+"'/></td></tr>");i[0].rp=N+99;a(O).append(i)}return aa}  
function z(i,w){var O,S,I=0,K,L;if(L=a(w).jqGrid("getInd",i,true)){a("td",L).each(function(N){O=w.p.colModel[N].name;S=w.p.colModel[N].editrules&&w.p.colModel[N].editrules.edithidden===true?false:w.p.colModel[N].hidden===true?true:false;if(O!=="cb"&&O!=="subgrid"&&O!=="rn"){K=O==w.p.ExpandColumn&&w.p.treeGrid===true?a(this).text():a(this).html();a.extend({},w.p.colModel[N].editoptions||{});O=a.jgrid.jqID("v_"+O);a("#"+O+" span","#"+f).html(K);S&&a("#"+O,"#"+f).parents("tr:first").hide();I++}});I>  
0&&a("#id_g","#"+f).val(i)}}var h=this;if(h.grid&&d){if(!b.imgpath)b.imgpath=h.p.imgpath;var p=h.p.id,H="ViewGrid_"+p,f="ViewTbl_"+p,l={themodal:"viewmod"+p,modalhead:"viewhd"+p,modalcontent:"viewcnt"+p,scrollelm:H},e=1,j=0;if(a("#"+l.themodal).html()!=null){a(".ui-jqdialog-title","#"+l.modalhead).html(b.caption);a("#FormError","#"+f).hide();z(d,h);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+H));viewModal("#"+l.themodal,{gbox:"#gbox_"+p,jqm:b.jqModal,jqM:false,modal:b.modal});q()}else{a(h.p.colModel).each(function(){var i=  
this.formoptions;e=Math.max(e,i?i.colpos||0:0);j=Math.max(j,i?i.rowpos||0:0)});var m=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",u=a("<form name='FormPost' id='"+H+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+m+";'></form>"),Q=a("<table id='"+f+"' class='EditTable' cellspacing='1' cellpading='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");a(u).append(Q);F(d,h,Q,e);m=h.p.direction=="rtl"?true:false;var o="<a href='javascript:void(0)' id='"+  
(m?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",s="<a href='javascript:void(0)' id='"+(m?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",y="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bClose+"</a>";if(j>0){var J=[];a.each(a(Q)[0].rows,function(i,w){J[i]=w});J.sort(function(i,w){if(i.rp>w.rp)return 1;  
if(i.rp<w.rp)return-1;return 0});a.each(J,function(i,w){a("tbody",Q).append(w)})}b.gbox="#gbox_"+p;var k=false;if(b.closeOnEscape===true){b.closeOnEscape=false;k=true}u=a("<span></span>").append(u).append("<table border='0' class='EditTable' id='"+f+"_2'><tbody><tr id='Act_Buttons'><td class='navButton ui-widget-content' width='"+b.labelswidth+"'>"+(m?s+o:o+s)+"</td><td class='EditButton ui-widget-content'>"+y+"</td></tr></tbody></table>");createModal(l,u,b,"#gview_"+h.p.id,a("#gview_"+h.p.id)[0]);  
if(m){a("#pData, #nData","#"+f+"_2").css("float","right");a(".EditButton","#"+f+"_2").css("text-align","left")}b.viewPagerButtons||a("#pData, #nData","#"+f+"_2").hide();u=null;a("#"+l.themodal).keydown(function(i){if(i.which===27){k&&hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(i.which===b.navkeys[1]){a("#pData","#"+f+"_2").trigger("click");return false}if(i.which===b.navkeys[2]){a("#nData","#"+f+"_2").trigger("click");return false}}});b.closeicon=  
a.extend([true,"left","ui-icon-close"],b.closeicon);if(b.closeicon[0]===true)a("#cData","#"+f+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+H));viewModal("#"+l.themodal,{gbox:"#gbox_"+p,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+f+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});  
q();a("#cData","#"+f+"_2").click(function(){hideModal("#"+l.themodal,{gb:"#gbox_"+p,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+f+"_2").click(function(){a("#FormError","#"+f).hide();var i=t();i[0]=parseInt(i[0],10);if(i[0]!=-1&&i[1][i[0]+1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("next",a("#"+H),i[1][i[0]]);z(i[1][i[0]+1],h);a(h).jqGrid("setSelection",i[1][i[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+H),i[1][i[0]+1]);D(i[0]+1,i[1].length-  
1)}q();return false});a("#pData","#"+f+"_2").click(function(){a("#FormError","#"+f).hide();var i=t();if(i[0]!=-1&&i[1][i[0]-1]){a.isFunction(b.onclickPgButtons)&&b.onclickPgButtons("prev",a("#"+H),i[1][i[0]]);z(i[1][i[0]-1],h);a(h).jqGrid("setSelection",i[1][i[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+H),i[1][i[0]-1]);D(i[0]-1,i[1].length-1)}q();return false})}m=t();D(m[0],m[1].length-1)}})},delGridRow:function(d,b){c=b=a.extend({top:0,left:0,width:240,height:"auto",  
dataheight:"auto",modal:false,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},a.jgrid.del,b||{});return this.each(function(){var q=this;if(q.grid)if(d){var D=typeof b.beforeShowForm==="function"?true:false,t=typeof b.afterShowForm===  
"function"?true:false,F=q.p.id,z={},h="DelTbl_"+F,p,H,f,l,e={themodal:"delmod"+F,modalhead:"delhd"+F,modalcontent:"delcnt"+F,scrollelm:h};if(jQuery.isArray(d))d=d.join();if(a("#"+e.themodal).html()!=null){a("#DelData>td","#"+h).text(d);a("#DelError","#"+h).hide();if(c.processing===true){c.processing=false;a("#dData","#"+h).removeClass("ui-state-active")}D&&b.beforeShowForm(a("#"+h));viewModal("#"+e.themodal,{gbox:"#gbox_"+F,jqm:b.jqModal,jqM:false,modal:b.modal})}else{var j=isNaN(b.dataheight)?b.dataheight:  
b.dataheight+"px";j="<div id='"+h+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+j+";'>";j+="<table class='DelTable'><tbody>";j+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";j+="<tr id='DelData' style='display:none'><td >"+d+"</td></tr>";j+='<tr><td class="delmsg" style="white-space:pre;">'+b.msg+"</td></tr><tr><td >&#160;</td></tr>";j+="</tbody></table></div>";j+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+  
h+"_2'><tbody><tr><td class='DataTD ui-widget-content'></td></tr><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+F;createModal(e,j,b,"#gview_"+q.p.id,a("#gview_"+q.p.id)[0]);a(".fm-button",  
"#"+h+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([true,"left","ui-icon-scissors"],b.delicon);b.cancelicon=a.extend([true,"left","ui-icon-cancel"],b.cancelicon);if(b.delicon[0]===true)a("#dData","#"+h+"_2").addClass(b.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");if(b.cancelicon[0]===true)a("#eData","#"+h+"_2").addClass(b.cancelicon[1]==  
"right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+h+"_2").click(function(){var m=[true,""];z={};var u=a("#DelData>td","#"+h).text();if(typeof b.onclickSubmit==="function")z=b.onclickSubmit(c,u)||{};if(typeof b.beforeSubmit==="function")m=b.beforeSubmit(u);if(m[0]&&!c.processing){c.processing=true;a(this).addClass("ui-state-active");f=q.p.prmNames;p=a.extend({},c.delData,z);l=f.oper;p[l]=f.deloper;H=f.id;p[H]=u;var Q=a.extend({url:c.url?  
c.url:a(q).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(p):p,complete:function(o,s){if(s!="success"){m[0]=false;m[1]=a.isFunction(c.errorTextFormat)?c.errorTextFormat(o):s+" Status: '"+o.statusText+"'. Error code: "+o.status}else if(typeof c.afterSubmit==="function")m=c.afterSubmit(o,p);if(m[0]===false){a("#DelError>td","#"+h).html(m[1]);a("#DelError","#"+h).show()}else{if(c.reloadAfterSubmit)a(q).trigger("reloadGrid");else{s=[];s=u.split(",");  
if(q.p.treeGrid===true)try{a(q).jqGrid("delTreeNode",s[0])}catch(y){}else for(var J=0;J<s.length;J++)a(q).jqGrid("delRowData",s[J]);q.p.selrow=null;q.p.selarrrow=[]}a.isFunction(c.afterComplete)&&setTimeout(function(){c.afterComplete(o,u)},500)}c.processing=false;a("#dData","#"+h+"_2").removeClass("ui-state-active");m[0]&&hideModal("#"+e.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:c.onClose})},error:function(o,s,y){a("#DelError>td","#"+h).html(s+" : "+y);a("#DelError","#"+h).show();c.processing=  
false;a("#dData","#"+h+"_2").removeClass("ui-state-active")}},a.jgrid.ajaxOptions,b.ajaxDelOptions);if(!Q.url&&!c.useDataProxy)if(a.isFunction(q.p.dataProxy))c.useDataProxy=true;else{m[0]=false;m[1]+=" "+a.jgrid.errors.nourl}if(m[0])c.useDataProxy?q.p.dataProxy.call(q,Q,"del_"+q.p.id):a.ajax(Q)}if(m[0]===false){a("#DelError>td","#"+h).html(m[1]);a("#DelError","#"+h).show()}return false});a("#eData","#"+h+"_2").click(function(){hideModal("#"+e.themodal,{gb:"#gbox_"+F,jqm:b.jqModal,onClose:c.onClose});  
return false});D&&b.beforeShowForm(a("#"+h));viewModal("#"+e.themodal,{gbox:"#gbox_"+F,jqm:b.jqModal,modal:b.modal})}t&&b.afterShowForm(a("#"+h));b.closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+e.modalhead).focus()},0)}})},navGrid:function(d,b,q,D,t,F,z){b=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",  
view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,beforeRefresh:null,afterRefresh:null,cloneToTop:false},a.jgrid.nav,b||{});return this.each(function(){var h={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},p=this,H,f,l;if(!(!p.grid||typeof d!="string")){if(a("#"+h.themodal).html()===null){if(typeof window.innerWidth!="undefined"){H=window.innerWidth;f=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!=  
"undefined"&&document.documentElement.clientWidth!==0){H=document.documentElement.clientWidth;f=document.documentElement.clientHeight}else{H=1024;f=768}createModal(h,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+p.p.id,jqModal:true,drag:true,resize:true,caption:b.alertcap,top:f/2-25,left:H/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",true)}H=1;if(b.cloneToTop&&p.p.toppager)H=2;for(f=0;f<H;f++){var e=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),  
j,m;if(f===0){j=d;m=p.p.id;if(j==p.p.toppager){m+="_top";H=1}}else{j=p.p.toppager;m=p.p.id+"_top"}p.p.direction=="rtl"&&a(e).attr("dir","rtl").css("float","right");if(b.add){D=D||{};l=a("<td class='ui-pg-button ui-corner-all'></td>");a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>");a("tr",e).append(l);a(l,e).attr({title:b.addtitle||"",id:D.id||"add_"+m}).click(function(){a(this).hasClass("ui-state-disabled")||(typeof b.addfunc=="function"?b.addfunc():  
a(p).jqGrid("editGridRow","new",D));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}if(b.edit){l=a("<td class='ui-pg-button ui-corner-all'></td>");q=q||{};a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.editicon+"'></span>"+b.edittext+"</div>");a("tr",e).append(l);a(l,e).attr({title:b.edittitle||"",id:q.id||"edit_"+m}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var u=  
p.p.selrow;if(u)typeof b.editfunc=="function"?b.editfunc(u):a(p).jqGrid("editGridRow",u,q);else{viewModal("#"+h.themodal,{gbox:"#gbox_"+p.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}if(b.view){l=a("<td class='ui-pg-button ui-corner-all'></td>");z=z||{};a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+  
"</div>");a("tr",e).append(l);a(l,e).attr({title:b.viewtitle||"",id:z.id||"view_"+m}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var u=p.p.selrow;if(u)a(p).jqGrid("viewGridRow",u,z);else{viewModal("#"+h.themodal,{gbox:"#gbox_"+p.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}if(b.del){l=a("<td class='ui-pg-button ui-corner-all'></td>");  
t=t||{};a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>");a("tr",e).append(l);a(l,e).attr({title:b.deltitle||"",id:t.id||"del_"+m}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var u;if(p.p.multiselect){u=p.p.selarrrow;if(u.length===0)u=null}else u=p.p.selrow;if(u)"function"==typeof b.delfunc?b.delfunc(u):a(p).jqGrid("delGridRow",u,t);else{viewModal("#"+h.themodal,{gbox:"#gbox_"+p.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||  
a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}if(b.add||b.edit||b.del||b.view)a("tr",e).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");if(b.search){l=a("<td class='ui-pg-button ui-corner-all'></td>");F=F||{};a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+"'></span>"+b.searchtext+"</div>");a("tr",e).append(l);a(l,e).attr({title:b.searchtitle||"",id:F.id||"search_"+  
m}).click(function(){a(this).hasClass("ui-state-disabled")||a(p).jqGrid("searchGrid",F);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}if(b.refresh){l=a("<td class='ui-pg-button ui-corner-all'></td>");a(l).append("<div class='ui-pg-div'><span class='ui-icon "+b.refreshicon+"'></span>"+b.refreshtext+"</div>");a("tr",e).append(l);a(l,e).attr({title:b.refreshtitle||"",id:"refresh_"+m}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&  
b.beforeRefresh();p.p.search=false;try{a("#fbox_"+p.p.id).searchFilter().reset();a.isFunction(p.clearToolbar)&&p.clearToolbar(false)}catch(u){}switch(b.refreshstate){case "firstpage":a(p).trigger("reloadGrid",[{page:1}]);break;case "current":a(p).trigger("reloadGrid",[{current:true}]);break}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});l=null}l=  
a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+l+";visibility:hidden;' ></div>");l=a(e).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(j+"_"+b.position,j).append(e);if(p.p._nvtd){if(l>p.p._nvtd[0]){a(j+"_"+b.position,j).width(l);p.p._nvtd[0]=l}p.p._nvtd[1]=l}e=l=l=null}}})},navButtonAdd:function(d,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",  
cursor:"pointer"},b||{});return this.each(function(){if(this.grid){if(d.indexOf("#")!==0)d="#"+d;var q=a(".navtable",d)[0],D=this;if(q){var t=a("<td></td>");b.buttonicon.toString().toUpperCase()=="NONE"?a(t).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+b.caption+"</div>"):a(t).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+"</div>");b.id&&a(t).attr("id",b.id);if(b.position=="first")q.rows[0].cells.length===  
0?a("tr",q).append(t):a("tr td:eq(0)",q).before(t);else a("tr",q).append(t);a(t,q).attr("title",b.title||"").click(function(F){a(this).hasClass("ui-state-disabled")||a.isFunction(b.onClickButton)&&b.onClickButton.call(D,F);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(d,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){if(d.indexOf("#")!==  
0)d="#"+d;var q=a(".navtable",d)[0];if(q){var D="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+"'></span>"+b.sepcontent+"</td>";a("tr",q).append(D)}}})},GridToForm:function(d,b){return this.each(function(){var q=this;if(q.grid){var D=a(q).jqGrid("getRowData",d);if(D)for(var t in D)a("[name="+t+"]",b).is("input:radio")||a("[name="+t+"]",b).is("input:checkbox")?a("[name="+t+"]",b).each(function(){a(this).val()==D[t]?a(this).attr("checked","checked"):a(this).attr("checked",  
"")}):a("[name="+t+"]",b).val(D[t])}})},FormToGrid:function(d,b,q,D){return this.each(function(){var t=this;if(t.grid){q||(q="set");D||(D="first");var F=a(b).serializeArray(),z={};a.each(F,function(h,p){z[p.name]=p.value});if(q=="add")a(t).jqGrid("addRowData",d,z,D);else q=="set"&&a(t).jqGrid("setRowData",d,z)}})}})})(jQuery);  
jQuery.fn.searchFilter=function(k,H){function I(e,l,v){this.$=e;this.add=function(a){a==null?e.find(".ui-add-last").click():e.find(".sf:eq("+a+") .ui-add").click();return this};this.del=function(a){a==null?e.find(".sf:last .ui-del").click():e.find(".sf:eq("+a+") .ui-del").click();return this};this.search=function(){e.find(".ui-search").click();return this};this.reset=function(){e.find(".ui-reset").click();return this};this.close=function(){e.find(".ui-closer").click();return this};if(l!=null){function C(){jQuery(this).toggleClass("ui-state-hover");  
return false}function D(a){jQuery(this).toggleClass("ui-state-active",a.type=="mousedown");return false}function m(a,b){return"<option value='"+a+"'>"+b+"</option>"}function w(a,b,d){return"<select class='"+a+"'"+(d?" style='display:none;'":"")+">"+b+"</select>"}function E(a,b){a=e.find("tr.sf td.data "+a);a[0]!=null&&b(a)}function F(a,b){var d=e.find("tr.sf td.data "+a);d[0]!=null&&jQuery.each(b,function(){this.data!=null?d.bind(this.type,this.data,this.fn):d.bind(this.type,this.fn)})}var f=jQuery.extend({},  
jQuery.fn.searchFilter.defaults,v),n=-1,r="";jQuery.each(f.groupOps,function(){r+=m(this.op,this.text)});r="<select name='groupOp'>"+r+"</select>";e.html("").addClass("ui-searchFilter").append("<div class='ui-widget-overlay' style='z-index: -1'>&#160;</div><table class='ui-widget-content ui-corner-all'><thead><tr><td colspan='5' class='ui-widget-header ui-corner-all' style='line-height: 18px;'><div class='ui-closer ui-state-default ui-corner-all ui-helper-clearfix' style='float: right;'><span class='ui-icon ui-icon-close'></span></div>"+  
f.windowTitle+"</td></tr></thead><tbody><tr class='sf'><td class='fields'></td><td class='ops'></td><td class='data'></td><td><div class='ui-del ui-state-default ui-corner-all'><span class='ui-icon ui-icon-minus'></span></div></td><td><div class='ui-add ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plus'></span></div></td></tr><tr><td colspan='5' class='divider'><div>&#160;</div></td></tr></tbody><tfoot><tr><td colspan='3'><span class='ui-reset ui-state-default ui-corner-all' style='display: inline-block; float: left;'><span class='ui-icon ui-icon-arrowreturnthick-1-w' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+  
f.resetText+"</span></span><span class='ui-search ui-state-default ui-corner-all' style='display: inline-block; float: right;'><span class='ui-icon ui-icon-search' style='float: left;'></span><span style='line-height: 18px; padding: 0 7px 0 3px;'>"+f.searchText+"</span></span><span class='matchText'>"+f.matchText+"</span> "+r+" <span class='rulesText'>"+f.rulesText+"</span></td><td>&#160;</td><td><div class='ui-add-last ui-state-default ui-corner-all'><span class='ui-icon ui-icon-plusthick'></span></div></td></tr></tfoot></table>");  
var x=e.find("tr.sf"),G=x.find("td.fields"),y=x.find("td.ops"),o=x.find("td.data"),s="";jQuery.each(f.operators,function(){s+=m(this.op,this.text)});s=w("default",s,true);y.append(s);o.append("<input type='text' class='default' style='display:none;' />");var t="",z=false,p=false;jQuery.each(l,function(a){t+=m(this.itemval,this.text);if(this.ops!=null){z=true;var b="";jQuery.each(this.ops,function(){b+=m(this.op,this.text)});b=w("field"+a,b,true);y.append(b)}if(this.dataUrl!=null){if(a>n)n=a;p=true;  
var d=this.dataEvents,c=this.dataInit,g=this.buildSelect;jQuery.ajax(jQuery.extend({url:this.dataUrl,complete:function(h){h=g!=null?jQuery("<div />").append(g(h)):jQuery("<div />").append(h.responseText);h.find("select").addClass("field"+a).hide();o.append(h.html());c&&E(".field"+a,c);d&&F(".field"+a,d);a==n&&e.find("tr.sf td.fields select[name='field']").change()}},f.ajaxSelectOptions))}else if(this.dataValues!=null){p=true;var i="";jQuery.each(this.dataValues,function(){i+=m(this.value,this.text)});  
i=w("field"+a,i,true);o.append(i)}else if(this.dataEvents!=null||this.dataInit!=null){p=true;i="<input type='text' class='field"+a+"' />";o.append(i)}this.dataInit!=null&&a!=n&&E(".field"+a,this.dataInit);this.dataEvents!=null&&a!=n&&F(".field"+a,this.dataEvents)});t="<select name='field'>"+t+"</select>";G.append(t);l=G.find("select[name='field']");z?l.change(function(a){var b=a.target.selectedIndex;a=jQuery(a.target).parents("tr.sf").find("td.ops");a.find("select").removeAttr("name").hide();b=a.find(".field"+  
b);if(b[0]==null)b=a.find(".default");b.attr("name","op").show()}):y.find(".default").attr("name","op").show();p?l.change(function(a){var b=a.target.selectedIndex;a=jQuery(a.target).parents("tr.sf").find("td.data");a.find("select,input").removeClass("vdata").hide();b=a.find(".field"+b);if(b[0]==null)b=a.find(".default");b.show().addClass("vdata")}):o.find(".default").show().addClass("vdata");if(z||p)l.change();e.find(".ui-state-default").hover(C,C).mousedown(D).mouseup(D);e.find(".ui-closer").click(function(){f.onClose(jQuery(e.selector));  
return false});e.find(".ui-del").click(function(a){a=jQuery(a.target).parents(".sf");if(a.siblings(".sf").length>0){f.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&a.find(".hasDatepicker").datepicker("destroy");a.remove()}else{a.find("select[name='field']")[0].selectedIndex=0;a.find("select[name='op']")[0].selectedIndex=0;a.find(".data input").val("");a.find(".data select").each(function(){this.selectedIndex=0});a.find("select[name='field']").change()}return false});e.find(".ui-add").click(function(a){a=  
jQuery(a.target).parents(".sf");var b=a.clone(true).insertAfter(a);b.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");if(f.clone){b.find("select[name='field']")[0].selectedIndex=a.find("select[name='field']")[0].selectedIndex;if(b.find("select[name='op']")[0]!=null)b.find("select[name='op']").focus()[0].selectedIndex=a.find("select[name='op']")[0].selectedIndex;var d=b.find("select.vdata");if(d[0]!=null)d[0].selectedIndex=a.find("select.vdata")[0].selectedIndex}else{b.find(".data input").val("");  
b.find("select[name='field']").focus()}f.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&a.find(".hasDatepicker").each(function(){var c=jQuery.data(this,"datepicker").settings;b.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(c)});b.find("select[name='field']").change();return false});e.find(".ui-search").click(function(){var a=jQuery(e.selector),b,d=a.find("select[name='groupOp'] :selected").val();b=f.stringResult?'{"groupOp":"'+d+'","rules":[':{groupOp:d,  
rules:[]};a.find(".sf").each(function(c){var g=jQuery(this).find("select[name='field'] :selected").val(),i=jQuery(this).find("select[name='op'] :selected").val(),h=jQuery(this).find("input.vdata,select.vdata :selected").val();h+="";h=h.replace(/\\/g,"\\\\").replace(/\"/g,'\\"');if(f.stringResult){if(c>0)b+=",";b+='{"field":"'+g+'",';b+='"op":"'+i+'",';b+='"data":"'+h+'"}'}else b.rules.push({field:g,op:i,data:h})});if(f.stringResult)b+="]}";f.onSearch(b);return false});e.find(".ui-reset").click(function(){var a=  
jQuery(e.selector);a.find(".ui-del").click();a.find("select[name='groupOp']")[0].selectedIndex=0;f.onReset();return false});e.find(".ui-add-last").click(function(){var a=jQuery(e.selector+" .sf:last"),b=a.clone(true).insertAfter(a);b.find(".ui-state-default").removeClass("ui-state-hover ui-state-active");b.find(".data input").val("");b.find("select[name='field']").focus();f.datepickerFix===true&&jQuery.fn.datepicker!==undefined&&a.find(".hasDatepicker").each(function(){var d=jQuery.data(this,"datepicker").settings;  
b.find("#"+this.id).unbind().removeAttr("id").removeClass("hasDatepicker").datepicker(d)});b.find("select[name='field']").change();return false});this.setGroupOp=function(a){selDOMobj=this.$.find("select[name='groupOp']")[0];var b={},d=selDOMobj.options.length,c;for(c=0;c<d;c++)b[selDOMobj.options[c].value]=c;selDOMobj.selectedIndex=b[a];$(selDOMobj).change()};this.setFilter=function(a){var b=a.sfref;a=a.filter;var d=[],c,g,i,h,j={};selDOMobj=b.find("select[name='field']")[0];c=0;for(i=selDOMobj.options.length;c<  
i;c++){j[selDOMobj.options[c].value]={index:c,ops:{}};d.push(selDOMobj.options[c].value)}c=0;for(i=d.length;c<i;c++){if(selDOMobj=b.find(".ops > select[class='field"+c+"']")[0]){g=0;for(h=selDOMobj.options.length;g<h;g++)j[d[c]].ops[selDOMobj.options[g].value]=g}if(selDOMobj=b.find(".data > select[class='field"+c+"']")[0]){j[d[c]].data={};g=0;for(h=selDOMobj.options.length;g<h;g++)j[d[c]].data[selDOMobj.options[g].value]=g}}var u,q,A,B;d=a.field;if(j[d])u=j[d].index;if(u!=null){q=j[d].ops[a.op];if(q===  
undefined){c=0;for(i=v.operators.length;c<i;c++)if(v.operators[c].op==a.op){q=c;break}}A=a.data;B=j[d].data==null?-1:j[d].data[A]}if(u!=null&&q!=null&&B!=null){b.find("select[name='field']")[0].selectedIndex=u;b.find("select[name='field']").change();b.find("select[name='op']")[0].selectedIndex=q;b.find("input.vdata").val(A);if(b=b.find("select.vdata")[0])b.selectedIndex=B;return true}else return false}}}return new I(this,k,H)};jQuery.fn.searchFilter.version="1.2.9";  
jQuery.fn.searchFilter.defaults={clone:true,datepickerFix:true,onReset:function(k){alert("Reset Clicked. Data Returned: "+k)},onSearch:function(k){alert("Search Clicked. Data Returned: "+k)},onClose:function(k){k.hide()},groupOps:[{op:"AND",text:"all"},{op:"OR",text:"any"}],operators:[{op:"eq",text:"is equal to"},{op:"ne",text:"is not equal to"},{op:"lt",text:"is less than"},{op:"le",text:"is less or equal to"},{op:"gt",text:"is greater than"},{op:"ge",text:"is greater or equal to"},{op:"in",text:"is in"},  
{op:"ni",text:"is not in"},{op:"bw",text:"begins with"},{op:"bn",text:"does not begin with"},{op:"ew",text:"ends with"},{op:"en",text:"does not end with"},{op:"cn",text:"contains"},{op:"nc",text:"does not contain"}],matchText:"match",rulesText:"rules",resetText:"Reset",searchText:"Search",stringResult:true,windowTitle:"Search Rules",ajaxSelectOptions:{}};  
(function(a){a.jgrid.extend({editRow:function(d,t,i,n,o,u,s,c,f){return this.each(function(){var b=this,k,l,r=0,p=null,q={},h,g;if(b.grid){h=a(b).jqGrid("getInd",d,true);if(h!==false)if((a(h).attr("editable")||"0")=="0"&&!a(h).hasClass("not-editable-row")){g=b.p.colModel;a("td",h).each(function(j){k=g[j].name;var v=b.p.treeGrid===true&&k==b.p.ExpandColumn;if(v)l=a("span:first",this).html();else try{l=a.unformat(this,{rowId:d,colModel:g[j]},j)}catch(m){l=a(this).html()}if(k!="cb"&&k!="subgrid"&&k!=  
"rn"){if(b.p.autoencode)l=a.jgrid.htmlDecode(l);q[k]=l;if(g[j].editable===true){if(p===null)p=j;v?a("span:first",this).html(""):a(this).html("");var e=a.extend({},g[j].editoptions||{},{id:d+"_"+k,name:k});if(!g[j].edittype)g[j].edittype="text";e=createEl(g[j].edittype,e,l,true,a.extend({},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));a(e).addClass("editable");v?a("span:first",this).append(e):a(this).append(e);g[j].edittype=="select"&&g[j].editoptions.multiple===true&&a.browser.msie&&a(e).width(a(e).width());  
r++}}});if(r>0){q.id=d;b.p.savedRow.push(q);a(h).attr("editable","1");a("td:eq("+p+") input",h).focus();t===true&&a(h).bind("keydown",function(j){j.keyCode===27&&a(b).jqGrid("restoreRow",d,f);if(j.keyCode===13){if(j.target.tagName=="TEXTAREA")return true;a(b).jqGrid("saveRow",d,n,o,u,s,c,f);return false}j.stopPropagation()});a.isFunction(i)&&i(d)}}}})},saveRow:function(d,t,i,n,o,u,s){return this.each(function(){var c=this,f,b={},k={},l,r,p,q;if(c.grid){q=a(c).jqGrid("getInd",d,true);if(q!==false){l=  
a(q).attr("editable");i=i?i:c.p.editurl;if(l==="1"){var h;a("td",q).each(function(m){h=c.p.colModel[m];f=h.name;if(f!="cb"&&f!="subgrid"&&h.editable===true&&f!="rn"){switch(h.edittype){case "checkbox":var e=["Yes","No"];if(h.editoptions)e=h.editoptions.value.split(":");b[f]=a("input",this).attr("checked")?e[0]:e[1];break;case "text":case "password":case "textarea":case "button":b[f]=a("input, textarea",this).val();break;case "select":if(h.editoptions.multiple){e=a("select",this);var x=[];b[f]=a(e).val();  
b[f]=b[f]?b[f].join(","):"";a("select > option:selected",this).each(function(y,z){x[y]=a(z).text()});k[f]=x.join(",")}else{b[f]=a("select>option:selected",this).val();k[f]=a("select>option:selected",this).text()}if(h.formatter&&h.formatter=="select")k={};break;case "custom":try{if(h.editoptions&&a.isFunction(h.editoptions.custom_value)){b[f]=h.editoptions.custom_value(a(".customelement",this),"get");if(b[f]===undefined)throw"e2";}else throw"e1";}catch(w){w=="e1"&&info_dialog(jQuery.jgrid.errors.errcap,  
"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);w=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,w.message,jQuery.jgrid.edit.bClose)}break}p=checkValues(b[f],m,c);if(p[0]===false){p[1]=b[f]+" "+p[1];return false}if(c.p.autoencode)b[f]=a.jgrid.htmlEncode(b[f])}});if(p[0]===false)try{var g=findPos(a("#"+d)[0]);info_dialog(a.jgrid.errors.errcap,p[1],a.jgrid.edit.bClose,  
{left:g[0],top:g[1]})}catch(j){alert(p[1])}else{if(b){var v;g=c.p.prmNames;v=g.oper;l=g.id;b[v]=g.editoper;b[l]=d;if(typeof c.p.inlineData=="undefined")c.p.inlineData={};if(typeof n=="undefined")n={};b=a.extend({},b,c.p.inlineData,n)}if(i=="clientArray"){b=a.extend({},b,k);c.p.autoencode&&a.each(b,function(m,e){b[m]=a.jgrid.htmlDecode(e)});l=a(c).jqGrid("setRowData",d,b);a(q).attr("editable","0");for(g=0;g<c.p.savedRow.length;g++)if(c.p.savedRow[g].id==d){r=g;break}r>=0&&c.p.savedRow.splice(r,1);  
a.isFunction(o)&&o(d,l)}else{a("#lui_"+c.p.id).show();a.ajax(a.extend({url:i,data:a.isFunction(c.p.serializeRowData)?c.p.serializeRowData(b):b,type:"POST",complete:function(m,e){a("#lui_"+c.p.id).hide();if(e==="success")if((a.isFunction(t)?t(m):true)===true){c.p.autoencode&&a.each(b,function(x,w){b[x]=a.jgrid.htmlDecode(w)});b=a.extend({},b,k);a(c).jqGrid("setRowData",d,b);a(q).attr("editable","0");for(e=0;e<c.p.savedRow.length;e++)if(c.p.savedRow[e].id==d){r=e;break}r>=0&&c.p.savedRow.splice(r,1);  
a.isFunction(o)&&o(d,m)}else a(c).jqGrid("restoreRow",d,s)},error:function(m,e){a("#lui_"+c.p.id).hide();a.isFunction(u)?u(d,m,e):alert("Error Row: "+d+" Result: "+m.status+":"+m.statusText+" Status: "+e)}},a.jgrid.ajaxOptions,c.p.ajaxRowOptions||{}))}a(q).unbind("keydown")}}}}})},restoreRow:function(d,t){return this.each(function(){var i=this,n,o,u={};if(i.grid){o=a(i).jqGrid("getInd",d,true);if(o!==false){for(var s=0;s<i.p.savedRow.length;s++)if(i.p.savedRow[s].id==d){n=s;break}if(n>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",  
"#"+o.id).datepicker("hide")}catch(c){}a.each(i.p.colModel,function(){if(this.editable===true&&this.name in i.p.savedRow[n])u[this.name]=i.p.savedRow[n][this.name]});a(i).jqGrid("setRowData",d,u);a(o).attr("editable","0").unbind("keydown");i.p.savedRow.splice(n,1)}a.isFunction(t)&&t(d)}}})}})})(jQuery);  
(function(b){b.jgrid.extend({editCell:function(d,e,a){return this.each(function(){var c=this,h,f,g;if(!(!c.grid||c.p.cellEdit!==true)){e=parseInt(e,10);c.p.selrow=c.rows[d].id;c.p.knv||b(c).jqGrid("GridNav");if(c.p.savedRow.length>0){if(a===true)if(d==c.p.iRow&&e==c.p.iCol)return;b(c).jqGrid("saveCell",c.p.savedRow[0].id,c.p.savedRow[0].ic)}else window.setTimeout(function(){b("#"+c.p.knv).attr("tabindex","-1").focus()},0);h=c.p.colModel[e].name;if(!(h=="subgrid"||h=="cb"||h=="rn")){g=b("td:eq("+e+  
")",c.rows[d]);if(c.p.colModel[e].editable===true&&a===true&&!g.hasClass("not-editable-cell")){if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}b(g).addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");try{f=b.unformat(g,{rowId:c.rows[d].id,colModel:c.p.colModel[e]},e)}catch(k){f=b(g).html()}if(c.p.autoencode)f=  
b.jgrid.htmlDecode(f);if(!c.p.colModel[e].edittype)c.p.colModel[e].edittype="text";c.p.savedRow.push({id:d,ic:e,name:h,v:f});if(b.isFunction(c.p.formatCell)){var j=c.p.formatCell(c.rows[d].id,h,f,d,e);if(j!==undefined)f=j}j=b.extend({},c.p.colModel[e].editoptions||{},{id:d+"_"+h,name:h});var i=createEl(c.p.colModel[e].edittype,j,f,true,b.extend({},b.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));b.isFunction(c.p.beforeEditCell)&&c.p.beforeEditCell(c.rows[d].id,h,f,d,e);b(g).html("").append(i).attr("tabindex",  
"0");window.setTimeout(function(){b(i).focus()},0);b("input, select, textarea",g).bind("keydown",function(l){if(l.keyCode===27)if(b("input.hasDatepicker",g).length>0)b(".ui-datepicker").is(":hidden")?b(c).jqGrid("restoreCell",d,e):b("input.hasDatepicker",g).datepicker("hide");else b(c).jqGrid("restoreCell",d,e);l.keyCode===13&&b(c).jqGrid("saveCell",d,e);if(l.keyCode==9)if(c.grid.hDiv.loading)return false;else l.shiftKey?b(c).jqGrid("prevCell",d,e):b(c).jqGrid("nextCell",d,e);l.stopPropagation()});  
b.isFunction(c.p.afterEditCell)&&c.p.afterEditCell(c.rows[d].id,h,f,d,e)}else{if(parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0){b("td:eq("+c.p.iCol+")",c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight");b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")}g.addClass("edit-cell ui-state-highlight");b(c.rows[d]).addClass("selected-row ui-state-hover");if(b.isFunction(c.p.onSelectCell)){f=g.html().replace(/\&#160\;/ig,"");c.p.onSelectCell(c.rows[d].id,h,f,d,e)}}c.p.iCol=e;c.p.iRow=  
d}}})},saveCell:function(d,e){return this.each(function(){var a=this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+e+")",a.rows[d]),f,g,k=a.p.colModel[e],j=k.name,i=b.jgrid.jqID(j);switch(k.edittype){case "select":if(k.editoptions.multiple){i=b("#"+d+"_"+i,a.rows[d]);var l=[];if(f=b(i).val())f.join(",");else f="";b("option:selected",i).each(function(m,p){l[m]=b(p).text()});g=l.join(",")}else{f=b("#"+d+"_"+i+">option:selected",a.rows[d]).val();  
g=b("#"+d+"_"+i+">option:selected",a.rows[d]).text()}if(k.formatter)g=f;break;case "checkbox":var n=["Yes","No"];if(k.editoptions)n=k.editoptions.value.split(":");g=f=b("#"+d+"_"+i,a.rows[d]).attr("checked")?n[0]:n[1];break;case "password":case "text":case "textarea":case "button":g=f=b("#"+d+"_"+i,a.rows[d]).val();break;case "custom":try{if(k.editoptions&&b.isFunction(k.editoptions.custom_value)){f=k.editoptions.custom_value(b(".customelement",h),"get");if(f===undefined)throw"e2";else g=f}else throw"e1";  
}catch(q){q=="e1"&&info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);q=="e2"?info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+b.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):info_dialog(jQuery.jgrid.errors.errcap,q.message,jQuery.jgrid.edit.bClose)}break}if(g!=a.p.savedRow[c].v){if(b.isFunction(a.p.beforeSaveCell))if(c=a.p.beforeSaveCell(a.rows[d].id,j,f,d,e))f=c;var r=checkValues(f,e,a);if(r[0]===true){c={};  
if(b.isFunction(a.p.beforeSubmitCell))(c=a.p.beforeSubmitCell(a.rows[d].id,j,f,d,e))||(c={});b("input.hasDatepicker",h).length>0&&b("input.hasDatepicker",h).datepicker("hide");if(a.p.cellsubmit=="remote")if(a.p.cellurl){var o={};if(a.p.autoencode)f=b.jgrid.htmlEncode(f);o[j]=f;n=a.p.prmNames;k=n.id;i=n.oper;o[k]=a.rows[d].id;o[i]=n.editoper;o=b.extend(c,o);b("#lui_"+a.p.id).show();a.grid.hDiv.loading=true;b.ajax(b.extend({url:a.p.cellurl,data:b.isFunction(a.p.serializeCellData)?a.p.serializeCellData(o):  
o,type:"POST",complete:function(m,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;if(p=="success")if(b.isFunction(a.p.afterSubmitCell)){m=a.p.afterSubmitCell(m,o.id,j,f,d,e);if(m[0]===true){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,e,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell(a.rows[d].id,j,f,d,e);a.p.savedRow.splice(0,1)}else{info_dialog(b.jgrid.errors.errcap,m[1],b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",  
d,e)}}else{b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,e,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell(a.rows[d].id,j,f,d,e);a.p.savedRow.splice(0,1)}},error:function(m,p){b("#lui_"+a.p.id).hide();a.grid.hDiv.loading=false;b.isFunction(a.p.errorCell)?a.p.errorCell(m,p):info_dialog(b.jgrid.errors.errcap,m.status+" : "+m.statusText+"<br/>"+p,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,e)}},b.jgrid.ajaxOptions,  
a.p.ajaxCellOptions||{}))}else try{info_dialog(b.jgrid.errors.errcap,b.jgrid.errors.nourl,b.jgrid.edit.bClose);b(a).jqGrid("restoreCell",d,e)}catch(s){}if(a.p.cellsubmit=="clientArray"){b(h).empty();b(a).jqGrid("setCell",a.rows[d].id,e,g,false,false,true);b(h).addClass("dirty-cell");b(a.rows[d]).addClass("edited");b.isFunction(a.p.afterSaveCell)&&a.p.afterSaveCell(a.rows[d].id,j,f,d,e);a.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){info_dialog(b.jgrid.errors.errcap,f+" "+r[1],b.jgrid.edit.bClose)},  
100);b(a).jqGrid("restoreCell",d,e)}catch(t){}}else b(a).jqGrid("restoreCell",d,e)}b.browser.opera?b("#"+a.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(d,e){return this.each(function(){var a=this,c;if(!(!a.grid||a.p.cellEdit!==true)){c=a.p.savedRow.length>=1?0:null;if(c!==null){var h=b("td:eq("+e+")",a.rows[d]);if(b.isFunction(b.fn.datepicker))try{b("input.hasDatepicker",h).datepicker("hide")}catch(f){}b(h).empty().attr("tabindex",  
"-1");b(a).jqGrid("setCell",a.rows[d].id,e,a.p.savedRow[c].v,false,false,true);a.p.savedRow.splice(0,1)}window.setTimeout(function(){b("#"+a.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(d,e){return this.each(function(){var a=this,c=false;if(!(!a.grid||a.p.cellEdit!==true)){for(var h=e+1;h<a.p.colModel.length;h++)if(a.p.colModel[h].editable===true){c=h;break}if(c!==false)b(a).jqGrid("editCell",d,c,true);else a.p.savedRow.length>0&&b(a).jqGrid("saveCell",d,e)}})},prevCell:function(d,  
e){return this.each(function(){var a=this,c=false;if(!(!a.grid||a.p.cellEdit!==true)){for(var h=e-1;h>=0;h--)if(a.p.colModel[h].editable===true){c=h;break}if(c!==false)b(a).jqGrid("editCell",d,c,true);else a.p.savedRow.length>0&&b(a).jqGrid("saveCell",d,e)}})},GridNav:function(){return this.each(function(){function d(g,k,j){if(j.substr(0,1)=="v"){var i=b(a.grid.bDiv)[0].clientHeight,l=b(a.grid.bDiv)[0].scrollTop,n=a.rows[g].offsetTop+a.rows[g].clientHeight,q=a.rows[g].offsetTop;if(j=="vd")if(n>=i)b(a.grid.bDiv)[0].scrollTop=  
b(a.grid.bDiv)[0].scrollTop+a.rows[g].clientHeight;if(j=="vu")if(q<l)b(a.grid.bDiv)[0].scrollTop=b(a.grid.bDiv)[0].scrollTop-a.rows[g].clientHeight}if(j=="h"){j=b(a.grid.bDiv)[0].clientWidth;i=b(a.grid.bDiv)[0].scrollLeft;l=a.rows[g].cells[k].offsetLeft;if(a.rows[g].cells[k].offsetLeft+a.rows[g].cells[k].clientWidth>=j+parseInt(i,10))b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft+a.rows[g].cells[k].clientWidth;else if(l<i)b(a.grid.bDiv)[0].scrollLeft=b(a.grid.bDiv)[0].scrollLeft-a.rows[g].cells[k].clientWidth}}  
function e(g,k){var j,i;if(k=="lft"){j=g+1;for(i=g;i>=0;i--)if(a.p.colModel[i].hidden!==true){j=i;break}}if(k=="rgt"){j=g-1;for(i=g;i<a.p.colModel.length;i++)if(a.p.colModel[i].hidden!==true){j=i;break}}return j}var a=this;if(!(!a.grid||a.p.cellEdit!==true)){a.p.knv=a.p.id+"_kn";var c=b("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+a.p.knv+"'></span></span>"),h,f;b(c).insertBefore(a.grid.cDiv);  
b("#"+a.p.knv).focus().keydown(function(g){f=g.keyCode;if(a.p.direction=="rtl")if(f==37)f=39;else if(f==39)f=37;switch(f){case 38:if(a.p.iRow-1>=0){d(a.p.iRow-1,a.p.iCol,"vu");b(a).jqGrid("editCell",a.p.iRow-1,a.p.iCol,false)}break;case 40:if(a.p.iRow+1<=a.rows.length-1){d(a.p.iRow+1,a.p.iCol,"vd");b(a).jqGrid("editCell",a.p.iRow+1,a.p.iCol,false)}break;case 37:if(a.p.iCol-1>=0){h=e(a.p.iCol-1,"lft");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 39:if(a.p.iCol+1<=a.p.colModel.length-  
1){h=e(a.p.iCol+1,"rgt");d(a.p.iRow,h,"h");b(a).jqGrid("editCell",a.p.iRow,h,false)}break;case 13:parseInt(a.p.iCol,10)>=0&&parseInt(a.p.iRow,10)>=0&&b(a).jqGrid("editCell",a.p.iRow,a.p.iCol,true);break}return false})}})},getChangedCells:function(d){var e=[];d||(d="all");this.each(function(){var a=this,c;!a.grid||a.p.cellEdit!==true||b(a.rows).each(function(h){var f={};if(b(this).hasClass("edited")){b("td",this).each(function(g){c=a.p.colModel[g].name;if(c!=="cb"&&c!=="subgrid")if(d=="dirty"){if(b(this).hasClass("dirty-cell"))try{f[c]=  
b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(k){f[c]=b.jgrid.htmlDecode(b(this).html())}}else try{f[c]=b.unformat(this,{rowId:a.rows[h].id,colModel:a.p.colModel[g]},g)}catch(j){f[c]=b.jgrid.htmlDecode(b(this).html())}});f.id=this.id;e.push(f)}})});return e}})})(jQuery);  
(function(b){b.fn.jqm=function(a){var f={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:e,ajaxText:"",target:e,modal:e,toTop:e,onShow:e,onHide:e,onLoad:e};return this.each(function(){if(this._jqm)return i[this._jqm].c=b.extend({},i[this._jqm].c,a);l++;this._jqm=l;i[l]={c:b.extend(f,b.jqm.params,a),a:e,w:b(this).addClass("jqmID"+l),s:l};f.trigger&&b(this).jqmAddTrigger(f.trigger)})};b.fn.jqmAddClose=function(a){return o(this,a,"jqmHide")};b.fn.jqmAddTrigger=  
function(a){return o(this,a,"jqmShow")};b.fn.jqmShow=function(a){return this.each(function(){b.jqm.open(this._jqm,a)})};b.fn.jqmHide=function(a){return this.each(function(){b.jqm.close(this._jqm,a)})};b.jqm={hash:{},open:function(a,f){var c=i[a],d=c.c,h="."+d.closeClass,g=parseInt(c.w.css("z-index"));g=g>0?g:3E3;var j=b("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":g-1,opacity:d.overlay/100});if(c.a)return e;c.t=f;c.a=true;c.w.css("z-index",g);if(d.modal){k[0]||  
setTimeout(function(){p("bind")},1);k.push(a)}else if(d.overlay>0)d.closeoverlay&&c.w.jqmAddClose(j);else j=e;c.o=j?j.addClass(d.overlayClass).prependTo("body"):e;if(q){b("html,body").css({height:"100%",width:"100%"});if(j){j=j.css({position:"absolute"})[0];for(var m in{Top:1,Left:1})j.style.setExpression(m.toLowerCase(),"(_=(document.documentElement.scroll"+m+" || document.body.scroll"+m+"))+'px'")}}if(d.ajax){a=d.target||c.w;g=d.ajax;a=typeof a=="string"?b(a,c.w):b(a);g=g.substr(0,1)=="@"?b(f).attr(g.substring(1)):  
g;a.html(d.ajaxText).load(g,function(){d.onLoad&&d.onLoad.call(this,c);h&&c.w.jqmAddClose(b(h,c.w));r(c)})}else h&&c.w.jqmAddClose(b(h,c.w));d.toTop&&c.o&&c.w.before('<span id="jqmP'+c.w[0]._jqm+'"></span>').insertAfter(c.o);d.onShow?d.onShow(c):c.w.show();r(c);return e},close:function(a){a=i[a];if(!a.a)return e;a.a=e;if(k[0]){k.pop();k[0]||p("unbind")}a.c.toTop&&a.o&&b("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else{a.w.hide();a.o&&a.o.remove()}return e},params:{}};var l=  
0,i=b.jqm.hash,k=[],q=b.browser.msie&&b.browser.version=="6.0",e=false,r=function(a){var f=b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(q)if(a.o)a.o.html('<p style="width:100%;height:100%"/>').prepend(f);else b("iframe.jqm",a.w)[0]||a.w.prepend(f);s(a)},s=function(a){try{b(":input:visible",a.w)[0].focus()}catch(f){}},p=function(a){b(document)[a]("keypress",n)[a]("keydown",n)[a]("mousedown",n)},n=function(a){var f=i[k[k.length-1]];(a=!b(a.target).parents(".jqmID"+  
f.s)[0])&&s(f);return!a},o=function(a,f,c){return a.each(function(){var d=this._jqm;b(f).each(function(){if(!this[c]){this[c]=[];b(this).click(function(){for(var h in{jqmShow:1,jqmHide:1})for(var g in this[h])i[this[h][g]]&&i[this[h][g]].w[h](this);return e})}this[c].push(d)})})}})(jQuery);  
(function(b){b.fn.jqDrag=function(a){return l(this,a,"d")};b.fn.jqResize=function(a,e){return l(this,a,"r",e)};b.jqDnR={dnr:{},e:0,drag:function(a){if(c.k=="d")d.css({left:c.X+a.pageX-c.pX,top:c.Y+a.pageY-c.pY});else{d.css({width:Math.max(a.pageX-c.pX+c.W,0),height:Math.max(a.pageY-c.pY+c.H,0)});M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)})}return false},stop:function(){b(document).unbind("mousemove",i.drag).unbind("mouseup",i.stop)}};var i=b.jqDnR,c=i.dnr,  
d=i.e,f,l=function(a,e,n,m){return a.each(function(){e=e?b(e,a):a;e.bind("mousedown",{e:a,k:n},function(g){var j=g.data,h={};d=j.e;f=m?b(m):false;if(d.css("position")!="relative")try{d.position(h)}catch(o){}c={X:h.left||k("left")||0,Y:h.top||k("top")||0,W:k("width")||d[0].scrollWidth||0,H:k("height")||d[0].scrollHeight||0,pX:g.pageX,pY:g.pageY,k:j.k};M1=f&&j.k!="d"?{X:h.left||f1("left")||0,Y:h.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:g.pageX,pY:g.pageY,  
k:j.k}:false;b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);return false})})},k=function(a){return parseInt(d.css(a))||false};f1=function(a){return parseInt(f.css(a))||false}})(jQuery);  
(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var e=this;e.p.colNames.unshift("");e.p.colModel.unshift({name:"subgrid",width:a.browser.safari?e.p.subGridWidth+e.p.cellLayout:e.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false,fixed:true});e=e.p.subGridModel;if(e[0]){e[0].align=a.extend([],e[0].align||[]);for(var c=0;c<e[0].name.length;c++)e[0].align[c]=e[0].align[c]||"left"}})},addSubGridCell:function(e,c){var b="",n,k;this.each(function(){b=  
this.formatCol(e,c);n=this.p.gridview;k=this.p.id});return n===false?'<td role="grid" aria-describedby="'+k+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+b+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>":'<td role="grid" aria-describedby="'+k+'_subgrid" '+b+"></td>"},addSubGrid:function(e,c){return this.each(function(){var b=this;if(b.grid){var n,k,p,t,s,u,o;a("td:eq("+c+")",e).click(function(){if(a(this).hasClass("sgcollapsed")){p=b.p.id;n=a(this).parent();  
t=c>=1?"<td colspan='"+c+"'>&#160;</td>":"";k=a(n).attr("id");o=true;if(a.isFunction(b.p.subGridBeforeExpand))o=b.p.subGridBeforeExpand(p+"_"+k,k);if(o===false)return false;s=0;a.each(b.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")s++});u="<tr role='row' class='ui-subgrid'>"+t+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(b.p.colNames.length-1-s,10)+"' class='ui-widget-content subgrid-data'><div id="+  
p+"_"+k+" class='tablediv'>";a(this).parent().after(u+"</div></td></tr>");a.isFunction(b.p.subGridRowExpanded)?b.p.subGridRowExpanded(p+"_"+k,k):x(n);a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded")}else if(a(this).hasClass("sgexpanded")){o=true;if(a.isFunction(b.p.subGridRowColapsed)){n=a(this).parent();k=a(n).attr("id");o=b.p.subGridRowColapsed(p+"_"+k,k)}if(o===false)return false;a(this).parent().next().remove(".ui-subgrid");  
a(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return false});var x=function(g){var j,f,d,h;j=a(g).attr("id");f={nd_:(new Date).getTime()};f[b.p.prmNames.subgridid]=j;if(!b.p.subGridModel[0])return false;if(b.p.subGridModel[0].params)for(h=0;h<b.p.subGridModel[0].params.length;h++)for(d=0;d<b.p.colModel.length;d++)if(b.p.colModel[d].name==b.p.subGridModel[0].params[h])f[b.p.colModel[d].name]=a("td:eq("+  
d+")",g).text().replace(/\&#160\;/ig,"");if(!b.grid.hDiv.loading){b.grid.hDiv.loading=true;a("#load_"+b.p.id).show();if(!b.p.subgridtype)b.p.subgridtype=b.p.datatype;if(a.isFunction(b.p.subgridtype))b.p.subgridtype(f);else b.p.subgridtype=b.p.subgridtype.toLowerCase();switch(b.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:b.p.mtype,url:b.p.subGridUrl,dataType:b.p.subgridtype,data:a.isFunction(b.p.serializeSubGridData)?b.p.serializeSubGridData(f):f,complete:function(i){b.p.subgridtype==  
"xml"?v(i.responseXML,j):w(a.jgrid.parse(i.responseText),j)}},a.jgrid.ajaxOptions,b.p.ajaxSubgridOptions||{}));break}}return false},r=function(g,j,f){j=a("<td align='"+b.p.subGridModel[0].align[f]+"'></td>").html(j);a(g).append(j)},v=function(g,j){var f,d,h,i=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=a("<tr></tr>");for(d=0;d<b.p.subGridModel[0].name.length;d++){f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+b.p.direction+"'></th>");a(f).html(b.p.subGridModel[0].name[d]);  
a(f).width(b.p.subGridModel[0].width[d]);a(l).append(f)}a(i).append(l);if(g){h=b.p.xmlReader.subgrid;a(h.root+" "+h.row,g).each(function(){l=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(h.repeatitems===true)a(h.cell,this).each(function(q){r(l,a(this).text()||"&#160;",q)});else{var m=b.p.subGridModel[0].mapping||b.p.subGridModel[0].name;if(m)for(d=0;d<m.length;d++)r(l,a(m[d],this).text()||"&#160;",d)}a(i).append(l)})}g=a("table:first",b.grid.bDiv).attr("id")+"_";a("#"+g+j).append(i);b.grid.hDiv.loading=  
false;a("#load_"+b.p.id).hide();return false},w=function(g,j){var f,d,h,i,l=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),m=a("<tr></tr>");for(d=0;d<b.p.subGridModel[0].name.length;d++){f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+b.p.direction+"'></th>");a(f).html(b.p.subGridModel[0].name[d]);a(f).width(b.p.subGridModel[0].width[d]);a(m).append(f)}a(l).append(m);if(g){f=b.p.jsonReader.subgrid;g=g[f.root];if(typeof g!=="undefined")for(d=0;d<  
g.length;d++){h=g[d];m=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(f.repeatitems===true){if(f.cell)h=h[f.cell];for(i=0;i<h.length;i++)r(m,h[i]||"&#160;",i)}else{var q=b.p.subGridModel[0].mapping||b.p.subGridModel[0].name;if(q.length)for(i=0;i<q.length;i++)r(m,h[q[i]]||"&#160;",i)}a(l).append(m)}}d=a("table:first",b.grid.bDiv).attr("id")+"_";a("#"+d+j).append(l);b.grid.hDiv.loading=false;a("#load_"+b.p.id).hide();return false};b.subGridXml=function(g,j){v(g,j)};b.subGridJson=function(g,  
j){w(g,j)}}})},expandSubGridRow:function(e){return this.each(function(){var c=this;if(c.grid||e)if(c.p.subGrid===true)if(c=a(this).jqGrid("getInd",e,true))(c=a("td.sgcollapsed",c)[0])&&a(c).trigger("click")})},collapseSubGridRow:function(e){return this.each(function(){var c=this;if(c.grid||e)if(c.p.subGrid===true)if(c=a(this).jqGrid("getInd",e,true))(c=a("td.sgexpanded",c)[0])&&a(c).trigger("click")})},toggleSubGridRow:function(e){return this.each(function(){var c=this;if(c.grid||e)if(c.p.subGrid===  
true)if(c=a(this).jqGrid("getInd",e,true)){var b=a("td.sgcollapsed",c)[0];if(b)a(b).trigger("click");else(b=a("td.sgexpanded",c)[0])&&a(b).trigger("click")}})}})})(jQuery);  
(function(d){d.jgrid.extend({setTreeNode:function(a,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid){var e=b.p.expColInd,f=b.p.treeReader.expanded_field,j=b.p.treeReader.leaf_field,k=b.p.treeReader.level_field;c.level=a[k];if(b.p.treeGridModel=="nested"){c.lft=a[b.p.treeReader.left_field];c.rgt=a[b.p.treeReader.right_field];a[j]||(a[j]=parseInt(c.rgt,10)===parseInt(c.lft,10)+1?"true":"false")}else c.parent_id=a[b.p.treeReader.parent_id_field];var g=parseInt(c.level,10),i;if(b.p.tree_root_level===  
0){i=g+1;g=g}else{i=g;g=g-1}i="<div class='tree-wrap tree-wrap-"+b.p.direction+"' style='width:"+i*18+"px;'>";i+="<div style='"+(b.p.direction=="rtl"?"right:":"left:")+g*18+"px;' class='ui-icon ";if(a[j]=="true"||a[j]===true){i+=b.p.treeIcons.leaf+" tree-leaf'";c.isLeaf=true}else{if(a[f]=="true"||a[f]===true){i+=b.p.treeIcons.minus+" tree-minus treeclick'";c.expanded=true}else{i+=b.p.treeIcons.plus+" tree-plus treeclick'";c.expanded=false}c.isLeaf=false}i+="</div></div>";if(parseInt(a[k],10)!==parseInt(b.p.tree_root_level,  
10))d(b).jqGrid("isVisibleNode",c)||d(c).css("display","none");d("td:eq("+e+")",c).wrapInner("<span></span>").prepend(i);d(".treeclick",c).bind("click",function(h){h=d(h.target||h.srcElement,b.rows).parents("tr.jqgrow")[0].rowIndex;if(!b.rows[h].isLeaf)if(b.rows[h].expanded){d(b).jqGrid("collapseRow",b.rows[h]);d(b).jqGrid("collapseNode",b.rows[h])}else{d(b).jqGrid("expandRow",b.rows[h]);d(b).jqGrid("expandNode",b.rows[h])}return false});b.p.ExpandColClick===true&&d("span",c).css("cursor","pointer").bind("click",  
function(h){h=d(h.target||h.srcElement,b.rows).parents("tr.jqgrow")[0].rowIndex;if(!b.rows[h].isLeaf)if(b.rows[h].expanded){d(b).jqGrid("collapseRow",b.rows[h]);d(b).jqGrid("collapseNode",b.rows[h])}else{d(b).jqGrid("expandRow",b.rows[h]);d(b).jqGrid("expandNode",b.rows[h])}d(b).jqGrid("setSelection",b.rows[h].id);return false})}})},setTreeGrid:function(){return this.each(function(){var a=this,c=0;if(a.p.treeGrid){a.p.treedatatype||d.extend(a.p,{treedatatype:a.p.datatype});a.p.subGrid=false;a.p.altRows=  
false;a.p.pgbuttons=false;a.p.pginput=false;a.p.multiselect=false;a.p.rowList=[];a.p.treeIcons=d.extend({plus:"ui-icon-triangle-1-"+(a.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},a.p.treeIcons||{});if(a.p.treeGridModel=="nested")a.p.treeReader=d.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded"},a.p.treeReader);else if(a.p.treeGridModel=="adjacency")a.p.treeReader=d.extend({level_field:"level",parent_id_field:"parent",  
leaf_field:"isLeaf",expanded_field:"expanded"},a.p.treeReader);for(var b in a.p.colModel)if(a.p.colModel.hasOwnProperty(b)){if(a.p.colModel[b].name==a.p.ExpandColumn){a.p.expColInd=c;break}c++}if(!a.p.expColInd)a.p.expColInd=0;d.each(a.p.treeReader,function(e,f){if(f){a.p.colNames.push(f);a.p.colModel.push({name:f,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(a){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=  
d(c).jqGrid("getNodeChildren",a);d(b).each(function(){d(this).css("display","");this.expanded&&d(c).jqGrid("expandRow",this)})}})},collapseRow:function(a){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getNodeChildren",a);d(b).each(function(){d(this).css("display","none");this.expanded&&d(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var a=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var b=c.p.treeReader.level_field;  
d(c.rows).each(function(){parseInt(this[b],10)===parseInt(c.p.tree_root_level,10)&&a.push(this)});break;case "adjacency":d(c.rows).each(function(){if(this.parent_id===null||String(this.parent_id).toLowerCase()=="null")a.push(this)});break}});return a},getNodeDepth:function(a){var c=null;this.each(function(){var b=this;if(this.grid&&this.p.treeGrid)switch(b.p.treeGridModel){case "nested":c=parseInt(a.level,10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=d(b).jqGrid("getNodeAncestors",  
a).length;break}});return c},getNodeParent:function(a){var c=null;this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var e=parseInt(a.lft,10),f=parseInt(a.rgt,10),j=parseInt(a.level,10);d(this.rows).each(function(){if(parseInt(this.level,10)===j-1&&parseInt(this.lft,10)<e&&parseInt(this.rgt,10)>f){c=this;return false}});break;case "adjacency":d(this.rows).each(function(){if(this.id==a.parent_id){c=this;return false}});break}});return c},getNodeChildren:function(a){var c=  
[];this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var e=parseInt(a.lft,10),f=parseInt(a.rgt,10),j=parseInt(a.level,10);d(this.rows).each(function(){parseInt(this.level,10)===j+1&&parseInt(this.lft,10)>e&&parseInt(this.rgt,10)<f&&c.push(this)});break;case "adjacency":d(this.rows).each(function(){this.parent_id==a.id&&c.push(this)});break}});return c},getFullTreeNode:function(a){var c=[];this.each(function(){var b=this,e;if(b.grid&&b.p.treeGrid)switch(b.p.treeGridModel){case "nested":var f=  
parseInt(a.lft,10),j=parseInt(a.rgt,10),k=parseInt(a.level,10);d(this.rows).each(function(){parseInt(this.level,10)>=k&&parseInt(this.lft,10)>=f&&parseInt(this.lft,10)<=j&&c.push(this)});break;case "adjacency":c.push(a);d(this.rows).each(function(g){e=c.length;for(g=0;g<e;g++)if(c[g].id==this.parent_id){c.push(this);break}});break}});return c},getNodeAncestors:function(a){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=d(this).jqGrid("getNodeParent",a);b;){c.push(b);b=d(this).jqGrid("getNodeParent",  
b)}});return c},isVisibleNode:function(a){var c=true;this.each(function(){var b=this;if(b.grid&&b.p.treeGrid){b=d(b).jqGrid("getNodeAncestors",a);d(b).each(function(){c=c&&this.expanded;if(!c)return false})}});return c},isNodeLoaded:function(a){var c;this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)c=a.loaded!==undefined?a.loaded:a.isLeaf||d(b).jqGrid("getNodeChildren",a).length>0?true:false});return c},expandNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid)if(!a.expanded)if(d(this).jqGrid("isNodeLoaded",  
a)){a.expanded=true;d("div.treeclick",a).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{a.expanded=true;d("div.treeclick",a).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=a.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:a.id,n_left:a.lft,n_right:a.rgt,n_level:a.level}}):d(this).jqGrid("setGridParam",{postData:{nodeid:a.id,  
parentid:a.parent_id,n_level:a.level}});d(this).trigger("reloadGrid");this.p.treeGridModel=="nested"?d(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):d(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}})},collapseNode:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid)if(a.expanded){a.expanded=false;d("div.treeclick",a).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},  
SortTree:function(a){return this.each(function(){if(this.grid&&this.p.treeGrid){var c,b,e,f=[],j=this,k=d(this).jqGrid("getRootNodes");k.sort(function(g,i){if(g.sortKey<i.sortKey)return-a;if(g.sortKey>i.sortKey)return a;return 0});if(k[0]){d("td",k[0]).each(function(g){d(this).css("width",j.grid.headers[g].width+"px")});j.grid.cols=k[0].cells}c=0;for(b=k.length;c<b;c++){e=k[c];f.push(e);d(this).jqGrid("collectChildrenSortTree",f,e,a)}d.each(f,function(g,i){d("tbody",j.grid.bDiv).append(i);i.sortKey=  
null})}})},collectChildrenSortTree:function(a,c,b){return this.each(function(){if(this.grid&&this.p.treeGrid){var e,f,j,k=d(this).jqGrid("getNodeChildren",c);k.sort(function(g,i){if(g.sortKey<i.sortKey)return-b;if(g.sortKey>i.sortKey)return b;return 0});e=0;for(f=k.length;e<f;e++){j=k[e];a.push(j);d(this).jqGrid("collectChildrenSortTree",a,j,b)}}})},setTreeRow:function(a,c){var b=false;this.each(function(){var e=this;if(e.grid&&e.p.treeGrid)b=d(e).jqGrid("setRowData",a,c)});return b},delTreeNode:function(a){return this.each(function(){var c=  
this;if(c.grid&&c.p.treeGrid){var b=d(c).jqGrid("getInd",a,true);if(b){var e=d(c).jqGrid("getNodeChildren",b);if(e.length>0)for(var f=0;f<e.length;f++)d(c).jqGrid("delRowData",e[f].id);d(c).jqGrid("delRowData",b.id)}}})}})})(jQuery);  
(function(b){b.jgrid.extend({jqGridImport:function(a){a=b.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},a||{});return this.each(function(){var e=this,c=function(d,g){var f=b(g.xmlGrid.config,d)[0];g=b(g.xmlGrid.data,d)[0];var k;if(xmlJsonClass.xml2json&&b.jgrid.parse){f=xmlJsonClass.xml2json(f," ");f=b.jgrid.parse(f);for(var h in f)if(f.hasOwnProperty(h))k=f[h];if(g){h=f.grid.datatype;  
f.grid.datatype="xmlstring";f.grid.datastr=d;b(e).jqGrid(k).jqGrid("setGridParam",{datatype:h})}else b(e).jqGrid(k)}else alert("xml2json or parse are not present")},i=function(d,g){if(d&&typeof d=="string"){var f=b.jgrid.parse(d);d=f[g.jsonGrid.config];if(g=f[g.jsonGrid.data]){f=d.datatype;d.datatype="jsonstring";d.datastr=g;b(e).jqGrid(d).jqGrid("setGridParam",{datatype:f})}else b(e).jqGrid(d)}};switch(a.imptype){case "xml":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"xml",  
complete:function(d,g){if(g=="success"){c(d.responseXML,a);b.isFunction(a.importComplete)&&a.importComplete(d)}}},a.ajaxOptions));break;case "xmlstring":if(a.impstring&&typeof a.impstring=="string"){var j=b.jgrid.stringToDoc(a.impstring);if(j){c(j,a);b.isFunction(a.importComplete)&&a.importComplete(j);a.impstring=null}j=null}break;case "json":b.ajax(b.extend({url:a.impurl,type:a.mtype,data:a.impData,dataType:"json",complete:function(d,g){if(g=="success"){i(d.responseText,a);b.isFunction(a.importComplete)&&  
a.importComplete(d)}}},a.ajaxOptions));break;case "jsonstring":if(a.impstring&&typeof a.impstring=="string"){i(a.impstring,a);b.isFunction(a.importComplete)&&a.importComplete(a.impstring);a.impstring=null}break}})},jqGridExport:function(a){a=b.extend({exptype:"xmlstring",root:"grid",ident:"\t"},a||{});var e=null;this.each(function(){if(this.grid){var c=b.extend({},b(this).jqGrid("getGridParam"));if(c.rownumbers){c.colNames.splice(0,1);c.colModel.splice(0,1)}if(c.multiselect){c.colNames.splice(0,1);  
c.colModel.splice(0,1)}if(c.subGrid){c.colNames.splice(0,1);c.colModel.splice(0,1)}c.knv=null;if(c.treeGrid)for(var i in c.treeReader)if(c.treeReader.hasOwnProperty(i)){c.colNames.splice(c.colNames.length-1);c.colModel.splice(c.colModel.length-1)}switch(a.exptype){case "xmlstring":e="<"+a.root+">"+xmlJsonClass.json2xml(c,a.ident)+"</"+a.root+">";break;case "jsonstring":e="{"+xmlJsonClass.toJson(c,a.root,a.ident)+"}";if(c.postData.filters!==undefined){e=e.replace(/filters":"/,'filters":');e=e.replace(/}]}"/,  
"}]}")}break}}});return e},excelExport:function(a){a=b.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},a||{});return this.each(function(){$t=this;if(this.grid)if(a.exptype=="remote"){var e=b.extend({},this.p.postData);e[a.oper]=a.tag;e=jQuery.param(e);window.location=a.url+"?"+e}})}})})(jQuery);  
var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;a=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?a.replace(/\t/g,b):a.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var g=function(d,c,j){var i="",k,h;if(d instanceof Array)if(d.length===0)i+=j+"<"+c+">__EMPTY_ARRAY_</"+c+">\n";else{k=0;for(h=d.length;k<h;k+=1){var l=j+g(d[k],c,j+"\t")+"\n";i+=l}}else if(typeof d==="object"){k=false;i+=j+"<"+c;for(h in d)if(d.hasOwnProperty(h))if(h.charAt(0)===  
"@")i+=" "+h.substr(1)+'="'+d[h].toString()+'"';else k=true;i+=k?">":"/>";if(k){for(h in d)if(d.hasOwnProperty(h))if(h==="#text")i+=d[h];else if(h==="#cdata")i+="<![CDATA["+d[h]+"]]\>";else if(h.charAt(0)!=="@")i+=g(d[h],h,j+"\t");i+=(i.charAt(i.length-1)==="\n"?j:"")+"</"+c+">"}}else i+=typeof d==="function"?j+"<"+c+"><![CDATA["+d+"]]\></"+c+">":d.toString()==='""'||d.toString().length===0?j+"<"+c+">__EMPTY_STRING_</"+c+">":j+"<"+c+">"+d.toString()+"</"+c+">";return i},e="",f;for(f in a)if(a.hasOwnProperty(f))e+=  
g(a[f],f,"");return b?e.replace(/\t/g,b):e.replace(/\t|\n/g,"")},toObj:function(a){var b={},g=/function/i;if(a.nodeType===1){if(a.attributes.length){var e;for(e=0;e<a.attributes.length;e+=1)b["@"+a.attributes[e].nodeName]=(a.attributes[e].nodeValue||"").toString()}if(a.firstChild){var f=e=0,d=false,c;for(c=a.firstChild;c;c=c.nextSibling)if(c.nodeType===1)d=true;else if(c.nodeType===3&&c.nodeValue.match(/[^ \f\n\r\t\v]/))e+=1;else if(c.nodeType===4)f+=1;if(d)if(e<2&&f<2){this.removeWhite(a);for(c=  
a.firstChild;c;c=c.nextSibling)if(c.nodeType===3)b["#text"]=this.escape(c.nodeValue);else if(c.nodeType===4)if(g.test(c.nodeValue))b[c.nodeName]=[b[c.nodeName],c.nodeValue];else b["#cdata"]=this.escape(c.nodeValue);else if(b[c.nodeName])if(b[c.nodeName]instanceof Array)b[c.nodeName][b[c.nodeName].length]=this.toObj(c);else b[c.nodeName]=[b[c.nodeName],this.toObj(c)];else b[c.nodeName]=this.toObj(c)}else if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else b=this.escape(this.innerXml(a));  
else if(e)if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else{b=this.escape(this.innerXml(a));if(b==="__EMPTY_ARRAY_")b="[]";else if(b==="__EMPTY_STRING_")b=""}else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(c=a.firstChild;c;c=c.nextSibling)if(g.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(c.nodeValue)}if(!a.attributes.length&&!a.firstChild)b=null}else if(a.nodeType===9)b=this.toObj(a.documentElement);else alert("unhandled node type: "+  
a.nodeType);return b},toJson:function(a,b,g){var e=b?'"'+b+'"':"";if(a==="[]")e+=b?":[]":"[]";else if(a instanceof Array){var f,d,c=[];d=0;for(f=a.length;d<f;d+=1)c[d]=this.toJson(a[d],"",g+"\t");e+=(b?":[":"[")+(c.length>1?"\n"+g+"\t"+c.join(",\n"+g+"\t")+"\n"+g:c.join(""))+"]"}else if(a===null)e+=(b&&":")+"null";else if(typeof a==="object"){f=[];for(d in a)if(a.hasOwnProperty(d))f[f.length]=this.toJson(a[d],d,g+"\t");e+=(b?":{":"{")+(f.length>1?"\n"+g+"\t"+f.join(",\n"+g+"\t")+"\n"+g:f.join(""))+  
"}"}else if(typeof a==="string"){g=/function/i;f=a.toString();e+=/(^-?\d+\.?\d*$)/.test(f)||g.test(f)||f==="false"||f==="true"?(b&&":")+f:(b&&":")+'"'+a+'"'}else e+=(b&&":")+a.toString();return e},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var g=function(e){var f="",d;if(e.nodeType===1){f+="<"+e.nodeName;for(d=0;d<e.attributes.length;d+=1)f+=" "+e.attributes[d].nodeName+'="'+(e.attributes[d].nodeValue||"").toString()+'"';if(e.firstChild){f+=">";for(d=e.firstChild;d;d=d.nextSibling)f+=  
g(d);f+="</"+e.nodeName+">"}else f+="/>"}else if(e.nodeType===3)f+=e.nodeValue;else if(e.nodeType===4)f+="<![CDATA["+e.nodeValue+"]]\>";return f};for(a=a.firstChild;a;a=a.nextSibling)b+=g(a)}return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var g=b.nextSibling;a.removeChild(b);  
b=g}else{b.nodeType===1&&this.removeWhite(b);b=b.nextSibling}return a}};  
(function(b){b.jgrid.extend({setColumns:function(a){a=b.extend({top:0,left:0,width:200,height:"auto",dataheight:"auto",modal:false,drag:true,beforeShowForm:null,afterShowForm:null,afterSubmitForm:null,closeOnEscape:true,ShrinkToFit:false,jqModal:false,saveicon:[true,"left","ui-icon-disk"],closeicon:[true,"left","ui-icon-close"],onClose:null,colnameview:true,closeAfterSubmit:true,updateAfterCheck:false,recreateForm:false},b.jgrid.col,a||{});return this.each(function(){var c=this;if(c.grid){var j=typeof a.beforeShowForm===  
"function"?true:false,k=typeof a.afterShowForm==="function"?true:false,l=typeof a.afterSubmitForm==="function"?true:false,e=c.p.id,d="ColTbl_"+e,f={themodal:"colmod"+e,modalhead:"colhd"+e,modalcontent:"colcnt"+e,scrollelm:d};a.recreateForm===true&&b("#"+f.themodal).html()!=null&&b("#"+f.themodal).remove();if(b("#"+f.themodal).html()!=null){j&&a.beforeShowForm(b("#"+d));viewModal("#"+f.themodal,{gbox:"#gbox_"+e,jqm:a.jqModal,jqM:false,modal:a.modal})}else{var g=isNaN(a.dataheight)?a.dataheight:a.dataheight+  
"px";g="<div id='"+d+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+g+";'>";g+="<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";for(i=0;i<this.p.colNames.length;i++)c.p.colModel[i].hidedlg||(g+="<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_"+this.p.colModel[i].name+"' class='cbox' value='T' "+(this.p.colModel[i].hidden===false?"checked":"")+"/><label for='col_"+this.p.colModel[i].name+"'>"+this.p.colNames[i]+  
(a.colnameview?" ("+this.p.colModel[i].name+")":"")+"</label></td></tr>");g+="</tbody></table></div>";g+="<table border='0' class='EditTable' id='"+d+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+(!a.updateAfterCheck?"<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+a.bSubmit+"</a>":"")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+  
a.bCancel+"</a>")+"</td></tr></tbody></table>";a.gbox="#gbox_"+e;createModal(f,g,a,"#gview_"+c.p.id,b("#gview_"+c.p.id)[0]);if(a.saveicon[0]==true)b("#dData","#"+d+"_2").addClass(a.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+a.saveicon[2]+"'></span>");if(a.closeicon[0]==true)b("#eData","#"+d+"_2").addClass(a.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+a.closeicon[2]+"'></span>");a.updateAfterCheck?  
b(":input","#"+d).click(function(){var h=this.id.substr(4);if(h){this.checked?b(c).jqGrid("showCol",h):b(c).jqGrid("hideCol",h);a.ShrinkToFit===true&&b(c).jqGrid("setGridWidth",c.grid.width-0.0010,true)}return this}):b("#dData","#"+d+"_2").click(function(){for(i=0;i<c.p.colModel.length;i++)if(!c.p.colModel[i].hidedlg){var h=c.p.colModel[i].name.replace(".","\\.");if(b("#col_"+h,"#"+d).attr("checked")){b(c).jqGrid("showCol",c.p.colModel[i].name);b("#col_"+h,"#"+d).attr("defaultChecked",true)}else{b(c).jqGrid("hideCol",  
c.p.colModel[i].name);b("#col_"+h,"#"+d).attr("defaultChecked","")}}a.ShrinkToFit===true&&b(c).jqGrid("setGridWidth",c.grid.width-0.0010,true);a.closeAfterSubmit&&hideModal("#"+f.themodal,{gb:"#gbox_"+e,jqm:a.jqModal,onClose:a.onClose});l&&a.afterSubmitForm(b("#"+d));return false});b("#eData","#"+d+"_2").click(function(){hideModal("#"+f.themodal,{gb:"#gbox_"+e,jqm:a.jqModal,onClose:a.onClose});return false});b("#dData, #eData","#"+d+"_2").hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")});  
j&&a.beforeShowForm(b("#"+d));viewModal("#"+f.themodal,{gbox:"#gbox_"+e,jqm:a.jqModal,jqM:true,modal:a.modal})}k&&a.afterShowForm(b("#"+d))}})}})})(jQuery);  
(function(c){c.jgrid.extend({getPostData:function(){var a=this[0];if(a.grid)return a.p.postData},setPostData:function(a){var b=this[0];if(b.grid)if(typeof a==="object")b.p.postData=a;else alert("Error: cannot add a non-object postData value. postData unchanged.")},appendPostData:function(a){var b=this[0];if(b.grid)typeof a==="object"?c.extend(b.p.postData,a):alert("Error: cannot append a non-object postData value. postData unchanged.")},setPostDataItem:function(a,b){var d=this[0];if(d.grid)d.p.postData[a]=  
b},getPostDataItem:function(a){var b=this[0];if(b.grid)return b.p.postData[a]},removePostDataItem:function(a){var b=this[0];b.grid&&delete b.p.postData[a]},getUserData:function(){var a=this[0];if(a.grid)return a.p.userData},getUserDataItem:function(a){var b=this[0];if(b.grid)return b.p.userData[a]}})})(jQuery);  
function tableToGrid(o,p){jQuery(o).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),f=jQuery("input[type=checkbox]:first",jQuery(this)),l=jQuery("input[type=radio]:first",jQuery(this)),b=f.length>0,q=!b&&l.length>0,m=b||q;f=f.attr("name")||l.attr("name");var c=[],g=[];jQuery("th",jQuery(this)).each(function(){if(c.length===0&&m){c.push({name:"__selection__",index:"__selection__",width:0,hidden:true});g.push("__selection__")}else{c.push({name:jQuery(this).attr("id")||  
jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});g.push(jQuery(this).html())}});var e=[],h=[],i=[];jQuery("tbody > tr",jQuery(this)).each(function(){var j={},d=0;jQuery("td",jQuery(this)).each(function(){if(d===0&&m){var k=jQuery("input",jQuery(this)),n=k.attr("value");h.push(n||e.length);k.attr("checked")&&i.push(n);j[c[d].name]=  
k.attr("value")}else j[c[d].name]=jQuery(this).html();d++});d>0&&e.push(j)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid($.extend({datatype:"local",width:a,colNames:g,colModel:c,multiselect:b},p||{}));for(a=0;a<e.length;a++){b=null;if(h.length>0)if((b=h[a])&&b.replace)b=encodeURIComponent(b).replace(/[.\-%]/g,"_");if(b===null)b=a+1;jQuery(this).jqGrid("addRowData",b,e[a])}for(a=0;a<i.length;a++)jQuery(this).jqGrid("setSelection",i[a])}})};  
(function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(b){return b.offsetWidth===0||b.offsetHeight===0||b.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var q=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(b,i){b=q.call(this,b,i);if(i&&this.selectedList){var c=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(c)})}return b}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=  
function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function i(){c.p.disableClick=true}var c=this,g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(e){return a(document.createElement(e[0].nodeName)).addClass(e[0].className+  
" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(e,h){h.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10));h.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10))}},update:function(e,h){e=a(h.item).parent();e=a(">th",e);var j={};a.each(c.p.colModel,function(m){j[this.name]=m});var l=[];  
e.each(function(){var m=a(">div",this).get(0).id.replace(/^jqgh_/,"");m in j&&l.push(j[m])});a(c).jqGrid("remapColumns",l,true,true);a.isFunction(c.p.sortable.update)&&c.p.sortable.update(l);setTimeout(function(){c.p.disableClick=false},50)}};if(c.p.sortable.options)a.extend(g,c.p.sortable.options);else if(a.isFunction(c.p.sortable))c.p.sortable={update:c.p.sortable};if(g.start){var d=g.start;g.start=function(e,h){i();d.call(this,e,h)}}else g.start=i;if(c.p.sortable.exclude)g.items+=":not("+c.p.sortable.exclude+  
")";b.sortable(g).data("sortable").floating=true})},columnChooser:function(b){function i(f,k,p){if(k>=0){var o=f.slice(),r=o.splice(k,Math.max(f.length-k,k));if(k>f.length)k=f.length;o[k]=p;return o.concat(r)}}function c(f,k){if(f)if(typeof f=="string")a.fn[f]&&a.fn[f].apply(k,a.makeArray(arguments).slice(2));else a.isFunction(f)&&f.apply(k,a.makeArray(arguments).slice(2))}var g=this;if(!a("#colchooser_"+g[0].p.id).length){var d=a('<div id="colchooser_'+g[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),  
e=a("select",d);b=a.extend({width:420,height:240,classname:null,done:function(f){f&&g.jqGrid("remapColumns",f,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(f){var k={};k[f.bSubmit]=function(){f.apply_perm();f.cleanup(false)};k[f.bCancel]=function(){f.cleanup(true)};return{buttons:k,close:function(){f.cleanup(true)},modal:false,resizable:false,width:f.width+20}},apply_perm:function(){a("option",e).each(function(){this.selected?g.jqGrid("showCol",h[this.value].name):g.jqGrid("hideCol",  
h[this.value].name)});var f=[];a("option[selected]",e).each(function(){f.push(parseInt(this.value,10))});a.each(f,function(){delete l[h[parseInt(this,10)].name]});a.each(l,function(){var k=parseInt(this,10);f=i(f,k,k)});b.done&&b.done.call(g,f)},cleanup:function(f){c(b.dlog,d,"destroy");c(b.msel,e,"destroy");d.remove();f&&b.done&&b.done.call(g)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui)if(a.ui.multiselect)if(b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");  
return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&d.attr("title",b.caption);if(b.classname){d.addClass(b.classname);e.addClass(b.classname)}if(b.width){a(">div",d).css({width:b.width,margin:"0 auto"});e.css("width",b.width)}if(b.height){a(">div",d).css("height",b.height);e.css("height",b.height-10)}var h=g.jqGrid("getGridParam","colModel"),j=g.jqGrid("getGridParam","colNames"),l={},m=[];e.empty();a.each(h,function(f){l[this.name]=f;if(this.hidedlg)this.hidden||m.push(f);  
else e.append("<option value='"+f+"' "+(this.hidden?"":"selected='selected'")+">"+j[f]+"</option>")});var n=a.isFunction(b.dlog_opts)?b.dlog_opts.call(g,b):b.dlog_opts;c(b.dlog,d,n);n=a.isFunction(b.msel_opts)?b.msel_opts.call(g,b):b.msel_opts;c(b.msel,e,n)}},sortableRows:function(b){return this.each(function(){var i=this;if(i.grid)if(!i.p.treeGrid)if(a.fn.sortable){b=a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{});if(b.start&&a.isFunction(b.start)){b._start_=b.start;delete b.start}else b._start_=  
false;if(b.update&&a.isFunction(b.update)){b._update_=b.update;delete b.update}else b._update_=false;b.start=function(c,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(h){this.style.width=i.grid.cols[h].style.width});if(i.p.subGrid){var d=a(g.item).attr("id");try{a(i).jqGrid("collapseSubGridRow",d)}catch(e){}}b._start_&&b._start_.apply(this,[c,g])};b.update=function(c,g){a(g.item).css("border-width","");i.updateColumns();i.p.rownumbers===true&&a("td.jqgrid-rownum",i.rows).each(function(d){a(this).html(d+  
1)});b._update_&&b._update_.apply(this,[c,g])};a("tbody:first",i).sortable(b);a("tbody:first",i).disableSelection()}})},gridDnD:function(b){return this.each(function(){function i(){var d=a.data(c,"dnd");a("tr.jqgrow:not(.ui-draggable)",c).draggable(a.isFunction(d.drag)?d.drag.call(a(c),d):d.drag)}var c=this;if(c.grid)if(!c.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof b=="string"&&b==  
"updateDnD"&&c.p.jqgdnd===true)i();else{b=a.extend({drag:function(d){return a.extend({start:function(e,h){if(c.p.subGrid){var j=a(h.helper).attr("id");try{a(c).jqGrid("collapseSubGridRow",j)}catch(l){}}for(j=0;j<a.data(c,"dnd").connectWith.length;j++)a(a.data(c,"dnd").connectWith[j]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(c,"dnd").connectWith[j]).jqGrid("addRowData","jqg_empty_row",{});h.helper.addClass("ui-state-highlight");a("td",h.helper).each(function(m){this.style.width=c.grid.headers[m].width+  
"px"});d.onstart&&a.isFunction(d.onstart)&&d.onstart.call(a(c),e,h)},stop:function(e,h){if(h.helper.dropped){var j=a(h.helper).attr("id");a(c).jqGrid("delRowData",j)}for(j=0;j<a.data(c,"dnd").connectWith.length;j++)a(a.data(c,"dnd").connectWith[j]).jqGrid("delRowData","jqg_empty_row");d.onstop&&a.isFunction(d.onstop)&&d.onstop.call(a(c),e,h)}},d.drag_opts||{})},drop:function(d){return a.extend({accept:function(e){var h=a(e).closest("table.ui-jqgrid-btable");if(a.data(h[0],"dnd")!==undefined){e=a.data(h[0],  
"dnd").connectWith;return a.inArray("#"+this.id,e)!=-1?true:false}return e},drop:function(e,h){var j=a(h.draggable).attr("id");j=a("#"+c.id).jqGrid("getRowData",j);if(!d.dropbyname){var l=0,m={},n,f=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var k in j){if(j.hasOwnProperty(k)&&f[l]){n=f[l].name;m[n]=j[k]}l++}j=m}catch(p){}}h.helper.dropped=true;if(d.beforedrop&&a.isFunction(d.beforedrop)){n=d.beforedrop.call(this,e,h,j,a("#"+c.id),a(this));if(typeof n!="undefined"&&n!==null&&typeof n==  
"object")j=n}if(h.helper.dropped){var o;if(d.autoid)if(a.isFunction(d.autoid))o=d.autoid.call(this,j);else{o=Math.ceil(Math.random()*1E3);o=d.autoidprefix+o}a("#"+this.id).jqGrid("addRowData",o,j,d.droppos)}d.ondrop&&a.isFunction(d.ondrop)&&d.ondrop.call(this,e,h,j)}},d.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},  
dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},b||{});if(b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(d){return a.trim(d)});a.data(c,"dnd",b);c.p.reccount!="0"&&!c.p.jqgdnd&&i();c.p.jqgdnd=true;for(var g=0;g<b.connectWith.length;g++)a(b.connectWith[g]).droppable(a.isFunction(b.drop)?b.drop.call(a(c),b):b.drop)}}}})},gridResize:function(b){return this.each(function(){var i=this;if(i.grid&&a.fn.resizable){b=a.extend({},b||{});if(b.alsoResize){b._alsoResize_=  
b.alsoResize;delete b.alsoResize}else b._alsoResize_=false;if(b.stop&&a.isFunction(b.stop)){b._stop_=b.stop;delete b.stop}else b._stop_=false;b.stop=function(c,g){a(i).jqGrid("setGridParam",{height:a("#gview_"+i.p.id+" .ui-jqgrid-bdiv").height()});a(i).jqGrid("setGridWidth",g.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(i,c,g)};b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+i.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+i.p.id);delete b._alsoResize_;  
a("#gbox_"+i.p.id).resizable(b)}})}})})(jQuery);  
 
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7(1C 1w.6=="T"){1w.T=1w.T;B 6=u(a,c){7(1w==q)v 1p 6(a,c);a=a||17;7(6.1t(a))v 1p 6(17)[6.E.27?"27":"2O"](a);7(1C a=="23"){B m=/^[^<]*(<(.|\\s)+>)[^>]*$/.2Q(a);7(m)a=6.3k([m[1]]);J v 1p 6(c).2o(a)}v q.6r(a.1l==2y&&a||(a.3Y||a.I&&a!=1w&&!a.24&&a[0]!=T&&a[0].24)&&6.3M(a)||[a])};7(1C $!="T")6.2S$=$;B $=6;6.E=6.8p={3Y:"1.1.2",8q:u(){v q.I},I:0,2b:u(1T){v 1T==T?6.3M(q):q[1T]},2r:u(a){B L=6(a);L.6p=q;v L},6r:u(a){q.I=0;[].1g.14(q,a);v q},K:u(E,1E){v 6.K(q,E,1E)},2h:u(1c){B 4c=-1;q.K(u(i){7(q==1c)4c=i});v 4c},1I:u(1Y,O,C){B 1c=1Y;7(1Y.1l==3t)7(O==T)v q.I&&6[C||"1I"](q[0],1Y)||T;J{1c={};1c[1Y]=O}v q.K(u(2h){P(B H 1x 1c)6.1I(C?q.1q:q,H,6.H(q,1c[H],C,2h,H))})},1m:u(1Y,O){v q.1I(1Y,O,"30")},2L:u(e){7(1C e=="23")v q.3u().3r(17.8t(e));B t="";6.K(e||q,u(){6.K(q.2I,u(){7(q.24!=8)t+=q.24!=1?q.60:6.E.2L([q])})});v t},2K:u(){B a=6.3k(1A);v q.K(u(){B b=a[0].3l(U);q.11.2X(b,q);22(b.1b)b=b.1b;b.4C(q)})},3r:u(){v q.3j(1A,U,1,u(a){q.4C(a)})},5i:u(){v q.3j(1A,U,-1,u(a){q.2X(a,q.1b)})},5j:u(){v q.3j(1A,12,1,u(a){q.11.2X(a,q)})},5t:u(){v q.3j(1A,12,-1,u(a){q.11.2X(a,q.2e)})},4g:u(){v q.6p||6([])},2o:u(t){v q.2r(6.31(q,u(a){v 6.2o(t,a)}),t)},4Y:u(4N){v q.2r(6.31(q,u(a){B a=a.3l(4N!=T?4N:U);a.$1H=16;v a}))},1D:u(t){v q.2r(6.1t(t)&&6.2q(q,u(2z,2h){v t.14(2z,[2h])})||6.3z(t,q))},2g:u(t){v q.2r(t.1l==3t&&6.3z(t,q,U)||6.2q(q,u(a){v(t.1l==2y||t.3Y)?6.3y(a,t)<0:a!=t}))},1M:u(t){v q.2r(6.2k(q.2b(),t.1l==3t?6(t).2b():t.I!=T&&(!t.1f||t.1f=="8v")?t:[t]))},4l:u(1s){v 1s?6.1D(1s,q).r.I>0:12},1a:u(1a){v 1a==T?(q.I?q[0].O:16):q.1I("O",1a)},4U:u(1a){v 1a==T?(q.I?q[0].2t:16):q.3u().3r(1a)},3j:u(1E,1P,3Z,E){B 4Y=q.I>1;B a=6.3k(1E);7(3Z<0)a.8w();v q.K(u(){B 1c=q;7(1P&&6.1f(q,"1P")&&6.1f(a[0],"3m"))1c=q.5J("20")[0]||q.4C(17.6n("20"));6.K(a,u(){E.14(1c,[4Y?q.3l(U):q])})})}};6.1z=6.E.1z=u(){B 1O=1A[0],a=1;7(1A.I==1){1O=q;a=0}B H;22(H=1A[a++])P(B i 1x H)1O[i]=H[i];v 1O};6.1z({8x:u(){7(6.2S$)$=6.2S$;v 6},1t:u(E){v!!E&&1C E!="23"&&!E.1f&&1C E[0]=="T"&&/u/i.1n(E+"")},4B:u(D){v D.66&&D.5I&&!D.5I.64},1f:u(D,Y){v D.1f&&D.1f.3K()==Y.3K()},K:u(1c,E,1E){7(1c.I==T)P(B i 1x 1c)E.14(1c[i],1E||[i,1c[i]]);J P(B i=0,6q=1c.I;i<6q;i++)7(E.14(1c[i],1E||[i,1c[i]])===12)3O;v 1c},H:u(D,O,C,2h,H){7(6.1t(O))O=O.3n(D,[2h]);B 6s=/z-?2h|7P-?8A|1d|58|8B-?28/i;v O&&O.1l==3Q&&C=="30"&&!6s.1n(H)?O+"4S":O},19:{1M:u(D,c){6.K(c.3o(/\\s+/),u(i,Q){7(!6.19.2V(D.19,Q))D.19+=(D.19?" ":"")+Q})},2f:u(D,c){D.19=c?6.2q(D.19.3o(/\\s+/),u(Q){v!6.19.2V(c,Q)}).6t(" "):""},2V:u(t,c){t=t.19||t;c=c.1R(/([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:])/g,"\\\\$1");v t&&1p 4v("(^|\\\\s)"+c+"(\\\\s|$)").1n(t)}},4d:u(e,o,f){P(B i 1x o){e.1q["1N"+i]=e.1q[i];e.1q[i]=o[i]}f.14(e,[]);P(B i 1x o)e.1q[i]=e.1q["1N"+i]},1m:u(e,p){7(p=="28"||p=="3V"){B 1N={},46,3P,d=["7d","8C","8D","8E"];6.K(d,u(){1N["8F"+q]=0;1N["8G"+q+"8H"]=0});6.4d(e,1N,u(){7(6.1m(e,"1h")!="1Z"){46=e.8I;3P=e.8J}J{e=6(e.3l(U)).2o(":4j").5l("2Z").4g().1m({4n:"1G",45:"8K",1h:"2D",7I:"0",8M:"0"}).5z(e.11)[0];B 3d=6.1m(e.11,"45");7(3d==""||3d=="4b")e.11.1q.45="6x";46=e.6y;3P=e.6z;7(3d==""||3d=="4b")e.11.1q.45="4b";e.11.33(e)}});v p=="28"?46:3P}v 6.30(e,p)},30:u(D,H,53){B L;7(H=="1d"&&6.W.1j)v 6.1I(D.1q,"1d");7(H=="4h"||H=="2v")H=6.W.1j?"3T":"2v";7(!53&&D.1q[H])L=D.1q[H];J 7(17.44&&17.44.4W){7(H=="2v"||H=="3T")H="4h";H=H.1R(/([A-Z])/g,"-$1").4m();B Q=17.44.4W(D,16);7(Q)L=Q.55(H);J 7(H=="1h")L="1Z";J 6.4d(D,{1h:"2D"},u(){B c=17.44.4W(q,"");L=c&&c.55(H)||""})}J 7(D.51){B 56=H.1R(/\\-(\\w)/g,u(m,c){v c.3K()});L=D.51[H]||D.51[56]}v L},3k:u(a){B r=[];6.K(a,u(i,1r){7(!1r)v;7(1r.1l==3Q)1r=1r.6C();7(1C 1r=="23"){B s=6.35(1r),1V=17.6n("1V"),2i=[];B 2K=!s.18("<1u")&&[1,"<42>","</42>"]||(!s.18("<6D")||!s.18("<20")||!s.18("<6E"))&&[1,"<1P>","</1P>"]||!s.18("<3m")&&[2,"<1P><20>","</20></1P>"]||(!s.18("<6F")||!s.18("<6G"))&&[3,"<1P><20><3m>","</3m></20></1P>"]||[0,"",""];1V.2t=2K[1]+s+2K[2];22(2K[0]--)1V=1V.1b;7(6.W.1j){7(!s.18("<1P")&&s.18("<20")<0)2i=1V.1b&&1V.1b.2I;J 7(2K[1]=="<1P>"&&s.18("<20")<0)2i=1V.2I;P(B n=2i.I-1;n>=0;--n)7(6.1f(2i[n],"20")&&!2i[n].2I.I)2i[n].11.33(2i[n])}1r=[];P(B i=0,l=1V.2I.I;i<l;i++)1r.1g(1V.2I[i])}7(1r.I===0&&!6.1f(1r,"3w"))v;7(1r[0]==T||6.1f(1r,"3w"))r.1g(1r);J r=6.2k(r,1r)});v r},1I:u(D,Y,O){B 2j=6.4B(D)?{}:{"P":"6J","6L":"19","4h":6.W.1j?"3T":"2v",2v:6.W.1j?"3T":"2v",2t:"2t",19:"19",O:"O",2W:"2W",2Z:"2Z",89:"6N",2Y:"2Y"};7(Y=="1d"&&6.W.1j&&O!=T){D.58=1;v D.1D=D.1D.1R(/4i\\([^\\)]*\\)/6O,"")+(O==1?"":"4i(1d="+O*6g+")")}J 7(Y=="1d"&&6.W.1j)v D.1D?4T(D.1D.6P(/4i\\(1d=(.*)\\)/)[1])/6g:1;7(Y=="1d"&&6.W.3h&&O==1)O=0.6R;7(2j[Y]){7(O!=T)D[2j[Y]]=O;v D[2j[Y]]}J 7(O==T&&6.W.1j&&6.1f(D,"3w")&&(Y=="81"||Y=="80"))v D.6T(Y).60;J 7(D.66){7(O!=T)D.6V(Y,O);7(6.W.1j&&/5E|3e/.1n(Y)&&!6.4B(D))v D.36(Y,2);v D.36(Y)}J{Y=Y.1R(/-([a-z])/6W,u(z,b){v b.3K()});7(O!=T)D[Y]=O;v D[Y]}},35:u(t){v t.1R(/^\\s+|\\s+$/g,"")},3M:u(a){B r=[];7(a.1l!=2y)P(B i=0,2R=a.I;i<2R;i++)r.1g(a[i]);J r=a.3N(0);v r},3y:u(b,a){P(B i=0,2R=a.I;i<2R;i++)7(a[i]==b)v i;v-1},2k:u(2u,3H){B r=[].3N.3n(2u,0);P(B i=0,5b=3H.I;i<5b;i++)7(6.3y(3H[i],r)==-1)2u.1g(3H[i]);v 2u},2q:u(1U,E,4k){7(1C E=="23")E=1p 4w("a","i","v "+E);B 1i=[];P(B i=0,2z=1U.I;i<2z;i++)7(!4k&&E(1U[i],i)||4k&&!E(1U[i],i))1i.1g(1U[i]);v 1i},31:u(1U,E){7(1C E=="23")E=1p 4w("a","v "+E);B 1i=[],r=[];P(B i=0,2z=1U.I;i<2z;i++){B 1a=E(1U[i],i);7(1a!==16&&1a!=T){7(1a.1l!=2y)1a=[1a];1i=1i.6Z(1a)}}B r=1i.I?[1i[0]]:[];5f:P(B i=1,5e=1i.I;i<5e;i++){P(B j=0;j<i;j++)7(1i[i]==r[j])5F 5f;r.1g(1i[i])}v r}});1p u(){B b=7L.71.4m();6.W={2N:/5D/.1n(b),3f:/3f/.1n(b),1j:/1j/.1n(b)&&!/3f/.1n(b),3h:/3h/.1n(b)&&!/(72|5D)/.1n(b)};6.7H=!6.W.1j||17.74=="75"};6.K({5u:"a.11",4z:"6.4z(a)",76:"6.2a(a,2,\'2e\')",7D:"6.2a(a,2,\'5s\')",78:"6.2B(a.11.1b,a)",79:"6.2B(a.1b)"},u(i,n){6.E[i]=u(a){B L=6.31(q,n);7(a&&1C a=="23")L=6.3z(a,L);v q.2r(L)}});6.K({5z:"3r",7b:"5i",2X:"5j",7e:"5t"},u(i,n){6.E[i]=u(){B a=1A;v q.K(u(){P(B j=0,2R=a.I;j<2R;j++)6(a[j])[n](q)})}});6.K({5l:u(1Y){6.1I(q,1Y,"");q.7g(1Y)},7h:u(c){6.19.1M(q,c)},7i:u(c){6.19.2f(q,c)},7k:u(c){6.19[6.19.2V(q,c)?"2f":"1M"](q,c)},2f:u(a){7(!a||6.1D(a,[q]).r.I)q.11.33(q)},3u:u(){22(q.1b)q.33(q.1b)}},u(i,n){6.E[i]=u(){v q.K(n,1A)}});6.K(["5q","5n","5p","5v"],u(i,n){6.E[n]=u(1T,E){v q.1D(":"+n+"("+1T+")",E)}});6.K(["28","3V"],u(i,n){6.E[n]=u(h){v h==T?(q.I?6.1m(q[0],n):16):q.1m(n,h.1l==3t?h:h+"4S")}});6.1z({1s:{"":"m[2]==\'*\'||6.1f(a,m[2])","#":"a.36(\'2J\')==m[2]",":":{5n:"i<m[3]-0",5p:"i>m[3]-0",2a:"m[3]-0==i",5q:"m[3]-0==i",2u:"i==0",2T:"i==r.I-1",5R:"i%2==0",5S:"i%2","2a-3s":"6.2a(a.11.1b,m[3],\'2e\',a)==a","2u-3s":"6.2a(a.11.1b,1,\'2e\')==a","2T-3s":"6.2a(a.11.7n,1,\'5s\')==a","7p-3s":"6.2B(a.11.1b).I==1",5u:"a.1b",3u:"!a.1b",5v:"6.E.2L.14([a]).18(m[3])>=0",3i:\'a.C!="1G"&&6.1m(a,"1h")!="1Z"&&6.1m(a,"4n")!="1G"\',1G:\'a.C=="1G"||6.1m(a,"1h")=="1Z"||6.1m(a,"4n")=="1G"\',7v:"!a.2W",2W:"a.2W",2Z:"a.2Z",2Y:"a.2Y||6.1I(a,\'2Y\')",2L:"a.C==\'2L\'",4j:"a.C==\'4j\'",5x:"a.C==\'5x\'",4G:"a.C==\'4G\'",5y:"a.C==\'5y\'",4R:"a.C==\'4R\'",5A:"a.C==\'5A\'",5B:"a.C==\'5B\'",3x:\'a.C=="3x"||6.1f(a,"3x")\',5C:"/5C|42|7A|3x/i.1n(a.1f)"},".":"6.19.2V(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.18(m[4])","$=":"z&&z.2U(z.I - m[4].I,m[4].I)==m[4]","*=":"z&&z.18(m[4])>=0","":"z",4u:u(m){v["",m[1],m[3],m[2],m[5]]},5P:"z=a[m[3]];7(!z||/5E|3e/.1n(m[3]))z=6.1I(a,m[3]);"},"[":"6.2o(m[2],a).I"},5M:[/^\\[ *(@)([a-2m-3C-]*) *([!*$^=]*) *(\'?"?)(.*?)\\4 *\\]/i,/^(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]/,/^(:)([a-2m-3C-]*)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/i,/^([:.#]*)([a-2m-3C*-]*)/i],1Q:[/^(\\/?\\.\\.)/,"a.11",/^(>|\\/)/,"6.2B(a.1b)",/^(\\+)/,"6.2a(a,2,\'2e\')",/^(~)/,u(a){B s=6.2B(a.11.1b);v s.3N(6.3y(a,s)+1)}],3z:u(1s,1U,2g){B 1N,Q=[];22(1s&&1s!=1N){1N=1s;B f=6.1D(1s,1U,2g);1s=f.t.1R(/^\\s*,\\s*/,"");Q=2g?1U=f.r:6.2k(Q,f.r)}v Q},2o:u(t,1B){7(1C t!="23")v[t];7(1B&&!1B.24)1B=16;1B=1B||17;7(!t.18("//")){1B=1B.4H;t=t.2U(2,t.I)}J 7(!t.18("/")){1B=1B.4H;t=t.2U(1,t.I);7(t.18("/")>=1)t=t.2U(t.18("/"),t.I)}B L=[1B],2c=[],2T=16;22(t&&2T!=t){B r=[];2T=t;t=6.35(t).1R(/^\\/\\//i,"");B 3B=12;B 1J=/^[\\/>]\\s*([a-2m-9*-]+)/i;B m=1J.2Q(t);7(m){6.K(L,u(){P(B c=q.1b;c;c=c.2e)7(c.24==1&&(6.1f(c,m[1])||m[1]=="*"))r.1g(c)});L=r;t=t.1R(1J,"");7(t.18(" ")==0)5F;3B=U}J{P(B i=0;i<6.1Q.I;i+=2){B 1J=6.1Q[i];B m=1J.2Q(t);7(m){r=L=6.31(L,6.1t(6.1Q[i+1])?6.1Q[i+1]:u(a){v 40(6.1Q[i+1])});t=6.35(t.1R(1J,""));3B=U;3O}}}7(t&&!3B){7(!t.18(",")){7(L[0]==1B)L.4L();6.2k(2c,L);r=L=[1B];t=" "+t.2U(1,t.I)}J{B 34=/^([a-2m-3C-]+)(#)([a-2m-9\\\\*2S-]*)/i;B m=34.2Q(t);7(m){m=[0,m[2],m[3],m[1]]}J{34=/^([#.]?)([a-2m-9\\\\*2S-]*)/i;m=34.2Q(t)}7(m[1]=="#"&&L[L.I-1].4X){B 2l=L[L.I-1].4X(m[2]);7(6.W.1j&&2l&&2l.2J!=m[2])2l=6(\'[@2J="\'+m[2]+\'"]\',L[L.I-1])[0];L=r=2l&&(!m[3]||6.1f(2l,m[3]))?[2l]:[]}J{7(m[1]==".")B 4r=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");6.K(L,u(){B 3E=m[1]!=""||m[0]==""?"*":m[2];7(6.1f(q,"7J")&&3E=="*")3E="3g";6.2k(r,m[1]!=""&&L.I!=1?6.4x(q,[],m[1],m[2],4r):q.5J(3E))});7(m[1]=="."&&L.I==1)r=6.2q(r,u(e){v 4r.1n(e.19)});7(m[1]=="#"&&L.I==1){B 5K=r;r=[];6.K(5K,u(){7(q.36("2J")==m[2]){r=[q];v 12}})}L=r}t=t.1R(34,"")}}7(t){B 1a=6.1D(t,r);L=r=1a.r;t=6.35(1a.t)}}7(L&&L[0]==1B)L.4L();6.2k(2c,L);v 2c},1D:u(t,r,2g){22(t&&/^[a-z[({<*:.#]/i.1n(t)){B p=6.5M,m;6.K(p,u(i,1J){m=1J.2Q(t);7(m){t=t.7M(m[0].I);7(6.1s[m[1]].4u)m=6.1s[m[1]].4u(m);v 12}});7(m[1]==":"&&m[2]=="2g")r=6.1D(m[3],r,U).r;J 7(m[1]=="."){B 1J=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");r=6.2q(r,u(e){v 1J.1n(e.19||"")},2g)}J{B f=6.1s[m[1]];7(1C f!="23")f=6.1s[m[1]][m[2]];40("f = u(a,i){"+(6.1s[m[1]].5P||"")+"v "+f+"}");r=6.2q(r,f,2g)}}v{r:r,t:t}},4x:u(o,r,1Q,Y,1J){P(B s=o.1b;s;s=s.2e)7(s.24==1){B 1M=U;7(1Q==".")1M=s.19&&1J.1n(s.19);J 7(1Q=="#")1M=s.36("2J")==Y;7(1M)r.1g(s);7(1Q=="#"&&r.I)3O;7(s.1b)6.4x(s,r,1Q,Y,1J)}v r},4z:u(D){B 4A=[];B Q=D.11;22(Q&&Q!=17){4A.1g(Q);Q=Q.11}v 4A},2a:u(Q,1i,3Z,D){1i=1i||1;B 1T=0;P(;Q;Q=Q[3Z]){7(Q.24==1)1T++;7(1T==1i||1i=="5R"&&1T%2==0&&1T>1&&Q==D||1i=="5S"&&1T%2==1&&Q==D)v Q}},2B:u(n,D){B r=[];P(;n;n=n.2e){7(n.24==1&&(!D||n!=D))r.1g(n)}v r}});6.G={1M:u(S,C,1o,F){7(6.W.1j&&S.3L!=T)S=1w;7(F)1o.F=F;7(!1o.2A)1o.2A=q.2A++;7(!S.$1H)S.$1H={};B 38=S.$1H[C];7(!38){38=S.$1H[C]={};7(S["39"+C])38[0]=S["39"+C]}38[1o.2A]=1o;S["39"+C]=q.5Y;7(!q.1k[C])q.1k[C]=[];q.1k[C].1g(S)},2A:1,1k:{},2f:u(S,C,1o){7(S.$1H){B i,j,k;7(C&&C.C){1o=C.1o;C=C.C}7(C&&S.$1H[C])7(1o)5U S.$1H[C][1o.2A];J P(i 1x S.$1H[C])5U S.$1H[C][i];J P(j 1x S.$1H)q.2f(S,j);P(k 1x S.$1H[C])7(k){k=U;3O}7(!k)S["39"+C]=16}},1S:u(C,F,S){F=6.3M(F||[]);7(!S)6.K(q.1k[C]||[],u(){6.G.1S(C,F,q)});J{B 1o=S["39"+C],1a,E=6.1t(S[C]);7(1o){F.61(q.2j({C:C,1O:S}));7((1a=1o.14(S,F))!==12)q.4F=U}7(E&&1a!==12)S[C]();q.4F=12}},5Y:u(G){7(1C 6=="T"||6.G.4F)v;G=6.G.2j(G||1w.G||{});B 3R;B c=q.$1H[G.C];B 1E=[].3N.3n(1A,1);1E.61(G);P(B j 1x c){1E[0].1o=c[j];1E[0].F=c[j].F;7(c[j].14(q,1E)===12){G.2n();G.2H();3R=12}}7(6.W.1j)G.1O=G.2n=G.2H=G.1o=G.F=16;v 3R},2j:u(G){7(!G.1O&&G.63)G.1O=G.63;7(G.65==T&&G.67!=T){B e=17.4H,b=17.64;G.65=G.67+(e.68||b.68);G.7Y=G.7Z+(e.6c||b.6c)}7(6.W.2N&&G.1O.24==3){B 3a=G;G=6.1z({},3a);G.1O=3a.1O.11;G.2n=u(){v 3a.2n()};G.2H=u(){v 3a.2H()}}7(!G.2n)G.2n=u(){q.3R=12};7(!G.2H)G.2H=u(){q.82=U};v G}};6.E.1z({3U:u(C,F,E){v q.K(u(){6.G.1M(q,C,E||F,F)})},6u:u(C,F,E){v q.K(u(){6.G.1M(q,C,u(G){6(q).6f(G);v(E||F).14(q,1A)},F)})},6f:u(C,E){v q.K(u(){6.G.2f(q,C,E)})},1S:u(C,F){v q.K(u(){6.G.1S(C,F,q)})},3X:u(){B a=1A;v q.6j(u(e){q.4M=q.4M==0?1:0;e.2n();v a[q.4M].14(q,[e])||12})},83:u(f,g){u 4O(e){B p=(e.C=="41"?e.84:e.85)||e.86;22(p&&p!=q)2G{p=p.11}2w(e){p=q};7(p==q)v 12;v(e.C=="41"?f:g).14(q,[e])}v q.41(4O).6k(4O)},27:u(f){7(6.3W)f.14(17,[6]);J{6.3c.1g(u(){v f.14(q,[6])})}v q}});6.1z({3W:12,3c:[],27:u(){7(!6.3W){6.3W=U;7(6.3c){6.K(6.3c,u(){q.14(17)});6.3c=16}7(6.W.3h||6.W.3f)17.87("6o",6.27,12)}}});1p u(){6.K(("88,8a,2O,8b,8d,52,6j,8e,"+"8f,8g,8h,41,6k,8j,42,"+"4R,8k,8l,8m,2C").3o(","),u(i,o){6.E[o]=u(f){v f?q.3U(o,f):q.1S(o)}});7(6.W.3h||6.W.3f)17.8n("6o",6.27,12);J 7(6.W.1j){17.8o("<8r"+"8s 2J=62 8u=U "+"3e=//:><\\/2d>");B 2d=17.4X("62");7(2d)2d.37=u(){7(q.3D!="1X")v;q.11.33(q);6.27()};2d=16}J 7(6.W.2N)6.50=3L(u(){7(17.3D=="8y"||17.3D=="1X"){4p(6.50);6.50=16;6.27()}},10);6.G.1M(1w,"2O",6.27)};7(6.W.1j)6(1w).6u("52",u(){B 1k=6.G.1k;P(B C 1x 1k){B 4Z=1k[C],i=4Z.I;7(i&&C!=\'52\')6w 6.G.2f(4Z[i-1],C);22(--i)}});6.E.1z({6A:u(V,21,M){q.2O(V,21,M,1)},2O:u(V,21,M,1W){7(6.1t(V))v q.3U("2O",V);M=M||u(){};B C="5d";7(21)7(6.1t(21)){M=21;21=16}J{21=6.3g(21);C="5V"}B 4e=q;6.3v({V:V,C:C,F:21,1W:1W,1X:u(2P,15){7(15=="2M"||!1W&&15=="5L")4e.1I("2t",2P.3G).4V().K(M,[2P.3G,15,2P]);J M.14(4e,[2P.3G,15,2P])}});v q},6B:u(){v 6.3g(q)},4V:u(){v q.2o("2d").K(u(){7(q.3e)6.59(q.3e);J 6.4a(q.2L||q.6H||q.2t||"")}).4g()}});7(!1w.3p)3p=u(){v 1p 6I("6K.6M")};6.K("5m,5Q,5O,5W,5N,5H".3o(","),u(i,o){6.E[o]=u(f){v q.3U(o,f)}});6.1z({2b:u(V,F,M,C,1W){7(6.1t(F)){M=F;F=16}v 6.3v({V:V,F:F,2M:M,4t:C,1W:1W})},6Q:u(V,F,M,C){v 6.2b(V,F,M,C,1)},59:u(V,M){v 6.2b(V,16,M,"2d")},6S:u(V,F,M){v 6.2b(V,F,M,"6m")},6U:u(V,F,M,C){7(6.1t(F)){M=F;F={}}v 6.3v({C:"5V",V:V,F:F,2M:M,4t:C})},6X:u(29){6.3q.29=29},6Y:u(5c){6.1z(6.3q,5c)},3q:{1k:U,C:"5d",29:0,5r:"70/x-73-3w-77",5h:U,48:U,F:16},3S:{},3v:u(s){s=6.1z({},6.3q,s);7(s.F){7(s.5h&&1C s.F!="23")s.F=6.3g(s.F);7(s.C.4m()=="2b"){s.V+=((s.V.18("?")>-1)?"&":"?")+s.F;s.F=16}}7(s.1k&&!6.4E++)6.G.1S("5m");B 4y=12;B N=1p 3p();N.7j(s.C,s.V,s.48);7(s.F)N.3A("7l-7m",s.5r);7(s.1W)N.3A("7o-4K-7q",6.3S[s.V]||"7s, 7t 7w 7x 4o:4o:4o 7z");N.3A("X-7B-7C","3p");7(N.7E)N.3A("7F","7G");7(s.5G)s.5G(N);7(s.1k)6.G.1S("5H",[N,s]);B 37=u(4s){7(N&&(N.3D==4||4s=="29")){4y=U;7(3I){4p(3I);3I=16}B 15;2G{15=6.5Z(N)&&4s!="29"?s.1W&&6.69(N,s.V)?"5L":"2M":"2C";7(15!="2C"){B 3F;2G{3F=N.4P("6b-4K")}2w(e){}7(s.1W&&3F)6.3S[s.V]=3F;B F=6.6i(N,s.4t);7(s.2M)s.2M(F,15);7(s.1k)6.G.1S("5N",[N,s])}J 6.3J(s,N,15)}2w(e){15="2C";6.3J(s,N,15,e)}7(s.1k)6.G.1S("5O",[N,s]);7(s.1k&&!--6.4E)6.G.1S("5Q");7(s.1X)s.1X(N,15);7(s.48)N=16}};B 3I=3L(37,13);7(s.29>0)57(u(){7(N){N.7N();7(!4y)37("29")}},s.29);2G{N.7Q(s.F)}2w(e){6.3J(s,N,16,e)}7(!s.48)37();v N},3J:u(s,N,15,e){7(s.2C)s.2C(N,15,e);7(s.1k)6.G.1S("5W",[N,s,e])},4E:0,5Z:u(r){2G{v!r.15&&7V.7W=="4G:"||(r.15>=5X&&r.15<7X)||r.15==6d||6.W.2N&&r.15==T}2w(e){}v 12},69:u(N,V){2G{B 6e=N.4P("6b-4K");v N.15==6d||6e==6.3S[V]||6.W.2N&&N.15==T}2w(e){}v 12},6i:u(r,C){B 4Q=r.4P("8c-C");B F=!C&&4Q&&4Q.18("N")>=0;F=C=="N"||F?r.8i:r.3G;7(C=="2d")6.4a(F);7(C=="6m")40("F = "+F);7(C=="4U")6("<1V>").4U(F).4V();v F},3g:u(a){B s=[];7(a.1l==2y||a.3Y)6.K(a,u(){s.1g(2x(q.Y)+"="+2x(q.O))});J P(B j 1x a)7(a[j]&&a[j].1l==2y)6.K(a[j],u(){s.1g(2x(j)+"="+2x(q))});J s.1g(2x(j)+"="+2x(a[j]));v s.6t("&")},4a:u(F){7(1w.54)1w.54(F);J 7(6.W.2N)1w.57(F,0);J 40.3n(1w,F)}});6.E.1z({1L:u(R,M){B 1G=q.1D(":1G");R?1G.26({28:"1L",3V:"1L",1d:"1L"},R,M):1G.K(u(){q.1q.1h=q.2E?q.2E:"";7(6.1m(q,"1h")=="1Z")q.1q.1h="2D"});v q},1K:u(R,M){B 3i=q.1D(":3i");R?3i.26({28:"1K",3V:"1K",1d:"1K"},R,M):3i.K(u(){q.2E=q.2E||6.1m(q,"1h");7(q.2E=="1Z")q.2E="2D";q.1q.1h="1Z"});v q},5g:6.E.3X,3X:u(E,4I){B 1E=1A;v 6.1t(E)&&6.1t(4I)?q.5g(E,4I):q.K(u(){6(q)[6(q).4l(":1G")?"1L":"1K"].14(6(q),1E)})},7a:u(R,M){v q.26({28:"1L"},R,M)},7c:u(R,M){v q.26({28:"1K"},R,M)},7f:u(R,M){v q.K(u(){B 5k=6(q).4l(":1G")?"1L":"1K";6(q).26({28:5k},R,M)})},7r:u(R,M){v q.26({1d:"1L"},R,M)},7u:u(R,M){v q.26({1d:"1K"},R,M)},7y:u(R,43,M){v q.26({1d:43},R,M)},26:u(H,R,1v,M){v q.1F(u(){q.2F=6.1z({},H);B 1u=6.R(R,1v,M);P(B p 1x H){B e=1p 6.3b(q,1u,p);7(H[p].1l==3Q)e.2s(e.Q(),H[p]);J e[H[p]](H)}})},1F:u(C,E){7(!E){E=C;C="3b"}v q.K(u(){7(!q.1F)q.1F={};7(!q.1F[C])q.1F[C]=[];q.1F[C].1g(E);7(q.1F[C].I==1)E.14(q)})}});6.1z({R:u(R,1v,E){B 1u=R&&R.1l==7K?R:{1X:E||!E&&1v||6.1t(R)&&R,25:R,1v:E&&1v||1v&&1v.1l!=4w&&1v};1u.25=(1u.25&&1u.25.1l==3Q?1u.25:{7R:7S,7T:5X}[1u.25])||7U;1u.1N=1u.1X;1u.1X=u(){6.6a(q,"3b");7(6.1t(1u.1N))1u.1N.14(q)};v 1u},1v:{},1F:{},6a:u(D,C){C=C||"3b";7(D.1F&&D.1F[C]){D.1F[C].4L();B f=D.1F[C][0];7(f)f.14(D)}},3b:u(D,1e,H){B z=q;B y=D.1q;B 4D=6.1m(D,"1h");y.5T="1G";z.a=u(){7(1e.49)1e.49.14(D,[z.2p]);7(H=="1d")6.1I(y,"1d",z.2p);J 7(6l(z.2p))y[H]=6l(z.2p)+"4S";y.1h="2D"};z.6v=u(){v 4T(6.1m(D,H))};z.Q=u(){B r=4T(6.30(D,H));v r&&r>-8z?r:z.6v()};z.2s=u(4f,43){z.4J=(1p 5o()).5w();z.2p=4f;z.a();z.4q=3L(u(){z.49(4f,43)},13)};z.1L=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1L=U;z.2s(0,D.1y[H]);7(H!="1d")y[H]="5a"};z.1K=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1K=U;z.2s(D.1y[H],0)};z.3X=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();7(4D=="1Z"){1e.1L=U;7(H!="1d")y[H]="5a";z.2s(0,D.1y[H])}J{1e.1K=U;z.2s(D.1y[H],0)}};z.49=u(32,47){B t=(1p 5o()).5w();7(t>1e.25+z.4J){4p(z.4q);z.4q=16;z.2p=47;z.a();7(D.2F)D.2F[H]=U;B 2c=U;P(B i 1x D.2F)7(D.2F[i]!==U)2c=12;7(2c){y.5T="";y.1h=4D;7(6.1m(D,"1h")=="1Z")y.1h="2D";7(1e.1K)y.1h="1Z";7(1e.1K||1e.1L)P(B p 1x D.2F)7(p=="1d")6.1I(y,p,D.1y[p]);J y[p]=""}7(2c&&6.1t(1e.1X))1e.1X.14(D)}J{B n=t-q.4J;B p=n/1e.25;z.2p=1e.1v&&6.1v[1e.1v]?6.1v[1e.1v](p,n,32,(47-32),1e.25):((-6h.7O(p*6h.8L)/2)+0.5)*(47-32)+32;z.a()}}}})}',62,545,'||||||jQuery|if|||||||||||||||||||this||||function|return||||||var|type|elem|fn|data|event|prop|length|else|each|ret|callback|xml|value|for|cur|speed|element|undefined|true|url|browser||name|||parentNode|false||apply|status|null|document|indexOf|className|val|firstChild|obj|opacity|options|nodeName|push|display|result|msie|global|constructor|css|test|handler|new|style|arg|expr|isFunction|opt|easing|window|in|orig|extend|arguments|context|typeof|filter|args|queue|hidden|events|attr|re|hide|show|add|old|target|table|token|replace|trigger|num|elems|div|ifModified|complete|key|none|tbody|params|while|string|nodeType|duration|animate|ready|height|timeout|nth|get|done|script|nextSibling|remove|not|index|tb|fix|merge|oid|z0|preventDefault|find|now|grep|pushStack|custom|innerHTML|first|cssFloat|catch|encodeURIComponent|Array|el|guid|sibling|error|block|oldblock|curAnim|try|stopPropagation|childNodes|id|wrap|text|success|safari|load|res|exec|al|_|last|substr|has|disabled|insertBefore|selected|checked|curCSS|map|firstNum|removeChild|re2|trim|getAttribute|onreadystatechange|handlers|on|originalEvent|fx|readyList|parPos|src|opera|param|mozilla|visible|domManip|clean|cloneNode|tr|call|split|XMLHttpRequest|ajaxSettings|append|child|String|empty|ajax|form|button|inArray|multiFilter|setRequestHeader|foundToken|9_|readyState|tag|modRes|responseText|second|ival|handleError|toUpperCase|setInterval|makeArray|slice|break|oWidth|Number|returnValue|lastModified|styleFloat|bind|width|isReady|toggle|jquery|dir|eval|mouseover|select|to|defaultView|position|oHeight|lastNum|async|step|globalEval|static|pos|swap|self|from|end|float|alpha|radio|inv|is|toLowerCase|visibility|00|clearInterval|timer|rec|isTimeout|dataType|_resort|RegExp|Function|getAll|requestDone|parents|matched|isXMLDoc|appendChild|oldDisplay|active|triggered|file|documentElement|fn2|startTime|Modified|shift|lastToggle|deep|handleHover|getResponseHeader|ct|submit|px|parseFloat|html|evalScripts|getComputedStyle|getElementById|clone|els|safariTimer|currentStyle|unload|force|execScript|getPropertyValue|newProp|setTimeout|zoom|getScript|1px|sl|settings|GET|rl|check|_toggle|processData|prepend|before|state|removeAttr|ajaxStart|lt|Date|gt|eq|contentType|previousSibling|after|parent|contains|getTime|checkbox|password|appendTo|image|reset|input|webkit|href|continue|beforeSend|ajaxSend|ownerDocument|getElementsByTagName|tmp|notmodified|parse|ajaxSuccess|ajaxComplete|_prefix|ajaxStop|even|odd|overflow|delete|POST|ajaxError|200|handle|httpSuccess|nodeValue|unshift|__ie_init|srcElement|body|pageX|tagName|clientX|scrollLeft|httpNotModified|dequeue|Last|scrollTop|304|xmlRes|unbind|100|Math|httpData|click|mouseout|parseInt|json|createElement|DOMContentLoaded|prevObject|ol|setArray|exclude|join|one|max|do|relative|clientHeight|clientWidth|loadIfModified|serialize|toString|thead|tfoot|td|th|textContent|ActiveXObject|htmlFor|Microsoft|class|XMLHTTP|readOnly|gi|match|getIfModified|9999|getJSON|getAttributeNode|post|setAttribute|ig|ajaxTimeout|ajaxSetup|concat|application|userAgent|compatible|www|compatMode|CSS1Compat|next|urlencoded|siblings|children|slideDown|prependTo|slideUp|Top|insertAfter|slideToggle|removeAttribute|addClass|removeClass|open|toggleClass|Content|Type|lastChild|If|only|Since|fadeIn|Thu|01|fadeOut|enabled|Jan|1970|fadeTo|GMT|textarea|Requested|With|prev|overrideMimeType|Connection|close|boxModel|right|object|Object|navigator|substring|abort|cos|font|send|slow|600|fast|400|location|protocol|300|pageY|clientY|method|action|cancelBubble|hover|fromElement|toElement|relatedTarget|removeEventListener|blur|readonly|focus|resize|content|scroll|dblclick|mousedown|mouseup|mousemove|responseXML|change|keydown|keypress|keyup|addEventListener|write|prototype|size|scr|ipt|createTextNode|defer|FORM|reverse|noConflict|loaded|10000|weight|line|Bottom|Right|Left|padding|border|Width|offsetHeight|offsetWidth|absolute|PI|left'.split('|'),0,{}))  
 
/* jquery.sparkline 1.2.1 - http://omnipotent.net/jquery.sparkline/ */  
 
(function($){$.fn.simpledraw=function(width,height,use_existing){if(use_existing&&this[0].vcanvas)return this[0].vcanvas;if(width==undefined)width=$(this).innerWidth();if(height==undefined)height=$(this).innerHeight();if($.browser.hasCanvas){return new vcanvas_canvas(width,height,this);}else if($.browser.msie){return new vcanvas_vml(width,height,this);}else{return false;}};$.fn.sparkline=function(uservalues,options){var options=$.extend({type:'line',lineColor:'#00f',fillColor:'#cdf',defaultPixelsPerValue:3,width:'auto',height:'auto',composite:false},options?options:{});return this.each(function(){var values=(uservalues=='html'||uservalues==undefined)?$(this).text().split(','):uservalues;var width=options.width=='auto'?values.length*options.defaultPixelsPerValue:options.width;if(options.height=='auto'){var tmp=document.createElement('span');tmp.innerHTML='a';$(this).append(tmp);height=$(tmp).innerHeight();$(tmp).remove();}else{height=options.height;}  
$.fn.sparkline[options.type].call(this,values,options,width,height);});};$.fn.sparkline.line=function(values,options,width,height){var options=$.extend({spotColor:'#f80',spotRadius:1.5,minSpotColor:'#f80',maxSpotColor:'#f80',normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:'#ccc',chartRangeMin:undefined,chartRangeMax:undefined},options?options:{});var xvalues=[],yvalues=[];for(i=0;i<values.length;i++){var isstr=typeof(values[i])=='string';var isarray=typeof(values[i])=='object'&&values[i]instanceof Array;var sp=isstr&&values[i].split(':');if(isstr&&sp.length==2){xvalues.push(Number(sp[0]));yvalues.push(Number(sp[1]));}else if(isarray){xvalues.push(values[i][0]);yvalues.push(values[i][1]);}else{xvalues.push(i);yvalues.push(Number(values[i]));}}  
if(options.xvalues){xvalues=options.xvalues;}  
var maxy=Math.max.apply(Math,yvalues);var maxyval=maxy;var miny=Math.min.apply(Math,yvalues);var minyval=miny;var maxx=Math.max.apply(Math,xvalues);var maxxval=maxx;var minx=Math.min.apply(Math,xvalues);var minxval=minx;if(options.normalRangeMin!=undefined){if(options.normalRangeMin<miny)  
miny=options.normalRangeMin;if(options.normalRangeMax>maxy)  
maxy=options.normalRangeMax;}  
if(options.chartRangeMin!=undefined&&options.chartRangeMin<miny){miny=options.chartRangeMin;}  
if(options.chartRangeMax!=undefined&&options.chartRangeMax>maxy){maxy=options.chartRangeMax;}  
var rangex=maxx-minx==0?1:maxx-minx;var rangey=maxy-miny==0?1:maxy-miny;var vl=yvalues.length-1;if(vl<1){this.innerHTML='';return;}  
var target=$(this).simpledraw(width,height,options.composite);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var canvas_top=0;var canvas_left=0;if(options.spotRadius&&(canvas_width<(options.spotRadius*4)||canvas_height<(options.spotRadius*4))){options.spotRadius=0;}  
if(options.spotRadius){if(options.minSpotColor||(options.spotColor&&yvalues[vl]==miny))  
canvas_height-=Math.ceil(options.spotRadius);if(options.maxSpotColor||(options.spotColor&&yvalues[vl]==maxy)){canvas_height-=Math.ceil(options.spotRadius);canvas_top+=Math.ceil(options.spotRadius);}  
if(options.minSpotColor||options.maxSpotColor&&(yvalues[0]==miny||yvalues[0]==maxy)){canvas_left+=Math.ceil(options.spotRadius);canvas_width-=Math.ceil(options.spotRadius);}  
if(options.spotColor||(options.minSpotColor||options.maxSpotColor&&(yvalues[vl]==miny||yvalues[vl]==maxy)))  
canvas_width-=Math.ceil(options.spotRadius);}  
canvas_height--;if(options.normalRangeMin!=undefined){var ytop=canvas_top+Math.round(canvas_height-(canvas_height*((options.normalRangeMax-miny)/rangey)));var height=Math.round((canvas_height*(options.normalRangeMax-options.normalRangeMin))/rangey);target.drawRect(canvas_left,ytop,canvas_width,height,undefined,options.normalRangeColor);}  
var path=[[canvas_left,canvas_top+canvas_height]];for(var i=0;i<yvalues.length;i++){var x=xvalues[i],y=yvalues[i];path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);}  
if(options.fillColor){path.push([canvas_left+canvas_width,canvas_top+canvas_height-1]);target.drawShape(path,undefined,options.fillColor);path.pop();}  
path[0]=[canvas_left,canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[0]-miny)/rangey)))];target.drawShape(path,options.lineColor);if(options.spotRadius&&options.spotColor){target.drawCircle(canvas_left+canvas_width,canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[vl]-miny)/rangey))),options.spotRadius,undefined,options.spotColor);}  
if(maxy!=minyval){if(options.spotRadius&&options.minSpotColor){var x=xvalues[yvalues.indexOf(minyval)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((minyval-miny)/rangey))),options.spotRadius,undefined,options.minSpotColor);}  
if(options.spotRadius&&options.maxSpotColor){var x=xvalues[yvalues.indexOf(maxyval)];target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),canvas_top+Math.round(canvas_height-(canvas_height*((maxyval-miny)/rangey))),options.spotRadius,undefined,options.maxSpotColor);}}}else{this.innerHTML='';}};$.fn.sparkline.bar=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({type:'bar',barColor:'#00f',negBarColor:'#f44',zeroColor:undefined,zeroAxis:undefined,barWidth:4,barSpacing:1,chartRangeMax:undefined,chartRangeMin:undefined},options?options:{});var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);var max=Math.max.apply(Math,values);var min=Math.min.apply(Math,values);if(options.chartRangeMin!=undefined&&options.chartRangeMin<min){min=options.chartRangeMin;}  
if(options.chartRangeMax!=undefined&&options.chartRangeMax>max){max=options.chartRangeMax;}  
if(options.zeroAxis==undefined)options.zeroAxis=min<0;var range=max-min+1;var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var yzero=min<0&&options.zeroAxis?canvas_height-Math.round(canvas_height*(Math.abs(min)/range))-1:canvas_height-1;for(var i=0;i<values.length;i++){var x=i*(options.barWidth+options.barSpacing);var val=values[i];var color=(val<0)?options.negBarColor:options.barColor;if(options.zeroAxis&&min<0){var height=Math.round(canvas_height*((Math.abs(val)/range)))+1;var y=(val<0)?yzero:yzero-height;}else{var height=Math.round(canvas_height*((val-min)/range))+1;var y=canvas_height-height;}  
if(val==0&&options.zeroColor!=undefined){color=options.zeroColor;}  
if($.browser.msie)  
target.drawRect(x,y,options.barWidth-1,height-1,color,color);else  
target.drawRect(x,y,options.barWidth,height,undefined,color);}}else{this.innerHTML='';}};$.fn.sparkline.tristate=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({barWidth:4,barSpacing:1,posBarColor:'#6f6',negBarColor:'#f44',zeroBarColor:'#999',colorMap:{}},options);var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var half_height=Math.round(canvas_height/2);for(var i=0;i<values.length;i++){var x=i*(options.barWidth+options.barSpacing);if(values[i]<0){var y=half_height;var height=half_height-1;var color=options.negBarColor;}else if(values[i]>0){var y=0;var height=half_height-1;var color=options.posBarColor;}else{var y=half_height-1;var height=2;var color=options.zeroBarColor;}  
if(options.colorMap[values[i]]){color=options.colorMap[values[i]];}  
if($.browser.msie)  
target.drawRect(x,y,options.barWidth-1,height-1,color,color);else  
target.drawRect(x,y,options.barWidth,height,undefined,color);}}else{this.innerHTML='';}};$.fn.sparkline.discrete=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({lineHeight:'auto',thresholdColor:undefined,thresholdValue:0,chartRangeMax:undefined,chartRangeMin:undefined},options);width=options.width=='auto'?values.length*2:width;var interval=Math.floor(width/values.length);var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var line_height=options.lineHeight=='auto'?Math.round(canvas_height*0.3):options.lineHeight;var pheight=canvas_height-line_height;var min=Math.min.apply(Math,values);var max=Math.max.apply(Math,values);if(options.chartRangeMin!=undefined&&options.chartRangeMin<min){min=options.chartRangeMin;}  
if(options.chartRangeMax!=undefined&&options.chartRangeMax>max){max=options.chartRangeMax;}  
var range=max-min;for(var i=0;i<values.length;i++){var val=values[i];var x=(i*interval);var ytop=Math.round(pheight-pheight*((val-min)/range));target.drawLine(x,ytop,x,ytop+line_height,(options.thresholdColor&&val<options.thresholdValue)?options.thresholdColor:options.lineColor);}}else{this.innerHTML='';}};$.fn.sparkline.bullet=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({targetColor:'red',targetWidth:3,performanceColor:'blue',rangeColors:['#D3DAFE','#A8B6FF','#7F94FF'],base:undefined},options);width=options.width=='auto'?'4.0em':width;var target=$(this).simpledraw(width,height);if(target&&values.length>1){var canvas_width=target.pixel_width-Math.ceil(options.targetWidth/2);var canvas_height=target.pixel_height;var min=Math.min.apply(Math,values);var max=Math.max.apply(Math,values);if(options.base==undefined){var min=min<0?min:0;}else{min=options.base;}  
var range=max-min;for(i=2;i<values.length;i++){var rangeval=parseInt(values[i]);var rangewidth=Math.round(canvas_width*((rangeval-min)/range));if($.browser.msie)  
target.drawRect(0,0,rangewidth-1,canvas_height-1,options.rangeColors[i-2],options.rangeColors[i-2]);else  
target.drawRect(0,0,rangewidth,canvas_height,undefined,options.rangeColors[i-2]);}  
var perfval=parseInt(values[1]);var perfwidth=Math.round(canvas_width*((perfval-min)/range));if($.browser.msie)  
target.drawRect(0,Math.round(canvas_height*0.3),perfwidth-1,Math.round(canvas_height*0.4)-1,options.performanceColor,options.performanceColor);else  
target.drawRect(0,Math.round(canvas_height*0.3),perfwidth,Math.round(canvas_height*0.4),undefined,options.performanceColor);var targetval=parseInt(values[0]);var x=Math.round(canvas_width*((targetval-min)/range)-(options.targetWidth/2));var targettop=Math.round(canvas_height*0.10);var targetheight=canvas_height-(targettop*2);if($.browser.msie)  
target.drawRect(x,targettop,options.targetWidth-1,targetheight-1,options.targetColor,options.targetColor);else  
target.drawRect(x,targettop,options.targetWidth,targetheight,undefined,options.targetColor);}else{this.innerHTML='';}};$.fn.sparkline.pie=function(values,options,width,height){values=$.map(values,Number);var options=$.extend({sliceColors:['#f00','#0f0','#00f']},options);width=options.width=='auto'?options.height:width;var target=$(this).simpledraw(width,height);if(target&&values.length>1){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var radius=Math.floor(Math.min(canvas_width,canvas_height)/2);var total=0;for(var i=0;i<values.length;i++)  
total+=values[i];var next=0;if(options.offset){next+=(2*Math.PI)*(options.offset/360);}  
var circle=2*Math.PI;for(var i=0;i<values.length;i++){var start=next;var end=next;if(total>0){end=next+(circle*(values[i]/total));}  
target.drawPieSlice(radius,radius,radius,start,end,undefined,options.sliceColors[i%options.sliceColors.length]);next=end;}}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(entry){for(var i=0;i<this.length;i++){if(this[i]==entry)  
return i;}  
return-1;}}  
if($.browser.msie&&!document.namespaces['v']){document.namespaces.add("v","urn:schemas-microsoft-com:vml");document.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML); display:inline-block; padding:0px; margin:0px;}";}  
if($.browser.hasCanvas==undefined){var t=document.createElement('canvas');$.browser.hasCanvas=t.getContext!=undefined;}  
var vcanvas_base=function(width,height,target){};vcanvas_base.prototype={init:function(width,height,target){this.width=width;this.height=height;this.target=target;if(target[0])target=target[0];target.vcanvas=this;},drawShape:function(path,lineColor,fillColor){alert('drawShape not implemented');},drawLine:function(x1,y1,x2,y2,lineColor){return this.drawShape([[x1,y1],[x2,y2]],lineColor);},drawCircle:function(x,y,radius,lineColor,fillColor){alert('drawCircle not implemented');},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){alert('drawPieSlice not implemented');},drawRect:function(x,y,width,height,lineColor,fillColor){alert('drawRect not implemented');},getElement:function(){return this.canvas;},_insert:function(el,target){$(target).html(el);}};var vcanvas_canvas=function(width,height,target){return this.init(width,height,target);};vcanvas_canvas.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement('canvas');if(target[0])target=target[0];target.vcanvas=this;$(this.canvas).css({display:'inline',width:width,height:height});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;},_getContext:function(lineColor,fillColor){var context=this.canvas.getContext('2d');if(lineColor!=undefined)  
context.strokeStyle=lineColor;context.lineWidth=1;if(fillColor!=undefined)  
context.fillStyle=fillColor;return context;},drawShape:function(path,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.moveTo(path[0][0]+0.5,path[0][1]+0.5);for(var i=1;i<path.length;i++){context.lineTo(path[i][0]+0.5,path[i][1]+0.5);}  
if(lineColor!=undefined){context.stroke();}  
if(fillColor!=undefined){context.fill();}},drawCircle:function(x,y,radius,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.arc(x,y,radius,0,2*Math.PI,false);if(lineColor!=undefined){context.stroke();}  
if(fillColor!=undefined){context.fill();}},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.moveTo(x,y);context.arc(x,y,radius,startAngle,endAngle,false);context.lineTo(x,y);context.closePath();if(lineColor!=undefined){context.stroke();}  
if(fillColor){context.fill();}},drawRect:function(x,y,width,height,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);if(fillColor!=undefined)  
context.fillRect(x,y,width,height);if(lineColor!=undefined)  
context.strokeRect(x,y,width,height);}});var vcanvas_vml=function(width,height,target){return this.init(width,height,target);};vcanvas_vml.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);if(target[0])target=target[0];target.vcanvas=this;this.canvas=document.createElement('span');$(this.canvas).css({display:'inline-block',position:'relative',overflow:'hidden',width:width,height:height,margin:'0px',padding:'0px'});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;;var groupel='<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"'  
+' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';this.canvas.insertAdjacentHTML('beforeEnd',groupel);this.group=$(this.canvas).children()[0];},drawShape:function(path,lineColor,fillColor){var vpath=[];for(var i=0;i<path.length;i++){vpath[i]=''+(path[i][0]-1)+','+(path[i][1]-1);}  
var initial=vpath.splice(0,1);var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var closed=vpath[0]==vpath[vpath.length-1]?'x ':'';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '  
+stroke  
+fill  
+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '  
+' path="m '+initial+' l '+vpath.join(', ')+' '+closed+'e">'  
+' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawCircle:function(x,y,radius,lineColor,fillColor){x-=radius+1;y-=radius+1;var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:oval '  
+stroke  
+fill  
+' style="position:absolute;top:'+y+'; left:'+x+'; width:'+(radius*2)+'; height:'+(radius*2)+'"></v:oval>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawPieSlice:function(x,y,radius,startAngle,endAngle,lineColor,fillColor){if(startAngle==endAngle){return;}  
if((endAngle-startAngle)==(2*Math.PI)){startAngle=0.0;endAngle=(2*Math.PI);}  
var startx=x+Math.round(Math.cos(startAngle)*radius);var starty=y+Math.round(Math.sin(startAngle)*radius);var endx=x+Math.round(Math.cos(endAngle)*radius);var endy=y+Math.round(Math.sin(endAngle)*radius);var vpath=[x-radius,y-radius,x+radius,y+radius,startx,starty,endx,endy];var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '  
+stroke  
+fill  
+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '  
+' path="m '+x+','+y+' wa '+vpath.join(', ')+' x e">'  
+' </v:shape>';this.group.insertAdjacentHTML('beforeEnd',vel);},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x,y+height],[x+width,y+height],[x+width,y],[x,y]],lineColor,fillColor);}});})(jQuery);  
/**  
* sprintf and vsprintf for jQuery  
* somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/  
*  
* Copyright (c) 2008 Sabin Iacob (m0n5t3r) <iacobs@m0n5t3r.info>  
* This program is free software: you can redistribute it and/or modify  
* it under the terms of the GNU General Public License as published by  
* the Free Software Foundation, either version 3 of the License, or  
* (at your option) any later version.  
*  
* This program is distributed in the hope that it will be useful,  
* but WITHOUT ANY WARRANTY; without even the implied warranty of  
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
* GNU General Public License for more details.  
*  
* @license http://www.gnu.org/licenses/gpl.html  
* @project jquery.sprintf  
*/  
(function($){  
var formats = {  
'%': function(val) {return '%';},  
'b': function(val) {return parseInt(val, 10).toString(2);},  
'c': function(val) {return String.fromCharCode(parseInt(val, 10));},  
'd': function(val) {return parseInt(val, 10) ? parseInt(val, 10) : 0;},  
'u': function(val) {return Math.abs(val);},  
'f': function(val, p) {return (p > -1) ? Math.round(parseFloat(val) * Math.pow(10, p)) / Math.pow(10, p): parseFloat(val);},  
'o': function(val) {return parseInt(val, 10).toString(8);},  
's': function(val) {return val;},  
'x': function(val) {return ('' + parseInt(val, 10).toString(16)).toLowerCase();},  
'X': function(val) {return ('' + parseInt(val, 10).toString(16)).toUpperCase();}  
};  
 
var re = /%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;  
 
var dispatch = function(data){  
if(data.length == 1 && typeof data[0] == 'object') { //python-style printf  
data = data[0];  
return function(match, w, p, lbl, fmt, off, str) {  
return formats[fmt](data[lbl]);  
};  
} else { // regular, somewhat incomplete, printf  
var idx = 0; // oh, the beauty of closures :D  
return function(match, w, p, lbl, fmt, off, str) {  
return formats[fmt](data[idx++], p);  
};  
}  
};  
 
$.extend({  
sprintf: function(format) {  
var argv = Array.apply(null, arguments).slice(1);  
return format.replace(re, dispatch(argv));  
},  
vsprintf: function(format, data) {  
return format.replace(re, dispatch(data));  
}  
});  
})(jQuery);  
/*  
jQuery Plugin spy (leftlogic.com/info/articles/jquery_spy2)  
(c) 2006 Remy Sharp (leftlogic.com)  
$Id: spy.js,v 1.4 2006/09/30 11:05:04 remy Exp $  
*/  
var spyRunning = 1;  
 
$.fn.spy = function(settings) {  
var spy = this;  
spy.epoch = new Date(1970, 0, 1);  
spy.last = '';  
spy.parsing = 0;  
spy.waitTimer = 0;  
spy.json = null;  
 
if (!settings.ajax) {  
alert("An AJAX/AJAH URL must be set for the spy to work.");  
return;  
}  
 
spy.attachHolder = function() {  
// not mad on this, but the only way to parse HTML collections  
if (o.method == 'html')  
$('body').append('<div style="display: none!important;" id="_spyTmp"></div>');  
}  
 
// returns true for 'no dupe', and false for 'dupe found'  
// latest = is latest ajax return value (raw)  
// last = is previous ajax return value (raw)  
// note that comparing latest and last if they're JSON objects  
// always returns false, so you need to implement it manually.  
spy.isDupe = function(latest, last) {  
if ((last.constructor == Object) && (o.method == 'html'))  
return (latest.html() == last.html());  
else if (last.constructor == String)  
return (latest == last);  
else  
return 0;  
}  
 
spy.timestamp = function() {  
var now = new Date();  
return Math.floor((now - spy.epoch) / 1000);  
}  
 
spy.parse = function(e, r) {  
spy.parsing = 1; // flag to stop pull via ajax  
if (o.method == 'html') {  
$('div#_spyTmp').html(r); // add contents to hidden div  
} else if (o.method == 'json') {  
eval('spy.json = ' + r); // convert text to json  
}  
 
if ((o.method == 'json' && spy.json.constructor == Array) || o.method == 'html') {  
if (spy.parseItem(e)) {  
spy.waitTimer = window.setInterval(function() {  
if (spyRunning) {  
if (!spy.parseItem(e)) {  
spy.parsing = 0;  
clearInterval(spy.waitTimer);  
}  
}  
}, o.timeout);  
} else {  
spy.parsing = 0;  
}  
} else if (o.method == 'json') { // we just have 1  
eval('spy.json = ' + r)  
spy.addItem(e, spy.json);  
spy.parsing = 0;  
}  
}  
 
// returns true if there's more to parse  
spy.parseItem = function(e) {  
if (o.method == 'html') {  
// note: pre jq-1.0 doesn't return the object  
var i = $('div#_spyTmp').find('div:first').remove();  
if (i.size() > 0) {  
i.hide();  
spy.addItem(e, i);  
}  
return ($('div#_spyTmp').find('div').size() != 0);  
} else {  
if (spy.json.length) {  
var i = spy.json.shift();  
spy.addItem(e, i);  
}  
 
return (spy.json.length != 0);  
}  
}  
 
spy.addItem = function(e, i) {  
if (! o.isDupe.call(this, i, spy.last)) {  
spy.last = i; // note i is a pointer - so when it gets modified, so does spy.last  
$('#' + e.id + ' > div:gt(' + (o.limit - 2) + ')').remove();  
$('#' + e.id + ' > div:gt(' + (o.limit - o.fadeLast - 2) + ')').fadeEachDown();  
o.push.call(e, i);  
$('#' + e.id + ' > div:first').fadeIn(o.fadeInSpeed);  
}  
}  
 
spy.push = function(r) {  
$('#' + this.id).prepend(r);  
}  
 
var o = {  
limit: (settings.limit || 10),  
fadeLast: (settings.fadeLast || 5),  
ajax: settings.ajax,  
timeout: (settings.timeout || 3000),  
method: (settings.method || 'html').toLowerCase(),  
push: (settings.push || spy.push),  
fadeInSpeed: (settings.fadeInSpeed || 'slow'), // 1400 = crawl  
timestamp: (settings.timestamp || spy.timestamp),  
isDupe: (settings.isDupe || spy.isDupe)  
};  
 
spy.attachHolder();  
 
return this.each(function() {  
var e = this;  
var timestamp = o.timestamp.call();  
var lr = ''; // last ajax return  
 
spy.ajaxTimer = window.setInterval(function() {  
if (spyRunning && (!spy.parsing)) {  
$.get(o.ajax, owa_getData()  
, function(r) {  
spy.parse(e, r);  
});  
timestamp = o.timestamp.call();  
} else {  
 
var d = new Date();  
timestamp = Math.round(d.getTime() / 1000);  
 
}  
}, o.timeout);  
});  
};  
 
$.fn.fadeEachDown = function() {  
var s = this.size();  
return this.each(function(i) {  
var o = 1 - (s == 1 ? 0.5 : 0.85/s*(i+1));  
var e = this.style;  
if (window.ActiveXObject)  
e.filter = "alpha(opacity=" + o*100 + ")";  
e.opacity = o;  
});  
};  
 
function pauseSpy() {  
spyRunning = 0;  
var temp_time;  
last_end_time = temp_time;  
$('div#_spyTmp').html("");  
$('div#spyContainer').prepend('<div class="status">The spy has been paused...</div>');  
 
return false;  
}  
 
function playSpy() {  
spyRunning = 1;  
$('div#spyContainer').prepend('<div class="status">The spy has been re-started...</div>');  
return false;  
}  
/* Arabic Translation for jQuery UI date picker plugin. */  
/* Khaled Al Horani -- koko.dw@gmail.com */  
/* خالد الحوراني -- koko.dw@gmail.com */  
/* NOTE: monthNames are the original months names and thez are the Arabic names, not the new months name فبراير - يناير and there isnät any Arabic roots for these months */  
jQuery(function($){  
$.datepicker.regional['ar'] = {  
clearText: 'مسح', clearStatus: 'امسح التاريخ الحالي',  
closeText: 'إغلاق', closeStatus: 'إغلاق بدون حفظ',  
prevText: '<السابق', prevStatus: 'عرض الشهر السابق',  
nextText: 'التالي>', nextStatus: 'عرض الشهر القادم',  
currentText: 'اليوم', currentStatus: 'عرض الشهر الحالي',  
monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],  
monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],  
monthStatus: 'عرض شهر آخر', yearStatus: 'عرض سنة آخرى',  
weekHeader: 'أسبوع', weekStatus: 'أسبوع السنة',  
dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],  
dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],  
dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],  
dayStatus: 'اختر DD لليوم الأول من الأسبوع', dateStatus: 'اختر D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: 'اختر يوم', isRTL: true};  
$.datepicker.setDefaults($.datepicker.regional['ar']);  
});  
/* Bulgarian initialisation for the jQuery UI date picker plugin. */  
/* Written by Stoyan Kyosev (http://svest.org). */  
jQuery(function($){  
$.datepicker.regional['bg'] = {clearText: 'изчисти', clearStatus: 'изчисти актуалната дата',  
closeText: 'затвори', closeStatus: 'затвори без промени',  
prevText: '&#x3c;назад', prevStatus: 'покажи последния месец',  
nextText: 'напред&#x3e;', nextStatus: 'покажи следващия месец',  
currentText: 'днес', currentStatus: '',  
monthNames: ['Януари','Февруари','Март','Април','Май','Юни',  
'Юли','Август','Септември','Октомври','Ноември','Декември'],  
monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни',  
'Юли','Авг','Сеп','Окт','Нов','Дек'],  
monthStatus: 'покажи друг месец', yearStatus: 'покажи друга година',  
weekHeader: 'Wk', weekStatus: 'седмица от месеца',  
dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],  
dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],  
dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'],  
dayStatus: 'Сложи DD като първи ден от седмицата', dateStatus: 'Избери D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: 'Избери дата', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['bg']);  
});  
 
 
/* Writers: (joan.leon@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['ca'] = {clearText: 'Netejar', clearStatus: '',  
closeText: 'Tancar', closeStatus: '',  
prevText: '&lt;Ant', prevStatus: '',  
nextText: 'Seg&gt;', nextStatus: '',  
currentText: 'Avui', currentStatus: '',  
monthNames: ['Gener','Febrer','Mar&ccedil;','Abril','Maig','Juny',  
'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'],  
monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun',  
'Jul','Ago','Set','Oct','Nov','Des'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'],  
dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],  
dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'mm/dd/yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['ca']);  
});  
/* Czech initialisation for the jQuery UI date picker plugin. */  
/* Written by Tomas Muller (tomas@tomas-muller.net). */  
jQuery(function($){  
$.datepicker.regional['cs'] = {clearText: 'Vymazat', clearStatus: 'Vymaže zadané datum',  
closeText: 'Zavřít', closeStatus: 'Zavře kalendář beze změny',  
prevText: '&#x3c;Dříve', prevStatus: 'Přejít na předchozí měsí',  
nextText: 'Později&#x3e;', nextStatus: 'Přejít na další měsíc',  
currentText: 'Nyní', currentStatus: 'Přejde na aktuální měsíc',  
monthNames: ['leden','únor','březen','duben','květen','červen',  
'červenec','srpen','září','říjen','listopad','prosinec'],  
monthNamesShort: ['led','úno','bře','dub','kvě','čer',  
'čvc','srp','zář','říj','lis','pro'],  
monthStatus: 'Přejít na jiný měsíc', yearStatus: 'Přejít na jiný rok',  
weekHeader: 'Týd', weekStatus: 'Týden v roce',  
dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],  
dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],  
dayNamesMin: ['ne','po','út','st','čt','pá','so'],  
dayStatus: 'Nastavit DD jako první den v týdnu', dateStatus: '\'Vyber\' DD, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: 'Vyberte datum', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['cs']);  
});  
 
/* Danish initialisation for the jQuery UI date picker plugin. */  
/* Written by Jan Christensen ( deletestuff@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['da'] = {clearText: 'Nulstil', clearStatus: 'Nulstil den aktuelle dato',  
closeText: 'Luk', closeStatus: 'Luk uden ændringer',  
prevText: '&#x3c;Forrige', prevStatus: 'Vis forrige måned',  
nextText: 'Næste&#x3e;', nextStatus: 'Vis næste måned',  
currentText: 'Idag', currentStatus: 'Vis aktuel måned',  
monthNames: ['Januar','Februar','Marts','April','Maj','Juni',  
'Juli','August','September','Oktober','November','December'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',  
'Jul','Aug','Sep','Okt','Nov','Dec'],  
monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år',  
weekHeader: 'Uge', weekStatus: 'Årets uge',  
dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],  
dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],  
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],  
dayStatus: 'Sæt DD som første ugedag', dateStatus: 'Vælg D, M d',  
dateFormat: 'dd-mm-yy', firstDay: 0,  
initStatus: 'Vælg en dato', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['da']);  
});  
 
/* German initialisation for the jQuery UI date picker plugin. */  
/* Written by Milian Wolff (mail@milianw.de). */  
jQuery(function($){  
$.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',  
closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',  
prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',  
nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',  
currentText: 'heute', currentStatus: '',  
monthNames: ['Januar','Februar','März','April','Mai','Juni',  
'Juli','August','September','Oktober','November','Dezember'],  
monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',  
'Jul','Aug','Sep','Okt','Nov','Dez'],  
monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',  
weekHeader: 'Wo', weekStatus: 'Woche des Monats',  
dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],  
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],  
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],  
dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: 'Wähle ein Datum', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['de']);  
});  
 
 
/* Traducido por Vester (xvester@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['es'] = {clearText: 'Limpiar', clearStatus: '',  
closeText: 'Cerrar', closeStatus: '',  
prevText: '&lt;Ant', prevStatus: '',  
nextText: 'Sig&gt;', nextStatus: '',  
currentText: 'Hoy', currentStatus: '',  
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',  
'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],  
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',  
'Jul','Ago','Sep','Oct','Nov','Dic'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;dabo'],  
dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],  
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['es']);  
});  
/* Finnish initialisation for the jQuery UI date picker plugin. */  
 
 
$(document).ready(function(){  
$.datepicker.regional['fi'] = {  
clearText: 'Tyhjenn&auml;', clearStatus: '',  
closeText: 'Sulje', closeStatus: '',  
prevText: '&laquo;Edellinen', prevStatus: '',  
nextText: 'Seuraava&raquo;', nextStatus: '',  
currentText: 'T&auml;n&auml;&auml;n', currentStatus: '',  
monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&auml;kuu',  
'Hein&auml;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],  
monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kes&auml;',  
'Hein&auml;','Elo','Syys','Loka','Marras','Joulu'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Vk', weekStatus: '',  
dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'],  
dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],  
dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['fi']);  
});  
 
/* French initialisation for the jQuery UI date picker plugin. */  
/* Written by Keith Wood (kbwood@virginbroadband.com.au) and Stéphane Nahmani (sholby@sholby.net). */  
jQuery(function($){  
$.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '',  
closeText: 'Fermer', closeStatus: 'Fermer sans modifier',  
prevText: '&lt;Préc', prevStatus: 'Voir le mois précédent',  
nextText: 'Suiv&gt;', nextStatus: 'Voir le mois suivant',  
currentText: 'Courant', currentStatus: 'Voir le mois courant',  
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',  
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],  
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',  
'Jul','Aoû','Sep','Oct','Nov','Déc'],  
monthStatus: 'Voir un autre mois', yearStatus: 'Voir un autre année',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],  
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],  
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],  
dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: 'Choisir la date', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['fr']);  
});  
/* Hebrew initialisation for the UI Datepicker extension. */  
/* Written by Amir Hardon (ahardon at gmail dot com). */  
jQuery(document).ready(function(){  
jQuery.datepicker.regional['he'] = {clearText: 'נקה', clearStatus: '',  
closeText: 'סגור', closeStatus: '',  
prevText: '&#x3c;הקודם', prevStatus: '',  
nextText: 'הבא&#x3e;', nextStatus: '',  
currentText: 'היום', currentStatus: '',  
monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני',  
'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'],  
monthNamesShort: ['1','2','3','4','5','6',  
'7','8','9','10','11','12'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'],  
dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],  
dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],  
dayStatus: 'DD', dateStatus: 'DD, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: '', isRTL: true};  
jQuery.datepicker.setDefaults($.datepicker.regional['he']);  
});  
 
/* Hungarian initialisation for the jQuery UI date picker plugin. */  
/* Written by Istvan Karaszi (jquerycalendar@spam.raszi.hu). */  
jQuery(function($){  
$.datepicker.regional['hu'] = {clearText: 'törlés', clearStatus: '',  
closeText: 'bezárás', closeStatus: '',  
prevText: '&laquo;&nbsp;vissza', prevStatus: '',  
nextText: 'előre&nbsp;&raquo;', nextStatus: '',  
currentText: 'ma', currentStatus: '',  
monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',  
'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],  
monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',  
'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Hé', weekStatus: '',  
dayNames: ['Vasámap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],  
dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],  
dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['hu']);  
});  
 
/* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */  
/* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/  
jQuery(function($){  
$.datepicker.regional['hy'] = {clearText: 'Մաքրել', clearStatus: '',  
closeText: 'Փակել', closeStatus: '',  
prevText: '&lt;Նախ.', prevStatus: '',  
nextText: 'Հաջ.&gt;', nextStatus: '',  
currentText: 'Այսօր', currentStatus: '',  
monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս',  
'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'],  
monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս',  
'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Դեկ'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'ՇԲՏ', weekStatus: '',  
dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','հինգշաբթի','ուրբաթ','շաբաթ'],  
dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],  
dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['hy']);  
});  
/* Indonesian initialisation for the jQuery UI date picker plugin. */  
/* Written by Deden Fathurahman (dedenf@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['id'] = {clearText: 'kosongkan', clearStatus: 'bersihkan tanggal yang sekarang',  
closeText: 'Tutup', closeStatus: 'Tutup tanpa mengubah',  
prevText: '&lt;mundur', prevStatus: 'Tampilkan bulan sebelumnya',  
nextText: 'maju&gt;', nextStatus: 'Tampilkan bulan berikutnya',  
currentText: 'hari ini', currentStatus: 'Tampilkan bulan sekarang',  
monthNames: ['Januari','Februari','Maret','April','Mei','Juni',  
'Juli','Agustus','September','Oktober','Nopember','Desember'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',  
'Jul','Agus','Sep','Okt','Nop','Des'],  
monthStatus: 'Tampilkan bulan yang berbeda', yearStatus: 'Tampilkan tahun yang berbeda',  
weekHeader: 'Mg', weekStatus: 'Minggu dalam tahun',  
dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'],  
dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],  
dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],  
dayStatus: 'gunakan DD sebagai awal hari dalam minggu', dateStatus: 'pilih le DD, MM d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: 'Pilih Tanggal', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['id']);  
});  
/* Icelandic initialisation for the jQuery UI date picker plugin. */  
/* Written by Haukur H. Thorsson (haukur@eskill.is). */  
jQuery(function($){  
$.datepicker.regional['is'] = {clearText: 'Hreinsa', clearStatus: '',  
closeText: 'Loka', closeStatus: '',  
prevText: '< Fyrri', prevStatus: '',  
nextText: 'N&aelig;sti >', nextStatus: '',  
currentText: '&Iacute; dag', currentStatus: '',  
monthNames: ['Jan&uacute;ar','Febr&uacute;ar','Mars','Apr&iacute;l','Ma&iacute','J&uacute;n&iacute;',  
'J&uacute;l&iacute;','&Aacute;g&uacute;st','September','Okt&oacute;ber','N&oacute;vember','Desember'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Ma&iacute;','J&uacute;n',  
'J&uacute;l','&Aacute;g&uacute;','Sep','Okt','N&oacute;v','Des'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Vika', weekStatus: '',  
dayNames: ['Sunnudagur','M&aacute;nudagur','&THORN;ri&eth;judagur','Mi&eth;vikudagur','Fimmtudagur','F&ouml;studagur','Laugardagur'],  
dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'],  
dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['is']);  
});  
/* Italian initialisation for the jQuery UI date picker plugin. */  
/* Written by Apaella (apaella@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['it'] = {clearText: 'Svuota', clearStatus: '',  
closeText: 'Chiudi', closeStatus: '',  
prevText: '&lt;Prec', prevStatus: '',  
nextText: 'Succ&gt;', nextStatus: '',  
currentText: 'Oggi', currentStatus: '',  
monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno',  
'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],  
monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu',  
'Lug','Ago','Set','Ott','Nov','Dic'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['Domenica','Luned&#236','Marted&#236','Mercoled&#236','Gioved&#236','Venerd&#236','Sabato'],  
dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],  
dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['it']);  
});  
 
/* Japanese (UTF-8) initialisation for the jQuery UI date picker plugin. */  
/* Written by Milly. */  
jQuery(function($){  
$.datepicker.regional['ja'] = {clearText: '&#21066;&#38500;', clearStatus: '',  
closeText: '&#38281;&#12376;&#12427;', closeStatus: '',  
prevText: '&lt;&#21069;&#26376;', prevStatus: '',  
nextText: '&#27425;&#26376;&gt;', nextStatus: '',  
currentText: '&#20170;&#26085;', currentStatus: '',  
monthNames: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;',  
'7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],  
monthNamesShort: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;',  
'7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Wk', weekStatus: '',  
dayNames: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],  
dayNamesShort: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],  
dayNamesMin: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy/mm/dd', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['ja']);  
});  
/* Korean initialisation for the jQuery calendar extension. */  
/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['ko'] = {clearText: '지우기', clearStatus: '',  
closeText: '닫기', closeStatus: '',  
prevText: '이전달', prevStatus: '',  
nextText: '다음달', nextStatus: '',  
currentText: '오늘', currentStatus: '',  
monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',  
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],  
monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',  
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Wk', weekStatus: '',  
dayNames: ['일','월','화','수','목','금','토'],  
dayNamesShort: ['일','월','화','수','목','금','토'],  
dayNamesMin: ['일','월','화','수','목','금','토'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['ko']);  
});  
/**  
* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin.  
*  
* @author Arturas Paleicikas <arturas@avalon.lt>  
*/  
jQuery(function($){  
$.datepicker.regional['lt'] = {clearText: 'Išvalyti', clearStatus: '',  
closeText: 'Uždaryti', closeStatus: '',  
prevText: '&lt;Atgal', prevStatus: '',  
nextText: 'Pirmyn&gt;', nextStatus: '',  
currentText: 'Šiandien', currentStatus: '',  
monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis',  
'Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],  
monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir',  
'Lie','Rugp','Rugs','Spa','Lap','Gru'],  
monthStatus: '', yearStatus: '',  
weekHeader: '', weekStatus: '',  
dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','šeštadienis'],  
dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],  
dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['lt']);  
});  
/**  
* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin.  
* @author Arturas Paleicikas <arturas.paleicikas@metasite.net>  
*/  
jQuery(function($){  
$.datepicker.regional['lv'] = {  
clearText: 'Notīrīt', clearStatus: '',  
closeText: 'Aizvērt', closeStatus: '',  
prevText: 'Iepr', prevStatus: '',  
nextText: 'Nāka', nextStatus: '',  
currentText: 'Šodien', currentStatus: '',  
monthNames: ['Janvāris','Februāris','Marts','Aprīlis','Maijs','Jūnijs',  
'Jūlijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jūn',  
'Jūl','Aug','Sep','Okt','Nov','Dec'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Nav', weekStatus: '',  
dayNames: ['svētdiena','pirmdiena','otrdiena','trešdiena','ceturtdiena','piektdiena','sestdiena'],  
dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],  
dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd-mm-yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['lv']);  
});  
/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */  
jQuery(function($){  
$.datepicker.regional['nl'] = {clearText: 'Wissen', clearStatus: 'Wis de huidige datum',  
closeText: 'Sluiten', closeStatus: 'Sluit zonder verandering',  
prevText: '&lt;Terug', prevStatus: 'Laat de voorgaande maand zien',  
nextText: 'Volgende&gt;', nextStatus: 'Laat de volgende maand zien',  
currentText: 'Vandaag', currentStatus: 'Laat de huidige maand zien',  
monthNames: ['Januari','Februari','Maart','April','Mei','Juni',  
'Juli','Augustus','September','Oktober','November','December'],  
monthNamesShort: ['Jan','Feb','Mrt','Apr','Mei','Jun',  
'Jul','Aug','Sep','Okt','Nov','Dec'],  
monthStatus: 'Laat een andere maand zien', yearStatus: 'Laat een ander jaar zien',  
weekHeader: 'Wk', weekStatus: 'Week van het jaar',  
dayNames: ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],  
dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'],  
dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: 'Kies een datum', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['nl']);  
});  
/* Norwegian initialisation for the jQuery UI date picker plugin. */  
/* Written by Naimdjon Takhirov (naimdjon@gmail.com). */  
 
$(document).ready(function(){  
$.datepicker.regional['no'] = {clearText: 'Tøm', clearStatus: '',  
closeText: 'Lukk', closeStatus: '',  
prevText: '&laquo;Forrige', prevStatus: '',  
nextText: 'Neste&raquo;', nextStatus: '',  
currentText: 'I dag', currentStatus: '',  
monthNames: ['Januar','Februar','Mars','April','Mai','Juni',  
'Juli','August','September','Oktober','November','Desember'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',  
'Jul','Aug','Sep','Okt','Nov','Des'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Uke', weekStatus: '',  
dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],  
dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],  
dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['no']);  
});  
 
/* Polish initialisation for the jQuery UI date picker plugin. */  
/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['pl'] = {clearText: 'Wyczyść', clearStatus: 'Wyczyść obecną datę',  
closeText: 'Zamknij', closeStatus: 'Zamknij bez zapisywania',  
prevText: '&#x3c;Poprzedni', prevStatus: 'Pokaż poprzedni miesiąc',  
nextText: 'Następny&#x3e;', nextStatus: 'Pokaż następny miesiąc',  
currentText: 'Dziś', currentStatus: 'Pokaż aktualny miesiąc',  
monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',  
'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],  
monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',  
'Lip','Sie','Wrz','Pa','Lis','Gru'],  
monthStatus: 'Pokaż inny miesiąc', yearStatus: 'Pokaż inny rok',  
weekHeader: 'Tydz', weekStatus: 'Tydzień roku',  
dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],  
dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],  
dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],  
dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 1,  
initStatus: 'Wybierz datę', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['pl']);  
});  
 
/* Brazilian initialisation for the jQuery UI date picker plugin. */  
/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['pt-BR'] = {clearText: 'Limpar', clearStatus: '',  
closeText: 'Fechar', closeStatus: '',  
prevText: '&lt;Anterior', prevStatus: '',  
nextText: 'Pr&oacute;ximo&gt;', nextStatus: '',  
currentText: 'Hoje', currentStatus: '',  
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',  
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],  
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',  
'Jul','Ago','Set','Out','Nov','Dez'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],  
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],  
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['pt-BR']);  
});  
/* Romanian initialisation for the jQuery UI date picker plugin. */  
/* Written by Edmond L. (ll_edmond@walla.com). */  
jQuery(function($){  
$.datepicker.regional['ro'] = {clearText: 'Curat', clearStatus: 'Sterge data curenta',  
closeText: 'Inchide', closeStatus: 'Inchide fara schimbare',  
prevText: '&#x3c;Anterior', prevStatus: 'Arata luna trecuta',  
nextText: 'Urmator&#x3e;', nextStatus: 'Arata luna urmatoare',  
currentText: 'Azi', currentStatus: 'Arata luna curenta',  
monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Junie',  
'Julie','August','Septembrie','Octobrie','Noiembrie','Decembrie'],  
monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun',  
'Jul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'],  
monthStatus: 'Arata o luna diferita', yearStatus: 'Arat un an diferit',  
weekHeader: 'Sapt', weekStatus: 'Saptamana anului',  
dayNames: ['Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'],  
dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'],  
dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sa'],  
dayStatus: 'Seteaza DD ca prima saptamana zi', dateStatus: 'Selecteaza D, M d',  
dateFormat: 'mm/dd/yy', firstDay: 0,  
initStatus: 'Selecteaza o data', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['ro']);  
});  
 
/* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */  
/* Written by Andrew Stromnov (stromnov@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['ru'] = {clearText: 'Очистить', clearStatus: '',  
closeText: 'Закрыть', closeStatus: '',  
prevText: '&lt;Пред', prevStatus: '',  
nextText: 'След&gt;', nextStatus: '',  
currentText: 'Сегодня', currentStatus: '',  
monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',  
'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],  
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',  
'Июл','Авг','Сен','Окт','Ноя','Дек'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Не', weekStatus: '',  
dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],  
dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],  
dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['ru']);  
});  
/* Slovak initialisation for the jQuery UI date picker plugin. */  
/* Written by Vojtech Rinik (vojto@hmm.sk). */  
jQuery(function($){  
$.datepicker.regional['sk'] = {clearText: 'Zmazať', clearStatus: '',  
closeText: 'Zavrieť', closeStatus: '',  
prevText: '&lt;Predchádzajúci', prevStatus: '',  
nextText: 'Nasledujúci&gt;', nextStatus: '',  
currentText: 'Dnes', currentStatus: '',  
monthNames: ['Január','Február','Marec','Apríl','Máj','Jún',  
'Júl','August','September','Október','November','December'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún',  
'Júl','Aug','Sep','Okt','Nov','Dec'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Ty', weekStatus: '',  
dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'],  
dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],  
dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['sk']);  
});  
 
/* Swedish initialisation for the jQuery UI date picker plugin. */  
/* Written by Anders Ekdahl ( anders@nomadiz.se). */  
jQuery(function($){  
$.datepicker.regional['sv'] = {clearText: 'Rensa', clearStatus: '',  
closeText: 'Stäng', closeStatus: '',  
prevText: '&laquo;Förra', prevStatus: '',  
nextText: 'Nästa&raquo;', nextStatus: '',  
currentText: 'Idag', currentStatus: '',  
monthNames: ['Januari','Februari','Mars','April','Maj','Juni',  
'Juli','Augusti','September','Oktober','November','December'],  
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',  
'Jul','Aug','Sep','Okt','Nov','Dec'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Ve', weekStatus: '',  
dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],  
dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],  
dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'yy-mm-dd', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['sv']);  
});  
 
/* Thai initialisation for the jQuery UI date picker plugin. */  
/* Written by pipo (pipo@sixhead.com). */  
jQuery(function($){  
$.datepicker.regional['th'] = {clearText: 'ลบ', clearStatus: '',  
closeText: 'ปิด', closeStatus: '',  
prevText: '&laquo;&nbsp;ย้อน', prevStatus: '',  
nextText: 'ถัดไป&nbsp;&raquo;', nextStatus: '',  
currentText: 'วันนี้', currentStatus: '',  
monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน',  
'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],  
monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.',  
'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Sm', weekStatus: '',  
dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'],  
dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],  
dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd/mm/yy', firstDay: 0,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['th']);  
});  
/* Turkish initialisation for the jQuery UI date picker plugin. */  
/* Written by Izzet Emre Erkan (kara@karalamalar.net). */  
jQuery(function($){  
$.datepicker.regional['tr'] = {clearText: 'temizle', clearStatus: 'geçerli tarihi temizler',  
closeText: 'kapat', closeStatus: 'sadece göstergeyi kapat',  
prevText: '&#x3c;geri', prevStatus: 'önceki ayı göster',  
nextText: 'ileri&#x3e', nextStatus: 'sonraki ayı göster',  
currentText: 'bugün', currentStatus: '',  
monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',  
'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],  
monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',  
'Tem','Ağu','Eyl','Eki','Kas','Ara'],  
monthStatus: 'başka ay', yearStatus: 'başka yıl',  
weekHeader: 'Hf', weekStatus: 'Ayın haftaları',  
dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],  
dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],  
dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],  
dayStatus: 'Haftanın ilk gününü belirleyin', dateStatus: 'D, M d seçiniz',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: 'Bir tarih seçiniz', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['tr']);  
});  
/* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */  
/* Written by Maxim Drogobitskiy (maxdao@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['uk'] = {clearText: 'Очистити', clearStatus: '',  
closeText: 'Закрити', closeStatus: '',  
prevText: '&lt;&lt;', prevStatus: '',  
nextText: '&gt;&gt;', nextStatus: '',  
currentText: 'Сьогодні', currentStatus: '',  
monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень',  
'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'],  
monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер',  
'Лип','Сер','Вер','Жов','Лис','Гру'],  
monthStatus: '', yearStatus: '',  
weekHeader: 'Не', weekStatus: '',  
dayNames: ['неділя','понеділок','вівторок','середа','четвер','пятниця','суббота'],  
dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],  
dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],  
dayStatus: 'DD', dateStatus: 'D, M d',  
dateFormat: 'dd.mm.yy', firstDay: 1,  
initStatus: '', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['uk']);  
});  
/* Chinese initialisation for the jQuery UI date picker plugin. */  
/* Written by Cloudream (cloudream@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['zh-CN'] = {clearText: '清除', clearStatus: '清除已选日期',  
closeText: '关闭', closeStatus: '不改变当前选择',  
prevText: '&lt;上月', prevStatus: '显示上月',  
nextText: '下月&gt;', nextStatus: '显示下月',  
currentText: '今天', currentStatus: '显示本月',  
monthNames: ['一月','二月','三月','四月','五月','六月',  
'七月','八月','九月','十月','十一月','十二月'],  
monthNamesShort: ['一','二','三','四','五','六',  
'七','八','九','十','十一','十二'],  
monthStatus: '选择月份', yearStatus: '选择年份',  
weekHeader: '周', weekStatus: '年内周次',  
dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],  
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],  
dayNamesMin: ['日','一','二','三','四','五','六'],  
dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD',  
dateFormat: 'yy-mm-dd', firstDay: 1,  
initStatus: '请选择日期', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['zh-CN']);  
});  
 
/* Chinese initialisation for the jQuery UI date picker plugin. */  
/* Written by Ressol (ressol@gmail.com). */  
jQuery(function($){  
$.datepicker.regional['zh-TW'] = {  
clearText: '清除', clearStatus: '清除已選日期',  
closeText: '關閉', closeStatus: '不改變目前的選擇',  
prevText: '&lt;上月', prevStatus: '顯示上月',  
nextText: '下月&gt;', nextStatus: '顯示下月',  
currentText: '今天', currentStatus: '顯示本月',  
monthNames: ['一月','二月','三月','四月','五月','六月',  
'七月','八月','九月','十月','十一月','十二月'],  
monthNamesShort: ['一','二','三','四','五','六',  
'七','八','九','十','十一','十二'],  
monthStatus: '選擇月份', yearStatus: '選擇年份',  
weekHeader: '周', weekStatus: '年內周次',  
dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],  
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],  
dayNamesMin: ['日','一','二','三','四','五','六'],  
dayStatus: '設定 DD 為一周起始', dateStatus: '選擇 m月 d日, DD',  
dateFormat: 'yy/mm/dd', firstDay: 1,  
initStatus: '請選擇日期', isRTL: false};  
$.datepicker.setDefaults($.datepicker.regional['zh-TW']);  
});  
 
/*  
http://www.JSON.org/json2.js  
2010-11-17  
 
Public Domain.  
 
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.  
 
See http://www.JSON.org/js.html  
 
 
This code should be minified before deployment.  
See http://javascript.crockford.com/jsmin.html  
 
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO  
NOT CONTROL.  
 
 
This file creates a global JSON object containing two methods: stringify  
and parse.  
 
JSON.stringify(value, replacer, space)  
value any JavaScript value, usually an object or array.  
 
replacer an optional parameter that determines how object  
values are stringified for objects. It can be a  
function or an array of strings.  
 
space an optional parameter that specifies the indentation  
of nested structures. If it is omitted, the text will  
be packed without extra whitespace. If it is a number,  
it will specify the number of spaces to indent at each  
level. If it is a string (such as '\t' or '&nbsp;'),  
it contains the characters used to indent at each level.  
 
This method produces a JSON text from a JavaScript value.  
 
When an object value is found, if the object contains a toJSON  
method, its toJSON method will be called and the result will be  
stringified. A toJSON method does not serialize: it returns the  
value represented by the name/value pair that should be serialized,  
or undefined if nothing should be serialized. The toJSON method  
will be passed the key associated with the value, and this will be  
bound to the value  
 
For example, this would serialize Dates as ISO strings.  
 
Date.prototype.toJSON = function (key) {  
function f(n) {  
// Format integers to have at least two digits.  
return n < 10 ? '0' + n : n;  
}  
 
return this.getUTCFullYear() + '-' +  
f(this.getUTCMonth() + 1) + '-' +  
f(this.getUTCDate()) + 'T' +  
f(this.getUTCHours()) + ':' +  
f(this.getUTCMinutes()) + ':' +  
f(this.getUTCSeconds()) + 'Z';  
};  
 
You can provide an optional replacer method. It will be passed the  
key and value of each member, with this bound to the containing  
object. The value that is returned from your method will be  
serialized. If your method returns undefined, then the member will  
be excluded from the serialization.  
 
If the replacer parameter is an array of strings, then it will be  
used to select the members to be serialized. It filters the results  
such that only members with keys listed in the replacer array are  
stringified.  
 
Values that do not have JSON representations, such as undefined or  
functions, will not be serialized. Such values in objects will be  
dropped; in arrays they will be replaced with null. You can use  
a replacer function to replace those with JSON values.  
JSON.stringify(undefined) returns undefined.  
 
The optional space parameter produces a stringification of the  
value that is filled with line breaks and indentation to make it  
easier to read.  
 
If the space parameter is a non-empty string, then that string will  
be used for indentation. If the space parameter is a number, then  
the indentation will be that many spaces.  
 
Example:  
 
text = JSON.stringify(['e', {pluribus: 'unum'}]);  
// text is '["e",{"pluribus":"unum"}]'  
 
 
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');  
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'  
 
text = JSON.stringify([new Date()], function (key, value) {  
return this[key] instanceof Date ?  
'Date(' + this[key] + ')' : value;  
});  
// text is '["Date(---current time---)"]'  
 
 
JSON.parse(text, reviver)  
This method parses a JSON text to produce an object or array.  
It can throw a SyntaxError exception.  
 
The optional reviver parameter is a function that can filter and  
transform the results. It receives each of the keys and values,  
and its return value is used instead of the original value.  
If it returns what it received, then the structure is not modified.  
If it returns undefined then the member is deleted.  
 
Example:  
 
// Parse the text. Values that look like ISO date strings will  
// be converted to Date objects.  
 
myData = JSON.parse(text, function (key, value) {  
var a;  
if (typeof value === 'string') {  
a =  
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);  
if (a) {  
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],  
+a[5], +a[6]));  
}  
}  
return value;  
});  
 
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {  
var d;  
if (typeof value === 'string' &&  
value.slice(0, 5) === 'Date(' &&  
value.slice(-1) === ')') {  
d = new Date(value.slice(5, -1));  
if (d) {  
return d;  
}  
}  
return value;  
});  
 
 
This is a reference implementation. You are free to copy, modify, or  
redistribute.  
*/  
 
/*jslint evil: true, strict: false, regexp: false */  
 
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,  
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,  
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,  
lastIndex, length, parse, prototype, push, replace, slice, stringify,  
test, toJSON, toString, valueOf  
*/  
 
 
// Create a JSON object only if one does not already exist. We create the  
// methods in a closure to avoid creating global variables.  
 
if (!this.JSON) {  
this.JSON = {};  
}  
 
(function () {  
"use strict";  
 
function f(n) {  
// Format integers to have at least two digits.  
return n < 10 ? '0' + n : n;  
}  
 
if (typeof Date.prototype.toJSON !== 'function') {  
 
Date.prototype.toJSON = function (key) {  
 
return isFinite(this.valueOf()) ?  
this.getUTCFullYear() + '-' +  
f(this.getUTCMonth() + 1) + '-' +  
f(this.getUTCDate()) + 'T' +  
f(this.getUTCHours()) + ':' +  
f(this.getUTCMinutes()) + ':' +  
f(this.getUTCSeconds()) + 'Z' : null;  
};  
 
String.prototype.toJSON =  
Number.prototype.toJSON =  
Boolean.prototype.toJSON = function (key) {  
return this.valueOf();  
};  
}  
 
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,  
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,  
gap,  
indent,  
meta = { // table of character substitutions  
'\b': '\\b',  
'\t': '\\t',  
'\n': '\\n',  
'\f': '\\f',  
'\r': '\\r',  
'"' : '\\"',  
'\\': '\\\\'  
},  
rep;  
 
 
function quote(string) {  
 
// If the string contains no control characters, no quote characters, and no  
// backslash characters, then we can safely slap some quotes around it.  
// Otherwise we must also replace the offending characters with safe escape  
// sequences.  
 
escapable.lastIndex = 0;  
return escapable.test(string) ?  
'"' + string.replace(escapable, function (a) {  
var c = meta[a];  
return typeof c === 'string' ? c :  
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);  
}) + '"' :  
'"' + string + '"';  
}  
 
 
function str(key, holder) {  
 
// Produce a string from holder[key].  
 
var i, // The loop counter.  
k, // The member key.  
v, // The member value.  
length,  
mind = gap,  
partial,  
value = holder[key];  
 
// If the value has a toJSON method, call it to obtain a replacement value.  
 
if (value && typeof value === 'object' &&  
typeof value.toJSON === 'function') {  
value = value.toJSON(key);  
}  
 
// If we were called with a replacer function, then call the replacer to  
// obtain a replacement value.  
 
if (typeof rep === 'function') {  
value = rep.call(holder, key, value);  
}  
 
// What happens next depends on the value's type.  
 
switch (typeof value) {  
case 'string':  
return quote(value);  
 
case 'number':  
 
// JSON numbers must be finite. Encode non-finite numbers as null.  
 
return isFinite(value) ? String(value) : 'null';  
 
case 'boolean':  
case 'null':  
 
// If the value is a boolean or null, convert it to a string. Note:  
// typeof null does not produce 'null'. The case is included here in  
// the remote chance that this gets fixed someday.  
 
return String(value);  
 
// If the type is 'object', we might be dealing with an object or an array or  
// null.  
 
case 'object':  
 
// Due to a specification blunder in ECMAScript, typeof null is 'object',  
// so watch out for that case.  
 
if (!value) {  
return 'null';  
}  
 
// Make an array to hold the partial results of stringifying this object value.  
 
gap += indent;  
partial = [];  
 
// Is the value an array?  
 
if (Object.prototype.toString.apply(value) === '[object Array]') {  
 
// The value is an array. Stringify every element. Use null as a placeholder  
// for non-JSON values.  
 
length = value.length;  
for (i = 0; i < length; i += 1) {  
partial[i] = str(i, value) || 'null';  
}  
 
// Join all of the elements together, separated with commas, and wrap them in  
// brackets.  
 
v = partial.length === 0 ? '[]' :  
gap ? '[\n' + gap +  
partial.join(',\n' + gap) + '\n' +  
mind + ']' :  
'[' + partial.join(',') + ']';  
gap = mind;  
return v;  
}  
 
// If the replacer is an array, use it to select the members to be stringified.  
 
if (rep && typeof rep === 'object') {  
length = rep.length;  
for (i = 0; i < length; i += 1) {  
k = rep[i];  
if (typeof k === 'string') {  
v = str(k, value);  
if (v) {  
partial.push(quote(k) + (gap ? ': ' : ':') + v);  
}  
}  
}  
} else {  
 
// Otherwise, iterate through all of the keys in the object.  
 
for (k in value) {  
if (Object.hasOwnProperty.call(value, k)) {  
v = str(k, value);  
if (v) {  
partial.push(quote(k) + (gap ? ': ' : ':') + v);  
}  
}  
}  
}  
 
// Join all of the member texts together, separated with commas,  
// and wrap them in braces.  
 
v = partial.length === 0 ? '{}' :  
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +  
mind + '}' : '{' + partial.join(',') + '}';  
gap = mind;  
return v;  
}  
}  
 
// If the JSON object does not yet have a stringify method, give it one.  
 
if (typeof JSON.stringify !== 'function') {  
JSON.stringify = function (value, replacer, space) {  
 
// The stringify method takes a value and an optional replacer, and an optional  
// space parameter, and returns a JSON text. The replacer can be a function  
// that can replace values, or an array of strings that will select the keys.  
// A default replacer method can be provided. Use of the space parameter can  
// produce text that is more easily readable.  
 
var i;  
gap = '';  
indent = '';  
 
// If the space parameter is a number, make an indent string containing that  
// many spaces.  
 
if (typeof space === 'number') {  
for (i = 0; i < space; i += 1) {  
indent += ' ';  
}  
 
// If the space parameter is a string, it will be used as the indent string.  
 
} else if (typeof space === 'string') {  
indent = space;  
}  
 
// If there is a replacer, it must be a function or an array.  
// Otherwise, throw an error.  
 
rep = replacer;  
if (replacer && typeof replacer !== 'function' &&  
(typeof replacer !== 'object' ||  
typeof replacer.length !== 'number')) {  
throw new Error('JSON.stringify');  
}  
 
// Make a fake root object containing our value under the key of ''.  
// Return the result of stringifying the value.  
 
return str('', {'': value});  
};  
}  
 
 
// If the JSON object does not yet have a parse method, give it one.  
 
if (typeof JSON.parse !== 'function') {  
JSON.parse = function (text, reviver) {  
 
// The parse method takes a text and an optional reviver function, and returns  
// a JavaScript value if the text is a valid JSON text.  
 
var j;  
 
function walk(holder, key) {  
 
// The walk method is used to recursively walk the resulting structure so  
// that modifications can be made.  
 
var k, v, value = holder[key];  
if (value && typeof value === 'object') {  
for (k in value) {  
if (Object.hasOwnProperty.call(value, k)) {  
v = walk(value, k);  
if (v !== undefined) {  
value[k] = v;  
} else {  
delete value[k];  
}  
}  
}  
}  
return reviver.call(holder, key, value);  
}  
 
 
// Parsing happens in four stages. In the first stage, we replace certain  
// Unicode characters with escape sequences. JavaScript handles many characters  
// incorrectly, either silently deleting them, or treating them as line endings.  
 
text = String(text);  
cx.lastIndex = 0;  
if (cx.test(text)) {  
text = text.replace(cx, function (a) {  
return '\\u' +  
('0000' + a.charCodeAt(0).toString(16)).slice(-4);  
});  
}  
 
// In the second stage, we run the text against regular expressions that look  
// for non-JSON patterns. We are especially concerned with '()' and 'new'  
// because they can cause invocation, and '=' because it can cause mutation.  
// But just to be safe, we want to reject all unexpected forms.  
 
// We split the second stage into 4 regexp operations in order to work around  
// crippling inefficiencies in IE's and Safari's regexp engines. First we  
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we  
// replace all simple value tokens with ']' characters. Third, we delete all  
// open brackets that follow a colon or comma or that begin the text. Finally,  
// we look to see that the remaining characters are only whitespace or ']' or  
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.  
 
if (/^[\],:{}\s]*$/  
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')  
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')  
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {  
 
// In the third stage we use the eval function to compile the text into a  
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity  
// in JavaScript: it can begin a block or an object literal. We wrap the text  
// in parens to eliminate the ambiguity.  
 
j = eval('(' + text + ')');  
 
// In the optional fourth stage, we recursively walk the new structure, passing  
// each name/value pair to a reviver function for possible transformation.  
 
return typeof reviver === 'function' ?  
walk({'': j}, '') : j;  
}  
 
// If the text is not JSON parseable, then a SyntaxError is thrown.  
 
throw new SyntaxError('JSON.parse');  
};  
}  
}());  
LazyLoad=function(){var f=document,g,b={},e={css:[],js:[]},a;function j(l,k){var m=f.createElement(l),d;for(d in k){if(k.hasOwnProperty(d)){m.setAttribute(d,k[d])}}return m}function h(d){var l=b[d];if(!l){return}var m=l.callback,k=l.urls;k.shift();if(!k.length){if(m){m.call(l.scope||window,l.obj)}b[d]=null;if(e[d].length){i(d)}}}function c(){if(a){return}var k=navigator.userAgent,l=parseFloat,d;a={gecko:0,ie:0,opera:0,webkit:0};d=k.match(/AppleWebKit\/(\S*)/);if(d&&d[1]){a.webkit=l(d[1])}else{d=k.match(/MSIE\s([^;]*)/);if(d&&d[1]){a.ie=l(d[1])}else{if((/Gecko\/(\S*)/).test(k)){a.gecko=1;d=k.match(/rv:([^\s\)]*)/);if(d&&d[1]){a.gecko=l(d[1])}}else{if(d=k.match(/Opera\/(\S*)/)){a.opera=l(d[1])}}}}}function i(r,q,s,m,t){var n,o,l,k,d;c();if(q){q=q.constructor===Array?q:[q];if(r==="css"||a.gecko||a.opera){e[r].push({urls:[].concat(q),callback:s,obj:m,scope:t})}else{for(n=0,o=q.length;n<o;++n){e[r].push({urls:[q[n]],callback:n===o-1?s:null,obj:m,scope:t})}}}if(b[r]||!(k=b[r]=e[r].shift())){return}g=g||f.getElementsByTagName("head")[0];q=k.urls;for(n=0,o=q.length;n<o;++n){d=q[n];if(r==="css"){l=j("link",{href:d,rel:"stylesheet",type:"text/css"})}else{l=j("script",{src:d})}if(a.ie){l.onreadystatechange=function(){var p=this.readyState;if(p==="loaded"||p==="complete"){this.onreadystatechange=null;h(r)}}}else{if(r==="css"&&(a.gecko||a.webkit)){setTimeout(function(){h(r)},50*o)}else{l.onload=l.onerror=function(){h(r)}}}g.appendChild(l)}}return{css:function(l,m,k,d){i("css",l,m,k,d)},js:function(l,m,k,d){i("js",l,m,k,d)}}}();  
/**  
*  
* URL encode / decode  
* http://www.webtoolkit.info/  
*  
*/  
 
var Url = {  
 
// public method for url encoding  
encode : function (string) {  
return escape(this._utf8_encode(string));  
},  
 
// public method for url decoding  
decode : function (string) {  
return this._utf8_decode(unescape(string));  
},  
 
// private method for UTF-8 encoding  
_utf8_encode : function (string) {  
string = string.replace(/\r\n/g,"\n");  
var utftext = "";  
 
for (var n = 0; n < string.length; n++) {  
 
var c = string.charCodeAt(n);  
 
if (c < 128) {  
utftext += String.fromCharCode(c);  
}  
else if((c > 127) && (c < 2048)) {  
utftext += String.fromCharCode((c >> 6) | 192);  
utftext += String.fromCharCode((c & 63) | 128);  
}  
else {  
utftext += String.fromCharCode((c >> 12) | 224);  
utftext += String.fromCharCode(((c >> 6) & 63) | 128);  
utftext += String.fromCharCode((c & 63) | 128);  
}  
 
}  
 
return utftext;  
},  
 
// private method for UTF-8 decoding  
_utf8_decode : function (utftext) {  
var string = "";  
var i = 0;  
var c = c1 = c2 = 0;  
 
while ( i < utftext.length ) {  
 
c = utftext.charCodeAt(i);  
 
if (c < 128) {  
string += String.fromCharCode(c);  
i++;  
}  
else if((c > 191) && (c < 224)) {  
c2 = utftext.charCodeAt(i+1);  
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));  
i += 2;  
}  
else {  
c2 = utftext.charCodeAt(i+1);  
c3 = utftext.charCodeAt(i+2);  
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));  
i += 3;  
}  
 
}  
 
return string;  
}  
 
}  
<?php  
// ...  
?>  
OWA.chart = function() {  
 
this.config = OWA.config;  
 
return;  
}  
 
OWA.chart.prototype = {  
 
properties: new Object,  
 
config: '',  
 
dom_id: '',  
 
data: '',  
 
height: "100%",  
 
width: "100%",  
 
render: function() {  
 
swfobject.embedSWF(this.config.modules_url + "base/js/includes/" + this.config.ofc_version + "/open-flash-chart.swf", this.dom_id, this.width, this.height, "9.0.0", "expressInstall.swf", {"get-data":"OWA.items['"+this.dom_id+"'].getData", id: this.dom_id});  
 
},  
 
getData: function() {  
 
//alert( 'reading data...obj' );  
return JSON.stringify(this.data);  
},  
 
setData: function(data) {  
 
this.data = data;  
return;  
},  
 
setHeight: function(height) {  
 
this.height = height;  
return;  
},  
 
setWidth: function(width) {  
 
this.width = width;  
return;  
},  
 
setDomId: function(dom_id) {  
 
this.dom_id = dom_id;  
return;  
}  
 
}  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Javascript Heatmap Library  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @web <a href="http://www.openwebanalytcs.com">Open Web Analytics</a>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
OWA.heatmap = function(w, h) {  
 
this.docDimensions = this.getDim(document);  
 
w = w || this.docDimensions.w;  
h = h || this.docDimensions.h;  
OWA.debug("Canvas size: %s by %s", w, h);  
this.createCanvas(w,h);  
this.canvas = document.getElementById('owa_heatmap');  
this.context = this.canvas.getContext('2d');  
this.calcRegions();  
 
};  
 
OWA.heatmap.prototype = {  
 
options: {  
dotSize: 12,  
numRegions: 40,  
alphaIncrement:50,  
demoMode: false,  
liveMode: false,  
mapInterval: 1000,  
randomDataCount: 200,  
rowsPerFetch: 100,  
strokeRegions: false,  
svgUrl: OWA.getSetting('baseUrl')+'/modules/base/i/test.svg#f1',  
baseUrl: '',  
apiUrl: ''  
},  
canvas: null,  
context: null,  
docDimensions: null,  
regions: new Array(),  
regionsMap: new Array(),  
regionWidth: null,  
regionHeight: null,  
dirtyRegions: new Object(),  
timer: '',  
clicks: '',  
nextPage: 1,  
more: true,  
lock: false,  
 
/**  
* Marks a region as dirty so that it can be re-rendered  
*/  
markRegionDirty: function(region_num) {  
if (region_num >= 0) {  
this.dirtyRegions[region_num] = true;  
OWA.debug("marking region dirty: %s", region_num);  
} else {  
OWA.debug("no region to mark dirty!");  
}  
},  
 
showControlPanel: function() {  
var that = this;  
jQuery('body').append('<div id="owa_overlay"></div>');  
jQuery('#owa_overlay').append('<div id="owa_overlay_logo"></div>');  
jQuery('#owa_overlay').append('<div class="owa_overlay_control" id="owa_overlay_start">Start</div>');  
jQuery('#owa_overlay_start').toggleClass('active');  
jQuery('#owa_overlay').append('<div class="owa_overlay_control" id="owa_overlay_stop">Stop</div>');  
jQuery('#owa_overlay').append('<div class="owa_overlay_control" id="owa_overlay_end">X</div>');  
jQuery('#owa_overlay_start').click(function(){that.startTimer()});  
jQuery('#owa_overlay_stop').click(function(){that.stopTimer()});  
jQuery('.owa_overlay_control').bind('click', function(){  
jQuery(".owa_overlay_control").removeClass('active');  
jQuery(this).addClass('active');  
});  
jQuery('#owa_overlay_end').click(function(){that.endSession()});  
//eliminate session cookie when window closes.  
jQuery(window).unload(function() {OWA.endOverlaySession()});  
},  
 
/**  
* Main generation method. kicks off the timer if in liveMode  
*/  
generate: function() {  
 
this.showControlPanel();  
this.applyBlur();  
 
if (this.options.liveMode === true) {  
 
this.startTimer();  
 
} else {  
 
this.map();  
}  
 
 
},  
 
endSession: function() {  
 
OWA.util.eraseCookie('owa_overlay', document.domain);  
window.close();  
},  
 
startTimer: function() {  
var that = this;  
this.timer = setInterval(function(){that.map()}, this.options.mapInterval);  
},  
 
stopTimer: function() {  
if (!this.timer) return false;  
clearInterval(this.timer);  
},  
 
/**  
* Gets data and plots it  
*/  
map: function() {  
 
if (this.lock == true) {  
OWA.debug("skipping data fetch due to lock.");  
return;  
} else {  
this.lock = true;  
}  
 
if (this.options.liveMode === true) {  
 
var more = this.checkForMoreClicks();  
if (more === true) {  
OWA.debug('there are more clicks to fetch.');  
var data = this.getData();  
} else {  
OWA.debug('there are no more clicks to fetch.');  
this.stopTimer();  
}  
} else {  
var data = this.getData();  
}  
},  
 
/**  
* Gets data, random if in demoMode  
*/  
getData: function() {  
 
// get data  
if (this.options.demoMode === true) {  
return this.getRandomData(this.options.randomDataCount);  
} else {  
var data = this.fetchData(this.getNextPage());  
 
return;  
}  
},  
 
checkForMoreClicks: function() {  
 
return this.more;  
},  
 
getNextPage: function() {  
 
return this.nextPage;  
},  
 
setNextPage: function(page) {  
OWA.debug("setNextpage received page as %d", page);  
this.nextPage++;  
OWA.debug("setNextpage is setting page as %d", this.nextPage);  
},  
 
setMore: function(bool) {  
 
this.more = bool;  
},  
 
/**  
* Fetches data via ajax request  
*/  
fetchData: function(page) {  
 
var p = OWA.util.readCookie('owa_overlay');  
//alert(unescape(p));  
var params = OWA.util.parseCookieStringToJson(p);  
//params.action = 'base.reportOverlay';  
//params.document_url = OWA.util.urlEncode(document.location);  
params.action = 'getDomClicks';  
params.pageUrl = OWA.util.urlEncode(document.location);  
//params.document_url = document.location;  
//OWA.debug('encoded url: '+OWA.util.urlEncode(document.location));  
params.resultsPerPage = this.options.rowsPerFetch;  
params.format = 'jsonp';  
 
// add page number if one was passed in  
if (page) {  
OWA.debug("fetchData will fetch page %s", page);  
params.page = page;  
}  
 
//closure  
var that = this;  
 
jQuery.ajax({  
url: OWA.getApiEndpoint(),  
data: OWA.util.nsParams(params),  
dataType: 'jsonp',  
jsonp: 'owa_jsonpCallback',  
success: function(data) {  
that.plotClickData(data);  
}  
});  
},  
 
plotClickData: function(data) {  
 
if (data) {  
//OWA.debug('setClicks says data is defined');  
this.clicks = data;  
 
//set more flag  
if (data.more === true && data.more != null) {  
OWA.debug("plotClickData says more flag was set to true");  
this.setMore(true);  
//set next page  
this.setNextPage(data.page);  
} else {  
OWA.debug("plotClickData says more flag was set to false");  
this.setMore(false);  
}  
 
//plot dots  
//this.plotDots(this.getClicks());  
this.plotDotsRound(this.getClicks());  
this.lock = false;  
return true;  
} else {  
return false;  
}  
 
},  
 
getClicks: function() {  
//OWA.debug("getClicks is logging %s", this.clicks['page']);  
return this.clicks.rows;  
},  
 
/**  
* Looks up the a region's top lower right corner plot points  
*/  
getRegion: function(num) {  
//OWA.debug("Getting dims for region %s", num);  
return this.regions[num];  
},  
 
/**  
* Sets the color of a pixels a region based on their alpha values  
*/  
setColor: function(num) {  
OWA.debug("About to set color for region %s", num);  
var dims = this.getRegion(num);  
OWA.debug("set color coords %s %s", dims.x, dims.y);  
 
// get the actual pixel data from the region  
var canvasData = this.context.getImageData(dims.x, dims.y, this.regionWidth, this.regionHeight);  
var pix = canvasData.data;  
 
// Loop over each pixel and invert the color.  
for (var i = 0, n = pix.length; i < n; i += 4) {  
var rgb = this.getRgbFromAlpha(pix[i+3]);  
pix[i ] = Math.round(parseInt(rgb.r)); // red  
pix[i+1] = Math.round(parseInt(rgb.g)); // green  
pix[i+2] = Math.round(parseInt(rgb.b)); // blue  
 
}  
 
// Draw the ImageData object at the given (x,y) coordinates.  
this.context.putImageData(canvasData,dims.x,dims.y);  
},  
 
getRgbFromAlpha : function(alpha) {  
 
var rgb = {'r': null, 'g': null, 'b': null};  
 
// set colors based on current alpha value  
if( alpha <= 255 && alpha >= 235 ){  
tmp = 255 - alpha;  
rgb.r = 255 - tmp;  
rgb.g = tmp * 12;  
} else if ( alpha <= 234 && alpha >= 200 ){  
tmp = 234 - alpha;  
rgb.r = 255 - ( tmp * 8 );  
rgb.g = 255;  
} else if ( alpha <= 199 && alpha >= 150 ){  
tmp = 199 - alpha;  
rgb.g = 255;  
rgb.b = tmp * 5;  
} else if ( alpha <= 149 && alpha >= 100 ){  
tmp = 149 - alpha;  
rgb.g = 255 - ( tmp * 5 );  
rgb.b = 255;  
} else {  
rgb.b = 255;  
}  
 
return rgb;  
},  
 
/**  
* Fills a region with grey  
* DEPRICATED  
*/  
fillRegion: function(num) {  
 
this.fillRectangle(this.regions[num].x, this.regions[num].y, this.regionWidth, this.regionHeight, "rgba(0,0,0, 0.5)");  
},  
 
strokeRegion: function(num) {  
 
this.context.strokeRect(this.regions[num].x, this.regions[num].y, this.regionWidth, this.regionHeight);  
 
},  
 
/**  
* Fills a rectangle with an rgba value  
*/  
fillRectangle: function(x,y,w,h,rgba) {  
 
this.context.fillStyle = rgba;  
this.context.fillRect(x, y, w, h);  
},  
 
/**  
* Fils all regions  
* DEPRICATED  
*/  
fillAllRegions: function() {  
 
for (var i=0, n = this.regions.length; i < n; i++) {  
//OWA.debug("region %s", i);  
this.fillRegion(i);  
}  
 
},  
 
/**  
* Find the region that a set of coordinates falls into  
*/  
findRegion: function(x, y) {  
x = parseFloat(x);  
y = parseFloat(y);  
// walk the outer x map in ascending order  
OWA.debug("finding region for %s", x,y);  
for (i in this.regionsMap) {  
// look for the first value that is greater that or equals to the x coordinate  
if (this.regionsMap.hasOwnProperty(i)) {  
OWA.debug("regionmap i: %s", i);  
if (x <= i) {  
// For that x coordinate walk the inner map in ascending order  
OWA.debug("regionmap x chosen: %s. x was: %s", i, x);  
for ( n in this.regionsMap[i]) {  
// find the first value that is greater than or equals to the y coordinate  
if (this.regionsMap[i].hasOwnProperty(n)) {  
//OWA.debug("what is this %s", n);  
if (y <= n) {  
// Return the region number  
OWA.debug("stopping on regionmap y: %s", n);  
OWA.debug("regionmap y: %s", n);  
OWA.debug("region chosen: %s (i = %s, n = %s)", this.regionsMap[i][n], i , n);  
return this.regionsMap[i][n];  
}  
}  
 
}  
}  
}  
}  
// Something went wrong as the coordinate does not fit into any region  
//OWA.debug("can't find region for %s %s", x, y);  
},  
 
/**  
* Chop the document up into a set of regions  
*/  
calcRegions: function() {  
 
// Calculate the region dimensions. This is controlled by the option numRegion.  
// More regions will increase the speed of rendering.  
this.regionWidth = Math.round((this.docDimensions.w / this.options.numRegions) * 100)/100;  
this.regionHeight = Math.round((this.docDimensions.h / this.options.numRegions) * 100)/100;  
OWA.debug("Region dims: %s %s", this.regionWidth, this.regionHeight);  
 
var count = 0;  
 
// y loop  
for (var y = this.regionHeight, n = this.docDimensions.h; y <= n; y+=this.regionHeight) {  
y = Math.round(y * 100)/100 -.00;  
OWA.debug("calcregions y value", y);  
// x loop  
for (var x = this.regionWidth, nn = this.docDimensions.w; x <= nn; x+=this.regionWidth) {  
x = Math.round(x * 100)/100 -.00;  
// add region  
this.regions[count] = {'x': x - this.regionWidth, 'y': y - this.regionHeight};  
//create inner y map  
if (!this.regionsMap[x]) {  
this.regionsMap[x] = Array();  
}  
//add region to inner map  
this.regionsMap[x][y] = count;  
//OWA.debug("adding to map: %s %s %s",x,y,count);  
 
if (this.options.strokeRegions === true) {  
this.strokeRegion(count);  
}  
 
count++;  
}  
 
//OWA.debug("x Count: %s", this.regions.length);  
}  
 
 
},  
 
/**  
* Generates random data  
* Takes an int  
*/  
getRandomData: function(count) {  
 
var data = Array();  
 
for (var li=0; li < count; li++) {  
var x = Math.round(Math.floor(Math.random()*(this.docDimensions.w-this.options.dotSize)));  
var y = Math.round(Math.floor(Math.random()*(this.docDimensions.h-this.options.dotSize)));  
 
data.push({'x':x,'y':y});  
}  
 
return data;  
},  
 
/**  
* Plots dots on a the canvas  
*  
*/  
plotDotsRound: function(data) {  
 
for( var i = 0; i < data.length; i++) {  
 
if ((data[i].x + this.options.dotSize) > this.docDimensions.w) {  
data[i].x = data[i].x - this.options.dotSize;  
}  
 
if ((data[i].y + this.options.dotSize) > this.docDimensions.h) {  
data[i].y = data[i].y - this.options.dotSize;  
}  
 
 
if ((data[i].x <= this.docDimensions.w) && (data[i].y <= this.docDimensions.h)) {  
OWA.debug("plotting %s %s", data[i].x, data[i].y);  
} else {  
OWA.debug("not getting image data. coordinates %s %s are outside the canvas", data[i].x, data[i].y);  
continue;  
}  
 
if ((data[i].x >= 0) && (data[i].y >= 0)) {  
OWA.debug("plotting %s %s", data[i].x, data[i].y);  
} else {  
OWA.debug("not getting image data. coordinates %s %s less than zero.", data[i].x, data[i].y);  
continue;  
}  
 
// create a radial gradient with the defined parameters. we want to draw an alphamap  
var rgr = this.context.createRadialGradient(data[i].x,data[i].y,7,data[i].x,data[i].y,this.options.dotSize);  
// the center of the radial gradient has .1 alpha value  
rgr.addColorStop(0, 'rgba(0,0,0,0.1)');  
// and it fades out to 0  
rgr.addColorStop(1, 'rgba(0,0,0,0)');  
// drawing the gradient  
this.context.fillStyle = rgr;  
this.context.fillRect(data[i].x-this.options.dotSize,data[i].y-this.options.dotSize,2*this.options.dotSize,2*this.options.dotSize);  
 
// mark region dirty  
this.markRegionDirty(this.findRegion(data[i].x,data[i].y));  
}  
// color dirty Regions  
this.processDirtyRegions();  
},  
 
processDirtyRegions: function() {  
 
for (i in this.dirtyRegions) {  
if (this.dirtyRegions.hasOwnProperty(i)) {  
this.setColor(i);  
}  
}  
 
this.dirtyRegions = new Array();  
 
},  
 
applyBlur: function() {  
 
// apply gausian blur  
 
this.canvas.className = 'owa_blur';  
},  
 
getDocHeight : function() {  
var D = document;  
return Math.max(  
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),  
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),  
Math.max(D.body.clientHeight, D.documentElement.clientHeight)  
);  
},  
 
getDim: function(d) {  
 
var w=200, h=200, scr_h, off_h;  
//OWA.setSetting('debug', true);  
if( d.height ) {  
//OWA.debug("doc dims %s %s", d.width, d.height);  
//return {'w':d.width,'h':d.height};  
}  
 
if( d.body ) {  
 
if( d.body.scrollHeight ) { h=scr_h=d.body.scrollHeight; w=d.body.scrollWidth; }  
if( d.body.offsetHeight ) { h=off_h=d.body.offsetHeight; w=d.body.offsetWidth; }  
if( scr_h && off_h ) h=Math.max(scr_h, off_h);  
}  
 
h = this.getDocHeight();  
OWA.debug("doc dims %s %s", w, h);  
 
return {'w': w,'h':h};  
},  
 
createCanvas: function(w, h) {  
 
var that = this;  
jQuery("body").append('<canvas id="owa_heatmap" width="'+w+'px" height="'+h+'px" style="position:absolute; top:0px; left:0px; z-index:99;padding:0; margin:0;background: rgba(127, 127, 127, 0.5);"></canvas>');  
},  
 
getDataPoints: function() {  
 
}  
 
}  
var OWA = {  
 
items: {},  
overlay: '',  
config: {  
ns: 'owa_',  
baseUrl: '',  
hashCookiesToDomain: true  
},  
state: {},  
overlayActive: false,  
 
// depricated  
setSetting: function(name, value) {  
return this.setOption(name, value);  
},  
// depricated  
getSetting: function(name) {  
return this.getOption(name);  
},  
 
setOption: function(name, value) {  
this.config[name] = value;  
},  
 
getOption: function(name) {  
return this.config[name];  
},  
 
initializeStateManager: function() {  
 
if ( ! this.state.hasOwnProperty('init') ) {  
 
OWA.debug('initializing state manager...');  
this.state = new OWA.stateManager();  
}  
},  
 
checkForState: function( store_name ) {  
 
this.initializeStateManager();  
return this.state.isPresent( store_name );  
},  
 
setState : function(store_name, key, value, is_perminant,format, expiration_days) {  
 
this.initializeStateManager();  
return this.state.set(store_name, key, value, is_perminant,format, expiration_days);  
},  
 
replaceState : function (store_name, value, is_perminant, format, expiration_days) {  
 
this.initializeStateManager();  
return this.state.replaceStore(store_name, value, is_perminant, format, expiration_days);  
},  
 
getStateFromCookie : function(store_name) {  
 
this.initializeStateManager();  
return this.state.getStateFromCookie(store_name);  
},  
 
getState : function(store_name, key) {  
 
this.initializeStateManager();  
return this.state.get(store_name, key);  
},  
 
clearState : function(store_name) {  
 
this.initializeStateManager();  
return this.state.clear(store_name);  
},  
 
getStateStoreFormat: function(store_name) {  
 
this.initializeStateManager();  
return this.state.getStoreFormat(store_name);  
},  
 
setStateStoreFormat: function(store_name, format) {  
 
this.initializeStateManager();  
return this.state.setStoreFormat(store_name, format);  
},  
 
debug: function() {  
 
var debugging = OWA.getSetting('debug') || false; // or true  
 
if ( debugging ) {  
 
if(window.console) {  
 
if (window.console.firebug) {  
console.log.apply(this, arguments);  
} else {  
console.log.apply(console, arguments);  
}  
}  
}  
},  
 
setApiEndpoint : function (endpoint) {  
this.config['api_endpoint'] = endpoint;  
},  
 
getApiEndpoint : function() {  
return this.config['api_endpoint'] || this.getSetting('baseUrl') + 'api.php';  
},  
 
loadHeatmap: function(p) {  
var that = this;  
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery-1.4.2.min.js', function(){});  
OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/owa.overlay.css', function(){});  
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/owa.heatmap.js', function(){  
that.overlay = new OWA.heatmap();  
//hm.setParams(p);  
//hm.options.demoMode = true;  
that.overlay.options.liveMode = true;  
that.overlay.generate();  
});  
},  
 
loadPlayer: function() {  
var that = this;  
OWA.debug("Loading Domstream Player");  
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery-1.4.2.min.js', function(){});  
OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/owa.overlay.css', function(){});  
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/owa.player.js', function(){  
that.overlay = new OWA.player();  
});  
},  
 
startOverlaySession: function(p) {  
 
// set global is overlay actve flag  
OWA.overlayActive = true;  
//alert(JSON.stringify(p));  
 
if (p.hasOwnProperty('api_url')) {  
 
OWA.setApiEndpoint(p.api_url);  
}  
 
// get param from cookie  
//var params = OWA.util.parseCookieStringToJson(p);  
var params = p;  
// evaluate the action param  
if (params.action === 'loadHeatmap') {  
this.loadHeatmap(p);  
} else if (params.action === 'loadPlayer') {  
this.loadPlayer(p);  
}  
 
},  
 
endOverlaySession : function() {  
 
OWA.util.eraseCookie('owa_overlay', document.domain);  
OWA.overlayActive = false;  
}  
 
 
}  
 
OWA.stateManager = function() {  
 
this.cookies = OWA.util.readAllCookies();  
this.init = true;  
};  
 
OWA.stateManager.prototype = {  
 
init: false,  
cookies: '',  
stores: {},  
storeFormats: {},  
 
isPresent: function( store_name ) {  
 
if ( this.stores.hasOwnProperty( store_name ) ) {  
return true;  
}  
},  
 
set: function(store_name, key, value, is_perminant,format, expiration_days) {  
 
if ( ! this.isPresent( store_name ) ) {  
this.load(store_name);  
}  
 
if ( ! this.isPresent( store_name ) ) {  
OWA.debug('Creating state store (%s)', store_name);  
this.stores[store_name] = {};  
// add cookie domain hash  
if (OWA.getSetting('hashCookiesToDomain')) {  
this.stores[store_name].cdh = OWA.util.getCookieDomainHash(OWA.getSetting('cookie_domain'));  
}  
}  
 
if ( key ) {  
this.stores[store_name][key] = value;  
} else {  
this.stores[store_name] = value;  
}  
 
if ( ! format ) {  
 
// check the orginal format that the state store was loaded from.  
if (this.storeFormats.hasOwnProperty(store_name)) {  
format = this.storeFormats[store_name];  
}  
}  
 
if (format === 'json') {  
state_value = JSON.stringify(this.stores[store_name]);  
} else {  
state_value = OWA.util.assocStringFromJson(this.stores[store_name]);  
}  
 
if ( ! expiration_days ) {  
 
if ( is_perminant ) {  
expiration_days = 3600;  
}  
}  
 
// set or reset the campaign cookie  
OWA.debug('Populating state store (%s) with value: %s', store_name, state_value);  
var domain = OWA.getSetting('cookie_domain') || document.domain;  
// erase cookie  
//OWA.util.eraseCookie( 'owa_'+store_name, domain );  
// set cookie  
OWA.util.setCookie( 'owa_'+store_name, state_value, expiration_days, '/', domain );  
},  
 
replaceStore : function (store_name, value, is_perminant, format, expiration_days) {  
 
OWA.debug('replace state format: %s, value: %s',format, JSON.stringify(value));  
if ( store_name ) {  
 
if (value) {  
 
this.stores[store_name] = value;  
this.storeFormats[store_name] = format;  
 
if (format === 'json') {  
cookie_value = JSON.stringify(value);  
} else {  
cookie_value = OWA.util.assocStringFromJson(value);  
}  
}  
 
var domain = OWA.getSetting('cookie_domain') || document.domain;  
 
if ( ! expiration_days ) {  
 
if ( is_perminant ) {  
expiration_days = 3600;  
}  
}  
OWA.debug('About to replace state store (%s) with: %s', store_name, cookie_value);  
OWA.util.setCookie( 'owa_'+ store_name, cookie_value, expiration_days, '/', domain );  
 
}  
},  
 
getStateFromCookie : function(store_name) {  
 
var store = unescape( OWA.util.readCookie( OWA.getSetting('ns') + store_name ) );  
if ( store ) {  
return store;  
}  
},  
 
get : function(store_name, key) {  
 
if ( ! this.isPresent( store_name ) ) {  
this.load(store_name);  
}  
 
if ( this.isPresent( store_name ) ) {  
if ( key ) {  
if ( this.stores[store_name].hasOwnProperty( key ) ) {  
return this.stores[store_name][key];  
}  
} else {  
return this.stores[store_name];  
}  
} else {  
OWA.debug('No state store (%s) was found', store_name);  
return '';  
}  
 
},  
 
getCookieValues: function(cookie_name) {  
 
if (this.cookies.hasOwnProperty(cookie_name)) {  
return this.cookies[cookie_name];  
}  
},  
 
load: function(store_name) {  
 
var state = '';  
var cookie_values = this.getCookieValues( OWA.getSetting('ns') + store_name );  
 
if (cookie_values) {  
 
for (var i=0;i < cookie_values.length;i++) {  
 
 
var raw_cookie_value = unescape( cookie_values[i] );  
var cookie_value = OWA.util.decodeCookieValue( raw_cookie_value );  
//OWA.debug(raw_cookie_value);  
var format = OWA.util.getCookieValueFormat( raw_cookie_value );  
 
if ( OWA.getSetting('hashCookiesToDomain') ) {  
var domain = OWA.getSetting('cookie_domain');  
var dhash = OWA.util.getCookieDomainHash(domain);  
 
if ( cookie_value.hasOwnProperty( 'cdh' ) ) {  
OWA.debug( 'Cookie value cdh: %s, domain hash: %s', cookie_value.cdh, dhash );  
if ( cookie_value.cdh == dhash ) {  
OWA.debug('Cookie: %s, index: %s domain hash matches current cookie domain. Loading...', store_name, i);  
state = cookie_value;  
break;  
} else {  
OWA.debug('Cookie: %s, index: %s domain hash does not match current cookie domain. Not loading.', store_name, i);  
}  
} else {  
//OWA.debug(cookie_value);  
OWA.debug('Cookie: %s, index: %s has no domain hash. Not going to Load it.', store_name, i);  
}  
 
} else {  
// just get the last cookie set by that name  
var lastIndex = cookie_values.length -1 ;  
if (i === lastIndex) {  
state = cookie_value;  
}  
}  
}  
}  
 
if ( state ) {  
this.stores[store_name] = state;  
this.storeFormats[store_name] = format;  
OWA.debug('Loaded state store: %s with: %s', store_name, JSON.stringify(state));  
} else {  
 
OWA.debug('No state for store: %s was found. Nothing to Load.', store_name);  
}  
},  
 
clear: function(store_name) {  
// delete cookie  
this.stores[store_name] = '';  
OWA.util.eraseCookie(OWA.getSetting('ns') + store_name);  
},  
 
getStoreFormat: function(store_name) {  
 
return this.storeFormats[store_name];  
},  
 
setStoreFormat: function(store_name, format) {  
 
this.storeFormats[store_name] = format;  
}  
};  
 
 
OWA.util = {  
 
ns: function(string) {  
 
return OWA.config.ns + string;  
 
},  
 
nsAll: function(obj) {  
 
var nsObj = new Object();  
 
for(param in obj) { // print out the params  
if (obj.hasOwnProperty(param)) {  
nsObj[OWA.config.ns+param] = obj[param];  
}  
}  
 
return nsObj;  
},  
 
getScript: function(file, path) {  
 
jQuery.getScript(path + file);  
 
return;  
 
},  
 
makeUrl: function(template, uri, params) {  
var url = jQuery.sprintf(template, uri, jQuery.param(OWA.util.nsAll(params)));  
//alert(url);  
return url;  
},  
 
createCookie: function (name,value,days,domain) {  
if (days) {  
var date = new Date();  
date.setTime(date.getTime()+(days*24*60*60*1000));  
var expires = "; expires="+date.toGMTString();  
}  
else var expires = "";  
document.cookie = name+"="+value+expires+"; path=/";  
},  
 
setCookie: function (name,value,days,path,domain,secure) {  
var date = new Date();  
date.setTime(date.getTime()+(days*24*60*60*1000));  
 
document.cookie = name + "=" + escape (value) +  
((days) ? "; expires=" + date.toGMTString() : "") +  
((path) ? "; path=" + path : "") +  
((domain) ? "; domain=" + domain : "") +  
((secure) ? "; secure" : "");  
},  
 
readAllCookies: function() {  
 
OWA.debug('Reading all cookies...');  
//var dhash = '';  
var jar = {};  
//var nameEQ = name + "=";  
var ca = document.cookie.split(';');  
 
if (ca) {  
OWA.debug(document.cookie);  
for(var i=0;i < ca.length;i++) {  
 
cat = OWA.util.trim(ca[i]);  
var pos = OWA.util.strpos(cat, '=');  
var key = cat.substring(0,pos);  
var value = cat.substring(pos+1, cat.length);  
//OWA.debug('key %s, value %s', key, value);  
// create cookie jar array for that key  
// this is needed because you can have multiple cookies with the same name  
if ( ! jar.hasOwnProperty(key) ) {  
jar[key] = [];  
}  
// add the value to the array  
jar[key].push(value);  
}  
 
OWA.debug(JSON.stringify(jar));  
return jar;  
}  
},  
 
/**  
* Reads and returns values from cookies.  
*  
* NOTE: this function returns an array of values as there can be  
* more than one cookie with the same name.  
*  
* @return array  
*/  
readCookie: function (name) {  
OWA.debug('Attempting to read cookie: %s', name);  
var jar = OWA.util.readAllCookies();  
if ( jar ) {  
if ( jar.hasOwnProperty(name) ) {  
return jar[name];  
} else {  
return '';  
}  
}  
},  
 
eraseCookie: function (name, domain) {  
OWA.debug(document.cookie);  
if ( ! domain ) {  
domain = OWA.getSetting('cookie_domain') || document.domain;  
}  
OWA.debug("erasing cookie: " + name + " in domain: " +domain);  
this.setCookie(name,"",-1,"/",domain);  
// attempt to read the cookie again to see if its there under another valid domain  
var test = OWA.util.readCookie(name);  
// if so then try the alternate domain  
if (test) {  
 
var period = domain.substr(0,1);  
OWA.debug('period: '+period);  
if (period === '.') {  
var domain2 = domain.substr(1);  
OWA.debug("erasing " + name + " in domain2: " + domain2);  
this.setCookie(name,"",-2,"/", domain2);  
 
 
} else {  
// domain = '.'+ domain  
OWA.debug("erasing " + name + " in domain3: " + domain);  
this.setCookie(name,"",-2,"/",domain);  
}  
//OWA.debug("erasing " + name + " in domain: ");  
//this.setCookie(name,"",-2,"/");  
}  
 
},  
 
eraseMultipleCookies: function(names, domain) {  
 
for (var i=0; i < names.length; i++) {  
this.eraseCookie(names[i], domain);  
}  
},  
 
loadScript: function (url, callback){  
 
return LazyLoad.js(url, callback);  
},  
 
loadCss: function (url, callback){  
 
return LazyLoad.css(url, callback);  
},  
 
parseCookieString: function parseQuery(v) {  
var queryAsAssoc = new Array();  
var queryString = unescape(v);  
var keyValues = queryString.split("|||");  
//alert(keyValues);  
for (var i in keyValues) {  
if (keyValues.hasOwnProperty(i)) {  
var key = keyValues[i].split("=>");  
queryAsAssoc[key[0]] = key[1];  
}  
//alert(key[0] +"="+ key[1]);  
}  
 
return queryAsAssoc;  
},  
 
parseCookieStringToJson: function parseQuery(v) {  
var queryAsObj = new Object;  
var queryString = unescape(v);  
var keyValues = queryString.split("|||");  
//alert(keyValues);  
for (var i in keyValues) {  
if (keyValues.hasOwnProperty(i)) {  
var key = keyValues[i].split("=>");  
queryAsObj[key[0]] = key[1];  
//alert(key[0] +"="+ key[1]);  
}  
}  
//alert (queryAsObj.period);  
return queryAsObj;  
},  
 
nsParams: function(obj) {  
var new_obj = new Object;  
 
for(param in obj) {  
if (obj.hasOwnProperty(param)) {  
new_obj['owa_'+ param] = obj[param];  
}  
}  
 
return new_obj;  
},  
 
urlEncode : function(str) {  
// URL-encodes string  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/urlencode  
// + original by: Philip Peterson  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: AJ  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: travc  
// + input by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Lars Fischer  
// + input by: Ratheous  
// + reimplemented by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Joris  
// + reimplemented by: Brett Zamir (http://brett-zamir.me)  
// % note 1: This reflects PHP 5.3/6.0+ behavior  
// % note 2: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on  
// % note 2: pages served as UTF-8  
// * example 1: urlencode('Kevin van Zonneveld!');  
// * returns 1: 'Kevin+van+Zonneveld%21'  
// * example 2: urlencode('http://kevin.vanzonneveld.net/');  
// * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'  
// * example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');  
// * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'  
str = (str+'').toString();  
 
// Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current  
// PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.  
return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');  
 
},  
 
urldecode : function (str) {  
// Decodes URL-encoded string  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/urldecode  
// + original by: Philip Peterson  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: AJ  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Brett Zamir (http://brett-zamir.me)  
// + input by: travc  
// + input by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Lars Fischer  
// + input by: Ratheous  
// + improved by: Orlando  
// + reimplemented by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Rob  
// % note 1: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/  
// % note 2: Please be aware that this function expects to decode from UTF-8 encoded strings, as found on  
// % note 2: pages served as UTF-8  
// * example 1: urldecode('Kevin+van+Zonneveld%21');  
// * returns 1: 'Kevin van Zonneveld!'  
// * example 2: urldecode('http%3A%2F%2Fkevin.vanzonneveld.net%2F');  
// * returns 2: 'http://kevin.vanzonneveld.net/'  
// * example 3: urldecode('http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a');  
// * returns 3: 'http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'  
 
return decodeURIComponent(str.replace(/\+/g, '%20'));  
},  
 
parseUrlParams : function(url) {  
 
var _GET = {};  
for(var i,a,m,n,o,v,p=location.href.split(/[?&]/),l=p.length,k=1;k<l;k++)  
if( (m=p[k].match(/(.*?)(\..*?|\[.*?\])?=([^#]*)/)) && m.length==4){  
n=decodeURI(m[1]).toLowerCase(),o=_GET,v=decodeURI(m[3]);  
if(m[2])  
for(a=decodeURI(m[2]).replace(/\[\s*\]/g,"[-1]").split(/[\.\[\]]/),i=0;i<a.length;i++)  
o=o[n]?o[n]:o[n]=(parseInt(a[i])==a[i])?[]:{}, n=a[i].replace(/^["\'](.*)["\']$/,"$1");  
n!='-1'?o[n]=v:o[o.length]=v;  
}  
 
return _GET;  
},  
 
strpos : function(haystack, needle, offset) {  
// Finds position of first occurrence of a string within another  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/strpos  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Onno Marsman  
// + bugfixed by: Daniel Esteban  
// + improved by: Brett Zamir (http://brett-zamir.me)  
// * example 1: strpos('Kevin van Zonneveld', 'e', 5);  
// * returns 1: 14  
var i = (haystack+'').indexOf(needle, (offset || 0));  
return i === -1 ? false : i;  
},  
 
strCountOccurances : function(haystack, needle) {  
return haystack.split(needle).length - 1;  
},  
 
implode : function(glue, pieces) {  
// Joins array elements placing glue string between items and return one string  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/implode  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Waldo Malqui Silva  
// + improved by: Itsacon (http://www.itsacon.net/)  
// + bugfixed by: Brett Zamir (http://brett-zamir.me)  
// * example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);  
// * returns 1: 'Kevin van Zonneveld'  
// * example 2: implode(' ', {first:'Kevin', last: 'van Zonneveld'});  
// * returns 2: 'Kevin van Zonneveld'  
var i = '', retVal='', tGlue='';  
if (arguments.length === 1) {  
pieces = glue;  
glue = '';  
}  
if (typeof(pieces) === 'object') {  
if (pieces instanceof Array) {  
return pieces.join(glue);  
}  
else {  
for (i in pieces) {  
retVal += tGlue + pieces[i];  
tGlue = glue;  
}  
return retVal;  
}  
}  
else {  
return pieces;  
}  
},  
 
checkForState: function( store_name ) {  
 
return OWA.checkForState( store_name );  
},  
 
setState : function(store_name, key, value, is_perminant,format, expiration_days) {  
 
return OWA.setState(store_name, key, value, is_perminant,format, expiration_days);  
},  
 
replaceState : function (store_name, value, is_perminant, format, expiration_days) {  
 
return OWA.replaceState(store_name, value, is_perminant, format, expiration_days);  
},  
 
getRawState : function(store_name) {  
 
return OWA.getStateFromCookie(store_name);  
},  
 
getState : function(store_name, key) {  
 
return OWA.getState(store_name, key);  
},  
 
clearState : function(store_name) {  
 
return OWA.clearState(store_name);  
},  
 
getCookieValueFormat : function(cstring) {  
var format = '';  
var check = cstring.substr(0,1);  
if (check === '{') {  
format = 'json';  
} else {  
format = 'assoc';  
}  
 
return format;  
},  
 
decodeCookieValue : function(string) {  
 
var format = OWA.util.getCookieValueFormat(string);  
var value = '';  
//OWA.debug('decodeCookieValue - string: %s, format: %s', string, format);  
if (format === 'json') {  
value = JSON.parse(string);  
 
} else {  
value = OWA.util.jsonFromAssocString(string);  
}  
OWA.debug('decodeCookieValue - string: %s, format: %s, value: %s', string, format, JSON.stringify(value));  
return value;  
},  
 
encodeJsonForCookie : function(json_obj, format) {  
 
format = format || 'assoc';  
 
if (format === 'json') {  
return JSON.stringify(json_obj);  
} else {  
return OWA.util.assocStringFromJson(json_obj);  
}  
},  
 
getCookieDomainHash: function(domain) {  
// must be string  
return OWA.util.dechex(OWA.util.crc32(domain));  
},  
 
loadStateJson : function(store_name) {  
var store = unescape(OWA.util.readCookie( OWA.getSetting('ns') + store_name ) );  
if (store) {  
state = JSON.parse(store);  
}  
OWA.state[store_name] = state;  
OWA.debug('state store %s: %s', store_name, JSON.stringify(state));  
},  
 
is_array : function (input) {  
return typeof(input)=='object'&&(input instanceof Array);  
},  
 
// Returns true if variable is an object  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/is_object  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Legaev Andrey  
// + improved by: Michael White (http://getsprink.com)  
// * example 1: is_object('23');  
// * returns 1: false  
// * example 2: is_object({foo: 'bar'});  
// * returns 2: true  
// * example 3: is_object(null);  
// * returns 3: false  
is_object : function (mixed_var) {  
 
if (mixed_var instanceof Array) {  
return false;  
} else {  
return (mixed_var !== null) && (typeof( mixed_var ) == 'object');  
}  
},  
 
countObjectProperties : function( obj ) {  
 
var size = 0, key;  
for (key in obj) {  
if (obj.hasOwnProperty(key)) size++;  
}  
return size;  
},  
 
jsonFromAssocString : function(str, inner, outer) {  
 
inner = inner || '=>';  
outer = outer || '|||';  
 
if (str){  
 
if (!this.strpos(str, inner)) {  
 
return str;  
 
} else {  
 
var assoc = {};  
outer_array = str.split(outer);  
//OWA.debug('outer array: %s', JSON.stringify(outer_array));  
for (var i = 0, n = outer_array.length; i < n; i++) {  
 
var inside_array = outer_array[i].split(inner);  
 
assoc[inside_array[0]] = inside_array[1];  
}  
}  
 
//OWA.debug('jsonFromAssocString: ' + JSON.stringify(assoc));  
return assoc;  
}  
},  
 
assocStringFromJson : function(obj) {  
 
var string = '';  
var i = 0;  
var count = OWA.util.countObjectProperties(obj);  
 
for (prop in obj) {  
i++;  
string += prop + '=>' + obj[prop];  
 
if (i < count) {  
string += '|||';  
}  
}  
//OWA.debug('OWA.util.assocStringFromJson: %s', string);  
return string;  
 
},  
 
getDomainFromUrl : function (url, strip_www) {  
 
var domain = url.split(/\/+/g)[1];  
 
if (strip_www === true) {  
var fp = domain.split('.')[0];  
 
if (fp === 'www') {  
return domain.substring(4);  
} else {  
return domain;  
}  
 
} else {  
return domain;  
}  
},  
 
getCurrentUnixTimestamp : function() {  
return Math.round(new Date().getTime() / 1000);  
},  
 
generateHash : function(value) {  
 
return this.crc32(value);  
},  
 
generateRandomGuid : function(salt) {  
var time = this.getCurrentUnixTimestamp();  
var random = this.rand();  
return this.generateHash(time + random + salt);  
},  
 
crc32 : function ( str ) {  
// Calculate the crc32 polynomial of a string  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/crc32  
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)  
// + improved by: T0bsn  
// - depends on: utf8_encode  
// * example 1: crc32('Kevin van Zonneveld');  
// * returns 1: 1249991249  
str = this.utf8_encode(str);  
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";  
 
var crc = 0;  
var x = 0;  
var y = 0;  
 
crc = crc ^ (-1);  
for (var i = 0, iTop = str.length; i < iTop; i++) {  
y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;  
x = "0x" + table.substr( y * 9, 8 );  
crc = ( crc >>> 8 ) ^ x;  
}  
 
return crc ^ (-1);  
},  
 
utf8_encode : function ( argString ) {  
// Encodes an ISO-8859-1 string to UTF-8  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/utf8_encode  
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: sowberry  
// + tweaked by: Jack  
// + bugfixed by: Onno Marsman  
// + improved by: Yves Sucaet  
// + bugfixed by: Onno Marsman  
// + bugfixed by: Ulrich  
// * example 1: utf8_encode('Kevin van Zonneveld');  
// * returns 1: 'Kevin van Zonneveld'  
var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");  
 
var utftext = "";  
var start, end;  
var stringl = 0;  
 
start = end = 0;  
stringl = string.length;  
for (var n = 0; n < stringl; n++) {  
var c1 = string.charCodeAt(n);  
var enc = null;  
 
if (c1 < 128) {  
end++;  
} else if (c1 > 127 && c1 < 2048) {  
enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);  
} else {  
enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);  
}  
if (enc !== null) {  
if (end > start) {  
utftext += string.substring(start, end);  
}  
utftext += enc;  
start = end = n+1;  
}  
}  
 
if (end > start) {  
utftext += string.substring(start, string.length);  
}  
 
return utftext;  
},  
 
utf8_decode : function( str_data ) {  
// Converts a UTF-8 encoded string to ISO-8859-1  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/utf8_decode  
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)  
// + input by: Aman Gupta  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: Norman "zEh" Fuchs  
// + bugfixed by: hitwork  
// + bugfixed by: Onno Marsman  
// + input by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// * example 1: utf8_decode('Kevin van Zonneveld');  
// * returns 1: 'Kevin van Zonneveld'  
var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;  
 
str_data += '';  
 
while ( i < str_data.length ) {  
c1 = str_data.charCodeAt(i);  
if (c1 < 128) {  
tmp_arr[ac++] = String.fromCharCode(c1);  
i++;  
} else if ((c1 > 191) && (c1 < 224)) {  
c2 = str_data.charCodeAt(i+1);  
tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));  
i += 2;  
} else {  
c2 = str_data.charCodeAt(i+1);  
c3 = str_data.charCodeAt(i+2);  
tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));  
i += 3;  
}  
}  
 
return tmp_arr.join('');  
},  
 
trim : function (str, charlist) {  
// Strips whitespace from the beginning and end of a string  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/trim  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: mdsjack (http://www.mdsjack.bo.it)  
// + improved by: Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev)  
// + input by: Erkekjetter  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: DxGx  
// + improved by: Steven Levithan (http://blog.stevenlevithan.com)  
// + tweaked by: Jack  
// + bugfixed by: Onno Marsman  
// * example 1: trim(' Kevin van Zonneveld ');  
// * returns 1: 'Kevin van Zonneveld'  
// * example 2: trim('Hello World', 'Hdle');  
// * returns 2: 'o Wor'  
// * example 3: trim(16, 1);  
// * returns 3: 6  
var whitespace, l = 0, i = 0;  
str += '';  
 
if (!charlist) {  
// default list  
whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";  
} else {  
// preg_quote custom list  
charlist += '';  
whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');  
}  
 
l = str.length;  
for (i = 0; i < l; i++) {  
if (whitespace.indexOf(str.charAt(i)) === -1) {  
str = str.substring(i);  
break;  
}  
}  
 
l = str.length;  
for (i = l - 1; i >= 0; i--) {  
if (whitespace.indexOf(str.charAt(i)) === -1) {  
str = str.substring(0, i + 1);  
break;  
}  
}  
 
return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';  
},  
 
rand : function(min, max) {  
// Returns a random number  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/rand  
// + original by: Leslie Hoare  
// + bugfixed by: Onno Marsman  
// * example 1: rand(1, 1);  
// * returns 1: 1  
 
var argc = arguments.length;  
if (argc === 0) {  
min = 0;  
max = 2147483647;  
} else if (argc === 1) {  
throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');  
}  
return Math.floor(Math.random() * (max - min + 1)) + min;  
},  
 
base64_encode: function (data) {  
// Encodes string using MIME base64 algorithm  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/base64_encode  
// + original by: Tyler Akins (http://rumkin.com)  
// + improved by: Bayron Guevara  
// + improved by: Thunder.m  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + bugfixed by: Pellentesque Malesuada  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// - depends on: utf8_encode  
// * example 1: base64_encode('Kevin van Zonneveld');  
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='  
// mozilla has this native  
// - but breaks in 2.0.0.12!  
//if (typeof this.window['atob'] == 'function') {  
// return atob(data);  
//}  
 
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";  
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = [];  
 
if (!data) {  
return data;  
}  
 
data = this.utf8_encode(data+'');  
 
do { // pack three octets into four hexets  
o1 = data.charCodeAt(i++);  
o2 = data.charCodeAt(i++);  
o3 = data.charCodeAt(i++);  
 
bits = o1<<16 | o2<<8 | o3;  
 
h1 = bits>>18 & 0x3f;  
h2 = bits>>12 & 0x3f;  
h3 = bits>>6 & 0x3f;  
h4 = bits & 0x3f;  
 
// use hexets to index into b64, and append result to encoded string  
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);  
} while (i < data.length);  
 
enc = tmp_arr.join('');  
 
switch (data.length % 3) {  
case 1:  
enc = enc.slice(0, -2) + '==';  
break;  
case 2:  
enc = enc.slice(0, -1) + '=';  
break;  
}  
 
return enc;  
},  
 
base64_decode: function (data) {  
// Decodes string using MIME base64 algorithm  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/base64_decode  
// + original by: Tyler Akins (http://rumkin.com)  
// + improved by: Thunder.m  
// + input by: Aman Gupta  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + bugfixed by: Onno Marsman  
// + bugfixed by: Pellentesque Malesuada  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: Brett Zamir (http://brett-zamir.me)  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// - depends on: utf8_decode  
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');  
// * returns 1: 'Kevin van Zonneveld'  
// mozilla has this native  
// - but breaks in 2.0.0.12!  
//if (typeof this.window['btoa'] == 'function') {  
// return btoa(data);  
//}  
 
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";  
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, dec = "", tmp_arr = [];  
 
if (!data) {  
return data;  
}  
 
data += '';  
 
do { // unpack four hexets into three octets using index points in b64  
h1 = b64.indexOf(data.charAt(i++));  
h2 = b64.indexOf(data.charAt(i++));  
h3 = b64.indexOf(data.charAt(i++));  
h4 = b64.indexOf(data.charAt(i++));  
 
bits = h1<<18 | h2<<12 | h3<<6 | h4;  
 
o1 = bits>>16 & 0xff;  
o2 = bits>>8 & 0xff;  
o3 = bits & 0xff;  
 
if (h3 == 64) {  
tmp_arr[ac++] = String.fromCharCode(o1);  
} else if (h4 == 64) {  
tmp_arr[ac++] = String.fromCharCode(o1, o2);  
} else {  
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);  
}  
} while (i < data.length);  
 
dec = tmp_arr.join('');  
dec = this.utf8_decode(dec);  
 
return dec;  
},  
 
sprintf : function( ) {  
// Return a formatted string  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/sprintf  
// + original by: Ash Searle (http://hexmen.com/blog/)  
// + namespaced by: Michael White (http://getsprink.com)  
// + tweaked by: Jack  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: Paulo Freitas  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + input by: Brett Zamir (http://brett-zamir.me)  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// * example 1: sprintf("%01.2f", 123.1);  
// * returns 1: 123.10  
// * example 2: sprintf("[%10s]", 'monkey');  
// * returns 2: '[ monkey]'  
// * example 3: sprintf("[%'#10s]", 'monkey');  
// * returns 3: '[####monkey]'  
var regex = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;  
var a = arguments, i = 0, format = a[i++];  
 
// pad()  
var pad = function (str, len, chr, leftJustify) {  
if (!chr) {chr = ' ';}  
var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);  
return leftJustify ? str + padding : padding + str;  
};  
 
// justify()  
var justify = function (value, prefix, leftJustify, minWidth, zeroPad, customPadChar) {  
var diff = minWidth - value.length;  
if (diff > 0) {  
if (leftJustify || !zeroPad) {  
value = pad(value, minWidth, customPadChar, leftJustify);  
} else {  
value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);  
}  
}  
return value;  
};  
 
// formatBaseX()  
var formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) {  
// Note: casts negative numbers to positive ones  
var number = value >>> 0;  
prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] || '';  
value = prefix + pad(number.toString(base), precision || 0, '0', false);  
return justify(value, prefix, leftJustify, minWidth, zeroPad);  
};  
 
// formatString()  
var formatString = function (value, leftJustify, minWidth, precision, zeroPad, customPadChar) {  
if (precision != null) {  
value = value.slice(0, precision);  
}  
return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar);  
};  
 
// doFormat()  
var doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) {  
var number;  
var prefix;  
var method;  
var textTransform;  
var value;  
 
if (substring == '%%') {return '%';}  
 
// parse flags  
var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false, customPadChar = ' ';  
var flagsl = flags.length;  
for (var j = 0; flags && j < flagsl; j++) {  
switch (flags.charAt(j)) {  
case ' ': positivePrefix = ' '; break;  
case '+': positivePrefix = '+'; break;  
case '-': leftJustify = true; break;  
case "'": customPadChar = flags.charAt(j+1); break;  
case '0': zeroPad = true; break;  
case '#': prefixBaseX = true; break;  
}  
}  
 
// parameters may be null, undefined, empty-string or real valued  
// we want to ignore null, undefined and empty-string values  
if (!minWidth) {  
minWidth = 0;  
} else if (minWidth == '*') {  
minWidth = +a[i++];  
} else if (minWidth.charAt(0) == '*') {  
minWidth = +a[minWidth.slice(1, -1)];  
} else {  
minWidth = +minWidth;  
}  
 
// Note: undocumented perl feature:  
if (minWidth < 0) {  
minWidth = -minWidth;  
leftJustify = true;  
}  
 
if (!isFinite(minWidth)) {  
throw new Error('sprintf: (minimum-)width must be finite');  
}  
 
if (!precision) {  
precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : undefined;  
} else if (precision == '*') {  
precision = +a[i++];  
} else if (precision.charAt(0) == '*') {  
precision = +a[precision.slice(1, -1)];  
} else {  
precision = +precision;  
}  
 
// grab value using valueIndex if required?  
value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++];  
 
switch (type) {  
case 's': return formatString(String(value), leftJustify, minWidth, precision, zeroPad, customPadChar);  
case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad);  
case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad);  
case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad);  
case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad);  
case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase();  
case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad);  
case 'i':  
case 'd':  
number = parseInt(+value, 10);  
prefix = number < 0 ? '-' : positivePrefix;  
value = prefix + pad(String(Math.abs(number)), precision, '0', false);  
return justify(value, prefix, leftJustify, minWidth, zeroPad);  
case 'e':  
case 'E':  
case 'f':  
case 'F':  
case 'g':  
case 'G':  
number = +value;  
prefix = number < 0 ? '-' : positivePrefix;  
method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];  
textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];  
value = prefix + Math.abs(number)[method](precision);  
return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform]();  
default: return substring;  
}  
};  
 
return format.replace(regex, doFormat);  
},  
 
clone : function (mixed) {  
 
var newObj = (mixed instanceof Array) ? [] : {};  
for (i in mixed) {  
if (mixed[i] && (typeof mixed[i] == "object") ) {  
newObj[i] = OWA.util.clone(mixed[i]);  
} else {  
newObj[i] = mixed[i];  
}  
}  
return newObj;  
},  
 
strtolower : function( str ) {  
 
return (str+'').toLowerCase();  
},  
 
in_array : function(needle, haystack, argStrict) {  
// Checks if the given value exists in the array  
//  
// version: 1008.1718  
// discuss at: http://phpjs.org/functions/in_array  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: vlado houba  
// + input by: Billy  
// + bugfixed by: Brett Zamir (http://brett-zamir.me)  
// * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);  
// * returns 1: true  
// * example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});  
// * returns 2: false  
// * example 3: in_array(1, ['1', '2', '3']);  
// * returns 3: true  
// * example 3: in_array(1, ['1', '2', '3'], false);  
// * returns 3: true  
// * example 4: in_array(1, ['1', '2', '3'], true);  
// * returns 4: false  
var key = '', strict = !!argStrict;  
 
if (strict) {  
for (key in haystack) {  
if (haystack[key] === needle) {  
return true;  
}  
}  
} else {  
for (key in haystack) {  
if (haystack[key] == needle) {  
return true;  
}  
}  
}  
 
return false;  
},  
 
dechex: function (number) {  
// Returns a string containing a hexadecimal representation of the given number  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/dechex  
// + original by: Philippe Baumann  
// + bugfixed by: Onno Marsman  
// + improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript  
// + input by: pilus  
// * example 1: dechex(10);  
// * returns 1: 'a'  
// * example 2: dechex(47);  
// * returns 2: '2f'  
// * example 3: dechex(-1415723993);  
// * returns 3: 'ab9dc427'  
if (number < 0) {  
number = 0xFFFFFFFF + number + 1;  
}  
return parseInt(number, 10).toString(16);  
},  
 
explode: function (delimiter, string, limit) {  
// Splits a string on string separator and return array of components.  
// If limit is positive only limit number of components is returned.  
// If limit is negative all components except the last abs(limit) are returned.  
//  
// version: 1009.2513  
// discuss at: http://phpjs.org/functions/explode  
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: kenneth  
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// + improved by: d3x  
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
// * example 1: explode(' ', 'Kevin van Zonneveld');  
// * returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}  
// * example 2: explode('=', 'a=bc=d', 2);  
// * returns 2: ['a', 'bc=d']  
 
var emptyArray = { 0: '' };  
 
// third argument is not required  
if ( arguments.length < 2 ||  
typeof arguments[0] == 'undefined' ||  
typeof arguments[1] == 'undefined' ) {  
return null;  
}  
 
if ( delimiter === '' ||  
delimiter === false ||  
delimiter === null ) {  
return false;  
}  
 
if ( typeof delimiter == 'function' ||  
typeof delimiter == 'object' ||  
typeof string == 'function' ||  
typeof string == 'object' ) {  
return emptyArray;  
}  
 
if ( delimiter === true ) {  
delimiter = '1';  
}  
 
if (!limit) {  
return string.toString().split(delimiter.toString());  
} else {  
// support for limit argument  
var splitted = string.toString().split(delimiter.toString());  
var partA = splitted.splice(0, limit - 1);  
var partB = splitted.join(delimiter.toString());  
partA.push(partB);  
return partA;  
}  
}  
}  
OWA.map = function() {  
 
return;  
}  
 
OWA.map.prototype = {  
 
markers: new Object,  
 
config: '',  
 
dom_id: 'map',  
 
height: "100%",  
 
width: "100%",  
 
mapType: '',  
 
placeMarkers: function() {  
 
var lvmarkers = this.markers;  
var dom_id = this.dom_id;  
var mType = this.getMapSettings();  
 
 
jQuery(document).ready(function(){  
 
jQuery('#'+ dom_id).jmap('init', mType);  
 
for(k in lvmarkers) {  
 
jQuery('#'+ dom_id).jmap('AddMarker', lvmarkers[k]);  
 
}  
 
});  
 
return;  
 
},  
 
getMapSettings: function() {  
 
switch(this.mapType) {  
 
case 'earth':  
return {'mapType': G_SATELLITE_3D_MAP,'mapZoom': 3,'mapCenter':[30.958639, -90.162516], 'mapShowjMapsIcon': false, 'mapEnableType': true, 'mapEnableOverview': true};  
 
break;  
 
default:  
 
return {'mapType': G_NORMAL_MAP,'mapZoom': 2,'mapCenter':[8.958639, -3.162516], 'mapShowjMapsIcon': false, 'mapEnableType': true, 'mapEnableOverview': true};  
 
 
}  
 
},  
 
reloadMap: function(t) {  
 
this.mapType = t;  
this.placeMarkers();  
return;  
}  
 
}  
 
// Bind event handlers  
jQuery(document).ready(function(){  
//jQuery.getScript(OWA.config.js_url + "includes/jquery/tablesorter/jquery.tablesorter.js");  
jQuery('.owa_map-type-control').click(owa_map_changeView);  
 
});  
 
function owa_map_changeView() {  
 
// get the map id  
var dom_id = jQuery(this).siblings('.jmap').get(0).id;  
var type = jQuery(this).attr('maptype');  
OWA.items[dom_id].reloadMap(type);  
return;  
 
}  
 
 
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Javascript Domstream Player Library  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @web <a href="http://www.openwebanalytcs.com">Open Web Analytics</a>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
OWA.player = function() {  
 
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery-1.3.2.min.js', function(){});  
OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery.jgrowl_minimized.js', function(){});  
OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/jquery.jgrowl.css', function(){});  
OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/owa.overlay.css', function(){});  
this.fetchData();  
this.showPlayerControls();  
 
}  
 
OWA.player.prototype = {  
 
timer : null,  
queue_step : 1,  
queue_count : 0,  
animateInterval : 250,  
stream : null,  
lock : false,  
 
block : function() {  
this.lock = true;  
},  
 
unblock : function() {  
this.lock = false;  
},  
 
load : function(data) {  
 
this.stream = data;  
// count the events in the queue  
this.queue_count = this.stream.events.length;  
},  
 
/**  
* Fetches data via ajax request  
*/  
fetchData: function() {  
 
var p = OWA.util.readCookie('owa_overlay');  
//alert(unescape(p));  
var params = OWA.util.parseCookieStringToJson(p);  
params.action = 'getDomstream';  
 
//closure  
var that = this;  
 
jQuery.ajax({  
url: OWA.getApiEndpoint(),  
data: OWA.util.nsParams(params),  
dataType: 'jsonp',  
jsonp: 'owa_jsonpCallback',  
success: function(data) {  
that.load(data);  
}  
});  
 
//OWA.debug(data.page);  
},  
 
 
moveCursor : function(x, y) {  
this.block();  
jQuery('#owa-cursor').animate({top: y +'px', left: x +'px'}, { queue:true, duration:100}, 'swing', this.unblock());  
//console.log("Moving to X: %s Y: %s", x, y);  
this.setStatus("Mouse Movement to: "+x+", "+y);  
},  
 
scrollViewport : function(x, y) {  
 
//jQuery('html, body').animate({scrollTop: y}, 0);  
window.scroll(0,y)  
//console.log("Scrolling to Y: %s", y);  
this.setStatus("Scrolling to: "+ y);  
},  
 
start : function() {  
 
var that = this;  
this.timer = setInterval(function(){that.step()}, this.animateInterval);  
},  
 
step : function() {  
 
if (this.lock) {  
OWA.debug("Can not step as player is locked");  
return;  
}  
 
if (this.queue_count === 0) {  
this.stop();  
} else if ((this.queue_count > 0) && (this.queue_step >= this.queue_count)) {  
this.stop();  
} else {  
// get the next event in the queue  
var event = this.getNextEvent();  
// trigger dom stream events  
//jQuery().trigger(event.event_type, [event]);  
this.playEvent(event);  
}  
},  
 
getNextEvent : function() {  
OWA.debug("Queue step is: "+ this.queue_step);  
var event = this.stream.events[this.queue_step];  
OWA.debug("getting event... " + event.event_type);  
// increment the queue step  
this.queue_step++;  
return event;  
},  
 
playEvent : function(event) {  
OWA.debug("playing event of type: " + event.event_type);  
switch (event.event_type) {  
case 'dom.movement':  
return this.movementEventHandler(event);  
case 'dom.scroll':  
return this.scrollEventHandler(event);  
case 'dom.keypress':  
return this.keypressEventHandler(event);  
case 'dom.click':  
return this.clickEventHandler(event);  
}  
},  
 
stop : function() {  
 
// change control static color  
jQuery('#owa_overlay_start').removeClass('active');  
if (!this.timer) return false;  
clearInterval(this.timer);  
this.setStatus('Ready.');  
 
},  
 
play : function() {  
OWA.debug("Now playing Domstream.");  
 
if ((this.queue_step = this.queue_count)) {  
this.queue_step = 1;  
}  
 
this.start();  
this.setStatus('Playing...');  
},  
 
showPlayerControls : function() {  
 
//create player control bar  
var player = '<div id="owa_overlay"></div>';  
jQuery('body').append(player);  
jQuery('#owa_overlay').append('<div id="owa_overlay_logo"></div>'); //logo  
var startlink = '<div class="owa_overlay_control" id="owa_player_start">Play</div>';  
jQuery('#owa_overlay').append(startlink);  
var pauselink = '<div class="owa_overlay_control" id="owa_player_stop">Pause</div>';  
jQuery('#owa_overlay').append(pauselink);  
var closelink = '<div class="owa_overlay_control" id="owa_player_close">Hide</div>';  
jQuery('#owa_overlay').append(closelink);  
var status_msg = '<div id="owa-overlay-status">...</div>';  
jQuery('#owa_overlay').append(status_msg);  
 
//create hidden player controls container  
var hiddenplayer = '<div id="owa_overlay_hidden"></div>';  
jQuery('body').append(hiddenplayer);  
jQuery("#owa_overlay_hidden").hide();  
 
//add cursor  
var cursor = '<div id="owa-cursor"><img src="'+OWA.getSetting('baseUrl')+'/modules/base/i/cursor2.png"></div>';  
jQuery('body').append(cursor);  
 
jQuery('#owa_overlay_start').toggleClass('active');  
 
// set active color. not sure this works right....  
jQuery('.owa_overlay_control').click( function(){  
jQuery(".owa_overlay_control").removeClass('active');  
jQuery(this).addClass('active');  
});  
 
//hide toolbar and make visible the 'show' button  
jQuery("#owa_overlay_logo").click(function() {  
jQuery("#owa_overlay").slideToggle("fast");  
jQuery("#owa_overlay_hidden").fadeIn("slow");  
});  
 
//show toolbar and hide the 'show' button  
jQuery("#owa_overlay_hidden").click(function() {  
jQuery("#owa_overlay").slideToggle("fast");  
jQuery("#owa_overlay_hidden").fadeOut();  
});  
 
//closure  
var that = this;  
 
// start player  
jQuery('#owa_player_start').bind('click', function(e) {that.play(e)});  
 
// pause player  
jQuery('#owa_player_stop').bind('click', function(e) {that.stop(e)});  
 
// eliminate overlay cookie when close button is pressed.  
jQuery('#owa_player_close').click( function() {  
jQuery("#owa_overlay").slideToggle("fast");  
jQuery("#owa_overlay_hidden").fadeIn("slow");  
});  
 
// eliminate overlay cookie when window closes.  
jQuery(window).unload(function() {OWA.endOverlaySession()});  
},  
 
setStatus : function(msg) {  
 
jQuery('#owa-overlay-status').html(msg);  
 
},  
 
showNotification : function(msg, header) {  
jQuery.jGrowl.defaults.position = 'center';  
jQuery.jGrowl.defaults.closer = false;  
jQuery.jGrowl.defaults.pool = 1;  
jQuery.jGrowl(msg, {  
life: 250,  
speed: 25,  
position: "center",  
closer: false,  
header: header  
});  
 
},  
 
movementEventHandler : function(e) {  
 
return this.moveCursor(e.cursor_x, e.cursor_y);  
},  
 
scrollEventHandler : function(e) {  
 
this.scrollViewport(e.x, e.y);  
},  
 
keypressEventHandler : function(event) {  
 
if (event.dom_element_id != "" || undefined) {  
var accessor = '#'+event.dom_element_id;  
} else if (event.dom_element_name) {  
var accessor = event.dom_element_tag+"[name="+event.dom_element_name+"]";  
//console.log("accessor: %s", accessor);  
}  
 
var element_value = jQuery(accessor).val() || '';  
element_value += event.key_value;  
jQuery(accessor).val(element_value);  
this.showNotification(event.key_value, "Key Press:");  
this.setStatus("Key Press: " + event.key_value);  
},  
 
clickEventHandler : function(event) {  
 
var accessor = '';  
 
if (event.dom_element_id != "" && event.dom_element_id != "(not set)" ) {  
accessor = '#'+event.dom_element_id;  
var accessor_msg = accessor;  
} else if (event.dom_element_name != "" && event.dom_element_name != "(not set)" ) {  
accessor = event.dom_element_tag+"[name="+event.dom_element_name+"]";  
var accessor_msg = accessor;  
//console.log("accessor: %s", accessor);  
} else if(event.dom_element_class != "" && event.dom_element_class != "(not set)") {  
var accessor_msg = event.dom_element_tag+"."+event.dom_element_class;  
} else {  
var accessor_msg = event.dom_element_tag;  
}  
 
var d = new Date();  
var id = 'owa-click-marker' + '_' + d.getTime()+1;  
var marker = '<div id="'+id+'" class="owa-click-marker"></div>';  
jQuery('body').append(marker);  
jQuery('#'+id).css({'position': 'absolute','left': event.click_x +'px', 'top': event.click_y +'px', 'z-index' : 89});  
 
if (accessor) {  
jQuery(accessor).click();  
jQuery(accessor).focus();  
}  
//jQuery('#owa-latest-click').slideToggle('normal');  
//console.log("Clicking: %s", accessor);  
//this.setStatus("Clicking: "+accessor);  
this.setStatus("Click @ "+event.click_x+", "+event.click_y);  
this.showNotification(accessor_msg, "Clicked On DOM Element:");  
 
 
}  
 
}  
OWA.report = function(dom_id) {  
 
this.dom_id = dom_id;  
this.config = OWA.config;  
this.properties = {};  
this.tabs = {};  
}  
 
OWA.report.prototype = {  
 
options: {},  
 
config: '',  
 
showSiteFilter : function(dom_id) {  
 
// create dom elements  
// ...  
 
// bind event handlers  
that = this;  
jQuery('#owa_reportSiteFilterSelect').change( function() { that.reload(); } );  
jQuery("#owa_reportPeriodFilterSubmit").click( function() { that.reload(); } );  
},  
 
reload: function() {  
 
// add new site_id to properties  
var siteId = jQuery("#owa_reportSiteFilterSelect option:selected").val();  
OWA.debug(this.properties['action']);  
this.properties['siteId'] = siteId;  
// reload report  
var url = OWA.util.makeUrl(OWA.config.link_template, OWA.config.main_url, this.properties);  
window.location.href = url;  
},  
 
setRequestProperty : function(name, value) {  
 
this.properties[name] = value;  
},  
 
_parseDate: function (date) {  
 
 
},  
 
setDateRange: function (date) {  
 
this.properties.startDate = jQuery.datepicker.formatDate('yymmdd', jQuery("#owa_report-datepicker-start").datepicker("getDate"));  
this.properties.endDate = jQuery.datepicker.formatDate('yymmdd', jQuery("#owa_report-datepicker-end").datepicker("getDate"));  
if (this.properties.startDate != null && this.properties.endDate != null) {  
this.setPeriod('date_range');  
}  
},  
 
setPeriod: function(period) {  
 
this.properties.period = period;  
 
if ( this.properties.hasOwnProperty( 'startDate' ) ) {  
delete this.properties[ 'startDate' ];  
}  
 
if ( this.properties.hasOwnProperty( 'endDate' ) ) {  
delete this.properties[ 'endDate' ];  
}  
},  
 
addTab : function(obj) {  
 
if (obj.dom_id.length > 0 ) {  
this.tabs[obj.dom_id] = obj;  
} else {  
OWA.debug('tab cannot be added with no dom_id set.');  
}  
},  
 
createTabs : function() {  
 
var that = this;  
 
jQuery("#report-tabs").prepend('<ul class="report-tabs-nav-list"></ul>');  
for (tab in this.tabs) {  
 
if ( this.tabs.hasOwnProperty(tab) ) {  
jQuery("#report-tabs > .report-tabs-nav-list").append(OWA.util.sprintf( '<li><a href="#%s">%s</a></li>', tab, that.tabs[tab].label ) );  
 
}  
}  
 
jQuery("#report-tabs").tabs({  
show: function(event, ui) {  
OWA.debug('tab selected is: %s', ui.panel.id);  
that.tabs[ui.panel.id].load();  
}  
});  
 
},  
 
getSiteId : function() {  
 
if (this.properties.hasOwnProperty('siteId')) {  
 
return this.properties.siteId;  
}  
},  
 
getPeriod : function() {  
 
if (this.properties.hasOwnProperty('period')) {  
 
return this.properties.period;  
}  
},  
 
getStartDate : function() {  
 
if (this.properties.hasOwnProperty('startDate')) {  
 
return this.properties.startDate;  
}  
 
},  
 
getEndDate : function() {  
 
if (this.properties.hasOwnProperty('endDate')) {  
 
return this.properties.endDate;  
}  
}  
}  
 
OWA.report.tab = function(dom_id) {  
this.dom_id = dom_id;  
this.resultSetExplorers = {};  
this.label = 'Default label';  
this.isLoaded = false;  
this.load = function() {  
if ( ! this.isLoaded ) {  
for (rse in this.resultSetExplorers) {  
 
if (this.resultSetExplorers.hasOwnProperty(rse)) {  
 
this.resultSetExplorers[rse].load();  
}  
 
}  
 
this.isLoaded = true;  
}  
}  
}  
 
OWA.report.tab.prototype = {  
 
addRse : function (name, rse) {  
 
this.resultSetExplorers[name] = rse;  
},  
 
setLabel : function (label) {  
this.label = label;  
},  
 
setDomId : function (dom_id) {  
this.dom_id = dom_id;  
}  
}  
 
// Bind event handlers  
jQuery(document).ready(function(){  
 
jQuery('#owa_reportPeriodFilter').change(owa_reportSetPeriod);  
jQuery("#owa_reportPeriodLabelContainer").click(function() {  
jQuery("#owa_reportPeriodFiltersContainer").toggle();  
});  
jQuery("#owa_report-datepicker-start, #owa_report-datepicker-end").datepicker({  
beforeShow: customRange,  
showOn: "both",  
dateFormat: 'mm-dd-yy',  
onSelect: function(date) {owa_reportSetDateRange(date);}  
 
//buttonImage: "templates/images/calendar.gif",  
//buttonImageOnly: true  
});  
// make tables sortable  
//jQuery.tablesorter.defaults.widgets = ['zebra'];  
//jQuery('.tablesorter').tablesorter();  
// report side navigaion panels - toggle  
jQuery('.owa_admin_nav_topmenu_toggle').click(function () {  
jQuery(this).parent().siblings('.owa_admin_nav_subgroup').toggle();  
});  
});  
 
 
function customRange(input) {  
 
return {minDate: (input.id == "owa_report-datepicker-end" ? jQuery("#owa_report-datepicker-start").datepicker("getDate") : null),  
maxDate: (input.id == "owa_report-datepicker-start" ? jQuery("#owa_report-datepicker-end").datepicker("getDate") : null)};  
 
}  
 
function owa_reportSetDateRange(date) {  
 
if (date != null) {  
var reportname = jQuery('.owa_reportContainer').get(0).id;  
OWA.items[reportname].setDateRange();  
OWA.items[reportname].setPeriod('date_range');  
// toggle the drop down to custom data range label  
jQuery("#owa_reportPeriodFilter option:contains('Custom Date Range')").attr("selected", true);  
}  
}  
 
function owa_reportSetPeriod() {  
 
var period = jQuery("#owa_reportPeriodFilter option:selected").val();  
var reportname = jQuery(this).parents(".owa_reportContainer").get(0).id;  
OWA.items[reportname].setPeriod(period);  
OWA.items[reportname].reload();  
}  
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Result Set Explorer Library  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @web <a href="http://www.openwebanalytcs.com">Open Web Analytics</a>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
OWA.resultSetExplorer = function(dom_id, options) {  
 
this.dom_id = dom_id || '';  
this.gridInit = false;  
this.init = {  
grid: false,  
pieChart: false,  
areaChart: false  
};  
 
this.columnLinks = '';  
this._columnLinksCount = 0;  
this.resultSet = [];  
this.currentView = '';  
this.currentContainerWidth = '';  
this.currentWindowWidth = '';  
this.view = '';  
this.asyncQueue = [];  
 
this.domSelectors = {  
areaChart: '',  
grid: ''  
};  
 
this.options = {  
defaultView: 'grid',  
areaChart: {  
series:[],  
showDots: true,  
showLegend: true,  
lineWidth: 4  
},  
pieChart: {  
metric: '',  
dimension: '',  
metrics: [],  
numSlices: 5  
},  
sparkline: {  
metric: ''  
},  
grid: {  
showRowNumbers: true,  
excludeColumns: [],  
columnFormatters: {}  
},  
template: {  
template: '',  
params: '',  
mode: 'append',  
dom_id: ''  
},  
metricBoxes: {  
width: ''  
},  
chart: {showGrid: true},  
chartHeight: 125,  
chartWidth:700,  
autoResizeCharts: true,  
views:['grid', 'areaChart','pie', 'sparkline']  
};  
 
this.viewObjects = {};  
this.loadUrl = '';  
};  
 
OWA.resultSetExplorer.prototype = {  
 
//remove  
viewMethods: {  
grid: 'refreshGrid',  
areaChart: 'makeAreaChart',  
pie: 'makePieChart',  
sparkline: 'makeSparkline',  
template: 'renderTemplate'  
},  
 
setDataLoadUrl : function(url) {  
 
this.loadUrl = url;  
},  
 
getOption : function(name) {  
 
return this.options[name];  
},  
 
setView : function(name) {  
 
this.view = name;  
},  
 
getAggregates : function() {  
 
return this.resultSet.aggregates;  
},  
 
// called after data is rendered for a view  
setCurrentView : function(name) {  
 
jQuery(that.domSelectors[that.currentView]).toggle();  
this.currentView = name;  
},  
 
getRowValues : function(old) {  
 
var row = {};  
 
for (var item in old) {  
 
if (old.hasOwnProperty(item)) {  
row[item] = old[item].value;  
}  
}  
 
return row;  
},  
 
// makesa unqiue idfor each row  
makeRowGuid : function(row) {  
 
},  
 
loadFromArray : function(json, view) {  
 
if (view) {  
this.view = view;  
}  
 
this.loader(json);  
 
},  
 
load : function(url) {  
 
url = url || this.loadUrl;  
this.getResultSet(url);  
},  
 
displayGrid : function () {  
this.injectDomElements();  
this.setGridOptions();  
this.addAllRowsToGrid();  
this.makeGridPagination();  
this.gridInit = true;  
this.currentView = 'grid';  
 
},  
 
makeGrid : function(dom_id) {  
 
dom_id = dom_id || this.dom_id;  
 
//if (typeof this.viewObjects[dom_id] != 'undefined') {  
this.viewObjects[dom_id] = new OWA.dataGrid(dom_id);  
//}  
 
this.viewObjects[dom_id].makeGrid(this.resultSet);  
},  
 
refreshGrid : function() {  
 
var that = this;  
 
// custom formattter functions.  
jQuery.extend(jQuery.fn.fmatter , {  
// urlFormatter allows for a single param substitution.  
urlFormatter : function(cellvalue, options, rowdata) {  
var sub_value = options.rowId;  
//alert(options.rowId);  
var name = options.colModel.realColName;  
//var name = 'actionName';  
//alert(that.columnLinks[name].template);  
OWA.debug(options.rowId-1+' '+name);  
//var new_url = that.columnLinks[name].template.replace('%s', escape(sub_value));  
var new_url = that.resultSet.resultsRows[options.rowId-1][name].link;  
var link = '<a href="' + new_url + '">' + cellvalue + '</a>';  
return link;  
},  
 
useServerFormatter : function(cellvalue, options, rowdata) {  
var name = options.colModel.realColName;  
return that.resultSet.resultsRows[options.rowId-1][name].formatted_value;  
}  
 
});  
 
 
 
if (this.resultSet.resultsReturned > 0) {  
 
// happens with first results set when loading from URL.  
if (this.gridInit !== true) {  
this.displayGrid();  
}  
 
jQuery("#"+that.dom_id + ' _grid').jqGrid('clearGridData',true);  
this.addAllRowsToGrid();  
 
// hide the built in jqgrid loading divs.  
jQuery("#load_"+that.dom_id+"_grid").hide();  
jQuery("#load_"+that.dom_id+"_grid").css("z-index", 101);  
 
// check to see if we need ot hide the previous page control.  
if (this.resultSet.page == 1) {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL > .owa_previousPageControl').hide();  
} else if (this.resultSet.page == this.resultSet.total_pages) {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL > .owa_nextPageControl').hide();  
} else {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL > .owa_previousPageControl').show();  
}  
 
} else {  
jQuery("#"+that.dom_id).html("No data is available for this time period.");  
}  
},  
 
loader : function(data) {  
 
if (data) {  
// check to see if resultSet is new  
if (this.resultSet.length > 0) {  
// if not new then return. nothing to do.  
if (data.resultSet.guid === this.resultSet.guid) {  
return;  
}  
 
}  
 
this.setResultSet(data);  
 
if (this.view) {  
var method_name = this.viewMethods[this.view];  
this[method_name]();  
}  
 
if (this.asyncQueue.length > 0) {  
 
for(var i=0;i< this.asyncQueue.length;i++) {  
 
this.dynamicFunc(this.asyncQueue[i]);  
}  
}  
}  
},  
 
dynamicFunc : function (func){  
//alert(func[0]);  
var args = Array.prototype.slice.call(func, 1);  
//alert(args);  
this[func[0]].apply(this, args);  
},  
 
// fetch the result set from the server  
getResultSet : function(url) {  
 
var that = this;  
 
// uses the built in jqgrid loading divs. just giveit a message and show it.  
jQuery("#load_"+that.dom_id+"_grid").html('Loading...');  
jQuery("#load_"+that.dom_id+"_grid").show();  
jQuery("#load_"+that.dom_id+"_grid").css("z-index", 1000);  
jQuery.getJSON(url, '', function (data) {that.loader(data);});  
},  
 
injectDomElements : function() {  
 
var p = '';  
 
p += '<table id="'+ this.dom_id + '_grid"></table>';  
p += '<div class="owa_genericHorizontalList owa_resultsExplorerBottomControls"><ul></ul></div>';  
p += '<div style="clear:both;"></div>';  
 
var that = this;  
jQuery('#'+that.dom_id).append(p);  
},  
 
setGridOptions : function() {  
 
var that = this;  
 
var columns = [];  
 
var columnDef = '';  
 
for (var column in this.resultSet.resultsRows[0]) {  
 
// check to see if we should exclude any columns  
if (this.options.grid.excludeColumns.length > 0) {  
 
for (var i=0;i<=this.options.grid.excludeColumns.length -1;i++) {  
// if column name is not on the exclude list then add it.  
if (this.options.grid.excludeColumns[i] != column) {  
// add column  
columnDef = this.makeGridColumnDef(this.resultSet.resultsRows[0][column]);  
columns.push(columnDef);  
}  
}  
 
} else {  
// add column  
columnDef = this.makeGridColumnDef(this.resultSet.resultsRows[0][column]);  
columns.push(columnDef);  
}  
 
}  
 
jQuery('#' + that.dom_id + '_grid').jqGrid({  
jsonReader: {  
repeatitems: false,  
root: "resultsRows",  
cell: '',  
id: '',  
page: 'page',  
total: 'total_pages',  
records: 'resultsReturned'  
},  
afterInsertRow: function(rowid, rowdata, rowelem) {return;},  
datatype: 'local',  
colModel: columns,  
rownumbers: that.options.grid.showRowNumbers,  
viewrecords: true,  
rowNum: that.resultSet.resultsReturned,  
height: '100%',  
autowidth: true,  
hoverrows: false,  
sortname: that.resultSet.sortColumn + '.value',  
sortorder: that.resultSet.sortOrder  
});  
 
// set header css  
for (var y=0;y < columns.length;y++) {  
var css = {};  
//if dimension column then left align  
if ( columns[y].classes == 'owa_dimensionGridCell' ) {  
css['text-align'] = 'left';  
} else {  
css['text-align'] = 'right';  
}  
// if sort column then bold.  
if (this.resultSet.sortColumn +'.value' === columns[y].name) {  
//css.fontWeight = 'bold';  
}  
// set the css. no way to just set a class...  
jQuery('#' + that.dom_id + '_grid').jqGrid('setLabel', columns[y].name, '',css);  
}  
 
/*  
// custom formattter functions.  
jQuery.extend(jQuery.fn.fmatter , {  
// urlFormatter allows for a single param substitution.  
urlFormatter : function(cellvalue, options, rowdata) {  
var sub_value = options.rowId;  
//alert(options.rowId);  
var name = options.colModel.realColName;  
//var name = 'actionName';  
//alert(that.columnLinks[name].template);  
OWA.debug(options.rowId-1+' '+name);  
//var new_url = that.columnLinks[name].template.replace('%s', escape(sub_value));  
var new_url = that.resultSet.resultsRows[options.rowId-1][name].link;  
var link = '<a href="' + new_url + '">' + cellvalue + '</a>';  
return link;  
}  
});  
*/  
},  
 
makeGridColumnDef : function(column) {  
 
var _sort_type = '';  
var _align = '';  
var _format = '';  
var _class = '';  
var _width = '';  
var _resizable = true;  
var _fixed = false;  
var _datefmt = '';  
 
if (column.result_type === 'dimension') {  
_align = 'left';  
_class = 'owa_dimensionGridCell';  
} else {  
_align = 'right';  
_class = 'owa_metricGridCell';  
_width = 100;  
_resizable = false;  
_fixed = true;  
}  
 
if (column.data_type === 'string') {  
_sort_type = 'text';  
} else {  
_sort_type = 'number';  
}  
 
if (column.link) {  
_format = 'urlFormatter';  
} else {  
_format = 'useServerFormatter';  
}  
 
// set custom formatter if one exists.  
if (this.options.grid.columnFormatters.hasOwnProperty(column.name)) {  
_format = this.options.grid.columnFormatters[column.name];  
}  
 
var columnDef = {  
name: column.name +'.value',  
index: column.name +'.value',  
label: column.label,  
sorttype: _sort_type,  
align: _align,  
formatter: _format,  
classes: _class,  
width: _width,  
resizable: _resizable,  
fixed: _fixed,  
realColName: column.name,  
datefmt: _datefmt  
};  
 
return columnDef;  
 
},  
 
makeColumnDefinitions : function() {  
 
},  
 
 
addRowToGrid : function(row, id) {  
 
var that = this;  
 
rowid = id || that.makeRowGuid(row);  
 
jQuery("#"+that.dom_id + '_grid').jqGrid('addRowData',rowid,that.getRowValues(row));  
},  
 
addAllRowsToGrid :function() {  
 
var that = this;  
jQuery("#"+that.dom_id + '_grid')[0].addJSONData(that.resultSet);  
this.displayRowCount();  
},  
 
displayRowCount : function() {  
 
if (this.resultSet.total_pages > 1) {  
 
var start = '';  
var end = '';  
if (this.resultSet.page === 1) {  
start = 1;  
end = this.resultSet.resultsReturned;  
} else {  
start = ((this.resultSet.page -1) * this.resultSet.resultsPerPage) + 1;  
end = ((this.resultSet.page -1) * this.resultSet.resultsPerPage) + this.resultSet.resultsReturned;  
}  
 
var p = '<li class="owa_rowCount">';  
p += 'Results: '+ start + ' - ' + end;  
p = p + '</li>';  
 
var that = this;  
//alert ("#"+that.dom_id + '_grid' + ' > .owa_rowCount');  
var check = jQuery("#"+that.dom_id + ' > .owa_resultsExplorerBottomControls > UL > .owa_rowCount').html();  
//alert(check);  
if (check === null) {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL').append(p);  
} else {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL > .owa_rowCount').html(p);  
}  
}  
},  
 
makeGridPagination : function() {  
 
if (this.resultSet.more) {  
 
var that = this;  
 
var p = '';  
p = p + '<LI class="owa_previousPageControl">';  
p = p + '<span>Previous Page</span></LI>';  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL').append(p);  
jQuery(".owa_previousPageControl").bind('click', function() {that.pageGrid(that.resultSet.previous);});  
 
var pn = '';  
pn = pn + '<LI class="owa_nextPageControl">';  
pn = pn + '<span>Next Page</span></LI>';  
 
jQuery("#"+that.dom_id + ' > .owa_resultsExplorerBottomControls > UL').append(pn);  
jQuery("#"+that.dom_id + ' > .owa_resultsExplorerBottomControls > UL > .owa_nextPageControl').bind('click', function() {that.pageGrid(that.resultSet.next);});  
 
if (this.resultSet.page == 1) {  
jQuery("#"+that.dom_id +' > .owa_resultsExplorerBottomControls > UL > .owa_previousPageControl').hide();  
}  
 
}  
},  
 
pageGrid : function (url) {  
 
this.getResultSet(url);  
var that = this;  
 
},  
 
addLinkToColumn : function(col_name, link_template, sub_params) {  
this.columnLinks = {};  
if (col_name) {  
var item = {};  
item.name = col_name;  
item.template = link_template;  
item.params = sub_params;  
 
this.columnLinks[col_name] = item;  
item = '';  
}  
 
this._columnLinksCount++;  
//alert(this.dom_id);  
},  
 
setResultSet : function(rs) {  
this.resultSet = rs;  
this.applyLinks();  
},  
 
applyLinks : function() {  
 
var p = '';  
 
if (this.resultSet.resultsRows.length > 0) {  
 
if (this._columnLinksCount > 0) {  
 
for(var i=0;i<=this.resultSet.resultsRows.length - 1;i++) {  
 
for (var y in this.columnLinks) {  
if (this.columnLinks.hasOwnProperty(y)) {  
//alert(this.dom_id + ' : '+y);  
var template = this.columnLinks[y].template;  
 
if (this.resultSet.resultsRows[i][y].name.length > 0) {  
//if (this.resultSet.resultsRows[i][this.columnLinks[y]].name.length > 0) {  
 
for (var z in this.columnLinks[y].params) {  
 
if (this.columnLinks[y].params.hasOwnProperty(z)) {  
 
template = template.replace('%s', OWA.util.urlEncode(this.resultSet.resultsRows[i][this.columnLinks[y].params[z]].value));  
}  
}  
 
this.resultSet.resultsRows[i][this.columnLinks[y].name].link = template;  
}  
}  
}  
}  
}  
}  
},  
 
getContainerWidth : function() {  
 
var that = this;  
 
if (this.getOption('autoResizeCharts')) {  
return jQuery("#"+that.dom_id).width();  
} else {  
return this.getOption('chartWidth');  
}  
},  
 
getContainerHeight : function() {  
var that = this;  
var h = jQuery("#"+that.dom_id).height();  
//alert(h);  
return h;  
 
},  
 
setupAreaChart : function(series, dom_id) {  
 
dom_id = dom_id || this.dom_id;  
this.domSelectors.areaChart = "#"+dom_id + ' > .owa_areaChart';  
 
var that = this;  
 
//var w = this.getContainerWidth();  
var w = jQuery("#"+dom_id).css('width');  
//alert(w);  
var h = this.getContainerHeight() || this.getOption('chartHeight');  
 
 
jQuery("#"+dom_id).append('<div class="owa_areaChart"></div>');  
 
jQuery(that.domSelectors.areaChart).css('width', w);  
jQuery(that.domSelectors.areaChart).css('height', h);  
 
// binds a tooltip to plot points  
var previousPoint = null;  
jQuery(that.domSelectors.areaChart).bind("plothover", function (event, pos, item) {  
 
jQuery("#x").text(pos.x.toFixed(2));  
jQuery("#y").text(pos.y.toFixed(2));  
 
if (item) {  
if (previousPoint != item.datapoint) {  
 
previousPoint = item.datapoint;  
 
jQuery("#tooltip").remove();  
var x = item.datapoint[0].toFixed(0),  
y = item.datapoint[1].toFixed(0);  
 
if (that.options.areaChart.flot.xaxis.mode === 'time') {  
 
x = that.timestampFormatter(x);  
}  
 
that.showTooltip(item.pageX -75, item.pageY -50,  
x+'<BR><B>'+item.series.label + ":</B> " + y);  
}  
} else {  
jQuery("#tooltip").remove();  
previousPoint = null;  
}  
 
});  
 
},  
 
formatValue : function(type, value) {  
 
switch(type) {  
// convery yyyymmdd to javascript timestamp as flot requires that  
case 'yyyymmdd':  
 
//date = jQuery.datepicker.parseDate('yymmdd', value);  
//value = Date.parse(date);  
var year = value.substring(0,4) * 1;  
var month = (value.substring(4,6) * 1) -1;  
var day = value.substring(6,8) * 1;  
var d = Date.UTC(year,month,day,0,0,0,0);  
value = d;  
OWA.debug('year: %s, month: %s, day: %s, timestamp: %s',year,month,day,d);  
break;  
 
case 'currency':  
value = value/100;  
}  
 
return value;  
},  
 
timestampFormatter : function(timestamp) {  
 
var d = new Date(timestamp*1);  
var curr_date = d.getDate();  
var curr_month = d.getMonth() + 1;  
var curr_year = d.getFullYear();  
//alert(d+' date: '+curr_month);  
var date = curr_month + "/" + curr_date + "/" + curr_year;  
//var date = curr_month + "/" + curr_date;  
return date;  
},  
 
 
/**  
* Main method for displaying an area chart  
*/  
makeAreaChart : function(series, dom_id) {  
 
dom_id = dom_id || this.dom_id;  
var selector = "#"+dom_id + ' > .owa_areaChart';  
 
if (this.resultSet.resultsRows.length > 0) {  
 
 
var dataseries = [];  
series = series || this.options.areaChart.series;  
var data = [];  
for(var ii=0;ii<=series.length -1;ii++) {  
 
var x_series_name = series[ii].x;  
var y_series_name = series[ii].y;  
 
 
 
//create data array  
for(var i=0;i<=this.resultSet.resultsRows.length -1;i++) {  
data_type_x = this.resultSet.resultsRows[i][x_series_name].data_type;  
data_type_y = this.resultSet.resultsRows[i][y_series_name].data_type;  
var item =[this.formatValue(data_type_x, this.resultSet.resultsRows[i][x_series_name].value), this.formatValue(data_type_y, this.resultSet.resultsRows[i][y_series_name].value)];  
data.push(item);  
}  
//alert(this.resultSet.resultsRows[i][series[ii].x].value);  
var l = this.getMetricLabel(y_series_name);  
dataseries.push({ label: l, data: data});  
 
}  
 
//var that = this;  
 
 
 
if(jQuery("#"+dom_id + ' > .owa_areaChart').length === 0) {  
 
this.setupAreaChart(series, dom_id);  
}  
 
var num_ticks = data.length;  
// reduce number of x axis ticks if data set has too many points.  
if (data.length > 10) {  
 
num_ticks = 10;  
}  
 
var options = {  
 
yaxis: {  
tickDecimals:0 },  
xaxis:{  
ticks: num_ticks,  
tickDecimals: null  
},  
grid: {show: this.options.chart.showGrid, hoverable: true, autoHilight:true, borderWidth:0, borderColor: null},  
series: {  
points: { show: this.options.areaChart.showDots, fill: this.options.areaChart.showDots},  
lines: { show: true, fill: true, fillColor: "rgba(202,225,255, 0.6)", lineWidth: this.options.areaChart.lineWidth}  
 
},  
colors: ["#1874CD", "#dba255", "#919733"],  
legend: {  
position: 'ne',  
margin: [0,-10],  
show:this.options.areaChart.showLegend  
}  
};  
 
if (data_type_x === 'yyyymmdd') {  
 
options.xaxis.mode = "time";  
//options.xaxis.timeformat = "%m/%d/%y";  
options.xaxis.timeformat = "%m/%d";  
}  
 
this.options.areaChart.flot = options;  
jQuery.plot(jQuery(selector), dataseries, options);  
this.currentContainerWidth = jQuery("#"+dom_id).width();  
this.currentWindowWidth = jQuery(window).width();  
 
// resize window handler  
var that = this;  
jQuery(window).resize(function () {  
var sel = that.domSelectors.areaChart;  
//alert(sel);  
//var that = this;  
var chartw =jQuery(sel).width();  
var containerw = jQuery("#"+dom_id).width();  
var ccontainerw = that.currentContainerWidth;  
var ww = jQuery(window).width();  
OWA.debug('cur-container-w: '+ccontainerw);  
OWA.debug('new-container-w: '+containerw);  
 
// check to see if the container or the window width has changed  
// redraw the graph if it has.  
if ((containerw != ccontainerw) || (ww != that.currentWindowWidth)) {  
 
//var d = that.currentWindowWidth - ww;  
var d = ww - that.currentWindowWidth;  
//alert(d);  
jQuery(sel).css('width', chartw + d);  
that.makeAreaChart(series, dom_id);  
}  
that.currentContainerWidth = containerw;  
that.currentWindowWidth = ww;  
});  
 
 
} else {  
jQuery('#'+ dom_id).html("No data is available for this time period");  
jQuery('#'+ dom_id).css('height', '50px');  
 
}  
 
},  
 
// shows a tool tip for flot charts  
showTooltip : function(x, y, contents) {  
 
jQuery('<div id="tooltip">' + contents + '</div>').css( {  
position: 'absolute',  
display: 'none',  
top: y + 5,  
left: x + 5,  
border: '1px solid #cccccc',  
padding: '2px',  
'background-color': '#ffffff',  
opacity: 0.90  
}).appendTo("body").fadeIn(100);  
},  
 
getMetricLabel : function(name) {  
//alert(this.resultSet.aggregates[name].label);  
if (this.resultSet.aggregates[name].label.length > 0) {  
return this.resultSet.aggregates[name].label;  
} else {  
return 'unknown';  
}  
},  
 
getMetricValue : function(name) {  
//alert(this.resultSet.aggregates[name].label);  
if (this.resultSet.aggregates[name].value.length > 0) {  
return this.resultSet.aggregates[name].value;  
} else {  
return 0;  
}  
},  
 
setupPieChart : function() {  
 
var that = this;  
var w = this.getContainerWidth();  
//alert(w);  
var h = this.getContainerWidth(); //this.getOption('chartHeight');  
//alert(h);  
jQuery("#"+that.dom_id).append('<div class="owa_pieChart"></div>');  
jQuery(that.domSelectors.pieChart).css('width', w);  
jQuery(that.domSelectors.pieChart).css('height', h);  
},  
 
makePieChart : function () {  
 
this.domSelectors.pieChart = "#"+this.dom_id + ' > .owa_pieChart';  
var selector = this.domSelectors.pieChart;  
var that = this;  
//create data array  
var data = [];  
var count = 0;  
 
if (this.options.pieChart.dimension.length > 0) {  
// plots a dimensional set of data  
 
if (this.resultSet.resultsRows.length > 0) {  
 
var dimension = this.options.pieChart.dimension;  
var numSlices = this.options.pieChart.numSlices;  
var metric = this.options.pieChart.metric;  
 
//create data array  
var iterations = 0;  
if (numSlices > this.resultSet.resultsRows.length) {  
iterations = this.resultSet.resultsRows.length;  
} else {  
iterations = numSlices;  
}  
 
 
for(var i=0;i<=iterations -1;i++) {  
 
var item = {label: this.resultSet.resultsRows[i][dimension].value, data: this.resultSet.resultsRows[i][metric].value * 1};  
data.push(item);  
count = count + this.resultSet.resultsRows[i][metric].value;  
}  
 
// if there are extra slices then lump into other bucket.  
if (this.resultSet.resultsRows.length > iterations) {  
var others = this.resultSet.aggregates[metric] - count;  
data.push({label: 'others', data: others});  
}  
 
} else {  
//no results  
jQuery('#'+ that.dom_id).append("No data is available for this time period");  
jQuery('#'+ that.dom_id).css('height', '50px');  
 
}  
} else {  
 
if (!jQuery.isEmptyObject(that.resultSet.aggregates)) {  
// plots a set of values taken from the aggregrate metrics array  
var metrics = this.options.pieChart.metrics;  
for(var ii=0;ii<=metrics.length -1 ;ii++) {  
var value = this.resultSet.aggregates[metrics[ii]].value * 1;  
data.push({label: this.getMetricLabel(metrics[ii]), data: value});  
}  
} else {  
//OWA.setSetting('debug', true);  
//OWA.debug('there was no data');  
//alert('hi');  
jQuery('#'+ that.dom_id).append("No data is available for this time period");  
jQuery('#'+ that.dom_id).css('height', '50px');  
 
}  
 
}  
 
if (this.init.pieInit !== true) {  
 
this.setupPieChart();  
}  
 
// options  
var options = {  
series: {  
pie: {  
show: true,  
//showLabel: true,  
label: {  
show: true,  
background: {  
color: '#ffffff',  
opacity: '.7'  
},  
radius:1,  
formatter: function(label, slice){  
return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+Math.round(slice.percent)+'%</div>';  
}  
//formatter: function(label, slice){ return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+label+'<br/>'+Math.round(slice.percent)+'%</div>';}  
 
}  
}  
},  
 
legend: {  
show: true,  
position: "ne",  
margin: [-160,50]  
},  
colors: ["#6BAED6", "#FD8D3C", "#dba255", "#919733"]  
};  
 
//GRAPH  
jQuery.plot(jQuery(selector), data, options);  
this.init.pieChart = true;  
},  
 
renderTemplate : function(template, params, mode, dom_id) {  
 
template = template || this.options.template.template;  
params = params || this.options.template.params;  
mode = mode || this.options.template.mode;  
dom_id = dom_id || this.options.template.dom_id || this.dom_id;  
jQuery.jqotetag('*');  
//dom_id = dom_id || this.dom_id;  
 
if (mode === 'append') {  
jQuery('#' + dom_id).jqoteapp(template, params);  
} else if (mode === 'prepend') {  
jQuery('#' + dom_id).jqotepre(template, params);  
} else if (mode === 'replace') {  
jQuery('#' + dom_id).jqotesub(template, params);  
}  
},  
 
makeSparkline : function(metric_name, dom_id, filter) {  
metric_name = metric_name || this.options.sparkline.metric;  
dom_id = dom_id || this.dom_id;  
var sl = new OWA.sparkline(dom_id);  
var data = this.getSeries(metric_name, '',filter);  
 
if (!data) {  
data = [0,0,0];  
}  
 
sl.loadFromArray(data);  
 
this.currentView = 'sparkline';  
},  
 
getSeries : function(value_name, value_name2, filter) {  
 
if (this.resultSet.resultsRows.length > 0) {  
 
var series = [];  
//create data array  
for(var i=0;i<=this.resultSet.resultsRows.length -1;i++) {  
 
if (filter) {  
check = filter(this.resultSet.resultsRows[i]);  
if (!check) {  
continue;  
}  
}  
 
var item = '';  
if (value_name2) {  
item =[this.resultSet.resultsRows[i][value_name].value, this.resultSet.resultsRows[i][value_name2].value];  
} else {  
item = this.resultSet.resultsRows[i][value_name].value;  
 
}  
 
series.push(item);  
}  
 
return series;  
}  
},  
 
makeMetricBoxes : function(dom_id, template, label, metrics, filter) {  
dom_id = dom_id || this.dom_id;  
template = template || '#metricInfobox';  
 
jQuery('#' + dom_id).append('<div class="metricInfoboxesContainer" style="width:auto;">');  
for(var i in this.resultSet.aggregates) {  
 
if (this.resultSet.aggregates.hasOwnProperty(i)) {  
var item = this.resultSet.aggregates[i];  
item.dom_id = dom_id+'-'+this.resultSet.aggregates[i].name+'-'+this.resultSet.guid;  
if (label) {  
item.label = label;  
}  
 
if (this.options.metricBoxes.width) {  
item.width = this.options.metricBoxes.width;  
}  
 
 
// set alt tag for jqote. needed to avoid problem with php's asp_tags ini directive  
jQuery.jqotetag('*');  
jQuery('#' + dom_id).jqoteapp(template, item);  
 
this.makeSparkline(this.resultSet.aggregates[i].name, item.dom_id+'-sparkline', filter);  
 
}  
}  
jQuery('#' + dom_id).append('</div>');  
jQuery('#' + dom_id).append('<div style="clear:both;"></div>');  
},  
 
renderResultsRows : function(dom_id, template) {  
 
if (this.resultSet.resultsRows.length > 0) {  
var that = this;  
dom_id = dom_id || this.dom_id;  
 
var table = '';  
var data = [];  
//re-order the data into an array  
for (var d_item in this.resultSet.resultsRows[0]) {  
 
if (this.resultSet.resultsRows[0].hasOwnProperty(d_item)) {  
data.push(this.resultSet.resultsRows[0][d_item]);  
}  
}  
// set alt tag for jqote. needed to avoid problem with php's asp_tags ini directive  
jQuery.jqotetag('*');  
//make table headers  
var ths = jQuery('#simpleTable-headers').jqote(data);  
// make outer table  
table = jQuery('#simpleTable-outer').jqote({dom_id: dom_id+'_simpleTable', headers: ths});  
// add to dom  
jQuery('#'+dom_id).html(table);  
// append rows  
for(i=0;i<= this.resultSet.resultsRows.length -1;i++) {  
 
var cells = '';  
for (var r_item in this.resultSet.resultsRows[i]) {  
 
if (this.resultSet.resultsRows[i].hasOwnProperty(r_item)) {  
cells += jQuery('#table-column').jqote(this.resultSet.resultsRows[i][r_item]);  
}  
}  
 
var row = jQuery('#table-row').jqote({columns: cells});  
jQuery('#'+dom_id+'_simpleTable').append(row);  
}  
 
} else {  
jQuery('#'+dom_id).html("No results to display.");  
}  
},  
 
getApiEndpoint : function() {  
 
return this.getOption('api_endpoint') || OWA.getSetting('api_endpoint');  
},  
 
makeApiRequestUrl : function(method, options, url) {  
 
var url = url || this.getApiEndpoint();  
url += '?';  
url += 'owa_do=' + method;  
var count = OWA.util.countObjectProperties(options);  
var i = 1;  
for (option in options) {  
 
if (options.hasOwnProperty(option)) {  
 
if (typeof options[option] != 'undefined') {  
url += '&owa_' +option + '=' + OWA.util.urlEncode(options[option]);  
}  
i++;  
}  
}  
 
return url;  
}  
 
};  
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* OWA Sparkline Implementation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @web <a href="http://www.openwebanalytcs.com">Open Web Analytics</a>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
OWA.sparkline = function(dom_id) {  
 
this.config = OWA.config || '';  
 
this.dom_id = dom_id || '';  
 
this.data = '';  
 
this.options = {  
type: 'line',  
lineWidth: 2,  
width: '100px',  
height: '20px',  
spotRadius: 0,  
//lineColor: '',  
//spotColor: '',  
minSpotColor: '#FF0000',  
maxSpotColor: '#00FF00'  
};  
 
}  
 
OWA.sparkline.prototype = {  
 
render: function() {  
 
jQuery('#' + this.dom_id).sparkline('html', this.options);  
},  
 
loadFromArray :function(data) {  
jQuery('#' + this.dom_id).sparkline(data, this.options);  
},  
 
setHeight: function(height) {  
 
this.options.height = height;  
return;  
},  
 
setWidth: function(width) {  
 
this.options.width = width;  
},  
 
setDomId: function(dom_id) {  
 
this.dom_id = dom_id;  
}  
 
}  
 
OWA.spy = function() {  
 
//this.config = OWA.config;  
 
return;  
}  
 
OWA.spy.prototype = {  
 
properties: new Object,  
last_start_time: '',  
last_end_time: 0,  
 
init: function(dom_id, url) {  
 
jQuery('#'+ dom_id).spy({  
'limit': 10,  
'fadeLast': 5,  
'ajax': url,  
'fadeInSpeed': '500',  
'timeout': 5000  
//'timestamp': owa_getNow  
});  
 
},  
 
getStartTime: function() {  
 
var d = new Date();  
var ts = '';  
 
if (this.last_end_time > 0) {  
 
ts = this.last_end_time;  
this.last_end_time = this.getNow();  
} else {  
 
ts = this.getNow();  
this.last_end_time = ts;  
}  
 
return ts;  
 
},  
 
getNow: function() {  
 
var d = new Date();  
var now;  
now = Math.round(d.getTime() / 1000);  
 
return now;  
 
}  
 
 
}  
 
 
function pauseSpy() {  
spyRunning = 0;  
var temp_time;  
last_end_time = temp_time;  
jQuery('div#_spyTmp').html("");  
jQuery('div#spyContainer').prepend('<div class="status">The spy has been paused...</div>');  
 
return false;  
}  
 
function playSpy() {  
spyRunning = 1;  
jQuery('div#spyContainer').prepend('<div class="status">The spy has been re-started...</div>');  
return false;  
}  
 
function owa_getData() {  
 
spy.properties.startTime = spy.getStartTime();  
spy.properties.endTime = spy.getNow();  
//alert(OWA.util.nsAll(spy.properties));  
return OWA.util.nsAll(spy.properties);  
 
 
}  
 
OWA.template = function(options) {  
 
if (options) {  
this.options = options;  
}  
}  
 
OWA.template.prototype = {  
 
/**  
* Template cache  
*/  
_tmplCache = {},  
 
/**  
* Client side template parser that uses &lt;#= #&gt; and &lt;# code #&gt; expressions.  
* and # # code blocks for template expansion.  
*  
* @param str string The text of the template to expand</param>  
* @param data mixed Any javascript variable that is to be merged.  
* @return string  
*/  
parseTemplate = function(str, data) {  
 
var err = "";  
try {  
var func = this._tmplCache[str];  
if (!func) {  
var strFunc = "var p=[],print=function(){p.push.apply(p,arguments);};" +  
"with(obj){p.push('" +  
str.replace(/[\r\t\n]/g, " ")  
.replace(/'(?=[^#]*#>)/g, "\t")  
.split("'").join("\\'")  
.split("\t").join("'")  
.replace(/<#=(.+?)#>/g, "',$1,'")  
.split("<#").join("');")  
.split("#>").join("p.push('")  
+ "');}return p.join('');";  
 
//alert(strFunc);  
func = new Function("obj", strFunc);  
this._tmplCache[str] = func;  
}  
return func(data);  
} catch (e) { err = e.message; }  
return "< # ERROR: " + err.htmlEncode() + " # >";  
}  
}  
// OWA Tracker Min file created 1295114210  
 
//// Start of json2 ////  
 
if(!this.JSON){this.JSON={};}  
(function(){"use strict";function f(n){return n<10?'0'+n:n;}  
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+  
f(this.getUTCMonth()+1)+'-'+  
f(this.getUTCDate())+'T'+  
f(this.getUTCHours())+':'+  
f(this.getUTCMinutes())+':'+  
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}  
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}  
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}  
if(typeof rep==='function'){value=rep.call(holder,key,value);}  
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}  
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}  
v=partial.length===0?'[]':gap?'[\n'+gap+  
partial.join(',\n'+gap)+'\n'+  
mind+']':'['+partial.join(',')+']';gap=mind;return v;}  
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}  
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+  
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}  
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}  
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}  
return str('',{'':value});};}  
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}  
return reviver.call(holder,key,value);}  
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+  
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}  
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}  
throw new SyntaxError('JSON.parse');};}}());  
//// End of json2 ////  
//// Start of lazyload ////  
 
LazyLoad=function(){var f=document,g,b={},e={css:[],js:[]},a;function j(l,k){var m=f.createElement(l),d;for(d in k){if(k.hasOwnProperty(d)){m.setAttribute(d,k[d])}}return m}function h(d){var l=b[d];if(!l){return}var m=l.callback,k=l.urls;k.shift();if(!k.length){if(m){m.call(l.scope||window,l.obj)}b[d]=null;if(e[d].length){i(d)}}}function c(){if(a){return}var k=navigator.userAgent,l=parseFloat,d;a={gecko:0,ie:0,opera:0,webkit:0};d=k.match(/AppleWebKit\/(\S*)/);if(d&&d[1]){a.webkit=l(d[1])}else{d=k.match(/MSIE\s([^;]*)/);if(d&&d[1]){a.ie=l(d[1])}else{if((/Gecko\/(\S*)/).test(k)){a.gecko=1;d=k.match(/rv:([^\s\)]*)/);if(d&&d[1]){a.gecko=l(d[1])}}else{if(d=k.match(/Opera\/(\S*)/)){a.opera=l(d[1])}}}}}function i(r,q,s,m,t){var n,o,l,k,d;c();if(q){q=q.constructor===Array?q:[q];if(r==="css"||a.gecko||a.opera){e[r].push({urls:[].concat(q),callback:s,obj:m,scope:t})}else{for(n=0,o=q.length;n<o;++n){e[r].push({urls:[q[n]],callback:n===o-1?s:null,obj:m,scope:t})}}}if(b[r]||!(k=b[r]=e[r].shift())){return}g=g||f.getElementsByTagName("head")[0];q=k.urls;for(n=0,o=q.length;n<o;++n){d=q[n];if(r==="css"){l=j("link",{href:d,rel:"stylesheet",type:"text/css"})}else{l=j("script",{src:d})}if(a.ie){l.onreadystatechange=function(){var p=this.readyState;if(p==="loaded"||p==="complete"){this.onreadystatechange=null;h(r)}}}else{if(r==="css"&&(a.gecko||a.webkit)){setTimeout(function(){h(r)},50*o)}else{l.onload=l.onerror=function(){h(r)}}}g.appendChild(l)}}return{css:function(l,m,k,d){i("css",l,m,k,d)},js:function(l,m,k,d){i("js",l,m,k,d)}}}();  
//// End of lazyload ////  
//// Start of owa ////  
 
var OWA={items:{},overlay:'',config:{ns:'owa_',baseUrl:'',hashCookiesToDomain:true},state:{},overlayActive:false,setSetting:function(name,value){return this.setOption(name,value);},getSetting:function(name){return this.getOption(name);},setOption:function(name,value){this.config[name]=value;},getOption:function(name){return this.config[name];},initializeStateManager:function(){if(!this.state.hasOwnProperty('init')){OWA.debug('initializing state manager...');this.state=new OWA.stateManager();}},checkForState:function(store_name){this.initializeStateManager();return this.state.isPresent(store_name);},setState:function(store_name,key,value,is_perminant,format,expiration_days){this.initializeStateManager();return this.state.set(store_name,key,value,is_perminant,format,expiration_days);},replaceState:function(store_name,value,is_perminant,format,expiration_days){this.initializeStateManager();return this.state.replaceStore(store_name,value,is_perminant,format,expiration_days);},getStateFromCookie:function(store_name){this.initializeStateManager();return this.state.getStateFromCookie(store_name);},getState:function(store_name,key){this.initializeStateManager();return this.state.get(store_name,key);},clearState:function(store_name){this.initializeStateManager();return this.state.clear(store_name);},getStateStoreFormat:function(store_name){this.initializeStateManager();return this.state.getStoreFormat(store_name);},setStateStoreFormat:function(store_name,format){this.initializeStateManager();return this.state.setStoreFormat(store_name,format);},debug:function(){var debugging=OWA.getSetting('debug')||false;if(debugging){if(window.console){if(window.console.firebug){console.log.apply(this,arguments);}else{console.log.apply(console,arguments);}}}},setApiEndpoint:function(endpoint){this.config['api_endpoint']=endpoint;},getApiEndpoint:function(){return this.config['api_endpoint']||this.getSetting('baseUrl')+'api.php';},loadHeatmap:function(p){var that=this;OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery-1.4.2.min.js',function(){});OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/owa.overlay.css',function(){});OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/owa.heatmap.js',function(){that.overlay=new OWA.heatmap();that.overlay.options.liveMode=true;that.overlay.generate();});},loadPlayer:function(){var that=this;OWA.debug("Loading Domstream Player");OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/includes/jquery/jquery-1.4.2.min.js',function(){});OWA.util.loadCss(OWA.getSetting('baseUrl')+'/modules/base/css/owa.overlay.css',function(){});OWA.util.loadScript(OWA.getSetting('baseUrl')+'/modules/base/js/owa.player.js',function(){that.overlay=new OWA.player();});},startOverlaySession:function(p){OWA.overlayActive=true;if(p.hasOwnProperty('api_url')){OWA.setApiEndpoint(p.api_url);}  
var params=p;if(params.action==='loadHeatmap'){this.loadHeatmap(p);}else if(params.action==='loadPlayer'){this.loadPlayer(p);}},endOverlaySession:function(){OWA.util.eraseCookie('owa_overlay',document.domain);OWA.overlayActive=false;}}  
OWA.stateManager=function(){this.cookies=OWA.util.readAllCookies();this.init=true;};OWA.stateManager.prototype={init:false,cookies:'',stores:{},storeFormats:{},isPresent:function(store_name){if(this.stores.hasOwnProperty(store_name)){return true;}},set:function(store_name,key,value,is_perminant,format,expiration_days){if(!this.isPresent(store_name)){this.load(store_name);}  
if(!this.isPresent(store_name)){OWA.debug('Creating state store (%s)',store_name);this.stores[store_name]={};if(OWA.getSetting('hashCookiesToDomain')){this.stores[store_name].cdh=OWA.util.getCookieDomainHash(OWA.getSetting('cookie_domain'));}}  
if(key){this.stores[store_name][key]=value;}else{this.stores[store_name]=value;}  
if(!format){if(this.storeFormats.hasOwnProperty(store_name)){format=this.storeFormats[store_name];}}  
if(format==='json'){state_value=JSON.stringify(this.stores[store_name]);}else{state_value=OWA.util.assocStringFromJson(this.stores[store_name]);}  
if(!expiration_days){if(is_perminant){expiration_days=3600;}}  
OWA.debug('Populating state store (%s) with value: %s',store_name,state_value);var domain=OWA.getSetting('cookie_domain')||document.domain;OWA.util.setCookie('owa_'+store_name,state_value,expiration_days,'/',domain);},replaceStore:function(store_name,value,is_perminant,format,expiration_days){OWA.debug('replace state format: %s, value: %s',format,JSON.stringify(value));if(store_name){if(value){this.stores[store_name]=value;this.storeFormats[store_name]=format;if(format==='json'){cookie_value=JSON.stringify(value);}else{cookie_value=OWA.util.assocStringFromJson(value);}}  
var domain=OWA.getSetting('cookie_domain')||document.domain;if(!expiration_days){if(is_perminant){expiration_days=3600;}}  
OWA.debug('About to replace state store (%s) with: %s',store_name,cookie_value);OWA.util.setCookie('owa_'+store_name,cookie_value,expiration_days,'/',domain);}},getStateFromCookie:function(store_name){var store=unescape(OWA.util.readCookie(OWA.getSetting('ns')+store_name));if(store){return store;}},get:function(store_name,key){if(!this.isPresent(store_name)){this.load(store_name);}  
if(this.isPresent(store_name)){if(key){if(this.stores[store_name].hasOwnProperty(key)){return this.stores[store_name][key];}}else{return this.stores[store_name];}}else{OWA.debug('No state store (%s) was found',store_name);return'';}},getCookieValues:function(cookie_name){if(this.cookies.hasOwnProperty(cookie_name)){return this.cookies[cookie_name];}},load:function(store_name){var state='';var cookie_values=this.getCookieValues(OWA.getSetting('ns')+store_name);if(cookie_values){for(var i=0;i<cookie_values.length;i++){var raw_cookie_value=unescape(cookie_values[i]);var cookie_value=OWA.util.decodeCookieValue(raw_cookie_value);var format=OWA.util.getCookieValueFormat(raw_cookie_value);if(OWA.getSetting('hashCookiesToDomain')){var domain=OWA.getSetting('cookie_domain');var dhash=OWA.util.getCookieDomainHash(domain);if(cookie_value.hasOwnProperty('cdh')){OWA.debug('Cookie value cdh: %s, domain hash: %s',cookie_value.cdh,dhash);if(cookie_value.cdh==dhash){OWA.debug('Cookie: %s, index: %s domain hash matches current cookie domain. Loading...',store_name,i);state=cookie_value;break;}else{OWA.debug('Cookie: %s, index: %s domain hash does not match current cookie domain. Not loading.',store_name,i);}}else{OWA.debug('Cookie: %s, index: %s has no domain hash. Not going to Load it.',store_name,i);}}else{var lastIndex=cookie_values.length-1;if(i===lastIndex){state=cookie_value;}}}}  
if(state){this.stores[store_name]=state;this.storeFormats[store_name]=format;OWA.debug('Loaded state store: %s with: %s',store_name,JSON.stringify(state));}else{OWA.debug('No state for store: %s was found. Nothing to Load.',store_name);}},clear:function(store_name){this.stores[store_name]='';OWA.util.eraseCookie(OWA.getSetting('ns')+store_name);},getStoreFormat:function(store_name){return this.storeFormats[store_name];},setStoreFormat:function(store_name,format){this.storeFormats[store_name]=format;}};OWA.util={ns:function(string){return OWA.config.ns+string;},nsAll:function(obj){var nsObj=new Object();for(param in obj){if(obj.hasOwnProperty(param)){nsObj[OWA.config.ns+param]=obj[param];}}  
return nsObj;},getScript:function(file,path){jQuery.getScript(path+file);return;},makeUrl:function(template,uri,params){var url=jQuery.sprintf(template,uri,jQuery.param(OWA.util.nsAll(params)));return url;},createCookie:function(name,value,days,domain){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}  
else var expires="";document.cookie=name+"="+value+expires+"; path=/";},setCookie:function(name,value,days,path,domain,secure){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));document.cookie=name+"="+escape(value)+  
((days)?"; expires="+date.toGMTString():"")+  
((path)?"; path="+path:"")+  
((domain)?"; domain="+domain:"")+  
((secure)?"; secure":"");},readAllCookies:function(){OWA.debug('Reading all cookies...');var jar={};var ca=document.cookie.split(';');if(ca){OWA.debug(document.cookie);for(var i=0;i<ca.length;i++){cat=OWA.util.trim(ca[i]);var pos=OWA.util.strpos(cat,'=');var key=cat.substring(0,pos);var value=cat.substring(pos+1,cat.length);if(!jar.hasOwnProperty(key)){jar[key]=[];}  
jar[key].push(value);}  
OWA.debug(JSON.stringify(jar));return jar;}},readCookie:function(name){OWA.debug('Attempting to read cookie: %s',name);var jar=OWA.util.readAllCookies();if(jar){if(jar.hasOwnProperty(name)){return jar[name];}else{return'';}}},eraseCookie:function(name,domain){OWA.debug(document.cookie);if(!domain){domain=OWA.getSetting('cookie_domain')||document.domain;}  
OWA.debug("erasing cookie: "+name+" in domain: "+domain);this.setCookie(name,"",-1,"/",domain);var test=OWA.util.readCookie(name);if(test){var period=domain.substr(0,1);OWA.debug('period: '+period);if(period==='.'){var domain2=domain.substr(1);OWA.debug("erasing "+name+" in domain2: "+domain2);this.setCookie(name,"",-2,"/",domain2);}else{OWA.debug("erasing "+name+" in domain3: "+domain);this.setCookie(name,"",-2,"/",domain);}}},eraseMultipleCookies:function(names,domain){for(var i=0;i<names.length;i++){this.eraseCookie(names[i],domain);}},loadScript:function(url,callback){return LazyLoad.js(url,callback);},loadCss:function(url,callback){return LazyLoad.css(url,callback);},parseCookieString:function parseQuery(v){var queryAsAssoc=new Array();var queryString=unescape(v);var keyValues=queryString.split("|||");for(var i in keyValues){if(keyValues.hasOwnProperty(i)){var key=keyValues[i].split("=>");queryAsAssoc[key[0]]=key[1];}}  
return queryAsAssoc;},parseCookieStringToJson:function parseQuery(v){var queryAsObj=new Object;var queryString=unescape(v);var keyValues=queryString.split("|||");for(var i in keyValues){if(keyValues.hasOwnProperty(i)){var key=keyValues[i].split("=>");queryAsObj[key[0]]=key[1];}}  
return queryAsObj;},nsParams:function(obj){var new_obj=new Object;for(param in obj){if(obj.hasOwnProperty(param)){new_obj['owa_'+param]=obj[param];}}  
return new_obj;},urlEncode:function(str){str=(str+'').toString();return encodeURIComponent(str).replace(/!/g,'%21').replace(/'/g,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29').replace(/\*/g,'%2A').replace(/%20/g,'+');},urldecode:function(str){return decodeURIComponent(str.replace(/\+/g,'%20'));},parseUrlParams:function(url){var _GET={};for(var i,a,m,n,o,v,p=location.href.split(/[?&]/),l=p.length,k=1;k<l;k++)  
if((m=p[k].match(/(.*?)(\..*?|\[.*?\])?=([^#]*)/))&&m.length==4){n=decodeURI(m[1]).toLowerCase(),o=_GET,v=decodeURI(m[3]);if(m[2])  
for(a=decodeURI(m[2]).replace(/\[\s*\]/g,"[-1]").split(/[\.\[\]]/),i=0;i<a.length;i++)  
o=o[n]?o[n]:o[n]=(parseInt(a[i])==a[i])?[]:{},n=a[i].replace(/^["\'](.*)["\']$/,"$1");n!='-1'?o[n]=v:o[o.length]=v;}  
return _GET;},strpos:function(haystack,needle,offset){var i=(haystack+'').indexOf(needle,(offset||0));return i===-1?false:i;},strCountOccurances:function(haystack,needle){return haystack.split(needle).length-1;},implode:function(glue,pieces){var i='',retVal='',tGlue='';if(arguments.length===1){pieces=glue;glue='';}  
if(typeof(pieces)==='object'){if(pieces instanceof Array){return pieces.join(glue);}  
else{for(i in pieces){retVal+=tGlue+pieces[i];tGlue=glue;}  
return retVal;}}  
else{return pieces;}},checkForState:function(store_name){return OWA.checkForState(store_name);},setState:function(store_name,key,value,is_perminant,format,expiration_days){return OWA.setState(store_name,key,value,is_perminant,format,expiration_days);},replaceState:function(store_name,value,is_perminant,format,expiration_days){return OWA.replaceState(store_name,value,is_perminant,format,expiration_days);},getRawState:function(store_name){return OWA.getStateFromCookie(store_name);},getState:function(store_name,key){return OWA.getState(store_name,key);},clearState:function(store_name){return OWA.clearState(store_name);},getCookieValueFormat:function(cstring){var format='';var check=cstring.substr(0,1);if(check==='{'){format='json';}else{format='assoc';}  
return format;},decodeCookieValue:function(string){var format=OWA.util.getCookieValueFormat(string);var value='';if(format==='json'){value=JSON.parse(string);}else{value=OWA.util.jsonFromAssocString(string);}  
OWA.debug('decodeCookieValue - string: %s, format: %s, value: %s',string,format,JSON.stringify(value));return value;},encodeJsonForCookie:function(json_obj,format){format=format||'assoc';if(format==='json'){return JSON.stringify(json_obj);}else{return OWA.util.assocStringFromJson(json_obj);}},getCookieDomainHash:function(domain){return OWA.util.dechex(OWA.util.crc32(domain));},loadStateJson:function(store_name){var store=unescape(OWA.util.readCookie(OWA.getSetting('ns')+store_name));if(store){state=JSON.parse(store);}  
OWA.state[store_name]=state;OWA.debug('state store %s: %s',store_name,JSON.stringify(state));},is_array:function(input){return typeof(input)=='object'&&(input instanceof Array);},is_object:function(mixed_var){if(mixed_var instanceof Array){return false;}else{return(mixed_var!==null)&&(typeof(mixed_var)=='object');}},countObjectProperties:function(obj){var size=0,key;for(key in obj){if(obj.hasOwnProperty(key))size++;}  
return size;},jsonFromAssocString:function(str,inner,outer){inner=inner||'=>';outer=outer||'|||';if(str){if(!this.strpos(str,inner)){return str;}else{var assoc={};outer_array=str.split(outer);for(var i=0,n=outer_array.length;i<n;i++){var inside_array=outer_array[i].split(inner);assoc[inside_array[0]]=inside_array[1];}}  
return assoc;}},assocStringFromJson:function(obj){var string='';var i=0;var count=OWA.util.countObjectProperties(obj);for(prop in obj){i++;string+=prop+'=>'+obj[prop];if(i<count){string+='|||';}}  
return string;},getDomainFromUrl:function(url,strip_www){var domain=url.split(/\/+/g)[1];if(strip_www===true){var fp=domain.split('.')[0];if(fp==='www'){return domain.substring(4);}else{return domain;}}else{return domain;}},getCurrentUnixTimestamp:function(){return Math.round(new Date().getTime()/1000);},generateHash:function(value){return this.crc32(value);},generateRandomGuid:function(salt){var time=this.getCurrentUnixTimestamp();var random=this.rand();return this.generateHash(time+random+salt);},crc32:function(str){str=this.utf8_encode(str);var table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";var crc=0;var x=0;var y=0;crc=crc^(-1);for(var i=0,iTop=str.length;i<iTop;i++){y=(crc^str.charCodeAt(i))&0xFF;x="0x"+table.substr(y*9,8);crc=(crc>>>8)^x;}  
return crc^(-1);},utf8_encode:function(argString){var string=(argString+'');var utftext="";var start,end;var stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if(c1>127&&c1<2048){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}  
if(enc!==null){if(end>start){utftext+=string.substring(start,end);}  
utftext+=enc;start=end=n+1;}}  
if(end>start){utftext+=string.substring(start,string.length);}  
return utftext;},utf8_decode:function(str_data){var tmp_arr=[],i=0,ac=0,c1=0,c2=0,c3=0;str_data+='';while(i<str_data.length){c1=str_data.charCodeAt(i);if(c1<128){tmp_arr[ac++]=String.fromCharCode(c1);i++;}else if((c1>191)&&(c1<224)){c2=str_data.charCodeAt(i+1);tmp_arr[ac++]=String.fromCharCode(((c1&31)<<6)|(c2&63));i+=2;}else{c2=str_data.charCodeAt(i+1);c3=str_data.charCodeAt(i+2);tmp_arr[ac++]=String.fromCharCode(((c1&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}  
return tmp_arr.join('');},trim:function(str,charlist){var whitespace,l=0,i=0;str+='';if(!charlist){whitespace=" \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";}else{charlist+='';whitespace=charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,'$1');}  
l=str.length;for(i=0;i<l;i++){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(i);break;}}  
l=str.length;for(i=l-1;i>=0;i--){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(0,i+1);break;}}  
return whitespace.indexOf(str.charAt(0))===-1?str:'';},rand:function(min,max){var argc=arguments.length;if(argc===0){min=0;max=2147483647;}else if(argc===1){throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');}  
return Math.floor(Math.random()*(max-min+1))+min;},base64_encode:function(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc="",tmp_arr=[];if(!data){return data;}  
data=this.utf8_encode(data+'');do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i<data.length);enc=tmp_arr.join('');switch(data.length%3){case 1:enc=enc.slice(0,-2)+'==';break;case 2:enc=enc.slice(0,-1)+'=';break;}  
return enc;},base64_decode:function(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,dec="",tmp_arr=[];if(!data){return data;}  
data+='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64){tmp_arr[ac++]=String.fromCharCode(o1);}else if(h4==64){tmp_arr[ac++]=String.fromCharCode(o1,o2);}else{tmp_arr[ac++]=String.fromCharCode(o1,o2,o3);}}while(i<data.length);dec=tmp_arr.join('');dec=this.utf8_decode(dec);return dec;},sprintf:function(){var regex=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;var a=arguments,i=0,format=a[i++];var pad=function(str,len,chr,leftJustify){if(!chr){chr=' ';}  
var padding=(str.length>=len)?'':Array(1+len-str.length>>>0).join(chr);return leftJustify?str+padding:padding+str;};var justify=function(value,prefix,leftJustify,minWidth,zeroPad,customPadChar){var diff=minWidth-value.length;if(diff>0){if(leftJustify||!zeroPad){value=pad(value,minWidth,customPadChar,leftJustify);}else{value=value.slice(0,prefix.length)+pad('',diff,'0',true)+value.slice(prefix.length);}}  
return value;};var formatBaseX=function(value,base,prefix,leftJustify,minWidth,precision,zeroPad){var number=value>>>0;prefix=prefix&&number&&{'2':'0b','8':'0','16':'0x'}[base]||'';value=prefix+pad(number.toString(base),precision||0,'0',false);return justify(value,prefix,leftJustify,minWidth,zeroPad);};var formatString=function(value,leftJustify,minWidth,precision,zeroPad,customPadChar){if(precision!=null){value=value.slice(0,precision);}  
return justify(value,'',leftJustify,minWidth,zeroPad,customPadChar);};var doFormat=function(substring,valueIndex,flags,minWidth,_,precision,type){var number;var prefix;var method;var textTransform;var value;if(substring=='%%'){return'%';}  
var leftJustify=false,positivePrefix='',zeroPad=false,prefixBaseX=false,customPadChar=' ';var flagsl=flags.length;for(var j=0;flags&&j<flagsl;j++){switch(flags.charAt(j)){case' ':positivePrefix=' ';break;case'+':positivePrefix='+';break;case'-':leftJustify=true;break;case"'":customPadChar=flags.charAt(j+1);break;case'0':zeroPad=true;break;case'#':prefixBaseX=true;break;}}  
if(!minWidth){minWidth=0;}else if(minWidth=='*'){minWidth=+a[i++];}else if(minWidth.charAt(0)=='*'){minWidth=+a[minWidth.slice(1,-1)];}else{minWidth=+minWidth;}  
if(minWidth<0){minWidth=-minWidth;leftJustify=true;}  
if(!isFinite(minWidth)){throw new Error('sprintf: (minimum-)width must be finite');}  
if(!precision){precision='fFeE'.indexOf(type)>-1?6:(type=='d')?0:undefined;}else if(precision=='*'){precision=+a[i++];}else if(precision.charAt(0)=='*'){precision=+a[precision.slice(1,-1)];}else{precision=+precision;}  
value=valueIndex?a[valueIndex.slice(0,-1)]:a[i++];switch(type){case's':return formatString(String(value),leftJustify,minWidth,precision,zeroPad,customPadChar);case'c':return formatString(String.fromCharCode(+value),leftJustify,minWidth,precision,zeroPad);case'b':return formatBaseX(value,2,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case'o':return formatBaseX(value,8,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case'x':return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case'X':return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad).toUpperCase();case'u':return formatBaseX(value,10,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case'i':case'd':number=parseInt(+value,10);prefix=number<0?'-':positivePrefix;value=prefix+pad(String(Math.abs(number)),precision,'0',false);return justify(value,prefix,leftJustify,minWidth,zeroPad);case'e':case'E':case'f':case'F':case'g':case'G':number=+value;prefix=number<0?'-':positivePrefix;method=['toExponential','toFixed','toPrecision']['efg'.indexOf(type.toLowerCase())];textTransform=['toString','toUpperCase']['eEfFgG'.indexOf(type)%2];value=prefix+Math.abs(number)[method](precision);return justify(value,prefix,leftJustify,minWidth,zeroPad)[textTransform]();default:return substring;}};return format.replace(regex,doFormat);},clone:function(mixed){var newObj=(mixed instanceof Array)?[]:{};for(i in mixed){if(mixed[i]&&(typeof mixed[i]=="object")){newObj[i]=OWA.util.clone(mixed[i]);}else{newObj[i]=mixed[i];}}  
return newObj;},strtolower:function(str){return(str+'').toLowerCase();},in_array:function(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}  
return false;},dechex:function(number){if(number<0){number=0xFFFFFFFF+number+1;}  
return parseInt(number,10).toString(16);},explode:function(delimiter,string,limit){var emptyArray={0:''};if(arguments.length<2||typeof arguments[0]=='undefined'||typeof arguments[1]=='undefined'){return null;}  
if(delimiter===''||delimiter===false||delimiter===null){return false;}  
if(typeof delimiter=='function'||typeof delimiter=='object'||typeof string=='function'||typeof string=='object'){return emptyArray;}  
if(delimiter===true){delimiter='1';}  
if(!limit){return string.toString().split(delimiter.toString());}else{var splitted=string.toString().split(delimiter.toString());var partA=splitted.splice(0,limit-1);var partB=splitted.join(delimiter.toString());partA.push(partB);return partA;}}}  
//// End of owa ////  
//// Start of owa.tracker ////  
 
OWA.event=function(){this.properties=new Object();this.set('timestamp',OWA.util.getCurrentUnixTimestamp());}  
OWA.event.prototype={id:'',siteId:'',properties:{},get:function(name){if(this.properties.hasOwnProperty(name)){return this.properties[name];}},set:function(name,value){this.properties[name]=value;},setEventType:function(event_type){this.set("event_type",event_type);},getProperties:function(){return this.properties;},merge:function(properties){for(param in properties){if(properties.hasOwnProperty(param)){this.set(param,properties[param]);}}}}  
OWA.commandQueue=function(){OWA.debug('Command Queue object created');}  
OWA.commandQueue.prototype={asyncCmds:'',push:function(cmd){var args=Array.prototype.slice.call(cmd,1);var obj_name='';var method='';var check=OWA.util.strpos(cmd[0],'.');if(!check){obj_name='OWATracker';method=cmd[0];}else{var parts=cmd[0].split('.');obj_name=parts[0];method=parts[1];}  
OWA.debug('cmd queue object name %s',obj_name);OWA.debug('cmd queue object method name %s',method);if(typeof window[obj_name]=="undefined"){OWA.debug('making global object named: %s',obj_name);window[obj_name]=new OWA.tracker({globalObjectName:obj_name});}  
window[obj_name][method].apply(window[obj_name],args);},loadCmds:function(cmds){this.asyncCmds=cmds;},process:function(){for(var i=0;i<this.asyncCmds.length;i++){this.push(this.asyncCmds[i]);}}};OWA.tracker=function(options){this.startTime=this.getTimestamp();this.options={logClicks:true,logPage:true,logMovement:false,encodeProperties:false,movementInterval:100,logDomStreamPercentage:100,domstreamLoggingInterval:3000,domstreamEventThreshold:10,maxPriorCampaigns:5,campaignAttributionWindow:60,trafficAttributionMode:'direct',sessionLength:1800,thirdParty:false,cookie_domain:false,campaignKeys:[{public:'owa_medium',private:'md',full:'medium'},{public:'owa_campaign',private:'cn',full:'campaign'},{public:'owa_source',private:'sr',full:'source'},{public:'owa_search_terms',private:'tr',full:'search_terms'},{public:'owa_ad',private:'ad',full:'ad'},{public:'owa_ad_type',private:'at',full:'ad_type'}],logger_endpoint:'',api_endpoint:''};var endpoint=window.owa_baseUrl||OWA.config.baseUrl;if(endpoint){this.setEndpoint(endpoint);}else{OWA.debug('no global endpoint url found.');}  
this.endpoint=OWA.config.baseUrl;this.active=true;if(options){for(opt in options){this.options[opt]=options[opt];}}  
this.ecommerce_transaction='',this.isClickTrackingEnabled=false;this.checkForOverlaySession();this.page=new OWA.event();this.page.set('page_url',document.URL);this.setPageTitle(document.title);this.page.set("referer",document.referrer);this.page.set('timestamp',this.startTime);if(typeof owa_params!='undefined'){if(owa_params.length>0){this.page.merge(owa_params);}}}  
OWA.tracker.prototype={id:'',siteId:'',init:0,stateInit:false,globalEventProperties:{},sharableStateStores:['v','s','c'],startTime:null,endTime:null,campaignState:[],isNewCampaign:false,isNewSessionFlag:false,isTrafficAttributed:false,cookie_names:['owa_s','owa_v','owa_c'],linkedStateSet:false,hashCookiesToDomain:true,urlParams:{},streamBindings:['bindMovementEvents','bindScrollEvents','bindKeypressEvents','bindClickEvents'],page:'',click:'',domstream:'',movement:'',keystroke:'',hover:'',last_event:'',last_movement:'',event_queue:[],player:'',overlay:'',setDebug:function(bool){OWA.setSetting('debug',bool);},checkForLinkedState:function(){var ls=this.getUrlParam('owa_state');if(!ls){ls=this.getAnchorParam('owa_state');}  
if(ls){OWA.debug('Shared OWA state detected...');ls=OWA.util.base64_decode(OWA.util.urldecode(ls));OWA.debug('linked state: %s',ls);var state=ls.split('.');OWA.debug('linked state: %s',JSON.stringify(state));if(state){for(var i=0;state.length>i;i++){var pair=state[i].split('=');OWA.debug('pair: %s',pair);var value=OWA.util.urldecode(pair[1]);OWA.debug('pair: %s',value);decodedvalue=OWA.util.decodeCookieValue(value);var format=OWA.util.getCookieValueFormat(value);decodedvalue.cdh=OWA.util.getCookieDomainHash(this.getCookieDomain());OWA.replaceState(pair[0],decodedvalue,true,format);}}}  
this.linkedStateSet=true;},shareStateByLink:function(url){OWA.debug('href of link: '+url);if(url){var state=this.createSharedStateValue();var anchor=this.getUrlAnchorValue();if(!anchor){OWA.debug('shared state: %s',state);document.location.href=url+'#owa_state.'+state;}else{}}},createSharedStateValue:function(){var state='';for(var i=0;this.sharableStateStores.length>i;i++){var value=OWA.getState(this.sharableStateStores[i]);value=OWA.util.encodeJsonForCookie(value,OWA.getStateStoreFormat(this.sharableStateStores[i]));if(value){state+=OWA.util.sprintf('%s=%s',this.sharableStateStores[i],OWA.util.urlEncode(value));if(this.sharableStateStores.length!=(i+1)){state+='.';}}}  
if(state){OWA.debug('linked state to send: %s',state);state=OWA.util.base64_encode(state);state=OWA.util.urlEncode(state);return state;}},shareShareByPost:function(form){var state=this.createSharedStateValue();form.action+='#owa_state.'+state;form.submit();},getCookieDomain:function(){return this.getOption('cookie_domain')||OWA.getSetting('cookie_domain')||document.domain;},setCookieDomain:function(domain){var not_passed=false;if(!domain){domain=document.domain;not_passed=true;}  
var period=domain.substr(0,1);if(period==='.'){domain=domain.substr(1);}  
var contains_www=false;var www=domain.substr(0,4);if(www==='www.'){if(not_passed){domain=domain.substr(4);}  
contains_www=true;}  
var match=false;if(document.domain===domain){match=true;}  
domain='.'+domain;this.setOption('cookie_domain',domain);this.setOption('cookie_domain_set',true);OWA.setSetting('cookie_domain',domain);OWA.debug('Cookie domain is: %s',domain);},getCookieDomainHash:function(domain){return OWA.util.crc32(domain);},setCookieDomainHashing:function(value){this.hashCookiesToDomain=value;OWA.setSetting('hashCookiesToDomain',value);},checkForOverlaySession:function(){var a=this.getAnchorParam('owa_overlay');if(a){a=OWA.util.base64_decode(OWA.util.urldecode(a));a=OWA.util.urldecode(a);OWA.debug('overlay anchor value: '+a);OWA.util.setCookie('owa_overlay',a,'','/',document.domain);this.pause();OWA.startOverlaySession(OWA.util.decodeCookieValue(a));}},getUrlAnchorValue:function(){var anchor=self.document.location.hash.substring(1);OWA.debug('anchor value: '+anchor);return anchor;},getAnchorParam:function(name){var anchor=this.getUrlAnchorValue();if(anchor){OWA.debug('anchor is: %s',anchor);var pairs=anchor.split(',');OWA.debug('anchor pairs: %s',JSON.stringify(pairs));if(pairs.length>0){var values={};for(var i=0;pairs.length>i;i++){var pieces=pairs[i].split('.');OWA.debug('anchor pieces: %s',JSON.stringify(pieces));values[pieces[0]]=pieces[1];}  
OWA.debug('anchor values: %s',JSON.stringify(values));if(values.hasOwnProperty(name)){return values[name];}}}},getUrlParam:function(name){this.urlParams=this.urlParams||OWA.util.parseUrlParams();if(this.urlParams.hasOwnProperty(name)){return this.urlParams[name];}else{return false;}},dynamicFunc:function(func){var args=Array.prototype.slice.call(func,1);this[func[0]].apply(this,args);},setPageTitle:function(title){this.page.set("page_title",title);},setPageType:function(type){this.page.set("page_type",type);},setSiteId:function(site_id){this.siteId=site_id;},getSiteId:function(){return this.siteId;},setEndpoint:function(endpoint){endpoint=('https:'==document.location.protocol?window.owa_baseSecUrl||endpoint.replace(/http:/,'https:'):endpoint);this.setOption('baseUrl',endpoint);OWA.config.baseUrl=endpoint;},setLoggerEndpoint:function(url){this.setOption('logger_endpoint',this.forceUrlProtocol(url));},getLoggerEndpoint:function(){var url=this.getOption('logger_endpoint')||this.getEndpoint()||OWA.getSetting('baseUrl');return url+'log.php';},setApiEndpoint:function(url){this.setOption('api_endpoint',this.forceUrlProtocol(url));OWA.setApiEndpoint(url);},getApiEndpoint:function(){return this.getOption('api_endpoint')||this.getEndpoint()+'api.php';},forceUrlProtocol:function(url){url=('https:'==document.location.protocol?url.replace(/http:/,'https:'):url);return url;},getEndpoint:function(){return this.getOption('baseUrl');},trackPageView:function(url){if(url){this.page.set('page_url',url);}  
this.page.setEventType("base.page_request");return this.trackEvent(this.page);},trackAction:function(action_group,action_name,action_label,numeric_value){var event=new OWA.event;event.setEventType('track.action');event.set('site_id',this.getSiteId());event.set('page_url',this.page.get('page_url'));event.set('action_group',action_group);event.set('action_name',action_name);event.set('action_label',action_label);event.set('numeric_value',numeric_value);this.trackEvent(event);OWA.debug("Action logged");},trackClicks:function(handler){this.setOption('logClicksAsTheyHappen',true);this.bindClickEvents();},bindClickEvents:function(){if(!this.isClickTrackingEnabled){var that=this;if(window.addEventListener){window.addEventListener('click',function(e){that.clickEventHandler(e);},false);}else if(window.attachEvent){window.attachEvent('click',function(e){that.clickEventHandler(e);});}  
this.isClickTrackingEnabled=true;}},trackDomStream:function(){if(this.active){var rand=Math.floor(Math.random()*100+1);if(rand<=this.getOption('logDomStreamPercentage')){this.setOption('trackDomStream',true);var len=this.streamBindings.length;for(var i=0;i<len;i++){this.callMethod(this.streamBindings[i]);}  
this.startDomstreamTimer();}else{OWA.debug("not tracking domstream for this user.");}}},logDomStream:function(){this.domstream=this.domstream||new OWA.event;if(this.event_queue.length>this.options.domstreamEventThreshold){if(!this.domstream.get('domstream_guid')){var salt='domstream'+this.page.get('page_url')+this.getSiteId();this.domstream.set('domstream_guid',OWA.util.generateRandomGuid(salt));}  
this.domstream.setEventType('dom.stream');this.domstream.set('site_id',this.getSiteId());this.domstream.set('page_url',this.page.get('page_url'));this.domstream.set('timestamp',OWA.util.getCurrentUnixTimestamp());this.domstream.set('duration',this.getElapsedTime());this.domstream.set('stream_events',JSON.stringify(this.event_queue));this.domstream.set('stream_length',this.event_queue.length);this.trackEvent(this.domstream);this.event_queue=[];}else{OWA.debug("Domstream had too few events to log.");}},startDomstreamTimer:function(){var interval=this.getOption('domstreamLoggingInterval')  
var that=this;var domstreamTimer=setInterval(function(){that.logDomStream()},interval);},log:function(){this.page.setEventType("base.page_request");return this.logEvent(this.page);},logEventAjax:function(event,method){if(this.active){if(event instanceof OWA.event){var properties=event.getProperties();}else{var properties=event;}  
method=method||'GET';if(method==='GET'){return this.ajaxGet(properties);}else{this.ajaxPost(properties);return;}}},isObjectType:function(obj,type){return!!(obj&&type&&type.prototype&&obj.constructor==type.prototype.constructor);},getAjaxObj:function(){if(window.XMLHttpRequest){var ajax=new XMLHttpRequest()}else{if(window.ActiveXObject){var ajax=new ActiveXObject("Microsoft.XMLHTTP");}}  
return ajax;},ajaxGet:function(properties){var url=this._assembleRequestUrl(properties);var ajax=this.getAjaxObj();ajax.open("GET",url,false);ajax.send(null);},ajaxPost:function(properties){var ajax=this.getAjaxObj();var params=this.prepareRequestParams(properties);ajax.open("POST",this.getLoggerEndpoint(),false);ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");ajax.setRequestHeader("Content-length",params.length);ajax.setRequestHeader("Connection","close");ajax.onreadystatechange=function(){if(ajax.readyState==4&&ajax.status==200){}}  
ajax.send(params);},ajaxJsonp:function(url){var script=document.createElement("script");script.setAttribute("src",url);script.setAttribute("type","text/javascript");document.body.appendChild(script);},prepareRequestParams:function(properties){var get='';properties.site_id=this.getSiteId();for(param in properties){var value='';var kvp='';if(properties.hasOwnProperty(param)){if(OWA.util.is_array(properties[param])){for(var i=0,n=properties[param].length;i<n;i++){if(OWA.util.is_object(properties[param][i])){for(o_param in properties[param][i]){kvp=OWA.util.sprintf('owa_%s[%s][%s]=%s&',param,i,o_param,OWA.util.urlEncode(properties[param][i][o_param]));get+=kvp;}}else{kvp=OWA.util.sprintf('owa_%s[%s]=%s&',param,i,OWA.util.urlEncode(properties[param][i]));get+=kvp;}}}else{kvp=OWA.util.sprintf('owa_%s=%s&',param,OWA.util.urlEncode(properties[param]));}}else{kvp=OWA.util.sprintf('owa_%s=%s&','',OWA.util.urlEncode(properties[param]));}  
get+=kvp;}  
return get;},trackEvent:function(event,block){if(this.getOption('cookie_domain_set')!=true){this.setCookieDomain();}  
if(this.linkedStateSet!=true){this.checkForLinkedState();}  
if(this.active){if(!block){block_flag=false;}else{block_flag=true;}  
if(this.getOption('thirdParty')){this.globalEventProperties.thirdParty=true;this.setCampaignRelatedProperties(event);}else{this.manageState(event);}  
this.addGlobalPropertiesToEvent(event);return this.logEvent(event.getProperties(),block_flag);}},addGlobalPropertiesToEvent:function(event){OWA.debug('Adding global properties to event: %s',JSON.stringify(this.globalEventProperties));for(prop in this.globalEventProperties){event.set(prop,this.globalEventProperties[prop]);}},logEvent:function(properties,block){if(this.active){var url=this._assembleRequestUrl(properties);OWA.debug('url : %s',url);image=new Image(1,1);image.onLoad=function(){};image.src=url;if(block){}  
OWA.debug('Inserted web bug for %s',properties['event_type']);}},_assembleRequestUrl:function(properties){properties.site_id=this.getSiteId();var get=this.prepareRequestParams(properties);var log_url=this.getLoggerEndpoint();if(log_url.indexOf('?')===-1){log_url+='?';}else{log_url+='&';}  
return log_url+get;},getViewportDimensions:function(){var viewport=new Object();viewport.width=window.innerWidth?window.innerWidth:document.body.offsetWidth;viewport.height=window.innerHeight?window.innerHeight:document.body.offsetHeight;return viewport;},findPosX:function(obj){var curleft=0;if(obj.offsetParent)  
{while(obj.offsetParent)  
{curleft+=obj.offsetLeft  
obj=obj.offsetParent;}}  
else if(obj.x)  
curleft+=obj.x;return curleft;},findPosY:function(obj){var curtop=0;if(obj.offsetParent)  
{while(obj.offsetParent)  
{curtop+=obj.offsetTop  
obj=obj.offsetParent;}}  
else if(obj.y)  
curtop+=obj.y;return curtop;},_getTarget:function(e){var targ=e.target||e.srcElement;if(targ.nodeType==3){targ=target.parentNode;}  
return targ;},getCoords:function(e){var coords=new Object();if(typeof(e.pageX)=='number'){coords.x=e.pageX+'';coords.y=e.pageY+'';}else{coords.x=e.clientX+'';coords.y=e.clientY+'';}  
return coords;},getDomElementProperties:function(targ){var properties=new Object();properties.dom_element_tag=targ.tagName;if(targ.tagName=="A"){if(targ.textContent!=undefined){properties.dom_element_text=targ.textContent;}else{properties.dom_element_text=targ.innerText;}  
properties.target_url=targ.href;}else if(targ.tagName=="INPUT"){properties.dom_element_text=targ.value;}else if(targ.tagName=="IMG"){properties.target_url=targ.parentNode.href;properties.dom_element_text=targ.alt;}else{if(targ.textContent!=undefined){properties.html_element_text='';}else{properties.html_element_text='';}}  
return properties;},clickEventHandler:function(e){e=e||window.event;var click=new OWA.event();click.setEventType("dom.click");var targ=this._getTarget(e);var dom_name='(not set)';if(targ.hasOwnProperty('name')&&targ.name.length>0){dom_name=targ.name;}  
click.set("dom_element_name",dom_name);var dom_value='(not set)';if(targ.hasOwnProperty('value')&&targ.value.length>0){dom_value=targ.value;}  
click.set("dom_element_value",dom_value);var dom_id='(not set)';if(!targ.hasOwnProperty('id')&&targ.id.length>0){dom_id=targ.id;}  
click.set("dom_element_id",dom_id);var dom_class='(not set)';if(targ.hasOwnProperty('className')&&targ.className.length>0){dom_class=targ.className;}  
click.set("dom_element_class",dom_class);click.set("dom_element_tag",OWA.util.strtolower(targ.tagName));click.set("page_url",window.location.href);var viewport=this.getViewportDimensions();click.set("page_width",viewport.width);click.set("page_height",viewport.height);var properties=this.getDomElementProperties(targ);click.merge(this.filterDomProperties(properties));click.set("dom_element_x",this.findPosX(targ)+'');click.set("dom_element_y",this.findPosY(targ)+'');var coords=this.getCoords(e);click.set('click_x',coords.x);click.set('click_y',coords.y);if(this.getOption('trackDomStream')){this.addToEventQueue(click)}  
var full_click=OWA.util.clone(click);if(this.getOption('logClicksAsTheyHappen')){this.trackEvent(full_click);}  
this.click=full_click;},filterDomProperties:function(properties){return properties;},callMethod:function(string,data){return this[string](data);},addDomStreamEventBinding:function(method_name){this.streamBindings.push(method_name);},bindMovementEvents:function(){var that=this;document.onmousemove=function(e){that.movementEventHandler(e);}},movementEventHandler:function(e){e=e||window.event;var now=this.getTime();if(now>this.last_movement+this.getOption('movementInterval')){this.movement=new OWA.event();this.movement.setEventType("dom.movement");var coords=this.getCoords(e);this.movement.set('cursor_x',coords.x);this.movement.set('cursor_y',coords.y);this.addToEventQueue(this.movement);this.last_movement=now;}},bindScrollEvents:function(){var that=this;window.onscroll=function(e){that.scrollEventHandler(e);}},scrollEventHandler:function(e){e=e||window.event;var now=this.getTimestamp();var event=new OWA.event();event.setEventType('dom.scroll');var coords=this.getScrollingPosition();event.set('x',coords.x);event.set('y',coords.y);var targ=this._getTarget(e);event.set("dom_element_name",targ.name);event.set("dom_element_value",targ.value);event.set("dom_element_id",targ.id);this.addToEventQueue(event);this.last_scroll=now;},getScrollingPosition:function(){var position=[0,0];if(typeof window.pageYOffset!='undefined'){position={x:window.pageXOffset,y:window.pageYOffset};}else if(typeof document.documentElement.scrollTop!='undefined'&&document.documentElement.scrollTop>0){position={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};}else if(typeof document.body.scrollTop!='undefined'){position={x:document.body.scrollLeft,y:document.body.scrollTop};}  
return position;},bindHoverEvents:function(){},bindFocusEvents:function(){var that=this;},bindKeypressEvents:function(){var that=this;document.onkeypress=function(e){that.keypressEventHandler(e);}},keypressEventHandler:function(e){var targ=this._getTarget(e);if(targ.tagName==='INPUT'&&targ.type==='password'){return;}  
var key_code=e.keyCode?e.keyCode:e.charCode  
var key_value=String.fromCharCode(key_code);var event=new OWA.event();event.setEventType('dom.keypress');event.set('key_value',key_value);event.set('key_code',key_code);event.set("dom_element_name",targ.name);event.set("dom_element_value",targ.value);event.set("dom_element_id",targ.id);event.set("dom_element_tag",targ.tagName);this.addToEventQueue(event);},getTimestamp:function(){return OWA.util.getCurrentUnixTimestamp();},getTime:function(){return Math.round(new Date().getTime());},getElapsedTime:function(){return this.getTimestamp()-this.startTime;},getOption:function(name){if(this.options.hasOwnProperty(name)){return this.options[name];}},setOption:function(name,value){this.options[name]=value;},setLastEvent:function(event){return;},addToEventQueue:function(event){if(this.active&&!this.isPausedBySibling()){var now=this.getTimestamp();if(event!=undefined){this.event_queue.push(event.getProperties());}else{}}},isPausedBySibling:function(){return OWA.getSetting('loggerPause');},sleep:function(delay){var start=new Date().getTime();while(new Date().getTime()<start+delay);},pause:function(){this.active=false;},restart:function(){this.active=true;},makeEvent:function(){return new OWA.event();},addStreamEventBinding:function(name){this.streamBindings.push(name);},getCampaignProperties:function(){if(!this.urlParams.length>0){this.urlParams=OWA.util.parseUrlParams(document.URL);OWA.debug('GET: '+JSON.stringify(this.urlParams));}  
var campaignKeys=this.getOption('campaignKeys');var campaign_params={};for(var i=0,n=campaignKeys.length;i<n;i++){if(this.urlParams.hasOwnProperty(campaignKeys[i].public)){campaign_params[campaignKeys[i].private]=this.urlParams[campaignKeys[i].public];this.isNewCampaign=true;}}  
if(campaign_params['at']&&!campaign_params['ad']){campaign_params['ad']='(not set)';}  
if(campaign_params['ad']&&!campaign_params['at']){campaign_params['at']='(not set)';}  
if(this.isNewCampaign){}  
return campaign_params;},applyCampaignPropertiesToEvent:function(event,properties){var campaignKeys=this.getOption('campaignKeys');for(var i=0,n=campaignKeys.length;i<n;i++){if(properties.hasOwnProperty(campaignKeys[i].private)){this.setGlobalEventProperty(campaignKeys[i].full,properties[campaignKeys[i].private]);}}},setCampaignRelatedProperties:function(event){var properties=this.getCampaignProperties();OWA.debug('campaign properties: %s',JSON.stringify(properties));this.applyCampaignPropertiesToEvent(event,properties);},directAttributionModel:function(campaign_params){if(this.isNewCampaign){OWA.debug('campaign state length: %s',this.campaignState.length);this.campaignState.push(campaign_params);if(this.campaignState.length>this.options.maxPriorCampaigns){var removed=this.campaignState.splice(0,1);OWA.debug('Too many prior campaigns in state store. Dropping oldest to make room.');}  
this.setCampaignCookie(this.campaignState);this.isTrafficAttributed=true;}},originalAttributionModel:function(campaign_params){if(this.campaignState.length>0){OWA.debug('Original attribution detected.');campaign_params=this.campaignState[0];this.isTrafficAttributed=true;}else{OWA.debug('Setting Original Campaign touch.');if(this.isNewCampaign){this.campaignState.push(campaign_params);this.setCampaignCookie(this.campaignState);this.isTrafficAttributed=true;}}  
return campaign_params;},setTrafficAttribution:function(event){var campaignState=OWA.getState('c','attribs');if(campaignState){this.campaignState=campaignState;}  
var campaign_params=this.getCampaignProperties();switch(this.options.trafficAttributionMode){case'direct':OWA.debug('Applying "Direct" Traffic Attribution Model');this.directAttributionModel(campaign_params);break;case'original':OWA.debug('Applying "Original" Traffic Attribution Model');campaign_params=this.originalAttributionModel(campaign_params);break;default:OWA.debug('Applying Default (Direct) Traffic Attribution Model');this.directAttributionModel(campaign_params);}  
if(this.isTrafficAttributed){OWA.debug('Attributing Traffic to: %s',JSON.stringify(campaign_params));this.applyCampaignPropertiesToEvent(event,campaign_params);if(this.campaignState.length>0){this.setGlobalEventProperty('attribs',JSON.stringify(this.campaignState));}}else{OWA.debug('No traffic attribution.');}},setCampaignCookie:function(values){OWA.setState('c','attribs',values,'','json',this.options.campaignAttributionWindow);},checkRefererForSearchEngine:function(referer){var _get=OWA.util.parseUrlParams(referer);var query_params=['q','p','search','Keywords','ask','keyword','keywords','kw','pattern','pgm','qr','qry','qs','qt','qu','query','queryterm','question','sTerm','searchfor','searchText','srch','su','what'];for(var i=0,n=query_params.length;i<n;i++){if(_get[query_params[i]]){OWA.debug('Found search engine query param: '+query_params[i]);return true;}}},addTransaction:function(order_id,order_source,total,tax,shipping,gateway,city,state,country){this.ecommerce_transaction=new OWA.event();this.ecommerce_transaction.setEventType('ecommerce.transaction');this.ecommerce_transaction.set('ct_order_id',order_id);this.ecommerce_transaction.set('ct_order_source',order_source);this.ecommerce_transaction.set('ct_total',total);this.ecommerce_transaction.set('ct_tax',tax);this.ecommerce_transaction.set('ct_shipping',shipping);this.ecommerce_transaction.set('ct_gateway',gateway);this.ecommerce_transaction.set('page_url',this.page.get('page_url'));this.ecommerce_transaction.set('city',city);this.ecommerce_transaction.set('state',state);this.ecommerce_transaction.set('country',country);OWA.debug('setting up ecommerce transaction');this.ecommerce_transaction.set('ct_line_items',[]);OWA.debug('completed setting up ecommerce transaction');},addTransactionLineItem:function(order_id,sku,product_name,category,unit_price,quantity){if(!this.ecommerce_transaction){this.addTransaction('none set');}  
var li={};li.li_order_id=order_id;li.li_sku=sku;li.li_product_name=product_name;li.li_category=category;li.li_unit_price=unit_price;li.li_quantity=quantity;var items=this.ecommerce_transaction.get('ct_line_items');items.push(li);this.ecommerce_transaction.set('ct_line_items',items);},trackTransaction:function(){if(this.ecommerce_transaction){this.trackEvent(this.ecommerce_transaction);this.ecommerce_transaction='';}},manageState:function(event){if(!this.stateInit){this.setVisitorId(event);this.setFirstSessionTimestamp(event);this.setLastRequestTime(event);this.setSessionId(event);this.setNumberPriorSessions(event);this.setTrafficAttribution(event);this.stateInit=true;}},setNumberPriorSessions:function(event){OWA.debug('setting number of prior sessions');var nps=OWA.getState('v','nps');if(!nps){nps='0';}  
if(this.isNewSessionFlag===true){nps=nps*1;nps++;OWA.setState('v','nps',nps,true);}  
this.globalEventProperties.num_prior_sessions=nps;},setVisitorId:function(event){var visitor_id=OWA.getState('v','vid');if(!visitor_id){visitor_id=OWA.getState('v');if(visitor_id){OWA.clearState('v');OWA.setState('v','vid',visitor_id,true);}}  
if(!visitor_id){visitor_id=OWA.util.generateRandomGuid(this.siteId);this.globalEventProperties.is_new_visitor=true;OWA.setState('v','vid',visitor_id,true);OWA.debug('Creating new visitor id');}  
this.globalEventProperties.visitor_id=visitor_id;},setFirstSessionTimestamp:function(event){var fsts=OWA.getState('v','fsts');if(!fsts){fsts=event.get('timestamp');OWA.debug('setting fsts value: %s',fsts);OWA.setState('v','fsts',fsts,true);}  
this.globalEventProperties.fsts=fsts;},setLastRequestTime:function(event){var last_req=OWA.getState('s','last_req');if(!last_req){var state_store_name=OWA.util.sprintf('%s_%s','ss',this.siteId);last_req=OWA.getState(state_store_name,'last_req');}  
this.globalEventProperties.last_req=last_req;OWA.setState('s','last_req',event.get('timestamp'),true);},setSessionId:function(event){var session_id='';var state_store_name='';var is_new_session=this.isNewSession(event.get('timestamp'),this.getGlobalEventProperty('last_req'));if(is_new_session){var prior_session_id=OWA.getState('s','sid');if(!prior_session_id){state_store_name=OWA.util.sprintf('%s_%s','ss',this.getSiteId());prior_session_id=OWA.getState(state_store_name,'s');}  
if(prior_session_id){this.globalEventProperties.prior_session_id=prior_session_id;}  
session_id=OWA.util.generateRandomGuid(this.getSiteId());this.globalEventProperties.session_id=session_id;this.globalEventProperties.is_new_session=true;this.isNewSessionFlag=true;OWA.setState('s','sid',session_id,true);}else{session_id=OWA.getState('s','sid');if(!session_id){state_store_name=OWA.util.sprintf('%s_%s','ss',this.getSiteId());session_id=OWA.getState(state_store_name,'s');OWA.setState('s','sid',session_id,true);}  
this.globalEventProperties.session_id=session_id;}  
if(!this.getGlobalEventProperty('session_id')){session_id=OWA.util.generateRandomGuid(this.getSiteId());this.globalEventProperties.session_id=session_id;this.globalEventProperties.is_new_session=true;this.isNewSessionFlag=true;OWA.setState('s','sid',session_id,true);}},isNewSession:function(timestamp,last_req){var is_new_session=false;if(!timestamp){timestamp=OWA.util.getCurrentUnixTimestamp();}  
if(!last_req){last_req=0;}  
var time_since_lastreq=timestamp-last_req;var len=this.options.sessionLength;if(time_since_lastreq<len){OWA.debug("This request is part of a active session.");return false;}else{OWA.debug("This request is the start of a new session. Prior session expired.");return true;}},getGlobalEventProperty:function(name){if(this.globalEventProperties.hasOwnProperty(name)){return this.globalEventProperties[name];}},setGlobalEventProperty:function(name,value){this.globalEventProperties[name]=value;},setPageProperties:function(properties){for(prop in properties){if(properties.hasOwnProperty(prop)){this.page.set(prop,properties[prop]);}}}};(function(){if(typeof owa_cmds==='undefined'){var q=new OWA.commandQueue();}else{if(OWA.util.is_array(owa_cmds)){var q=new OWA.commandQueue();q.loadCmds(owa_cmds);}}  
window['owa_cmds']=q;window['owa_cmds'].process();})();  
//// End of owa.tracker ////  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* OWA Generic Event Object  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
OWA.event = function() {  
 
this.properties = new Object();  
this.set('timestamp', OWA.util.getCurrentUnixTimestamp() );  
}  
 
OWA.event.prototype = {  
 
id : '',  
 
siteId : '',  
 
properties : {},  
 
get : function(name) {  
 
if ( this.properties.hasOwnProperty(name) ) {  
 
return this.properties[name];  
}  
},  
 
set : function(name, value) {  
 
this.properties[name] = value;  
},  
 
setEventType : function(event_type) {  
 
this.set("event_type", event_type);  
},  
 
getProperties : function() {  
 
return this.properties;  
},  
 
merge : function(properties) {  
 
for(param in properties) {  
 
if (properties.hasOwnProperty(param)) {  
 
this.set(param, properties[param]);  
}  
}  
}  
}  
 
OWA.commandQueue = function() {  
 
OWA.debug('Command Queue object created');  
}  
 
OWA.commandQueue.prototype = {  
asyncCmds: '',  
push : function (cmd) {  
 
//alert(func[0]);  
var args = Array.prototype.slice.call(cmd, 1);  
//alert(args);  
 
var obj_name = '';  
var method = '';  
var check = OWA.util.strpos( cmd[0], '.' );  
 
if ( ! check ) {  
obj_name = 'OWATracker';  
method = cmd[0];  
} else {  
var parts = cmd[0].split( '.' );  
obj_name = parts[0];  
method = parts[1];  
}  
 
OWA.debug('cmd queue object name %s', obj_name);  
OWA.debug('cmd queue object method name %s', method);  
 
// is OWATracker created?  
if ( typeof window[obj_name] == "undefined" ) {  
OWA.debug('making global object named: %s', obj_name);  
window[obj_name] = new OWA.tracker( { globalObjectName: obj_name } );  
}  
 
window[obj_name][method].apply(window[obj_name], args);  
},  
 
loadCmds: function(cmds) {  
 
this.asyncCmds = cmds;  
},  
 
process: function() {  
 
for (var i=0; i < this.asyncCmds.length;i++) {  
this.push(this.asyncCmds[i]);  
}  
}  
};  
 
/**  
* Javascript Tracker Object  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
OWA.tracker = function( options ) {  
 
//this.setDebug(true);  
// set start time  
this.startTime = this.getTimestamp();  
 
// Configuration options  
this.options = {  
logClicks: true,  
logPage: true,  
logMovement: false,  
encodeProperties: false,  
movementInterval: 100,  
logDomStreamPercentage: 100,  
domstreamLoggingInterval: 3000,  
domstreamEventThreshold: 10,  
maxPriorCampaigns: 5,  
campaignAttributionWindow: 60,  
trafficAttributionMode: 'direct',  
sessionLength: 1800,  
thirdParty: false,  
cookie_domain: false,  
campaignKeys: [  
{ public: 'owa_medium', private: 'md', full: 'medium' },  
{ public: 'owa_campaign', private: 'cn', full: 'campaign' },  
{ public: 'owa_source', private: 'sr', full: 'source' },  
{ public: 'owa_search_terms', private: 'tr', full: 'search_terms' },  
{ public: 'owa_ad', private: 'ad', full: 'ad' },  
{ public: 'owa_ad_type', private: 'at', full: 'ad_type' } ],  
logger_endpoint: '',  
api_endpoint: ''  
 
};  
 
// Endpoint URL of log service. needed for backwards compatability with old tags  
var endpoint = window.owa_baseUrl || OWA.config.baseUrl ;  
if (endpoint) {  
this.setEndpoint(endpoint);  
} else {  
OWA.debug('no global endpoint url found.');  
}  
 
this.endpoint = OWA.config.baseUrl;  
// Active status of tracker  
this.active = true;  
 
if ( options ) {  
 
for (opt in options) {  
 
this.options[opt] = options[opt];  
}  
}  
 
// private vars  
this.ecommerce_transaction = '',  
this.isClickTrackingEnabled = false;  
 
// check to se if an overlay session is active  
this.checkForOverlaySession();  
 
// set default page properties  
this.page = new OWA.event();  
this.page.set('page_url', document.URL);  
this.setPageTitle(document.title);  
this.page.set("referer", document.referrer);  
this.page.set('timestamp', this.startTime);  
 
// merge page properties from global owa_params object  
if (typeof owa_params != 'undefined') {  
// merge page params from the global object if it exists  
if (owa_params.length > 0) {  
this.page.merge(owa_params);  
}  
}  
}  
 
OWA.tracker.prototype = {  
 
id : '',  
// site id  
siteId : '',  
// ???  
init: 0,  
// flag to tell if client state has been set  
stateInit: false,  
// properties that should be added to all events  
globalEventProperties: {},  
// state sores that can be shared across sites  
sharableStateStores: ['v', 's', 'c'],  
// Time When tracker is loaded  
startTime: null,  
// time when tracker is unloaded  
endTime: null,  
// campaign state holder  
campaignState : [],  
// flag for new campaign status  
isNewCampaign: false,  
// flag for new session status  
isNewSessionFlag: false,  
// flag for whether or not traffic has been attributed  
isTrafficAttributed: false,  
cookie_names: ['owa_s', 'owa_v', 'owa_c'],  
linkedStateSet: false,  
hashCookiesToDomain: true,  
/**  
* GET params parsed from URL  
*/  
urlParams: {},  
/**  
* DOM stream Event Binding Methods  
*/  
streamBindings : ['bindMovementEvents', 'bindScrollEvents','bindKeypressEvents', 'bindClickEvents'],  
/**  
* Page view event  
*/  
page : '',  
/**  
* Latest click event  
*/  
click : '',  
/**  
* Domstream event  
*/  
domstream : '',  
/**  
* Latest Movement Event  
*/  
movement : '',  
/**  
* Latest Keystroke Event  
*/  
keystroke : '',  
/**  
* Latest Hover Event  
*/  
hover : '',  
 
last_event : '',  
last_movement : '',  
/**  
* DOM Stream Event Queue  
*/  
event_queue : [],  
player: '',  
overlay: '',  
 
setDebug : function(bool) {  
 
OWA.setSetting('debug', bool);  
},  
 
checkForLinkedState : function() {  
 
var ls = this.getUrlParam('owa_state');  
 
if ( ! ls ) {  
ls = this.getAnchorParam('owa_state');  
}  
 
if ( ls ) {  
OWA.debug('Shared OWA state detected...');  
 
ls = OWA.util.base64_decode(OWA.util.urldecode(ls));  
//ls = OWA.util.trim(ls, '\u0000');  
//ls = OWA.util.trim(ls, '\u0000');  
OWA.debug('linked state: %s', ls);  
 
var state = ls.split('.');  
//var state = OWA.util.explode('.', ls);  
OWA.debug('linked state: %s', JSON.stringify(state));  
if ( state ) {  
 
for (var i=0; state.length > i; i++) {  
 
var pair = state[i].split('=');  
OWA.debug('pair: %s', pair);  
// add cookie domain hash for current cookie domain  
var value = OWA.util.urldecode(pair[1]);  
OWA.debug('pair: %s', value);  
//OWA.debug('about to decode shared link state value: %s', value);  
decodedvalue = OWA.util.decodeCookieValue(value);  
//OWA.debug('decoded shared link state value: %s', JSON.stringify(decodedvalue));  
var format = OWA.util.getCookieValueFormat(value);  
//OWA.debug('format of decoded shared state value: %s', format);  
decodedvalue.cdh = OWA.util.getCookieDomainHash( this.getCookieDomain() );  
 
OWA.replaceState( pair[0], decodedvalue, true, format );  
}  
}  
}  
 
this.linkedStateSet = true;  
},  
 
/**  
* Shares User State cross domains using GET string  
*  
* gets cookies and concatenates them together using:  
* name1=encoded_value1.name2=encoded_value2  
* then base64 encodes the entire string and appends it  
* to an href  
*  
* @param url string  
*/  
shareStateByLink : function(url) {  
 
OWA.debug( 'href of link: '+ url );  
if ( url ) {  
 
var state = this.createSharedStateValue();  
 
//check to see if we can just stick this on the anchor  
var anchor = this.getUrlAnchorValue();  
if ( ! anchor ) {  
 
OWA.debug('shared state: %s', state);  
document.location.href = url + '#owa_state.' + state ;  
 
// if not then we need ot insert it into GET params  
} else {  
 
}  
}  
},  
 
createSharedStateValue : function() {  
 
var state = '';  
 
for (var i=0; this.sharableStateStores.length > i;i++) {  
var value = OWA.getState( this.sharableStateStores[i] );  
value = OWA.util.encodeJsonForCookie(value, OWA.getStateStoreFormat(this.sharableStateStores[i]));  
 
if (value) {  
state += OWA.util.sprintf( '%s=%s', this.sharableStateStores[i], OWA.util.urlEncode(value) );  
if ( this.sharableStateStores.length != ( i + 1) ) {  
state += '.';  
}  
}  
}  
 
// base64 for transport  
if ( state ) {  
OWA.debug('linked state to send: %s', state);  
 
state = OWA.util.base64_encode(state);  
state = OWA.util.urlEncode(state);  
return state;  
}  
},  
 
shareShareByPost : function (form) {  
 
var state = this.createSharedStateValue();  
form.action += '#owa_state.' + state;  
form.submit();  
},  
 
getCookieDomain : function() {  
 
return this.getOption('cookie_domain') || OWA.getSetting('cookie_domain') || document.domain;  
 
},  
 
setCookieDomain : function(domain) {  
 
var not_passed = false;  
 
if ( ! domain ) {  
domain = document.domain;  
not_passed = true;  
//this.setOption('cookie_domain_mode', 'auto');  
//OWA.setSetting('cookie_domain_mode', 'auto');  
}  
 
// remove the leading period  
var period = domain.substr(0,1);  
if (period === '.') {  
domain = domain.substr(1);  
}  
 
var contains_www = false;  
var www = domain.substr(0,4);  
// check for www and eliminate it if no domain was passed.  
if (www === 'www.') {  
if ( not_passed ) {  
domain = domain.substr(4);  
}  
 
contains_www = true;  
}  
 
var match = false;  
if (document.domain === domain) {  
match = true;  
}  
 
/*  
if (match === true) {  
// check to see if the domain is www  
if ( contains_www === true ) {  
// eliminate any top level domain cookies  
OWA.debug('document domain matches cookie domain and includes www. cleaning up cookies.');  
//erase the no www domain cookie (ie. .openwebanalytics.com)  
var top_domain = document.domain.substr(4);  
OWA.util.eraseMultipleCookies(this.cookie_names, top_domain);  
}  
 
} else {  
// erase the document.domain version of all cookies (ie. www.openwebanalytics.com)  
OWA.debug('document domain does not match cookie domain. cleaning up by erasing cookies under document.domain .');  
OWA.util.eraseMultipleCookies(this.cookie_names, document.domain);  
 
 
//if ( contains_www === true) {  
// OWA.util.eraseMultipleCookies(this.cookie_names, document.domain.substr(4));  
// OWA.util.eraseMultipleCookies(this.cookie_names, document.domain.substr(4));  
//}  
 
}  
*/  
 
// add the leading period back  
domain = '.' + domain;  
this.setOption('cookie_domain', domain);  
this.setOption('cookie_domain_set', true);  
OWA.setSetting('cookie_domain', domain);  
OWA.debug('Cookie domain is: %s', domain);  
},  
 
getCookieDomainHash: function(domain) {  
 
return OWA.util.crc32(domain);  
},  
 
setCookieDomainHashing: function(value) {  
this.hashCookiesToDomain = value;  
OWA.setSetting('hashCookiesToDomain', value);  
},  
 
checkForOverlaySession: function() {  
 
// check to see if overlay sesson should be created  
var a = this.getAnchorParam('owa_overlay');  
 
if ( a ) {  
a = OWA.util.base64_decode(OWA.util.urldecode(a));  
//a = OWA.util.trim(a, '\u0000');  
a = OWA.util.urldecode( a );  
OWA.debug('overlay anchor value: ' + a);  
//var domain = this.getCookieDomain();  
 
// set the overlay cookie  
OWA.util.setCookie('owa_overlay',a, '','/', document.domain );  
////alert(OWA.util.readCookie('owa_overlay') );  
// pause tracker so we dont log anything during an overlay session  
this.pause();  
// start overlay session  
OWA.startOverlaySession( OWA.util.decodeCookieValue( a ) );  
}  
},  
 
getUrlAnchorValue : function() {  
 
var anchor = self.document.location.hash.substring(1);  
OWA.debug('anchor value: ' + anchor);  
return anchor;  
},  
 
getAnchorParam : function(name) {  
 
var anchor = this.getUrlAnchorValue();  
 
if ( anchor ) {  
OWA.debug('anchor is: %s', anchor);  
var pairs = anchor.split(',');  
OWA.debug('anchor pairs: %s', JSON.stringify(pairs));  
if ( pairs.length > 0 ) {  
 
var values = {};  
for( var i=0; pairs.length > i;i++ ) {  
 
var pieces = pairs[i].split('.');  
OWA.debug('anchor pieces: %s', JSON.stringify(pieces));  
values[pieces[0]] = pieces[1];  
}  
 
OWA.debug('anchor values: %s', JSON.stringify(values));  
 
if ( values.hasOwnProperty( name ) ) {  
return values[name];  
}  
}  
 
}  
},  
 
getUrlParam : function(name) {  
 
this.urlParams = this.urlParams || OWA.util.parseUrlParams();  
 
if ( this.urlParams.hasOwnProperty( name ) ) {  
return this.urlParams[name];  
} else {  
return false;  
}  
},  
 
dynamicFunc : function (func){  
//alert(func[0]);  
var args = Array.prototype.slice.call(func, 1);  
//alert(args);  
this[func[0]].apply(this, args);  
},  
 
/**  
* Convienence method for seting page title  
*/  
setPageTitle: function(title) {  
 
this.page.set("page_title", title);  
},  
 
/**  
* Convienence method for seting page type  
*/  
setPageType : function(type) {  
 
this.page.set("page_type", type);  
},  
 
/**  
* Sets the siteId to be appended to all logging events  
*/  
setSiteId : function(site_id) {  
this.siteId = site_id;  
},  
 
/**  
* Convienence method for getting siteId of the logger  
*/  
getSiteId : function() {  
return this.siteId;  
},  
 
setEndpoint : function (endpoint) {  
 
endpoint = ('https:' == document.location.protocol ? window.owa_baseSecUrl || endpoint.replace(/http:/, 'https:') : endpoint );  
this.setOption('baseUrl', endpoint);  
OWA.config.baseUrl = endpoint;  
},  
 
setLoggerEndpoint : function(url) {  
 
this.setOption( 'logger_endpoint', this.forceUrlProtocol( url ) );  
},  
 
getLoggerEndpoint : function() {  
 
var url = this.getOption( 'logger_endpoint') || this.getEndpoint() || OWA.getSetting('baseUrl') ;  
 
return url + 'log.php';  
},  
 
setApiEndpoint : function(url) {  
 
this.setOption( 'api_endpoint', this.forceUrlProtocol( url ) );  
OWA.setApiEndpoint(url);  
},  
 
getApiEndpoint : function() {  
 
return this.getOption('api_endpoint') || this.getEndpoint() + 'api.php';  
},  
 
forceUrlProtocol : function (url) {  
 
url = ('https:' == document.location.protocol ? url.replace(/http:/, 'https:') : url );  
return url;  
},  
 
 
getEndpoint : function() {  
return this.getOption('baseUrl');  
},  
 
/**  
* Logs a page view event  
*/  
trackPageView : function(url) {  
 
if (url) {  
this.page.set('page_url', url);  
}  
 
this.page.setEventType("base.page_request");  
 
return this.trackEvent(this.page);  
},  
 
trackAction : function(action_group, action_name, action_label, numeric_value) {  
 
var event = new OWA.event;  
 
event.setEventType('track.action');  
event.set('site_id', this.getSiteId());  
event.set('page_url', this.page.get('page_url'));  
event.set('action_group', action_group);  
event.set('action_name', action_name);  
event.set('action_label', action_label);  
event.set('numeric_value', numeric_value);  
this.trackEvent(event);  
OWA.debug("Action logged");  
},  
 
trackClicks : function(handler) {  
// flag to tell handler to log clicks as they happen  
this.setOption('logClicksAsTheyHappen', true);  
this.bindClickEvents();  
 
},  
 
bindClickEvents : function() {  
 
if ( ! this.isClickTrackingEnabled ) {  
var that = this;  
// Registers the handler for the before navigate event so that the dom stream can be logged  
if (window.addEventListener) {  
window.addEventListener('click', function (e) {that.clickEventHandler(e);}, false);  
} else if(window.attachEvent) {  
window.attachEvent('click', function (e) {that.clickEventHandler(e);});  
}  
 
this.isClickTrackingEnabled = true;  
}  
 
},  
 
trackDomStream : function() {  
 
if (this.active) {  
 
// check random number against logging percentage  
var rand = Math.floor(Math.random() * 100 + 1 );  
 
if (rand <= this.getOption('logDomStreamPercentage')) {  
 
// needed by click handler  
this.setOption('trackDomStream', true);  
// loop through stream event bindings  
var len = this.streamBindings.length;  
for ( var i = 0; i < len; i++ ) {  
//for (method in this.streamBindings) {  
 
this.callMethod(this.streamBindings[i]);  
}  
 
this.startDomstreamTimer();  
} else {  
OWA.debug("not tracking domstream for this user.");  
}  
}  
},  
 
logDomStream : function() {  
 
this.domstream = this.domstream || new OWA.event;  
 
if ( this.event_queue.length > this.options.domstreamEventThreshold ) {  
 
// make an domstream_id if one does not exist. needed for upstream processing  
if ( ! this.domstream.get('domstream_guid') ) {  
var salt = 'domstream' + this.page.get('page_url') + this.getSiteId();  
this.domstream.set( 'domstream_guid', OWA.util.generateRandomGuid( salt ) );  
}  
 
this.domstream.setEventType( 'dom.stream' );  
this.domstream.set( 'site_id', this.getSiteId());  
this.domstream.set( 'page_url', this.page.get('page_url') );  
//this.domstream.set( 'timestamp', this.startTime);  
this.domstream.set( 'timestamp', OWA.util.getCurrentUnixTimestamp() );  
this.domstream.set( 'duration', this.getElapsedTime());  
this.domstream.set( 'stream_events', JSON.stringify(this.event_queue));  
this.domstream.set( 'stream_length', this.event_queue.length );  
this.trackEvent( this.domstream );  
this.event_queue = [];  
 
} else {  
OWA.debug("Domstream had too few events to log.");  
}  
},  
 
startDomstreamTimer : function() {  
 
var interval = this.getOption('domstreamLoggingInterval')  
var that = this;  
var domstreamTimer = setInterval(  
function(){ that.logDomStream() },  
interval  
);  
},  
 
/**  
* Deprecated  
*/  
log : function() {  
this.page.setEventType("base.page_request");  
return this.logEvent(this.page);  
},  
 
/**  
* Logs event asyncronously using AJAX GET  
*/  
logEventAjax : function (event, method) {  
if (this.active) {  
 
if (event instanceof OWA.event) {  
var properties = event.getProperties();  
} else {  
var properties = event;  
}  
 
method = method || 'GET';  
 
if (method === 'GET') {  
return this.ajaxGet(properties);  
} else {  
this.ajaxPost(properties);  
return;  
}  
 
}  
 
 
},  
 
isObjectType : function(obj, type) {  
return !!(obj && type && type.prototype && obj.constructor == type.prototype.constructor);  
},  
 
 
/**  
* Gets XMLHttpRequest Object  
*/  
getAjaxObj : function() {  
 
if (window.XMLHttpRequest){  
// If IE7, Mozilla, Safari, etc: Use native object  
var ajax = new XMLHttpRequest()  
} else {  
 
if (window.ActiveXObject){  
// ...otherwise, use the ActiveX control for IE5.x and IE6  
var ajax = new ActiveXObject("Microsoft.XMLHTTP");  
}  
 
}  
return ajax;  
},  
 
ajaxGet : function(properties) {  
 
var url = this._assembleRequestUrl(properties);  
var ajax = this.getAjaxObj();  
ajax.open("GET", url, false);  
ajax.send(null);  
},  
 
/**  
* AJAX POST Request  
*/  
ajaxPost : function(properties) {  
 
var ajax = this.getAjaxObj();  
var params = this.prepareRequestParams(properties);  
 
ajax.open("POST", this.getLoggerEndpoint(), false);  
//Send the proper header information along with the request  
ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
ajax.setRequestHeader("Content-length", params.length);  
ajax.setRequestHeader("Connection", "close");  
 
ajax.onreadystatechange = function() {//Call a function when the state changes.  
if(ajax.readyState == 4 && ajax.status == 200) {  
//console.log("ajax response: %s", ajax.responseText);  
}  
}  
 
ajax.send(params);  
 
},  
 
ajaxJsonp : function (url) {  
 
var script = document.createElement("script");  
script.setAttribute("src",url);  
script.setAttribute("type","text/javascript");  
document.body.appendChild(script);  
},  
 
prepareRequestParams : function(properties) {  
 
var get = '';  
 
// append site_id to properties  
properties.site_id = this.getSiteId();  
//assemble query string  
for ( param in properties ) {  
// print out the params  
var value = '';  
var kvp = '';  
 
if ( properties.hasOwnProperty(param) ) {  
 
if ( OWA.util.is_array( properties[param] ) ) {  
 
for ( var i = 0, n = properties[param].length; i < n; i++ ) {  
 
if ( OWA.util.is_object( properties[param][i] ) ) {  
for ( o_param in properties[param][i] ) {  
kvp = OWA.util.sprintf('owa_%s[%s][%s]=%s&', param, i, o_param, OWA.util.urlEncode( properties[param][i][o_param] ) );  
get += kvp;  
}  
} else {  
// what the heck is it then. assum string  
kvp = OWA.util.sprintf('owa_%s[%s]=%s&', param, i, OWA.util.urlEncode( properties[param][i] ) );  
get += kvp;  
}  
}  
// assume it's a string  
} else {  
kvp = OWA.util.sprintf('owa_%s=%s&', param, OWA.util.urlEncode( properties[param] ) );  
 
}  
 
 
//needed?  
} else {  
 
kvp = OWA.util.sprintf('owa_%s=%s&', '', OWA.util.urlEncode( properties[param] ) );  
}  
 
get += kvp;  
}  
//OWA.debug('GET string: %s', get);  
return get;  
},  
 
/**  
* Sends an OWA event to the server for processing using GET  
* inserts 1x1 pixel IMG tag into DOM  
*/  
trackEvent : function(event, block) {  
//OWA.debug('pre global event: %s', JSON.stringify(event));  
 
if ( this.getOption('cookie_domain_set') != true ) {  
// set default cookie domain  
this.setCookieDomain();  
}  
 
if ( this.linkedStateSet != true ) {  
//check for linked state send from another domain  
this.checkForLinkedState();  
}  
 
if ( this.active ) {  
if ( ! block ) {  
block_flag = false;  
} else {  
block_flag = true;  
}  
 
// check for third party mode.  
if ( this.getOption( 'thirdParty' ) ) {  
// tell upstream client to manage state  
this.globalEventProperties.thirdParty = true;  
// add in campaign related properties for upstream evaluation  
this.setCampaignRelatedProperties(event);  
} else {  
// else we are in first party mode, so manage state on the client.  
this.manageState(event);  
}  
 
this.addGlobalPropertiesToEvent( event );  
//OWA.debug('post global event: %s', JSON.stringify(event));  
return this.logEvent( event.getProperties(), block_flag );  
}  
},  
 
addGlobalPropertiesToEvent : function ( event ) {  
OWA.debug( 'Adding global properties to event: %s', JSON.stringify(this.globalEventProperties) );  
for ( prop in this.globalEventProperties ) {  
event.set( prop, this.globalEventProperties[prop] );  
}  
},  
 
 
/**  
* Logs event by inserting 1x1 pixel IMG tag into DOM  
*/  
logEvent : function (properties, block) {  
 
if (this.active) {  
 
var url = this._assembleRequestUrl(properties);  
OWA.debug('url : %s', url);  
image = new Image(1, 1);  
//expireDateTime = now.getTime() + delay;  
image.onLoad = function () { };  
image.src = url;  
if (block) {  
//OWA.debug(' blocking...');  
}  
OWA.debug('Inserted web bug for %s', properties['event_type']);  
}  
},  
 
/**  
* Private method for helping assemble request params  
*/  
_assembleRequestUrl : function(properties) {  
 
// append site_id to properties  
properties.site_id = this.getSiteId();  
var get = this.prepareRequestParams(properties);  
 
var log_url = this.getLoggerEndpoint();  
 
if (log_url.indexOf('?') === -1) {  
log_url += '?';  
} else {  
log_url += '&';  
}  
 
// add some radomness for cache busting  
return log_url + get;  
},  
 
getViewportDimensions : function() {  
 
var viewport = new Object();  
viewport.width = window.innerWidth ? window.innerWidth : document.body.offsetWidth;  
viewport.height = window.innerHeight ? window.innerHeight : document.body.offsetHeight;  
return viewport;  
},  
 
/**  
* Sets the X coordinate of where in the browser the user clicked  
*  
*/  
findPosX : function(obj) {  
 
var curleft = 0;  
if (obj.offsetParent)  
{  
while (obj.offsetParent)  
{  
curleft += obj.offsetLeft  
obj = obj.offsetParent;  
}  
}  
else if (obj.x)  
curleft += obj.x;  
return curleft;  
},  
 
/**  
* Sets the Y coordinates of where in the browser the user clicked  
*  
*/  
findPosY : function(obj) {  
 
var curtop = 0;  
if (obj.offsetParent)  
{  
while (obj.offsetParent)  
{  
curtop += obj.offsetTop  
obj = obj.offsetParent;  
}  
}  
else if (obj.y)  
curtop += obj.y;  
return curtop;  
},  
 
/**  
* Get the HTML elementassociated with an event  
*  
*/  
_getTarget : function(e) {  
 
// Determine the actual html element that generated the event  
var targ = e.target || e.srcElement;  
 
if (targ.nodeType == 3) {  
// defeat Safari bug  
targ = target.parentNode;  
}  
 
return targ;  
},  
 
/**  
* Sets coordinates of where in the browser the user clicked  
*  
*/  
getCoords : function(e) {  
 
var coords = new Object();  
 
if ( typeof( e.pageX ) == 'number' ) {  
coords.x = e.pageX + '';  
coords.y = e.pageY + '';  
} else {  
coords.x = e.clientX + '';  
coords.y = e.clientY + '';  
}  
 
return coords;  
},  
 
/**  
* Sets the tag name of html eleemnt that generated the event  
*/  
getDomElementProperties : function(targ) {  
 
var properties = new Object();  
// Set properties of the owa_click object.  
properties.dom_element_tag = targ.tagName;  
 
if (targ.tagName == "A") {  
 
if (targ.textContent != undefined) {  
properties.dom_element_text = targ.textContent;  
} else {  
properties.dom_element_text = targ.innerText;  
}  
 
properties.target_url = targ.href;  
 
} else if (targ.tagName == "INPUT") {  
 
properties.dom_element_text = targ.value;  
 
} else if (targ.tagName == "IMG") {  
 
properties.target_url = targ.parentNode.href;  
properties.dom_element_text = targ.alt;  
 
} else {  
 
//properties.target_url = targ.parentNode.href || null;  
 
if (targ.textContent != undefined) {  
//properties.html_element_text = targ.textContent;  
properties.html_element_text = '';  
} else {  
//properties.html_element_text = targ.innerText;  
properties.html_element_text = '';  
}  
}  
 
return properties;  
},  
 
clickEventHandler : function(e) {  
 
// hack for IE7  
e = e || window.event;  
 
var click = new OWA.event();  
// set event type  
click.setEventType("dom.click");  
 
//clicked DOM element properties  
var targ = this._getTarget(e);  
 
var dom_name = '(not set)';  
if ( targ.hasOwnProperty( 'name' ) && targ.name.length > 0 ) {  
dom_name = targ.name;  
}  
click.set("dom_element_name", dom_name);  
 
var dom_value = '(not set)';  
if ( targ.hasOwnProperty( 'value' ) && targ.value.length > 0 ) {  
dom_value = targ.value;  
}  
click.set("dom_element_value", dom_value);  
 
var dom_id = '(not set)';  
if ( ! targ.hasOwnProperty( 'id' ) && targ.id.length > 0) {  
dom_id = targ.id;  
}  
click.set("dom_element_id", dom_id);  
 
var dom_class = '(not set)';  
if ( targ.hasOwnProperty( 'className' ) && targ.className.length > 0) {  
dom_class = targ.className;  
}  
click.set("dom_element_class", dom_class);  
 
click.set("dom_element_tag", OWA.util.strtolower(targ.tagName));  
click.set("page_url", window.location.href);  
// view port dimensions - needed for calculating relative position  
var viewport = this.getViewportDimensions();  
click.set("page_width", viewport.width);  
click.set("page_height", viewport.height);  
var properties = this.getDomElementProperties(targ);  
click.merge(this.filterDomProperties(properties));  
// set coordinates  
click.set("dom_element_x", this.findPosX(targ) + '');  
click.set("dom_element_y", this.findPosY(targ) + '');  
var coords = this.getCoords(e);  
click.set('click_x', coords.x);  
click.set('click_y', coords.y);  
 
// add to event queue is logging dom stream  
if (this.getOption('trackDomStream')) {  
this.addToEventQueue(click)  
}  
var full_click = OWA.util.clone(click);  
//if all that works then log  
if (this.getOption('logClicksAsTheyHappen')) {  
this.trackEvent(full_click);  
}  
 
 
this.click = full_click;  
},  
 
// stub for a filter that will strip certain properties or abort the logging  
filterDomProperties : function(properties) {  
 
return properties;  
 
},  
 
callMethod : function(string, data) {  
 
return this[string](data);  
},  
 
addDomStreamEventBinding : function(method_name) {  
this.streamBindings.push(method_name);  
},  
 
bindMovementEvents : function() {  
 
var that = this;  
document.onmousemove = function (e) {that.movementEventHandler(e);}  
},  
 
movementEventHandler : function(e) {  
 
// hack for IE7  
e = e || window.event;  
var now = this.getTime();  
if (now > this.last_movement + this.getOption('movementInterval')) {  
// set event type  
this.movement = new OWA.event();  
this.movement.setEventType("dom.movement");  
var coords = this.getCoords(e);  
this.movement.set('cursor_x', coords.x);  
this.movement.set('cursor_y', coords.y);  
this.addToEventQueue(this.movement);  
this.last_movement = now;  
}  
 
},  
 
bindScrollEvents : function() {  
 
var that = this;  
window.onscroll = function (e) {that.scrollEventHandler(e);}  
},  
 
scrollEventHandler : function(e) {  
 
// hack for IE7  
e = e || window.event;  
 
var now = this.getTimestamp();  
 
var event = new OWA.event();  
event.setEventType('dom.scroll');  
var coords = this.getScrollingPosition();  
event.set('x', coords.x);  
event.set('y', coords.y);  
var targ = this._getTarget(e);  
event.set("dom_element_name", targ.name);  
event.set("dom_element_value", targ.value);  
event.set("dom_element_id", targ.id);  
this.addToEventQueue(event);  
this.last_scroll = now;  
 
},  
 
getScrollingPosition : function() {  
 
var position = [0, 0];  
if (typeof window.pageYOffset != 'undefined') {  
position = {x: window.pageXOffset, y: window.pageYOffset};  
} else if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0) {  
position = {x: document.documentElement.scrollLeft, y: document.documentElement.scrollTop};  
} else if (typeof document.body.scrollTop != 'undefined') {  
position = {x: document.body.scrollLeft, y: document.body.scrollTop};  
}  
return position;  
},  
 
bindHoverEvents : function() {  
 
//handler = handler || this.hoverEventHandler;  
//document.onmousemove = handler;  
 
},  
 
bindFocusEvents : function() {  
 
var that = this;  
 
},  
 
bindKeypressEvents : function() {  
 
var that = this;  
document.onkeypress = function (e) {that.keypressEventHandler(e);}  
 
},  
 
keypressEventHandler : function(e) {  
var targ = this._getTarget(e);  
 
if (targ.tagName === 'INPUT' && targ.type === 'password') {  
return;  
}  
 
var key_code = e.keyCode? e.keyCode : e.charCode  
var key_value = String.fromCharCode(key_code);  
var event = new OWA.event();  
event.setEventType('dom.keypress');  
event.set('key_value', key_value);  
event.set('key_code', key_code);  
event.set("dom_element_name", targ.name);  
event.set("dom_element_value", targ.value);  
event.set("dom_element_id", targ.id);  
event.set("dom_element_tag", targ.tagName);  
//console.log("Keypress: %s %d", key_value, key_code);  
this.addToEventQueue(event);  
 
},  
 
// utc epoch in seconds  
getTimestamp : function() {  
 
return OWA.util.getCurrentUnixTimestamp();  
},  
 
// utc epoch in milliseconds  
getTime : function() {  
 
return Math.round(new Date().getTime());  
},  
 
getElapsedTime : function() {  
 
return this.getTimestamp() - this.startTime;  
},  
 
getOption : function(name) {  
 
if ( this.options.hasOwnProperty(name) ) {  
return this.options[name];  
}  
},  
 
setOption : function(name, value) {  
 
this.options[name] = value;  
},  
 
setLastEvent : function(event) {  
return;  
},  
 
addToEventQueue : function(event) {  
 
if (this.active && !this.isPausedBySibling()) {  
 
var now = this.getTimestamp();  
 
if (event != undefined) {  
this.event_queue.push(event.getProperties());  
//console.debug("Now logging %s for: %d", event.get('event_type'), now);  
} else {  
//console.debug("No event properties to log");  
}  
 
}  
},  
 
isPausedBySibling: function() {  
 
return OWA.getSetting('loggerPause');  
},  
 
sleep : function(delay) {  
var start = new Date().getTime();  
while (new Date().getTime() < start + delay);  
},  
 
pause : function() {  
 
this.active = false;  
},  
 
restart : function() {  
this.active = true;  
},  
 
// Event object Factory  
makeEvent : function() {  
return new OWA.event();  
},  
 
// adds a new Domstream event binding. takes function name  
addStreamEventBinding : function(name) {  
 
this.streamBindings.push(name);  
},  
 
// gets campaign related properties from request scope.  
getCampaignProperties : function() {  
 
// load GET params from URL  
if (!this.urlParams.length > 0) {  
this.urlParams = OWA.util.parseUrlParams(document.URL);  
OWA.debug('GET: '+ JSON.stringify(this.urlParams));  
}  
 
// look for attributes in the url of the page  
var campaignKeys = this.getOption('campaignKeys');  
 
// pull campaign params from _GET  
var campaign_params = {};  
 
for (var i = 0, n = campaignKeys.length; i < n; i++) {  
 
if ( this.urlParams.hasOwnProperty(campaignKeys[i].public) ) {  
 
campaign_params[campaignKeys[i].private] = this.urlParams[campaignKeys[i].public];  
//OWA.debug('campaign params obj: ' + JSON.stringify(campaign_params));  
this.isNewCampaign = true;  
}  
}  
 
// check for incomplete combos and backfill values if needed  
if (campaign_params['at'] && !campaign_params['ad']) {  
campaign_params['ad'] = '(not set)';  
}  
 
if (campaign_params['ad'] && !campaign_params['at']) {  
campaign_params['at'] = '(not set)';  
}  
 
if (this.isNewCampaign) {  
//campaign_params['ts'] = this.page.get('timestamp');  
}  
 
return campaign_params;  
},  
 
applyCampaignPropertiesToEvent : function(event, properties) {  
 
var campaignKeys = this.getOption('campaignKeys');  
for (var i = 0, n = campaignKeys.length; i < n; i++) {  
if ( properties.hasOwnProperty(campaignKeys[i].private) ) {  
this.setGlobalEventProperty(campaignKeys[i].full, properties[campaignKeys[i].private]);  
//OWA.debug('setting campaign property %s %s', campaignKeys[i].private, properties[campaignKeys[i].private]);  
}  
}  
},  
 
// used when in third party cookie mode to send raw campaign related  
// properties as part of the event. upstream handler needs these to  
// do traffic attribution.  
setCampaignRelatedProperties : function( event ) {  
var properties = this.getCampaignProperties();  
OWA.debug('campaign properties: %s', JSON.stringify(properties));  
this.applyCampaignPropertiesToEvent( event, properties );  
},  
 
directAttributionModel : function(campaign_params) {  
 
if ( this.isNewCampaign ) {  
OWA.debug( 'campaign state length: %s', this.campaignState.length );  
// add the new campaing params to the prior touches array  
this.campaignState.push( campaign_params );  
 
// if there is prior campaign touches, check to see if there is room for one more touch  
if ( this.campaignState.length > this.options.maxPriorCampaigns ) {  
// splice array to make room for the new one  
var removed = this.campaignState.splice( 0, 1 );  
OWA.debug('Too many prior campaigns in state store. Dropping oldest to make room.');  
//OWA.debug('campaign state array post slice: ' + JSON.stringify( this.campaignState ) );  
}  
 
// set/reset the campaign cookie.  
this.setCampaignCookie( this.campaignState );  
 
// set flag  
this.isTrafficAttributed = true;  
}  
},  
 
originalAttributionModel : function( campaign_params ) {  
 
// orignal touch was set previously. jus use that.  
if ( this.campaignState.length > 0 ) {  
// do nothing  
OWA.debug( 'Original attribution detected.' );  
// set the attributes from the first campaign touch  
 
campaign_params = this.campaignState[0];  
// set flag  
this.isTrafficAttributed = true;  
 
// no orginal touch, set one if its a new campaign touch  
} else {  
OWA.debug( 'Setting Original Campaign touch.' );  
if ( this.isNewCampaign ) {  
 
this.campaignState.push( campaign_params );  
// set cookie  
this.setCampaignCookie( this.campaignState );  
// set flag  
this.isTrafficAttributed = true;  
}  
}  
 
return campaign_params;  
 
},  
 
setTrafficAttribution : function( event ) {  
 
var campaignState = OWA.getState( 'c', 'attribs' );  
 
if (campaignState) {  
this.campaignState = campaignState;  
}  
 
var campaign_params = this.getCampaignProperties();  
 
// choose attribution mode.  
switch ( this.options.trafficAttributionMode ) {  
 
case 'direct':  
OWA.debug( 'Applying "Direct" Traffic Attribution Model' );  
this.directAttributionModel( campaign_params );  
break;  
case 'original':  
OWA.debug( 'Applying "Original" Traffic Attribution Model' );  
campaign_params = this.originalAttributionModel( campaign_params );  
break;  
default:  
OWA.debug( 'Applying Default (Direct) Traffic Attribution Model' );  
this.directAttributionModel( campaign_params );  
}  
 
// if one of the attribution methods attributes the traffic them  
// set attribution properties on the event object  
if ( this.isTrafficAttributed ) {  
 
OWA.debug( 'Attributing Traffic to: %s', JSON.stringify( campaign_params ) );  
 
this.applyCampaignPropertiesToEvent( event, campaign_params );  
 
// set campaign touches  
if ( this.campaignState.length > 0 ) {  
this.setGlobalEventProperty( 'attribs', JSON.stringify( this.campaignState ) );  
//event.set( 'campaign_timestamp', campaign_params.ts );  
 
}  
 
// tells upstream processing to skip attribution  
//event.set( 'is_attributed', true );  
 
} else {  
OWA.debug( 'No traffic attribution.' );  
}  
 
},  
 
setCampaignCookie : function( values ) {  
OWA.setState( 'c', 'attribs', values, '', 'json', this.options.campaignAttributionWindow );  
},  
 
checkRefererForSearchEngine : function ( referer ) {  
 
var _get = OWA.util.parseUrlParams( referer );  
 
var query_params = [  
'q', 'p','search', 'Keywords','ask','keyword','keywords','kw','pattern', 'pgm','qr','qry','qs','qt','qu','query','queryterm','question',  
'sTerm','searchfor','searchText','srch','su','what'  
];  
 
for ( var i = 0, n = query_params.length; i < n; i++ ) {  
if ( _get[query_params[i]] ) {  
OWA.debug( 'Found search engine query param: ' + query_params[i] );  
return true;  
}  
}  
},  
 
addTransaction : function ( order_id, order_source, total, tax, shipping, gateway, city, state, country ) {  
this.ecommerce_transaction = new OWA.event();  
this.ecommerce_transaction.setEventType( 'ecommerce.transaction' );  
this.ecommerce_transaction.set( 'ct_order_id', order_id );  
this.ecommerce_transaction.set( 'ct_order_source', order_source );  
this.ecommerce_transaction.set( 'ct_total', total );  
this.ecommerce_transaction.set( 'ct_tax', tax );  
this.ecommerce_transaction.set( 'ct_shipping', shipping );  
this.ecommerce_transaction.set( 'ct_gateway', gateway );  
this.ecommerce_transaction.set( 'page_url', this.page.get('page_url') );  
this.ecommerce_transaction.set( 'city', city );  
this.ecommerce_transaction.set( 'state', state );  
this.ecommerce_transaction.set( 'country', country );  
 
OWA.debug('setting up ecommerce transaction');  
 
this.ecommerce_transaction.set( 'ct_line_items', [] );  
OWA.debug('completed setting up ecommerce transaction');  
},  
 
addTransactionLineItem : function ( order_id, sku, product_name, category, unit_price, quantity ) {  
 
if ( ! this.ecommerce_transaction ) {  
this.addTransaction('none set');  
}  
 
var li = {};  
li.li_order_id = order_id ;  
li.li_sku = sku ;  
li.li_product_name = product_name ;  
li.li_category = category ;  
li.li_unit_price = unit_price ;  
li.li_quantity = quantity ;  
var items = this.ecommerce_transaction.get( 'ct_line_items' );  
items.push( li );  
this.ecommerce_transaction.set( 'ct_line_items', items );  
},  
 
trackTransaction : function () {  
 
if ( this.ecommerce_transaction ) {  
this.trackEvent( this.ecommerce_transaction );  
this.ecommerce_transaction = '';  
}  
},  
 
manageState : function( event ) {  
 
if ( ! this.stateInit ) {  
this.setVisitorId( event );  
this.setFirstSessionTimestamp( event );  
this.setLastRequestTime( event );  
this.setSessionId( event );  
this.setNumberPriorSessions( event );  
this.setTrafficAttribution( event );  
this.stateInit = true;  
}  
},  
 
setNumberPriorSessions : function ( event ) {  
OWA.debug('setting number of prior sessions');  
// if check for nps value in vistor cookie.  
var nps = OWA.getState( 'v', 'nps' );  
// set value to 1 if not found as it means its he first session.  
if ( ! nps ) {  
nps = '0';  
}  
 
if ( this.isNewSessionFlag === true ) {  
// increment visit count and persist to state store  
nps = nps * 1;  
nps++;  
OWA.setState( 'v', 'nps', nps, true );  
}  
 
this.globalEventProperties.num_prior_sessions = nps;  
 
},  
 
setVisitorId : function( event ) {  
 
var visitor_id = OWA.getState( 'v', 'vid' );  
 
if ( ! visitor_id ) {  
visitor_id = OWA.getState( 'v' );  
 
if (visitor_id) {  
OWA.clearState( 'v' );  
OWA.setState( 'v', 'vid', visitor_id, true );  
}  
}  
 
if ( ! visitor_id ) {  
visitor_id = OWA.util.generateRandomGuid( this.siteId );  
 
this.globalEventProperties.is_new_visitor = true;  
OWA.setState( 'v', 'vid', visitor_id, true );  
OWA.debug('Creating new visitor id');  
}  
// set property on event object  
this.globalEventProperties.visitor_id = visitor_id ;  
},  
 
setFirstSessionTimestamp : function( event ) {  
var fsts = OWA.getState( 'v', 'fsts' );  
 
if ( ! fsts ) {  
fsts = event.get('timestamp');  
OWA.debug('setting fsts value: %s', fsts);  
OWA.setState('v', 'fsts', fsts , true);  
}  
 
this.globalEventProperties.fsts = fsts;  
},  
 
setLastRequestTime : function( event ) {  
 
var last_req = OWA.getState('s', 'last_req');  
 
// suppport for old style cookie  
if ( ! last_req ) {  
var state_store_name = OWA.util.sprintf( '%s_%s', 'ss', this.siteId );  
last_req = OWA.getState( state_store_name, 'last_req' );  
}  
// set property on event object  
this.globalEventProperties.last_req = last_req;  
// store new state value  
OWA.setState( 's', 'last_req', event.get( 'timestamp' ), true );  
},  
 
setSessionId : function ( event ) {  
var session_id = '';  
var state_store_name = '';  
var is_new_session = this.isNewSession( event.get( 'timestamp' ), this.getGlobalEventProperty( 'last_req' ) );  
if ( is_new_session ) {  
//set prior_session_id  
var prior_session_id = OWA.getState('s', 'sid');  
if ( ! prior_session_id ) {  
state_store_name = OWA.util.sprintf('%s_%s', 'ss', this.getSiteId() );  
prior_session_id = OWA.getState(state_store_name, 's');  
}  
if ( prior_session_id ) {  
this.globalEventProperties.prior_session_id = prior_session_id;  
}  
session_id = OWA.util.generateRandomGuid( this.getSiteId() );  
// it's a new session. generate new session ID  
this.globalEventProperties.session_id = session_id;  
//mark new session flag on current request  
this.globalEventProperties.is_new_session = true;  
this.isNewSessionFlag = true;  
OWA.setState( 's', 'sid', session_id, true );  
} else {  
// Must be an active session so just pull the session id from the state store  
session_id = OWA.getState('s', 'sid');  
// support for old style cookie  
if ( ! session_id ) {  
state_store_name = OWA.util.sprintf( '%s_%s', 'ss', this.getSiteId() );  
session_id = OWA.getState(state_store_name, 's');  
OWA.setState( 's', 'sid', session_id, true );  
}  
 
this.globalEventProperties.session_id = session_id;  
}  
 
// fail-safe just in case there is no session_id  
if ( ! this.getGlobalEventProperty( 'session_id' ) ) {  
session_id = OWA.util.generateRandomGuid( this.getSiteId() );  
this.globalEventProperties.session_id = session_id;  
//mark new session flag on current request  
this.globalEventProperties.is_new_session = true;  
this.isNewSessionFlag = true;  
OWA.setState( 's', 'sid', session_id, true );  
}  
 
},  
 
isNewSession : function( timestamp, last_req ) {  
 
var is_new_session = false;  
 
if ( ! timestamp ) {  
timestamp = OWA.util.getCurrentUnixTimestamp();  
}  
 
if ( ! last_req ) {  
last_req = 0;  
}  
 
var time_since_lastreq = timestamp - last_req;  
var len = this.options.sessionLength;  
if ( time_since_lastreq < len ) {  
OWA.debug("This request is part of a active session.");  
return false;  
} else {  
//NEW SESSION. prev session expired, because no requests since some time.  
OWA.debug("This request is the start of a new session. Prior session expired.");  
return true;  
}  
},  
 
getGlobalEventProperty : function( name ) {  
 
if ( this.globalEventProperties.hasOwnProperty(name) ) {  
 
return this.globalEventProperties[name];  
}  
},  
 
setGlobalEventProperty : function (name, value) {  
 
this.globalEventProperties[name] = value;  
},  
 
setPageProperties : function(properties) {  
 
for (prop in properties) {  
 
if ( properties.hasOwnProperty( prop ) ) {  
this.page.set( prop, properties[prop] );  
}  
}  
}  
 
};  
 
(function() {  
//if ( typeof owa_baseUrl != "undefined" ) {  
// OWA.config.baseUrl = owa_baseUrl;  
//}  
// execute commands global owa_cmds command queue  
if ( typeof owa_cmds === 'undefined' ) {  
var q = new OWA.commandQueue();  
} else {  
if ( OWA.util.is_array(owa_cmds) ) {  
var q = new OWA.commandQueue();  
q.loadCmds( owa_cmds );  
}  
}  
 
window['owa_cmds'] = q;  
window['owa_cmds'].process();  
})();  
// OWA Widgets  
 
OWA.widget = function() {  
 
this.config = OWA.config;  
 
return;  
}  
 
OWA.widget.prototype = {  
 
properties: new Object,  
 
config: '',  
 
dom_id: '',  
 
name: '',  
 
current_view: '',  
 
page_num: 1,  
 
max_page_num: 2,  
 
more_pages: false,  
 
minimized: false,  
 
displayPagination: function() {  
 
var widget_pagination_div = "#"+this.dom_id+"_widget-pagination";  
var pages = this._makePagination();  
jQuery(widget_pagination_div).show("fast");  
jQuery(widget_pagination_div).html(pages);  
jQuery('.owa_widget-paginationcontrol').click(owa_widget_page_results);  
 
return;  
},  
 
 
hidePagination: function() {  
 
var widget_pagination_div = "#"+this.dom_id+"_widget-pagination";  
jQuery(widget_pagination_div).hide();  
 
return;  
},  
 
changeView: function(view) {  
 
var widgetcontentid = "#"+this.dom_id+"_widget-content";  
 
this.properties.format = view;  
 
jQuery(widgetcontentid).slideUp("fast");  
 
jQuery.ajax({  
method: "get",  
url: this.config.action_url,  
data: OWA.util.nsAll(this.properties),  
//show loading just when link is clicked  
beforeSend: function(){ jQuery("#"+this.dom_id).children(".owa_widget-status").show("slow");},  
//stop showing loading when the process is complete  
complete: function(){ jQuery("#"+this.dom_id).children(".owa_widget-status").hide("slow");},  
//so, if data is retrieved, store it in html  
success: function(html){  
jQuery(widgetcontentid).show("slow"); //animation  
jQuery(widgetcontentid).html(html); //show the html inside .content div  
 
 
 
 
}  
}); //close $.ajax(  
 
this.current_view = view;  
 
if (view == "table") {  
this.displayPagination();  
} else {  
this.hidePagination();  
}  
 
return true;  
 
},  
 
_makePagination: function() {  
 
var pagination = '';  
var anchor = this._makeLinkAnchor();  
 
// previous nav link  
if (this.page_num > 1) {  
pagination = 'Pages: ';  
pagination = pagination + this._makePaginationLink(anchor, "<< Previous") + ' ... ';  
}  
 
for (i = 1; i <= this.max_page_num; i++) {  
 
// let's pick a page name for our link  
var page_name = i;  
 
// to link or not to link  
if (i == this.page_num) {  
pagination = pagination + page_name;  
} else {  
pagination = pagination + this._makePaginationLink(anchor, page_name);  
}  
 
// add commas  
if (i != this.max_page_num) {  
pagination = pagination + ', ';  
}  
 
}  
 
// previous nav link  
if (this.page_num < this.max_page_num) {  
if (this.more_pages == true) {  
pagination = pagination + this._makePaginationLink(anchor, "Next >>") + ' ... ';  
}  
}  
 
 
return pagination;  
 
},  
 
_makePaginationLink: function(anchor, page_name) {  
 
var link = '<a href="' + anchor + '" class="owa_widget-paginationcontrol">' + page_name + '</a>';  
return link;  
},  
 
_makeLinkAnchor: function() {  
 
return anchor = "#"+this.dom_id+"_widget-header";  
}  
 
 
 
}  
 
// Bind event handlers  
jQuery(document).ready(function(){  
//jQuery.getScript(OWA.config.js_url + "includes/jquery/tablesorter/jquery.tablesorter.js");  
jQuery('.owa_widget-control').click(owa_widget_changeView);  
jQuery('.owa_widget-pagecontrol').click(owa_widget_changeView);  
jQuery('.owa_widget-close').click(owa_widget_close);  
jQuery('.owa_widget-status').hide("slow");  
jQuery('.owa_widget-collapsetoggle').click(owa_widget_toggle);  
jQuery('.owa_widget-paginationcontrol').click(owa_widget_page_results);  
 
});  
 
 
// Event handler for changeing views  
function owa_widget_changeView() {  
 
var view = jQuery(this).attr("name");  
var widgetname = jQuery(this).parents(".owa_widget-container").get(0).id;  
//alert(widgetname);  
return OWA.items[widgetname].changeView(view);  
 
}  
 
function owa_widget_close() {  
 
return jQuery(this).parents(".owa_widget-container").hide("slow");  
}  
 
function owa_widget_toggle() {  
 
// get the widget name  
var widgetname = jQuery(this).parents(".owa_widget-container").get(0).id;  
 
// toggle the visibility of the child element  
jQuery('#'+widgetname).children(".owa_widget-innercontainer").toggle("slow");  
 
if (OWA.items[widgetname].minimized != true) {  
// set property on widget object  
OWA.items[widgetname].minimized = true;  
//change the text of the link to reflect new state  
jQuery(this).html("Show");  
} else {  
// set property on widget object  
OWA.items[widgetname].minimized = false;  
//change the text of the link to reflect new state  
jQuery(this).html("Minimize");  
}  
 
return;  
}  
 
function owa_widget_page_results() {  
var page = jQuery(this).text();  
alert(page);  
var widgetname = jQuery(this).parents(".owa_widget-container").get(0).id;  
OWA.items[widgetname].page_num = page;  
OWA.items[widgetname].properties.page = page;  
var view = OWA.items[widgetname].current_view;  
return OWA.items[widgetname].changeView(view);  
 
}  
 
 
 
/* This notice must be untouched at all times.  
 
wz_jsgraphics.js v. 2.36  
The latest version is available at  
http://www.walterzorn.com  
or http://www.devira.com  
or http://www.walterzorn.de  
 
Copyright (c) 2002-2004 Walter Zorn. All rights reserved.  
Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )  
Last modified: 21. 6. 2006  
 
Performance optimizations for Internet Explorer  
by Thomas Frank and John Holdsworth.  
fillPolygon method implemented by Matthieu Haller.  
 
High Performance JavaScript Graphics Library.  
Provides methods  
- to draw lines, rectangles, ellipses, polygons  
with specifiable line thickness,  
- to fill rectangles and ellipses  
- to draw text.  
NOTE: Operations, functions and branching have rather been optimized  
to efficiency and speed than to shortness of source code.  
 
LICENSE: LGPL  
 
This library is free software; you can redistribute it and/or  
modify it under the terms of the GNU Lesser General Public  
License (LGPL) as published by the Free Software Foundation; either  
version 2.1 of the License, or (at your option) any later version.  
 
This library is distributed in the hope that it will be useful,  
but WITHOUT ANY WARRANTY; without even the implied warranty of  
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
Lesser General Public License for more details.  
 
You should have received a copy of the GNU Lesser General Public  
License along with this library; if not, write to the Free Software  
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,  
or see http://www.gnu.org/copyleft/lesser.html  
*/  
 
 
var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,  
jg_n4 = (document.layers && typeof document.classes != "undefined");  
 
 
function chkDHTM(x, i)  
{  
x = document.body || null;  
jg_ie = x && typeof x.insertAdjacentHTML != "undefined";  
jg_dom = (x && !jg_ie &&  
typeof x.appendChild != "undefined" &&  
typeof document.createRange != "undefined" &&  
typeof (i = document.createRange()).setStartBefore != "undefined" &&  
typeof i.createContextualFragment != "undefined");  
jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined";  
jg_fast = jg_ie && document.all && !window.opera;  
jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";  
}  
 
 
function pntDoc()  
{  
this.wnd.document.write(jg_fast? this.htmRpc() : this.htm);  
this.htm = '';  
}  
 
 
function pntCnvDom()  
{  
var x = this.wnd.document.createRange();  
x.setStartBefore(this.cnv);  
x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm);  
if(this.cnv) this.cnv.appendChild(x);  
this.htm = '';  
}  
 
 
function pntCnvIe()  
{  
if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);  
this.htm = '';  
}  
 
 
function pntCnvIhtm()  
{  
if(this.cnv) this.cnv.innerHTML += this.htm;  
this.htm = '';  
}  
 
 
function pntCnv()  
{  
this.htm = '';  
}  
 
 
function mkDiv(x, y, w, h)  
{  
this.htm += '<div style="position:absolute;'+  
'left:' + x + 'px;'+  
'top:' + y + 'px;'+  
'width:' + w + 'px;'+  
'height:' + h + 'px;'+  
'clip:rect(0,'+w+'px,'+h+'px,0);'+  
'background-color:' + this.color +  
(!jg_moz? ';overflow:hidden' : '')+  
';"><\/div>';  
}  
 
 
function mkDivIe(x, y, w, h)  
{  
this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';  
}  
 
 
function mkDivPrt(x, y, w, h)  
{  
this.htm += '<div style="position:absolute;'+  
'border-left:' + w + 'px solid ' + this.color + ';'+  
'left:' + x + 'px;'+  
'top:' + y + 'px;'+  
'width:0px;'+  
'height:' + h + 'px;'+  
'clip:rect(0,'+w+'px,'+h+'px,0);'+  
'background-color:' + this.color +  
(!jg_moz? ';overflow:hidden' : '')+  
';"><\/div>';  
}  
 
 
function mkLyr(x, y, w, h)  
{  
this.htm += '<layer '+  
'left="' + x + '" '+  
'top="' + y + '" '+  
'width="' + w + '" '+  
'height="' + h + '" '+  
'bgcolor="' + this.color + '"><\/layer>\n';  
}  
 
 
var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;  
function htmRpc()  
{  
return this.htm.replace(  
regex,  
'<div style="overflow:hidden;position:absolute;background-color:'+  
'$1;left:$2;top:$3;width:$4;height:$5"></div>\n');  
}  
 
 
function htmPrtRpc()  
{  
return this.htm.replace(  
regex,  
'<div style="overflow:hidden;position:absolute;background-color:'+  
'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');  
}  
 
 
function mkLin(x1, y1, x2, y2)  
{  
if (x1 > x2)  
{  
var _x2 = x2;  
var _y2 = y2;  
x2 = x1;  
y2 = y1;  
x1 = _x2;  
y1 = _y2;  
}  
var dx = x2-x1, dy = Math.abs(y2-y1),  
x = x1, y = y1,  
yIncr = (y1 > y2)? -1 : 1;  
 
if (dx >= dy)  
{  
var pr = dy<<1,  
pru = pr - (dx<<1),  
p = pr-dx,  
ox = x;  
while ((dx--) > 0)  
{  
++x;  
if (p > 0)  
{  
this.mkDiv(ox, y, x-ox, 1);  
y += yIncr;  
p += pru;  
ox = x;  
}  
else p += pr;  
}  
this.mkDiv(ox, y, x2-ox+1, 1);  
}  
 
else  
{  
var pr = dx<<1,  
pru = pr - (dy<<1),  
p = pr-dy,  
oy = y;  
if (y2 <= y1)  
{  
while ((dy--) > 0)  
{  
if (p > 0)  
{  
this.mkDiv(x++, y, 1, oy-y+1);  
y += yIncr;  
p += pru;  
oy = y;  
}  
else  
{  
y += yIncr;  
p += pr;  
}  
}  
this.mkDiv(x2, y2, 1, oy-y2+1);  
}  
else  
{  
while ((dy--) > 0)  
{  
y += yIncr;  
if (p > 0)  
{  
this.mkDiv(x++, oy, 1, y-oy);  
p += pru;  
oy = y;  
}  
else p += pr;  
}  
this.mkDiv(x2, oy, 1, y2-oy+1);  
}  
}  
}  
 
 
function mkLin2D(x1, y1, x2, y2)  
{  
if (x1 > x2)  
{  
var _x2 = x2;  
var _y2 = y2;  
x2 = x1;  
y2 = y1;  
x1 = _x2;  
y1 = _y2;  
}  
var dx = x2-x1, dy = Math.abs(y2-y1),  
x = x1, y = y1,  
yIncr = (y1 > y2)? -1 : 1;  
 
var s = this.stroke;  
if (dx >= dy)  
{  
if (dx > 0 && s-3 > 0)  
{  
var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;  
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;  
}  
else var _s = s;  
var ad = Math.ceil(s/2);  
 
var pr = dy<<1,  
pru = pr - (dx<<1),  
p = pr-dx,  
ox = x;  
while ((dx--) > 0)  
{  
++x;  
if (p > 0)  
{  
this.mkDiv(ox, y, x-ox+ad, _s);  
y += yIncr;  
p += pru;  
ox = x;  
}  
else p += pr;  
}  
this.mkDiv(ox, y, x2-ox+ad+1, _s);  
}  
 
else  
{  
if (s-3 > 0)  
{  
var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;  
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;  
}  
else var _s = s;  
var ad = Math.round(s/2);  
 
var pr = dx<<1,  
pru = pr - (dy<<1),  
p = pr-dy,  
oy = y;  
if (y2 <= y1)  
{  
++ad;  
while ((dy--) > 0)  
{  
if (p > 0)  
{  
this.mkDiv(x++, y, _s, oy-y+ad);  
y += yIncr;  
p += pru;  
oy = y;  
}  
else  
{  
y += yIncr;  
p += pr;  
}  
}  
this.mkDiv(x2, y2, _s, oy-y2+ad);  
}  
else  
{  
while ((dy--) > 0)  
{  
y += yIncr;  
if (p > 0)  
{  
this.mkDiv(x++, oy, _s, y-oy+ad);  
p += pru;  
oy = y;  
}  
else p += pr;  
}  
this.mkDiv(x2, oy, _s, y2-oy+ad+1);  
}  
}  
}  
 
 
function mkLinDott(x1, y1, x2, y2)  
{  
if (x1 > x2)  
{  
var _x2 = x2;  
var _y2 = y2;  
x2 = x1;  
y2 = y1;  
x1 = _x2;  
y1 = _y2;  
}  
var dx = x2-x1, dy = Math.abs(y2-y1),  
x = x1, y = y1,  
yIncr = (y1 > y2)? -1 : 1,  
drw = true;  
if (dx >= dy)  
{  
var pr = dy<<1,  
pru = pr - (dx<<1),  
p = pr-dx;  
while ((dx--) > 0)  
{  
if (drw) this.mkDiv(x, y, 1, 1);  
drw = !drw;  
if (p > 0)  
{  
y += yIncr;  
p += pru;  
}  
else p += pr;  
++x;  
}  
if (drw) this.mkDiv(x, y, 1, 1);  
}  
 
else  
{  
var pr = dx<<1,  
pru = pr - (dy<<1),  
p = pr-dy;  
while ((dy--) > 0)  
{  
if (drw) this.mkDiv(x, y, 1, 1);  
drw = !drw;  
y += yIncr;  
if (p > 0)  
{  
++x;  
p += pru;  
}  
else p += pr;  
}  
if (drw) this.mkDiv(x, y, 1, 1);  
}  
}  
 
 
function mkOv(left, top, width, height)  
{  
var a = width>>1, b = height>>1,  
wod = width&1, hod = (height&1)+1,  
cx = left+a, cy = top+b,  
x = 0, y = b,  
ox = 0, oy = b,  
aa = (a*a)<<1, bb = (b*b)<<1,  
st = (aa>>1)*(1-(b<<1)) + bb,  
tt = (bb>>1) - aa*((b<<1)-1),  
w, h;  
while (y > 0)  
{  
if (st < 0)  
{  
st += bb*((x<<1)+3);  
tt += (bb<<1)*(++x);  
}  
else if (tt < 0)  
{  
st += bb*((x<<1)+3) - (aa<<1)*(y-1);  
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);  
w = x-ox;  
h = oy-y;  
if (w&2 && h&2)  
{  
this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1);  
this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);  
}  
else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);  
ox = x;  
oy = y;  
}  
else  
{  
tt -= aa*((y<<1)-3);  
st -= (aa<<1)*(--y);  
}  
}  
this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);  
this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);  
}  
 
 
function mkOv2D(left, top, width, height)  
{  
var s = this.stroke;  
width += s-1;  
height += s-1;  
var a = width>>1, b = height>>1,  
wod = width&1, hod = (height&1)+1,  
cx = left+a, cy = top+b,  
x = 0, y = b,  
aa = (a*a)<<1, bb = (b*b)<<1,  
st = (aa>>1)*(1-(b<<1)) + bb,  
tt = (bb>>1) - aa*((b<<1)-1);  
 
if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))  
{  
var ox = 0, oy = b,  
w, h,  
pxl, pxr, pxt, pxb, pxw;  
while (y > 0)  
{  
if (st < 0)  
{  
st += bb*((x<<1)+3);  
tt += (bb<<1)*(++x);  
}  
else if (tt < 0)  
{  
st += bb*((x<<1)+3) - (aa<<1)*(y-1);  
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);  
w = x-ox;  
h = oy-y;  
 
if (w-1)  
{  
pxw = w+1+(s&1);  
h = s;  
}  
else if (h-1)  
{  
pxw = s;  
h += 1+(s&1);  
}  
else pxw = h = s;  
this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);  
ox = x;  
oy = y;  
}  
else  
{  
tt -= aa*((y<<1)-3);  
st -= (aa<<1)*(--y);  
}  
}  
this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);  
this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);  
}  
 
else  
{  
var _a = (width-((s-1)<<1))>>1,  
_b = (height-((s-1)<<1))>>1,  
_x = 0, _y = _b,  
_aa = (_a*_a)<<1, _bb = (_b*_b)<<1,  
_st = (_aa>>1)*(1-(_b<<1)) + _bb,  
_tt = (_bb>>1) - _aa*((_b<<1)-1),  
 
pxl = new Array(),  
pxt = new Array(),  
_pxb = new Array();  
pxl[0] = 0;  
pxt[0] = b;  
_pxb[0] = _b-1;  
while (y > 0)  
{  
if (st < 0)  
{  
st += bb*((x<<1)+3);  
tt += (bb<<1)*(++x);  
pxl[pxl.length] = x;  
pxt[pxt.length] = y;  
}  
else if (tt < 0)  
{  
st += bb*((x<<1)+3) - (aa<<1)*(y-1);  
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);  
pxl[pxl.length] = x;  
pxt[pxt.length] = y;  
}  
else  
{  
tt -= aa*((y<<1)-3);  
st -= (aa<<1)*(--y);  
}  
 
if (_y > 0)  
{  
if (_st < 0)  
{  
_st += _bb*((_x<<1)+3);  
_tt += (_bb<<1)*(++_x);  
_pxb[_pxb.length] = _y-1;  
}  
else if (_tt < 0)  
{  
_st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1);  
_tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3);  
_pxb[_pxb.length] = _y-1;  
}  
else  
{  
_tt -= _aa*((_y<<1)-3);  
_st -= (_aa<<1)*(--_y);  
_pxb[_pxb.length-1]--;  
}  
}  
}  
 
var ox = 0, oy = b,  
_oy = _pxb[0],  
l = pxl.length,  
w, h;  
for (var i = 0; i < l; i++)  
{  
if (typeof _pxb[i] != "undefined")  
{  
if (_pxb[i] < _oy || pxt[i] < oy)  
{  
x = pxl[i];  
this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);  
ox = x;  
oy = pxt[i];  
_oy = _pxb[i];  
}  
}  
else  
{  
x = pxl[i];  
this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod);  
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);  
ox = x;  
oy = pxt[i];  
}  
}  
this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);  
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);  
}  
}  
 
 
function mkOvDott(left, top, width, height)  
{  
var a = width>>1, b = height>>1,  
wod = width&1, hod = height&1,  
cx = left+a, cy = top+b,  
x = 0, y = b,  
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,  
st = (aa2>>1)*(1-(b<<1)) + bb,  
tt = (bb>>1) - aa2*((b<<1)-1),  
drw = true;  
while (y > 0)  
{  
if (st < 0)  
{  
st += bb*((x<<1)+3);  
tt += (bb<<1)*(++x);  
}  
else if (tt < 0)  
{  
st += bb*((x<<1)+3) - aa4*(y-1);  
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);  
}  
else  
{  
tt -= aa2*((y<<1)-3);  
st -= aa4*(--y);  
}  
if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);  
drw = !drw;  
}  
}  
 
 
function mkRect(x, y, w, h)  
{  
var s = this.stroke;  
this.mkDiv(x, y, w, s);  
this.mkDiv(x+w, y, s, h);  
this.mkDiv(x, y+h, w+s, s);  
this.mkDiv(x, y+s, s, h-s);  
}  
 
 
function mkRectDott(x, y, w, h)  
{  
this.drawLine(x, y, x+w, y);  
this.drawLine(x+w, y, x+w, y+h);  
this.drawLine(x, y+h, x+w, y+h);  
this.drawLine(x, y, x, y+h);  
}  
 
 
function jsgFont()  
{  
this.PLAIN = 'font-weight:normal;';  
this.BOLD = 'font-weight:bold;';  
this.ITALIC = 'font-style:italic;';  
this.ITALIC_BOLD = this.ITALIC + this.BOLD;  
this.BOLD_ITALIC = this.ITALIC_BOLD;  
}  
var Font = new jsgFont();  
 
 
function jsgStroke()  
{  
this.DOTTED = -1;  
}  
var Stroke = new jsgStroke();  
 
 
function jsGraphics(id, wnd)  
{  
this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');  
 
this.setStroke = function(x)  
{  
this.stroke = x;  
if (!(x+1))  
{  
this.drawLine = mkLinDott;  
this.mkOv = mkOvDott;  
this.drawRect = mkRectDott;  
}  
else if (x-1 > 0)  
{  
this.drawLine = mkLin2D;  
this.mkOv = mkOv2D;  
this.drawRect = mkRect;  
}  
else  
{  
this.drawLine = mkLin;  
this.mkOv = mkOv;  
this.drawRect = mkRect;  
}  
};  
 
 
this.setPrintable = function(arg)  
{  
this.printable = arg;  
if (jg_fast)  
{  
this.mkDiv = mkDivIe;  
this.htmRpc = arg? htmPrtRpc : htmRpc;  
}  
else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv;  
};  
 
 
this.setFont = function(fam, sz, sty)  
{  
this.ftFam = fam;  
this.ftSz = sz;  
this.ftSty = sty || Font.PLAIN;  
};  
 
 
this.drawPolyline = this.drawPolyLine = function(x, y, s)  
{  
for (var i=0 ; i<x.length-1 ; i++ )  
this.drawLine(x[i], y[i], x[i+1], y[i+1]);  
};  
 
 
this.fillRect = function(x, y, w, h)  
{  
this.mkDiv(x, y, w, h);  
};  
 
 
this.drawPolygon = function(x, y)  
{  
this.drawPolyline(x, y);  
this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);  
};  
 
 
this.drawEllipse = this.drawOval = function(x, y, w, h)  
{  
this.mkOv(x, y, w, h);  
};  
 
 
this.fillEllipse = this.fillOval = function(left, top, w, h)  
{  
var a = (w -= 1)>>1, b = (h -= 1)>>1,  
wod = (w&1)+1, hod = (h&1)+1,  
cx = left+a, cy = top+b,  
x = 0, y = b,  
ox = 0, oy = b,  
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,  
st = (aa2>>1)*(1-(b<<1)) + bb,  
tt = (bb>>1) - aa2*((b<<1)-1),  
pxl, dw, dh;  
if (w+1) while (y > 0)  
{  
if (st < 0)  
{  
st += bb*((x<<1)+3);  
tt += (bb<<1)*(++x);  
}  
else if (tt < 0)  
{  
st += bb*((x<<1)+3) - aa4*(y-1);  
pxl = cx-x;  
dw = (x<<1)+wod;  
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);  
dh = oy-y;  
this.mkDiv(pxl, cy-oy, dw, dh);  
this.mkDiv(pxl, cy+y+hod, dw, dh);  
ox = x;  
oy = y;  
}  
else  
{  
tt -= aa2*((y<<1)-3);  
st -= aa4*(--y);  
}  
}  
this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);  
};  
 
 
/* fillPolygon method, implemented by Matthieu Haller.  
This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.  
C source of GD 1.8.4 found at http://www.boutell.com/gd/  
 
THANKS to Kirsten Schulz for the polygon fixes!  
 
The intersection finding technique of this code could be improved  
by remembering the previous intertersection, and by using the slope.  
That could help to adjust intersections to produce a nice  
interior_extrema. */  
this.fillPolygon = function(array_x, array_y)  
{  
var i;  
var y;  
var miny, maxy;  
var x1, y1;  
var x2, y2;  
var ind1, ind2;  
var ints;  
 
var n = array_x.length;  
 
if (!n) return;  
 
 
miny = array_y[0];  
maxy = array_y[0];  
for (i = 1; i < n; i++)  
{  
if (array_y[i] < miny)  
miny = array_y[i];  
 
if (array_y[i] > maxy)  
maxy = array_y[i];  
}  
for (y = miny; y <= maxy; y++)  
{  
var polyInts = new Array();  
ints = 0;  
for (i = 0; i < n; i++)  
{  
if (!i)  
{  
ind1 = n-1;  
ind2 = 0;  
}  
else  
{  
ind1 = i-1;  
ind2 = i;  
}  
y1 = array_y[ind1];  
y2 = array_y[ind2];  
if (y1 < y2)  
{  
x1 = array_x[ind1];  
x2 = array_x[ind2];  
}  
else if (y1 > y2)  
{  
y2 = array_y[ind1];  
y1 = array_y[ind2];  
x2 = array_x[ind1];  
x1 = array_x[ind2];  
}  
else continue;  
 
// modified 11. 2. 2004 Walter Zorn  
if ((y >= y1) && (y < y2))  
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);  
 
else if ((y == maxy) && (y > y1) && (y <= y2))  
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);  
}  
polyInts.sort(integer_compare);  
for (i = 0; i < ints; i+=2)  
this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);  
}  
};  
 
 
this.drawString = function(txt, x, y)  
{  
this.htm += '<div style="position:absolute;white-space:nowrap;'+  
'left:' + x + 'px;'+  
'top:' + y + 'px;'+  
'font-family:' + this.ftFam + ';'+  
'font-size:' + this.ftSz + ';'+  
'color:' + this.color + ';' + this.ftSty + '">'+  
txt +  
'<\/div>';  
};  
 
 
/* drawStringRect() added by Rick Blommers.  
Allows to specify the size of the text rectangle and to align the  
text both horizontally (e.g. right) and vertically within that rectangle */  
this.drawStringRect = function(txt, x, y, width, halign)  
{  
this.htm += '<div style="position:absolute;overflow:hidden;'+  
'left:' + x + 'px;'+  
'top:' + y + 'px;'+  
'width:'+width +'px;'+  
'text-align:'+halign+';'+  
'font-family:' + this.ftFam + ';'+  
'font-size:' + this.ftSz + ';'+  
'color:' + this.color + ';' + this.ftSty + '">'+  
txt +  
'<\/div>';  
};  
 
 
this.drawImage = function(imgSrc, x, y, w, h, a)  
{  
this.htm += '<div style="position:absolute;'+  
'left:' + x + 'px;'+  
'top:' + y + 'px;'+  
'width:' + w + 'px;'+  
'height:' + h + 'px;">'+  
'<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+  
'<\/div>';  
};  
 
 
this.clear = function()  
{  
this.htm = "";  
if (this.cnv) this.cnv.innerHTML = this.defhtm;  
};  
 
 
this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)  
{  
this.mkDiv(xr+cx, yt+cy, w, h);  
this.mkDiv(xr+cx, yb+cy, w, h);  
this.mkDiv(xl+cx, yb+cy, w, h);  
this.mkDiv(xl+cx, yt+cy, w, h);  
};  
 
this.setStroke(1);  
this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);  
this.color = '#000000';  
this.htm = '';  
this.wnd = wnd || window;  
 
if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();  
if (typeof id != 'string' || !id) this.paint = pntDoc;  
else  
{  
this.cnv = document.all? (this.wnd.document.all[id] || null)  
: document.getElementById? (this.wnd.document.getElementById(id) || null)  
: null;  
this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';  
this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;  
}  
 
this.setPrintable(false);  
}  
 
 
 
function integer_compare(x,y)  
{  
return (x < y) ? -1 : ((x > y)*1);  
}  
 
 
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
 
 
class owa_jsLogLibController extends owa_controller {  
 
 
function __construct($params) {  
 
return parent::__construct($params);  
 
}  
 
function owa_jsLogLibController($params) {  
 
return owa_jsLogLibController::__construct($params);  
}  
 
function action($data) {  
 
$this->setView('base.jsLogLibView');  
 
return;  
 
}  
 
}  
 
/**  
* Combined Javascript Tracker Library and Invocation view  
*  
* Returns owa.tracker lib and invocation as a non minimized contatinated stream. This method  
* has been depricated in favor of a static file approach and is maintained  
* solely for backwards compatability with old style tags.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_jsLogLibView extends owa_view {  
 
function owa_jsLogLibView() {  
 
return owa_jsLogLibView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
// load body template  
$this->t->set_template('wrapper_blank.tpl');  
 
// check to see if we should log clicks.  
if (!owa_coreAPI::getSetting('base', 'log_dom_clicks')) {  
$this->body->set('do_not_log_clicks', true);  
}  
 
// check to see if we should log clicks.  
if (!owa_coreAPI::getSetting('base', 'log_dom_stream')) {  
$this->body->set('do_not_log_domstream', true);  
}  
 
//set siteId variable name to support old style owa_params js object  
$this->body->set("site_id", "owa_params['site_id']");  
// set name of javascript object containing params that need to be logged  
// depricated, but needed to support old style tags  
$this->body->set("owa_params", true);  
// load body template  
$this->body->set_template('js_logger.tpl');  
 
// assemble JS libs  
$this->setJs('json2', 'base/js/includes/json2.js');  
$this->setJs('lazyload', 'base/js/includes/lazyload-2.0.min.js');  
$this->setJs('owa', 'base/js/owa.js');  
$this->setJs('owa.tracker', 'base/js/owa.tracker.js');  
//$this->setJs('url_encode', 'base/js/includes/url_encode.js');  
$this->concatinateJs();  
 
 
return;  
}  
 
 
}  
 
 
 
 
?>  
<?php  
 
 
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visits Geolocation Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_kmlVisitsGeolocationController extends owa_reportController {  
 
function owa_kmlVisitsGeolocationController($params) {  
 
return owa_kmlVisitsGeolocationController::__construct($params);  
 
}  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
// Load the core API  
$api = &owa_coreAPI::singleton($this->params);  
 
if ($this->params['site_id']):  
//get site labels  
$s = owa_coreAPI::entityFactory('base.site');  
$s->getByColumn('site_id', $this->getParam('site_id'));  
$this->set('site_name', $s->get('name'));  
$this->set('site_description', $s->get('description'));  
else:  
$this->set('site_name', 'All Sites');  
$this->set('site_description', 'All Sites Tracked by OWA');  
endif;  
 
//setup Metrics  
$m = owa_coreApi::metricFactory('base.latestVisits');  
$m->setConstraint('site_id', $this->getParam('site_id'));  
$m->setPeriod($this->getPeriod());  
$m->setOrder(OWA_SQL_DESCENDING);  
$m->setLimit(15);  
$results = $m->generate();  
 
 
$this->set('latest_visits', $results);  
 
$this->setView('base.kmlVisitsGeolocation');  
 
return;  
 
}  
 
}  
 
/**  
* Visits Geolocation KML View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_kmlVisitsGeolocationView extends owa_view {  
 
function owa_kmlVisitsGeolocationView() {  
 
return owa_kmlVisitsGeolocationView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
 
// load body template  
$this->body->set_template('kml_visits_geolocation.tpl');  
$this->body->set('visits', $this->get('latest_visits'));  
$this->body->set('site_name', $this->get('site_name'));  
$this->body->set('site_domain', $this->get('site_domain'));  
$this->body->set('site_description', $this->get('site_description'));  
 
//$this->_setLinkState();  
 
$this->body->set('xml', '<?xml version="1.0" encoding="UTF-8"?>');  
 
header('Content-type: application/vnd.google-earth.kml+xml; charset=UTF-8', true);  
 
header('Content-Disposition: inline; filename="owa.kml"');  
//header('Content-type: text/plain', true);  
return;  
}  
 
 
}  
 
 
?>  
<?php  
 
 
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visits Geolocation KML network Link Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_kmlVisitsGeolocationNetworkLinkController extends owa_reportController {  
 
function __construct($params) {  
 
$this->priviledge_level = 'viewer';  
return parent::__construct($params);  
}  
 
function action() {  
 
// Load the core API  
$api = &owa_coreAPI::singleton($this->params);  
 
$data = array();  
$data['params'] = $this->params;  
 
if ($this->params['site_id']):  
//get site labels  
$s = owa_coreAPI::entityFactory('base.site');  
$s->getByColumn('site_id', $this->params['site_id']);  
$data['site_name'] = $s->get('name');  
$data['site_description'] = $s->get('description');  
$data['site_domain'] = $s->get('domain');  
else:  
$data['site_name'] = 'All Sites';  
$data['site_description'] = 'Visits for all sitess tracked by OWA.';  
$data['site_domain'] = 'owa';  
endif;  
 
 
$data['view'] = 'base.kmlVisitsGeolocationNetworkLink';  
$data['user_name'] = $this->params['u'];  
$data['passkey'] = $this->params['pk'];  
 
return $data;  
 
}  
 
}  
 
 
 
/**  
* Visits Geolocation KML View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_kmlVisitsGeolocationNetworkLinkView extends owa_view {  
 
function __construct() {  
 
$this->priviledge_level = 'guest';  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
 
// load body template  
$this->body->set_template('kml_network_link_geolocation.tpl');  
$this->body->set('params', $data['params']);  
$this->body->set('site_name', $data['site_name']);  
$this->body->set('site_domain', $data['site_domain']);  
$this->body->set('site_description', $data['site_description']);  
$this->body->set('period_label', owa_lib::get_period_label($data['params']['period']));  
$this->body->set('date_label', owa_lib::getDateLabel($data['params']['period']));  
$this->body->set('xml', '<?xml version="1.0" encoding="UTF-8"?>');  
$this->body->set('user_name', $data['user_name']);  
$this->body->set('passkey', $data['passkey']);  
 
$this->_setLinkState();  
 
header('Content-type: application/vnd.google-earth.kml+xml; charset=UTF-8', true);  
//header('Content-type: application/keyhole', true);  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
 
class owa_loginController extends owa_controller {  
 
function action() {  
 
$auth = &owa_auth::get_instance();  
$status = $auth->authenticateUser();  
$go = $this->getParam('go');  
// if authentication is successfull  
if ($status['auth_status'] == true) {  
 
if (!empty($go)) {  
// redirect to url if present  
$url = urldecode($go);  
$this->e->debug("redirecting browser to...:". $url);  
owa_lib::redirectBrowser($url);  
 
} else {  
//else redirect to home page  
 
// these need to be unset as they were set previously by the doAction method.  
// need to refactor this out.  
$this->set('auth_status', '');  
$this->set('params', '');  
$this->set('site_id', '');  
$this->setRedirectAction($this->config['start_page']);  
}  
 
} else {  
// return login form with error msg  
$this->setView('base.loginForm');  
$this->set('go', $go);  
$this->set('error_code', 2002);  
$this->set('user_id', $this->getParam('user_id'));  
 
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
/**  
* Login Form Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_loginFormController extends owa_controller {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$cu = owa_coreAPI::getCurrentUser();  
 
$this->set('go', $this->getParam('go'));  
$this->set('user_id', $cu->getUserData('user_id'));  
$this->setView('base.loginForm');  
}  
}  
 
/**  
* Login Form View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_loginFormView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function construct($data) {  
 
$this->setTitle("Login");  
$this->t->set_template('wrapper_public.tpl');  
$this->body->set_template('login_form.tpl');  
$this->body->set('headline', 'Please login using the from below');  
$this->body->set('user_id', $this->get('user_id'));  
$this->body->set('go', $this->get('go'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
 
/**  
* Logout Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_logoutController extends owa_controller {  
 
function action() {  
 
$auth = &owa_auth::get_instance();  
$auth->deleteCredentials();  
$this->setRedirectAction('base.loginForm');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Actions Count Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_actions extends owa_metric {  
 
function __construct() {  
 
$this->setName('actions');  
$this->setLabel('Actions');  
$this->setEntity('base.action_fact');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Actions Per Visit Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_actionsPerVisit extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('actionsPerVisit');  
$this->setLabel('Actions / Visit');  
$this->setChildMetric('actions');  
$this->setChildMetric('visits');  
$this->setFormula('round(actions / visits, 1)');  
$this->setDataType('decimal');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Action Count Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_actionsValue extends owa_metric {  
 
function __construct() {  
 
$this->setName('actionsValue');  
$this->setLabel('Actions Value');  
$this->setEntity('base.action_fact');  
$this->setColumn('numeric_value');  
$this->setSelect(sprintf("sum(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Bounce Rate Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_bounceRate extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('bounceRate');  
$this->setLabel('Bounce Rate');  
$this->setChildMetric('bounces');  
$this->setChildMetric('visits');  
$this->setFormula('bounces / visits');  
$this->setDataType('percentage');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Bounces metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_bounces extends owa_metric {  
 
function __construct() {  
 
$this->setName('bounces');  
$this->setLabel('Bounces');  
$this->setEntity('base.session');  
$this->setColumn('is_bounce');  
$this->setSelect(sprintf("sum(CASE %s WHEN TRUE THEN 1 ELSE 0 END)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Click Browser Types Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_clickBrowserTypes extends owa_metric {  
 
function owa_clickBrowserTypes($params = null) {  
 
return owa_clickBrowserTypes::__construct($params);  
 
}  
 
function __construct($params = null) {  
 
return parent::__construct($params);  
}  
 
function calculate() {  
 
$this->db->selectFrom('owa_click', 'click');  
 
$this->db->selectColumn("count(distinct click.id) as count,  
ua.id,  
ua.ua as ua,  
ua.browser_type");  
$this->db->join(OWA_SQL_JOIN_LEFT_OUTER,'owa_ua', 'ua', 'ua_id', 'ua.id');  
$this->db->groupBy('ua.browser_type');  
$this->db->orderBy('count');  
 
return $this->db->getAllRows();  
 
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Clicks metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_domClicks extends owa_metric {  
 
function __construct() {  
 
$this->setName('domClicks');  
$this->setLabel('Dom Clicks');  
$this->setEntity('base.click');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Avg. Revenue per Transaction Calculated Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_ecommerceConversionRate extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('ecommerceConversionRate');  
$this->setLabel('Ecommerce Conversion Rate');  
$this->setChildMetric('visits');  
$this->setChildMetric('transactions');  
$this->setFormula('transactions / visits');  
$this->setDataType('percentage');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Feed Readers metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_feedReaders extends owa_metric {  
 
function __construct() {  
 
$this->setName('feedReaders');  
$this->setLabel('Feed Readers');  
$this->setEntity('base.feed_request');  
$this->setColumn('feed_reader_guid');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Feed Requests metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_feedRequests extends owa_metric {  
 
function __construct() {  
 
$this->setName('feedRequests');  
$this->setLabel('Feed Requests');  
$this->setEntity('base.feed_request');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Feed Subscriptions metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_feedSubscriptions extends owa_metric {  
 
function __construct() {  
 
$this->setName('feedSubscriptions');  
$this->setLabel('Feed Subscriptions');  
$this->setEntity('base.feed_request');  
$this->setColumn('subscription_id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Goal Abandon Rate Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalAbandonRateAll extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('goalAbandonRateAll');  
$this->setLabel('Goal Abandonment Rate');  
$this->setChildMetric('goalCompletionsAll');  
$this->setChildMetric('goalStartsAll');  
$this->setFormula('goalStartsAll / goalCompletionsAll');  
$this->setDataType('percentage');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal Completions of All Goals  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalCompletionsAll extends owa_metric {  
 
function __construct() {  
 
$this->setName('goalCompletionsAll');  
$this->setLabel('Goal Completions');  
$this->setEntity('base.session');  
$this->setColumn('num_goals');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Goal Conversion Rate Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalConversionRateAll extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('goalConversionRateAll');  
$this->setLabel('Goal Conversion Rate');  
$this->setChildMetric('visits');  
$this->setChildMetric('goalCompletionsAll');  
$this->setFormula('goalCompletionsAll / visits');  
$this->setDataType('percentage');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal N Compeletions  
*  
* This metric produces a count of goal completions for a specific goal number  
* Goal number is passed into the object dynamicaly when the metric is created.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalNCompletions extends owa_metric {  
 
function __construct( $params ) {  
 
if ( array_key_exists( 'goal_number' , $params ) ) {  
$goal_number = $params['goal_number'];  
}  
 
$siteId = owa_coreAPI::getRequestParam('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goal = $gm->getGoal($goal_number);  
$name = 'goal'.$goal_number.'Completions';  
$this->setName( $name );  
$this->setLabel( sprintf('G%d: %s', $goal_number,$goal['goal_name'] ) );  
$this->setEntity( 'base.session' );  
$column = 'goal_'.$goal_number;  
$this->setColumn( $column );  
$this->setSelect( sprintf( "SUM(%s)", $this->getColumn() ) );  
$this->setDataType( 'integer' );  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal N Starts  
*  
* This metric produces a count of goal starts for a specific goal number  
* Goal number is passed into the object dynamicaly when the metric is created.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalNStarts extends owa_metric {  
 
function __construct( $params ) {  
 
if ( array_key_exists( 'goal_number' ), $params ) {  
$goal_number = $params['goal_number'];  
}  
$siteId = owa_coreAPI::getRequestParam('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goal = $gm->getGoal($goal_number);  
$name = 'goal'.$goal_number.'Starts';  
$this->setName( $name );  
$this->setLabel( $goal['name'] . ' Starts');  
$this->setEntity( 'base.session' );  
$column = 'goal_'.$goal_number.'_start';  
$this->setColumn( $column );  
$this->setSelect( sprintf( "SUM(%s)", $this->getColumn() ) );  
$this->setDataType( 'integer' );  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal N Value  
*  
* This metric produces a sum of goal value for a specific goal number  
* Goal number is passed into the object dynamicaly when the metric is created.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalNValue extends owa_metric {  
 
function __construct( $params ) {  
 
if ( array_key_exists( 'goal_number' ), $params ) {  
$goal_number = $params['goal_number'];  
}  
$siteId = owa_coreAPI::getRequestParam('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goal = $gm->getGoal($goal_number);  
$name = 'goal'.$goal_number.'Value';  
$this->setName( $name );  
$this->setLabel( "G$goal_number Value");  
$this->setEntity( 'base.session' );  
$column = 'goal_'.$goal_number.'_value';  
$this->setColumn( $column );  
$this->setSelect( sprintf( "SUM(%s)", $this->getColumn() ) );  
$this->setDataType( 'currency' );  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal Starts of All Goals  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalStartsAll extends owa_metric {  
 
function __construct() {  
 
$this->setName('goalStartsAll');  
$this->setLabel('Goal Starts');  
$this->setEntity('base.session');  
$this->setColumn('num_goal_starts');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Goal Value of All Goals  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_goalValueAll extends owa_metric {  
 
function __construct() {  
 
$this->setName('goalValueAll');  
$this->setLabel('All Goals Value');  
$this->setEntity('base.session');  
$this->setColumn('goals_value');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Top Clicks Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_latestDomstreams extends owa_metric {  
 
function owa_latestDomstreams($params = null) {  
 
return owa_latestDomstreams::__construct($params);  
}  
 
function __construct($params = null) {  
 
return parent::__construct($params);  
}  
 
function calculate() {  
 
$this->db->selectFrom('owa_domstream');  
$this->db->selectColumn("id, timestamp, page_url, duration");  
$this->db->selectColumn($this->setLabel('id', 'Domstream ID'));  
$this->db->selectColumn($this->setLabel('page_url', 'Page URL'));  
$this->db->selectColumn($this->setLabel('duration', 'Duration'));  
$this->db->selectColumn($this->setLabel('timestamp', 'Timestamp'));  
$this->db->orderBy('timestamp', 'DESC');  
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Line Item Quantity Metric  
*  
* A Sum of the total number of items purchased as part of an ecomerce transaction.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_lineItemQuantity extends owa_metric {  
 
function __construct() {  
 
$this->setName('lineItemQuantity');  
$this->setLabel('Quantity');  
$this->setEntity('base.commerce_line_item_fact');  
$this->setColumn('quantity');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Line Item Quantity Metric  
*  
* A Sum of the total number of items purchased as part of an ecomerce transaction.  
* Derived from use of the owa_session fact table.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_lineItemQuantityFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('lineItemQuantity');  
$this->setLabel('Quantity');  
$this->setEntity('base.session');  
$this->setColumn('commerce_items_quantity');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Line Item Revenue Metric  
*  
* A Sum of the total number of items purchased as part of an ecomerce transaction.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_lineItemRevenue extends owa_metric {  
 
function __construct() {  
 
$this->setName('lineItemRevenue');  
$this->setLabel('Item Revenue');  
$this->setEntity('base.commerce_line_item_fact');  
$this->setColumn('item_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Line Item Revenue Metric  
*  
* A Sum of the total number of items purchased as part of an ecomerce transaction.  
* Derived from use of owa_session fact table  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_lineItemRevenueFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('lineItemRevenue');  
$this->setLabel('Item Revenue');  
$this->setEntity('base.session');  
$this->setColumn('commerce_items_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* New Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_newVisitors extends owa_metric {  
 
function __construct() {  
 
$this->setName('newVisitors');  
$this->setLabel('New Visitors');  
$this->setEntity('base.session');  
$this->setColumn('is_new_visitor');  
$this->setSelect(sprintf("sum(CASE %s WHEN TRUE THEN 1 ELSE 0 END)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Page View metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_pageViews extends owa_metric {  
 
function __construct() {  
 
$this->setName('pageViews');  
$this->setLabel('Page Views');  
$this->setEntity('base.request');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Page View metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_pageViewsFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('pageViews');  
$this->setLabel('Page Views');  
$this->setEntity('base.session');  
$this->setColumn('num_pageviews');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Pages Per Visit Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_pagesPerVisit extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('pagesPerVisit');  
$this->setLabel('Pages Per Visit');  
$this->setChildMetric('pageViews');  
$this->setChildMetric('visits');  
$this->setFormula('round(pageViews / visits, 2)');  
$this->setDataType('decimal');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_repeatVisitors extends owa_metric {  
 
function __construct() {  
 
$this->setName('repeatVisitors');  
$this->setLabel('Repeat Visitors');  
$this->setEntity('base.session');  
$this->setSelect("(count(distinct(session.visitor_id)) - sum(CASE session.is_new_visitor WHEN TRUE THEN 1 ELSE 0 END))");  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Avg. Revenue per Transaction Calculated Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_revenuePerTransaction extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('revenuePerTransaction');  
$this->setLabel('Avg. Transaction Value');  
$this->setChildMetric('transactionRevenue');  
$this->setChildMetric('transactions');  
$this->setFormula('transactionRevenue / transactions');  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists("owa_calculatedMetric")) {  
require_once(OWA_BASE_CLASS_DIR.'calculatedMetric.php');  
}  
 
/**  
* Avg. Revenue per Visit Calculated Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_revenuePerVisit extends owa_calculatedMetric {  
 
function __construct() {  
 
$this->setName('revenuePerVisit');  
$this->setLabel('Revenue Per Visit');  
$this->setChildMetric('transactionRevenue');  
$this->setChildMetric('visits');  
$this->setFormula('transactionRevenue / visits');  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Session Browser Types Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sessionBrowserTypes extends owa_metric {  
 
function owa_sessionBrowserTypes($params = null) {  
 
return owa_sessionBrowserTypes::__construct($params);  
 
}  
 
function __construct($params = null) {  
 
parent::__construct($params);  
}  
 
function calculate() {  
 
$this->db->selectFrom('owa_session', 'session');  
$this->db->selectColumn("count(distinct session.id) as count, ua.ua as ua, ua.browser_type");  
$this->db->join(OWA_SQL_JOIN_LEFT_OUTER, 'owa_ua', 'ua', 'ua_id', 'ua.id');  
$this->db->groupBy('ua.browser_type');  
$this->db->orderBy('count', $this->getOrder());  
 
return $this->db->getAllRows();  
 
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Tax Revenue Metric  
*  
* A Sum of the tax revenue of ecommerce transactions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_shippingRevenue extends owa_metric {  
 
function __construct() {  
 
$this->setName('shippingRevenue');  
$this->setLabel('Shipping');  
$this->setEntity('base.commerce_transaction_fact');  
$this->setColumn('shipping_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Shipping Revenue Metric  
*  
* A Sum of the tax revenue of ecommerce transactions  
* Derived from owa_session fact table.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_shippingRevenueFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('shippingRevenue');  
$this->setLabel('Shipping');  
$this->setEntity('base.session');  
$this->setColumn('commerce_shipping_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Tax Revenue Metric  
*  
* A Sum of the tax revenue of ecommerce transactions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_taxRevenue extends owa_metric {  
 
function __construct() {  
 
$this->setName('taxRevenue');  
$this->setLabel('Tax');  
$this->setEntity('base.commerce_transaction_fact');  
$this->setColumn('tax_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Tax Revenue Metric  
*  
* A Sum of the tax revenue of ecommerce transactions  
* Derived from owa_session fact table.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_taxRevenueFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('taxRevenue');  
$this->setLabel('Tax Revenue');  
$this->setEntity('base.session');  
$this->setColumn('commerce_tax_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Top Referers Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_topReferers extends owa_metric {  
 
function owa_topReferers($params = null) {  
 
return owa_topReferers::__construct($params);  
 
}  
 
function __construct($params = '') {  
 
return parent::__construct($params);  
}  
 
function calculate() {  
 
$this->db->selectColumn("count(referer.id) as count,  
sum(session.num_pageviews) as page_views,  
url,  
page_title,  
site_name,  
query_terms,  
snippet,  
refering_anchortext,  
is_searchengine");  
 
$this->db->selectFrom('owa_session', 'session');  
$this->db->join(OWA_SQL_JOIN_LEFT_OUTER, 'owa_referer', 'referer', 'referer_id', 'referer.id');  
$this->db->groupBy('referer.url');  
$this->db->orderBy('count', $this->getOrder());  
$this->db->where('is_searchengine', 1, '!=');  
 
$ret = $this->db->getAllRows();  
 
return $ret;  
 
}  
 
function paginationCount() {  
 
$this->db->selectColumn("count(distinct referer.id) as count");  
 
$this->db->selectFrom('owa_session', 'session');  
$this->db->join(OWA_SQL_JOIN_LEFT_OUTER, 'owa_referer', 'referer', 'referer_id', 'referer.id');  
$this->db->where('is_searchengine', 1, '!=');  
 
$ret = $this->db->getOneRow();  
 
return $ret['count'];  
 
 
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Top Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_topVisitors extends owa_metric {  
 
function owa_topVisitors($params = null) {  
 
return owa_topVisitors::__construct($params = null);  
 
}  
 
function __construct($params = null) {  
 
parent::__construct($params);  
}  
 
function calculate() {  
 
$this->db->selectColumn("count(visitor_id) as count, visitor_id as vis_id, user_name, user_email");  
$this->db->selectFrom('owa_session');  
$this->db->groupBy('vis_id');  
$this->db->orderBy('count', $this->getOrder());  
 
$ret = $this->db->getAllRows();  
 
return $ret;  
 
}  
 
function paginationCount() {  
 
$this->db->selectColumn("count(distinct visitor_id) as count");  
$this->db->selectFrom('owa_session');  
 
$ret = $this->db->getOneRow();  
 
return $ret['count'];  
 
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Transactions Revenue Metric  
*  
* A Sum of the total revenue of ecommerce transactions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_transactionRevenue extends owa_metric {  
 
function __construct() {  
 
$this->setName('transactionRevenue');  
$this->setLabel('Revenue');  
$this->setEntity('base.commerce_transaction_fact');  
$this->setColumn('total_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Transactions Revenue Metric  
*  
* A Sum of the total revenue of ecommerce transactions  
* Derived from owa_session fact table.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_transactionRevenueFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('transactionRevenue');  
$this->setLabel('Revenue');  
$this->setEntity('base.session');  
$this->setColumn('commerce_trans_revenue');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('currency');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Trnsactions Quantity Metric  
*  
* A Sum of the total number of ecommerce transactions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_transactions extends owa_metric {  
 
function __construct() {  
 
$this->setName('transactions');  
$this->setLabel('Transactions');  
$this->setEntity('base.commerce_transaction_fact');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Transactions Quantity Metric  
*  
* A Sum of the total number of ecommerce transactions  
* Derived from owa_session fact table.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_transactionsFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('transactions');  
$this->setLabel('Transactions');  
$this->setEntity('base.session');  
$this->setColumn('commerce_trans_count');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Action Count Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_uniqueActions extends owa_metric {  
 
function __construct() {  
 
$this->setName('uniqueActions');  
$this->setLabel('Unique Actions');  
$this->setEntity('base.action_fact');  
$this->setColumn('action_name');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Unique Line Items Metric  
*  
* A distinct count of the line items of ecommerce transactions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_uniqueLineItems extends owa_metric {  
 
function __construct() {  
 
$this->setName('uniqueLineItems');  
$this->setLabel('Unique Items');  
$this->setEntity('base.commerce_transaction_fact');  
$this->setColumn('sku');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
// <a href="//www.openwebanalytics.com">Open Web Analytics</a>  
// Copyright Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Ecommerce Unique Line Items Metric  
*  
* A distinct count of the line items of ecommerce transactions  
* Derived from owa_session fact table  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_uniqueLineItemsFromSessionFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('uniqueLineItems');  
$this->setLabel('Unique Items');  
$this->setEntity('base.session');  
$this->setColumn('commerce_items_count');  
$this->setSelect(sprintf("SUM(%s)", $this->getColumn()));  
$this->setDataType('integer');  
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Page Views Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_uniquePageViews extends owa_metric {  
 
function __construct() {  
 
$this->setName('uniquePageViews');  
$this->setLabel('Unique Page Views');  
$this->setEntity('base.request');  
$this->setColumn('document_id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_uniqueVisitors extends owa_metric {  
 
function __construct() {  
 
$this->setName('uniqueVisitors');  
$this->setLabel('Unique Visitors');  
$this->setEntity('base.session');  
$this->setColumn('visitor_id');  
$this->setSelect(sprintf("count(distinct(%s))", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visit Duration metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_visitDuration extends owa_metric {  
 
function __construct() {  
 
$this->setName('visitDuration');  
$this->setLabel('Avg. Visit Duration');  
$this->setEntity('base.session');  
$this->setSelect(sprintf("round(avg(%s.last_req - %s.timestamp))", $this->entity->getTableAlias(), $this->entity->getTableAlias()));  
$this->setDataType('timestamp');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_visitors extends owa_metric {  
 
function __construct() {  
 
$this->setName('visitors');  
$this->setLabel('Visitors');  
$this->setEntity('base.session');  
$this->setColumn('visitor_id');  
$this->setSelect(sprintf("count(%s)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Visitors from Request Fact metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_visitorsFromRequestFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('visitors');  
$this->setLabel('Visitors');  
$this->setEntity('base.request');  
$this->setColumn('visitor_id');  
$this->setSelect(sprintf("count(%s)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_visits extends owa_metric {  
 
function __construct() {  
 
$this->setName('visits');  
$this->setLabel('Visits');  
$this->setEntity('base.session');  
$this->setColumn('id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Unique Visitors metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_visitsFromRequestFact extends owa_metric {  
 
function __construct() {  
 
$this->setName('visits');  
$this->setLabel('Visits');  
$this->setEntity('base.request');  
$this->setColumn('session_id');  
$this->setSelect(sprintf("count(distinct %s)", $this->getColumn()));  
$this->setDataType('integer');  
 
return parent::__construct();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_module.php');  
 
/**  
* Base Package Module  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_baseModule extends owa_module {  
 
/**  
* Constructor  
*  
*/  
function __construct() {  
 
$this->name = 'base';  
$this->display_name = 'Open Web Analytics';  
$this->group = 'Base';  
$this->author = 'Peter Adams';  
$this->version = 6;  
$this->description = 'Base functionality for OWA.';  
$this->config_required = false;  
$this->required_schema_version = 6;  
 
/**  
* Register Filters  
*  
* The following lines register filter methods.  
*/  
$this->registerFilter('operating_system', $this, 'determineOperatingSystem', 0);  
$this->registerFilter('ip_address', $this, 'setIp', 0);  
$this->registerFilter('full_host', $this, 'resolveHost', 0);  
$this->registerFilter('host', $this, 'getHostDomain', 0);  
$this->registerFilter('attributed_campaign', $this, 'attributeCampaign', 10);  
$this->registerFilter('geolocation', 'hostip', 'get_location', 10, 'classes');  
//Clean Query Strings  
if (owa_coreAPI::getSetting('base', 'clean_query_string')) {  
$this->registerFilter('page_url', $this, 'makeUrlCanonical',0);  
$this->registerFilter('prior_page', $this, 'makeUrlCanonical',0);  
$this->registerFilter('target_url', $this, 'makeUrlCanonical',0);  
}  
// event procesing daemon jobs  
$this->registerBackgroundJob('process_event_queue', 'cli.php cmd=processEventQueue', owa_coreAPI::getSetting('base', 'processQueuesJobSchedule'), 10);  
 
/**  
* Register Service Implementations  
*  
* The following lines register various service implementations.  
*/  
 
/**  
* Register Metrics  
*  
* The following lines register various data metrics.  
*/  
$this->registerMetric('pageViews', 'base.pageViews');  
$this->registerMetric('pageViews', 'base.pageViewsFromSessionFact');  
$this->registerMetric('uniqueVisitors', 'base.uniqueVisitors');  
$this->registerMetric('visits', 'base.visits');  
$this->registerMetric('visits', 'base.visitsFromRequestFact');  
$this->registerMetric('visitors', 'base.visitors');  
$this->registerMetric('visitors', 'base.visitorsFromRequestFact');  
$this->registerMetric('newVisitors', 'base.newVisitors');  
$this->registerMetric('repeatVisitors', 'base.repeatVisitors');  
$this->registerMetric('bounces', 'base.bounces');  
$this->registerMetric('visitDuration', 'base.visitDuration');  
$this->registerMetric('uniquePageViews', 'base.uniquePageViews');  
$this->registerMetric('bounceRate', 'base.bounceRate');  
$this->registerMetric('pagesPerVisit', 'base.pagesPerVisit');  
$this->registerMetric('actions', 'base.actions');  
$this->registerMetric('uniqueActions', 'base.uniqueActions');  
$this->registerMetric('actionsValue', 'base.actionsValue');  
//$this->registerMetric('actionsPerVisit', 'base.actionsPerVisit');  
$this->registerMetric('feedRequests', 'base.feedRequests');  
$this->registerMetric('feedReaders', 'base.feedReaders');  
$this->registerMetric('feedSubscriptions', 'base.feedSubscriptions');  
 
// goals  
$gcount = owa_coreAPI::getSetting('base', 'numGoals');  
for ($num = 1; $num <= $gcount;$num++) {  
$params = array('goal_number' => $num);  
 
$metric_name = 'goal'.$num.'Completions';  
$this->registerMetric($metric_name, 'base.goalNCompletions', $params);  
 
$metric_name = 'goal'.$num.'Starts';  
$this->registerMetric($metric_name, 'base.goalNStarts', $params);  
 
$metric_name = 'goal'.$num.'Value';  
$this->registerMetric($metric_name, 'base.goalNValue', $params);  
}  
 
$this->registerMetric('goalCompletionsAll', 'base.goalCompletionsAll');  
$this->registerMetric('goalStartsAll', 'base.goalStartsAll');  
$this->registerMetric('goalValueAll', 'base.goalValueAll');  
$this->registerMetric('goalConversionRateAll', 'base.goalConversionRateAll');  
$this->registerMetric('goalAbandonRateAll', 'base.goalAbandonRateAll');  
 
// ecommerce metrics  
$this->registerMetric('lineItemQuantity', 'base.lineItemQuantity');  
$this->registerMetric('lineItemQuantity', 'base.lineItemQuantityFromSessionFact');  
$this->registerMetric('lineItemRevenue', 'base.lineItemRevenue');  
$this->registerMetric('lineItemRevenue', 'base.lineItemRevenueFromSessionFact');  
$this->registerMetric('transactions', 'base.transactions');  
$this->registerMetric('transactions', 'base.transactionsFromSessionFact');  
$this->registerMetric('transactionRevenue', 'base.transactionRevenue');  
$this->registerMetric('transactionRevenue', 'base.transactionRevenueFromSessionFact');  
$this->registerMetric('taxRevenue', 'base.taxRevenue');  
$this->registerMetric('taxRevenue', 'base.taxRevenueFromSessionFact');  
$this->registerMetric('shippingRevenue', 'base.shippingRevenue');  
$this->registerMetric('shippingRevenue', 'base.shippingRevenueFromSessionFact');  
$this->registerMetric('uniqueLineItems', 'base.uniqueLineItems');  
$this->registerMetric('uniqueLineItems', 'base.uniqueLineItemsFromSessionFact');  
$this->registerMetric('revenuePerTransaction', 'base.revenuePerTransaction');  
$this->registerMetric('revenuePerVisit', 'base.revenuePerVisit');  
$this->registerMetric('ecommerceConversionRate', 'base.ecommerceConversionRate');  
$this->registerMetric('domClicks', 'base.domClicks');  
/**  
* Register Dimensions  
*  
* The following lines register various data dimensions.  
*/  
$this->registerDimension('browserVersion', 'base.ua', 'browser', 'Browser Version', 'visitor', 'The browser version of the visitor.');  
$this->registerDimension('browserType', 'base.ua', 'browser_type', 'Browser Type', 'visitor', 'The browser type of the visitor.');  
$this->registerDimension('osType', 'base.os', 'name', 'Operating System', 'visitor', 'The operating System of the visitor.');  
$this->registerDimension('ipAddress', 'base.host', 'ip_address', 'IP Address', 'visitor', 'The IP address of the visitor.');  
$this->registerDimension('hostName', 'base.host', 'full_host', 'Host Name', 'visitor', 'The host name used by the visitor.');  
$this->registerDimension('city', 'base.location_dim', 'city', 'City', 'visitor', 'The city of the visitor.');  
$this->registerDimension('country', 'base.location_dim', 'country', 'Country', 'visitor', 'The country of the visitor.');  
$this->registerDimension('latitude', 'base.location_dim', 'latitude', 'Latitude', 'visitor', 'The latitude of the visitor.');  
$this->registerDimension('longitude', 'base.location_dim', 'longitude', 'Longitude', 'visitor', 'The longitude of the visitor.');  
$this->registerDimension('countryCode', 'base.location_dim', 'country_code', 'Country Code', 'visitor', 'The ISO country code of the visitor.');  
$this->registerDimension('stateRegion', 'base.location_dim', 'state', 'State/Region', 'visitor', 'The state or region of the visitor.');  
 
$this->registerDimension('timeSinceLastVisit', 'base.session', 'time_sinse_priorsession', 'Time Since Last Visit', 'visitor', 'The time since the last visit.', '', true);  
$this->registerDimension('isRepeatVisitor', 'base.session', 'is_repeat_visitor', 'Repeat Visitor', 'visitor', 'Repeat Site Visitor.', '', true);  
$this->registerDimension('isNewVisitor', 'base.session', 'is_new_visitor', 'New Visitor', 'visitor', 'New Site Visitor.', '', true);  
$this->registerDimension('language', 'base.session', 'language', 'Language', 'visit', 'The language of the visit.', '', true);  
$this->registerDimension('language', 'base.request', 'language', 'Language', 'visit', 'The language of the visit.', '', true);  
// campaign related  
$this->registerDimension('medium', 'base.session', 'medium', 'Medium', 'visit', 'The medium of channel of visit.', '', true);  
$this->registerDimension('latestAttributions', 'base.session', 'latest_attributions', 'Latest Attributions', 'visit', 'The latest campaign attributions.', '', true);  
$this->registerDimension('source', 'base.source_dim', 'source_domain', 'Source', 'visit', 'The traffic source of the visit.');  
$this->registerDimension('campaign', 'base.campaign_dim', 'name', 'Campaign', 'visit', 'The campaign that originated the visit.');  
$this->registerDimension('ad', 'base.ad_dim', 'name', 'Ad', 'visit', 'The name of the ad that originated the visit.');  
$this->registerDimension('adType', 'base.ad_dim', 'type', 'Ad Type', 'visit', 'The type of ad that originated the visit.');  
 
$this->registerDimension('siteDomain', 'base.site', 'domain', 'Site Domain', 'visit', 'The domain of the site.');  
$this->registerDimension('siteName', 'base.site', 'name', 'Site Name', 'visit', 'The name of the site.');  
$this->registerDimension('siteId', 'base.site', 'site_id', 'Site ID', 'visit', 'The ID of the site.');  
$this->registerDimension('userName', 'base.visitor', 'user_name', 'User Name', 'visitor', 'The name or ID of the user.');  
$this->registerDimension('userEmail', 'base.visitor', 'user_email', 'Email Address', 'visitor', 'The email address of the user.');  
 
// Date and time oriented dimensions  
$this->registerDimension('date', 'base.session', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('day', 'base.session', 'day', 'Day', 'visit', 'The day.', '', true);  
$this->registerDimension('month', 'base.session', 'month', 'Month', 'visit', 'The month.', '', true);  
$this->registerDimension('year', 'base.session', 'year', 'Year', 'visit', 'The year.', '', true);  
$this->registerDimension('dayofweek', 'base.session', 'dayofweek', 'Day of Week', 'visit', 'The day of the week.', '', true);  
$this->registerDimension('dayofyear', 'base.session', 'dayofyear', 'Day of Year', 'visit', 'The day of the year.', '', true);  
$this->registerDimension('weekofyear', 'base.session', 'weekofyear', 'Week of Year', 'visit', 'The week of the year.', '', true);  
$this->registerDimension('siteId', 'base.session', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true);  
$this->registerDimension('daysSinceLastVisit', 'base.session', 'days_since_prior_session', 'Days Since Last Visit', 'visit', 'The number of days since the last visit.', '', true);  
$this->registerDimension('daysSinceFirstVisit', 'base.session', 'days_since_first_session', 'Days Since First Visit', 'visit', 'The number of days since the first visit of the user.', '', true);  
 
$this->registerDimension('priorVisitCount', 'base.session', 'num_prior_sessions', 'Prior Visits', 'visit', 'The number of prior visits, excluding the current one.', '', true);  
 
$this->registerDimension('priorVisitCount', 'base.request', 'num_prior_sessions', 'Prior Visits', 'visit', 'The number of prior visits, excluding the current one.', '', true);  
 
$this->registerDimension('date', 'base.request', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('day', 'base.request', 'day', 'Day', 'visit', 'The day.', '', true);  
$this->registerDimension('month', 'base.request', 'month', 'Month', 'visit', 'The month.', '', true);  
$this->registerDimension('year', 'base.request', 'year', 'Year', 'visit', 'The year.', '', true);  
$this->registerDimension('dayofweek', 'base.request', 'dayofweek', 'Day of Week', 'visit', 'The day of the week.', '', true);  
$this->registerDimension('dayofyear', 'base.request', 'dayofyear', 'Day of Year', 'visit', 'The day of the year.', '', true);  
$this->registerDimension('weekofyear', 'base.request', 'weekofyear', 'Week of Year', 'visit', 'The week of the year.', '', true);  
$this->registerDimension('siteId', 'base.request', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true);  
 
$this->registerDimension('actionName', 'base.action_fact', 'action_name', 'Action Name', 'actions', 'The name of the action.', '', true);  
$this->registerDimension('actionGroup', 'base.action_fact', 'action_group', 'Action Group', 'actions', 'The group that an action belongs to.', '', true);  
$this->registerDimension('actionLabel', 'base.action_fact', 'action_label', 'Action Label', 'actions', 'The label associated with an action.', '', true);  
$this->registerDimension('date', 'base.action_fact', 'yyyymmdd', 'Date', 'action', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('siteId', 'base.acton_fact', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true);  
 
// visit  
$this->registerDimension('entryPageUrl', 'base.document', 'url', 'Entry Page URL', 'visit', 'The URL of the entry page.', 'first_page_id');  
$this->registerDimension('entryPagePath', 'base.document', 'uri', 'Entry Page Path', 'visit', 'The URI of the entry page.', 'first_page_id');  
$this->registerDimension('entryPageTitle', 'base.document', 'page_title', 'Entry Page Title', 'visit', 'The title of the entry page.', 'first_page_id');  
$this->registerDimension('entryPageType', 'base.document', 'page_type', 'Entry Page Type', 'visit', 'The page type of the entry page.', 'first_page_id');  
$this->registerDimension('exitPageUrl', 'base.document', 'url', 'Exit Page URL', 'visit', 'The URL of the exit page.', 'last_page_id');  
$this->registerDimension('exitPagePath', 'base.document', 'uri', 'Exit Page Path', 'visit', 'The URI of the exit page.', 'last_page_id');  
$this->registerDimension('exitPageTitle', 'base.document', 'page_title', 'Exit Page Title', 'visit', 'The title of the exit page.', 'last_page_id');  
$this->registerDimension('exitPageType', 'base.document', 'page_type', 'Exit Page Type', 'visit', 'The page type of the exit page.', 'last_page_id');  
$this->registerDimension('priorPageUrl', 'base.document', 'url', 'Prior Page URL', 'visit', 'The URL of the prior page.', 'prior_document_id');  
$this->registerDimension('priorPagePath', 'base.document', 'uri', 'Prior Page Path', 'visit', 'The URI of the prior page.', 'prior_document_id');  
$this->registerDimension('priorPageTitle', 'base.document', 'page_title', 'Prior Page Title', 'visit', 'The title of the prior page.', 'prior_document_id');  
$this->registerDimension('priorPageType', 'base.document', 'page_type', 'Prior Page Type', 'visit', 'The page type of the prior page.', 'prior_document_id');  
 
// traffic sources  
$this->registerDimension('referralPageUrl', 'base.referer', 'url', 'Referral Page URL', 'traffic sources', 'The url of the referring web page.');  
$this->registerDimension('referralPageTitle', 'base.referer', 'page_title', 'Referral Page Title', 'traffic sources', 'The title of the referring web page.');  
$this->registerDimension('referralSearchTerms', 'base.search_term_dim', 'terms', 'Search Terms', 'traffic sources', 'The referring search terms.', 'referring_search_term_id');  
$this->registerDimension('referralLinkText', 'base.referer', 'refering_anchortext', 'Referral Link Text', 'traffic sources', 'The text of the referring link.');  
$this->registerDimension('isSearchEngine', 'base.referer', 'is_searchengine', 'Search Engine', 'traffic sources', 'Is traffic source a search engine.');  
$this->registerDimension('referralWebSite', 'base.referer', 'site', 'Referral Web Site', 'traffic sources', 'The full domain of the referring web site.');  
 
// content  
$this->registerDimension('pageUrl', 'base.document', 'url', 'Page URL', 'content', 'The URL of the web page.', 'document_id');  
$this->registerDimension('pagePath', 'base.document', 'uri', 'Page Path', 'content', 'The path of the web page.', 'document_id');  
$this->registerDimension('pageTitle', 'base.document', 'page_title', 'Page Title', 'content', 'The title of the web page.', 'document_id');  
$this->registerDimension('pageType', 'base.document', 'page_type', 'Page Type', 'content', 'The page type of the web page.', 'document_id');  
 
// feeds  
$this->registerDimension('date', 'base.feed_request', 'yyyymmdd', 'Date', 'date', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('day', 'base.feed_request', 'day', 'Day', 'date', 'The day.', '', true);  
$this->registerDimension('month', 'base.feed_request', 'month', 'Month', 'date', 'The month.', '', true);  
$this->registerDimension('year', 'base.feed_request', 'year', 'Year', 'date', 'The year.', '', true);  
$this->registerDimension('dayofweek', 'base.feed_request', 'dayofweek', 'Day of Week', 'date', 'The day of the week.', '', true);  
$this->registerDimension('dayofyear', 'base.feed_request', 'dayofyear', 'Day of Year', 'date', 'The day of the year.', '', true);  
$this->registerDimension('weekofyear', 'base.feed_request', 'weekofyear', 'Week of Year', 'date', 'The week of the year.', '', true);  
$this->registerDimension('feedType', 'base.feed_request', 'feed_format', 'Feed Type', 'feed', 'The type or format of the feed.', '', true);  
$this->registerDimension('siteId', 'base.feed_request', 'site_id', 'Site ID', 'request', 'The ID of the the web site.', '', true);  
 
//clicks  
$this->registerDimension('date', 'base.click', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd');  
// IDs  
$this->registerDimension('visitorId', 'base.visitor', 'id', 'Visitor ID', 'visitor', 'The ID of the visitor.');  
$this->registerDimension('sessionId', 'base.session', 'id', 'Session ID', 'visit', 'The ID of the session/visit.');  
 
$this->registerDimension('daysToTransaction', 'base.commerce_transaction_fact', 'days_since_first_session', 'Days To Purchase', 'ecommerce', 'The number of days since the first visit and an e-commerce transaction.', '', true);  
$this->registerDimension('visitsToTransaction', 'base.commerce_transaction_fact', 'num_prior_sessions', 'Visits To Purchase', 'ecommerce', 'The number of visits prior to an e-commerce transaction.', '', true);  
 
// productName  
$this->registerDimension(  
'productName',  
'base.commerce_line_item_fact',  
'product_name',  
'Product Name',  
'ecommerce',  
'The name of the product purchased.',  
'',  
true  
);  
// productSku  
$this->registerDimension('productSku', 'base.commerce_line_item_fact', 'sku', 'Product SKU', 'ecommerce', 'The SKU code of the product purchased.', '', true);  
// productCategory  
$this->registerDimension('productCategory', 'base.commerce_line_item_fact', 'category', 'Product Category', 'ecommerce', 'The category of product purchased.', '', true);  
// transactionOriginator  
$this->registerDimension('transactionOriginator', 'base.commerce_transaction_fact', 'order_source', 'Originator', 'ecommerce', 'The store or location that originated the transaction.', '', true);  
// transactionId  
$this->registerDimension('transactionId', 'base.commerce_transaction_fact', 'order_id', 'Transaction ID', 'ecommerce', 'The id of the e-commerce transaction.', '', true);  
$this->registerDimension('transactionGateway', 'base.commerce_transaction_fact', 'gateway', 'Payment Gateway', 'ecommerce', 'The payment gateway or provider used in the e-commerce transaction.', '', true);  
// daysToTransaction  
$this->registerDimension('daysToTransaction', 'base.commerce_transaction_fact', 'days_since_first_session', "Days To Purchase', 'ecommerce', 'The number of days between the visitor's first visit and when transaction occurred.", '', true);  
// visitsToTransaction  
$this->registerDimension('visitsToTransaction', 'base.commerce_transaction_fact', 'num_prior_sessions', "Visits To Purchase', 'ecommerce', 'The number of visits before the transaction occurred.", '', true);  
$this->registerDimension('date', 'base.commerce_line_item_fact', 'yyyymmdd', 'Date', 'ecommerce', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('date', 'base.commerce_transaction_fact', 'yyyymmdd', 'Date', 'ecommerce', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('timestamp', 'base.commerce_transaction_fact', 'timestamp', 'Time', 'ecommerce', 'The timestamp of the transaction.', '', true);  
$this->registerDimension('siteId', 'base.commerce_line_item_fact', 'site_id', 'Site Id', 'ecommerce', 'The site ID.', '', true, 'site_id');  
$this->registerDimension('siteId', 'base.commerce_transaction_fact', 'site_id', 'Site Id', 'ecommerce', 'The site ID.', '', true, 'site_id');  
// dom clicks  
$this->registerDimension('siteId', 'base.click', 'site_id', 'Site Id', 'site', 'The site ID.', '', true, 'site_id');  
$this->registerDimension('date', 'base.click', 'yyyymmdd', 'Date', 'date', 'The date.', '', true, 'yyyymmdd');  
$this->registerDimension('domElementId', 'base.click', 'dom_element_id', 'Dom ID', 'dom', 'The id of the dom element.', '', true);  
$this->registerDimension('domElementName', 'base.click', 'dom_element_name', 'Dom Name', 'dom', 'The name of the dom element.', '', true);  
$this->registerDimension('domElementText', 'base.click', 'dom_element_text', 'Dom Text', 'dom', 'The text associated the dom element.', '', true);  
$this->registerDimension('domElementValue', 'base.click', 'dom_element_value', 'Dom Value', 'dom', 'The value of the dom element.', '', true);  
$this->registerDimension('domElementTag', 'base.click', 'dom_element_tag', 'Dom Tag', 'dom', 'The html tag of the dom element.', '', true);  
$this->registerDimension('domElementClass', 'base.click', 'dom_element_class', 'Dom Class', 'dom', 'The class of the dom element.', '', true);  
 
/**  
* Register CLI Commands  
*  
* The following lines register various command line interface (CLI) controller.  
*/  
$this->registerCliCommand('update', 'base.updatesApplyCli');  
$this->registerCliCommand('build', 'base.build');  
$this->registerCliCommand('flush-cache', 'base.flushCacheCli');  
$this->registerCliCommand('processEventQueue', 'base.processEventQueue');  
$this->registerCliCommand('install', 'base.installCli');  
$this->registerCliCommand('activate', 'base.moduleActivateCli');  
$this->registerCliCommand('deactivate', 'base.moduleDeactivateCli');  
$this->registerCliCommand('install-module', 'base.moduleInstallCli');  
 
/**  
* Register API methods  
*  
* The following lines register various API methods.  
*/  
$this->registerApiMethod('getResultSet',  
array($this, 'getResultSet'),  
array(  
'metrics',  
'dimensions',  
'siteId',  
'constraints',  
'sort',  
'resultsPerPage',  
'page',  
'offset',  
'period',  
'startDate',  
'endDate',  
'startTime',  
'endTime',  
'format'),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getDomstreams',  
array( $this, 'getDomstreams' ),  
array(  
'startDate',  
'endDate',  
'document_id',  
'siteId',  
'resultsPerPage',  
'page',  
'format' ),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getLatestVisits',  
array($this, 'getLatestVisits'),  
array( 'startDate', 'endDate', 'visitorId', 'siteId', 'resultsPerPage', 'page', 'format'),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getClickstream',  
array($this, 'getClickstream'),  
array( 'sessionId', 'resultsPerPage', 'page','format'),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getVisitDetail',  
array($this, 'getVisitDetail'),  
array( 'sessionId', 'format'),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getTransactionDetail',  
array($this, 'getTransactionDetail'),  
array( 'transactionId', 'format'),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getDomClicks',  
array($this, 'getDomClicks'),  
array(  
'pageUrl',  
'siteId',  
'startDate',  
'endDate',  
'document_id',  
'period',  
'resultsPerPage',  
'page',  
'format'  
),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getTransactions',  
array($this, 'getTransactions'),  
array(  
'siteId',  
'startDate',  
'endDate',  
'period',  
'sort',  
'resultsPerPage',  
'page',  
'format'  
),  
'',  
'view_reports'  
);  
 
$this->registerApiMethod('getDomstream',  
array($this, 'getDomstream'),  
array('domstream_guid'),  
'',  
'view_reports'  
);  
 
return parent::__construct();  
}  
 
/**  
* Registers Admin panels  
*  
*/  
function registerAdminPanels() {  
 
$this->addAdminPanel(array(  
'do' => 'base.optionsGeneral',  
'priviledge' => 'admin',  
'anchortext' => 'Main Configuration',  
'group' => 'General',  
'order' => 1)  
);  
 
$this->addAdminPanel(array(  
'do' => 'base.users',  
'priviledge' => 'admin',  
'anchortext' => 'User Management',  
'group' => 'General',  
'order' => 2)  
);  
 
 
 
$this->addAdminPanel(array(  
'do' => 'base.sites',  
'priviledge' => 'admin',  
'anchortext' => 'Tracked Sites',  
'group' => 'General',  
'order' => 3)  
);  
 
$this->addAdminPanel(array(  
'do' => 'base.optionsModules',  
'priviledge' => 'admin',  
'anchortext' => 'Modules',  
'group' => 'General',  
'order' => 3)  
);  
 
/*  
$this->addAdminPanel(array(  
'do' => 'base.optionsGoals',  
'priviledge' => 'admin',  
'anchortext' => 'Goal Settings',  
'group' => 'General',  
'order' => 3)  
);  
*/  
}  
 
function registerNavigation() {  
 
$this->addNavigationLink('Reports', '', 'base.reportDashboard', 'Dashboard', 1);  
$this->addNavigationLink('Reports', '', 'base.reportVisitors', 'Visitors', 3);  
 
$this->addNavigationLink('Reports', '', 'base.reportContent', 'Content', 4);  
 
$this->addNavigationLink('Reports', '', 'base.reportEcommerce', 'Ecommerce', 1);  
$this->addNavigationLink('Reports', 'Ecommerce', 'base.reportRevenue', 'Revenue', 2);  
$this->addNavigationLink('Reports', 'Ecommerce', 'base.reportTransactions', 'Transactions', 3);  
$this->addNavigationLink('Reports', 'Ecommerce', 'base.reportVisitsToPurchase', 'Visits To Purchase', 4);  
$this->addNavigationLink('Reports', 'Ecommerce', 'base.reportDaysToPurchase', 'Days To Purchase', 5);  
 
$this->addNavigationLink('Reports', 'Content', 'base.reportPages', 'Top Pages', 1);  
$this->addNavigationLink('Reports', 'Content', 'base.reportPageTypes', 'Page Types', 2);  
$this->addNavigationLink('Reports', 'Content', 'base.reportFeeds', 'Feeds', 7);  
$this->addNavigationLink('Reports', 'Content', 'base.reportEntryPages', 'Entry Pages', 3);  
$this->addNavigationLink('Reports', 'Content', 'base.reportExitPages', 'Exit Pages', 4);  
$this->addNavigationLink('Reports', 'Content', 'base.reportDomstreams', 'Domstreams', 5);  
$this->addNavigationLink('Reports', '', 'base.reportActionTracking', 'Action Tracking', 1);  
$this->addNavigationLink('Reports', 'Action Tracking', 'base.reportActionGroups', 'Action Groups', 2);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportGeolocation', 'Geo-location', 1);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportHosts', 'Domains', 2);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsLoyalty', 'Visitor Loyalty', 3);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsRecency', 'Visitor Recency', 4);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsAge', 'Visitor Age', 5);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportBrowsers', 'Browser Types', 6);  
$this->addNavigationLink('Reports', 'Visitors', 'base.reportOs', 'Operating Systems', 7);  
 
$this->addNavigationLink('Reports', '', 'base.reportTraffic', 'Traffic', 2);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportKeywords', 'Search Terms', 1);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportAnchortext', 'Inbound Link Text', 2);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportSearchEngines', 'Search Engines', 3);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportReferringSites', 'Referring Web Sites', 4);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportCampaigns', 'Campaigns', 5);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportAds', 'Ad Performance', 6);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportAdTypes', 'Ad Types', 7);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportCreativePerformance', 'Creative Performance', 8);  
$this->addNavigationLink('Reports', 'Traffic', 'base.reportAttributionHistory', 'Attribution History', 8);  
$this->addNavigationLink('Reports', '', 'base.reportGoals', 'Goals', 5);  
$this->addNavigationLink('Reports', 'Goals', 'base.reportGoalFunnel', 'Funnel Visualization', 1);  
 
}  
 
/**  
* Registers Event Handlers with queue queue  
*  
*/  
function _registerEventHandlers() {  
 
// User management  
$this->registerEventHandler(array('base.set_password', 'base.reset_password', 'base.new_user_account'), 'userHandlers');  
// Page Requests  
$this->registerEventHandler(array('base.page_request', 'base.first_page_request'), 'requestHandlers');  
// Sessions  
$this->registerEventHandler(array('base.page_request_logged', 'base.first_page_request_logged'), 'sessionHandlers');  
// Clicks  
$this->registerEventHandler('dom.click', 'clickHandlers');  
// Documents  
$this->registerEventHandler(array(  
'base.page_request_logged',  
'base.first_page_request_logged',  
'base.feed_request_logged') , 'documentHandlers');  
// Referers  
$this->registerEventHandler('base.new_session', 'refererHandlers');  
// Search Terms  
$this->registerEventHandler('base.new_session', 'searchTermHandlers');  
// Location  
$this->registerEventHandler( array( 'base.new_session', 'ecommerce.transaction' ), 'locationHandlers' );  
// operating systems  
$this->registerEventHandler('base.new_session', 'osHandlers');  
// source dimension  
$this->registerEventHandler('base.page_request', 'sourceHandlers');  
// campaign dimension  
$this->registerEventHandler('base.page_request', 'campaignHandlers');  
// ad dimension  
$this->registerEventHandler('base.page_request', 'adHandlers');  
// conversions  
$this->registerEventHandler(array(  
'base.new_session',  
'base.session_update',  
'ecommerce.transaction_persisted' ), 'conversionHandlers');  
// User Agent dimension  
$this->registerEventHandler(array('base.feed_request', 'base.new_session'), 'userAgentHandlers');  
// Hosts  
$this->registerEventHandler(array('base.feed_request', 'base.new_session'), 'hostHandlers');  
// Hosts  
$this->registerEventHandler('base.feed_request', 'feedRequestHandlers');  
// User management  
$this->registerEventHandler('base.new_session', 'visitorHandlers');  
// Nofifcation handlers  
$this->registerEventHandler('base.new_session', 'notifyHandlers');  
// install complete handler  
$this->registerEventHandler('install_complete', $this, 'installCompleteHandler');  
// domstreams  
$this->registerEventHandler('dom.stream', 'domstreamHandlers');  
// actions  
$this->registerEventHandler('track.action', 'actionHandler');  
// Commerce  
$this->registerEventHandler('ecommerce.transaction', 'commerceTransactionHandlers');  
$this->registerEventHandler('ecommerce.transaction_persisted', 'sessionCommerceSummaryHandlers');  
}  
 
function _registerEventProcessors() {  
 
$this->addEventProcessor('base.page_request', 'base.processRequest');  
$this->addEventProcessor('base.first_page_request', 'base.processFirstRequest');  
}  
 
function _registerEntities() {  
 
$this->registerEntity(array(  
'request',  
'session',  
'document',  
'feed_request',  
'click',  
'ua',  
'referer',  
'site',  
'visitor',  
'host',  
'exit',  
'os',  
'impression',  
'configuration',  
'user',  
'domstream',  
'action_fact',  
'search_term_dim',  
'ad_dim',  
'source_dim',  
'campaign_dim',  
'location_dim',  
'commerce_transaction_fact',  
'commerce_line_item_fact',  
'queue_item')  
);  
 
}  
 
function installCompleteHandler($event) {  
 
//owa_coreAPI::debug('test handler: '.print_r($event, true));  
}  
 
/**  
* Determine the operating system of the browser making the request  
*  
* @param string $user_agent  
* @return string  
*/  
function determineOperatingSystem($os = '', $ua) {  
 
if (empty($os)) {  
 
$matches = array(  
'Win.*NT 5\.0' =>'Windows 2000',  
'Win.*NT 5.1' =>'Windows XP',  
'Win.*(Vista|XP|2000|ME|NT|9.?)'=>'Windows $1',  
'Windows .*(3\.11|NT)' =>'Windows $1',  
'Win32' =>'Windows [prior to 1995]',  
'Linux 2\.(.?)\.' =>'Linux 2.$1.x',  
'Linux' =>'Linux [unknown version]',  
'FreeBSD .*-CURRENT$' =>'FreeBSD -CURRENT',  
'FreeBSD (.?)\.' =>'FreeBSD $1.x',  
'NetBSD 1\.(.?)\.' =>'NetBSD 1.$1.x',  
'(Free|Net|Open)BSD' =>'$1BSD [unknown]',  
'HP-UX B\.(10|11)\.' =>'HP-UX B.$1.x',  
'IRIX(64)? 6\.' =>'IRIX 6.x',  
'SunOS 4\.1' =>'SunOS 4.1.x',  
'SunOS 5\.([4-6])' =>'Solaris 2.$1.x',  
'SunOS 5\.([78])' =>'Solaris $1.x',  
'Mac_PowerPC' =>'Mac OS [PowerPC]',  
'Mac OS X' =>'Mac OS X',  
'X11' =>'UNIX [unknown]',  
'Unix' =>'UNIX [unknown]',  
'BeOS' =>'BeOS [unknown]',  
'QNX' =>'QNX [unknown]',  
);  
 
$uas = array_map(create_function('$a', 'return "#.*$a.*#";'), array_keys($matches));  
 
$os = preg_replace($uas, array_values($matches), $ua);  
}  
 
return $os;  
}  
 
/**  
* Get IP address from request  
*  
* @return string  
* @access private  
*/  
function setIp($ip) {  
 
$HTTP_X_FORWARDED_FOR = owa_coreAPI::getServerParam('HTTP_X_FORWARDED_FOR');  
$HTTP_CLIENT_IP = owa_coreAPI::getServerParam('HTTP_CLIENT_IP');  
 
// check for a non-unknown proxy address  
if (!empty($HTTP_X_FORWARDED_FOR) && strpos(strtolower($HTTP_X_FORWARDED_FOR), 'unknown') === false) {  
 
// if more than one use the last one  
if (strpos($HTTP_X_FORWARDED_FOR, ',') === false) {  
$ip = $HTTP_X_FORWARDED_FOR;  
} else {  
$ips = array_reverse(explode(",", $HTTP_X_FORWARDED_FOR));  
$ip = $ips[0];  
}  
 
// or else just use the remote address  
} else {  
 
if ($HTTP_CLIENT_IP) {  
$ip = $HTTP_CLIENT_IP;  
}  
 
}  
 
return $ip;  
 
}  
 
/**  
* Resolve hostname from IP address  
*  
* @access public  
*/  
function resolveHost($remote_host = '', $ip_address = '') {  
 
// See if host is already resolved  
if (empty($remote_host)) {  
 
// Do the host lookup  
if (owa_coreAPI::getSetting('base', 'resolve_hosts')) {  
$remote_host = @gethostbyaddr($ip_address);  
}  
 
}  
 
return $remote_host;  
}  
 
function getHostDomain($fullhost = '', $ip_address = '') {  
 
$host = '';  
 
if (!empty($fullhost)) {  
 
// Sometimes gethostbyaddr returns 'unknown' or the IP address if it can't resolve the host  
if ($fullhost === 'localhost') {  
$host = 'localhost';  
} elseif ($fullhost === 'unknown') {  
$host = $ip_address;  
} elseif ($fullhost != $ip_address) {  
 
$host_array = explode('.', $fullhost);  
 
// resort so top level domain is first in array  
$host_array = array_reverse($host_array);  
 
// array of tlds. this should probably be in the config array not here.  
$tlds = array('com', 'net', 'org', 'gov', 'mil', 'edu');  
 
if (in_array($host_array[0], $tlds)) {  
$host = $host_array[1].".".$host_array[0];  
} else {  
$host = $host_array[2].".".$host_array[1].".".$host_array[0];  
}  
 
}  
 
} else {  
$host = $ip_address;  
}  
 
return $host;  
}  
 
/**  
* Filter function Strips a URL of certain defined session or tracking params  
*  
* @return string  
*/  
function makeUrlCanonical($url, $site_id = '') {  
 
owa_coreAPI::debug('makeUrlCanonical using site_id: '.$site_id);  
//remove anchors  
$pos = strpos($url, '#');  
if($pos) {  
 
$url = substr($url, 0, $pos);  
}  
 
$filter_string = owa_coreAPI::getSiteSetting($site_id, 'query_string_filters');  
 
if ($filter_string) {  
$filters = str_replace(' ', '', $filter_string);  
$filters = explode(',', $filter_string);  
} else {  
$filters = array();  
}  
 
// merge global filters  
$global_filters = owa_coreAPI::getSetting('base', 'query_string_filters');  
if ($global_filters) {  
$global_filters = str_replace(' ', '', $global_filters);  
$global_filters = explode(',', $global_filters);  
$filters = array_merge($global_filters, $filters);  
}  
 
// OWA specific params to filter  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'source');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'medium');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'campaign');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'ad');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'ad_type');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'overlay');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').'state');  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').owa_coreAPI::getSetting('base', 'feed_subscription_param'));  
 
//print_r($filters);  
 
foreach ($filters as $filter => $value) {  
 
$url = preg_replace(  
'#\?' .  
$value .  
'=.*$|&' .  
$value .  
'=.*$|' .  
$value .  
'=.*&#msiU',  
'',  
$url  
);  
 
}  
 
 
//check for dangling '?'. this might occure if all params are stripped.  
 
// returns last character of string  
$test = substr($url, -1);  
 
// if dangling '?' is found clean up the url by removing it.  
if ($test == '?') {  
$url = substr($url, 0, -1);  
}  
 
//check and remove default page  
$default_page = owa_coreAPI::getSiteSetting($site_id, 'default_page');  
 
if ($default_page) {  
 
$default_length = strlen($default_page);  
 
if ($default_length) {  
 
//test for string  
$default_test = substr($url, 0 - $default_length, $default_length);  
if ($default_test === $default_page) {  
$url = substr($url, 0, 0 - $default_length);  
}  
}  
}  
 
// check and remove trailing slash  
if (substr($url, -1) === '/') {  
 
$url = substr($url, 0, -1);  
}  
 
return $url;  
 
}  
 
/**  
* Convienence method for generating a data result set  
*  
* Takes an array of values that contain necessary params to compute the results set.  
* Strings use ',' to seperate their values if needed. Array name/value pairs include:  
*  
* array(metrics => 'foo,bar'  
* , dimensions => 'dim1,dim2,dim3'  
* , period => 'today'  
* , startDate => 'yyyymmdd'  
* , endDate => 'yyyymmdd'  
* , startTime => timestamp  
* , endTime => timestamp  
* , constraints => 'con1=foo, con2=bar'  
* , page => 1  
* , offset => 0  
* , limit => 10  
* , sort => 'dim1,dim2'  
*  
*  
* @param $params array  
* @return paginatedResultSet obj  
* @link http://wiki.openwebanalytics.com/index.php?title=REST_API  
*/  
function getResultSet($metrics, $dimensions = '', $siteId = '', $constraints = '', $sort = '', $resultsPerPage = '', $page = '', $offset = '', $period = '', $startDate = '', $endDate = '', $startTime = '', $endTime = '', $format = '') {  
 
//print_r(func_get_args());  
// create the metric obj for the first metric  
require_once(OWA_BASE_CLASS_DIR.'resultSetManager.php');  
$rsm = new owa_resultSetManager;  
 
if ($metrics) {  
$rsm->metrics = $rsm->metricsStringToArray($metrics);  
} else {  
return false;  
}  
 
// set dimensions  
if ($dimensions) {  
$rsm->setDimensions($rsm->dimensionsStringToArray($dimensions));  
}  
 
// set period  
if (!$period) {  
$period = 'today';  
}  
 
$rsm->setTimePeriod($period,  
$startDate,  
$endDate,  
$startTime,  
$endTime);  
 
// set constraints  
if ($constraints) {  
 
$rsm->setConstraints($rsm->constraintsStringToArray($constraints));  
}  
 
//site_id  
if ($siteId) {  
$rsm->setConstraints($rsm->constraintsStringToArray('siteId=='.$siteId));  
}  
 
// set sort order  
if ($sort) {  
$rsm->setSorts($rsm->sortStringToArray($sort));  
}  
 
// set limit  
if ($resultsPerPage) {  
$rsm->setLimit($resultsPerPage);  
}  
 
// set limit (alt key)  
if ($resultsPerPage) {  
$rsm->setLimit($resultsPerPage);  
}  
 
// set page  
if ($page) {  
$rsm->setPage($page);  
}  
 
// set offset  
if ($offset) {  
$rsm->setOffset($offset);  
}  
 
// set format  
if ($format) {  
$rsm->setFormat($format);  
}  
 
// get results  
$rs = $rsm->getResults();  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
}  
 
function getDomstreams($start_date, $end_date, $document_id = '', $siteId = '', $resultsPerPage = 20, $page = 1, $format = '') {  
 
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_domstream');  
$db->selectColumn("domstream_guid, max(timestamp) as timestamp, page_url, duration");  
//$db->selectColumn('id');  
$db->selectColumn('document_id');  
$db->groupby('domstream_guid');  
//$db->selectColumn('events');  
$db->where('yyyymmdd', array('start' => $start_date, 'end' => $end_date), 'BETWEEN');  
if ($document_id) {  
$db->where('document_id', $document_id);  
}  
 
if ($siteId) {  
$db->where('site_id', $siteId);  
}  
 
$db->orderBy('timestamp', 'DESC');  
 
// pass limit to rs object if one exists  
$rs->setLimit($resultsPerPage);  
 
// pass page to rs object if one exists  
$rs->setPage($page);  
 
$results = $rs->generate($db);  
 
$rs->setLabels(array('id' => 'Domstream ID', 'page_url' => 'Page Url', 'duration' => 'Duration', 'timestamp' => 'Timestamp'));  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
}  
 
function getVisitDetail($sessionId, $format = '') {  
 
if ($sessionId) {  
 
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
$db = owa_coreAPI::dbSingleton();  
 
$s = owa_coreAPI::entityFactory('base.session');  
$h = owa_coreAPI::entityFactory('base.host');  
$ua = owa_coreAPI::entityFactory('base.ua');  
$d = owa_coreAPI::entityFactory('base.document');  
$v = owa_coreAPI::entityFactory('base.visitor');  
$r = owa_coreAPI::entityFactory('base.referer');  
 
$db->selectFrom($s->getTableName());  
 
$db->selectColumn($s->getColumnsSql('session_'));  
$db->selectColumn($h->getColumnsSql('host_'));  
$db->selectColumn($ua->getColumnsSql('ua_'));  
$db->selectColumn($d->getColumnsSql('document_'));  
$db->selectColumn($v->getColumnsSql('visitor_'));  
$db->selectColumn($r->getColumnsSql('referer_'));  
 
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $h->getTableName(), '', 'host_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $ua->getTableName(), '', 'ua_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $d->getTableName(), '', 'first_page_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $v->getTableName(), '', 'visitor_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $r->getTableName(), '', 'referer_id');  
 
 
$db->where($s->getTableName().'.id', $sessionId);  
 
 
$results = $rs->generate($db);  
$rs->resultsRows = $results;  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
}  
}  
 
function getLatestVisits($startDate = '', $endDate = '', $visitorId = '', $siteId = '', $resultsPerPage = 20, $page = 1, $format = '') {  
 
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
$db = owa_coreAPI::dbSingleton();  
 
$s = owa_coreAPI::entityFactory('base.session');  
$h = owa_coreAPI::entityFactory('base.host');  
$ua = owa_coreAPI::entityFactory('base.ua');  
$d = owa_coreAPI::entityFactory('base.document');  
$v = owa_coreAPI::entityFactory('base.visitor');  
$r = owa_coreAPI::entityFactory('base.referer');  
 
$db->selectFrom($s->getTableName());  
 
$db->selectColumn($s->getColumnsSql('session_'));  
$db->selectColumn($h->getColumnsSql('host_'));  
$db->selectColumn($ua->getColumnsSql('ua_'));  
$db->selectColumn($d->getColumnsSql('document_'));  
$db->selectColumn($v->getColumnsSql('visitor_'));  
$db->selectColumn($r->getColumnsSql('referer_'));  
 
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $h->getTableName(), '', 'host_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $ua->getTableName(), '', 'ua_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $d->getTableName(), '', 'first_page_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $v->getTableName(), '', 'visitor_id');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, $r->getTableName(), '', 'referer_id');  
 
$db->orderBy('session_timestamp','DESC');  
 
if ($visitorId) {  
$db->where('visitor_id', $visitorId);  
}  
 
if ($siteId) {  
$db->where('site_id', $siteId);  
}  
 
if ($startDate && $endDate) {  
$db->where('owa_session.yyyymmdd', array('start' => $startDate, 'end' => $endDate), 'BETWEEN');  
}  
 
$db->orderBy('timestamp', 'DESC');  
 
// pass limit to rs object if one exists  
$rs->setLimit($resultsPerPage);  
 
// pass page to rs object if one exists  
$rs->setPage($page);  
 
$results = $rs->generate($db);  
$rs->resultsRows = $results;  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
}  
 
function getClickstream($sessionId, $resultsPerPage = 100, $page = 1, $format = '') {  
 
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_request', 'request');  
$db->selectColumn("*");  
// pass constraints into where clause  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, 'owa_document', 'document', 'document_id', 'document.id');  
 
if ($sessionId) {  
$db->where('session_id', $sessionId);  
}  
 
$db->orderBy('timestamp','DESC');  
 
// pass limit to rs object if one exists  
$rs->setLimit($resultsPerPage);  
 
// pass page to rs object if one exists  
$rs->setPage($page);  
 
$results = $rs->generate($db);  
$rs->resultsRows = $results;  
//print_r($rs);  
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
 
return $rs;  
}  
}  
 
/**  
* Retrieves full detail of an ecommerce transaction  
*  
* @param $transactionId string the id of the transaction you want  
* @param $format string the format you want returned  
* @return  
*/  
function getTransactionDetail( $transactionId, $format = 'php' ) {  
 
$t = owa_coreAPI::entityFactory( 'base.commerce_transaction_fact' );  
$t->getbyColumn('order_id',$transactionId);  
$trans_detail = array();  
 
$id = $t->get( 'id' );  
if ( $id ) {  
$trans_detail = $t->_getProperties();  
// fetch line items  
$db = owa_coreAPI::dbSingleton();  
 
$db->selectFrom( 'owa_commerce_line_item_fact' );  
$db->selectColumn( '*' );  
$db->where( 'order_id', $transactionId );  
$lis = $db->getAllRows();  
$trans_detail['line_items'] = $lis;  
}  
 
return $trans_detail;  
}  
 
function attributeCampaign( $tracking_event ) {  
 
$mode = owa_coreAPI::getSetting('base', 'campaign_attribution_mode');  
// direct mode means that that we attribute the latest campaign touch  
// if the request originaled from the touching the campaign.  
if ( $mode === 'direct' ) {  
if ( $tracking_event->get( 'from_campaign' ) ) {  
$campaigns = array_reverse( $tracking_event->get( 'campaign_touches' ) );  
//$tracking_event->set( 'attributed_campaign', $campaigns[0] );  
return $campaigns[0];  
}  
// orginal mode means that we always attribute the request to the  
// first touch regardless of the medium/source that generated the request  
} elseif ( $mode === 'original' ) {  
$campaigns = $tracking_event->get( 'campaign_touches' );  
//$tracking_event->set( 'attributed_campaign', $campaigns[0] );  
return $campaigns[0];  
}  
}  
 
function getTransactions($siteId, $startDate, $endDate, $period, $sort = 'desc', $resultsPerPage = 25, $page = 1, $format = 'json') {  
 
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_commerce_transaction_fact');  
$db->selectColumn("*");  
$db->orderBy('timestamp', $sort);  
$db->where('site_id', $siteId);  
 
if ( $period ) {  
 
$p = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
$p->set($period);  
$startDate = $p->startDate->get('yyyymmdd');  
$endDate = $p->endDate->get('yyyymmdd');  
}  
 
if ($startDate && $endDate) {  
$db->where('yyyymmdd', array('start' => $startDate, 'end' => $endDate), 'BETWEEN');  
}  
 
// pass limit to rs object if one exists  
$rs->setLimit($resultsPerPage);  
 
// pass page to rs object if one exists  
$rs->setPage($page);  
 
$results = $rs->generate($db);  
//$rs->resultsRows = $results;  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
 
}  
 
function getDomClicks($pageUrl, $siteId, $startDate, $endDate, $document_id = '', $period = '', $resultsPerPage = 100, $page = 1, $format = 'jsonp') {  
 
// Fetch document object  
$d = owa_coreAPI::entityFactory('base.document');  
 
if ( ! $document_id ) {  
 
$eq = owa_coreAPI::getEventDispatch();  
$document_id = $d->generateId( $eq->filter('page_url', urldecode( $pageUrl ), $siteId ) ) ;  
}  
 
$d->getByColumn('id', $document_id);  
 
 
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_click');  
$db->selectColumn("click_x as x,  
click_y as y,  
page_width,  
page_height,  
dom_element_x,  
dom_element_y,  
position");  
 
 
$db->orderBy('click_y', 'ASC');  
$db->where('document_id', $document_id);  
$db->where('site_id', $siteId);  
 
 
if ( $period ) {  
 
$p = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
$p->set($period);  
$startDate = $p->startDate->get('yyyymmdd');  
$endDate = $p->endDate->get('yyyymmdd');  
}  
 
if ($startDate && $endDate) {  
$db->where('yyyymmdd', array('start' => $startDate, 'end' => $endDate), 'BETWEEN');  
}  
 
// pass limit to rs object if one exists  
$rs->setLimit($resultsPerPage);  
 
// pass page to rs object if one exists  
$rs->setPage($page);  
 
$results = $rs->generate($db);  
//$rs->resultsRows = $results;  
 
if ($format) {  
owa_lib::setContentTypeHeader($format);  
return $rs->formatResults($format);  
} else {  
return $rs;  
}  
}  
 
function getDomstream( $domstream_guid ) {  
 
if ( ! $domstream_guid ) {  
return;  
}  
// Fetch document object  
$d = owa_coreAPI::entityFactory('base.domstream');  
//$d->load($this->getParam('domstream_id'));  
//$json = new Services_JSON();  
//$d->set('events', $json->decode($d->get('events')));  
 
$db = owa_coreAPI::dbSingleton();  
$db->select('*');  
$db->from( $d->getTableName() );  
$db->where( 'domstream_guid', $domstream_guid );  
$db->orderBy('timestamp', 'ASC');  
$ret = $db->getAllRows();  
//print_r($ret);  
$combined = '';  
foreach ($ret as $row) {  
$combined = $this->mergeStreamEvents( $row['events'], $combined );  
}  
 
$row['events'] = json_decode($combined);  
 
$t = new owa_template;  
$t->set_template('json.php');  
//$json = new Services_JSON();  
// set  
 
// if not found look on the request scope.  
$callback = owa_coreAPI::getRequestParam('jsonpCallback');  
if ( ! $callback ) {  
 
$t->set('json', json_encode( $row ) );  
} else {  
$body = sprintf("%s(%s);", $callback, json_encode( $row ) );  
$t->set('json', $body);  
}  
return $t->fetch();  
}  
 
function mergeStreamEvents($new, $old = '') {  
 
if ( $old) {  
$old = json_decode($old);  
} else {  
$old = array();  
}  
owa_coreAPI::debug('old: '.print_r($old, true));  
$new = json_decode($new);  
owa_coreAPI::debug('new: '.print_r($new, true));  
//$combined = array_merge($old, $new);  
//array_splice($old, count($old), 0, $new);  
 
foreach ($new as $v) {  
$old[] = $v;  
}  
$combined = $old;  
owa_coreAPI::debug('combined: '.print_r($combined, true));  
owa_coreAPI::debug('combined count: '.count($combined));  
$combined = json_encode($combined);  
return $combined;  
 
}  
 
/*  
function eventProcessingDaemonJobs($jobs) {  
 
$source = owa_coreAPI::getSetting( 'base', 'event_queue_type' );  
$dest = owa_coreAPI::getSetting( 'base', 'event_secondary_queue_type' );  
 
// check event file  
$event_log_file = owa_coreAPI::getSetting( 'base', 'async_log_dir' ) . owa_coreAPI::getSetting( 'base', 'async_log_file' );  
$event_log_rotate_size = owa_coreAPI::getSetting( 'base', 'async_log_rotate_size' );  
if ( file_exists( $event_log_file ) && filesize( $event_log_file ) > $event_log_rotate_size ) {  
$file_cmd = array('cmd=processEventQueue');  
$file_cmd[] = 'source=file';  
 
if ( $dest ) {  
$file_cmd[] = 'destination='.$dest;  
}  
$jobs['processEventQueue'] = array('cmd' => $file_cmd, 'max_workers' => 3, 'interval' => 100);  
 
$queue_file_exists = true;  
}  
 
return $jobs;  
}  
*/  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* Module Activation Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_moduleActivateController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$module = $this->getParam('module');  
 
if ( $module ) {  
$ret = owa_coreAPI::installModule($module);  
}  
 
$data = array();  
 
$data['do'] = 'base.optionsModules';  
$data['view_method'] = 'redirect';  
$data['status_code'] = 2501;  
 
return $data;  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Module Activation Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_moduleActivateCliController extends owa_cliController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$module = $this->getParam('module');  
 
if ( $module ) {  
 
$ret = owa_coreAPI::activateModule($module);  
 
} else {  
owa_coreAPI::notice('No module argument was specified. Use module=xxx');  
}  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* Module Deactivation Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_moduleDeactivateController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
 
return parent::__construct($params);  
 
}  
 
function action() {  
 
$s = &owa_coreAPI::serviceSingleton();  
$m = $s->getModule($this->getParam('module'));  
$m->deactivate();  
$this->setRedirectAction('base.optionsModules');  
$this->setStatusCode(2502);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Module Deactivation Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_moduleDeactivateCliController extends owa_cliController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$module = $this->getParam('module');  
 
if ( $module ) {  
 
$ret = owa_coreAPI::deactivateModule($module);  
 
} else {  
owa_coreAPI::notice('No module argument was specified. Use module=xxx');  
}  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Module Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_moduleInstallCliController extends owa_cliController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$module = $this->getParam('module');  
 
if ( $module ) {  
 
$ret = owa_coreAPI::installModule($module);  
 
} else {  
owa_coreAPI::notice('No module argument was specified. Use module=xxx');  
}  
}  
 
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Notify New Session Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_notifyNewSessionController extends owa_controller {  
 
function __construct($params) {  
 
$this->priviledge_level = 'guest';  
return parent::__construct($params);  
}  
 
function action() {  
 
// Control logic  
 
$s = owa_coreAPI::entityFactory('base.site');  
 
$s->getByPk('site_id', $this->params['site_id']);  
 
$data['site'] = $s->_getProperties();  
 
$data['email_address']= $this->config['notice_email'];  
$data['session'] = $this->params;  
$data['subject'] = sprintf('OWA: New Visit to %s', $s->get('domain'));  
$data['view'] = 'base.notifyNewSession';  
$data['plainTextView'] = 'base.notifyNewSessionPlainText';  
$data['view_method'] = 'email-html';  
 
return $data;  
 
}  
 
 
}  
 
 
/**  
* New Session Notification View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_notifyNewSessionView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_email.tpl');  
$this->body->set_template('new_session_email.tpl');  
$this->body->set('site', $data['site']);  
$this->body->set('session', $data['session']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* New Session Notification View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_notifyNewSessionPlainTextView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('new_session_email_plain_text.tpl');  
$this->body->set('site', $data['site']);  
$this->body->set('session', $data['session']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Options View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsView extends owa_view {  
 
function __construct() {  
 
$this->default_subview = 'base.optionsGeneral';  
 
return parent::__construct();  
}  
 
function render($data) {  
 
//page title  
$this->t->set('page_title', 'OWA Options');  
 
// load body template  
$this->body->set_template('options.tpl');  
 
// fetch admin links from all modules  
// need api call here.  
$this->body->set('headline', 'OWA Settings');  
 
// get admin panels  
$api = &owa_coreAPI::singleton();  
$panels = $api->getAdminPanels();  
//print_r($panels);  
$this->body->set('panels', $panels);  
 
// Assign config data  
$this->body->set('config', $this->config);  
$this->setJs('jquery', 'base/js/includes/jquery/jquery-1.4.2.min.js', '1.4.2');  
$this->setJs("sprinf", "base/js/includes/jquery/jquery.sprintf.js", '', array('jquery'));  
$this->setJs("jquery-ui", "base/js/includes/jquery/jquery-ui-1.8.1.custom.min.js", '1.8.1', array('jquery'));  
$this->setJs("owa", "base/js/owa.js");  
$this->setCss('base/css/owa.admin.css');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Options Update Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsFlushCacheController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_settings');  
return parent::__construct($params);  
}  
 
function action() {  
 
$cache = &owa_coreAPI::cacheSingleton();  
$cache->flush();  
 
$this->e->notice("Cache Flushed");  
 
$data = array();  
$data['do'] = 'base.optionsGeneral';  
$data['view_method'] = 'redirect';  
//$data['configuration'] = $nbsettings;  
$data['status_code'] = 2500;  
 
return $data;  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_view.php');  
require_once(OWA_DIR.'owa_adminController.php');  
 
/**  
* Admin Settings/Options Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsGeneralController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->type = 'options';  
$this->setRequiredCapability('edit_settings');  
return;  
}  
 
function action() {  
 
$this->data['configuration'] = $this->c->fetch('base');  
 
// add data to container  
$this->data['view'] = 'base.options';  
$this->data['subview'] = 'base.optionsGeneral';  
$this->data['view_method'] = 'delegate';  
 
return $this->data;  
 
}  
 
}  
 
/**  
* Options View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsGeneralView extends owa_view {  
 
function render($data) {  
 
// load template  
$this->body->set_template('options_general.tpl');  
// fetch admin links from all modules  
$this->body->set('headline', 'General Configuration Options');  
 
//print_r($data['config']);  
// assign config data  
$this->body->set('config', $data['configuration']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_view.php');  
require_once(OWA_DIR.'owa_adminController.php');  
 
/**  
* Goals Edit Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_optionsGoalEditController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->type = 'options';  
$this->setRequiredCapability('edit_settings');  
$this->setNonceRequired();  
$goal = $this->getParam('goal');  
// check that goal number is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['goal_number']);  
$this->setValidation('goal_number', $v1);  
 
// check that goal status is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['goal_status']);  
$this->setValidation('goal_status', $v1);  
 
// check that goal status is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['goal_group']);  
$this->setValidation('goal_group', $v1);  
 
// check that goal type is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['goal_type']);  
$this->setValidation('goal_type', $v1);  
 
if ($goal['goal_type'] === 'url_destination') {  
// check that match_type is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['details']['match_type']);  
$this->setValidation('match_type', $v1);  
 
// check that goal_url is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($goal['details']['goal_url']);  
$this->setValidation('goal_url', $v1);  
}  
 
$steps = $goal['details']['funnel_steps'];  
 
if ($steps) {  
 
foreach ($steps as $num => $step) {  
 
if (!empty($step['name']) || !empty($step['url'])) {  
// check that step name is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($step['name']);  
$this->setValidation('step_name_'.$num, $v1);  
 
// check that step url is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($step['url']);  
$this->setValidation('step_url_'.$num, $v1);  
 
// check that step is_required is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($step['is_required']);  
//$this->setValidation('step_is_required_'.$num, $v1);  
}  
 
$check = owa_lib::array_values_assoc($step);  
if (!empty($check)) {  
$step['step_number'] = $num;  
$this->params['goal']['details']['funnel_steps'][$num] = $step;  
} else {  
// remove the array as it only contains empty values.  
// this can happen when the use adds a step but does not fill in any  
// values.  
unset( $this->params['goal']['details']['funnel_steps'][$num] );  
}  
}  
}  
}  
 
function action() {  
 
// setup goal manager  
$siteId = $this->get('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goal = $this->getParam('goal');  
//$all_goals = owa_coreAPI::getSiteSetting($site_id, 'goals');  
//$goal_groups = owa_coreAPI::getSiteSetting($site_id, 'goal_groups');  
$gm->saveGoal($goal['goal_number'], $goal);  
 
if ( $this->get( 'new_goal_group_name' ) ) {  
$gm->saveGoalGroupLabel($goal['goal_group'], $this->get( 'new_goal_group_name' ) );  
//$goal_groups[$goal['goal_group']] = $this->get( 'new_goal_group_name' );  
}  
 
owa_coreAPI::debug('New goals: '.print_r($gm->goals,true));  
$this->setStatusCode(2504);  
$this->set('siteId', $siteId);  
$this->setRedirectAction('base.optionsGoals');  
}  
 
function errorAction() {  
$goal = $this->getParam('goal');  
$this->setView('base.options');  
$this->setSubview('base.optionsGoalEntry');  
$this->set('error_code', 3311);  
$this->set('goal', $goal);  
$this->set('goal_number', $goal['goal_number']);  
$siteId = $this->get('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$this->set('goal_groups', $gm->getAllGoalGroupLabels() );  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_view.php');  
require_once(OWA_DIR.'owa_adminController.php');  
 
/**  
* Goals Entry Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_optionsGoalEntryController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->type = 'options';  
$this->setRequiredCapability('edit_settings');  
}  
 
function action() {  
 
$number = $this->getParam( 'goal_number' );  
$siteId = $this->get('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goal = $gm->getGoal( $number );  
$goal_groups = $gm->getAllGoalGroupLabels();  
$this->set( 'goal_groups', $goal_groups );  
$this->set( 'goal', $goal );  
$this->set('goal_number', $number);  
$this->set('siteId', $this->getParam( 'siteId' ) );  
$this->setView('base.options');  
$this->setSubView('base.optionsGoalEntry');  
 
}  
}  
 
/**  
* Goals Roster View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_optionsGoalEntryView extends owa_view {  
 
function render() {  
 
$this->body->set_template( 'options_goal_entry.php' );  
$this->body->set( 'headline', 'Edit Goal');  
$this->body->set( 'goal', $this->get( 'goal' ) );  
$this->body->set( 'goal_groups', $this->get( 'goal_groups' ) );  
$this->body->set( 'goal_number', $this->get( 'goal_number' ) );  
$this->body->set( 'siteId', $this->get( 'siteId' ) );  
$this->setJs('jquery', 'base/js/includes/jquery/jquery-1.4.2.min.js');  
$this->setJs('jqote', 'base/js/includes/jquery/jQote2/jquery.jqote2.min.js');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_view.php');  
require_once(OWA_DIR.'owa_adminController.php');  
 
/**  
* Goals Roster Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_optionsGoalsController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->type = 'options';  
$this->setRequiredCapability('edit_settings');  
}  
 
function action() {  
 
$siteId = $this->get('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goals = $gm->getAllGoals();  
$goal_groups = $gm->getAllGoalGroupLabels();  
$this->set('goals', $goals);  
$this->set('goal_groups', $goal_groups);  
$this->setView('base.options');  
$this->setSubView('base.optionsGoals');  
$this->set('siteId', $siteId);  
}  
}  
 
/**  
* Goals Roster View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_optionsGoalsView extends owa_view {  
 
function render($data) {  
 
// load template  
$this->body->set_template( 'options_goals.tpl' );  
// fetch admin links from all modules  
$this->body->set( 'headline', 'Conversion Goals');  
$this->body->set( 'goals', $this->get( 'goals' ) );  
$this->body->set( 'goal_groups', $this->get( 'goal_groups' ) );  
$this->body->set( 'siteId', $this->get( 'siteId' ) );  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
require_once(OWA_BASE_CLASSES_DIR.'owa_view.php');  
 
/**  
* Options Modules Roster Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsModulesController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_modules');  
return parent::__construct($params);  
}  
 
function action() {  
 
$path = OWA_BASE_CLASSES_DIR.'modules'.DIRECTORY_SEPARATOR;  
$dirs = array();  
 
if ($handle = opendir($path)):  
while (($file = readdir($handle)) !== false) {  
 
// test for '.' in dir name  
if (strpos($file, '.') === false):  
 
// test for whether file is a dir  
if (is_dir($path.$file)):  
 
$mod = owa_coreAPI::moduleClassFactory($file);  
$dirs[$file]['name'] = $mod->name;  
$dirs[$file]['display_name'] = $mod->display_name;  
$dirs[$file]['author'] = $mod->author;  
$dirs[$file]['group'] = $mod->group;  
$dirs[$file]['version'] = $mod->version;  
$dirs[$file]['description'] = $mod->description;  
$dirs[$file]['config_required'] = $mod->config_required;  
$dirs[$file]['current_schema_version'] = $mod->getSchemaVersion();  
$dirs[$file]['required_schema_version'] = $mod->getRequiredSchemaVersion();  
$dirs[$file]['schema_uptodate'] = $mod->isSchemaCurrent();  
//$dirs['stats'] = lstat($path.$file);  
 
endif;  
 
endif;  
}  
endif;  
 
closedir($handle);  
 
ksort($dirs);  
 
// remove base module so it can't be deactivated  
// unset($dirs['base']);  
 
$active_modules = owa_coreAPI::getActiveModules();  
 
foreach ($active_modules as $module) {  
 
if (!empty($dirs[$module])):  
$dirs[$module]['status'] = 'active';  
endif;  
}  
 
// add data to container  
$this->setView('base.options');  
$this->setSubview('base.optionsModules');  
$this->set('modules', $dirs);  
 
return;  
 
}  
 
}  
 
/**  
* Options Modules View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsModulesView extends owa_view {  
 
function __construct($params) {  
 
//set priviledge level  
$this->_setPriviledgeLevel('admin');  
//set page type  
$this->_setPageType('Administration Page');  
 
return parent::__construct();  
}  
 
function render($data) {  
 
//$this->c->get('base', 'modules'));  
 
// load template  
$this->body->set_template('options_modules.tpl');  
 
// fetch admin links from all modules  
$this->body->set('headline', 'Modules Administration');  
 
// Assign module data  
$this->body->set('modules', $this->get('modules'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* Options Reset Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsResetController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_settings');  
return parent::__construct($params);  
}  
 
function action() {  
 
$config = owa_coreAPI::configSingleton();  
 
$ret = $config->reset($this->get('module'));  
 
if ($ret) {  
 
$this->e->notice($this->getMsg(2503));  
$this->setStatusCode(2503);  
}  
 
$this->setRedirectAction('base.optionsGeneral');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* Base Options Update Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_optionsUpdateController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_settings');  
$this->setNonceRequired();  
return parent::__construct($params);  
 
}  
 
function action() {  
 
$c = owa_coreAPI::configSingleton();  
 
$config_values = $this->get('config');  
 
if (!empty($config_values)) {  
 
foreach ($config_values as $k => $v) {  
 
list($module, $name) = split("\.", $k);  
$c->persistSetting($module, $name, $v);  
}  
 
$c->save();  
owa_coreAPI::notice("Configuration changes saved to database.");  
$this->setStatusCode(2500);  
}  
 
$this->setRedirectAction('base.optionsGeneral');  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Overlay Launcher Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_overlayLauncherController extends owa_controller {  
 
function action() {  
 
// setup overlay cookiestate  
//owa_coreAPI::setState('overlay', '', urldecode($this->getParam('overlay_params')), 'cookie');  
 
 
 
// load entity for document id to get URL  
$d = owa_coreAPI::entityFactory('base.document');  
$d->load($this->getParam('document_id'));  
 
$url = trim( $d->get( 'url' ) );  
 
if ( strpos( $url, '#' ) ) {  
$parts = explode( '#', $url );  
$url = $parts[0];  
}  
 
$url = $url.'#owa_overlay.' . trim( base64_encode( urlencode($this->getParam( 'overlay_params' ) ) ), '\u0000' );  
 
// redirect browser  
$this->redirectBrowserToUrl($url);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
/**  
* Password Reset Request Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_passwordResetFormController extends owa_controller {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$this->setView('base.passwordResetForm');  
}  
}  
 
 
/**  
* Password Reset Request View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_passwordResetFormView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
$this->t->set_template('wrapper_public.tpl');  
$this->body->set_template('users_password_reset_request.tpl');  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
/**  
* Password Reset Request Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_passwordResetRequestController extends owa_controller {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$v1 = owa_coreAPI::validationFactory('entityExists');  
$v1->setConfig('entity', 'base.user');  
$v1->setConfig('column', 'email_address');  
$v1->setValues(trim($this->getParam('email_address')));  
$v1->setErrorMessage($this->getMsg(3010));  
$this->setValidation('email_address', $v1);  
}  
 
function action() {  
 
// Log password reset request to event queue  
$eq = &eventQueue::get_instance();  
 
$eq->log(array('email_address' => $this->getParam('email_address')), 'base.reset_password');  
 
// return view  
$this->setView('base.passwordResetForm');  
$email_address = trim($this->getParam('email_address'));  
$msg = $this->getMsg(2000, $email_address);  
$this->set('status_msg', $msg);  
 
return;  
}  
 
function errorAction() {  
 
$this->setView('base.passwordResetForm');  
$this->set('error_msg', $this->getMsg(2001, $this->getParam('email_address')));  
return;  
}  
 
 
 
}  
 
 
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Pixel View  
*  
* Used to return a transparent 1x1 pixel image to the browser to satisfy a request for img source  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_pixelView extends owa_view {  
 
function render($data) {  
 
// Set Page title  
$this->t->set_template('wrapper_blank.tpl');  
 
// load body template  
$this->body->set_template('pixel.tpl');  
 
$this->body->set('img', sprintf(  
'%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%',  
71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59  
));  
 
 
header('Content-type: image/gif', true);  
 
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'ini_db.php');  
 
/**  
* Generic Event Processor Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_processEventController extends owa_controller {  
 
var $event;  
var $eq;  
 
function __construct($params) {  
 
if (array_key_exists('event', $params) && !empty($params['event'])) {  
 
$this->event = $params['event'];  
 
} else {  
owa_coreAPI::debug("No event object was passed to controller.");  
$this->event = owa_coreAPI::supportClassFactory('base', 'event');  
}  
 
$this->eq = owa_coreAPI::getEventDispatch();  
 
return parent::__construct($params);  
 
}  
 
/**  
* Main Control Logic  
*  
* @return unknown  
*/  
function action() {  
 
return;  
 
}  
 
/**  
* Must be called before all other event property setting functions  
*/  
function pre() {  
 
// Set all time related properties  
$this->event->setTime();  
 
// set repeat visitor type flag visitor is not new.  
if ( ! $this->event->get( 'is_new_visitor' ) ) {  
$this->event->set( 'is_repeat_visitor', true );  
} else {  
// properly cast this to a bool.  
$this->event->set( 'is_new_visitor', true );  
}  
 
//set user agent  
if (!$this->event->get('HTTP_USER_AGENT')) {  
$this->event->set('HTTP_USER_AGENT', owa_coreAPI::getServerParam('HTTP_USER_AGENT'));  
}  
 
$this->event->set( 'HTTP_USER_AGENT', $this->eq->filter( 'user_agent', $this->event->get( 'HTTP_USER_AGENT' ) ) );  
//set user agent id  
$this->event->set( 'ua_id', owa_lib::setStringGuid( $this->event->get( 'HTTP_USER_AGENT' ) ) );  
 
// set referer  
// needed in case javascript logger sets the referer variable but is blank  
if ($this->event->get('referer')) {  
//TODO: STANDARDIZE NAME to avoid doing this map  
$referer = $this->event->get('referer');  
} else {  
owa_coreAPI::debug('ref: '.owa_coreAPI::getServerParam('HTTP_REFERER'));  
$referer = owa_coreAPI::getServerParam('HTTP_REFERER');  
}  
 
$this->event->set('HTTP_REFERER', $this->eq->filter('http_referer', $referer));  
 
// set host  
if (!$this->event->get('HTTP_HOST')) {  
$this->event->set('HTTP_HOST', owa_coreAPI::getServerParam('HTTP_HOST'));  
}  
 
// set language  
if (!$this->event->get( 'language' ) ) {  
$this->event->set( 'language', $this->eq->filter('language', substr(owa_coreAPI::getServerParam( 'HTTP_ACCEPT_LANGUAGE' ),0,5 ) ) );  
}  
 
$this->event->set('HTTP_HOST', $this->eq->filter('http_host', $this->event->get('HTTP_HOST')));  
 
// set page type to unknown if not already set by caller  
if (!$this->event->get('page_type')) {  
$this->event->set('page_type', '(not set)');  
}  
 
$this->event->set('page_type', $this->eq->filter('page_type', $this->event->get('page_type')));  
 
// Set the page url or else construct it from environmental vars  
if (!$this->event->get('page_url')) {  
$this->event->set('page_url', owa_lib::get_current_url());  
}  
 
$this->event->set( 'page_url', $this->eq->filter( 'page_url', $this->event->get( 'page_url' ), $this->event->get( 'site_id' ) ) );  
// set document/page id  
$this->event->set( 'document_id', owa_lib::setStringGuid( $this->event->get( 'page_url' ) ) );  
// needed?  
$this->event->set('inbound_page_url', $this->event->get('page_url'));  
 
// Page title  
if ( $this->event->get( 'page_title' ) ) {  
$page_title = owa_lib::utf8Encode( trim( $this->event->get( 'page_title' ) ) );  
} else {  
$page_title = '(not set)';  
}  
 
$this->event->set('page_title', $this->eq->filter( 'page_title', $page_title ) );  
 
$page_parse = parse_url($this->event->get('page_url'));  
 
if (!array_key_exists('path', $page_parse) || empty($page_parse['path'])) {  
$page_parse['path'] = '/';  
}  
 
if (!$this->event->get('page_uri')) {  
 
if (array_key_exists('query', $page_parse) || !empty($page_parse['query'])) {  
$this->event->set('page_uri', $this->eq->filter('page_uri', sprintf('%s?%s', $page_parse['path'], $page_parse['query'])));  
} else {  
$this->event->set('page_uri', $this->eq->filter('page_uri', $page_parse['path']));  
}  
 
}  
 
// set internal referer  
if ($this->event->get('HTTP_REFERER')) {  
 
$referer_parse = parse_url($this->event->get('HTTP_REFERER'));  
 
if ($referer_parse['host'] === $page_parse['host']) {  
$this->event->set('prior_page', $this->eq->filter('prior_page', $this->event->get('HTTP_REFERER'), $this->event->get( 'site_id' ) ) );  
} else {  
 
$this->event->set('external_referer', true);  
$this->event->set('referer_id', owa_lib::setStringGuid($this->event->get('HTTP_REFERER' ) ) );  
 
if ( ! $this->event->get( 'search_terms' ) ) {  
// set query terms  
$qt = $this->extractSearchTerms($this->event->get('HTTP_REFERER'));  
 
if ($qt) {  
$this->event->set('search_terms', trim( strtolower( $qt ) ) );  
}  
}  
}  
}  
 
// set referring search term id  
if ($this->event->get( 'search_terms' ) ) {  
$this->event->set('referring_search_term_id', owa_lib::setStringGuid( trim( strtolower( $this->event->get('search_terms') ) ) ) );  
}  
 
// Filter the target url of clicks  
if ($this->event->get('target_url')) {  
$this->event->set('target_url', $this->eq->filter('target_url', $this->event->get('target_url'), $this->event->get( 'site_id' ) ) );  
}  
 
// Set Ip Address  
if (!$this->event->get('ip_address')) {  
$this->event->set('ip_address', owa_coreAPI::getServerParam('REMOTE_ADDR'));  
}  
 
$this->event->set('ip_address', $this->eq->filter('ip_address', $this->event->get('ip_address')));  
 
// Set host related properties  
if (!$this->event->get('REMOTE_HOST')) {  
$this->event->set('REMOTE_HOST', owa_coreAPI::getServerParam('REMOTE_HOST'));  
}  
// host properties  
$this->event->set( 'full_host', $this->eq->filter( 'full_host',  
$this->event->get( 'REMOTE_HOST' ),  
$this->event->get( 'ip_address' ) ) );  
 
$this->event->set( 'host', $this->eq->filter( 'host', $this->event->get( 'full_host' ), $this->event->get( 'ip_address' ) ) );  
// Generate host_id  
$this->event->set( 'host_id', owa_lib::setStringGuid( $this->event->get( 'full_host' ) ) );  
 
// Browser related properties  
$service = owa_coreAPI::serviceSingleton();  
$bcap = $service->getBrowscap();  
 
// Assume browser untill told otherwise  
$this->event->set('is_browser',true);  
 
$this->event->set('browser_type', $this->eq->filter('browser_type', $bcap->get('Browser')));  
 
if ($bcap->get('Version')) {  
$this->event->set('browser', $this->eq->filter('browser', $bcap->get('Browser') . ' ' . $bcap->get('Version')));  
} else {  
$this->event->set('browser', $this->eq->filter('browser', $bcap->get('Browser')));  
}  
 
// Set Operating System  
$this->event->set( 'os', $this->eq->filter( 'operating_system', $bcap->get( 'Platform' ), $this->event->get( 'HTTP_USER_AGENT' ) ) );  
$this->event->set( 'os_id', owa_lib::setStringGuid( $this->event->get( 'os' ) ) );  
 
//Check for what kind of page request this is  
if ($bcap->get('Crawler')) {  
$this->event->set('is_robot', true);  
$this->event->set('is_browser', false);  
}  
 
// feed request properties  
$et = $this->event->getEventType();  
if ($et === 'base.feed_request') {  
 
// Feed subscription tracking code  
if (!$this->event->get('feed_subscription_id')) {  
$this->event->set('feed_subscription_id', $this->getParam(owa_coreAPI::getSetting('base', 'feed_subscription_param')));  
}  
 
// needed??  
$this->event->set('feed_reader_guid', $this->event->setEnvGUID());  
// set feedreader flag to true, browser flag to false  
$this->event->set('is_feedreader', true);  
$this->event->set('is_browser', false);  
}  
 
// record and filter visitor personally identifiable info (PII)  
if (owa_coreAPI::getSetting('base', 'log_visitor_pii')) {  
 
$cu = owa_coreAPI::getCurrentUser();  
 
// set user name  
$this->event->set('user_name', $this->eq->filter('user_name', $cu->user->get('user_id')));  
 
// set email_address  
if ($this->event->get('email_address')) {  
$email_adress = $this->event->get('email_address');  
} else {  
$email_address = $cu->user->get('email_address');  
}  
 
$this->event->set('user_email', $this->eq->filter('user_email', $email_address));  
} else {  
// remove ip address from event  
$this->event->set('ip_address', '(not set)');  
}  
 
// calc days since first session  
$this->setDaysSinceFirstSession();  
 
if ( $this->event->get('is_new_session') ) {  
//mark entry page flag on current request  
$this->event->set( 'is_entry_page', true );  
 
// mark event type as first_page_request. Necessary?????  
//$this->event->setEventType('base.first_page_request');  
 
// if this is not the first sessio nthen calc days sisne last session  
if ($this->event->get('last_req')) {  
$this->event->set('days_since_prior_session', round(($this->event->get('timestamp') - $this->event->get('last_req'))/(3600*24)));  
}  
 
if ( ! $this->event->get('medium') ) {  
$this->setMedium();  
}  
 
if ( ! $this->event->get('source') ) {  
$this->setSource();  
}  
 
}  
 
if ( $this->event->get( 'source' ) ) {  
$this->event->set( 'source_id', owa_lib::setStringGuid( trim( strtolower( $this->event->get( 'source' ) ) ) ) );  
}  
 
if ( $this->event->get( 'campaign' ) ) {  
$this->event->set( 'campaign_id', owa_lib::setStringGuid( trim( strtolower( $this->event->get( 'campaign' ) ) ) ) );  
}  
 
if ( $this->event->get( 'ad' ) ) {  
$this->event->set( 'ad_id', owa_lib::setStringGuid( trim( strtolower( $this->event->get( 'ad' ) ) ) ) );  
}  
}  
 
function post() {  
 
return $this->addToEventQueue();  
 
}  
 
/**  
* Log request properties of the first hit from a new visitor to a special cookie.  
*  
* This is used to determine if the request is made by an actual browser instead  
* of a robot with spoofed or unknown user agent.  
*  
* @access public  
*/  
function log_first_hit() {  
 
$state_name = owa_coreAPI::getSetting('base', 'first_hit_param');  
$this->event->set('event_type', 'base.first_page_request');  
return owa_coreAPI::setState($state_name, '', $this->event->getProperties(), 'cookie', true);  
}  
 
function addToEventQueue() {  
 
if (!$this->event->get('do_not_log')) {  
// pass event to handlers but filter it first  
$this->eq->asyncNotify($this->eq->filter('post_processed_tracking_event', $this->event));  
return owa_coreAPI::debug('Logged '.$this->event->getEventType().' to event queue with properties: '.print_r($this->event->getProperties(), true));  
} else {  
owa_coreAPI::debug("Not logging event due to 'do not log' flag being set.");  
}  
 
}  
 
/**  
* Parses query terms from referer  
*  
* @param string $referer  
* @return string  
* @access private  
*/  
function extractSearchTerms($referer) {  
 
/* Look for query_terms */  
$db = new ini_db(owa_coreAPI::getSetting('base', 'query_strings.ini'));  
 
$match = $db->match($referer);  
 
if (!empty($match[1])) {  
 
return trim(strtolower(urldecode($match[1])));  
 
}  
}  
 
// if no campaign attribution look for standard medium/source:  
// organic-search, referral, direct  
function setMedium() {  
 
// if there is an external referer  
if ( $this->event->get( 'external_referer' ) ) {  
 
// see if its from a search engine  
if ( $this->event->get( 'search_terms' ) ) {  
$medium = 'organic-search';  
} else {  
// assume its a plain old referral  
$medium = 'referral';  
}  
} else {  
// set as direct  
$medium = 'direct';  
}  
 
$this->event->set( 'medium', $medium );  
}  
 
function setSource() {  
 
$ref = $this->event->get( 'external_referer' );  
 
if ( $ref ) {  
$source = $this->getDomainFromUrl( $ref );  
} else {  
$source = '(none)';  
}  
 
$this->event->set( 'source', $source);  
}  
 
function getDomainFromUrl($url, $strip_www = true) {  
 
$split_url = preg_split('/\/+/', $url);  
$domain = $split_url[1];  
if ($strip_www === true) {  
$domain_parts = explode('.', $domain);  
$fp = $domain_parts[0];  
if ($fp === 'www') {  
return substring($domain, 4);  
} else {  
return $domain;  
}  
 
} else {  
return $domain;  
}  
}  
 
function setDaysSinceFirstSession() {  
 
$fsts = $this->event->get( 'fsts' );  
if ( $fsts ) {  
$this->event->set('days_since_first_session', round(($this->event->get('timestamp') - $fsts)/(3600*24)));  
} else {  
// this means that first session timestamp was not set in the cookie even though it's not a new user...so we set it.  
// This can happen with users prior to 1.3.0. when this value was introduced into the cookie.  
$this->event->set('days_since_first_session', 0);  
}  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'cliController.php');  
 
/**  
* Entity Install Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_processEventQueueController extends owa_cliController {  
 
function __construct($params) {  
 
$this->setRequiredCapability( 'edit_modules' );  
return parent::__construct( $params );  
}  
 
function action() {  
 
if ( $this->getParam( 'source' ) ) {  
$input_queue_type = $this->getParam( 'source' );  
} else {  
$input_queue_type = owa_coreAPI::getSetting( 'base', 'event_queue_type' );  
}  
 
$processing_queue_type = $this->getParam( 'destination' );  
 
if ( ! $processing_queue_type ) {  
 
$processing_queue_type = owa_coreAPI::getSetting( 'base', 'event_secondary_queue_type' );  
}  
 
// switch event queue setting in case a new events should be sent to a different type of queue.  
// this is handy for when processing from a file queue to a database queue  
if ( $processing_queue_type ) {  
owa_coreAPI::setSetting( 'base', 'event_queue_type', $processing_queue_type );  
owa_coreAPI::debug( "Setting event queue type to $processing_queue_type for processing." );  
}  
 
$d = owa_coreAPI::getEventDispatch();  
owa_coreAPI::debug( "Loading $input_queue_type event queue." );  
$q = $d->getAsyncEventQueue( $input_queue_type );  
 
$ret = $q->processQueue();  
 
// go ahead and process the secondary event queue  
if ( $ret && $processing_queue_type ) {  
$destq = $d->getAsyncEventQueue( $processing_queue_type );  
$destq->processQueue();  
}  
}  
}  
 
?>  
 
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_MODULE_DIR.'processEvent.php');  
 
/**  
* Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_processFirstRequestController extends owa_processEventController {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function pre() {  
 
return false;  
}  
 
function action() {  
 
$fh_state_name = owa_coreAPI::getSetting('base', 'first_hit_param');  
//print_r($fh_state_name);  
$fh = owa_coreAPI::getStateParam($fh_state_name);  
owa_coreAPI::debug('cookiename: '.$fh_state_name);  
//owa_coreAPI::debug(print_r($_COOKIE, true));  
if (!empty($fh)) {  
 
$this->event->replaceProperties($fh);  
$this->event->setEventType('base.first_page_request');  
//owa_coreAPI::debug(print_r($this->event, true));  
// Delete first_hit Cookie  
owa_coreAPI::clearState($fh_state_name);  
 
}  
 
$this->setView('base.pixel');  
$this->setViewMethod('image');  
}  
}  
 
?>  
<?php  
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_MODULE_DIR.'processEvent.php');  
 
/**  
* Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_processRequestController extends owa_processEventController {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
// Control logic  
 
// Do not log if the first_hit cookie is still present.  
$fh_state_name = owa_coreAPI::getSetting('base', 'first_hit_param');  
$fh = owa_coreAPI::getStateParam($fh_state_name);  
 
if (!empty($fh)) {  
$this->e->debug('Clearing left over first first hit cookie.');  
owa_coreAPI::clearState($fh_state_name);  
$this->e->debug('Left over first first hit cookie found...aborting request as likely a robot.');  
$this->event->set('do_not_log', true);  
return;  
}  
 
// set variety of new session properties.  
if ($this->event->get('is_new_session')) {  
 
}  
}  
 
function post() {  
 
if ( owa_coreAPI::getSetting('base', 'delay_first_hit') ) {  
 
// If not, then make sure that there is an inbound visitor_id  
if ( ! $this->event->get( 'visitor_id' ) ) {  
// Log request properties to a cookie for processing by a second request and return  
owa_coreAPI::debug('Logging this request to first hit cookie.');  
return $this->log_first_hit();  
}  
}  
 
owa_coreAPI::debug('Logging '.$this->event->getEventType().' to event queue...');  
 
return $this->addToEventQueue();  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportView extends owa_view {  
 
function render($data) {  
 
// Set Page title  
$this->t->set('page_title', $this->get('title'));  
 
// Set Page headline  
$this->body->set('title', $this->get('title'));  
$this->body->set('titleSuffix', $this->get('titleSuffix'));  
 
// Report Period Filters  
$pl = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
$this->body->set('reporting_periods', $pl->getPeriodLabels());  
 
// Set reporting period  
$this->setPeriod($this->data['period']);  
$this->subview->body->set('is_default_period', $this->get('is_default_period'));  
 
//create the report control params array  
$this->report_params = $this->data['params'];  
unset($this->report_params['p']);  
unset($this->report_params['u']);  
unset($this->report_params['v']);  
 
// unset per site session cookies but not site_id param  
foreach ($this->report_params as $k => $v) {  
 
// remove site specific session values  
if (substr($k, 0, 3) == 'ss_'):  
unset($this->report_params[$k]);  
endif;  
 
// remove left over first hit session value if found.  
if (substr($k, 0, 10) == 'first_hit_'):  
unset($this->report_params[$k]);  
endif;  
 
}  
 
unset($this->report_params['guid']);  
unset($this->report_params['caller']);  
 
$this->body->set('params', $this->report_params);  
$this->subview->body->set('params', $this->report_params);  
$this->_setLinkState();  
 
// set site filter list  
$this->body->set('sites', $this->get('sites') );  
 
$this->body->set('dom_id', $this->data['dom_id']);  
// add if here  
$this->subview->body->set('dom_id', $this->data['dom_id']);  
$this->body->set('do', $this->data['do']);  
 
// Set navigation  
$this->body->set('top_level_report_nav', $this->get('top_level_report_nav'));  
 
// load body template  
$this->body->set_template('report.tpl');  
 
// set Js libs to be loaded  
$this->setJs('jquery', 'base/js/includes/jquery/jquery-1.4.2.min.js', '1.4.2');  
$this->setJs("sprintf", "base/js/includes/jquery/jquery.sprintf.js", '', array('jquery'));  
$this->setJs("jquery-ui", "base/js/includes/jquery/jquery-ui-1.8.1.custom.min.js", '1.8.1', array('jquery'));  
$this->setJs("sparkline", "base/js/includes/jquery/jquery.sparkline.min.js", '', array('jquery'));  
$this->setJs('jqgrid','base/js/includes/jquery/jquery.jqGrid.min.js');  
$this->setJs('excanvas','base/js/includes/excanvas.compiled.js', '', '', true);  
$this->setJs('flot','base/js/includes/jquery/flot/jquery.flot.min.js');  
$this->setJs('flot-pie','base/js/includes/jquery/flot/jquery.flot.pie.js');  
$this->setJs('jqote','base/js/includes/jquery/jQote2/jquery.jqote2.min.js');  
$this->setJs("owa", "base/js/owa.js");  
$this->setJs("owa.report", 'base/js/owa.report.js', '', array('owa', 'jquery'));  
//$this->setJs("owa.dataGrid", "base/js/owa.dataGrid.js", '', array('owa', 'jquery', 'jquery-ui'));  
$this->setJs("owa.resultSetExplorer", "base/js/owa.resultSetExplorer.js", '', array('owa', 'jquery', 'jquery-ui'));  
$this->setJs("json2", "base/js/includes/json2.js");  
$this->setJs("owa.sparkline", "base/js/owa.sparkline.js", '', array('owa', 'jquery', 'sparkline'));  
 
// css libs to be loaded  
$this->setCss('base/css/smoothness/jquery-ui-1.8.1.custom.css');  
$this->setCss("base/css/owa.report.css");  
$this->setCss('base/css/ui.jqgrid.css');  
}  
 
/**  
* Set report period  
*  
* @access public  
* @param string $period  
*/  
function setPeriod($period) {  
 
// set in various templates and params  
$this->data['params']['period'] = $period->get();  
$this->body->set('period', $period->get());  
$this->body->set('period_obj', $period);  
$this->subview->body->set('period_obj', $period);  
$this->subview->body->set('period', $period->get());  
// set period label  
$period_label = $period->getLabel();  
$this->body->set('period_label', $period_label);  
$this->subview->body->set('period_label', $period_label);  
}  
 
/**  
* Applies calling params  
*  
* @access private  
* @param array $properties  
*/  
function _setParams($params = null) {  
 
if(!empty($params)) {  
foreach ($params as $key => $value) {  
if(!empty($value)) {  
$this->params[$key] = $value;  
}  
}  
}  
}  
 
function post() {  
 
$this->setCss("base/css/owa.admin.css");  
}  
}  
 
/**  
* Dimension Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDimensionView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
$this->body->set('tabs', $this->get('tabs') );  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('gridFormatters', $this->get('gridFormatters'));  
$this->body->set('excludeColumns', $this->get('excludeColumns'));  
$this->body->set_template('report_dimensionalTrend.php');  
}  
}  
 
/**  
* Dimension Detail Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDimensionDetailView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
$this->body->set('tabs', $this->get('tabs') );  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimension', $this->get('dimension'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('dimension_properties', $this->get('dimension_properties'));  
$this->body->set('dimension_template', $this->get('dimension_template'));  
$this->body->set('excludeColumns', $this->get('excludeColumns'));  
$this->body->set_template('report_dimensionDetail.php');  
}  
}  
 
/**  
* Simple Dimensional Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportSimpleDimensionalView extends owa_view {  
 
function render() {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('gridFormatters', $this->get('gridFormatters'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('excludeColumns', $this->get('excludeColumns'));  
$this->body->set_template('report_dimensionDetailNoTabs.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Action Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportActionDetailController extends owa_reportController {  
 
function action() {  
 
$actionName = $this->getParam('actionName');  
$actionGroup = $this->getParam('actionGroup');  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Action Detail: ', $actionGroup.': '.$actionName);  
$this->set('metrics', 'actions,actionsValue');  
$this->set('dimensions', 'actionLabel');  
$this->set('sort', 'actions-');  
$this->set('trendChartMetric', 'actions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.actions.formatted_value *> actions of this type.');  
$this->set('constraints', 'actionName=='.urlencode($actionName).',actionGroup=='.urlencode($actionGroup));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Browser Type Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportActionGroupController extends owa_reportController {  
 
function action() {  
 
$actionGroup = $this->getParam('actionGroup');  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Action Group: ', $actionGroup);  
$this->set('metrics', 'actions,uniqueActions,actionsValue');  
$this->set('dimensions', 'actionGroup,actionName');  
$this->set('sort', 'actions-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array(  
'linkColumn' => 'actionName',  
'template' => array(  
'do' => 'base.reportActionDetail',  
'actionName' => '%s',  
'actionGroup' => '%s'),  
'valueColumns' => array('actionName', 'actionGroup')));  
 
$this->set('trendChartMetric', 'actions');  
$this->set('constraints', 'actionGroup=='.urlencode($actionGroup));  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.actions.formatted_value *> actions for this action group.');  
$this->set('excludeColumns', "'actionGroup'");  
//$this->set('gridTitle', 'Top Page Types');  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Action Groups Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportActionGroupsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Action Groups');  
$this->set('metrics', 'actions,uniqueActions,actionsValue');  
$this->set('dimensions', 'actionGroup');  
$this->set('sort', 'actions-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array('linkColumn' => 'actionGroup',  
'template' => array('do' => 'base.reportActionGroup', 'actionGroup' => '%s'),  
'valueColumns' => 'actionGroup'));  
$this->set('trendChartMetric', 'actions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.actions.formatted_value *> actions for all action groups.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Action Tracking Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportActionTrackingController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportActionTracking');  
$this->setTitle('Actions');  
$this->set('metrics', 'actions,uniqueActions,actionsValue');  
//$this->set('dimensions', 'pageTitle,pageUrl');  
$this->set('sort', 'actions');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array('linkColumn' => 'pageTitle',  
'template' => array('do' => 'base.reportDocument', 'pageUrl' => '%s'),  
'valueColumns' => 'pageUrl'));  
$this->set('trendChartMetric', 'actions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.actions.formatted_value *> actions performed on all pages.');  
 
}  
}  
 
/**  
* Action Tracking Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportActionTrackingView extends owa_view {  
 
function render() {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('hideGrid', true);  
$this->body->set_template('report_actionTracking.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Ad Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAdDetailController extends owa_reportController {  
 
function action() {  
 
$dim_value = strtolower($this->getParam('ad'));  
$this->setTitle('Ad: ', $dim_value);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('constraints', 'ad=='.urlencode($dim_value));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this ad.');  
$this->setSubview('base.reportDimensionDetail');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Ad Type Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAdTypeDetailController extends owa_reportController {  
 
function action() {  
 
$dim_value = strtolower($this->getParam('adType'));  
$this->setTitle('Ad Type: ', $dim_value);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('constraints', 'adType=='.urlencode($dim_value));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this ad type.');  
$this->setSubview('base.reportDimensionDetail');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Ad Types Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006-2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAdTypesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Ad Types');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'adType');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'adType',  
'template' => array('do' => 'base.reportAdTypeDetail', 'adType' => '%s'),  
'valueColumns' => 'adType'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from ads.');  
$this->set('gridTitle', 'Top Ad Types');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Ad Performance Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAdsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Ad Performance');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'ad');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'ad',  
'template' => array('do' => 'base.reportAdDetail', 'ad' => '%s'),  
'valueColumns' => 'ad'));  
$this->set('constraints', 'ad!=null');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from ads.');  
$this->set('gridTitle', 'Top Ads');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Anchortext Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportAnchortextController extends owa_reportController {  
 
function action() {  
 
$this->setView('base.report');  
$this->setSubview('base.reportDimension');  
$this->setTitle('Referral Link Text');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralLinkText');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('constraints', 'medium==referral');  
$this->set('dimensionLink', array(  
'linkColumn' => 'referralLinkText',  
'template' => array(  
'do' => 'base.reportReferralLinkTextDetail',  
'referralLinkText' => '%s'),  
'valueColumns' => 'referralLinkText'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from referrals.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Attribution History Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAttributionHistoryController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Attribution History');  
 
$this->set('dimensions', 'latestAttributions');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all mediums/source.');  
 
$this->set('gridFormatters', array('latestAttributions' =>  
"function(value) {  
if (value) {  
table = jQuery('#attributionCell').jqote(JSON.parse(value), '*');  
return table;  
} else {  
return '(none)';  
}  
}  
"  
));  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Ecommerce Conversion Rate Trend Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportAvgOrderValueController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Average Order Value');  
$this->set('metrics', 'revenuePerTransaction');  
$this->set('dimensions', 'date');  
$this->set('sort', 'date-');  
$this->set('resultsPerPage', 30);  
 
$this->set('trendChartMetric', 'revenuePerTransaction');  
$this->set('trendTitle', 'Average order Value was <*= this.d.resultSet.aggregates.revenuePerTransaction.formatted_value *> across all transactions.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Browser Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportBrowserDetailController extends owa_reportController {  
 
function action() {  
 
$browser = $this->getParam('browserType');  
 
$this->set('dimension_properties', array('browser_family' => $browser));  
$this->set('dimension_template', 'dimension_browser.php');  
$this->setSubview('base.reportDimension');  
$this->setTitle('Browser Detail:');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'browserVersion');  
$this->set('sort', 'visits-');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this browser type.');  
$this->set('constraints', 'browserType=='.urlencode($browser));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Browser Type Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportBrowsersController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Browser Types');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'browserType');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array(  
'linkColumn' => 'browserType',  
'template' => array('do' => 'base.reportBrowserDetail', 'browserType' => '%s'),  
'valueColumns' => 'browserType'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits for all browser types.');  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Campaign Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportCampaignDetailController extends owa_reportController {  
 
function action() {  
 
$dim_value = strtolower($this->getParam('campaign'));  
$this->setTitle('Campaign: ', $dim_value);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('constraints', 'campaign=='.urlencode($dim_value));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this campaign.');  
$this->setSubview('base.reportDimensionDetail');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Campaigns Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportCampaignsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Campaigns');  
$metrics = 'visits,pageViews,bounces';  
if ( owa_coreAPI::getSetting('base', 'enableEcommerceReporting') ) {  
$metrics .= ',transactions,transactionRevenue';  
}  
 
$this->set('metrics', $metrics);  
$this->set('dimensions', 'campaign');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'campaign',  
'template' => array('do' => 'base.reportCampaignDetail', 'campaign' => '%s'),  
'valueColumns' => 'campaign'));  
$this->set('constraints', 'campaign!=null');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from campaigns.');  
$this->set('gridTitle', 'Top Campaigns');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Commerce Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportCommerceController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportCommerce');  
$this->setTitle('Ecommerce Overview');  
}  
 
}  
 
/**  
* Commerce Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportCommerceView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
 
$this->body->set('headline', 'Ecommerce');  
$this->body->set_template('report_commerce.php');  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Content Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportContentController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportContent');  
$this->setTitle('Content Overview');  
}  
 
}  
 
/**  
* Content Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportContentView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
 
$this->body->set('headline', 'Content');  
$this->body->set_template('report_content.tpl');  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Country Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportCountryDetailController extends owa_reportController {  
 
function action() {  
 
$value = $this->getParam('country');  
$this->setSubview('base.reportDimension');  
$this->setTitle('Country: ', $value);  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'stateRegion,country');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'stateRegion',  
'template' => array('do' => 'base.reportStateDetail', 'stateRegion' => '%s', 'country' => '%s'),  
'valueColumns' => array('stateRegion', 'country')));  
$this->set('constraints', 'country=='.urlencode($value));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this country.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Creative Performance Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportCreativePerformanceController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Creative Performance');  
 
$this->set('dimensions', 'ad,entryPagePath');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array(  
'linkColumn' => 'ad',  
'template' => array('do' => 'base.reportAdDetail', 'ad' => '%s'),  
'valueColumns' => 'ad'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits for all ads.');  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Dashboard Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDashboardController extends owa_reportController {  
 
function action() {  
 
// action counts  
$params = array('period' => $this->get('period'),  
'startDate' => $this->get('startDate'),  
'endDate' => $this->get('endDate'),  
'metrics' => 'actions',  
'dimensions' => 'actionName',  
'siteId' => $this->getParam('siteId'),  
'do' => 'getResultSet'  
);  
 
$rs = owa_coreAPI::executeApiCommand($params);  
//print_r($rs);  
$this->set('actions', $rs);  
 
$rs = owa_coreAPI::executeApiCommand(array(  
 
'do' => 'getLatestVisits',  
'siteId' => $this->getParam('siteId'),  
'page' => $this->getParam('page'),  
'startDate' => $this->getParam('startDate'),  
'endDate' => $this->getParam('endDate'),  
'period' => $this->getParam('period'),  
'resultsPerPage' => 10  
));  
 
$this->set('latest_visits', $rs);  
 
// set view stuff  
$this->setSubview('base.reportDashboard');  
$this->setTitle('Dashboard');  
 
$metrics = 'visits,uniqueVisitors,pageViews,bounceRate,pagesPerVisit,visitDuration';  
 
if ( owa_coreAPI::getSiteSetting( $this->getParam('siteId'), 'enableEcommerceReporting') ) {  
$metrics .= ',transactions,transactionRevenue';  
}  
 
$this->set('metrics', $metrics);  
}  
}  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Dashboard Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDashboardView extends owa_view {  
 
function render() {  
 
$this->body->set_template('report_dashboard.tpl');  
$this->body->set('summary', $this->get('summary'));  
$this->body->set('site_trend', $this->get('site_trend'));  
$this->body->set('visits', $this->get('latest_visits'));  
$this->body->set('actions', $this->get('actions'));  
$this->body->set('metrics', $this->get('metrics'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Days To Purchase Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportDaysToPurchaseController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Days To Purchase');  
$this->set('metrics', 'transactions');  
$this->set('dimensions', 'daysToTransaction');  
$this->set('sort', 'daysToTransaction');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'transactions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.transactions.formatted_value *> transactions from all visitors.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Document Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDocumentController extends owa_reportController {  
 
function action() {  
 
$d = owa_coreAPI::entityFactory('base.document');  
 
if ($this->getParam('pageUrl')) {  
$pageUrl = $this->getParam('pageUrl');  
$d->getByColumn('url', $pageUrl);  
$this->set('constraints', 'pageUrl=='.urlencode($pageUrl));  
$title_slug = $pageUrl;  
}  
 
if ($this->getParam('pagePath')) {  
$pagePath = $this->getParam('pagePath');  
$d->getByColumn('uri', $pagePath);  
$this->set('constraints', 'pagePath=='.urlencode($pagePath));  
$title_slug = $pagePath;  
}  
 
$this->setTitle('Page Detail: ');  
$this->set('document', $d);  
$this->set('metrics', 'visits,pageViews');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'pageViews');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.pageViews.formatted_value *> page views for this page.');  
$this->setSubview('base.reportDocument');  
}  
 
}  
 
 
/**  
* Document Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportDocumentView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('document', $this->get('document'));  
$this->body->set('dimension_properties', $this->get('document'));  
$this->body->set('dimension_template', 'item_document.php');  
$this->body->set_template('report_document.tpl');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Ecommerce Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportDomClicksController extends owa_reportController {  
 
function action() {  
 
$d = owa_coreAPI::entityFactory('base.document');  
 
if ($this->getParam('pageUrl')) {  
$pageUrl = $this->getParam('pageUrl');  
$d->getByColumn('url', $pageUrl);  
$this->set('constraints', 'pageUrl=='.urlencode($pageUrl));  
$title_slug = $pageUrl;  
}  
 
if ($this->getParam('pagePath')) {  
$pagePath = $this->getParam('pagePath');  
$d->getByColumn('uri', $pagePath);  
$this->set('constraints', 'pagePath=='.urlencode($pagePath));  
$title_slug = $pagePath;  
}  
 
if ($this->getParam('document_id')) {  
$did = $this->getParam('document_id');  
$d->load( $did );  
$pagePath = $d->get('uri');  
$this->set('constraints', 'pagePath=='.urlencode($pagePath));  
$title_slug = $pagePath;  
}  
 
$this->setTitle('Dom Clicks: ', $title_slug);  
$this->set('document', $d);  
$this->setSubview('base.reportDomClicks');  
$this->set('metrics', 'domClicks');  
$this->set('sort', 'domClicks');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'domClicks');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.domClicks.formatted_value *> dom clicks for this web page.');  
}  
}  
 
/**  
* Dom Clicks Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportDomClicksView extends owa_view {  
 
function render() {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('hideGrid', true);  
$this->body->set('dimension_properties', $this->get('document'));  
$this->body->set('dimension_template', 'item_document.php');  
$this->body->set_template('report_dom_clicks.php');  
$this->body->set('document', $this->get('document'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Domstream Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
class owa_reportDomstreamsController extends owa_reportController {  
 
function action() {  
 
$document_id = '';  
 
// get period  
$p = $this->getPeriod();  
 
// check for limits  
if ($this->getParam('document_id') || $this->getParam('pageUrl') || $this->getParam('pagePath')) {  
$doc = owa_coreAPI::entityFactory('base.document');  
 
if ($this->getParam('pageUrl')) {  
$doc->getByColumn('url', $this->getParam('pageUrl'));  
} elseif ($this->getParam('pagePath')) {  
$doc->getByColumn('uri', $this->getParam('pagePath'));  
} else {  
$doc->load($this->getParam('document_id'));  
}  
 
$document_id = $doc->get('id');  
 
$this->setTitle('Domstream Recordings: ', $doc->get('url'));  
$this->set('document', $doc->_getProperties());  
$this->set('item_properties', $doc);  
} else {  
// latest domstream report  
$this->setTitle('Latest Domstreams');  
}  
 
$ds = owa_coreAPI::executeApiCommand(array(  
 
'do' => 'getDomstreams',  
'startDate' => $p->getStartDate()->getYyyymmdd(),  
'endDate' => $p->getEndDate()->getYyyymmdd(),  
'document_id' => $document_id,  
'siteId' => $this->getParam('siteId'),  
'page' => $this->getParam('page'),  
'resultsPerPage' => 50,  
'format' => $this->getParam('format')  
));  
 
$this->set('domstreams', $ds);  
//print_r($ds);  
 
// set view stuff  
$this->setSubview('base.reportDomstreams');  
 
 
}  
 
}  
 
/**  
* Domstream Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
class owa_reportDomstreamsView extends owa_view {  
 
function render() {  
 
$this->body->set('domstreams', $this->get('domstreams'));  
$this->body->set_template('report_domstreams.tpl');  
$doc = $this->get('document');  
$this->body->set('document', $doc);  
$this->body->set('properties', $this->get('item_properties'));  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Ecommerce Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportEcommerceController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportEcommerce');  
$this->setTitle('Ecommerce');  
$this->set('metrics', 'visits,transactions,transactionRevenue,ecommerceConversionRate,revenuePerVisit,revenuePerTransaction');  
$this->set('sort', 'actions');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'transactions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.transactions.formatted_value *> transactions completed.');  
}  
}  
 
/**  
* Ecommerce Tracking Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportEcommerceView extends owa_view {  
 
function render() {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('hideGrid', true);  
$this->body->set_template('report_ecommerce.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Ecommerce Conversion Rate Trend Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportEcommerceConversionRateController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Total Revenue');  
$this->set('metrics', 'visits,ecommerceConversionRate');  
$this->set('dimensions', 'date');  
$this->set('sort', 'date-');  
$this->set('resultsPerPage', 30);  
 
$this->set('trendChartMetric', 'ecommerceConversionRate');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.ecommerceConversionRate.formatted_value *> across all visits.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Entry Pages Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportEntryPagesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Entry Pages');  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'entryPagePath,entryPageUrl,entryPageTitle');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'entryPageTitle',  
'template' => array('do' => 'base.reportDocument', 'pageUrl' => '%s'),  
'valueColumns' => 'entryPageUrl'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits to the site through all entry pages.');  
$this->set('gridTitle', 'Top Entry Pages');  
$this->set('excludeColumns', "'entryPageUrl'");  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Exit Pages Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportExitPagesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Exit Pages');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'exitPageTitle,exitPagePath,exitPageUrl');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'exitPageTitle',  
'template' => array('do' => 'base.reportDocument', 'pageUrl' => '%s'),  
'valueColumns' => 'exitPageUrl'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits to the site.');  
$this->set('gridTitle', 'Top Exit Pages');  
$this->set('excludeColumns', "'exitPageUrl'");  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Feeds Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportFeedsController extends owa_reportController {  
 
function action() {  
 
$this->set('metrics', 'feedReaders,feedRequests,feedSubscriptions');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'feedReaders');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.feedReaders.formatted_value *> readers of all feeds.');  
$this->set('dimensions', 'feedType');  
$this->set('sort', 'feedReaders-');  
// view stuff  
$this->setView('base.report');  
$this->setSubview('base.reportFeeds');  
$this->setTitle('Feeds');  
}  
}  
 
/**  
* Feeds Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportFeedsView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
 
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set_template('report_feeds.tpl');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Geolocation Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportGeolocationController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Visitor Geolocation');  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'country,countryCode');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'country',  
'template' => array('do' => 'base.reportCountryDetail', 'country' => '%s'),  
'valueColumns' => 'country'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all locations.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Goal Funnel Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportGoalFunnelController extends owa_reportController {  
 
function action() {  
 
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $this->getParam( 'siteId' ) );  
 
$goal_number = $this->getParam('goalNumber');  
 
if ( ! $goal_number ) {  
$goal_number = 1;  
}  
 
$goal = $gm->getGoal($goal_number);  
$funnel = $gm->getGoalFunnel($goal_number);  
 
if ( $funnel ) {  
$goal = $gm->getGoal($goal_number);  
// find required steps. build a constraint string.  
$required_step_constraints = '';  
$steps_count = count($funnel);  
for ($i=1; $i <= $steps_count ;$i++ ) {  
 
if (array_key_exists('is_required', $funnel[$i]) && $funnel[$i]['is_required'] === true) {  
 
$required_step_constraints .= 'pagePath=='.$funnel[$i]['url'].',';  
}  
}  
$required_step_constraints = trim($required_step_constraints, ',');  
 
//print $required_step_constraints;  
// get total visits  
$total_visitors_rs = owa_coreAPI::executeApiCommand(array(  
'period' => $this->get('period'),  
'startDate' => $this->get('startDate'),  
'endDate' => $this->get('endDate'),  
'constraints' => $required_step_constraints,  
'metrics' => 'visitors',  
'do' => 'getResultSet',  
'siteId' => $this->getParam( 'siteId' )  
));  
//print_r($total_visitors_rs);  
$total_visitors = $total_visitors_rs->getAggregateMetric( 'visitors' );  
//print "Total visits: $total_visitors";  
 
$this->set( 'total_visitors', $total_visitors);  
// get visits for each step  
 
// add goal url to steps array  
$funnel[] = array('url' => $goal['details']['goal_url'], 'name' => $goal['goal_name'], 'step_number' => $steps_count + 1);  
foreach ( $funnel as $k => $step ) {  
$operator = '==';  
$rs = owa_coreAPI::executeApiCommand(array(  
'period' => $this->get('period'),  
'startDate' => $this->get('startDate'),  
'endDate' => $this->get('endDate'),  
'metrics' => 'visitors',  
'constraints' => 'pagePath'.$operator.$step['url'],  
'do' => 'getResultSet',  
'siteId' => $this->getParam( 'siteId' )  
));  
 
$visitors = $rs->getAggregateMetric('visitors') ? $rs->getAggregateMetric('visitors'): 0;  
$funnel[$k]['visitors'] = $visitors;  
 
// backfill check in case there are more visitors to this step than were at prior step.  
if ($funnel[$k]['visitors'] <= $funnel[$k-1]['visitors']) {  
if ($funnel[$k-1]['visitors'] > 0 ) {  
$funnel[$k]['visitor_percentage'] = round($funnel[$k]['visitors'] / $funnel[$k-1]['visitors'], 4) * 100 . '%';  
} else {  
$funnel[$k]['visitor_percentage'] = '0.00%';  
}  
} else {  
$funnel[$k]['visitor_percentage'] = '100%';  
}  
}  
 
//print_r($funnel);  
 
$goal_step = end($funnel);  
$goal_conversion_rate = round($goal_step['visitors'] / $total_visitors, 2) * 100 . '%';  
$this->set('goal_conversion_rate', $goal_conversion_rate);  
$this->set('funnel', $funnel);  
 
}  
// set view stuff  
$this->setSubview('base.reportGoalFunnel');  
$this->setTitle('Funnel Visualization:', 'Goal ' . $goal_number);  
$this->set('goal_number', $goal_number);  
}  
}  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Goal Funnel Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportGoalFunnelView extends owa_view {  
 
function render() {  
 
$this->body->set_template('report_goal_funnel.php');  
$this->body->set('funnel', $this->get('funnel'));  
$this->body->set('funnel_json', json_encode($this->get('funnel')));  
$this->body->set('goal_conversion_rate', $this->get('goal_conversion_rate'));  
$this->body->set('numGoals', owa_coreAPI::getSetting('base', 'numGoals') );  
$this->body->set('goal_number', $this->get('goal_number') );  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Goals Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportGoalsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportGoals');  
$this->setTitle('Goals');  
$this->set('metrics', 'visits,goalCompletionsAll,goalConversionRateAll,goalAbandonRateAll,goalValueAll');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.goalCompletionsAll.formatted_value *> goals completed.');  
$this->set('trendChartMetric', 'goalCompletionsAll');  
 
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
$goals = $gm->getActiveGoals();  
 
if ($goals) {  
$goal_metrics = '';  
$goal_count = count($goals);  
$i = 1;  
foreach ($goals as $goal) {  
$goal_metrics .= 'goal'.$goal['goal_number'].'Completions';  
 
if ($i < $goal_count) {  
$goal_metrics .= ',';  
}  
$i++;  
}  
}  
$this->set('goal_metrics', $goal_metrics);  
}  
}  
 
/**  
* Goal Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportGoalsView extends owa_view {  
 
function render() {  
 
// Assign Data to templates  
$this->body->set('metrics', $this->get('metrics'));  
$this->body->set('dimensions', $this->get('dimensions'));  
$this->body->set('sort', $this->get('sort'));  
$this->body->set('resultsPerPage', $this->get('resultsPerPage'));  
$this->body->set('dimensionLink', $this->get('dimensionLink'));  
$this->body->set('trendChartMetric', $this->get('trendChartMetric'));  
$this->body->set('trendTitle', $this->get('trendTitle'));  
$this->body->set('constraints', $this->get('constraints'));  
$this->body->set('gridTitle', $this->get('gridTitle'));  
$this->body->set('hideGrid', true);  
$this->body->set('goal_metrics', $this->get('goal_metrics'));  
$this->body->set_template('report_goals.php');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitor Hosts Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportHostDetailController extends owa_reportController {  
 
function action() {  
 
$hostName = $this->getParam('hostName');  
 
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Host Detail: ', $hostName);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimension', 'hostName');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this host.');  
$this->set('constraints', 'hostName=='.urlencode($hostName));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitor Hosts Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportHostsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Host Names');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'hostName');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'hostName',  
'template' => array('do' => 'base.reportHostDetail', 'hostName' => '%s'),  
'valueColumns' => 'hostName'));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all hosts.');  
$this->set('gridTitle', 'Top Hosts');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Keyword Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportKeywordDetailController extends owa_reportController {  
 
function action() {  
 
$searchTerm = $this->getParam('referralSearchTerms');  
 
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Search Term Detail: ', $searchTerm);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimension', 'referralSearchTerms');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this search term.');  
$this->set('constraints', 'referralSearchTerms=='.urlencode($searchTerm));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Keywords Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportKeywordsController extends owa_reportController {  
 
function action() {  
 
$this->setView('base.report');  
$this->setSubview('base.reportDimension');  
$this->setTitle('Referring Search Terms');  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralSearchTerms');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'referralSearchTerms',  
'template' => array('do' => 'base.reportKeywordDetail', 'referralSearchTerms' => '%s'),  
'valueColumns' => 'referralSearchTerms'));  
$this->set('constraints', 'medium==organic-search');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from search engines.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Operating System Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportOsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Operating Systems');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'osType');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array(  
'linkColumn' => 'osType',  
'template' => array('do' => 'base.reportOsDetail', 'osType' => '%s'),  
'valueColumns' => 'osType'));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits for all operating systems.');  
$this->set('gridTitle', 'Top Page Types');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Operating System Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportOsDetailController extends owa_reportController {  
 
function action() {  
 
$os = $this->getParam('osType');  
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Operating System: ', $os);  
$this->set('metrics', 'visits,pageViews');  
//$this->set('dimensions', 'osType');  
$this->set('constraints', 'osType=='.urlencode($os));  
$this->set('sort', 'visits-');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits for this operating system.');  
//$this->set('gridTitle', 'Top Page Types');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Pages Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportPageTypeDetailController extends owa_reportController {  
 
function action() {  
 
$pageType = $this->getParam('pageType');  
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Page Type: ', $pageType);  
$this->set('metrics', 'visits,pageViews');  
//$this->set('dimensions', 'pageType');  
$this->set('constraints', 'pageType=='.urlencode($pageType));  
$this->set('sort', 'pageViews-');  
$this->set('trendChartMetric', 'pageViews');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.pageViews.formatted_value *> page views for this page type.');  
$this->set('gridTitle', 'Top Page Types');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Pages Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportPageTypesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Page Types');  
$this->set('metrics', 'visits,pageViews');  
$this->set('dimensions', 'pageType');  
$this->set('sort', 'pageViews-');  
$this->set('resultsPerPage', 25);  
$this->set('dimensionLink', array(  
'linkColumn' => 'pageType',  
'template' => array('do' => 'base.reportPageTypeDetail', 'pageType' => '%s'),  
'valueColumns' => 'pageType'));  
 
$this->set('trendChartMetric', 'pageViews');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.pageViews.formatted_value *> page views for all page types.');  
$this->set('gridTitle', 'Top Page Types');  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Pages Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportPagesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Web Pages');  
$this->set('metrics', 'pageViews,visits,uniquePageViews');  
// add ametrics override setting  
$this->set('dimensions', 'pagePath,pageTitle,pageType');  
//$this->set('excludeColumns', "'pageUrl'");  
$this->set('sort', 'pageViews-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'pagePath',  
'template' => array('do' => 'base.reportDocument', 'pagePath' => '%s'),  
'valueColumns' => 'pagePath'));  
$this->set('trendChartMetric', 'pageViews');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.pageViews.formatted_value *> page views for <*= this.d.resultSet.aggregates.uniquePageViews.value *> unique pages.');  
$this->set('gridTitle', 'Top Pages');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Product Categories Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductCategoriesController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'productCategory';  
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Product SKUs');  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimensions', $dim_name);  
$this->set('sort', 'lineItemQuantity-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array('linkColumn' => $dim_name,  
'template' => array('do' => 'base.reportProductCategoryDetail', $dim_name => '%s'),  
'valueColumns' => $dim_name));  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> products sold across all Categories.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Product Category Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductCategoryDetailController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'productCategory';  
$dim_value = $this->getParam($dim_name);  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Product Category: ', $dim_value);  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimension', $dim_name);  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> units sold for this SKU.');  
$this->set('constraints', $dim_name.'=='.urlencode($dim_value));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Product Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductDetailController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'productName';  
$dim_value = $this->getParam($dim_name);  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Product Detail: ', $dim_value);  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimension', $dim_name);  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> units sold for this product.');  
$this->set('constraints', $dim_name.'=='.urlencode($dim_value));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Product SKU Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductSkuDetailController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'productSku';  
$dim_value = $this->getParam($dim_name);  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Product SKU: ', $dim_value);  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimension', $dim_name);  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> units sold for this SKU.');  
$this->set('constraints', $dim_name.'=='.urlencode($dim_value));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Product SKUs Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductSkusController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'productSku';  
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Product SKUs');  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimensions', $dim_name);  
$this->set('sort', 'lineItemQuantity-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array('linkColumn' => $dim_name,  
'template' => array('do' => 'base.reportProductSkuDetail', $dim_name => '%s'),  
'valueColumns' => $dim_name));  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> products sold across all SKUs.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Products Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportProductsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Products');  
$this->set('metrics', 'lineItemQuantity,lineItemRevenue');  
$this->set('dimensions', 'productName');  
$this->set('sort', 'actions');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array('linkColumn' => 'productName',  
'template' => array('do' => 'base.reportProductDetail', 'productName' => '%s'),  
'valueColumns' => 'productName'));  
$this->set('trendChartMetric', 'lineItemQuantity');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.lineItemQuantity.formatted_value *> products sold.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Referral Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportReferralDetailController extends owa_reportController {  
 
function action() {  
 
$referral = $this->getParam('referralPageUrl');  
 
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Referral:');  
 
$r = owa_coreAPI::entityFactory('base.referer');  
$r->getByColumn('url', $referral);  
 
$this->set('dimension_properties', array(  
'page_title' => $r->get('page_title'),  
'url' => $r->get('url'),  
'snippet' => $r->get('snippet') ) );  
 
$this->set('dimension_template', 'dimension_referral.php');  
 
 
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralPageTitle,referralWebSite');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 25);  
$this->set('constraints', 'referralPageUrl=='.urlencode($referral));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this referral.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Anchortext Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportReferralLinkTextDetailController extends owa_reportController {  
 
function action() {  
 
$linkText = $this->getParam('referralLinkText');  
 
$this->setView('base.report');  
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Referral Link Text: ', $linkText);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralLinkText');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
$this->set('constraints', 'referralLinkText=='.urlencode($linkText));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from links with this text.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Referring Sites Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportReferringSitesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Referrals');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralPageTitle,referralPageUrl');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'referralPageTitle',  
'template' => array('do' => 'base.reportReferralDetail', 'referralPageUrl' => '%s'),  
'valueColumns' => 'referralPageUrl'));  
$this->set('constraints', 'medium==referral');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from referrals.');  
$this->set('gridTitle', 'Top Referrals');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Revenue Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportRevenueController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Total Revenue');  
$this->set('metrics', 'transactionRevenue');  
$this->set('dimensions', 'date');  
$this->set('sort', 'date-');  
$this->set('resultsPerPage', 30);  
 
$this->set('trendChartMetric', 'transactionRevenue');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.transactionRevenue.formatted_value *> across all transactions.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Search Engine Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportSearchEngineDetailController extends owa_reportController {  
 
function action() {  
 
$searchEngine = $this->getParam('referralWebSite');  
 
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Search Engine: ', $searchEngine);  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralWebSite');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
$this->set('constraints', 'source==organic-search');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this search engine.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Search Engines Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportSearchEnginesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Search Engines');  
$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'referralWebSite');  
$this->set('sort', 'visits-');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'referralWebSite',  
'template' => array('do' => 'base.reportSearchEngineDetail', 'referralWebSite' => '%s'),  
'valueColumns' => 'referralWebSite'));  
$this->set('constraints', 'medium==organic-search');  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from search engines.');  
$this->set('gridTitle', 'Top Search Engines');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Source Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportSourceDetailController extends owa_reportController {  
 
function action() {  
 
$dim_name = 'source';  
$dim_value = $this->getParam('source');  
 
$this->setSubview('base.reportDimensionDetail');  
$this->setTitle('Source Detail: ', $dim_value);  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimension', $dim_name);  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this source.');  
$this->set('constraints', $dim_name.'=='.urlencode($dim_value));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Sources Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportSourcesController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Sources');  
$this->set('dimensions', 'source,medium');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
$this->set('dimensionLink', array(  
'linkColumn' => 'source',  
'template' => array(  
'do' => 'base.reportSourceDetail',  
'source' => '%s'),  
'valueColumns' => 'source'  
));  
 
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all sources.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* State Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportStateDetailController extends owa_reportController {  
 
function action() {  
 
$state = $this->getParam('stateRegion');  
$country = $this->getParam('country');  
$this->setSubview('base.reportDimension');  
$this->setTitle('State/Region: ', $state);  
//$this->set('metrics', 'visits,pageViews,bounces');  
$this->set('dimensions', 'city,stateRegion');  
$this->set('sort', 'visits');  
$this->set('resultsPerPage', 30);  
/*  
 
$this->set('dimensionLink', array(  
'linkColumn' => 'stateRegion',  
'template' => array('do' => 'base.reportStateDetail', 'stateRegion' => '%s'),  
'valueColumns' => 'stateRegion'));  
 
*/  
$this->set('constraints', 'country=='.urlencode($country).',stateRegion=='.urlencode($state));  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from this state/region.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Traffic Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportTrafficController extends owa_reportController {  
 
function action() {  
 
// view stuff  
$this->setView('base.report');  
$this->setSubview('base.reportTraffic');  
$this->setTitle('Traffic Sources');  
}  
}  
 
/**  
* Traffic Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportTrafficView extends owa_view {  
 
function render($data) {  
 
// Assign Data to templates  
 
$this->body->set_template('report_traffic.tpl');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Transaction Detail Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportTransactionDetailController extends owa_reportController {  
 
function action() {  
 
$transactionId = $this->getParam('transactionId');  
 
$trans_detail = owa_coreAPI::executeAPICommand(array(  
'do' => 'getTransactionDetail',  
'transactionId' => $transactionId,  
'format' => 'php'  
));  
 
$this->set('trans_detail', $trans_detail);  
$this->setSubview('base.reportTransactionDetail');  
$this->setTitle('Transaction Detail for: ', $transaction_id);  
}  
 
}  
 
/**  
* Transaction Detail Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportTransactionDetailView extends owa_view {  
 
function render() {  
 
$this->body->set( 'trans_detail', $this->get( 'trans_detail' ) );  
$this->body->set_template( 'report_transaction_detail.php' );  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Transactions Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportTransactionsController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportTransactions');  
$this->setTitle('Transactions Overview');  
}  
 
}  
 
/**  
* Transactions Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 - 2011 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportTransactionsView extends owa_view {  
 
function render($data) {  
 
$this->body->set_template('report_transactions.php');  
}  
 
}  
 
?>  
<?php  
 
 
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visit Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitController extends owa_reportController {  
 
function action() {  
 
$visit = owa_coreAPI::executeApiCommand(array(  
'do' => 'getVisitDetail',  
'sessionId' => $this->getParam('session_id') ) );  
 
//setup Metrics  
$rs = owa_coreAPI::executeApiCommand(array(  
'do' => 'getClickstream',  
'sessionId' => $this->getParam('session_id') ) );  
 
$this->set('clickstream', $rs);  
$this->set('visit', $visit);  
$this->set('session_id', $this->getParam('session_id'));  
$this->setView('base.report');  
$this->setSubview('base.reportVisit');  
$this->setTitle('Visit Clickstream');  
}  
}  
 
/**  
* Visit Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitView extends owa_view {  
 
function render() {  
 
// Assign data to templates  
$this->body->set_template('report_visit.tpl');  
$this->body->set('session_id', $this->get('session_id'));  
$this->body->set('visits', $this->get('visit'));  
$this->body->set('clickstream', $this->get('clickstream'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visit Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorController extends owa_reportController {  
 
function action() {  
 
$visitorId = $this->getParam('visitorId');  
 
if (!$visitorId) {  
$visitorId = $this->getParam('visitor_id');  
}  
 
$v = owa_coreAPI::entityFactory('base.visitor');  
$v->load($visitorId);  
 
$this->set('visitor_id', $visitorId);  
$this->set('visitor', $v);  
$this->setView('base.report');  
$this->setSubview('base.reportVisitor');  
$this->setTitle('Visitor History:', $v->getVisitorName());  
}  
 
}  
 
/**  
* Visit Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorView extends owa_view {  
 
function render($data) {  
 
$this->body->set_template('report_visitor.tpl');  
$this->body->set('visitor_id', $this->get('visitor_id'));  
$this->body->set('visits', $this->get('visits'));  
$this->body->set('visitor', $this->get('visitor'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitors Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorsController extends owa_reportController {  
 
function action() {  
 
$rs = owa_coreAPI::executeApiCommand(array(  
 
'do' => 'getLatestVisits',  
'siteId' => $this->getParam('siteId'),  
'page' => $this->getParam('page'),  
'startDate' => $this->getParam('startDate'),  
'endDate' => $this->getParam('endDate'),  
'period' => $this->getParam('period'),  
'resultsPerPage' => 10 ) );  
 
$this->set('latest_visits', $rs);  
 
// view stuff  
$this->setView('base.report');  
$this->setSubview('base.reportVisitors');  
$this->setTitle('Visitors');  
}  
}  
 
/**  
* Visitors Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorsView extends owa_view {  
 
function render($data) {  
 
$this->body->set_template('report_visitors.tpl');  
$this->body->set('visits', $this->get('latest_visits'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitors Age Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportVisitorsAgeController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Visitor Age');  
$this->set('metrics', 'visits');  
$this->set('dimensions', 'daysSinceFirstVisit');  
$this->set('sort', 'daysSinceFirstVisit');  
$this->set('resultsPerPage', 25);  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all sources.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitors Loyalty Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorsLoyaltyController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Visitor Loyalty');  
$this->set('metrics', 'visits');  
$this->set('dimensions', 'priorVisitCount');  
$this->set('sort', 'priorVisitCount');  
$this->set('resultsPerPage', 25);  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all sources.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitors Recency Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportVisitorsRecencyController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportDimension');  
$this->setTitle('Visitor Recency');  
$this->set('metrics', 'visits');  
$this->set('dimensions', 'daysSinceLastVisit');  
$this->set('sort', 'daysSinceLastVisit');  
$this->set('resultsPerPage', 25);  
$this->set('trendChartMetric', 'visits');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.visits.formatted_value *> visits from all sources.');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visitors Roster Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
* @depricated  
* @todo remove  
*/  
 
class owa_reportVisitorsRosterController extends owa_reportController {  
 
function __construct($params) {  
 
$this->priviledge_level = 'viewer';  
return parent::__construct($params);  
}  
 
function action() {  
 
 
$db = owa_coreAPI::dbSingleton();  
 
$db->selectColumn("distinct session.visitor_id as visitor_id, visitor.user_name, visitor.user_email");  
$db->selectFrom('owa_session', 'session');  
$db->join(OWA_SQL_JOIN_LEFT_OUTER, 'owa_visitor', 'visitor', 'visitor_id', 'visitor.id');  
 
$db->where('site_id', $this->getParam('site_id'));  
 
// make new timeperiod of a day  
$period = owa_coreAPI::makeTimePeriod('day', array('startDate' => $this->getParam('first_session')));  
$start = $period->getStartDate();  
$end = $period->getEndDate();  
//print_r($period);  
// set new period so lables show up right.  
$db->where('first_session_timestamp',  
array('start' => $start->getTimestamp(), 'end' => $end->getTimestamp()),  
'BETWEEN');  
 
$ret = $db->getAllRows();  
 
$this->set('visitors', $ret);  
$this->setSubview('base.reportVisitorsRoster');  
$this->setTitle('New Visitors from', $period->getStartDate()->label);  
}  
 
}  
 
/**  
* Visitors Roster Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitorsRosterView extends owa_view {  
 
function render($data) {  
 
$this->body->set_template('report_visitors_roster.tpl');  
$this->body->set('headline', 'Visitors');  
$this->body->set('visitors', $data['visitors']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visits Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportVisitsController extends owa_reportController {  
 
function action() {  
 
$visitorId = $this->getParam('visitorId');  
 
if (!$visitorId) {  
$visitorId = $this->getParam('visitor_id');  
}  
 
$v = owa_coreAPI::entityFactory('base.visitor');  
$v->load($visitorId);  
 
if ($this->getParam('date')) {  
$startDate = $this->getParam('date');  
$endDate = $this->getParam('date');  
}  
 
$rs = owa_coreAPI::executeApiCommand(array(  
 
'do' => 'getLatestVisits',  
'visitorId' => $visitorId,  
'siteId' => $this->getParam('siteId'),  
'page' => $this->getParam('page'),  
'startDate' => $startDate,  
'endDate' => $endDate,  
'format' => '' ) );  
 
$this->set('visits', $rs);  
$this->set('visitor', $v);  
$this->set('visitor_id', $visitorId);  
$this->setView('base.report');  
$this->setSubview('base.reportVisits');  
$this->setTitle('Visit History For: ', $v->getVisitorName());  
}  
}  
 
/**  
* Visits Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_reportVisitsView extends owa_view {  
 
function render() {  
 
$this->body->set_template('report_visits.php');  
$this->body->set('visitor_id', $this->get('visitor_id'));  
$this->body->set('visits', $this->get('visits'));  
$this->body->set('visitor', $this->get('visitor'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* Visits geolocation Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitsGeolocationController extends owa_reportController {  
 
function action() {  
 
$site_id = $this->getParam('siteId');  
 
if ($site_id) {  
//get site labels  
$s = owa_coreAPI::entityFactory('base.site');  
$s->getByColumn('site_id', $site_id);  
$this->set('site_name', $s->get('name'));  
$this->set('site_description', $s->get('description'));  
}  
 
$rs = owa_coreAPI::executeApiCommand(array(  
'do' => 'getLatestVisits',  
'siteId' => $this->getParam('siteId'),  
'page' => $this->getParam('page'),  
'startDate' => $this->getParam('startDate'),  
'endDate' => $this->getParam('endDate'),  
'period' => $this->getParam('period'),  
'resultsPerPage' => 200 ) );  
 
$this->set('latest_visits', $rs);  
$this->set('site_id', $site_id);  
$this->setTitle('Visitor Geo-location');  
$this->setView('base.report');  
$this->setSubview('base.reportVisitsGeolocation');  
}  
}  
 
 
/**  
* Visits Geolocation Report View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_reportVisitsGeolocationView extends owa_view {  
 
function render($data) {  
 
// Assign data to templates  
$this->body->set_template('report_geolocation.tpl');  
$this->body->set('latest_visits', $this->get('latest_visits'));  
$this->body->set('site_id', $this->get('site_id') );  
$this->setjs('jmaps', 'base/js/includes/jquery/jquery.jmap-r72.js');  
$this->setjs('owa.map', 'base/js/owa.map.js');  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Visits To Purchase Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_reportVisitsToPurchaseController extends owa_reportController {  
 
function action() {  
 
$this->setSubview('base.reportSimpleDimensional');  
$this->setTitle('Visits To Purchase');  
$this->set('metrics', 'transactions');  
$this->set('dimensions', 'visitsToTransaction');  
$this->set('sort', 'visitsToTransaction');  
$this->set('resultsPerPage', 30);  
$this->set('trendChartMetric', 'transactions');  
$this->set('trendTitle', 'There were <*= this.d.resultSet.aggregates.transactions.formatted_value *> transactions from all visitors.');  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Tracked Sites Roster Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_sites');  
return parent::__construct($params);  
}  
 
function action() {  
 
$s = owa_coreAPI::entityFactory('base.site');  
$sites = owa_coreAPI::getSitesList();  
$this->set('tracked_sites', $sites);  
$this->setSubview('base.sites');  
$this->setView('base.options');  
}  
}  
 
 
/**  
* Sites Roster View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesView extends owa_view {  
 
function render() {  
 
//page title  
$this->t->set('page_title', 'Sites Roster');  
$this->body->set_template('sites.tpl');  
$this->body->set('headline', 'Web Sites Roster');  
$this->body->set('tracked_sites', $this->get('tracked_sites'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Add Sites View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesAddView extends owa_view {  
 
function render($data) {  
 
//page title  
$this->t->set('page_title', 'Add Web Site');  
$this->body->set('headline', 'Add Web Site Profile');  
// load body template  
$this->body->set_template('sites_addoredit.tpl');  
 
$this->body->set('action', 'base.sitesAdd');  
 
//Check to see if user is passed by constructor or else fetch the object.  
if ($data['site']) {  
$this->body->set('site', $data['site']);  
}  
}  
}  
 
/**  
* Add Site Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesAddController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$this->setRequiredCapability('edit_sites');  
 
// Config for the domain validation  
$domain_conf = array('substring' => 'http', 'position' => 0, 'operator' => '!=', 'errorMsgTemplate' => 'Please remove the "http://" from your begining of your domain.');  
 
// Add validations to the run  
$this->addValidation('domain', $this->params['domain'], 'subStringPosition', $domain_conf);  
$this->addValidation('domain', $this->params['domain'], 'required');  
 
// Check user name exists  
$v2 = owa_coreAPI::validationFactory('entityDoesNotExist');  
$v2->setConfig('entity', 'base.site');  
$v2->setConfig('column', 'domain');  
$v2->setValues($this->getParam('protocol').$this->getParam('domain'));  
$v2->setErrorMessage($this->getMsg(3206));  
$this->setValidation('domain', $v2);  
 
// require nonce for this action  
$this->setNonceRequired();  
}  
 
function action() {  
 
$this->params['domain'] = $this->params['protocol'].$this->params['domain'];  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site_id = md5($this->params['domain']);  
$site->set('id', $site->generateId($site_id));  
$site->set('site_id', $site_id);  
$site->set('name', $this->params['name']);  
$site->set('domain', $this->params['domain']);  
$site->set('description', $this->params['description']);  
$site->set('site_family', $this->params['site_family']);  
$site->create();  
 
$this->setRedirectAction('base.sites');  
$this->set('status_code', 3202);  
}  
 
function errorAction() {  
 
$this->setView('base.options');  
$this->setSubview('base.sitesProfile');  
$this->set('error_code', 3311);  
$this->set('site', $this->params);  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Delete Site Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesDeleteController extends owa_adminController {  
 
function __construct($params) {  
parent::__construct($params);  
$this->setRequiredCapability('edit_sites');  
$this->setNonceRequired();  
}  
 
function action() {  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->delete($this->params['siteId'], 'site_id');  
 
$data['view_method'] = 'redirect';  
$data['do'] = 'base.sites';  
$data['status_code'] = 3204;  
 
return $data;  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Edit User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesEditController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$this->setRequiredCapability('edit_sites');  
$this->setNonceRequired();  
 
// validations  
 
// check that user_id is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($this->getParam('siteId'));  
$this->setValidation('siteId', $v1);  
 
// Check user name exists  
$v2 = owa_coreAPI::validationFactory('entityExists');  
$v2->setConfig('entity', 'base.site');  
$v2->setConfig('column', 'site_id');  
$v2->setValues($this->getParam('siteId'));  
$v2->setErrorMessage($this->getMsg(3208));  
$this->setValidation('siteId', $v2);  
}  
 
function action() {  
 
// This needs form validation in a bad way.  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->set('site_id', $this->params['siteId']);  
$site->set('name', $this->params['name']);  
$site->set('domain', $this->params['domain']);  
$site->set('description', $this->params['description']);  
$site->update('site_id');  
 
$data['view_method'] = 'redirect';  
$data['do'] = 'base.sites';  
$data['status_code'] = 3201;  
 
return $data;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Edit User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesEditSettingsController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->setRequiredCapability('edit_sites');  
$this->setNonceRequired();  
 
// validations  
 
// check that user_id is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($this->getParam('siteId'));  
$this->setValidation('siteId', $v1);  
 
// Check site exists  
$v2 = owa_coreAPI::validationFactory('entityExists');  
$v2->setConfig('entity', 'base.site');  
$v2->setConfig('column', 'site_id');  
$v2->setValues($this->getParam('siteId'));  
$v2->setErrorMessage($this->getMsg(3208));  
$this->setValidation('siteId', $v2);  
}  
 
function action() {  
 
$site_id = $this->getParam( 'siteId' );  
$site = owa_coreAPI::entityFactory( 'base.site' );  
$site->load( $site->generateId( $site_id ) );  
$settings = $site->get( 'settings' );  
 
if ( ! is_array($settings) ) {  
 
$settings = array();  
}  
 
$new_settings = $this->getParam( 'config' );  
 
if ($new_settings) {  
$site->set('settings', array_merge( $settings, $new_settings ) );  
 
$ret = $site->update();  
 
if ($ret) {  
$this->setStatusCode( 3201 );  
}  
 
$this->set('siteId', $site_id);  
$this->set('edit', true);  
$this->setRedirectAction( 'base.sitesProfile' );  
}  
}  
 
function errorAction() {  
 
$this->setView('base.options');  
$this->setSubview('base.sitesProfile');  
$this->set('error_code', 3311);  
$site_id = $this->getParam( 'siteId' );  
$site = owa_coreAPI::entityFactory( 'base.site' );  
$site->load( $site->generateId( $site_id ) );  
$this->set('site', $site);  
$this->set('config', $this->params);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Tracked Sites Tag Generator Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesInvocationController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_sites');  
return parent::__construct($params);  
}  
 
function action() {  
$site_id = $this->getParam('siteId');  
$this->set('site_id', $site_id);  
$s = owa_coreAPI::entityFactory('base.site');  
$s->getByColumn('site_id', $site_id);  
$this->set('site', $s);  
$this->setSubview('base.sitesInvocation');  
$this->setView('base.options');  
}  
}  
 
 
 
/**  
* Sites Invocation Instructions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_sitesInvocationView extends owa_view {  
 
function render($data) {  
 
$site = $this->get('site');  
 
if ($site->get('name')) {  
$name = sprintf("%s (%s)", $site->get('domain'), $site->get('name'));  
} else {  
$name = $site->get('domain');  
}  
 
 
//page title  
$this->t->set('page_title', 'Tracking Tags');  
$this->body->set('site', $site);  
$this->body->set('name', $name);  
// load body template  
$this->body->set_template('sites_invocation.tpl');  
 
$this->body->set('site_id', $this->get('site_id'));  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Site Profile Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesProfileController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_sites');  
return parent::__construct($params);  
}  
 
function action() {  
 
// needed as this controller is  
$site_id = $this->getParam('siteId');  
if (!empty($site_id)) {  
$site = owa_coreAPI::entityFactory('base.site');  
$site->getByColumn('site_id', $site_id);  
$site_data = $site->_getProperties();  
$this->set('config', $site->get('settings') );  
$this->set('edit', $this->getParam('edit'));  
} else {  
$site_data = array();  
}  
 
$this->set('site', $site_data);  
$this->set('siteId', $site_id);  
$this->setView('base.options');  
$this->setSubview('base.sitesProfile');  
}  
 
}  
 
 
/**  
* Sites Profile View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_sitesProfileView extends owa_view {  
 
function render() {  
 
$site = $this->get('site');  
if ($this->get('edit')) {  
$this->body->set('action', 'base.sitesEdit');  
$this->body->set('headline', 'Edit Site Profile for: '. $site['domain'] );  
 
} else {  
$this->body->set('action', 'base.sitesAdd');  
$this->body->set('headline', 'Add a New Tracked Site Profile');  
 
}  
 
$this->t->set( 'page_title', 'Site Profile for: '. $site['domain'] );  
$this->body->set( 'site', $site );  
$this->body->set( 'edit', $this->get('edit') );  
$this->body->set( 'site_id', $this->get('siteId') );  
$this->body->set( 'config', $this->get('config') );  
//print_r($this->get('config'));  
$this->body->set_template( 'sites_addoredit.tpl' );  
}  
 
 
}  
 
 
 
?>  
<div id="<?php echo $dom_id;?>Container" style="width:; margin:0px; padding:0px;height:<?php echo $height;?>;">  
<div id="<?php echo $dom_id;?>"></div>  
</div>  
 
<script>  
OWA.items['<?php echo $dom_id;?>'] = new OWA.chart();  
OWA.items['<?php echo $dom_id;?>'].setDomId('<?php echo $dom_id;?>');  
OWA.items['<?php echo $dom_id;?>'].setData(<?php echo $data;?>);  
OWA.items['<?php echo $dom_id;?>'].config.ofc_version = '<?php echo OWA_OFC_VERSION;?>';  
 
OWA.items['<?php echo $dom_id;?>'].render();  
jQuery("#<?php echo $dom_id;?>").addClass('owa_ofcChart');  
</script>  
 
// OWA CONFIG SETTINGS  
 
OWA.config.main_url = "<?php echo owa_coreAPI::getSetting('base', 'main_url');?>";  
OWA.config.public_url = "<?php echo owa_coreAPI::getSetting('base', 'public_url');?>";  
OWA.config.baseUrl = "<?php echo owa_coreAPI::getSetting('base', 'public_url');?>";  
//OWA.config.js_url = "<?php echo owa_coreAPI::getSetting('base', 'public_url').'js/';?>";  
OWA.config.action_url = "<?php echo owa_coreAPI::getSetting('base', 'action_url');?>";  
OWA.config.images_url = "<?php echo owa_coreAPI::getSetting('base', 'images_url');?>";  
OWA.config.log_url = "<?php echo owa_coreAPI::getSetting('base', 'log_url');?>";  
OWA.config.modules_url = "<?php echo owa_coreAPI::getSetting('base', 'modules_url');?>";  
OWA.config.api_endpoint = "<?php echo owa_coreAPI::getSetting('base', 'api_url');?>";  
OWA.config.ns = "<?php echo owa_coreAPI::getSetting('base', 'ns');?>";  
OWA.config.link_template = "<?php echo owa_coreAPI::getSetting('base', 'link_template');?>";  
 
<style>  
 
/* HTML ENTITIES*/  
 
body {border-color:#cccccc; background-color:; font-family:Helvetica,'Arial'; padding:0; margin: 0;}  
th {padding:6px 6px 6px 6px; text-align:left;}  
td {padding: 2px 2px 2px 2px;}  
legend {font-size:16px;font-weight:bold;}  
fieldset{margin: 7px; border:1px solid #cccccc;}  
div {margin:0;}  
 
.owa a {  
color: #21759B;  
}  
 
.owa a:hover {  
color: orange;  
}  
 
.owa .section {  
background-color:#ffffff;  
margin:20px;  
}  
 
/* COLORS */  
.red {background-color:red;}  
.yellow {background-color:yellow;}  
.green {background-color:green; color:#ffffff;}  
 
/* NAVIGATION */  
#sub_nav {padding:5px; background-color:#cccccc; width=100%; }  
.top_level_nav{font-size:20px;}  
.nav_links {list-style:none; margin:0px; padding:0px; }  
.nav_links li {float: left; padding:4px 20px 4px 20px;}  
.nav_links li a {text-decoration: none; }  
.nav_links ul {clear: both;}  
.post-nav {clear: both; margin:0px; padding:0px 0px 5px 0px;}  
.active_nav_link {background-color:#cccccc;}  
.host_app_nav {background-color:; vertical-align:middle;font-size:18px;padding:4px;}  
#owa_header {border-bottom: 3px solid orange; background-color:#FFFFFF; padding:4px; font-weight:bold; line-height:55px;}  
.owa_logo {float:left;padding-right:30px; vertical-align: middle;line-height:normal;}  
.owa_navigation {float:left;vertical-align:middle;padding-top:10px;}  
.owa_navigation ul {list-style: none; padding: 0; margin: 0;float:left;padding-top:0px;}  
.owa_navigation li {text-decoration: none; float:left; margin: 2px;}  
.owa_navigation li a {  
background: url() #fff bottom left repeat-x;  
height: 2em;  
line-height: 2em;  
float: left;  
width: 9em;  
display: block;  
border: 0.1em solid #efefef;  
text-decoration: none;  
text-align: center;  
}  
 
.owa_navigation li a:hover {  
 
border-color: orange;  
}  
 
/* FORMS */  
.form-row {border-bottom:1px solid #efefef;padding:10px; float:none;}  
.form-label {width:;}  
.form-field {position: relative; left: 120px;}  
.form-value {position: absolute; left: 380px; font-weight: bold;}  
.form-instructions {position: relative; left: 150px; font-size:12px; color: #9f9f9f;}  
.owa-button {  
border-radius:4px;  
background-color:orange;  
padding:15px 30px 15px 30px;  
color:#ffffff;  
font-size:18px;  
font-weight:bold;  
border: 1px solid #efefef;  
-moz-border-radius: 3px;  
-webkit-border-radius: 3px;  
margin-top: 50px;  
text-decoration: none;  
 
}  
.owa-button:hover {  
color: #000000;  
border-color: #9f9f9f;  
-moz-box-shadow:2px 2px 2px #999;  
box-shadow:2px 2px 2px #999;  
-webkit-box-shadow:2px 2px 2px #999;  
}  
 
.owa-button a {  
text-decoration: none;  
}  
 
.owa_pagination {float:left; overflow: hidden;}  
.owa_pagination ul {list-style: none; padding: 0; margin: 0;}  
.owa_pagination li {text-decoration: none; float:left; margin: 2px;}  
.owa_pagination li {  
background: url() #fff bottom left repeat-x;  
height:2em;  
line-height:2em;  
float: left;  
width: auto;  
display: block;  
border: 0.1em solid #efefef;  
color: ;  
text-decoration: none;  
text-align: center;  
padding:0px 2px 0px 2px;  
}  
 
.owa_headerServiceMsg {border: 1px solid #efefef;border-left: 8px solid yellow; height: 25px; width: auto; padding:10px}  
 
 
/* HEADLINES */  
 
.inline_h1 {font-size:24px; font-weight:bold;}  
.inline_h2 {font-size:20px;}  
.inline_h2_grey {font-size:20px; color:#cccccc;}  
.inline_h3 {font-size:16px;}  
.inline_h4 {font-size:14px;}  
.headline {font-size:20px; background-color:orange;color:#ffffff;border-color:#000000;padding:8px; font-weight:bold;margin: 0px 0px 0px 0px;}  
.panel_headline {font-size:18px; background-color:#FFF8DC;padding:10px;font-weight:bold;margin: 0px 0px 20px 0px;border-bottom:solid 1px}  
.sub-legend {font-size:16px;font-weight:bold; }  
 
/* DATA TABLES */  
 
.h_label {font-size:14px; font-weight:bold;}  
.indented_header_row {padding:0px 0px 0px 20px;}  
#layout_panels {border:1px solid #999999;border-collapse: collapse; width:100%; vertical-align:top;}  
.layout_panels td {border:1px solid #999999;border-collapse: collapse; vertical-align:top;}  
#panel {border-collapse: collapse; width:;border:0px;padding:10px; vertical-align:top;}  
td#panel {margin: 0px; padding-top:0px;width:;border-collapse: collapse;border:0px;}  
.layout_subview {margin: 0px; padding:0px;border-collapse: collapse;}  
.subview_content{padding:10px;}  
.subview_content td {padding:20ps;}  
#nav_left {width:240px; padding:10px}  
#nav_left li {padding-bottom:5px;}  
.owa .introtext {padding:0px 10px 0px 10px; line-height: 25px;}  
 
 
/* WIZARD */  
 
.owa_wizard {}  
.owa_wizardNextText {text-align:left; font-size:20px;}  
 
/* FORMATING */  
.owa_largeFormField { font-size:18px;}  
.active_wizard_step {background-color:orange; color:#ffffff;border:1px solid #9f9f9f; padding:5px; font-weight:bold; font-size:16px;}  
.wizard_step {font-weight:bold; font-size:16px;}  
.visitor_info_box {width:40px; height:40px; text-align:center; padding:7px;}  
.owa_visitSummaryLeftCol {width:auto;}  
.owa_visitSummaryRightCol {padding-left:15px;width:auto; vertical-align: top;}  
.visit_icon {width:40px;}  
.comments_info_box {  
padding:4px 4px 4px 4px;  
border:solid 0px #999999;  
margin:0px 2px 2px 2px;  
width:40px;  
height:40px;  
background-image: url('<?=$this->makeImageLink('comment_background.jpg');?>');  
background-repeat: no-repeat;  
text-align:center;  
}  
.visit_summary {width:100%;}  
.date_box {padding:4px; border:solid 1px #999999;margin:2px;}  
.pages_box {padding:5px; border:solid 2px #999999; margin:0px 0px 0px 0px; text-align:center;}  
.large_number {font-size:24px; font-weight:bold;}  
.info_text {color:#999999;font-size:12px;}  
.legend_link {color:#999999;font-size:12px;font-weight:normal;}  
.legend_link a {text-decoration:underline;}  
.centered_buttons {margin-left:auto;margin-right:auto;}  
.snippet_text {color:;font-size:12px;}  
.snippet_text a {color:#999999;}  
.snippet_anchor {font-size:14px;font-weight:bold;}  
.visit_box_stat {width:42px;}  
.nav_bar{text-decoration:none;}  
.id_box{background-color:green;color:#ffffff;font-style:bold;font-size:18px;padding:6px;}  
.code {padding:7px;margin:0px 30px 0px 30px;background-color:; border: 1px dashed blue; font-size:10px;}  
.top_level_nav_link{padding:0px 5px 0px 5px; font-size:22px;}  
.visible {display:;}  
.invisible {display:none;}  
 
.owa .error, .owa .status {  
color: #ffffff;  
border: 2px solid #FF0000;  
margin:20px 40px 20px 40px;  
padding: 20px 10px 20px 20px;  
background-color: #FF4040;  
font-size: 14px;  
font-weight:;  
-moz-border-radius:5px 5px 5px 5px;  
-moz-box-shadow:2px 2px 2px 1px #9f9f9f;  
border-radius:5px 5px 5px 5px;  
box-shadow:2px 2px 2px 1px #9f9f9f;  
-webkit-border-radius:5px 5px 5px 5px;  
-webkit-box-shadow:2px 2px 2px 1px #9f9f9f;  
}  
 
.owa .status {  
background-color: #71ad2b;  
border-color: #519600;  
color: #FFFFFF;  
}  
 
.tiny_icon{width:10px;padding-left:0px;}  
.wrap {margin:0px;padding:10px;}  
.validation_error {color:red;}  
 
/* Admin Settings */  
.setting {padding:5px;border:1px solid #cccccc; margin:10px;}  
.setting .description {border:0px solid #cccccc; font-size:12px; padding: 2px 0 2px 0;}  
.setting .title {font-weight:bold; font-size:16px; padding: 2px 0 2px 0;}  
.setting .field {padding: 2px 0 2px 0;}  
 
/* LAYOUT */  
#admin_nav{font-size:12px;}  
#keywords{width:400px;}  
#side_bar {width:auto; color: ; border-right: 0px solid #000000; padding: 5px; background-color: ; font-size: 12px;}  
#login_box {  
-moz-border-radius:10px 10px 10px 10px;  
border-radius:10px 10px 10px 10px;  
-webkit-border-radius:10px 10px 10px 10px;  
background-color: #494444;  
}  
 
/* ROUNDER CORNERS */  
.spiffy{display:block;}  
.spiffy *{  
display:block;  
height:1px;  
overflow:hidden;  
font-size:.01em;  
background:#494444}  
.spiffy1{  
margin-left:3px;  
margin-right:3px;  
padding-left:1px;  
padding-right:1px;  
border-left:1px solid #b0aeae;  
border-right:1px solid #b0aeae;  
background:#767272}  
.spiffy2{  
margin-left:1px;  
margin-right:1px;  
padding-right:1px;  
padding-left:1px;  
border-left:1px solid #ececec;  
border-right:1px solid #ececec;  
background:#6b6767}  
.spiffy3{  
margin-left:1px;  
margin-right:1px;  
border-left:1px solid #6b6767;  
border-right:1px solid #6b6767;}  
.spiffy4{  
border-left:1px solid #b0aeae;  
border-right:1px solid #b0aeae}  
.spiffy5{  
border-left:1px solid #767272;  
border-right:1px solid #767272}  
.spiffyfg{  
background:#494444;}  
 
.owa div.goal-detail {  
display: none;  
padding:20px;  
}  
 
.owa span.optional {  
 
font-size: 10px;  
color: #9f9f9f;  
}  
 
.owa .formInstructions {  
font-size: 10px;  
color: #505050;  
 
font-weight: normal;  
}  
 
 
 
</style>  
<div class="owa_dimensionDetail" id="">  
 
<div class="icon" style="float:left;">  
<img src="<?php echo $this->getBrowserIcon($properties['browser_family']);?>">  
</div>  
<div>  
<div class="title">  
<?php $this->out($properties['browser_family'], true, true); ?>  
</div>  
 
</div>  
<div style="clear:both;"></div>  
 
</div>  
<div class="owa_dimensionDetail refererDetailPanel" id="">  
<div class="icon" style="float:left;">  
<img src="<?php echo $this->makeImageLink('base/i/referral_icon_64.png'); ?>">  
</div>  
<div>  
<div class="title">  
<?php  
if ($properties['page_title']) {  
$this->out($properties['page_title'], true, true);  
} else {  
$this->out('No Title', false);  
}  
?>  
</div>  
<div class="url">  
<?php $this->out($properties['url']);?> &nbsp; <span class="moreLink"><a href="<?php $this->out( $properties['url'] );?>">Visit Site &raquo;</a></span>  
</div>  
<div class="snippet"><?php $this->out($properties['snippet'], false);?></div>  
</div>  
<div style="clear:both;"></div>  
</div>  
<span class="inline_h2">The form that you completed had some errors:</span>  
<UL>  
<?php foreach ($validation_errors as $k => $v): ?>  
<LI><?php echo $v;?></LI>  
<?php endforeach;?>  
</UL>  
<div id="owa_reportPeriodControl">  
 
<table id="owa_reportPeriodLabelContainer" cellpadding="0" cellspacing="0">  
<TR>  
<TD class="owa_reportPeriodLabelText">  
<span><?php $this->out( $this->get( 'period_label' ) );?><?php $this->out( $this->get( 'date_label' ) );?></span>  
</TD>  
<TD class="owa_reportRevealControl"></TD>  
</TR>  
</table>  
 
<table id="owa_reportPeriodFiltersContainer" style="display:none;" cellpadding="0" cellspacing="0">  
<TR>  
<TH>  
Enter a Date Range:  
</TH>  
</TR>  
<TR>  
<TD>  
<input type="text" id="owa_report-datepicker-start" size="10"> to <input type="text" id="owa_report-datepicker-end" size="10">  
</TD>  
</TR>  
<TR>  
<TH colspan="2">  
Or choose a predefined date range below:  
</TH>  
</TR>  
<TR>  
<TD colspan="2">  
<SELECT id="owa_reportPeriodFilter" name="owa_reportPeriodFilter">  
<?php foreach ($reporting_periods as $reporting_period => $value):?>  
<OPTION VALUE="<?php echo $reporting_period;?>" <?php if ($params['period'] == $reporting_period): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
</TR>  
<TR>  
<TD colspan="2"><INPUT type="submit" id="owa_reportPeriodFilterSubmit" name="" value="Change Date Period"></TD>  
</TR>  
</table>  
</div>  
<div id="owa_reportSiteFilter" style="line-height:30px;">  
 
<div style="float:left;">  
<span>Web Site:</span>  
<SELECT name="owa_reportSiteFilterSelect" id="owa_reportSiteFilterSelect" style="width:auto;height:auto;">  
<?php foreach ($sites as $site => $value):?>  
<OPTION VALUE="<?php $this->out($value['site_id'], false);?>" <?php if ($params['siteId'] === $value['site_id']):?>selected="selected" selected <?php endif; ?>><?php $this->out( $value['name'] );?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</div>  
&nbsp  
<span class="genericHorizontalList" style="font-size:12px;float:left;vertical-align:middle;">  
<ul>  
<LI>  
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesProfile', 'siteId' => $params['siteId'], 'edit' => true ) );?>">Settings</a>  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink( array('do' => 'base.optionsGoals', 'siteId' => $params['siteId'] ) );?>">Goals</a>  
</LI>  
</ul>  
</span>  
<div style="clear:both;"></div>  
</div>  
<div class="owa_footer" style="text-align:center">  
<span class="inline_h4"><a href="http://www.openwebanalytics.com">Web Analytics</a> powered by <a href="http://www.openwebanalytics.com">Open Web Analytics</a> - v: <?php echo OWA_VERSION;?></span>  
</div>  
<input type="hidden" name="{g->formVar var="controller"}" value="owa.owaControl"/>  
{$owa.content}  
<div class=""><?php echo $error_msg;?></div>  
 
<?php if (!empty($rows)): ?>  
 
<script>  
 
jQuery(document).ready(function() {  
jQuery("#<?php echo $table_id;?>").tablesorter();  
});  
 
</script>  
 
<table class="<?php echo $sort_table_class;?> <?php echo $table_class;?>" summary="" id="<?php echo $table_id;?>">  
<?php if (!empty($caption)): ?>  
<caption><?php echo $caption;?></caption>  
<?php endif;?>  
<thead>  
<TR>  
<?php if (!empty($labels)):?>  
<?php foreach ($labels as $label): ?>  
<TH scope="<?php echo $th_scope;?>"><?php echo $label;?></TH>  
<?php endforeach;?>  
<?php endif;?>  
</TR>  
</thead>  
<?php if (!empty($table_footer)): ?>  
<tfoot>  
<td colspan="<?php echo $col_count;?>"><?php echo $table_footer;?></td>  
</tfoot>  
<?php endif;?>  
<tbody>  
<?php foreach ($rows as $row):?>  
<TR>  
<?php if (!empty($table_row_template)): ?>  
<?php include($this->setTemplate($table_row_template));?>  
<?php else: ?>  
<?php foreach ($row as $item): ?>  
<TD><?php echo $item;?></TD>  
<?php endforeach;?>  
<?php endif;?>  
</TR>  
<?php endforeach;?>  
</tbody>  
</table>  
 
<?php else: ?>  
<?php if ($show_error):?>  
<div class="owa_status-msg">No data to display.</div>  
<?php endif;?>  
<?php endif;?>  
<!-- HEAD Elements -->  
<?php if(!empty($css)): ?>  
<?php foreach ($css as $cssfile): ?>  
<LINK REL=StyleSheet HREF="<?php echo $cssfile;?>" TYPE="text/css">  
<?php endforeach; ?>  
<?php endif;?>  
 
<?php if(!empty($js)): ?>  
<?php foreach ($js as $jsfile): ?>  
<?php if ($jsfile['ie_only']):?>  
<!--[if IE]><script language="javascript" type="text/javascript" src="<?php echo $jsfile['url'];?>"></script><![endif]-->  
<?php else: ?>  
<script type="text/javascript" src="<?php echo $jsfile['url'];?>"></script>  
<?php endif;?>  
<?php endforeach; ?>  
<?php endif;?>  
 
<script>  
<?php include('config_dom.tpl'); ?>  
</script>  
 
 
<!-- END HEAD -->  
<div id="owa_header">  
 
<span class="owa_logo"><img src="<?php echo $this->makeImageLink('base/i/owa-logo-100w.png'); ?>" alt="Open Web Analytics"></span>  
&nbsp  
<span class="owa_navigation">  
<UL>  
<LI><a href="<?php echo $this->makeLink(array('do' => 'base.reportDashboard'), true);?>">Reports</a></LI>  
<LI><a href="<?php echo $this->makeLink(array('do' => 'base.optionsGeneral'));?>">Administration</a></LI>  
<LI><a href="http://wiki.openwebanalytics.com">Help</a></LI>  
<LI><a href="http://trac.openwebanalytics.com">Report a Bug</a></LI>  
 
</UL>  
</span>  
<?php $cu = $this->getCurrentUser(); ?>  
<span class="user-greating" style="">  
Hi, <?php $this->out( $cu->getUserData('user_id') );?> ! &bull;  
<?php if ( ! owa_coreAPI::getSetting( 'base', 'is_embedded' ) ):?>  
 
<?php if (owa_coreAPI::isCurrentUserAuthenticated()):?>  
<a class="login" href="<?php echo $this->makeLink(array('do' => 'base.logout'), false);?>">Logout</a>  
<?php else:?>  
<a class="login" href="<?php echo $this->makeLink(array('do' => 'base.loginForm'), false);?>">Login</a>  
<?php endif;?>  
 
<?php endif;?>  
</span>  
<div class="post-nav"></div>  
<?php if (!empty($service_msg)): ?>  
<div class="owa_headerServiceMsg"><?php echo $service_msg; ?></div>  
<?php endif;?>  
 
<?php $this->headerActions(); ?>  
 
</div>  
<?php  
// ...  
?>  
<div style="width:800px; margin: 0px auto -1px auto;">  
<div class="" style="text-align:center;">  
<h1>Open Web Analytics Installer</h1>  
</div>  
<br>  
<div class="layout_subview" valign="top" style="text-align:left;"><?php echo $subview;?></div>  
 
</div>  
 
<!-- <div class="panel_headline"><?php //echo $headline;?></div> -->  
 
<h2>Uh-oh. We found a few issues.</h2>  
 
<p>We found a few problems with your server environment. Please resolve these issues and start the installation again.</p>  
 
<style>  
.form-row {border-bottom:1px solid #efefef;padding:10px;}  
.form-label {position: inherit;}  
.form-field {position: absolute; left: 420px;}  
.form-error {background-color: red; border:1px solid red; color:#ffffff; padding:3px;}  
.form-instructions {position: absolute; left: 650px; font-size:12px; color: #9f9f9f;}  
</style>  
 
<h3>Problems</h3>  
<?php foreach ($errors as $error): ?>  
<p class="form-row">  
<span class="form-label"><?php echo $error['name'];?></span>  
<span class="form-field form-error"><?php echo $error['value'];?></span>  
<span class="form-instructions"><?php echo $error['msg'];?></span>  
</p>  
<?php endforeach; ?>  
 
<h2>Configuration Settings</h2>  
<p>  
We could not locate OWA's <code>owa-config.php</code> configuration file. You can use the form below to create the file but this may not work on all hosts. If file generation fails, you can just create it manually by renaming <code>owa-config-dist.php</code> to <code>owa-config.php</code> and filling in your database information and public URL.  
</p>  
<div id="configSettings">  
<form method="POST">  
 
<h3>Web URL of OWA</h3>  
<p class="form-row">  
<span class="form-label">URL of OWA:</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>public_url" value="<?php echo $config['public_url'];?>">  
</span>  
<span class="form-instructions">This is the web URL of OWA's base directory.</span>  
</p>  
 
<h3>Database</h3>  
<p class="form-row">  
<span class="form-label">Database Type:</span>  
<span class="form-field">  
<select name="<?php echo $this->getNs();?>db_type">  
<option value="mysql">Mysql</option>  
</select>  
</span>  
<span class="form-instructions">This is the type of database you are going to use.</span>  
</p>  
 
<p class="form-row">  
<span class="form-label">Database Host:</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>db_host" value="<?php echo $config['db_host'];?>">  
</span>  
<span class="form-instructions">This is the host that your database resides on. Localhost is ok.</span>  
</p>  
 
<p class="form-row">  
<span class="form-label">Database Name:</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>db_name" value="<?php echo $config['db_name'];?>">  
</span>  
<span class="form-instructions">This is the name of the database to install tables into.</span>  
</p>  
 
<p class="form-row">  
<span class="form-label">Database User:</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>db_user" value="<?php echo $config['db_user'];?>">  
</span>  
<span class="form-instructions">This is the user name to connect to the database.</span>  
</p>  
 
<p class="form-row">  
<span class="form-label">Database Password:</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>db_password" value="<?php echo $config['db_password'];?>">  
</span>  
<span class="form-instructions">This is the password to connect to the database.</span>  
</p>  
<p>  
<?php echo $this->createNonceFormField('base.installConfig');?>  
<input type="hidden" value="base.installConfig" name="<?php echo $this->getNs();?>action">  
<input class="owa-button"type="submit" value="Continue..." name="<?php echo $this->getNs();?>save_button">  
<p>  
 
</form>  
 
</div>  
<h2>Default Site & User Information</h2>  
<div id="configSettings">  
<form method="POST">  
 
<p class="form-row">  
<span class="form-label">Site Domain</span>  
<span class="form-field">  
<select name="<?php echo $this->getNs();?>protocol">  
<option value="http://">http://</option>  
<option value="https://">https://</option>  
</select>  
<input type="text"size="30" name="<?php echo $this->getNs();?>domain" value="<?php echo $defaults['domain'];?>">  
</span>  
<span class="form-instructions">This is the domain of the site to track.</span>  
</p>  
 
<p class="form-row">  
<span class="form-label">Your E-mail Address</span>  
<span class="form-field">  
<input type="text"size="30" name="<?php echo $this->getNs();?>email_address" value="<?php echo $defaults['email_address'];?>">  
</span>  
<span class="form-instructions">This is the e-mail address of the admin user.</span>  
</p>  
 
<p>  
<?php echo $this->createNonceFormField('base.installBase');?>  
<input type="hidden" value="base.installBase" name="<?php echo $this->getNs();?>action">  
<input class="owa-button" type="submit" value="Continue..." name="<?php echo $this->getNs();?>save_button">  
</p>  
 
</form>  
 
</div>  
 
<div class="subview_content">  
 
<h1>Success! That's It. Installation is Complete.</h1>  
<p>Open Web Analytics has been successfully installed. Login using the user name and password below and generate a tracker.</p>  
<p class="form-row">  
<span class="form-label">User Name:</span>  
<span class="form-field"><?php echo $u;?></span>  
</p>  
<p class="form-row">  
<span class="form-label">Password:</span>  
<span class="form-field"><?php echo $p;?></span>  
<span class="form-instructions">Be sure to change this password.</span>  
</p>  
<BR>  
<p>  
<a href="<?php echo $this->makeLink(array("action" => "base.sitesInvocation", "siteId" => $site_id), false, owa_coreAPI::getSetting('base','public_url'));?>" target="_blank">  
<span class="owa-button">Login and generate a site tracker!</span>  
</a>  
</p>  
</div>  
<div class="subview_content">  
 
<h1>Installation is complete. That's it, you made it!</h1>  
 
<P>From here you can configure OWA's <a href="<?php echo $this->makeLink(array('do' => 'base.optionsGeneral'));?>">settings</a>, or <a href="<?php echo $this->makeLink(array('do' => 'base.reportDashboard'));?>">view your analytics</a>.<P>  
 
 
</div>  
<div class="subview_content">  
 
<h2>Whoops. It looks like OWA is already installed!</h2>  
 
<p>To re-install OWA, drop all owa_ tables run the installer again.</p>  
<BR>  
<p>  
<a href="<?php echo $this->makeLink(array("action" => "base.loginForm"), false, owa_coreAPI::getSetting('base','public_url'));?>">  
<span class="owa-button">Login</span>  
</a>  
</p>  
 
 
</div>  
<div id="panel">  
 
<h2>Welcome to the Installer!</h2>  
 
<P>The next few screens will guide you through installing the Open Web Analytics framework. If at any time you  
need help, please consult the <a href=<?php echo $this->config['wiki_url'];?>>OWA Wiki</a>.</P>  
<BR>  
<p>  
<a href="<?php echo $this->makeLink(array('action' => 'base.installCheckEnv'));?>"><span class="owa-button">Let's Get Started...</span></a>  
</p>  
 
 
 
</div>  
 
<div id="panel">  
 
<h2><?php echo $headline;?></h2>  
 
It looks like the Open Web Analytics database still needs to be installed.  
<BR><BR>  
 
<form method="POST">  
<input type="hidden" name="<?php echo $this->getNs();?>site_id" value="<?php echo $site_id;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>domain" value="<?php echo $domain;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>name" value="<?php echo $name;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>description" value="<?php echo $description;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>do" value="base.installEmbedded">  
 
<input type="hidden" name="<?php echo $this->getNs();?>db_type" value="<?php echo $db_type;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>db_name" value="<?php echo $db_name;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>db_host" value="<?php echo $db_host;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>db_user" value="<?php echo $db_user;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>db_password" value="<?php echo $db_password;?>">  
<input type="hidden" name="<?php echo $this->getNs();?>public_url" value="<?php echo $public_url;?>">  
 
<input type="submit" name="<?php echo $this->getNs();?>submit_btn" value="Install Open Web Analytics">  
 
</form>  
 
 
<BR><BR>  
<P>If at any time you need help, please consult the <a href=<?php echo $this->config['wiki_url'];?>>OWA Wiki</a>.</P>  
 
 
</div>  
 
<fieldset>  
<legend>Javascript</legend>  
<div style="padding:10px;">  
<P>To track page views using Javascript, cut and paste this tracking tag into the HTML of your web pages. Learn more about how to use OWA's <a href="<?php echo $this->makeWikiLink('Javascript_Invocation');?>">Javascript tracking API</a> to track your web site and pages.</P>  
 
<textarea cols="110" rows="18">  
 
 
<?php include('js_log_tag.tpl');?>  
 
</textarea>  
</div>  
</fieldset>  
 
<fieldset>  
<legend>PHP</legend>  
<div style="padding:10px;">  
 
<P>To track page views using PHP, cut and paste the following code to your PHP script/application. Learn more about how to use OWA's <a href="<?php echo $this->makeWikiLink('PHP_Invocation');?>">PHP Tracking API</a> to track your web site and pages.</P>  
 
<textarea cols="75" rows="12">  
 
require_once('<?php echo OWA_BASE_CLASSES_DIR;?>owa_php.php');  
 
$owa = new owa_php();  
// Set the site id you want to track  
$owa->setSiteId('<?php echo $site_id;?>');  
// Uncomment the next line to set your page title  
//$owa->setPageTitle('somepagetitle');  
// Set other page properties  
//$owa->setProperty('foo', 'bar');  
$owa->trackPageView();  
</textarea>  
 
</div>  
</fieldset>  
 
 
<div class="owa_dimensionDetail" id="<?php echo $properties->get('id');?>">  
<div class="icon" style="float:left;">  
<img src="<?php echo $this->makeImageLink('base/i/document_icon_64.png');?>">  
</div>  
<div>  
<div class="title"><?php echo $properties->get('page_title');?></div>  
<div class="url">  
<?php echo $properties->get('url');?> &nbsp; <span class="moreLink"><a href="<?php echo $properties->get('url');?>">Visit Site &raquo;</a></span>  
</div>  
<div class="pagetype"><b>Page Type:</B> <?php echo $properties->get('page_type');?></div>  
</div>  
<div style="clear:both;"></div>  
</div>  
<!-- OWA Helper Tag Tags -->  
<?php if ( $this->getValue( 'first_hit_tag', $options ) ):?>  
<script type="text/javascript">  
//<![CDATA[  
document.write('<img src="<?php echo $this->makeAbsolutelink(array('action' => 'base.processFirstRequest', 'site_id' => $site_id), '', $this->config['action_url']);?>">');  
//]]>  
</script>  
<?php endif;?>  
 
<?php include($this->getTemplatePath('base','js_log_tag.tpl')); ?>  
<?php if ( isset($options) && ! $this->getValue( 'no_script_wrapper', $options ) ): ?>  
<!-- Start Open Web Analytics Tracker -->  
<script type="text/javascript">  
//<![CDATA[  
<?php endif;?>  
var owa_baseUrl = '<?php $this->out( owa_coreAPI::getSetting( 'base', 'public_url' ) ); ?>';  
var owa_cmds = owa_cmds || [];  
<?php if (owa_coreAPI::getSetting('base', 'error_handler') === 'development'): ?>  
owa_cmds.push(['setDebug', true]);  
<?php endif;?>  
<?php if ( isset($options) && $this->getValue('apiEndpoint', $options ) ): ?>  
owa_cmds.push(['setApiEndpoint', '<?php echo $options['apiEndpoint'];?>']);  
<?php endif;?>  
owa_cmds.push(['setSiteId', '<?php echo $site_id; ?>']);  
<?php if ( isset($options) && $this->getValue( 'cmds', $options ) ): ?>  
<?php $this->out($this->getValue( 'cmds', $options ), false ); ?>  
<?php endif;?>  
<?php if (isset($options) && ! $this->getValue('do_not_log_pageview', $options ) ): ?>  
owa_cmds.push(['trackPageView']);  
<?php endif;?>  
<?php if (isset($options) && ! $this->getValue('do_not_log_clicks', $options ) ): ?>  
owa_cmds.push(['trackClicks']);  
<?php endif;?>  
<?php if (isset($options) && ! $this->getValue('do_not_log_domstream', $options ) ): ?>  
owa_cmds.push(['trackDomStream']);  
<?php endif;?>  
 
(function() {  
var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;  
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );  
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';  
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);  
}());  
<?php if ( isset($options) && ! $this->getValue( 'no_script_wrapper', $options ) ): ?>  
//]]>  
</script>  
<!-- End Open Web Analytics Code -->  
<?php endif;?>  
// js includes  
<?php echo $js_includes;?>  
 
// invocation  
<?php //$this->includeTemplate('js_tracker_invocation.php');?>  
<?php include('js_tracker_invocation.php');?>  
var owa_params = new Object();  
owa_params["site_id"] = "<?php echo $site_id;?>";  
 
 
<script type="text/x-jqote-template" id="metricInfobox">  
<![CDATA[  
 
<div class="owa_metricInfobox" style="min-width:135px;width:<*= this.width || 'auto' *>;">  
<p class="owa_metricInfoboxLabel"><*= this.label *></p>  
<p class="owa_metricInfoboxLargeNumber"><*= this.formatted_value *></p>  
<p id='<*= this.dom_id *>-sparkline'></p>  
</div>  
 
]]>  
</script>  
 
<script type="text/x-jqote-template" id="table-column">  
<![CDATA[  
 
<TD class="<*= this.result_type *>cell"><*= this.value *></TD>  
 
]]>  
</script>  
 
<script type="text/x-jqote-template" id="table-row">  
<![CDATA[  
<TR>  
<*= this.columns*>  
</TR>  
]]>  
</script>  
 
<script type="text/x-jqote-template" id="simpleTable-outer">  
<![CDATA[  
 
<table id="<*= this.dom_id *>" class="simpleTable">  
<tr>  
<*= this.headers *>  
</tr>  
</table>  
]]>  
</script>  
 
<script type="text/x-jqote-template" id="simpleTable-headers">  
<![CDATA[  
<th class="<*= this.result_type *>"><*= this.label *></th>  
]]>  
</script>  
 
<script type="text/x-jqote-template" id="attributionCell">  
<![CDATA[  
<b>Atribution <*=(j+1) *>:</b><BR>  
<* if (this.md) { *> <i>Medium:</i> <*= this.md *> -> <* } *>  
<* if (this.sr) { *> <i>Source:</i> <*= this.sr *> -> <* } *>  
<* if (this.cn) { *> <i>Campaign:</i> <*= this.cn *> -> <* } *>  
<* if (this.ad) { *> <i>Ad:</i> <*= this.ad *> -> <* } *>  
<* if (this.at) { *> <i>Ad Type:</i> <*= this.at *> -> <* } *>  
<* if (this.st) { *> <i>Search Terms:</i> <*= this.st *><* } *>  
<br>  
]]>  
</script>  
 
 
<?php echo $json; ?>  
<?php echo $xml;?>  
 
<kml xmlns="http://earth.google.com/kml/2.1">  
<Folder>  
<name>Open Web Analytics Links</name>  
<visibility>1</visibility>  
<open>1</open>  
<description>These are network links for OWA.</description>  
<NetworkLink>  
<name><?php echo $site_name;?></name>  
<visibility>1</visibility>  
<open>0</open>  
<description>Visits for <?php echo $period_label;?><?php echo $date_label;?></description>  
<refreshVisibility>0</refreshVisibility>  
<flyToView>1</flyToView>  
<Link>  
<href><?php echo $this->makeAbsoluteLink(array('do' => 'base.kmlVisitsGeolocation', 'rand' => rand()), true, '', true);?></href>  
</Link>  
</NetworkLink>  
</Folder>  
</kml>  
<?php echo $xml;?>  
 
<kml xmlns="http://earth.google.com/kml/2.1">  
<Document>  
<name>OWA: Visits to <?php echo $site_name;?></name>  
<description>Site visits for <?php echo $period_label;?><?php echo $date_label;?></description>  
<?php if ($visits):?>  
<?php foreach ($visits as $visit):?>  
<Placemark id="<?php echo $visit['session_id'];?>">  
<name><?php echo $visit['host_host'];?> - <?php echo $visit['session_month'];?>/<?php echo $visit['session_day'];?> at <?php echo $visit['session_hour'];?>:<?php echo $visit['session_minute'];?></name>  
<description><![CDATA[<? include('report_visit_summary_balloon.tpl');?>]]></description>  
<Point>  
<coordinates><?php echo trim($visit['host_longitude']);?>,<?php echo trim($visit['host_latitude']);?>,5000</coordinates>  
</Point>  
<styleUrl>#defaultStyle</styleUrl>  
</Placemark>  
<?php endforeach;?>  
<?php endif; ?>  
</Document>  
</kml>  
<div style="width:340px; margin: 0px auto -1px auto;">  
<div class="inline_h1" style="text-align:left;">Login</div><BR>  
 
<div style="width:340px; margin: 0px auto -1px auto; text-align:center;">  
 
<!-- content goes here -->  
<DIV id="login_box" style="color:#ffffff; padding:45px; height:210px; text-align:left;" >  
 
<form method="POST">  
 
<div class="inline_h3"><B>User Name:</B></div>  
<INPUT class="owa_largeFormField" type="text" size="20" name="<?php echo $this->getNs();?>user_id" value="<?php echo $user_id;?>"><BR><BR>  
<div class="inline_h3"><B>Password:</B></div>  
<INPUT class="owa_largeFormField" type="password" size="20" name="<?php echo $this->getNs();?>password"><BR><BR>  
<input type="hidden" size="70" name="<?php echo $this->getNs();?>go" value="<?php echo $go?>">  
<input name="<?php echo $this->getNs();?>action" value="base.login" type="hidden">  
<div style="text-align:;">  
<INPUT class="owa_largeFormField" type="submit" name="<?php echo $this->getNs();?>submit_btn" value="Login">  
</div>  
</form>  
 
</DIV>  
 
</div>  
 
 
<BR>  
<span class="info_text">  
<a href="<?php echo $this->makeLink(array('do' => 'base.passwordResetForm'))?>">Forgot your password?</a>  
</span>  
</div>  
 
 
 
 
<?php if(!empty($this->config['google_maps_api_key'])):?>  
 
<div class="owa_map-container">  
<img align="bottom" src="<?php echo $this->makeImageLink('kml_feed_small.png');?>"> <a class="owa_map-type-control" maptype="earth" href="#">View in Google Earth</a><BR><BR>  
<div id="map" class="jmap" style="width: 100%; height: 500px"></div>  
</div>  
<script>  
 
OWA.items['map'] = new OWA.map();  
OWA.items['map'].dom_id = 'map';  
<?php foreach($latest_visits->resultsRows as $k => $visit): ?>  
<?php if (!empty($visit['host_longitude'])):?>  
OWA.items['map'].markers[<?php echo $k;?>] = {pointLatLng: [<?php echo trim($visit['host_latitude']);?>, <?php echo trim($visit['host_longitude']);?>], pointHTML: '<?php echo preg_replace("/[\n\r]/", '', $this->subTemplate('report_visit_summary_balloon.tpl', array('visit' => $visit)));?>'};  
<?php endif;?>  
<?php endforeach;?>  
OWA.items['map'].placeMarkers();  
 
</script>  
 
<?php else:?>  
 
<div class="error">  
You must have a Google Maps API Key to use this feature. Google provides this key for free at <a href="http://www.google.com/apis/maps/signup.html" target="_blank">this Google web site</a>. Once you obtain a key enter in on the <a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile', 'site_id' => $site_id));?>">profile page for this tracked web site</a>.  
</div>  
 
<?php endif;?>  
 
 
<div id="<?php echo $dom_id;?>" class="owa_metricInfobox">  
<p class="owa_metricInfoboxLabel"><?php echo $count->getlabel($count->aggregates[$metric_name]['name']);?></p>  
<p class="owa_metricInfoboxLargeNumber"><?php echo $count->aggregates[$metric_name]['value'];?></p>  
<p><?php echo $this->displaySeriesAsSparkline($count->aggregates[$metric_name]['name'], $trend, $dom_id);?></p>  
</div>  
<?php if(!empty($status_msg)):?>  
<DIV class="status"><?php echo $status_msg;?></div>  
<?php endif;?>  
 
<?php if (isset($error_msg)):?>  
<DIV class="error"><?php echo $error_msg;?></DIV>  
<?php endif;?>  
 
<H1>New Visit to <?php echo $site['domain'];?> from:</H1>  
 
Visitor: <?php echo $session['visitor_id'];?><BR>  
Email or Username: <?php echo $session['user_email'];?> | <?php echo $session['user_name'];?><BR>  
Host: <?php echo $session['host'];?><BR>  
City/Country: <?php echo $session['city'];?> <?php echo $session['country'];?><BR>  
Entry page: <?php echo $session['page_title'];?> (<?php echo $session['page_url'];?>)<BR>  
 
New Visit to <?php echo $site['domain'];?> from:  
 
Visitor: <?php echo $session['visitor_id'];?>  
Email or Username: <?php echo $session['user_email'];?> | <?php echo $session['user_name'];?>  
Host: <?php echo $session['host'];?>  
City/Country: <?php echo $session['city'];?> <?php echo $session['country'];?>  
Entry page: <?php echo $session['page_title'];?> (<?php echo $session['page_url'];?>)  
 
<?php if ($news):?>  
<DIV style="text-align:left;">  
<?php foreach ($news['items'] as $item => $value): ?>  
<span class="info_text"><?php echo $value['pubDate'];?></span><BR>  
<a href="<?php echo $value['link'];?>"><span class="h_label"><?php echo $value['title'];?></span></a>  
<P><?php echo $value['description'];?></P>  
<?php endforeach;?>  
</DIV>  
<?php endif;?>  
<?php echo $this->ofc($this->makeAbsoluteLink(array('do' => $widget, 'period' => $params['period'], 'site_id' => $params['site_id'], 'format' => 'graphData'), true), true, $dom_id, $this->config['action_url']); ?>  
 
<div class="section">  
 
<table id="layout_panels" class="layout_panels" cellpadding="0" cellspacing="0">  
<TR>  
<TD colspan="2" class="headline">  
<?php $this->out( $headline );?>  
</TD>  
</TR>  
<TR>  
<TD colspan="2" class="introtext">  
<P>Open Web Analytics has several configuration options that can be set using the controls below. Once changes are made click the save button to save the configuration to the database. To learn more about configuring OWA, visit the <a href="http://wiki.openwebanalytics.com">OWA Wiki</a></P>  
</TD>  
</TR>  
<TR>  
<TD valign="top" id="nav_left">  
 
<?php foreach ($panels as $group => $items):?>  
 
<H4><?php echo $group;?></H4>  
<UL>  
<?php foreach ($items as $k => $v):?>  
<LI><a href="<?php echo $this->makeLink(array('do' => $v['do']));?>"><?php echo $v['anchortext'];?></a></LI>  
<?php endforeach;?>  
</UL>  
<?php endforeach;?>  
</TD>  
<TD class="layout_subview"><?php echo $subview;?></TD>  
</TR>  
 
</table>  
</div>  
 
<h2><?php echo $headline?></h2>  
 
<form method="post">  
 
<fieldset name="owa-db-options" class="options">  
<legend>Database Options</legend>  
 
<DIV class="setting">  
Asynchronous Event Handling Mode:  
<SELECT NAME="async_db">  
 
<OPTION VALUE="0" <?php if ($config['async_db'] == false):?>SELECTED<?php endif;?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['async_db'] == true):?>SELECTED<?php endif;?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
 
<DIV class="setting">  
 
Event Log File Directory: <input type="text" size="80" name="async_log_dir" value="<?php echo $config['async_log_dir']?>"><BR>  
 
</DIV>  
 
<DIV class="setting">  
 
Event Log File Name: <input type="text" name="async_log_file" value="<?php echo $config['async_log_file']?>"><BR>  
 
</DIV>  
 
</fieldset>  
 
<BR>  
 
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsUpdate">Update Configuration</BUTTON>  
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsReset">Reset to Default Values</BUTTON>  
 
</form>  
 
<h2><?php echo $headline;?></h2>  
 
<form method="post">  
 
<fieldset name="owa-error-options" class="options">  
<legend>Error Logging</legend>  
 
<DIV class="setting">  
Logging Mode:  
<SELECT NAME="<?php echo $this->getNs();?>config[error_handler]">  
 
<OPTION VALUE="production" <?php if ($config['error_handler'] == 'production'):?>SELECTED<?php endif;?>>  
Production (Errors logged to file)</OPTION>  
<OPTION VALUE="development" <?php if ($config['error_handler'] == 'development'):?>SELECTED<?php endif;?>>  
Development (Debug and Error messages logged to file)</OPTION>  
</SELECT>  
 
</DIV>  
 
</fieldset>  
 
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsUpdate">Update Configuration</BUTTON>  
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsReset">Reset to Default Values</BUTTON>  
</form>  
<div class="panel_headline"><?php echo $headline?></div>  
 
<div class="subview_content">  
 
<form method="post" name="owa_options">  
 
<fieldset name="owa-options" class="options">  
<legend>Request Processing Options</legend>  
 
<div class="setting" id="resolve_hosts">  
<div class="title">Resolve Host Names</div>  
<div class="description">Controls the resolution of host names (e.g. verizon.com) from visitor's raw IP addresses.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.resolve_hosts]">  
<option value="0" <?php if ($config['resolve_hosts'] == false):?>SELECTED<?php endif;?>>Off</option>  
<option value="1" <?php if ($config['resolve_hosts'] == true):?>SELECTED<?php endif;?>>On</option>  
</select>  
</div>  
</div>  
 
<div class="setting" id="log_feedreaders">  
<div class="title">Log Requests From Feed Readers</div>  
<div class="description">Controls the logging of page requests made by Feed Readers. This setting must be enabled in order to compile statistics about your site's feeds.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.log_feedreaders]">  
<option value="0" <?php if ($config['log_feedreaders'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<option value="1" <?php if ($config['log_feedreaders'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</select>  
</div>  
</div>  
 
<div class="setting" id="log_robots">  
<div class="title">Log Requests From Known Robots</div>  
<div class="description">Controls the logging of page requests made by known robots and spiders. Turning this feature on will dramatically increase the number of requests that are processed and logged.</div>  
<div class="field">  
<SELECT NAME="<?php echo $this->getNs();?>config[base.log_robots]">  
<OPTION VALUE="0" <?php if ($config['log_robots'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<OPTION VALUE="1" <?php if ($config['log_robots'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</SELECT>  
</div>  
</div>  
 
<div class="setting" id="log_named_users">  
<div class="title">Log Requests From Named Users</div>  
<div class="description">Controls the logging of requests made by named users.</div>  
<div class="field">  
<SELECT NAME="<?php echo $this->getNs();?>config[base.log_named_users]">  
<OPTION VALUE="0" <?php if ($config['log_named_users'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<OPTION VALUE="1" <?php if ($config['log_named_users'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</SELECT>  
</div>  
</div>  
 
 
 
<div class="setting" id="fetch_refering_page_info">  
<div class="title">Fetch Referring Web Page Info</div>  
<div class="description">Controls whether OWA should crawl the web pages that refer visitors to your web site and extract descriptive meta-data that will be used in reporting.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.fetch_refering_page_info]">  
<option value="0" <?php if ($config['fetch_refering_page_info'] == false):?>SELECTED<?php endif;?>>  
Off</option>  
<option value="1" <?php if ($config['fetch_refering_page_info'] == true):?>SELECTED<?php endif;?>>  
On</option>  
</select>  
</div>  
</div>  
 
<div class="setting" id="first_hit">  
<div class="title">Delay First Hit</div>  
<div class="description">This setting controls whether OWA should delay logging the first hit of new visitors untill a secondary http request for a special web bug is made. This tactic is used to foil spiders/robots that spoof their user agents in an attempt to appear like a normal web browser.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.delay_first_hit]">  
<option value="0" <?php if ($config['delay_first_hit'] == false):?>SELECTED<?php endif;?>>Off</option>  
<option value="1" <?php if ($config['delay_first_hit'] == true):?>SELECTED<?php endif;?>>On</option>  
</select>  
</div>  
</div>  
 
<div class="setting" id="log_dom_streams">  
<div class="title">Log Domstreams</div>  
<div class="description">This setting controls whether OWA should should log Domstreams.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.log_dom_streams]">  
<option value="0" <?php if ($config['log_dom_streams'] == false):?>SELECTED<?php endif;?>>Off</option>  
<option value="1" <?php if ($config['log_dom_streams'] == true):?>SELECTED<?php endif;?>>On</option>  
</select>  
</div>  
</div>  
 
 
<div class="setting" id="p3p_policy">  
<div class="title">P3P Compact Privacy Policy</div>  
<div class="description">This setting controls the P3P compact privacy policy that is returned to the browser when OWA sets cookies. Click <a href="http://www.p3pwriter.com/LRN_111.asp">here</a> for more information on compact privacy policies and choosing the right one for your web site.</div>  
<div class="field"><input type="text" size="50" name="<?php echo $this->getNs();?>config[base.p3p_policy]" value="<?php echo $config['p3p_policy'];?>"></div>  
</div>  
 
<div class="setting" id="url_params">  
<div class="title">URL Parameters</div>  
<div class="description">This setting controls the URL parameters that OWA should ignore when processing requests. This is useful for avoiding duplicate URLs due to the use of tracking or others state parameters in your URLs. Parameter names should be separated by comma.</div>  
<div class="field"><input type="text" size="50" name="<?php echo $this->getNs();?>config[base.query_string_filters]" value="<?php echo $config['query_string_filters'];?>"></div>  
</div>  
 
</fieldset>  
 
<BR>  
 
<fieldset name="owa-options" class="options">  
<legend>Visitor Announcements</legend>  
 
<div class="setting" id="announce_visitors">  
<div class="title">Announce New Visitors Via E-mail</div>  
<div class="description">Announces each new visitor to your web site via e-mail. If you have a lot of visitors then you probably want to keep this feature turned off.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.announce_visitors]">  
<option value="0" <?php if ($config['announce_visitors'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<option value="1" <?php if ($config['announce_visitors'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</select>  
</div>  
</div>  
 
<div class="setting" id="notice_email">  
<div class="title">Notice E-mail Address</div>  
<div class="description">This is the e-mail address that new visitor e-mails will be sent to.</div>  
<div class="field"><input size="50" type="text" name="<?php echo $this->getNs();?>config[base.notice_email]" value="<?php echo $config['notice_email']?>"></div>  
 
</div>  
 
</fieldset>  
 
 
<BR>  
 
<fieldset name="owa-geolocation-options" class="options">  
 
<legend>Geo-location</legend>  
 
<div class="setting" id="geolocation_lookup">  
<div class="title">Perform Geo-location Lookup</div>  
<div class="description">Lookup the geographic location of visitors.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.geolocation_lookup]">  
<option value="0" <?php if ($config['geolocation_lookup'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<option value="1" <?php if ($config['geolocation_lookup'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</select>  
</div>  
</div>  
 
<div class="setting" id="google_maps_api_key">  
<div class="title">Google Maps API Key</div>  
<div class="description">Google maps API key is needed to produce Google maps of visitor geo-locations. You may obtain an API key from <a href="http://www.google.com/apis/maps/signup.html">this Google web site</a> for free.</div>  
<div class="field"><input type="text" size="90" name="<?php echo $this->getNs();?>config[base.google_maps_api_key]" value="<?php echo $config['google_maps_api_key']?>"></div>  
</div>  
 
</fieldset>  
 
<BR>  
 
<fieldset name="owa-feed-options" class="options">  
<legend>Feed Tracking</legend>  
 
<div class="setting" id="feeds">  
<div class="title">Feed Link Tracking</div>  
<div class="description">Adds tracking parameters to RSS or Atom feeds links. This provides a way to track how many visitors come from your feeds.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.track_feed_links]">  
 
<option value="0" <?php if ($config['track_feed_links'] == false):?>SELECTED<?php endif;?>>Off</OPTION>  
<option value="1" <?php if ($config['track_feed_links'] == true):?>SELECTED<?php endif;?>>On</OPTION>  
</select>  
</div>  
</div>  
 
</fieldset>  
 
<BR>  
 
<fieldset name="owa-event-options" class="options">  
<legend>Event Queueing</legend>  
 
<div class="setting" id="async_log_dir">  
<div class="title">Event Log File Directory</div>  
<div class="description">This is the file system path of the file that OWA will write queued events to when Event Queuing mode is turned on. (e.g. /path/to/owa/log/file.txt)</div>  
<div class="field"><input type="text" size="80" name="<?php echo $this->getNs();?>config[base.async_log_dir]" value="<?php echo $config['async_log_dir']?>"></div>  
</div>  
 
</fieldset>  
 
<BR>  
 
 
<fieldset name="owa-cache-options" class="options">  
<legend>Object Cache</legend>  
 
<div class="setting" id="object_cache">  
<div class="title">Cache Control</div>  
<div class="description">Enables and disables object caching. This will improve performance under high load conditions. The object cache can be turned on/off via your config file.  
</div>  
<div class="field">  
Status: <?php if ($config['cache_objects'] == true):?><B>ON</B><?php else:?><B>OFF</B><?php endif;?> </div>  
</div>  
 
<div class="setting" id="object_cache_flush">  
<div class="title">Flush Cache</div>  
<div class="description">Flushes the object cache</div>  
<div class="field">  
 
<a href="<?php echo $this->makeLink(array('do' => 'base.optionsFlushCache')); ?>">Flush Cache Now</a>  
</div>  
</div>  
 
 
</fieldset>  
 
<BR>  
 
<fieldset name="owa-ecommerce-options" class="options">  
 
<legend>e-commerce</legend>  
 
<div class="setting" id="ecommerce_reporting">  
<div class="title">e-commerce Reporting</div>  
<div class="description">Adds e-commerce metrics/statistics to reports.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[base.enableEcommerceReporting]">  
<option value="0" <?php if ($config['enableEcommerceReporting'] == false):?>SELECTED<?php endif;?>>Off</option>  
<option value="1" <?php if ($config['enableEcommerceReporting'] == true):?>SELECTED<?php endif;?>>On</option>  
</select>  
</div>  
</div>  
</fieldset>  
 
<BR>  
 
<?php echo $this->createNonceFormField('base.optionsUpdate');?>  
 
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsUpdate">Update Configuration</BUTTON>  
<input type="hidden" name="<?php echo $this->getNs();?>module" value="base">  
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsReset">Reset Base Module Configuration to Default Values</BUTTON>  
 
</form>  
</div>  
<div class="panel_headline"><?php echo $headline?></div>  
 
<div class="subview_content">  
 
<h3>Goal <?php $this->out($goal_number);?> Settings</h3>  
 
<form name="goal-entry" method="POST">  
 
<table class="management" width="100%">  
<thead>  
 
</thead>  
 
<tbody>  
 
<tr>  
 
<th valign="top">Name:</th>  
<td>  
<input name="<?php echo $this->getNs();?>goal[goal_name]" type="text" size="40" value="<?php $this->out($goal['goal_name']);?>">  
</td>  
</tr>  
<tr>  
<th valign="top">Group:  
<p class="formInstructions">  
The group that you want to assign this goal to. Goal groups are presented as a tab view on most reports.  
</p>  
</th>  
<td>  
 
<select name="<?php echo $this->getNs();?>goal[goal_group]">  
<?php foreach ($goal_groups as $k => $group): ?>  
<option value="<?php $this->out($k, false);?>" <?php if ( isset( $goal['goal_group'] ) && $goal['goal_group'] == $k ) { echo 'SELECTED';}?>><?php  
if ( !empty( $group ) ) {  
$this->out($k." - $group");  
} else {  
$this->out($k);  
}  
?></option>  
<?php endforeach;?>  
</select>  
<BR><BR>Edit the group label:  
 
<input name="<?php echo $this->getNs();?>new_goal_group_name" type="text" size="20" value="<?php $this->out($goal_groups[$goal['goal_group']]);?>">  
</td>  
</tr>  
<tr>  
<th valign="top">Status:</th>  
<td>  
<select name="<?php echo $this->getNs();?>goal[goal_status]">  
<option value="active" <?php if (isset($goal['goal_status']) && $goal['goal_status'] != 'disabled'){echo 'SELECTED';}?>>  
Active  
</option>  
<option value="disabled" <?php if (isset($goal['goal_status']) && $goal['goal_status'] === 'disabled'){echo 'SELECTED';}?>>  
Disabled  
</option>  
</select>  
 
 
</td>  
</tr>  
 
<tr>  
<th valign="top">  
Value:  
<p class="formInstructions">  
The value associated with achieving this goal.  
</p>  
</th>  
<td>  
<input name="<?php echo $this->getNs();?>goal[goal_value]" type="text" size="20" value="<?php $this->out($goal['goal_value']);?>">  
<span class="optional">Optional</span>  
</td>  
</tr>  
 
<tr>  
<th valign="top">  
Type:  
<p class="formInstructions">  
The type of goal.  
</p>  
</th>  
<td>  
<input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="url_destination" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'url_destination'){echo 'CHECKED';}?> > URL Destination<BR>  
 
<input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="pages_per_visit" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'pages_per_visit'){echo 'CHECKED';}?> > Pages / Visit<BR>  
 
<input type="radio" name="<?php echo $this->getNs();?>goal[goal_type]" value="visit_duration" <?php if (isset($goal['goal_type']) && $goal['goal_type'] === 'visit_duration'){echo 'CHECKED';}?> > Visit Duration <BR>  
 
 
</td>  
</tr>  
 
</tbody>  
 
</table>  
 
<!-- URL destination specific options -->  
<div id="url_destination_details" class="goal-detail">  
 
<h3>Goal Details</h3>  
<table class="management">  
<tr>  
<th>Match Type:</th>  
<td>  
<select name="<?php echo $this->getNs();?>goal[details][match_type]">  
<option value="begins" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'begins'){echo 'SELECTED';}?>>  
Begins With  
</option>  
<option value="exact" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'exact'){echo 'SELECTED';}?>>  
Exact Match  
</option>  
<option value="regex" <?php if (isset($goal['details']['match_type']) && $goal['details']['match_type'] === 'regex'){echo 'SELECTED';}?>>  
Regular Expression  
</option>  
</select>  
 
</td>  
</tr>  
<tr>  
<th>  
Goal URL:  
<p class="formInstructions">  
Example: /register.html  
</p>  
</th>  
<td>  
<input name="<?php echo $this->getNs();?>goal[details][goal_url]" value="<?php $this->out($goal['details']['goal_url']);?>" type="text" size="60" value="<?php $this->out($goal['url']);?>">  
</td>  
</tr>  
</table>  
 
<h3>Funnel</h3>  
 
<table class="management" id="funnel-steps">  
<TR>  
<th></th>  
<th>Step URL</th>  
<th>Name</th>  
<th>Is Required?</th>  
<th></th>  
</TR>  
</table>  
<BR>  
<a name="steps-end" href="# steps-end" id="addStep">Add New Funnel Step</a>  
</div>  
 
<!-- pages per visit goal type specific options -->  
<div id="pages_per_visit_details" class="goal-detail">  
<h3>Goal Details</h3>  
Not implemented yet.  
</div>  
 
<!-- visit duration goal type specific options -->  
<div id="visit_duration_details" class="goal-detail">  
<h3>Goal Details</h3>  
Not implemented yet.  
</div>  
 
<input type="hidden" name="<?php echo $this->getNs();?>goal[goal_number]" value="<?php $this->out($goal_number, false);?>">  
<input type="hidden" name="<?php echo $this->getNs();?>siteId" value="<?php $this->out($siteId, false);?>">  
<input type="hidden" name="<?php echo $this->getNs();?>action" value="base.optionsGoalEdit">  
<?php echo $this->createNonceFormField('base.optionsGoalEdit');?>  
<BR>  
<input type="submit" value="Submit">  
</form>  
 
</div>  
 
<script>  
OWA.setSetting('debug', true);  
jQuery(document).ready(function() {  
 
showGoalDetails();  
 
// show hide the right goal type details  
jQuery("input[name='owa_goal[goal_type]']").change(function(e) {  
showGoalDetails();  
});  
 
jQuery('#addStep').click(function() {  
addNewStep();  
});  
 
if (OWA.util.countObjectProperties(steps) > 0) {  
populateGoalSteps();  
}  
});  
 
function showGoalDetails() {  
var val = jQuery("input[name='owa_goal[goal_type]']:checked").val();  
OWA.debug(val);  
jQuery('.goal-detail').hide();  
var selector = '#'+val+'_details';  
OWA.debug(selector);  
jQuery(selector).show();  
}  
 
function populateGoalSteps() {  
OWA.debug('pop');  
for (step in steps) {  
renderStep(steps[step]);  
}  
}  
 
function addNewStep() {  
var count = OWA.util.countObjectProperties(steps);  
OWA.debug('count: '+count);  
var num;  
if (count === 0) {  
num = 1;  
} else {  
num = count + 1;  
}  
 
if (num < 11) {  
 
OWA.debug('num: '+num);  
var empty_step = {step_number: num, is_required: '', name: '', url: ''};  
renderStep(empty_step);  
steps[num] = empty_step;  
} else {  
alert("Sorry but funnels can only have 10 steps.");  
}  
}  
 
function renderStep(step) {  
jQuery('#funnel-steps tr:last').after(jQuery('#funnel-step').jqote(step, '*'));  
}  
 
</script>  
 
<script type="text/x-jqote-template" id="funnel-step">  
<![CDATA[  
<tr>  
<th class="">Step <*= this.step_number *></th>  
<td class=""><input type="text" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][url]" value="<*= this.url *>"></td>  
<td class=""><input type="text" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][name]" value="<*= this.name *>"></td>  
<td class="">  
 
 
<input type="checkbox" size="20" name="owa_goal[details][funnel_steps][<*= this.step_number *>][is_required]" value="true"  
<* if ( this.is_required ) { *>  
CHECKED  
<* } *>  
>  
 
</td>  
 
</tr>  
]]>  
</script>  
 
<script>  
var steps = [];  
<?php if (array_key_exists('funnel_steps', $goal['details'])):?>  
<?php $this->out(sprintf("steps = %s;", json_encode($goal['details']['funnel_steps'])), false); ?>  
<?php endif;?>  
</script>  
<div class="panel_headline"><?php echo $headline?></div>  
 
<div class="subview_content">  
 
<table class="management">  
<thead>  
<tr>  
<th>Goal Number</th>  
<th>Goal Name</th>  
<th>Goal Group</th>  
<th>Goal Type</th>  
<th>Status</th>  
</tr>  
</thead>  
 
<tbody>  
 
<?php foreach ($goals as $k => $goal): ?>  
<tr>  
<td>Goal <?php $this->out($k);?> <a class="" href="<?php echo $this->makeLink(array('do' => 'base.optionsGoalEntry', 'goal_number' => $k, 'siteId' => $siteId));?>">Edit</a></p></td>  
<td><?php $this->out($goal['goal_name']);?></td>  
<td>  
<?php  
if ( isset( $goal['goal_group'] ) ) {  
if ( !empty( $goal_groups[$goal['goal_group']] ) ) {  
$this->out($goal_groups[$goal['goal_group']] );  
} else {  
$this->out( $goal['goal_group'] );  
}  
}  
?>  
</td>  
<td><?php $this->out($goal['goal_type']);?></td>  
<td><?php $this->out($goal['goal_status']);?></td>  
</tr>  
<?php endforeach; ?>  
</tbody>  
 
<tfoot>  
 
</tfoot>  
</table>  
 
</div>  
<div class="panel_headline"><?php echo $headline?></div>  
<div id="panel">  
 
<?php if (!empty($modules)): ?>  
 
<table width="100%" id="module_roster" class="management">  
<thead>  
<TR>  
<TH>Module</TH>  
<th>Current Schema</th>  
<th>Required Schema</th>  
<th>Schema Up to Date?</th>  
<TH></TH>  
</TR>  
</thead>  
<tbody>  
<?php foreach ($modules as $k => $v): ?>  
 
<TR>  
<TD>  
<B><?php echo $v['display_name'];?></B><BR>  
<?php echo $v['description'];?>  
</TD>  
<TD><?php echo $v['current_schema_version'];?></TD>  
<TD><?php echo $v['required_schema_version'];?></TD>  
<TD><?php echo $v['schema_uptodate'];?></TD>  
<TD class="">  
<?php if ($v['name'] != 'base'): ?>  
<?php if (isset($v['status']) && $v['status'] == 'active'): ?>  
<a href="<?php echo $this->makeLink(array('do' => 'base.moduleDeactivate', 'module' => $v['name']));?>">Deactivate</a>  
<?php else: ?>  
<a href="<?php echo $this->makeLink(array('do' => 'base.moduleActivate', 'module' => $v['name']));?>">Activate</a>  
<?php endif; ?>  
<?php endif;?>  
 
</TD>  
</TR>  
 
<?php endforeach; ?>  
</tbody>  
</table>  
 
<?php else: ?>  
 
There are no additional modules installed.  
 
<?php endif;?>  
 
</div>  
<h2><?php echo $headline;?></h2>  
 
<form method="post">  
 
<fieldset name="owa-reports-options" class="options">  
<legend>Reporting</legend>  
 
<DIV class="setting">  
 
Reporting Wrapper: <input type="text" name="<?php echo $this->getNs();?>config[report_wrapper]" value="<?php echo $config['report_wrapper']?>"><BR>  
 
</DIV>  
 
</fieldset>  
 
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsUpdate">Update Configuration</BUTTON>  
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsReset">Reset to Default Values</BUTTON>  
</form>  
<h2><?php echo $headline?></h2>  
 
<form method="post">  
 
<fieldset name="owa-options" class="options">  
<legend>Request Processing Options</legend>  
 
<DIV class="setting">  
Resolve Host Names:  
<SELECT NAME="<?php echo $this->getNs();?>config[resolve_hosts]">  
 
<OPTION VALUE="0" <?php if ($config['resolve_hosts'] == false):?>SELECTED<?php endif; ?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['resolve_hosts'] == true):?>SELECTED<?php endif; ?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
 
<DIV class="setting">  
Log Requests from Feed Readers:  
<SELECT NAME="<?php echo $this->getNs();?>config[log_feedreaders]">  
 
<OPTION VALUE="0" <?php if ($config['log_feedreaders'] == false):?>SELECTED<?php endif; ?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['log_feedreaders'] == true):?>SELECTED<?php endif; ?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
 
<DIV class="setting">  
Log Requests from Known Robots:  
<SELECT NAME="<?php echo $this->getNs();?>config[log_robots]">  
 
<OPTION VALUE="0" <?php if ($config['log_robots'] == false):?>SELECTED<?php endif; ?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['log_robots'] == true):?>SELECTED<?php endif; ?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
 
<DIV class="setting">  
Announce New Visitors via E-mail:  
<SELECT NAME="<?php echo $this->getNs();?>config[announce_visitors]">  
 
<OPTION VALUE="0" <?php if ($config['announce_visitors'] == false):?>SELECTED<?php endif; ?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['announce_visitors'] == true):?>SELECTED<?php endif; ?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
 
<DIV class="setting">  
 
Notice Email Address: <input type="text" name="<?php echo $this->getNs();?>config[notice_email]" value="<?php echo $config['notice_email']?>"><BR>  
 
</DIV>  
 
</fieldset>  
 
<fieldset name="owa-geolocation-options" class="options">  
<legend>Geo-location Options</legend>  
 
<DIV class="setting">  
 
Perform Geo-location Lookup:  
<SELECT NAME="<?php echo $this->getNs();?>config[geolocation_lookup]">  
 
<OPTION VALUE="0" <?php if ($config['geolocation_lookup'] == false):?>SELECTED<?php endif; ?>>  
Off</OPTION>  
 
<OPTION VALUE="1" <?php if ($config['geolocation_lookup'] == true):?>SELECTED<?php endif; ?>>  
On</OPTION>  
 
</SELECT>  
</DIV>  
<DIV class="setting">  
Geolocation Service:  
<SELECT NAME="<?php echo $this->getNs();?>config[geolocation_service]">  
 
<OPTION VALUE="hostip" <?php if ($config['geolocation_service'] == 'hostip'):?>SELECTED<?php endif; ?>>  
Hostip.info Web Service (free)</OPTION>  
 
</SELECT>  
 
</DIV>  
 
</fieldset>  
 
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsUpdate">Update Configuration</BUTTON>  
<BUTTON type="submit" name="<?php echo $this->getNs();?>action" value="base.optionsReset">Reset to Default Values</BUTTON>  
</form>  
<?php echo $img;?>  
<SCRIPT>  
OWA.items['<?php echo $dom_id;?>'] = new OWA.report();  
OWA.items['<?php echo $dom_id;?>'].dom_id = "<?php echo $dom_id;?>";  
OWA.items['<?php echo $dom_id;?>'].page_num = "<?php $this->out( $this->getValue( 'page_num', 'pagination' ),false );?>1";  
OWA.items['<?php echo $dom_id;?>'].max_page_num = "<?php $this->out( $this->getValue( 'max_page_num', 'pagination' ), false );?>";  
OWA.items['<?php echo $dom_id;?>'].max_page_num = "<?php $this->out( $this->getValue( 'more_pages', 'pagination' ), false );?>";  
OWA.items['<?php echo $dom_id;?>'].properties = <?php echo $this->makeJson($params);?>;  
</SCRIPT>  
<div id="<?php echo $dom_id;?>" class="owa_reportContainer">  
 
<table width="100%" cellpadding="0" cellspacing="0">  
 
<TR>  
<TD valign="top" class="owa_reportLeftNavColumn">  
<div class="reportSectionContainer">  
<div id="owa_reportNavPanel">  
<?php echo $this->makeNavigationMenu($top_level_report_nav);?>  
</div>  
</div>  
</TD>  
<TD valign="top" width="*">  
 
<div class="reportSectionContainer" style="margin-bottom:20px;">  
<?php include('filter_site.tpl');?>  
</div>  
 
<div class="reportSectionContainer">  
<div class="owa_reportPeriod" style="float:right;"><?php include('filter_period.tpl');?></div>  
<div class="owa_reportTitle"><?php echo $title;?><span class="titleSuffix"><?php echo $this->get('titleSuffix');?></span></div>  
 
<div class="clear"></div>  
<?php echo $subview;?>  
 
</div>  
</TD>  
</TR>  
</table>  
</div>  
<script>  
OWA.items['<?php echo $dom_id;?>'].showSiteFilter();  
</script>  
 
 
<div class="owa_reportSectionHeader">Action Metrics</div>  
<div class="owa_reportSectionContent">  
 
 
<table cellpadding="0" cellspacing="0" width="100%">  
<tr>  
<td valign="top">  
<?php foreach($aggregates->aggregates as $row):?>  
<div class="owa_metricInfobox">  
<p class="owa_metricInfoboxLabel"><?php echo $row['label'];?></p>  
<p class="owa_metricInfoboxLargeNumber"><?php echo $row['value'];?></p>  
</div>  
<?php endforeach;?>  
</td>  
</tr>  
</table>  
</div>  
 
<div class="owa_reportSectionHeader">Analysis Workbook</div>  
<div id="owa-actions-workbook" class="owa-workbook">  
 
<ul>  
<li><a href="#actionsByLabel">Actions By Label</a></li>  
<li><a href="#actionsByDate">Actions By Date</a></li>  
</ul>  
 
<div id="actionsByLabel" class="owa_reportSectionContent">  
 
 
<div style="width:;" id="actionsByLabelExplorer"></div>  
 
</div>  
 
<div id="actionsByDate" class="owa_reportSectionContent">  
 
<div style="width:;" id="actionsByDateExplorer"></div>  
 
</div>  
 
</div>  
 
<script type="text/javascript">  
jQuery(function() {  
jQuery("#owa-actions-workbook").tabs();  
});  
 
jQuery('#owa-actions-workbook').bind('tabsshow', function(event, ui) {  
 
if (ui.index === 0) {  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'actions,actionsValue',  
'dimensions' => 'actionLabel',  
'sort' => 'actions-',  
'resultsPerPage' => 25,  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId').'actionName=='.$actionName)), true);?>';  
 
rsh = new OWA.resultSetExplorer('actionsByLabelExplorer');  
rsh.load(aurl, 'grid');  
 
}  
 
if (ui.index === 1) {  
 
var aurl2 = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'actions,actionsValue',  
'dimensions' => 'date',  
'sort' => 'date-',  
'resultsPerPage' => 25,  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId').'actionName=='.$actionName)), true);?>';  
 
rsh2 = new OWA.resultSetExplorer('actionsByDateExplorer');  
rsh2.load(aurl2, 'grid');  
}  
 
// Objects available in the function context:  
//ui.tab // anchor element of the selected (clicked) tab  
//ui.panel // element, that contains the selected/clicked tab contents  
//ui.index // zero-based index of the selected (clicked) tab  
 
});  
 
</script>  
 
 
<? include('report_dimensionDetailNoTabs.php');?>  
 
 
<table width="100%">  
<TR>  
<TD valign="top" style="width:50%;">  
<div class="owa_reportSectionContent">  
<div class="section_header">Actions by Name</div>  
<div style="min-width:250px;" id="actionsByNameExplorer"></div>  
<script>  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'actions',  
'dimensions' => 'actionGroup,actionName',  
'sort' => 'actions-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rsh = new OWA.resultSetExplorer('actionsByNameExplorer');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportActionDetail', 'actionName' => '%s', 'actionGroup' => '%s'), true);?>';  
rsh.addLinkToColumn('actionName', link, ['actionName', 'actionGroup']);  
rsh.asyncQueue.push(['refreshGrid']);  
rsh.load(aurl, 'grid');  
</script>  
</div>  
</TD>  
 
<TD valign="top" style="width:50%;">  
<div class="owa_reportSectionContent">  
<div class="section_header">Actions By Group</div>  
<div style="min-width:300px;" id="actionsByGroupExplorer"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'actions',  
'dimensions' => 'actionGroup',  
'sort' => 'actions-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('actionsByGroupExplorer');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportActionGroup', 'actionGroup' => '%s'), true);?>';  
rshre.addLinkToColumn('actionGroup', link, ['actionGroup']);  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
</TD>  
</TR>  
</table>  
 
 
<div class="owa_reportSectionContent">  
<div id="trend-title" class="owa_reportSectionHeader"></div>  
<div id="trend-chart"></div><BR>  
<div id="trend-metrics" style="height:auto;width:auto;"></div>  
<div style="clear:both;"></div>  
<script>  
 
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.options.sparkline.metric = 'visits';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
trend.load(trendurl);  
 
</script>  
 
</div>  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Top Inbound Link Text</div>  
<div id="dimension-grid"></div>  
 
<script>  
var dimurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => $dimensions,  
'sort' => $sort,  
'resultsPerPage' => $resultsPerPage,  
'format' => 'json',  
),true);?>';  
 
var dim = new OWA.resultSetExplorer('dimension-grid');  
 
<?php if (!empty($dimensionLink)):?>  
var link = '<?php echo $this->makeLink($dimensionLink['template'], true);?>';  
dim.addLinkToColumn('<?php echo $dimensionLink['linkColumn'];?>', link, ['<?php echo $dimensionLink['valueColumns'];?>']);  
<?php endif; ?>  
dim.asyncQueue.push(['refreshGrid']);  
dim.load(dimurl);  
</script>  
 
</div>  
 
<script type="text/x-jqote-template" id="metricInfobox">  
<![CDATA[  
 
<div class="owa_metricInfobox">  
<p class="owa_metricInfoboxLabel"><%= this.label %></p>  
<p class="owa_metricInfoboxLargeNumber"><%= this.value %></p>  
<p id='<%= this.dom_id %>-sparkline'></p>  
</div>  
 
]]>  
</script>  
 
<div class="owa_reportSectionContent">  
<div id="trend-chart" style="height:125px;width:auto;"></div>  
<div class="owa_reportHeadline" id="content-headline"></div>  
<div id="trend-metrics"></div>  
</div>  
 
<div class="clear"></div>  
<BR>  
 
<table style="width:100%;margin-top:;">  
<tr>  
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent">  
 
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Products</div>  
 
<div id="top-products"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportProducts'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
</td>  
 
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Traffic Sources</div>  
<div id="top-sources"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportSources'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
</td>  
</tr>  
</table>  
 
<script>  
//OWA.setSetting('debug', true);  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits,transactions,transactionRevenue,revenuePerVisit,revenuePerTransaction,ecommerceConversionRate',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.rsh = new OWA.resultSetExplorer('trend-chart');  
OWA.items.rsh.options.metricBoxes.width = '125px';  
OWA.items.rsh.asyncQueue.push(['makeAreaChart', [{x:'date',y:'transactions'}]]);  
OWA.items.rsh.asyncQueue.push(['makeMetricBoxes', 'trend-metrics']);  
OWA.items.rsh.asyncQueue.push(['renderTemplate','#headline-template', {data: OWA.items.rsh}, 'replace', 'content-headline']);  
OWA.items.rsh.load(aurl);  
 
var topproductsurl = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'lineItemQuantity,lineItemRevenue',  
'dimensions' => 'productName',  
'sort' => 'lineItemRevenue-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.topproducts = new OWA.resultSetExplorer('top-products');  
OWA.items.topproducts.addLinkToColumn('productName', '<?php echo $this->makeLink(array(  
'do' => 'base.reportProductDetail',  
'productName' => '%s'  
),true);?>', ['productName']);  
OWA.items.topproducts.asyncQueue.push(['refreshGrid']);  
OWA.items.topproducts.load(topproductsurl);  
 
var topsourcesurl = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'transactionRevenue',  
'dimensions' => 'source,medium',  
'sort' => 'transactionRevenue-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.topsources = new OWA.resultSetExplorer('top-sources');  
OWA.items.topsources.addLinkToColumn('source', '<?php echo $this->makeLink(array(  
'do' => 'base.reportSourceDetail',  
'source' => '%s'  
),true);?>', ['source']);  
OWA.items.topsources.asyncQueue.push(['refreshGrid']);  
OWA.items.topsources.load(topsourcesurl);  
 
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
 
<script type="text/x-jqote-template" id="headline-template">  
<![CDATA[  
There were <*= this.data.resultSet.aggregates.transactions.formatted_value *> <* if (this.data.resultSet.aggregates.transactions.value > 1) {this.label = 'transactions';} else {this.label = 'transaction';} *> <*= this.label *> generating <*= this.data.resultSet.aggregates.transactionRevenue.formatted_value *>.  
]]>  
</script>  
 
 
<div class="owa_reportSectionContent">  
<div id="trend-chart" style="height:125px;width:auto;"></div>  
<div class="owa_reportHeadline" id="content-headline"></div>  
<div id="trend-metrics"></div>  
</div>  
 
<div class="clear"></div>  
<BR>  
 
<table style="width:100%;margin-top:;">  
<tr>  
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent">  
 
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Top Pages</div>  
 
<div id="top-pages"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportPages'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
</td>  
 
<td valign="top" style="width:50%;">  
<div class="owa_reportSectionHeader">Content Reports</div>  
<div class="relatedReports">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportDomstreams'));?>">Domstream Recordings</a></span> - See user mouse movement and keypress recordings.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportActions'));?>">Actions</a></span> - See which actions your user performed.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'));?>">Entry & Exits</a></span> - See which web pages user entered and exited on.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportAnchortext'));?>">Feeds</a></span> - See trends for feed subscribers and usage.  
</LI>  
</UL>  
</div>  
</div>  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Top Page Types</div>  
<div id="top-pagetypes"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportPageTypes'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
</td>  
</tr>  
</table>  
 
<script>  
//OWA.setSetting('debug', true);  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits,pageViews,bounceRate',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.rsh = new OWA.resultSetExplorer('trend-chart');  
OWA.items.rsh.options.metricBoxes.width = '125px';  
OWA.items.rsh.asyncQueue.push(['makeAreaChart', [{x:'date',y:'pageViews'}]]);  
OWA.items.rsh.asyncQueue.push(['makeMetricBoxes', 'trend-metrics']);  
OWA.items.rsh.asyncQueue.push(['renderTemplate','#content-headline-template', {data: OWA.items.rsh}, 'replace', 'content-headline']);  
OWA.items.rsh.load(aurl);  
 
 
 
var vmurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'medium',  
'sort' => 'visits-',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';  
 
OWA.items.vm = new OWA.resultSetExplorer('traffic-sources');  
OWA.items.vm.options.pieChart.metric = 'visits';  
OWA.items.vm.options.pieChart.dimension = 'medium';  
OWA.items.vm.options.chartWidth = '300px';  
OWA.items.vm.asyncQueue.push(['makePieChart']);  
OWA.items.vm.load(vmurl);  
 
 
var toppagesurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'pageTitle,pageUrl',  
'sort' => 'visits-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.toppages = new OWA.resultSetExplorer('top-pages');  
OWA.items.toppages.addLinkToColumn('pageTitle', '<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'pageUrl' => '%s'),true);?>', ['pageUrl']);  
OWA.items.toppages.options.grid.excludeColumns = ['pageUrl'];  
OWA.items.toppages.asyncQueue.push(['refreshGrid']);  
OWA.items.toppages.load(toppagesurl);  
 
var toppagetypesurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'pageType',  
'sort' => 'visits-',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.toppagetypes = new OWA.resultSetExplorer('top-pagetypes');  
OWA.items.toppagetypes.asyncQueue.push(['refreshGrid']);  
OWA.items.toppagetypes.addLinkToColumn('pageType', '<?php echo $this->makeLink(array('do' => 'base.reportPageTypeDetail', 'pageType' => '%s'),true);?>', ['pageType']);  
OWA.items.toppagetypes.load(toppagetypesurl);  
 
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
 
<script type="text/x-jqote-template" id="content-headline-template">  
<![CDATA[  
There were <*= this.data.resultSet.aggregates.pageViews.value *> <* if (this.data.resultSet.aggregates.pageViews.value > 1) {this.label = 'page views';} else {this.label = 'page view';} *> <*= this.label *> of all pages.  
]]>  
</script>  
 
 
<div class="owa_reportSectionContent" style="width:auto;">  
<div class="owa_reportSectionHeader">Site Metrics</div>  
 
<div id="trend-chart" style="height:125px;"></div><BR>  
<div id="trend-metrics" style="width:auto;"></div>  
 
</div>  
<div class="clear"></div>  
<table style="padding:0px;width:auto;">  
<TR>  
<TD style="width:50%" valign="top">  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Top Content</div>  
 
<div id="top-pages" style="min-width:350px"></div>  
<div class="owa_moreLinks">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportPages'), true);?>">View Full Report &raquo;</a>  
</div>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Visitor Types</div>  
<div id="visitor-types" style="width:250px;margin-top:-10px;"></div>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="section_header">Latest Visits</div>  
<?php include('report_latest_visits.tpl')?>  
</div>  
 
</TD>  
<TD style="width:50%" valign="top">  
 
<?php if ($actions->getDataRows()):?>  
<div class="owa_reportSectionContent" style="min-width:200px; height:;">  
<div class="section_header">Actions</div>  
 
<div id="actions-trend" style="width:200px;height:;"></div>  
 
 
<table cellpadding="0" cellspacing="0" width="100%">  
<tr>  
<td valign="top">  
<?php foreach($actions->getDataRows() as $k => $row):?>  
<div class="owa_metricInfobox" style="width:150px;">  
<p class="owa_metricInfoboxLabel"><?php echo $row['actionName']['value'];?></p>  
<p class="owa_metricInfoboxLargeNumber"><?php echo $row['actions']['value'];?></p>  
</div>  
<?php endforeach;?>  
</td>  
</tr>  
</table>  
 
 
<div class="owa_genericHorizontalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportActionTracking'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
<div class="clear"></div>  
</div>  
<?php endif;?>  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Traffic Sources</div>  
<div id="visitor-mediums" style="width:250px;margin-top:-10px;"></div>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Top Referrers</div>  
 
<div id="top-referers" style="min-width:350px"></div>  
<div class="owa_moreLinks">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'), true);?>">View Full Report &raquo;</a>  
</div>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="section_header">OWA News</div>  
<?php echo $this->getWidget('base.widgetOwaNews','',false);?>  
</div>  
</TD>  
</TR>  
</table>  
 
<script>  
 
var aurl = '<?php  
 
echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json'  
), true);  
?>';  
 
var rsh = new OWA.resultSetExplorer('site-trend');  
 
rsh.asyncQueue.push(['makeAreaChart', [{x: 'date', y: 'visits'}], 'trend-chart']);  
rsh.options.metricBoxes.width = '150px';  
rsh.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
 
rsh.load(aurl);  
 
(function() {  
var tcurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'pageViews',  
'dimensions' => 'pageTitle,pageUrl',  
'sort' => 'pageViews-',  
'format' => 'json',  
'page' => 1,  
'resultsPerPage' => 10  
),true);?>';  
 
OWA.items.tc = new OWA.resultSetExplorer('top-pages');  
OWA.items.tc.options.grid.showRowNumbers = false;  
OWA.items.tc.addLinkToColumn('pageTitle', '<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'pageUrl' => '%s'), true);?>', ['pageUrl']);  
OWA.items.tc.options.grid.excludeColumns = ['pageUrl'];  
OWA.items.tc.asyncQueue.push(['refreshGrid']);  
OWA.items.tc.load(tcurl);  
})();  
 
(function() {  
var traurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'referralPageTitle,referralPageUrl',  
'sort' => 'visits-',  
'format' => 'json',  
'resultsPerPage' => 10  
),true);?>';  
 
 
OWA.items.topreferers = new OWA.resultSetExplorer('top-referers');  
OWA.items.topreferers.options.grid.showRowNumbers = false;  
OWA.items.topreferers.addLinkToColumn('referralPageTitle', '<?php echo $this->makeLink(array('do' => 'base.reportReferralDetail', 'referralPageUrl' => '%s'),true);?>', ['referralPageUrl']);  
OWA.items.topreferers.options.grid.excludeColumns = ['referralPageUrl'];  
OWA.items.topreferers.asyncQueue.push(['refreshGrid']);  
OWA.items.topreferers.load(traurl);  
})();  
 
(function() {  
var aturl = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'actions',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'period' => 'last_seven_days',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))  
));?>';  
 
at = new OWA.resultSetExplorer('actions-trend');  
at.options.areaChart.series.push({x:'date',y:'actions'});  
at.setView('areaChart');  
//at.load(aturl);  
})();  
 
(function() {  
var vmurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'medium',  
'sort' => 'visits-',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';  
 
var vm = new OWA.resultSetExplorer('visitor-mediums');  
vm.options.pieChart.metric = 'visits';  
vm.options.pieChart.dimension = 'medium';  
vm.setView('pie');  
vm.load(vmurl);  
})();  
 
(function() {  
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'repeatVisitors,newVisitors',  
'dimensions' => '',  
'sort' => 'visits',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';  
 
OWA.items.vt = new OWA.resultSetExplorer('visitor-types');  
OWA.items.vt.options.pieChart.metrics = ['repeatVisitors', 'newVisitors'];  
OWA.items.vt.asyncQueue.push(['makePieChart']);  
OWA.items.vt.load(aurl);  
})();  
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
<?php if ($dimension_properties): ?>  
<div class="owa_reportSectionContent">  
<?php echo $this->renderDimension($dimension_template, $dimension_properties);?>  
</div>  
<?php endif;?>  
 
<div class="owa_reportSectionContent">  
 
<div id="trend-chart" style="height:125px;width:auto;"></div>  
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="report-tabs">  
 
<?php foreach ($tabs as $k => $tab): ?>  
<div id="tab_<?php $this->out($k); ?>">  
 
<div id="<?php $this->out($k); ?>_trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>  
<?php if($pie): ?>  
<div id="pie" style="min-width:300px;"></div>  
<?php endif;?>  
<div class="spacer" style="clear:both; height:20px;"></div>  
<?php if (!$this->get('hideGrid')):?>  
<div id="<?php $this->out($k); ?>_dimension-grid"></div>  
<?php endif;?>  
 
</div>  
<?php endforeach; ?>  
</div>  
</div>  
 
 
<script>  
 
// add tabs  
<?php foreach ($tabs as $k => $tab): ?>  
 
var tab = new OWA.report.tab('tab_<?php $this->out($k, false);?>');  
tab.setLabel('<?php $this->out($tab['tab_label']);?>');  
// create trend and aggregate data resultSetExplorer objects  
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $tab['metrics'],  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.setDataLoadUrl(trendurl);  
trend.options.sparkline.metric = 'visits';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , '<?php $this->out($k, false);?>_trend-metrics']);  
tab.addRse('trend', trend);  
OWA.items['<?php echo $dom_id;?>'].addTab( tab );  
<?php endforeach;?>  
// create report tabs  
OWA.items['<?php echo $dom_id;?>'].createTabs();  
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
<?php if (isset($dimension_properties) && $dimension_properties): ?>  
<div class="owa_reportSectionContent">  
<?php echo $this->renderDimension($dimension_template, $dimension_properties);?>  
</div>  
<?php endif;?>  
 
<div class="owa_reportSectionContent">  
 
<div id="trend-chart"></div>  
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>  
 
<?php if(isset($pie) && $pie): ?>  
<div id="pie" style="min-width:300px;"></div>  
<script>  
var hpurl = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'pageViews,visits,bounceRate',  
'dimensions' => 'hostName',  
'sort' => 'visits-',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';  
 
hp = new OWA.resultSetExplorer('pie');  
hp.options.pieChart.dimension = '<?php echo $dimensions;?>';  
hp.options.pieChart.metric = 'visits';  
hp.setView('pie');  
hp.load(hpurl);  
 
</script>  
<?php endif; ?>  
 
<div style="clear:both;"></div>  
<script>  
 
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.options.sparkline.metric = 'visits';  
 
 
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
<?php if (isset($trendChartMetric)): ?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
<?php endif; ?>  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
 
trend.load(trendurl);  
 
</script>  
 
</div>  
 
<?php if ( $this->get( 'dimensions' ) ):?>  
<div class="owa_reportSectionContent">  
 
<div id="dimension-grid"></div>  
 
<script>  
var dimurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => $dimensions,  
'sort' => $sort,  
'resultsPerPage' => $resultsPerPage,  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var dim = new OWA.resultSetExplorer('dimension-grid');  
 
<?php if (!empty($dimensionLink)):?>  
var link = '<?php echo $this->makeLink($dimensionLink['template'], true);?>';  
var values = <?php if (is_array($dimensionLink['valueColumns'])) {  
$values = "[";  
$i = 0;  
$count = count($dimensionLink['valueColumns']);  
foreach ($dimensionLink['valueColumns'] as $v) {  
$values .= "'$v'";  
if ($i < $count) {  
$values .= ', ';  
}  
$i++;  
}  
$values .= "]";  
echo $values;  
} else {  
echo "['".$dimensionLink['valueColumns']."']";  
}  
?>;  
dim.addLinkToColumn('<?php echo $dimensionLink['linkColumn'];?>', link, values);  
<?php endif; ?>  
<?php if (!empty($excludeColumns)):?>  
dim.options.grid.excludeColumns = [<?php echo $excludeColumns;?>];  
<?php endif; ?>  
dim.asyncQueue.push(['refreshGrid']);  
dim.load(dimurl);  
</script>  
 
</div>  
<?php endif;?>  
 
<?php require_once('js_report_templates.php');?>  
<div class="owa_reportSectionContent">  
 
<div id="trend-chart"></div>  
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="report-tabs">  
 
<?php foreach ($tabs as $k => $tab): ?>  
<div id="tab_<?php $this->out($k); ?>">  
 
<div id="<?php $this->out($k); ?>_trend-metrics" style="height:auto;width:auto;<?php if( $this->get( 'pie' ) ) {echo 'float:right';}?>"></div>  
<?php if ( $this->get('pie' ) ): ?>  
<div id="pie" style="min-width:300px;"></div>  
<?php endif;?>  
<div class="spacer" style="clear:both; height:20px;"></div>  
<?php if (!$this->get('hideGrid')):?>  
<div id="<?php $this->out($k); ?>_dimension-grid"></div>  
<?php endif;?>  
 
</div>  
<?php endforeach; ?>  
</div>  
</div>  
 
<script type="text/javascript">  
 
// add tabs  
 
<?php foreach ($tabs as $k => $tab): ?>  
 
// adding tab for <?php $this->out($k, false);?>  
 
 
var tab = new OWA.report.tab('tab_<?php $this->out($k, false);?>');  
tab.setLabel('<?php $this->out($tab['tab_label']);?>');  
// create trend and aggregate data resultSetExplorer objects  
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $tab['metrics'],  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.setDataLoadUrl(trendurl);  
trend.options.sparkline.metric = 'visits';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , '<?php $this->out($k, false);?>_trend-metrics']);  
// add rse to tab  
tab.addRse('trend', trend);  
// dimensonal data object  
var dimurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $tab['metrics'],  
'dimensions' => $dimensions,  
'sort' => $tab['sort'],  
'resultsPerPage' => $resultsPerPage,  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var dim = new OWA.resultSetExplorer('<?php $this->out($k, false);?>_dimension-grid');  
dim.setDataLoadUrl(dimurl);  
<?php if (!empty($dimensionLink)):?>  
var link = '<?php echo $this->makeLink($dimensionLink['template'], true);?>';  
var values = <?php if (is_array($dimensionLink['valueColumns'])) {  
$values = "[";  
$i = 0;  
$count = count($dimensionLink['valueColumns']);  
foreach ($dimensionLink['valueColumns'] as $v) {  
$values .= "'$v'";  
if ($i < $count) {  
$values .= ', ';  
}  
$i++;  
}  
$values .= "]";  
echo $values;  
} else {  
echo "['".$dimensionLink['valueColumns']."']";  
}  
?>;  
dim.addLinkToColumn('<?php echo $dimensionLink['linkColumn'];?>', link, values);  
<?php endif; ?>  
 
<?php if (isset($gridFormatters) && ! empty($gridFormatters) ):?>  
<?php foreach ($gridFormatters as $col => $formatter): ?>  
dim.options.grid.columnFormatters['<?php $this->out($col); ?>'] = <?php $this->out($formatter, false);?>;  
<?php endforeach;?>  
<?php endif;?>  
 
<?php if (!empty($excludeColumns)):?>  
dim.options.grid.excludeColumns = [<?php echo $excludeColumns;?>];  
<?php endif; ?>  
dim.asyncQueue.push(['refreshGrid']);  
// add dim object to tab  
tab.addRse('dim', dim);  
// add tab  
OWA.items['<?php echo $dom_id;?>'].addTab( tab );  
<?php endforeach;?>  
// create report tabs  
OWA.items['<?php echo $dom_id;?>'].createTabs();  
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
<?php if ($dimension_properties): ?>  
<div class="owa_reportSectionContent">  
<?php echo $this->renderDimension($dimension_template, $dimension_properties);?>  
</div>  
<?php endif;?>  
 
<?php require('report_trend_section.php');?>  
 
<div class="owa_reportSectionContent">  
<table style="width:100%;">  
<TR>  
 
<TD width="50%" valign="top">  
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Next Pages Viewed</div>  
<div id="nextpages"></div>  
</div>  
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Prior Pages Viewed</div>  
<div id="priorpages"></div>  
</div>  
</TD>  
<TD width="50%" valign="top">  
<div class="owa_reportSectionHeader">Related Reports:</div>  
 
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.overlayLauncher', 'document_id' =>$document->get('id'), 'overlay_params' => urlencode($this->makeParamString(array('action' => 'loadHeatmap', 'api_url' => owa_coreAPI::getSetting('base', 'api_url'), 'document_id' => $document->get('id')), true, 'cookie'))));?>" target="_blank">Heatmap Overlay</a></span> (Firefox 3.5+ required)  
</P>  
 
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.reportDomstreams', 'document_id' => $document->get('id')), true);?>">Domstreams</a></span> - mouse movement recordings.  
</P>  
 
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.reportDomClicks', 'document_id' => $document->get('id')), true);?>">Dom Clicks</a></span> - analysis of dom clicks.  
</P>  
 
 
</TD>  
</TR>  
</table>  
</div>  
 
 
 
<script>  
var trurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'pagePath,pageTitle',  
'sort' => 'visits-',  
'resultsPerPage' => 15,  
'constraints' => 'priorPageUrl=='.urlencode($dimension_properties->get('url')),  
'format' => 'json'), true);?>';  
 
var trshre = new OWA.resultSetExplorer('nextpages');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'pagePath' => '%s'), true);?>';  
trshre.addLinkToColumn('pagePath', link, ['pagePath']);  
trshre.asyncQueue.push(['refreshGrid']);  
trshre.load(trurl);  
 
var prurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'priorPagePath,priorPageTitle',  
'sort' => 'visits-',  
'resultsPerPage' => 15,  
'constraints' => 'pageUrl=='.urlencode($dimension_properties->get('url')),  
'format' => 'json'), true);?>';  
 
var prshre = new OWA.resultSetExplorer('priorpages');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'pagePath' => '%s'), true);?>';  
prshre.addLinkToColumn('priorPagePath', link, ['priorPagePath']);  
prshre.asyncQueue.push(['refreshGrid']);  
prshre.load(prurl);  
</script>  
 
<?php require_once('js_report_templates.php');?>  
<table>  
<TR>  
<TH>Title</TH>  
<TD><span class="inline_h2"><?php echo $detail['page_title'];?></span></TD>  
</TR>  
<TR>  
<TH>URL:</TH>  
<TD><a href="<?php echo $detail['url'];?>"><?php echo $detail['url'];?></a></TD>  
</TR>  
<TR>  
<TH>Page Type:</TH>  
<TD><?php echo $detail['page_type'];?></TD>  
</TR>  
</table>  
 
<?php require('report_trend_section.php');?>  
 
<div class="owa_reportSectionContent">  
<table style="width:100%;">  
<TR>  
 
<TD width="50%" valign="top">  
 
<div class="owa_reportSectionContent">  
<div class="section_header">Dom IDs</div>  
<div style="min-width:300px;" id="topDomIds"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'domClicks',  
'dimensions' => 'domElementId',  
'constraints' => $constraints,  
'sort' => 'domClicks-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('topDomIds');  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="section_header">Name Attributes</div>  
<div style="min-width:300px;" id="topDomNames"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'domClicks',  
'dimensions' => 'domElementName',  
'constraints' => $constraints,  
'sort' => 'domClicks-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('topDomNames');  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
 
</TD>  
 
<TD width="" valign="top">  
 
<div class="owa_reportSectionContent">  
<div class="section_header">HTML Tags</div>  
<div style="min-width:300px;" id="topHtmlTags"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'domClicks',  
'dimensions' => 'domElementTag',  
'constraints' => $constraints,  
'sort' => 'domClicks-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('topHtmlTags');  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="section_header">Dom Classes</div>  
<div style="min-width:300px;" id="topDomClasses"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'domClicks',  
'dimensions' => 'domElementClass',  
'constraints' => $constraints,  
'sort' => 'domClicks-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('topDomClasses');  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
 
</TD>  
</TR>  
</table>  
</div>  
 
<?php require_once('js_report_templates.php');?>  
<?php if (!empty($document)): require('item_document.php'); endif;?>  
 
 
<?php if (!empty($domstreams)):?>  
<table class="simpleTable">  
<thead>  
<tr>  
<th><?php echo $domstreams->getLabel('timestamp');?></th>  
<th><?php echo $domstreams->getLabel('page_url');?></th>  
<th><?php echo $domstreams->getLabel('duration');?></th>  
<th></th>  
</tr>  
</thead>  
<tbody>  
<?php foreach($domstreams->rows as $ds): ?>  
 
<TR>  
<TD class="data_cell">  
<?php echo date("F j, Y, g:i a",$ds['timestamp']);?>  
</TD>  
<TD class="data_cell">  
<a href="<?php echo $ds['page_url'];?>">  
<?php echo $this->truncate($ds['page_url'], 150);?>  
</a>  
</TD>  
 
<TD class="data_cell">  
<?php echo date("H:i:s", mktime(0,0,$ds['duration']));?>  
</TD>  
<TD class="data_cell">  
<a href="<?php $api_url = owa_coreAPI::getSetting('base', 'api_url'); echo $this->makeLink(array(  
'do' => 'base.overlayLauncher',  
'document_id' => $ds['document_id'],  
'overlay_params' => urlencode(  
$this->makeParamString(  
array(  
'action' => 'loadPlayer',  
'api_url' => trim(owa_coreAPI::getSetting('base', 'api_url')),  
'domstream_guid' => $ds['domstream_guid']),  
true,  
'cookie'))));?>" target="_blank">Play</a>  
</TD>  
</TR>  
<?php endforeach; ?>  
</tbody>  
</table>  
 
<?php echo $this->makePaginationFromResultSet($domstreams, array('do' => 'base.reportDomstreams'), true);?>  
 
<?php else:?>  
There are no refering web pages for this time period.  
<?php endif;?>  
<div class="owa_reportSectionContent">  
 
<div id="trend-chart"></div>  
 
 
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>  
<div style="clear:both;"></div>  
<script>  
 
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.options.sparkline.metric = 'visits';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
trend.load(trendurl);  
 
</script>  
 
</div>  
 
<table width="100%">  
<TR>  
<TD valign="top" style="width:50%;">  
<div class="owa_reportSectionContent">  
<div class="section_header">Product Performance</div>  
<div style="min-width:250px;" id="productNameExplorer"></div>  
<script>  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'lineItemRevenue',  
'dimensions' => 'productName',  
'sort' => 'lineItemRevenue-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rsh = new OWA.resultSetExplorer('productNameExplorer');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportProductDetail', 'productName' => '%s'), true);?>';  
rsh.addLinkToColumn('productName', link, ['productName']);  
rsh.asyncQueue.push(['refreshGrid']);  
rsh.load(aurl, 'grid');  
</script>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="section_header">Sales Sources</div>  
<div style="min-width:300px;" id="sourceExplorer"></div>  
<script>  
var url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'transactions,transactionRevenue',  
'dimensions' => 'source',  
'sort' => 'transactionsRevenue-',  
'resultsPerPage' => 5,  
'format' => 'json'), true);?>';  
 
rshre = new OWA.resultSetExplorer('sourceExplorer');  
var link = '<?php echo $this->makeLink(array('do' => 'base.reportSources', 'source' => '%s'), true);?>';  
rshre.addLinkToColumn('source', link, ['source']);  
rshre.asyncQueue.push(['refreshGrid']);  
rshre.load(url);  
</script>  
</div>  
</TD>  
 
<td valign="top">  
<div class="owa_reportSectionContent">  
<div class="section_header">Related Reports</div>  
<div class="relatedReports">  
<UL>  
<li>  
Item Level Analysis:  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportProducts'), true);?>">Product Name</a>,  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportProductSkus'), true);?>">SKU</a>,  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportProductCategories'), true);?>">Categories</a>  
</li>  
<li>  
Purchase Patterns:  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitsToPurchase'), true);?>">Visits to Purchase</a>,  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportDaysToPurchase'), true);?>">Days to Purchase</a>  
</li>  
<li>  
Sales Trends:  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportAvgOrderValue'), true);?>">Average Order Value</a>,  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportRevenue'), true);?>">Total Revenue</a>,  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportEcommerceConversionRate'), true);?>">Conversion Rate</a>  
</li>  
</UL>  
</div>  
</div>  
</td>  
</TR>  
</table>  
 
<?php require_once('js_report_templates.php');?>  
 
 
<?php require('report_dimensionDetailNoTabs.php');?>  
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php $this->out( owa_coreAPI::getSiteSetting($site_id, 'google_maps_api_key') );?>" type="text/javascript"></script>  
<noscript>  
<div class="error">  
<b>JavaScript must be enabled in order for you to use Google Maps.</b> However, it seems JavaScript is either disabled or not supported by your browser. To view Google Maps, enable JavaScript by changing your browser options, and then try again.  
</div>  
</noscript>  
 
<div class="owa_reportSectionContent">  
<P><img align="bottom" src="<?php echo $this->makeImageLink('kml_feed_small.png');?>"> <a href="<?php echo $this->makeLink(array('do' => 'base.kmlVisitsGeolocation'), true, $this->config['action_url']);?>">Download KML</a></P>  
 
<?php include("map_dom.tpl");?>  
</div>  
 
<?php echo $this->makePaginationFromResultSet($latest_visits, array('do' => 'base.reportVisitsGeolocation'));?>  
 
 
 
 
 
<div>  
 
Choose a goal: <select id="goalChooser">  
<?php for ($i = 1; $i <= $numGoals; $i++):?>  
<option <?php if ($i == $goal_number): echo 'SELECTED'; endif;?> value="<?php $this->out($i, false); ?>">Goal <?php $this->out($i, false); ?></option>  
<?php endfor; ?>  
</select>  
</div>  
 
<?php if ( $this->get('funnel') ):?>  
<table class="funnel" border="0" style="min-width:100%;">  
<tr>  
<td class="funnelLeft">Prior Page Viewed</td>  
<td class="funnelMiddle"><h2><?php $this->out($goal_conversion_rate);?> conversion rate</h2></td>  
<td class="funnelRight" style="text-align:right;">Next Page Viewed</td>  
</tr>  
<?php foreach ($funnel as $k => $step):?>  
<tr>  
<td width="33%" valign="top" class="funnelLeft" id="entrances_step_<?php $this->out($step['step_number']);?>">  
<div class="funnelLargeNumber entranceCount" style="text-align: right;" id="prior_page_count_step_<?php $this->out($step['step_number']);?>">  
 
</div>  
</td>  
<td width="33%" valign="top" class="funnelMiddle funnelStep" id="step_<?php $this->out($step['step_number']);?>">  
<div class="funnelStepName">Step <?php $this->out($step['step_number']);?>: <?php $this->out($step['name']);?></div>  
<div class="funnelStepCount"><?php $this->out($step['visitors']);?> <span class="visitorCountLabel">visitors</span></div>  
<div class="funnelStepUrl"><?php $this->out($step['url']);?></div>  
<div class="genericHorizontalList" style="padding-top:10px;font-size:12px;">  
<ul class="">  
 
 
<li>  
<span class="inline_h4"><a href="<?php echo $this->makeLink(array('do' => 'base.reportDomstreams', 'pagePath' => $step['url']), true);?>">Watch Domstreams</a></span>  
</li>  
 
<li>  
<span class="inline_h4"><a href="<?php echo $this->makeLink(array('do' => 'base.reportDomClicks', 'pagePath' => $step['url']), true);?>">Analyze Dom Clicks</a></span>  
</li>  
</ul>  
</div>  
</td>  
<td width="33%" valign="top" class="funnelRight" id="exits_step_<?php $this->out($step['step_number']);?>">  
<div class="funnelLargeNumber exitCount" id="next_page_count_step_<?php $this->out($step['step_number']);?>"></div>  
</td>  
</tr>  
<?php if (array_key_exists($k+1, $funnel)):?>  
<tr>  
<td class="funnelLeft"></td>  
<td class="funnelMiddle funnelLargeNumber funnelFlow">  
<?php $this->out($funnel[$k+1]['visitor_percentage']);?><BR>  
<span class="secondaryText">Proceeded to step: <?php $this->out($funnel[$k+1]['name']); ?></span>  
</td>  
<td class="funnelRight"></td>  
</tr>  
<?php endif;?>  
<?php endforeach;?>  
</table>  
 
<script>  
var funnel_json = <?php $this->out($funnel_json, false);?>;  
var i = 1;  
for (step in funnel_json) {  
step = parseInt(step);  
 
var total_steps = OWA.util.countObjectProperties(funnel_json);  
var operator = '==';  
if (i < total_steps ) {  
next_step = step + 1;  
} else {  
next_step = step;  
}  
 
if (i == 1) {  
prior_step = step;  
} else {  
prior_step = step - 1 ;  
}  
 
// prior pages  
var name = 'entrances_step_' + funnel_json[step]['step_number'] ;  
OWA.items[name] = new OWA.resultSetExplorer(name);  
OWA.items[name].setDataLoadUrl(  
OWA.items[name].makeApiRequestUrl( 'getResultSet',{  
metrics: 'visitors',  
dimensions: 'priorPagePath',  
sort: 'visitors-',  
format: 'json',  
constraints: 'pagePath' + operator + funnel_json[step]['url'] + ',priorPagePath!=' + funnel_json[prior_step]['url'],  
resultsPerPage: 5,  
siteId: OWA.items['base-reportGoalFunnel'].getSiteId(),  
period: OWA.items['base-reportGoalFunnel'].getPeriod(),  
startDate: OWA.items['base-reportGoalFunnel'].getStartDate(),  
endDate: OWA.items['base-reportGoalFunnel'].getEndDate()  
}));  
OWA.items[name].asyncQueue.push(['refreshGrid']);  
OWA.items[name].asyncQueue.push([  
'renderTemplate',  
'<*= this.d.resultSet.aggregates.visitors.formatted_value *>',  
{d: OWA.items[name]},  
'replace',  
'prior_page_count_step_' + funnel_json[step]['step_number']  
]);  
OWA.items[name].load();  
// next page  
var name = 'exits_step_' + funnel_json[step]['step_number'] ;  
OWA.items[name] = new OWA.resultSetExplorer(name);  
OWA.items[name].setDataLoadUrl(  
OWA.items[name].makeApiRequestUrl( 'getResultSet',{  
metrics: 'visitors',  
dimensions: 'pagePath',  
sort: 'visitors-',  
format: 'json',  
constraints: 'priorPagePath' + operator + funnel_json[step]['url'] + ',pagePath!=' + funnel_json[next_step]['url'],  
resultsPerPage: 5,  
siteId: OWA.items['base-reportGoalFunnel'].getSiteId(),  
period: OWA.items['base-reportGoalFunnel'].getPeriod(),  
startDate: OWA.items['base-reportGoalFunnel'].getStartDate(),  
endDate: OWA.items['base-reportGoalFunnel'].getEndDate()  
}));  
OWA.items[name].asyncQueue.push([  
'renderTemplate',  
'<*= this.d.resultSet.aggregates.visitors.formatted_value *>',  
{d: OWA.items[name]},  
'replace',  
'next_page_count_step_' + funnel_json[step]['step_number']  
]);  
OWA.items[name].asyncQueue.push(['refreshGrid']);  
OWA.items[name].load();  
i++;  
}  
</script>  
<?php else: ?>  
No Funnel has been configured for this goal. <a href="<?php echo $this->makeLink(array('do' => 'base.optionsGoalEntry', 'goal_number' => $goal_number, 'siteId' => $params['siteId']));?>">Add a funnel</a>  
<?php endif;?>  
 
<script>  
// jquery binding for select list  
// Bind event handlers  
jQuery(document).ready(function(){  
 
jQuery('#goalChooser').change(function() {  
var num = jQuery("#goalChooser option:selected").val();  
OWA.items['base-reportGoalFunnel'].setRequestProperty('goalNumber', num);  
OWA.items['base-reportGoalFunnel'].reload();  
});  
});  
</script>  
<div class="owa_reportSectionContent">  
 
<div id="trend-chart"></div>  
 
 
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="trend-metrics" style="height:auto;width:auto;<?php if(isset($pie)) {echo 'float:right';}?>"></div>  
<div style="clear:both;"></div>  
<script>  
 
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.options.sparkline.metric = 'goalCompletionsAll';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
trend.load(trendurl);  
 
</script>  
 
</div>  
 
<table width="100%">  
<TR>  
<TD valign="top" style="width:50%;">  
<div class="owa_reportSectionContent">  
<div class="section_header">Goal Performance</div>  
<div style="min-width:250px;" id="goalMetrics"></div>  
<?php if ($goal_metrics): ?>  
<script>  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $goal_metrics,  
'format' => 'json'), true);?>';  
 
rsh = new OWA.resultSetExplorer('goalMetrics');  
rsh.asyncQueue.push(['makeMetricBoxes' , 'goalMetrics']);  
rsh.load(aurl, 'grid');  
</script>  
<?php endif;?>  
</div>  
 
</TD>  
 
<td valign="top">  
<div class="owa_reportSectionContent">  
<div class="section_header">Related Reports</div>  
<div class="relatedReports">  
<UL>  
<li>  
 
<a href="<?php echo $this->makeLink(array('do' => 'base.reportGoalFunnel'), true);?>">Conversion Funnels</a> - Goal funnel Visualization.  
 
</li>  
</UL>  
</div>  
</div>  
</td>  
</TR>  
</table>  
 
<?php require_once('js_report_templates.php');?>  
 
 
 
<table id="report_header">  
<TR>  
<TD class="report_headline"><?php echo $headline;?></TD>  
<TD class="report_period"><?php echo $period_label;?><?php echo $date_label;?></TD>  
<TR>  
</table>  
 
<?php if(!empty($visits)):?>  
<table style="width:100%;">  
<?php foreach($visits->resultsRows as $row): ?>  
<TR>  
<?php include('row_visitSummary.tpl');?>  
</TR>  
<?php endforeach; ?>  
</table>  
<?php //echo $this->makePaginationFromResultSet($visits);?>  
<?php else:?>  
There were no visits during this time period.  
<?php endif;?>  
<div class="owa_admin_nav">  
 
<UL>  
<?php foreach ($links as $kl => $l): ?>  
<LI>  
<div class="owa_admin_nav_topmenu">  
 
<div class="owa_admin_nav_topmenu_item">  
<div class="owa_admin_nav_topmenu_toggle"></div>  
<div style="padding:5px;">  
<a id="owa_admin_nav_topmenu_item_<?php echo $kl;?>" href="<?php echo $this->makeLink(array('do' => $l['ref']), true);?>"><?php echo $l['anchortext'];?></a>  
</div>  
 
</div>  
 
 
<?php if (!empty($l['subgroup'])): ?>  
<div id="owa_admin_nav_subgroup_<?php echo $kl;?>" class="owa_admin_nav_subgroup">  
<UL>  
<?php foreach ($l['subgroup'] as $sgl): ?>  
<LI>  
<div class="owa_admin_nav_subgroup_item">  
<a href="<?php echo $this->makeLink(array('do' => $sgl['ref']), true);?>"><?php echo $sgl['anchortext'];?></a>  
</div>  
 
</LI>  
<?php endforeach;?>  
</UL>  
</div>  
<?php endif; ?>  
</div>  
</LI>  
<?php endforeach;?>  
</UL>  
 
</div>  
 
 
<!-- DEPRICATED -->  
 
<TABLE>  
 
<TR>  
<TH>Site</TH>  
<TH>Reporting Period</TH>  
</TR>  
 
<TR>  
<TD valign="top">  
<form action="" method="GET">  
<SELECT name="sites" onchange='OnChange(this.form.sites, "site_id");' <? if (count($sites) == 1):?>DISABLED<?endif;?>>  
 
<?foreach ($sites as $site => $value):?>  
<OPTION VALUE="<?php echo $value['site_id'];?>" <?php if ($params['site_id'] == $value['site_id']): echo 'selected'; endif; ?>><?php echo $value['name'];?></OPTION>  
<?endforeach;?>  
<OPTION VALUE="" <?php if (empty($params['site_id'])): echo 'selected'; endif; ?>>All Sites</OPTION>  
 
</SELECT>  
</FORM>  
</TD>  
 
<TD valign="top">  
<TABLE cellpadding="0" cellspacing="0">  
<TR>  
<TD valign="top">  
<input type="radio" name="period_type" id="set_periods" onclick='choosePeriodType("set_periods_form");' <? if (array_key_exists($params['period'], $reporting_periods)):?>CHECKED<?endif;?>>  
</TD>  
<TH valign="top">Time Period: </th>  
<TD valign="top"><form action="" method="GET" name="set_periods_form">  
<SELECT name="period" onchange='OnChange(this.form.period, "period");' <? if (!array_key_exists($params['period'], $reporting_periods)):?>DISABLED<?endif;?>>  
<? foreach ($reporting_periods as $reporting_period => $value):?>  
<OPTION VALUE="<?php echo $reporting_period;?>" <?php if ($params['period'] == $reporting_period): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?endforeach;?>  
</SELECT>  
</FORM>  
</TD>  
</TR>  
<TR>  
 
<td valign="top">  
<input type="radio" name="period_type" id="date_periods" onclick='choosePeriodType("date_periods_form");' <? if (array_key_exists($params['period'], $date_reporting_periods)):?>CHECKED<?endif;?>>  
</TD>  
<TH valign="top">Date Period:</TH>  
<TD valign="top">  
<form action="" method="GET" name="date_periods_form" >  
<SELECT name="period" onchange='dateFormReveal(this.form.period);' <?php if (!array_key_exists($params['period'], $date_reporting_periods)):?>DISABLED<?php endif;?>>  
<?php foreach ($date_reporting_periods as $date_reporting_period => $value):?>  
<OPTION VALUE="<?php echo $date_reporting_period;?>" <?php if ($params['period'] == $date_reporting_period): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</FORM>  
</TD>  
</TR>  
</TABLE>  
 
</TD>  
 
<TD valign="top">  
 
<div id="day_container" class="<?if ($params['period'] != 'day'): echo 'invisible'; endif;?>">  
<table>  
<form action="" method="GET" name="day" id="day">  
<TR>  
<TH>Month</TH>  
<TH>Day</TH>  
<TH>Year</TH>  
</TR>  
<TR>  
<TD>  
<SELECT name="month">  
<?php foreach ($months as $month => $value):?>  
<OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD>  
<SELECT name="day">  
<?php foreach ($days as $day):?>  
<OPTION VALUE="<?php echo $day;?>" <?php if ($params['day'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
 
</TD>  
<TD>  
<SELECT name="year">  
<?php foreach ($years as $year):?>  
<OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD><input type="hidden" name="period" value="day"><input type="button" name="date_submit" value="Go" onclick='changeDate("day");'></TD>  
</TR>  
</form>  
</table>  
</div>  
 
<div id="month_container" class="<?if ($params['period'] != 'month'): echo 'invisible'; endif;?>">  
<table>  
<form action="" method="GET" name="month" id="month">  
<TR>  
<TH>Month</TH>  
<TH>Year</TH>  
</TR>  
<TR>  
<TD>  
<SELECT name="month">  
<?php foreach ($months as $month => $value):?>  
<OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD>  
<SELECT name="year">  
<?php foreach ($years as $year):?>  
<OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD><input type="hidden" name="period" value="month"><input type="button" name="date_submit" value="Go" onclick='changeDate("month");'></TD>  
</TR>  
</form>  
</table>  
</div>  
 
<div id="year_container" class="<?if ($params['period'] != 'year'): echo 'invisible'; endif;?>">  
<table>  
<form action="" method="GET" name="" id="year">  
<TR>  
<TH>Year</TH>  
</TR>  
<TR>  
<TD>  
<SELECT name="year">  
<?php foreach ($years as $year):?>  
<OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD><input type="hidden" name="period" value="year"><input type="button" name="date_submit" value="Go" onclick='changeDate("year");'></TD>  
</TR>  
</form>  
</table>  
</div>  
 
<div id="date_range_container" class="<?if ($params['period'] != 'date_range'): echo 'invisible'; endif;?>">  
<table>  
<form action="" method="GET" name="" id="date_range">  
 
<TR>  
<TH>Start Month</TH>  
<TH>Start Day</TH>  
<TH>Start Year</TH>  
<TH></TH>  
<TH>End Month</TH>  
<TH>End Day</TH>  
<TH>End Year</TH>  
</TR>  
<TR>  
<TD>  
<SELECT name="month">  
<?php foreach ($months as $month => $value):?>  
<OPTION VALUE="<?php echo $month;?>" <?php if ($params['month'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD>  
<SELECT name="day">  
<?php foreach ($days as $day):?>  
<OPTION VALUE="<?php echo $day;?>" <?php if ($params['day'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
 
</TD>  
<TD>  
<SELECT name="year">  
<?php foreach ($years as $year):?>  
<OPTION VALUE="<?php echo $year;?>" <?php if ($params['year'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
 
<TD> to </TD>  
 
<TD>  
<SELECT name="month2">  
<?php foreach ($months as $month => $value):?>  
<OPTION VALUE="<?php echo $month;?>" <?php if ($params['month2'] == $month): echo 'selected'; endif; ?>><?php echo $value['label'];?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
<TD>  
<SELECT name="day2">  
<?php foreach ($days as $day):?>  
<OPTION VALUE="<?php echo $day;?>" <?php if ($params['day2'] == $day): echo 'selected'; endif; ?>><?php echo $day;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
 
</TD>  
<TD>  
<SELECT name="year2">  
<?php foreach ($years as $year):?>  
<OPTION VALUE="<?php echo $year;?>" <?php if ($params['year2'] == $year): echo 'selected'; endif; ?>><?php echo $year;?></OPTION>  
<?php endforeach;?>  
</SELECT>  
</TD>  
 
 
<TD><input type="hidden" name="period" value="date_range"><input type="button" name="date_submit" value="Go" onclick='changeDate("date_range");'></TD>  
</TR>  
 
 
</form>  
</table>  
</div>  
 
</TD>  
 
</TR>  
</TABLE>  
<?//print_r($params);?>  
<SCRIPT>  
<!--  
 
var params = new Object()  
 
<?php foreach ($params as $k => $v):?>  
params["<?php echo $k;?>"] = "<?php echo $v;?>";  
<?php endforeach;?>  
 
var baseURL = '<?php echo $this->makeLink();?>'  
 
function OnChange(dropdown, change_param) {  
 
var getParam = change_param  
var myindex = dropdown.selectedIndex  
var SelValue = dropdown.options[myindex].value  
 
params[getParam] = SelValue;  
 
delete params["month"];  
delete params["day"];  
delete params["year"];  
delete params["month2"];  
delete params["day2"];  
delete params["year2"];  
 
get_string = owa_makeQueryString(params);  
 
top.location.href = baseURL + get_string;  
 
return true;  
}  
 
function changeDate(form_name) {  
 
var f = document.getElementById(form_name);  
 
delete params["month"];  
delete params["day"];  
delete params["year"];  
delete params["month2"];  
delete params["day2"];  
delete params["year2"];  
 
if (form_name == 'day') {  
params["month"] = f.month.value;  
params["day"] = f.day.value;  
params["year"] = f.year.value;  
 
}  
 
if (form_name == 'month') {  
params["month"] = f.month.value;  
params["year"] = f.year.value;  
}  
 
if (form_name == 'year') {  
params["year"] = f.year.value;  
}  
 
if (form_name == 'date_range') {  
params["month"] = f.month.value;  
params["day"] = f.day.value;  
params["year"] = f.year.value;  
params["month2"] = f.month2.value;  
params["day2"] = f.day2.value;  
params["year2"] = f.year2.value;  
}  
 
params["period"] = f.period.value;  
 
get_string = owa_makeQueryString(params);  
 
top.location.href = baseURL + get_string;  
 
return true;  
 
}  
 
function owa_makeQueryString(params) {  
 
var get_string = ""  
 
for(param in params) { // print out the params  
get_string = get_string + '&owa_' + param + "=" + params[param];  
}  
 
return get_string;  
 
}  
 
function dateFormReveal(element_name) {  
 
var div_container = element_name.value + '_container'  
 
document.getElementById('day_container').className = "invisible";  
document.getElementById('month_container').className = "invisible";  
document.getElementById('year_container').className = "invisible";  
document.getElementById('date_range_container').className = "invisible";  
 
document.getElementById(div_container).className = "visible";  
 
return true;  
}  
 
function choosePeriodType(form_name) {  
 
 
document.set_periods_form.period.disabled = true;  
document.date_periods_form.period.disabled = true;  
document.forms[form_name].period.disabled = false;  
 
if (form_name == 'date_periods_form') {  
 
element_name = document.forms[form_name].period;  
 
dateFormReveal(element_name);  
 
}  
 
if (form_name == 'set_periods_form') {  
 
element_name = document.forms[form_name].period;  
 
document.getElementById('day_container').className = "invisible";  
document.getElementById('month_container').className = "invisible";  
document.getElementById('year_container').className = "invisible";  
document.getElementById('date_range_container').className = "invisible";  
 
//dateFormReveal(element_name);  
 
}  
 
 
return true;  
}  
 
//-->  
</SCRIPT>  
 
 
<?php if (!empty($top_visitors)):?>  
<table class="tablesorter">  
<thead>  
<tr>  
<th>Visitor</th>  
<th>Visits</th>  
</tr>  
</thead>  
<tbody>  
<?php foreach($top_visitors as $vis): ?>  
<TR>  
<TD>  
<a href="<?php echo $this->makeLink(array('visitor_id' => $vis['vis_id'], 'do' => 'base.reportVisitor'), true);?>">  
<span class="">  
<?php if (!empty($vis['user_name'])):?>  
<?php echo $vis['user_name'];?>  
<?php elseif (!empty($vis['user_email'])):?>  
<?php echo $vis['user_email'];?>  
<?php else: ?>  
<?php echo $vis['vis_id'];?>  
<?php endif; ?>  
</span>  
</a>  
</TD>  
<TD>  
<?php echo $vis['count']?>  
</TD>  
</TR>  
 
<?php endforeach; ?>  
</tbody>  
</table>  
 
<?php else:?>  
There are no visitors for this time period.  
<?php endif;?>  
<div class="owa_reportSectionContent">  
<div id="trend-chart" style="height:125px; min-width:400px;padding-right:30px;"></div>  
</div>  
<div class="owa_reportSectionContent">  
<div id="visits-headline" class="owa_reportSectionHeader"></div>  
 
<table style="width:100%;margin-top:-15px;">  
<TR>  
<TD valign="top" style="width:50%;">  
<div id="traffic-sources" style="width:250px;"></div>  
</TD>  
 
<TD valign="top" style="width:50%;">  
<div id="trend-metrics"></div>  
</TD>  
 
</TR>  
</table>  
</div>  
 
<table style="width:auto;margin-top:;">  
<tr>  
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent">  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Top Sources</div>  
 
<div id="top-sources"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportSources'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
<div class="owa_reportSectionHeader">Related Reports</div>  
<div class="relatedReports">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportSearchEngines'));?>">Search Engines</a></span> - See which search engines your visitors are coming from.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportKeywords'));?>">Keywords</a></span> - See what keywords your visitor are using to find your web site.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'));?>">Referring Web Sites</a></span> - See which web sites are linking to your web site.  
</LI>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportAnchortext'));?>">Inbound Link Text</a></span> - See what words Referring Web Sites use to describe your web site.  
</LI>  
</UL>  
</div>  
</div>  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Top Keywords</div>  
 
<div id="top-keywords"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportKeywords'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
 
</td>  
 
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Top Referrals</div>  
<div id="top-referrals"></div>  
<div class="owa_genericHorizonalList owa_moreLinks">  
<UL>  
<LI>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'), true);?>">View Full Report &raquo;</a>  
</LI>  
</UL>  
</div>  
</div>  
</td>  
</tr>  
</table>  
 
 
 
 
<script>  
//OWA.setSetting('debug', true);  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.rsh = new OWA.resultSetExplorer('trend-chart');  
OWA.items.rsh.asyncQueue.push(['makeAreaChart', [{x:'date',y:'visits'}]]);  
OWA.items.rsh.asyncQueue.push(['renderTemplate','#visits-headline-template', {data: OWA.items.rsh}, 'replace', 'visits-headline']);  
OWA.items.rsh.load(aurl);  
 
var tturl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'date,medium',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,', 'siteId').',medium=@organic')),true);?>';  
 
OWA.items.tt = new OWA.resultSetExplorer('trend-metrics');  
OWA.items.tt.asyncQueue.push(['makeMetricBoxes','','','Visits From Search Engines', '',function(row) {if (row.medium.value === 'organic-search') return true;}]);  
OWA.items.tt.load(tturl);  
 
var tt1url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,', 'siteId')).'medium==direct'),true);?>';  
 
var tt1 = new OWA.resultSetExplorer('trend-metrics');  
tt1.asyncQueue.push(['makeMetricBoxes','','','Visits From Direct Navigation']);  
tt1.load(tt1url);  
 
 
var tt2url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId')).'medium==referral'),true);?>';  
 
OWA.items.tt2 = new OWA.resultSetExplorer('trend-metrics');  
 
OWA.items.tt2.asyncQueue.push(['makeMetricBoxes','','','Visits From Referrals']);  
OWA.items.tt2.load(tt2url);  
 
var vmurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'medium',  
'sort' => 'visits-',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';  
 
OWA.items.vm = new OWA.resultSetExplorer('traffic-sources');  
OWA.items.vm.options.pieChart.metric = 'visits';  
OWA.items.vm.options.pieChart.dimension = 'medium';  
OWA.items.vm.options.chartWidth = '300px';  
OWA.items.vm.asyncQueue.push(['makePieChart']);  
OWA.items.vm.load(vmurl);  
 
 
var topkeywordsurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'referralSearchTerms',  
'sort' => 'visits-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.topkeywords = new OWA.resultSetExplorer('top-keywords');  
OWA.items.topkeywords.addLinkToColumn('referralSearchTerms', '<?php echo $this->makeLink(array('do' => 'base.reportKeywordDetail', 'referralSearchTerms' => '%s'), true);?>', ['referralSearchTerms']);  
OWA.items.topkeywords.asyncQueue.push(['refreshGrid']);  
OWA.items.topkeywords.load(topkeywordsurl);  
 
var topreferralsurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'referralPageUrl',  
'sort' => 'visits-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.topreferrals = new OWA.resultSetExplorer('top-referrals');  
OWA.items.topreferrals.addLinkToColumn('referralPageUrl', '<?php echo $this->makeLink(array('do' => 'base.reportReferralDetail', 'referralPageUrl' => '%s'),true);?>', ['referralPageUrl']);  
OWA.items.topreferrals.asyncQueue.push(['refreshGrid', 'top-referrals']);  
OWA.items.topreferrals.load(topreferralsurl);  
 
var topsources_url = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'source,medium',  
'sort' => 'visits-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.topsources = new OWA.resultSetExplorer('top-sources');  
OWA.items.topsources.addLinkToColumn('source', '<?php echo $this->makeLink(array('do' => 'base.reportSourceDetail', 'source' => '%s' , 'medium' => '%s'),true);?>', ['source', 'medium']);  
OWA.items.topsources.asyncQueue.push(['refreshGrid', 'top-sources']);  
OWA.items.topsources.load(topsources_url);  
 
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
 
<script type="text/x-jqote-template" id="visits-headline-template">  
<![CDATA[  
There were <*= this.data.resultSet.aggregates.visits.formatted_value *> <* if (this.data.resultSet.aggregates.visits.value > 1) {this.label = 'visits';} else {this.label = 'visit';} *> <*= this.label *> from all mediums.  
]]>  
</script>  
<table class="management">  
 
<thead>  
 
</thead>  
 
<tbody>  
<?php  
$fields = array(  
'order_id' => array(  
'label' => 'Order Id'  
),  
'order_source' => array(  
'label' => 'Order Source'  
),  
'gateway' => array(  
'label' => 'Transaction Processing Gateway'  
),  
'total_revenue' => array(  
'label' => 'Total Revenue',  
'data_type' => 'currency'  
),  
'tax_revenue' => array(  
'label' => 'Tax Revenue'  
),  
'shipping_revenue' => array(  
'label' => 'Shipping Revenue'  
),  
 
);  
?>  
 
<tr>  
<th>Order Id</th>  
<td><?php $this->out( $trans_detail['order_id'] );?></td>  
</tr>  
<tr>  
<th>Order Source</th>  
<td><?php $this->out( $trans_detail['order_source'] );?></td>  
</tr>  
<tr>  
<th>Processing Gateway</th>  
<td><?php $this->out( $trans_detail['gateway'] );?></td>  
</tr>  
<tr>  
<th>Total Revenue</th>  
<td><?php $this->out( $this->formatCurrency( $trans_detail['total_revenue'] ) );?></td>  
</tr>  
<tr>  
<th>Tax Revenue</th>  
<td><?php $this->out( $this->formatCurrency( $trans_detail['tax_revenue'] ) );?></td>  
</tr>  
<tr>  
<th>Shipping Revenue</th>  
<td><?php $this->out( $this->formatCurrency( $trans_detail['shipping_revenue'] ) );?></td>  
</tr>  
</tbody>  
</table>  
 
<h3>Transaction Line Items</h3>  
<?php if ( isset( $trans_detail['line_items'] ) ):?>  
<table class="simpleTable">  
<tr>  
<th>Product Name</th>  
<th>SKU</th>  
<th>Unit Price</th>  
<th>Quantity</th>  
<th>Item Revenue</th>  
</tr>  
 
<?php foreach ($trans_detail['line_items'] as $li): ?>  
<tr>  
<td><?php $this->out( $li['product_name'] ); ?> (<?php $this->out( $li['category'] ); ?>)</td>  
<td><?php $this->out( $li['sku'] ); ?></td>  
<td><?php $this->out( $li['quantity'] ); ?></td>  
<td><?php $this->out( $this->formatCurrency( $li['unit_price'] ) ); ?></td>  
<td><?php $this->out( $this->formatCurrency( $li['item_revenue'] ) ); ?></td>  
</tr>  
<?php endforeach; ?>  
</table>  
<?php else: ?>  
None.  
<?php endif;?>  
 
 
<div class="owa_reportSectionContent">  
<div id="trend-chart" style="height:125px;width:auto;"></div>  
<div class="owa_reportHeadline" id="content-headline"></div>  
<div id="trend-metrics"></div>  
</div>  
 
<div class="clear"></div>  
<BR>  
 
<table style="width:100%;margin-top:;">  
<tr>  
 
 
<td valign="top" style="width:50%;">  
 
<div class="owa_reportSectionContent" style="min-width:350px;">  
<div class="owa_reportSectionHeader">Transaction Roster</div>  
<div id="transactions"></div>  
 
</div>  
 
</td>  
</tr>  
</table>  
 
<script>  
//OWA.setSetting('debug', true);  
 
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits,transactions,transactionRevenue,revenuePerVisit,revenuePerTransaction,ecommerceConversionRate',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.rsh = new OWA.resultSetExplorer('trend-chart');  
OWA.items.rsh.options.metricBoxes.width = '125px';  
OWA.items.rsh.asyncQueue.push(['makeAreaChart', [{x:'date',y:'transactions'}]]);  
OWA.items.rsh.asyncQueue.push(['makeMetricBoxes', 'trend-metrics']);  
OWA.items.rsh.asyncQueue.push(['renderTemplate','#headline-template', {data: OWA.items.rsh}, 'replace', 'content-headline']);  
OWA.items.rsh.load(aurl);  
 
var transactionsurl = '<?php echo $this->makeApiLink(array(  
'do' => 'getResultSet',  
'metrics' => 'transactionRevenue,shippingRevenue,taxRevenue',  
'dimensions' => 'timestamp,transactionId',  
'sort' => 'timestamp-',  
'format' => 'json',  
'resultsPerPage' => 25,  
'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';  
 
OWA.items.transactions = new OWA.resultSetExplorer('transactions');  
OWA.items.transactions.addLinkToColumn('transactionId', '<?php echo $this->makeLink(array(  
'do' => 'base.reportTransactionDetail',  
'transactionId' => '%s'  
),true);?>', ['transactionId']);  
OWA.items.transactions.options.grid.excludeColumns = ['timestamp'];  
OWA.items.transactions.asyncQueue.push(['refreshGrid']);  
OWA.items.transactions.load(transactionsurl);  
 
 
</script>  
 
<?php require_once('js_report_templates.php');?>  
 
<script type="text/x-jqote-template" id="headline-template">  
<![CDATA[  
There were <*= this.data.resultSet.aggregates.transactions.formatted_value *> <* if (this.data.resultSet.aggregates.transactions.value > 1) {this.label = 'transactions';} else {this.label = 'transaction';} *> <*= this.label *> generating <*= this.data.resultSet.aggregates.transactionRevenue.formatted_value *>.  
]]>  
</script>  
 
 
<div class="owa_reportSectionContent">  
 
<div id="trend-chart"></div>  
 
 
<div id="trend-title" class="owa_reportHeadline"></div>  
<div id="trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>  
<div style="clear:both;"></div>  
<script>  
 
var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => $metrics,  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json',  
'constraints' => $constraints  
),true);?>';  
 
var trend = new OWA.resultSetExplorer('trend-chart');  
trend.options.sparkline.metric = 'visits';  
<?php if ($trendTitle):?>  
trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);  
<?php endif;?>  
trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);  
trend.options.metricBoxes.width = '150px';  
trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
trend.load(trendurl);  
 
</script>  
 
</div>  
<div class="owa_reportSectionHeader">Visit Summary</div>  
<div class="owa_reportSectionContent">  
<?php include('report_latest_visits.tpl');?>  
</div>  
 
<div class="owa_reportSectionHeader">Visit Clickstream</div>  
<div class="owa_reportSectionContent">  
 
 
<div>  
<table size="100%">  
<TR>  
<TH>Time</TH>  
<TH>Page</TH>  
</TR>  
<?php foreach($clickstream->resultsRows as $s): ?>  
<TR>  
<TD colspan="2">  
<table class="owa_infobox" size="100%">  
<TR>  
<TD valign="top"><?php echo $s['hour'];?>:<?php echo $s['minute'];?>:<?php echo $s['second'];?></TD>  
<TD>  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'document_id' => $s['document_id']));?>"><span class="inline_h2"><?php echo $s['page_title'];?></span></a> <span class="h_label">(<?php echo $s['page_type'];?>)</span><BR>  
<span class="info_text"><?php echo $s['url'];?></span>  
</TD>  
</TR>  
</table>  
</TD>  
</TR>  
<?php endforeach; ?>  
</table>  
</div>  
</div>  
 
<div class="owa_infobox">  
<table cellpadding="0" cellspacing="0" width="" border="0" class="visit_summary" style="">  
<TR>  
<!-- left col -->  
<TD valign="top" class="owa_visitSummaryLeftCol">  
<span class="h_label"><?php echo $visit['session_month'];?>/<?php echo $visit['session_day'];?> @ at <?php echo $visit['session_hour'];?>:<?php echo $visit['session_minute'];?></span> | <span class="info_text"><?php echo $visit['host_host'];?> <?php if ($visit['host_city']):?>- <?php echo $visit['host_city'];?>, <?php echo $visit['host_country'];?><?php endif;?></span> <?php echo $this->choose_browser_icon($visit['ua_browser_type']);?><BR>  
<table>  
<TR>  
<TD class="visit_icon" align="right" valign="bottom">  
<span class="h_label">  
<?php if ($visit['session_is_new_visitor'] == true): ?>  
<img src="<?php echo $this->makeImageLink('base/i/newuser_icon_small.png');?>" alt="New Visitor" >  
<?php else:?>  
<img src="<?php echo $this->makeImageLink('base/i/user_icon_small.png');?>" alt="Repeat Visitor">  
<?php endif;?>  
</span>  
</TD>  
 
<TD valign="bottom">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitor', 'visitor_id' => $visit['visitor_id'], 'site_id' => $site_id));?>">  
<span class="inline_h2"><?php if (!empty($visit['visitor_user_name'])):?><?php echo $visit['visitor_user_name'];?><?php elseif (!empty($visit['visitor_user_email'])):?><?php echo $visit['visitor_user_email'];?><?php else: ?><?php echo $visit['visitor_id'];?><?php endif; ?></span>  
</a>  
<?php if ($visit['session_is_new_visitor'] == false): ?>  
<?php if (!empty($visit['session_prior_session_id'])): ?>  
- <span class="info_text">(<a href="<?php echo $this->makeLink(array('session_id' => $visit['session_prior_session_id'], 'do' => 'base.reportVisit'), true);?>">Last visit was</a> <?php echo round($visit['session_time_sinse_priorsession']/(3600*24));?>  
<?php if (round($visit['session_time_sinse_priorsession']/(3600*24)) == 1): ?>  
day ago.  
<?php else: ?>  
days ago.  
<?php endif; ?>  
)</span>  
<?php endif;?>  
<?php endif;?>  
</TD>  
</TR>  
<TR>  
<TD class="visit_icon" align="right" valign="top"><span class="h_label">  
<img src="<?php echo $this->makeImageLink('base/i/document_icon.gif');?>" alt="Entry Page"></span>  
</TD>  
 
<TD valign="top">  
<a href="<?php echo $visit['document_url'];?>"><span class="inline_h4"><?php echo $visit['document_page_title'];?></span></a><?php if($visit['document_page_type']):?> (<?php echo $visit['document_page_type'];?>)<?php endif;?><BR><span class="info_text"><?php echo $visit['document_url'];?></span>  
</TD>  
</TR>  
<?php if (!empty($visit['referer_url'])):?>  
<TR>  
<TD class="visit_icon" rowspan="2" align="right" valign="top">  
 
<span class="h_label"><img src="<?php echo $this->makeImageLink('base/i/referer_icon.gif');?>" alt="Refering URL"></span>  
</TD>  
 
<TD valign="top" colspan="2">  
<a href="<?php echo $visit['referer_url'];?>"><?php if (!empty($visit['referer_page_title'])):?><span class="inline_h4"><?php echo $this->truncate($visit['referer_page_title'], 80, '...');?></span></a><BR><span class="info_text"><?php echo $this->truncate($visit['referer_url'], 80, '...');?></span><?php else:?><?php echo $this->truncate($visit['referer_url'], 50, '...');?><?php endif;?></a>  
</TD>  
 
</TR>  
<?php endif;?>  
<?php if (!empty($visit['referer_snippet'])):?>  
<TR>  
<TD colspan="1">  
<span class="snippet_text"><?php echo $visit['referer_snippet'];?></span>  
</TD>  
 
</TR>  
<?php endif;?>  
</table>  
 
</TD>  
<!-- right col -->  
<TD valign="top" align="right" class="owa_visitSummaryRightCol">  
 
<div class="visitor_info_box pages_box">  
<a href="<?php echo $this->makeLink(array('session_id' => $visit['session_id'], 'do' => 'base.reportVisit'), true);?>"><span class="large_number"><?php echo $visit['session_num_pageviews'];?></span></a>  
<br />  
<span class="info_text">Pages</span>  
</div>  
<BR>  
<?php if (!empty($visit['session_num_comments'])):?>  
<div class="comments_info_box">  
<span class="large_number"><?php echo $visit['session_num_comments'];?></span><br /><span class="info_text"></span></a>  
</div>  
<?php endif;?>  
 
</TD>  
</TR>  
</table>  
 
</div>  
<P>  
<div>  
 
<?php if ($visit['session_is_new_visitor'] == true): ?>  
New Visitor  
<?php else: ?>  
Returning Visitor <span class="info_text">(<a href="<?php echo $this->makeLink(array('session_id' => $visit['session_prior_session_id'], 'do' => 'base.reportVisit'), true,'',true);?>">Last visit was</a> <?php echo round($visit['session_time_sinse_priorsession']/(3600*24));?>  
<?php if (round($visit['session_time_sinse_priorsession']/(3600*24)) == 1): ?>  
day ago.  
<?php else: ?>  
days ago.  
<?php endif; ?>  
)</span>  
<?php endif;?>  
<?php echo $this->choose_browser_icon($visit['ua_browser_type']);?><P>  
 
<span class="inline_h2"><?php echo $visit['host_host'];?> - <?php echo $visit['session_month'];?>/<?php echo $visit['session_day'];?> at <?php echo $visit['session_hour'];?>:<?php echo $visit['session_minute'];?></span>  
<P>  
 
<?php if ($visit['host_city']):?>  
<?php echo $visit['host_city'];?>, <?php echo $visit['host_country'];?>  
<?php endif;?>  
<P>  
<table cellpadding="0" cellspacing="0" width="250" border="0" class="visit_summary">  
<TR>  
<TD class="visit_icon" align="left" valign="top" width="20">  
<img src="<?php echo $this->makeImageLink('base/i/user_icon_small.gif', true);?>" alt="Visitor">  
</TD>  
<TD valign="top">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitor', 'visitor_id' => $visit['visitor_id']), true,'',true);?>">  
<span class="inline_h2"><?php if (!empty($visit['visitor_user_name'])):?><?php echo $visit['visitor_user_name'];?><?php elseif (!empty($visit['visitor_user_email'])):?><?php echo $visit['visitor_user_email'];?><?php else: ?><?php echo $visit['visitor_id'];?><?php endif; ?></span></a>  
 
</TD>  
</TR>  
<TR>  
<TD class="visit_icon" align="left" width="20" valign="top"><span class="h_label">  
<img src="<?php echo $this->makeImageLink('base/i/document_icon.gif', true);?>" alt="Entry Page"> </span>  
</TD>  
<TD valign="top">  
<a href="<?php echo $visit['document_url'];?>"><span class="inline_h4"><?php echo $this->escapeForXml($visit['document_page_title']);?></span></a><?php if($visit['document_page_type']):?> (<?php echo $visit['document_page_type'];?>)<?php endif;?><BR>  
<span class="info_text"><?php echo $visit['document_url'];?></span>  
</TD>  
</TR>  
<?php if (!empty($visit['referer_url'])):?>  
<TR>  
<TD class="visit_icon" rowspan="2" align="left" width="20" valign="top">  
<span class="h_label"><img src="<?php echo $this->makeImageLink('base/i/referer_icon.gif', true);?>" alt="Refering URL"> </span>  
</TD>  
<TD valign="top" colspan="2">  
<a href="<?php echo $visit['referer_url'];?>"><?php if (!empty($visit['referer_page_title'])):?><span class="inline_h4"><?php echo $this->escapeForXml($this->truncate($visit['referer_page_title'], 80, '...'));?></span></a> <span class="info_text"><?php echo $this->truncate($visit['referer_url'], 35, '...');?></span><?php else:?><?php echo $this->truncate($visit['referer_url'], 50, '...');?><?php endif;?></a>  
</TD>  
</TR>  
<?endif;?>  
</table>  
 
<P><a href="<?php echo $this->makeLink(array('session_id' => $visit['session_id'], 'do' => 'base.reportVisit'), true,'',true);?>"><span class="">View Visit Details</a></P>  
 
</div>  
 
 
<div class="owa_reportSectionContent">  
 
<div id="past-visits"></div>  
<script>  
var pvurl = '<?php echo $this->makeApiLink(  
array(  
 
'do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'date',  
'sort' => 'visits-',  
'resultsPerPage' => 10,  
'format' => 'json',  
'constraints' => 'visitorId=='.$visitor_id  
),  
true);  
?>';  
 
OWA.items.pastvisits = new OWA.resultSetExplorer('past-visits');  
OWA.items.pastvisits.addLinkToColumn('visits', '<?php echo $this->makeLink(array('do' => 'base.reportVisits', 'visitorId' => $visitor_id, 'date' => '%s')); ?>', ['date']);  
OWA.items.pastvisits.asyncQueue.push(['refreshGrid']);  
OWA.items.pastvisits.load(pvurl);  
</script>  
</div>  
 
 
 
<div class="owa_reportSectionContent">  
<div id="visitor-trend" style="height:125px;width:auto;"></div>  
<div id="trend-metrics"></div>  
 
<script>  
//OWA.setSetting('debug', true);  
var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'uniqueVisitors,newVisitors,repeatVisitors,visits,visitDuration',  
'dimensions' => 'date',  
'sort' => 'date',  
'format' => 'json'), true);?>';  
 
OWA.items.visitortrend = new OWA.resultSetExplorer('visitor-trend');  
OWA.items.visitortrend.asyncQueue.push(['makeAreaChart', [{x:'date',y:'uniqueVisitors'}], 'visitor-trend']);  
OWA.items.visitortrend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);  
OWA.items.visitortrend.asyncQueue.push(['renderTemplate','#visitors-headline-template', {data: OWA.items.visitortrend}, 'replace', 'visitors-headline']);  
OWA.items.visitortrend.options.metricBoxes.width = '135px';  
OWA.items.visitortrend.load(aurl);  
 
</script>  
<div class="clear"></div>  
<div class="owa_reportHeadline" id="visitors-headline"></div>  
 
</div>  
 
 
<table width="100%">  
<TR>  
<td>  
<div class="owa_reportSectionContent" style="width:500px;">  
<div class="owa_reportSectionHeader">Latest Visits</div>  
<?php include('report_latest_visits.tpl')?>  
<?php echo $this->makePaginationFromResultSet($visits, array('do' => 'base.reportVisitors'), true);?>  
</div>  
</td>  
<TD width="50%" valign="top">  
<div class="owa_reportSectionContent">  
<div class="section_header inline_h2">Visitor Reports</div>  
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitorsLoyalty'));?>">Visitor Loyalty</a></span> - See how long ago your visitors first came to your web site.  
</P>  
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitsGeolocation'));?>">Geo-location</a></span> - See which parts of the world your visitors are coming from.  
</P>  
<P>  
<span class="inline_h3"><a href="<?php echo $this->makeLink(array('do' => 'base.reportHosts'));?>">Domains</a></span> - See which Networks or Internet hosts your visitors are coming from.  
</P>  
</div>  
 
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Browser Types</div>  
<div id="top-browsers"></div>  
<script>  
 
var bturl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits',  
'dimensions' => 'browserType',  
'sort' => 'visits-',  
'resultsPerPage' => 10,  
'format' => 'json'  
),true);?>';  
 
OWA.items.browsertypes = new OWA.resultSetExplorer('top-browsers');  
OWA.items.browsertypes.addLinkToColumn('browserType', '<?php echo $this->makeLink(array('do' => 'base.reportBrowserDetail', 'browserType' => '%s'),true); ?>', ['browserType']);  
OWA.items.browsertypes.asyncQueue.push(['refreshGrid']);  
OWA.items.browsertypes.load(bturl);  
 
</script>  
</div>  
 
<div class="owa_reportSectionContent">  
<div class="owa_reportSectionHeader">Most Frequent Visitors</div>  
<div id="top-visitors"></div>  
<script>  
 
var tvurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet',  
'metrics' => 'visits,pageViews',  
'dimensions' => 'visitorId',  
'sort' => 'visits-',  
'resultsPerPage' => 10,  
'format' => 'json'  
),true);?>';  
 
OWA.items.topvisitors = new OWA.resultSetExplorer('top-visitors');  
OWA.items.topvisitors.addLinkToColumn('visitorId', '<?php echo $this->makeLink(array('do' => 'base.reportVisitor', 'visitorId' => '%s')); ?>', ['visitorId']);  
OWA.items.topvisitors.asyncQueue.push(['refreshGrid']);  
OWA.items.topvisitors.load(tvurl);  
 
</script>  
</div>  
 
</TD>  
</TR>  
</table>  
 
<?php require_once('js_report_templates.php');?>  
 
<script type="text/x-jqote-template" id="visitors-headline-template">  
<![CDATA[  
There were <*= this.data.resultSet.aggregates.uniqueVisitors.formatted_value *> <* if (this.data.resultSet.aggregates.uniqueVisitors.value > 1) {this.label = 'visitors';} else {this.label = 'visitor';} *> <*= this.label *> to this web site.  
]]>  
</script>  
<H2><?php echo $headline;?>: <?php echo $date_label;?></H2>  
 
<table>  
<?php if (!empty($visitors)):?>  
<?php foreach ($visitors as $visitor):?>  
<TR>  
<TD><img src="<?php echo $this->makeImageLink('user_icon_small.gif');?>" align="top">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitor', 'visitor_id' => $visitor['visitor_id'], 'period' => 'all_time'));?>">  
<?if(!empty($visitor['user_name'])):  
echo $visitor['user_name'];  
elseif(!empty($visitor['user_email'])):  
echo $visitor['user_email'];  
else:  
echo $visitor['visitor_id'];  
endif;?>  
</a>  
</TD>  
</TR>  
<?php endforeach;?>  
<?php else:?>  
<TR>  
<TD>  
There are no visitors during this time period.  
</TD>  
</TR>  
<?php endif;?>  
</table>  
<div class="owa_reportSectionContent" style="width:700px;">  
<div class="owa_reportSectionHeader">Latest Visits</div>  
<?php include('report_latest_visits.tpl')?>  
<?php echo $this->makePagination($pagination, array('do' => $params['do']));?>  
</div>  
 
<table id= "" class="owa_dataGrid<?php //echo $class; ?>" summary="">  
<!-- <CAPTION>Result set for <?php echo $rs->timePeriod['label'];?>.</CAPTION> -->  
<thead>  
<tr>  
<? if ($rs->resultsRows):?>  
<?php foreach ($rs->resultsRows[0] as $k => $v):?>  
<th class="<?php if($v['result_type'] === 'dimension') { echo 'dimensionColumn';} else { echo 'metricColumn';}?>"><?php echo $v['label'];?></th>  
<?php endforeach;?>  
<?php endif;?>  
</tr>  
</thead>  
 
<tfoot>  
 
</tfoot>  
 
<tbody>  
<? if ($rs->resultsRows):?>  
<?php foreach ($rs->resultsRows as $row):?>  
<tr>  
<?php foreach ($row as $k => $v):?>  
<td class="<?php if($v['result_type'] === 'dimension') { echo 'dimensionColumn';} else { echo 'metricColumn';}?>">  
<?php if (array_key_exists('link', $v)):?>  
<a href="<?php echo $v['link'];?>"><?php echo $v['value'];?></a>  
<?php else: ?>  
<?php echo $v['value'];?>  
<?php endif;?>  
</td>  
<?php endforeach;?>  
</tr>  
<?php endforeach;?>  
<?php endif;?>  
</tbody>  
</table>  
<?php echo ("<?xml version='1.0' encoding='UTF-8'?>");?>  
<resultSet>  
<timePeriod>  
<?php foreach ($rs->timePeriod as $k => $v):?>  
<?php echo sprintf("<%s>%s</%s>\n", $k, $this->escapeForXml($v), $k);?>  
<?php endforeach;?>  
</timePeriod>  
 
<aggregates>  
<?php foreach ($rs->aggregates as $item):?>  
<?php echo sprintf("<%s name='%s' value='%s' label='%s'/>\n", $item['result_type'], $this->escapeForXml($item['name']), $this->escapeForXml($item['value']), $this->escapeForXml($item['label']));?>  
<?php endforeach;?>  
</aggregates>  
 
<resultsTotal><?php echo $rs->resultsTotal;?></resultsTotal>  
 
<resultsReturned><?php echo $rs->resultsReturned;?></resultsReturned>  
 
<resultsPerPage><?php echo $rs->resultsPerPage;?></resultsPerPage>  
 
<resultsRows>  
<?php foreach ($rs->resultsRows as $row):?>  
<row>  
<?php foreach ($row as $item):?>  
<?php echo sprintf("<%s name='%s' value='%s' label='%s'/>\n", $item['result_type'], $this->escapeForXml($item['name']), $this->escapeForXml($item['value']), $this->escapeForXml($item['label']));?>  
<?php endforeach;?>  
</row>  
<?php endforeach;?>  
</resultsRows>  
 
</resultSet>  
<TD class="item_cell"><a href="<?php echo $this->makeLink(array('do' => 'base.reportDocument', 'document_id' => $row['document_id']), true);?>"><?php echo $this->truncate($row['page_title'], 100, '...');?></a> (<?php echo $row['page_type'];?>)</TD>  
<TD class="data_cell"><?php echo $row['count']?></TD>  
<TD class="item_cell"><a href="<?php echo $row['url'];?>"><?php if (!empty($row['page_title'])):?><?php echo $this->truncate($row['page_title'], 70, '...');?><?php else:?><?php echo $this->truncate($row['url'], 70, '...');?><?php endif;?></a></TD>  
<TD class="data_cell"><?php echo $row['count']?></TD>  
 
<TD>  
<div class="owa_visitInfobox" style="width:auto;">  
 
<p class="owa_visitInfoboxTitle"><?php echo date("D M j G:i:s T",$row['session_timestamp']);?> &raquo; <?php echo $row['host_host'];?></p>  
 
<table class="owa_visitInfoboxItemContainer" cellspacing="0" width="100%">  
<TR>  
<TD>  
<table class="owa_userInfobox">  
<TD class="owa_avatar">  
<img src="<?php echo $this->getAvatarImage($row['visitor_user_email']);?>" width="30" height="30">  
</TD>  
<TD class="owa_userLabel" style="width:auto;">  
 
<span class="owa_userNameLabel">  
<a href="<?php echo $this->makeLink(array('do' => 'base.reportVisitor', 'visitor_id' => $row['visitor_id'], 'site_id' => $this->get('site_id')),true);?>">  
<?php  
if (!empty($row['visitor_user_name'])) {  
echo $row['visitor_user_name'];  
} elseif (!empty($row['visitor_user_email'])) {  
echo $row['visitor_user_email'];  
} else {  
echo $row['visitor_id'];  
}?></a></span>  
 
<?php if ($row['session_is_new_visitor'] == true): ?>  
<img src="<?php echo $this->makeImageLink('base/i/icon_new.png');?>" alt="New Visitor">  
<?php endif;?>  
<BR>  
<?php if ($row['host_city']):?>  
<span class="owa_userGeoLabel"><?php echo $row['host_city'];?>, <?php echo $row['host_country'];?></span>  
<?php endif;?>  
</TD>  
</table>  
</td>  
<TD class="owa_visitInfoboxItem">  
<?php echo $this->choose_browser_icon($row['ua_browser_type']);?>  
</TD>  
<TD class="owa_visitInfoboxItem">  
<span class="owa_largeNumber">  
<a href="<?php echo $this->makeLink(array('session_id' => $row['session_id'], 'do' => 'base.reportVisit'), true);?>">  
<?php echo $row['session_num_pageviews'];?>  
</a>  
</span>  
<BR>  
<span class="info_text">Pages</span>  
 
</TD>  
<TD class="owa_visitInfoboxItem">  
<span class="">  
<?php echo date("G:i:s",mktime(0,0,($row['session_last_req'] - $row['session_timestamp'])));?>  
</span>  
<BR>  
<span class="info_text">Length</span>  
</TD>  
</TR>  
</table>  
 
<table class="owa_visitInfoboxDocContainer">  
<TR>  
<TD class="owa_icon16x16" align="" valign="top"><span class="h_label">  
<img src="<?php echo $this->makeImageLink('base/i/document_icon.gif');?>" alt="Entry Page"></span>  
</TD>  
 
<TD valign="top">  
<span class="">  
<a href="<?php echo $row['document_url'];?>"><?php echo $row['document_page_title'];?></a>  
</span>  
<span class="owa_secondaryText">  
<?php if($row['document_page_type']):?>  
(<?php echo $row['document_page_type'];?>)  
<?php endif;?>  
</span>  
<BR>  
<span class="owa_secondaryText"><?php echo $this->truncate($row['document_url'],80,'...');?></span>  
</TD>  
</tr>  
 
<?php if (!empty($row['referer_url'])):?>  
<TR>  
<TD class="owa_icon16x16" rowspan="2" align="right" valign="top">  
 
<span class="h_label"><img src="<?php echo $this->makeImageLink('base/i/referer_icon.gif');?>" alt="Refering URL"></span>  
</TD>  
 
<TD valign="top" colspan="2">  
<span class="inline_h4">  
<a href="<?php echo $row['referer_url'];?>">  
<?php if (!empty($row['referer_page_title'])):?><?php echo $this->truncate($row['referer_page_title'], 80, '...');?></span></a><BR><span class="info_text"><?php echo $this->truncate($row['referer_url'], 80, '...');?><?php else:?><?php echo $this->truncate($row['referer_url'], 80, '...');?><?php endif;?></a></span>  
</TD>  
 
</TR>  
<?php endif;?>  
 
<?php if (!empty($row['referer_snippet'])):?>  
<TR>  
<TD colspan="1">  
<span class="snippet_text"><?php echo $row['referer_snippet'];?></span>  
</TD>  
 
</TR>  
<?php endif;?>  
 
 
</TR>  
 
</table>  
 
</div>  
</TD>  
<DIV class="panel_headline"><?php echo $headline;?></DIV>  
<DIV id="panel">  
<P>Below is the list of Web Sites that can be tracked. A site must appear in this list  
if it is to be tracked/reported separately.</P>  
 
<fieldset>  
<legend>Tracked Web Sites <span class="legend_link">(<a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile'));?>">Add a Site</a>)<span></legend>  
 
 
<TABLE width="100%" border="0" class="management">  
<thead>  
<TR>  
<TH>Name & Description</TH>  
 
<TH>Options</TH>  
</TR>  
</thead>  
<tbody>  
<?php foreach ($tracked_sites as $site => $value):?>  
<TR>  
<TD>  
<span style="font-size:14px; font-weight:bold;">  
<a href="<?php echo $this->makeLink( array('do' => 'base.reportDashboard', 'siteId' => $value['site_id'] ), false );?>"><?php $this->out( $value['name'] );?></a>  
</span><BR>  
<?php if (!empty($value['description'])):?>  
<span class="info_text"><?php $this->out( $value['description'] );?></span><BR>  
<?php endif;?>  
<span class="info_text"><?php $this->out( $value['domain'] );?></span><BR>  
</TD>  
 
<TD>  
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesProfile', 'siteId' => $value['site_id'], 'edit' => true ) );?>">Edit</a> |  
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesDelete', 'siteId' => $value['site_id'] ), false, false, false, true );?>">Delete</a> |  
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesInvocation', 'siteId' => $value['site_id'] ) );?>">Get Tracking Code</a> |  
<a href="<?php echo $this->makeLink( array('do' => 'base.optionsGoals', 'siteId' => $value['site_id'] ) );?>">Goals</a>  
</TD>  
 
</TR>  
<?php endforeach;?>  
</tbody>  
</TABLE>  
 
</fieldset>  
</div>  
 
<DIV class="panel_headline"><?php echo $headline;?></DIV>  
<div id="panel">  
<fieldset>  
 
<legend>Site Profile</legend>  
 
<form method="POST">  
 
<table class="management" style="width:auto;">  
<?php if ($edit == true):?>  
<TR>  
<TH>Site ID:</TH>  
<TD><?php $this->out( $site['site_id'] );?></TD>  
<input type="hidden" name="<?php echo $this->getNs();?>siteId" value="<?php $this->out( $site['site_id'] );?>">  
 
</TR>  
<?php endif;?>  
<TR>  
<TH>Domain:</TH>  
<?php if ($edit == true):?>  
<input type="hidden" name="<?php echo $this->getNs();?>domain" value="<?php $this->out( $site['domain'] );?>">  
<TD><?php $this->out( $site['domain'] );?></TD>  
<?php else:?>  
<TD>  
 
<select name="<?php echo $this->getNs();?>protocol">  
<option value="http://">http://</option>  
<option value="https://">https://</option>  
</select>  
 
<input type="text" name="<?php echo $this->getNs();?>domain" size="52" maxlength="70" value="<?php $this->out( $site['domain'] );?>"><BR>  
<span class="validation_error"><?php $this->out( $validation_errors['domain'] );?></span>  
</TD>  
<?php endif;?>  
</TR>  
<TR>  
<TH>Site Name:</TH>  
<TD><input type="text" name="<?php echo $this->getNs();?>name" size="52" maxlength="70" value="<?php $this->out( $site['name'] );?>"></TD>  
</TR>  
<TR>  
<TH>Description:</TH>  
<TD>  
<textarea name="<?php echo $this->getNs();?>description" cols="52" rows="3"><?php $this->out( $site['description'] );?></textarea>  
</TD>  
</TR>  
</table>  
<BR>  
<?php echo $this->createNonceFormField($action);?>  
<input type="hidden" name="<?php echo $this->getNs();?>action" value="<?php $this->out( $action, false );?>">  
<input type="submit" name="<?php echo $this->getNs();?>submit_btn" value="Save Profile">  
 
</form>  
 
</fieldset>  
 
 
<form method="post" name="owa_options">  
 
<fieldset name="owa-options" class="options">  
<legend>Site Settings</legend>  
 
<div class="setting" id="p3p_policy">  
<div class="title">P3P Compact Privacy Policy</div>  
<div class="description">This setting controls the P3P compact privacy policy that is returned to the browser when OWA sets cookies. Click <a href="http://www.p3pwriter.com/LRN_111.asp">here</a> for more information on compact privacy policies and choosing the right one for your web site.</div>  
<div class="field"><input type="text" size="50" name="<?php echo $this->getNs();?>config[p3p_policy]" value="<?php $this->out( $config['p3p_policy'] );?>"></div>  
</div>  
 
<div class="setting" id="url_params">  
<div class="title">URL Parameters</div>  
<div class="description">This setting controls the URL parameters that OWA should ignore when processing requests. This is useful for avoiding duplicate URLs due to the use of tracking or others state parameters in your URLs. Parameter names should be separated by comma.</div>  
<div class="field"><input type="text" size="50" name="<?php echo $this->getNs();?>config[query_string_filters]" value="<?php $this->out( $config['query_string_filters'] );?>"></div>  
</div>  
 
<div class="setting" id="default_page">  
<div class="title">Default Page</div>  
<div class="description">This is the page that your web server defaults to when there is no page specified in your URL (e.g. index.html). Use this setting to combine page views for www.domain.com and www.domain.com/index.html.</div>  
<div class="field"><input type="text" size="50" name="<?php echo $this->getNs();?>config[default_page]" value="<?php $this->out( $config['default_page'] );?>"></div>  
</div>  
 
<div class="setting" id="ecommerce_reporting">  
<div class="title">e-commerce Reporting</div>  
<div class="description">Adds e-commerce metrics/statistics to reports.</div>  
<div class="field">  
<select name="<?php echo $this->getNs();?>config[enableEcommerceReporting]">  
<option value="0" <?php if ( ! $this->getValue( 'enableEcommerceReporting', $config ) ):?>SELECTED<?php endif;?>>Off</option>  
<option value="1" <?php if ( $this->getValue( 'enableEcommerceReporting', $config ) ):?>SELECTED<?php endif;?>>On</option>  
</select>  
</div>  
</div>  
 
<BR>  
 
<?php echo $this->createNonceFormField('base.sitesEditSettings');?>  
<input type="hidden" name="<?php echo $this->getNs();?>siteId" value="<?php $this->out( $site['site_id'] );?>">  
<input type="hidden" name="<?php echo $this->getNs();?>module" value="base">  
<input type="hidden" name="<?php echo $this->getNs();?>action" value="base.sitesEditSettings">  
<input type="submit" name="<?php echo $this->getNs();?>submit_btn" value="Save Settings">  
</fieldset>  
</form>  
</div>  
<div class="panel_headline">Tracking Tag</div>  
<div id="panel">  
 
<P>The Domain for this web site is: <span class=""><B><?php echo $site->get('domain');?></B></P>  
<P>The Site ID for this web site is: <span class=""><B><?php echo $site_id;?></B></P>  
 
<?php include('invocation.tpl');?>  
</div>  
 
<!-- DEPRICATED -->  
<img src="<?php echo $this->makeAbsoluteLink(array('height' => $height, 'width' => $width, 'do' => $widget, 'period' => $params['period'], 'site_id' => $params['site_id'], 'format' => 'sparklineImage'), true, $this->config['action_url']); ?>">  
 
<span id="<?php echo $dom_id;?>Sparkline"><?php echo $values;?></span>  
<script>  
jQuery('#<?php echo $dom_id;?>Sparkline').sparkline('html', {width:'<?php echo $width;?>px', height:'<?php echo $height;?>px', spotRadius: 2, fillColor: '', lineColor: '#ffffff'});  
</script>  
<!-- Sparkline data for '<?php echo $dom_id;?>' -->  
<span id="<?php echo $dom_id;?>"><?php echo $data;?></span>  
 
<script>  
/* Sparkline DOM configuration for '<?php echo $dom_id;?>' */  
OWA.items['<?php echo $dom_id;?>'] = new OWA.sparkline();  
OWA.items['<?php echo $dom_id;?>'].setDomId('<?php echo $dom_id;?>');  
OWA.items['<?php echo $dom_id;?>'].setWidth('<?php echo $width;?>');  
OWA.items['<?php echo $dom_id;?>'].setHeight('<?php echo $height;?>');  
OWA.items['<?php echo $dom_id;?>'].render();  
</script>  
<div style="width:800px; margin: 0px auto -1px auto;">  
<div class="" style="text-align:center;">  
<h1>Open Web Analytics Updater</h1>  
</div>  
<br>  
<div class="layout_subview" valign="top" style="text-align:left;">  
 
<h2>Some Modules need to create or update their database tables.</h2>  
 
<P>Here is the list of modules that have updates that needs to be applied:</P>  
 
<P>  
<UL>  
 
<?php foreach ($modules as $k => $module): ?>  
 
<LI><?php echo $module; ?></LI>  
 
<?php endforeach;?>  
 
</UL>  
</P>  
<P><I>It is recommended that you backup your database before applying updates.</I></P>  
<BR>  
 
<P>  
<a href="<?php echo $this->makeLink(array('do' => 'base.updatesApply'));?>"><span class="owa-button">Apply updates</span></a>  
</P>  
 
</div>  
 
</div>  
 
 
 
 
<div class="panel_headline"><?php echo $headline;?></div>  
<div id="panel">  
<fieldset>  
 
<legend>  
Users <span class="legend_link">(<a href="<?php echo $this->makeLink(array('do' => 'base.usersProfile'));?>">Add New User</a>)</span>  
</legend>  
 
<?php if($users):?>  
 
<table class="management">  
<thead>  
<TR>  
<TH>User ID</TH>  
<TH>Real Name</TH>  
<TH>Email Address</TH>  
<TH>Role</TH>  
<TH>API Key</TH>  
<TH>Last Updated</TH>  
<TH>Options</TH>  
</TR>  
</thead>  
<tbody>  
<?php foreach ($users as $user => $value):?>  
<TR>  
<TD><?php echo $value['user_id'];?></TD>  
<TD><?php echo $value['real_name'];?></TD>  
<TD><?php echo $value['email_address'];?></TD>  
<TD><?php echo $value['role'];?></TD>  
<TD><?php echo $value['api_key'];?></TD>  
<TD><?php echo date("F j, Y, g:i a", $value['last_update_date']);?></TD>  
<TD><a href="<?php echo $this->makeLink(array('do' => 'base.usersProfile', 'edit' => true, 'user_id' => $value['user_id']));?>">Edit</a>  
<?php if ($value['id'] != 1):?>  
| <a href="<?php echo $this->makeLink( array( 'do' => 'base.usersDelete', 'user_id' => $value['user_id'] ), false, false, false, true );?>">Delete</a></TD>  
<?php endif;?>  
</TR>  
<?php endforeach;?>  
</tbody>  
</table>  
 
<?php else:?>  
There are no User Accounts.</TD>  
<?php endif;?>  
</fieldset>  
</div>  
<div class="panel_headline"><?php echo $headline;?></div>  
<div id="panel">  
<fieldset class="options">  
 
<legend>User Profile</legend>  
 
<TABLE class="form">  
 
<form method="POST">  
<TR>  
<TH>User Name</TH>  
<TD>  
<?php if ($edit === true):?>  
<input type="hidden" size="30" name="<?php echo $this->getNs();?>user_id" value="<?php echo $user['user_id']?>"><?php echo $user['user_id']?>  
<?php else:?>  
<input type="text" size="30" name="<?php echo $this->getNs();?>user_id" value="<?php echo $user['user_id']?>">  
<?php endif;?>  
</TD>  
</TR>  
<TR>  
<TH>Real Name</TH>  
<TD><input type="text" size="30" name="<?php echo $this->getNs();?>real_name" value="<?php echo $user['real_name']?>"></TD>  
</TR>  
<?php if ($user['id'] != 1):?>  
<TR>  
<TH>Role</TH>  
<TD>  
<select name="<?php echo $this->getNs();?>role">  
<?php foreach ($roles as $role):?>  
<option <?php if($user['role'] === $role): echo "SELECTED"; endif;?> value="<?php echo $role;?>"><?php echo $role;?></option>  
<?php endforeach;?>  
</select>  
</TD>  
</TR>  
<?php endif;?>  
<TR>  
<TH>E-mail Address</TH>  
<TD><input type="text"size="30" name="<?php echo $this->getNs();?>email_address" value="<?php echo $user['email_address'];?>"></TD>  
</TR>  
 
<TR>  
<TD>  
<input type="hidden" name="<?php echo $this->getNs();?>id" value="<?php echo $user['id'];?>">  
<?php echo $this->createNonceFormField($action);?>  
<input type="hidden" name="<?php echo $this->getNs();?>action" value="<?php echo $action;?>">  
<input type="submit" value="Save" name="<?php echo $this->getNs();?>save_button">  
</TD>  
</TR>  
</form>  
 
</TABLE>  
 
</fieldset>  
<?php if ($edit === true):?>  
<P>  
<fieldset class="options">  
 
<legend>Change Password</legend>  
<div style="padding:10px">  
<a href="<?php echo $this->makeLink(array('do' => 'base.passwordResetForm'))?>">Change password for this user</a>  
</div>  
</fieldset>  
<?php endif;?>  
</div>  
<div style="width:550px;margin: 0px auto -1px auto;">  
<div class="inline_h1" style="text-align:left;">Password Setup</div><BR>  
<div class="inline_h2" style="text-align:left;">Enter your new password below.</div><BR>  
<div style="width:550px; margin: 0px auto -1px auto; ">  
<b class="spiffy">  
<b class="spiffy1"><b></b></b>  
<b class="spiffy2"><b></b></b>  
<b class="spiffy3"></b>  
<b class="spiffy4"></b>  
<b class="spiffy5"></b></b>  
 
<div class="spiffyfg">  
<!-- content goes here -->  
<div id="" style="color:#ffffff; padding:30px; height:200px; text-align:left;" >  
<form method="POST">  
<div class="inline_h2">New Password</div>  
<INPUT class="owa_largeFormField" type="password" size="20" name="<?php echo $this->getNs();?>password"><BR><BR>  
<div class="inline_h2">Re-type your Password</div>  
<INPUT class="owa_largeFormField" type="password" size="20" name="<?php echo $this->getNs();?>password2"><BR><BR>  
<input type="hidden" name="<?php echo $this->getNs();?>k" value="<?php echo $key;?>">  
<input name="<?php echo $this->getNs();?>action" value="base.usersChangePassword" type="hidden">  
<INPUT class="owa_largeFormField" type="submit" size="" name="<?php echo $this->getNs();?>submit_btn" value="Save Your New Password">  
</form>  
</div>  
</div>  
 
<b class="spiffy">  
<b class="spiffy5"></b>  
<b class="spiffy4"></b>  
<b class="spiffy3"></b>  
<b class="spiffy2"><b></b></b>  
<b class="spiffy1"><b></b></b></b>  
</div>  
 
</div>  
 
An Open Web Analytics account has been created for you.  
 
Your User Name is: <?php echo $user_id;?>  
 
To login you need to set your password by clicking on the link below.  
 
<?php echo $this->makeAbsoluteLink(array('do' => 'base.usersPasswordEntry', 'k' => $key));?>  
 
Once your password has been setup you can login to OWA at the following URL:  
 
<?php echo $this->makeAbsoluteLink(array('do' => 'base.reportDashboard'));?>  
<div style="width:550px;margin: 0px auto -1px auto;">  
<div class="inline_h1" style="text-align:left;">Password Reset</div><BR>  
<div class="inline_h2" style="text-align:left;">Enter the e-mail address associated with your account.</div><BR>  
<div style="width:550px; margin: 0px auto -1px auto; ">  
<b class="spiffy">  
<b class="spiffy1"><b></b></b>  
<b class="spiffy2"><b></b></b>  
<b class="spiffy3"></b>  
<b class="spiffy4"></b>  
<b class="spiffy5"></b></b>  
 
<div class="spiffyfg">  
<!-- content goes here -->  
<div id="" style="color:#ffffff; padding:30px; height:100px; text-align:left;" >  
<form method="POST">  
<div class="inline_h3">E-mail address:</div>  
<INPUT class="owa_largeFormField" type="text" size="30" name="<?php echo $this->getNs();?>email_address" value=""></TD>  
</TR>  
 
<TR>  
<TH scope="row"></TH>  
<TD>  
 
<input name="<?php echo $this->getNs();?>action" value="base.passwordResetRequest" type="hidden"><BR><BR>  
<INPUT class="owa_largeFormField" type="submit" size="30" name="<?php echo $this->getNs();?>submit" value="Request New Password">  
</TD>  
</TR>  
 
</TABLE>  
 
</form>  
</div>  
 
</div>  
 
<b class="spiffy">  
<b class="spiffy5"></b>  
<b class="spiffy4"></b>  
<b class="spiffy3"></b>  
<b class="spiffy2"><b></b></b>  
<b class="spiffy1"><b></b></b></b>  
</div>  
 
 
<BR>  
<span class="info_text">  
<!--<a href="<?php echo $this->makeLink(array('do' => 'base.passwordResetForm'))?>">Forgot your password?</a> -->  
</span>  
</div>  
 
 
Someone, hopefully you, has requested a reset of your Open Web Analytics account password.  
 
If this message was generated in error, please disregard. If not, please click on the link below  
to complete the process.  
 
<?php echo $this->makeAbsoluteLink(array('do' => 'base.usersPasswordEntry', 'k' => $key));  
 
Your Open Web Analytics password was successfully changed on <?php echo date("F j, Y, \a\\t g:i a");?> from IP address <?php echo $ip;?>.  
 
<?php include('widget_dom.tpl');?>  
 
<div id="<?php echo $widget;?>" class="owa_widget-container" style="width:<?php if ($params['width']): echo($params['width']); else: echo(''); endif;?>;">  
 
<div id="<?php echo $widget;?>_widget-header" class="owa_widget-header">  
<table style="width:100%">  
<TR>  
<TD>  
<span class="owa_widget-title"><?php echo $title;?></span>  
</TD>  
<TD style="text-align:right;">  
<div id="">  
<a class="owa_widget-collapsetoggle" href="#<?php echo $widget;?>_widget-header">Minimize</a>  
|  
<a class="owa_widget-close" href="#<?php echo $widget;?>_widget-header">Close</a>  
</TD>  
</TR>  
</table>  
</div>  
 
<div class="owa_widget-innercontainer">  
<div id="<?php echo $widget;?>_widget-status" class="owa_widget-status">  
<img src="<?php echo $this->makeImageLink("base/i/loading.gif");?>" border="0" align="ABSMIDDLE"> Loading...  
</div>  
 
<div id="<?php echo $widget;?>_widget-content" class="owa_widget-content" style="width:<?php echo $params['width'];?>100%;"><?php echo $subview;?></div>  
 
<div id="<?php echo $widget;?>_widget-pagination" class="owa_widget-pagination"></div>  
<?php if($widget_views): ?>  
<div id="<?php echo $widget;?>_widget-controls" class="owa_widget-controls">  
<?php if ($widget_views_count > 1): ?>  
<span>Views: </span>  
<?php foreach ($widget_views as $k => $v): ?>  
<a class="owa_widget-control" href="#<?php echo $widget;?>_widget-header" name="<?php echo $k;?>"><?php echo $v;?></a> /  
<?php endforeach;?>  
<?php endif;?>  
</div>  
<?php endif; ?>  
</div>  
 
</div>  
 
<script>  
/* Widget DOM configuration for <?php echo $widget;?> */  
 
OWA.items['<?php echo $widget;?>'] = new OWA.widget();  
OWA.items['<?php echo $widget;?>'].properties = <?php echo $this->makeJson($params);?>;  
OWA.items['<?php echo $widget;?>'].properties.action = "<?php echo $do;?>";  
OWA.items['<?php echo $widget;?>'].current_view = "<?php echo $format;?>";  
OWA.items['<?php echo $widget;?>'].dom_id = "<?php echo $widget;?>";  
OWA.items['<?php echo $widget;?>'].page_num = "<?php //echo $pagination['page_num'];?>1";  
OWA.items['<?php echo $widget;?>'].max_page_num = "<?php //echo $pagination['max_page_num'];?>";  
OWA.items['<?php echo $widget;?>'].max_page_num = "<?php //$echo pagination['more_pages'];?>";  
 
</script>  
<?php include('widget_dom.tpl');?>  
 
<div id="<?php echo $widget;?>" class="owa_widget-container" style="width:<?php if ($params['width']): echo($params['width'].'px'); else: echo('auto'); endif;?>;">  
 
<?php if($widget_views): ?>  
<div id="<?php echo $widget;?>_widget-controls" class="owa_widget-controls">  
<?php if ($widget_views_count > 1): ?>  
<span>Views: </span>  
<?php foreach ($widget_views as $k => $v): ?>  
<a class="owa_widget-control" href="#<?php echo $widget;?>_widget-header" name="<?php echo $k;?>"><?php echo $v;?></a> /  
<?php endforeach;?>  
<?php endif;?>  
</div>  
<?php endif; ?>  
 
<div class="owa_widget-innercontainer">  
<div id="<?php echo $widget;?>_widget-status" class="owa_widget-status">  
<img src="<?php echo $this->makeImageLink("base/i/loading.gif");?>" border="0" align="ABSMIDDLE"> Loading...  
</div>  
 
<div id="<?php echo $widget;?>_widget-content" class="owa_widget-content" style="height:<? //$params['height'];?>px;"><?php echo $subview;?></div>  
 
<div id="<?php echo $widget;?>_widget-pagination" class="owa_widget-pagination"></div>  
 
</div>  
 
</div>  
 
<?php echo $body;?>  
<?php include($this->setTemplate('head.tpl'));?>  
<?php echo $body;?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
 
<html xmlns="http://www.w3.org/1999/xhtml">  
 
<head>  
<title>Open Web Analytics - <?php echo $page_title;?></title>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
<?php include($this->getTemplatePath('base','head.tpl'));?>  
<?php include($this->getTemplatePath('base','css.tpl'));?>  
</head>  
 
<body>  
<style>  
html {background-color: #F2F2F2;}  
</style>  
 
<div class="owa">  
<?php include($this->getTemplatePath('base', 'header.tpl'));?>  
 
<?php include($this->getTemplatePath('base', 'msgs.tpl'));?>  
 
<?php echo $body;?>  
 
<?php include($this->getTemplatePath('base', 'footer.php'));?>  
</div>  
</body>  
 
</html>  
-- Open Web Analytics -------------------------------  
 
<?php echo $body;?>  
 
<?php include($this->setTemplate('css.tpl'));?>  
 
<?php include($this->setTemplate('header.tpl'));?>  
 
<?php include($this->setTemplate('msgs.tpl'));?>  
 
<?php include($this->setTemplate('head.tpl'));?>  
 
<?php echo $body;?>  
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
 
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />  
<title>Open Web Analytics - <?php echo $page_title;?></title>  
<?php include($this->setTemplate('css.tpl'));?>  
 
<?php include($this->setTemplate('head.tpl'));?>  
</head>  
 
<body>  
<!-- <div class="host_app_nav"><img src="<?php echo $this->makeImageLink('mediawiki_icon_50h.jpg');?>" align="absmiddle"> <a href="index.php?title=Special:SpecialPages">Return to your MediaWiki >></a></div> -->  
<div id="header"><?php include($this->setTemplate('header.tpl'));?></div>  
<?php include($this->setTemplate('msgs.tpl'));?>  
<?php echo $body;?>  
<!-- <div class="host_app_nav"><img src="<?php echo $this->makeImageLink('mediawiki_icon_50h.jpg');?>" align="absmiddle"> <a href="index.php?title=Special:SpecialPages">Return to your MediaWiki >></a></div> -->  
 
<?php include($this->getTemplatePath('base', 'footer.php'));?>  
</body>  
</html>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
 
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />  
<title><?php echo $page_title;?> - Open Web Analytics</title>  
</head>  
 
<body>  
 
<?php include($this->setTemplate('css.tpl'));?>  
 
<div class="owa">  
<DIV id="header" style="text-align:center;">  
<table width="100%">  
<TR>  
<TD class="">  
<img src="<?php echo $this->makeImageLink('base/i/owa_logo_150w.jpg'); ?>" alt="Open Web Analytics"><BR>  
</TD>  
</TR>  
</table>  
</div>  
<BR>  
<?php include($this->setTemplate('msgs.tpl'));?>  
<BR>  
<?php if (isset($content)) { echo $content; }?>  
<?php echo $body;?>  
 
<BR><BR><BR><BR>  
<div style="text-align:center">  
<span class="inline_h4"><a href="http://www.openwebanalytics.com">Web Analytics</a> powered by <a href="http://www.openwebanalytics.com">Open Web Analytics</a> - v: <?php echo OWA_VERSION;?></span>  
</div>  
 
</div>  
</body>  
</html>  
<?php echo $body;?>  
<?php include($this->setTemplate('css.tpl'));?>  
 
<div class="owa">  
 
<?php include($this->setTemplate('header.tpl'));?>  
 
<?php include($this->setTemplate('msgs.tpl'));?>  
 
<?php include($this->setTemplate('head.tpl'));?>  
 
<?php echo $body;?>  
 
<?php include($this->getTemplatePath('base', 'footer.php'));?>  
 
</div>  
<kml xmlns="http://earth.google.com/kml/2.1">  
<Document>  
<name>OWA: Visits to <?php echo $site_name;?></name>  
<description>Site visits for <?php echo $period_label;?><?php echo $date_label;?></description>  
<?php if ($visits):?>  
<?php foreach ($visits as $visit):?>  
<?php if (!empty($visit['host_longitude'])):?>  
<Placemark id="<?php echo $visit['session_id'];?>">  
<name><?php echo $visit['host_host'];?> - <?php echo $visit['session_month'];?>/<?php echo $visit['session_day'];?> at <?php echo $visit['session_hour'];?>:<?php echo $visit['session_minute'];?></name>  
<description><![CDATA[<? include('report_visit_summary_balloon.tpl');?>]]></description>  
<Point>  
<coordinates><?php echo trim($visit['host_longitude']);?>,<?php echo trim($visit['host_latitude']);?>,5000</coordinates>  
</Point>  
<styleUrl>#defaultStyle</styleUrl>  
</Placemark>  
<?php endif; ?>  
<?php endforeach;?>  
<?php endif; ?>  
 
</Document>  
</kml>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_controller.php');  
 
 
/**  
* Update View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_updatesView extends owa_view {  
 
function render($data) {  
 
//switch wrapper if OWA is not embedded  
// needed becasue this view might be rendered before anything else.  
if ($this->config['is_embedded'] != true) {  
$this->t->set_template('wrapper_public.tpl');  
}  
 
$this->body->set_template('updates.tpl');// This is the inner template  
$this->body->set('headline', 'Your database needs to be upgraded...');  
$this->body->set('modules', $data['modules']);  
}  
}  
 
class owa_updatesController extends owa_controller {  
 
function action() {  
 
$data = array();  
 
$data['view_method'] = 'delegate';  
$data['view'] = 'base.updates';  
$data['modules'] = owa_coreAPI::getModulesNeedingUpdates();  
 
return $data;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* 003 Update Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_base_003_update extends owa_update {  
 
function up() {  
 
$db = owa_coreAPI::dbSingleton();  
$s = &owa_coreAPI::serviceSingleton();  
 
$entities = $s->modules[$this->module_name]->getEntities();  
 
foreach ($entities as $k => $v) {  
 
$ret = $db->alterTableType($this->c->get('base', 'ns').$v, 'InnoDB');  
 
if ($ret == true):  
$this->e->notice(sprintf('Changed Table %s to InnoDB', $v));  
else:  
$this->e->notice(sprintf('Change to Table %s failed', $v));  
return false;  
endif;  
 
}  
 
 
return true;  
 
 
}  
 
function down() {  
 
return false;  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* 004 Update Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.2.1  
*/  
 
 
class owa_base_004_update extends owa_update {  
 
function up() {  
 
// create admin user for embedded installs.  
// embedded installs did not create admin users until this release (v1.2.1)  
$cu = owa_coreAPI::getCurrentUser();  
$this->createAdminUser($cu->getUserData('email_address'));  
 
$ds = owa_coreAPI::entityFactory('base.domstream');  
$ret = $ds->createTable();  
 
if ($ret == true) {  
$this->e->notice('Domstream entity table created');  
return true;  
} else {  
$this->e->notice('Domstream entity table creation failed');  
return false;  
}  
}  
 
function down() {  
 
return false;  
}  
 
function createAdminUser($email_address) {  
 
//create user entity  
$u = owa_coreAPI::entityFactory('base.user');  
// check to see if an admin user already exists  
$u->getByColumn('role', 'admin');  
$id_check = $u->get('id');  
// if not then proceed  
if (empty($id_check)) {  
 
//Check to see if user name already exists  
$u->getByColumn('user_id', 'admin');  
 
$id = $u->get('id');  
 
// Set user object Params  
if (empty($id)) {  
 
$password = $u->generateRandomPassword();  
$u->set('user_id', 'admin');  
$u->set('role', 'admin');  
$u->set('real_name', '');  
$u->set('email_address', $email_address);  
$u->set('password', owa_lib::encryptPassword($password));  
$u->set('creation_date', time());  
$u->set('last_update_date', time());  
$ret = $u->create();  
 
owa_coreAPI::debug("Admin user created successfully.");  
 
return $password;  
 
} else {  
owa_coreAPI::debug($this->getMsg(3306));  
}  
} else {  
owa_coreAPI::debug("Admin user already exists.");  
}  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* 005 Update Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3  
*/  
 
 
class owa_base_005_update extends owa_update {  
 
var $schema_version = 5;  
var $is_cli_mode_required = true;  
 
function up() {  
 
$tables = array('owa_session', 'owa_request', 'owa_click', 'owa_feed_request');  
 
foreach ($tables as $table) {  
 
// add yyyymmdd column to owa_session  
$db = owa_coreAPI::dbSingleton();  
$db->addColumn($table, 'yyyymmdd', 'INT');  
$db->addIndex($table, 'yyyymmdd');  
$ret = $db->query("update $table set yyyymmdd =  
concat(cast(year as CHAR), lpad(CAST(month AS CHAR), 2, '0'), lpad(CAST(day AS CHAR), 2, '0')) ");  
 
if ($ret == true) {  
$this->e->notice('Added yyyymmdd column to '.$table);  
} else {  
$this->e->notice('Failed to add yyyymmdd column to '.$table);  
return false;  
}  
}  
 
$visitor = owa_coreAPI::entityFactory('base.visitor');  
 
$ret = $visitor->addColumn('num_prior_sessions');  
 
if (!$ret) {  
$this->e->notice('Failed to add num_prior_sessions column to owa_visitor');  
return false;  
}  
 
$ret = $visitor->addColumn('first_session_yyyymmdd');  
 
if (!$ret) {  
$this->e->notice('Failed to add first_session_yyyymmdd column to owa_visitor');  
return false;  
}  
 
$ret = $db->query("update owa_visitor set first_session_yyyymmdd =  
concat(cast(first_session_year as CHAR), lpad(CAST(first_session_month AS CHAR), 2, '0'), lpad(CAST(first_session_day AS CHAR), 2, '0')) ");  
 
if (!$ret) {  
$this->e->notice('Failed to populate first_session_yyyymmdd column in owa_visitor');  
return false;  
}  
 
$request = owa_coreAPI::entityFactory('base.request');  
 
$ret = $request->addColumn('prior_document_id');  
 
if (!$ret) {  
$this->e->notice('Failed to add prior_document_id column to owa_request');  
return false;  
}  
 
$ret = $request->addColumn('num_prior_sessions');  
 
if (!$ret) {  
$this->e->notice('Failed to add num_prior_sessions column to owa_request');  
return false;  
}  
 
 
$session = owa_coreAPI::entityFactory('base.session');  
 
$ret = $session->addColumn('num_prior_sessions');  
 
if (!$ret) {  
$this->e->notice('Failed to add num_prior_sessions column to owa_session');  
return false;  
}  
 
 
$ret = $session->addColumn('is_bounce');  
 
if (!$ret) {  
$this->e->notice('Failed to add is_bounce column to owa_session');  
return false;  
}  
 
$ret = $db->query("update owa_session set is_bounce = true WHERE num_pageviews = 1");  
 
if (!$ret) {  
$this->e->notice('Failed to populate is_bounce column in owa_session');  
return false;  
}  
 
$ret = $session->addColumn('referring_search_term_id');  
 
if (!$ret) {  
$this->e->notice('Failed to add referring_search_term_id column in owa_session');  
return false;  
}  
 
$ret = $session->addColumn('days_since_prior_session');  
 
if (!$ret) {  
$this->e->notice('Failed to add days_since_prior_session column in owa_session');  
return false;  
}  
 
$ret = $db->query("update owa_session set days_since_prior_session = round(time_sinse_priorsession/(3600*24)) WHERE time_sinse_priorsession IS NOT NULL and time_sinse_priorsession > 0");  
 
if (!$ret) {  
$this->e->notice('Failed to populate days_since_prior_session column in owa_session');  
return false;  
}  
 
$ret = $session->addColumn('days_since_first_session');  
 
 
if (!$ret) {  
$this->e->notice('Failed to add days_since_first_session column in owa_session');  
return false;  
}  
 
$ret = $db->query("update owa_session, owa_visitor set owa_session.days_since_first_session = round((owa_session.timestamp - owa_visitor.first_session_timestamp)/(3600*24)) WHERE owa_session.visitor_id = owa_visitor.id AND owa_visitor.first_session_timestamp IS NOT NULL");  
 
if (!$ret) {  
$this->e->notice('Failed to populate days_since_first_session column in owa_session');  
return false;  
}  
 
// add api column  
$u = owa_coreAPI::entityFactory('base.user');  
$ret = $u->addColumn('api_key');  
 
if (!$ret) {  
$this->e->notice('Failed to add api_key column to owa_user');  
return false;  
}  
 
// add uri column  
$d = owa_coreAPI::entityFactory('base.document');  
$d->addColumn('uri');  
$ret = $db->query("update owa_document set uri = substring_index(SUBSTR(url FROM 1+ length(substring_index(url, '/', 3))), '#', 1) ");  
 
if (!$ret) {  
$this->e->notice('Failed to add uri column to owa_document');  
return false;  
}  
 
$a = owa_coreAPI::entityFactory('base.action_fact');  
$ret = $a->createTable();  
 
if ($ret === true) {  
$this->e->notice('Action fact entity table created');  
} else {  
$this->e->notice('Action fact entity table creation failed');  
return false;  
}  
 
$st = owa_coreAPI::entityFactory('base.search_term_dim');  
$ret = $st->createTable();  
 
if ($ret === true) {  
$this->e->notice('Search Term Dimension entity table created');  
} else {  
$this->e->notice('Search Term Dimension entity table creation failed');  
return false;  
}  
 
// migrate search terms to new table  
$ret = $db->query(  
"INSERT INTO  
owa_search_term_dim (id, terms, term_count)  
SELECT  
distinct(CRC32(LOWER(query_terms))) as id,  
query_terms as terms,  
length(query_terms) + 1 - length(replace(query_terms,' ','')) as term_count  
FROM  
owa_referer  
WHERE  
query_terms != ''"  
);  
 
if (!$ret) {  
$this->e->notice('Failed to migrate search terms to new table.');  
return false;  
}  
 
//populate search term foreign key in session table  
$ret = $db->query(  
"UPDATE  
owa_session as session, owa_referer as referer  
SET  
session.referring_search_term_id = (CRC32(LOWER(referer.query_terms)))  
WHERE  
session.referer_id = referer.id and  
session.referer_id != 0 AND  
referer.query_terms != ''"  
);  
 
if (!$ret) {  
$this->e->notice('Failed to add referring_search_term_id values to owa_session');  
return false;  
}  
 
//populate search source in session table  
$ret = $db->query(  
"UPDATE  
owa_session as session  
SET  
session.source = 'organic-search'  
WHERE  
session.referring_search_term_id IS NOT null"  
);  
 
if (!$ret) {  
$this->e->notice('Failed to populate session.source values for organic-search');  
return false;  
}  
 
//populate search source in session table  
$ret = $db->query(  
"UPDATE  
owa_session as session  
SET  
session.source = 'referral'  
WHERE  
session.referer_id != 0 AND  
session.referer_id != '' AND  
session.referer_id IS NOT null AND  
session.source != 'feed' AND  
session.source != 'organic-search'"  
);  
 
if (!$ret) {  
$this->e->notice('Failed to populate session.source values for referral');  
return false;  
}  
 
 
// add apiKeys to each user  
$users = $db->get_results("select user_id from owa_user");  
 
foreach ($users as $user) {  
 
$u = owa_coreAPI::entityFactory('base.user');  
$u->load($user['user_id'],'user_id');  
 
if (!$u->get('api_key')) {  
$u->set('api_key', $u->generateTempPasskey($u->get('user_id')));  
$u->update();  
}  
}  
 
// change character encoding to UTF-8  
$tables = array('owa_request', 'owa_session', 'owa_feed_request', 'owa_click', 'owa_document', 'owa_ua', 'owa_site', 'owa_user', 'owa_configuration', 'owa_visitor', 'owa_os', 'owa_impression', 'owa_host', 'owa_exit','owa_domstream');  
 
foreach ($tables as $table) {  
 
// change snippet dtd  
$ret = $db->query(sprintf("ALTER TABLE %s CONVERT TO CHARACTER SET utf8", $table));  
 
if (!$ret) {  
$this->e->notice('Failed to change table character encoding for: ' .$table);  
return false;  
}  
 
}  
 
// change snippet dtd  
$ret = $db->query("ALTER TABLE owa_referer MODIFY snippet MEDIUMTEXT");  
 
if (!$ret) {  
$this->e->notice('Failed to modify snippet column of owa_referer');  
return false;  
}  
 
// change snippet dtd  
$ret = $db->query("ALTER TABLE owa_domstream MODIFY page_url VARCHAR(255)");  
 
if (!$ret) {  
$this->e->notice('Failed to modify page_url column of owa_domstream');  
return false;  
}  
 
// change snippet dtd  
$ret = $db->query("ALTER TABLE owa_domstream MODIFY events MEDIUMTEXT");  
 
if (!$ret) {  
$this->e->notice('Failed to modify events column of owa_domstream');  
return false;  
}  
 
// change snippet dtd  
$ret = $db->query("ALTER TABLE owa_site MODIFY description MEDIUMTEXT");  
 
if (!$ret) {  
$this->e->notice('Failed to modify description column of owa_site');  
return false;  
}  
 
// check for bad permissions on config file  
if (file_exists(OWA_DIR . 'owa-config.php')) {  
@chmod(OWA_DIR . 'owa-config.php', 0750);  
}  
 
if (file_exists(OWA_DIR . 'conf/owa-config.php')) {  
@chmod(OWA_DIR . 'conf/owa-config.php', 0750);  
}  
 
if (file_exists(OWA_DIR . 'cli.php')) {  
@chmod(OWA_DIR . 'cli.php', 0700);  
}  
 
// must return true  
return true;  
}  
 
function down() {  
 
$visitor = owa_coreAPI::entityFactory('base.visitor');  
$visitor->dropColumn('num_prior_sessions');  
$visitor->dropColumn('first_session_yyyymmdd');  
$session = owa_coreAPI::entityFactory('base.session');  
$session->dropColumn('yyyymmdd');  
$session->dropColumn('is_bounce');  
$session->dropColumn('referring_search_term_id');  
$session->dropColumn('days_since_first_session');  
$session->dropColumn('days_since_prior_session');  
$session->dropColumn('num_prior_sessions');  
$request = owa_coreAPI::entityFactory('base.request');  
$request->dropColumn('yyyymmdd');  
$request->dropColumn('prior_document_id');  
$request->dropColumn('num_prior_sessions');  
$click = owa_coreAPI::entityFactory('base.click');  
$click->dropColumn('yyyymmdd');  
$feed_request = owa_coreAPI::entityFactory('base.feed_request');  
$feed_request->dropColumn('yyyymmdd');  
$u = owa_coreAPI::entityFactory('base.user');  
$u->dropColumn('api_key');  
$u = owa_coreAPI::entityFactory('base.document');  
$u->dropColumn('uri');  
$af = owa_coreAPI::entityFactory('base.action_fact');  
$af->dropTable();  
$st = owa_coreAPI::entityFactory('base.search_term_dim');  
$st->dropTable();  
 
return true;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* 006 Update Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
 
class owa_base_006_update extends owa_update {  
 
var $schema_version = 6;  
var $is_cli_mode_required = true;  
 
function up() {  
 
$session = owa_coreAPI::entityFactory('base.session');  
$session_columns = array(  
'num_goals',  
'num_goal_starts',  
'goals_value',  
'location_id',  
'language',  
'source_id',  
'ad_id',  
'campaign_id',  
'latest_attributions',  
'commerce_trans_count',  
'commerce_trans_revenue',  
'commerce_items_revenue',  
'commerce_items_count',  
'commerce_items_quantity',  
'commerce_shipping_revenue',  
'commerce_tax_revenue');  
 
// create goal related columns  
$goals = owa_coreAPI::getSetting('base', 'numGoals');  
 
for ($i=1; $i <= $goals; $i++ ) {  
$session_columns[] = 'goal_'.$i;  
$session_columns[] = 'goal_'.$i.'_start';  
$session_columns[] = 'goal_'.$i.'_value';  
}  
// add columns to owa_session  
foreach ( $session_columns as $session_col_name ) {  
$ret = $session->addColumn( $session_col_name );  
if ( $ret === true ) {  
$this->e->notice( "$session_col_name added to owa_session" );  
} else {  
$this->e->notice( "Adding $session_col_name to owa_session failed." );  
return false;  
}  
}  
//rename col  
$ret = $session->renameColumn('source', 'medium');  
if (!$ret) {  
$this->e->notice('Failed to rename source column to medium in owa_session');  
return false;  
}  
 
$request = owa_coreAPI::entityFactory('base.request');  
$request_columns = array(  
'location_id',  
'language');  
 
// add columns to owa_session  
foreach ( $request_columns as $request_col_name ) {  
$ret = $request->addColumn( $request_col_name );  
if ( $ret === true ) {  
$this->e->notice( "$request_col_name added to owa_request" );  
} else {  
$this->e->notice( "Adding $request_col_name to owa_request failed." );  
return false;  
}  
}  
 
$domstream = owa_coreAPI::entityFactory('base.domstream');  
$ret = $domstream->addColumn('domstream_guid');  
 
if ( $ret === true ) {  
$this->e->notice( "domstream_guid added to owa_domstream" );  
} else {  
$this->e->notice( "Adding domstream_guid to owa_domstream failed." );  
return false;  
}  
 
$db = owa_coreAPI::dbSingleton();  
$ret = $db->query("update owa_domstream set domstream_guid = id");  
 
$site = owa_coreAPI::entityFactory('base.site');  
$ret = $site->addColumn('settings');  
 
if ( $ret === true ) {  
$this->e->notice( "settings added to owa_site" );  
} else {  
$this->e->notice( "Adding settings to owa_site failed." );  
return false;  
}  
//$db->query("alter table owa_site DROP PRIMARY KEY");  
$db->query("ALTER TABLE owa_site ADD id_1_3 INT");  
if ( $ret === true ) {  
$this->e->notice( "id_1_3 column added to owa_site" );  
} else {  
$this->e->notice( "adding id_1_3 column to owa_site failed." );  
return false;  
}  
 
$ret = $db->query("update owa_site set id_1_3 = id");  
if ( $ret === true ) {  
$this->e->notice( "populating id_1_3 in owa_site." );  
} else {  
$this->e->notice( "population of id_1_3 column in owa_site failed." );  
return false;  
}  
 
$ret = $db->query('ALTER TABLE owa_site MODIFY id BIGINT');  
if ( $ret === true ) {  
$this->e->notice( "id column modified in owa_site" );  
} else {  
$this->e->notice( "modify of id column in owa_site failed." );  
return false;  
}  
 
$ret = $db->query("update owa_site set id = CRC32(site_id)");  
if ( $ret === true ) {  
$this->e->notice( "populating id column in owa_site was successful." );  
} else {  
$this->e->notice( "populating id column in owa_site failed." );  
return false;  
}  
 
$click = owa_coreAPI::entityFactory('base.click');  
$ret = $click->addColumn('dom_element_class');  
 
if ( $ret === true ) {  
$this->e->notice( "dom_element_class added to owa_click" );  
} else {  
$this->e->notice( "Adding dom_element_class to owa_click failed." );  
return false;  
}  
 
$ret = $click->addColumn('dom_element_parent_id');  
 
if ( $ret === true ) {  
$this->e->notice( "dom_element_parent_id added to owa_click" );  
} else {  
$this->e->notice( "Adding dom_element_parent_id to owa_click failed." );  
return false;  
}  
 
 
//create new entitiy tables  
$new_entities = array(  
'base.ad_dim',  
'base.source_dim',  
'base.campaign_dim',  
'base.location_dim',  
'base.commerce_transaction_fact',  
'base.commerce_line_item_fact',  
'base.queue_item');  
 
foreach ($new_entities as $entity_name) {  
$entity = owa_coreAPI::entityFactory($entity_name);  
$ret = $entity->createTable();  
 
if ($ret === true) {  
$this->e->notice("$entity_name table created.");  
} else {  
$this->e->notice("$entity_name table failed.");  
return false;  
}  
}  
 
// must return true  
return true;  
}  
 
function down() {  
 
$session = owa_coreAPI::entityFactory('base.session');  
// owa_session columns to drop  
$session_columns = array(  
'num_goals',  
'num_goal_starts',  
'goals_value',  
'location_id',  
'language',  
'source_id',  
'ad_id',  
'campaign_id',  
'latest_attributions',  
'commerce_trans_count',  
'commerce_trans_revenue',  
'commerce_items_revenue',  
'commerce_items_count',  
'commerce_items_quantity',  
'commerce_shipping_revenue',  
'commerce_tax_revenue');  
 
// add in goal related columns  
$goals = owa_coreAPI::getSetting('base', 'numGoals');  
for ($i=1; $i <= $goals; $i++ ) {  
$session_columns[] = 'goal_'.$i;  
$session_columns[] = 'goal_'.$i.'_start';  
$session_columns[] = 'goal_'.$i.'_value';  
}  
//drop columns from owa_session  
foreach ($session_columns as $session_col_name) {  
$session->dropColumn($session_col_name);  
}  
//rename col back to original  
$session->renameColumn('medium', 'source', true);  
 
//drop request columns  
$request = owa_coreAPI::entityFactory('base.request');  
$request_columns = array(  
'location_id',  
'language');  
 
// add columns to owa_session  
foreach ( $request_columns as $request_col_name ) {  
$ret = $request->dropColumn( $request_col_name );  
}  
 
$domstream = owa_coreAPI::entityFactory('base.domstream');  
$domstream->dropColumn('domstream_guid');  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->dropColumn('settings');  
//$site->modifyColumn('id');  
$db = owa_coreAPI::dbSingleton();  
$db->query('ALTER TABLE owa_site MODIFY id SERIAL');  
$db->query('UPDATE owa_site SET id = id_1_3');  
$ret = $db->query('ALTER TABLE owa_site MODIFY id INT');  
$db->query('ALTER TABLE owa_site DROP id_1_3');  
 
$click = owa_coreAPI::entityFactory('base.click');  
$click->dropColumn('dom_element_class');  
$click->dropColumn('dom_element_parent_id');  
 
//drop tables  
$new_entities = array(  
'base.ad_dim',  
'base.source_dim',  
'base.campaign_dim',  
'base.location_dim',  
'base.commerce_transaction_fact',  
'base.commerce_line_item_fact',  
'base.queue_item');  
 
foreach ($new_entities as $entity_name) {  
$entity = owa_coreAPI::entityFactory($entity_name);  
$ret = $entity->dropTable();  
}  
 
return true;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_controller.php');  
 
/**  
* Updates Application Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_updatesApplyController extends owa_controller {  
 
function action() {  
 
// fetch list of modules that require updates  
$s = &owa_coreAPI::serviceSingleton();  
 
$modules = $s->getModulesNeedingUpdates();  
//print_r($modules);  
//return;  
 
// foreach do update in order  
 
$error = false;  
 
foreach ($modules as $k => $v) {  
 
$ret = $s->modules[$v]->update();  
 
if ($ret != true):  
$error = true;  
// if there is an error check to see if it's because the cli update mode is required  
$cli_update_required = $s->modules[$v]->isCliUpdateModeRequired();  
break;  
endif;  
 
}  
 
if ($error === true) {  
 
if($cli_update_required) {  
$this->set('error_msg', $this->getMsg(3311));  
} else {  
$this->set('error_msg', $this->getMsg(3307));  
}  
 
$this->setView('base.error');  
$this->setViewMethod('delegate');  
} else {  
 
// add data to container  
$this->set('status_code', 3308);  
$this->set('do', 'base.optionsGeneral');  
$this->setViewMethod('redirect');  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Updates Application Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_updatesApplyCliController extends owa_cliController {  
 
function __construct($params) {  
define('OWA_UPDATING', true);  
return parent::__construct($params);  
}  
 
function action() {  
 
// fetch list of modules that require updates  
$s = &owa_coreAPI::serviceSingleton();  
 
if ($this->isParam('listpending')) {  
 
return $this->listPendingUpdates();  
}  
 
if ($this->getParam('apply')) {  
 
return $this->apply($this->get('apply'));  
}  
 
if ($this->getParam('rollback')) {  
 
return $this->rollback($this->get('rollback'));  
}  
 
$modules = $s->getModulesNeedingUpdates();  
//print_r($modules);  
//return;  
 
// foreach do update in order  
if (!empty($modules)) {  
$error = false;  
 
foreach ($modules as $k => $v) {  
 
$ret = $s->modules[$v]->update();  
 
if ($ret != true):  
$error = true;  
break;  
endif;  
 
}  
 
if ($error === true) {  
owa_coreAPI::notice($this->getMsg(3307));  
} else {  
 
// add data to container  
owa_coreAPI::notice($this->getMsg(3308));  
}  
} else {  
owa_coreAPI::notice("There are no modules with pending updates to apply.");  
}  
 
 
}  
 
function listPendingUpdates() {  
 
$s = &owa_coreAPI::serviceSingleton();  
$modules = $s->getModulesNeedingUpdates();  
if ($modules) {  
owa_coreAPI::notice(sprintf("Updates pending include: %s",print_r($modules, true)));  
} else {  
owa_coreAPI::notice("No updates are pending.");  
}  
}  
 
function apply($update) {  
 
list($module, $seq) = explode('.', $update);  
$u = owa_coreAPI::updateFactory($module, $seq);  
$ret = $u->apply();  
 
if ($ret) {  
owa_coreAPI::notice("Updates applied successfully.");  
}  
}  
 
function rollback($update) {  
list($module, $seq) = explode('.', $update);  
$u = owa_coreAPI::updateFactory($module, $seq);  
$u->rollback();  
owa_coreAPI::notice("Rollback completed.");  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Users Roster View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_usersController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_users');  
return parent::__construct($params);  
}  
 
function action() {  
 
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_user');  
$db->selectColumn("*");  
$users = $db->getAllRows();  
$this->set('users', $users);  
$this->setView('base.options');  
$this->setSubview('base.users');  
}  
}  
 
 
/**  
* Users Roster View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_usersView extends owa_view {  
 
function render() {  
 
//page title  
$this->t->set('page_title', 'User Roster');  
$this->body->set_template('users.tpl');  
$this->body->set('headline', 'User Roster');  
$this->body->set('users', $this->get('users'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
require_once(OWA_BASE_DIR.'/eventQueue.php');  
 
/**  
* Add User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersAddController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$this->setRequiredCapability('edit_users');  
$this->setNonceRequired();  
 
// Check for user with the same email address  
// this is needed or else the change password feature will not know which account  
// to chane the password for.  
$v1 = owa_coreAPI::validationFactory('entityDoesNotExist');  
$v1->setConfig('entity', 'base.user');  
$v1->setConfig('column', 'email_address');  
$v1->setValues(trim($this->getParam('email_address')));  
$v1->setErrorMessage($this->getMsg(3009));  
$this->setValidation('email_address', $v1);  
 
// Check user name.  
$v2 = owa_coreAPI::validationFactory('entityDoesNotExist');  
$v2->setConfig('entity', 'base.user');  
$v2->setConfig('column', 'user_id');  
$v2->setValues(trim($this->getParam('user_id')));  
$v2->setErrorMessage($this->getMsg(3001));  
$this->setValidation('user_id', $v2);  
 
return;  
}  
 
function action() {  
 
$userManager = owa_coreApi::supportClassFactory('base', 'userManager');  
 
 
$user_params = array( 'user_id' => trim($this->params['user_id']),  
'real_name' => $this->params['real_name'],  
'role' => $this->params['role'],  
'email_address' => trim($this->params['email_address']));  
 
$temp_passkey = $userManager->createNewUser($user_params);  
 
// log account creation event to event queue  
$eq = &eventQueue::get_instance();  
$eq->log(array( 'user_id' => $this->params['user_id'],  
'real_name' => $this->params['real_name'],  
'role' => $this->params['role'],  
'email_address' => $this->params['email_address'],  
'temp_passkey' => $temp_passkey),  
'base.new_user_account');  
 
 
$this->setRedirectAction('base.users');  
$this->set('status_code', 3000);  
 
return;  
}  
 
function errorAction() {  
$this->setView('base.options');  
$this->setSubview('base.usersProfile');  
$this->set('error_code', 3009);  
//assign original form data so the user does not have to re-enter the data  
$this->set('profile', $this->params);  
 
return;  
 
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
require_once(OWA_BASE_DIR.'/eventQueue.php');  
 
/**  
* Change Password Controller  
*  
* handles from input from the Change password screen  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersChangePasswordController extends owa_controller {  
 
function owa_usersChangePasswordController($params) {  
 
return owa_usersChangePasswordController::__construct($params);  
 
}  
 
function __construct($params) {  
 
parent::__construct($params);  
 
// Add validations to the run  
$v1 = owa_coreAPI::validationFactory('stringMatch');  
$v1->setValues(array($this->getParam('password'), $this->getParam('password2')));  
$v1->setErrorMessage("Your passwords must match.");  
$this->setValidation('password_match', $v1);  
 
$v2 = owa_coreAPI::validationFactory('stringLength');  
$v2->setValues($this->getParam('password'));  
$v2->setConfig('operator', '>=');  
$v2->setConfig('length', 6);  
$v2->setErrorMessage("Your password must be at least 6 characters in length.");  
$this->setValidation('password_length', $v2);  
 
return;  
}  
 
function action() {  
 
$auth = &owa_auth::get_instance();  
$status = $auth->authenticateUserTempPasskey($this->params['k']);  
 
// log to event queue  
if ($status === true) {  
$eq = & eventQueue::get_instance();  
$new_password = array('key' => $this->params['k'], 'password' => $auth->encryptPassword($this->params['password']), 'ip' => $_SERVER['REMOTE_ADDR']);  
$eq->log($new_password, 'base.set_password');  
$auth->deleteCredentials();  
$this->setRedirectAction('base.loginForm');  
$this->set('status_code', 3006);  
} else {  
$this->setRedirectAction('base.loginForm');  
$this->set('error_code', 2011); // can't find key in the db  
}  
 
return;  
}  
 
function errorAction() {  
//print 'error action';  
$this->setView('base.usersPasswordEntry');  
$this->set('k', $this->getParam('k'));  
//$this->set('password', $this->getParam('password'));  
//$this->set('password2', $this->getParam('password2'));  
return;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Delete User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersDeleteController extends owa_adminController {  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_users');  
$this->setNonceRequired();  
return parent::__construct($params);  
}  
 
function action() {  
 
$userManager = owa_coreApi::supportClassFactory('base', 'userManager');  
 
// add check here to ensure that this is not the default user....  
$userManager->deleteUser($this->getParam('user_id'));  
 
$this->setRedirectAction('base.users');  
$this->set('status_code', 3004);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Edit User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersEditController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
 
$this->setRequiredCapability('edit_users');  
$this->setNonceRequired();  
 
// check that user_id is present  
$v1 = owa_coreAPI::validationFactory('required');  
$v1->setValues($this->getParam('user_id'));  
$this->setValidation('user_id', $v1);  
 
// Check user name exists  
$v2 = owa_coreAPI::validationFactory('entityExists');  
$v2->setConfig('entity', 'base.user');  
$v2->setConfig('column', 'user_id');  
$v2->setValues($this->getParam('user_id'));  
$v2->setErrorMessage($this->getMsg(3001));  
$this->setValidation('user_id', $v2);  
}  
 
function action() {  
 
// This needs form validation in a bad way.  
 
$u = owa_coreAPI::entityFactory('base.user');  
$u->getByColumn('user_id', $this->getParam('user_id'));  
$u->set('email_address', $this->getParam('email_address'));  
$u->set('real_name', $this->getParam('real_name'));  
 
// never change the role of the admin user  
if ($u->get('user_id') != 'admin') {  
$u->set('role', $this->getParam('role'));  
}  
$u->update();  
$this->set('status_code', 3003);  
$this->setRedirectAction('base.users');  
}  
 
function errorAction() {  
 
$this->setView('base.options');  
$this->setSubview('base.usersProfile');  
$this->set('error_code', 3311);  
$this->set('user', $this->params);  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* New user Account Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersNewAccountController extends owa_controller {  
 
function __construct($params) {  
return parent::__construct($params);  
 
}  
 
function action() {  
 
$event = $this->getParam('event');  
 
// return email view  
$data['user_id']= $event->get('user_id');  
$data['email_address']= $event->get('email_address');  
$data['temp_passkey'] = $event->get('temp_passkey');  
$data['subject'] = 'OWA User Account Setup';  
$data['view'] = 'base.usersNewAccount';  
$data['view_method'] = 'email';  
 
return $data;  
}  
 
}  
 
 
/**  
* New Account Notification View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersNewAccountView extends owa_mailView {  
 
function owa_usersNewAccountView() {  
 
return owa_usersNewAccountView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_email.tpl');  
$this->body->set_template('users_new_account_email.tpl');  
$this->body->set('user_id', $data['user_id']);  
$this->body->set('key', $data['temp_passkey']);  
 
// mailer specific  
$this->setMailSubject($data['subject']);  
$this->addMailToAddress($data['email_address'], $data['name']);  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
 
/**  
* Change Password Controller  
*  
* handles from input from the Change password screen  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersPasswordEntryController extends owa_controller {  
 
function owa_usersPasswordEntryController($params) {  
 
return owa_usersPasswordEntryController::__construct($params);  
}  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$this->set('key', $this->getParam('k'));  
$this->setView('base.usersPasswordEntry');  
return;  
}  
 
 
}  
 
/**  
* Change Password View  
*  
* Presents a simple form to the user asking them to enter a new password.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersPasswordEntryView extends owa_view {  
 
function owa_usersPasswordEntryView() {  
 
return owa_usersPasswordEntryView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_public.tpl');  
$this->body->set_template('users_change_password.tpl');  
$this->body->set('headline', $this->getMsg(3005));  
$this->body->set('key', $this->get('key'));  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_adminController.php');  
 
/**  
* Edit User Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersProfileController extends owa_controller {  
 
function owa_usersProfileController($params) {  
 
return owa_usersProfileController::__construct($params);  
}  
 
function __construct($params) {  
 
$this->setRequiredCapability('edit_users');  
return parent::__construct($params);  
}  
 
function action() {  
 
// This needs form validation in a bad way.  
//Check to see if user is passed by constructor or else fetch the object.  
if ($this->getParam('user_id')) {  
$u = owa_coreAPI::entityFactory('base.user');  
$u->getByColumn('user_id', $this->getParam('user_id'));  
$this->set('profile', $u->_getProperties());  
$this->set('edit', true);  
$this->set('user_id', $this->getParam('user_id'));  
} else {  
$this->set('profile', array());  
}  
 
$this->setView('base.options');  
$this->setSubview('base.usersProfile');  
 
return $data;  
}  
 
}  
 
/**  
* OWA User Profile View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersProfileView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
if ($this->get('edit')) {  
$this->body->set('headline', 'Edit user profile');  
$this->body->set('action', 'base.usersEdit');  
$this->body->set('edit', true);  
} else {  
$this->body->set('headline', 'Add a new user profile');  
$this->body->set('action', 'base.usersAdd');  
}  
//page title  
$this->t->set('page_title', 'User Profile');  
$this->body->set_template('users_addoredit.tpl');  
$this->body->set('roles', owa_coreAPI::getAllRoles());  
$this->body->set('user', $this->get('profile'));  
 
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
 
/**  
* Reset Password Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersResetPasswordController extends owa_controller {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$event = $this->getParam('event');  
 
$auth = &owa_auth::get_instance();  
$u = owa_coreAPI::entityFactory('base.user');  
$u->getByColumn('email_address', $event->get('email_address'));  
$u->set('temp_passkey', $auth->generateTempPasskey($u->get('user_id')));  
$status = $u->update();  
$this->e->debug('status: '.$status);  
if ($status === true):  
 
$this->setView('base.usersResetPassword');  
$this->set('key', $u->get('temp_passkey'));  
$this->set('email_address', $u->get('email_address'));  
 
else:  
$this->e->debug("could not update password in db.");  
endif;  
 
return;  
}  
 
}  
 
/**  
* Reset Password Notification View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersResetPasswordView extends owa_mailView {  
 
function render($data) {  
 
$this->t->set_template('wrapper_email.tpl');  
$this->body->set_template('users_reset_password_email.tpl');  
$this->body->set('key', $this->get('key'));  
$this->setMailSubject('Your New OWA Password');  
$this->addMailToAddress($this->get('email_address'));  
}  
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_controller.php');  
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
 
/**  
* New user Account Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersSetPasswordController extends owa_controller {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$event = $this->getParam('event');  
 
$u = owa_coreAPI::entityFactory('base.user');  
$u->getByColumn('temp_passkey', $event->get('key'));  
$u->set('temp_passkey', '');  
$u->set('password', $event->get('password'));  
$status = $u->update();  
 
if ($status == true):  
 
$data['view'] = 'base.usersSetPassword';  
$data['view_method'] = 'email';  
$data['ip'] = $event->get('ip');  
$data['subject'] = 'Password Change Complete';  
$data['email_address'] = $u->get('email_address');  
 
endif;  
 
return $data;  
}  
 
}  
 
/**  
* Set Password Notification View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_usersSetPasswordView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_email.tpl');  
$this->body->set_template('users_set_password_email.tpl');  
$this->body->set('ip', $data['ip']);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'widget.php');  
require_once(OWA_BASE_DIR.'/owa_news.php');  
 
/**  
* OWA News Widget Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_widgetOwaNewsController extends owa_widgetController {  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$this->set('title', 'OWA News');  
 
//$data['params'] = $this->params;  
 
//Fetch latest OWA news  
$rss = new owa_news;  
//print_r($this->config);  
$news = $rss->Get($this->config['owa_rss_url']);  
$this->set('news', $news);  
$this->setView('base.widgetOwaNews');  
}  
 
}  
 
class owa_widgetOwaNewsView extends owa_view {  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('news.tpl');  
$this->body->set('news', $data['news']);  
}  
 
}  
 
?>  
<?php  
 
 
 
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_view.php');  
require_once(OWA_BASE_DIR.'/owa_reportController.php');  
 
/**  
* XML Visits Geolocation Report Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_xmlVisitsGeolocationController extends owa_reportController {  
 
function owa_xmlVisitsGeolocationController($params) {  
 
return owa_xmlVisitsGeolocationController::__construct($params);  
}  
 
function __construct($params) {  
 
return parent::__construct($params);  
}  
 
function action() {  
 
$site_id = $this->getParam('site_id');  
if ($site_id):  
//get site labels  
$s = owa_coreAPI::entityFactory('base.site');  
$s->getByColumn('site_id', $site_id);  
$this->set('site_name', $s->get('name'));  
$this->set('site_description', $s->get('description'));  
else:  
$this->set('site_name', 'All Sites');  
$this->set('site_description', 'All Sites Tracked by OWA');  
endif;  
 
//setup Metrics  
$m = owa_coreApi::metricFactory('base.latestVisits');  
$m->setConstraint('site_id', $this->getParam('site_id'));  
//$period = $this->makeTimePeriod('all_time');  
$m->setPeriod($this->getPeriod());  
$m->setLimit(100);  
$m->setOrder('DESC');  
$this->set('latest_visits', $m->generate());  
$this->setView('base.xmlVisitsGeolocation');  
 
return;  
 
}  
 
}  
 
 
 
/**  
* Visits Geolocation xml View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_xmlVisitsGeolocationView extends owa_view {  
 
function owa_xmlVisitsGeolocationView() {  
 
return owa_xmlVisitsGeolocationView::__construct();  
}  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
 
// load body template  
$this->body->set_template('xml_visits_geolocation.tpl');  
//$this->body->set_template('kml_google_sample.tpl');  
$this->body->set('visits', $this->get('latest_visits'));  
$this->body->set('site_name', $this->get('site_name'));  
$this->body->set('site_domain', $this->get('site_domain'));  
$this->body->set('site_description', $this->get('site_description'));  
$this->body->set('xml', trim('<?xml version="1.0" encoding="UTF-8"?>'));  
$this->_setLinkState();  
 
//if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')):  
// ob_start("ob_gzhandler");  
// header('Content-type: text/xml', true);  
// ob_end_flush();  
//else:  
//header('Content-type: text/xml', true);  
header('Content-type: application/vnd.google-earth.kml+xml; charset=UTF-8', true);  
//endif:  
 
return;  
}  
 
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_DIR.'owa_lib.php');  
require_once(OWA_DIR.'owa_view.php');  
require_once(OWA_DIR.'owa_adminController.php');  
 
/**  
* Example Settings/Options Controller  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
class owa_exampleSettingsController extends owa_adminController {  
 
function __construct($params) {  
 
parent::__construct($params);  
$this->type = 'options';  
$this->setRequiredCapability('edit_settings');  
}  
 
function action() {  
 
// add data to container  
$this->setView('base.options');  
$this->setSubview('base.exampleSettings');  
}  
 
}  
 
/**  
* Options View  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_exampleSettingsView extends owa_view {  
 
function __construct($params) {  
//set page type  
$this->_setPageType('Administration Page');  
return parent::__construct($params);  
}  
 
function render($data) {  
 
// load template  
$this->body->setTemplateFile('hello', 'example_settings.php');  
// assign headline  
$this->body->set('headline', 'Example Settings Page');  
}  
 
 
}  
 
 
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_module.php');  
 
/**  
* Hello World Module  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_helloModule extends owa_module {  
 
 
function __construct() {  
 
$this->name = 'hello';  
$this->display_name = 'Hello World';  
$this->group = 'hello';  
$this->author = 'Peter Adams';  
$this->version = '1.0';  
$this->description = 'Hello world sample module.';  
$this->config_required = false;  
$this->required_schema_version = 1;  
 
return parent::__construct();  
}  
 
/**  
* Registers Admin panels with the core API  
*  
*/  
function registerAdminPanels() {  
 
$this->addAdminPanel(array( 'do' => 'hello.exampleSettings',  
'priviledge' => 'admin',  
'anchortext' => 'Hello World!',  
'group' => 'Test',  
'order' => 1));  
 
 
return;  
 
}  
 
function registerNavigation() {  
 
/*$this->addNavigationLink(array('view' => 'base.reportDocument',  
'nav_name' => 'subnav',  
'ref' => 'base.reportClicks',  
'priviledge' => 'viewer',  
'anchortext' => 'Click Map Report',  
'order' => 1));  
 
*/  
 
return;  
 
}  
 
/**  
* Registers Event Handlers with queue queue  
*  
*/  
function _registerEventHandlers() {  
 
 
// Clicks  
//$this->_addHandler('base.click', 'clickHandlers');  
 
return;  
 
}  
 
function _registerEntities() {  
 
//$this->entities[] = 'myentity';  
}  
 
 
}  
 
 
?>  
<h2><?php echo $headline; ?></h2>  
 
Hello world. This is how you create a settings page.  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2010 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_location.php');  
 
if (!class_exists('PEAR_Exception')) {  
set_include_path(get_include_path().PATH_SEPARATOR.OWA_MODULES_DIR.'maxmind_geoip/includes/PEAR-1.9.1/');  
}  
 
define('OWA_MAXMIND_DIR', OWA_MODULES_DIR.  
'maxmind_geoip'.DIRECTORY_SEPARATOR.  
'includes'.DIRECTORY_SEPARATOR.  
'Net_GeoIP-1.0.0RC3'.DIRECTORY_SEPARATOR);  
 
if (!class_exists('Net_GeoIP')) {  
require_once(OWA_MAXMIND_DIR.'Net/GeoIP.php');  
}  
 
set_include_path(  
get_include_path().PATH_SEPARATOR.  
OWA_MODULES_DIR.'maxmind_geoip/includes/Net_GeoIP-1.0.0RC3/'  
);  
 
require_once(OWA_MODULES_DIR.  
'maxmind_geoip'.DIRECTORY_SEPARATOR.  
'includes'.DIRECTORY_SEPARATOR.  
'maxmind-ws/GeoCityLocateIspOrg.class.php');  
 
 
/**  
* Maxmind Geolocation Wrapper  
*  
* See http://www.maxmind.com/app/php for API documentation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
class owa_maxmind extends owa_location {  
 
/**  
* URL template for REST based web service  
*  
* @var unknown_type  
*/  
var $ws_url = '';  
var $db_file_dir;  
var $db_file_name = 'GeoLiteCity.dat';  
var $db_file_path;  
var $db_File_present = false;  
 
/**  
* Constructor  
*  
* @return owa_hostip  
*/  
function __construct() {  
 
if ( ! defined( 'OWA_MAXMIND_DATA_DIR' ) ) {  
define('OWA_MAXMIND_DATA_DIR', OWA_DATA_DIR.'maxmind'.DIRECTORY_SEPARATOR);  
}  
 
$this->db_file_path = OWA_MAXMIND_DATA_DIR.$this->db_file_name;  
 
if ( file_exists( $this->db_file_path ) ) {  
$this->db_file_present = true;  
} else {  
owa_coreAPI::notice('Maxmind DB file could is not present at: ' . OWA_MAXMIND_DATA_DIR);  
}  
 
return parent::__construct();  
}  
 
function isDbReady() {  
 
return $this->db_file_present;  
}  
 
/**  
* Fetches the location from the Maxmind local db  
*  
* @param string $ip  
*/  
function getLocation($location_map) {  
 
if ( ! $this->isDbReady() ) {  
return $location_map;  
}  
 
if ( ! array_key_exists( 'ip_address', $location_map ) ) {  
return $location_map;  
}  
 
// check for shared memory capability  
if ( function_exists( 'shmop_open' ) ) {  
$flag = Net_GeoIP::SHARED_MEMORY ;  
} else {  
$flag = Net_GeoIp::STANDARD ;  
}  
 
$geoip = Net_GeoIP::getInstance($this->db_file_path, $flag);  
$location = $geoip->lookupLocation($location_map['ip_address']);  
 
if ($location) {  
 
$location_map['city'] = strtolower(trim($location->__get('city')));  
$location_map['state'] = strtolower(trim($location->__get('region')));  
$location_map['country'] = strtolower(trim($location->__get('countryName')));  
$location_map['country_code'] = strtoupper(trim($location->__get('countryCode')));  
$location_map['country_code3'] = strtoupper(trim($location->__get('countryCode3')));  
$location_map['latitude'] = trim($location->__get('latitude'));  
$location_map['longitude'] = trim($location->__get('longitude'));  
$location_map['dma_code'] = trim($location->__get('dmaCode'));  
$location_map['area_code'] = trim($location->__get('areaCode'));  
$location_map['postal_code'] = trim($location->__get('postalCode'));  
}  
 
return $location_map;  
}  
 
 
function getLocationFromWebService($location_map) {  
 
$license_key = owa_coreAPI::getSetting('maxmind_geoip', 'ws_license_key');  
 
if ( ! array_key_exists( 'ip_address', $location_map ) ) {  
return $location_map;  
}  
 
$geoloc = GeoCityLocateIspOrg::getInstance();  
$geoloc->setLicenceKey( $license_key );  
$geoloc->setIP( $location_map['ip_address'] );  
 
if ( $geoloc->isError() ) {  
owa_coreAPI::debug( $geoloc->isError().": " . $geoloc->getError() );  
return $location_map;  
}  
 
$location_map['city'] = strtolower( trim( $geoloc->getCity() ) );  
$location_map['state'] = strtolower( trim($geoloc->getState() ) );  
$location_map['country'] = strtolower( trim( $geoloc->lookupCountryCode( $geoloc->getCountryCode() ) ) );  
$location_map['country_code'] = strtoupper( trim($geoloc->getCountryCode() ) );  
$location_map['latitude'] = trim( $geoloc->getLat() );  
$location_map['longitude'] = trim( $geoloc->getLong() );  
$location_map['dma_code'] = trim( $geoloc->getMetroCode() );  
$location_map['dma'] = trim( $geoloc->lookupMetroCode( $geoloc->getMetroCode() ) );  
$location_map['area_code'] = trim( $geoloc->getAreaCode() );  
$location_map['postal_code'] = trim( $geoloc->getZip() );  
$location_map['isp'] = trim( $geoloc->getIsp() );  
$location_map['organization'] = trim( $geoloc->getOrganization() );  
$location_map['subcountry_code'] = trim( $geoloc->lookupSubCountryCode( $geoloc->getState(), $geoloc->getCountryCode() ) );  
 
return $location_map;  
}  
 
}  
 
?>  
<?php  
/**  
* +----------------------------------------------------------------------+  
* | PHP version 5 |  
* +----------------------------------------------------------------------+  
* | Copyright (C) 2004 MaxMind LLC |  
* +----------------------------------------------------------------------+  
* | This library is free software; you can redistribute it and/or |  
* | modify it under the terms of the GNU Lesser General Public |  
* | License as published by the Free Software Foundation; either |  
* | version 2.1 of the License, or (at your option) any later version. |  
* | |  
* | This library is distributed in the hope that it will be useful, |  
* | but WITHOUT ANY WARRANTY; without even the implied warranty of |  
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |  
* | Lesser General Public License for more details. |  
* | |  
* | You should have received a copy of the GNU Lesser General Public |  
* | License along with this library; if not, write to the Free Software |  
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |  
* | USA, or view it online at http://www.gnu.org/licenses/lgpl.txt. |  
* +----------------------------------------------------------------------+  
* | Authors: Jim Winstead <jimw@apache.org> (original Maxmind version) |  
* | Hans Lellelid <hans@xmpl.org> |  
* +----------------------------------------------------------------------+  
*  
* @category Net  
* @package Net_GeoIP  
* @author Jim Winstead <jimw@apache.org> (original Maxmind PHP API)  
* @author Hans Lellelid <hans@xmpl.org>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @link http://pear.php.net/package/Net_GeoIp  
* $Id: GeoIP.php 296763 2010-03-25 00:53:44Z clockwerx $  
*/  
 
require_once 'PEAR/Exception.php';  
 
/**  
* GeoIP class provides an API for performing geo-location lookups based on IP  
* address.  
*  
* To use this class you must have a [binary version] GeoIP database. There is  
* a free GeoIP country database which can be obtained from Maxmind:  
* {@link http://www.maxmind.com/app/geoip_country}  
*  
*  
* <b>SIMPLE USE</b>  
*  
*  
* Create an instance:  
*  
* <code>  
* $geoip = Net_GeoIP::getInstance('/path/to/geoipdb.dat', Net_GeoIP::SHARED_MEMORY);  
* </code>  
*  
* Depending on which database you are using (free, or one of paid versions)  
* you must use appropriate lookup method:  
*  
* <code>  
* // for free country db:  
* $country_name = $geoip->lookupCountryName($_SERVER['REMOTE_ADDR']);  
* $country_code = $geoip->lookupCountryCode($_SERVER['REMOTE_ADDR']);  
*  
* // for [non-free] region db:  
* list($ctry_code, $region) = $geoip->lookupRegion($_SERVER['REMOTE_ADDR']);  
*  
* // for [non-free] city db:  
* $location = $geoip->lookupLocation($_SERVER['REMOTE_ADDR']);  
* print "city: " . $location->city . ", " . $location->region;  
* print "lat: " . $location->latitude . ", long: " . $location->longitude;  
*  
* // for organization or ISP db:  
* $org_or_isp_name = $geoip->lookupOrg($_SERVER['REMOTE_ADDR']);  
* </code>  
*  
*  
* <b>MULTIPLE INSTANCES</b>  
*  
*  
* You can have several instances of this class, one for each database file  
* you are using. You should use the static getInstance() singleton method  
* to save on overhead of setting up database segments. Note that only one  
* instance is stored per filename, and any flags will be ignored if an  
* instance already exists for the specifiedfilename.  
*  
* <b>Special note on using SHARED_MEMORY flag</b>  
*  
* If you are using SHARED_MEMORY (shmop) you can only use SHARED_MEMORY for  
* one (1) instance (i.e. for one database). Any subsequent attempts to  
* instantiate using SHARED_MEMORY will read the same shared memory block  
* already initialized, and therefore will cause problems since the expected  
* database format won't match the database in the shared memory block.  
*  
* Note that there is no easy way to flag "nice errors" to prevent attempts  
* to create new instances using SHARED_MEMORY flag and it is also not posible  
* (in a safe way) to allow new instances to overwrite the shared memory block.  
*  
* In short, is you are using multiple databses, use the SHARED_MEMORY flag  
* with care.  
*  
*  
* <b>LOOKUPS ON HOSTNAMES</b>  
*  
*  
* Note that this PHP API does NOT support lookups on hostnames. This is so  
* that the public API can be kept simple and so that the lookup functions  
* don't need to try name lookups if IP lookup fails (which would be the only  
* way to keep the API simple and support name-based lookups).  
*  
* If you do not know the IP address, you can convert an name to IP very  
* simply using PHP native functions or other libraries:  
*  
* <code>  
* $geoip->lookupCountryName(gethostbyname('www.sunset.se'));  
* </code>  
*  
* Or, if you don't know whether an address is a name or ip address, use  
* application-level logic:  
*  
* <code>  
* if (ip2long($ip_or_name) === false) {  
* $ip = gethostbyname($ip_or_name);  
* } else {  
* $ip = $ip_or_name;  
* }  
* $ctry = $geoip->lookupCountryName($ip);  
* </code>  
*  
* @category Net  
* @package Net_GeoIP  
* @author Jim Winstead <jimw@apache.org> (original Maxmind PHP API)  
* @author Hans Lellelid <hans@xmpl.org>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @link http://pear.php.net/package/Net_GeoIp  
*/  
class Net_GeoIP  
{  
/**  
* Exception error code used for invalid IP address.  
*/  
const ERR_INVALID_IP = 218624992; // crc32('Net_GeoIP::ERR_INVALID_IP')  
 
/**  
* Exception error code when there is a DB-format-related error.  
*/  
const ERR_DB_FORMAT = 866184008; // crc32('Net_GeoIP::ERR_DB_FORMAT')  
 
public static $COUNTRY_CODES = array(  
"", "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ",  
"AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH",  
"BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA",  
"CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU",  
"CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG",  
"EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB",  
"GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT",  
"GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN",  
"IO", "IQ", "IR", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM",  
"KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS",  
"LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN",  
"MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA",  
"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA",  
"PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY",  
"QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI",  
"SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD",  
"TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO", "TL", "TR", "TT", "TV", "TW",  
"TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN",  
"VU", "WF", "WS", "YE", "YT", "RS", "ZA", "ZM", "ME", "ZW", "A1", "A2", "O1",  
"AX", "GG", "IM", "JE", "BL", "MF"  
);  
 
public static $COUNTRY_CODES3 = array(  
"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG",  
"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI",  
"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC",  
"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV",  
"CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH",  
"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD",  
"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM",  
"GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO",  
"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA",  
"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU",  
"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC",  
"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL",  
"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER",  
"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT",  
"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM",  
"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF",  
"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA",  
"UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT",  
"WLF","WSM","YEM","YT","SRB","ZAF","ZMB","MNE","ZWE","A1","A2","O1",  
"ALA","GGY","IMN","JEY","BLM","MAF"  
);  
 
public static $COUNTRY_NAMES = array(  
"", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates",  
"Afghanistan", "Antigua and Barbuda", "Anguilla", "Albania", "Armenia",  
"Netherlands Antilles", "Angola", "Antarctica", "Argentina", "American Samoa",  
"Austria", "Australia", "Aruba", "Azerbaijan", "Bosnia and Herzegovina",  
"Barbados", "Bangladesh", "Belgium", "Burkina Faso", "Bulgaria", "Bahrain",  
"Burundi", "Benin", "Bermuda", "Brunei Darussalam", "Bolivia", "Brazil",  
"Bahamas", "Bhutan", "Bouvet Island", "Botswana", "Belarus", "Belize",  
"Canada", "Cocos (Keeling) Islands", "Congo, The Democratic Republic of the",  
"Central African Republic", "Congo", "Switzerland", "Cote D'Ivoire", "Cook Islands",  
"Chile", "Cameroon", "China", "Colombia", "Costa Rica", "Cuba", "Cape Verde",  
"Christmas Island", "Cyprus", "Czech Republic", "Germany", "Djibouti",  
"Denmark", "Dominica", "Dominican Republic", "Algeria", "Ecuador", "Estonia",  
"Egypt", "Western Sahara", "Eritrea", "Spain", "Ethiopia", "Finland", "Fiji",  
"Falkland Islands (Malvinas)", "Micronesia, Federated States of", "Faroe Islands",  
"France", "France, Metropolitan", "Gabon", "United Kingdom",  
"Grenada", "Georgia", "French Guiana", "Ghana", "Gibraltar", "Greenland",  
"Gambia", "Guinea", "Guadeloupe", "Equatorial Guinea", "Greece", "South Georgia and the South Sandwich Islands",  
"Guatemala", "Guam", "Guinea-Bissau",  
"Guyana", "Hong Kong", "Heard Island and McDonald Islands", "Honduras",  
"Croatia", "Haiti", "Hungary", "Indonesia", "Ireland", "Israel", "India",  
"British Indian Ocean Territory", "Iraq", "Iran, Islamic Republic of",  
"Iceland", "Italy", "Jamaica", "Jordan", "Japan", "Kenya", "Kyrgyzstan",  
"Cambodia", "Kiribati", "Comoros", "Saint Kitts and Nevis", "Korea, Democratic People's Republic of",  
"Korea, Republic of", "Kuwait", "Cayman Islands",  
"Kazakstan", "Lao People's Democratic Republic", "Lebanon", "Saint Lucia",  
"Liechtenstein", "Sri Lanka", "Liberia", "Lesotho", "Lithuania", "Luxembourg",  
"Latvia", "Libyan Arab Jamahiriya", "Morocco", "Monaco", "Moldova, Republic of",  
"Madagascar", "Marshall Islands", "Macedonia",  
"Mali", "Myanmar", "Mongolia", "Macau", "Northern Mariana Islands",  
"Martinique", "Mauritania", "Montserrat", "Malta", "Mauritius", "Maldives",  
"Malawi", "Mexico", "Malaysia", "Mozambique", "Namibia", "New Caledonia",  
"Niger", "Norfolk Island", "Nigeria", "Nicaragua", "Netherlands", "Norway",  
"Nepal", "Nauru", "Niue", "New Zealand", "Oman", "Panama", "Peru", "French Polynesia",  
"Papua New Guinea", "Philippines", "Pakistan", "Poland", "Saint Pierre and Miquelon",  
"Pitcairn Islands", "Puerto Rico", "Palestinian Territory",  
"Portugal", "Palau", "Paraguay", "Qatar", "Reunion", "Romania",  
"Russian Federation", "Rwanda", "Saudi Arabia", "Solomon Islands",  
"Seychelles", "Sudan", "Sweden", "Singapore", "Saint Helena", "Slovenia",  
"Svalbard and Jan Mayen", "Slovakia", "Sierra Leone", "San Marino", "Senegal",  
"Somalia", "Suriname", "Sao Tome and Principe", "El Salvador", "Syrian Arab Republic",  
"Swaziland", "Turks and Caicos Islands", "Chad", "French Southern Territories",  
"Togo", "Thailand", "Tajikistan", "Tokelau", "Turkmenistan",  
"Tunisia", "Tonga", "Timor-Leste", "Turkey", "Trinidad and Tobago", "Tuvalu",  
"Taiwan", "Tanzania, United Republic of", "Ukraine",  
"Uganda", "United States Minor Outlying Islands", "United States", "Uruguay",  
"Uzbekistan", "Holy See (Vatican City State)", "Saint Vincent and the Grenadines",  
"Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.",  
"Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte",  
"Serbia", "South Africa", "Zambia", "Montenegro", "Zimbabwe",  
"Anonymous Proxy","Satellite Provider","Other",  
"Aland Islands","Guernsey","Isle of Man","Jersey","Saint Barthelemy","Saint Martin"  
);  
 
// storage / caching flags  
const STANDARD = 0;  
const MEMORY_CACHE = 1;  
const SHARED_MEMORY = 2;  
 
// Database structure constants  
const COUNTRY_BEGIN = 16776960;  
const STATE_BEGIN_REV0 = 16700000;  
const STATE_BEGIN_REV1 = 16000000;  
 
const STRUCTURE_INFO_MAX_SIZE = 20;  
const DATABASE_INFO_MAX_SIZE = 100;  
const COUNTRY_EDITION = 106;  
const REGION_EDITION_REV0 = 112;  
const REGION_EDITION_REV1 = 3;  
const CITY_EDITION_REV0 = 111;  
const CITY_EDITION_REV1 = 2;  
const ORG_EDITION = 110;  
const SEGMENT_RECORD_LENGTH = 3;  
const STANDARD_RECORD_LENGTH = 3;  
const ORG_RECORD_LENGTH = 4;  
const MAX_RECORD_LENGTH = 4;  
const MAX_ORG_RECORD_LENGTH = 300;  
const FULL_RECORD_LENGTH = 50;  
 
const US_OFFSET = 1;  
const CANADA_OFFSET = 677;  
const WORLD_OFFSET = 1353;  
const FIPS_RANGE = 360;  
 
// SHMOP memory address  
const SHM_KEY = 0x4f415401;  
 
/**  
* @var int  
*/  
private $flags = 0;  
 
/**  
* @var resource  
*/  
private $filehandle;  
 
/**  
* @var string  
*/  
private $memoryBuffer;  
 
/**  
* @var int  
*/  
private $databaseType;  
 
/**  
* @var int  
*/  
private $databaseSegments;  
 
/**  
* @var int  
*/  
private $recordLength;  
 
/**  
* The memory addr "id" for use with SHMOP.  
* @var int  
*/  
private $shmid;  
 
/**  
* Support for singleton pattern.  
* @var array  
*/  
private static $instances = array();  
 
/**  
* Construct a Net_GeoIP instance.  
* You should use the getInstance() method if you plan to use multiple databases or  
* the same database from several different places in your script.  
*  
* @param string $filename Path to binary geoip database.  
* @param int $flags Flags  
*  
* @see getInstance()  
*/  
public function __construct($filename = null, $flags = null)  
{  
if ($filename !== null) {  
$this->open($filename, $flags);  
}  
// store the instance, so that it will be returned by a call to  
// getInstance() (with the same db filename).  
self::$instances[$filename] = $this;  
}  
 
/**  
* Calls the close() function to free any resources.  
* @see close()  
*  
* COMMENTED OUT TO ADDRESS BUG IN PHP 5.0.4, 5.0.5dev. THIS RESOURCE  
* SHOULD AUTOMATICALLY BE FREED AT SCRIPT CLOSE, SO A DESTRUCTOR  
* IS A GOOD IDEA BUT NOT NECESSARILY A NECESSITY.  
public function __destruct()  
{  
$this->close();  
}  
*/  
 
/**  
* Singleton method, use this to get an instance and avoid re-parsing the db.  
*  
* Unique instances are instantiated based on the filename of the db. The flags  
* are ignored -- in that requests to for instance with same filename but different  
* flags will return the already-instantiated instance. For example:  
* <code>  
* // create new instance with memory_cache enabled  
* $geoip = Net_GeoIP::getInstance('C:\mydb.dat', Net_GeoIP::MEMORY_CACHE);  
* ....  
*  
* // later in code, request instance with no flags specified.  
* $geoip = Net_GeoIP::getInstance('C:\mydb.dat');  
*  
* // Normally this means no MEMORY_CACHE but since an instance  
* // with memory cache enabled has already been created for 'C:\mydb.dat', the  
* // existing instance (with memory cache) will be returned.  
* </code>  
*  
* NOTE: You can only use SHARED_MEMORY flag for one instance! Any subsquent instances  
* that attempt to use the SHARED_MEMORY will use the *same* shared memory, which will break  
* your script.  
*  
* @param string $filename Filename  
* @param int $flags Flags that control class behavior.  
* + Net_GeoIp::SHARED_MEMORY  
* Use SHMOP to share a db among multiple PHP instances.  
* NOTE: ONLY ONE GEOIP INSTANCE CAN USE SHARED MEMORY!!!  
* + Net_GeoIp::MEMORY_CACHE  
* Store the full contents of the database in memory for current script.  
* This is useful if you access the database several times in a script.  
* + Net_GeoIp::STANDARD  
* [default] standard no-cache version.  
*  
* @return Net_GeoIP  
*/  
public static function getInstance($filename = null, $flags = null)  
{  
if (!isset(self::$instances[$filename])) {  
self::$instances[$filename] = new Net_GeoIP($filename, $flags);  
}  
return self::$instances[$filename];  
}  
 
/**  
* Opens geoip database at filename and with specified flags.  
*  
* @param string $filename File to open  
* @param int $flags Flags  
*  
* @return void  
*  
* @throws PEAR_Exception if unable to open specified file or shared memory.  
*/  
public function open($filename, $flags = null)  
{  
if ($flags !== null) {  
$this->flags = $flags;  
}  
if ($this->flags & self::SHARED_MEMORY) {  
$this->shmid = @shmop_open(self::SHM_KEY, "a", 0, 0);  
if ($this->shmid === false) {  
$this->loadSharedMemory($filename);  
$this->shmid = @shmop_open(self::SHM_KEY, "a", 0, 0);  
if ($this->shmid === false) { // should never be false as loadSharedMemory() will throw Exc if cannot create  
throw new PEAR_Exception("Unable to open shared memory at key: " . dechex(self::SHM_KEY));  
}  
}  
} else {  
$this->filehandle = fopen($filename, "rb");  
if (!$this->filehandle) {  
throw new PEAR_Exception("Unable to open file: $filename");  
}  
if ($this->flags & self::MEMORY_CACHE) {  
$s_array = fstat($this->filehandle);  
$this->memoryBuffer = fread($this->filehandle, $s_array['size']);  
}  
}  
$this->setupSegments();  
}  
 
/**  
* Loads the database file into shared memory.  
*  
* @param string $filename Path to database file to read into shared memory.  
*  
* @return void  
*  
* @throws PEAR_Exception - if unable to read the db file.  
*/  
protected function loadSharedMemory($filename)  
{  
$fp = fopen($filename, "rb");  
if (!$fp) {  
throw new PEAR_Exception("Unable to open file: $filename");  
}  
$s_array = fstat($fp);  
$size = $s_array['size'];  
 
if ($shmid = @shmop_open(self::SHM_KEY, "w", 0, 0)) {  
shmop_delete($shmid);  
shmop_close($shmid);  
}  
 
if ($shmid = @shmop_open(self::SHM_KEY, "c", 0644, $size)) {  
$offset = 0;  
while ($offset < $size) {  
$buf = fread($fp, 524288);  
shmop_write($shmid, $buf, $offset);  
$offset += 524288;  
}  
shmop_close($shmid);  
}  
 
fclose($fp);  
}  
 
/**  
* Parses the database file to determine what kind of database is being used and setup  
* segment sizes and start points that will be used by the seek*() methods later.  
*  
* @return void  
*/  
protected function setupSegments()  
{  
 
$this->databaseType = self::COUNTRY_EDITION;  
$this->recordLength = self::STANDARD_RECORD_LENGTH;  
 
if ($this->flags & self::SHARED_MEMORY) {  
 
$offset = shmop_size($this->shmid) - 3;  
for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {  
$delim = shmop_read($this->shmid, $offset, 3);  
$offset += 3;  
if ($delim == (chr(255).chr(255).chr(255))) {  
$this->databaseType = ord(shmop_read($this->shmid, $offset, 1));  
$offset++;  
if ($this->databaseType === self::REGION_EDITION_REV0) {  
$this->databaseSegments = self::STATE_BEGIN_REV0;  
} elseif ($this->databaseType === self::REGION_EDITION_REV1) {  
$this->databaseSegments = self::STATE_BEGIN_REV1;  
} elseif (($this->databaseType === self::CITY_EDITION_REV0)  
|| ($this->databaseType === self::CITY_EDITION_REV1)  
|| ($this->databaseType === self::ORG_EDITION)) {  
$this->databaseSegments = 0;  
$buf = shmop_read($this->shmid, $offset, self::SEGMENT_RECORD_LENGTH);  
for ($j = 0; $j < self::SEGMENT_RECORD_LENGTH; $j++) {  
$this->databaseSegments += (ord($buf[$j]) << ($j * 8));  
}  
if ($this->databaseType === self::ORG_EDITION) {  
$this->recordLength = self::ORG_RECORD_LENGTH;  
}  
}  
break;  
} else {  
$offset -= 4;  
}  
}  
if ($this->databaseType == self::COUNTRY_EDITION) {  
$this->databaseSegments = self::COUNTRY_BEGIN;  
}  
 
} else {  
 
$filepos = ftell($this->filehandle);  
fseek($this->filehandle, -3, SEEK_END);  
for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {  
$delim = fread($this->filehandle, 3);  
if ($delim == (chr(255).chr(255).chr(255))) {  
$this->databaseType = ord(fread($this->filehandle, 1));  
if ($this->databaseType === self::REGION_EDITION_REV0) {  
$this->databaseSegments = self::STATE_BEGIN_REV0;  
} elseif ($this->databaseType === self::REGION_EDITION_REV1) {  
$this->databaseSegments = self::STATE_BEGIN_REV1;  
} elseif ($this->databaseType === self::CITY_EDITION_REV0  
|| $this->databaseType === self::CITY_EDITION_REV1  
|| $this->databaseType === self::ORG_EDITION) {  
$this->databaseSegments = 0;  
$buf = fread($this->filehandle, self::SEGMENT_RECORD_LENGTH);  
for ($j = 0; $j < self::SEGMENT_RECORD_LENGTH; $j++) {  
$this->databaseSegments += (ord($buf[$j]) << ($j * 8));  
}  
if ($this->databaseType === self::ORG_EDITION) {  
$this->recordLength = self::ORG_RECORD_LENGTH;  
}  
}  
break;  
} else {  
fseek($this->filehandle, -4, SEEK_CUR);  
}  
}  
if ($this->databaseType === self::COUNTRY_EDITION) {  
$this->databaseSegments = self::COUNTRY_BEGIN;  
}  
fseek($this->filehandle, $filepos, SEEK_SET);  
 
}  
}  
 
/**  
* Closes the geoip database.  
*  
* @return int Status of close command.  
*/  
public function close()  
{  
if ($this->flags & self::SHARED_MEMORY) {  
return shmop_close($this->shmid);  
} else {  
// right now even if file was cached in RAM the file was not closed  
// so it's safe to expect no error w/ fclose()  
return fclose($this->filehandle);  
}  
}  
 
/**  
* Get the country index.  
*  
* This method is called by the lookupCountryCode() and lookupCountryName()  
* methods. It lookups up the index ('id') for the country which is the key  
* for the code and name.  
*  
* @param string $addr IP address (hostname not allowed)  
*  
* @throws PEAR_Exception - if IP address is invalid.  
* - if database type is incorrect  
*  
* @return string ID for the country  
*/  
protected function lookupCountryId($addr)  
{  
$ipnum = ip2long($addr);  
if ($ipnum === false) {  
throw new PEAR_Exception("Invalid IP address: " . var_export($addr, true), self::ERR_INVALID_IP);  
}  
if ($this->databaseType !== self::COUNTRY_EDITION) {  
throw new PEAR_Exception("Invalid database type; lookupCountry*() methods expect Country database.");  
}  
return $this->seekCountry($ipnum) - self::COUNTRY_BEGIN;  
}  
 
/**  
* Returns 2-letter country code (e.g. 'CA') for specified IP address.  
* Use this method if you have a Country database.  
*  
* @param string $addr IP address (hostname not allowed).  
*  
* @return string 2-letter country code  
*  
* @throws PEAR_Exception (see lookupCountryId())  
* @see lookupCountryId()  
*/  
public function lookupCountryCode($addr)  
{  
return self::$COUNTRY_CODES[$this->lookupCountryId($addr)];  
}  
 
/**  
* Returns full country name for specified IP address.  
* Use this method if you have a Country database.  
*  
* @param string $addr IP address (hostname not allowed).  
*  
* @return string Country name  
* @throws PEAR_Exception (see lookupCountryId())  
* @see lookupCountryId()  
*/  
public function lookupCountryName($addr)  
{  
return self::$COUNTRY_NAMES[$this->lookupCountryId($addr)];  
}  
 
/**  
* Using the record length and appropriate start points, seek to the country that corresponds  
* to the converted IP address integer.  
*  
* @param int $ipnum Result of ip2long() conversion.  
*  
* @return int Offset of start of record.  
* @throws PEAR_Exception - if fseek() fails on the file or no results after traversing the database (indicating corrupt db).  
*/  
protected function seekCountry($ipnum)  
{  
$offset = 0;  
for ($depth = 31; $depth >= 0; --$depth) {  
if ($this->flags & self::MEMORY_CACHE) {  
$buf = substr($this->memoryBuffer, 2 * $this->recordLength * $offset, 2 * $this->recordLength);  
} elseif ($this->flags & self::SHARED_MEMORY) {  
$buf = shmop_read($this->shmid, 2 * $this->recordLength * $offset, 2 * $this->recordLength);  
} else {  
if (fseek($this->filehandle, 2 * $this->recordLength * $offset, SEEK_SET) !== 0) {  
throw new PEAR_Exception("fseek failed");  
}  
$buf = fread($this->filehandle, 2 * $this->recordLength);  
}  
$x = array(0,0);  
for ($i = 0; $i < 2; ++$i) {  
for ($j = 0; $j < $this->recordLength; ++$j) {  
$x[$i] += ord($buf[$this->recordLength * $i + $j]) << ($j * 8);  
}  
}  
if ($ipnum & (1 << $depth)) {  
if ($x[1] >= $this->databaseSegments) {  
return $x[1];  
}  
$offset = $x[1];  
} else {  
if ($x[0] >= $this->databaseSegments) {  
return $x[0];  
}  
$offset = $x[0];  
}  
}  
throw new PEAR_Exception("Error traversing database - perhaps it is corrupt?");  
}  
 
/**  
* Lookup the organization (or ISP) for given IP address.  
* Use this method if you have an Organization/ISP database.  
*  
* @param string $addr IP address (hostname not allowed).  
*  
* @throws PEAR_Exception - if IP address is invalid.  
* - if database is of wrong type  
*  
* @return string The organization  
*/  
public function lookupOrg($addr)  
{  
$ipnum = ip2long($addr);  
if ($ipnum === false) {  
throw new PEAR_Exception("Invalid IP address: " . var_export($addr, true), self::ERR_INVALID_IP);  
}  
if ($this->databaseType !== self::ORG_EDITION) {  
throw new PEAR_Exception("Invalid database type; lookupOrg() method expects Org/ISP database.", self::ERR_DB_FORMAT);  
}  
return $this->getOrg($ipnum);  
}  
 
/**  
* Lookup the region for given IP address.  
* Use this method if you have a Region database.  
*  
* @param string $addr IP address (hostname not allowed).  
*  
* @return array Array containing country code and region: array($country_code, $region)  
*  
* @throws PEAR_Exception - if IP address is invalid.  
*/  
public function lookupRegion($addr)  
{  
$ipnum = ip2long($addr);  
if ($ipnum === false) {  
throw new PEAR_Exception("Invalid IP address: " . var_export($addr, true), self::ERR_INVALID_IP);  
}  
if ($this->databaseType !== self::REGION_EDITION_REV0 && $this->databaseType !== self::REGION_EDITION_REV1) {  
throw new PEAR_Exception("Invalid database type; lookupRegion() method expects Region database.", self::ERR_DB_FORMAT);  
}  
return $this->getRegion($ipnum);  
}  
 
/**  
* Lookup the location record for given IP address.  
* Use this method if you have a City database.  
*  
* @param string $addr IP address (hostname not allowed).  
*  
* @return Net_GeoIP_Location The full location record.  
*  
* @throws PEAR_Exception - if IP address is invalid.  
*/  
public function lookupLocation($addr)  
{  
include_once 'Net/GeoIP/Location.php';  
$ipnum = ip2long($addr);  
if ($ipnum === false) {  
throw new PEAR_Exception("Invalid IP address: " . var_export($addr, true), self::ERR_INVALID_IP);  
}  
if ($this->databaseType !== self::CITY_EDITION_REV0 && $this->databaseType !== self::CITY_EDITION_REV1) {  
throw new PEAR_Exception("Invalid database type; lookupLocation() method expects City database.");  
}  
return $this->getRecord($ipnum);  
}  
 
/**  
* Seek and return organization (or ISP) name for converted IP addr.  
*  
* @param int $ipnum Converted IP address.  
*  
* @return string The organization  
*/  
protected function getOrg($ipnum)  
{  
$seek_org = $this->seekCountry($ipnum);  
if ($seek_org == $this->databaseSegments) {  
return null;  
}  
$record_pointer = $seek_org + (2 * $this->recordLength - 1) * $this->databaseSegments;  
if ($this->flags & self::SHARED_MEMORY) {  
$org_buf = shmop_read($this->shmid, $record_pointer, self::MAX_ORG_RECORD_LENGTH);  
} else {  
fseek($this->filehandle, $record_pointer, SEEK_SET);  
$org_buf = fread($this->filehandle, self::MAX_ORG_RECORD_LENGTH);  
}  
$org_buf = substr($org_buf, 0, strpos($org_buf, 0));  
return $org_buf;  
}  
 
/**  
* Seek and return the region info (array containing country code and region name) for converted IP addr.  
*  
* @param int $ipnum Converted IP address.  
*  
* @return array Array containing country code and region: array($country_code, $region)  
*/  
protected function getRegion($ipnum)  
{  
if ($this->databaseType == self::REGION_EDITION_REV0) {  
$seek_region = $this->seekCountry($ipnum) - self::STATE_BEGIN_REV0;  
if ($seek_region >= 1000) {  
$country_code = "US";  
$region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65);  
} else {  
$country_code = self::$COUNTRY_CODES[$seek_region];  
$region = "";  
}  
return array($country_code, $region);  
} elseif ($this->databaseType == self::REGION_EDITION_REV1) {  
$seek_region = $this->seekCountry($ipnum) - self::STATE_BEGIN_REV1;  
//print $seek_region;  
if ($seek_region < self::US_OFFSET) {  
$country_code = "";  
$region = "";  
} elseif ($seek_region < self::CANADA_OFFSET) {  
$country_code = "US";  
$region = chr(($seek_region - self::US_OFFSET)/26 + 65) . chr(($seek_region - self::US_OFFSET)%26 + 65);  
} elseif ($seek_region < self::WORLD_OFFSET) {  
$country_code = "CA";  
$region = chr(($seek_region - self::CANADA_OFFSET)/26 + 65) . chr(($seek_region - self::CANADA_OFFSET)%26 + 65);  
} else {  
$country_code = self::$COUNTRY_CODES[($seek_region - self::WORLD_OFFSET) / self::FIPS_RANGE];  
$region = "";  
}  
return array ($country_code,$region);  
}  
}  
 
/**  
* Seek and populate Net_GeoIP_Location object for converted IP addr.  
* Note: this  
*  
* @param int $ipnum Converted IP address.  
*  
* @return Net_GeoIP_Location  
*/  
protected function getRecord($ipnum)  
{  
$seek_country = $this->seekCountry($ipnum);  
if ($seek_country == $this->databaseSegments) {  
return null;  
}  
 
$record_pointer = $seek_country + (2 * $this->recordLength - 1) * $this->databaseSegments;  
 
if ($this->flags & self::SHARED_MEMORY) {  
$record_buf = shmop_read($this->shmid, $record_pointer, self::FULL_RECORD_LENGTH);  
} else {  
fseek($this->filehandle, $record_pointer, SEEK_SET);  
$record_buf = fread($this->filehandle, self::FULL_RECORD_LENGTH);  
}  
 
$record = new Net_GeoIP_Location();  
 
$record_buf_pos = 0;  
$char = ord(substr($record_buf, $record_buf_pos, 1));  
 
$record->countryCode = self::$COUNTRY_CODES[$char];  
$record->countryCode3 = self::$COUNTRY_CODES3[$char];  
$record->countryName = self::$COUNTRY_NAMES[$char];  
$record_buf_pos++;  
$str_length = 0;  
 
//get region  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
while ($char != 0) {  
$str_length++;  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
}  
if ($str_length > 0) {  
$record->region = substr($record_buf, $record_buf_pos, $str_length);  
}  
$record_buf_pos += $str_length + 1;  
$str_length = 0;  
 
//get city  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
while ($char != 0) {  
$str_length++;  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
}  
if ($str_length > 0) {  
$record->city = substr($record_buf, $record_buf_pos, $str_length);  
}  
$record_buf_pos += $str_length + 1;  
$str_length = 0;  
 
//get postal code  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
while ($char != 0) {  
$str_length++;  
$char = ord(substr($record_buf, $record_buf_pos+$str_length, 1));  
}  
if ($str_length > 0) {  
$record->postalCode = substr($record_buf, $record_buf_pos, $str_length);  
}  
$record_buf_pos += $str_length + 1;  
$str_length = 0;  
$latitude = 0;  
$longitude = 0;  
for ($j = 0;$j < 3; ++$j) {  
$char = ord(substr($record_buf, $record_buf_pos++, 1));  
$latitude += ($char << ($j * 8));  
}  
$record->latitude = ($latitude/10000) - 180;  
 
for ($j = 0;$j < 3; ++$j) {  
$char = ord(substr($record_buf, $record_buf_pos++, 1));  
$longitude += ($char << ($j * 8));  
}  
$record->longitude = ($longitude/10000) - 180;  
 
if ($this->databaseType === self::CITY_EDITION_REV1) {  
$dmaarea_combo = 0;  
if ($record->countryCode == "US") {  
for ($j = 0;$j < 3;++$j) {  
$char = ord(substr($record_buf, $record_buf_pos++, 1));  
$dmaarea_combo += ($char << ($j * 8));  
}  
$record->dmaCode = floor($dmaarea_combo/1000);  
$record->areaCode = $dmaarea_combo%1000;  
}  
}  
 
return $record;  
}  
 
}  
 
 
<?php  
/**  
* +----------------------------------------------------------------------+  
* | PHP version 5 |  
* +----------------------------------------------------------------------+  
* | Copyright (C) 2004 MaxMind LLC |  
* +----------------------------------------------------------------------+  
* | This library is free software; you can redistribute it and/or |  
* | modify it under the terms of the GNU Lesser General Public |  
* | License as published by the Free Software Foundation; either |  
* | version 2.1 of the License, or (at your option) any later version. |  
* | |  
* | This library is distributed in the hope that it will be useful, |  
* | but WITHOUT ANY WARRANTY; without even the implied warranty of |  
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |  
* | Lesser General Public License for more details. |  
* | |  
* | You should have received a copy of the GNU Lesser General Public |  
* | License along with this library; if not, write to the Free Software |  
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |  
* | USA, or view it online at http://www.gnu.org/licenses/lgpl.txt. |  
* +----------------------------------------------------------------------+  
* | Authors: Jim Winstead <jimw@apache.org> (original Maxmind version) |  
* | Hans Lellelid <hans@xmpl.org> |  
* +----------------------------------------------------------------------+  
*  
* @category Net  
* @package Net_GeoIP  
* @author Hans Lellelid <hans@xmpl.org>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @link http://pear.php.net/package/Net_GeoIp  
* $Id: DMA.php 296755 2010-03-24 22:22:06Z clockwerx $  
*/  
 
/**  
* Static class to handle mapping of DMA codes to metro regions.  
*  
* Use this class with the dmaCode property of the Net_GeoIpLocation object.  
*  
* <code>  
* $region = Net_GeoIPDMA::getMetroRegion($record->dmaCode);  
* </code>  
*  
* @category Net  
* @package Net_GeoIP  
* @author Hans Lellelid <hans@xmpl.org>  
* @author Dmitri Snytkine <d.snytkine@gmail.com>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @version $Revision: 296755 $  
* @link http://pear.php.net/package/Net_GeoIp  
*/  
class Net_GeoIP_DMA  
{  
/**  
* Holds DMA -> Metro mapping.  
* @var array  
*/  
private static $dmaMap;  
 
/**  
* Initialize  
*  
* @return void  
*/  
public static function initialize()  
{  
self::$dmaMap = array(  
500 => 'Portland-Auburn, ME',  
501 => 'New York, NY',  
502 => 'Binghamton, NY',  
503 => 'Macon, GA',  
504 => 'Philadelphia, PA',  
505 => 'Detroit, MI',  
506 => 'Boston, MA',  
507 => 'Savannah, GA',  
508 => 'Pittsburgh, PA',  
509 => 'Ft Wayne, IN',  
510 => 'Cleveland, OH',  
511 => 'Washington, DC',  
512 => 'Baltimore, MD',  
513 => 'Flint, MI',  
514 => 'Buffalo, NY',  
515 => 'Cincinnati, OH',  
516 => 'Erie, PA',  
517 => 'Charlotte, NC',  
518 => 'Greensboro, NC',  
519 => 'Charleston, SC',  
520 => 'Augusta, GA',  
521 => 'Providence, RI',  
522 => 'Columbus, GA',  
523 => 'Burlington, VT',  
524 => 'Atlanta, GA',  
525 => 'Albany, GA',  
526 => 'Utica-Rome, NY',  
527 => 'Indianapolis, IN',  
528 => 'Miami, FL',  
529 => 'Louisville, KY',  
530 => 'Tallahassee, FL',  
531 => 'Tri-Cities, TN',  
532 => 'Albany-Schenectady-Troy, NY',  
533 => 'Hartford, CT',  
534 => 'Orlando, FL',  
535 => 'Columbus, OH',  
536 => 'Youngstown-Warren, OH',  
537 => 'Bangor, ME',  
538 => 'Rochester, NY',  
539 => 'Tampa, FL',  
540 => 'Traverse City-Cadillac, MI',  
541 => 'Lexington, KY',  
542 => 'Dayton, OH',  
543 => 'Springfield-Holyoke, MA',  
544 => 'Norfolk-Portsmouth, VA',  
545 => 'Greenville-New Bern-Washington, NC',  
546 => 'Columbia, SC',  
547 => 'Toledo, OH',  
548 => 'West Palm Beach, FL',  
549 => 'Watertown, NY',  
550 => 'Wilmington, NC',  
551 => 'Lansing, MI',  
552 => 'Presque Isle, ME',  
553 => 'Marquette, MI',  
554 => 'Wheeling, WV',  
555 => 'Syracuse, NY',  
556 => 'Richmond-Petersburg, VA',  
557 => 'Knoxville, TN',  
558 => 'Lima, OH',  
559 => 'Bluefield-Beckley-Oak Hill, WV',  
560 => 'Raleigh-Durham, NC',  
561 => 'Jacksonville, FL',  
563 => 'Grand Rapids, MI',  
564 => 'Charleston-Huntington, WV',  
565 => 'Elmira, NY',  
566 => 'Harrisburg-Lancaster-Lebanon-York, PA',  
567 => 'Greenville-Spartenburg, SC',  
569 => 'Harrisonburg, VA',  
570 => 'Florence-Myrtle Beach, SC',  
571 => 'Ft Myers, FL',  
573 => 'Roanoke-Lynchburg, VA',  
574 => 'Johnstown-Altoona, PA',  
575 => 'Chattanooga, TN',  
576 => 'Salisbury, MD',  
577 => 'Wilkes Barre-Scranton, PA',  
581 => 'Terre Haute, IN',  
582 => 'Lafayette, IN',  
583 => 'Alpena, MI',  
584 => 'Charlottesville, VA',  
588 => 'South Bend, IN',  
592 => 'Gainesville, FL',  
596 => 'Zanesville, OH',  
597 => 'Parkersburg, WV',  
598 => 'Clarksburg-Weston, WV',  
600 => 'Corpus Christi, TX',  
602 => 'Chicago, IL',  
603 => 'Joplin-Pittsburg, MO',  
604 => 'Columbia-Jefferson City, MO',  
605 => 'Topeka, KS',  
606 => 'Dothan, AL',  
609 => 'St Louis, MO',  
610 => 'Rockford, IL',  
611 => 'Rochester-Mason City-Austin, MN',  
612 => 'Shreveport, LA',  
613 => 'Minneapolis-St Paul, MN',  
616 => 'Kansas City, MO',  
617 => 'Milwaukee, WI',  
618 => 'Houston, TX',  
619 => 'Springfield, MO',  
620 => 'Tuscaloosa, AL',  
622 => 'New Orleans, LA',  
623 => 'Dallas-Fort Worth, TX',  
624 => 'Sioux City, IA',  
625 => 'Waco-Temple-Bryan, TX',  
626 => 'Victoria, TX',  
627 => 'Wichita Falls, TX',  
628 => 'Monroe, LA',  
630 => 'Birmingham, AL',  
631 => 'Ottumwa-Kirksville, IA',  
632 => 'Paducah, KY',  
633 => 'Odessa-Midland, TX',  
634 => 'Amarillo, TX',  
635 => 'Austin, TX',  
636 => 'Harlingen, TX',  
637 => 'Cedar Rapids-Waterloo, IA',  
638 => 'St Joseph, MO',  
639 => 'Jackson, TN',  
640 => 'Memphis, TN',  
641 => 'San Antonio, TX',  
642 => 'Lafayette, LA',  
643 => 'Lake Charles, LA',  
644 => 'Alexandria, LA',  
646 => 'Anniston, AL',  
647 => 'Greenwood-Greenville, MS',  
648 => 'Champaign-Springfield-Decatur, IL',  
649 => 'Evansville, IN',  
650 => 'Oklahoma City, OK',  
651 => 'Lubbock, TX',  
652 => 'Omaha, NE',  
656 => 'Panama City, FL',  
657 => 'Sherman, TX',  
658 => 'Green Bay-Appleton, WI',  
659 => 'Nashville, TN',  
661 => 'San Angelo, TX',  
662 => 'Abilene-Sweetwater, TX',  
669 => 'Madison, WI',  
670 => 'Ft Smith-Fay-Springfield, AR',  
671 => 'Tulsa, OK',  
673 => 'Columbus-Tupelo-West Point, MS',  
675 => 'Peoria-Bloomington, IL',  
676 => 'Duluth, MN',  
678 => 'Wichita, KS',  
679 => 'Des Moines, IA',  
682 => 'Davenport-Rock Island-Moline, IL',  
686 => 'Mobile, AL',  
687 => 'Minot-Bismarck-Dickinson, ND',  
691 => 'Huntsville, AL',  
692 => 'Beaumont-Port Author, TX',  
693 => 'Little Rock-Pine Bluff, AR',  
698 => 'Montgomery, AL',  
702 => 'La Crosse-Eau Claire, WI',  
705 => 'Wausau-Rhinelander, WI',  
709 => 'Tyler-Longview, TX',  
710 => 'Hattiesburg-Laurel, MS',  
711 => 'Meridian, MS',  
716 => 'Baton Rouge, LA',  
717 => 'Quincy, IL',  
718 => 'Jackson, MS',  
722 => 'Lincoln-Hastings, NE',  
724 => 'Fargo-Valley City, ND',  
725 => 'Sioux Falls, SD',  
734 => 'Jonesboro, AR',  
736 => 'Bowling Green, KY',  
737 => 'Mankato, MN',  
740 => 'North Platte, NE',  
743 => 'Anchorage, AK',  
744 => 'Honolulu, HI',  
745 => 'Fairbanks, AK',  
746 => 'Biloxi-Gulfport, MS',  
747 => 'Juneau, AK',  
749 => 'Laredo, TX',  
751 => 'Denver, CO',  
752 => 'Colorado Springs, CO',  
753 => 'Phoenix, AZ',  
754 => 'Butte-Bozeman, MT',  
755 => 'Great Falls, MT',  
756 => 'Billings, MT',  
757 => 'Boise, ID',  
758 => 'Idaho Falls-Pocatello, ID',  
759 => 'Cheyenne, WY',  
760 => 'Twin Falls, ID',  
762 => 'Missoula, MT',  
764 => 'Rapid City, SD',  
765 => 'El Paso, TX',  
766 => 'Helena, MT',  
767 => 'Casper-Riverton, WY',  
770 => 'Salt Lake City, UT',  
771 => 'Yuma, AZ',  
773 => 'Grand Junction, CO',  
789 => 'Tucson, AZ',  
790 => 'Albuquerque, NM',  
798 => 'Glendive, MT',  
800 => 'Bakersfield, CA',  
801 => 'Eugene, OR',  
802 => 'Eureka, CA',  
803 => 'Los Angeles, CA',  
804 => 'Palm Springs, CA',  
807 => 'San Francisco, CA',  
810 => 'Yakima-Pasco, WA',  
811 => 'Reno, NV',  
813 => 'Medford-Klamath Falls, OR',  
819 => 'Seattle-Tacoma, WA',  
820 => 'Portland, OR',  
821 => 'Bend, OR',  
825 => 'San Diego, CA',  
828 => 'Monterey-Salinas, CA',  
839 => 'Las Vegas, NV',  
855 => 'Santa Barbara, CA',  
862 => 'Sacramento, CA',  
866 => 'Fresno, CA',  
868 => 'Chico-Redding, CA',  
881 => 'Spokane, WA');  
}  
 
/**  
* Lookup the metro region based on the provided DMA code.  
*  
* @param int $dmaCode The DMA code  
*  
* @return string Metro region name.  
*/  
public static function getMetroRegion($dmaCode)  
{  
if ($dmaCode === null) {  
return null;  
}  
if (self::$dmaMap === null) {  
self::initialize();  
}  
return self::$dmaMap[$dmaCode];  
}  
 
/**  
* Reverse lookup of DMA code if [exact] metro region name is known.  
*  
* @param string $metro Metro region name.  
*  
* @return int DMA code, or false if not found.  
*/  
public static function getDMACode($metro)  
{  
if (self::$dmaMap === null) {  
self::initialize();  
}  
return array_search($metro, self::$dmaMap);  
}  
 
}  
<?php  
/**  
* +----------------------------------------------------------------------+  
* | PHP version 5 |  
* +----------------------------------------------------------------------+  
* | Copyright (C) 2004 MaxMind LLC |  
* +----------------------------------------------------------------------+  
* | This library is free software; you can redistribute it and/or |  
* | modify it under the terms of the GNU Lesser General Public |  
* | License as published by the Free Software Foundation; either |  
* | version 2.1 of the License, or (at your option) any later version. |  
* | |  
* | This library is distributed in the hope that it will be useful, |  
* | but WITHOUT ANY WARRANTY; without even the implied warranty of |  
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |  
* | Lesser General Public License for more details. |  
* | |  
* | You should have received a copy of the GNU Lesser General Public |  
* | License along with this library; if not, write to the Free Software |  
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |  
* | USA, or view it online at http://www.gnu.org/licenses/lgpl.txt. |  
* +----------------------------------------------------------------------+  
* | Authors: Jim Winstead <jimw@apache.org> (original Maxmind version) |  
* | Hans Lellelid <hans@xmpl.org> |  
* +----------------------------------------------------------------------+  
*  
* @category Net  
* @package Net_GeoIP  
* @author Hans Lellelid <hans@xmpl.org>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @link http://pear.php.net/package/Net_GeoIp  
* $Id: Location.php 296763 2010-03-25 00:53:44Z clockwerx $  
*/  
 
/**  
* This class represents a location record as returned by Net_GeoIP::lookupLocation().  
*  
* This class is primarily a collection of values (the public properties of the class), but  
* there is also a distance() method to calculate the km distance between two points.  
*  
* @category Net  
* @package Net_GeoIP  
* @author Hans Lellelid <hans@xmpl.org>  
* @author Dmitri Snytkine <d.snytkine@gmail.com>  
* @license LGPL http://www.gnu.org/licenses/lgpl.txt  
* @version $Revision: 296763 $  
* @link http://pear.php.net/package/Net_GeoIp  
* @see Net_GeoIP::lookupLocation()  
*/  
class Net_GeoIP_Location implements Serializable  
{  
protected $aData = array(  
'countryCode' => null,  
'countryCode3' => null,  
'countryName' => null,  
'region' => null,  
'city' => null,  
'postalCode' => null,  
'latitude' => null,  
'longitude' => null,  
'areaCode' => null,  
'dmaCode' => null  
);  
 
 
/**  
* Calculate the distance in km between two points.  
*  
* @param Net_GeoIP_Location $loc The other point to which distance will be calculated.  
*  
* @return float The number of km between two points on the globe.  
*/  
public function distance(Net_GeoIP_Location $loc)  
{  
// ideally these should be class constants, but class constants  
// can't be operations.  
$RAD_CONVERT = M_PI / 180;  
$EARTH_DIAMETER = 2 * 6378.2;  
 
$lat1 = $this->latitude;  
$lon1 = $this->longitude;  
$lat2 = $loc->latitude;  
$lon2 = $loc->longitude;  
 
// convert degrees to radians  
$lat1 *= $RAD_CONVERT;  
$lat2 *= $RAD_CONVERT;  
 
// find the deltas  
$delta_lat = $lat2 - $lat1;  
$delta_lon = ($lon2 - $lon1) * $RAD_CONVERT;  
 
// Find the great circle distance  
$temp = pow(sin($delta_lat/2), 2) + cos($lat1) * cos($lat2) * pow(sin($delta_lon/2), 2);  
return $EARTH_DIAMETER * atan2(sqrt($temp), sqrt(1-$temp));  
}  
 
/**  
* magic method to make it possible  
* to store this object in cache when  
* automatic serialization is on  
* Specifically it makes it possible to store  
* this object in memcache  
*  
* @return array  
*/  
public function serialize()  
{  
return serialize($this->aData);  
}  
 
/**  
* unserialize a representation of the object  
*  
* @param array $serialized The serialized representation of the location  
*  
* @return void  
*/  
public function unserialize($serialized)  
{  
$this->aData = unserialize($serialized);  
}  
 
 
/**  
* Setter for elements of $this->aData array  
*  
* @param string $name The variable to set  
* @param string $val The value  
*  
* @return object $this object  
*/  
public function set($name, $val)  
{  
if (array_key_exists($name, $this->aData)) {  
$this->aData[$name] = $val;  
}  
 
return $this;  
}  
 
public function __set($name, $val)  
{  
return $this->set($name, $val);  
}  
 
/**  
* Getter for $this->aData array  
*  
* @return array  
*/  
public function getData()  
{  
return $this->aData;  
}  
 
 
/**  
* Magic method to get value from $this->aData array  
*  
* @param string $name The var to get  
*  
* @return mixed string if value exists or null if it is empty of  
* just does not exist  
*/  
public function __get($name)  
{  
if (array_key_exists($name, $this->aData)) {  
return $this->aData[$name];  
}  
 
return null;  
}  
 
 
/**  
* String representation of the object  
*  
* @return string text and result of print_r of $this->aData array  
*/  
public function __toString()  
{  
return 'object of type '.__CLASS__.'. data: '.implode(',', $this->aData);  
}  
 
 
/**  
* Magic method  
* makes it possible to check if specific record exists  
* and also makes it possible to use empty() on any property  
*  
* @param strign $name The name of the var to check  
*  
* @return bool  
*/  
public function __isset($name)  
{  
return (null !== $this->__get($name));  
}  
 
}  
 
Copyright (c) 1997-2009,  
Stig Bakken <ssb@php.net>,  
Gregory Beaver <cellog@php.net>,  
Helgi Þormar Þorbjörnsson <helgi@php.net>,  
Tomas V.V.Cox <cox@idecnet.com>,  
Martin Jansen <mj@php.net>.  
All rights reserved.  
 
Redistribution and use in source and binary forms, with or without  
modification, are permitted provided that the following conditions are met:  
 
* Redistributions of source code must retain the above copyright notice,  
this list of conditions and the following disclaimer.  
* Redistributions in binary form must reproduce the above copyright  
notice, this list of conditions and the following disclaimer in the  
documentation and/or other materials provided with the distribution.  
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE  
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR  
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER  
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,  
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
 
<?php  
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */  
/**  
* PEAR_Exception  
*  
* PHP versions 4 and 5  
*  
* @category pear  
* @package PEAR  
* @author Tomas V. V. Cox <cox@idecnet.com>  
* @author Hans Lellelid <hans@velum.net>  
* @author Bertrand Mansion <bmansion@mamasam.com>  
* @author Greg Beaver <cellog@php.net>  
* @copyright 1997-2009 The Authors  
* @license http://opensource.org/licenses/bsd-license.php New BSD License  
* @version CVS: $Id: Exception.php 296939 2010-03-27 16:24:43Z dufuz $  
* @link http://pear.php.net/package/PEAR  
* @since File available since Release 1.3.3  
*/  
 
 
/**  
* Base PEAR_Exception Class  
*  
* 1) Features:  
*  
* - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception))  
* - Definable triggers, shot when exceptions occur  
* - Pretty and informative error messages  
* - Added more context info available (like class, method or cause)  
* - cause can be a PEAR_Exception or an array of mixed  
* PEAR_Exceptions/PEAR_ErrorStack warnings  
* - callbacks for specific exception classes and their children  
*  
* 2) Ideas:  
*  
* - Maybe a way to define a 'template' for the output  
*  
* 3) Inherited properties from PHP Exception Class:  
*  
* protected $message  
* protected $code  
* protected $line  
* protected $file  
* private $trace  
*  
* 4) Inherited methods from PHP Exception Class:  
*  
* __clone  
* __construct  
* getMessage  
* getCode  
* getFile  
* getLine  
* getTraceSafe  
* getTraceSafeAsString  
* __toString  
*  
* 5) Usage example  
*  
* <code>  
* require_once 'PEAR/Exception.php';  
*  
* class Test {  
* function foo() {  
* throw new PEAR_Exception('Error Message', ERROR_CODE);  
* }  
* }  
*  
* function myLogger($pear_exception) {  
* echo $pear_exception->getMessage();  
* }  
* // each time a exception is thrown the 'myLogger' will be called  
* // (its use is completely optional)  
* PEAR_Exception::addObserver('myLogger');  
* $test = new Test;  
* try {  
* $test->foo();  
* } catch (PEAR_Exception $e) {  
* print $e;  
* }  
* </code>  
*  
* @category pear  
* @package PEAR  
* @author Tomas V.V.Cox <cox@idecnet.com>  
* @author Hans Lellelid <hans@velum.net>  
* @author Bertrand Mansion <bmansion@mamasam.com>  
* @author Greg Beaver <cellog@php.net>  
* @copyright 1997-2009 The Authors  
* @license http://opensource.org/licenses/bsd-license.php New BSD License  
* @version Release: 1.9.1  
* @link http://pear.php.net/package/PEAR  
* @since Class available since Release 1.3.3  
*  
*/  
class PEAR_Exception extends Exception  
{  
const OBSERVER_PRINT = -2;  
const OBSERVER_TRIGGER = -4;  
const OBSERVER_DIE = -8;  
protected $cause;  
private static $_observers = array();  
private static $_uniqueid = 0;  
private $_trace;  
 
/**  
* Supported signatures:  
* - PEAR_Exception(string $message);  
* - PEAR_Exception(string $message, int $code);  
* - PEAR_Exception(string $message, Exception $cause);  
* - PEAR_Exception(string $message, Exception $cause, int $code);  
* - PEAR_Exception(string $message, PEAR_Error $cause);  
* - PEAR_Exception(string $message, PEAR_Error $cause, int $code);  
* - PEAR_Exception(string $message, array $causes);  
* - PEAR_Exception(string $message, array $causes, int $code);  
* @param string exception message  
* @param int|Exception|PEAR_Error|array|null exception cause  
* @param int|null exception code or null  
*/  
public function __construct($message, $p2 = null, $p3 = null)  
{  
if (is_int($p2)) {  
$code = $p2;  
$this->cause = null;  
} elseif (is_object($p2) || is_array($p2)) {  
// using is_object allows both Exception and PEAR_Error  
if (is_object($p2) && !($p2 instanceof Exception)) {  
if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) {  
throw new PEAR_Exception('exception cause must be Exception, ' .  
'array, or PEAR_Error');  
}  
}  
$code = $p3;  
if (is_array($p2) && isset($p2['message'])) {  
// fix potential problem of passing in a single warning  
$p2 = array($p2);  
}  
$this->cause = $p2;  
} else {  
$code = null;  
$this->cause = null;  
}  
parent::__construct($message, $code);  
$this->signal();  
}  
 
/**  
* @param mixed $callback - A valid php callback, see php func is_callable()  
* - A PEAR_Exception::OBSERVER_* constant  
* - An array(const PEAR_Exception::OBSERVER_*,  
* mixed $options)  
* @param string $label The name of the observer. Use this if you want  
* to remove it later with removeObserver()  
*/  
public static function addObserver($callback, $label = 'default')  
{  
self::$_observers[$label] = $callback;  
}  
 
public static function removeObserver($label = 'default')  
{  
unset(self::$_observers[$label]);  
}  
 
/**  
* @return int unique identifier for an observer  
*/  
public static function getUniqueId()  
{  
return self::$_uniqueid++;  
}  
 
private function signal()  
{  
foreach (self::$_observers as $func) {  
if (is_callable($func)) {  
call_user_func($func, $this);  
continue;  
}  
settype($func, 'array');  
switch ($func[0]) {  
case self::OBSERVER_PRINT :  
$f = (isset($func[1])) ? $func[1] : '%s';  
printf($f, $this->getMessage());  
break;  
case self::OBSERVER_TRIGGER :  
$f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;  
trigger_error($this->getMessage(), $f);  
break;  
case self::OBSERVER_DIE :  
$f = (isset($func[1])) ? $func[1] : '%s';  
die(printf($f, $this->getMessage()));  
break;  
default:  
trigger_error('invalid observer type', E_USER_WARNING);  
}  
}  
}  
 
/**  
* Return specific error information that can be used for more detailed  
* error messages or translation.  
*  
* This method may be overridden in child exception classes in order  
* to add functionality not present in PEAR_Exception and is a placeholder  
* to define API  
*  
* The returned array must be an associative array of parameter => value like so:  
* <pre>  
* array('name' => $name, 'context' => array(...))  
* </pre>  
* @return array  
*/  
public function getErrorData()  
{  
return array();  
}  
 
/**  
* Returns the exception that caused this exception to be thrown  
* @access public  
* @return Exception|array The context of the exception  
*/  
public function getCause()  
{  
return $this->cause;  
}  
 
/**  
* Function must be public to call on caused exceptions  
* @param array  
*/  
public function getCauseMessage(&$causes)  
{  
$trace = $this->getTraceSafe();  
$cause = array('class' => get_class($this),  
'message' => $this->message,  
'file' => 'unknown',  
'line' => 'unknown');  
if (isset($trace[0])) {  
if (isset($trace[0]['file'])) {  
$cause['file'] = $trace[0]['file'];  
$cause['line'] = $trace[0]['line'];  
}  
}  
$causes[] = $cause;  
if ($this->cause instanceof PEAR_Exception) {  
$this->cause->getCauseMessage($causes);  
} elseif ($this->cause instanceof Exception) {  
$causes[] = array('class' => get_class($this->cause),  
'message' => $this->cause->getMessage(),  
'file' => $this->cause->getFile(),  
'line' => $this->cause->getLine());  
} elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {  
$causes[] = array('class' => get_class($this->cause),  
'message' => $this->cause->getMessage(),  
'file' => 'unknown',  
'line' => 'unknown');  
} elseif (is_array($this->cause)) {  
foreach ($this->cause as $cause) {  
if ($cause instanceof PEAR_Exception) {  
$cause->getCauseMessage($causes);  
} elseif ($cause instanceof Exception) {  
$causes[] = array('class' => get_class($cause),  
'message' => $cause->getMessage(),  
'file' => $cause->getFile(),  
'line' => $cause->getLine());  
} elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) {  
$causes[] = array('class' => get_class($cause),  
'message' => $cause->getMessage(),  
'file' => 'unknown',  
'line' => 'unknown');  
} elseif (is_array($cause) && isset($cause['message'])) {  
// PEAR_ErrorStack warning  
$causes[] = array(  
'class' => $cause['package'],  
'message' => $cause['message'],  
'file' => isset($cause['context']['file']) ?  
$cause['context']['file'] :  
'unknown',  
'line' => isset($cause['context']['line']) ?  
$cause['context']['line'] :  
'unknown',  
);  
}  
}  
}  
}  
 
public function getTraceSafe()  
{  
if (!isset($this->_trace)) {  
$this->_trace = $this->getTrace();  
if (empty($this->_trace)) {  
$backtrace = debug_backtrace();  
$this->_trace = array($backtrace[count($backtrace)-1]);  
}  
}  
return $this->_trace;  
}  
 
public function getErrorClass()  
{  
$trace = $this->getTraceSafe();  
return $trace[0]['class'];  
}  
 
public function getErrorMethod()  
{  
$trace = $this->getTraceSafe();  
return $trace[0]['function'];  
}  
 
public function __toString()  
{  
if (isset($_SERVER['REQUEST_URI'])) {  
return $this->toHtml();  
}  
return $this->toText();  
}  
 
public function toHtml()  
{  
$trace = $this->getTraceSafe();  
$causes = array();  
$this->getCauseMessage($causes);  
$html = '<table style="border: 1px" cellspacing="0">' . "\n";  
foreach ($causes as $i => $cause) {  
$html .= '<tr><td colspan="3" style="background: #ff9999">'  
. str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '  
. htmlspecialchars($cause['message']) . ' in <b>' . $cause['file'] . '</b> '  
. 'on line <b>' . $cause['line'] . '</b>'  
. "</td></tr>\n";  
}  
$html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n"  
. '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'  
. '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'  
. '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";  
 
foreach ($trace as $k => $v) {  
$html .= '<tr><td style="text-align: center;">' . $k . '</td>'  
. '<td>';  
if (!empty($v['class'])) {  
$html .= $v['class'] . $v['type'];  
}  
$html .= $v['function'];  
$args = array();  
if (!empty($v['args'])) {  
foreach ($v['args'] as $arg) {  
if (is_null($arg)) $args[] = 'null';  
elseif (is_array($arg)) $args[] = 'Array';  
elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')';  
elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false';  
elseif (is_int($arg) || is_double($arg)) $args[] = $arg;  
else {  
$arg = (string)$arg;  
$str = htmlspecialchars(substr($arg, 0, 16));  
if (strlen($arg) > 16) $str .= '&hellip;';  
$args[] = "'" . $str . "'";  
}  
}  
}  
$html .= '(' . implode(', ',$args) . ')'  
. '</td>'  
. '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')  
. ':' . (isset($v['line']) ? $v['line'] : 'unknown')  
. '</td></tr>' . "\n";  
}  
$html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>'  
. '<td>{main}</td>'  
. '<td>&nbsp;</td></tr>' . "\n"  
. '</table>';  
return $html;  
}  
 
public function toText()  
{  
$causes = array();  
$this->getCauseMessage($causes);  
$causeMsg = '';  
foreach ($causes as $i => $cause) {  
$causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '  
. $cause['message'] . ' in ' . $cause['file']  
. ' on line ' . $cause['line'] . "\n";  
}  
return $causeMsg . $this->getTraceAsString();  
}  
}  
<?php  
 
require_once( "MaxMindWebServices.class.php" );  
 
/**  
* Geo City Locate W/ ISP and Organization information  
*  
* @access public  
* @author Nathan White < contact at nathanwhite dot us >  
*  
*/  
class GeoCityLocateIspOrg extends MaxMindWebServices {  
 
/**  
* Implements a singleton design pattern  
*  
* when looking for an instance one can pass an IP address to have data populated  
*  
* @access public  
* @param string  
* @return reference to a GeoCityLocateIspOrg object  
*/  
function &getInstance($ip = "") {  
static $instance = null;  
 
if ($instance === null) {  
$instance = new GeoCityLocateIspOrg();  
}  
 
if(!empty($ip)){  
$instance->setIP($ip);  
}  
 
return $instance;  
}  
 
/**  
* An array that holds all returned values from a Maxmind request  
*  
* @param string  
* @access public  
*/  
function setIP($ip){  
$this->data = array();  
$this->ip = $ip;  
$this->_process();  
}  
 
/**  
* Get the IP address that is being processed  
*  
* @return string  
* @access public  
*/  
function getIP(){  
return $this->ip;  
}  
 
/**  
* Get the return Country Code  
*  
* @return string  
* @access public  
*/  
function getCountryCode(){  
return $this->data[0];  
}  
 
/**  
* Get the return Region Code  
*  
* @return string  
* @access public  
*/  
function getRegion(){  
return $this->data[1];  
}  
 
/**  
* Get the return Region Code  
*  
* @return string  
* @access public  
*/  
function getState(){  
return $this->getRegion();  
}  
 
/**  
* Get the return City  
*  
* @return string  
* @access public  
*/  
function getCity(){  
return $this->data[2];  
}  
 
/**  
* Get the return Postal  
*  
* @return string  
* @access public  
*/  
function getPostal(){  
return $this->data[3];  
}  
 
/**  
* Get the return Postal  
*  
* @return string  
* @access public  
*/  
function getZip(){  
return $this->getPostal();  
}  
 
/**  
* Get the return Latitude  
*  
* @return string  
* @access public  
*/  
function getLatitude(){  
return $this->data[4];  
}  
 
/**  
* Get the return Latitude  
*  
* @return string  
* @access public  
*/  
function getLat(){  
return $this->getLatitude();  
}  
 
/**  
* Get the return Longitude  
*  
* @return string  
* @access public  
*/  
function getLongitude(){  
return $this->data[5];  
}  
 
/**  
* Get the return Longitude  
*  
* @return string  
* @access public  
*/  
function getLong(){  
return $this->getLongitude();  
}  
 
/**  
* Get the return Metro Code  
*  
* @return string  
* @access public  
*/  
function getMetroCode(){  
return $this->data[6];  
}  
 
/**  
* Get the return Area Code  
*  
* @return string  
* @access public  
*/  
function getAreaCode(){  
return $this->data[7];  
}  
 
/**  
* Get the return ISP  
*  
* @return string  
* @access public  
*/  
function getISP(){  
return $this->data[8];  
}  
 
/**  
* Get the return Organization  
*  
* @return string  
* @access public  
*/  
function getOrganization(){  
return $this->data[9];  
}  
 
/**  
* Get the return Error  
*  
* @return string  
* @access public  
*/  
function getError(){  
return $this->data[10];  
 
}  
 
/**  
* Formats the url to submit to Maxmind and returns data in an array  
*  
* @access private  
*/  
function _process(){  
$url = "http://maxmind.com:8010/f?l=" . $this->licenceKey . "&i=" . $this->ip;  
$response = $this->_queryMaxMind($url);  
$this->data = $this->csv_split( trim($response) );  
}  
 
 
}  
 
?>  
<?php  
 
/**  
* The Abstraction Layer that all MaxMind Web Services extend from  
*  
* @access private  
* @author Nathan White < contact at nathanwhite dot us >  
*  
*/  
 
class MaxMindWebServices {  
 
 
/**  
* The licence Key for of a Maxmind web services account  
*  
* @var string  
* @access private  
*/  
var $licenceKey = "";  
 
 
/**  
* An array that holds all returned values from a Maxmind request  
*  
* @var array  
* @access private  
*/  
var $data = array();  
 
/**  
* Set the Licence Key  
*  
* @var string  
* @access public  
*/  
function setLicenceKey($key){  
$this->licenceKey = $key;  
}  
 
/**  
* Test to see if the Service produced an Error  
*  
* @return bool  
* @access public  
*/  
function isError(){  
$error = $this->getError();  
if( isset($error) ) return true;  
else return false;  
}  
 
/**  
* Get all Results in a single array for fast processing  
*  
* @return array  
* @access public  
*/  
function getResultArray(){  
return $this->data;  
}  
 
/**  
* Returns the City and State from a metro code  
*  
* @param string  
* @return string  
* @access public  
*/  
function lookupMetroCode($code){  
if( !isset($this->_metroCodes) ){  
$this->_metroCodes = parse_ini_file(dirname( __FILE__ ).'/ini/metroCodes.ini');  
}  
return $this->_metroCodes[$code];  
}  
 
/**  
* Returns the Country Name from the code  
*  
* @param string  
* @return string  
* @access public  
*/  
function lookupCountryCode($code){  
if( !isset($this->_countryCodes) ){  
$this->_countryCodes = parse_ini_file(dirname( __FILE__ ).'/ini/countryCodes.ini');  
}  
return $this->_countryCodes["'".$code."'"];  
}  
 
/**  
* Returns the SubCountry Name from the code ( States, Provinces )  
*  
* @param string  
* @param string  
* @return string  
* @access public  
*/  
function lookupSubCountryCode($code, $countryCode){  
if( !isset($this->_subCountryCodes) ){  
$this->_subCountryCodes = parse_ini_file(dirname( __FILE__ ).'/ini/subCountryCodes.ini', true);  
}  
if( is_array($this->_subCountryCodes["'".$countryCode."'"]) ){  
return $this->_subCountryCodes["'".$countryCode."'"]["'".$code."'"];  
}  
}  
/**  
* Generic Web Service Request for MaxMind  
*  
* @access private  
*/  
function _queryMaxMind($url){  
 
$ch = curl_init(); // initialize curl handle  
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable  
curl_setopt($ch, CURLOPT_HEADER, 0);  
curl_setopt($ch, CURLOPT_TIMEOUT, 4); // times out after 4s  
 
return curl_exec($ch);  
 
}  
 
 
/**  
* Function to handle parsing the csv string returned from MaxMind  
*  
* This function was found in the comments section on:  
* http://www.php.net/manual/en/function.fgetcsv.php  
*  
* @var string csv line to parse  
* @var string delimiter to use for spliting  
* @var bool remove quotes around values  
* @return array the parts of the csv line  
* @access public  
* @author php@dogpoop.cjb.net  
*/  
 
function csv_split($line,$delim=',',$removeQuotes=true) {  
 
$fields = array();  
$fldCount = 0;  
$inQuotes = false;  
for ($i = 0; $i < strlen($line); $i++) {  
if (!isset($fields[$fldCount])) $fields[$fldCount] = "";  
$tmp = substr($line,$i,strlen($delim));  
 
if ($tmp === $delim && !$inQuotes) {  
$fldCount++;  
$i += strlen($delim)-1;  
}  
else if ($fields[$fldCount] == "" && $line[$i] == '"' && !$inQuotes) {  
if (!$removeQuotes) $fields[$fldCount] .= $line[$i];  
$inQuotes = true;  
}  
else if ($line[$i] == '"') {  
if ($line[$i+1] == '"') {  
$i++;  
$fields[$fldCount] .= $line[$i];  
}  
else {  
if (!$removeQuotes) $fields[$fldCount] .= $line[$i];  
$inQuotes = false;  
}  
}  
else {  
$fields[$fldCount] .= $line[$i];  
}  
}  
return $fields;  
}  
 
 
}  
 
?>  
 
'A1' = "Anonymous Proxy"  
'A2' = "Satellite Provider"  
'AD' = "Andorra"  
'AE' = "United Arab Emirates"  
'AF' = "Afghanistan"  
'AG' = "Antigua and Barbuda"  
'AI' = "Anguilla"  
'AL' = "Albania"  
'AM' = "Armenia"  
'AN' = "Netherlands Antilles"  
'AO' = "Angola"  
'AP' = "Asia/Pacific Region"  
'AQ' = "Antarctica"  
'AR' = "Argentina"  
'AS' = "American Samoa"  
'AT' = "Austria"  
'AU' = "Australia"  
'AW' = "Aruba"  
'AZ' = "Azerbaijan"  
'BA' = "Bosnia and Herzegovina"  
'BB' = "Barbados"  
'BD' = "Bangladesh"  
'BE' = "Belgium"  
'BF' = "Burkina Faso"  
'BG' = "Bulgaria"  
'BH' = "Bahrain"  
'BI' = "Burundi"  
'BJ' = "Benin"  
'BM' = "Bermuda"  
'BN' = "Brunei Darussalam"  
'BO' = "Bolivia"  
'BR' = "Brazil"  
'BS' = "Bahamas"  
'BT' = "Bhutan"  
'BV' = "Bouvet Island"  
'BW' = "Botswana"  
'BY' = "Belarus"  
'BZ' = "Belize"  
'CA' = "Canada"  
'CC' = "Cocos (Keeling) Islands"  
'CD' = "Congo, The Democratic Republic of the"  
'CF' = "Central African Republic"  
'CG' = "Congo"  
'CH' = "Switzerland"  
'CI' = "Cote D'Ivoire"  
'CK' = "Cook Islands"  
'CL' = "Chile"  
'CM' = "Cameroon"  
'CN' = "China"  
'CO' = "Colombia"  
'CR' = "Costa Rica"  
'CS' = "Serbia and Montenegro"  
'CU' = "Cuba"  
'CV' = "Cape Verde"  
'CX' = "Christmas Island"  
'CY' = "Cyprus"  
'CZ' = "Czech Republic"  
'DE' = "Germany"  
'DJ' = "Djibouti"  
'DK' = "Denmark"  
'DM' = "Dominica"  
'DO' = "Dominican Republic"  
'DZ' = "Algeria"  
'EC' = "Ecuador"  
'EE' = "Estonia"  
'EG' = "Egypt"  
'EH' = "Western Sahara"  
'ER' = "Eritrea"  
'ES' = "Spain"  
'ET' = "Ethiopia"  
'EU' = "Europe"  
'FI' = "Finland"  
'FJ' = "Fiji"  
'FK' = "Falkland Islands (Malvinas)"  
'FM' = "Micronesia, Federated States of"  
'FO' = "Faroe Islands"  
'FR' = "France"  
'FX' = "France, Metropolitan"  
'GA' = "Gabon"  
'GB' = "United Kingdom"  
'GD' = "Grenada"  
'GE' = "Georgia"  
'GF' = "French Guiana"  
'GH' = "Ghana"  
'GI' = "Gibraltar"  
'GL' = "Greenland"  
'GM' = "Gambia"  
'GN' = "Guinea"  
'GP' = "Guadeloupe"  
'GQ' = "Equatorial Guinea"  
'GR' = "Greece"  
'GS' = "South Georgia and the South Sandwich Islands"  
'GT' = "Guatemala"  
'GU' = "Guam"  
'GW' = "Guinea-Bissau"  
'GY' = "Guyana"  
'HK' = "Hong Kong"  
'HM' = "Heard Island and McDonald Islands"  
'HN' = "Honduras"  
'HR' = "Croatia"  
'HT' = "Haiti"  
'HU' = "Hungary"  
'ID' = "Indonesia"  
'IE' = "Ireland"  
'IL' = "Israel"  
'IN' = "India"  
'IO' = "British Indian Ocean Territory"  
'IQ' = "Iraq"  
'IR' = "Iran, Islamic Republic of"  
'IS' = "Iceland"  
'IT' = "Italy"  
'JM' = "Jamaica"  
'JO' = "Jordan"  
'JP' = "Japan"  
'KE' = "Kenya"  
'KG' = "Kyrgyzstan"  
'KH' = "Cambodia"  
'KI' = "Kiribati"  
'KM' = "Comoros"  
'KN' = "Saint Kitts and Nevis"  
'KP' = "Korea, Democratic People's Republic of"  
'KR' = "Korea, Republic of"  
'KW' = "Kuwait"  
'KY' = "Cayman Islands"  
'KZ' = "Kazakhstan"  
'LA' = "Lao People's Democratic Republic"  
'LB' = "Lebanon"  
'LC' = "Saint Lucia"  
'LI' = "Liechtenstein"  
'LK' = "Sri Lanka"  
'LR' = "Liberia"  
'LS' = "Lesotho"  
'LT' = "Lithuania"  
'LU' = "Luxembourg"  
'LV' = "Latvia"  
'LY' = "Libyan Arab Jamahiriya"  
'MA' = "Morocco"  
'MC' = "Monaco"  
'MD' = "Moldova, Republic of"  
'MG' = "Madagascar"  
'MH' = "Marshall Islands"  
'MK' = "Macedonia"  
'ML' = "Mali"  
'MM' = "Myanmar"  
'MN' = "Mongolia"  
'MO' = "Macau"  
'MP' = "Northern Mariana Islands"  
'MQ' = "Martinique"  
'MR' = "Mauritania"  
'MS' = "Montserrat"  
'MT' = "Malta"  
'MU' = "Mauritius"  
'MV' = "Maldives"  
'MW' = "Malawi"  
'MX' = "Mexico"  
'MY' = "Malaysia"  
'MZ' = "Mozambique"  
'NA' = "Namibia"  
'NC' = "New Caledonia"  
'NE' = "Niger"  
'NF' = "Norfolk Island"  
'NG' = "Nigeria"  
'NI' = "Nicaragua"  
'NL' = "Netherlands"  
'NO' = "Norway"  
'NP' = "Nepal"  
'NR' = "Nauru"  
'NU' = "Niue"  
'NZ' = "New Zealand"  
'OM' = "Oman"  
'PA' = "Panama"  
'PE' = "Peru"  
'PF' = "French Polynesia"  
'PG' = "Papua New Guinea"  
'PH' = "Philippines"  
'PK' = "Pakistan"  
'PL' = "Poland"  
'PM' = "Saint Pierre and Miquelon"  
'PN' = "Pitcairn"  
'PR' = "Puerto Rico"  
'PS' = "Palestinian Territory"  
'PT' = "Portugal"  
'PW' = "Palau"  
'PY' = "Paraguay"  
'QA' = "Qatar"  
'RE' = "Reunion"  
'RO' = "Romania"  
'RU' = "Russian Federation"  
'RW' = "Rwanda"  
'SA' = "Saudi Arabia"  
'SB' = "Solomon Islands"  
'SC' = "Seychelles"  
'SD' = "Sudan"  
'SE' = "Sweden"  
'SG' = "Singapore"  
'SH' = "Saint Helena"  
'SI' = "Slovenia"  
'SJ' = "Svalbard and Jan Mayen"  
'SK' = "Slovakia"  
'SL' = "Sierra Leone"  
'SM' = "San Marino"  
'SN' = "Senegal"  
'SO' = "Somalia"  
'SR' = "Suriname"  
'ST' = "Sao Tome and Principe"  
'SV' = "El Salvador"  
'SY' = "Syrian Arab Republic"  
'SZ' = "Swaziland"  
'TC' = "Turks and Caicos Islands"  
'TD' = "Chad"  
'TF' = "French Southern Territories"  
'TG' = "Togo"  
'TH' = "Thailand"  
'TJ' = "Tajikistan"  
'TK' = "Tokelau"  
'TL' = "East Timor"  
'TM' = "Turkmenistan"  
'TN' = "Tunisia"  
'TO' = "Tonga"  
'TR' = "Turkey"  
'TT' = "Trinidad and Tobago"  
'TV' = "Tuvalu"  
'TW' = "Taiwan"  
'TZ' = "Tanzania, United Republic of"  
'UA' = "Ukraine"  
'UG' = "Uganda"  
'UM' = "United States Minor Outlying Islands"  
'US' = "United States"  
'UY' = "Uruguay"  
'UZ' = "Uzbekistan"  
'VA' = "Holy See (Vatican City State)"  
'VC' = "Saint Vincent and the Grenadines"  
'VE' = "Venezuela"  
'VG' = "Virgin Islands, British"  
'VI' = "Virgin Islands, U.S."  
'VN' = "Vietnam"  
'VU' = "Vanuatu"  
'WF' = "Wallis and Futuna"  
'WS' = "Samoa"  
'YE' = "Yemen"  
'YT' = "Mayotte"  
'ZA' = "South Africa"  
'ZM' = "Zambia"  
'ZR' = "Zaire"  
'ZW' = "Zimbabwe"  
500 = Portland-Auburn, ME  
501 = New York, NY  
502 = Binghamton, NY  
503 = Macon, GA  
504 = Philadelphia, PA  
505 = Detroit, MI  
506 = Boston, MA  
507 = Savannah, GA  
508 = Pittsburgh, PA  
509 = Ft Wayne, IN  
510 = Cleveland, OH  
511 = Washington, DC  
512 = Baltimore, MD  
513 = Flint, MI  
514 = Buffalo, NY  
515 = Cincinnati, OH  
516 = Erie, PA  
517 = Charlotte, NC  
518 = Greensboro, NC  
519 = Charleston, SC  
520 = Augusta, GA  
521 = Providence, RI  
522 = Columbus, GA  
523 = Burlington, VT  
524 = Atlanta, GA  
525 = Albany, GA  
526 = Utica-Rome, NY  
527 = Indianapolis, IN  
528 = Miami, FL  
529 = Louisville, KY  
530 = Tallahassee, FL  
531 = Tri-Cities, TN  
532 = Albany-Schenectady-Troy, NY  
533 = Hartford, CT  
534 = Orlando, FL  
535 = Columbus, OH  
536 = Youngstown-Warren, OH  
537 = Bangor, ME  
538 = Rochester, NY  
539 = Tampa, FL  
540 = Traverse City-Cadillac, MI  
541 = Lexington, KY  
542 = Dayton, OH  
543 = Springfield-Holyoke, MA  
544 = Norfolk-Portsmouth, VA  
545 = Greenville-New Bern-Washington, NC  
546 = Columbia, SC  
547 = Toledo, OH  
548 = West Palm Beach, FL  
549 = Watertown, NY  
550 = Wilmington, NC  
551 = Lansing, MI  
552 = Presque Isle, ME  
553 = Marquette, MI  
554 = Wheeling, WV  
555 = Syracuse, NY  
556 = Richmond-Petersburg, VA  
557 = Knoxville, TN  
558 = Lima, OH  
559 = Bluefield-Beckley-Oak Hill, WV  
560 = Raleigh-Durham, NC  
561 = Jacksonville, FL  
563 = Grand Rapids, MI  
564 = Charleston-Huntington, WV  
565 = Elmira, NY  
566 = Harrisburg-Lancaster-Lebanon-York, PA  
567 = Greenville-Spartenburg, SC  
569 = Harrisonburg, VA  
570 = Florence-Myrtle Beach, SC  
571 = Ft Myers, FL  
573 = Roanoke-Lynchburg, VA  
574 = Johnstown-Altoona, PA  
575 = Chattanooga, TN  
576 = Salisbury, MD  
577 = Wilkes Barre-Scranton, PA  
581 = Terre Haute, IN  
582 = Lafayette, IN  
583 = Alpena, MI  
584 = Charlottesville, VA  
588 = South Bend, IN  
592 = Gainesville, FL  
596 = Zanesville, OH  
597 = Parkersburg, WV  
598 = Clarksburg-Weston, WV  
600 = Corpus Christi, TX  
602 = Chicago, IL  
603 = Joplin-Pittsburg, MO  
604 = Columbia-Jefferson City, MO  
605 = Topeka, KS  
606 = Dothan, AL  
609 = St Louis, MO  
610 = Rockford, IL  
611 = Rochester-Mason City-Austin, MN  
612 = Shreveport, LA  
613 = Minneapolis-St Paul, MN  
616 = Kansas City, MO  
617 = Milwaukee, WI  
618 = Houston, TX  
619 = Springfield, MO  
620 = Tuscaloosa, AL  
622 = New Orleans, LA  
623 = Dallas-Fort Worth, TX  
624 = Sioux City, IA  
625 = Waco-Temple-Bryan, TX  
626 = Victoria, TX  
627 = Wichita Falls, TX  
628 = Monroe, LA  
630 = Birmingham, AL  
631 = Ottumwa-Kirksville, IA  
632 = Paducah, KY  
633 = Odessa-Midland, TX  
634 = Amarillo, TX  
635 = Austin, TX  
636 = Harlingen, TX  
637 = Cedar Rapids-Waterloo, IA  
638 = St Joseph, MO  
639 = Jackson, TN  
640 = Memphis, TN  
641 = San Antonio, TX  
642 = Lafayette, LA  
643 = Lake Charles, LA  
644 = Alexandria, LA  
646 = Anniston, AL  
647 = Greenwood-Greenville, MS  
648 = Champaign-Springfield-Decatur, IL  
649 = Evansville, IN  
650 = Oklahoma City, OK  
651 = Lubbock, TX  
652 = Omaha, NE  
656 = Panama City, FL  
657 = Sherman, TX  
658 = Green Bay-Appleton, WI  
659 = Nashville, TN  
661 = San Angelo, TX  
662 = Abilene-Sweetwater, TX  
669 = Madison, WI  
670 = Ft Smith-Fay-Springfield, AR  
671 = Tulsa, OK  
673 = Columbus-Tupelo-West Point, MS  
675 = Peoria-Bloomington, IL  
676 = Duluth, MN  
678 = Wichita, KS  
679 = Des Moines, IA  
682 = Davenport-Rock Island-Moline, IL  
686 = Mobile, AL  
687 = Minot-Bismarck-Dickinson, ND  
691 = Huntsville, AL  
692 = Beaumont-Port Author, TX  
693 = Little Rock-Pine Bluff, AR  
698 = Montgomery, AL  
702 = La Crosse-Eau Claire, WI  
705 = Wausau-Rhinelander, WI  
709 = Tyler-Longview, TX  
710 = Hattiesburg-Laurel, MS  
711 = Meridian, MS  
716 = Baton Rouge, LA  
717 = Quincy, IL  
718 = Jackson, MS  
722 = Lincoln-Hastings, NE  
724 = Fargo-Valley City, ND  
725 = Sioux Falls, SD  
734 = Jonesboro, AR  
736 = Bowling Green, KY  
737 = Mankato, MN  
740 = North Platte, NE  
743 = Anchorage, AK  
744 = Honolulu, HI  
745 = Fairbanks, AK  
746 = Biloxi-Gulfport, MS  
747 = Juneau, AK  
749 = Laredo, TX  
751 = Denver, CO  
752 = Colorado Springs, CO  
753 = Phoenix, AZ  
754 = Butte-Bozeman, MT  
755 = Great Falls, MT  
756 = Billings, MT  
757 = Boise, ID  
758 = Idaho Falls-Pocatello, ID  
759 = Cheyenne, WY  
760 = Twin Falls, ID  
762 = Missoula, MT  
764 = Rapid City, SD  
765 = El Paso, TX  
766 = Helena, MT  
767 = Casper-Riverton, WY  
770 = Salt Lake City, UT  
771 = Yuma, AZ  
773 = Grand Junction, CO  
789 = Tucson, AZ  
790 = Albuquerque, NM  
798 = Glendive, MT  
800 = Bakersfield, CA  
801 = Eugene, OR  
802 = Eureka, CA  
803 = Los Angeles, CA  
804 = Palm Springs, CA  
807 = San Francisco, CA  
810 = Yakima-Pasco, WA  
811 = Reno, NV  
813 = Medford-Klamath Falls, OR  
819 = Seattle-Tacoma, WA  
820 = Portland, OR  
821 = Bend, OR  
825 = San Diego, CA  
828 = Monterey-Salinas, CA  
839 = Las Vegas, NV  
855 = Santa Barbara, CA  
862 = Sacramento, CA  
866 = Fresno, CA  
868 = Chico-Redding, CA  
881 = Spokane, WA  
['CA']  
'AB' = "Alberta"  
'BC' = "British Columbia"  
'MB' = "Manitoba"  
'NB' = "New Brunswick"  
'NF' = "Newfoundland"  
'NS' = "Nova Scotia"  
'NU' = "Nunavut"  
'ON' = "Ontario"  
'PE' = "Prince Edward Island"  
'QC' = "Quebec"  
'SK' = "Saskatchewan"  
'NT' = "Northwest Territories"  
'YT' = "Yukon Territory"  
['US']  
'AA' = "Armed Forces Americas"  
'AE' = "Armed Forces Europe, Middle East, & Canada"  
'AK' = "Alaska"  
'AL' = "Alabama"  
'AP' = "Armed Forces Pacific"  
'AR' = "Arkansas"  
'AS' = "American Samoa"  
'AZ' = "Arizona"  
'CA' = "California"  
'CO' = "Colorado"  
'CT' = "Connecticut"  
'DC' = "District of Columbia"  
'DE' = "Delaware"  
'FL' = "Florida"  
'FM' = "Federated States of Micronesia"  
'GA' = "Georgia"  
'GU' = "Guam"  
'HI' = "Hawaii"  
'IA' = "Iowa"  
'ID' = "Idaho"  
'IL' = "Illinois"  
'IN' = "Indiana"  
'KS' = "Kansas"  
'KY' = "Kentucky"  
'LA' = "Louisiana"  
'MA' = "Massachusetts"  
'MD' = "Maryland"  
'ME' = "Maine"  
'MH' = "Marshall Islands"  
'MI' = "Michigan"  
'MN' = "Minnesota"  
'MO' = "Missouri"  
'MP' = "Northern Mariana Islands"  
'MS' = "Mississippi"  
'MT' = "Montana"  
'NC' = "North Carolina"  
'ND' = "North Dakota"  
'NE' = "Nebraska"  
'NH' = "New Hampshire"  
'NJ' = "New Jersey"  
'NM' = "New Mexico"  
'NV' = "Nevada"  
'NY' = "New York"  
'OH' = "Ohio"  
'OK' = "Oklahoma"  
'OR' = "Oregon"  
'PA' = "Pennsylvania"  
'PR' = "Puerto Rico"  
'PW' = "Palau"  
'RI' = "Rhode Island"  
'SC' = "South Carolina"  
'SD' = "South Dakota"  
'TN' = "Tennessee"  
'TX' = "Texas"  
'UT' = "Utah"  
'VA' = "Virginia"  
'VI' = "Virgin Islands"  
'VT' = "Vermont"  
'WA' = "Washington"  
'WV' = "West Virginia"  
'WI' = "Wisconsin"  
'WY' = "Wyoming"  
 
 
MaxMindWebServices Class  
========================  
 
The MaxMindWebServices class is an abstract class that all MaxMind web services extend from. This class has no public access.  
 
I have made a few assumptions in terms of the other services since I have yet to use them.  
 
1. I assume that all services would have a need to look up:  
a. Country Codes  
b. SubCountry Codes  
c. Metro Codes  
 
As a result of this assumption I have public methods for translation of these codes in the MaxMindWebServices abstraction class.  
 
2. Since it appears that not all the Web Services have the same interface I have stored the helper functions in the abstraction class anyway. Reason for this is to reduce code between multiple services.  
 
Methods that all MaxMind Services have:  
setLicenceKey($key)  
isError() // return bool  
getResultArray() // returns all returned values in an array  
lookupCountryCode($countryCode);  
lookupSubCountryCode($subcountryCode, $countryCode);  
lookupMetroCode($metroCode);  
 
Notes:  
 
1. the lookup...Code() methods use lazy load, they don't parse the ini file unless the method is explicitly call.  
 
2. It is possible to set your licenceKey inside this class which then applies it as the default key for all MaxMind web services.  
 
 
 
GeoCityLocateIspOrg  
===================  
 
This class Implements the Geo city location with ISP and Organization inforation included. This class is designed to be used as a singleton.  
 
ex.  
Instead of $service = new GeoCityLocateIspOrg();  
 
use: $service = GeoCityLocateIspOrg::getInstance();  
 
Methods:  
setIP($ip) // this is the trigger, all data is cleared and updated with new value  
getIP()  
getCountry()  
getRegion()  
getState() // alias of getRegion()  
getCity()  
getPostal()  
getZip() // alias of getPostal()  
getLatitude()  
getLat() // alias of getLat()  
getLongitude()  
getLong() // alias of getLong()  
getMetroCode()  
getAreaCode()  
getISP()  
getOrganization()  
getError()  
 
And all generic methods listed above.  
 
 
For Developers  
==============  
 
When adding a new Web Service to this library there are a few code interface details to remember.  
 
1. All new interfaces must extend MaxMindWebServices  
2. All services are responsible for building the url with the query string  
3. All services must implement a getError() method  
4. All methods must implement there own trigger to submit and recieve data  
5. All data recieved must be stored in $this->data array, it doesn't matter if its an assoc array or not.  
 
TODO  
=========  
 
1. change the _queryMaxMind() in the MaxMindWebService class to handle ssl connections as well.  
 
2. The ini files that provide the lookup for the country, subcountry and metro codes appears to have issues. In order to remedy the issue I enclosed all keys with tick marks. This issue will be explored later.  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_module.php');  
 
/**  
* Maxmind GeoIP Module  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2010 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.4.0  
*/  
 
class owa_maxmind_geoipModule extends owa_module {  
 
function __construct() {  
 
$this->name = 'maxmind_geoip';  
$this->display_name = 'Maxmind GeoIP';  
$this->group = 'geoip';  
$this->author = 'Peter Adams';  
$this->version = '1.0';  
$this->description = 'Performs Maxmind Geo-IP lookups.';  
$this->config_required = false;  
$this->required_schema_version = 1;  
 
$mode = owa_coreAPI::getSetting('maxmind_geoip', 'lookup_method');  
 
switch ( $mode ) {  
 
case "geoip_city_isp_org_web_service":  
$method = 'getLocationFromWebService';  
break;  
 
case "city_lite_db":  
$method = 'getLocation';  
break;  
 
default:  
$method = 'getLocation';  
}  
 
 
$this->registerFilter('geolocation', 'maxmind', $method, 0, 'classes');  
 
return parent::__construct();  
}  
}  
file:a/busui/owa/mw_plugin.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
// ensures that mediawiki is the only entry point.  
if ( ! defined( 'MEDIAWIKI' ) ) {  
exit;  
}  
 
require_once( dirname( __FILE__ ) . '/' . 'owa_env.php' );  
require_once( OWA_BASE_CLASSES_DIR . 'owa_mw.php' );  
 
/**  
* OWA MW EXTENSION SPECIFIC CONFIGURATION VARIABLES  
* To alter these, set them in your localsettings.php file AFTER you  
* include/require the extension.  
*/  
 
// $wgOwaSiteId is used to overide the default site_id that OWA  
// will append to all tracking requests.This is handy if you want  
// to aggregate stats for more than one wiki under the same site_id  
$wgOwaSiteId = false;  
 
// $wgOwaEnableSpecialPage enables/disables OWA's special page.  
// Use this to deactivate and hide the special page  
$wgOwaEnableSpecialPage = true;  
 
// $wgOwaThirdPartyCookies enables third party cookie mode for  
// OWA's javascript tracker. This is rarely a good idea and will  
// have data quality ramifications.  
$wgOwaThirdPartyCookies = false;  
 
// $wgOwaCookieDomain contain the domain that OWA's javascript tracker  
// will use to write it's cookies.  
$wgOwaCookieDomain = false;  
 
/**  
* Register Extension and Hooks  
*/  
$wgExtensionCredits['specialpage'][] = array(  
'name' => 'Open Web Analytics for MediaWiki',  
'author' => 'Peter Adams',  
'url' => 'http://www.openwebanalytics.com',  
'description' => 'Open Web Analytics for MedaWiki'  
);  
 
// used to sniff out admin requests  
$wgHooks['UnknownAction'][] = 'owa_actions';  
// used to set proper params for logging Article Page Views  
$wgHooks['ArticlePageDataAfter'][] = 'owa_logArticle';  
// used to set proper params for logging Special Page Views  
$wgHooks['SpecialPageExecuteAfterPage'][] = 'owa_logSpecialPage';  
// used to set proper params for logging Category Page Views  
$wgHooks['CategoryPageView'][] = 'owa_logCategoryPage';  
// used to add OWA's javascript tracking tag to all pages  
$wgHooks['BeforePageDisplay'][] = 'owa_footer';  
// used to fire Action events when articles are created  
$wgHooks['ArticleInsertComplete'][] = 'owa_newArticleAction';  
// used to fire Action events when articles are edited  
$wgHooks['ArticleSaveComplete'][] = 'owa_editArticleAction';  
// used to fire Action events when new articles are deleted  
$wgHooks['ArticleDeleteComplete'][] = 'owa_deleteArticleAction';  
// used to fire Action events when new user accounts are created  
$wgHooks['AddNewAccount'][] = 'owa_addUserAction';  
// used to fire Action events when new uploads occur  
$wgHooks['UploadComplete'][] = 'owa_addUploadAction';  
// used to fire Action events when users login  
$wgHooks['UserLoginComplete'][] = 'owa_userLoginAction';  
// used to fire Action events when talk pages are edited  
$wgHooks['ArticleEditUpdateNewTalk'][] ='owa_editTalkPageAction';  
// used to register OWA's special page  
$wgHooks['SpecialPage_initList'][] = 'owa_registerSpecialPage';  
 
/**  
* Hook Function for Registering OWA's Special Page  
*/  
function owa_registerSpecialPage( &$aSpecialPages ) {  
 
global $wgOwaEnableSpecialPage;  
 
// Enable Special Page  
if ( $wgOwaEnableSpecialPage === true ) {  
//Load Special Page  
$wgAutoloadClasses['SpecialOwa'] = __FILE__;  
// Adds OWA's admin interface to special page list  
$aSpecialPages['Owa'] = 'SpecialOwa';  
}  
// must return true for hook to continue processing.  
return true;  
}  
 
/**  
* Hook for OWA special actions  
*  
* This uses mediawiki's 'unknown action' hook to trigger OWA's special action handler.  
* This is setup by adding 'action=owa' to the URLs for special actions. There is  
* probably a better way to do this so that the OWA namespace is preserved.  
*  
* @TODO figure out how to register this method to be triggered only when 'action=owa' instead of  
* for all unknown mediawiki actions.  
* @param object $specialPage  
* @url http://www.mediawiki.org/wiki/Manual:MediaWiki_hooks/UnknownAction  
* @return false  
*/  
function owa_actions($action) {  
 
global $wgOut, $wgUser, $wgRequest;  
 
$action = $wgRequest->getText( 'action' );  
if ( $action === 'owa' ) {  
$wgOut->disable();  
$owa = owa_singleton();  
$owa->handleSpecialActionRequest();  
return false;  
} else {  
return true;  
}  
}  
 
/**  
* OWA Singelton  
*  
* Needed to avoid OWA loading for every mediawiki request  
*/  
function owa_singleton() {  
 
static $owa;  
 
if ( empty( $owa ) ) {  
 
global $wgUser,  
$wgServer,  
$wgScriptPath,  
$wgScript,  
$wgMainCacheType,  
$wgMemCachedServers,  
$wgOwaSiteId,  
$wgOwaMemCachedServers;  
 
/* OWA CONFIGURATION OVERRIDES */  
$owa_config = array();  
// check for memcache. these need to be passed into OWA to avoid race condition.  
if ( $wgMainCacheType === CACHE_MEMCACHED ) {  
$owa_config['cacheType'] = 'memcached';  
$owa_config['memcachedServers'] = $wgMemCachedServers;  
}  
$owa = new owa_mw( $owa_config );  
$owa->setSetting( 'base', 'report_wrapper', 'wrapper_mediawiki.tpl' );  
$owa->setSetting( 'base', 'main_url', $wgScriptPath.'/index.php?title=Special:Owa' );  
$owa->setSetting( 'base', 'main_absolute_url', $wgServer.$owa->getSetting( 'base', 'main_url' ) );  
$owa->setSetting( 'base', 'action_url', $wgServer.$wgScriptPath.'/index.php?action=owa&owa_specialAction' );  
$owa->setSetting( 'base', 'api_url', $wgServer.$wgScriptPath.'/index.php?action=owa&owa_apiAction' );  
$owa->setSetting( 'base', 'link_template', '%s&%s' );  
$owa->setSetting( 'base', 'is_embedded', true );  
$owa->setSetting( 'base', 'query_string_filters', 'returnto' );  
$owa->setSetting( 'base', 'delay_first_hit', false );  
 
if ( ! $wgOwaSiteId ) {  
$wgOwaSiteId = md5($wgServer.$wgScriptPath);  
}  
 
$owa->setSiteId( $wgOwaSiteId );  
/**  
* Populates OWA's current user object with info about the current mediawiki user.  
* This info is needed by OWA authentication system as well as to add dimensions  
* requests that are logged.  
*/  
$cu = &owa_coreAPI::getCurrentUser();  
$cu->setUserData( 'user_id', $wgUser->getName() );  
$cu->setUserData( 'email_address', $wgUser->getEmail() );  
$cu->setUserData( 'real_name', $wgUser->getRealName() );  
$cu->setRole( owa_translate_role( $wgUser->getGroups() ) );  
$cu->setAuthStatus(true);  
}  
 
return $owa;  
}  
 
/**  
* Transalates MW Roles into OWA Roles  
*  
* @todo make this configurable with a global property  
*/  
function owa_translate_role($level = array()) {  
 
if ( ! empty( $level ) ) {  
 
if ( in_array( "*", $level ) ) {  
$owa_role = 'everyone';  
} elseif ( in_array( "user", $level ) ) {  
$owa_role = 'viewer';  
} elseif ( in_array( "autoconfirmed", $level ) ) {  
$owa_role = 'viewer';  
} elseif ( in_array( "emailconfirmed", $level ) ) {  
$owa_role = 'viewer';  
} elseif ( in_array( "bot", $level ) ) {  
$owa_role = 'viewer';  
} elseif ( in_array( "sysop", $level ) ) {  
$owa_role = 'admin';  
} elseif ( in_array( "bureaucrat", $level ) ) {  
$owa_role = 'admin';  
} elseif ( in_array( "developer", $level ) ) {  
$owa_role = 'admin';  
}  
 
} else {  
$owa_role = '';  
}  
 
return $owa_role;  
}  
 
/**  
* Helper function for tracking page views of various types  
*/  
function owa_trackPageView( $params = array() ) {  
 
global $wgUser, $wgOut, $wgOwaSiteId;  
 
$owa = owa_singleton();  
 
if ( $owa->getSetting( 'base', 'install_complete' ) ) {  
 
//$event = $owa->makeEvent();  
//$event->setEventType( 'base.page_request' );  
$owa->setSiteId( $wgOwaSiteId );  
$owa->setProperty( 'user_name', $wgUser->mName );  
$owa->setProperty( 'user_email', $wgUser->mEmail );  
$owa->setProperty( 'language', owa_getLanguage() );  
if ( ! $owa->pageview_event->get( 'page_type') ) {  
$owa->setPageType( '(not set)' );  
}  
 
//foreach ( $params as $k => $v ) {  
// $event->set( $k, $v );  
//}  
 
// if the page title is not set for some reasons, set it  
// using $wgOut.  
if ( ! $owa->pageview_event->get( 'page_title') ) {  
$owa->setPageTitle( 'page_title', $wgOut->getPageTitle() );  
}  
 
/*  
$tag = sprintf(  
'<!-- OWA Page View Tracking Params -->  
var owa_params = %s;',  
json_encode( $event->getProperties() )  
);  
 
$wgOut->addInlineScript( $tag );  
*/  
}  
 
return true;  
}  
 
/**  
* Logs Special Page Views  
*  
* @param object $specialPage  
* @return boolean  
*/  
function owa_logSpecialPage(&$specialPage) {  
 
$title_obj = $specialPage->getTitle();  
$title = $title_obj->getText();  
$owa = owa_singleton();  
$owa->setPageTitle( $title );  
$owa->setPageType( 'Special Page' );  
return true;  
}  
 
/**  
* Logs Category Page Views  
*  
* @param object $categoryPage  
* @return boolean  
*/  
function owa_logCategoryPage( &$categoryPage ) {  
 
$title_obj = $categoryPage->getTitle();  
$title = $title_obj->getText();  
$owa = owa_singleton();  
$owa->setPageTitle( $title );  
$owa->setPageType( 'Category' );  
return true;  
}  
 
/**  
* Logs Article Page Views  
*  
* @param object $article  
* @return boolean  
*/  
function owa_logArticle( &$article ) {  
 
$title_obj = $article->getTitle();  
$title = $title_obj->getText();  
$owa = owa_singleton();  
$owa->setPageTitle( $title );  
$owa->setPageType( 'Article' );  
return true;  
}  
 
/**  
* Helper Function for tracking Action Events  
*  
* This function is a wrapper for the Action Event API in owa_client.  
*  
* @param $action_name string The name of the action being tracked  
* @param $label string The label associated with the action being tracked  
* @return boolean true  
*/  
function owa_trackAction( $action_name, $label ) {  
 
$owa = owa_singleton();  
 
if ( $owa->getSetting( 'base', 'install_complete' ) ) {  
$owa->trackAction( 'mediawiki', $action_name, $label );  
owa_coreAPI::debug( "logging action event " . $action_name );  
}  
 
return true;  
}  
 
/**  
* Logs New Articles  
*  
* @param object $categoryPage  
* @return boolean  
*/  
function owa_newArticleAction(&$article, &$user, $text, $summary, $minoredit, &$watchthis, $sectionanchor, &$flags, $revision) {  
 
$label = $article->getTitle()->getText();  
return owa_trackAction( 'Article Created', $label );  
}  
 
function owa_editArticleAction($article, &$user, $text, $summary,  
$minoredit, &$watchthis, $sectionanchor, &$flags, $revision,  
&$status, $baseRevId, &$redirect = '') {  
 
if ( $flags & EDIT_UPDATE ) {  
 
$label = $article->getTitle()->getText();  
return owa_trackAction( 'Article Edit', $label );  
 
} else {  
 
return true;  
}  
}  
 
function owa_deleteArticleAction( &$article, &$user, $reason, $id ) {  
 
$label = $article->getTitle()->getText();  
return owa_trackAction( 'Article Deleted', $label );  
}  
 
function owa_addUserAction( $user, $byEmail ) {  
 
$label = '';  
return owa_trackAction( 'User Account Added', $label );  
}  
 
function owa_addUploadAction( &$image ) {  
 
$label = $image->getLocalFile()->getMimeType();  
return owa_trackAction( 'File Upload', $label );  
}  
 
function owa_userLoginAction( &$user, &$inject_html ) {  
 
$label = '';  
return owa_trackAction( 'Login', $label );  
}  
 
function editTalkPageAction( $article ) {  
 
$label = $article->getTitle()->getText();  
return owa_trackAction( 'Talk Page Edit', $label );  
}  
 
/**  
* Adds javascript tracker to pages  
*  
* @param object $article  
* @return boolean  
*/  
function owa_footer(&$wgOut, $sk) {  
 
global $wgRequest, $wgOwaThirdPartyCookies;  
 
if ($wgRequest->getVal('action') != 'edit' && $wgRequest->getVal('title') != 'Special:Owa') {  
 
$owa = owa_singleton();  
if ($owa->getSetting('base', 'install_complete')) {  
 
$cmds = "";  
if ( $wgOwaThirdPartyCookies ) {  
$cmds .= "owa_cmds.push( ['setOption', 'thirdParty', true] );";  
}  
 
if ( $wgOwaCookieDomain ) {  
$cmds .= "owa_cmds.push( ['setCookieDomain', '$wgOwaCookieDomain'] );";  
}  
 
$page_properties = $owa->getAllEventProperties($owa->pageview_event);  
if ( $page_properties ) {  
$page_properties_json = json_encode( $page_properties );  
$cmds .= "owa_cmds.push( ['setPageProperties', $page_properties_json] );";  
}  
 
//$wgOut->addInlineScript( $cmds );  
 
$options = array( 'cmds' => $cmds );  
 
$tags = $owa->placeHelperPageTags(false, $options);  
$wgOut->addHTML($tags);  
 
}  
}  
 
return true;  
}  
 
/**  
* Gets mediawiki Language variable  
*/  
function owa_getLanguage() {  
 
global $wgLang, $wgContLang;  
$code = '';  
 
$code = $wgLang->getCode();  
if ( ! $code ) {  
$code = $wgContLang->getCode();  
}  
 
return $code;  
}  
 
/**  
* OWA Special Page Class  
*  
* Enables OWA to be accessed through a Mediawiki special page.  
*/  
class SpecialOwa extends SpecialPage {  
 
function __construct() {  
parent::__construct('Owa');  
self::loadMessages();  
}  
 
function execute() {  
 
global $wgRequest, $wgOut, $wgUser, $wgSitename, $wgScriptPath, $wgScript, $wgServer,  
$wgDBtype, $wgDBname, $wgDBserver, $wgDBuser, $wgDBpassword;  
 
$this->setHeaders();  
//must be called after setHeaders for some reason or elsethe wgUser object is not yet populated.  
$owa = owa_singleton();  
$params = array();  
 
// if no action is found...  
$do = owa_coreAPI::getRequestParam('do');  
if (empty($do)) {  
// check to see that owa in installed.  
if (!$owa->getSetting('base', 'install_complete')) {  
 
define('OWA_INSTALLING', true);  
 
$site_url = $wgServer.$wgScriptPath;  
 
$params = array(  
'site_id' => md5($site_url),  
'name' => $wgSitename,  
'domain' => $site_url,  
'description' => '',  
'do' => 'base.installStartEmbedded');  
 
$params['db_type'] = $wgDBtype;  
$params['db_name'] = $wgDBname;  
$params['db_host'] = $wgDBserver;  
$params['db_user'] = $wgDBuser;  
$params['db_password'] = $wgDBpassword;  
$params['public_url'] = $wgServer.$wgScriptPath.'/extensions/owa/';  
$page = $owa->handleRequest($params);  
 
// send to daashboard  
} else {  
$params['do'] = 'base.reportDashboard';  
$page = $owa->handleRequest($params);  
}  
// do action found on url  
} else {  
$page = $owa->handleRequestFromURL();  
}  
 
return $wgOut->addHTML($page);  
 
}  
 
function loadMessages() {  
static $messagesLoaded = false;  
global $wgMessageCache;  
 
if ( $messagesLoaded ) return;  
 
$messagesLoaded = true;  
 
// this should be the only msg defined by mediawiki  
$allMessages = array(  
'en' => array(  
'owa' => 'Open Web Analytics'  
)  
);  
 
 
// load msgs in to mediawiki cache  
foreach ( $allMessages as $lang => $langMessages ) {  
$wgMessageCache->addMessages( $langMessages, $lang );  
}  
 
return true;  
}  
}  
 
?>  
 
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id: owa-config-dist.php 1183 2010-11-21 23:22:37Z padams $  
//  
 
/**  
* OWA Configuration  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision: 1183 $  
* @since owa 1.0.0  
*/  
 
/**  
* DATABASE CONFIGURATION  
*  
* Connection info for databases that will be used by OWA.  
*  
*/  
 
define('OWA_DB_TYPE', 'yourdbtypegoeshere'); // options: mysql  
define('OWA_DB_NAME', 'yourdbnamegoeshere'); // name of the database  
define('OWA_DB_HOST', 'yourdbhostgoeshere'); // host name of the server housing the database  
define('OWA_DB_USER', 'yourdbusergoeshere'); // database user  
define('OWA_DB_PASSWORD', 'yourdbpasswordgoeshere'); // database user's password  
 
 
/**  
* PUBLIC URL  
*  
* Define the URL of OWA's base directory e.g. http://www.domain.com/path/to/owa/  
* Don't forget the slash at the end.  
*/  
 
define('OWA_PUBLIC_URL', 'http://domain/path/to/owa/');  
 
/**  
* OWA ERROR HANDLER  
*  
* Overide OWA error handler. This should be done through the admin GUI, but  
* can be handy during install or development.  
*  
* Choices are:  
*  
* 'production' - will log only critical errors to a log file.  
* 'development' - logs al sorts of useful debug to log file.  
*/  
 
//define('OWA_ERROR_HANDLER', 'development');  
 
/**  
* LOG PHP ERRORS  
*  
* Log all php errors to OWA's error log file. Only do this to debug.  
*/  
 
//define('OWA_LOG_PHP_ERRORS', true);  
 
/**  
* OBJECT CACHING  
*  
* Override setting to cache objects. Caching will increase performance.  
*/  
 
//define('OWA_CACHE_OBJECTS', true);  
 
/**  
* CONFIGURATION ID  
*  
* Override to load an alternative user configuration  
*/  
 
//define('OWA_CONFIGURATION_ID', '1');  
 
 
?>  
<?php  
// ...  
?>  
<?php  
// ...  
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_controller.php');  
 
/**  
* Administrative Controller Class  
*  
* This controller should be used for internal management pages/actions that require authentication  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_adminController extends owa_controller {  
 
var $is_admin = true;  
 
/**  
* Constructor  
*  
* @param array $params  
* @return owa_controller  
*/  
function __construct($params) {  
 
return parent::__construct($params);  
}  
}  
 
?>  
file:a/busui/owa/owa_auth.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* User Authentication Object  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_auth extends owa_base {  
 
/**  
* User object  
*  
* @var unknown_type  
*/  
var $u;  
 
/**  
* Array of permission roles that users can have  
*  
* @var array  
*/  
var $roles;  
 
var $status_msg;  
 
/**  
* Login credentials  
*  
* @var array  
*/  
var $credentials = array();  
 
/**  
* Status of Authentication  
*  
* @var boolean  
*/  
var $auth_status = false;  
 
var $_is_user = false;  
 
var $_priviledge_level;  
 
var $_is_priviledged = false;  
 
var $params;  
 
var $check_for_credentials = false;  
 
/**  
* Auth class Singleton  
*  
* @return object  
*/  
public static function &get_instance($plugin = '') {  
 
static $auth;  
 
if (!$auth) {  
 
$auth = new owa_auth();  
 
}  
 
return $auth;  
}  
 
 
/**  
* Class Constructor  
*  
* @return owa_auth  
*/  
function __construct() {  
 
parent::__construct();  
$this->eq = owa_coreAPI::getEventDispatch();  
}  
 
/**  
* Used by controllers to check if the user exists and if they are priviledged.  
*  
* @param string $necessary_role  
*/  
function authenticateUser() {  
 
// check existing auth status first in case someone else took care of this already.  
if (owa_coreAPI::getCurrentUser()->isAuthenticated()) {  
$ret = true;  
} elseif (owa_coreAPI::getRequestParam('apiKey')) {  
// auth user by api key  
$ret = $this->authByApiKey(owa_coreAPI::getRequestParam('apiKey'));  
} elseif (owa_coreAPI::getRequestParam('pk') && owa_coreAPI::getStateParam('u')) {  
// auth user by temporary passkey. used in forgot password situations  
$ret = $this->authenticateUserByUrlPasskey(owa_coreAPI::getRequestParam('pk'));  
} elseif (owa_coreAPI::getRequestParam('user_id') && owa_coreAPI::getRequestParam('password')) {  
// auth user by login form input  
$ret = $this->authByInput(owa_coreAPI::getRequestParam('user_id'), owa_coreAPI::getRequestParam('password'));  
} elseif (owa_coreAPI::getStateParam('u') && owa_coreAPI::getStateParam('p')) {  
// auth user by cookies  
$ret = $this->authByCookies(owa_coreAPI::getStateParam('u'), owa_coreAPI::getStateParam('p'));  
} else {  
$ret = false;  
owa_coreAPI::debug("Could not find any credentials to authenticate with.");  
}  
 
// filter results for modules can add their own auth logic.  
$ret = $this->eq->filter('auth_status', $ret);  
 
return array('auth_status' => $ret);  
 
}  
 
function authByApiKey($key) {  
 
// fetch user object from the db  
$this->u = owa_coreAPI::entityFactory('base.user');  
$this->u->load($key, 'api_key');  
 
if ($this->u->get('user_id')) {  
// get current user  
$cu = &owa_coreAPI::getCurrentUser();  
// set as new current user in service layer  
$cu->loadNewUserByObject($this->u);  
$cu->setAuthStatus(true);  
$this->_is_user = true;  
return true;  
} else {  
return false;  
}  
 
 
}  
 
function authByCookies($user_id, $password) {  
 
// set credentials  
$this->credentials['user_id'] = $user_id;  
$this->credentials['password'] = $password;  
 
// lookup user if not already done.  
if ($this->_is_user == false) {  
 
// check to see if the current user has already been authenticated by something upstream  
$cu = &owa_coreAPI::getCurrentUser();  
if (!$cu->isAuthenticated()) {  
// check to see if they are a user.  
return $this->isUser();  
}  
} else {  
return true;  
}  
}  
 
function authByInput($user_id, $password) {  
 
// set credentials  
$this->credentials['user_id'] = $user_id;  
// must encrypt password to see if it matches whats in the db  
$this->credentials['password'] = $this->encryptPassword($password);  
//owa_coreAPI::debug(print_r($this->credentials, true));  
$ret = $this->isUser();  
 
if ($ret === true) {  
$this->saveCredentials();  
}  
 
return $ret;  
}  
 
/**  
* Looks up user by temporary Passkey Column in db  
*  
* @param unknown_type $key  
* @return unknown  
*/  
function authenticateUserTempPasskey($key) {  
 
$this->u = owa_coreAPI::entityFactory('base.user');  
$this->u->getByColumn('temp_passkey', $key);  
 
$id = $this->u->get('id');  
if (!empty($id)):  
return true;  
else:  
return false;  
endif;  
 
}  
 
/**  
* Authenticates user by a passkey  
*  
* @param unknown_type $key  
* @return unknown  
*/  
function authenticateUserByUrlPasskey($user_id, $passkey) {  
 
// set credentials  
$this->credentials['user_id'] = $user_id;  
$this->credentials['passkey'] = $passkey;  
 
// fetch user obj  
$this->getUser();  
 
// generate a new passkey from its components in the db  
$key = $this->generateUrlPasskey($this->u->get('user_id'), $this->u->get('password'));  
 
// see if it matches the key on the url  
if ($key == $passkey):  
return true;  
else:  
return false;  
endif;  
 
}  
 
/**  
* Sets a temporary Passkey for a user  
*  
* @param string $email_address  
* @return boolean  
*/  
function setTempPasskey($email_address) {  
 
$this->u = owa_coreAPI::entityFactory('base.user');  
$this->u->getByColumn('email_address', $email_address);  
 
$id = $u->get('id');  
 
if (!empty($id)):  
 
$this->eq->log(array('email_address' => $this->u->email_address), 'user.set_temp_passkey');  
return true;  
else:  
return false;  
endif;  
 
}  
 
function generateTempPasskey($seed) {  
 
return md5($seed.time().rand());  
}  
 
function generateUrlPasskey($user_name, $password) {  
 
return md5($user_name . $password);  
 
}  
 
/**  
* Sets the initial Passkey for a new user  
*  
* @param string $user_id  
* @return boolean  
* @deprecated  
*/  
function setInitialPasskey($user_id) {  
 
return $this->eq->log(array('user_id' => $user_id), 'user.set_initial_passkey');  
 
}  
 
/**  
* Saves login credentails to persistant browser cookies  
* TODO: refactor to use state facility  
*/  
function saveCredentials() {  
 
$this->e->debug('saving user credentials to cookies');  
setcookie($this->config['ns'].'u', $this->u->get('user_id'), time()+3600*24*365*10, '/', $this->config['cookie_domain']);  
setcookie($this->config['ns'].'p', $this->u->get('password'), time()+3600*24*30, '/', $this->config['cookie_domain']);  
}  
 
/**  
* Removes credentials  
* @return boolean  
*/  
function deleteCredentials() {  
 
return owa_coreAPI::clearState('p');  
}  
 
/**  
* Simple Password Encryption Scheme  
*  
* @param string $password  
* @return string  
*/  
function encryptPassword($password) {  
 
return owa_lib::encryptPassword($password);  
}  
 
function getUser() {  
 
// fetch user object from the db  
$this->u = owa_coreAPI::entityFactory('base.user');  
$this->u->getByColumn('user_id', $this->credentials['user_id']);  
}  
 
/**  
* Checks to see if the user credentials match a real user object in the DB  
*  
* @return boolean  
*/  
function isUser() {  
 
// get current user  
$cu = &owa_coreAPI::getCurrentUser();  
 
// fetches user object from DB  
$this->getUser();  
if ($this->credentials['user_id'] === $this->u->get('user_id')):  
 
if ($this->credentials['password'] === $this->u->get('password')):  
$this->_is_user = true;  
 
// set as new current user in service layer  
$cu->loadNewUserByObject($this->u);  
$cu->setAuthStatus(true);  
return true;  
else:  
$this->_is_user = false;  
return false;  
endif;  
else:  
$this->_is_user = false;  
return false;  
endif;  
 
}  
 
}  
 
?>  
file:a/busui/owa/owa_base.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once('owa_env.php');  
 
/**  
* OWA Base Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_base {  
 
/**  
* Configuration  
*  
* @var array  
*/  
var $config;  
 
/**  
* Error Logger  
*  
* @var object  
*/  
var $e;  
 
/**  
* Configuration Entity  
*  
* @var Object global configuration object  
*/  
var $c;  
 
/**  
* Module that this class belongs to  
*  
* @var unknown_type  
*/  
var $module;  
 
/**  
* Request Params  
*  
* @var array  
*/  
var $params;  
 
/**  
* Base Constructor  
*  
* @return owa_base  
*/  
function owa_base() {  
 
return owa_base::__construct();  
 
}  
 
function __construct() {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$this->e = &owa_coreAPI::errorSingleton();  
$this->c = &owa_coreAPI::configSingleton();  
$this->config = $this->c->fetch('base');  
}  
 
/**  
* Retrieves string message from mesage file  
*  
* @param integer $code  
* @param string $s1  
* @param string $s2  
* @param string $s3  
* @param string $s4  
* @return string  
*/  
function getMsg($code, $s1 = null, $s2 = null, $s3 = null, $s4 = null) {  
 
static $_owa_messages;  
 
if (empty($_owa_messages)) {  
 
require_once(OWA_DIR.'conf/messages.php');  
}  
 
switch ($_owa_messages[$code][1]) {  
 
case 0:  
$msg = $_owa_messages[$code][0];  
break;  
case 1:  
$msg = sprintf($_owa_messages[$code][0], $s1);  
break;  
case 2:  
$msg = sprintf($_owa_messages[$code][0], $s1, $s2);  
break;  
case 3:  
$msg = sprintf($_owa_messages[$code][0], $s1, $s2, $s3);  
break;  
case 4:  
$msg = sprintf($_owa_messages[$code][0], $s1, $s2, $s3, $s4);  
break;  
}  
 
return $msg;  
 
}  
 
/**  
* Sets object attributes  
*  
* @param unknown_type $array  
*/  
function _setObjectValues($array) {  
 
foreach ($array as $n => $v) {  
 
$this->$n = $v;  
 
}  
 
return;  
}  
 
/**  
* Sets array attributes  
*  
* @param unknown_type $array  
*/  
function _setArrayValues($array) {  
 
foreach ($array as $n => $v) {  
 
$this->params['$n'] = $v;  
 
}  
 
return;  
}  
 
function __destruct() {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_base.php');  
require_once(OWA_BASE_DIR.'/owa_requestContainer.php');  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
require_once(OWA_BASE_DIR.'/owa_coreAPI.php');  
 
/**  
* Abstract Caller class used to build application specific invocation classes  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_caller extends owa_base {  
 
/**  
* Request Params from get or post  
*  
* @var array  
*/  
var $params;  
 
var $start_time;  
 
var $end_time;  
 
var $update_required;  
 
var $service;  
 
var $site_id;  
 
/**  
* Constructor  
*  
* @param array $config  
* @return owa_caller  
*/  
function __construct($config = array()) {  
 
if (empty($config)) {  
$config = array();  
}  
 
// Start time  
$this->start_time = owa_lib::microtime_float();  
 
/* SETUP CONFIGURATION AND ERROR LOGGER */  
 
// Parent Constructor. Sets default config entity and error logger  
parent::__construct();  
 
// Log version debug  
$this->e->debug(sprintf('*** Starting Open Web Analytics v%s. Running under PHP v%s (%s) ***', OWA_VERSION, PHP_VERSION, PHP_OS));  
if ( array_key_exists('REQUEST_URI', $_SERVER ) ) {  
owa_coreAPI::debug( 'Request URL: '.$_SERVER['REQUEST_URI'] );  
}  
 
if ( array_key_exists('HTTP_USER_AGENT', $_SERVER ) ) {  
owa_coreAPI::debug( 'User Agent: '.$_SERVER['HTTP_USER_AGENT'] );  
}  
 
if ( array_key_exists('HTTP_HOST', $_SERVER ) ) {  
owa_coreAPI::debug( 'Host: '.$_SERVER['HTTP_HOST'] );  
}  
//owa_coreAPI::debug('cookie domain in caller: '. owa_coreAPI::getSetting('base', 'cookie_domain'));  
// Backtrace. handy for debugging who called OWA  
//$bt = debug_backtrace();  
//$this->e->debug($bt[4]);  
 
// load config values from DB  
// Applies config from db or cache  
// check here is needed for installs when the configuration table does not exist.  
 
if (!defined('OWA_INSTALLING')) {  
if ($this->c->get('base', 'do_not_fetch_config_from_db') != true) {  
if ($this->c->isConfigFilePresent()) {  
$this->c->load($this->c->get('base', 'configuration_id'));  
}  
}  
}  
 
 
/* APPLY CALLER CONFIGURATION OVERRIDES */  
 
// overrides all default and user config values except defined in the config file  
// must come after user overides are applied  
// This will apply configuration overirdes that are specified by the calling application.  
// This is usually used by plugins to setup integration specific configuration values.  
 
$this->c->applyModuleOverrides('base', $config);  
 
$this->e->debug('Caller configuration overrides applied.');  
 
/* SET ERROR HANDLER */  
 
// Sets the correct mode of the error logger now that final config values are in place  
// This will flush buffered msgs that were thrown up untill this point  
$this->e->setHandler($this->c->get('base', 'error_handler'));  
 
/* PHP ERROR LOGGING */  
 
if (defined('OWA_LOG_PHP_ERRORS')) {  
$this->e->logPhpErrors();  
}  
 
/* LOAD SERVICE LAYER */  
$this->service = &owa_coreAPI::serviceSingleton();  
// initialize framework  
$this->service->initializeFramework();  
// notify handlers of 'init' action  
$dispatch = owa_coreAPI::getEventDispatch();  
$dispatch->notify($dispatch->makeEvent('init'));  
 
/* SET SITE ID */  
// needed in standalone installs where site_id is not set in config file.  
// still needed??????  
if (!empty($this->params['site_id'])) {  
$this->c->set('base', 'site_id', $this->params['site_id']);  
}  
 
// re-fetch the array now that overrides have been applied.  
// needed for backwards compatability  
$this->config = $this->c->fetch('base');  
 
/* SETUP REQUEST Params */  
// still needed?????  
$this->params = $this->service->request->getAllOwaParams();  
}  
 
function handleRequestFromUrl() {  
 
//$this->params = owa_lib::getRequestParams();  
return $this->handleRequest();  
 
}  
 
 
/**  
* Returns a configured javascript tracker for inclusion in your web page.  
* You can pass an options array to control what the tracker will log.  
* The options array is a key/value pair format like:  
*  
* $options = array('do_not_log_pageview' => true);  
*  
* Option keys include: 'do_not_log_pageview', 'do_not_log_clicks', 'do_not_log_domstream'  
*  
* @param $echo bool if true the function will echo. if false the tracker is returned asa string.  
* @param $options array an key value pair option array  
* @return $tag string the tracker javascript.  
*/  
function placeHelperPageTags($echo = true, $options = array()) {  
 
if(!owa_coreAPI::getRequestParam('is_robot')) {  
 
$tag = owa_coreAPI::getJsTrackerTag( $this->getSiteId(), $options );  
 
if ($echo == false) {  
return $tag;  
} else {  
echo $tag;  
}  
}  
}  
 
// needed?  
function handleHelperPageTagsRequest() {  
 
$params = array();  
$params['do'] = 'base.helperPageTags';  
return $this->handleRequest($params);  
 
}  
 
/**  
* Handles OWA internal page/action requests  
*  
* @return unknown  
*/  
function handleRequest($caller_params = null, $action = '') {  
 
return owa_coreAPI::handleRequest($caller_params, $action);  
 
}  
 
function handleSpecialActionRequest() {  
 
if(isset($_GET['owa_specialAction'])):  
$this->e->debug("special action received");  
echo $this->handleRequestFromUrl();  
$this->e->debug("special action complete");  
exit;  
elseif(isset($_GET['owa_logAction'])):  
$this->e->debug("log action received");  
$this->config['delay_first_hit'] = false;  
$this->c->set('base', 'delay_first_hit', false);  
echo $this->logEventFromUrl();  
exit;  
elseif(isset($_GET['owa_apiAction'])):  
$this->e->debug("api action received");  
define('OWA_API', true);  
// lookup method class  
echo $this->handleRequest('', 'base.apiRequest');  
exit;  
else:  
owa_coreAPI::debug('hello from special action request method in caller. no action to do.');  
return;  
endif;  
 
}  
 
function __destruct() {  
 
$this->end_time = owa_lib::microtime_float();  
$total_time = $this->end_time - $this->start_time;  
$this->e->debug(sprintf('Total session time: %s',$total_time));  
$this->e->debug("goodbye from OWA");  
owa_coreAPI::profileDisplay();  
 
return;  
}  
 
function setSetting($module, $name, $value) {  
 
return owa_coreAPI::setSetting($module, $name, $value);  
}  
 
function getSetting($module, $name) {  
 
return owa_coreAPI::getSetting($module, $name);  
}  
 
function setCurrentUser($role, $login_name = '') {  
$cu =&owa_coreAPI::getCurrentUser();  
$cu->setRole($role);  
$cu->setAuthStatus(true);  
}  
 
function makeEvent($type = '') {  
 
$event = owa_coreAPI::supportClassFactory('base', 'event');  
 
if ($type) {  
$event->setEventType($type);  
}  
 
return $event;  
}  
 
function setSiteId($site_id) {  
 
$this->site_id = $site_id;  
}  
 
function getSiteId() {  
 
return $this->site_id;  
}  
 
function setErrorHandler($mode) {  
$this->e->setHandler($mode);  
}  
 
function isOwaInstalled() {  
 
$version = owa_coreAPI::getSetting('base', 'schema_version');  
if ($version > 0) {  
return true;  
} else {  
return false;  
}  
}  
 
function isEndpointEnabled($file_name) {  
 
if ( ! $this->getSetting('base', 'disableAllEndpoints') ) {  
$disabled_endpoints = $this->getSetting('base', 'disabledEndpoints');  
 
if ( ! in_array( $file_name, $disabled_endpoints ) ) {  
return true;  
}  
}  
}  
 
function restInPeace() {  
 
echo '...';  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Controller Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_controller extends owa_base {  
 
/**  
* Request Parameters passed in from caller  
*  
* @var array  
*/  
var $params = array();  
 
/**  
* Controller Type  
*  
* @var array  
*/  
var $type;  
 
/**  
* Is the controller for an admin function  
*  
* @var boolean  
*/  
var $is_admin;  
 
/**  
* The priviledge level required to access this controller  
*  
* @var string  
*/  
var $priviledge_level;  
 
/**  
* data validation control object  
*  
* @var Object  
*/  
var $v;  
 
/**  
* Data container  
*  
* @var Array  
*/  
var $data = array();  
 
/**  
* Capability  
*  
* @var string  
*/  
var $capability;  
 
/**  
* Available Views  
*  
* @var Array  
*/  
var $available_views = array();  
 
/**  
* Time period  
*  
* @var Object  
*/  
var $period;  
 
/**  
* Dom id  
*  
* @var String  
*/  
var $dom_id;  
 
/**  
* Flag for requiring authenciation before performing actions  
*  
* @var Bool  
*/  
var $authenticate_user;  
 
var $state;  
 
/**  
* Flag for requiring nonce before performing write actions  
*  
* @var Bool  
*/  
var $is_nonce_required = false;  
 
/**  
* Constructor  
*  
* @param array $params  
*/  
function __construct($params) {  
 
// call parent constructor to setup objects.  
parent::__construct();  
 
// set request params  
$this->params = $params;  
 
// set the default view method  
$this->setViewMethod('delegate');  
}  
 
/**  
* Handles request from caller  
*  
*/  
function doAction() {  
 
owa_coreAPI::debug('Performing Action: '.get_class($this));  
 
// check if the schema needs to be updated and force the update  
// not sure this should go here...  
if ($this->is_admin === true) {  
// do not intercept if its the updatesApply action or a re-install else updates will never apply  
$do = $this->getParam('do');  
if ($do != 'base.updatesApply' && !defined('OWA_INSTALLING') && !defined('OWA_UPDATING')) {  
 
if (owa_coreAPI::isUpdateRequired()) {  
$this->e->debug('Updates Required. Redirecting action.');  
$data = array();  
$data['view_method'] = 'redirect';  
$data['action'] = 'base.updates';  
return $data;  
}  
}  
}  
 
 
/* Check validity of nonce */  
 
if ($this->is_nonce_required == true) {  
$nonce = $this->getParam('nonce');  
 
if ($nonce) {  
$is_nonce_valid = $this->verifyNonce($nonce);  
}  
 
if (!$nonce || !$is_nonce_valid) {  
$this->e->debug('Nonce is not valid.');  
$ret = $this->notAuthenticatedAction();  
if (!empty($ret)) {  
$this->post();  
return $ret;  
} else {  
$this->post();  
return $this->data;  
}  
}  
}  
 
/* CHECK USER FOR CAPABILITIES */  
if (!owa_coreAPI::isCurrentUserCapable($this->getRequiredCapability())) {  
 
owa_coreAPI::debug('User does not have capability required by this controller.');  
 
// check to see if the user has already been authenticated  
if (owa_coreAPI::isCurrentUserAuthenticated()) {  
$this->authenticatedButNotCapableAction();  
return $this->data;  
}  
 
/* PERFORM AUTHENTICATION */  
$auth = &owa_auth::get_instance();  
$status = $auth->authenticateUser();  
// if auth was not successful then return login view.  
if ($status['auth_status'] != true) {  
$this->notAuthenticatedAction();  
return $this->data;  
} else {  
//check for needed capability again now that they are authenticated  
if (!owa_coreAPI::isCurrentUserCapable($this->getRequiredCapability())) {  
$this->authenticatedButNotCapableAction();  
//needed?  
$this->set('go', urlencode(owa_lib::get_current_url()));  
// needed? -- set auth status for downstream views  
$this->set('auth_status', true);  
return $this->data;  
}  
}  
}  
// TODO: These sets need to be removed and added to pre(), action() or post() methods  
// in various concrete controller classes as they screw up things when  
// redirecting from one controller to another.  
 
// set auth status for downstream views  
//$this->set('auth_status', true);  
//set request params  
$this->set('params', $this->params);  
// set site_id  
$this->set('site_id', $this->get('site_id'));  
 
// set status msg - NEEDED HERE? doesnt owa_ view handle this?  
if (array_key_exists('status_code', $this->params)) {  
$this->set('status_code', $this->getParam('status_code'));  
}  
 
// get error msg from error code passed on the query string from a redirect.  
if (array_key_exists('error_code', $this->params)) {  
$this->set('error_code', $this->getParam('error_code'));  
}  
 
// check to see if the controller has created a validator  
if (!empty($this->v)) {  
// if so do the validations required  
$this->v->doValidations();  
//check for errors  
if ($this->v->hasErrors === true) {  
//print_r($this->v);  
// if errors, do the errorAction instead of the normal action  
$this->set('validation_errors', $this->getValidationErrorMsgs());  
$ret = $this->errorAction();  
if (!empty($ret)) {  
$this->post();  
return $ret;  
} else {  
$this->post();  
return $this->data;  
}  
}  
}  
 
 
/* PERFORM PRE ACTION */  
// often used by abstract descendant controllers to set various things  
$this->pre();  
 
/* PERFORM MAIN ACTION */  
// need to check ret for backwards compatability with older  
// controllers that donot use $this->data  
$ret = $this->action();  
 
if (!empty($ret)) {  
$this->post();  
return $ret;  
} else {  
$this->post();  
return $this->data;  
}  
 
}  
 
function logEvent($event_type, $properties) {  
 
if (!class_exists('eventQueue')):  
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'eventQueue.php');  
endif;  
 
$eq = &eventQueue::get_instance();  
 
if (!is_a($properties, 'owa_event')) {  
 
$event = owa_coreAPI::supportClassFactory('base', 'event');  
$event->setProperties($properties);  
$event->setEventType($event_type);  
} else {  
$event = $properties;  
}  
 
return $eq->log($event, $event->getEventType());  
}  
 
function createValidator() {  
 
$this->v = owa_coreAPI::supportClassFactory('base', 'validator');  
 
return;  
 
}  
 
function addValidation($name, $value, $validation, $conf = array()) {  
 
if (empty($this->v)):  
$this->createValidator();  
endif;  
 
return $this->v->addValidation($name, $value, $validation, $conf);  
 
}  
 
function setValidation($name, $obj) {  
 
if (empty($this->v)):  
$this->createValidator();  
endif;  
 
return $this->v->setValidation($name, $obj);  
 
}  
 
function getValidationErrorMsgs() {  
 
return $this->v->getErrorMsgs();  
 
}  
 
function isAdmin() {  
 
if ($this->is_admin == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
// depricated  
function _setCapability($capability) {  
 
$this->setRequiredCapability($capability);  
 
return;  
}  
 
function setRequiredCapability($capability) {  
 
$this->capability = $capability;  
return;  
}  
 
function getRequiredCapability() {  
 
return $this->capability;  
}  
 
function getParam($name) {  
 
if (array_key_exists($name, $this->params)) {  
return $this->params[$name];  
} else {  
return false;  
}  
}  
 
function setParam($name, $value) {  
 
$this->params[$name] = $value;  
}  
 
function isParam($name) {  
 
if (array_key_exists($name, $this->params)) {  
return true;  
} else {  
return false;  
}  
}  
 
function get($name) {  
 
return $this->getParam($name);  
}  
 
function getAllParams() {  
 
return $this->params;  
}  
 
function pre() {  
 
return false;  
}  
 
function post() {  
return false;  
}  
 
function getPeriod() {  
 
return $this->period;  
}  
 
function setPeriod() {  
 
// set period  
 
$period = $this->makeTimePeriod($this->getParam('period'), $this->params);  
 
$this->period = $period;  
$this->set('period', $this->getPeriod());  
$this->data['params'] = array_merge($this->data['params'], $period->getPeriodProperties());  
return;  
}  
 
function makeTimePeriod($time_period, $params = array()) {  
 
return owa_coreAPI::makeTimePeriod($time_period, $params);  
}  
 
function setTimePeriod($period) {  
 
$this->period = $period;  
$this->set('period', $this->getPeriod());  
//$this->data['params'] = array_merge($this->data['params'], $period->getPeriodProperties());  
}  
 
 
function setView($view) {  
$this->data['view'] = $view;  
return;  
}  
 
function setSubview($subview) {  
$this->data['subview'] = $subview;  
return;  
}  
 
function setViewMethod($method = 'delegate') {  
$this->data['view_method'] = $method;  
return;  
}  
 
function setRedirectAction($do) {  
$this->set('view_method', 'redirect');  
$this->set('do', $do);  
 
// need to remove these unsets once they are no longer set in the main doAction method  
if (array_key_exists('params', $this->data)) {  
unset($this->data['params']);  
}  
if (array_key_exists('site_id', $this->data)) {  
// unset($this->data['site_id']);  
}  
}  
 
function setPagination($pagination, $name = 'pagination') {  
$this->data[$name] = $pagination;  
return;  
}  
 
function set($name, $value) {  
 
$this->data[$name] = $value;  
return;  
}  
 
function setControllerType($string) {  
 
$this->type = $string;  
return;  
}  
 
function mergeParams($array) {  
 
$this->params = array_merge($this->params, $array);  
return;  
}  
 
/**  
* redirects borwser to a particular view  
*  
* @param unknown_type $data  
*/  
function redirectBrowser($action, $pass_params = true) {  
 
$control_params = array('view_method', 'auth_status');  
 
$get = '';  
 
$get .= owa_coreAPI::getSetting('base', 'ns').'do'.'='.$action.'&';  
 
if ($pass_params === true) {  
 
foreach ($this->data as $n => $v) {  
 
if (!in_array($n, $control_params)) {  
 
$get .= owa_coreAPI::getSetting('base', 'ns').$n.'='.$v.'&';  
 
}  
}  
}  
 
$new_url = sprintf(owa_coreAPI::getSetting('base', 'link_template'), owa_coreAPI::getSetting('base', 'main_url'), $get);  
 
return owa_lib::redirectBrowser($new_url);  
 
}  
 
function redirectBrowserToUrl($url) {  
 
return owa_lib::redirectBrowser($url);  
}  
 
function setStatusCode($code) {  
 
$this->data['status_code'] = $code;  
}  
 
function setStatusMsg($msg) {  
 
$this->data['status_message'] = $msg;  
}  
 
function authenticatedButNotCapableAction() {  
 
$this->setView('base.error');  
$this->set('error_msg', $this->getMsg(2003));  
}  
 
function notAuthenticatedAction() {  
 
$this->setRedirectAction('base.loginForm');  
$this->set('go', urlencode(owa_lib::get_current_url()));  
}  
 
function verifyNonce($nonce) {  
 
$action = $this->getParam('do');  
 
if (!$action) {  
$action = $this->getParam('action');  
}  
 
$matching_nonce = owa_coreAPI::createNonce($action);  
//owa_coreAPI::debug("passed nonce: $nonce | matching nonce: $matching_nonce");  
if ($nonce === $matching_nonce) {  
return true;  
}  
}  
 
/**  
* Sets nonce flag for the controller.  
*/  
function setNonceRequired() {  
 
$this->is_nonce_required = true;  
}  
 
function getSetting($module, $name) {  
return owa_coreAPI::getSetting($module, $name);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_lib.php');  
 
/**  
* OWA Core API  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_coreAPI {  
 
public static function &singleton($params = array()) {  
 
static $api;  
 
if(!isset($api)):  
$api = new owa_coreAPI();  
endif;  
 
if(!empty($params)):  
$api->params = $params;  
endif;  
 
return $api;  
}  
 
public static function setupStorageEngine($type) {  
 
if (!class_exists('owa_db')) {  
require_once(OWA_BASE_CLASSES_DIR.'owa_db.php');  
}  
 
if ($type) {  
 
$connection_class = "owa_db_" . $type;  
 
if (!class_exists($connection_class)) {  
$connection_class_path = OWA_PLUGINS_DIR.'/db/' . $connection_class . ".php";  
 
if (!require_once($connection_class_path)) {  
owa_coreAPI::error(sprintf('Cannot locate proper db class at %s.', $connection_class_path));  
return false;  
}  
}  
 
}  
 
return true;  
 
}  
 
public static function &dbSingleton() {  
 
static $db;  
 
if (!isset($db)) {  
 
$db_type = owa_coreAPI::getSetting('base', 'db_type');  
$ret = owa_coreAPI::setupStorageEngine($db_type);  
 
if (!$ret) {  
owa_coreAPI::error(sprintf('Cannot locate proper db class at %s. Exiting.', $connection_class_path));  
return;  
} else {  
$connection_class = 'owa_db_'.$db_type;  
$db = new $connection_class(  
owa_coreAPI::getSetting('base','db_host'),  
owa_coreAPI::getSetting('base','db_name'),  
owa_coreAPI::getSetting('base','db_user'),  
owa_coreAPI::getSetting('base','db_password'),  
owa_coreAPI::getSetting('base','db_force_new_connections'),  
owa_coreAPI::getSetting('base','db_make_persistant_connections')  
);  
}  
}  
 
return $db;  
}  
 
public static function &configSingleton($params = array()) {  
 
static $config;  
 
if(!isset($config)):  
 
if (!class_exists('owa_settings')):  
require_once(OWA_BASE_CLASS_DIR.'settings.php');  
endif;  
 
$config = owa_coreAPI::supportClassFactory('base', 'settings');  
 
endif;  
 
return $config;  
}  
 
public static function &errorSingleton() {  
 
static $e;  
 
if(!$e) {  
 
if (!class_exists('owa_error')):  
require_once(OWA_BASE_CLASS_DIR.'error.php');  
endif;  
 
$e = owa_coreAPI::supportClassFactory('base', 'error');  
 
}  
 
return $e;  
}  
 
public static function getSetting($module, $name) {  
 
$s = &owa_coreAPI::configSingleton();  
return $s->get($module, $name);  
}  
 
public static function setSetting($module, $name, $value, $persist = false) {  
 
$s = &owa_coreAPI::configSingleton();  
 
if ($persist === true) {  
$s->persistSetting($module, $name, $value);  
} else {  
$s->setSetting($module, $name, $value);  
}  
 
}  
 
public static function persistSetting($module, $name, $value) {  
 
$s = &owa_coreAPI::configSingleton();  
$s->persistSetting($module, $name, $value);  
 
}  
 
public static function getSiteSetting($site_id, $name) {  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->load( $site->generateId( $site_id ) );  
if ( $site->wasPersisted() ) {  
 
$settings = $site->get('settings');  
if (!empty($settings)) {  
if ( array_key_exists($name, $settings) ) {  
return $settings[$name];  
}  
}  
}  
}  
 
public static function persistSiteSetting($site_id, $name, $value) {  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->load( $site->generateId( $site_id ) );  
if ( $site->wasPersisted() ) {  
$settings = $site->get('settings');  
if ( ! $settings ) {  
$settings = array();  
}  
$settings[$name] = $value;  
$site->set('settings', $settings);  
$site->update();  
}  
}  
 
public static function getSiteSettings($site_id) {  
 
$site = owa_coreAPI::entityFactory('base.site');  
$site->load( $site->generateId( $site_id ) );  
if ( $site->wasPersisted() ) {  
 
$settings = $site->get('settings');  
 
if ( $settings ) {  
return $settings;  
} else {  
return array();  
}  
}  
 
}  
 
public static function getAllRoles() {  
 
$caps = owa_coreAPI::getSetting('base', 'capabilities');  
return array_keys($caps);  
}  
 
public static function &getCurrentUser() {  
 
$s = &owa_coreAPI::serviceSingleton();  
return $s->getCurrentUser();  
}  
 
/**  
* check to see if the current user has a capability  
* always returns a bool  
*/  
public static function isCurrentUserCapable($capability) {  
 
$cu = &owa_coreAPI::getCurrentUser();  
owa_coreAPI::debug("Current User Role: ".$cu->getRole());  
owa_coreAPI::debug("Current User Authentication: ".$cu->isAuthenticated());  
$ret = $cu->isCapable($capability);  
owa_coreAPI::debug("Is current User capable: ".$ret);  
return $ret;  
}  
 
public static function isCurrentUserAuthenticated() {  
 
$cu = &owa_coreAPI::getCurrentUser();  
return $cu->isAuthenticated();  
}  
 
public static function &serviceSingleton() {  
 
static $s;  
 
if(empty($s)) {  
 
if (!class_exists('owa_service')) {  
require_once(OWA_BASE_CLASS_DIR.'service.php');  
}  
 
$s = owa_coreAPI::supportClassFactory('base', 'service');  
 
}  
 
return $s;  
}  
 
public static function &cacheSingleton($params = array()) {  
 
static $cache;  
 
if ( !isset ( $cache ) ) {  
$cache_type = owa_coreAPI::getSetting('base', 'cacheType');  
 
switch ($cache_type) {  
 
case "memcached":  
$implementation = array('owa_memcachedCache', OWA_BASE_CLASS_DIR.'memcachedCache.php');  
break;  
default:  
$implementation = array('owa_fileCache', OWA_BASE_CLASS_DIR.'fileCache.php');  
 
}  
 
if ( ! class_exists( $implementation[0] ) ) {  
require_once( $implementation[1] );  
}  
// make this plugable  
$cache = new $implementation[0];  
}  
 
return $cache;  
}  
 
public static function requestContainerSingleton() {  
 
static $request;  
 
if(!isset($request)):  
 
if (!class_exists('owa_requestContainer')):  
require_once(OWA_DIR.'owa_requestContainer.php');  
endif;  
 
$request = owa_lib::factory(OWA_DIR, '', 'owa_requestContainer');  
 
endif;  
 
return $request;  
 
}  
 
public static function moduleRequireOnce($module, $class_dir, $file) {  
 
if (!empty($class_dir)) {  
 
$class_dir .= DIRECTORY_SEPARATOR;  
 
}  
 
$full_file_path = OWA_BASE_DIR.'/modules/'.$module.DIRECTORY_SEPARATOR.$class_dir.$file.'.php';  
 
if (file_exists($full_file_path)) {  
return require_once($full_file_path);  
} else {  
owa_coreAPI::debug("moduleRequireOnce says no file found at: $full_file_path");  
return false;  
}  
}  
 
public static function moduleFactory($modulefile, $class_suffix = null, $params = '', $class_ns = 'owa_') {  
 
list($module, $file) = explode(".", $modulefile);  
$class = $class_ns.$file.$class_suffix;  
//print $class;  
// Require class file if class does not already exist  
if(!class_exists($class)):  
owa_coreAPI::moduleRequireOnce($module, '', $file);  
endif;  
 
$obj = owa_lib::factory(OWA_BASE_DIR.'/modules/'.$module, '', $class, $params);  
 
//if (isset($obj->module)):  
$obj->module = $module;  
//endif;  
 
return $obj;  
}  
 
public static function moduleGenericFactory($module, $sub_directory, $file, $class_suffix = null, $params = '', $class_ns = 'owa_') {  
 
$class = $class_ns.$file.$class_suffix;  
 
// Require class file if class does not already exist  
if(!class_exists($class)):  
owa_coreAPI::moduleRequireOnce($module, $sub_directory, $file);  
endif;  
 
$obj = owa_lib::factory(OWA_DIR.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.$sub_directory, '', $class, $params);  
 
return $obj;  
}  
 
/**  
* Produces Module Classes (module.php)  
*  
* @return Object module class object  
*/  
public static function moduleClassFactory($module) {  
 
if (!class_exists('owa_module')):  
require_once(OWA_BASE_CLASSES_DIR.'owa_module.php');  
endif;  
 
require_once(OWA_BASE_DIR.'/modules/'.$module.'/module.php');  
 
return owa_lib::factory(OWA_BASE_CLASSES_DIR.$module, 'owa_', $module.'Module');  
 
}  
 
 
public static function updateFactory($module, $filename, $class_ns = 'owa_') {  
 
require_once(OWA_BASE_CLASS_DIR.'update.php');  
 
//$obj = owa_coreAPI::moduleGenericFactory($module, 'updates', $filename, '_update');  
$class = $class_ns.$module.'_'.$filename.'_update';  
 
// Require class file if class does not already exist  
if(!class_exists($class)):  
owa_coreAPI::moduleRequireOnce($module, 'updates', $filename);  
endif;  
 
$obj = owa_lib::factory(OWA_DIR.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'updates', '', $class);  
 
$obj->module_name = $module;  
if (!$obj->schema_version) {  
$obj->schema_version = $filename;  
}  
return $obj;  
}  
 
public static function subViewFactory($subview, $params = array()) {  
 
list($module, $class) = explode(".", $subview);  
//print_r($module.' ' . $class);  
//owa_lib::moduleRequireOnce($module, $class);  
 
$subview = owa_lib::moduleFactory($subview, 'View', $params);  
$subview->is_subview = true;  
 
return $subview;  
}  
 
public static function &supportClassFactory($module, $class, $params = array(),$class_ns = 'owa_') {  
 
$obj = &owa_lib::factory(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR, $class_ns, $class, $params);  
$obj->module = $module;  
 
return $obj;  
 
 
}  
 
/**  
* Convienence method for generating entities  
*  
* @param unknown_type $entity_name  
* @return unknown  
*/  
public static function entityFactory($entity_name) {  
 
/* SETUP STORAGE ENGINE */  
 
// Must be called before any entities are created  
 
if (!defined('OWA_DTD_INT')) {  
if (defined('OWA_DB_TYPE')) {  
owa_coreAPI::setupStorageEngine(OWA_DB_TYPE);  
} else {  
owa_coreAPI::setupStorageEngine('mysql');  
}  
 
}  
 
 
 
if (!class_exists('owa_entity')):  
require_once(OWA_BASE_CLASSES_DIR.'owa_entity.php');  
endif;  
 
$entity = owa_coreAPI::moduleSpecificFactory($entity_name, 'entities', '', '', false);  
$entity->name = $entity_name;  
return $entity;  
//return owa_coreAPI::supportClassFactory('base', 'entityManager', $entity_name);  
 
}  
 
/**  
* Convienence method for generating entities  
*  
* @param unknown_type $entity_name  
* @return unknown  
* @depricated  
* @todo REMOVE  
*/  
public static function rawEntityFactory($entity_name) {  
 
return owa_coreAPI::entityFactory($entity_name);  
 
}  
 
/**  
* Factory for generating module specific classes  
*  
* @param string $modulefile  
* @param string $class_dir  
* @param string $class_suffix  
* @param array $params  
* @return unknown  
*/  
public static function moduleSpecificFactory($modulefile, $class_dir, $class_suffix = null, $params = '', $add_module_name = true, $class_ns = 'owa_') {  
 
list($module, $file) = explode(".", $modulefile);  
$class = $class_ns.$file.$class_suffix;  
 
// Require class file if class does not already exist  
if(!class_exists($class)):  
owa_coreAPI::moduleRequireOnce($module, $class_dir, $file);  
endif;  
 
$obj = owa_lib::factory(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$class_dir.DIRECTORY_SEPARATOR.$module, '', $class, $params);  
 
if ($add_module_name == true):  
$obj->module = $module;  
endif;  
 
return $obj;  
 
 
}  
 
public static function executeApiCommand($map) {  
 
if (!array_key_exists('do', $map)) {  
echo ("API Command missing from request.");  
owa_coreAPI::debug('API Command missing from request. Aborting.');  
exit;  
} else {  
// load service  
$s = owa_coreAPI::serviceSingleton();  
// lookup method class  
$do = $s->getApiMethodClass($map['do']);  
 
}  
 
// if exists, pass to OWA as a request  
if ($do) {  
 
if (array_key_exists('args', $do)) {  
 
$passed_args = array();  
 
foreach ($do['args'] as $arg) {  
 
if (isset($map[$arg])) {  
$passed_args[] = $map[$arg];  
} else {  
$passed_args[] = '';  
}  
}  
 
if (!empty($do['file'])) {  
 
if (!class_exists($do['callback'][0])) {  
require_once($file);  
}  
}  
 
$something = call_user_func_array($do['callback'], $passed_args);  
}  
 
return $something;  
} else {  
echo "No API Method Found.";  
}  
 
}  
 
/**  
* Convienence method for generating metrics  
*  
* @param unknown_type $entity_name  
* @return unknown  
*/  
public static function metricFactory($metric_name, $params = array()) {  
 
if (!strpos($metric_name, '.')) {  
$s = owa_coreAPI::serviceSingleton();  
$metric_name = $s->getMetricClasses($metric_name);  
}  
 
if (!class_exists('owa_metric')) {  
require_once(OWA_BASE_CLASSES_DIR.'owa_metric.php');  
}  
 
return owa_coreAPI::moduleSpecificFactory($metric_name, 'metrics', '', $params, false);  
}  
 
/**  
* Returns a consolidated list of admin/options panels from all active modules  
*  
* @return array  
*/  
public static function getAdminPanels() {  
 
$panels = array();  
 
$service = owa_coreAPI::serviceSingleton();  
 
foreach ($service->modules as $k => $v) {  
$v->registerAdminPanels();  
$module_panels = $v->getAdminPanels();  
if ($module_panels) {  
foreach ($module_panels as $key => $value) {  
 
$panels[$value['group']][] = $value;  
}  
}  
}  
 
return $panels;  
}  
 
/**  
* Returns a consolidated list of nav links from all active modules for a particular view  
* and named navigation element.  
*  
* @param string nav_name the name of the navigation element that you want links for  
* @param string sortby the array value to sort the navigation array by  
* @return array  
*/  
public static function getNavigation($view, $nav_name, $sortby ='order') {  
 
$links = array();  
 
$service = owa_coreAPI::serviceSingleton();  
 
foreach ($service->modules as $k => $v) {  
 
// If the module does not have nav links, register them. needed in case this function is called twice on  
// same view.  
if (empty($v->nav_links)):  
$v->registerNavigation();  
endif;  
 
$module_nav = $v->getNavigationLinks();  
 
 
if (!empty($module_nav)) {  
// assemble the navigation for a specific view's named navigation element'  
foreach ($module_nav as $key => $value) {  
 
$links[$value['view']][$value['nav_name']][] = $value;  
}  
}  
 
}  
 
//print_r($links[$view][$nav_name]);  
if (!empty($links[$view][$nav_name])):  
// anonymous sorting function, takes sort by variable.  
$code = "return strnatcmp(\$a['$sortby'], \$b['$sortby']);";  
 
// sort the array  
$ret = usort($links[$view][$nav_name], create_function('$a,$b', $code));  
 
return $links[$view][$nav_name];  
else:  
return false;  
endif;  
 
}  
 
public static function getGroupNavigation($group, $sortby ='order') {  
 
$links = array();  
 
$service = owa_coreAPI::serviceSingleton();  
 
foreach ($service->modules as $k => $v) {  
 
// If the module does not have nav links, register them. needed in case this function is called twice on  
// same view.  
if (empty($v->nav_links)):  
$v->registerNavigation();  
endif;  
 
$module_nav = $v->getNavigationLinks();  
 
if (!empty($module_nav)):  
//loop through returned nav array  
foreach ($module_nav as $group => $nav_links) {  
 
foreach ($nav_links as $link) {  
 
if (array_key_exists($group, $links)):  
 
// check to see if link is already present in the main array  
if (array_key_exists($link['anchortext'], $links[$group])):  
// merge various elements?? not now.  
//check to see if there is an existing subgroup  
 
if (array_key_exists('subgroup', $links[$group][$link['anchortext']])):  
// if so, merge the subgroups  
$links[$group][$link['anchortext']]['subgroup'] = array_merge($links[$group][$link['anchortext']]['subgroup'], $link['subgroup']);  
endif;  
else:  
// else populate the link  
$links[$group][$link['anchortext']] = $link;  
endif;  
 
else:  
$links[$group][$link['anchortext']] = $link;  
endif;  
}  
 
}  
endif;  
 
}  
 
return $links[$group];  
}  
 
/**  
* @Todo REMOVE  
*/  
public static function getNavSort($a, $b) {  
 
return strnatcmp($a['order'], $b['order']);  
}  
 
 
public static function getActiveModules() {  
 
$c = owa_coreAPI::configSingleton();  
$config = $c->config->get('settings');  
 
//print_r($config);  
$active_modules = array();  
 
foreach ($config as $k => $module) {  
 
if ($module['is_active'] == true):  
$active_modules[] = $k;  
endif;  
}  
 
return $active_modules;  
 
}  
 
public static function getModulesNeedingUpdates() {  
 
$service = owa_coreAPI::serviceSingleton();  
 
return $service->getModulesNeedingUpdates();  
}  
 
/**  
* Invokes controller to perform controller  
*  
* @param $action string  
*  
*/  
public static function performAction($action, $params = array()) {  
 
// Load  
$controller = owa_coreAPI::moduleFactory($action, 'Controller', $params);  
 
if (!$controller || !method_exists($controller, 'doAction')) {  
owa_coreAPI::debug("No controller is associated with $action.");  
return;  
}  
 
$data = $controller->doAction();  
 
// Display view if controller calls for one.  
if (!empty($data['view']) || !empty($data['action'])):  
 
//  
if ($data['view_method'] == 'delegate'):  
return owa_coreAPI::displayView($data);  
 
// Redirect to a view  
elseif ($data['view_method'] == 'redirect'):  
owa_lib::redirectToView($data);  
return;  
 
// return an image . Will output headers and binary data.  
elseif ($data['view_method'] == 'image'):  
return owa_coreAPI::displayImage($data);  
 
else:  
return owa_coreAPI::displayView($data);  
 
endif;  
 
elseif(!empty($data['do'])):  
//print_r($data);  
owa_lib::redirectToView($data);  
return;  
 
endif;  
}  
 
/**  
* Logs an event to the event queue  
*  
* take an owa_event object as a message.  
*  
* @param string $event_type  
* @param object $message  
* @return boolean  
*/  
public static function logEvent($event_type, $message = '') {  
 
// debug  
owa_coreAPI::debug("logging event $event_type");  
 
if (owa_coreAPI::getSetting('base', 'error_log_level') > 9) {  
owa_coreAPI::debug("PHP Server Global: ".print_r($_SERVER, true));  
}  
 
// Check to see if named users should be logged  
if (owa_coreAPI::getSetting('base', 'log_named_users') != true) {  
$cu = owa_coreAPI::getCurrentUser();  
$cu_user_id = $cu->getUserData('user_id');  
 
if(!empty($cu_user_id)) {  
return false;  
}  
}  
 
// do not log if the request is robotic  
$service = &owa_coreAPI::serviceSingleton();  
$bcap = $service->getBrowscap();  
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);  
if (!owa_coreAPI::getSetting('base', 'log_robots')) {  
 
if ($bcap->robotCheck()) {  
owa_coreAPI::debug("ABORTING: request appears to be from a robot");  
owa_coreAPI::setRequestParam('is_robot', true);  
return;  
}  
owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__);  
}  
 
$service->setBrowscap($bcap);  
 
// form event if one was not passed  
$class= 'owa_event';  
if (!($message instanceof $class)) {  
$event = owa_coreAPI::supportClassFactory('base', 'event');  
$event->setProperties($message);  
$event->setEventType($event_type);  
} else {  
$event = $message;  
}  
 
// Filter XSS exploits from event properties  
$event->cleanProperties();  
 
// do not log if the do not log property is set on the event.  
if ($event->get('do_not_log')) {  
return false;  
}  
 
// lookup which event processor to use to process this event type  
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());  
 
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);  
}  
 
 
public static function displayImage($data) {  
 
header('Content-type: image/gif');  
header('P3P: CP="'.owa_coreAPI::getSetting('base', 'p3p_policy').'"');  
header('Expires: Sat, 22 Apr 1978 02:19:00 GMT');  
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');  
header('Cache-Control: no-store, no-cache, must-revalidate');  
header('Cache-Control: post-check=0, pre-check=0', false);  
header('Pragma: no-cache');  
 
echo owa_coreAPI::displayView($data);  
}  
 
 
/**  
* Displays a View without user authentication. Takes array of data as input  
*  
* @param array $data  
* @param string $viewfile a specific view file to use  
* @return string  
*  
*/  
public static function displayView($data, $viewfile = '') {  
 
if (empty($viewfile)):  
$viewfile = $data['view'];  
endif;  
 
$view = owa_coreAPI::moduleFactory($viewfile, 'View');  
$view->setData($data);  
return $view->assembleView($data);  
 
}  
 
public static function displaySubView($data, $viewfile = '') {  
 
if (empty($viewfile)):  
$viewfile = $data['view'];  
endif;  
 
$view = owa_coreAPI::subViewFactory($viewfile);  
 
return $view->assembleView($data);  
 
}  
 
/**  
* Strip a URL of certain GET params  
* @depricated  
* @return string  
* @todo REMOVE  
*/  
function stripDocumentUrl($url) {  
 
if (owa_coreAPI::getSetting('base', 'clean_query_string')):  
 
if (owa_coreAPI::getSetting('base', 'query_string_filters')):  
$filters = str_replace(' ', '', owa_coreAPI::getSetting('base', 'query_string_filters'));  
$filters = explode(',', $filters);  
else:  
$filters = array();  
endif;  
 
// OWA specific params to filter  
array_push($filters, owa_coreAPI::getSetting('base', 'source_param'));  
array_push($filters, owa_coreAPI::getSetting('base', 'ns').owa_coreAPI::getSetting('base', 'feed_subscription_param'));  
 
//print_r($filters);  
 
foreach ($filters as $filter => $value) {  
 
$url = preg_replace(  
'#\?' .  
$value .  
'=.*$|&' .  
$value .  
'=.*$|' .  
$value .  
'=.*&#msiU',  
'',  
$url  
);  
 
}  
 
endif;  
//print $url;  
 
return $url;  
 
}  
 
public static function getRequestParam($name) {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->request->getParam($name);  
 
}  
 
public static function getRequest() {  
$service = &owa_coreAPI::serviceSingleton();  
return $service->request;  
}  
 
public static function setRequestParam($name, $value) {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->request->setParam($name, $value);  
 
}  
 
public static function makeTimePeriod($time_period, $params = array()) {  
 
$period = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
$map = array();  
 
if (array_key_exists('startDate', $params)) {  
$map['startDate'] = $params['startDate'];  
}  
 
if (array_key_exists('endDate', $params)) {  
$map['endDate'] = $params['endDate'];  
}  
 
if (array_key_exists('startTime', $params)) {  
$map['startTime'] = $params['startTime'];  
}  
 
if (array_key_exists('endTime', $params)) {  
$map['endTime'] = $params['endTime'];  
}  
 
$period->set($time_period, $map);  
 
return $period;  
}  
 
/**  
* Factory method for producing validation objects  
*  
* @return Object  
*/  
public static function validationFactory($class_file) {  
 
if (!class_exists('owa_validation')):  
require_once(OWA_BASE_CLASS_DIR.'validation.php');  
endif;  
 
return owa_lib::factory(OWA_PLUGINS_DIR.'/validations', 'owa_', $class_file, array(), 'Validation');  
 
}  
 
public static function debug($msg) {  
 
$e = owa_coreAPI::errorSingleton();  
$e->debug($msg);  
return;  
}  
 
public static function error($msg) {  
 
$e = owa_coreAPI::errorSingleton();  
$e->err($msg);  
return;  
}  
 
public static function notice($msg) {  
 
$e = owa_coreAPI::errorSingleton();  
$e->notice($msg);  
return;  
}  
 
public static function createCookie($cookie_name, $cookie_value, $expires = 0, $path = '/', $domain = '') {  
 
if ( $domain ) {  
// sanitizes the domain  
$domain = owa_lib::sanitizeCookieDomain( $domain );  
} else {  
$domain = owa_coreAPI::getSetting('base', 'cookie_domain');  
}  
if (is_array($cookie_value)) {  
 
$cookie_value = owa_lib::implode_assoc('=>', '|||', $cookie_value);  
}  
 
// add namespace  
$cookie_name = sprintf('%s%s', owa_coreAPI::getSetting('base', 'ns'), $cookie_name);  
 
// debug  
owa_coreAPI::debug(sprintf('Setting cookie %s with values: %s under domain: %s', $cookie_name, $cookie_value, $domain));  
 
// set compact privacy header  
header(sprintf('P3P: CP="%s"', owa_coreAPI::getSetting('base', 'p3p_policy')));  
//owa_coreAPI::debug('time: '.$expires);  
setcookie($cookie_name, $cookie_value, $expires, $path, $domain);  
return;  
}  
 
public static function deleteCookie($cookie_name, $path = '/', $domain = '') {  
 
return owa_coreAPI::createCookie($cookie_name, false, time()-3600*25, $path, $domain);  
}  
 
public static function setState($store, $name = '', $value, $store_type = '', $is_perminent = '') {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->request->state->set($store, $name, $value, $store_type, $is_perminent);  
}  
 
public static function getStateParam($store, $name = '') {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->request->state->get($store, $name);  
}  
 
public static function getServerParam($name = '') {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->request->getServerParam($name);  
}  
 
public static function clearState($store) {  
 
$service = &owa_coreAPI::serviceSingleton();  
$service->request->state->clear($store);  
 
}  
 
public static function getEventProcessor($event_type) {  
 
$service = &owa_coreAPI::serviceSingleton();  
$processor = $service->getMapValue('event_processors', $event_type);  
 
if (empty($processor)) {  
 
$processor = 'base.processEvent';  
}  
 
return $processor;  
}  
 
/**  
* Handles OWA internal page/action requests  
*  
* @return unknown  
*/  
public static function handleRequest($caller_params = null, $action = '') {  
 
static $init;  
 
$service = &owa_coreAPI::serviceSingleton();  
// Override request parsms with those passed by caller  
if (!empty($caller_params)) {  
$service->request->mergeParams($caller_params);  
};  
 
$params = $service->request->getAllOwaParams();  
 
if ($init != true) {  
owa_coreAPI::debug('Handling request with params: '. print_r($params, true));  
}  
 
// backwards compatability with old style view/controler scheme  
// still needed??  
if (array_key_exists('view', $params)) {  
// its a view request so the only data is in whats in the params  
$init = true;  
return owa_coreAPI::displayView($params);  
}  
 
if (empty($action)) {  
$action = owa_coreAPI::getRequestParam('action');  
if (empty($action)) {  
$action = owa_coreAPI::getRequestParam('do');  
 
if (empty($action)) {  
$action = owa_coreAPI::getSetting('base', 'start_page');  
}  
}  
}  
 
$init = true;  
owa_coreAPI::debug('About to perform action: '.$action);  
return owa_coreAPI::performAction($action, $params);  
 
}  
 
public static function isUpdateRequired() {  
 
$service = &owa_coreAPI::serviceSingleton();  
return $service->isUpdateRequired();  
}  
 
public static function getSitesList() {  
 
//$s = owa_coreAPI::entityFactory('base.site');  
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom('owa_site');  
$db->selectColumn('*');  
return $db->getAllRows();  
 
}  
 
public static function profile($that = '', $function = '', $line = '', $msg = '') {  
 
if (defined('OWA_PROFILER')) {  
if (OWA_PROFILER === true) {  
 
static $profiler;  
 
if (!class_exists('PhpQuickProfiler')) {  
require_once(OWA_INCLUDE_DIR.'pqp/classes/PhpQuickProfiler.php');  
}  
 
if (empty($profiler)) {  
$profiler = new PhpQuickProfiler(PhpQuickProfiler::getMicroTime(), OWA_INCLUDE_DIR.'pqp/');  
}  
 
$class = get_class($that);  
Console::logSpeed($class."::$function - Line: $line - Msg: $msg");  
Console::logMemory($that, $class. "::$function - Line: $line");  
 
return $profiler;  
}  
}  
}  
 
public static function profileDisplay() {  
$p = owa_coreAPI::profile();  
if ($p) {  
$p->display();  
}  
 
}  
 
public static function getEventDispatch() {  
 
if (!class_exists('eventQueue')) {  
require_once(OWA_DIR.'/eventQueue.php');  
}  
 
$eq = &eventQueue::get_instance();  
return $eq;  
}  
 
public static function getCliCommandClass($command) {  
 
$s = owa_coreAPI::serviceSingleton();  
return $s->getCliCommandClass($command);  
}  
 
public static function getGeolocationFromIpAddress($ip_address) {  
 
$s = &owa_coreAPI::serviceSingleton();  
$s->geolocation->getGeolocationFromIp($ip_address);  
return $s->geolocation;  
}  
 
public static function getNonceTimeInterval() {  
 
return ceil( time() / owa_coreAPI::getSetting( 'base', 'nonce_expiration_period') );  
}  
 
public static function createNonce($action) {  
 
$time = owa_coreAPI::getNonceTimeInterval();  
$cu = owa_coreAPI::getCurrentUser();  
$user_id = $cu->getUserData( 'user_id' );  
$full_nonce = $time . $action . $user_id . 'owa_nonce';  
$nonce = substr(md5($full_nonce), -12, 10);  
 
return $nonce;  
}  
 
public static function summarize($map) {  
 
$entity = owa_coreAPI::entityFactory($map['entity']);  
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom($entity->getTableName(), $entity->getTableAlias());  
 
foreach ($map['columns'] as $col => $action) {  
 
switch ($action) {  
 
case 'sum':  
$col_def = sprintf("SUM(%s)", $col);  
$name = $col.'_sum';  
break;  
case 'count':  
$col_def = sprintf("COUNT(%s)", $col);  
$name = $col.'_count';  
break;  
case 'count_distinct':  
$col_def = sprintf("COUNT(distinct %s)", $col);  
$name = $col.'_dcount';  
break;  
}  
 
$db->selectColumn($col_def, $name);  
}  
 
foreach ($map['constraints'] as $con_col => $con_value) {  
 
if ( is_array( $con_value ) ) {  
$db->where($con_col, $con_value['value'], $con_value['operator']);  
} else {  
$db->where($con_col, $con_value);  
}  
}  
 
$ret = $db->getOneRow();  
return $ret;  
}  
 
public static function getJsTrackerTag( $site_id, $options = array() ) {  
 
if ( ! class_exists( 'owa_template' ) ) {  
require_once(OWA_BASE_CLASSES_DIR.'owa_template.php');  
}  
 
$t = new owa_template();  
 
// check to see if first hit tag is needed  
if (owa_coreAPI::getSetting('base', 'delay_first_hit')) {  
 
$service = &owa_coreAPI::serviceSingleton();  
//check for persistant cookie  
$v = $service->request->getOwaCookie('v');  
 
if (empty($v)) {  
 
$options['first_hit_tag'] = true;  
}  
}  
 
//check to see if we shuld log clicks.  
if ( ! owa_coreAPI::getSetting( 'base', 'log_dom_clicks' ) ) {  
$options['do_not_log_clicks'] = true;  
}  
 
if ( ! owa_coreAPI::getSetting( 'base', 'log_dom_streams' ) ) {  
$options['do_not_log_domstream'] = true;  
}  
 
if (owa_coreAPI::getSetting('base', 'is_embedded')) {  
 
// needed to override the endpoint used by the js tracker  
$options['apiEndpoint'] = owa_coreAPI::getSetting('base', 'api_url');  
}  
 
$t->set( 'site_id', $site_id );  
$t->set( 'options', $options);  
 
$t->set_template('js_helper_tags.tpl');  
return $t->fetch();  
}  
 
public static function activateModule( $module_name ) {  
 
if ( $module_name ) {  
 
$m = owa_coreAPI::moduleClassFactory($module_name);  
return $m->activate();  
}  
}  
 
public static function deactivateModule( $module_name ) {  
 
if ( $module_name ) {  
 
$s = owa_coreAPI::serviceSingleton();  
$m = $s->getModule($module_name);  
return $m->deactivate();  
}  
}  
 
public static function installModule( $module_name ) {  
 
if ($module_name) {  
 
$m = owa_coreAPI::moduleClassFactory($module_name);  
$status = $m->install();  
return $status;  
}  
}  
 
public static function generateInstanceSpecificHash() {  
 
if ( defined( 'OWA_SECRET' ) ) {  
$salt = OWA_SECRET;  
} else {  
$salt = '';  
}  
 
if ( defined( 'OWA_DB_USER' ) ) {  
$salt .= OWA_DB_USER;  
}  
 
if ( defined( 'OWA_DB_PASSWORD' ) ) {  
$salt .= OWA_DB_PASSWORD;  
}  
 
return md5( $salt );  
}  
}  
 
?>  
file:a/busui/owa/owa_db.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'owa_base.php');  
 
/**  
* Database Connection Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_db extends owa_base {  
 
/**  
* Database Connection  
*  
* @var object  
*/  
var $connection;  
 
var $connectionParams;  
 
/**  
* Number of queries  
*  
* @var integer  
*/  
var $num_queries;  
 
/**  
* Raw result object  
*  
* @var object  
*/  
var $new_result;  
 
/**  
* Rows  
*  
* @var array  
*/  
var $result;  
 
/**  
* Caller Params  
*  
* @var array  
*/  
var $params = array();  
 
/**  
* Status of selecting a databse  
*  
* @var boolean  
*/  
var $database_selection;  
 
/**  
* Status of connection  
*  
* @var boolean  
*/  
var $connection_status;  
 
/**  
* Number of rows in result set  
*  
* @var integer  
*/  
var $num_rows;  
 
/**  
* Number of rows affected by insert/update/delete statements  
*  
* @var integer  
*/  
var $rows_affected;  
 
/**  
* Microtime Start of Query  
*  
* @var unknown_type  
*/  
var $_start_time;  
 
/**  
* Total Elapsed time of query  
*  
* @var unknown_type  
*/  
var $_total_time;  
 
/**  
* Storage Array for components of sql queries  
*  
* @var array  
*/  
var $_sqlParams = array();  
 
/**  
* Sql Statement  
*  
* @var string  
*/  
var $_sql_statement;  
 
/**  
* Last Sql Statement  
*  
* @var string  
*/  
var $_last_sql_statement;  
 
function __construct($db_host, $db_name, $db_user, $db_password, $open_new_connection = true, $persistant = false) {  
 
$this->connectionParams = array('host' => $db_host,  
'user' => $db_user,  
'password' => $db_password,  
'name' => $db_name,  
'open_new_connection' => $open_new_connection,  
'persistant' => $persistant);  
 
return parent::__construct();  
}  
 
function __destruct() {  
 
$this->close();  
}  
 
function connect() {  
 
 
return false;  
}  
 
function pconnect() {  
 
return false;  
}  
 
function close() {  
 
return false;  
}  
 
function getConnectionParam($name) {  
 
if (array_key_exists($name, $this->connectionParams)) {  
return $this->connectionParams[$name];  
}  
}  
 
/**  
* Prepare string  
*  
* @param string $string  
* @return string  
*/  
function prepare_string($string) {  
 
$chars = array("\t", "\n");  
return str_replace($chars, " ", $string);  
}  
 
/**  
* Starts the query microtimer  
*  
*/  
function _timerStart() {  
 
$mtime = microtime();  
//$mtime = explode(' ', $mtime);  
//$this->_start_time = $mtime[1].substr(round($mtime[0], 4), 1);  
$this->_start_time = microtime();  
return;  
}  
 
/**  
* Ends the query microtimer and populates $this->_total_time  
*  
*/  
function _timerEnd() {  
 
$mtime = microtime();  
//$mtime = explode(" ", $mtime);  
//$endtime = $mtime[1].substr(round($mtime[0], 4), 1);  
$endtime = microtime();  
//$this->_total_time = bcsub($endtime, $this->_start_time, 4);  
$this->_total_time = number_format(((substr($endtime,0,9)) + (substr($endtime,-10)) - (substr($this->_start_time,0,9)) - (substr($this->_start_time,-10))),6);  
 
return;  
 
}  
 
function selectColumn($name, $as = '') {  
 
if (is_array($name)) {  
$as = $name[1];  
$name = $name[0];  
}  
 
$this->_sqlParams['select_values'][] = array('name' => $name, 'as' => $as);  
 
return;  
}  
 
function select($name, $as = '') {  
return $this->selectColumn($name, $as = '');  
}  
 
function where($name, $value, $operator = '') {  
 
if (empty($operator)):  
$operator = '=';  
endif;  
 
if (!empty($value)):  
 
// hack for intentional empty value  
if($value == ' '):  
$value = '';  
endif;  
 
$this->_sqlParams['where'][$name] = array('name' => $name, 'value' => $value, 'operator' => $operator);  
endif;  
 
return;  
}  
 
function multiWhere($where_array = array()) {  
 
if (!empty($where_array)):  
 
foreach ($where_array as $k => $v) {  
if (!empty($v)):  
 
if (empty($v['operator'])):  
$v['operator'] = '=';  
endif;  
 
$this->_sqlParams['where'][$k] = array('name' => $k, 'value' => $v['value'], 'operator' => $v['operator']);  
endif;  
}  
 
endif;  
}  
 
function groupBy($col) {  
 
$this->_sqlParams['groupby'][] = $col;  
return;  
}  
 
function orderBy($col, $flag = '') {  
 
$this->_sqlParams['orderby'][] = array($col, $flag);  
return;  
}  
 
function order($flag) {  
 
$this->_sqlParams['order'] = $flag;  
return;  
}  
 
function limit($value) {  
 
$this->_sqlParams['limit'] = $value;  
return;  
}  
 
function offset($value) {  
 
$this->_sqlParams['offset'] = $value;  
return;  
}  
 
function set($name, $value) {  
 
$this->_sqlParams['set_values'][] = array('name' => $name, 'value' => $value);  
return;  
}  
 
function executeQuery() {  
 
switch($this->_sqlParams['query_type']) {  
 
case 'insert':  
 
return $this->_insertQuery();  
 
case 'select':  
 
return $this->_selectQuery();  
 
case 'update':  
 
return $this->_updateQuery();  
 
case 'delete':  
 
return $this->_deleteQuery();  
 
default:  
 
return $this->_query();  
}  
}  
 
function getAllRows() {  
 
return $this->_selectQuery();  
}  
 
function getOneRow() {  
 
$ret = $this->_selectQuery();  
return $ret[0];  
}  
 
function _setSql($sql) {  
$this->_sql_statement = $sql;  
}  
 
function selectFrom($name, $as = '') {  
 
if (is_array($name)) {  
$as = $name[1];  
$name = $name[0];  
}  
 
$this->_sqlParams['query_type'] = 'select';  
$this->_sqlParams['from'][$name] = array('name' => $name, 'as' => $as);  
}  
 
function from($name, $as = '') {  
return $this->selectFrom($name, $as = '');  
}  
 
function insertInto($table) {  
 
$this->_sqlParams['query_type'] = 'insert';  
$this->_sqlParams['table'] = $table;  
}  
 
function deleteFrom($table) {  
 
$this->_sqlParams['query_type'] = 'delete';  
$this->_sqlParams['table'] = $table;  
}  
 
function updateTable($table) {  
 
$this->_sqlParams['query_type'] = 'update';  
$this->_sqlParams['table'] = $table;  
}  
 
function _insertQuery() {  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$params = $this->_fetchSqlParams('set_values');  
 
$count = count($params);  
 
$i = 0;  
 
$sql_cols = '';  
$sql_values = '';  
 
foreach ($params as $k => $v) {  
 
$sql_cols .= $v['name'];  
$sql_values .= "'".$this->prepare($v['value'])."'";  
 
$i++;  
 
// Add commas  
if ($i < $count):  
 
$sql_cols .= ", ";  
$sql_values .= ", ";  
 
endif;  
}  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$this->_setSql(sprintf(OWA_SQL_INSERT_ROW, $this->_sqlParams['table'], $sql_cols, $sql_values));  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$ret = $this->_query();  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
return $ret;  
 
}  
 
function _selectQuery() {  
 
$cols = '';  
$i = 0;  
$params = $this->_fetchSqlParams('select_values');  
$count = count($params);  
 
foreach ($params as $k => $v) {  
 
$cols .= $v['name'];  
 
// Add as  
if (!empty($v['as'])):  
 
$cols .= ' as '.$v['as'];  
 
endif;  
 
// Add commas  
if ($i < $count - 1):  
 
$cols .= ', ';  
 
endif;  
 
$i++;  
 
}  
 
$this->_setSql(sprintf("SELECT %s FROM %s %s %s %s %s",  
$cols,  
$this->_makeFromClause(),  
$this->_makeWhereClause(),  
$this->_makeGroupByClause(),  
$this->_makeOrderByClause(),  
$this->_makeLimitClause()  
));  
return $this->_query();  
 
}  
 
 
function _updateQuery() {  
 
$params = $this->_fetchSqlParams('set_values');  
 
$count = count($params);  
 
$i = 0;  
 
$sql_cols = '';  
$sql_values = '';  
$set = '';  
 
foreach ($params as $k => $v) {  
 
//$sql_cols = $sql_cols.$key;  
//$sql_values = $sql_values."'".$this->prepare($value)."'";  
 
// Add commas  
if ($i != 0):  
 
$set .= ', ';  
 
endif;  
 
$set .= $v['name'] .' = \'' . $this->prepare($v['value']) . '\'';  
 
$i++;  
}  
 
$this->_setSql(sprintf(OWA_SQL_UPDATE_ROW, $this->_sqlParams['table'], $set, $this->_makeWhereClause()));  
 
return $this->_query();  
 
 
 
}  
 
function _deleteQuery() {  
 
$this->_setSql(sprintf(OWA_SQL_DELETE_ROW, $this->_sqlParams['table'], $this->_makeWhereClause()));  
 
return $this->_query();  
}  
 
function rawQuery($sql) {  
 
$this->_setSql($sql);  
 
return $this->_query();  
}  
 
function _fetchSqlParams($sql_params_name) {  
 
if (array_key_exists($sql_params_name, $this->_sqlParams)):  
if (!empty($this->_sqlParams[$sql_params_name])):  
return $this->_sqlParams[$sql_params_name];  
else:  
return false;  
endif;  
else:  
return false;  
endif;  
}  
 
function _makeWhereClause() {  
 
$params = $this->_fetchSqlParams('where');  
//print_r($params);  
if (!empty($params)):  
 
$count = count($params);  
 
$i = 0;  
 
$where = 'WHERE ';  
 
foreach ($params as $k => $v) {  
//print_r($v);  
switch (strtolower($v['operator'])) {  
 
case '==':  
$where .= sprintf("%s = '%s'",$v['name'], $v['value']);  
break;  
 
case 'between':  
 
$where .= sprintf("%s BETWEEN '%s' AND '%s'", $v['name'], $v['value']['start'], $v['value']['end']);  
break;  
 
case '=~':  
$where .= sprintf("%s %s '%s'",$v['name'], OWA_SQL_REGEXP, $v['value']);  
break;  
 
case '!~':  
$where .= sprintf("%s %s '%s'",$v['name'], OWA_SQL_NOTREGEXP, $v['value']);  
break;  
 
case '=@':  
$where .= sprintf("LOCATE('%s', %s) > 0",$v['value'], $v['name']);  
break;  
 
case '!@':  
$where .= sprintf("LOCATE('%s', %s) = 0",$v['value'], $v['name']);  
break;  
 
default:  
$where .= sprintf("%s %s '%s'",$v['name'], $v['operator'], $v['value']);  
break;  
}  
 
 
 
if ($i < $count - 1):  
 
$where .= " AND ";  
 
endif;  
 
$i++;  
 
 
}  
 
return $where;  
 
else:  
 
return;  
 
endif;  
 
}  
 
function join($type, $table, $as, $foreign_key, $primary_key = '') {  
 
if (!$primary_key) {  
 
if (!$as) {  
$as = $table;  
}  
 
$primary_key = $as.'.id';  
}  
 
 
 
$this->_sqlParams['joins'][$as] = array('type' => $type,  
'table' => $table,  
'as' => $as,  
'foreign_key' => $foreign_key,  
'primary_key' => $primary_key);  
 
}  
 
function _makeJoinClause() {  
 
$params = $this->_fetchSqlParams('joins');  
 
if (!empty($params)):  
 
$join_clause = '';  
 
foreach ($params as $k => $v) {  
 
if (!empty($v['as'])):  
$join_clause .= sprintf(" %s %s AS %s ON %s = %s", $v['type'],  
$v['table'],  
$v['as'],  
$v['foreign_key'],  
$v['primary_key']);  
else:  
$join_clause .= sprintf(" %s %s ON %s = %s", $v['type'],  
$v['table'], $v['foreign_key'],  
$v['primary_key']);  
endif;  
 
 
 
}  
 
return $join_clause;  
 
else:  
return;  
endif;  
 
}  
 
function _makeFromClause() {  
 
$from = '';  
$i = 0;  
$params = $this->_fetchSqlParams('from');  
 
if(!empty($params)):  
 
$count = count($params);  
 
foreach ($params as $k => $v) {  
 
$from .= $v['name'];  
 
// Add as  
if (!empty($v['as'])):  
 
$from .= ' as '.$v['as'];  
 
endif;  
 
// Add commas  
if ($i < $count - 1):  
 
$from .= ', ';  
 
endif;  
 
$i++;  
 
}  
 
$from .= $this->_makeJoinClause();  
 
return $from;  
else:  
$this->e->debug("No SQL FROM params set.");  
return false;  
endif;  
 
}  
 
function _makeGroupByClause() {  
 
$params = $this->_fetchSqlParams('groupby');  
 
if (!empty($params)):  
 
return sprintf("GROUP BY %s", $this->_makeDelimitedValueList($params));  
 
else:  
return;  
endif;  
 
 
}  
 
function _makeOrderByClause() {  
 
$sorts = $this->_fetchSqlParams('orderby');  
//print_r($sorts);  
if (!empty($sorts)):  
 
$order = $this->_fetchSqlParams('order');  
 
$i = 1;  
$sort_string = '';  
$count = count($sorts);  
foreach ($sorts as $sort) {  
 
// needed for backwards compatability.  
if (!isset($sort[1])) {  
$sort[1] = $order;  
}  
 
$sort_string .= sprintf("%s %s",$sort[0], $sort[1]);  
if ($i < $count) {  
$sort_string .= ', ';  
}  
 
$i++;  
}  
 
return sprintf("ORDER BY %s", $sort_string);  
 
else:  
return;  
endif;  
 
 
}  
 
function _makeLimitClause() {  
 
$param = $this->_fetchSqlParams('limit');  
 
if(!empty($param)):  
$limit = sprintf("LIMIT %d", $param);  
 
$offset = $this->_makeOffsetClause();  
 
$ret = $limit . ' ' . $offset;  
 
return $ret;  
else:  
return;  
endif;  
 
}  
 
function _makeOffsetClause() {  
 
$param = $this->_fetchSqlParams('offset');  
 
if(!empty($param)):  
return sprintf("OFFSET %d", $param);  
else:  
return;  
endif;  
 
}  
 
 
/**  
* Creates a delimited value list from an array or arrays.  
*  
*/  
function _makeDelimitedValueListArray($values, $delimiter = ', ', $inner_delimiter = ' ') {  
 
$items = '';  
$i = 0;  
$count = count($values);  
 
//print_r($values);  
 
foreach ($values as $k) {  
 
$items .= implode($inner_delimiter, $k);  
 
// Add commas  
if ($i < $count - 1):  
 
$items .= $delimiter;  
 
endif;  
 
$i++;  
 
}  
 
return $items;  
 
}  
 
function _makeDelimitedValueList($values, $delimiter = ', ') {  
 
$items = '';  
$i = 0;  
$count = count($values);  
 
if (is_array($values)):  
 
foreach ($values as $k) {  
 
$items .= $k;  
 
// Add commas  
if ($i < $count - 1):  
 
$items .= $delimiter;  
 
endif;  
 
$i++;  
 
}  
 
else:  
 
$items = $values;  
 
endif;  
 
return $items;  
 
}  
 
function _query() {  
 
switch($this->_sqlParams['query_type']) {  
 
case 'insert':  
 
$ret = $this->query($this->_sql_statement);  
break;  
case 'select':  
 
$ret = $this->get_results($this->_sql_statement);  
 
if (array_key_exists('result_format', $this->_sqlParams)):  
$ret = $this->_formatResults($ret);  
endif;  
 
break;  
 
case 'update':  
 
$ret = $this->query($this->_sql_statement);  
break;  
case 'delete':  
 
$ret = $this->query($this->_sql_statement);  
break;  
}  
 
$this->_last_sql_statement = $this->_sql_statement;  
$this->_sql_statement = '';  
$this->_sqlParams = array();  
return $ret;  
 
}  
 
function removeNs($string, $ns = '') {  
 
if (empty($ns)):  
$ns = $this->config['ns'];  
endif;  
 
$ns_len = strlen($ns);  
return substr($string, $ns_len);  
 
}  
 
function setFormat($value) {  
 
$this->_sqlParams['result_format'] = $value;  
return;  
}  
 
function _formatResults($results) {  
 
switch ($this->_sqlParams['result_format']) {  
 
case "single_array":  
return $results[0];  
break;  
case "single_row":  
return $results[0];  
break;  
case "inverted_array":  
return owa_lib::deconstruct_assoc($results);  
break;  
default:  
return $results;  
break;  
}  
 
}  
 
/**  
* Drops a table  
*  
*/  
function dropTable($table_name) {  
 
return $this->query(sprintf(OWA_SQL_DROP_TABLE, $table_name));  
 
}  
 
/**  
* Change table type  
*  
*/  
function alterTableType($table_name, $engine) {  
 
return $this->query(sprintf(OWA_SQL_ALTER_TABLE_TYPE, $table_name, $engine));  
 
}  
 
 
/**  
* Rename a table  
*  
*/  
function renameTable($table_name, $new_table_name) {  
 
return $this->query(sprintf(OWA_SQL_RENAME_TABLE, $table_name, $new_table_name));  
}  
 
/**  
* Renames column  
* idempotent  
*/  
function renameColumn($table_name, $old, $new, $defs) {  
 
return $this->query(sprintf(OWA_SQL_RENAME_COLUMN, $table_name, $old, $new, $defs));  
}  
 
 
/**  
* Adds new column to table  
* idempotent  
*/  
function addColumn($table_name, $column_name, $column_definition) {  
 
return $this->query(sprintf(OWA_SQL_ADD_COLUMN, $table_name, $column_name, $column_definition));  
}  
 
/**  
* Drops a column from a table  
*  
*/  
function dropColumn($table_name, $column_name) {  
 
return $this->query(sprintf(OWA_SQL_DROP_COLUMN, $table_name, $column_name));  
 
}  
 
/**  
* Changes the definition of a column  
*  
*/  
function modifyColumn($table_name, $column_name, $column_definition) {  
 
return $this->query(sprintf(OWA_SQL_MODIFY_COLUMN, $table_name, $column_name, $column_definition));  
}  
 
/**  
* Adds index to a column  
*  
*/  
function addIndex($table_name, $column_name, $index_definition = '') {  
 
return $this->query(sprintf(OWA_SQL_ADD_INDEX, $table_name, $column_name, $index_definition));  
}  
 
/**  
* Adds index to a column  
*  
*/  
function dropIndex($table_name, $column_name) {  
 
return $this->query(sprintf(OWA_SQL_DROP_INDEX, $column_name, $table_name));  
}  
 
/**  
* Creates a new table  
*  
*/  
function createTable($entity) {  
 
//create column defs  
 
$all_cols = $entity->getColumns();  
 
$columns = '';  
 
$table_defs = '';  
 
$i = 0;  
$count = count($all_cols);  
 
// Control loop  
 
foreach ($all_cols as $k => $v){  
 
// get column definition  
$columns .= $v.' '.$entity->getColumnDefinition($v);  
 
// Add commas to column statement  
if ($i < $count - 1):  
 
$columns .= ', ';  
 
endif;  
 
$i++;  
 
}  
 
// make table options  
$table_options = '';  
$options = $entity->getTableOptions();  
 
// table type  
switch ($options['table_type']) {  
 
case "disk":  
$table_type = OWA_DTD_TABLE_TYPE_DISK;  
break;  
case "memory":  
$table_type = OWA_DTD_TABLE_TYPE_MEMORY;  
break;  
default:  
$table_type = OWA_DTD_TABLE_TYPE_DEFAULT;  
 
}  
 
$table_options .= sprintf(OWA_DTD_TABLE_TYPE, $table_type);  
 
// character encoding type  
 
// just in case the propoerties is not i nthe array, add a default value.  
if (!array_key_exists('character_encoding', $options)) {  
 
$options['character_encoding'] = OWA_DTD_CHARACTER_ENCODING_UTF8;  
}  
 
$table_options .= sprintf(' ' . OWA_DTD_TABLE_CHARACTER_ENCODING, $options['character_encoding']);  
 
return $this->query(sprintf(OWA_SQL_CREATE_TABLE, $entity->getTableName(), $columns, $table_options));  
}  
 
 
 
/**  
* Begins a SQL transaction statement  
*  
*/  
function beginTransaction() {  
 
return $this->query(OWA_SQL_BEGIN_TRANSACTION);  
}  
 
/**  
* Ends a SQL transaction statement  
*  
*/  
function endTransaction() {  
 
return $this->query(OWA_SQL_END_TRANSACTION);  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists('owa_dbColumn')):  
require_once(OWA_BASE_CLASS_DIR.'column.php');  
endif;  
 
/**  
* Abstract Entity Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_entity {  
 
var $name;  
var $properties = array();  
var $_tableProperties = array();  
var $wasPersisted;  
var $cache;  
 
function __construct($cache = '', $db = '') {  
 
}  
 
 
function _getProperties() {  
 
$properties = array();  
 
if (!empty($this->properties)) {  
$vars = $this->properties;  
}  
 
foreach ($vars as $k => $v) {  
 
$properties[$k] = $v->getValue();  
 
}  
 
return $properties;  
}  
 
function getColumns($return_as_string = false, $as_namespace = '', $table_namespace = false) {  
 
if (!empty($this->properties)) {  
$all_cols = array_keys($this->properties);  
$all_cols = array_flip($all_cols);  
}  
 
//print_r($all_cols);  
 
$table = $this->getTableName();  
$new_cols = array();  
$ns = '';  
$as = '';  
 
if (!empty($table_namespace)):  
$ns = $table.'.';  
endif;  
 
foreach ($all_cols as $k => $v) {  
 
if (!empty($as_namespace)):  
$as = ' AS '.$as_namespace.$k;  
endif;  
 
$new_cols[] = $ns.$k.$as;  
}  
 
// add implode as string here  
 
if ($return_as_string == true):  
$new_cols = implode(', ', $new_cols);  
endif;  
 
//print_r($new_cols);  
return $new_cols;  
 
}  
 
function getColumnsSql($as_namespace = '', $table_namespace = true) {  
 
return $this->getColumns(true, $as_namespace, $table_namespace);  
}  
 
/**  
* Sets object attributes  
*  
* @param unknown_type $array  
*/  
function setProperties($array, $apply_filters = false) {  
 
$properties = $this->getColumns();  
 
foreach ($properties as $k => $v) {  
 
if ( ! empty( $array[$v] ) ) {  
if ( ! empty( $this->properties ) ) {  
$this->set($v, $array[$v], $apply_filters);  
}  
}  
}  
}  
 
function setGuid($string) {  
 
return owa_lib::setStringGuid($string);  
 
}  
 
function set($name, $value, $filter = true) {  
 
if ( array_key_exists( $name, $this->properties ) ) {  
$method = $name.'SetFilter';  
if ( $filter && method_exists( $this, $method ) ) {  
$this->properties[$name]->setValue( $this->$method( $value ) );  
} else {  
$this->properties[$name]->setValue( $value );  
}  
}  
}  
 
// depricated  
function setValues($values) {  
 
return $this->setProperties($values);  
}  
 
function get($name, $filter = true) {  
 
if (array_key_exists($name, $this->properties)) {  
$method = $name.'GetFilter';  
if ( $filter && method_exists($this, $method) ) {  
return $this->$method( $this->properties[$name]->getValue() );  
} else {  
return $this->properties[$name]->getValue();  
}  
}  
}  
 
function getTableOptions() {  
 
if ($this->_tableProperties) {  
if (array_key_exists('table_type', $this->_tableProperties)) {  
return $this->_tableProperties['table_type'];  
}  
}  
 
return array('table_type' => 'disk');  
 
}  
 
/**  
* Persist new object  
*  
*/  
function create() {  
 
$db = owa_coreAPI::dbSingleton();  
$all_cols = $this->getColumns();  
 
$db->insertInto($this->getTableName());  
 
// Control loop  
foreach ($all_cols as $k => $v){  
 
// drop column is it is marked as auto-incement as DB will take care of that.  
if ($this->properties[$v]->auto_increment === true):  
;  
else:  
$db->set($v, $this->get($v, false));  
endif;  
 
}  
 
// Persist object  
$status = $db->executeQuery();  
 
// Add to Cache  
if ($status == true) {  
$this->addToCache();  
}  
 
return $status;  
}  
 
function save() {  
 
if ( $this->wasPersisted ) {  
return $this->update();  
} else {  
return $this->create();  
}  
}  
 
function addToCache($col = 'id') {  
 
if($this->isCachable()) {  
$cache = &owa_coreAPI::cacheSingleton();  
$cache->setCollectionExpirationPeriod($this->getTableName(), $this->getCacheExpirationPeriod());  
$cache->set($this->getTableName(), $col.$this->get('id'), $this, $this->getCacheExpirationPeriod());  
}  
}  
 
/**  
* Update all properties of an Existing object  
*  
*/  
function update($where = '') {  
 
$db = owa_coreAPI::dbSingleton();  
$db->updateTable($this->getTableName());  
 
// get column list  
$all_cols = $this->getColumns();  
 
 
// Control loop  
foreach ($all_cols as $k => $v){  
 
// drop column is it is marked as auto-incement as DB will take care of that.  
 
if ($this->get($v, false)) {  
$db->set($v, $this->get($v, false));  
}  
}  
 
if(empty($where)):  
$id = $this->get('id');  
$db->where('id', $id);  
 
else:  
$db->where($where, $this->get($where));  
endif;  
 
// Persist object  
$status = $db->executeQuery();  
// Add to Cache  
if ($status === true) {  
$this->addToCache();  
}  
 
return $status;  
 
}  
 
/**  
* Update named list of properties of an existing object  
*  
* @param array $named_properties  
* @param array $where  
* @return boolean  
*/  
function partialUpdate($named_properties, $where) {  
 
$db = &owa_coreAPI::dbSingleton();  
$db->updateTable($this->getTableName());  
 
foreach ($named_properties as $v) {  
 
if ($this->get($v)){  
$db->set($v, $this->get($v));  
}  
}  
 
if(empty($where)):  
$db->where('id', $this->get('id'));  
else:  
$db->where($where, $this->get($where));  
endif;  
 
// Persist object  
$status = $db->executeQuery();  
// Add to Cache  
if ($status == true) {  
$this->addToCache();  
}  
 
return $status;  
}  
 
 
/**  
* Delete Object  
*  
*/  
function delete($value = '', $col = 'id') {  
 
$db = owa_coreAPI::dbSingleton();  
$db->deleteFrom($this->getTableName());  
 
if (empty($value)) {  
$value = $this->get('id');  
}  
 
$db->where($col, $value);  
 
$status = $db->executeQuery();  
 
// Add to Cache  
if ($status == true){  
if ($this->isCachable()) {  
$cache = &owa_coreAPI::cacheSingleton();  
$cache->remove($this->getTableName(), 'id'.$this->get('id'));  
}  
}  
 
return $status;  
 
}  
 
function load($value, $col = 'id') {  
 
return $this->getByColumn($col, $value);  
 
}  
 
function getByPk($col, $value) {  
 
return $this->getByColumn($col, $value);  
 
}  
 
function getByColumn($col, $value) {  
 
$cache_obj = '';  
 
if ($this->isCachable()) {  
$cache = &owa_coreAPI::cacheSingleton();  
$cache->setCollectionExpirationPeriod($this->getTableName(), $this->getCacheExpirationPeriod());  
$cache_obj = $cache->get($this->getTableName(), $col.$value);  
}  
 
if (!empty($cache_obj)) {  
 
$cache_obj_properties = $cache_obj->_getProperties();  
$this->setProperties($cache_obj_properties);  
$this->wasPersisted = true;  
 
} else {  
 
$db = owa_coreAPI::dbSingleton();  
$db->selectFrom($this->getTableName());  
$db->selectColumn('*');  
$db->where($col, $value);  
$properties = $db->getOneRow();  
 
if (!empty($properties)) {  
 
$this->setProperties($properties);  
$this->wasPersisted = true;  
// add to cache  
$this->addToCache($col);  
owa_coreAPI::debug('entity loaded from db');  
}  
}  
}  
 
function getTableName() {  
 
if ($this->_tableProperties) {  
return $this->_tableProperties['name'];  
} else {  
return get_class($this);  
}  
 
}  
 
function getTableAlias() {  
 
if ($this->_tableProperties) {  
return $this->_tableProperties['alias'];  
}  
}  
 
function setTableName($name, $namespace = 'owa_') {  
 
$this->_tableProperties['alias'] = $name;  
$this->_tableProperties['name'] = $namespace.$name;  
}  
 
/**  
* Sets the entity as cachable for some period of time  
*  
* @todo make this use the getSetting method but that requires a refactoring of  
* the entity abstract class to not use an entity in it's constructor  
*/  
function setCachable($seconds = '') {  
 
$this->_tableProperties['cacheable'] = true;  
 
// set cache expiration period  
if (!$seconds) {  
// remove hard coded value. fix this see note above.  
//$seconds = owa_coreAPI::getSetting('base', 'default_cache_expiration_period');  
$seconds = 604800;  
}  
 
$this->setCacheExpirationPeriod($seconds);  
}  
 
function isCachable() {  
 
if (owa_coreAPI::getSetting('base', 'cache_objects')) {  
if (array_key_exists('cacheable', $this->_tableProperties)) {  
return $this->_tableProperties['cacheable'];  
}  
} else {  
return false;  
}  
 
}  
 
function setPrimaryKey($col) {  
//backwards compatability  
$this->properties[$col]->setPrimaryKey();  
$this->_tableProperties['primary_key'] = $col;  
 
}  
 
function getForeignKeyColumn($entity) {  
if (array_key_exists('relatedEntities', $this->_tableProperties)) {  
if (array_key_exists($entity, $this->_tableProperties['relatedEntities'])) {  
return $this->_tableProperties['relatedEntities'][$entity];  
}  
}  
}  
 
function isForeignKeyColumn($col) {  
 
if (array_key_exists($col, $this->properties)) {  
return $this->properties[$col]->isForeignKey();  
}  
}  
 
function getAllForeignKeys() {  
 
return;  
}  
 
/**  
* Create Table  
*  
* Handled by DB abstraction layer because the SQL associated with this is way too DB specific  
*/  
function createTable() {  
 
$db = owa_coreAPI::dbSingleton();  
// Persist table  
$status = $db->createTable($this);  
 
if ($status == true):  
owa_coreAPI::notice(sprintf("%s Table Created.", $this->getTableName()));  
return true;  
else:  
owa_coreAPI::notice(sprintf("%s Table Creation Failed.", $this->getTableName()));  
return false;  
endif;  
 
}  
 
/**  
* DROP Table  
*  
* Drops a table. will throw error is table does not exist  
*/  
function dropTable() {  
 
$db = owa_coreAPI::dbSingleton();  
// Persist table  
$status = $db->dropTable($this->getTableName());  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
function addColumn($column_name) {  
 
$def = $this->getColumnDefinition($column_name);  
// Persist table  
$db = owa_coreAPI::dbSingleton();  
$status = $db->addColumn($this->getTableName(), $column_name, $def);  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
function dropColumn($column_name) {  
 
$db = owa_coreAPI::dbSingleton();  
$status = $db->dropColumn($this->getTableName(), $column_name);  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
function modifyColumn($column_name) {  
 
$def = $this->getColumnDefinition($column_name);  
$db = owa_coreAPI::dbSingleton();  
$status = $db->modifyColumn($this->getTableName(), $column_name, $def);  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
 
 
}  
 
function renameColumn($old_column_name, $column_name, $use_old_column_for_defs = false) {  
 
if ($use_old_column_for_defs) {  
$def = $this->getColumnDefinition($old_column_name);  
} else {  
$def = $this->getColumnDefinition($column_name);  
}  
 
$db = owa_coreAPI::dbSingleton();  
$status = $db->renameColumn($this->getTableName(), $old_column_name, $column_name, $def);  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
 
}  
 
function renameTable($new_table_name) {  
 
$db = owa_coreAPI::dbSingleton();  
$status = $db->renameTable($this->getTableName(), $new_table_name);  
 
if ($status == true):  
return true;  
else:  
return false;  
endif;  
return;  
}  
 
function getColumnDefinition($column_name) {  
 
if (empty($this->properties)) {  
return $this->$column_name->getDefinition();  
} else {  
return $this->properties[$column_name]->getDefinition();  
}  
}  
 
function setProperty($obj) {  
 
$this->properties[$obj->get('name')] = $obj;  
 
if ($obj->isForeignKey()) {  
$fk = $obj->getForeignKey();  
 
$this->_tableProperties['relatedEntities'][$fk[0]] = $obj->getName();  
$this->_tableProperties['foreign_keys'][$obj->getName()] = $fk[0];  
}  
 
}  
 
function getProperty($name) {  
if (array_key_exists($name, $this->properties)) {  
return $this->properties[$name];  
}  
}  
 
function generateRandomUid($seed = '') {  
 
return crc32($_SERVER['SERVER_ADDR'].$_SERVER['SERVER_NAME'].getmypid().$this->getTableName().microtime().$seed.rand());  
}  
 
/**  
* Create guid from string  
*  
* @param string $string  
* @return integer  
*/  
function generateId($string) {  
//require_once(OWA_DIR.'owa_lib.php');  
return owa_lib::setStringGuid($string);  
}  
 
function setCacheExpirationPeriod($seconds) {  
 
$this->_tableProperties['cache_expiration_period'] = $seconds;  
}  
 
function getCacheExpirationPeriod() {  
 
if (array_key_exists('cache_expiration_period', $this->_tableProperties)) {  
return $this->_tableProperties['cache_expiration_period'];  
} else {  
// default of thirty days  
return (3600);  
}  
}  
 
function getName() {  
 
return $this->name;  
}  
 
function setSummaryLevel($num) {  
 
$this->_tableProperties['summary_level'] = $num;  
}  
 
function getSummaryLevel() {  
 
if (array_key_exists('summary_level', $this->_tableProperties)) {  
 
return $this->_tableProperties['summary_level'];  
 
} else {  
 
return 0;  
}  
}  
 
function setCharacterEncoding($encoding) {  
 
$this->_tableProperties['character_encoding'] = $encoding;  
}  
 
function wasPersisted() {  
return $this->wasPersisted;  
}  
}  
 
?>  
 
file:a/busui/owa/owa_env.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Environment Configuration  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
if (!defined('OWA_PATH')) {  
define('OWA_PATH', dirname(__FILE__));  
}  
define('OWA_DIR', OWA_PATH . '/');  
define('OWA_MODULES_DIR', OWA_DIR.'modules/');  
define('OWA_BASE_DIR', OWA_PATH); // depricated  
define('OWA_BASE_CLASSES_DIR', OWA_DIR); //depricated  
define('OWA_BASE_MODULE_DIR', OWA_DIR.'modules/base/');  
define('OWA_BASE_CLASS_DIR', OWA_BASE_MODULE_DIR.'classes/');  
define('OWA_INCLUDE_DIR', OWA_DIR.'includes/');  
define('OWA_PEARLOG_DIR', OWA_INCLUDE_DIR.'Log-1.12.2');  
define('OWA_PHPMAILER_DIR', OWA_INCLUDE_DIR.'PHPMailer_v2.0.3/');  
define('OWA_HTTPCLIENT_DIR', OWA_INCLUDE_DIR.'httpclient-2009-09-02/');  
define('OWA_PLUGINS_DIR', OWA_DIR.'plugins'); //depricated  
define('OWA_PLUGIN_DIR', OWA_DIR.'plugins/');  
define('OWA_CONF_DIR', OWA_DIR.'conf/');  
define('OWA_THEMES_DIR', OWA_DIR.'themes/');  
define('OWA_VERSION', '1.4.0');  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if(!class_exists('Snoopy')) {  
require_once(OWA_INCLUDE_DIR.'/Snoopy.class.php');  
}  
 
require_once(OWA_HTTPCLIENT_DIR.'http.php');  
 
/**  
* Wrapper for Snoopy http request class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_http {  
 
/**  
* Configuration  
*  
* @var array  
*/  
var $config;  
 
/**  
* Error handler  
*  
* @var object  
*/  
var $e;  
 
/**  
* The length of text contained in the snippet  
*  
* @var string  
*/  
var $snip_len = 100;  
 
/**  
* The string that is added to the beginning and  
* end of snippet text.  
*  
* @var string  
*/  
var $snip_str = '...';  
 
/**  
* Anchor information for a particular link  
*  
* @var array  
*/  
var $anchor_info;  
 
var $crawler;  
 
var $testcrawler;  
 
var $http;  
 
var $response;  
var $response_headers;  
var $response_code;  
 
var $request_headers;  
 
function __construct() {  
 
$c = &owa_coreAPI::configSingleton();  
$this->config = $c->fetch('base');  
$this->e = &owa_coreAPI::errorSingleton();  
$this->crawler = new Snoopy;  
// do not allow snoopy to follow links  
$this->crawler->maxredirs = 5;  
$this->crawler->agent = owa_coreAPI::getSetting('base', 'owa_user_agent');  
//$this->crawler->agent = "Firefox";  
//owa_coreAPI::debug('hello from owa_http constructor');  
return;  
 
}  
 
function fetch($uri) {  
//owa_coreAPI::debug('hello from owa_http fetch');  
return $this->crawler->fetch($uri);  
}  
 
function testFetch($url) {  
 
$http= new http_class;  
owa_coreAPI::debug('hello owa_http testfetch method');  
/* Connection timeout */  
$http->timeout=0;  
/* Data transfer timeout */  
$http->data_timeout=0;  
/* Output debugging information about the progress of the connection */  
$http->debug=1;  
$http->user_agent = owa_coreAPI::getSetting('base', 'owa_user_agent');  
$http->follow_redirect=1;  
$http->redirection_limit=5;  
$http->exclude_address="";  
$http->prefer_curl=0;  
$arguments = array();  
$error=$http->GetRequestArguments($url,$arguments);  
$error=$http->Open($arguments);  
 
//for(;;)  
// {  
$error=$http->ReadReplyBody($body,50000);  
if($error!="" || strlen($body)==0)  
owa_coreAPI::debug(HtmlSpecialChars($body));  
// }  
 
}  
 
/**  
* Searches a fetched html document for the anchor of a specific url  
*  
* @param string $link  
*/  
function extract_anchor($link) {  
 
$matches = '';  
$regex = '/<a[^>]*href=\"%s\"[^>]*>(.*?)<\/a>/i';  
 
//$escaped_link = str_replace(array("/", "?"), array("\/", "\?"), $link);  
 
$pattern = trim(sprintf($regex, preg_quote($link, '/')));  
$search = preg_match($pattern, $this->response, $matches);  
//$this->e->debug('pattern: '.$pattern);  
//$this->e->debug('link: '.$link);  
 
 
if (empty($matches)) {  
if (substr($link, -1) === '/') {  
$link = substr($link, 0, -1);  
$pattern = trim(sprintf($regex, preg_quote($link, '/')));  
$search = preg_match($pattern, $this->response, $matches);  
//$this->e->debug('pattern: '.$pattern);  
//$this->e->debug('link: '.$link);  
}  
}  
 
$this->e->debug('ref search: '.$search);  
//$this->e->debug('ref matches: '.print_r($this->results, true));  
//$this->e->debug('ref matches: '.print_r($matches, true));  
if (isset($matches[0])) {  
$this->anchor_info = array('anchor_tag' => $matches[0], 'anchor_text' => owa_lib::inputFilter($matches[0]));  
$this->e->debug('Anchor info: '.print_r($this->anchor_info, true));  
}  
}  
 
/**  
* Creates a text snippet of the portion of page where the  
* specific link is found.  
*  
* Takes fully qualified URL for the link to search for.  
*  
* @param string $link  
* @return string  
*/  
function extract_anchor_snippet($link){  
 
// Search the page for a specific anchor  
$this->extract_anchor($link);  
 
if(!empty($this->anchor_info['anchor_tag'])) {  
 
// drop certain HTML entitities and their content  
$nohtml = $this->strip_selected_tags(  
$this->response,  
array('title',  
'head',  
'script',  
'object',  
'style',  
'meta',  
'link',  
'rdf:'),  
true);  
 
//$this->e->debug('Refering page content after certain html entities were dropped: '.$this->results);  
 
// calc len of the anchor text  
$atext_len = strlen($this->anchor_info['anchor_tag']);  
 
// find position within document of the anchor text  
$start = strpos($nohtml, $this->anchor_info['anchor_tag']);  
 
if ($start < $this->snip_len) {  
$part1_start_pos = 0;  
$part1_snip_len = $start;  
} else {  
$part1_start_pos = $start;  
$part1_snip_len = $this->snip_len;  
}  
 
$replace_items = array("\r\n", "\n\n", "\t", "\r", "\n");  
// Create first segment of snippet  
$first_part = substr($nohtml, 0, $part1_start_pos);  
$first_part = str_replace($replace_items, '', $first_part);  
$first_part = strip_tags(owa_lib::inputFilter($first_part));  
//$part1 = trim(substr($nohtml, $part1_start_pos, $part1_snip_len));  
$part1 = substr($first_part,-$part1_snip_len, $part1_snip_len);  
 
//$part1 = str_replace(array('\r\n', '\n\n', '\t', '\r', '\n'), '', $part1);  
//$part1 = owa_lib::inputFilter($part1);  
// Create second segment of snippet  
$part2 = trim(substr($nohtml, $start + $atext_len, $this->snip_len+300));  
$part2 = str_replace($replace_items, '', $part2);  
$part2 = substr(strip_tags(owa_lib::inputFilter($part2)),0, $this->snip_len);  
 
// Put humpty dumpy back together again and create actual snippet  
$snippet = $this->snip_str.$part1.' <span class="snippet_anchor">'.owa_lib::inputFilter($this->anchor_info['anchor_tag']).'</span> '.$part2.$this->snip_str;  
 
} else {  
 
$snippet = '';  
 
}  
 
return $snippet;  
 
}  
 
function extract_title() {  
 
preg_match('~(</head>|<body>|(<title>\s*(.*?)\s*</title>))~i', $this->response, $m);  
 
$this->e->debug("referer title extract: ". print_r($m, true));  
 
return $m[3];  
}  
 
function strip_selected_tags($str, $tags = array(), $stripContent = false) {  
 
foreach ($tags as $k => $tag){  
 
if ($stripContent == true) {  
$pattern = sprintf('#(<%s.*?>)(.*?)(<\/%s.*?>)#is', preg_quote($tag), preg_quote($tag));  
$str = preg_replace($pattern,"",$str);  
}  
$str = preg_replace($pattern, ${2},$str);  
}  
 
return $str;  
}  
 
function SetupHTTP()  
{  
if(!IsSet($this->http))  
{  
$this->http = new http_class;  
$this->http->follow_redirect = 1;  
$this->http->debug = 0;  
$this->http->debug_response_body = 0;  
$this->http->html_debug = 1;  
$this->http->user_agent = owa_coreAPI::getSetting('base', 'owa_user_agent');  
$this->http->timeout = 3;  
$this->http->data_timeout = 3;  
}  
}  
 
function OpenRequest($arguments, &$headers)  
{  
if(strlen($this->error=$this->http->Open($arguments)))  
return(0);  
if(strlen($this->error=$this->http->SendRequest($arguments))  
|| strlen($this->error=$this->http->ReadReplyHeaders($headers)))  
{  
$this->http->Close();  
return(0);  
}  
if($this->http->response_status!=200)  
{  
$this->error = 'the HTTP request returned the status '.$this->http->response_status;  
$this->http->Close();  
return(0);  
}  
return(1);  
}  
 
function GetRequestResponse(&$response)  
{  
for($response = ''; ; )  
{  
if(strlen($this->error=$this->http->ReadReplyBody($body, 500000)))  
{  
$this->http->Close();  
return(0);  
}  
if(strlen($body)==0)  
break;  
$response .= $body;  
 
}  
$this->http->Close();  
owa_coreAPI::debug('http response code: '.$this->http->response_status);  
return($response);  
}  
 
function getRequest($url, $arguments = '', $response = '') {  
 
$this->SetupHTTP();  
 
$this->http->GetRequestArguments($url, $arguments);  
$arguments['RequestMethod']='GET';  
if(!$this->OpenRequest($arguments, $headers)) {  
return(0);  
}  
$this->response = $this->GetRequestResponse($response);  
return($this->response);  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once (OWA_BASE_DIR.'/owa_base.php');  
 
/**  
* Install Abstract Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_install extends owa_base{  
 
/**  
* Data access object  
*  
* @var object  
*/  
var $db;  
 
/**  
* Version of string  
*  
* @var string  
*/  
var $version;  
 
/**  
* Params array  
*  
* @var array  
*/  
var $params;  
 
/**  
* Module name  
*  
* @var unknown_type  
*/  
var $module;  
 
/**  
* Constructor  
*  
* @return owa_install  
*/  
 
function owa_install() {  
 
$this->owa_base();  
$this->db = &owa_coreAPI::dbSingleton();  
 
return;  
}  
 
/**  
* Check to see if schema is installed  
*  
* @return boolean  
*/  
function checkForSchema() {  
 
$table_check = array();  
//$this->e->notice(print_r($this->tables, true));  
// test for existance of tables  
foreach ($this->tables as $table) {  
$this->e->notice('Testing for existance of table: '. $table);  
$check = $this->db->get_results(sprintf("show tables like 'owa_%s'", $table));  
//$this->e->notice(print_r($check, true));  
 
// if a table is missing add it to this array  
if (empty($check)):  
$table_check[] = $table;  
$this->e->notice('Did not find table: '. $table);  
else:  
$this->e->notice('Table '. $table. ' already exists.');  
endif;  
}  
 
if (!empty($table_check)):  
//$this->e->notice(sprintf("Schema Check: Tables '%s' are missing.", implode(',', $table_check)));  
$this->e->notice(sprintf("Schema Check: Tables to install: %s", print_r($table_check, true)));  
 
return $table_check;  
else:  
return false;  
endif;  
 
}  
 
}  
 
?>  
file:a/busui/owa/owa_lib.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
//require_once 'owa_env.php';  
 
//require_once(OWA_BASE_CLASS_DIR.'settings.php');  
 
/**  
* Utility Functions  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_lib {  
 
/**  
* Convert Associative Array to String  
*  
* @param string $inner_glue  
* @param string $outer_glue  
* @param array $array  
* @return string  
*/  
public static function implode_assoc($inner_glue, $outer_glue, $array) {  
$output = array();  
foreach( $array as $key => $item ) {  
$output[] = $key . $inner_glue . $item;  
}  
 
return implode($outer_glue, $output);  
}  
 
/**  
* Deconstruct Associative Array  
*  
* For example this takes array([1] => array(a => dog, b => cat), [2] => array(a => sheep, b => goat))  
* and tunrs it into array([a] => array(dog, sheep), [b] => array(cat, goat))  
*  
* @param array $a_array  
* @return array $data_arrays  
* @access public  
*/  
public static function deconstruct_assoc($a_array) {  
if (!empty($a_array)):  
 
$data_arrays = array();  
 
if(!empty($a_array[1])) :  
 
foreach ($a_array as $key => $value) {  
foreach ($value as $k => $v) {  
$data_arrays[$k][] = $v;  
 
}  
}  
else:  
//print_r($a_array[0]);  
foreach ($a_array[0] as $key => $value) {  
$data_arrays[$key][] = $value;  
}  
endif;  
 
return $data_arrays;  
else:  
return array();  
endif;  
}  
 
 
public static function decon_assoc($a_array) {  
 
$data_arrays = array();  
 
foreach ($a_array as $key => $value) {  
//foreach ($value as $k => $v) {  
$data_arrays[$key][] = $value;  
 
//}  
}  
 
return $data_arrays;  
}  
 
// php 4 compatible function  
public static function array_intersect_key() {  
 
$arrs = func_get_args();  
$result = array_shift($arrs);  
foreach ($arrs as $array) {  
foreach ($result as $key => $v) {  
if (!array_key_exists($key, $array)) {  
unset($result[$key]);  
}  
}  
}  
return $result;  
}  
 
// php4 compatible function  
public static function array_walk_recursive(&$input, $funcname, $userdata = "")  
{  
if (!is_callable($funcname))  
{  
return false;  
}  
 
if (!is_array($input))  
{  
return false;  
}  
 
if (is_array($funcname))  
{  
$funcname = $funcname[0].'::'.$funcname[1];  
}  
 
 
foreach ($input AS $key => $value)  
{  
if (is_array($input[$key]))  
{  
array_walk_recursive($input[$key], $funcname, $userdata);  
}  
else  
{  
$saved_value = $value;  
if (!empty($userdata))  
{  
$funcname($value, $key, $userdata);  
}  
else  
{  
$funcname($value, $key);  
}  
 
if ($value != $saved_value)  
{  
$input[$key] = $value;  
}  
}  
}  
return true;  
}  
 
/**  
* Array of Current Time  
*  
* @return array  
* @access public  
*/  
public static function time_now() {  
 
$timestamp = time();  
 
return array(  
 
'year' => date("Y", $timestamp),  
'month' => date("n", $timestamp),  
'day' => date("d", $timestamp),  
'dayofweek' => date("w", $timestamp),  
'dayofyear' => date("z", $timestamp),  
'weekofyear' => date("W", $timestamp),  
'hour' => date("G", $timestamp),  
'minute' => date("i", $timestamp),  
'second' => date("s", $timestamp),  
'timestamp' => $timestamp  
);  
}  
 
/**  
* Error Handler  
*  
* @param string $msg  
* @access public  
* @depricated  
*/  
function errorHandler($msg) {  
require_once(OWA_PEARLOG_DIR . '/Log.php');  
$conf = array('mode' => 0755, 'timeFormat' => '%X %x');  
$error_logger = &Log::singleton('file', $this->config['error_log_file'], 'ident', $conf);  
$this->error_logger->_lineFormat = '[%3$s]';  
 
return;  
}  
 
/**  
* Information array for Months in the year.  
*  
* @return array  
*/  
public static function months() {  
 
return array(  
 
1 => array('label' => 'January'),  
2 => array('label' => 'February'),  
3 => array('label' => 'March'),  
4 => array('label' => 'April'),  
5 => array('label' => 'May'),  
6 => array('label' => 'June'),  
7 => array('label' => 'July'),  
8 => array('label' => 'August'),  
9 => array('label' => 'September'),  
10 => array('label' => 'October'),  
11 => array('label' => 'November'),  
12 => array('label' => 'December')  
);  
 
}  
 
public static function days() {  
 
return array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,  
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);  
}  
 
public static function years() {  
 
static $years;  
 
if (empty($years)):  
 
$start_year = 2005;  
 
$years = array($start_year);  
 
$num_years = date("Y", time()) - $start_year;  
 
for($i=1; $i<=$num_years; $i++) {  
 
$years[] = $start_year + $i;  
}  
 
$years = array_reverse($years);  
 
endif;  
 
return $years;  
}  
 
 
/**  
* Returns a label from an array of months  
*  
* @param int $month  
* @return string  
*/  
public static function get_month_label($month) {  
 
static $months;  
 
if (empty($months)):  
 
$months = owa_lib::months();  
 
endif;  
 
return $months[$month]['label'];  
 
}  
 
 
/**  
* Sets the suffix for Days used in Date labels  
* @depricated  
* @param string $day  
* @return string  
*/  
public static function setDaySuffix($day) {  
 
switch ($day) {  
 
case "1":  
$day_suffix = 'st';  
break;  
case "2":  
$day_suffix = 'nd';  
break;  
case "3":  
$day_suffix = 'rd';  
break;  
default:  
$day_suffix = 'th';  
}  
 
return $day_suffix;  
 
}  
 
/**  
* Generates the label for a date  
* @depricated  
* @param array $params  
* @return string  
*/  
public static function getDatelabel($params) {  
 
switch ($params['period']) {  
 
case "day":  
return sprintf("%s, %d%s %s",  
owa_lib::get_month_label($params['month']),  
$params['day'],  
owa_lib::setDaySuffix($params['day']),  
$params['year']  
);  
break;  
 
case "month":  
return sprintf("%s %s",  
owa_lib::get_month_label($params['month']),  
$params['year']  
);  
break;  
 
case "year":  
return sprintf("%s",  
$params['year']  
);  
break;  
case "date_range":  
return sprintf("%s, %d%s %s - %s, %d%s %s",  
owa_lib::get_month_label($params['month']),  
$params['day'],  
owa_lib::setDaySuffix($params['day']),  
$params['year'],  
owa_lib::get_month_label($params['month2']),  
$params['day2'],  
owa_lib::setDaySuffix($params['day2']),  
$params['year2']  
);  
break;  
}  
 
return false;  
 
}  
 
/**  
* Array of Reporting Periods  
* @depricated  
* @return array  
*/  
public static function reporting_periods() {  
 
return array(  
 
'today' => array('label' => 'Today'),  
'yesterday' => array('label' => 'Yesterday'),  
'this_week' => array('label' => 'This Week'),  
'this_month' => array('label' => 'This Month'),  
'this_year' => array('label' => 'This Year'),  
'last_week' => array('label' => 'Last Week'),  
'last_month' => array('label' => 'Last Month'),  
'last_year' => array('label' => 'Last Year'),  
'last_half_hour' => array('label' => 'The Last 30 Minutes'),  
'last_hour' => array('label' => 'Last Hour'),  
'last_24_hours' => array('label' => 'The Last 24 Hours'),  
'last_seven_days' => array('label' => 'The Last Seven Days'),  
'last_thirty_days' => array('label' => 'The Last Thirty Days'),  
'same_day_last_week' => array('label' => 'Same Day last Week'),  
'same_week_last_year' => array('label' => 'Same Week Last Year'),  
'same_month_last_year' => array('label' => 'Same Month Last Year'),  
'date_range' => array('label' => 'Date Range')  
);  
 
}  
 
/**  
* Array of Date specific Reporting Periods  
* @depricated  
* @return array  
*/  
public static function date_reporting_periods() {  
 
return array(  
 
'day' => array('label' => 'Day'),  
'month' => array('label' => 'Month'),  
'year' => array('label' => 'Year'),  
'date_range' => array('label' => 'Date Range')  
);  
 
}  
 
/**  
* Gets label for a particular reporting period  
*  
* @param unknown_type $period  
* @return unknown  
*/  
public static function get_period_label($period) {  
 
$periods = owa_lib::reporting_periods();  
 
return $periods[$period]['label'];  
}  
 
/**  
* Assembles the current URL from request params  
*  
* @return string  
*/  
public static function get_current_url() {  
 
$url = 'http';  
 
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {  
$url.= 's';  
}  
 
if ( isset( $_SERVER['HTTP_HOST'] ) ) {  
// contains port number  
$domain = $_SERVER['HTTP_HOST'];  
} else {  
// does not contain port number.  
$domain = $_SERVER['SERVER_NAME'];  
if( $_SERVER['SERVER_PORT'] != 80 ) {  
$domain .= ':' . $_SERVER['SERVER_PORT'];  
}  
}  
 
$url .= '://'.$domain;  
 
$url .= $_SERVER['REQUEST_URI'];  
 
return $url;  
}  
 
public static function inputFilter($array) {  
 
if ( ! class_exists( 'owa_InputFilter' ) ) {  
require_once(OWA_INCLUDE_DIR.'/class.inputfilter.php');  
}  
 
$f = new owa_InputFilter;  
return $f->process($array);  
 
}  
 
public static function fileInclusionFilter($str) {  
 
$str = str_replace("http://", "", $str);  
$str = str_replace("/", "", $str);  
$str = str_replace("\\", "", $str);  
$str = str_replace("../", "", $str);  
$str = str_replace("..", "", $str);  
$str = str_replace("?", "", $str);  
$str = str_replace("%00", "", $str);  
 
if (strpos($str, '%00')) {  
$str = '';  
}  
 
if (strpos($str, null)) {  
$str = '';  
}  
 
return $str;  
}  
 
/**  
* Generic Factory method  
*  
* @param string $class_dir  
* @param string $class_prefix  
* @param string $class_name  
* @param array $conf  
* @return object  
*/  
public static function &factory($class_dir, $class_prefix, $class_name, $conf = array(), $class_suffix = '') {  
 
//$class_dir = strtolower($class_dir).DIRECTORY_SEPARATOR;  
$class_dir = $class_dir.DIRECTORY_SEPARATOR;  
$classfile = $class_dir . $class_name . '.php';  
$class = $class_prefix . $class_name . $class_suffix;  
 
/*  
* Attempt to include a version of the named class, but don't treat  
* a failure as fatal. The caller may have already included their own  
* version of the named class.  
*/  
if (!class_exists($class)) {  
 
if (file_exists($classfile)) {  
require_once ($classfile);  
}  
 
}  
 
/* If the class exists, return a new instance of it. */  
if (class_exists($class)) {  
$obj = &new $class($conf);  
return $obj;  
}  
 
$null = null;  
return $null;  
}  
 
/**  
* Generic Object Singleton  
*  
* @param string $class_dir  
* @param string $class_prefix  
* @param string $class_name  
* @param array $conf  
* @return object  
*/  
public static function &singleton($class_dir, $class_prefix, $class_name, $conf = array()) {  
 
static $instance;  
 
if (!isset($instance)) {  
// below missing a reference becasue the static vriable can not handle a reference  
$instance = owa_lib::factory($class_dir, $class_prefix, $class_name, $conf);  
}  
 
return $instance;  
}  
 
/**  
* 302 HTTP redirect the user to a new url  
*  
* @param string $url  
*/  
public static function redirectBrowser($url) {  
 
//ob_clean();  
// 302 redirect to URL  
header ('Location: '.$url, true);  
header ('HTTP/1.0 302 Found', true);  
return;  
}  
 
public static function makeLinkQueryString($query_params) {  
 
$new_query_params = array();  
 
//Load params passed by caller  
if (!empty($this->caller_params)):  
foreach ($this->caller_params as $name => $value) {  
if (!empty($value)):  
$new_query_params[$name] = $value;  
endif;  
}  
endif;  
 
// Load overrides  
if (!empty($query_params)):  
foreach ($query_params as $name => $value) {  
if (!empty($value)):  
$new_query_params[$name] = $value;  
endif;  
}  
endif;  
 
// Construct GET request  
if (!empty($new_query_params)):  
foreach ($new_query_params as $name => $value) {  
if (!empty($value)):  
$get .= $name . "=" . $value . "&";  
endif;  
}  
endif;  
 
return $get;  
 
}  
 
public static function getRequestParams() {  
 
$params = array();  
 
if (!empty($_POST)) {  
$params = $_POST;  
} else {  
$params = $_GET;  
}  
 
if (!empty($_COOKIE)) {  
 
$params = array_merge($params, $_COOKIE);  
}  
 
return $params;  
}  
 
public static function rekeyArray($array, $new_keys) {  
 
$new_keys = $new_keys;  
$new_array = array();  
foreach ($array as $k => $v) {  
 
if (array_key_exists($k, $new_keys)) {  
$k = $new_keys[$k];  
}  
 
$new_array[$k] = $v;  
}  
 
return $new_array;  
}  
 
 
public static function stripParams($params, $ns = '') {  
 
$striped_params = array();  
 
if (!empty($ns)) {  
 
$len = strlen($ns);  
 
foreach ($params as $n => $v) {  
 
// if namespace is present in param  
if (strstr($n, $ns)) {  
// strip the namespace value  
$striped_n = substr($n, $len);  
//add to striped array  
$striped_params[$striped_n] = $v;  
 
}  
 
}  
 
return $striped_params;  
 
} else {  
 
return $params;  
}  
 
}  
 
/**  
* module specific require method  
*  
* @param unknown_type $module  
* @param unknown_type $file  
* @return unknown  
* @deprecated  
*/  
public static function moduleRequireOnce($module, $file) {  
 
return require_once(OWA_BASE_DIR.'/modules/'.$module.'/'.$file.'.php');  
}  
 
/**  
* module specific factory  
*  
* @param unknown_type $modulefile  
* @param unknown_type $class_suffix  
* @param unknown_type $params  
* @return unknown  
* @deprecated  
*/  
public static function moduleFactory($modulefile, $class_suffix = null, $params = '') {  
 
list($module, $file) = explode(".", $modulefile);  
$class = 'owa_'.$file.$class_suffix;  
 
// Require class file if class does not already exist  
if(!class_exists($class)):  
owa_lib::moduleRequireOnce($module, $file);  
endif;  
 
$obj = owa_lib::factory(OWA_BASE_DIR.'/modules/'.$module, '', $class, $params);  
$obj->module = $module;  
 
return $obj;  
}  
 
/**  
* redirects borwser to a particular view  
*  
* @param unknown_type $data  
*/  
public static function redirectToView($data) {  
//print_r($data);  
$c = &owa_coreAPI::configSingleton();  
$config = $c->fetch('base');  
 
$control_params = array('view_method', 'auth_status');  
 
 
$get = '';  
 
foreach ($data as $n => $v) {  
 
if (!in_array($n, $control_params)):  
 
$get .= $config['ns'].$n.'='.$v.'&';  
 
endif;  
}  
$new_url = sprintf($config['link_template'], $config['main_url'], $get);  
 
owa_lib::redirectBrowser($new_url);  
 
return;  
}  
 
/**  
* Displays a View without user authentication. Takes array of data as input  
*  
* @param array $data  
* @deprecated  
*/  
public static function displayView($data, $params = array()) {  
 
$view = owa_lib::moduleFactory($data['view'], 'View', $params);  
 
return $view->assembleView($data);  
 
}  
 
/**  
* Create guid from string  
*  
* @param string $string  
* @return integer  
* @access private  
*/  
public static function setStringGuid($string) {  
if (!empty($string)):  
return crc32(strtolower($string));  
else:  
return;  
endif;  
}  
 
/**  
* Add constraints into SQL where clause  
*  
* @param array $constraints  
* @return string $where  
* @access public  
* @depricated  
* @todo remove  
*/  
function addConstraints($constraints) {  
 
if (!empty($constraints)):  
 
$count = count($constraints);  
 
$i = 0;  
 
$where = '';  
 
foreach ($constraints as $key => $value) {  
 
if (empty($value)):  
$i++;  
else:  
 
if (!is_array($value)):  
$where .= $key . ' = ' . "'$value'";  
else:  
 
switch ($value['operator']) {  
case 'BETWEEN':  
$where .= sprintf("%s BETWEEN '%s' AND '%s'", $key, $value['start'], $value['end']);  
break;  
default:  
$where .= sprintf("%s %s '%s'", $key, $value['operator'], $value['value']);  
break;  
}  
 
 
endif;  
 
if ($i < $count - 1):  
 
$where .= " AND ";  
 
endif;  
 
$i++;  
 
endif;  
 
}  
// needed in case all values in the array are empty  
if (!empty($where)):  
return $where;  
else:  
return;  
endif;  
 
else:  
 
return;  
 
endif;  
 
 
 
}  
 
public static function assocFromString($string_state, $inner = '=>', $outer = '|||') {  
 
if (!empty($string_state)):  
 
if (strpos($string_state, $outer) === false):  
 
return $string_state;  
 
else:  
 
$array = explode($outer, $string_state);  
 
$state = array();  
 
foreach ($array as $key => $value) {  
 
list($realkey, $realvalue) = explode($inner, $value);  
$state[$realkey] = $realvalue;  
 
}  
 
endif;  
 
endif;  
 
return $state;  
 
 
}  
 
/**  
* Simple function to replicate PHP 5 behaviour  
*/  
 
public static function microtime_float() {  
list($usec, $sec) = explode(" ", microtime());  
return ((float)$usec + (float)$sec);  
}  
 
/**  
* Lists all files in a Directory  
*  
*/  
public static function listDir($start_dir='.', $recursive = true) {  
 
$files = array();  
 
if (is_dir($start_dir)):  
 
$fh = opendir($start_dir);  
 
while (($file = readdir($fh)) !== false) {  
 
// loop through the files, skipping . and .., and recursing if necessary  
if (strcmp($file, '.')==0 || strcmp($file, '..')==0) continue;  
$filepath = $start_dir . DIRECTORY_SEPARATOR . $file;  
 
 
if (is_dir($filepath)):  
if ($recursive === true):  
$files = array_merge($files, owa_lib::listDir($filepath));  
endif;  
else:  
array_push($files, array('name' => $file, 'path' => $filepath));  
endif;  
}  
 
closedir($fh);  
 
else:  
// false if the function was called with an invalid non-directory argument  
$files = false;  
endif;  
 
return $files;  
 
}  
 
public static function makeDateArray($result, $format) {  
 
if (!empty($result)) {  
 
$timestamps = array();  
 
foreach ($result as $row) {  
 
$timestamps[]= mktime(0,0,0,$row['month'],$row['day'],$row['year']);  
}  
 
return owa_lib::makeDates($timestamps, $format);  
 
} else {  
 
return array();  
}  
 
}  
 
public static function makeDates($timestamps, $format) {  
 
sort($timestamps);  
 
$new_dates = array();  
 
foreach ($timestamps as $timestamp) {  
 
$new_dates[] = date($format, $timestamp);  
 
}  
 
return $new_dates;  
 
}  
 
public static function html2txt($document){  
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript  
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly  
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags  
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA  
);  
$text = preg_replace($search, '', $document);  
return $text;  
}  
 
public static function escapeNonAsciiChars($string) {  
 
return preg_replace('/[^(\x20-\x7F)]*/','', $string);  
}  
 
/**  
* Truncate string  
*  
* @param string $str  
* @param integer $length  
* @param string $trailing  
* @return string  
*/  
public static function truncate ($str, $length=10, $trailing='...') {  
 
// take off chars for the trailing  
$length-=strlen($trailing);  
if (strlen($str) > $length):  
// string exceeded length, truncate and add trailing dots  
return substr($str,0,$length).$trailing;  
else:  
// string was already short enough, return the string  
$res = $str;  
endif;  
 
return $res;  
}  
 
/**  
* Simple Password Encryption  
*  
* @param string $password  
* @return string  
*/  
public static function encryptPassword($password) {  
 
return md5(strtolower($password).strlen($password));  
}  
 
public static function timestampToYyyymmdd($timestamp = '') {  
 
if(empty($timestamp)) {  
$timestamp = time();  
}  
//print "before date";  
$yyyymmdd = date("Ymd", $timestamp);  
///print "after date";  
return $yyyymmdd;  
}  
 
public static function setContentTypeHeader($type = 'html') {  
 
if (!$type) {  
$type = 'html';  
}  
 
$content_types = array('html' => 'text/html',  
'xml' => 'text/xml',  
'json' => 'application/json',  
'jsonp' => 'application/json',  
'csv' => 'text/csv');  
 
if (array_key_exists($type, $content_types)) {  
$mime = $content_types[$type];  
header('Content-type: '.$mime);  
}  
}  
 
public static function array_values_assoc($assoc) {  
 
$values = array();  
 
foreach ($assoc as $k => $v) {  
 
if (!empty($v)) {  
$values[] = $v;  
}  
}  
 
return $values;  
}  
 
public static function prepareCurrencyValue($string) {  
 
return $string * 100;  
}  
 
public static function utf8Encode($string) {  
 
if ( owa_lib::checkForUtf8( $string ) ) {  
return $string;  
} else {  
if (function_exists('iconv')) {  
return iconv('UTF-8','UTF-8//TRANSLIT', $string);  
} else {  
// at least worth a try  
return utf8_encode($string);  
}  
}  
}  
 
public static function checkForUtf8($str) {  
 
if ( function_exists( 'mb_detect_encoding' ) ) {  
$cur_encoding = mb_detect_encoding( $str ) ;  
if ( $cur_encoding == "UTF-8" && mb_check_encoding( $str,"UTF-8" ) ) {  
return true;  
}  
} else {  
 
$len = strlen( $str );  
for( $i = 0; $i < $len; $i++ ) {  
 
$c = ord( $str[$i] );  
if ($c > 128) {  
 
if ( ( $c > 247 ) ) {  
return false;  
} elseif ( $c > 239 ) {  
$bytes = 4;  
} elseif ( $c > 223 ) {  
$bytes = 3;  
} elseif ( $c > 191 ) {  
$bytes = 2;  
} else {  
return false;  
}  
 
if ( ( $i + $bytes ) > $len ) {  
return false;  
}  
 
while ( $bytes > 1 ) {  
$i++;  
$b = ord( $str[$i] );  
if ( $b < 128 || $b > 191 ) {  
return false;  
}  
$bytes--;  
}  
}  
}  
return true;  
}  
}  
 
public static function formatCurrency($value, $local) {  
 
setlocale( LC_MONETARY, $local );  
$value = $value /100;  
return money_format( '%.2n',$value );  
}  
 
public static function crc32AsHex($string) {  
$crc = crc32($string);  
//$crc += 0x100000000;  
if ($crc < 0) {  
$crc = 0xFFFFFFFF + $crc + 1;  
}  
return dechex($crc);  
}  
 
public static function getLocalTimestamp($utc = '') {  
 
if ( ! $utc ) {  
$utc = time();  
}  
$local_timezone_offset = date('Z');  
$daylight_savings = date('I') * 3600;  
$local_time = $utc - $local_timezone_offset + $daylight_savings;  
return $local_time;  
}  
 
public static function sanitizeCookieDomain($domain) {  
 
$pos = strpos($domain, '.');  
 
//check for local host  
if ( strpos( $domain, 'localhost' ) ) {  
return false;  
 
// check for local domain  
} elseif ( $pos === false) {  
 
return false;  
 
// ah-ha a real domain  
} else {  
// Remove port information.  
$port = strpos( $domain, ':' );  
if ( $port ) {  
$domain = substr( $domain, 0, $port );  
}  
 
// check for leading period, add if missing  
$period = substr( $domain, 0, 1);  
if ( $period != '.' ) {  
$domain = '.'.$domain;  
}  
 
return $domain;  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Geo-location abstract class  
*  
* Looks up the geographic location of a request based on IP address lookups in a variety of  
* databses or web services.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_location {  
 
/**  
* City  
*  
* @var string  
*/  
var $city;  
 
/**  
* Country  
*  
* @var string  
*/  
var $country;  
 
/**  
* Latitude coordinates  
*  
* @var string  
*/  
var $latitude;  
 
/**  
* Longitude coordinates  
*  
* @var string  
*/  
var $longitude;  
 
/**  
* Location of concrete class plugins  
*  
* @var unknown_type  
*/  
var $plugin_dir;  
 
/**  
* Constructor  
*  
* @return owa_location  
*/  
function __construct() {  
 
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'pagination.php');  
require_once(OWA_BASE_CLASS_DIR.'timePeriod.php');  
 
/**  
* Metric  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_metric extends owa_base {  
 
/**  
* Current Time  
*  
* @var array  
*/  
var $time_now = array();  
 
/**  
* Data  
*  
* @var array  
*/  
var $data;  
 
/**  
* The params of the caller, either a report or graph  
*  
* @var array  
*/  
var $params = array();  
 
/**  
* The lables for calculated measures  
*  
* @var array  
*/  
var $labels = array();  
 
/**  
* Page results  
*  
* @var boolean  
*/  
var $page_results = false;  
 
/**  
* Data Access Object  
*  
* @var object  
*/  
var $db;  
 
var $_default_offset = 0;  
 
var $pagination;  
 
var $page;  
 
var $limit;  
 
var $order;  
 
var $table;  
 
var $select = array();  
 
var $time_period_constraint_format = 'timestamp';  
 
var $column;  
 
var $is_calculated = false;  
 
var $data_type;  
 
var $supported_data_types = array('percentage', 'decimal', 'integer', 'url', 'yyyymmdd', 'timestamp', 'string', 'currency');  
 
function __construct($params = array()) {  
 
if (!empty($params)) {  
$this->params = $params;  
}  
 
$this->db = owa_coreAPI::dbSingleton();  
 
$this->pagination = new owa_pagination;  
 
return parent::__construct();  
}  
 
 
/**  
* @depricated  
* @remove  
*/  
function applyOptions($params) {  
 
// apply constraints  
if (array_key_exists('constraints', $params)) {  
 
foreach ($params['constraints'] as $k => $v) {  
 
if(is_array($v)) {  
$this->setConstraint($k, $v[1], $v[0]);  
} else {  
$this->setConstraint($k, $value);  
}  
}  
}  
 
// apply limit  
if (array_key_exists('limit', $params)) {  
$this->setLimit($params['limit']);  
}  
 
// apply order  
if (array_key_exists('order', $params)) {  
$this->setOrder($params['order']);  
}  
 
// apply page  
if (array_key_exists('page', $params)) {  
$this->setOrder($params['page']);  
}  
 
// apply offset  
if (array_key_exists('offset', $params)) {  
$this->setOrder($params['offset']);  
}  
 
// apply format  
if (array_key_exists('format', $params)) {  
//$this->setFormat($params['format']);  
}  
 
// apply period  
if (array_key_exists('period', $params)) {  
$this->setFormat($params['period']);  
}  
 
// apply start date  
if (array_key_exists('startDate', $params)) {  
$this->setFormat($params['startDate']);  
}  
 
// apply end date  
if (array_key_exists('endDate', $params)) {  
$this->setFormat($params['endDate']);  
}  
}  
 
function setConstraint($name, $value, $operator = '') {  
 
if (empty($operator)):  
$operator = '=';  
endif;  
 
if (!empty($value)):  
$this->params['constraints'][$name] = array('operator' => $operator, 'value' => $value, 'name' => $name);  
endif;  
 
return;  
 
}  
 
function setConstraints($array) {  
 
if (is_array($array)) {  
 
if (is_array($this->params['constraints'])) {  
$this->params['constraints'] = array_merge($array, $this->params['constraints']);  
} else {  
$this->params['constraints'] = $array;  
}  
}  
}  
 
function setLimit($value) {  
 
if (!empty($value)):  
 
$this->limit = $value;  
 
endif;  
}  
 
function setOrder($value) {  
 
if (!empty($value)):  
 
$this->params['order'] = $value;  
 
endif;  
}  
 
function setSort($column, $order) {  
 
//$this->params['orderby'][] = array($this->getColumnName($column), $order);  
}  
 
function setSorts($array) {  
 
if (is_array($array)) {  
 
if (!empty($this->params['orderby'])) {  
$this->params['orderby'] = array_merge($array, $this->params['orderby']);  
 
} else {  
$this->params['orderby'] = $array;  
}  
 
}  
 
}  
 
function setPage($value) {  
 
if (!empty($value)):  
 
$this->page = $value;  
 
if (!empty($this->pagination)):  
$this->pagination->setPage($value);  
endif;  
 
endif;  
}  
 
 
function getConstraints() {  
 
return $this->params['constraints'];  
}  
 
function setOffset($value) {  
 
if (!empty($value)):  
$this->params['offset'] = $value;  
endif;  
}  
 
function setFormat($value) {  
if (!empty($value)):  
$this->params['result_format'] = $value;  
endif;  
}  
 
function setPeriod($value) {  
if (!empty($value)):  
$this->params['period'] = $value;  
endif;  
}  
 
function setTimePeriod($period_name = '', $startDate = null, $endDate = null, $startTime = null, $endTime = null) {  
 
if ($startDate && $endDate) {  
$period_name = 'date_range';  
$map = array('startDate' => $startDate, 'endDate' => $endDate);  
} elseif ($startTime && $endTime) {  
$period_name = 'time_range';  
$map = array('startTime' => $startTime, 'endTime' => $endTime);  
} else {  
$this->debug('no period params passed to owa_metric::setTimePeriod');  
return false;  
}  
 
$p = owa_coreAPI::supportClassFactory('base', 'timePeriod');  
 
$p->set($period_name, $map);  
 
$this->setPeriod($p);  
}  
 
function makeTimePeriod($period = '') {  
 
$start = $this->params['period']->startDate->get($this->time_period_constraint_format);  
$end = $this->params['period']->endDate->get($this->time_period_constraint_format);  
 
if (!empty($this->entity)) {  
$col = $this->entity->getTableAlias().'.'.$this->time_period_constraint_format;  
} else {  
// needed for backwards compatability  
$col = $this->time_period_constraint_format;  
}  
 
 
$this->params['constraints'][$col] = array('operator' => 'BETWEEN', 'value' => array('start' => $start, 'end' => $end));  
 
return;  
 
}  
 
function setStartDate($date) {  
if (!empty($date)):  
$this->params['startDate'] = $date;  
endif;  
}  
 
function setEndDate($date) {  
if (!empty($date)):  
$this->params['endDate'] = $date;  
endif;  
}  
 
/**  
* @depricated  
*/  
function generate($method = 'calculate') {  
 
$this->makeTimePeriod();  
 
$this->db->multiWhere($this->getConstraints());  
 
if (!empty($this->pagination)):  
$this->pagination->setLimit($this->limit);  
endif;  
 
// pass limit to db object if one exists  
if (!empty($this->limit)):  
$this->db->limit($this->limit);  
endif;  
 
// pass order to db object if one exists  
 
 
 
// pagination  
if (!empty($this->page)):  
$this->pagination->setPage($this->page);  
$offset = $this->pagination->calculateOffset();  
$this->db->offset($offset);  
endif;  
 
 
$results = $this->$method();  
 
if (!empty($this->pagination)):  
$this->pagination->countResults($results);  
endif;  
 
return $results;  
 
}  
 
/**  
* @depricated  
*/  
function generateResults() {  
 
// set period specific constraints  
$this->makeTimePeriod();  
// set constraints  
$this->db->multiWhere($this->getConstraints());  
// sets metric specific SQL  
$this->calculate();  
// generate paginated result set  
$rs = owa_coreAPI::supportClassFactory('base', 'paginatedResultSet');  
// pass limit to db object if one exists  
if (!empty($this->limit)) {  
$rs->setLimit($this->limit);  
}  
 
// pass limit to db object if one exists  
if (!empty($this->page)) {  
$rs->setPage($this->page);  
}  
 
// get results  
$rs->generate($this->db);  
 
// add labels  
$rs->setLabels($this->getLabels());  
 
// add period info  
$rs->setPeriodInfo($this->params['period']->getAllInfo());  
 
return $rs;  
}  
 
/**  
* @depricated  
*/  
function calculatePaginationCount() {  
 
if (method_exists($this, 'paginationCount')):  
$this->makeTimePeriod();  
 
$this->db->multiWhere($this->getConstraints());  
 
return $this->paginationCount();  
else:  
return false;  
endif;  
}  
 
/**  
* Set the labels of the measures  
*  
*/  
function setLabels($array) {  
 
$this->labels = $array;  
return;  
}  
 
/**  
* Sets an individual label  
* return the key so that it can be nested  
* @return $key string  
*/  
function addLabel($key, $label) {  
 
$this->labels[$key] = $label;  
return $key;  
}  
 
function getLabel($key = '') {  
 
if (!$key) {  
$key = $this->getName();  
}  
 
return $this->labels[$key];  
}  
 
/**  
* Sets an individual label  
* return the key so that it can be nested  
* @return $key string  
*/  
function setLabel($label) {  
 
$this->labels[$this->getName()] = $label;  
 
}  
 
/**  
* Retrieve the labels of the measures  
*  
*/  
function getLabels() {  
 
return $this->labels;  
 
}  
 
function getPagination() {  
 
$count = $this->calculatePaginationCount();  
$this->pagination->total_count = $count;  
return $this->pagination->getPagination();  
 
}  
 
function zeroFill(&$array) {  
 
// PHP 5 only function used here  
if (function_exists("array_walk_recursive")) {  
array_walk_recursive($array, array($this, 'addzero'));  
} else {  
owa_lib::array_walk_recursive($array, array(get_class($this).'Metric', 'addzero'));  
}  
 
return $array;  
 
}  
 
function addzero(&$v, $k) {  
 
if (empty($v)) {  
 
$v = 0;  
 
}  
 
return;  
}  
 
function getPeriod() {  
 
return $this->params['period'];  
}  
 
function getOrder() {  
 
if (array_key_exists('order', $this->params)) {  
return $this->params['order'];  
}  
}  
 
function getLimit() {  
 
return $this->limit;  
 
}  
 
function setEntity($name) {  
 
$this->entity = owa_coreAPI::entityFactory($name);  
}  
 
function getTableName() {  
 
return $this->entity->getTableName();  
}  
 
function getTableAlias() {  
 
return $this->entity->getTableAlias();  
}  
 
function setSelect($column, $as = '') {  
 
if (!$as) {  
 
$as = $this->getName();  
}  
 
$this->select = array($column, $as);  
}  
 
function getSelect() {  
 
return $this->select;  
}  
 
function setName($name) {  
 
$this->name = $name;  
}  
 
function getName() {  
 
return $this->name;  
}  
 
function getFormat() {  
 
if (array_key_exists('result_format', $this->params)) {  
return $this->params['result_format'];  
}  
}  
 
/**  
* Sets a metric's column  
*/  
function setColumn($col_name, $name = '') {  
 
if (!$name) {  
$name = $this->getName();  
}  
$this->column = $this->entity->getTableAlias().'.'.$col_name;  
$this->all_columns[$name] = $this->column;  
 
}  
 
/**  
* Gets a metric's column name  
*/  
function getColumn() {  
 
return $this->column;  
}  
 
function getEntityName() {  
return $this->entity->getName();  
}  
 
function isCalculated() {  
return $this->is_calculated;  
}  
 
function setDataType($string) {  
 
if (in_array($string, $this->supported_data_types)) {  
$this->data_type = $string;  
}  
 
}  
 
function getDataType() {  
return $this->data_type;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract Module Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_module extends owa_base {  
 
/**  
* Name of module  
*  
* @var string  
*/  
var $name;  
 
/**  
* Description of Module  
*  
* @var string  
*/  
var $description;  
 
/**  
* Version of Module  
*  
* @var string  
*/  
var $version;  
 
/**  
* Schema Version of Module  
*  
* @var string  
*/  
//var $schema_version = 1;  
 
/**  
* Name of author of module  
*  
* @var string  
*/  
var $author;  
 
/**  
* URL for author of module  
*  
* @var unknown_type  
*/  
var $author_url;  
 
/**  
* Wiki Page title. Used to generate link to OWA wiki for this module.  
*  
* Must be unique or else it will could clobber another wiki page.  
*  
* @var string  
*/  
var $wiki_title;  
 
/**  
* name used in display situations  
*  
* @var unknown_type  
*/  
var $display_name;  
 
/**  
* Array of event names that this module has handlers for  
*  
* @var array  
*/  
var $subscribed_events;  
 
/**  
* Array of link information for admin panels that this module implements.  
*  
* @var array  
*/  
var $admin_panels;  
 
/**  
* Array of navigation links that this module implements  
*  
* @var unknown_type  
*/  
var $nav_links;  
 
/**  
* Array of metric names that this module implements  
*  
* @var unknown_type  
*/  
var $metrics;  
 
/**  
* Array of graphs that are implemented by this module  
*  
* @var array  
*/  
var $graphs;  
 
/**  
* The Module Group that the module belongs to.  
*  
* This is used often to group a module's features or functions together in the UI  
*  
* @var string  
*/  
var $group;  
 
/**  
* Array of Entities that are implmented by the module  
*  
* @var array  
*/  
var $entities = array();  
 
/**  
* Required Schema Version  
*  
* @var array  
*/  
var $required_schema_version;  
 
/**  
* Available Updates  
*  
* @var array  
*/  
var $updates = array();  
 
/**  
* Event Processors Map  
*  
* @var array  
*/  
var $event_processors = array();  
 
/**  
* Dimensions  
*  
* @var array  
*/  
var $dimensions = array();  
 
/**  
* Dimensions  
*  
* @var array  
*/  
var $denormalizedDimensions = array();  
 
/**  
* cli_commands  
*  
* @var array  
*/  
var $cli_commands = array();  
 
/**  
* API Methods  
*  
* @var array  
*/  
var $api_methods = array();  
 
/**  
* Background Jobs  
*  
* @var array  
*/  
var $background_jobs = array();  
 
/**  
* Update from CLI Required flag  
*  
* Used by controllers to see if an update error was becuase it needs  
* to be applied from the command line instead of via the browser.  
*  
* @var boolean  
*/  
var $update_from_cli_required;  
 
/**  
* Constructor  
*  
*  
*/  
function __construct() {  
 
parent::__construct();  
 
$this->_registerEventHandlers();  
$this->_registerEventProcessors();  
$this->_registerEntities();  
}  
 
/**  
* Method for registering event processors  
*  
*/  
function _registerEventProcessors() {  
 
return false;  
}  
 
/**  
* Returns array of admin Links for this module to be used in navigation  
*  
* @access public  
* @return array  
*/  
function getAdminPanels() {  
 
return $this->admin_panels;  
}  
 
/**  
* Returns array of report links for this module that will be  
* used in report navigation  
*  
* @access public  
* @return array  
*/  
function getNavigationLinks() {  
 
return $this->nav_links;  
}  
 
/**  
* Abstract method for registering event handlers  
*  
* Must be defined by a concrete module class for any event handlers to be registered  
*  
* @access public  
* @return array  
*/  
function _registerEventHandlers() {  
 
return;  
}  
 
/**  
* Attaches an event handler to the event queue  
*  
* @param array $event_name  
* @param string $handler_name  
* @return boolean  
*/  
function registerEventHandler($event_name, $handler_name, $method = 'notify', $dir = 'handlers') {  
 
if (!is_object($handler_name)) {  
 
//$handler = &owa_lib::factory($handler_dir,'owa_', $handler_name);  
$handler_name = owa_coreAPI::moduleGenericFactory($this->name, $dir, $handler_name, $class_suffix = null, $params = '', $class_ns = 'owa_');  
}  
 
$eq = owa_coreAPI::getEventDispatch();  
$eq->attach($event_name, array($handler_name, $method));  
}  
 
/**  
* Attaches an event handler to the event queue  
*  
* @param array $event_name  
* @param string $handler_name  
* @return boolean  
*/  
function registerFilter($filter_name, $handler_name, $method, $priority = 10, $dir = 'filters') {  
 
if (!is_object($handler_name)) {  
 
//$handler = &owa_lib::factory($handler_dir,'owa_', $handler_name);  
$handler_name = owa_coreAPI::moduleGenericFactory($this->name, $dir, $handler_name, $class_suffix = null, $params = '', $class_ns = 'owa_');  
}  
 
$eq = owa_coreAPI::getEventDispatch();  
$eq->attachFilter($filter_name, array($handler_name, $method), $priority);  
}  
 
/**  
* Attaches an event handler to the event queue  
*  
* @param array $event_name  
* @param string $handler_name  
* @return boolean  
* @depricated  
*/  
function _addHandler($event_name, $handler_name) {  
 
return $this->registerEventHandler($event_name, $handler_name);  
 
}  
 
/**  
* Abstract method for registering administration/settings page  
*  
* @access public  
* @return array  
*/  
function registerAdminPanels() {  
 
return;  
}  
 
/**  
* Registers an admin panel with this module  
*  
*/  
function registerSettingsPanel($panel) {  
 
$this->admin_panels[] = $panel;  
 
return true;  
}  
 
/**  
* Registers an admin panel with this module  
* @depricated  
*/  
function addAdminPanel($panel) {  
 
return $this->registerSettingsPanel($panel);  
}  
 
/**  
* Registers Group Link with a particular View  
*  
*/  
function addNavigationLink($group, $subgroup = '', $ref, $anchortext, $order = 0, $priviledge = 'viewer') {  
 
$link = array('ref' => $ref,  
'anchortext' => $anchortext,  
'order' => $order,  
'priviledge' => $priviledge);  
 
if (!empty($subgroup)):  
$this->nav_links[$group][$subgroup]['subgroup'][] = $link;  
else:  
$this->nav_links[$group][$anchortext] = $link;  
endif;  
 
return;  
}  
 
/**  
* Abstract method for registering a module's entities  
*  
* This method must be defined in concrete module classes in order for entities to be registered.  
*/  
function _registerEntities() {  
 
return false;  
}  
 
function registerNavigation() {  
 
return false;  
}  
 
 
/**  
* Registers an Entity  
*  
* Can take an array of entities or just a single entity as a string.  
* Will add an enetiy to the module's entity array. Required for entity installation, etc.  
*  
* @param $entity_name array or string  
*/  
function registerEntity($entity_name) {  
 
if (is_array($entity_name)) {  
$this->entities = array_merge($this->entities, $entity_name);  
} else {  
$this->entities[] = $entity_name;  
}  
}  
 
/**  
* Registers Entity  
*  
* Depreicated see registerEntity  
*  
* @depricated  
*/  
function _addEntity($entity_name) {  
 
return $this->registerEntity($entity_name);  
}  
 
 
function getEntities() {  
 
return $this->entities;  
}  
 
/**  
* Installation method  
*  
* Creates database tables and sets schema version  
*  
*/  
function install() {  
 
$this->e->notice('Starting installation of module: '.$this->name);  
 
$errors = '';  
 
// Install schema  
if (!empty($this->entities)):  
 
foreach ($this->entities as $k => $v) {  
 
$entity = owa_coreAPI::entityFactory($this->name.'.'.$v);  
//$this->e->debug("about to execute createtable");  
$status = $entity->createTable();  
 
if ($status != true):  
$this->e->notice("Entity Installation Failed.");  
$errors = true;  
//return false;  
endif;  
 
}  
 
endif;  
 
// activate module and persist configuration changes  
if ($errors != true):  
 
// run post install hook  
$ret = $this->postInstall();  
 
if ($ret == true):  
$this->e->notice("Post install proceadure was a success.");;  
else:  
$this->e->notice("Post install proceadure failed.");  
endif;  
 
// save schema version to configuration  
$this->c->persistSetting($this->name, 'schema_version', $this->getRequiredSchemaVersion());  
//activate the module and save the configuration  
$this->activate();  
$this->e->notice("Installation complete.");  
return true;  
 
else:  
$this->e->notice("Installation failed.");  
return false;  
endif;  
 
}  
 
/**  
* Post installation hook  
*  
*/  
function postInstall() {  
 
return true;  
}  
 
function isCliUpdateModeRequired() {  
 
return $this->update_from_cli_required;  
}  
 
/**  
* Checks for and applies schema upgrades for the module  
*  
*/  
function update() {  
 
// list files in a directory  
$files = owa_lib::listDir(OWA_DIR.'modules'.DIRECTORY_SEPARATOR.$this->name.DIRECTORY_SEPARATOR.'updates', false);  
//print_r($files);  
 
$current_schema_version = $this->c->get($this->name, 'schema_version');  
 
// extract sequence  
foreach ($files as $k => $v) {  
// the use of %d casts the sequence number as an int which is critical for maintaining the  
// order of the keys in the array that we are going ot create that holds the update objs  
//$n = sscanf($v['name'], '%d_%s', $seq, $classname);  
$seq = substr($v['name'], 0, -4);  
 
settype($seq, "integer");  
 
if ($seq > $current_schema_version):  
 
if ($seq <= $this->required_schema_version):  
$this->updates[$seq] = owa_coreAPI::updateFactory($this->name, substr($v['name'], 0, -4));  
// if the cli update mode is required and we are not running via cli then return an error.  
owa_coreAPI::debug('cli update mode required: '.$this->updates[$seq]->isCliModeRequired());  
if ($this->updates[$seq]->isCliModeRequired() === true && !defined('OWA_CLI')) {  
//set flag in module  
$this->update_from_cli_required = true;  
owa_coreAPI::notice("Aborting update $seq. This update must be applied using the command line interface.");  
return false;  
}  
// set schema version from sequence number in file name. This ensures that only one update  
// class can ever be in use for a particular schema version  
$this->updates[$seq]->schema_version = $seq;  
endif;  
endif;  
 
}  
 
// sort the array  
ksort($this->updates, SORT_NUMERIC);  
 
//print_r(array_keys($this->updates));  
 
foreach ($this->updates as $k => $obj) {  
 
$this->e->notice(sprintf("Applying Update %d (%s)", $k, get_class($obj)));  
 
$ret = $obj->apply();  
 
if ($ret == true):  
$this->e->notice("Update Suceeded");  
else:  
$this->e->notice("Update Failed");  
return false;  
endif;  
}  
 
return true;  
}  
 
/**  
* Deactivates and removes schema for the module  
*  
*/  
function uninstall() {  
 
return;  
}  
 
/**  
* Places the Module into the active module list in the global configuration  
*  
*/  
function activate() {  
 
//if ($this->name != 'base'):  
 
$this->c->persistSetting($this->name, 'is_active', true);  
$this->c->save();  
$this->e->notice("Module $this->name activated");  
 
//endif;  
 
return;  
}  
 
/**  
* Deactivates the module by removing it from  
* the active module list in the global configuration  
*  
*/  
function deactivate() {  
 
if ($this->name != 'base'):  
 
$this->c->persistSetting($this->name, 'is_active', false);  
$this->c->save();  
 
endif;  
 
return;  
}  
 
/**  
* Checks to se if the schema is up to date  
*  
*/  
function isSchemaCurrent() {  
 
$current_schema = $this->getSchemaVersion();  
$required_schema = $this->getRequiredSchemaVersion();  
 
owa_coreAPI::debug("$this->name Schema version is $current_schema");  
owa_coreAPI::debug("$this->name Required Schema version is $required_schema");  
 
if ($current_schema >= $required_schema):  
return true;  
else:  
return false;  
endif;  
}  
 
function getSchemaVersion() {  
 
$current_schema = owa_coreAPI::getSetting($this->name, 'schema_version');  
 
if (empty($current_schema)) {  
$current_schema = 1;  
 
// if this is the base module then we need to let filters know to install the base schema  
if ($this->name === 'base') {  
// $s = owa_coreAPI::serviceSingleton();  
// $s->setInstallRequired();  
}  
}  
 
return $current_schema;  
}  
 
function getRequiredSchemaVersion() {  
 
return $this->required_schema_version;  
}  
 
/**  
* Registers updates  
*  
*/  
function _registerUpdates() {  
 
return;  
 
}  
 
/**  
* Adds an update class into the update array.  
* This should be used to within the _registerUpdates method or else  
* it will not get called.  
*  
*/  
function _addUpdate($sequence, $class) {  
 
$this->updates[$sequence] = $class;  
 
return true;  
}  
 
/**  
* Adds an event processor class to the processor array. This is used to determin  
* which class to use to process a particular event  
*/  
function addEventProcessor($event_type, $processor) {  
$this->event_processors[$event_type] = $processor;  
return;  
}  
 
function registerMetric($metric_name, $class_name, $params = array()) {  
 
$map = array('class' => $class_name, 'params' => $params);  
$this->metrics[$metric_name][] = $map;  
}  
 
/**  
* Register a dimension  
*  
* registers a dimension for use by metrics in producing results sets.  
*  
* @param $dim_name string  
* @param $entity string the entiy housing the dimension. uses module.name format  
* @param $column string the name of the column that represents the dimension  
* @param $family string the name of the group or family that this dimension belongs to. optional.  
* @param $description string a short description of this metric, used in various interfaces.  
* @param $label string the lable of the dimension  
* @param $foreign_key_name the name of the foreign key column that should  
* be used to relate the metric entity to the dimension's entity.  
* If one is not specfied, metrics will use any valid foreign key column they can find.  
* Specifying this is important when the same column in a table is used by  
* two different dimensions but the meaning of the column differs based on the value of the foreign key.  
* a good example is the page_title column in the documents table. It is used by three dimensions:  
* pageTitle, entryPageTitle, and existPageTitle.  
* @param $denormalized boolean flag marks the dimension as being denormalized into a fact table  
* as opposed to being housed in a related table.  
*/  
function registerDimension($dim_name, $entity, $column, $label = '', $family, $description = '', $foreign_key_name = '', $denormalized = false, $data_type = 'string') {  
 
$dim = array('family' => $family, 'name' => $dim_name, 'entity' => $entity, 'column' => $column, 'label' => $label, 'description' => $description, 'foreign_key_name' => $foreign_key_name, 'data_type' => $data_type, 'denormalized' => $denormalized);  
 
if ($denormalized) {  
$this->denormalizedDimensions[$dim_name][$entity] = $dim;  
} else {  
$this->dimensions[$dim_name] = $dim;  
}  
}  
 
function registerCliCommand($command, $class) {  
 
$this->cli_commands[$command] = $class;  
}  
 
function registerApiMethod($api_method_name, $user_function, $argument_names, $file = '', $required_capability = '') {  
 
$map = array('callback' => $user_function, 'args' => $argument_names, 'file' => $file);  
 
if ($required_capability) {  
$map['required_capability'] = $required_capability;  
}  
 
$this->api_methods[$api_method_name] = $map;  
}  
 
function registerImplementation($type, $name, $class_name, $file) {  
 
$s = owa_coreAPI::serviceSingleton();  
$class_info = array($class_name, $file);  
$s->setMapValue($type, $name, $class_info);  
}  
 
function registerBackgroundJob($name, $command, $cron_tab, $max_processes = 1) {  
 
$job = array('name' => $name,  
'cron_tab' => $cron_tab,  
'command' => $command,  
'max_processes' => $max_processes);  
 
$s = owa_coreAPI::serviceSingleton();  
$s->setMapValue('background_jobs', $name, $job);  
}  
}  
 
?>  
file:a/busui/owa/owa_mw.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
require_once('owa_env.php');  
require_once(OWA_BASE_CLASS_DIR.'client.php');  
 
/**  
* MediaWiki Caller Class  
*  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_mw extends owa_client {  
 
function __construct($config = null) {  
 
return parent::__construct($config);  
}  
 
function owa_mw($config = null) {  
 
return owa_mw::__construct($config);  
}  
 
/**  
* OWA Singleton Method  
*  
* Makes a singleton instance of OWA using the config array  
*/  
function singleton($config = null) {  
 
static $owa;  
 
if(!empty($owa)) {  
return $owa;  
} else {  
$owa = new owa_mw($config);  
return $owa;  
}  
}  
 
 
}  
 
?>  
file:a/busui/owa/owa_news.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_env.php');  
require_once(OWA_INCLUDE_DIR.'/lastRSS.php');  
require_once(OWA_BASE_DIR.'/owa_httpRequest.php');  
 
/**  
* Grabs the OWA News Feed from the OWA Blog.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_news extends lastRSS {  
 
/**  
* Configuration  
*  
* @var array  
*/  
var $config;  
 
/**  
* Error handler  
*  
* @var object  
*/  
var $e;  
 
var $crawler;  
 
function owa_news() {  
 
$c = &owa_coreAPI::configSingleton();  
$this->config = $c->fetch('base');  
$this->e = &owa_coreAPI::errorSingleton();  
$this->crawler = new owa_http;  
$this->crawler->read_timeout = 20;  
$this->cache_dir = '';  
$this->date_format = "F j, Y";  
$this->CDATA = 'content';  
$this->items_limit = 3;  
return;  
}  
 
/**  
* This is a redefined Parse function that uses Snoopy to fetch  
* the file instead of fopen.  
*  
* @param unknown_type $rss_url  
* @return unknown  
*/  
function Parse ($rss_url) {  
// Open and load RSS file  
 
$this->crawler->getRequest($rss_url);  
$rss_content = $this->crawler->response;  
 
if (!empty($rss_content)) {  
 
// Parse document encoding  
$result['encoding'] = $this->my_preg_match("'encoding=[\'\"](.*?)[\'\"]'si", $rss_content);  
// if document codepage is specified, use it  
if ($result['encoding'] != '')  
{ $this->rsscp = $result['encoding']; } // This is used in my_preg_match()  
// otherwise use the default codepage  
else  
{ $this->rsscp = $this->default_cp; } // This is used in my_preg_match()  
 
// Parse CHANNEL info  
preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);  
foreach($this->channeltags as $channeltag)  
{  
$temp = $this->my_preg_match("'<$channeltag.*?>(.*?)</$channeltag>'si", $out_channel[1]);  
if ($temp != '') $result[$channeltag] = $temp; // Set only if not empty  
}  
// If date_format is specified and lastBuildDate is valid  
if ($this->date_format != '' && ($timestamp = strtotime($result['lastBuildDate'])) !==-1) {  
// convert lastBuildDate to specified date format  
$result['lastBuildDate'] = date($this->date_format, $timestamp);  
}  
 
// Parse TEXTINPUT info  
preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);  
// This a little strange regexp means:  
// Look for tag <textinput> with or without any attributes, but skip truncated version <textinput /> (it's not beggining tag)  
if (isset($out_textinfo[2])) {  
foreach($this->textinputtags as $textinputtag) {  
$temp = $this->my_preg_match("'<$textinputtag.*?>(.*?)</$textinputtag>'si", $out_textinfo[2]);  
if ($temp != '') $result['textinput_'.$textinputtag] = $temp; // Set only if not empty  
}  
}  
// Parse IMAGE info  
preg_match("'<image.*?>(.*?)</image>'si", $rss_content, $out_imageinfo);  
if (isset($out_imageinfo[1])) {  
foreach($this->imagetags as $imagetag) {  
$temp = $this->my_preg_match("'<$imagetag.*?>(.*?)</$imagetag>'si", $out_imageinfo[1]);  
if ($temp != '') $result['image_'.$imagetag] = $temp; // Set only if not empty  
}  
}  
// Parse ITEMS  
preg_match_all("'<item(| .*?)>(.*?)</item>'si", $rss_content, $items);  
$rss_items = $items[2];  
$i = 0;  
$result['items'] = array(); // create array even if there are no items  
foreach($rss_items as $rss_item) {  
// If number of items is lower then limit: Parse one item  
if ($i < $this->items_limit || $this->items_limit == 0) {  
foreach($this->itemtags as $itemtag) {  
$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)</$itemtag>'si", $rss_item);  
if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty  
}  
// Strip HTML tags and other bullshit from DESCRIPTION  
if ($this->stripHTML && $result['items'][$i]['description'])  
$result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));  
// Strip HTML tags and other bullshit from TITLE  
if ($this->stripHTML && $result['items'][$i]['title'])  
$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));  
// If date_format is specified and pubDate is valid  
if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !==-1) {  
// convert pubDate to specified date format  
$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);  
}  
// Item counter  
$i++;  
}  
}  
 
$result['items_count'] = $i;  
return $result;  
}  
else // Error in opening return False  
{  
$this->e->notice('no rss content found at: '.$rss_url);  
return False;  
}  
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Abstract observer class, wraps PEAR Log's observer to add event type.  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_observer extends owa_base {  
 
/**  
* The type of event that an observer would want to hear about.  
*  
* @var array  
* @access private  
*/  
var $_event_type = array();  
 
var $id;  
 
/**  
* Event Message  
*  
* @var array  
*/  
var $m;  
 
/**  
* Creates a new basic Log_observer instance.  
*  
* @param integer $priority The highest priority at which to receive  
* log event notifications.  
*  
* @access public  
*/  
function __construct() {  
$this->id = md5(microtime());  
}  
 
function handleEvent($action) {  
 
$data = owa_coreAPI::performAction($action, array('event' => $this->m));  
return owa_coreAPI::debug(sprintf("Handled Event. Action: %s", $action));  
 
}  
 
function sendMail($email_address, $subject, $msg) {  
 
mail($email_address, $subject, $msg);  
owa_coreAPI::debug('Sent e-mail with subject of "'.$subject.'" to: '.$email_address);  
return;  
}  
 
}  
 
?>  
file:a/busui/owa/owa_php.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
require_once('owa_env.php');  
require_once(OWA_BASE_CLASS_DIR.'client.php');  
 
/**  
* OWA PHP Client  
*  
* Implements a PHP client for logging requests to OWA  
* Typical usage is:  
*  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_php extends owa_client {  
 
function __construct($config = null) {  
 
return parent::__construct($config);  
}  
 
/**  
* OWA Singleton Method  
*  
* Makes a singleton instance of OWA using the config array  
*/  
function singleton($config = null) {  
 
static $owa;  
 
if(!empty($owa)) {  
return $owa;  
} else {  
return new owa_php($config);  
}  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_adminController.php');  
 
/**  
* Abstract Report Controller Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
 
class owa_reportController extends owa_adminController {  
 
/**  
* Constructor  
*  
* @param array $params  
* @return  
*/  
function __construct($params) {  
 
$this->setControllerType('report');  
$this->_setCapability('view_reports');  
return parent::__construct($params);  
 
}  
 
/**  
* pre action  
*  
*/  
function pre() {  
 
// site lists  
$sites = owa_coreAPI::getSitesList();  
$this->set('sites', $sites);  
// set default siteId if none exists on request  
$site_id = $this->getParam('siteId');  
if ( ! $site_id ) {  
$site_id = $this->getParam('site_id');  
}  
if ( ! $site_id ) {  
$site_id = $sites[0]['site_id'];  
}  
$this->setParam('siteId', $site_id);  
 
// pass full set of params to view  
$this->data['params'] = $this->params;  
 
// set default period if necessary  
if (empty($this->params['period'])) {  
$this->params['period'] = 'last_seven_days';  
$this->set('is_default_period', true);  
}  
 
$this->setPeriod($this->getParam('period'));  
 
$this->setView('base.report');  
$this->setViewMethod('delegate');  
 
$this->dom_id = str_replace('.', '-', $this->getParam('do'));  
$this->data['dom_id'] = $this->dom_id;  
$this->data['do'] = $this->getParam('do');  
 
// setup tabs  
$siteId = $this->get('siteId');  
$gm = owa_coreAPI::supportClassFactory('base', 'goalManager', $siteId);  
 
$tabs = array();  
$site_usage = array(  
'tab_label' => 'Site Usage',  
'metrics' => 'visits,pagesPerVisit,visitDuration,bounceRate,uniqueVisitors',  
'sort' => 'visits-'  
);  
 
$tabs['site_usage'] = $site_usage;  
 
// ecommerce tab  
if ( owa_coreAPI::getSiteSetting( $this->getParam('siteId'), 'enableEcommerceReporting') ) {  
 
$ecommerce = array(  
'tab_label' => 'e-commerce',  
'metrics' => 'visits,transactions,transactionRevenue,revenuePerVisit,revenuePerTransaction,ecommerceConversionRate',  
'sort' => 'transactionRevenue-'  
);  
 
$tabs['ecommerce'] = $ecommerce;  
}  
$goal_groups = $gm->getActiveGoalGroups();  
 
if ( $goal_groups ) {  
foreach ($goal_groups as $group) {  
$goal_metrics = 'visits';  
$active_goals = $gm->getActiveGoalsByGroup($group);  
 
if ( $active_goals ) {  
 
foreach ($active_goals as $goal) {  
$goal_metrics .= sprintf(',goal%sCompletions', $goal);  
}  
}  
 
$goal_metrics .= ',goalValueAll';  
$goal_group = array(  
'tab_label' => $gm->getGoalGroupLabel($group),  
'metrics' => $goal_metrics,  
'sort' => 'goalValueAll-'  
);  
$name = 'goal_group_'.$group;  
$tabs[$name] = $goal_group;  
}  
}  
 
$this->set('tabs', $tabs);  
$this->set('tabs_json', json_encode($tabs));  
 
 
//$this->body->set('sub_nav', owa_coreAPI::getNavigation($this->get('nav_tab'), 'sub_nav'));  
$nav = owa_coreAPI::getGroupNavigation('Reports');  
 
if ( ! owa_coreAPI::getSiteSetting( $this->getParam( 'siteId' ), 'enableEcommerceReporting' ) ) {  
unset($nav['Ecommerce']);  
}  
 
$this->set('top_level_report_nav', $nav);  
 
}  
 
function post() {  
 
return;  
}  
 
function setTitle($title, $suffix = '') {  
 
$this->set('title', $title);  
$this->set('titleSuffix', $suffix);  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* OWA Request Params  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_requestContainer {  
 
var $cli_args;  
var $is_https;  
var $owa_params = array();  
var $cookies = array();  
var $owa_cookies = array();  
var $session = array();  
var $request = array();  
var $server;  
var $guid;  
var $state;  
var $request_type;  
 
/**  
* Singleton returns request params  
*  
* @return array  
* @todo DEPRICATED  
*/  
function &getInstance() {  
 
static $params;  
 
if(empty($params)):  
 
$params = owa_lib::getRequestParams();  
// Clean Input arrays  
$params = owa_lib::inputFilter($params);  
//strip all params that do not include the namespace  
$params = owa_lib::stripParams($params, owa_coreAPI::getSetting('base', 'ns'));  
// translate certain request variables that are reserved in javascript  
$params = owa_lib::rekeyArray($params, array_flip(owa_coreAPI::getSetting('base', 'reserved_words')));  
 
$params['guid'] = crc32(microtime().getmypid());  
 
return $params;  
 
else:  
 
return $params;  
 
endif;  
 
}  
 
function __construct() {  
 
$this->guid = crc32(microtime().getmypid());  
 
// CLI args  
if (array_key_exists('argv', $_SERVER)) {  
 
$this->cli_args = $_SERVER['argv'];  
}  
 
// php's server variables  
$this->server = $_SERVER;  
 
// files  
if (!empty($_FILES)) {  
$this->files = $_FILES;  
}  
 
// cookies  
if (!empty($_COOKIE)) {  
$this->cookies = $_COOKIE;  
$this->owa_cookies = owa_lib::stripParams($_COOKIE, owa_coreAPI::getSetting('base', 'ns'));  
// hack against other frameworks sanitizing cookie data and blowing away our '>' delimiter  
// this should be removed once all cookies are using json format.  
foreach ($this->owa_cookies as $k => $cookie) {  
if (strpos($cookie, '&gt;')) {  
$this->owa_cookies[$k] = str_replace("&gt;", ">", $cookie);  
}  
}  
}  
 
// cookies  
if (!empty($_SESSION)) {  
$this->session = $_SESSION;  
}  
 
/* STATE CONTAINER */  
 
// state  
$this->state = owa_coreAPI::supportClassFactory('base', 'state');  
// merges session  
if (!empty($this->session)) {  
$this->state->addStores(owa_lib::stripParams($this->session, owa_coreAPI::getSetting('base', 'ns')));  
}  
 
// merges cookies  
foreach ($this->owa_cookies as $k => $cookie) {  
 
$this->state->setInitialState($k, $cookie, 'cookie');  
}  
 
 
//print_r($this->state);  
// create request params from GET or POST or CLI args  
$params = array();  
 
if (!empty($_POST)) {  
// get params from _POST  
$params = $_POST;  
$this->request_type = 'post';  
} elseif (!empty($_GET)) {  
// get params from _GET  
$params = $_GET;  
$this->request_type = 'get';  
} elseif (!empty($this->cli_args)) {  
// get params from the command line args  
// $argv is a php super global variable  
 
for ($i=1; $i<count($this->cli_args);$i++) {  
$it = explode("=",$this->cli_args[$i]);  
 
if ( isset( $it[1] ) ) {  
$params[ $it[0] ] = $it[1];  
} else {  
$params[ $it[0] ] = '';  
}  
}  
 
$this->request_type = 'cli';  
}  
 
// merge in cookies into the request params  
if (!empty($_COOKIE)) {  
//$params = array_merge($params, $this->owa_cookies);  
}  
 
// Clean Input arrays  
$this->request = owa_lib::inputFilter($params);  
if (array_key_exists('owa_action', $this->request)) {  
 
$this->request['owa_action'] = owa_lib::fileInclusionFilter($this->request['owa_action']);  
}  
 
if (array_key_exists('owa_do', $this->request)) {  
 
$this->request['owa_do'] = owa_lib::fileInclusionFilter($this->request['owa_do']);  
}  
// strip owa namespace  
$this->owa_params = owa_lib::stripParams($this->request, owa_coreAPI::getSetting('base', 'ns'));  
// translate certain request variables that are reserved in javascript  
$this->owa_params = owa_lib::rekeyArray($this->owa_params, array_flip(owa_coreAPI::getSetting('base', 'reserved_words')));  
 
if(isset($_SERVER['HTTPS'])):  
$this->is_https = true;  
endif;  
 
return;  
 
}  
 
function getParam($name) {  
 
if (array_key_exists($name, $this->owa_params)) {  
return $this->owa_params[$name];  
} else {  
return false;  
}  
 
}  
 
function setParam($name, $value) {  
 
$this->owa_params[$name] = $value;  
return true;  
}  
 
function getCookie($name) {  
 
if (array_key_exists($name, $this->cookies)) {  
return $this->cookies[$name];  
} else {  
return false;  
}  
 
}  
 
function getRequestParam($name) {  
 
if (array_key_exists($name, $this->request)) {  
return $this->request[$name];  
} else {  
return false;  
}  
}  
 
function getAllRequestParams() {  
 
return $this->request;  
}  
 
function getAllOwaParams() {  
 
return $this->owa_params;  
}  
 
function mergeParams($params) {  
 
$this->owa_params = array_merge($this->owa_params, $params);  
return;  
}  
 
function getServerParam($name) {  
 
if (array_key_exists($name, $this->server)) {  
return $this->server[$name];  
} else {  
return false;  
}  
}  
 
function decodeRequestParams() {  
 
$params = array();  
// Apply caller specific params  
foreach ($this->owa_params as $k => $v) {  
if (is_array($v)) {  
array_walk_recursive($v, array($this, 'arrayUrlDecode'));  
$params[$k] = $v;  
} else {  
$params[$k] = urldecode($v);  
}  
}  
 
// clean params after decode  
$params = owa_lib::inputFilter($params);  
// replace owa params  
$this->owa_params = $params;  
//debug  
owa_coreAPI::debug('decoded OWA params: '. print_r($this->owa_params, true));  
return;  
 
}  
 
function arrayUrlDecode(&$val, $index) {  
urldecode($val);  
}  
 
function getOwaCookie($name) {  
 
if (array_key_exists($name, $this->owa_cookies)) {  
return $this->owa_cookies[$name];  
} else {  
return false;  
}  
 
}  
 
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
if (!class_exists('Template')) {  
require_once(OWA_INCLUDE_DIR.'template_class.php');  
}  
 
if (!class_exists('owa_lib')) {  
require_once(OWA_BASE_DIR.'/owa_lib.php');  
}  
 
if (!class_exists('owa_sanitize')) {  
require_once(OWA_BASE_CLASS_DIR.'sanitize.php');  
}  
 
/**  
* OWA Wrapper for template class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_template extends Template {  
 
/**  
* Configuration  
*  
* @var array  
*/  
var $config;  
 
var $theme_template_dir;  
 
var $module_local_template_dir;  
 
var $module_template_dir;  
 
var $e;  
 
var $period;  
 
/**  
* Params passed by calling caller  
*  
* @var array  
*/  
var $caller_params;  
 
function owa_template($module = null, $caller_params = array()) {  
 
$this->caller_params = $caller_params;  
 
$c = &owa_coreAPI::configSingleton();  
$this->config = $c->fetch('base');  
 
$this->e = &owa_coreAPI::errorSingleton();  
 
// set template dirs  
if(!empty($caller_params['module'])):  
$this->_setTemplateDir($module);  
else:  
$this->_setTemplateDir('base');  
endif;  
 
$this->time_now = owa_lib::time_now();  
 
return;  
}  
 
function _setTemplateDir($module) {  
 
// set module template dir  
$this->module_template_dir = OWA_DIR.'modules'.DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;  
 
// set module local template override dir  
$this->module_local_template_dir = $this->module_template_dir.'local'.DIRECTORY_SEPARATOR;  
 
// set theme template dir  
$this->theme_template_dir = OWA_THEMES_DIR.$this->config['theme'].DIRECTORY_SEPARATOR;  
 
return;  
}  
 
function getTemplatePath($module, $file) {  
 
$this->_setTemplateDir($module);  
 
if ($file == null) {  
owa_coreAPI::error('No template file was specified.');  
return false;  
} else {  
// check module's local modification template Directory  
if (file_exists($this->module_local_template_dir.$file)) {  
$fullfile = $this->module_local_template_dir.$file;  
 
// check theme's template Directory  
} elseif(file_exists($this->theme_template_dir.$file)) {  
$fullfile = $this->theme_template_dir.$file;  
 
// check module's template directory  
} elseif(file_exists($this->module_template_dir.$file)) {  
$fullfile = $this->module_template_dir.$file;  
 
// throw error  
} else {  
$this->e->err(sprintf('%s was not found in any template directory.', $file));  
return false;  
}  
return $fullfile;  
}  
 
 
 
}  
 
/**  
* Set the template file  
* @depricated  
* @param string $file  
*/  
function set_template($file = null) {  
 
if (!$file):  
owa_coreAPI::error('No template file was specified.');  
return false;  
else:  
// check module's local modification template Directory  
if (file_exists($this->module_local_template_dir.$file)):  
$this->file = $this->module_local_template_dir.$file;  
 
// check theme's template Directory  
elseif(file_exists($this->theme_template_dir.$file)):  
$this->file = $this->theme_template_dir.$file;  
 
// check module's template directory  
elseif(file_exists($this->module_template_dir.$file)):  
$this->file = $this->module_template_dir.$file;  
 
// throw error  
else:  
$this->e->err(sprintf('%s was not found in any template directory.', $file));  
return false;  
endif;  
 
return true;  
endif;  
}  
 
function setTemplateFile($module, $file) {  
 
//choose file  
$filepath = $this->getTemplatePath($module, $file);  
//set template  
if ($filepath) {  
$this->file = $filepath;  
}  
}  
 
/**  
* Truncate string  
*  
* @param string $str  
* @param integer $length  
* @param string $trailing  
* @return string  
*/  
function truncate ($str, $length=10, $trailing='...') {  
 
return owa_lib::truncate ($str, $length, $trailing);  
}  
 
function get_month_label($month) {  
 
return owa_lib::get_month_label($month);  
}  
 
/**  
* Chooses the right icon based on browser type  
*  
* @param unknown_type $browser_type  
* @return unknown  
*/  
function choose_browser_icon($browser_type) {  
 
switch (strtolower($browser_type)) {  
 
case "ie":  
$file = 'msie.png';  
$name = 'Microsoft Internet Explorer';  
break;  
case "internet explorer":  
$file = 'msie.png';  
$name = 'Microsoft Internet Explorer';  
break;  
case "firefox":  
$file = 'firefox.png';  
$name = 'Firefox';  
break;  
case "safari":  
$file = 'safari.png';  
$name = 'Safari';  
break;  
case "opera":  
$file = 'opera.png';  
$name = 'Opera';  
break;  
case "netscape":  
$file = 'netscape.png';  
$name = 'Netscape';  
break;  
case "mozilla":  
$file = 'mozilla.png';  
$name = 'Mozilla';  
break;  
case "konqueror":  
$file = 'kon.png';  
$name = 'Konqueror';  
break;  
case "camino":  
$file = 'camino.png';  
$name = 'Camino';  
break;  
case "aol":  
$file = 'aol.png';  
$name = 'AOL';  
break;  
case "default browser":  
$file = 'default_browser.png';  
$name = 'Unknown Browser';  
break;  
default:  
$name = 'Unknown Browser';  
$file = 'default_browser.png';  
 
}  
 
return sprintf('<img alt="%s" align="baseline" src="%s">', $name, $this->makeImageLink('base/i/'.$file));  
 
}  
 
function getBrowserIcon($browser_family, $size = '128x128', $module = 'base') {  
 
if ($browser_family) {  
$browser_family = strtolower($browser_family);  
}  
 
 
if (file_exists(OWA_MODULES_DIR.$module.'/i/browsers/'.$size.'/'.$browser_family.'.png')) {  
return $this->makeImageLink('base/i/browsers/'.$size.'/'.$browser_family.'.png');  
} else {  
return $this->makeImageLink('base/i/browsers/'.$size.'/default.png');  
}  
}  
 
 
function makeLinkQueryString($query_params) {  
 
$new_query_params = array();  
 
//Load params passed by caller  
if (!empty($this->caller_params)):  
foreach ($this->caller_params as $name => $value) {  
if (!empty($value)):  
$new_query_params[$name] = $value;  
endif;  
}  
endif;  
 
// Load overrides  
if (!empty($query_params)):  
foreach ($query_params as $name => $value) {  
if (!empty($value)):  
$new_query_params[$name] = $value;  
endif;  
}  
endif;  
 
// Construct GET request  
if (!empty($new_query_params)):  
foreach ($new_query_params as $name => $value) {  
if (!empty($value)):  
$get .= $name . "=" . $value . "&";  
endif;  
}  
endif;  
 
return $get;  
 
}  
 
/**  
* Makes navigation links by checking whether or not the view  
* that is rendering the template is not the view being refered to in the link.  
*  
* @param array navigation array  
*/  
function makeNavigation($nav, $id = '', $class = '', $li_template = '<LI class="%s"><a href="%s">%s</a></LI>', $li_class = '') {  
 
$ul = sprintf('<UL id="%s" class="%s">', $id, $class);  
 
if (!empty($nav)):  
 
$navigation = $ul;  
 
foreach($nav as $k => $v) {  
 
$navigation .= sprintf($li_template, $li_class, $this->makeLink(array('do' => $v['ref']), true), $v['anchortext']);  
 
}  
 
$navigation .= '</UL>';  
 
return $navigation;  
else:  
return false;  
endif;  
 
}  
 
function makeTwoLevelNav($links) {  
print_r($links);  
$navigation = '<UL id="report_top_level_nav_ul">';  
 
foreach($links as $k => $v) {  
 
if (!empty($v['subgroup'])):  
$sub_nav = $this->makeNavigation($v['subgroup']);  
 
$navigation .= sprintf('<LI class="drawer"><H2 class="nav_header"><a href="%s">%s</a></H2>%s</LI>',  
$this->makeLink(array('do' => $v['ref']), true),  
$v['anchortext'], $sub_nav);  
else:  
 
$navigation .= sprintf('<LI class="drawer"><H2 class="nav_header"><a href="%s">%s</a></H2></LI>',  
$this->makeLink(array('do' => $v['ref']), true),  
$v['anchortext']);  
 
endif;  
 
}  
 
$navigation .= '</UL>';  
 
return $navigation;  
 
}  
 
function daysAgo($time) {  
 
$now = mktime(23, 59, 59, $this->time_now['month'], $this->time_now['day'], $this->time_now['year']);  
 
$days = round(($now - $time) / (3600*24));  
 
switch ($days) {  
 
case 1:  
return $days . " day ago";  
 
default:  
return $days . " days ago";  
}  
 
}  
 
/**  
* @depricated  
* @todo remove  
*/  
function getAuthStatus() {  
 
if (!class_exists('owa_auth')) {  
require_once(OWA_BASE_DIR.'/owa_auth.php');  
}  
 
$auth = &owa_auth::get_instance();  
return $auth->auth_status;  
}  
 
function makeWikiLink($page) {  
 
return sprintf($this->config['owa_wiki_link_template'], $page);  
}  
 
/**  
* Returns Namespace value to template  
*  
* @return string  
*/  
function getNs() {  
 
return $this->config['ns'];  
}  
 
function makeParamString($params = array(), $add_state = false, $format = 'query', $namespace = true) {  
 
$all_params = array();  
 
// merge in state params  
if ($add_state) {  
$all_params = array_merge($all_params, $this->getAllStateParams());  
}  
//merge in params  
$all_params = array_merge($all_params, $params);  
 
switch($format) {  
 
case 'query':  
 
$get = '';  
 
$count = count($all_params);  
 
$i = 0;  
 
foreach ($all_params as $n => $v) {  
 
$get .= owa_coreAPI::getSetting('base','ns').$n.'='.$v;  
 
$i++;  
 
if ($i < $count):  
$get .= "&";  
endif;  
}  
 
$string= $get;  
 
break;  
 
case 'cookie':  
 
$string = owa_lib::implode_assoc('=>', '|||', $all_params);  
break;  
}  
 
 
return $string;  
 
}  
 
function getAllStateParams() {  
 
$all_params = array();  
 
if (!empty($this->caller_params['link_state'])) {  
$all_params = array_merge($all_params, $this->caller_params['link_state']);  
}  
 
// add in period properties if available  
$period = $this->get('timePeriod');  
 
if (!empty($period)) {  
$all_params = array_merge($all_params, $period->getPeriodProperties());  
//print_r($all_params);  
}  
 
return $all_params;  
}  
 
 
/**  
* Makes Links, adds state to links optionaly.  
*  
* @param array $params  
* @param boolean $add_state  
* @return string  
*/  
function makeLink($params = array(), $add_state = false, $url = '', $xml = false, $add_nonce = false) {  
 
$all_params = array();  
 
//Loads link state passed by caller  
if ($add_state == true) {  
if (!empty($this->caller_params['link_state'])) {  
$all_params = array_merge($all_params, $this->caller_params['link_state']);  
}  
 
// add in period properties if available  
$period = $this->get('timePeriod');  
 
if (!empty($period)) {  
$all_params = array_merge($all_params, $period->getPeriodProperties());  
 
}  
}  
 
// Load overrides  
if (!empty($params)) {  
$params = array_filter($params);  
$all_params = array_merge($all_params, $params);  
}  
 
// add nonce if called for  
if ($add_nonce) {  
if ( array_key_exists('do', $all_params) ) {  
$action = $all_params['do'];  
} elseif ( array_key_exists('action', $all_params) ) {  
$action = $all_params['action'];  
}  
 
$all_params['nonce'] = owa_coreAPI::createNonce($action);  
}  
 
$get = '';  
 
if (!empty($all_params)):  
 
$count = count($all_params);  
 
$i = 0;  
 
foreach ($all_params as $n => $v) {  
 
$get .= $this->config['ns'].$n.'='.$v;  
 
$i++;  
 
if ($i < $count):  
$get .= "&";  
endif;  
}  
endif;  
 
if (empty($url)):  
$url = $this->config['main_url'];  
endif;  
 
$link = sprintf($this->config['link_template'], $url, $get);  
 
if ($xml == true):  
$link = $this->escapeForXml($link);  
endif;  
 
return $link;  
 
}  
 
function escapeForXml($string) {  
 
$string = str_replace(array('&', '"', "'", '<', '>' ), array('&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;'), $string);  
// removes non-ascii chars  
$string = owa_lib::escapeNonAsciiChars($string);  
return $string;  
}  
 
function makeAbsoluteLink($params = array(), $add_state = false, $url = '', $xml = false) {  
 
if (empty($url)):  
$url = $this->config['main_absolute_url'];  
endif;  
 
return $this->makeLink($params, $add_state, $url, $xml);  
 
}  
 
function makeApiLink($params = array(), $add_state = false) {  
 
 
$url = $this->config['api_url'];  
 
return $this->makeLink($params, $add_state, $url);  
 
}  
 
 
function makeImageLink($path, $absolute = false) {  
 
if ($absolute === true) {  
$url = owa_coreAPI::getSetting('base', 'modules_url');  
} else {  
$url = owa_coreAPI::getSetting('base', 'modules_url');  
}  
 
return $url.$path;  
 
}  
 
function includeTemplate($file) {  
 
$this->set_template($file);  
include($this->file);  
return;  
 
}  
 
function setTemplate($file) {  
 
$this->set_template($file);  
return $this->file;  
 
}  
 
function getWidget($do, $params = array(), $wrapper = true, $add_state = true) {  
 
$final_params = array();  
 
if (empty($params)):  
$params = array();  
endif;  
 
$params['do'] = $do;  
 
if ($wrapper === true):  
$params['initial_view'] = true;  
$params['wrapper'] = true;  
elseif ($wrapper === 'inpage'):  
$params['initial_view'] = true;  
$params['wrapper'] = 'inpage';  
else:  
$params['wrapper'] = false;  
endif;  
 
// add state params into request params  
if ($add_state === true):  
$final_params = array_merge($final_params, $this->caller_params['link_state']);  
endif;  
 
// apply overides made via the template  
$final_params = array_merge($final_params, array_filter($params));  
 
return owa_coreAPI::performAction($do, $final_params);  
}  
 
function getInpageWidget($do, $params = array()) {  
 
return owa_template::getWidget($do, $params, 'inpage');  
 
}  
 
function getSparkline($metric, $metric_col, $period = '', $height = 25, $width = 250, $map = array(), $add_state = true) {  
 
$map['metric'] = $metric;  
$map['metric_col'] = $metric_col;  
$map['period'] = $period;  
$map['height'] = $height;  
$map['width'] = $width;  
return owa_template::getWidget('base.widgetSparkline', $map, false, $add_state);  
 
}  
 
function makeJson($array) {  
 
$reserved_words = owa_coreAPI::getSetting('base', 'reserved_words');  
 
$json = '{';  
 
foreach ($array as $k => $v) {  
 
if (is_object($v)) {  
if (method_exists($v, 'toString')) {  
$v = $v->toString();  
} else {  
$v = '';  
}  
 
}  
 
if (in_array($k, array_keys($reserved_words))) {  
$k = $reserved_words[$k];  
}  
 
$json .= sprintf('%s: "%s", ', $k, $v);  
 
}  
 
 
$json = substr($json, 0, -2);  
 
$json .= '}';  
 
return $json;  
 
}  
 
function headerActions() {  
 
return;  
}  
 
function footerActions() {  
 
return;  
}  
 
function makePagination($pagination, $map = array(), $add_state = true, $template = '') {  
 
$pages = '';  
//print_r($pagination);  
if ($pagination['max_page_num'] > 1) {  
 
$pages = '<div class="owa_pagination"><UL>';  
 
for ($i = 1; $i <= $pagination['max_page_num'];$i++) {  
 
if ($pagination['page_num'] != $i) {  
$new_map = array();  
$new_map = $map;  
$new_map['page'] = $i;  
$link = sprintf('<LI class="owa_reportPaginationControl"><a href="%s">%s</a></LI>',  
$this->makeLink($new_map, $add_state),  
$i);  
 
} else {  
 
$link = sprintf('<LI class="owa_reportPaginationControl">%s</LI>', $i);  
}  
 
$pages .= $link;  
}  
 
$pages .= '</UL></div>';  
$pages .= '<div style="clear:both;"></div>';  
}  
 
return $pages;  
}  
 
function makePaginationFromResultSet($pagination, $map = array(), $add_state = true, $template = '') {  
 
$pages = '';  
//print_r($pagination);  
//print $pagination->total_pages;  
 
if ($pagination->total_pages > 1) {  
 
$pages = '<div class="owa_pagination"><UL>';  
 
for ($i = 1; $i <= $pagination->total_pages;$i++) {  
 
if ($pagination->page != $i) {  
 
$new_map = array();  
 
if (is_array($map)) {  
$new_map = array_merge($map, $new_map);  
}  
 
$new_map['page'] = $i;  
 
$link = sprintf('<LI class="owa_reportPaginationControl"><a href="%s">%s</a></LI>',  
$this->makeLink($new_map, $add_state),  
$i);  
 
} else {  
 
$link = sprintf('<LI class="owa_reportPaginationControl">%s</LI>', $i);  
}  
 
$pages .= $link;  
}  
 
$pages .= '</UL></div>';  
 
 
 
}  
 
return $pages;  
}  
 
function get($name) {  
 
if (array_key_exists($name, $this->vars)) {  
return $this->vars[$name];  
} else {  
return false;  
}  
 
}  
 
function getValue( $key, $var) {  
 
if ( isset( $var ) && is_array( $var ) ) {  
if ( array_key_exists( $key, $var) ) {  
return $var[$key];  
}  
}  
}  
 
function substituteValue($string, $var_name) {  
 
$value = $this->get($var_name);  
 
if ($value) {  
 
return sprintf($string,$value);  
}  
}  
 
function makeNavigationMenu($links) {  
 
if (!empty($links)) {  
 
$t = new owa_template;  
$t->set('links', $links);  
$t->caller_params['link_state'] = $this->caller_params['link_state'];  
$t->set_template('report_nav.tpl');  
return $t->fetch();  
} else {  
 
return false;  
}  
 
}  
 
function displayChart($id, $data, $width = '100%', $height = '200px') {  
 
if (!empty($data)) {  
 
$t = new owa_template;  
$t->set('dom_id', $id.'Chart');  
$t->set('data', $data);  
$t->set('width', $width);  
$t->set('height', $height);  
$t->set_template('chart_dom.tpl');  
return $t->fetch();  
} else {  
 
return false;  
}  
}  
 
function displaySparkline($id, $data, $width = '100px', $height = '35px') {  
 
if (!empty($data)) {  
 
$data_string = implode(',', $data);  
 
$t = new owa_template;  
$t->set('dom_id', $id.'Sparkline');  
$t->set('data', $data_string);  
$t->set('width', $width);  
$t->set('height', $height);  
$t->set_template('sparkline_dom.tpl');  
return $t->fetch();  
 
} else {  
 
return false;  
}  
}  
 
function displaySeriesAsSparkline($name, $result_set_obj, $id = '') {  
 
if (!$id) {  
$id = rand();  
}  
 
$series = $result_set_obj->getSeries($name);  
 
if ($series) {  
echo $this->displaySparkline($id, $series);  
}  
}  
 
function makeTable($labels, $data, $table_class = '', $table_id = '', $is_sortable = true) {  
 
$t = new owa_template;  
 
if (!empty($table_id)) {  
$id = rand();  
}  
 
$t->set('table_id', $id.'Table');  
$t->set('data', $data);  
$t->set('labels', $labels);  
$t->set('class', $table_class);  
if ($is_sortable === true) {  
$t->set('sort_table_class', 'tablesorter');  
}  
 
$t->set_template('generic_table.tpl');  
 
return $t->fetch();  
 
}  
 
function subTemplate($template_name = '', $map = array(), $linkstate = array()) {  
 
$t = new owa_template;  
 
$t->set_template($template_name);  
 
foreach ($map as $k => $v) {  
 
$t->set($k, $v);  
}  
 
return $t->fetch();  
 
}  
 
function formatNumber($num, $decimal_places) {  
 
return number_format($num, $decimal_places,'.',',');  
}  
 
function getAvatarImage($email) {  
 
if (false != $email) {  
$url = sprintf("http://www.gravatar.com/avatar/%s?s=30", md5($email));  
} else {  
$url = $this->makeImageLink('base/i/default_user_50x50.png');  
}  
 
return $url;  
}  
 
function displayMetricInfobox($params = array()) {  
 
$t = new owa_template;  
 
if (!empty($dom_id)) {  
$dom_id = rand();  
}  
$params['do'] = 'getResultSet';  
$count = owa_coreAPI::executeApiCommand($params);  
$params['period'] = 'last_thirty_days';  
$params['dimensions'] = 'date';  
$trend = owa_coreAPI::executeApiCommand($params);  
$t->set('metric_name', $params['metrics']);  
$t->set('dom_id', $dom_id);  
$t->set('count', $count);  
$t->set('trend', $trend);  
$t->set_template('metricInfobox.php');  
 
return $t->fetch();  
 
}  
 
function renderDimension($template, $properties) {  
 
$t = new owa_template;  
$t->set('properties', $properties);  
$t->set_template($template);  
return $t->fetch();  
}  
 
/**  
* Creates a hidden nonce form field  
*  
* @param string $action the action that the nonce should be tied to.  
* @return string The html fragment  
*/  
function createNonceFormField($action) {  
 
return sprintf(  
'<input type="hidden" name="%snonce" value="%s">',  
owa_coreAPI::getSetting('base', 'ns'),  
owa_coreAPI::createNonce($action));  
}  
 
function makeNonceLink() {  
 
}  
 
/**  
* Outputs data into the template  
*  
* @param string $output The String to be output into the template  
* @param bool $sanitize Flag that will sanitize the output for display  
*/  
function out($output, $sanitize = true, $decode_special_entities = false) {  
 
if ( $sanitize ) {  
$output = owa_sanitize::escapeForDisplay($output);  
 
if ( $decode_special_entities ) {  
$output = strtr($output, array('&amp;' => '&'));  
}  
 
}  
 
echo $output;  
}  
 
function formatCurrency($value) {  
return owa_lib::formatCurrency( $value, owa_coreAPI::getSetting( 'base', 'currencyLocal' ) );  
}  
 
function getCurrentUser() {  
 
return owa_coreAPI::getCurrentUser();  
}  
}  
 
 
?>  
file:a/busui/owa/owa_view.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_template.php');  
require_once(OWA_BASE_CLASSES_DIR.'owa_requestContainer.php'); // ??  
 
/**  
* Abstract View Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_view extends owa_base {  
 
/**  
* Main view template object  
*  
* @var object  
*/  
var $t;  
 
/**  
* Body content template object  
*  
* @var object  
*/  
var $body;  
 
/**  
* Sub View object  
*  
* @var object  
*/  
var $subview;  
 
/**  
* Rednered subview  
*  
* @var string  
*/  
var $subview_rendered;  
 
/**  
* CSS file for main template  
*  
* @var unknown_type  
*/  
var $css_file;  
 
/**  
* The priviledge level required to access this view  
* @depricated  
* @var string  
*/  
var $priviledge_level;  
 
/**  
* Type of page  
*  
* @var unknown_type  
*/  
var $page_type;  
 
/**  
* Request Params  
*  
* @var unknown_type  
*/  
var $params;  
 
/**  
* Authorization object  
*  
* @var object  
*/  
var $auth;  
 
var $module; // set by factory.  
 
var $data;  
 
var $default_subview;  
 
var $is_subview;  
 
var $js = array();  
 
var $css = array();  
 
var $postProcessView = false;  
 
var $renderJsInline;  
 
/**  
* Constructor  
*  
*/  
function __construct($params = null) {  
 
parent::__construct($params);  
 
$this->t = new owa_template();  
$this->body = new owa_template($this->module);  
$this->setTheme();  
//header('Content-type: text/html; charset=utf-8');  
}  
 
/**  
* Assembles the view using passed model objects  
*  
* @param unknown_type $data  
* @return unknown  
*/  
function assembleView($data) {  
 
$this->e->debug('Assembling view: '.get_class($this));  
 
// set view name in template class. used for navigation.  
if (array_key_exists('view', $this->data)) {  
$this->body->caller_params['view'] = $this->data['view'];  
}  
 
if (array_key_exists('params', $this->data)):  
$this->body->set('params', $this->data['params']);  
endif;  
 
if (array_key_exists('subview', $this->data)):  
$this->body->caller_params['subview'] = $this->data['subview'];  
endif;  
 
// Assign status msg  
if (array_key_exists('status_msg', $this->data)):  
$this->t->set('status_msg', $this->data['status_msg']);  
endif;  
 
// get status msg from code passed on the query string from a redirect.  
if (array_key_exists('status_code', $this->data)):  
$this->t->set('status_msg', $this->getMsg($this->data['status_code']));  
endif;  
 
// set error msg directly if passed from constructor  
if (array_key_exists('error_msg', $this->data)):  
$this->t->set('error_msg', $this->data['error_msg']);  
endif;  
 
// authentication status  
if (array_key_exists('auth_status', $this->data)):  
$this->t->set('authStatus', $this->data['auth_status']);  
endif;  
 
// get error msg from error code passed on the query string from a redirect.  
if (array_key_exists('error_code', $this->data)):  
$this->t->set('error_msg', $this->getMsg($this->data['error_code']));  
endif;  
 
// load subview  
if (!empty($this->data['subview']) || !empty($this->default_subview)):  
// Load subview  
$this->loadSubView($this->data['subview']);  
endif;  
 
// construct main view. This might set some properties of the subview.  
if (method_exists($this, 'render')) {  
$this->render($this->data);  
} else {  
// old style  
$this->construct($this->data);  
}  
//array of errors usually used for field validations  
if (array_key_exists('validation_errors', $this->data)):  
$this->body->set('validation_errors', $this->data['validation_errors']);  
endif;  
 
// pagination  
if (array_key_exists('pagination', $this->data)):  
$this->body->set('pagination', $this->data['pagination']);  
endif;  
 
$this->_setLinkState();  
 
// assemble subview  
if (!empty($this->data['subview'])):  
 
// set view name in template. used for navigation.  
$this->subview->body->caller_params['view'] = $this->data['subview'];  
 
// Set validation errors  
$this->subview->body->set('validation_errors', $this->get('validation_errors'));  
 
// pagination  
if (array_key_exists('pagination', $this->data)):  
$this->subview->body->set('pagination', $this->data['pagination']);  
endif;  
 
if (array_key_exists('params', $this->data)):  
$this->subview->body->set('params', $this->data['params']);  
$this->subview->body->set('do', $this->data['params']['do']);  
endif;  
 
// Load subview  
$this->renderSubView($this->data);  
 
// assign subview to body template  
$this->body->set('subview', $this->subview_rendered);  
 
 
endif;  
 
// assign validation errors  
if (!empty($this->data['validation_errors'])) {  
$ves = new owa_template('base');  
$ves->set_template('error_validation_summary.tpl');  
$ves->set('validation_errors', $this->data['validation_errors']);  
$validation_errors_summary = $ves->fetch();  
$this->t->set('error_msg', $validation_errors_summary);  
}  
 
 
// fire post method  
$this->post();  
 
// assign css and js ellements if the view is not a subview.  
// subview css/js have been merged/pulls from subview and assigned here.  
if ($this->is_subview != true) {  
if (!empty($this->css)) {  
$this->t->set('css', $this->css);  
}  
 
if (!empty($this->js)) {  
$this->t->set('js', $this->js);  
}  
}  
 
//Assign body to main template  
$this->t->set('config', $this->config);  
 
//Assign body to main template  
$this->t->set('body', $this->body);  
 
if ($this->postProcessView === true){  
return $this->postProcess();  
} else {  
// Return fully asembled View  
return $this->t->fetch();  
}  
}  
 
/**  
* Abstract Alternative rendering method reuires the setting of $this->postProcessView to fire  
*  
*/  
function postProcess() {  
 
return false;  
}  
 
/**  
* Post method fired right before view is rendered and returned  
* as output  
*/  
function post() {  
 
return false;  
}  
 
 
/**  
* Sets the theme to be used by a view  
*  
*/  
function setTheme() {  
 
$this->t->set_template($this->config['report_wrapper']);  
 
return;  
}  
 
/**  
* Abstract method for assembling a view  
* @depricated  
* @param array $data  
*/  
function construct($data) {  
 
return;  
 
}  
 
/**  
* Assembles subview  
*  
* @param array $data  
*/  
function loadSubView($subview) {  
 
if (empty($subview)):  
if (!empty($this->default_subview)):  
$subview = $this->default_subview;  
$this->data['subview'] = $this->default_subview;  
else:  
return $this->e->debug("No Subview was specified by caller.");  
endif;  
endif;  
 
$this->subview = owa_coreAPI::subViewFactory($subview);  
//print_r($subview.'///');  
$this->subview->setData($this->data);  
 
return;  
 
}  
 
/**  
* Assembles subview  
*  
* @param array $data  
*/  
function renderSubView($data) {  
 
// Stores subview as string into $this->subview  
$this->subview_rendered = $this->subview->assembleSubView($data);  
 
// pull css and jas elements needed by subview  
$this->css = array_merge($this->css, $this->subview->css);  
$this->js = array_merge($this->js, $this->subview->js);  
 
return;  
 
}  
 
/**  
* Assembles the view using passed model objects  
*  
* @param unknown_type $data  
* @return unknown  
*/  
function assembleSubView($data) {  
 
// construct main view. This might set some properties of the subview.  
if (method_exists($this, 'render')) {  
$this->render($data);  
} else {  
// old style  
$this->construct($data);  
}  
 
$this->t->set_template('wrapper_subview.tpl');  
 
//Assign body to main template  
$this->t->set('body', $this->body);  
 
// Return fully asembled View  
$page = $this->t->fetch();  
 
return $page;  
 
}  
 
function setCss($path) {  
 
$url = owa_coreAPI::getSetting('base', 'modules_url').$path;  
$this->css[] = $url;  
return;  
}  
 
function setJs($name, $path, $version ='', $deps = array(), $ie_only = false) {  
 
if (empty($version)) {  
$version = OWA_VERSION;  
}  
 
$uid = $name.$version;  
 
$url = sprintf('%s?version=%s', owa_coreAPI::getSetting('base', 'modules_url').$path, $version);  
$this->js[$uid]['url'] = $url;  
 
// build file system path just in case we need to concatenate the JS into a single file.  
$fs_path = OWA_MODULES_DIR.$path;  
$this->js[$uid]['path'] = $fs_path;  
$this->js[$uid]['deps'] = $deps;  
$this->js[$uid]['version'] = $version;  
$this->js[$uid]['ie_only'] = $ie_only;  
 
return;  
}  
 
function concatinateJs() {  
 
$js_libs = '';  
 
foreach ($this->js as $lib) {  
 
$js_libs .= file_get_contents($lib['path']);  
$js_libs .= "\n\n";  
}  
 
$this->body->set('js_includes', $js_libs);  
 
return;  
 
}  
 
/**  
* Sets flag to tell view to render the JS inline as <SCRIPT> blocks  
* TODO: not yet implemented  
*/  
function renderJsInline() {  
 
$this->renderJsInLine = true;  
 
return;  
}  
 
 
/**  
* Sets the Priviledge Level required to access this view  
*  
* @param string $level  
*/  
function _setPriviledgeLevel($level) {  
 
$this->priviledge_level = $level;  
 
return;  
}  
 
/**  
* Sets the page type of this view. Used for tracking.  
*  
* @param string $page_type  
*/  
function _setPageType($page_type) {  
 
$this->page_type = $page_type;  
 
return;  
}  
 
 
/**  
* Sets properties that are needed to maintain state across most  
* report and widget requests. This is used by many template functions.  
*  
*/  
function _setLinkState() {  
 
// array of params to check  
$p = $this->get('params');  
 
// control array - will check for these params. If they exist it will return.  
$sp = array('period' => null,  
'startDate' => null,  
'endDate' => null,  
'siteId' => null,  
'startTime' => null,  
'endTime' => null);  
 
// result array  
$link_params = array();  
 
if (!empty($p)):  
$link_params = owa_lib::array_intersect_key($p, $sp);  
endif;  
 
// needed for forwards compatability with  
if (array_key_exists('site_id', $link_params) && !array_key_exists('siteId', $link_params)) {  
$link_params['siteId'] = $link_params['site_id'];  
}  
$this->t->caller_params['link_state'] = $link_params;  
$this->body->caller_params['link_state'] = $link_params;  
 
if(!empty($this->subview)) {  
$this->subview->body->caller_params['link_state'] = $link_params;  
}  
}  
 
function get($name) {  
 
if (array_key_exists($name, $this->data)) {  
return $this->data[$name];  
} else {  
return false;  
}  
 
}  
 
function set($name, $value) {  
 
$this->data[$name] = $value;  
return;  
}  
 
function setSubViewProperty($name, $value) {  
 
$this->subview->set($name, $value);  
return;  
}  
 
function getSubViewProperty($name) {  
return $this->subview->get($name);  
}  
 
function setData($data) {  
$this->data = $data;  
}  
 
function setTitle($title, $suffix = '') {  
 
$this->t->set('page_title', $title);  
$this->t->set('titleSuffix', $suffix);  
}  
 
function setContentTypeHeader($type = 'html') {  
 
owa_lib::setContentTypeHeader($type);  
}  
 
}  
 
/**  
* Generic HTMl Table View  
*  
* Will produce a generic html table  
*  
*/  
class owa_genericTableView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
 
}  
 
function render($data) {  
 
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('generic_table.tpl');  
 
if (!empty($data['labels'])):  
$this->body->set('labels', $data['labels']);  
$this->body->set('col_count', count($data['labels']));  
else:  
$this->body->set('labels', '');  
$this->body->set('col_count', count($data['rows'][0]));  
endif;  
 
if (!empty($data['rows'])):  
$this->body->set('rows', $data['rows']);  
$this->body->set('row_count', count($data['rows']));  
else:  
$this->body->set('rows', '');  
$this->body->set('row_count', 0);  
endif;  
 
if (array_key_exists('table_class', $data)):  
$this->body->set('table_class', $data['table_class']);  
else:  
$this->body->set('table_class', 'data');  
endif;  
 
if (array_key_exists('header_orientation', $data)):  
$this->body->set('header_orientation', $data['header_orientation']);  
else:  
$this->body->set('header_orientation', 'col');  
endif;  
 
if (array_key_exists('table_footer', $data)):  
$this->body->set('table_footer', $data['table_footer']);  
else:  
$this->body->set('table_footer', '');  
endif;  
 
if (array_key_exists('table_caption', $data)):  
$this->body->set('table_caption', $data['table_caption']);  
else:  
$this->body->set('table_caption', '');  
endif;  
 
if (array_key_exists('is_sortable', $data)) {  
if ($data['is_sortable'] != true) {  
$this->body->set('sort_table_class', '');  
}  
} else {  
$this->body->set('sort_table_class', 'tablesorter');  
}  
 
if (array_key_exists('table_row_template', $data)):  
$this->body->set('table_row_template', $data['table_row_template']);  
else:  
;  
endif;  
 
// show the no data error msg  
if (array_key_exists('show_error', $data)):  
$this->body->set('show_error', $data['show_error']);  
else:  
$this->body->set('show_error', true);  
endif;  
 
$this->body->set('table_id', str_replace('.', '-', $data['params']['do']).'-table');  
 
return;  
 
 
}  
 
}  
 
 
class owa_sparklineJsView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
 
}  
 
function render($data) {  
 
// load template  
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('sparklineJs.tpl');  
// set  
$this->body->set('widget', $data['widget']);  
$this->body->set('type', $data['type']);  
$this->body->set('height', $data['height']);  
$this->body->set('width', $data['width']);  
$this->body->set('values', $data['series']['values']);  
$this->body->set('dom_id', $data['dom_id'].rand());  
//$this->setJs("includes/jquery/jquery.sparkline.js");  
return;  
}  
 
 
}  
 
class owa_chartView extends owa_view {  
 
function __construct() {  
 
return parent::__construct();  
 
}  
 
function render($data) {  
 
// load template  
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('chart_dom.tpl');  
// set  
$this->body->set('widget', $this->get('widget'));  
$this->body->set('type', $this->get('type'));  
//print_r($this->get('height'));  
//height should be passed in as a request params as it sets the height of the actual flash object  
$this->body->set('height', $this->get('height'));  
//width should always be 100%  
$this->body->set('width', $this->get('width'));  
$this->body->set('data', $this->get('chart_data'));  
$this->body->set('dom_id', $this->get('dom_id').rand().'Chart');  
$this->setJs('swfobject', "base/js/includes/swfobject.js");  
return;  
}  
 
}  
 
class owa_mailView extends owa_view {  
 
// post office  
var $po;  
var $postProcessView = true;  
 
function __construct() {  
 
// make this a service  
require_once(OWA_BASE_CLASS_DIR.'mailer.php');  
$this->po = new owa_mailer;  
return parent::__construct();  
}  
 
function postProcess() {  
 
$this->po->mailer->Body = $this->t->fetch();  
 
if (!empty($data['plainTextView'])) {  
$this->po->mailer->AltBody = owa_coreAPI::displayView($this->get('plain_text_view'));  
}  
 
return $this->po->sendMail();  
}  
 
function setMailSubject($sbj) {  
 
$this->po->mailer->Subject = $sbj;  
return;  
}  
 
function addMailToAddress($email, $name = '') {  
 
if (empty($name)) {  
$name = $email;  
}  
 
$this->po->mailer->AddAddress($email, $name);  
return;  
}  
}  
 
class owa_adminView extends owa_view {  
 
var $postProcessView = true;  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function post() {  
 
$this->setJs('owa.admin.css');  
return;  
}  
 
 
}  
 
class owa_jsonView extends owa_view {  
 
function __construct() {  
 
if (!class_exists('Services_JSON')) {  
require_once(OWA_INCLUDE_DIR.'JSON.php');  
}  
 
return parent::__construct();  
}  
 
function render() {  
 
// load template  
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('json.php');  
 
$json = new Services_JSON();  
// set  
 
// look for jsonp callback  
$callback = $this->get('jsonpCallback');  
 
// if not found look on the request scope.  
if ( ! $callback ) {  
$callback = owa_coreAPI::getRequestParam('jsonpCallback');  
}  
 
if ( $callback ) {  
$body = sprintf("%s(%s);", $callback, $json->encode( $this->get( 'json' ) ) );  
} else {  
$body = $json->encode( $this->get( 'json' ) );  
}  
$this->body->set('json', $body);  
}  
}  
 
class owa_jsonResultsView extends owa_view {  
 
function __construct() {  
 
if (!class_exists('Services_JSON')) {  
require_once(OWA_INCLUDE_DIR.'JSON.php');  
}  
 
return parent::__construct();  
}  
 
function render() {  
 
// load template  
$this->t->set_template('wrapper_blank.tpl');  
$this->body->set_template('json.php');  
 
$json = new Services_JSON();  
// set  
$this->body->set('json', $json->encode($this->get('data')));  
}  
}  
 
?>  
file:a/busui/owa/owa_wp.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_CLASS_DIR.'client.php');  
 
/**  
* Wordpress Caller class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_wp extends owa_client {  
 
/**  
* Constructor  
*  
* @return owa_wp  
*/  
 
function __construct($config = null) {  
 
ob_start();  
 
return parent::__construct($config);  
 
}  
 
 
function add_link_tracking($link) {  
 
// check for presence of '?' which is not present under URL rewrite conditions  
 
if ($this->config['track_feed_links'] == true):  
 
if (strpos($link, "?") === false):  
// add the '?' if not found  
$link .= '?';  
endif;  
 
// setup link template  
$link_template = "%s&amp;%s=%s&amp;%s=%s";  
 
return sprintf($link_template,  
$link,  
$this->config['ns'].'medium',  
'feed',  
$this->config['ns'].$this->config['feed_subscription_param'],  
$_GET[$this->config['ns'].$this->config['feed_subscription_param']]);  
else:  
return;  
endif;  
}  
 
/**  
* Wordpress filter method. Adds tracking to feed links.  
*  
* @var string the feed link  
* @return string link string with special tracking id  
*/  
function add_feed_tracking($binfo) {  
 
if ($this->config['track_feed_links'] == true):  
$guid = crc32(getmypid().microtime());  
 
return $binfo."&amp;".$this->config['ns'].$this->config['feed_subscription_param']."=".$guid;  
else:  
return;  
endif;  
}  
}  
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
 
define('OWA_DTD_BIGINT', 'BIGINT');  
define('OWA_DTD_INT', 'INT');  
define('OWA_DTD_TINYINT', 'TINYINT(1)');  
define('OWA_DTD_TINYINT2', 'TINYINT(2)');  
define('OWA_DTD_TINYINT4', 'TINYINT(4)');  
define('OWA_DTD_SERIAL', 'SERIAL');  
define('OWA_DTD_PRIMARY_KEY', 'PRIMARY KEY');  
define('OWA_DTD_VARCHAR10', 'VARCHAR(10)');  
define('OWA_DTD_VARCHAR255', 'VARCHAR(255)');  
define('OWA_DTD_VARCHAR', 'VARCHAR(%s)');  
define('OWA_DTD_TEXT', 'MEDIUMTEXT');  
define('OWA_DTD_BOOLEAN', 'TINYINT(1)');  
define('OWA_DTD_TIMESTAMP', 'TIMESTAMP');  
define('OWA_DTD_BLOB', 'BLOB');  
define('OWA_DTD_INDEX', 'KEY');  
define('OWA_DTD_AUTO_INCREMENT', 'AUTO_INCREMENT');  
define('OWA_DTD_NOT_NULL', 'NOT NULL');  
define('OWA_DTD_UNIQUE', 'PRIMARY KEY(%s)');  
define('OWA_SQL_ADD_COLUMN', 'ALTER TABLE %s ADD %s %s');  
define('OWA_SQL_DROP_COLUMN', 'ALTER TABLE %s DROP %s');  
define('OWA_SQL_RENAME_COLUMN', 'ALTER TABLE %s CHANGE %s %s %s');  
define('OWA_SQL_MODIFY_COLUMN', 'ALTER TABLE %s MODIFY %s %s');  
define('OWA_SQL_RENAME_TABLE', 'ALTER TABLE %s RENAME %s');  
define('OWA_SQL_CREATE_TABLE', 'CREATE TABLE IF NOT EXISTS %s (%s) %s');  
define('OWA_SQL_DROP_TABLE', 'DROP TABLE IF EXISTS %s');  
define('OWA_SQL_INSERT_ROW', 'INSERT into %s (%s) VALUES (%s)');  
define('OWA_SQL_UPDATE_ROW', 'UPDATE %s SET %s %s');  
define('OWA_SQL_DELETE_ROW', "DELETE from %s %s");  
define('OWA_SQL_CREATE_INDEX', 'CREATE INDEX %s ON %s (%s)');  
define('OWA_SQL_DROP_INDEX', 'DROP INDEX %s ON %s');  
define('OWA_SQL_INDEX', 'INDEX (%s)');  
define('OWA_SQL_BEGIN_TRANSACTION', 'BEGIN');  
define('OWA_SQL_END_TRANSACTION', 'COMMIT');  
define('OWA_DTD_TABLE_TYPE', 'ENGINE = %s');  
define('OWA_DTD_TABLE_TYPE_DEFAULT', 'INNODB');  
define('OWA_DTD_TABLE_TYPE_DISK', 'INNODB');  
define('OWA_DTD_TABLE_TYPE_MEMORY', 'MEMORY');  
define('OWA_SQL_ALTER_TABLE_TYPE', 'ALTER TABLE %s ENGINE = %s');  
define('OWA_SQL_JOIN_LEFT_OUTER', 'LEFT OUTER JOIN');  
define('OWA_SQL_JOIN_LEFT_INNER', 'LEFT INNER JOIN');  
define('OWA_SQL_JOIN_RIGHT_OUTER', 'RIGHT OUTER JOIN');  
define('OWA_SQL_JOIN_RIGHT_INNER', 'RIGHT INNER JOIN');  
define('OWA_SQL_JOIN', 'JOIN');  
define('OWA_SQL_DESCENDING', 'DESC');  
define('OWA_SQL_ASCENDING', 'ASC');  
define('OWA_SQL_REGEXP', 'REGEXP');  
define('OWA_SQL_NOTREGEXP', 'NOT REGEXP');  
define('OWA_SQL_LIKE', 'LIKE');  
define('OWA_SQL_ADD_INDEX', 'ALTER TABLE %s ADD INDEX (%s) %s');  
define('OWA_DTD_CHARACTER_ENCODING_UTF8', 'utf8');  
define('OWA_DTD_TABLE_CHARACTER_ENCODING', 'CHARACTER SET = %s');  
 
 
/**  
* MySQL Data Access Class  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
class owa_db_mysql extends owa_db {  
 
function connect() {  
 
if (!$this->connection) {  
 
if ($this->getConnectionParam('persistant')) {  
 
$this->connection = mysql_pconnect(  
$this->getConnectionParam('host'),  
$this->getConnectionParam('user'),  
$this->getConnectionParam('password'),  
$this->getConnectionParam('open_new_connection')  
);  
 
} else {  
 
$this->connection = mysql_connect(  
$this->getConnectionParam('host'),  
$this->getConnectionParam('user'),  
$this->getConnectionParam('password'),  
$this->getConnectionParam('open_new_connection')  
);  
}  
 
$this->database_selection = mysql_select_db($this->getConnectionParam('name'), $this->connection);  
 
if (function_exists('mysql_set_charset')) {  
mysql_set_charset('utf8',$this->connection);  
} else {  
$this->query("SET NAMES 'utf8'");  
}  
 
}  
 
 
if (!$this->connection || !$this->database_selection) {  
$this->e->alert('Could not connect to database.');  
$this->connection_status = false;  
return false;  
} else {  
$this->connection_status = true;  
return true;  
}  
}  
 
 
/**  
* Database Query  
*  
* @param string $sql  
* @access public  
*  
*/  
function query($sql) {  
 
if ($this->connection_status == false):  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$this->connect();  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
endif;  
 
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$this->e->debug(sprintf('Query: %s', $sql));  
 
$this->result = '';  
$this->new_result = '';  
 
if (!empty($this->new_result)):  
mysql_free_result($this->new_result);  
endif;  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__, $sql);  
$result = @mysql_unbuffered_query($sql, $this->connection);  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
// Log Errors  
if (mysql_errno($this->connection)):  
$this->e->debug(sprintf('A MySQL error occured. Error: (%s) %s. Query: %s',  
mysql_errno($this->connection),  
htmlspecialchars(mysql_error($this->connection)),  
$sql));  
endif;  
owa_coreAPI::profile($this, __FUNCTION__, __LINE__);  
$this->new_result = $result;  
 
return $this->new_result;  
 
}  
 
function close() {  
 
@mysql_close($this->connection);  
return;  
 
}  
 
/**  
* Fetch result set array  
*  
* @param string $sql  
* @return array  
* @access public  
*/  
function get_results($sql) {  
 
if ($sql):  
$this->query($sql);  
endif;  
 
$num_rows = 0;  
 
while ( $row = @mysql_fetch_assoc($this->new_result) ) {  
$this->result[$num_rows] = $row;  
$num_rows++;  
}  
 
if ($this->result):  
 
return $this->result;  
 
else:  
return null;  
endif;  
}  
 
/**  
* Fetch Single Row  
*  
* @param string $sql  
* @return array  
*/  
function get_row($sql) {  
 
$this->query($sql);  
 
//print_r($this->result);  
$row = @mysql_fetch_assoc($this->new_result);  
 
return $row;  
}  
 
/**  
* Prepares and escapes string  
*  
* @param string $string  
* @return string  
*/  
function prepare($string) {  
 
if ($this->connection_status == false):  
$this->connect();  
endif;  
 
return mysql_real_escape_string($string, $this->connection);  
 
}  
}  
 
?>  
 
<?php  
// ...  
?>  
<?php  
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once(OWA_BASE_DIR.'/owa_error.php');  
 
/**  
* The Log_winstatic class is a concrete implementation of the Log abstract  
* class that logs messages to a separate browser window. This version is different  
* as it stores all output into a static variable that can then be printed after all  
* other headers are sent.  
*  
* The concept for this log handler is based on part by Craig Davis' article  
* entitled "JavaScript Power PHP Debugging:  
*  
* http://www.zend.com/zend/tut/tutorial-DebugLib.php  
*  
* @author Peter Adams <peter@openwebanalytics>  
* @since OWA 1.0.0  
* @package OWA  
*  
* @example winstatic.php Using the window handler.  
*/  
class Log_winstatic extends Log {  
 
 
/**  
* The name of the output window.  
* @var string  
* @access private  
*/  
var $_name = 'LogWindow';  
 
/**  
* The title of the output window.  
* @var string  
* @access private  
*/  
var $_title = 'Log Output Window';  
 
/**  
* Mapping of log priorities to colors.  
* @var array  
* @access private  
*/  
var $_colors = array(  
PEAR_LOG_EMERG => 'red',  
PEAR_LOG_ALERT => 'orange',  
PEAR_LOG_CRIT => 'yellow',  
PEAR_LOG_ERR => 'green',  
PEAR_LOG_WARNING => 'blue',  
PEAR_LOG_NOTICE => 'indigo',  
PEAR_LOG_INFO => 'violet',  
PEAR_LOG_DEBUG => 'black'  
);  
 
/**  
* String buffer that holds line that are pending output.  
* @var array  
* @access private  
*/  
var $_buffer = array();  
 
/**  
* Constructs a new Log_win object.  
*  
* @param string $name Ignored.  
* @param string $ident The identity string.  
* @param array $conf The configuration array.  
* @param int $level Log messages up to and including this level.  
* @access public  
*/  
function Log_winstatic($name, $ident = '', $conf = array(),  
$level = PEAR_LOG_DEBUG)  
{  
 
$this->_id = md5(microtime());  
$this->_name = $name;  
$this->_ident = $ident;  
$this->_mask = Log::UPTO($level);  
 
// fetches the static array that will store output to be printed later  
$this->debug = &owa_error::get_msgs();  
 
if (isset($conf['title'])) {  
$this->_title = $conf['title'];  
}  
if (isset($conf['colors']) && is_array($conf['colors'])) {  
$this->_colors = $conf['colors'];  
}  
 
register_shutdown_function(array(&$this, '_Log_winstatic'));  
}  
 
/**  
* Destructor  
*/  
function _Log_winstatic()  
{  
if ($this->_opened || (count($this->_buffer) > 0)) {  
$this->close();  
}  
}  
 
/**  
* The first time open() is called, it will open a new browser window and  
* prepare it for output.  
*  
* This is implicitly called by log(), if necessary.  
*  
* @access public  
*/  
function open()  
{  
if (!$this->_opened) {  
$win = $this->_name;  
 
if (!empty($this->_ident)) {  
$identHeader = "$win.document.writeln('<th>Ident</th>')";  
} else {  
$identHeader = '';  
}  
 
$this->debug .= <<< END_OF_SCRIPT  
<script language="JavaScript">  
$win = window.open('', '{$this->_name}', 'toolbar=no,scrollbars,width=600,height=400');  
$win.document.writeln('<html>');  
$win.document.writeln('<head>');  
$win.document.writeln('<title>{$this->_title}</title>');  
$win.document.writeln('<style type="text/css">');  
$win.document.writeln('body { font-family: monospace; font-size: 8pt; }');  
$win.document.writeln('td,th { font-size: 8pt; }');  
$win.document.writeln('td,th { border-bottom: #999999 solid 1px; }');  
$win.document.writeln('td,th { border-right: #999999 solid 1px; }');  
$win.document.writeln('</style>');  
$win.document.writeln('</head>');  
$win.document.writeln('<body>');  
$win.document.writeln('<table border="0" cellpadding="2" cellspacing="0">');  
$win.document.writeln('<tr><th>Time</th>');  
$identHeader  
$win.document.writeln('<th>Priority</th><th width="100%">Message</th></tr>');  
</script>  
END_OF_SCRIPT;  
$this->_opened = true;  
}  
 
return $this->_opened;  
}  
 
/**  
* Closes the output stream if it is open. If there are still pending  
* lines in the output buffer, the output window will be opened so that  
* the buffer can be drained.  
*  
* @access public  
*/  
function close()  
{  
/*  
* If there are still lines waiting to be written, open the output  
* window so that we can drain the buffer.  
*/  
if (!$this->_opened && (count($this->_buffer) > 0)) {  
$this->open();  
}  
 
if ($this->_opened) {  
$this->_writeln('</table>');  
$this->_writeln('</body></html>');  
$this->_opened = false;  
}  
 
return ($this->_opened === false);  
}  
 
/**  
* Writes a single line of text to the output window.  
*  
* @param string $line The line of text to write.  
*  
* @access private  
*/  
function _writeln($line)  
{  
/* Add this line to our output buffer. */  
$this->_buffer[] = $line;  
 
/* Buffer the output until this page's headers have been sent. */  
if (!headers_sent()) {  
// return;  
}  
 
/* If we haven't already opened the output window, do so now. */  
if (!$this->_opened && !$this->open()) {  
return false;  
}  
 
/* Drain the buffer to the output window. */  
$win = $this->_name;  
foreach ($this->_buffer as $line) {  
$this->debug .= "<script language='JavaScript'>\n";  
$this->debug .= "$win.document.writeln('" . addslashes($line) . "');\n";  
$this->debug .= "self.focus();\n";  
$this->debug .= "</script>\n";  
}  
 
/* Now that the buffer has been drained, clear it. */  
$this->_buffer = array();  
}  
 
/**  
* Logs $message to the output window. The message is also passed along  
* to any Log_observer instances that are observing this Log.  
*  
* @param mixed $message String or object containing the message to log.  
* @param string $priority The priority of the message. Valid  
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,  
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,  
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.  
* @return boolean True on success or false on failure.  
* @access public  
*/  
function log($message, $priority = null)  
{  
/* If a priority hasn't been specified, use the default value. */  
if ($priority === null) {  
$priority = $this->_priority;  
}  
 
/* Abort early if the priority is above the maximum logging level. */  
if (!$this->_isMasked($priority)) {  
return false;  
}  
 
/* Extract the string representation of the message. */  
$message = $this->_extractMessage($message);  
 
list($usec, $sec) = explode(' ', microtime());  
 
/* Build the output line that contains the log entry row. */  
$line = '<tr align="left" valign="top">';  
$line .= sprintf('<td>%s.%s</td>',  
strftime('%T', $sec), substr($usec, 2, 2));  
if (!empty($this->_ident)) {  
$line .= '<td>' . $this->_ident . '</td>';  
}  
$line .= '<td>' . ucfirst($this->priorityToString($priority)) . '</td>';  
$line .= sprintf('<td style="color: %s">%s</td>',  
$this->_colors[$priority],  
preg_replace('/\r\n|\n|\r/', '<br />', $message));  
$line .= '</tr>';  
 
$this->_writeln($line);  
 
$this->_announce(array('priority' => $priority, 'message' => $message));  
 
return true;  
}  
 
}  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Entity does not exist Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_entityDoesNotExistValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
 
function validate() {  
 
$entity = owa_coreAPI::entityFactory($this->getConfig('entity'));  
$entity->getByColumn($this->getConfig('column'), $this->getValues());  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$this->setErrorMessage('An entity with that value already exists.');  
}  
 
$id = $entity->get('id');  
 
// validation logic  
if (!empty($id)) {  
$this->hasError();  
}  
 
return;  
 
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Sub String Position Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_entityExistsValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function validate() {  
 
$entity = owa_coreAPI::entityFactory($this->getConfig('entity'));  
$entity->getByColumn($this->getConfig('column'), $this->getValues());  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$this->setErrorMessage('An entity with that value does not exist.');  
}  
 
$id = $entity->get('id');  
 
// validation logic  
if (empty($id)) {  
$this->hasError();  
}  
 
return;  
 
}  
 
}  
 
 
?>  
<?php  
// ...  
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Required Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_requiredValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function validate() {  
 
$value = $this->getValues();  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$this->setErrorMessage('Required field was empty.');  
}  
 
if (empty($value)):  
$this->hasError();  
endif;  
 
return;  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Required Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_stringLengthValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function validate() {  
 
$value = $this->getValues();  
$length = $this->getConfig('length');  
$operator = $this->getConfig('operator');  
 
// default error msg  
$errorMsg = $this->getErrorMsg();  
if (empty($errorMsg)) {  
 
$this->setErrorMessage(sprintf("Must be %s %d character in length.", $operator, $length));  
}  
 
switch ($operator) {  
 
case '<':  
if (strlen($value) >= $length) {  
$this->hasError();  
}  
break;  
 
case '>':  
if (strlen($value) <= $length) {  
$this->hasError();  
}  
break;  
 
case '<=':  
if (strlen($value) > $length) {  
$this->hasError();  
}  
break;  
 
case '>=':  
if (strlen($value) < $length) {  
$this->hasError();  
}  
break;  
 
}  
 
return;  
 
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* String Match Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_stringMatchValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
 
function validate() {  
 
$values_array = $this->getValues();  
$string1 = $values_array[0];  
$string2 = $values_array[1];  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$this->setErrorMessage('Strings do not match.');  
}  
 
// validation logic  
if ($string1 === $string2) {  
;  
} else {  
$this->hasError();  
}  
 
return;  
 
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Sub String Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_subStringMatchValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function validate() {  
 
$value = $this->getValues();  
$length = strlen($this->getConfig('match'));  
$str = substr($value, $this->getConfig('position'), $length);  
 
switch ($this->getConfig('operator')) {  
 
case "=":  
 
if ($str != $this->getConfig('match')) {  
$this->hasError();  
//print $str;  
}  
 
break;  
 
case "!=":  
 
if ($str === $this->getConfig('match')) {  
$this->hasError();  
}  
 
break;  
}  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$error = $this->setErrorMessage(sprintf('The string "%s" was found within the value at position %d', $this->getConfig('match'), $this->getConfig('position')));  
}  
}  
 
}  
 
 
?>  
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
/**  
* Sub String Position Validation  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.0.0  
*/  
 
class owa_subStringPositionValidation extends owa_validation {  
 
function __construct() {  
 
return parent::__construct();  
}  
 
function validate() {  
 
$value = $this->getValues();  
 
$substring = $this->getConfig('subString');  
$pos = strpos($value, $substring);  
 
$operator = $this->getConfig('operator');  
$position = $this->getConfig('position');  
 
switch ($operator) {  
 
case "=":  
 
if ($pos === $position) {  
;  
} else {  
$this->hasError();  
}  
 
 
break;  
 
case "!=":  
 
if ($pos === $position) {  
$this->hasError();  
}  
 
break;  
}  
 
$error = $this->getErrorMsg();  
 
if (empty($error)) {  
$error = $this->setErrorMessage(sprintf('The string "%s" was found within the value at position %d', $subString, $pos));  
}  
 
 
 
}  
 
}  
 
 
?>  
file:a/busui/owa/queue.php (deleted)
<?php  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2006 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
ignore_user_abort(true);  
set_time_limit(180);  
 
include_once('owa_env.php');  
require_once(OWA_BASE_DIR.'/owa_php.php');  
 
/**  
* Remote Event Queue Endpoint  
*  
* @author Peter Adams <peter@openwebanalytics.com>  
* @copyright Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>  
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0  
* @category owa  
* @package owa  
* @version $Revision$  
* @since owa 1.3.0  
*/  
 
$owa = new owa_php();  
if ( $owa->isEndpointEnabled( basename( __FILE__ ) ) ) {  
 
$owa->setSetting('base', 'is_remote_event_queue', true);  
$owa->e->debug($_POST);  
$raw_event = owa_coreAPI::getRequestParam('event');  
 
if ( $raw_event ) {  
 
$dispatch = owa_coreAPI::getEventDispatch();  
$event = unserialize( base64_decode( $raw_event ) );  
$owa->e->debug(print_r($event,true));  
$dispatch->asyncNotify($event);  
}  
 
} else {  
// unload owa  
$owa->restInPeace();  
}  
 
?>  
file:a/busui/owa/wp_plugin.php (deleted)
<?php  
 
/*  
Plugin Name: Open Web Analytics  
Plugin URI: http://www.openwebanalytics.com  
Description: This plugin enables Wordpress blog owners to use the Open Web Analytics Framework.  
Author: Peter Adams  
Version: v1.4.0  
Author URI: http://www.openwebanalytics.com  
*/  
 
//  
// Open Web Analytics - An Open Source Web Analytics Framework  
//  
// Copyright 2008 Peter Adams. All rights reserved.  
//  
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
//  
// $Id$  
//  
 
require_once('owa_env.php');  
 
// Filter and Action hook assignments  
add_action('template_redirect', 'owa_main');  
add_action('wp_head', 'owa_insertPageTags',100);  
add_filter('the_permalink_rss', 'owa_post_link');  
add_action('init', 'owa_handleSpecialActionRequest');  
add_filter('bloginfo_url', 'add_feed_sid');  
add_action('admin_menu', 'owa_dashboard_menu');  
add_action('comment_post', 'owa_logComment');  
add_action('transition_comment_status', 'owa_logCommentEdit');  
add_action('admin_menu', 'owa_options_menu');  
add_action('user_register', 'owa_userRegistrationActionTracker');  
add_action('wp_login', 'owa_userLoginActionTracker');  
add_action('profile_update', 'owa_userProfileUpdateActionTracker', 10,2);  
add_action('password_reset', 'owa_userPasswordResetActionTracker');  
add_action('trackback_post', 'owa_trackbackActionTracker');  
add_action('add_attachment', 'owa_newAttachmentActionTracker');  
add_action('edit_attachment', 'owa_editAttachmentActionTracker');  
add_action('transition_post_status', 'owa_postActionTracker', 10, 3);  
add_action('wpmu_new_blog', 'owa_newBlogActionTracker', 10, 5);  
// Installation hook  
register_activation_hook(__FILE__, 'owa_install');  
 
/////////////////////////////////////////////////////////////////////////////////  
 
/**  
* New Blog Action Tracker  
*/  
function owa_newBlogActionTracker($blog_id, $user_id, $domain, $path, $site_id) {  
 
$owa = owa_getInstance();  
$owa->trackAction('wordpress', 'Blog Created', $domain);  
}  
 
/**  
* Edit Post Action Tracker  
*/  
function owa_editPostActionTracker($post_id, $post) {  
 
// we don't want to track autosaves...  
if(wp_is_post_autosave($post)) {  
return;  
}  
 
$owa = owa_getInstance();  
$label = $post->post_title;  
$owa->trackAction('wordpress', $post->post_type.' edited', $label);  
}  
 
/**  
* Post Action Tracker  
*/  
function owa_postActionTracker($new_status, $old_status, $post) {  
 
// we don't want to track autosaves...  
if(wp_is_post_autosave($post)) {  
return;  
}  
 
if ($new_status === 'draft' && $old_status === 'draft') {  
return;  
} elseif ($new_status === 'publish' && $old_status != 'publish') {  
$action_name = $post->post_type.' publish';  
} elseif ($new_status === $old_status) {  
$action_name = $post->post_type.' edit';  
}  
 
if ($action_name) {  
$owa = owa_getInstance();  
owa_coreAPI::debug(sprintf("new: %s, old: %s, post: %s", $new_status, $old_status, print_r($post, true)));  
$label = $post->post_title;  
$owa->trackAction('wordpress', $action_name, $label);  
}  
}  
 
/**  
* New Attachment Action Tracker  
*/  
function owa_editAttachmentActionTracker($post_id) {  
 
$owa = owa_getInstance();  
$post = get_post($post_id);  
$label = $post->post_title;  
$owa->trackAction('wordpress', 'Attachment Edit', $label);  
}  
 
/**  
* New Attachment Action Tracker  
*/  
function owa_newAttachmentActionTracker($post_id) {  
 
$owa = owa_getInstance();  
$post = get_post($post_id);  
$label = $post->post_title;  
$owa->trackAction('wordpress', 'Attachment Created', $label);  
}  
 
/**  
* User Registration Action Tracker  
*/  
function owa_userRegistrationActionTracker($user_id) {  
 
$owa = owa_getInstance();  
$user = get_userdata($user_id);  
if (!empty($user->first_name) && !empty($user->last_name)) {  
$label = $user->first_name.' '.$user->last_name;  
} else {  
$label = $user->display_name;  
}  
 
$owa->trackAction('wordpress', 'User Registration', $label);  
}  
 
/**  
* User Login Action Tracker  
*/  
function owa_userLoginActionTracker($user_id) {  
 
$owa = owa_getInstance();  
$label = $user_id;  
$owa->trackAction('wordpress', 'User Login', $label);  
}  
 
/**  
* Profile Update Action Tracker  
*/  
function owa_userProfileUpdateActionTracker($user_id, $old_user_data = '') {  
 
$owa = owa_getInstance();  
$user = get_userdata($user_id);  
if (!empty($user->first_name) && !empty($user->last_name)) {  
$label = $user->first_name.' '.$user->last_name;  
} else {  
$label = $user->display_name;  
}  
 
$owa->trackAction('wordpress', 'User Profile Update', $label);  
}  
 
/**  
* Password Reset Action Tracker  
*/  
function owa_userPasswordResetActionTracker($user) {  
 
$owa = owa_getInstance();  
$label = $user->display_name;  
$owa->trackAction('wordpress', 'User Password Reset', $label);  
}  
 
/**  
* Trackback Action Tracker  
*/  
function owa_trackbackActionTracker($comment_id) {  
 
$owa = owa_getInstance();  
$label = $comment_id;  
$owa->trackAction('wordpress', 'Trackback', $label);  
}  
 
 
 
 
/**  
* Singleton Method  
*  
* Returns an instance of OWA  
*  
* @return $owa object  
*/  
function &owa_getInstance() {  
 
static $owa;  
 
if( empty( $owa ) ) {  
 
require_once(OWA_BASE_CLASSES_DIR.'owa_wp.php');  
 
// create owa instance w/ config  
$owa = new owa_wp();  
$owa->setSiteId( md5( get_settings( 'siteurl' ) ) );  
$owa->setSetting( 'base', 'report_wrapper', 'wrapper_wordpress.tpl' );  
$owa->setSetting( 'base', 'link_template', '%s&%s' );  
$owa->setSetting( 'base', 'main_url', '../wp-admin/index.php?page=owa' );  
$owa->setSetting( 'base', 'main_absolute_url', get_bloginfo('url').'/wp-admin/index.php?page=owa' );  
$owa->setSetting( 'base', 'action_url', get_bloginfo('url').'/index.php?owa_specialAction' );  
$owa->setSetting( 'base', 'api_url', get_bloginfo('url').'/index.php?owa_apiAction' );  
$owa->setSetting( 'base', 'is_embedded', true );  
// needed as old installs might have this turned on by default...  
$owa->setSetting( 'base', 'delay_first_hit', false );  
 
// Access WP current user object to check permissions  
$current_user = owa_getCurrentWpUser();  
//print_r($current_user);  
// Set OWA's current user info and mark as authenticated so that  
// downstream controllers don't have to authenticate  
$cu =&owa_coreAPI::getCurrentUser();  
 
if (isset($current_user->user_login)) {  
$cu->setUserData('user_id', $current_user->user_login);  
owa_coreAPI::debug("Wordpress User_id: ".$current_user->user_login);  
}  
 
if (isset($current_user->user_email)) {  
$cu->setUserData('email_address', $current_user->user_email);  
}  
 
if (isset($current_user->first_name)) {  
$cu->setUserData('real_name', $current_user->first_name.' '.$current_user->last_name);  
$cu->setRole(owa_translate_role($current_user->roles));  
}  
owa_coreAPI::debug("Wordpress User Role: ".print_r($current_user->roles, true));  
owa_coreAPI::debug("Wordpress Translated OWA User Role: ".$cu->getRole());  
$cu->setAuthStatus(true);  
}  
 
return $owa;  
}  
 
function owa_getCurrentWpUser() {  
 
// Access WP current user object to check permissions  
global $current_user;  
get_currentuserinfo();  
return $current_user;  
 
}  
 
// translates wordpress roles to owa roles  
function owa_translate_role($roles) {  
 
if (!empty($roles)) {  
 
if (in_array('administrator', $roles)) {  
$owa_role = 'admin';  
} elseif (in_array('editor', $roles)) {  
$owa_role = 'viewer';  
} elseif (in_array('author', $roles)) {  
$owa_role = 'viewer';  
} elseif (in_array('contributor', $roles)) {  
$owa_role = 'viewer';  
} elseif (in_array('subscriber', $roles)) {  
$owa_role = 'everyone';  
} else {  
$owa_role = 'everyone';  
}  
 
} else {  
$owa_role = 'everyone';  
}  
 
return $owa_role;  
}  
 
 
function owa_handleSpecialActionRequest() {  
 
$owa = owa_getInstance();  
owa_coreAPI::debug("hello from WP special action handler");  
return $owa->handleSpecialActionRequest();  
 
}  
 
function owa_logComment($id, $comment_data = '') {  
 
if ( $comment_data === 'approved' || $comment_data === 1 ) {  
 
$owa = owa_getInstance();  
$label = '';  
$owa->trackAction('wordpress', 'comment', $label);  
}  
}  
 
function owa_logCommentEdit($new_status, $old_status, $comment) {  
 
if ($new_status === 'approved') {  
if (isset($comment->comment_author)) {  
$label = $comment->comment_author;  
} else {  
$label = '';  
}  
 
$owa = owa_getInstance();  
$owa->trackAction('wordpress', 'comment', $label);  
}  
}  
 
/**  
* Prints helper page tags to the <head> of pages.  
*  
*/  
function owa_insertPageTags() {  
 
// Don't log if the page request is a preview - Wordpress 2.x or greater  
if (function_exists('is_preview')) {  
if (is_preview()) {  
return;  
}  
}  
 
$owa = owa_getInstance();  
 
$page_properties = $owa->getAllEventProperties($owa->pageview_event);  
$cmds = '';  
if ( $page_properties ) {  
$page_properties_json = json_encode( $page_properties );  
$cmds .= "owa_cmds.push( ['setPageProperties', $page_properties_json] );";  
}  
 
//$wgOut->addInlineScript( $cmds );  
 
$options = array( 'cmds' => $cmds );  
 
 
$owa->placeHelperPageTags(true, $options);  
}  
 
/**  
* This is the main logging controller that is called on each request.  
*  
*/  
function owa_main() {  
 
//global $user_level;  
 
$owa = owa_getInstance();  
owa_coreAPI::debug('wp main request method');  
 
//Check to see if this is a Feed Reeder  
if( $owa->getSetting('base', 'log_feedreaders') && is_feed() ) {  
$event = $owa->makeEvent();  
$event->setEventType('base.feed_request');  
$event->set('feed_format', $_GET['feed']);  
// Process the request by calling owa  
return $owa->trackEvent($event);  
}  
 
// Set the type and title of the page  
$page_type = owa_get_page_type();  
$owa->setPageType( $page_type );  
// Get Title of Page  
$owa->setPageTitle( owa_get_title( $page_type ) );  
}  
 
/**  
* Determines the title of the page being requested  
*  
* @param string $page_type  
* @return string $title  
*/  
function owa_get_title($page_type) {  
 
if ($page_type == "Home"):  
$title = get_bloginfo('name');  
elseif ($page_type == "Search Results"):  
$title = "Search Results for \"".$_GET['s']."\"";  
elseif ($page_type == "Page" || "Post"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Author"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Category"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Month"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Day"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Year"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Time"):  
$title = wp_title($sep = '', $display = 0);  
elseif ($page_type == "Feed"):  
$title = wp_title($sep = '', $display = 0);  
endif;  
 
return $title;  
}  
 
/**  
* Determines the type of page being requested  
*  
* @return string $type  
*/  
function owa_get_page_type() {  
 
if (is_home()):  
$type = "Home";  
elseif (is_attachment()):  
$type = "Attachment";  
elseif (is_page()):  
$type = "Page";  
// general page catch, should be after more specific post types  
elseif (is_single()):  
$type = "Post";  
elseif (is_feed()):  
$type = "Feed";  
elseif (is_author()):  
$type = "Author";  
elseif (is_category()):  
$type = "Category";  
elseif (is_search()):  
$type = "Search Results";  
elseif (is_month()):  
$type = "Month";  
elseif (is_day()):  
$type = "Day";  
elseif (is_year()):  
$type = "Year";  
elseif (is_time()):  
$type = "Time";  
elseif (is_tag()):  
$type = "Tag";  
elseif (is_tax()):  
$type = "Taxonomy";  
// general archive catch, should be after specific archive types  
elseif (is_archive()):  
$type = "Archive";  
else:  
$type = '(not set)';  
endif;  
 
return $type;  
}  
 
/**  
* Wordpress filter function adds a GUID to the feed URL.  
*  
* @param array $binfo  
* @return string $newbinfo  
*/  
function add_feed_sid($binfo) {  
 
$owa = owa_getInstance();  
 
$test = strpos($binfo, "feed=");  
 
if ($test == true):  
$newbinfo = $owa->add_feed_tracking($binfo);  
 
else:  
 
$newbinfo = $binfo;  
 
endif;  
 
return $newbinfo;  
 
}  
 
/**  
* Adds tracking source param to links in feeds  
*  
* @param string $link  
* @return string  
*/  
function owa_post_link($link) {  
 
$owa = owa_getInstance();  
 
return $owa->add_link_tracking($link);  
 
}  
 
/**  
* Schema and setting installation  
*  
*/  
function owa_install() {  
 
define('OWA_INSTALLING', true);  
 
$params = array();  
//$params['do_not_fetch_config_from_db'] = true;  
 
$owa = owa_getInstance($params);  
$owa->setSetting('base', 'cache_objects', false);  
 
$public_url = get_bloginfo('wpurl').'/wp-content/plugins/owa/';  
 
$install_params = array('site_id' => md5(get_settings('siteurl')),  
'name' => get_bloginfo('name'),  
'domain' => get_settings('siteurl'),  
'description' => get_bloginfo('description'),  
'action' => 'base.installEmbedded',  
'db_type' => 'mysql',  
'db_name' => DB_NAME,  
'db_host' => DB_HOST,  
'db_user' => DB_USER,  
'db_password' => DB_PASSWORD,  
'public_url' => $public_url  
);  
 
$owa->handleRequest($install_params);  
}  
 
/**  
* Adds Analytics sub tab to admin dashboard screens.  
*  
*/  
function owa_dashboard_menu() {  
 
if (function_exists('add_submenu_page')):  
add_submenu_page('index.php', 'OWA Dashboard', 'Analytics', 1, dirname(__FILE__), 'owa_pageController');  
endif;  
 
return;  
 
}  
 
/**  
* Produces the analytics dashboard  
*  
*/  
function owa_dashboard_report() {  
 
$owa = owa_getInstance();  
 
$params = array();  
$params['do'] = 'base.reportDashboard';  
echo $owa->handleRequest($params);  
 
return;  
 
}  
 
function owa_pageController() {  
 
$owa = owa_getInstance();  
 
$do = owa_coreAPI::getRequestParam('do');  
$params = array();  
if (empty($do)) {  
 
$params['do'] = 'base.reportDashboard';  
}  
 
echo $owa->handleRequest($params);  
 
}  
 
/**  
* Adds Options page to admin interface  
*  
*/  
function owa_options_menu() {  
 
if (function_exists('add_options_page')):  
add_options_page('Options', 'OWA', 8, basename(__FILE__), 'owa_options_page');  
endif;  
 
return;  
}  
 
/**  
* Generates Options Management Page  
*  
*/  
function owa_options_page() {  
 
$owa = owa_getInstance();  
 
$params = array();  
$params['view'] = 'base.options';  
$params['subview'] = 'base.optionsGeneral';  
echo $owa->handleRequest($params);  
 
return;  
}  
 
/**  
* Parses string to get the major and minor version of the  
* instance of wordpress that is running  
*  
* @param string $version  
* @return array  
*/  
function owa_parse_version($version) {  
 
$version_array = explode(".", $version);  
 
return $version_array;  
 
}  
 
?>  
file:a/busui/readme.txt (deleted)
# input location (via GPS or favourites or search) and destination (via searchable list, optional)  
# http://10.0.1.153:8765/json/boundboxstops?n=-35.27568499917103&e=149.1346514225006&s=-35.279495003493516  
&w=149.12622928619385&limit=50  
# http://10.0.1.153:8765/json/stoptrips?stop=43&time=64440 # recursively call to show all services nearby, sort by distance, need to filter by service period  
# Hey, can pick destination again from a list filtered to places these stops go if you're curious!  
# http://10.0.1.153:8765/json/tripstoptimes?trip=2139 # Can recursively call and parse based on intended destination to show ETA  
# http://10.0.1.153:8765/json/triprows?trip=2139 # For pretty maps  
 
have to do  
/usr/sbin/setsebool -P httpd_can_network_connect=1  
on fedora  
 
might need http://forum.jquery.com/topic/google-maps-inside-jquery-mobile  
 
some extras  
/json/routes = all routes  
/json/neareststops?lat/lng/number  
TODO  
Destinations  
Favourites  
OOP stops/routes  
Stop sorting/search-filter  
 
static maps  
https://code.google.com/apis/maps/documentation/staticmaps/  
http://www.multimap.com/openapidocs/1.2/web_service/staticmaps.htm  
http://dev.openstreetmap.de/staticmap/ (os @ http://sourceforge.net/projects/staticmaplite/)  
(php and open source @ http://trac.openstreetmap.org/browser/sites/other/StaticMap?rev=16348)  
http://pafciu17.dev.openstreetmap.org/  
 
file:a/busui/routeList.php (deleted)
<?php  
include('common.inc.php');  
include_header("Routes","routeList");  
echo'  
<div data-role="navbar">  
<ul>  
<li><a href="routeList.php">By Final Destination...</a></li>  
<li><a href="routeList.php?bynumber=yes">By Number... </a></li>  
<li><a href="routeList.php?bysuburb=yes">By Suburb... </a></li>  
<li><a href="routeList.php?nearby=yes">Nearby... </a></li>  
</ul>  
</div>  
';  
echo ' <ul data-role="listview" data-inset="true">';  
$url = $APIurl."/json/routes";  
$contents = json_decode(getPage($url));  
debug(print_r($contents,true));  
 
function printRoutes($routes){  
foreach($routes as $row) {  
echo '<li>'.$row[1].' <a href="trip.php?routeid='.$row[0].'">'.$row[2]." (".ucwords($row[3]).")</a></li>\n";  
}  
}  
 
if ($_REQUEST['bynumber']) {  
$routeSeries = Array();  
$seriesRange = Array();  
foreach ($contents as $key => $row) {  
foreach (explode(" ",$row[1]) as $routeNumber ) {  
$seriesNum = substr($routeNumber, 0, -1)."0";  
if ($seriesNum == "0") $seriesNum = $routeNumber;  
$finalDigit = substr($routeNumber, sizeof($routeNumber)-1, 1);  
if (isset($seriesRange[$seriesNum])) {  
if ($finalDigit < $seriesRange[$seriesNum]['max'])  
$seriesRange[$seriesNum]['max'] = $routeNumber;  
if ($finalDigit > $seriesRange[$seriesNum]['min'])  
$seriesRange[$seriesNum]['min'] = $routeNumber;  
} else {  
$seriesRange[$seriesNum]['max'] = $routeNumber;  
$seriesRange[$seriesNum]['min'] = $routeNumber;  
}  
$routeSeries[$seriesNum][$seriesNum."-".$row[1]."-".$row[0]] = $row;  
}  
}  
ksort($routeSeries);  
ksort($seriesRange);  
echo '<div class="noscriptnav"> Go to route numbers: ';  
foreach ($seriesRange as $series => $range)  
{  
if ($range['min'] == $range['max']) echo "<a href=\"#$series\">$series</a>&nbsp;";  
else echo "<a href=\"#$series\">{$range['min']}-{$range['max']}</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
foreach ($routeSeries as $series => $routes)  
{  
echo '<a name="'.$series.'"></a>';  
if ($series <= 9) echo '<li>'.$series."<ul>\n";  
else echo "<li>{$seriesRange[$series]['min']}-{$seriesRange[$series]['max']}<ul>\n";  
printRoutes($routes);  
echo "</ul></li>\n";  
}  
} else {  
foreach ($contents as $key => $row) {  
$routeDestinations[$row[2]][] = $row;  
}  
echo '<div class="noscriptnav"> Go to Destination: ';  
foreach(ksort($routeDestinations) as $destination => $routes)  
{  
echo "<a href=\"#$destination\">$destination</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
foreach ($routeDestinations as $destination => $routes)  
{  
echo '<a name="'.$destination.'"></a>';  
echo '<li>'.$destination."... <ul>\n";  
printRoutes($routes);  
echo "</ul></li>\n";  
}  
}  
echo "</ul>\n";  
 
 
include_footer();  
?>  
 
#!/usr/bin/python2.5  
 
# Copyright (C) 2007 Google Inc.  
#  
# Licensed under the Apache License, Version 2.0 (the "License");  
# you may not use this file except in compliance with the License.  
# You may obtain a copy of the License at  
#  
# http://www.apache.org/licenses/LICENSE-2.0  
#  
# Unless required by applicable law or agreed to in writing, software  
# distributed under the License is distributed on an "AS IS" BASIS,  
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
# See the License for the specific language governing permissions and  
# limitations under the License.  
 
"""  
An example application that uses the transitfeed module.  
 
You must provide a Google Maps API key.  
"""  
 
 
import BaseHTTPServer, sys, urlparse  
import bisect  
from gtfsscheduleviewer.marey_graph import MareyGraph  
import gtfsscheduleviewer  
import mimetypes  
import os.path  
import re  
import signal  
import simplejson  
import socket  
import time  
import transitfeed  
from transitfeed import util  
import urllib  
 
 
# By default Windows kills Python with Ctrl+Break. Instead make Ctrl+Break  
# raise a KeyboardInterrupt.  
if hasattr(signal, 'SIGBREAK'):  
signal.signal(signal.SIGBREAK, signal.default_int_handler)  
 
 
mimetypes.add_type('text/plain', '.vbs')  
 
 
class ResultEncoder(simplejson.JSONEncoder):  
def default(self, obj):  
try:  
iterable = iter(obj)  
except TypeError:  
pass  
else:  
return list(iterable)  
return simplejson.JSONEncoder.default(self, obj)  
 
# Code taken from  
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425210/index_txt  
# An alternate approach is shown at  
# http://mail.python.org/pipermail/python-list/2003-July/212751.html  
# but it requires multiple threads. A sqlite object can only be used from one  
# thread.  
class StoppableHTTPServer(BaseHTTPServer.HTTPServer):  
def server_bind(self):  
BaseHTTPServer.HTTPServer.server_bind(self)  
self.socket.settimeout(1)  
self._run = True  
 
def get_request(self):  
while self._run:  
try:  
sock, addr = self.socket.accept()  
sock.settimeout(None)  
return (sock, addr)  
except socket.timeout:  
pass  
 
def stop(self):  
self._run = False  
 
def serve(self):  
while self._run:  
self.handle_request()  
 
 
def StopToTuple(stop):  
"""Return tuple as expected by javascript function addStopMarkerFromList"""  
return (stop.stop_id, stop.stop_name, float(stop.stop_lat),  
float(stop.stop_lon), stop.location_type, stop.stop_code)  
def StopZoneToTuple(stop):  
"""Return tuple as expected by javascript function addStopMarkerFromList"""  
return (stop.stop_id, stop.stop_name, float(stop.stop_lat),  
float(stop.stop_lon), stop.location_type, stop.stop_code, stop.zone_id)  
 
class ScheduleRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):  
def do_GET(self):  
scheme, host, path, x, params, fragment = urlparse.urlparse(self.path)  
parsed_params = {}  
for k in params.split('&'):  
k = urllib.unquote(k)  
if '=' in k:  
k, v = k.split('=', 1)  
parsed_params[k] = unicode(v, 'utf8')  
else:  
parsed_params[k] = ''  
 
if path == '/':  
return self.handle_GET_home()  
 
m = re.match(r'/json/([a-z]{1,64})', path)  
if m:  
handler_name = 'handle_json_GET_%s' % m.group(1)  
handler = getattr(self, handler_name, None)  
if callable(handler):  
return self.handle_json_wrapper_GET(handler, parsed_params)  
 
# Restrict allowable file names to prevent relative path attacks etc  
m = re.match(r'/file/([a-z0-9_-]{1,64}\.?[a-z0-9_-]{1,64})$', path)  
if m and m.group(1):  
try:  
f, mime_type = self.OpenFile(m.group(1))  
return self.handle_static_file_GET(f, mime_type)  
except IOError, e:  
print "Error: unable to open %s" % m.group(1)  
# Ignore and treat as 404  
 
m = re.match(r'/([a-z]{1,64})', path)  
if m:  
handler_name = 'handle_GET_%s' % m.group(1)  
handler = getattr(self, handler_name, None)  
if callable(handler):  
return handler(parsed_params)  
 
return self.handle_GET_default(parsed_params, path)  
 
def OpenFile(self, filename):  
"""Try to open filename in the static files directory of this server.  
Return a tuple (file object, string mime_type) or raise an exception."""  
(mime_type, encoding) = mimetypes.guess_type(filename)  
assert mime_type  
# A crude guess of when we should use binary mode. Without it non-unix  
# platforms may corrupt binary files.  
if mime_type.startswith('text/'):  
mode = 'r'  
else:  
mode = 'rb'  
return open(os.path.join(self.server.file_dir, filename), mode), mime_type  
 
def handle_GET_default(self, parsed_params, path):  
self.send_error(404)  
 
def handle_static_file_GET(self, fh, mime_type):  
content = fh.read()  
self.send_response(200)  
self.send_header('Content-Type', mime_type)  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def AllowEditMode(self):  
return False  
 
def handle_GET_home(self):  
schedule = self.server.schedule  
(min_lat, min_lon, max_lat, max_lon) = schedule.GetStopBoundingBox()  
forbid_editing = ('true', 'false')[self.AllowEditMode()]  
 
agency = ', '.join(a.agency_name for a in schedule.GetAgencyList()).encode('utf-8')  
 
key = self.server.key  
host = self.server.host  
 
# A very simple template system. For a fixed set of values replace [xxx]  
# with the value of local variable xxx  
f, _ = self.OpenFile('index.html')  
content = f.read()  
for v in ('agency', 'min_lat', 'min_lon', 'max_lat', 'max_lon', 'key',  
'host', 'forbid_editing'):  
content = content.replace('[%s]' % v, str(locals()[v]))  
 
self.send_response(200)  
self.send_header('Content-Type', 'text/html')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def handle_json_GET_routepatterns(self, params):  
"""Given a route_id generate a list of patterns of the route. For each  
pattern include some basic information and a few sample trips."""  
schedule = self.server.schedule  
route = schedule.GetRoute(params.get('route', None))  
if not route:  
self.send_error(404)  
return  
time = int(params.get('time', 0))  
sample_size = 10 # For each pattern return the start time for this many trips  
 
pattern_id_trip_dict = route.GetPatternIdTripDict()  
patterns = []  
 
for pattern_id, trips in pattern_id_trip_dict.items():  
time_stops = trips[0].GetTimeStops()  
if not time_stops:  
continue  
has_non_zero_trip_type = False;  
for trip in trips:  
if trip['trip_type'] and trip['trip_type'] != '0':  
has_non_zero_trip_type = True  
name = u'%s to %s, %d stops' % (time_stops[0][2].stop_name, time_stops[-1][2].stop_name, len(time_stops))  
transitfeed.SortListOfTripByTime(trips)  
 
num_trips = len(trips)  
if num_trips <= sample_size:  
start_sample_index = 0  
num_after_sample = 0  
else:  
# Will return sample_size trips that start after the 'time' param.  
 
# Linear search because I couldn't find a built-in way to do a binary  
# search with a custom key.  
start_sample_index = len(trips)  
for i, trip in enumerate(trips):  
if trip.GetStartTime() >= time:  
start_sample_index = i  
break  
 
num_after_sample = num_trips - (start_sample_index + sample_size)  
if num_after_sample < 0:  
# Less than sample_size trips start after 'time' so return all the  
# last sample_size trips.  
num_after_sample = 0  
start_sample_index = num_trips - sample_size  
 
sample = []  
for t in trips[start_sample_index:start_sample_index + sample_size]:  
sample.append( (t.GetStartTime(), t.trip_id) )  
 
patterns.append((name, pattern_id, start_sample_index, sample,  
num_after_sample, (0,1)[has_non_zero_trip_type]))  
 
patterns.sort()  
return patterns  
 
def handle_json_wrapper_GET(self, handler, parsed_params):  
"""Call handler and output the return value in JSON."""  
schedule = self.server.schedule  
result = handler(parsed_params)  
content = ResultEncoder().encode(result)  
self.send_response(200)  
self.send_header('Content-Type', 'text/plain')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
def handle_json_GET_routes(self, params):  
"""Return a list of all routes."""  
schedule = self.server.schedule  
result = []  
for r in schedule.GetRouteList():  
servicep = None  
for t in schedule.GetTripList():  
if t.route_id == r.route_id:  
servicep = t.service_period  
break  
result.append( (r.route_id, r.route_short_name, r.route_long_name, servicep.service_id) )  
result.sort(key = lambda x: x[1:3])  
return result  
 
def handle_json_GET_routerow(self, params):  
schedule = self.server.schedule  
route = schedule.GetRoute(params.get('route', None))  
return [transitfeed.Route._FIELD_NAMES, route.GetFieldValuesTuple()]  
 
def handle_json_GET_routetrips(self, params):  
""" Get a trip for a route_id (preferablly the next one) """  
schedule = self.server.schedule  
query = params.get('route_id', None).lower()  
result = []  
for t in schedule.GetTripList():  
if t.route_id == query:  
result.append ( (t.GetStartTime(), t.trip_id) )  
return sorted(result, key=lambda trip: trip[0])  
 
def handle_json_GET_triprows(self, params):  
"""Return a list of rows from the feed file that are related to this  
trip."""  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip', None))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
route = schedule.GetRoute(trip.route_id)  
trip_row = dict(trip.iteritems())  
route_row = dict(route.iteritems())  
return [['trips.txt', trip_row], ['routes.txt', route_row]]  
 
def handle_json_GET_tripstoptimes(self, params):  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip'))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
time_stops = trip.GetTimeInterpolatedStops()  
stops = []  
times = []  
for arr,ts,is_timingpoint in time_stops:  
stops.append(StopToTuple(ts.stop))  
times.append(arr)  
return [stops, times]  
 
def handle_json_GET_tripshape(self, params):  
schedule = self.server.schedule  
try:  
trip = schedule.GetTrip(params.get('trip'))  
except KeyError:  
# if a non-existent trip is searched for, the return nothing  
return  
points = []  
if trip.shape_id:  
shape = schedule.GetShape(trip.shape_id)  
for (lat, lon, dist) in shape.points:  
points.append((lat, lon))  
else:  
time_stops = trip.GetTimeStops()  
for arr,dep,stop in time_stops:  
points.append((stop.stop_lat, stop.stop_lon))  
return points  
 
def handle_json_GET_neareststops(self, params):  
"""Return a list of the nearest 'limit' stops to 'lat', 'lon'"""  
schedule = self.server.schedule  
lat = float(params.get('lat'))  
lon = float(params.get('lon'))  
limit = int(params.get('limit'))  
stops = schedule.GetNearestStops(lat=lat, lon=lon, n=limit)  
return [StopToTuple(s) for s in stops]  
 
def handle_json_GET_boundboxstops(self, params):  
"""Return a list of up to 'limit' stops within bounding box with 'n','e'  
and 's','w' in the NE and SW corners. Does not handle boxes crossing  
longitude line 180."""  
schedule = self.server.schedule  
n = float(params.get('n'))  
e = float(params.get('e'))  
s = float(params.get('s'))  
w = float(params.get('w'))  
limit = int(params.get('limit'))  
stops = schedule.GetStopsInBoundingBox(north=n, east=e, south=s, west=w, n=limit)  
return [StopToTuple(s) for s in stops]  
 
def handle_json_GET_stops(self, params):  
schedule = self.server.schedule  
return [StopToTuple(s) for s in schedule.GetStopList()]  
 
def handle_json_GET_timingpoints(self, params):  
schedule = self.server.schedule  
matches = []  
for s in schedule.GetStopList():  
if s.stop_code.find("Wj") == -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopsearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_name.lower().find(query) != -1 or s.stop_code.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopnamesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_name.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopcodesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.stop_code.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stopzonesearch(self, params):  
schedule = self.server.schedule  
query = params.get('q', None).lower()  
matches = []  
for s in schedule.GetStopList():  
if s.zone_id != None and s.zone_id.lower().find(query) != -1:  
matches.append(StopToTuple(s))  
return matches  
 
def handle_json_GET_stop(self, params):  
schedule = self.server.schedule  
query = params.get('stop_id', None).lower()  
for s in schedule.GetStopList():  
if s.stop_id.lower() == query:  
return StopToTuple(s)  
return []  
 
def handle_json_GET_stoptrips(self, params):  
"""Given a stop_id and time in seconds since midnight return the next  
trips to visit the stop."""  
schedule = self.server.schedule  
stop = schedule.GetStop(params.get('stop', None))  
time = int(params.get('time', 0))  
service_period = params.get('service_period', None)  
time_trips = stop.GetStopTimeTrips(schedule)  
time_trips.sort() # OPT: use bisect.insort to make this O(N*ln(N)) -> O(N)  
# Keep the first 15 after param 'time'.  
# Need make a tuple to find correct bisect point  
time_trips = time_trips[bisect.bisect_left(time_trips, (time, 0)):]  
time_trips = time_trips[:15]  
result = []  
for time, (trip, index), tp in time_trips:  
headsign = None  
# Find the most recent headsign from the StopTime objects  
for stoptime in trip.GetStopTimes()[index::-1]:  
if stoptime.stop_headsign:  
headsign = stoptime.stop_headsign  
break  
# If stop_headsign isn't found, look for a trip_headsign  
if not headsign:  
headsign = trip.trip_headsign  
route = schedule.GetRoute(trip.route_id)  
trip_name = ''  
if route.route_short_name:  
trip_name += route.route_short_name  
if route.route_long_name:  
if len(trip_name):  
trip_name += " - "  
trip_name += route.route_long_name  
# comment out directions because we already have them in the long name  
#if headsign:  
# trip_name += " (Direction: %s)" % headsign  
if service_period == None or trip.service_id == service_period:  
result.append((time, (trip.trip_id, trip_name, trip.service_id), tp))  
return result  
 
def handle_GET_ttablegraph(self,params):  
"""Draw a Marey graph in SVG for a pattern (collection of trips in a route  
that visit the same sequence of stops)."""  
schedule = self.server.schedule  
marey = MareyGraph()  
trip = schedule.GetTrip(params.get('trip', None))  
route = schedule.GetRoute(trip.route_id)  
height = int(params.get('height', 300))  
 
if not route:  
print 'no such route'  
self.send_error(404)  
return  
 
pattern_id_trip_dict = route.GetPatternIdTripDict()  
pattern_id = trip.pattern_id  
if pattern_id not in pattern_id_trip_dict:  
print 'no pattern %s found in %s' % (pattern_id, pattern_id_trip_dict.keys())  
self.send_error(404)  
return  
triplist = pattern_id_trip_dict[pattern_id]  
 
pattern_start_time = min((t.GetStartTime() for t in triplist))  
pattern_end_time = max((t.GetEndTime() for t in triplist))  
 
marey.SetSpan(pattern_start_time,pattern_end_time)  
marey.Draw(triplist[0].GetPattern(), triplist, height)  
 
content = marey.Draw()  
 
self.send_response(200)  
self.send_header('Content-Type', 'image/svg+xml')  
self.send_header('Content-Length', str(len(content)))  
self.end_headers()  
self.wfile.write(content)  
 
 
def FindPy2ExeBase():  
"""If this is running in py2exe return the install directory else return  
None"""  
# py2exe puts gtfsscheduleviewer in library.zip. For py2exe setup.py is  
# configured to put the data next to library.zip.  
windows_ending = gtfsscheduleviewer.__file__.find('\\library.zip\\')  
if windows_ending != -1:  
return transitfeed.__file__[:windows_ending]  
else:  
return None  
 
 
def FindDefaultFileDir():  
"""Return the path of the directory containing the static files. By default  
the directory is called 'files'. The location depends on where setup.py put  
it."""  
base = FindPy2ExeBase()  
if base:  
return os.path.join(base, 'schedule_viewer_files')  
else:  
# For all other distributions 'files' is in the gtfsscheduleviewer  
# directory.  
base = os.path.dirname(gtfsscheduleviewer.__file__) # Strip __init__.py  
return os.path.join(base, 'files')  
 
 
def GetDefaultKeyFilePath():  
"""In py2exe return absolute path of file in the base directory and in all  
other distributions return relative path 'key.txt'"""  
windows_base = FindPy2ExeBase()  
if windows_base:  
return os.path.join(windows_base, 'key.txt')  
else:  
return 'key.txt'  
 
 
def main(RequestHandlerClass = ScheduleRequestHandler):  
usage = \  
'''%prog [options] [<input GTFS.zip>]  
 
Runs a webserver that lets you explore a <input GTFS.zip> in your browser.  
 
If <input GTFS.zip> is omited the filename is read from the console. Dragging  
a file into the console may enter the filename.  
'''  
parser = util.OptionParserLongError(  
usage=usage, version='%prog '+transitfeed.__version__)  
parser.add_option('--feed_filename', '--feed', dest='feed_filename',  
help='file name of feed to load')  
parser.add_option('--key', dest='key',  
help='Google Maps API key or the name '  
'of a text file that contains an API key')  
parser.add_option('--host', dest='host', help='Host name of Google Maps')  
parser.add_option('--port', dest='port', type='int',  
help='port on which to listen')  
parser.add_option('--file_dir', dest='file_dir',  
help='directory containing static files')  
parser.add_option('-n', '--noprompt', action='store_false',  
dest='manual_entry',  
help='disable interactive prompts')  
parser.set_defaults(port=8765,  
host='maps.google.com',  
file_dir=FindDefaultFileDir(),  
manual_entry=True)  
(options, args) = parser.parse_args()  
 
if not os.path.isfile(os.path.join(options.file_dir, 'index.html')):  
print "Can't find index.html with --file_dir=%s" % options.file_dir  
exit(1)  
 
if not options.feed_filename and len(args) == 1:  
options.feed_filename = args[0]  
 
if not options.feed_filename and options.manual_entry:  
options.feed_filename = raw_input('Enter Feed Location: ').strip('"')  
 
default_key_file = GetDefaultKeyFilePath()  
if not options.key and os.path.isfile(default_key_file):  
options.key = open(default_key_file).read().strip()  
 
if options.key and os.path.isfile(options.key):  
options.key = open(options.key).read().strip()  
 
schedule = transitfeed.Schedule(problem_reporter=transitfeed.ProblemReporter())  
print 'Loading data from feed "%s"...' % options.feed_filename  
print '(this may take a few minutes for larger cities)'  
schedule.Load(options.feed_filename)  
 
server = StoppableHTTPServer(server_address=('', options.port),  
RequestHandlerClass=RequestHandlerClass)  
server.key = options.key  
server.schedule = schedule  
server.file_dir = options.file_dir  
server.host = options.host  
server.feed_path = options.feed_filename  
 
print ("To view, point your browser at http://localhost:%d/" %  
(server.server_port))  
server.serve_forever()  
 
 
if __name__ == '__main__':  
main()  
 
cache/tiles  
cache/map  
 
[InternetShortcut]  
URL=http://gplotter.offwhite.net/  
 
[InternetShortcut]  
URL=http://brennan.offwhite.net/blog/2005/07/23/new-google-maps-icons-free/  
 
 Binary files a/busui/staticmaplite/images/markers/Thumbs.db and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconb9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icong9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr10.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr11.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr12.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr13.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr14.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr15.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr16.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr17.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr18.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr19.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr20.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr21.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr22.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr23.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr24.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr25.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr6.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr7.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr8.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/iconr9.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/icons.psd and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue1.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue2.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue3.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue4.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/lightblue5.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-blue.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-gold.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker-green.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/markers/ol-marker.png and /dev/null differ
 Binary files a/busui/staticmaplite/images/osm_logo.png and /dev/null differ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-de" lang="de-de">  
<head>  
<!--  
CSS based on template of Dandelion wiki engine by Radomir Dopieralski who released this  
template under the terms of GNU GPL. http://dandelion.sheep.art.pl/  
-->  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />  
<title>staticMapLite</title>  
<style type="text/css">  
html{font:96% sans-serif;color:#000;background:#f7f7f7;line-height:1.4;}  
body{color:#333;}  
#wrapper{margin:auto;width:60em;position:relative;}  
#header{padding:0px 0px 7px 0px; height: 1em;}  
#header h1 { float:left; width: 40%; }  
#content{background:white;padding:1em;border:1px solid #e0d78a;outline:0.5em solid #fef4a4; margin:0.5em 0;padding:20px;min-height:20em;}  
h1{margin-top:0px;}  
h1,h2,h3,h4,h5,h6{letter-spacing:0.05em;color:#1474CA;font-weight:normal;}  
h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{text-decoration:none;}  
a{color:#1474CA;text-decoration:none;}  
a:visited{color:#1474CA;}  
a.pending{color:#c174a0;}  
a:hover{text-decoration:underline;}  
a img{border:none;}  
input,textarea{font-size:94%;border:1px solid #999;background:#fff;color:#666;outline:0.2em solid #eee;padding:0px;line-height:1.2;margin:0.5em;vertical-align:middle;}  
textarea{display:block;margin:0.5em auto;width:100%;}  
pre{outline:0.4em solid #eee;padding:0.5em;margin:0.5em;border:1px solid #e0d78a;background:#fef4a4;color:#644e22;}  
img{border:1px solid #ccc;outline:0.25em solid #eee;padding:0.25em;margin:0.25em 0 0.25em 0.5em;background:#fff;}  
hr{height:0;border:none;color:#fff;background:transparent;border-bottom:1px solid #ccc; margin:0.5em 0;}  
#diff {outline:none;border:none;}  
#diff ins{color:green;text-decoration:none;font-weight:bold;}  
#diff del{color:red;text-decoration:line-through;}  
#diff{background:#fff;line-height:1.25;padding:1em;white-space:pre-wrap;word-wrap:break-word; white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;width:97%;}  
hr{margin:10px 0 10px 0;height:0px;overflow:hidden;border:0px;border-top:2px solid #ccc;}  
.error{color:#F25A5A;font-weight:bold;}  
form{display:inline;}  
#contentTextarea{height:44em;}  
#toc{margin:5px 0 5px 10px;padding:6px 5px 7px 0px;float:right;list-style:none;outline:0.4em solid #eee;background:#fef4a4;border:1px solid #e0d78a;}  
#toc ul{list-style:none;padding:3px 0 3px 10px;}  
#toc li{font-size:11px;padding-left:10px;}  
#toc ul li{font-size:10px;}  
#toc ul ul li{font-size:9px;}  
#toc ul ul ul li{font-size:8px;}  
#toc ul ul ul ul li{font-size:7px;}  
.pageVersionsList{letter-spacing:0px;font-variant:normal;font-size:12px;}  
#renameForm{float:left;}  
.clear{clear:both;}  
.tagList{padding:0.2em 0.4em 0.2em 0.4em;margin-top:0.5em;border:1px dashed #e0d78a;background:#fef4a4;color:#644e22;}  
.tagCloud{float:right;width:200px;padding:0.5em;margin:1em;border:1px dashed #e0d78a;background:#fef4a4;color:#644e22;}  
#fileTable{border-collapse:collapse;}  
#fileTable td{border:1px solid #FEF4A4;padding:2px 6px 2px 6px;}  
h2 span.par-edit, h3 span.par-edit, h4 span.par-edit, h5 span.par-edit, h6 span.par-edit {display:none;}  
h2:hover span.par-edit, h3:hover span.par-edit, h4:hover span.par-edit, h5:hover span.par-edit, h6:hover span.par-edit {display:inline;font-size:x-small;}  
.comment-item { border:1px solid #999;color:#666;outline:0.2em solid #eee; }  
.resizeTextareaDiv { margin-top: 5px;}  
a.toolbarTextareaItem { padding-right: 10px; }  
a.external:after { content: "\2197";}  
</style>  
</head>  
 
<body>  
<div id="wrapper">  
<div id="header">  
</div>  
<div id="content">  
 
<div class="par-div">  
<h2>  
staticMapLite - simple map for your website  
</h2>  
<p>  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik" width="865" height="512" /></p>  
<p>  
This image was created using the following simple &lt;img> tag:  
<pre>&lt;img src="staticmap.php?center=40.714728,-73.998672&amp;zoom=14&amp;size=865x512&amp;maptype=mapnik" /&gt;</pre>  
</p>  
</div>  
<hr />  
<div class="par-div">  
<h3>  
Place Markers  
</h3>  
 
<p>  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik&markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3" width="865" height="512" />  
</p><p> Add markers by appending them to the image URL:  
<pre>markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3</pre>  
</p>  
</div>  
<hr />  
<div class="par-div">  
<h3>  
Use Different Map Styles (Tile Sources)  
</h3>  
 
<p>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=mapnik" width="256" height="256" />  
<pre>maptype=mapnik</pre>  
</div>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=osmarenderer" width="256" height="256" />  
<pre>maptype=osmarenderer</pre>  
</div>  
<div style="float:left; margin-right: 10px">  
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=cycle" width="256" height="256" />  
<pre>maptype=cycle</pre>  
</div>  
<br style="clear:both" />  
</p>  
</div>  
 
</div>  
<div id="footer">  
<div style="text-align:center;padding:7px;color:#ccc">  
sponsored by <a href="http://dfacts.de">dFacts Network</a>  
</div>  
</div>  
</div>  
</body>  
</html>  
chcon -R -t httpd_sys_content_rw_t cache  
 
 
<?php  
 
/**  
* staticMapLite 0.02  
*  
* Copyright 2009 Gerhard Koch  
*  
* Licensed under the Apache License, Version 2.0 (the "License");  
* you may not use this file except in compliance with the License.  
* You may obtain a copy of the License at  
*  
* http://www.apache.org/licenses/LICENSE-2.0  
*  
* Unless required by applicable law or agreed to in writing, software  
* distributed under the License is distributed on an "AS IS" BASIS,  
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
* See the License for the specific language governing permissions and  
* limitations under the License.  
*  
* @author Gerhard Koch <gerhard.koch AT ymail.com>  
*  
* USAGE:  
*  
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=mapnik&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc  
*  
*/  
 
error_reporting(0);  
ini_set('display_errors','off');  
 
Class staticMapLite {  
 
protected $tileSize = 256;  
protected $tileSrcUrl = array( 'mapnik' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',  
'osmarenderer' => 'http://c.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png',  
'cycle' => 'http://c.andy.sandbox.cloudmade.com/tiles/cycle/{Z}/{X}/{Y}.png'  
);  
 
protected $tileDefaultSrc = 'mapnik';  
protected $markerBaseDir = 'images/markers';  
protected $osmLogo = 'images/osm_logo.png';  
 
protected $useTileCache = true;  
protected $tileCacheBaseDir = './cache/tiles';  
 
protected $useMapCache = true;  
protected $mapCacheBaseDir = './cache/maps';  
protected $mapCacheID = '';  
protected $mapCacheFile = '';  
protected $mapCacheExtension = 'png';  
 
protected $zoom, $lat, $lon, $width, $height, $markers, $image, $maptype;  
protected $centerX, $centerY, $offsetX, $offsetY;  
 
public function __construct(){  
$this->zoom = 0;  
$this->lat = 0;  
$this->lon = 0;  
$this->width = 500;  
$this->height = 350;  
$this->markers = array();  
$this->maptype = $this->tileDefaultSrc;  
}  
 
public function parseParams(){  
global $_GET;  
 
// get zoom from GET paramter  
$this->zoom = $_GET['zoom']?intval($_GET['zoom']):0;  
if($this->zoom>18)$this->zoom = 18;  
 
// get lat and lon from GET paramter  
list($this->lat,$this->lon) = split(',',$_GET['center']);  
$this->lat = floatval($this->lat);  
$this->lon = floatval($this->lon);  
 
// get zoom from GET paramter  
if($_GET['size']){  
list($this->width, $this->height) = split('x',$_GET['size']);  
$this->width = intval($this->width);  
$this->height = intval($this->height);  
}  
if($_GET['markers']){  
$markers = split('%7C|\|',$_GET['markers']);  
foreach($markers as $marker){  
list($markerLat, $markerLon, $markerImage) = split(',',$marker);  
$markerLat = floatval($markerLat);  
$markerLon = floatval($markerLon);  
$markerImage = basename($markerImage);  
$this->markers[] = array('lat'=>$markerLat, 'lon'=>$markerLon, 'image'=>$markerImage);  
}  
 
}  
if($_GET['maptype']){  
if(array_key_exists($_GET['maptype'],$this->tileSrcUrl)) $this->maptype = $_GET['maptype'];  
}  
}  
 
public function lonToTile($long, $zoom){  
return (($long + 180) / 360) * pow(2, $zoom);  
}  
 
public function latToTile($lat, $zoom){  
return (1 - log(tan($lat * pi()/180) + 1 / cos($lat* pi()/180)) / pi()) /2 * pow(2, $zoom);  
}  
 
public function initCoords(){  
$this->centerX = $this->lonToTile($this->lon, $this->zoom);  
$this->centerY = $this->latToTile($this->lat, $this->zoom);  
$this->offsetX = floor((floor($this->centerX)-$this->centerX)*$this->tileSize);  
$this->offsetY = floor((floor($this->centerY)-$this->centerY)*$this->tileSize);  
}  
 
public function createBaseMap(){  
$this->image = imagecreatetruecolor($this->width, $this->height);  
$startX = floor($this->centerX-($this->width/$this->tileSize)/2);  
$startY = floor($this->centerY-($this->height/$this->tileSize)/2);  
$endX = ceil($this->centerX+($this->width/$this->tileSize)/2);  
$endY = ceil($this->centerY+($this->height/$this->tileSize)/2);  
$this->offsetX = -floor(($this->centerX-floor($this->centerX))*$this->tileSize);  
$this->offsetY = -floor(($this->centerY-floor($this->centerY))*$this->tileSize);  
$this->offsetX += floor($this->width/2);  
$this->offsetY += floor($this->height/2);  
$this->offsetX += floor($startX-floor($this->centerX))*$this->tileSize;  
$this->offsetY += floor($startY-floor($this->centerY))*$this->tileSize;  
 
for($x=$startX; $x<=$endX; $x++){  
for($y=$startY; $y<=$endY; $y++){  
$url = str_replace(array('{Z}','{X}','{Y}'),array($this->zoom, $x, $y), $this->tileSrcUrl[$this->maptype]);  
$tileImage = imagecreatefromstring($this->fetchTile($url));  
$destX = ($x-$startX)*$this->tileSize+$this->offsetX;  
$destY = ($y-$startY)*$this->tileSize+$this->offsetY;  
imagecopy($this->image, $tileImage, $destX, $destY, 0, 0, $this->tileSize, $this->tileSize);  
}  
}  
}  
 
 
public function placeMarkers(){  
foreach($this->markers as $marker){  
$markerLat = $marker['lat'];  
$markerLon = $marker['lon'];  
$markerImage = $marker['image'];  
$markerIndex++;  
$markerFilename = $markerImage?(file_exists($this->markerBaseDir.'/'.$markerImage.".png")?$markerImage:'lightblue'.$markerIndex):'lightblue'.$markerIndex;  
if(file_exists($this->markerBaseDir.'/'.$markerFilename.".png")){  
$markerImg = imagecreatefrompng($this->markerBaseDir.'/'.$markerFilename.".png");  
} else {  
$markerImg = imagecreatefrompng($this->markerBaseDir.'/lightblue1.png');  
}  
$destX = floor(($this->width/2)-$this->tileSize*($this->centerX-$this->lonToTile($markerLon, $this->zoom)));  
$destY = floor(($this->height/2)-$this->tileSize*($this->centerY-$this->latToTile($markerLat, $this->zoom)));  
$destY = $destY - imagesy($markerImg);  
 
imagecopy($this->image, $markerImg, $destX, $destY, 0, 0, imagesx($markerImg), imagesy($markerImg));  
 
};  
}  
 
 
 
public function tileUrlToFilename($url){  
return $this->tileCacheBaseDir."/".str_replace(array('http://'),'',$url);  
}  
 
public function checkTileCache($url){  
$filename = $this->tileUrlToFilename($url);  
if(file_exists($filename)){  
return file_get_contents($filename);  
}  
}  
 
public function checkMapCache(){  
$this->mapCacheID = md5($this->serializeParams());  
$filename = $this->mapCacheIDToFilename();  
if(file_exists($filename)) return true;  
}  
 
public function serializeParams(){  
return join("&",array($this->zoom,$this->lat,$this->lon,$this->width,$this->height, serialize($this->markers),$this->maptype));  
}  
 
public function mapCacheIDToFilename(){  
if(!$this->mapCacheFile){  
$this->mapCacheFile = $this->mapCacheBaseDir."/".substr($this->mapCacheID,0,2)."/".substr($this->mapCacheID,2,2)."/".substr($this->mapCacheID,4);  
}  
return $this->mapCacheFile.".".$this->mapCacheExtension;  
}  
 
 
 
public function mkdir_recursive($pathname, $mode){  
return mkdir($pathname, $mode, true);  
}  
public function writeTileToCache($url, $data){  
$filename = $this->tileUrlToFilename($url);  
$this->mkdir_recursive(dirname($filename),0777);  
file_put_contents($filename, $data);  
}  
 
public function fetchTile($url){  
if($this->useTileCache && ($cached = $this->checkTileCache($url))) return $cached;  
$ch = curl_init();  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");  
curl_setopt($ch, CURLOPT_URL, $url);  
$tile = curl_exec($ch);  
curl_close($ch);  
if($this->useTileCache){  
$this->writeTileToCache($url,$tile);  
}  
return $tile;  
 
}  
 
public function copyrightNotice(){  
$logoImg = imagecreatefrompng($this->osmLogo);  
imagecopy($this->image, $logoImg, imagesx($this->image)-imagesx($logoImg), imagesy($this->image)-imagesy($logoImg), 0, 0, imagesx($logoImg), imagesy($logoImg));  
 
}  
 
public function sendHeader(){  
header('Content-Type: image/png');  
$expires = 60*60*24*14;  
header("Pragma: public");  
header("Cache-Control: maxage=".$expires);  
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');  
}  
 
public function makeMap(){  
$this->initCoords();  
$this->createBaseMap();  
if(count($this->markers))$this->placeMarkers();  
if($this->osmLogo) $this->copyrightNotice();  
}  
 
public function showMap(){  
$this->parseParams();  
if($this->useMapCache){  
// use map cache, so check cache for map  
if(!$this->checkMapCache()){  
// map is not in cache, needs to be build  
$this->makeMap();  
$this->mkdir_recursive(dirname($this->mapCacheIDToFilename()),0777);  
imagepng($this->image,$this->mapCacheIDToFilename(),9);  
$this->sendHeader();  
if(file_exists($this->mapCacheIDToFilename())){  
return file_get_contents($this->mapCacheIDToFilename());  
} else {  
return imagepng($this->image);  
}  
} else {  
// map is in cache  
$this->sendHeader();  
return file_get_contents($this->mapCacheIDToFilename());  
}  
 
} else {  
// no cache, make map, send headers and deliver png  
$this->makeMap();  
$this->sendHeader();  
return imagepng($this->image);  
 
}  
}  
 
}  
 
$map = new staticMapLite();  
print $map->showMap();  
 
?>  
 
file:a/busui/stop.php (deleted)
<?php  
include('common.inc.php');  
$url = $APIurl."/json/stop?stop_id=".$_REQUEST['stopid'];  
$stop = json_decode(getPage($url));  
 
include_header($stop[1],"stop");  
if (isMetricsOn()) {  
// Create a new Instance of the tracker  
$owa = new owa_php($config);  
// Set the ID of the site being tracked  
$owa->setSiteId('bus.lambdacomplex.org');  
// Create a new event object  
$event = $owa->makeEvent();  
// Set the Event Type, in this case a "video_play"  
$event->setEventType('view_stop');  
// Set a property  
$event->set('stop_id',$_REQUEST['stopid']);  
// Track the event  
$owa->trackEvent($event);  
}  
timePlaceSettings();  
echo '<div data-role="content" class="ui-content" role="main"><p>'.staticmap(Array(0 => Array($stop[2],$stop[3]))).'</p>';  
echo ' <ul data-role="listview" data-inset="true">';  
$url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds()."&service_period=".service_period();  
$trips = json_decode(getPage($url));  
debug(print_r($trips,true));  
foreach ($trips as $row)  
{  
echo '<li>';  
echo '<h3><a href="trip.php?stopid='.$_REQUEST['stopid'].'&tripid='.$row[1][0].'">'.$row[1][1];  
echo '<br><small>Via: '.viaPointNames($row[1][0],$_REQUEST['stopid']).'</small> </a></h3>';  
echo '<p class="ui-li-aside"><strong>'.midnight_seconds_to_time($row[0]).'</strong></p>';  
echo '</li>';  
}  
if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>";  
echo '</ul></div>';  
include_footer();  
?>  
 
file:a/busui/stopList.php (deleted)
<?php  
include('common.inc.php');  
 
function navbar() {  
echo'  
<div data-role="navbar">  
<ul>  
<li><a href="stopList.php">Timing Points</a></li>  
<li><a href="stopList.php?suburbs=yes">By Suburb</a></li>  
<li><a href="stopList.php?nearby=yes">Nearby Stops</a></li>  
<li><a href="stopList.php?allstops=yes">All Stops</a></li>  
</ul>  
</div>  
';  
timePlaceSettings();  
}  
// By suburb  
if (isset($_REQUEST['suburbs'])) {  
include_header("Stops by Suburb","stopList");  
navbar();  
echo ' <ul data-role="listview" data-filter="true" data-inset="true" >';  
foreach ($suburbs as $suburb) {  
echo '<li><a href="stopList.php?suburb='.urlencode($suburb).'">'.$suburb.'</a></li>';  
}  
echo '</ul>';  
} else {  
// Timing Points / All stops  
 
if ($_REQUEST['allstops']) {  
$url = $APIurl."/json/stops";  
include_header("All Stops","stopList");  
navbar();  
} else if ($_REQUEST['nearby']) {  
$url = $APIurl."/json/neareststops?lat={$_SESSION['lat']}&lon={$_SESSION['lon']}&limit=15";  
include_header("Nearby Stops","stopList");  
navbar();  
timePlaceSettings();  
} else if ($_REQUEST['suburb']) {  
$url = $APIurl."/json/stopzonesearch?q=".filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING);  
include_header("Stops in ".ucwords(filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING)),"stopList");  
if (isMetricsOn()) {  
// Create a new Instance of the tracker  
$owa = new owa_php($config);  
// Set the ID of the site being tracked  
$owa->setSiteId('bus.lambdacomplex.org');  
// Create a new event object  
$event = $owa->makeEvent();  
// Set the Event Type, in this case a "video_play"  
$event->setEventType('view_stop_list_suburb');  
// Set a property  
$event->set('stop_list_suburb',$_REQUEST['suburb']);  
// Track the event  
$owa->trackEvent($event);  
}  
navbar();  
} else {  
$url = $APIurl."/json/timingpoints";  
include_header("Timing Points / Major Stops","stopList");  
navbar();  
}  
echo '<div class="noscriptnav"> Go to letter: ';  
foreach(range('A','Z') as $letter)  
{  
echo "<a href=\"#$letter\">$letter</a>&nbsp;";  
}  
echo "</div>  
<script>  
$('.noscriptnav').hide();  
</script>";  
echo ' <ul data-role="listview" data-filter="true" data-inset="true" >';  
$contents = json_decode(getPage($url));  
debug(print_r($contents,true));  
foreach ($contents as $key => $row) {  
$stopName[$key] = $row[1];  
}  
 
// Sort the stops by name  
array_multisort($stopName, SORT_ASC, $contents);  
 
$firstletter = "";  
foreach ($contents as $row)  
{  
if (substr($row[1],0,1) != $firstletter){  
echo "<a name=$firstletter></a>";  
$firstletter = substr($row[1],0,1);  
}  
echo '<li><a href="stop.php?stopid='.$row[0].'">'.bracketsMeanNewLine($row[1]).'</a></li>';  
}  
echo '</ul>';  
}  
include_footer();  
?>  
 
 
file:a/busui/trip.php (deleted)
<?php  
include('common.inc.php');  
$tripid = filter_var($_REQUEST['tripid'],FILTER_SANITIZE_NUMBER_INT);  
$stopid = filter_var($_REQUEST['stopid'],FILTER_SANITIZE_NUMBER_INT);  
if ($_REQUEST['routeid']) {  
$url = $APIurl."/json/routetrips?route_id=".filter_var($_REQUEST['routeid'],FILTER_SANITIZE_NUMBER_INT);  
$trips = json_decode(getPage($url));  
debug(print_r($trips,true));  
foreach ($trips as $trip)  
{  
if ($trip[0] < midnight_seconds()) {  
$tripid = $trip[1];  
break;  
}  
}  
if (!($tripid > 0)) $tripid = $trips[0][1];  
}  
$url = $APIurl."/json/triprows?trip=".$tripid;  
$trips = array_flatten(json_decode(getPage($url)));  
debug(print_r($trips,true));  
include_header("Stops on ". $trips[1]->route_short_name . ' '. $trips[1]->route_long_name,"trip");  
if (isMetricsOn()) {  
// Create a new Instance of the tracker  
$owa = new owa_php($config);  
// Set the ID of the site being tracked  
$owa->setSiteId('bus.lambdacomplex.org');  
// Create a new event object  
$event = $owa->makeEvent();  
// Set the Event Type, in this case a "video_play"  
$event->setEventType('view_trip');  
// Set a property  
$event->set('trip_id',$tripid);  
$event->set('route_id',$routeid);  
// Track the event  
$owa->trackEvent($event);  
}  
timePlaceSettings();  
echo ' <ul data-role="listview" data-inset="true">';  
 
 
$url = $APIurl."/json/tripstoptimes?trip=".$tripid;  
 
$json = json_decode(getPage($url));  
debug(print_r($json,true));  
$stops = $json[0];  
$times = $json[1];  
foreach ($stops as $key => $row)  
{  
echo '<li>';  
echo '<h3><a href="stop.php?stopid='.$row[0].'">'.bracketsMeanNewLine($row[1]);  
if ($row[0] == $stopid) echo "<br><small> Current Location</small>";  
echo '</a></h3>';  
echo '<p class="ui-li-aside">'.midnight_seconds_to_time($times[$key]).'</p>';  
echo '</li>';  
}  
echo '</ul>';  
include_footer();  
?>  
 
file:a/busui/tripPlanner.php (deleted)
<?php  
include('common.inc.php');  
include_header("Trip Planner","tripPlanner", true, true);  
$from = (isset($_REQUEST['from']) ? filter_var($_REQUEST['from'],FILTER_SANITIZE_STRING) : "Brigalow");  
$to = (isset($_REQUEST['to']) ? filter_var($_REQUEST['to'],FILTER_SANITIZE_STRING) : "Barry");  
$date = (isset($_REQUEST['date']) ? filter_var($_REQUEST['date'],FILTER_SANITIZE_STRING) : date("m/d/Y"));  
$time = (isset($_REQUEST['time']) ? filter_var($_REQUEST['time'],FILTER_SANITIZE_STRING) : date("H:m"));  
# todo: convert date from form to h:ia?  
 
function tripPlanForm($errorMessage = "")  
{  
global $date,$time,$from,$to;  
echo "<font color=red>$errorMessage</font>";  
echo '<form action="tripPlanner.php" method="post">  
<div data-role="fieldcontain">  
<label for="from">I would like to go from</label>  
<input type="text" name="from" id="from" value="' . $from . '" />  
<a href="#" style="display:none" name="fromHere" id="fromHere"/>Here?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="to"> to </label>  
<input type="text" name="to" id="to" value="' . $to . '" />  
<a href="#" style="display:none" name="toHere" id="toHere"/>Here?</a>  
</div>  
<div data-role="fieldcontain">  
<label for="date"> on </label>  
<input type="date" name="date" id="date" value="' . $date . '" />  
</div>  
<div data-role="fieldcontain">  
<label for="time"> at </label>  
<input type="time" name="time" id="time" value="' . $time . '" />  
</div>  
<input type="submit" value="Go!"></form>';  
echo "<script>  
$('#toHere').click(function(event) { $('#to').val(getCookie('geolocate')); return false;});  
$('#toHere').show();  
$('#fromHere').click(function(event) { $('#from').val(getCookie('geolocate')); return false;});  
$('#fromHere').show();  
 
</script>";  
}  
 
function processItinerary($itineraryNumber, $itinerary)  
{  
echo '<div data-role="collapsible" ' . ($itineraryNumber > 0 ? 'data-collapsed="true"' : "") . '> <h3> Option #' . ($itineraryNumber + 1) . ": " . floor($itinerary->duration / 60000) . " minutes ({$itinerary->startTime} to {$itinerary->endTime})</h3><p>";  
echo "Walking time: " . floor($itinerary->walkTime / 60000) . " minutes (" . floor($itinerary->walkDistance) . " meters)<br>\n";  
echo "Transit time: " . floor($itinerary->transitTime / 60000) . " minutes<br>\n";  
echo "Waiting time: " . floor($itinerary->waitingTime / 60000) . " minutes<br>\n";  
 
 
 
if (is_array($itinerary->legs->leg)) {  
$legMarkers = array();  
foreach ($itinerary->legs->leg as $legNumber => $leg) {  
$legMarkers[] = array($leg->from->lat, $leg->from->lon);  
}  
echo '' . staticmap($legMarkers) . "<br>\n";  
echo '<ul>';  
foreach ($itinerary->legs->leg as $legNumber => $leg) {  
echo '<li>';  
processLeg($legNumber, $leg);  
echo "</li>";  
}  
echo "</ul>";  
} else {  
echo '' . staticmap(array(array($itinerary->legs->leg->from->lat, $itinerary->legs->leg->from->lon))) . "<br>\n";  
processLeg(0, $itinerary->legs->leg);  
}  
 
echo "</p></div>";  
}  
 
function processLeg($legNumber, $leg) {  
$legArray = object2array($leg);  
echo '<h3>Leg #' . ($legNumber + 1) . " ( {$legArray['@mode']} from: {$leg->from->name} to {$leg->to->name}, " . floor($leg->duration / 60000) . " minutes) </h3>\n";  
if ($legArray["@mode"] === "BUS") {  
echo "Take bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']) . "<br>";  
} else {  
$walkStepMarkers = array();  
foreach ($leg->steps->walkSteps as $stepNumber => $step) {  
$walkStepMarkers[] = array($step->lat, $step->lon);  
}  
echo "" . staticmap($walkStepMarkers, "icong") . "<br>\n";  
foreach ($leg->steps->walkSteps as $stepNumber => $step) {  
echo "Walking step " . ($stepNumber + 1) . " $step->absoluteDirection / $step->relativeDirection on $step->streetName for " . floor($step->distance) . " meters<br>\n";  
}  
}  
}  
 
if ($_REQUEST['time']) {  
$toPlace = (startsWith($to, "-") ? $to : geocode($to, false));  
$fromPlace = (startsWith($from, "-") ? $from : geocode($from, false));  
if ($toPlace == "" || $fromPlace == "") {  
$errorMessage = "";  
if ($toPlace === "")  
$errorMessage .= urlencode($to) . " not found.<br>\n";  
if ($fromPlace === "")  
$errorMessage .= urlencode($from) . " not found.<br>\n";  
tripPlanForm($errorMessage);  
} else {  
if (isMetricsOn()) {  
// Create a new Instance of the tracker  
$owa = new owa_php($config);  
// Set the ID of the site being tracked  
$owa->setSiteId('bus.lambdacomplex.org');  
// Create a new event object  
$event = $owa->makeEvent();  
// Set the Event Type, in this case a "video_play"  
$event->setEventType('view_trip_plan');  
// Set a property  
$event->set('from',$from);  
$event->set('to',$to);  
$event->set('time',$time);  
$event->set('date',$date);  
// Track the event  
$owa->trackEvent($event);  
}  
$url = $otpAPIurl."ws/plan?date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces=";  
$ch = curl_init($url);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_HEADER, 0);  
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));  
curl_setopt($ch,CURLOPT_TIMEOUT,5);  
$page = curl_exec($ch);  
 
if(curl_errno($ch)) { tripPlanForm("Trip planner temporarily unavailable: ".curl_errno($ch)." ".curl_error($ch));}  
else {  
$tripplan = json_decode($page);  
debug(print_r($triplan,true));  
echo "<h1> From: {$tripplan->plan->from->name} To: {$tripplan->plan->to->name} </h1>";  
echo "<h1> At: {$tripplan->plan->date} </h1>";  
 
if (is_array($tripplan->plan->itineraries->itinerary)) {  
echo '<div data-role="collapsible-set">';  
foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary) {  
processItinerary($itineraryNumber, $itinerary);  
}  
echo "</div>";  
} else {  
processItinerary(0, $tripplan->plan->itineraries->itinerary);  
}  
}  
curl_close($ch);  
}  
} else {  
tripPlanForm();  
}  
include_footer();  
?>  
 
file:a/busui/view.sh (deleted)
python schedule_viewer.py --feed=../maxious-canberra-transit-feed/cbrfeed.zip --key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q