// JavaScript Document

$(document).ready(function(){
	var mailformplus = $("#kontaktformular").validate({
		rules: {
			Vorname: "required",
			Nachname: "required",
			"E-Mail-Adresse": "required email",
			Nachricht: "required",
			"Telefon-Nr": "number"
		},
		messages: {
			Vorname: "Bitte geben Sie Ihren Vornamen ein.",
			Nachname: "Bitte geben Sie Ihren Nachnamen ein.",
			"E-Mail-Adresse": {
				required: "Bitte geben Sie Ihre E-Mail-Adresse ein.",
				email: "Ihre Eingabe muss vom Format name@meinedomain.de sein."
			},
			Nachricht: "Bitte geben Sie eine Nachricht ein.",
			"Telefon-Nr": {
				number: "Sie d&uuml;rfen nur Zahlen eingeben."	
			}
		},
		//errorLabelContainer: "#messageBox",
		//wrapper: "li",
		errorPlacement: function(error, element) {
     		error.appendTo(element.parent("td").find(".messageBox"));
		},
		errorClass: "invalid"
	});
	
	var highlightColor = "#6C75A9";
	
	$(".contact_text, .contact_textarea").focus(function(){
		$(this).css({borderColor: highlightColor});													 
	});
	
	$(".contact_text, .contact_textarea").blur(function(){
		$(this).css({borderColor: ""});													
	});	
   
    /*
    if ($("#product-options-hidden").length>0) {
        $("#product-options-visible").append("<label>Kaufen als</label>");
        $("#product-options-visible").append('<select name="fake"></select>');
        
        $("#product-options-hidden option").each(function(){
            var this_option = $(this).html();
            var this_value = $(this).val();
            var this_select_id = $(this).parent("select").attr("name");
            $("#product-options-visible select").append('<option value="'+this_select_id+'-'+this_value+'">'+this_option+'</option>');
        });
        
        $("#product-options-visible select").change(function(){
            var selected_value = $(this).find("option:selected").val();
            selected_value = selected_value.split("-");
            select_id = selected_value[0];
            new_value = selected_value[1];
            
            $("#product-options-hidden select[name="+select_id+"] option[value="+new_value+"]").attr({selected: 'selected'});
            
            /*$("#product-options-hidden select[name="+select_id+"] option[value="+new_value+"]").attr({
                selected: selected,
           });*/
    /*
        });
    }
    */	   
    
   
    $('.umfrage').fancybox({
            'width' : 600,
            'height': 400
        });
});

 function byenow(i){
    with(document.getElementById('downloadversion')){
        value=i;
        form.submit()
    }
    
}
