/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$(document).ready(function() {
   $(".myProfile-pInfo").click(function(event){
    if($(".pInfo-content").is(":hidden")){
       $(".pInfo-content").slideDown();
    }
    else {
       $(".pInfo-content").slideUp();
    }
  });

 $(".myProfile-profileAccount").click(function(event){
    if($(".profileAccount-content").is(":hidden")){
       $(".profileAccount-content").slideDown();
    }
    else {
       $(".profileAccount-content").slideUp();
    }
  });

 $(".myProfile-profilePhoto").click(function(event){
    if($(".profilePhoto-content").is(":hidden")){
       $(".profilePhoto-content").slideDown();
    }
    else {
       $(".profilePhoto-content").slideUp();
    }
  });

  $(".add_property").click(function(event){
    if($(".add_property_content").is(":hidden")){
       $(".add_property_content").slideDown();
    }
    else {
       $(".add_property_content").slideUp();
    }
  });

/* Property Menus */

  $("#property-maps").click(function(){
    if($(".propertymap").is(":hidden")){
       $(".propertymap").slideDown();
       if($(".uploader").is(":block"))
       {
         $(".uploader").slideUp();
       }
       if($(".propertyvideo").is(":block"))
       {
         $(".propertyvideo").slideUp();
       }
    }
    else {
       $(".propertymap").slideUp();
    }
  });

  $("#upload-property-image").click(function(event){
    if($(".uploader").is(":hidden")){
       $(".uploader").slideDown();
       if($(".propertymap").is(":block"))
       {
        $(".propertymap").slideUp();
       }
       if($(".propertyvideo").is(":block"))
       {
         $(".propertyvideo").slideUp();
       }
    }
    else {
       $(".uploader").slideUp();
    }
  });

 $("#property-videos").click(function(event){
    if($(".propertyvideo").is(":hidden")){
       $(".propertyvideo").slideDown();
       if($(".uploader").is(":block"))
       {
         $(".uploader").slideUp();
       }
       if($(".propertymap").is(":block"))
       {
        $(".propertymap").slideUp();
       }
    }
    else {
       $(".propertyvideo").slideUp();
    }
  });

  // animate message box

// $(".message-success").animate({opacity: 1.0}, 3000).fadeOut("slow");
//  $(".message-fail").animate({opacity: 1.0}, 1000).fadeOut("slow");

// accepts number only

    //when key is pressed in the textbox
 $("#contact_number").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });
 $("#mobile_number").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg_mobile").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });
 $("#price").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg_price").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });

 $("#total_rooms").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg_total_rooms").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });
 $("#total_bedrooms").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg_total_bedrooms").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });
 $("#total_bathrooms").keypress(function(e)
 {
  //if the letter is not digit then display error and don't type anything
  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
  {
    //display error message
    $("#errmsg_total_bathroomns").html("Digits Only").show().fadeOut("slow");
    return false;
  }
 });
});
