Current File : /home/aventura/public_html/js/googleMap.js |
/*$(window).load(function(){*/
var mapUrl = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Brooklyn,+New+York,+NY,+United+States&aq=0&sll=37.0625,-95.677068&sspn=61.282355,146.513672&ie=UTF8&hq=&hnear=Brooklyn,+Kings,+New+York&ll=40.649974,-73.950005&spn=0.01628,0.025663&z=14&iwloc=A&output=embed",
onLoadWebSite = true,
googleMapHolder = $(".google_map"),
backgroundColor = googleMapHolder.css("backgroundColor"),
mapWidth=googleMapHolder.css("width"),
mapHeight=googleMapHolder.css("height"),
borderTopLeftRadius = googleMapHolder.css("borderTopLeftRadius"),
borderTopRightRadius = googleMapHolder.css("borderTopLeftRadius"),
borderBottomLeftRadius = googleMapHolder.css("borderTopLeftRadius"),
borderBottomRightRadius = googleMapHolder.css("borderTopLeftRadius"),
addMap=false,
idPage,
intervalCall;
if(backgroundColor == "rgba(0, 0, 0, 0)"){
backgroundColor= "#ffffff";
}
verificationPageHandler();
/*if(onLoadWebSite == false){
$(window).bind("hashchange", verificationPageHandler);
}*/
function verificationPageHandler(){
/*if(onLoadWebSite == false){
idPage = "#"+window.location.hash.substring(3, window.location.hash.length);
if(idPage != "#"){
if(googleMapHolder.parents(idPage).length != 0){
addGoogleMapHandler();
}
}
}else{
addGoogleMapHandler();
} */
addGoogleMapHandler();
}
function addGoogleMapHandler(){
if(!addMap){
addMap = true;
// $(window).unbind("hashchange", verificationPageHandler);
googleMapHolder.css({"overflow":"hidden"});
googleMapHolder.append("<div id='loaderPart' style='position:absolute; z-index:1; width:"+mapWidth+"; height:"+mapHeight+"; background:"+backgroundColor+" url(images/googleMapLoader.gif) no-repeat 50%; border-top-left-radius:"+borderTopLeftRadius+"; border-top-right-radius:"+borderTopRightRadius+"; border-bottom-right-radius:"+borderBottomLeftRadius+"; border-bottom-left-radius:"+borderBottomRightRadius+";'></div>");
// intervalCall = setInterval(addIframe, 200)
addIframe();
}
function addIframe(){
//if($(idPage).css("display")!="none"){
//clearInterval(intervalCall);
googleMapHolder.append("<iframe width='"+mapWidth+"' height='"+mapHeight+"' frameborder='0' src='"+mapUrl+"' style='position:absolute; z-index:0; border-top-left-radius:"+borderTopLeftRadius+"; border-top-right-radius:"+borderTopRightRadius+"; border-bottom-right-radius:"+borderBottomLeftRadius+"; border-bottom-left-radius:"+borderBottomRightRadius+";'></iframe>");
googleMapHolder.find("iframe").load(googleMapLoadCompleteHandler);
//}
}
}
function googleMapLoadCompleteHandler(){
var loaderPart = googleMapHolder.find("#loaderPart");
loaderPart.delay(100).fadeOut(500, function(){loaderPart.css({"display":"none"});});
}
//})