// JavaScript Document function submitThisForm(e) { var resultat = testForm(e,attTestas) if (resultat) { document.getElementById("verifyFrm").value = "verified"; e.action = window.location; } return resultat; } function popupJa() { $('.popup_button_nej').hide(); $('.popup_button_nej_i').show(); $('.popup_button_ja').hide(); $('.popup_button_ja_i').show(); $.ajax({ url: "/ajax/popup_form.asp", cache: false, success: function(html) { $(".popup_content").append(html); $(".popup_button_ja").unbind('click', popupJa); $('.p_inp').focus(function() { $(this).css('background','url(/bilder/design/input_bg_active.png)'); }); $('.p_texta').focus(function() { $(this).css('background','url(/bilder/design/text_bg_active.png)'); }); $('.p_inp').blur(function() { if($(this).hasClass('krav') && $(this).val() == '') { $(this).css('background','url(/bilder/design/input_bg_fail.png)'); } else { $(this).css('background','url(/bilder/design/input_bg_inactive.png)'); } }); $('.p_texta').blur(function() { $(this).css('background','url(/bilder/design/text_bg_inactive.png)'); }); $('.p_submit').click(function() { if(document.getElementById('p_namn').value == '' && document.getElementById('p_telefon').value == '') { alert("Du har inte fyllt ditt namn och ditt telefonnummer"); return false; } if(document.getElementById('p_namn').value == '') { alert("Du har inte fyllt ditt namn"); return false; } if(document.getElementById('p_telefon').value == '') { alert("Du har inte fyllt i ditt telefonnummer"); return false; } document.getElementById('verifyFrm').value = 'verified'; alert(document.getElementById('verifyFrm').value); data = $("#p_kontakt").serialize(); $.ajax({ url: "/ajax/popup_send.asp", type: "POST", data: data, cache: false, success: function(html) { $("#p_form").hide(); $(".popup_content").append(html); setTimeout("popupNej", 10000); } }); }); } }); $('.popup_button_ja').blur(); $('.popup_button_ja_i').click(function() { $('.popup_button_ja_i').blur(); }); } function popupNej() { jQuery(document).trigger('close.facebox'); } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } $(document).ready(function() { $('.popup_button_ja').bind('click', popupJa); $('.popup_button_nej').bind('click', popupNej); $('.p_close').bind('click', popupNej); });