/* SITE JS


*/

//Preload Image Fn

jQuery.preloadImages = function() {
    jQuery.each(arguments, function(e) {
        jQuery('<img src="' + this + '" />');
    });
}

//Simple Modal Display
$(document).ready(function() {

    $.easy.navigation();
    $.easy.tooltip();
    $.easy.popup();
    $.easy.external();
    $.easy.rotate();
    $.easy.forms();
    $.easy.showhide();
    $.easy.jump();

    $('#specialsLink ').click(function(e) {
        e.preventDefault();
        $('#SpecialDivMain').modal();
    });

    
    $('input.alertButton').click(function(e) {

        //Set the popup window to center
        $('#AlertDivMain').css('top', $(this).position().top - ($('#AlertDivMain').height() / 2));
        $('#AlertDivMain').css('left', $(this).position().left - $('#AlertDivMain').width());

        $('#AlertDivMain').fadeIn("slow");
        $('#ctl00_ContentMain_ctl02_ddTerm').val('12');
        $('#ctl00_ContentMain_ctl02_ddBeds').val($(this).attr('bed'));
        $('#ctl00_ContentMain_ctl02_ddBath').val($(this).attr('bath'));
    });
    $('#btnCancelAlert').click(function(e) {
        $('#AlertDivMain').fadeOut("fast");

    });
    $('#G-Map').ready(function(e) {

    });


});

function HideAlert() {
    $('#AlertDivMain').fadeOut("fast");
}

Date.firstDayOfWeek = 0;
Date.format = 'mm/dd/yyyy';
$(function() {
    $('.datePick').datePicker().val(new Date().asString()).trigger('change');
});

$(function() { $('a.gallery').lightBox(); });
$(function() { $('#Photo-Gallery a').lightBox(); });

function viewShow() {
    $('#DivPreLoad').css('display', 'none');
    $('#DivPropertyLoad').css('display', 'none');
    $('#Photo-Gallery').fadeIn('fast');
    $('#DivMainImage').fadeIn('fast');
    $('#DivPropertyImage').fadeIn('fast');
    $('#DivMainSideImage').fadeIn('fast');

}


//Alert Information
$(function() {
    $('.alertButton').mouseover(function() {
        showAlertText(true, $(this));
    });
    $('.alertButton').mouseout(function() {
        showAlertText(false, $(this));
    });
});

function showAlertText(bVal, elem) {
    var hVal = ($(elem).position().top - 60) + 'px';
    var vVal = ($(elem).position().left - 135) + 'px';
    if (bVal == true) {
        $('#alertTextDiv').fadeIn('slow');
        $('#alertTextDiv').css('top', hVal);
        $('#alertTextDiv').css('left', vVal);
    }
    else {
        $('#alertTextDiv').fadeOut('fast');
    }
}

//Video Information
$(function() {
    $('.videoLink').click(function(e) {
        e.preventDefault();
        $('.videoShow').css('display', 'block');
    });
});

/* GOOGLE MAP FNS *

var map;
var mapControl;
var mapControl;
var markers = [];

function showAddress(address, description, imageLocation) {

map = new GMap2(document.getElementById("G-Map"));
mapControl = new GMapTypeControl();
map.addControl(mapControl);
var mapControl = new GSmallZoomControl3D();
map.addControl(mapControl)
var newIcon = new GIcon(G_DEFAULT_ICON);
newIcon.image = imageLocation;
newIcon.iconSize = new GSize(32, 32);
var options = { icon: newIcon, title: description };
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address, function(point) {
if (point) {
map.setCenter(point, 13);
var marker = new GMarker(point, options);
markers[markers.length] = marker;
map.addOverlay(marker);
};
});
}

function showPoint(address, description, imageLocation) {
var newIcon = new GIcon(G_DEFAULT_ICON);
newIcon.image = imageLocation;
newIcon.iconSize = new GSize(28, 28);
newIcon.shadow = "http://maps.google.com/mapfiles/kml/pal2/icon6s.png";
var options = { icon: newIcon, title: description };
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address, function(point) {
if (point) {
var marker = new GMarker(point, options);
map.addOverlay(marker);
markers[markers.length] = marker;
};
});
}

*/