<?php 

//	date_default_timezone_set('Australia/Brisbane');

	$isoLastModifiedSite = "";
	$newLine = "\n";
	$indent = " ";
	if (!$rootUrl) $rootUrl = strtolower($_SERVER['SERVER_NAME']);
	if (substr($rootUrl,0,4) <> 'http') {
		$rootUrl = 'http://'.$rootUrl;
	}

	$xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>$newLine";

	$urlsetOpen = "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\"	
	xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"	
	xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84	
	http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">$newLine";
	$urlsetValue = "";
	$urlsetClose = "</urlset>$newLine";

function makeUrlString ($urlString) {
    return htmlentities($urlString, ENT_QUOTES, 'UTF-8'); 
}

function makeIso8601TimeStamp ($dateTime) {

    if (!$dateTime) {
        $dateTime = date('Y-m-d H:i:s');
    }
    if (is_numeric(substr($dateTime, 11, 1))) {
        $isoTS = substr($dateTime, 0, 10) ."T" 
                 .substr($dateTime, 11, 8) ."+00:00";
    }
    else {
        $isoTS = substr($dateTime, 0, 10);
    }
    return $isoTS;
}

function makeUrlTag ($url, $modifiedDateTime, $changeFrequency, $priority) {
    GLOBAL $newLine;
    GLOBAL $indent;
    GLOBAL $isoLastModifiedSite;
    $urlOpen = "$indent<url>$newLine";
    $urlValue = "";
    $urlClose = "$indent</url>$newLine";
    $locOpen = "$indent$indent<loc>";
    $locValue = "";
    $locClose = "</loc>$newLine";
    $lastmodOpen = "$indent$indent<lastmod>";
    $lastmodValue = "";
    $lastmodClose = "</lastmod>$newLine";
    $changefreqOpen = "$indent$indent<changefreq>";
    $changefreqValue = "";
    $changefreqClose = "</changefreq>$newLine";
    $priorityOpen = "$indent$indent<priority>";
    $priorityValue = "";
    $priorityClose = "</priority>$newLine";

    $urlTag	 = $urlOpen;
    $urlValue     = $locOpen .makeUrlString("$url") .$locClose;
    if ($modifiedDateTime) {
     $urlValue .= $lastmodOpen .makeIso8601TimeStamp($modifiedDateTime) .$lastmodClose; 
     if (!$isoLastModifiedSite) { // last modification of web site
         $isoLastModifiedSite = makeIso8601TimeStamp($modifiedDateTime); 
     } 
    }
    if ($changeFrequency) {
     $urlValue .= $changefreqOpen .$changeFrequency .$changefreqClose; 
    }
    if ($priority) {
     $urlValue .= $priorityOpen .$priority .$priorityClose; 
    }
    $urlTag .= $urlValue;
    $urlTag .= $urlClose;
    return $urlTag;
}

	if (!$isoLastModifiedSite) { // last modification of web site
	    $isoLastModifiedSite = makeIso8601TimeStamp(date('Y-m-d H:i:s')); 
	} 


		$urlsetValue .= makeUrlTag ("$rootUrl/", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/p13.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z25.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/silent.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dieseltrailer.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/senatorscrew.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/curtisscrew.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/receivers.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=pressure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/p17.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z35.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z50.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dieselbox.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dryers.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/filtration.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/separators.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/autodrains.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/pipesandfittings.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/spareparts.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/contactus.php?feature=form", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/index.php?feature=whattobuy", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/glossary.php?feature=page1", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/glossary.php?feature=page2", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/glossary.php?feature=page3", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/sitemap.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/disclaimer.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=temperature", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=volume", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=power", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=plant", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=3phase", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=powerfactor", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=dewpoint", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=leakage", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=energycost", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/service.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/terms.php?feature=overview", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/calculator.php?feature=consumption", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/p13.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/p17.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z25.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z35.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/z50.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/silent.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/silent.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/senatorscrew.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/autodrains.php?feature=document", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/autodrains.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/autodrains.php?feature=documents", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dryers.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dryers.php?feature=documents", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dryers.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/filtration.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/filtration.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/pipesandfittings.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/pipesandfittings.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/pipesandfittings.php?feature=movies", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/pipesandfittings.php?feature=guidelines", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/separators.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/separators.php?feature=gallery", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/receivers.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dieselbox.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/curtisscrew.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/dieseltrailer.php?feature=brochure", $isoLastModifiedSite, "weekly", "1.0");
		$urlsetValue .= makeUrlTag ("$rootUrl/fac-52p-instruction-manual.pdf", $isoLastModifiedSite, "weekly", "1.0");

	
	header('Content-type: application/xml; charset="utf-8"',true);
	print "$xmlHeader
	$urlsetOpen
	$urlsetValue
	$urlsetClose
	";

?>



