﻿$(function(){
	$("#symptom_container").flash( { wmode: "transparent", src: baseURL + "/symptom/symptom_new.swf", flashvars:{folderURL:baseURL + "/symptom"}, width:550, height:250 }, { version: 8 } );
	
	$("#symptom_puff").flash( { wmode: "transparent", src: baseURL + "/symptom/puff.swf", width:550, height:175 }, { version: 8 } );
	
	$.sifr({path:baseURL+'/',font: "sifr"});
	$("#h2_container").height($("h2").height())
	$("h2").sifr({
		color: "#212121",
		width:590
	});
	
	$("#drop_menu ul").css({display: "none"}); // Opera Fix   
	

	$("#drop_menu li").hover(function(){   
	$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(250);   
	},function(){   
	$(this).find('ul:first').css({visibility: "hidden"});   
	});   
	
	$("#contact_form").validationEngine({ 
		success : function() { send_form()},
	  	failure : function() {}
		});


function send_form(){
	var first_time_user;
	var customer;
	if ($('#first_time').is(':checked')){
		first_time_user = "Ja";
		}
	else {
		first_time_user = "Nej";
	}
	
	if ($('#customer').is(':checked')){
		customer = "Ja";
	}	
	else {
		customer = "Nej";
	}
	$.get(baseURL + "/send_sodertandlakarna.php", {
				n: $("#n").val(),
				s: $("#s").val(),
				e: $("#e").val(),
				t: $("#t").val(),
				m: $("#m").val(),
				year: $("#year").val(),
				month: $("#month").val(),
				day: $("#day").val(),
				time: $("#time").val(),
				first_time: first_time_user,
				customer: customer
			}, function(d){
				$("#send_f").attr("disabled", "false"); 
				alert("Ditt meddelande är skickat");
				$('input').removeClass('error_input');
				$("#n").val("");
				$("#s").val("");
				$("#e").val("");
				$("#t").val("");
				$("#m").val("");
				
				
			}, "json"); }




	
	

	/*
	jQuery.validator.messages.required = "";
	$("#time_bookning_form").validate({

	highlight: function(element, errorClass) {
			$(element).addClass('error_input')},
	submitHandler: function(form) {
       $.get(baseURL + "/send_sodertandlakarna.php", {
				n: $("#n").val(),
				s: $("#s").val(),
				e: $("#e").val(),
				t: $("#t").val(),
				m: $("#m").val(),
				year: $("#year").val(),
				month: $("#month").val(),
				day: $("#day").val(),
				time: $("#time").val(),
				first_time: $("#first_time").val(),
				customer: $("#customer").val()
			}, function(d){
				$("#send_f").attr("disabled", "false"); 
				alert("Ditt meddelande är skickat");
				$('input').removeClass('error_input');
				$("#n").val("");
				$("#s").val("");
				$("#e").val("");
				$("#t").val("");
				$("#m").val("");
				
				
			}, "json"); }});



	$("#send_f").click(function(){
		
								
		$("#send_f").attr("disabled", "true"); 
		$.get(baseURL + "/send_sodertandlakarna.php", {
				n: $("#n").val(),
				s: $("#s").val(),
				e: $("#e").val(),
				t: $("#t").val(),
				m: $("#m").val(),
				year: $("#year").val(),
				month: $("#month").val(),
				day: $("#day").val(),
				time: $("#time").val(),
				first_time: $("#first_time").val(),
				customer: $("#customer").val()
			}, function(d){
				$("#send_f").attr("disabled", "false"); 
				alert("Ditt meddelande är skickat");
				
				$("#n").val("");
				$("#s").val("");
				$("#e").val("");
				$("#t").val("");
				$("#m").val("");
				
				
			}, "json");
		
		return false;
		
	})
	*/
});

