dbClass = new dbClass(); } function getLatitudeLongitude($zip) { //Returns latitude and longitude of a given zipcode $query = "SELECT latitude, longitude FROM ctrak_zipcodes WHERE zipcode = ".$zip; $results = $this->dbClass->query($query); return $results; } function getZipArray($zip, $distance = 10) { //Given a zipcode and a distance, returns an comma separated list of zipcodes within this distance //If distance = 0 change to a very small distance if ($distance==0) $distance = 0.001; //Get zipcode location $location = $this->getLatitudeLongitude($zip); if(isset($location[0])) { $latitude = $location[0]['latitude']; $longitude = $location[0]['longitude']; //Get rectangle area $this->RadiusAssistant($latitude, $longitude, $distance); //Select all zipcodes within rectangle $query = "SELECT zipcode FROM ctrak_zipcodes WHERE latitude <= ".$this->maxLat." AND latitude >= ".$this->minLat; $query.= " AND longitude <= ".$this->maxLong." AND longitude >= ".$this->minLong; $results = $this->dbClass->query($query); $list = array(); foreach ($results as $key=>$value) { $list[] = $value['zipcode']; } $result = implode(",",$list); } else { $result =""; } return $result; } function Calculate( $dblLat1, $dblLong1, $dblLat2, $dblLong2 ) { $EARTH_RADIUS_MILES = 3963; $dist = 0; //convert degrees to radians $dblLat1 = $dblLat1 * M_PI / 180; $dblLong1 = $dblLong1 * M_PI / 180; $dblLat2 = $dblLat2 * M_PI / 180; $dblLong2 = $dblLong2 * M_PI / 180; if ($dblLat1 != $dblLat2 || $dblLong1 != $dblLong2) { //the two points are not the same $dist = sin($dblLat1) * sin($dblLat2) + cos($dblLat1) * cos($dblLat2) * cos($dblLong2 - $dblLong1); $dist = $EARTH_RADIUS_MILES * (-1 * atan($dist / sqrt(1 - $dist * $dist)) + M_PI / 2); } return $dist; } function RadiusAssistant($Latitude, $Longitude, $Miles) { $EQUATOR_LAT_MILE = 69.172; $this->maxLat = $Latitude + $Miles / $EQUATOR_LAT_MILE; $this->minLat = $Latitude - ($this->maxLat - $Latitude); $this->maxLong = $Longitude + $Miles / (cos($this->minLat * M_PI / 180) * $EQUATOR_LAT_MILE); $this->minLong = $Longitude - ($this->maxLong - $Longitude); } } ?> Everyhomepro.com provides the most comprehensive online directory of home improvement professionals
EVERYHOMEPRO.com site sponsor
 
ALL VIDEOS & ARTICLES

SEARCH VIDEOS / ARTICLES
All or part of the title:
A word or phrase in the article/description:
From Date:
To Date:
Subject:

Sort By:
Date | Title
Ways to Reduce Oil Consumption
(09/26/2008 article)

By Anthony A. Martin, P.E.

About 25 years ago, out of local and national interest  more...

HOMEOWNERS IN CRISIS - Surviving the Mortgage Meltdown
(10/03/2008 video)

What are lenders looking for from potential homeowners?more...

HOMEOWNERS IN CRISIS - Surviving the Mortgage Meltdown
(10/04/2008 video)
welcome vide  more...
HOMEOWNERS IN CRISIS - Surviving the Mortgage Meltdown
(10/04/2008 video)
ew vide  more...
Home sales rise in December as buyers grab at bargain prices
(05/07/2009 news)

http://www.usatoday.com/money/economy/2009-01-26-home-sales_N.htmmore...

Fire Safety Tips for You and Your Family
(05/19/2009 article)

IN AN EMEGENCY CALL 911

Shock is a common occupational hazard associated wit  more...

Seasonal & Pandemic Flu - What Is The Difference?
(05/19/2009 article)

SEASONAL FLU

Open burning IS NOT an environmentally sound way to dispose of leaves and plant clippings at your home. Stat  more...

As home values fall, more try tax appeals
(05/19/2009 news)

http://www.dailyrecord.com/article/20090517/COMMUNITIES/905170323&referrer=FRONTPAGECAROUSELmore...

Stimulus Bill
(05/28/2009 article)

 Attention, Homeowners!

 ...It's About Your Health  more...

Experts Debate Power Line Safety
(11/24/2009 news)

http://www.dailyrecord.com/article/20091124/COMMUNITIES/91123134/Experts-debate-power-line-safetymore...

Report: 1 in 7 N.J. homeowners owe more than property is worth (12/6/09)
(12/06/2009 news)

http://www.dailyrecord.com/article/20091206/BUSINESS/91203085/-1/ARCHIVES/Report--1-in-7-N.J.-homeowners-owe-more-than-property-is-worthmore...

Homes move fast in Morris if priced to sell (12/7/09)
(12/07/2009 news)

http://www.dailyrecord.com/article/20091207/COMMUNITIES/312070006/1203/Homes-move-fast-in-Morris-if-priced-to-sellmore...

Parsippany homes burglarized over Thanksgiving weekend
(12/07/2009 news)

http://www.dailyrecord.com/article/20091208/COMMUNITIES/91207129/-1/ARCHIVES/Parsippany-homes-burglarized-over-Thanksgiving-weekend more...

Crawford blazing trail for women engineers (12/07/09)
(12/07/2009 news)
http://www.dailyrecord.com/article/20091208/BUSINESS05/91207107/-1/ARCHIVES/Crawford-blazing-the-trail-for-women-engineer  more...
Overheated outlet blamed for Chester fire (12/09/09)
(12/09/2009 news)

http://www.dailyrecord.com/article/20091209/COMMUNITIES/91208061/-1/ARCHIVES/Overheated-outlet-blamed-for-Chester-fire

 more...

Is Only One Mouse a Bad Thing?
(01/12/2010 article)