 

function t117_appendMap() {

    if (typeof google === 'object' && typeof google.maps === 'object') {

        t117_handleApiReady();

    } else {

    	if(window.googleapiiscalled!==true){

	        var script = document.createElement("script");

	        script.type = "text/javascript";

	        script.src = "//maps.google.com/maps/api/js?callback=t117_handleApiReady";

	        document.body.appendChild(script);

	        window.googleapiiscalled=true;

	    }

    }

}



function t117_handleApiReady(){

    $('.t117_map').each(function(index,Element) {

		var el=$(Element);

		window.isDragMap = $isMobile ? false : true;

            

		if(el.attr('data-map-style')!=''){var mapstyle=eval(el.attr('data-map-style'));}else{var mapstyle='[]';}

	    var myLatlng = new google.maps.LatLng(parseFloat(el.attr('data-map-x')), parseFloat(el.attr('data-map-y')));

	    var myOptions = {

            zoom: parseInt(el.attr('data-map-zoom')),

			center:myLatlng,

			scrollwheel: false,

			draggable: window.isDragMap,          

			zoomControl: true,

            styles: mapstyle                                                     	

	    };

	    

	    var map = new google.maps.Map(Element, myOptions);

	

	    var marker = new google.maps.Marker({

	        position: myLatlng,

	        map: map,

	        title:el.attr('data-map-title')

	    });

	    

		// Resizing the map for responsive design

		google.maps.event.addDomListener(window, "resize", function() {

			var center = map.getCenter();

			google.maps.event.trigger(map, "resize");

			map.setCenter(center); 

		});

      

        // DBL Click - activate on mobile      

        if ($isMobile) {

          google.maps.event.addDomListener(window, "dblclick", function() {

            if (window.isDragMap) {

	            window.isDragMap = false;

            } else {

	            window.isDragMap = true;

            }

            map.setOptions({draggable: window.isDragMap});

          }); 

        }

      

    });	

} 

function t232_expandtext(recid){

  $("#rec"+recid).find(".t232__text").toggle();

}
function expandtext(recid){

	$("#rec"+recid).find(".t232__text").toggle();

}

function t381_appearMenu(recid) {

    var window_width=$(window).width();

    if(window_width>980){

         $(".t381").each(function() {

                var el=$(this);

                var appearoffset=el.attr("data-appearoffset");

                var hideoffset=el.attr("data-hideoffset");

                if(appearoffset!=""){

                        if(appearoffset.indexOf('vh') > -1){

                            appearoffset = Math.floor((window.innerHeight * (parseInt(appearoffset) / 100)));

                        }



                        appearoffset=parseInt(appearoffset, 10);



                        if ($(window).scrollTop() >= appearoffset) {

                          if(el.css('visibility') == 'hidden'){

                              el.finish();

                              el.css("visibility","visible");

                              el.animate({"opacity": "1"}, 300,function() {

                              });       

                          }

                        }else{

                          el.stop();

                          el.css("visibility","hidden");

                        }

                }



                if(hideoffset!=""){

                        if(hideoffset.indexOf('vh') > -1){

                            hideoffset = Math.floor((window.innerHeight * (parseInt(hideoffset) / 100)));

                        }



                        hideoffset=parseInt(hideoffset, 10);



                        if ($(window).scrollTop()+$(window).height() >= $(document).height() - hideoffset) {

                          if(el.css('visibility') != 'hidden'){

                              el.finish();

                              el.css("visibility","hidden");

                          }

                        }else{

                          if (appearoffset!="") {

                              if($(window).scrollTop() >= appearoffset){

                                el.stop();

                                el.css("visibility","visible");

                              }

                          }else{

                              el.stop();

                              el.css("visibility","visible");

                          }

                        }

                }

         });

    }

}



