
//function pageLoad()
//{
//   CallWebMethod("select");
//}


function CallWebMethod(methodType)
{
   CallWebMethod2(methodType, 0)
}

function CallWebMethod2(methodType, count)
{
  if(count < 5)
  {
    switch(methodType)
     {
        case "select":
           FeaturedPropertyService.NextFeaturedProperty(Number(FeaturedListingListingIdHiddenField.value), FillFeaturedProperty,ErrorHandler, TimeOutHandler);
           t=setTimeout("CallWebMethod2('select', " + (count+1) + " )",10000);
           break;
        case "selectIPlat":
           FeaturedPropertyService.NextIPlatProperty(Number(FeaturedListingListingIdHiddenField.value), Number(FeaturedListingIPlatModeHiddenField.value), FillFeaturedProperty,ErrorHandler, TimeOutHandler);
           t=setTimeout("CallWebMethod2('selectIPlat', " + (count+1) + " )",10000);
           break;
     }
  }
}

function FillFeaturedProperty(result)
{
  var theWidth=0;
  
  if(typeof(FeaturedListingListingImage.width)!="undefined")
  {
    theWidth = FeaturedListingListingImage.width;
   }
  
  if(typeof(FeaturedListingListingImage.style.width)!="undefined")
  {
    theWidth = FeaturedListingListingImage.style.width;
   if(isNaN(theWidth))
     theWidth = theWidth.substring(0,theWidth.length-2); 
  }
  
  if(theWidth != 0  && result.FeaturedPropertyId != 0)
  {
    FeaturedListingHasMarkedFeatureHiddenField.value = result.HasMarkedFeatured.toString();
    FeaturedListingListingIdHiddenField.value = result.FeaturedPropertyId.toString();
    FeaturedListingListingImage.onclick = function(){ javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(FeaturedListingListingImage.name, '', false, '',  result.MoreDetailsLink, false, false)); };
    FeaturedListingListingImage.src = result.ListingImagePath + "&w="+ theWidth.toString();
    FeaturedListingDescription.innerHTML = result.DescriptionText;
    FeaturedListingMoreDetailsButtonImage.onclick = function() { javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(FeaturedListingListingImage.name, '', false, '', result.MoreDetailsLink, false, false)) };
  }
  
 
  
}

function ErrorHandler(result)
{
   /* not impirtant enough to notify
   var msg=result.get_exceptionType() + "\r\n";
   msg += result.get_message() + "\r\n";
   msg += result.get_stackTrace();
   alert(msg);
  */ 
}
function TimeOutHandler(result)
{
/* not impirtant enough to notify
   alert("Timeout :" + result);
  */ 
}