Embedding google maps in office form.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 27 Jun 2012 12:35:05 +0000 (14:35 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 27 Jun 2012 12:35:05 +0000 (14:35 +0200)
apps/companyfront/modules/office/config/view.yml [new file with mode: 0644]
apps/companyfront/modules/office/templates/_formCustomOffice.php
apps/companyfront/modules/office/templates/_formCustomOfficeAds.php
apps/companyfront/modules/office/templates/indexSuccess.php
lib/form/doctrine/OfficeForm.class.php
web/css/inadminpanel/style.googlemaps.css [new file with mode: 0644]
web/js/googlemaps.js [new file with mode: 0644]

diff --git a/apps/companyfront/modules/office/config/view.yml b/apps/companyfront/modules/office/config/view.yml
new file mode 100644 (file)
index 0000000..ca64440
--- /dev/null
@@ -0,0 +1,20 @@
+# You can find more information about this file on the symfony website:
+# http://www.symfony-project.org/reference/1_4/en/13-View
+
+default:
+  http_metas:
+    content-type: text/html
+
+  metas:
+    #title:        symfony project
+    #description:  symfony project
+    #keywords:     symfony, project
+    #language:     en
+    #robots:       index, follow
+
+  stylesheets:    [inadminpanel/niceforms-default.css]
+
+  javascripts:    [jquery-1.6.2.min.js, inadminpanel/ddaccordion.js]
+
+  has_layout:     true
+  layout:         layout
index 8963f67..d01f104 100644 (file)
@@ -1,4 +1,6 @@
 <?php use_stylesheets_for_form($form) ?>
+<?php use_stylesheet('inadminpanel/style.googlemaps.css') ?>
+<?php use_javascript('googlemaps.js') ?>
 <?php use_javascripts_for_form($form) ?>
 
 <script type="text/javascript">
@@ -67,3 +69,5 @@
         </tbody>
    </table>
 </form>
+
+<div id="map_canvas" style="width:100%; height:40%"></div>
index d21b54d..9b03e40 100644 (file)
@@ -1,4 +1,5 @@
 <?php use_stylesheets_for_form($form) ?>
+<?php use_stylesheet('inadminpanel/style.css') ?>
 <?php use_javascripts_for_form($form) ?>
 <?php use_javascript('/sfFormExtraPlugin/js/double_list.js') ?>
 
index ca167a2..a3043ef 100644 (file)
@@ -1,3 +1,5 @@
+<?php use_stylesheet('inadminpanel/style.css') ?>
+
 <h2><?php echo __('Offices Index') ?></h2>
 
 <?php if ($pager->haveToPaginate()): ?>
index b6f4b5d..4bc21a3 100644 (file)
@@ -14,6 +14,7 @@ class OfficeForm extends BaseOfficeForm
   {
     $this->useFields(array('city_id', 'office_street_address', 'office_zip'));
 
+    $query = null;
     if($this->isNew()) 
     {
         $country = CountryTable::getInstance()->findOnebyCountryName(sfConfig::get('app_default_country'));
diff --git a/web/css/inadminpanel/style.googlemaps.css b/web/css/inadminpanel/style.googlemaps.css
new file mode 100644 (file)
index 0000000..f7875d7
--- /dev/null
@@ -0,0 +1,584 @@
+html { height: 100% }
+body
+{
+background:url(/images/inadminpanel/images/bg.jpg) no-repeat center top #310b28;
+font-family:Arial, Helvetica, sans-serif;
+padding:0;
+font-size:12px;
+margin:0 auto;
+color: #0e4354;
+height: 100%;
+}
+.clear{
+clear:both;
+}
+a{
+color:#256c89;
+}
+h2{
+font-size:18px;
+color:#256c89;
+font-weight:normal;
+padding:0px 0 15px 0;
+margin:0px;
+clear:both;
+}
+h3{
+font-size:18px;
+color:#256c89;
+font-weight:normal;
+padding:15px 0 5px 20px;
+margin:0px;
+float:left;
+clear:both;
+}
+a.forgot_pass{
+float:right;
+color:#256c89;
+text-decoration:none;
+background:url(images/help.png) no-repeat left;
+padding:0 0 0 18px;
+display:block;
+margin:15px 20px 0 0;
+}
+#main_container{
+margin:0 auto;
+width:900px;
+height:100%;
+padding:0px 0 0px 0;
+}
+.header{
+width:900px;
+height:100px;
+}
+.header_login{
+width:600px;
+margin:auto;
+}
+.logo{
+float:left;
+padding:35px 0 0 0;
+}
+#clock_a{
+float:right;
+padding:15px 0 0 0;
+}
+.jclock{
+color:#FFFFFF;
+float:right;
+font-size:22px;
+font-weight:bold;
+padding:34px 25px 0 0;
+}
+.right_header{
+width:350px;
+float:right;
+text-align:right;
+color:#FFFFFF;
+padding:40px 0 0 0;
+}
+.right_header a{
+margin:0 5px 0 5px;
+text-decoration:underline;
+color:#FFFFFF;
+}
+.right_header a.messages{
+background:url(/images/inadminpanel/images/comment.png) no-repeat right;
+padding-right:20px;
+}
+.right_header a.logout{
+background:url(/images/inadminpanel/images/user_logout.png) no-repeat right;
+padding-right:20px;
+}
+
+.main_content{
+margin:0 auto;
+width:900px;
+height:100%;
+padding:0px 0 50px 0;
+background:url(/images/inadminpanel/images/menu_bg.jpg) no-repeat center top #fff;
+}
+.footer{width:900px;height:87px;background:url(/images/inadminpanel/images/footer_bg.jpg) no-repeat center top;}
+.footer_login{width:600px;margin:auto;}
+
+.left_footer{float:left;padding:25px 0 0 10px;color:#a8549b;font-size:11px;}
+.left_footer a{color:#FFFFFF;text-decoration:none;}
+.right_footer{float:right;padding:25px 10px 0 0;}
+
+.left_footer_login{float:left;padding:15px 0 0 10px;color:#a8549b;font-size:11px;}
+.left_footer_login a{color:#FFFFFF;text-decoration:none;}
+.right_footer_login{float:right;padding:15px 10px 0 0;}
+/*---------------- menu----------------------*/
+.menu {font-size:11px;padding:0px 10px 0 10px; float:left; width:880px;}
+
+/* remove all the bullets, borders and padding from the default list styling */
+.menu ul {padding:0;margin:0;list-style-type:none; height:34px;}
+
+/* style the sub-level lists */
+.menu ul ul {width: auto;}
+
+/* float the top list items to make it horizontal and a relative positon so that you can control the dropdown menu positon */
+.menu ul li {float:left;height:34px;line-height:34px;}
+
+/* style the sub level list items */
+.menu ul ul li {display:block;width: auto;height:auto;position:relative;line-height:1em;}
+
+/* style the links for the top level */
+.menu a, .menu a:visited {display:block;float:left;height:100%;font-size:11px;text-decoration:none;color:#fff;padding:0 21px 0 17px;}
+.menu a.current{background:url(/images/inadminpanel/images/menu_bg.gif) repeat-x center;}
+/* style the sub level links */
+.menu ul ul a, .menu ul ul a:visited {display:block;background:#57c0e8; border-bottom:1px #81dafc solid; color:#fff;width:12em;height:100%;line-height:1em;padding:1em 1em;}
+.menu ul table ul a, .menu ul table ul a:visited  {width:14em; w\idth:12em;}
+
+
+/* style the table so that it takes no part in the layout - required for IE to work */
+.menu table {position:absolute; left:0; top:0; font-size:1em; z-index:-1;}
+.menu ul ul table {lef\t:-1px;}
+.menu ul ul table ul.left {margin-lef\t:2px;}
+
+.menu li:hover {position:relative;}
+* html .menu a:hover {position:relative;}
+
+/* style the third level background */
+.menu ul ul ul a, .menu ul ul ul a:visited {background:#57c0e8;}
+/* style the fourth level background */
+.menu ul ul ul ul a, .menu ul ul ul ul a:visited {background:#57c0e8;}
+/* style the sub level 1 background */
+.menu ul :hover a.sub1 {background:url(/images/inadminpanel/images/arrow.gif) no-repeat right #309dc7;}
+/* style the sub level 2 background */
+.menu ul ul :hover a.sub2 {background:url(/images/inadminpanel/images/arrow.gif) no-repeat right #088bb4;}
+
+/* style the level hovers */
+/* first */
+.menu a:hover {color:#fff;background:url(/images/inadminpanel/images/menu_bg.gif) repeat-x center;}
+.menu :hover > a {color:#fff;background:url(/images/inadminpanel/images/menu_bg.gif) repeat-x center;}
+/* second */
+.menu ul ul a:hover{color:#fff;background:url(/images/inadminpanel/images/menu_bg_a.gif) repeat-x center;}
+.menu ul ul :hover > a {color:#fff;background:url(/images/inadminpanel/images/menu_bg_a.gif) repeat-x center;}
+/* third */
+.menu ul ul ul a:hover {background:url(/images/inadminpanel/images/menu_bg_a.gif) repeat-x center;}
+.menu ul ul ul :hover > a {background:url(/images/inadminpanel/images/menu_bg_a.gif) repeat-x center;}
+/* fourth */
+.menu ul ul ul ul a:hover {background:url(/images/inadminpanel/images/menu_bg_a.gif) repeat-x center;}
+
+
+/* hide the sub levels and give them a positon absolute so that they take up no room */
+.menu ul ul {visibility:hidden;position:absolute;height:0;top:34px;left:0;width:14em; z-index:999;}
+
+/* position the third level flyout menu */
+.menu ul ul ul{left:14em;top:0;width:14em;}
+
+/* position the third level flyout menu for a left flyout */
+.menu ul ul ul.left {left:-14em;}
+
+
+/* make the second level visible when hover on first level list OR link */
+.menu ul li:hover ul, .menu ul a:hover ul {visibility:visible; height:auto; padding-bottom:3em; background:transparent url(/images/inadminpanel/images/trans.gif);}
+/* keep the third level hidden when you hover on first level list OR link */
+.menu ul :hover ul ul{visibility:hidden;}
+/* keep the fourth level hidden when you hover on second level list OR link */
+.menu ul :hover ul :hover ul ul{visibility:hidden;}
+/* make the third level visible when you hover over second level list OR link */
+.menu ul :hover ul :hover ul{visibility:visible;}
+/* make the fourth level visible when you hover over third level list OR link */
+.menu ul :hover ul :hover ul :hover ul {visibility:visible;}
+
+
+
+
+
+
+
+.center_content{
+clear:both;
+height:100%;
+width:100%;
+}
+
+.left_content{
+width:195px;
+height:100%;
+float:left;
+padding:30px 0 0 20px;
+}
+.right_content{
+width:625px;
+height:100%;
+float:left;
+padding:30px 0 0 30px;
+}
+.map_canvas { 
+height: 100%;
+}
+
+.sidebarmenu{
+margin:0px 0;
+padding:0;
+width:195px;
+}
+.sidebarmenu a.menuitem{background:url(/images/inadminpanel/images/sidebar_menu_top.gif) no-repeat center top;
+color: #fff;display: block;position: relative;width:185px;height:31px;margin:0 0 5px 0;line-height:31px;padding:0px 0 0 10px;text-decoration: none;
+}
+.sidebarmenu a.menuitem_green{background:url(/images/inadminpanel/images/green_bt.gif) no-repeat center top;
+color: #fff;display: block;position: relative;width:185px;height:31px;margin:0 0 5px 0;line-height:31px;padding:0px 0 0 10px;text-decoration: none;
+}
+.sidebarmenu a.menuitem_red{background:url(/images/inadminpanel/images/red_bt.gif) no-repeat center top;
+color: #fff;display: block;position: relative;width:185px;height:31px;margin:0 0 5px 0;line-height:31px;padding:0px 0 0 10px;text-decoration: none;
+}
+.sidebarmenu a.menuitem:hover{background:url(/images/inadminpanel/images/sidebar_menu_top_a.gif) no-repeat center top;}
+.sidebarmenu a.menuitem_green:hover{background:url(/images/inadminpanel/images/green_bt_a.gif) no-repeat center top;}
+.sidebarmenu a.menuitem_red:hover{background:url(/images/inadminpanel/images/red_bt_a.gif) no-repeat center top;}
+
+.sidebarmenu a.menuitem:visited, .sidebarmenu .menuitem:active{
+color: white;
+}
+.sidebarmenu a.menuitem .statusicon{
+position: absolute;
+top:11px;
+right:7px;
+border: none;
+}
+
+.sidebarmenu div.submenu{
+background: white;
+}
+.sidebarmenu div.submenu ul{ 
+list-style-type: none;
+margin: 0;
+padding: 0 0 5px 0;
+}
+.sidebarmenu div.submenu ul li{
+border-bottom: 1px dotted #bfd1d9;
+}
+.sidebarmenu div.submenu ul li a{
+display: block;
+color: black;
+text-decoration: none;
+padding:5px 0;
+padding-left: 10px;
+}
+.sidebarmenu div.submenu ul li a:hover{
+background: #e2f0ff;
+color: #0e4354;
+}
+
+.sidebar_search{
+background:url(images/sidebar_menu_top.gif) no-repeat center;
+width:195px;
+height:31px;
+margin:0 0 5px 0;
+}
+input.search_input{
+width:155px;
+height:16px;
+margin:5px 0 0 5px;
+border:1px #bdebfd solid;
+background:#92dbf8;
+padding:4px 0 0 2px;
+float:left;
+color:#096184;
+font-size:11px;
+}
+input.search_submit{
+float:left;
+background:none;
+border:none;
+margin:7px 0 0 8px;
+}
+
+
+
+
+
+#rounded-corner
+{
+margin:0px;
+width:625px;
+text-align: left;
+border-collapse: collapse;
+}
+#rounded-corner thead th.rounded-company
+{
+background: #60c8f2 url('/images/inadminpanel/images/left.jpg') left top no-repeat;
+}
+#rounded-corner thead th.rounded-q4
+{
+background: #60c8f2 url('/images/inadminpanel/images/right.jpg') right top no-repeat;
+}
+#rounded-corner th
+{
+padding: 8px;
+font-weight: normal;
+font-size: 13px;
+color: #039;
+background: #60c8f2;
+}
+#rounded-corner td
+{
+padding: 8px;
+background: #ecf8fd;
+border-top: 1px solid #fff;
+color: #669;
+}
+#rounded-corner tfoot td.rounded-foot-left
+{
+background: #ecf8fd url('/images/inadminpanel/images/botleft.jpg') left bottom no-repeat;
+}
+#rounded-corner tfoot td.rounded-foot-right
+{
+background: #ecf8fd url('/images/inadminpanel/images/botright.jpg') right bottom no-repeat;
+}
+#rounded-corner tbody tr:hover td
+{
+background: #d2e7f0;
+}
+
+
+.question {
+position: absolute;
+display: inline;
+text-align: center;
+width: 174px;
+height: 78px;
+font-size: 13px;
+line-height: 1.5em;
+background: url('/images/inadminpanel/images/bubble.png') left top no-repeat;
+padding: 10px 0 0 0;
+text-shadow: 0px 1px 0px #fff;
+margin-left: -7em;
+margin-top: -6em;
+opacity: 0;
+}
+
+.yes{
+margin-top: .5em;
+margin-right: .5em;
+cursor: pointer;
+display: inline-block;
+width: 63px;
+height: 21px;
+color: #434d17;
+text-shadow: 0px 1px 0px #fff;
+background: url('/images/inadminpanel/images/buttony.png') left top no-repeat;
+}
+.cancel {
+margin-top: .5em;
+margin-right: .5em;
+cursor: pointer;
+display: inline-block;
+width: 63px;
+height: 21px;
+color: #fff;
+text-shadow: 0px 1px 0px #000;
+background: url('/images/inadminpanel/images/buttonn.png') left top no-repeat;
+}
+
+a.bt_green{display:block; float:right; margin:10px 5px 10px 5px; line-height:31px; text-decoration:none; color:#FFFFFF; text-shadow:1px 1px #8fa42b;}
+a.bt_green strong{width:auto;height:31px; padding:0 10px 0 10px;display:block; float:left;background:url(/images/inadminpanel/images/bt_green_center.gif) repeat-x center;}
+a.bt_green span.bt_green_lft{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_green_left.gif) no-repeat center right;}
+a.bt_green span.bt_green_r{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_green_r.gif) no-repeat center right;}
+a:hover.bt_green{ text-decoration:underline;}
+
+a.bt_blue{display:block; float:right; margin:10px 5px 10px 5px; line-height:31px; text-decoration:none; color:#FFFFFF; text-shadow:1px 1px #3597bf;}
+a.bt_blue strong{width:auto;height:31px; padding:0 10px 0 10px;display:block; float:left;background:url(/images/inadminpanel/images/bt_blue_center.gif) repeat-x center;}
+a.bt_blue span.bt_blue_lft{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_blue_left.gif) no-repeat center right;}
+a.bt_blue span.bt_blue_r{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_blue_r.gif) no-repeat center right;}
+a:hover.bt_blue{ text-decoration:underline;}
+
+a.bt_red{display:block; float:right; margin:10px 5px 10px 5px; line-height:31px; text-decoration:none; color:#FFFFFF; text-shadow:1px 1px #c24739;}
+a.bt_red strong{width:auto;height:31px; padding:0 10px 0 10px;display:block; float:left;background:url(/images/inadminpanel/images/bt_red_center.gif) repeat-x center;}
+a.bt_red span.bt_red_lft{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_red_left.gif) no-repeat center right;}
+a.bt_red span.bt_red_r{width:10px;height:31px;display:block; float:left;background:url(/images/inadminpanel/images/bt_red_r.gif) no-repeat center right;}
+a:hover.bt_red{ text-decoration:underline;}
+
+.sidebar_box{
+width:195px;
+padding:15px 0 5px 0;
+}
+.sidebar_box_top{width:195px;height:8px;background:url(/images/inadminpanel/images/sidebar_box_top.gif) no-repeat center bottom;}
+.sidebar_box_bottom{width:195px;height:8px;background:url(/images/inadminpanel/images/sidebar_box_bottom.gif) no-repeat center bottom;}
+.sidebar_box_content{width:175px;height:auto;background-color:#ecf8fd; padding:0 10px 0 10px;}
+
+.sidebar_box_content h3{ color:#49bae8; float:left; font-size:18px; margin:0px;padding:0px; font-weight:normal;}
+.sidebar_box_content h4{ color:#f75744; float:left; font-size:18px; margin:0px;padding:0px; font-weight:normal;}
+.sidebar_box_content h5{ color:#a4bf40; float:left; font-size:18px; margin:0px;padding:0px; font-weight:normal;}
+.sidebar_box_content p{padding:5px 0 5px 0; margin:0px; clear:both; font-size:11px; text-align:left; line-height:17px;}
+img.sidebar_icon_right{
+float:right; padding:0 0 0 0;
+}
+.sidebar_box_content ul{
+list-style:none;
+padding:10px 0 10px 0;
+margin:0px;
+clear:both;
+}
+.sidebar_box_content ul li{
+padding:5px 0 5px 10px;
+background:url(/images/inadminpanel/images/list_bullet.gif) no-repeat left top;
+background-position:0px 10px;
+}
+
+
+.warning_box{width:540px;clear:both;background:url(/images/inadminpanel/images/warning.png) no-repeat left #fcfae9;
+border:1px #e9e6c7 solid;background-position:15px 10px;padding:20px 20px 15px 60px;margin:0 0 10px 0;}
+
+.valid_box{width:540px;clear:both;background:url(/images/inadminpanel/images/valid.png) no-repeat left #edfce9;
+border:1px #cceac4 solid;background-position:15px 10px;padding:20px 20px 15px 60px;margin:0 0 10px 0;}
+
+.error_box{width:540px;clear:both;background:url(/images/inadminpanel/images/error.png) no-repeat left #fce9e9;
+border:1px #eac7c7 solid;background-position:15px 10px;padding:20px 20px 15px 60px;margin:0 0 10px 0;}
+
+/*--------------*/
+div.pagination {
+width:625px;
+clear:both;
+padding:10px 0 10px 0;
+margin:0px;
+text-align:center;
+float:left;
+clear:both;
+font-size:11px;
+}
+
+div.pagination a {
+padding: 2px 5px 2px 5px;
+margin-right: 2px;
+border: 1px solid #52bfea;
+text-decoration: none; 
+color: #52bfea;
+}
+div.pagination a:hover, div.pagination a:active {
+border:1px solid #52bfea;
+color: #fff;
+background-color: #52bfea;
+}
+div.pagination span.current {
+padding: 2px 5px 2px 5px;
+margin-right: 2px;
+border: 1px solid #52bfea;
+font-weight: bold;
+background-color: #52bfea;
+color: #FFF;
+}
+div.pagination span.disabled {
+padding: 2px 5px 2px 5px;
+margin-right: 2px;
+border: 1px solid #f3f3f3;
+color: #ccc;
+}
+.form-row
+{
+  clear: both;
+  padding: 10px;
+  border-bottom: 1px solid #bbf;
+  background-color: #fff;
+}
+label
+{
+  float: left;
+  color: #666666;
+  padding: 8px;
+  line-height: 25px;
+  font-size: 12px;
+  width: 150px;
+  font-weight: normal;
+}
+div.form_helper {
+    clear: both;
+    color: #333;
+    font-style: italic;
+}
+.error_list {
+    color: #ff0000;
+}
+#rounded-cornergus
+{
+margin:0px;
+width:550px;
+text-align: left;
+border-collapse: collapse;
+}
+#rounded-cornergus thead th.rounded-companygus
+{
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus thead th.rounded-q4gus
+{
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus th
+{
+padding: 8px;
+font-weight: normal;
+font-size: 13px;
+color: #666666;
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus td
+{
+padding: 8px;
+border: 1px solid #95E0EF;
+color: #666666;
+}
+input.required {
+background-color: #F3FCFE;
+border-color: #95E0EF;
+border-style: solid;
+border-width: 1px 1px 1px 2px;
+float: left;
+height: 22px;
+padding: 5px 0 0 2px;
+width: 300px;
+}
+select.validate-selection{
+width:90px;
+height:28px;
+border: 1px solid #95E0EF;
+background-color:#f3fcfe;
+border-left-width:2px;
+padding:4px 2px 3px 2px;
+float:left;
+}
+fieldset{
+border: 1px solid #EBEBEB;
+margin: 0 10px 10px;
+padding: 15px 10px;
+}
+legend{
+background-color: #0FCDF6;
+color: #FFFFFF;
+padding: 2px 5px;
+}
+legend.optional{
+color:#FFFFFF;
+background-color:#50c150;
+padding:2px 5px 2px 5px;
+}
+textarea.required{
+width:300px;
+height:75px;
+float:left;
+border: 1px solid #95E0EF;
+background-color:#f3fcfe;
+border-left-width:2px;
+}
+.double_list_select-selected{
+width:200px;
+height:200px;
+float:left;
+border: 1px solid #95E0EF;
+background-color:#f3fcfe;
+border-left-width:2px;
+}
+.double_list_select{
+width:200px;
+height:200px;
+float:left;
+border: 1px solid #95E0EF;
+background-color:#f3fcfe;
+border-left-width:2px;
+}
+.double_list_label{
+color:#666666;
+padding:2px 5px 2px 5px;
+}
diff --git a/web/js/googlemaps.js b/web/js/googlemaps.js
new file mode 100644 (file)
index 0000000..224deab
--- /dev/null
@@ -0,0 +1,56 @@
+var map;
+var oldMarker;
+
+function initialize() {
+        var longitude = document.getElementById('office_longitude');
+        var latitude = document.getElementById('office_latitude');
+        var myLatlng = new google.maps.LatLng(latitude.value, longitude.value);
+        var myOptions = {
+          zoom: 8,
+          center: myLatlng,
+          mapTypeId: google.maps.MapTypeId.ROADMAP
+        };
+
+        map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
+
+        oldMarker = new google.maps.Marker({
+            position: myLatlng,
+            map: map,
+            title:"Your office"
+        });
+
+        google.maps.event.addListener(oldMarker, 'click', function() {
+                map.setZoom(15);
+                map.setCenter(marker.getPosition());
+        });
+
+        google.maps.event.addListener(map, 'click', function(event) {
+                placeMarker(event.latLng);
+        });
+    }
+
+function placeMarker(location) {
+        var marker = new google.maps.Marker({
+            position: location,
+            map: map
+        });
+
+        oldMarker.setMap(null);
+        oldMarker = marker;
+        map.setCenter(location);
+        var longitude = document.getElementById('office_longitude');
+        var latitude = document.getElementById('office_latitude');
+        longitude.value = location.lng().toFixed(4);
+        latitude.value = location.lat().toFixed(4);
+    }
+
+function loadScript() {
+        var script = document.createElement('script');
+        script.type = 'text/javascript';
+        script.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyC12sfHN7LppY0AkhTRzCCZEAAjMCT3BEM&sensor=false&callback=initialize';
+        document.body.appendChild(script);
+      }
+
+      window.onload = loadScript;
+
+    google.maps.event.addDomListener(window, 'load', initialize);