	/*This Function for ShowHide more content */	 
  $(document).ready(function() {
   // Expand All
   $("#expand-all-link").click(function(e){
	  	$(".collapse-all").slideDown("slow");	  
		$("#collapse-all-link").show();	
		$("#expand-all-link").hide();
		$(".plus").hide();
		$(".minus").show();
	 });  	
	// Collapse All
   $("#collapse-all-link").click(function(e){
		 $(".collapse-all").slideUp("slow");
		 $("#expand-all-link").show();	
		 $("#collapse-all-link").hide();
		 $(".plus").show();
		 $(".minus").hide();
   });  

	
/*	$("ul.menu2 li").hover(function(){
		  $(this).find("div").toggle();		  
		  }); */	 
		  
	 	$("div.menu3 li").hover(
		function(){		  
		  $(this).find("div").show();		  
		  },function()
		  {
			  $(this).find("div").hide();		  			  
			}
		  ); 
		 
		// For Hide Tooltip after link clicked  
		$("div.menu3 li a").click(
			function(){	
			$(this).parent().find("div").hide();
		});	  
		// For Hide Tooltip after link clicked  
		$("#loc1").click(function(){
		  $(this).find(".locations-tool-tips").hide();		  
		  });
		  
		 $("#loc2").click(function(){
		  $(this).find(".locations-tool-tips").hide();		  
		  });
		  $("#loc3").click(function(){
		  $(this).find(".locations-tool-tips").hide();		  
		  });
		  $("#loc4").click(function(){
		  $(this).find(".locations-tool-tips").hide();		  
		  });
		  $("#loc5").click(function(){
		  $(this).find(".locations-tool-tips").hide();		  
		  });   
		// For Hide Tooltip after link clicked 
		$("#del").click(	
		function(){
			$(".delivery-tool-tips").hide();		  			  
		}); 	
		
		
	  $("#test,#test2,#test3").hover(function(){		  									  
		  var Id = $(this).attr("id");
		  $("#div-"+Id).show();		  
		  },
		  function(){
		   var Id = $(this).attr("id");
		  $("#div-"+Id).hide();		
		  }); 
		
		$("#test,#test2,#test3").click(function(){		  				
			   var Id = $(this).attr("id");
		 		    $("#div-"+Id).hide();		
		  }); 
		  
	$("#loc1,#loc2,#loc3,#loc4,#loc5").hover(		 
		  function(){		  
		$(this).find(".locations-tool-tips").show();		  
	},
	function()
	{
		$(this).find(".locations-tool-tips").hide();			  		  
		  });  
		  
$("#del").hover(
	function(){		  
		$(".delivery-tool-tips").show();		  
	},
	function()
	{
		$(".delivery-tool-tips").hide();		  			  
}); 	  
	  
$("#submtLink").click(function(){
isformValid();
});		  		  
});
  
function isformValid()
{							   	  
    // Ids of form fields
    var txtnName = $("#txtName");
    var txtEmail = $("#txtEmail");  
    var txtSub = $("#txtSub");
    var txtMsg = $("#txtMsg");   

    // Error Message
    var errMsgName = "Please enter your name.";
    var errMsgEmail = "Please enter your email id.";
    var errMsgSub = "Please enter subject.";
    var errMsgMsg = "Please enter message.";
    var errMsgValidEmail="Please enter valid email.";    

    // Div Ids for display error
    var errName = $("#errName");
    var errEmail = $("#errEmail");
    var errSub = $("#errSub");
    var errMsg = $("#errMsg");
  

    var isValidName=Emptyfield(txtnName,errMsgName,errName);    
    var isValidMail= Emptyfield(txtEmail,errMsgEmail,errEmail);
    if(isValidMail)
    {
        isValidMail= isValidEmailField(txtEmail,errMsgValidEmail,errEmail);
    }
    var isValidSubject= Emptyfield(txtSub,errMsgSub,errSub);
    var isValidMesage= Emptyfield(txtMsg,errMsgMsg,errMsg);
     if(isValidName && isValidMail && isValidSubject && isValidMesage)
     { 
        $('#frmContact').submit();
     }    
}

//Check For Empty
function Emptyfield(fieldId,message,errId)
{
    var fieldVal = fieldId.attr('value');         
     errId.empty();
     if (fieldVal.length == 0) {
        errId.text(message);
        errId.css("display","block");
        return false;
    } else {
        errId.css("display","none");
        return true;
    }
}

// check email valid
function isValidEmailField(fieldId,message,errId)
{
    var email=fieldId.attr('value');
    var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
    if(filter.test(email))
    {                   // Valid Email
       errId.css("display","none");
       return true;
    }
    else
    {
        errId.text(message);
        errId.css("display","block");
       return false;
    }
}

  
 function ShowHideContainer(id,e){  
 $("#"+id).animate({"height":"toggle"},500);
 $(e).find("#left-arrow").toggle();
 } 
