/* (c) Allwebsites.lv 2012 info@allwebsites.lv */ $(document).ready(function() { $('#mcs').change(function() { $('#rcs').removeAttr('name'); setforsubmit(); }); $('#rcs').change(function() { setforsubmit(); }); $('.class_radio').click(function() { setforsubmit(); }); $('.s_w').click(function() { $("#a_search").val(""); $('#a_search').removeAttr('name'); setforsubmit(); }); $('.s_a').click(function() { $("#w_search").val(""); $('#w_search').removeAttr('name'); setforsubmit(); }); //Set images for fancy box $("a.fancy").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : false }); //Set iframe window for fancy box $(".iframe").fancybox({ 'width' : '80%', 'height' : '98%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); $(window).scroll(function () { $('.center_block_out').center(); }); }); //Set good all on center off page. var abs = 0; function open_small(id) { $.get('http://www.saluddutyfree.com/?p=ajax&act=get_house_small&id='+id, function(data){ abs +=1; $('.center_block_out').center('absolute'); if(abs==1) { $(window).scrollTop(3) } $('.center_block_out .information_center').html(data); $('.center_block_out').fadeIn('slow'); $('.close_center img').click(function(){ $('.center_block_out').fadeOut('slow'); }); }); } function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } function setform() { $('#ctf').append(''); setforsubmit(); } function setforsubmit() { if($("#w_search").val()=='Keyword'){ $('#w_search').removeAttr('name'); } if($("#w_search").val()==''){ $('#w_search').removeAttr('name'); } if($("#a_search").val()=='Model_nr'){ $('#a_search').removeAttr('name'); } if($("#mcs").val()=='0'){ $('#mcs').removeAttr('name'); } if($("#rcs").val()=='0'){ $('#rcs').removeAttr('name'); } if(getUrlVars()["limit"]) $('#ctf').append(''); if(getUrlVars()["obd"] && $('#orderin').attr('name') == undefined){ $('#orderin').attr('name', 'obd'); $('#orderin').val(getUrlVars()["obd"]);} if(getUrlVars()["obpl"] && $('#orderin').attr('name') == undefined){ $('#orderin').attr('name', 'obpl'); $('#orderin').val(getUrlVars()["obpl"]);} if(getUrlVars()["obpr"] && $('#orderin').attr('name') == undefined){ $('#orderin').attr('name', 'obpr'); $('#orderin').val(getUrlVars()["obpr"]);} if(getUrlVars()["oba"] && $('#orderin').attr('name') == undefined){ $('#orderin').attr('name', 'oba'); $('#orderin').val(getUrlVars()["oba"]);} $("#ctf").submit(); } function all_suply(){ $('#ctf input').removeAttr('name'); $('#ctf select').removeAttr('name'); $("#ctf").submit(); } function ord1() { $('#orderin').attr('name', 'obd'); if(getUrlVars()["obd"]=='ASC') $('#orderin').val('DESC'); else $('#orderin').val('ASC'); setforsubmit(); } function ord2() { $('#orderin').attr('name', 'obpl'); if(getUrlVars()["obpl"]=='ASC') $('#orderin').val('DESC'); else $('#orderin').val('ASC'); setforsubmit(); } function ord3() { $('#orderin').attr('name', 'obpr'); if(getUrlVars()["obpr"]=='ASC') $('#orderin').val('DESC'); else $('#orderin').val('ASC'); setforsubmit(); } function ord4() { $('#orderin').attr('name', 'oba'); if(getUrlVars()["oba"]=='ASC') $('#orderin').val('DESC'); else $('#orderin').val('ASC'); setforsubmit(); } function o_item(newa,old){ var pathname = $(location).attr('href'); path=pathname.replace("item="+old, "item="+newa); window.location.href = path; } function printPage() { var html=""; html+=""; html+=""; html+=""; html+=""+$(location).attr('href')+""; html+= document.getElementById('one_item_view').innerHTML; html+=""; var htmlCode = html; document.write(htmlCode); window.print(); var pathname = $(location).attr('href'); window.location.href = pathname; } function stfriend(){ $.fancybox({ content: $("#stf"), }); } function registr(){ $.fancybox({ content: $("#regs"), }); } function pasw(){ $.fancybox({ content: $("#pasw"), }); } function registr1(){ var error=0; var txt=" "; if(!$("#regs input[name=name]").val()){ txt=txt+"Name is required! \n"; error=1; } if(!$("#regs input[name=sname]").val()){ txt=txt+"Surname is required! \n"; error=1; } if (!$("#regs input[name=email]").val().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)){ txt=txt+"Invalid email! \n"; error=1; } if($("#regs input[name=pass1]").val()!=$("#regs input[name=pass2]").val()){ txt=txt+"Passwords do not match! \n"; error=1; } if (!$("#regs input[name=pass1]").val()){ txt=txt+"Password is required! \n"; error=1; } if (!$("#regs input[name=sc]").val()){ txt=txt+"Security code is required! \n"; error=1; } if(error==0){ var url = "?p=ajax&sys=regs"; // the script where you handle the form input. $.ajax({ type: "POST", url: url, data: $("#regform").serialize(), // serializes the form's elements. success: function(data) { $('#regs').html(data); } }); return false; } else alert(txt); } function pr(){ var errorr=0; var txt=" "; if (!$("#pasw input[name=email]").val().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)){ txt=txt+"Invalid email! \n"; errorr=1; } if (!$("#pasw input[name=sc]").val()){ txt=txt+"Security code is required! \n"; errorr=1; } if(errorr==0){ var url = "?p=ajax&sys=pasw"; // the script where you handle the form input. $.ajax({ type: "POST", url: url, data: $("#passform").serialize(), // serializes the form's elements. success: function(data) { $('#pasw').html(data); } }); return false; } else alert(txt); } function lout(){ var pathname = $(location).attr('href'); $.get('?p=ajax',{'sys': 'lout'}, function (data) { window.location.href = pathname; }); } function offerr(){ $.fancybox({ content: $("#offer"), }); }