function Infowindow secs points this timeout secs 1000 var args_num 10

  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
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
function Infowindow(secs, points)
{
this.timeout = secs*1000;
var args_num = 10;
this.counter = 0;
this.points = [];
for(x=0;x<points.length/args_num;x++)
{
var point = new Object();
point.id = points[x*args_num];
point._latlng = new GLatLng(points[x*args_num+1], points[x*args_num+2])
point.icon_name = points[x*args_num+3];
point.city_ru = points[x*args_num+4];
point.city_path = points[x*args_num+5];
point.country_ru = points[x*args_num+6];
point.country_path = points[x*args_num+7];
point.preview = points[x*args_num+8];
point.been_here = points[x*args_num+9];
this.points[x] = point;
}
this.showNext=function()
{
try{
var point = this.points[this.counter];
this.show(point);
if(this.counter == this.points.length-1)
this.counter = 0;
else
this.counter++;
if(!this.points[this.counter].img){
this.points[this.counter].img = new Image()
this.points[this.counter].img.src = this.points[this.counter].preview;
}
}catch(err){alert(err)}
}
this.close = function(map_id)
{
var mapp = getMap(map_id);
this.isOpened = 0;
mapp.map.closeInfoWindow();
}
}
Infowindow.prototype.beenHereHandler = function(point, map_id){
if (ANONYMOUS)
{
window.location = QS1 + '?addcity=' + point.id;
return ;
}
var mapp = getMap(map_id);
point.icon_name = "red";
if (point.setImage) {
point.setImage(mapp.icons["red"]);
}
var args = {'city': point.id, 'action': 'add'}
$.post(API_SET_CITY_URL, args, function(data) {
if (data.error) {
alert(data.error);
}
}, 'json');
}
Infowindow.prototype.clickHandler = function(){
if(document._isAnonymous){
window.location.href='/quickstart/changeRelation/?reg=1&city='+this.currentPoint.id;
document._infw.stop();
}else{
document._infw.beenHereHandler(this.currentPoint);
this.currentPoint.been_here++;
document._infw.show(this.currentPoint);
}
}
Infowindow.prototype.start = function(){
document._infw.showNext();
this.tmt = setInterval("document._infw.showNext();", this.timeout);
}
Infowindow.prototype.stop = function(){
clearInterval(this.tmt);
this.close();
}
Infowindow.prototype.stop2 = function(){
clearInterval(this.tmt);
}
Infowindow.prototype.show = function(point, map_id)
{
var mapp = getMap(map_id);
mapp.map.closeInfoWindow();
this.currentPoint = point;
$('#infw_city').html(point.city_ru);
$('#infw_city').attr('href', point.city_path);
$('#infw_city_ih').attr('href', point.city_path);
$('#infw_country').html(point.country_ru);
$('#infw_country').attr('href', point.country_path);
if(point.preview!=""){
$('#infw_city_preview').attr('src', point.preview);
$('#infw_city_preview_div').show();
}
else
$('#infw_city_preview_div').hide();
var been = (point.icon_name == "red")
var been_here =point.been_here;
switch(parseInt(point.been_here)){
case 0:
been_here_str = "Здесь еще никто не был";
$('#infw_button').html('Я буду '+chooseSex("первым","первой"));
break;
case 1:
if(been){
been_here_str = "Вы "+chooseSex("единственный","единственная")+" были здесь";
been_here--;
break;
}
default:
if(been){
prefix = "Вы и еще ";
been_here--;
}else{
prefix = "";
}
been_here_str = prefix + "<b>"+ been_here +"</b>" +" " + numbered(been_here, ['человек',"человека","человек"])+" "+(been?"были здесь":numbered((been_here==1)?1:0, ["был здесь","были здесь","были здесь"]));
$('#infw_button').html('Я тоже '+chooseSex("был","была"));
}
been || point.city_ru=='' ? $('#infw_button_container').hide() : $('#infw_button_container').show();
$('#infw_been_here').html(been_here_str);
mapp.map.openInfoWindowHtml(point._latlng, $('#infw_div').html());
}