
    $(document).ready(function(){
        
        $("#thumbnails").jCarouselLite({
            btnNext: ".thumbnext",
            btnPrev: ".thumbprev",
            mouseWheel: true,
            visible: 4,
            scroll: 4,
            circular: true
            
        });
        
        document.getElementById("divPropDetailContainer").style.height = $("#divPropDetailContainer").height() + 25;
        
    });
    
    function OpenRelocation()
    { 
        window.open ("Popup_Relocation.aspx", "Relocation"," status=0, toolbar=0, location=0, menubar=0, scrollbars=0, width=470,height=400");
    }
    
    function SetShowingTime(BoardId, MlsNumber, Broker){
        var oImgShowingTime = new Image(10,10);
        oImgShowingTime.src = "http://links.showingtime.com/showingalert/images/wbShowingAlert_dtl.gif?SITEID=www.Semonin.com&broker=" + Broker  + "MLSID=" + BoardId + "&listingid=" + MlsNumber + "&source=S";
    }
    
    function GotoProperty(idx, max)
    {
        val = getQuerystring("PropertyIdx");
        if(val != "")
        {
            newval = parseInt(val) + idx; 
            if(newval < 0) newval = 1;
            if(newval > (max -1)) newval = max - 1;
            querystring = ReplaceQueryString(location.href, "PropertyIdx", newval);
        }
        else
        {
            querystring = ReplaceQueryString(location.href, "PropertyIdx", "1");
        }
        querystring = ReplaceQueryString(querystring, "PropertyDetail", "");
        location.replace(querystring)
    }
    
    function SaveWebsiteActivityDetail(pEnumWebsiteActivity){
        //if (_UserKey != "0"){
            $("#ctl00_mainContent_txtWebTrackAction").val(pEnumWebsiteActivity);
            __doPostBack('ctl00$mainContent$lnkWebTrack','');
        //}
    }
    
    function MapDirection(sQueryString,baseUrl){
        window.open(baseUrl+'/PropertyDetailDirections.aspx?' + sQueryString, 'MapDirections', 'width=980,height=600,scrollbars=yes');
    }
    
    function BackToResults()
    {
        queryString = ReplaceQueryString(location.search, "PropertyIdx", "");
        queryString = ReplaceQueryString(queryString, "PropertyItem", "");
        queryString = ReplaceQueryString(queryString, "PropertyDetail", "");
        //queryString = ReplaceQueryString(queryString, "RecordType", "180");
        //alert(queryString);
        location.replace("PropertyResult.aspx" + queryString);
    }
    
    function GoRefineSearch(baseUrl) {
        var tab = getQuerystring("tab", "1");
        
        switch(parseInt(tab))
        {
            case 1: document.location.replace(baseUrl+'/PropertySearch.aspx' + location.search); break;
            case 2: document.location.replace(baseUrl+'/PropertySearch_120.aspx' + location.search); break;
            case 120: document.location.replace(baseUrl+'/PropertySearch_120.aspx' + location.search); break;
            case 140: document.location.replace(baseUrl+'/PropertySearch_140.aspx' + location.search); break;
            case 160: document.location.replace(baseUrl+'/PropertySearch_160.aspx' + location.search); break;
            case 3: document.location.replace(baseUrl+'/PropertySearchSubdivision.aspx' + location.search); break;
            case 4: document.location.replace(baseUrl+'/PropertySearchRadius.aspx' + location.search); break;
            case 5: document.location.replace(baseUrl+'/PropertySearchAddress.aspx' + location.search); break;
            case 6: document.location.replace(baseUrl+'/PropertySearchMLS.aspx' + location.search); break;
            case 7: document.location.replace(baseUrl+'/PropertySearchPayment.aspx' + location.search); break;
            case 8: document.location.replace(baseUrl+'/PropertySearchOpenHomes.aspx' + location.search); break;
            case 3120: document.location.replace(baseUrl+'/PropertySearchPayment_120.aspx' + location.search); break;
            case 3140: document.location.replace(baseUrl+'/PropertySearchPayment_140.aspx' + location.search); break;
            case 3160: document.location.replace(baseUrl+'/PropertySearchPayment_160.aspx' + location.search); break;
        }        
    }

    function Propertyprint(pMlsNumber, pRecordType,baseUrl)
    {   
        
      // location.replace("PropertyPrint.aspx" + location.search);
      window.open(baseUrl+'/PropertyPrint.aspx?RecordType=180&0110=' + pMlsNumber,'_blank');
      
    }



 function slideShow()
 {
    if(currentPhotoIdx > -1 && currentPhotoIdx < photoCount - 1 && photoCount > 0 && OnSlideShow == true)
    {
        $("#MainImage").attr("src", photos.split("~")[currentPhotoIdx]);
        currentPhotoIdx++;
        setTimeout("slideShow()", 3000);
    }                
 }
 
 function SetCurrentPhoto(src)
 {
    for(i=0; i<photoCount; i++)
    {
        if(src == photos.split("~")[i]) 
        {
            currentPhotoIdx = i;
            break;
        }
    }
 }
 
 function GotoPhoto(idx)
 {
    OnSlideShow = false;
    SetCurrentPhoto($("#MainImage").attr("src"));
    currentPhotoIdx = currentPhotoIdx + idx;
    if(currentPhotoIdx > -1 && currentPhotoIdx < photoCount - 1 && photoCount > 0)
    {
        $("#MainImage").attr("src", photos.split("~")[currentPhotoIdx]);
    }
 }
 
