var remote_addr ='38.107.191.105' var qv1Slide; var qv1Slide2; var qv1Form; var qv1Cookie = Cookie.get('qv1'); var qv1CookieDays = 30; var qArray = new Array('qv11','qv12','qv13','qv14'); var qArrayRandom = new Array(); var qSum = 4; /** Only execute if a cookie is not set or the value of the cookie is not 'hide' */ if (qv1Cookie != 'hide') { window.addEvent('domready', function(){ qv1Slide = new Fx.Slide('qv1', {mode: 'vertical'}).hide(); qv1Slide2 = new Fx.Slide('qv3', {mode: 'vertical'}).hide(); $('qv1').setStyle('display','block'); $('qv3').setStyle('display','block'); qv1Slide.slideIn.delay(3000, qv1Slide); qv1Form = $('qv1f'); for (qArrayRandom.length; qArrayRandom.length <= qSum - 1;) { qArrayRandom.include(qArray.getRandom()); } qArrayRandom.each(function(row){ clone = $(row).clone(); $(row).remove(); clone.injectAfter('qv1h'); }); $('qv1ra').value= remote_addr; $('qv1-button-hide').addEvent('click', function(e){ e = new Event(e); qv1Slide.hide(); qv1Form.reset(); Cookie.set('qv1', 'hide', {duration: qv1CookieDays}); e.stop(); }); /* Submit data to DB server */ $('qv1-button-submit').addEvent('click', function(e) { /** * Prevent the submit event */ new Event(e).stop(); /** * This empties the log and shows the spinning indicator */ var qv1log = $('qv3content').empty().addClass('ajax-loading'); qv1Slide2.slideIn.delay(1000, qv1Slide2); /** * send takes care of encoding and returns the Ajax instance. * onComplete removes the spinner from the log. */ $('qv1f').send({ update: qv1log, onComplete: function() { qv1log.removeClass('ajax-loading'); qv1Slide.slideOut.delay(250, qv1Slide); qv1Form.reset(); Cookie.set('qv1', 'hide', {duration: qv1CookieDays}); } }); //qv1Slide2.slideOut.delay(5000, qv1Slide2); }); }); } /* Show div after a delay */ //window.addEvent('load', function () { // qv1Slide.slideIn.delay(3000, qv1Slide); //});