function load() { if (GBrowserIsCompatible()) { //添加基本的图片信息 var baseIcon = new GIcon(); baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png"; baseIcon.iconSize = new GSize(20, 34); baseIcon.shadowSize = new GSize(37, 34); baseIcon.iconAnchor = new GPoint(9, 34); baseIcon.infoWindowAnchor = new GPoint(9, 2); baseIcon.infoShadowAnchor = new GPoint(18, 25) var map = new GMap2(document.getElementById("map")); var customUI = map.getDefaultUI(); customUI.controls.maptypecontrol = false; customUI.controls.menumaptypecontrol = true; map.setUI(customUI); map.addControl(new GOverviewMapControl()); function crossCenter() {} crossCenter.prototype = new GControl(); crossCenter.prototype.initialize = function(map) { var container = document.createElement("div"); var imgDiv = document.createElement("div"); this.setButtonStyle_(imgDiv); container.appendChild(imgDiv); GEvent.addDomListener(imgDiv, "move", function() { }); map.getContainer().appendChild(container); return container; } // By default, the control will appear in the top left corner of the // map with 7 pixels of padding. crossCenter.prototype.getDefaultPosition = function() { var size=map.getSize().toString(); var test=size.replace("(","").replace(")","").split(","); var x=test[0]-493; var y=test[1]-400; return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y)); } // Sets the proper CSS for the given button element. crossCenter.prototype.setButtonStyle_ = function(button) { button.id="overInfo"; button.style.textDecoration = "none"; button.style.color = "#FFFFFF"; //button.style.width = "128px"; button.style.backgroundColor = "#000"; //button.style.font = "small Arial"; button.style.border = "2px solid #F4F4F4"; button.style.padding = "5px"; button.style.filter = "Alpha(Opacity=60)"; button.style.opacity = "0.6"; button.style.textAlign = "left"; // button.style.cursor = "pointer"; button.innerHTML="您可以随意拖动地图上的红色游标到您想标记的位置"; } map.addControl(new crossCenter()); function createMarker(point, index, html) { var marker = new GMarker(point,{draggable: true}); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } map.setCenter(new GLatLng(39.99467078609602, 116.40203475952148), 11); var point = new GLatLng(39.99467078609602,116.40203475952148); var html="呵呵,这里将来就是您的地盘了~!
地址:
"; var marker = createMarker(point, 0,html); GEvent.addListener(marker, "dragstart", function() { map.closeInfoWindow(); }); GEvent.addListener(map, "move", function() { map.closeInfoWindow(); var center = map.getCenter(); marker.setLatLng(new GLatLng(center.y,center.x)); }); GEvent.addListener(marker, "dragend", function() { marker.openInfoWindowHtml(html); var center = map.getCenter(); parent.document.getElementById("x").value = center.x; parent.document.getElementById("y").value = center.y; }); map.addOverlay(marker); } } function save() { if($("#address").val()!="") { $("#map").slideUp("fast"); } else { alert("请填写据点地址!"); } } function Exception() { //nothing to do } var isopen=0; function selectMap() { $("#mapx").slideDown("fast"); $("#map").slideDown("fast"); if(isopen==0) window.setTimeout("load();",500); isopen=1; } function isEmail(str) { var res = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; var re = new RegExp(res); return !(str.match(re) == null); } function isMobile(str) { var res=/^[0]{0,1}(13|15|01|18){1}(\d){1}[ ]?[-]?(\d){7,8}$/; var re = new RegExp(res); return !(str.match(re) == null); } function checkForm(theForm) { if(theForm.mobileOk.value=="1" || theForm.mobile.value=="") { alert("手机号不正确!"); theForm.mobile.focus(); return false; } if(theForm.emailOk.value=="1" || theForm.email.value=="") { alert("电子邮件不正确!"); theForm.email.focus(); return false; } if(theForm.unameOk.value=="1" || theForm.nickname.value=="") { alert("用户名不正确!"); theForm.nickname.focus(); return false; } if((theForm.city.value==0 || theForm.office.value==0)) { alert("请选择您所在的写字楼!"); return false; } if(theForm.sendmobile.value=="" || theForm.sendmobileOk.value=="0") { alert("推荐人手机号填写不正确或该用户不存在!"); theForm.email.focus(); return false; } $("#mainReg").hide(); $("#v").show(); return true; } function checkMobile() { if($("#mobile").val()!=""){ var mvalue=$("#mobile").val(); if(isMobile(mvalue) && mvalue!="" && mvalue.length>10){ $.ajax({ url: "class/ajax/reg/check.php?type=mobile&mobile="+encodeURIComponent($("#mobile")[0].value), type: "GET", dataType: "text", timeout: 10000, error: Exception(), success: function(text){ $("#mobileStatus").html(text=="0"?"":"该手机号已经被注册!"); $("#mobileOk").val(text); } }); }else if($("#mobile").val()!=""){ $("#mobileStatus").html("手机号不符合规则!"); $("#mobileOk").val("1"); } }else{ $("#mobileStatus").html("貌似手机号没填,别一会儿忘了!"); $("#mobileOk").val("1"); } } function checkInvMobile(){ if($("#sendmobile").val()!=""){ if(isMobile($("#sendmobile").val()) && $("#sendmobile").val()!=""){ $.ajax({ url: "class/ajax/reg/check.php?type=invmobile&mobile="+encodeURIComponent($("#sendmobile")[0].value), type: "GET", dataType: "text", timeout: 10000, error: Exception(), success: function(text){ $("#sendmobileStatus").html(text=="1"?"":"该手机号不是六人行会员或已被系统加入黑名单!"); $("#sendmobileOk").val(text); } }); }else if($("#sendmobile").val()!=""){ $("#sendmobileStatus").html("手机号不正确!"); $("#sendmobileOk").val("0"); } }else{ $("#sendmobileStatus").html("貌似邀请者手机号没填,别一会儿忘了!"); $("#sendmobileOk").val("1"); } } function checkEmail(){ if(isEmail($("#email").val())){ $.ajax({ url: "class/ajax/reg/check.php?type=email&email="+encodeURIComponent($("#email")[0].value), type: "GET", dataType: "text", timeout: 10000, error: Exception(), success: function(text){ $("#emailStatus").html(text=="0"?"":"该Email地址已经被注册!"); $("#emailOk").val(text); } }); }else{ $("#emailStatus").html("貌似Email格式不对或没有填写,别一会儿忘了!"); $("#emailOk").val("1"); } } function checkUser(){ if($("#nickname").val()!=""){ var b=/^[a-zA-Z0-9\u4e00-\u9fa5\_]+$/; if(b.test($("#nickname").val())){ $.ajax({ url: "class/ajax/reg/check.php?type=user&name="+encodeURIComponent($("#nickname").val()), type: "GET", dataType: "text", timeout: 10000, error: Exception(), success: function(text){ $("#userStatus").html(text=="0"?"":"该用户名已经被注册!"); $("#unameOk").val(text); } }); }else{ $("#userStatus").html("用户名只允许使用汉字、字母、数字与下划线!"); $("#unameOk").val("1"); } }else{ $("#userStatus").html("貌似用户名没填,别一会儿忘了!"); $("#unameOk").val("1"); } } function checkAgreement(){ $("#tonext").attr("disabled",($("#tonext").attr("disabled")==true)?false:true); } $(function() { $('#city').chainSelect('#district','js/combobox.php', { before:function (target) //before request hide the target combobox and display the loading message { $("#loading").css("display","block"); $(target).css("display","none"); }, after:function (target) //after request show the target combobox and hide the loading message { $("#loading").css("display","none"); $(target).css("display","inline"); } }); $('#district').chainSelect('#office','js/combobox.php', { before:function (target){ $("#loading").css("display","block"); $(target).css("display","none"); }, after:function (target){ $("#loading").css("display","none"); $(target).css("display","inline"); } }); });