$(document).ready(function(){
	$(".top_msgk").animate({"top":"-5px"},"slow");
	$(".top_msg").css("opacity","0");
	$(".top_msg").animate({"opacity":".9"});
	$(".clicktogive").click(function(){
		$(".top_msgk").animate({"top":"-42px"},"slow",function(){
			$(".top_msgk").css("top","-177px");
			$(".top_msg").html('<form name="feedback" id="feedback" method="post" action=""><ul><li class="required">Name</li><li class="quote">&nbsp;</li><li class="input_msg"><input name="msg_name" id="msg_name" type="text" /></li><li class="required">Email</li><li class="quote">&nbsp;</li><li class="input_msg"><input name="msg_email" id="msg_email" type="text" /></li><li class="required">Message</li><li class="quote">&nbsp;</li><li class="input_msg"><textarea name="msg_message" id="msg_message"></textarea></li><li class="required">&nbsp;</li><li class="quote">&nbsp;</li><li class="input_msg"><strong onClick="cancelfeadback();" style="float:left">Cancel</strong><strong onClick="send_msg()">Send Message</strong></li><br clear="all" style="clear:both" /></ul></form>');
			$(".top_msgk").animate({"top":"0px"},1500)
		});
	});
});
var isoksuccess = 0;
var new_oneup = 0;
function send_msg(){
	errormsg = "You can not continue because of :\n";
	if($("#msg_name").val()==""){
		errormsg+= "   Error in name\n";
	}
	if($("#msg_email").val()==""){
		errormsg+= "   Error in email\n";
	}else{
		x=$("#msg_email").val();
		atpos=x.indexOf("@");
		dotpos=x.lastIndexOf(".");
		if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length){
			errormsg+= "   Error in email\n";
		}
	}
	if($("#msg_message").val()==""){
		errormsg+= "   Error in message\n";
	}
	if(errormsg!="You can not continue because of :\n"){
		alert(errormsg);
	}else{
		lasttop = "-"+$(".top_msgk").css("height");
		$(".top_msgk").animate({"top":lasttop},1500,function(){
			$(".top_msg").html("Thank you!");
			$(".top_msgk").css("top","-42px");
			$(".top_msgk").animate({"top":"0px"},"slow")
		});
		datas = $('#feedback').serialize();
		$.ajax({url:'../scripts/php/sendfeedback.php',type:'post',data:datas});
	}
}
function cancelfeadback(){
	lasttop = "-"+$(".top_msgk").css("height");
	$(".top_msgk").animate({"top":lasttop},1500);
}
