$(document).ready(function(){
	$("ul.nav").superfish();
	$("form").validate({
		rules:{
			fname: {
				required: true,
				minlength: 2
			},
			lname: {
				required: true,
				minlength: 2
			},
			country: {
				required: true,
				minlength: 2
			},
			phone1: {
				required: true,
				minlength: 3,
				number:true
			},
			phone2: {
				required: true,
				minlength: 3,
				number:true
			},
			phone3: {
				required: true,
				minlength:4,
				number:true
			},
			exphone1: {
				minlength: 3,
				number:true
			},
			exphone2: {
				minlength: 3,
				number:true
			},
			exphone3: {
				minlength: 4,
				number:true
			},
			email: {
				email: true,
				minlength: 5
			}													
		}
	});
	if($("select[@name='paper']").val() == "Other"){
		$("#paper").after("<TR id='paperother'><TD align=right vAlign=top bgcolor='#F5FAF9' class='BlackVerdana9'>Other:</TD><TD align=left bgcolor='#F5FAF9' class='DarkGreyBoldVerdana11' ><textarea type='text' name='paperother' cols='40' rows='3'></textarea></TD></TR>");
	}
	$("select[@name='paper']").change(function(){
		if($(this).val() == "Other"){
			$("#paper").after("<TR id='paperother'><TD align=right vAlign=top bgcolor='#F5FAF9' class='BlackVerdana9'>Other:</TD><TD align=left bgcolor='#F5FAF9' class='DarkGreyBoldVerdana11' ><textarea type='text' name='paperother' cols='40' rows='3'></textarea></TD></TR>");
		}else{
			$("#paperother").empty();
		}
	});	
	
	if($("select[@name='internet']").val() == "Other"){
		$("#internet").after("<TR id='internetother'><TD align=right vAlign=top bgcolor='#F5FAF9' class='BlackVerdana9'>Other:</TD><TD align=left bgcolor='#F5FAF9' class='DarkGreyBoldVerdana11' ><textarea type='text' name='internetother' cols='40' rows='3'></textarea></TD></TR>");
	}	
	$("select[@name='internet']").change(function(){
		if($(this).val() == "Other"){
			$("#internet").after("<TR id='internetother'><TD align=right vAlign=top bgcolor='#F5FAF9' class='BlackVerdana9'>Other:</TD><TD align=left bgcolor='#F5FAF9' class='DarkGreyBoldVerdana11' ><textarea type='text' name='internetother' cols='40' rows='3'></textarea></TD></TR>");
		}else{
			$("#internetother").empty();
		}
	});
	
	$("input[@name='store']").click(function(){
		var out = $(this).attr("checked");
		if(out == true){
			if($("#visitarea").length == 0){
				$("#visit").append("<textarea type='text' name='storeother' cols='40' rows='3' id='visitarea'>Location:</textarea>");
			}
		}else{
			$("#visitarea").remove();
		}
	});
	
	$("input[@name='other']").click(function(){
		if($(this).attr("checked")){
			$("#other").append("<textarea type='text' name='otherother' cols='40' rows='3' id='other'></textarea>");
		}else{
			$("textarea[@name='otherother']").remove();
		}
	});
	
	var out = $("#page_title").css("height");
	if ($.browser.msie) {
		out = parseInt(out,10) + 112;
	} 
	$(".mid_center_lm_contact").css("height",out);	
});