// JavaScript Document
$(document).ready(function() {
	$('form#RightContactUs textarea[class*=expand]').TextAreaExpander(55);
	
	//$('textarea').inputlimiter();
	$('form#RightContactUs textarea#Message').inputlimiter({
		limit: 2000,
		remText: 'You only have %n character%s remaining...',
		limitText: 'You\'re allowed to input %n character%s into this field.'
	});
});

function AJAXSendDetailsRight(){	
	$.ajax({
		type: "POST",
		url: "ContactUs_DB.asp",
		//<![CDATA[
		data: $("form#RightContactUs").serialize(),		
		//data: "Funct=ShowModelPhoto&ModelID="+m,
		//]]>
		beforeSend: function(){
			//<![CDATA[
				$("div#divRightContactForm").text("").append("<img src='Images/Common/progressimgred.gif' alt='Loading...'/>");
			//]]>
		},
		success: function(html){
			var response = html;
			//<![CDATA[				
				var FinalResponse="<div class='Message ";
				if(response=="FormSuccess"){FinalResponse=FinalResponse+"Success'>Thanks you for submitting your details";}
				else{FinalResponse=FinalResponse+"Error'>Please fill all the required fields(*) to complete the request."}						
				FinalResponse=FinalResponse+"<\/div>";
				$("div#divRightContactForm").hide().text("").append(FinalResponse).fadeIn(400);				
			//]]>
		},
		error: function(){
			// Display something when the AJAX fails.  This could be an image or just text...
			$("div#divRightContactForm").text("").append("Failed to load page correctly!");
		}
	});
}
