<!--
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; 
  if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
	for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image;
	  d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;
   if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var newWin;
function OpenApp() {
	newWin = window.open('https://secure.resiteit.com/apps/?cid=1407','App','toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=640 ,height=400');
}

function PopupLink(obj, features)
{
    /*
    This function opens a hyperlink in a new window with the specifications in features
    Paramaters:
                obj - DOM object representing the hyperlink
                features - string with specified features
                
    returns false if the window opens suscessfully
    
    ex: "<asp:HyperLink ID="lnkCoupon" CssClass="lnk_coupon" NavigateUrl="~/" onclick="javascript:return lnkCoupon_Click(this);" Target="_blank" runat="server">"
    */
    
    var retVal = true;
    
    if(!features) { features = ''; }
    
    if(obj && obj.href && obj.href != '')
    {
        window.open(obj.href,name,features); 
        
        retVal = false;
    }
    else
        retVal = true;
        
    return retVal;
}

//window.onload = function () { Blanker.scan(); };

function liAECLink_Click(obj)
{
    //window.open('http://www.whitefence.com/WebObjects/WhiteFence.woa/wa/cm?id=1009341','');
    
    var features = 'width=700,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes';
    
    return PopupLink(obj, features);
}

function liPaymentLink_Click(ePayID)
{
    //alert('liPaymentLink_Click(' + ePayID + ')');
    window.open('https://payments.nwpsc.com/ConsumerConsole/PaymentAuthentication.aspx?MID=' + ePayID,'');
}

function liWhiteFenceLink_Click(href)
{
    //alert(href);
    window.open(href, '');
}

function lnkPrint_Click(webroot)
{
    var url = ((webroot)? webroot : '') + 'printable.aspx';
    var name = '';
    //var features = 'width=700,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes';
    //- 3.18.11 -//
    var features = 'width=770,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes';
    window.open(url,name,features); 
}

function FPNameLnk_Click(fpid)
{
    var url = 'floorplandetail.aspx?fpid=' + fpid;
    var name = '';
    var features = 'width=700,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes';
    
    window.open(url,name,features); 
}

function lnkApp_Click(obj)
{
    //var url = ((webroot)? webroot : '') + 'AEC_Rental_Application.pdf';
    //var name = '';

    var features = 'width=900,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes';
    
    return PopupLink(obj, features);   
}

function lnk_OpenOneBed_Click()
{
    if(pnlOneBed)
    {
        $('#' + pnlOneBed).fadeIn('slow');
    }
}

function lnk_OpenTwoBed_Click()
{
    if(pnlTwoBedPopup)
    {
        $('#' + pnlTwoBedPopup).fadeIn('slow');
    }
}

function lnk_OpenThreeBed_Click()
{
    if(pnlThreeBedPopup)
    {
        $('#' + pnlThreeBedPopup).fadeIn('slow');
    }
}
// Open Photos Panel
// commented out 4.6.11 for redesign
//function lnkOpenPhotos_Click()
//{
//    if(pnlPhotosPopup)
//    {
//        //Effect.Appear(pnlPhotosPopup, { duration: 0.5 });
//        $('#' + pnlPhotosPopup).fadeIn('slow');
//    }
//}
// commented out 4.6.11 for redesign
function lnkClosePhotos_Click()
{
    if(pnlPhotosPopup)
    {
        //Effect.Fade(pnlPhotosPopup, { duration: 0.5 });
        $('#' + pnlPhotosPopup).fadeOut('slow');
    }
}

// Open SitePlan Panel
function lnkOpenSitePlan_Click()
{
        $('#' + pnlSitePlansPopup).fadeIn('slow');
}

function lnkCloseSitePlans_Click()
{
        $('#' + pnlSitePlansPopup).fadeOut('slow');
}


// Open Video Panel
function lnkOpenVideo_Click()
{
    if(pnlVideoPopup)
    {
        $('#' + pnlVideoPopup).fadeIn('slow');
    }    
}


function lnkOpenTours_Click()
{
    if(pnlToursPopup)
    {
        //Effect.Appear(pnlToursPopup, { duration: 0.5 });
        //$('.pnlToursPopup').fadeIn('slow');
        $('#' + pnlToursPopup).fadeIn('slow');
    }
}

function ChangeTour(tourID)
{
    if(txtSelectedTour && btnReloadTour && $get(btnReloadTour) && $get(txtSelectedTour) && tourID)
    {
        //$(txtSelectedTour).value = tourID;
        $get(txtSelectedTour).value = tourID
        
        var btnName = $get(btnReloadTour).name;

        __doPostBack(btnName, '');
    }
}






//--  Click Section --------------------------------------------------//

function lkbContactMaintenance_Click()
{
    OpenMaintEmailPopup();
}



//3.1.11 ------------ APPOINTMENT  -//
function lkbAppointment_Click()
{
    OpenAppointmentPopup();     
}


// 3.1.11
function lnkQuestions_Click()
{
   OpenQuestionsPopup(); 
}


function lnkFloorplanDetails_Click()
{
    OpenFloorplanDetails();
}



//- 3.18.11 ------------------------ APPLICATION -//
function lnkOpenApplication_Click()
{
   OpenApplication();
}
//- 3.17.11 
function OpenApplication()
{
    ResetApplicaton();
}
function ResetApplicaton()
{
    if(pnlApplication_ClientID)
    {
        __doPostBack(btnResetApplicationForm_UniqueID, '');
        //$('#' + pnlApplication_ClientID).fadeIn('slow');
    }
}
//---- Close Application Function -//
function lnkApplicationFormClose_Click()
{
    //if(btnResetApplicationForm_UniqueID)
    //{
        $(pnlApplication_ClientID).fadeOut('slow');
        $('#' + pnlApplication_ClientID).fadeOut('slow');
    //}
}




function lnkEmail_Click()
{
    if(btnResetEmailForm_UniqueID)
    {
        //$(pnlLeasingEmail).show();
        //__doPostBack(btnResetEmailForm_UniqueID, '');
        //$(btnResetEmailForm).click();
        //Effect.Appear(pnlLeasingEmail_ClientID, { duration: 0.5 });
        
        /*
         *The logic to display the div is in pageLoaded function
         * it checks after each postback to determine if the form should be displayed
        */
        __doPostBack(btnResetEmailForm_UniqueID, '');
        
    }
}

//- 3.17.11 -//



function ResetEmailUs()
{
    if(pnlEmailUs_ClientID)
    {
        __doPostBack(btnResetEmailUsForm_UniqueID, '');
        //$('.pnl_emailUs').fadeIn('slow'); 
    }
}

function lnkMaintEmail_Click()
{
    OpenMaintEmailPopup();
}




//--  CLOSE Section --------------------------------------------------//
//- 3.18.11 -//


//- Close Maint Email -//
function lnkCloseMaintEmail_Click()
{
    $('#' + pnlMaintenanceEmail_ClientID).fadeOut('slow');
}

//- 3.1.11 - Close Appointment -//
function lnkCloseAppointSchedule_Click()
{
    $('#' + pnlAppointmentEmail_ClientID).fadeOut('slow');
}

//- Close Questions -//
function lnkCloseQuestions_Click()
{
    if(pnlQuestions_ClientID)
    {
        $('#' + pnlQuestions_ClientID).fadeOut('slow');
    }
}
function lnkCloseFloorplanDetails_Click()
{
    if(pnlFloorplanDetails_ClientID)
    {
        $('#' + pnlFloorplanDetails_ClientID).fadeOut('slow');
    }
}


//- Close Leaseing Email -//
function lnkLeasingEmailClose_Click()
{
    if(pnlLeasingEmail_ClientID)
    {
        //$(pnlLeasingEmail).hide();
        //Effect.Fade(pnlLeasingEmail_ClientID, { duration: 0.5 });
        $('#' + pnlLeasingEmail_ClientID).fadeOut('slow');
    }
}

//- 3.17.11 Tab share Email -//
function lnkShareEmailClose_Click()
{     
    if(pnlShareEmail_ClientID)
    {
        $('#' + pnlShareEmail_ClientID).fadeOut('slow');
    }
}

//- 3.17.11 Close Share Email (Slide Tab) -//
function lnkEmailUsClose_Click()
{
    if(pnlEmailUs_ClientID)
    {
        $('#' + pnlEmailUs_ClientID).fadeOut('slow');
    }   
}

//- Close Contact Maint -//
function lkbCloseConatctMaint_Click()
{
    if(pnlContactMaint)
    {
        //Effect.Fade(pnlContactMaint, { duration: 0.5 });
        $('#' + pnlContactMaint).fadeOut('slow');
    }
}

//- Close tours -//
function lnkCloseTours_Click()
{
    if(pnlToursPopup)
    {
        //Effect.Fade(pnlToursPopup, { duration: 0.5 });
        $('#' + pnlToursPopup).fadeOut('slow');
    }
}

//- Close Video -//
function lnkCloseVideo_Click() 
{
    if(pnlVideoPopup)
    {
        $('#' + pnlVideoPopup).fadeOut('slow');
    }    
}


//--  RESET Section --------------------------------------------------//
function ResetLeasingEmail()
{
    if(btnResetMaintEmailForm_UniqueID)
    {
        /*
         *The logic to display the div is in pageLoaded function
         * it checks after each postback to determine if the form should be displayed
        */
        __doPostBack(btnResetMaintEmailForm_UniqueID, '');
    }
}
//3.1.11
function ResetQuestions()
{
    if(btnResetQuestions_UniqueID)
    {
        __doPostBack(btnResetQuestions_UniqueID, '');
    }
}
//- TEMP -//
function RestTempUnAvailable()
{
    if(btnResetTempUnAvailable_UniqueID)
    {
        __doPostBack(btnResetTempUnAvailable_UniqueID, '');
    }
}


// 3.1.11 Reset Floorplan Schedule
function ResetAppointmentSchedule()
{
    if(btnResetAppointEmailForm_UniqueID)
    {
         /*
         *The logic to display the div is in pageLoaded function
         * it checks after each postback to determine if the form should be displayed
        */
        __doPostBack(btnResetAppointEmailForm_UniqueID, '');
        
    }
}


// 3.1.11
function OpenAppointmentPopup()
{
    ResetAppointmentSchedule();            
}

// 3.1.11
function OpenQuestionsPopup()
{
    ResetQuestions();   
}

//- 3.24.11
function OpenFloorplanDetails()
{
    
    $('#' + pnlFloorplanDetails_ClientID).fadeIn('slow');
    $('.overlay').css('filter', 'alha(opacity=40)');
    //ResetFloorplanDetails();
}


//- 6.03.11 Open Walk Thru Video -//
function lnkOpenBedVideo_Click(videoID)
{
    var link = "http://www.apartments.com/l/" + videoID + "";    
    swfobject.embedSWF(link, pnlFlashWalkThruContent_ClientID, 320, 265, '9.0.0');
    $('.pnl_OneBedVideo_popup').fadeIn('slow');    
}


function lnkOpenGermentownSpecial() {
    //var link = "\\\\stream1\\c$\\media\\movie\\VGTown.wmv";
    //swfobject.embedSWF(link, pnlGermantownVideoContent_ClientID, 940, 510, '9.0.0');    
    $('.pnl_GermantownPopup').fadeIn('slow');
}


function lnk_CloseVideoPopup_Click(panel)
{
    if(panel)
    {
        $('.'+ panel).fadeOut('slow');
    }
}



//- 3.18.11 -//
function lnkEmailUsOpen_Click()
{    
    OpenEmailUs();
}
function OpenEmailUs()
{
    ResetEmailUs();
}

function OpenMaintEmailPopup()
{
    ResetLeasingEmail();
}
function CloseErrorBox(id) 
{
    if(id && (id != ''))
        $('#' + id).fadeOut();
}

function Body_Load()
{
    //** this registers a event after any postback
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
}

function pageLoaded(sender, args) 
{
    //** This function fires every time the page loads from a post
    //** add specific postback code here for all pages
    
    //** check if the post was async, use this if block for all async postbacks
    if (Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) 
    {
        if(udpLeasingEmail_ClientID)
        {
            //** if the panel that is upadated is the leasing email panel then display the email form
            //** this does a compelete comparison of the divs, may need to change to looping IDs if there is a problem
            if (Array.contains(args.get_panelsUpdated(), $get(udpLeasingEmail_ClientID))) 
            {
                //Effect.Appear(pnlLeasingEmail_ClientID, { duration: 0.5 });
                $('#' + pnlLeasingEmail_ClientID).fadeIn('slow');
            }
        }
        
        //- Handles Maintenance Popover (ContactUs.aspx) -//
        if(udpMaintenanceEmail_ClientID)
        {
            //** do the same logic for the maintenance email
            if (Array.contains(args.get_panelsUpdated(), $get(udpMaintenanceEmail_ClientID))) 
            {
                //Effect.Appear(pnlLeasingEmail_ClientID, { duration: 0.5 });
                $('#' + pnlMaintenanceEmail_ClientID).fadeIn('slow');
            }
        }
        //- Handles Scheduler Popover (ContactUs.aspx)-//
        if(udpScheduleAppointment_ClientID)
        {
            if(Array.contains(args.get_panelsUpdated(), $get(udpScheduleAppointment_ClientID)))
            {
                $('#' + pnlAppointmentEmail_ClientID).fadeIn('slow');                
            }
        }
        //- Handle questions popover -//
        if(udpQuestions_ClientID)
        {
            
            if(Array.contains(args.get_panelsUpdated(), $get(udpQuestions_ClientID)))
            {
                $('#' + pnlQuestions_ClientID).fadeIn('slow');
            }
        }
        
        if(udpFloorplanDetails_ClientID)
        {
            if(Array.contains(args.get_panelsUpdated(), $get(udpFloorplanDetails_ClientID)))
            {
                $('#' + pnlFloorplanDetails_ClientID).fadeIn('slow');
            }
        }
        
        //- Handles Application Popover (Slide Tab) -// 
        if(udpApplication_ClientID)
        {
            //- look for Applications's updatePanel in array
            if(Array.contains(args.get_panelsUpdated(), $get(udpApplication_ClientID)))            
            {
                //- open via jquery
                $('.pnl_Application').fadeIn('slow');                
            }
        }
        //- Handles EmailUs Popover (Slide Tab) -//
        if(udpEmailUs_ClientID)
        {
            if(Array.contains(args.get_panelsUpdated(), $get(udpEmailUs_ClientID)))
            {
                $('.pnl_emailUs').fadeIn('slow');
                //DrawCaptcha();
            }
        }        
       
    }
}

function lnkCoupon_Click(obj)
{
   var features = 'width=800,height=700,location=no,menubar=yes,status=no,titlebar=no,toolbar=yes,scrollbars=yes';
   
   return PopupLink(obj, features);
}




function isDefined(variable)
{
    return (typeof(window[variable.toString()]) == "undefined")?  false: true;
}

function js_DisableOnClick(obj)
{
    obj.disabled = true;
}

function GoBack() { 
    history.go(-1); 
} 

// TEMP
function lnkOpenSiteMap_Click() {
    if(pnlSitePopup) {
        $('#' + pnlSitePopup).fadeIn('slow'); 
    }
}   

function lnkCloseSiteMap_Click() {
    if(pnlSitePopup) {
        $('#' + pnlSitePopup).fadeOut('slow'); 
    }
}



function getLoc() {

    if(pnlSlideShow_ClientID) {
        var left = $('#' + pnlSlideShow_ClientID).offset().left;
        var top = $('#' + pnlSlideShow_ClientID).offset().top;
        
        // Vertical buttons
        var bt = $('#' + pnlFloatButtons_ClientID).offset().top; 
        var bl = $('#' + pnlFloatButtons_ClientID).offset().left;
        var newT = (bt + 82);
        var newL = (bl + 795);
        $('#' + pnlFloatButtons_ClientID).css('top', newT).css('left', newL);   
        
        // Horizontal buttons       
        var newHt = (top - 5);
        var newHl = (left);
        $('#' + pnlHorizontalFloatButtons_ClientID).css('top', newHt).css('left', newHl);      
//        
//        $(function() {
//            $('#' + slideOutDiv_ClientID).tabSlideOut({            
//            tabHandle: '.handle', //class of the element that will be your tab -doesnt have to be an anchor
//            pathToTabImage: 'images/contact_tab.gif', //relative path to the image for the tab
//            imageHeight: '133px', //height of tab image
//            imageWidth: '44px' //width of tab image
//            });            
//        });
//               
        
//        $(function(){
//        $('#' + slideOutDiv_ClientID).tabSlideOut({
//            tabHandle: '.handle',                     //class of the element that will become your tab
//            pathToTabImage: 'frame.png', //path to the image for the tab //Optionally can be set using css
//            imageHeight: '300px',                     //height of tab image           //Optionally can be set using css
//            imageWidth: '30px',                       //width of tab image            //Optionally can be set using css
//            tabLocation: 'right',                      //side of screen where tab lives, top, right, bottom, or left
//            speed: 300,                               //speed of animation
//            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
//            topPos: '55px',                          //position from the top/ use if tabLocation is left or right
//            leftPos: '100px',                          //position from left/ use if tabLocation is bottom or top
//            fixedPosition: false                      //options: true makes it stick(fixed position) on scroll
//        });
        //});   
    }
}

//-->

