-
Notifications
You must be signed in to change notification settings - Fork 35
/
main.inc
62 lines (56 loc) · 1.86 KB
/
main.inc
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php include 'views/header.inc'; ?>
<script type="text/javascript" src="prototype.lite.js"></script>
<script type="text/javascript" src="moo.ajax.js"></script>
<form name="ptform" action="javascript:void(0);" onsubmit="javascript:handleSubmit();">
<input type="text" id="location" value="<?php echo $q; ?>">
<input type="submit" value="Search">
<div class="searchdesc">to get prayertimes, type in a zipcode, postal code, city, city and state, country, or address.</div>
</form>
<div id="calculating"></div>
<div id="prayertimes">
<?php
if ((isset($search_results)) && (!is_null($search_results)))
include 'views/locsearch.inc';
else if (!is_null($data)) include 'views/salatimes.inc';
?>
</div>
<script type="text/javascript">
<!--
function init(){
$('location').focus();
var input = document.ptform.location.value;
if (input.length==0){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position) {
document.ptform.location.value =
"loc:" + position.coords.latitude + "," +
position.coords.longitude;
handleSubmit();
});
}
}
}
function clearCalculating(){
$('calculating').innerHTML = '';
}
function handleSubmit(){
$('calculating').innerHTML = '<img src="/imgs/loading.gif">';
$('prayertimes').innerHTML = '';
var input = document.ptform.location.value;
if (input.length==0){
$('calculating').innerHTML = '';
return false;
}
new ajax('calculate.php?ajax=1&q=' + input,
{ update: $('prayertimes'),
method: 'get',
onComplete: clearCalculating });
}
function manualLocation(loc){
document.ptform.location.value = loc;
handleSubmit();
}
init();
-->
</script>
<?php include 'views/footer.inc'; ?>