﻿/// <reference name="MicrosoftAjax.js" />
/// <reference path="jquery-vsdoc.js" />

$().ready(function() {
  InitializeLogo();

  if (self.location.href.indexOf("cmspagemode=edit") > -1 || self.location.href.indexOf("cmspagemode=preview") > -1) {
    return;
  }

  $("form input:text").bind("keypress", function(e) {
    if (window.event) {
      e = window.event;
    }
    if (e.keyCode == 13) {
      return false;
    }
    else {
      return true;
    }
  });

  $("input:password").bind("keypress", function(e) {
    if (window.event) {
      e = window.event;
    }
    if (e.keyCode == 13) {
      return false;
    }
    else {
      return true;
    }
  });

//  $("form").bind("keypress", function(e) {
//    if (window.event) {
//      e = window.event;
//    }
//    if (e.keyCode == 13) {
//      return false;
//    }
//    else {
//      return true;
//    }
//  });

  $(".txtarea").bind("keypress", function(e) {
    return true;
  });

  // Any function and needs to be invoked if it is not "Edit" mode.
});

function InitializeLogo() {
    var flashvars = {};
    var params = {};
    params.wmode = "transparent";
    params.menu = "false";
    params.width = "327";
    params.height = "65";
    swfobject.embedSWF("/Images/slogo.swf", "slogo", "327", "65", "9.0.0", "expressInstall.swf", flashvars, params);
}

function popup(url, name, width, height, resize) {
    width = width > 0 ? width : 400;
    height = height > 0 ? height : 500;

    var t = (screen.height - height) / 2;
    var l = (screen.width - width) / 2;

    window.open(url, name, "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=" + resize + ",width=" + width + ",height=" + height + ",screenX=0,screenY=0,top=" + t + ",left=" + l);
    return false;
}

var map;

function mapIt(hlId, name, lat, lng) {
    if (GBrowserIsCompatible()) {

        lat = lat.replace(",", ".");
        lng = lng.replace(",", ".");

        var point = new GLatLng(parseFloat(lat), parseFloat(lng));

        if (map == null) {
            map = new GMap2(document.getElementById("gmap"), { size: new GSize(492, 487) });
            map.setCenter(point, 13);

            var mapTypeControl = new GMapTypeControl();
            var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10));
            var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10));
            map.addControl(mapTypeControl, topRight);
            map.addControl(new GLargeMapControl3D());
        }
        

        map.addOverlay(new GMarker(point));
//        map.openInfoWindow(map.getCenter(),
        //                   document.createTextNode(name));

        map.panTo(point);
    }
}