var g = 6;
var p = '';
var gmap;
var gmarker;
var fmap;
var fmarkers = [];
function SelImgi(objid) {
$('.imgi').stop();
$('.dprv').stop();
$('.imgi').animate({'width':'200px', 'height':'200px', 'top':'0px', 'left':'0px', 'margin-top': '0px', 'margin-left': '0px'},1);
$('.dprv').animate({'width':'197px', 'height':'33px','top':'171px', 'left':'4px', 'margin-top': '0px', 'margin-left': '0px', 'font-size': '9pt'},1);
if (objid!=null) {
$('#'+objid).animate({
marginTop: '-35px', /* The next 4 lines will vertically align this image */
marginLeft: '-35px',
width: '270px', /* Set new width */
height: '270px', /* Set new height */
}, 200);
dobjid = objid.replace("i_","d_");
$('#'+dobjid).animate({
top: '176px', /* The next 4 lines will vertically align this image */
left: '-31px',
height: "63px",
width: "267px",
fontSize: "11pt",
}, 200);
}
}
function ShowIntro() {
window.location.href = "./";
}
function ShowGallery(nb) {
window.location.href = "./?g="+nb;
}
function GoHome() {
window.location.href = "./";
}
function GoAbout() {
$(window).scrollTo( $('.about'), 800 );
}
function GoMGGPAero() {
window.location.href = "http://www.mggpaero.com/";
}
function GoMap() {
if ($('#fmap').is(":visible")) { $('#fmap').slideUp(); } else { $('#fmap').show(); FMap_Start(); }
}
function GMap(lat,lon) {
gmap = new google.maps.Map(document.getElementById('gmap'), {
zoom: 10,
center: new google.maps.LatLng(lat, lon),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
gmarker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lon),
map: gmap
});
}
function setText(point,text) {
var label = new Label({ map: fmap });
label.bindTo('position', point,'position');
label.set('text',text);
return label;
}
function ShowFMarkers() {
fmarkers = [];
for (i=0;i<=gc;i++) {
var lat = gallery[i]["lat"];
var lon = gallery[i]["lon"];
var subtitle = gallery[i]["number"]+" "+gallery[i]["title"];
var point = new google.maps.LatLng(lat,lon);
var markerOptions =
{
name: 'm_'+i,
inx: i,
position: point,
map: fmap,
title: subtitle,
clickable: true,
zIndex: 10
}
var fmarker = new google.maps.Marker(markerOptions);
google.maps.event.addListener(fmarker, 'click', (function(fmarker, i) {
return function() {
ShowPhoto(g,fmarker.inx);
}
})(fmarker, i));
var label = setText(fmarker,gallery[i]["number"]);
fmarkers.push(fmarker);
}
}
function FMap_Start() {
if (fmap==undefined) {
fmap = new google.maps.Map(document.getElementById('fmap'), {
zoom: 6,
center: new google.maps.LatLng(52, 19.5),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
ShowFMarkers();
}
}
function ShowPhoto(gnb,pnb) {
if (gnb!=g) {
window.location.href = "./?g="+gnb+"&p="+pnb;
} else {
if (pnb < 0) { pnb = gc; }
if (pnb > gc) { pnb = 0; }
var subtitle = gallery[pnb]["number"]+" "+gallery[pnb]["title"];
$('#subtitle').text(subtitle);
var ident = gallery[pnb]["ident"];
$('#desc').load('./templates/default/desc.php?ident='+ident);
$('#dialog-content').load('./templates/default/preview.php?gnb='+gnb+'&pnb='+pnb+'&distance='+gallery[pnb]["distance"]+'&image='+gallery[pnb]["image"]);
$('#dialog').jqmShow();
var lat = gallery[pnb]["lat"];
var lon = gallery[pnb]["lon"];
GMap(lat,lon);
$('#target').focus();
$('#dialog-desc').scrollTop(0);
}
}
function GoToolTip(tnb) {
$('#dialog-tooltip').text('');
$('#dialog-tooltip').load('./templates/default/tooltip.php?tnb='+tnb);
$('#dialog-tooltip').slideDown(100);
setTimeout("$('#dialog-tooltip').slideUp(100);",5000);
}
function GoInfo() {
$('#dialog-tooltip').text('');
var info ="";
var author = gallery[pnb]["author"];
info = "Autor: "+author+"
";
var date = gallery[pnb]["date"];
info = info + "Data zdjecia: "+date+"
";
var lato = gallery[pnb]["lat_orig"];
var lono = gallery[pnb]["lon_orig"];
info = info + "Lokalizacja: "+lato+", "+lono;
$('#dialog-tooltip').html(info);
$('#dialog-tooltip').slideDown(100);
setTimeout("$('#dialog-tooltip').slideUp(100);",5000);
}
function HidePhoto() {
$('#dialog').jqmHide();
}
function GoReview() {
if ($('#review').is(':hidden')) { $('#review').slideDown(100); $('#lreview').text('Ukryj recenzję'); } else { $('#review').slideUp(100); $('#lreview').text('Zobacz recenzję'); }
}
$(document).ready(function(){
$('#dialog')
.jqm({
trigger:'#dialogTrigger',
overlay: 50,
onShow: function(h) {
/* callback executed when a trigger click. Show notice */
h.w.fadeIn();
},
onHide: function(h) {
/* callback executed on window hide. Hide notice, overlay. */
h.w.fadeOut("fast",function() { if(h.o) h.o.remove(); }); }
});
$("body").delegate('.imgi','mouseover mouseleave', function(e){
if (e.type == 'mouseover') {
var objid = $(this).attr("id");
SelImgi(objid);
} else {
SelImgi(null);
}
});
$("body").delegate('[id*=g_]','mouseover mouseleave', function(e){
if (e.type == 'mouseover') {
var gobjid = $(this).attr("id");
var objid = gobjid.replace("g_","i_");
SelImgi(objid);
SelMenu(gobjid);
} else {
SelMenu(null);
SelImgi(null);
}
});
if (p!="") { ShowPhoto(g,p); }
});