File: /home/awaldron/_domains/_waldroninteractive.com/js/googleMap.js
$(window).load(function(){
var mapUrl = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Pittsburgh,+PA+15235+United+States&aq=0&ie=UTF8&hq=&ll=40.441068,-79.999523&spn=0.01628,0.025663&z=12&iwloc=A&output=embed",
onLoadWebSite = false,
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();
}
}
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)
}
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"});});
}
})