var tx_odstores_pi1_map=new Class({initialize:function(options){if(!this.prefixId){this.prefixId="tx_odstores_pi1";this.linksPlanDirections=new Array();$each($$("a[id^="+this.prefixId+"_link_plan_directions_]"),function(link){link.addEvent("click",function(e){new Event(e).stop()});this.linksPlanDirections.push(link)},this);if($(this.prefixId+"_link_find_store")){$(this.prefixId+"_link_find_store").addEvent("click",function(e){new Event(e).stop()})}if(!options.mapId||!$(options.mapId)){return}this.dialogStreet="";this.dialogCity="";if(options.getDirectionsDialog&&options.getDirectionsDialog instanceof Object&&options.getDirectionsDialog["content"]){this.getDirectionsDialog=new Object();this.getDirectionsDialog.content=options.getDirectionsDialog["content"];if(options.getDirectionsDialog["title"]){this.getDirectionsDialog.title=options.getDirectionsDialog["title"]}else{this.getDirectionsDialog.title=""}if(options.getDirectionsDialog["width"]){this.getDirectionsDialog.width=parseInt(options.getDirectionsDialog["width"])}else{this.getDirectionsDialog.width=300}if(options.getDirectionsDialog["height"]){this.getDirectionsDialog.height=parseInt(options.getDirectionsDialog["height"])}else{this.getDirectionsDialog.height=170}if(options.getDirectionsDialog["startingPointNotFoundMessage"]){this.getDirectionsDialog.startingPointNotFoundMessage=options.getDirectionsDialog["startingPointNotFoundMessage"]}if(options.getDirectionsDialog["startingPointErrorMessage"]){this.getDirectionsDialog.startingPointErrorMessage=options.getDirectionsDialog["startingPointErrorMessage"]}this.getDirectionsDialog.travel="by_car"}if(options.findStoreDialog&&options.findStoreDialog instanceof Object&&options.findStoreDialog["content"]){this.findStoreDialog=new Object();this.findStoreDialog.content=options.findStoreDialog["content"];if(options.findStoreDialog["title"]){this.findStoreDialog.title=options.findStoreDialog["title"]}else{this.findStoreDialog.title=""}if(options.findStoreDialog["width"]){this.findStoreDialog.width=parseInt(options.findStoreDialog["width"])}else{this.findStoreDialog.width=300}if(options.findStoreDialog["height"]){this.findStoreDialog.height=parseInt(options.findStoreDialog["height"])}else{this.findStoreDialog.height=145}if(options.findStoreDialog["addressNotFoundMessage"]){this.findStoreDialog.addressNotFoundMessage=options.findStoreDialog["addressNotFoundMessage"]}}this.geocoder=new GClientGeocoder()}if(options.mapCenterLat&&options.mapCenterLng){this.mapCenter=new GLatLng(parseFloat(options.mapCenterLat),parseFloat(options.mapCenterLng))}else{if(options.mapCenterStreet||options.mapCenterCity){this.address="";if(options.mapCenterStreet){this.address=options.mapCenterStreet;this.dialogStreet=unescape(options.mapCenterStreet)}if(options.mapCenterStreet&&options.mapCenterCity){this.address+=" "}if(options.mapCenterCity){this.address+=options.mapCenterCity;this.dialogCity=unescape(options.mapCenterCity)}this.geocoder.getLatLng(this.address,function(point){if(!point){this.address=false;options.mapCenterCity=false;options.mapCenterStreet=false;this.showaddressNotFoundMessage=true;alert(this.findStoreDialog.addressNotFoundMessage?this.findStoreDialog.addressNotFoundMessage:"Error!")}else{options.mapCenterLat=point.lat();options.mapCenterLng=point.lng()}this.initialize(options)}.bind(this));return}}this.mapDiv=$(options.mapId);if($("tx_odstores_pi1_map_wrap")){this.mapWrap=$("tx_odstores_pi1_map_wrap")}if($("tx_odstores_pi1_loader")){if(this.mapWrap){var size=this.mapDiv.getSize();this.mapLoader=$("tx_odstores_pi1_loader");var sizeLoader=this.mapLoader.getSize();this.mapLoader.setStyles({left:parseInt(size.x/2)-parseInt(sizeLoader.x/2),top:parseInt(size.y/2)-parseInt(sizeLoader.y/2)})}}if(parseInt(options.mapZoom)>0){this.mapZoom=parseInt(options.mapZoom)}else{}if(options.disableDefaultUI){this.disableDefaultUI=true}if(options.mapTypes){this.mapTypes=new Array();$each(options.mapTypes.split(","),function(mapType){try{mapType=eval(mapType)}catch(e){}if(mapType instanceof GMapType){this.mapTypes.push(eval(mapType))}},this)}if(options.defaultMapType){try{this.defaultMapType=eval(options.defaultMapType)}catch(e){}if(!this.defaultMapType instanceof GMapType){this.defaultMapType=false}}if(options.disableDragging){this.disableDragging=true}if(options.disableScrollZoom){this.disableScrollZoom=true}if(options.viewportDecreaseWidth){this.viewportDecreaseWidth=parseInt(options.viewportDecreaseWidth)}if(options.viewportDecreaseHeight){this.viewportDecreaseHeight=parseInt(options.viewportDecreaseHeight)}if(options.mapCenterAnchorX){this.mapCenterAnchorX=parseInt(options.mapCenterAnchorX)}if(options.mapCenterAnchorY){this.mapCenterAnchorY=parseInt(options.mapCenterAnchorY)}if(options.mapControls instanceof Object){this.mapControls=new Array();$each(options.mapControls,function(config,name){try{var control=eval("new "+name+"()")}catch(e){}if(!control instanceof GControl){return}var controlSum={control:control,position:control.getDefaultPosition()};if(!config.position){this.mapControls.push(controlSum);return}try{var anchor=eval(config.position)}catch(e){}if(parseInt(anchor)<=0){this.mapControls.push(controlSum);return}controlSum.position.anchor=anchor;if(config.sizeX){controlSum.position.offset.width=parseInt(config.sizeX)}if(config.sizeY){controlSum.position.offset.height=parseInt(config.sizeY)}this.mapControls.push(controlSum)},this)}this.defaultIcon=new GIcon(G_DEFAULT_ICON);this.markerIcon=this.cloneObject(this.defaultIcon);if(options.markerIcons){if(options.markerIcons["defaultImage"]){this.markerIcon.image=options.markerIcons["defaultImage"]}if(options.markerIcons["shadowImage"]){this.markerIcon.shadow=options.markerIcons["shadowImage"]}if(options.markerIcons["iconWidth"]){this.markerIcon.iconSize.width=parseInt(options.markerIcons["iconWidth"])}if(options.markerIcons["iconHeight"]){this.markerIcon.iconSize.height=parseInt(options.markerIcons["iconHeight"])}if(options.markerIcons["shadowWidth"]){this.markerIcon.shadowSize.width=parseInt(options.markerIcons["shadowWidth"])}if(options.markerIcons["shadowHeight"]){this.markerIcon.shadowSize.height=parseInt(options.markerIcons["shadowHeight"])}if(options.markerIcons["iconAnchorX"]){this.markerIcon.iconAnchor.x=parseInt(options.markerIcons["iconAnchorX"])}if(options.markerIcons["iconAnchorY"]){this.markerIcon.iconAnchor.y=parseInt(options.markerIcons["iconAnchorY"])}if(options.markerIcons["infoWindowAnchorX"]){this.markerIcon.infoWindowAnchor.x=parseInt(options.markerIcons["infoWindowAnchorX"])}if(options.markerIcons["infoWindowAnchorY"]){this.markerIcon.infoWindowAnchor.y=parseInt(options.markerIcons["infoWindowAnchorY"])}if(options.markerIcons["printImage"]){this.markerIcon.printImage=options.markerIcons["printImage"]}if(options.markerIcons["printShadowImage"]){this.markerIcon.printShadow=options.markerIcons["printShadowImage"]}if(options.markerIcons["imageMap"]){this.markerIcon.imageMap=new Array();$each(options.markerIcons["imageMap"].split(","),function(coordinate){this.markerIcon.imageMap.push(parseInt(coordinate))},this)}if(options.markerIcons["otherImage"]){this.otherMarkerIconImage=options.markerIcons["otherImage"]}if(options.markerIcons["otherPrintImage"]){this.otherMarkerIconPrintImage=options.markerIcons["otherPrintImage"]}if(options.markerIcons["hoverImage"]){this.hoverMarkerIconImage=options.markerIcons["hoverImage"]}}this.userLocationIcon=this.cloneObject(this.defaultIcon);if(options.userLocationIcon){if(options.userLocationIcon["defaultImage"]){this.userLocationIcon.image=options.userLocationIcon["defaultImage"]}if(options.userLocationIcon["shadowImage"]){this.userLocationIcon.shadow=options.userLocationIcon["shadowImage"]}if(options.userLocationIcon["iconWidth"]){this.userLocationIcon.iconSize.width=parseInt(options.userLocationIcon["iconWidth"])}if(options.userLocationIcon["iconHeight"]){this.userLocationIcon.iconSize.height=parseInt(options.userLocationIcon["iconHeight"])}if(options.userLocationIcon["shadowWidth"]){this.userLocationIcon.shadowSize.width=parseInt(options.userLocationIcon["shadowWidth"])}if(options.userLocationIcon["shadowHeight"]){this.userLocationIcon.shadowSize.height=parseInt(options.userLocationIcon["shadowHeight"])}if(options.userLocationIcon["iconAnchorX"]){this.userLocationIcon.iconAnchor.x=parseInt(options.userLocationIcon["iconAnchorX"])}if(options.userLocationIcon["iconAnchorY"]){this.userLocationIcon.iconAnchor.y=parseInt(options.userLocationIcon["iconAnchorY"])}if(options.userLocationIcon["printImage"]){this.userLocationIcon.printImage=options.userLocationIcon["printImage"]}if(options.userLocationIcon["printShadowImage"]){this.userLocationIcon.printShadow=options.userLocationIcon["printShadowImage"]}}if(options.stores&&options.stores instanceof Object){this.stores=new Object();$each(options.stores,function(store,key){if(!store.lat||!store.lng){return}this.stores[key]=new Object;var icon=this.cloneObject(this.markerIcon);if(store.selected){this.stores[key].selected=true}else{if(this.otherMarkerIconImage){icon.image=this.otherMarkerIconImage}if(this.otherMarkerIconPrintImage){icon.printImage=this.otherMarkerIconPrintImage}}this.stores[key].marker=new GMarker(new GLatLng(store.lat,store.lng),{icon:icon});if(store.infoWindow){GEvent.bind(this.stores[key].marker,"infowindowopen",this,function(){var infoWindow=this.map.getInfoWindow();if(!infoWindow){return}var content=infoWindow.getContentContainers();if(!content&&!content[0]){return}$each($$(this.map,"a[id^="+this.prefixId+"_link_plan_directions_]"),function(link){link.addEvent("click",this.showGetDirectionsDialog.bindWithEvent(this))},this)});this.stores[key].marker.bindInfoWindowHtml(store.infoWindow)}},this)}if(parseInt(options.maxSearchedStores)>0){this.maxSearchedStores=parseInt(options.maxSearchedStores)}else{this.maxSearchedStores=5}if(options.findStoreErrorMessage){this.findStoreErrorMessage=options.findStoreErrorMessage}this.main()},main:function(){this.map=new GMap2(this.mapDiv);if(this.address&&this.mapCenter){var a=new GMarker(this.mapCenter,{icon:this.userLocationIcon,clickable:false});this.map.addOverlay(a);if(this.stores){this.storesUid=new Array();this.storesDistance=new Array();$each(this.stores,function(d,e){this.storesUid.push(e)},this);this.userPosition=this.mapCenter;this.getDistance()}}if(!this.disableDefaultUI){this.map.setUIToDefault()}if(this.mapTypes){$each(this.map.getMapTypes(),function(d){this.map.removeMapType(d)},this);$each(this.mapTypes,function(d){this.map.removeMapType(d);this.map.addMapType(d)},this);if(this.mapTypes.indexOf(G_SATELLITE_MAP)==-1){this.map.removeMapType(G_SATELLITE_MAP)}}if(this.defaultMapType){this.map.setMapType(this.defaultMapType)}if(this.disableDragging){this.map.disableDragging()}if(this.disableScrollZoom){this.map.disableScrollWheelZoom()}else{this.map.enableScrollWheelZoom()}if(this.mapControls){$each(this.mapControls,function(d){if(d.position){this.map.addControl(d.control,d.position)}else{this.map.addControl(d.control)}},this)}if(this.stores){var c=new Array();$each(this.stores,function(e){this.map.addOverlay(e.marker);if(!e.selected){return}var d=e.marker.getLatLng();if(!d){return}c.push(d)},this);if(c.length==0){$each(this.stores,function(e){var d=e.marker.getLatLng();if(!d){return}c.push(d)},this)}if(this.mapZoom){var b=this.mapZoom}this.setViewport(c);if(b){this.mapZoom=b;this.map.setZoom(this.mapZoom)}}if(this.hoverMarkerIconImage){this.bindLinks()}if(this.getDirectionsDialog){this.directions=new GDirections(this.map,$(this.prefixId+"_directions"));GEvent.bind(this.directions,"load",this,function(){var d=this.map.getInfoWindow();if(d){d.hide()}this.getDirectionsDialog.window.close();document.location.href=document.location.href.split("#")[0]+"#"+this.mapDiv.id});GEvent.bind(this.directions,"error",this,function(d){if(d.getStatus().code==G_GEO_UNKNOWN_ADDRESS){if(this.getDirectionsDialog.startingPointNotFoundMessage){alert(this.getDirectionsDialog.startingPointNotFoundMessage)}else{alert(d.getStatus().code)}}else{if(this.getDirectionsDialog.startingPointErrorMessage){alert(this.getDirectionsDialog.startingPointErrorMessage)}else{alert(d.getStatus().code)}}});$each(this.linksPlanDirections,function(d){d.addEvent("click",this.showGetDirectionsDialog.bindWithEvent(this))},this)}if(this.findStoreDialog){if($(this.prefixId+"_link_find_store")){$(this.prefixId+"_link_find_store").addEvent("click",this.showFindStoreDialog.bindWithEvent(this))}}if(this.mapLoader&&!this.userPosition){this.mapLoader.setStyle("display","none")}},setViewport:function(i){if(i.length==0){return}var c=180,e=-180,d=180,f=-180;$each(i,function(j){if(j.lat()<c){c=j.lat()}if(j.lng()<d){d=j.lng()}if(j.lat()>e){e=j.lat()}if(j.lng()>f){f=j.lng()}},this);this.map.checkResize();var a=new GLatLngBounds(new GLatLng(c,d),new GLatLng(e,f));if(a){var h=parseInt($("tx_odstores_pi1_map").getStyle("width"))-(this.viewportDecreaseWidth>0?this.viewportDecreaseWidth:0);var g=parseInt($("tx_odstores_pi1_map").getStyle("height"))-(this.viewportDecreaseHeight>0?this.viewportDecreaseHeight:0);var b=this.map.getCurrentMapType();this.mapZoom=b.getBoundsZoomLevel(a,new GSize(h,g));if(this.mapZoom){this.mapCenter=new GLatLng(c+(e-c)/2,d+(f-d)/2);this.map.setCenter(this.mapCenter,this.mapZoom);if(this.mapCenterAnchorX||this.mapCenterAnchorY){this.map.panBy(new GSize(this.mapCenterAnchorX?this.mapCenterAnchorX:0,this.mapCenterAnchorY?this.mapCenterAnchorY:0))}}}},sortDistance:function(){for(var c=0;c<this.maxSearchedStores;c++){var g=40075004000;var e=null;$each(this.stores,function(h,i){if(!h.distance){return}if(h.selected){return}if(h.distance<g){g=h.distance;e=i}},this);if(!e){break}this.storesDistance.push(e);this.stores[e].selected=true;this.stores[e].marker.setImage(this.markerIcon.image)}if(this.storesDistance.length<=0){if(this.mapLoader){this.mapLoader.setStyle("display","none")}alert(this.findStoreErrorMessage?this.findStoreErrorMessage:"Error!");return}var d="";var f=new Array();f.push(this.userPosition);$each(this.storesDistance,function(i){if(d!=""){d+="+"}d+=i;var h=this.stores[i].marker.getLatLng();if(!h){return}f.push(h)},this);this.setViewport(f);var b=document.location.href.split("#")[0];b=b.split("?")[0];var a=new Request.HTML();a.onSuccess=function(i){if(this.mapLoader){this.mapLoader.setStyle("display","none")}var h=$(this.prefixId+"_searched_stores");if(!h){return}h.adopt(i);this.bindLinks(h)}.bindWithEvent(this);a.onFailure=function(){if(this.mapLoader){this.mapLoader.setStyle("display","none")}}.bindWithEvent(this);a.options.url=b+"?"+this.prefixId+"[searched_stores]="+d;a.send()},getDistance:function(){var a=new GDirections(null,null);this.getDistanceDirectionsLoad=GEvent.bind(a,"load",this,function(){var b=a.getDistance().meters;if(b){this.stores[this.storesUid[0]].distance=b}this.storesUid.erase(this.storesUid[0]);if(this.storesUid.length<=0){this.sortDistance();return}this.getDistance()});this.getDistanceDirectionsError=GEvent.bind(a,"error",this,function(){this.storesUid.erase(this.storesUid[0]);if(this.storesUid.length<=0){this.sortDistance();return}this.getDistance()});a.load("from: "+this.address+" to: "+this.stores[this.storesUid[0]].marker.getLatLng())},saveGetDirectionsDialog:function(){if(this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street")){this.dialogStreet=this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street").value}if(this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city")){this.dialogCity=this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city").value}if(this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking")&&this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking").checked){this.getDirectionsDialog.travel="walking"}else{this.getDirectionsDialog.travel="by_car"}},saveFindStoreDialog:function(){if(this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street")){this.dialogStreet=this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street").value}if(this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city")){this.dialogCity=this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city").value}},showGetDirectionsDialog:function(b){new Event(b).stop();this.getDirectionsDialog.window=new MUI.Modal({id:this.prefixId+"_get_directions_dialog",title:this.getDirectionsDialog.title,content:this.getDirectionsDialog.content,width:this.getDirectionsDialog.width,height:this.getDirectionsDialog.height,onClose:this.saveGetDirectionsDialog.bindWithEvent(this),onCloseComplete:function(){}.bindWithEvent(this)});var a=this.getDirectionsDialog.window.windowEl.getElements("form");if(a.length>0){a=a[0]}else{return}a.addEvent("submit",this.getDirections.bindWithEvent(this,{dialog:this.getDirectionsDialog.window,link:b.target}));if(this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street")){this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street").value=this.dialogStreet}if(this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city")){this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city").value=this.dialogCity}if(this.getDirectionsDialog.travel=="walking"&&this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking")){this.getDirectionsDialog.window.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking").checked=true}},showFindStoreDialog:function(b){new Event(b).stop();this.findStoreDialog.window=new MUI.Modal({id:this.prefixId+"_find_store_dialog",title:this.findStoreDialog.title,content:this.findStoreDialog.content,width:this.findStoreDialog.width,height:this.findStoreDialog.height,onClose:this.saveFindStoreDialog.bindWithEvent(this),onCloseComplete:function(){}.bindWithEvent(this)});var a=this.findStoreDialog.window.windowEl.getElements("form");if(a.length>0){a=a[0]}else{return}a.addEvent("submit",this.findStore.bindWithEvent(this,{dialog:this.findStoreDialog.window,link:b.target}));if(this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street")){this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street").value=this.dialogStreet}if(this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city")){this.findStoreDialog.window.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city").value=this.dialogCity}},getDirections:function(c,d){new Event(c).stop();if(this.getDistanceDirectionsError){GEvent.removeListener(this.getDistanceDirectionsError)}if(this.getDistanceDirectionsLoad){GEvent.removeListener(this.getDistanceDirectionsLoad)}if(this.mapLoader){this.mapLoader.setStyle("display","none")}var e="";if(d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street")){e+=d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_street").value}if(d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city")){if(e!=""){e+=" "}e+=d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_city").value}var a=new Object;if(d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking")&&d.dialog.windowEl.getElementById(this.prefixId+"_get_directions_dialog_content_walking").checked){a={travelMode:G_TRAVEL_MODE_WALKING}}else{a={travelMode:G_TRAVEL_MODE_DRIVING}}var b=parseInt(d.link.id.substring((this.prefixId+"_link_plan_directions_").length));if(!b||!this.stores[b]||!this.stores[b].marker){return}if($(this.prefixId+"_directions")){$(this.prefixId+"_directions").innerHTML=""}this.directions.load("from: "+e+" to: "+this.stores[b].marker.getLatLng(),a)},findStore:function(b,c){new Event(b).stop();var a="";if(c.dialog.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street")){a+=c.dialog.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_street").value}if(c.dialog.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city")){if(a!=""){a+=" "}a+=c.dialog.windowEl.getElementById(this.prefixId+"_find_store_dialog_content_city").value}this.geocoder.getLatLng(a,function(d){if(!d){alert(this.findStoreDialog.addressNotFoundMessage?this.findStoreDialog.addressNotFoundMessage:"Error!");return}var e=this.findStoreDialog.window.windowEl.getElements("form");if(e.length<=0){return}e[0].submit();c.dialog.close()}.bind(this))},bindLinks:function(a){if(!a){a=document}$each(a.getElements("a"),function(c){var b=c.href.split("?");if(!b[1]){return}var d=b[1].split("&");$each(d,function(e){e=e.split("=");if(unescape(e[0])!=this.prefixId+"[store_uid]"||parseInt(e[1])<=0){return}c.addEvent("mousemove",function(){if(!this.stores[e[1]]||this.stores[e[1]].markerHover){return}this.stores[e[1]].marker.setImage(this.hoverMarkerIconImage);this.stores[e[1]].markerHover=true;$each(this.stores,function(f){if(!f.markerHover||f==this.stores[e[1]]){return}f.markerHover=false;f.marker.setImage(this.markerIcon.image)},this)}.bindWithEvent(this));c.addEvent("mouseout",function(){if(!this.stores[e[1]]||!this.stores[e[1]].markerHover){return}this.stores[e[1]].marker.setImage(this.markerIcon.image);this.stores[e[1]].markerHover=false}.bindWithEvent(this))},this)},this)},mousePosition:function(a){this.mousex=a.page.x;this.mousey=a.page.y},cloneObject:function(c){if(c==null||typeof(c)!="object"){return c}var a=new c.constructor();for(var b in c){a[b]=this.cloneObject(c[b])}return a}});