﻿var myData;
	
	function cbSuccess(responseText, statusText) {
		//alert('success');
		//alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        //'\n\nThe output div should have already been updated with the responseText.');
        $('#frmContact').resetForm();
	}
	
	$(document).ready(function() {
	


// CODE FOR BRANDS - STARTS
		
		$("#dvRefBrandsShowAll").click(function(obj){
			obj.preventDefault();
			var minheight="300px";
			var maxheight="545px";
			if($("#dvRefBrands").css('height') == minheight){
				  $("#dvRefBrands").animate({height: maxheight} , 450);
				  
				  $("#dvRefBrandsShowAll").html($("#dvRefBrandsShowAll").html().replace("more","less"));
				  $.scrollTo('#dvRefBrands',800);
				}
				else{
				  $("#dvRefBrands").animate({height: minheight}, 450);
  				  $("#dvRefBrandsShowAll").html($("#dvRefBrandsShowAll").html().replace("less","more"));
				  $.scrollTo('#dvReferences',800);
				}
			});
	
		$('#dvRefBrands a').cluetip({ dropShadow: false, sticky: false, ajaxCache: true, arrows: true});
	
//CODE FOR BRANDS - ENDS
	
	
	
	
	
		var options= {
			target: '#contactMsg',
			success: cbSuccess
		}
		//$('#frmContact').ajaxForm(options);
		

		
		
		
		$('a.homelink').click(function(obj){
			obj.preventDefault();
			//alert('hi, im homelink');
			$.scrollTo($(this).attr('href'), 
						{axis:'y', 
						duration:1600
						});
		});
		
		$('#frmContact').validate({
			submitHandler:function () {
				$('#frmContact').ajaxSubmit(options)
				},
			rules: {
				txtFName: "required",
				txtLName: "required",
				txtEmail: {required:true, email:true},
				txtContact: { required:true, number:true, minlength:7, maxlength:20},
				drpPurpose: {required:true, min:1},
				txMessage: {required:true, maxlength:512 }
			},
			messages: {
				txtFName: "",
				txtLName: "",
				txtEmail: "Should be valid email",
				txtContact: "Should be valid number",
				drpPurpose: "Select from the drop down list",
				txMessage: "Should not exceed 512 characters"

			}
		});	
	});
