function isValidEmailAddress(email) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email); } function subscribe() { $.status = false; if ($('#fr_name').val().length < 3) { $('#fr_name').css("border-color","red"); $.status = true; } else { $('#fr_name').css("border-color","#bbb69c"); } if (isValidEmailAddress($('#fr_email').val())) { $('#fr_email').css("border-color","#bbb69c"); } else { $('#fr_email').css("border-color","red"); $.status = true; } if ($.status == true) { alert('Lūdzu pārbaudiet visas atzīmētas daļas!'); } else { $.post("/subscribe.php", { lang_id: 1, name: $("#fr_name").val(), email: $("#fr_email").val() }, function(data){ alert(data); $('.qtip').hide(); }); } } $().ready(function() { $('.on h2').click(function(){ $(this).parent().toggleClass('on'); $(this).parent().toggleClass('off'); }); $('.off h2').click(function(){ $(this).parent().toggleClass('on'); $(this).parent().toggleClass('off'); }); $('.search_block-body img.button').click(function(e){ $('.search_block-pop').hide(); $('#pop'+$(this).attr('rel')).css("left", (e.pageX-(($(window).width()-990)/2))+'px'); $('#pop'+$(this).attr('rel')).css("top", (e.pageY-120)+'px'); $('#pop'+$(this).attr('rel')).show(); }); $('.search_block-body ').click(function(e){ $('#pop'+$(this).attr('rel')).hide(); }); $('.search_block-pop .ok').click(function(){ $(this).parent().parent().hide(); }); }); $(document).ready(function() { // Use the each() method to gain access to each elements attributes $('#col1 a[rel]').each(function() { if ($(this).attr('rel') != 'nofollow') { if ($(this).text() == "") { $.val = "Informacija aģentiem"; } else { $.val = $(this).text(); } $(this).qtip( { content: { // Set the text to an image HTML string with the correct src URL to the loading image you want to use text: 'Loading...', url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load title: { text: $.val, // Give the tooltip a title using each elements text button: 'x' // Show a close link in the title } }, position: { corner: { target: 'bottomMiddle', // Position the tooltip above the link tooltip: 'topMiddle' }, adjust: { screen: true // Keep the tooltip on-screen at all times } }, show: { when: 'click', solo: true // Only show one tooltip at a time }, hide: 'unfocus', style: { tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner padding: 10, background: '#f8f8f3', color: '#2f1904', title: { background: '#76651f', color: '#d3d2bd' }, button: { color: '#d3d2bd' }, border: { width: 4, radius: 0, color: '#3f1f04' }, name: 'light', // Use the default light style width: { min: 400, // Set the tooltip width max: 400 } } }) } }); });