function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById) { //screen thru every element in the form, and hunt down "submit" and "reset" for (i=0;i 0) { var field = document.forms[0]; for (i=0; i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i i){ ref=ref.replace(' ','-'); ref=ref.replace('&','-'); i=i+1; } ref=ref.substring(0,50); //fieldResultObj.value=ref.toUpperCase(); fieldResultObj.value = ref; } } var gClientIsGecko = (window.controllers) ? true : false; var gClientIsOpera = (window.opera) ? true : false; var gClientIsIE = (document.all && !gClientIsOpera) ? true : false; var gClientIsIE5 = (gClientIsIE && /MSIE 5\.0/.test(navigator.appVersion)) ? true : false; var gClientIsMac = (/Mac/.test(navigator.appVersion)) ? true : false; function showDiv (el, div, alignX, alignY) { // (i) popups etc if (document.getElementById){ var i = document.getElementById(el); var c = document.getElementById(div); if (c.style.display != "block"){ //var l=0; var t=0; //aTag = i; //do { // aTag = aTag.offsetParent; // l += aTag.offsetLeft; // t += aTag.offsetTop; //} while (aTag.offsetParent && aTag.tagName != 'BODY'); //var left = i.offsetLeft + l; //var top = i.offsetTop + t + i.offsetHeight + 2; var box = getDimensions(i); var left = box.x, top = box.y; //if (alignX == 'left' && c.style.width){ // left = left - parseInt(c.style.width); //} //if (alignY == 'top' && c.style.height){ // top = top - parseInt(c.style.height) -25; //} c.style.visibility = 'hidden'; // Needed to measure c.style.display = "block"; // Needed to measure if(alignX == 'left') left -= c.offsetWidth; else left += i.offsetWidth; if(alignY == 'top') top -= c.offsetHeight; else top += i.offsetHeight; if(top<10) top = 10; // XXX: Don't know why IE5 needs this here and not for calendar if(gClientIsIE5) { left += document.body.scrollLeft; top += document.body.scrollTop; } c.style.left = left+'px'; c.style.top = top+'px'; c.style.visibility = 'visible'; } else { c.style.display="none"; } } } function hideDiv (div) { if (document.getElementById){ var c=document.getElementById(div); c.style.display="none"; } } var hide = true; function showHideDiv (div) { if (document.getElementById) { var c=document.getElementById(div); if(c.style.display=="none") { c.style.display="block"; } else { c.style.display="none"; } } } function show_hide(element, link, linkInner1, linkInner2) { var elem = document.getElementById(element); var lnk = document.getElementById(link); //alert(elem.style.display); if(elem.style.display!='block') { elem.style.display='block'; if(link) lnk.innerHTML = linkInner2; } else { elem.style.display='none'; if(link) lnk.innerHTML = linkInner1; } /* if (control.innerText == "[more info...]") { control.innerText = "[minimise...]" document.getElementById('categoryDescription').style.display='inline'; } else { control.innerText = "[more info...]" document.getElementById('categoryDescription').style.display='none'; } */ return false; } // Getting element dimensions function getDimensions( elm ) { var box = { x:0, y:0, w:0, h:0 }; if(document.getBoxObjectFor) { var boxRef = document.getBoxObjectFor(elm); box.x = boxRef.x; box.y = boxRef.y; box.w = boxRef.width; box.h = boxRef.height; } else if(elm.getBoundingClientRect) { var rxIE50 = /MSIE 5\.0/g; //alert(rxIE50 + '.test("' + navigator.appVersion + '" = ' + rxIE50.test(navigator.appVersion)); var boxRef = elm.getBoundingClientRect(); box.x = boxRef.left; box.y = boxRef.top; box.w = (boxRef.right - boxRef.left); box.h = (boxRef.bottom - boxRef.top); //var s='';for(p in boxRef) s+=p+' '; alert(s); // Damn IE... if(document.compatMode && document.compatMode != 'BackCompat') { // IE6/compliance mode box.x += document.documentElement.scrollLeft - 2; box.y += document.documentElement.scrollTop - 2; } else if(!gClientIsIE5) { // IE5.5 box.x += document.body.scrollLeft - 2; box.y += document.body.scrollTop - 2; } } else { // No known box information available, walking // manually through offsetParents to calculate x/y coordinates box.w = elm.offsetWidth; box.h = elm.offsetHeight; while(elm) { box.x += elm.offsetLeft; box.y += elm.offsetTop; elm = elm.offsetParent; } } //var bodyDiv = document.getElementById('body'); //box.x -= bodyDiv.offsetLeft; return box; } /*function AddLinkToBookmark(bookmarkurl,bookmarktitle) { alert(bookmarktitle); if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle) } */ function AddLinkToBookmark(title,url) { //title = "VseVesti.com - ????? ?????? ??????"; //url = "http://vsevesti.com"; if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel(title, url,""); } else if( window.external ) { // IE Favorite window.external.AddFavorite( url, title); } else if(window.opera && window.print) { // Opera Hotlist alert("Sorry, your web browser does not support automatically adding Bookmarks/Favorites. Press 'Ctrl-D' in Firefox or 'Ctrl-T' in Opera to manually bookmark VseVesti.ru"); return true; } } function ff(nodeId) { var node = document.getElementById(nodeId); if (node.style.display =='none') { node.style.display = 'block'; }else{ node.style.display = 'none'; } } function ffalter(node1Id, node2Id) { var node1 = document.getElementById(node1Id); var node2 = document.getElementById(node2Id); //if (node1.style.display =='none') { node1.style.display = 'block'; node2.style.display = 'none'; //}else{ //node1.style.display = 'none'; //node1.style.display = 'none'; } } function writeSelectedCategory(targetID, targetValue, targetNameID, targetNameValue) { //alert(targetNameID); if(targetID && targetNameID) { document.getElementById(targetID).value = targetValue; document.getElementById(targetNameID).innerHTML = targetNameValue; } } function checkInput(element, method, messageIfError){ var elem = document.getElementById(element); //alert (elem.value); if(method=='digits') { var charpos = elem.value.search("[^0-9]"); //alert (charpos); if(elem.value.length > 0 && charpos >= 0) { elem.value=''; alert(messageIfError); } } } function ahah(url, target, loadingiconpath) { if(url == 'empty' || url == '') { document.getElementById(target).innerHTML = ''; } else { //alert(thisloadingicon); if(loadingiconpath) { document.getElementById(target).innerHTML = ''; } else if(loadingIcon.src) { document.getElementById(target).innerHTML = ''; } else { document.getElementById(target).innerHTML = 'Loaging...'; } if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function() {ahahDone(url, target);}; req.open("GET", url, true); req.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); req.send(""); } } } function ahahDone(url, target) { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200 || req.status == 304) { // only if "OK" document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText; } } } function length_left(maxlength, textlength, objid, fieldid){ dispobj=document.getElementById(objid + '_left'); dispobjtyped=document.getElementById(objid + '_typed'); descriptionValue = document.getElementById(fieldid).value; if(maxlength-textlength >= 0){ dispobj.style.color="red"; dispobj.innerHTML=maxlength-textlength; dispobjtyped.style.color="green"; dispobjtyped.innerHTML=textlength; } else { document.getElementById(fieldid).value = document.getElementById(fieldid).value.substr(0, maxlength); } } /*Progress Bar*/ function textCounter(field,counter,maxlimit,linecounter) { // text width// var fieldWidth = parseInt(field.offsetWidth); var charcnt = field.value.length; // trim the extra text if (charcnt > maxlimit) { field.value = field.value.substring(0, maxlimit); } else { // progress bar percentage var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ; var showValue = parseInt(maxlimit - charcnt) ; document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px"; //document.getElementById(counter).innerHTML="Limit: "+percentage+"%" document.getElementById(counter).innerHTML=showValue+' ('+percentage+'%)'; // color correction on style from CCFFF -> CC0000 } //setTextCounterColor(document.getElementById(counter),percentage,"backgroundColor"); document.getElementById(counter).style.backgroundColor = "rgb("+percentage+"%,"+(50-percentage/2)+"%,0%)"; } /*FADE ANIMATOR*/ var TimeToFade = 1000.0; function fade(eid, fs, rec) { var element = document.getElementById(eid); if(element == null) return; element.FadeState = fs; if(element.FadeState == null) { if(element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') { element.FadeState = 2; } else { element.FadeState = -2; } } //alert(element.FadeState); if(element.FadeState == 1 || element.FadeState == -1) { element.FadeState = element.FadeState == 1 ? -1 : 1; element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft; } else { //alert("else"); element.FadeState = element.FadeState == 2 ? -1 : 1; element.FadeTimeLeft = TimeToFade; setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33); } if(rec==1) { //setTimeout("fade('"+eid+"', "+2+", "+0+")", 7000); } } function animateFade(lastTick, eid) { var curTick = new Date().getTime(); var elapsedTicks = curTick - lastTick; var element = document.getElementById(eid); if(element.FadeTimeLeft <= elapsedTicks) { element.style.opacity = element.FadeState == 1 ? '1' : '0'; element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')'; element.FadeState = element.FadeState == 1 ? 2 : -2; return; } element.FadeTimeLeft -= elapsedTicks; var newOpVal = element.FadeTimeLeft/TimeToFade; if(element.FadeState == 1) newOpVal = 1 - newOpVal; element.style.opacity = newOpVal; element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')'; setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33); } /*FORM LABELS*/ function initOverLabels () { if (!document.getElementById) return; var labels, id, field; // Set focus and blur handlers to hide and show // LABELs with 'overlabel' class names. labels = document.getElementsByTagName('label'); //alert(labels); for (var i = 0; i < labels.length; i++) { if (labels[i].className == 'overlabel') { // Skip labels that do not have a named association // with another field. id = labels[i].htmlFor || labels[i].getAttribute ('for'); if (!id || !(field = document.getElementById(id))) { //alert(id); continue; } // Hide any fields having an initial value. if (field.value !== '') { hideLabel(field.getAttribute('id'), true); } // Set handlers to show and hide labels. field.onfocus = function () { hideLabel(this.getAttribute('id'), true); }; field.onblur = function () { if (this.value === '') { hideLabel(this.getAttribute('id'), false); } }; // Handle clicks to LABEL elements (for Safari). labels[i].onclick = function () { var id, field; id = this.getAttribute('for'); if (id && (field = document.getElementById(id))) { field.focus(); } }; } } }; function hideLabel (field_id, hide) { var field_for; var labels = document.getElementsByTagName('label'); for (var i = 0; i < labels.length; i++) { field_for = labels[i].htmlFor || labels[i]. getAttribute('for'); if (field_for == field_id) { //alert(window.innerWidth); //var wdw = window.innerWidth+1000; labels[i].style.textIndent = (hide) ? '-5000px' : '0px'; //labels[i].className = (hide) ? 'overlabelHidden' : 'overlabel'; return true; } } } // Created by: Simon Willison // http://simon.incutio.com/archive/2004/05/26/addLoadEvent function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { setTimeout(initOverLabels, 50); }); function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref) //alert(filename); } //============================================ // Author: 2basix automatisering // http://2basix.nl // Project: resource loader // Version: 1.5.4 development (20120210) // license: GNU General Public License v3 // project: http://code.google.com/p/rloader //============================================ (function ($) { $.rloader = function (args) { var list = [], resourcestoload = [], eventstohandle = [], attachevents = [], onreadyevent = null; if (args && !(args.propertyIsEnumerable('length')) && typeof args === 'object' && typeof args.length === 'number') { list = args; } else { list[0] = args; } function runFunction(f, arg) { if ( $.isFunction(f) || typeof f === 'string') { if ($.isFunction(f)) { f(arg); return true; } else { var fn = window[f]; if (typeof fn === 'function') { fn(arg); return true; } else { if (typeof eval(f) === "function") { eval(f).call(this,arg); return true; } } } return false; } return true; } // alternative IE safe console solution function add2console(text) { if (!(console)) { window.console = { tlog:"", log: function (par){ console.tlog+=par+"\n"; return true;}}; } console.log(text); } //================================================================== //================================================================== function processAttachedCallbacks(src) { var j; var callbackstructarray = $.rloader.track[src]._cback; if (callbackstructarray) { for (j = 0; j < callbackstructarray.length; j++) { runFunction(callbackstructarray[j].callback, callbackstructarray[j].arg); } // reset the array to no elements (all callbacks were processed) $.rloader.track[src]._cback= []; } return true; } //================================================================== //================================================================== function processAttachedEvents(src) { var i, j, fire, event; for (j = 0; j < $.rloader.track[src]._evts.length; j++) { event=$.rloader.track[src]._evts[j]; if (event.fired===0) { fire=true; for (i = 0; i < event.rlist.length; i++) { // -1 is error in loading (ignore this.... we still fire the event even though there was an error !!!) if ($.rloader.track[event.rlist[i]]) { if ($.rloader.track[event.rlist[i]].status === 0) { fire = false; break; } } else { // Bugfix in 1.5.4 fire = false; break; } } if (fire) { runFunction(event.func, event.arg); // make sure this event does not get fired twice $.rloader.track[src]._evts[j].fired=1; $.rloader.track[src]._evts[j].rlist=null; $.rloader.track[src]._evts[j].event=""; $.rloader.track[src]._evts[j].arg=null; } } } $.rloader.track[src]._evts=$.grep($.rloader.track[src]._evts, function(val) { return val.fired !== 1; }); } //============================================================================= // this will handle an event //============================================================================= function doEvent(src) { processAttachedCallbacks(src); processAttachedEvents(src); } function loadCSS(options) { var src=options.src; if (!options.cache) { var d = new Date(); src = src + "?" + d.getTime(); } var node = document.createElement('link'); node.type = 'text/css'; node.rel = 'stylesheet'; node.href = src; node.media = 'screen'; document.getElementsByTagName("head")[0].appendChild(node); $.rloader.track[options.src].status = 1; doEvent(options.src); return true; } function loadJS(options) { var src=options.src; $.ajax({ type: "GET", url: src, async: options.async, cache: options.cache, dataType: "script", error: function (jqXHR, textStatus, errorThrown) { $.rloader.track[src].status = -1; $.rloader.track[src].error = "rloader ajax error: "+textStatus+" - "+errorThrown; add2console($.rloader.track[src].error); add2console('rloader error on resource: '+src); }, statusCode: { 404: function() { $.rloader.track[src].status = -2; $.rloader.track[src].error = "rloader error: 404 - Resource NOT found: "+src; add2console($.rloader.track[src].error); } }, success: function () { $.rloader.track[src].status = 1; doEvent(src); } }); } function getFileType(filename) { return filename.split('.').pop().toLowerCase(); } // process the listed arguments (Split them into resources and events, and do checking) $.each(list, function (i, res) { if (typeof res.defaultcache === "boolean") { $.rloader.track.defaultcache=res.defaultcache; } if (typeof res.defaultasync === "boolean") { $.rloader.track.defaultasync=res.defaultasync; } if (typeof res.event === 'string') { if (res.event === 'onready' || res.event === 'beforeload') { // type check for an event if (typeof res.func === 'string' || typeof res.func === 'function') { var arg = null; if (res.arg) { arg = res.arg; } if (arg === null) { res.arg = {}; } res.fired=0; eventstohandle.push(res); } } } else { // The fileextension will be the type, in this version the type parameter is ignored completely if (typeof res.src === 'string') { res.type=getFileType(res.src); if (res.type==='js' || res.type==='css') { // preprocess all options here to correct format var callback = null; if (res.callback) { // type checking if (typeof res.callback === 'string' || typeof res.callback === 'function') { callback = res.callback; } } res.callback=callback; var argf= {}; if (typeof res.arg !== "undefined") { // type checking if (typeof res.arg === "object") { argf=res.arg; } } res.arg=argf; var async=$.rloader.track.defaultasync; if (typeof res.async !== "undefined") { if (typeof res.async==="boolean") { async=res.async; } if ((typeof res.async==="number") && res.async===1) { async=true; } } res.async=async; var cache=$.rloader.track.defaultcache; if (typeof res.cache !== "undefined") { if (typeof res.cache==="boolean") { cache=res.cache; } if ((typeof res.cache==="number") && res.cache===1) { cache=true; } } res.cache=cache; resourcestoload.push(res); } } } }); var i, j, justres; for (i = 0; i < eventstohandle.length; i++) { if (eventstohandle[i].event==="beforeload") { runFunction(eventstohandle[i].func, eventstohandle[i].arg); } if (eventstohandle[i].event==="onready") { justres = []; for (j=0;j=$(element).offset().top+$(element).height()-settings.threshold;};$.rightofscreen=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.leftofscreen=function(element,settings){var left=$(window).scrollLeft();return left>=$(element).offset().left+$(element).width()-settings.threshold;};$.inviewport=function(element,settings){return!$.rightofscreen(element,settings)&&!$.leftofscreen(element,settings)&&!$.belowthefold(element,settings)&&!$.abovethetop(element,settings);};$.extend($.expr[':'],{"below-the-fold":function(a,i,m){return $.belowthefold(a,{threshold:0});},"above-the-top":function(a,i,m){return $.abovethetop(a,{threshold:0});},"left-of-screen":function(a,i,m){return $.leftofscreen(a,{threshold:0});},"right-of-screen":function(a,i,m){return $.rightofscreen(a,{threshold:0});},"in-viewport":function(a,i,m){return $.inviewport(a,{threshold:0});}});})(jQuery);/* * Inline Form Validation Engine 2.6.2, jQuery plugin * * Copyright(c) 2010, Cedric Dugas * http://www.position-absolute.com * * 2.0 Rewrite by Olivier Refalo * http://www.crionics.com * * Form validation engine allowing custom regex rules to be added. * Licensed under the MIT License */ (function($) { "use strict"; var methods = { /** * Kind of the constructor, called before any action * @param {Map} user options */ init: function(options) { var form = this; if (!form.data('jqv') || form.data('jqv') == null ) { options = methods._saveOptions(form, options); // bind all formError elements to close on click $(document).on("click", ".formError", function() { $(this).fadeOut(150, function() { // remove prompt once invisible $(this).parent('.formErrorOuter').remove(); $(this).remove(); }); }); } return this; }, /** * Attachs jQuery.validationEngine to form.submit and field.blur events * Takes an optional params: a list of options * ie. jQuery("#formID1").validationEngine('attach', {promptPosition : "centerRight"}); */ attach: function(userOptions) { var form = this; var options; if(userOptions) options = methods._saveOptions(form, userOptions); else options = form.data('jqv'); options.validateAttribute = (form.find("[data-validation-engine*=validate]").length) ? "data-validation-engine" : "class"; if (options.binded) { // delegate fields form.on(options.validationEventTrigger, "["+options.validateAttribute+"*=validate]:not([type=checkbox]):not([type=radio]):not(.datepicker)", methods._onFieldEvent); form.on("click", "["+options.validateAttribute+"*=validate][type=checkbox],["+options.validateAttribute+"*=validate][type=radio]", methods._onFieldEvent); form.on(options.validationEventTrigger,"["+options.validateAttribute+"*=validate][class*=datepicker]", {"delay": 300}, methods._onFieldEvent); } if (options.autoPositionUpdate) { $(window).bind("resize", { "noAnimation": true, "formElem": form }, methods.updatePromptsPosition); } form.on("click","a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); form.removeData('jqv_submitButton'); // bind form.submit form.on("submit", methods._onSubmitEvent); return this; }, /** * Unregisters any bindings that may point to jQuery.validaitonEngine */ detach: function() { var form = this; var options = form.data('jqv'); // unbind fields form.find("["+options.validateAttribute+"*=validate]").not("[type=checkbox]").off(options.validationEventTrigger, methods._onFieldEvent); form.find("["+options.validateAttribute+"*=validate][type=checkbox],[class*=validate][type=radio]").off("click", methods._onFieldEvent); // unbind form.submit form.off("submit", methods.onAjaxFormComplete); // unbind form.submit form.off("submit", methods.onAjaxFormComplete); form.removeData('jqv'); form.off("click", "a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); form.removeData('jqv_submitButton'); if (options.autoPositionUpdate) $(window).unbind("resize", methods.updatePromptsPosition); return this; }, /** * Validates either a form or a list of fields, shows prompts accordingly. * Note: There is no ajax form validation with this method, only field ajax validation are evaluated * * @return true if the form validates, false if it fails */ validate: function() { var element = $(this); var valid = null; if (element.is("form") || element.hasClass("validationEngineContainer")) { if (element.hasClass('validating')) { // form is already validating. // Should abort old validation and start new one. I don't know how to implement it. return false; } else { element.addClass('validating'); var options = element.data('jqv'); var valid = methods._validateFields(this); // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again setTimeout(function(){ element.removeClass('validating'); }, 100); if (valid && options.onSuccess) { options.onSuccess(); } else if (!valid && options.onFailure) { options.onFailure(); } } } else if (element.is('form') || element.hasClass('validationEngineContainer')) { element.removeClass('validating'); } else { // field validation var form = element.closest('form, .validationEngineContainer'), options = (form.data('jqv')) ? form.data('jqv') : $.validationEngine.defaults, valid = methods._validateField(element, options); if (valid && options.onFieldSuccess) options.onFieldSuccess(); else if (options.onFieldFailure && options.InvalidFields.length > 0) { options.onFieldFailure(); } } if(options.onValidationComplete) { // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing return !!options.onValidationComplete(form, valid); } return valid; }, /** * Redraw prompts position, useful when you change the DOM state when validating */ updatePromptsPosition: function(event) { if (event && this == window) { var form = event.data.formElem; var noAnimation = event.data.noAnimation; } else var form = $(this.closest('form, .validationEngineContainer')); var options = form.data('jqv'); // No option, take default one form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each(function(){ var field = $(this); if (options.prettySelect && field.is(":hidden")) field = form.find("#" + options.usePrefix + field.attr('id') + options.useSuffix); var prompt = methods._getPrompt(field); var promptText = $(prompt).find(".formErrorContent").html(); if(prompt) methods._updatePrompt(field, $(prompt), promptText, undefined, false, options, noAnimation); }); return this; }, /** * Displays a prompt on a element. * Note that the element needs an id! * * @param {String} promptText html text to display type * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) * @param {String} possible values topLeft, topRight, bottomLeft, centerRight, bottomRight */ showPrompt: function(promptText, type, promptPosition, showArrow) { var form = this.closest('form, .validationEngineContainer'); var options = form.data('jqv'); // No option, take default one if(!options) options = methods._saveOptions(this, options); if(promptPosition) options.promptPosition=promptPosition; options.showArrow = showArrow==true; methods._showPrompt(this, promptText, type, false, options); return this; }, /** * Closes form error prompts, CAN be invidual */ hide: function() { var form = $(this).closest('form, .validationEngineContainer'); var options = form.data('jqv'); var fadeDuration = (options && options.fadeDuration) ? options.fadeDuration : 0.3; var closingtag; if($(this).is("form") || $(this).hasClass("validationEngineContainer")) { closingtag = "parentForm"+methods._getClassName($(this).attr("id")); } else { closingtag = methods._getClassName($(this).attr("id")) +"formError"; } $('.'+closingtag).fadeTo(fadeDuration, 0.3, function() { $(this).parent('.formErrorOuter').remove(); $(this).remove(); }); return this; }, /** * Closes all error prompts on the page */ hideAll: function() { var form = this; var options = form.data('jqv'); var duration = options ? options.fadeDuration:300; $('.formError').fadeTo(duration, 300, function() { $(this).parent('.formErrorOuter').remove(); $(this).remove(); }); return this; }, /** * Typically called when user exists a field using tab or a mouse click, triggers a field * validation */ _onFieldEvent: function(event) { var field = $(this); var form = field.closest('form, .validationEngineContainer'); var options = form.data('jqv'); options.eventTrigger = "field"; // validate the current field window.setTimeout(function() { methods._validateField(field, options); if (options.InvalidFields.length == 0 && options.onFieldSuccess) { options.onFieldSuccess(); } else if (options.InvalidFields.length > 0 && options.onFieldFailure) { options.onFieldFailure(); } }, (event.data) ? event.data.delay : 0); }, /** * Called when the form is submited, shows prompts accordingly * * @param {jqObject} * form * @return false if form submission needs to be cancelled */ _onSubmitEvent: function() { var form = $(this); var options = form.data('jqv'); //check if it is trigger from skipped button if (form.data("jqv_submitButton")){ var submitButton = $("#" + form.data("jqv_submitButton")); if (submitButton){ if (submitButton.length > 0){ if (submitButton.hasClass("validate-skip") || submitButton.attr("data-validation-engine-skip") == "true") return true; } } } options.eventTrigger = "submit"; // validate each field // (- skip field ajax validation, not necessary IF we will perform an ajax form validation) var r=methods._validateFields(form); if (r && options.ajaxFormValidation) { methods._validateFormWithAjax(form, options); // cancel form auto-submission - process with async call onAjaxFormComplete return false; } if(options.onValidationComplete) { // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing return !!options.onValidationComplete(form, r); } return r; }, /** * Return true if the ajax field validations passed so far * @param {Object} options * @return true, is all ajax validation passed so far (remember ajax is async) */ _checkAjaxStatus: function(options) { var status = true; $.each(options.ajaxValidCache, function(key, value) { if (!value) { status = false; // break the each return false; } }); return status; }, /** * Return true if the ajax field is validated * @param {String} fieldid * @param {Object} options * @return true, if validation passed, false if false or doesn't exist */ _checkAjaxFieldStatus: function(fieldid, options) { return options.ajaxValidCache[fieldid] == true; }, /** * Validates form fields, shows prompts accordingly * * @param {jqObject} * form * @param {skipAjaxFieldValidation} * boolean - when set to true, ajax field validation is skipped, typically used when the submit button is clicked * * @return true if form is valid, false if not, undefined if ajax form validation is done */ _validateFields: function(form) { var options = form.data('jqv'); // this variable is set to true if an error is found var errorFound = false; // Trigger hook, start validation form.trigger("jqv.form.validating"); // first, evaluate status of non ajax fields var first_err=null; form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each( function() { var field = $(this); var names = []; if ($.inArray(field.attr('name'), names) < 0) { errorFound |= methods._validateField(field, options); if (errorFound && first_err==null) if (field.is(":hidden") && options.prettySelect) first_err = field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); else first_err=field; if (options.doNotShowAllErrosOnSubmit) return false; names.push(field.attr('name')); //if option set, stop checking validation rules after one error is found if(options.showOneMessage == true && errorFound){ return false; } } }); // second, check to see if all ajax calls completed ok // errorFound |= !methods._checkAjaxStatus(options); // third, check status and scroll the container accordingly form.trigger("jqv.form.result", [errorFound]); if (errorFound) { if (options.scroll) { var destination=first_err.offset().top; var fixleft = first_err.offset().left; //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) var positionType=options.promptPosition; if (typeof(positionType)=='string' && positionType.indexOf(":")!=-1) positionType=positionType.substring(0,positionType.indexOf(":")); if (positionType!="bottomRight" && positionType!="bottomLeft") { var prompt_err= methods._getPrompt(first_err); if (prompt_err) { destination=prompt_err.offset().top; } } // Offset the amount the page scrolls by an amount in px to accomodate fixed elements at top of page if (options.scrollOffset) { destination -= options.scrollOffset; } // get the position of the first error, there should be at least one, no need to check this //var destination = form.find(".formError:not('.greenPopup'):first").offset().top; if (options.isOverflown) { var overflowDIV = $(options.overflownDIV); if(!overflowDIV.length) return false; var scrollContainerScroll = overflowDIV.scrollTop(); var scrollContainerPos = -parseInt(overflowDIV.offset().top); destination += scrollContainerScroll + scrollContainerPos - 5; var scrollContainer = $(options.overflownDIV + ":not(:animated)"); scrollContainer.animate({ scrollTop: destination }, 1100, function(){ if(options.focusFirstField) first_err.focus(); }); } else { $("html, body").animate({ scrollTop: destination }, 1100, function(){ if(options.focusFirstField) first_err.focus(); }); $("html, body").animate({scrollLeft: fixleft},1100) } } else if(options.focusFirstField) first_err.focus(); return false; } return true; }, /** * This method is called to perform an ajax form validation. * During this process all the (field, value) pairs are sent to the server which returns a list of invalid fields or true * * @param {jqObject} form * @param {Map} options */ _validateFormWithAjax: function(form, options) { var data = form.serialize(); var type = (options.ajaxFormValidationMethod) ? options.ajaxFormValidationMethod : "GET"; var url = (options.ajaxFormValidationURL) ? options.ajaxFormValidationURL : form.attr("action"); var dataType = (options.dataType) ? options.dataType : "json"; $.ajax({ type: type, url: url, cache: false, dataType: dataType, data: data, form: form, methods: methods, options: options, beforeSend: function() { return options.onBeforeAjaxFormValidation(form, options); }, error: function(data, transport) { methods._ajaxError(data, transport); }, success: function(json) { if ((dataType == "json") && (json !== true)) { // getting to this case doesn't necessary means that the form is invalid // the server may return green or closing prompt actions // this flag helps figuring it out var errorInForm=false; for (var i = 0; i < json.length; i++) { var value = json[i]; var errorFieldId = value[0]; var errorField = $($("#" + errorFieldId)[0]); // make sure we found the element if (errorField.length == 1) { // promptText or selector var msg = value[2]; // if the field is valid if (value[1] == true) { if (msg == "" || !msg){ // if for some reason, status==true and error="", just close the prompt methods._closePrompt(errorField); } else { // the field is valid, but we are displaying a green prompt if (options.allrules[msg]) { var txt = options.allrules[msg].alertTextOk; if (txt) msg = txt; } if (options.showPrompts) methods._showPrompt(errorField, msg, "pass", false, options, true); } } else { // the field is invalid, show the red error prompt errorInForm|=true; if (options.allrules[msg]) { var txt = options.allrules[msg].alertText; if (txt) msg = txt; } if(options.showPrompts) methods._showPrompt(errorField, msg, "", false, options, true); } } } options.onAjaxFormComplete(!errorInForm, form, json, options); } else options.onAjaxFormComplete(true, form, json, options); } }); }, /** * Validates field, shows prompts accordingly * * @param {jqObject} * field * @param {Array[String]} * field's validation rules * @param {Map} * user options * @return false if field is valid (It is inversed for *fields*, it return false on validate and true on errors.) */ _validateField: function(field, options, skipAjaxValidation) { if (!field.attr("id")) { field.attr("id", "form-validation-field-" + $.validationEngine.fieldIdCounter); ++$.validationEngine.fieldIdCounter; } if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))) return false; var rulesParsing = field.attr(options.validateAttribute); var getRules = /validate\[(.*)\]/.exec(rulesParsing); if (!getRules) return false; var str = getRules[1]; var rules = str.split(/\[|,|\]/); // true if we ran the ajax validation, tells the logic to stop messing with prompts var isAjaxValidator = false; var fieldName = field.attr("name"); var promptText = ""; var promptType = ""; var required = false; var limitErrors = false; options.isError = false; options.showArrow = true; // If the programmer wants to limit the amount of error messages per field, if (options.maxErrorsPerField > 0) { limitErrors = true; } var form = $(field.closest("form, .validationEngineContainer")); // Fix for adding spaces in the rules for (var i = 0; i < rules.length; i++) { rules[i] = rules[i].replace(" ", ""); // Remove any parsing errors if (rules[i] === '') { delete rules[i]; } } for (var i = 0, field_errors = 0; i < rules.length; i++) { // If we are limiting errors, and have hit the max, break if (limitErrors && field_errors >= options.maxErrorsPerField) { // If we haven't hit a required yet, check to see if there is one in the validation rules for this // field and that it's index is greater or equal to our current index if (!required) { var have_required = $.inArray('required', rules); required = (have_required != -1 && have_required >= i); } break; } var errorMsg = undefined; switch (rules[i]) { case "required": required = true; errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._required); break; case "custom": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._custom); break; case "groupRequired": // Check is its the first of group, if not, reload validation with first field // AND continue normal validation on present field var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; var firstOfGroup = form.find(classGroup).eq(0); if(firstOfGroup[0] != field[0]){ methods._validateField(firstOfGroup, options, skipAjaxValidation); options.showArrow = true; } errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._groupRequired); if(errorMsg) required = true; options.showArrow = false; break; case "ajax": // AJAX defaults to returning it's loading message errorMsg = methods._ajax(field, rules, i, options); if (errorMsg) { promptType = "load"; } break; case "minSize": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minSize); break; case "maxSize": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxSize); break; case "min": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._min); break; case "max": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._max); break; case "past": errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._past); break; case "future": errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._future); break; case "dateRange": var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; options.firstOfGroup = form.find(classGroup).eq(0); options.secondOfGroup = form.find(classGroup).eq(1); //if one entry out of the pair has value then proceed to run through validation if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateRange); } if (errorMsg) required = true; options.showArrow = false; break; case "dateTimeRange": var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; options.firstOfGroup = form.find(classGroup).eq(0); options.secondOfGroup = form.find(classGroup).eq(1); //if one entry out of the pair has value then proceed to run through validation if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateTimeRange); } if (errorMsg) required = true; options.showArrow = false; break; case "maxCheckbox": field = $(form.find("input[name='" + fieldName + "']")); errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxCheckbox); break; case "minCheckbox": field = $(form.find("input[name='" + fieldName + "']")); errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minCheckbox); break; case "equals": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._equals); break; case "funcCall": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._funcCall); break; case "creditCard": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._creditCard); break; case "condRequired": errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._condRequired); if (errorMsg !== undefined) { required = true; } break; default: } var end_validation = false; // If we were passed back an message object, check what the status was to determine what to do if (typeof errorMsg == "object") { switch (errorMsg.status) { case "_break": end_validation = true; break; // If we have an error message, set errorMsg to the error message case "_error": errorMsg = errorMsg.message; break; // If we want to throw an error, but not show a prompt, return early with true case "_error_no_prompt": return true; break; // Anything else we continue on default: break; } } // If it has been specified that validation should end now, break if (end_validation) { break; } // If we have a string, that means that we have an error, so add it to the error message. if (typeof errorMsg == 'string') { promptText += errorMsg + "
"; options.isError = true; field_errors++; } } // If the rules required is not added, an empty field is not validated if(!required && !(field.val()) && field.val().length < 1) options.isError = false; // Hack for radio/checkbox group button, the validation go into the // first radio/checkbox of the group var fieldType = field.prop("type"); var positionType=field.data("promptPosition") || options.promptPosition; if ((fieldType == "radio" || fieldType == "checkbox") && form.find("input[name='" + fieldName + "']").size() > 1) { if(positionType === 'inline') { field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:last")); } else { field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:first")); } options.showArrow = false; } if(field.is(":hidden") && options.prettySelect) { field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); } if (options.isError && options.showPrompts){ methods._showPrompt(field, promptText, promptType, false, options); }else{ if (!isAjaxValidator) methods._closePrompt(field); } if (!isAjaxValidator) { field.trigger("jqv.field.result", [field, options.isError, promptText]); } /* Record error */ var errindex = $.inArray(field[0], options.InvalidFields); if (errindex == -1) { if (options.isError) options.InvalidFields.push(field[0]); } else if (!options.isError) { options.InvalidFields.splice(errindex, 1); } methods._handleStatusCssClasses(field, options); /* run callback function for each field */ if (options.isError && options.onFieldFailure) options.onFieldFailure(field); if (!options.isError && options.onFieldSuccess) options.onFieldSuccess(field); return options.isError; }, /** * Handling css classes of fields indicating result of validation * * @param {jqObject} * field * @param {Array[String]} * field's validation rules * @private */ _handleStatusCssClasses: function(field, options) { /* remove all classes */ if(options.addSuccessCssClassToField) field.removeClass(options.addSuccessCssClassToField); if(options.addFailureCssClassToField) field.removeClass(options.addFailureCssClassToField); /* Add classes */ if (options.addSuccessCssClassToField && !options.isError) field.addClass(options.addSuccessCssClassToField); if (options.addFailureCssClassToField && options.isError) field.addClass(options.addFailureCssClassToField); }, /******************** * _getErrorMessage * * @param form * @param field * @param rule * @param rules * @param i * @param options * @param originalValidationMethod * @return {*} * @private */ _getErrorMessage:function (form, field, rule, rules, i, options, originalValidationMethod) { // If we are using the custon validation type, build the index for the rule. // Otherwise if we are doing a function call, make the call and return the object // that is passed back. var rule_index = jQuery.inArray(rule, rules); if (rule === "custom" || rule === "funcCall") { var custom_validation_type = rules[rule_index + 1]; rule = rule + "[" + custom_validation_type + "]"; // Delete the rule from the rules array so that it doesn't try to call the // same rule over again delete(rules[rule_index]); } // Change the rule to the composite rule, if it was different from the original var alteredRule = rule; var element_classes = (field.attr("data-validation-engine")) ? field.attr("data-validation-engine") : field.attr("class"); var element_classes_array = element_classes.split(" "); // Call the original validation method. If we are dealing with dates or checkboxes, also pass the form var errorMsg; if (rule == "future" || rule == "past" || rule == "maxCheckbox" || rule == "minCheckbox") { errorMsg = originalValidationMethod(form, field, rules, i, options); } else { errorMsg = originalValidationMethod(field, rules, i, options); } // If the original validation method returned an error and we have a custom error message, // return the custom message instead. Otherwise return the original error message. if (errorMsg != undefined) { var custom_message = methods._getCustomErrorMessage($(field), element_classes_array, alteredRule, options); if (custom_message) errorMsg = custom_message; } return errorMsg; }, _getCustomErrorMessage:function (field, classes, rule, options) { var custom_message = false; var validityProp = /^custom\[.*\]$/.test(rule) ? methods._validityProp["custom"] : methods._validityProp[rule]; // If there is a validityProp for this rule, check to see if the field has an attribute for it if (validityProp != undefined) { custom_message = field.attr("data-errormessage-"+validityProp); // If there was an error message for it, return the message if (custom_message != undefined) return custom_message; } custom_message = field.attr("data-errormessage"); // If there is an inline custom error message, return it if (custom_message != undefined) return custom_message; var id = '#' + field.attr("id"); // If we have custom messages for the element's id, get the message for the rule from the id. // Otherwise, if we have custom messages for the element's classes, use the first class message we find instead. if (typeof options.custom_error_messages[id] != "undefined" && typeof options.custom_error_messages[id][rule] != "undefined" ) { custom_message = options.custom_error_messages[id][rule]['message']; } else if (classes.length > 0) { for (var i = 0; i < classes.length && classes.length > 0; i++) { var element_class = "." + classes[i]; if (typeof options.custom_error_messages[element_class] != "undefined" && typeof options.custom_error_messages[element_class][rule] != "undefined") { custom_message = options.custom_error_messages[element_class][rule]['message']; break; } } } if (!custom_message && typeof options.custom_error_messages[rule] != "undefined" && typeof options.custom_error_messages[rule]['message'] != "undefined"){ custom_message = options.custom_error_messages[rule]['message']; } return custom_message; }, _validityProp: { "required": "value-missing", "custom": "custom-error", "groupRequired": "value-missing", "ajax": "custom-error", "minSize": "range-underflow", "maxSize": "range-overflow", "min": "range-underflow", "max": "range-overflow", "past": "type-mismatch", "future": "type-mismatch", "dateRange": "type-mismatch", "dateTimeRange": "type-mismatch", "maxCheckbox": "range-overflow", "minCheckbox": "range-underflow", "equals": "pattern-mismatch", "funcCall": "custom-error", "creditCard": "pattern-mismatch", "condRequired": "value-missing" }, /** * Required validation * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @param {bool} condRequired flag when method is used for internal purpose in condRequired check * @return an error string if validation failed */ _required: function(field, rules, i, options, condRequired) { switch (field.prop("type")) { case "text": case "password": case "textarea": case "file": case "select-one": case "select-multiple": default: var field_val = $.trim( field.val() ); var dv_placeholder = $.trim( field.attr("data-validation-placeholder") ); var placeholder = $.trim( field.attr("placeholder") ); if ( ( !field_val ) || ( dv_placeholder && field_val == dv_placeholder ) || ( placeholder && field_val == placeholder ) ) { return options.allrules[rules[i]].alertText; } break; case "radio": case "checkbox": // new validation style to only check dependent field if (condRequired) { if (!field.attr('checked')) { return options.allrules[rules[i]].alertTextCheckboxMultiple; } break; } // old validation style var form = field.closest("form, .validationEngineContainer"); var name = field.attr("name"); if (form.find("input[name='" + name + "']:checked").size() == 0) { if (form.find("input[name='" + name + "']:visible").size() == 1) return options.allrules[rules[i]].alertTextCheckboxe; else return options.allrules[rules[i]].alertTextCheckboxMultiple; } break; } }, /** * Validate that 1 from the group field is required * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _groupRequired: function(field, rules, i, options) { var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; var isValid = false; // Check all fields from the group field.closest("form, .validationEngineContainer").find(classGroup).each(function(){ if(!methods._required($(this), rules, i, options)){ isValid = true; return false; } }); if(!isValid) { return options.allrules[rules[i]].alertText; } }, /** * Validate rules * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _custom: function(field, rules, i, options) { var customRule = rules[i + 1]; var rule = options.allrules[customRule]; var fn; if(!rule) { alert("jqv:custom rule not found - "+customRule); return; } if(rule["regex"]) { var ex=rule.regex; if(!ex) { alert("jqv:custom regex not found - "+customRule); return; } var pattern = new RegExp(ex); if (!pattern.test(field.val())) return options.allrules[customRule].alertText; } else if(rule["func"]) { fn = rule["func"]; if (typeof(fn) !== "function") { alert("jqv:custom parameter 'function' is no function - "+customRule); return; } if (!fn(field, rules, i, options)) return options.allrules[customRule].alertText; } else { alert("jqv:custom type not allowed "+customRule); return; } }, /** * Validate custom function outside of the engine scope * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _funcCall: function(field, rules, i, options) { var functionName = rules[i + 1]; var fn; if(functionName.indexOf('.') >-1) { var namespaces = functionName.split('.'); var scope = window; while(namespaces.length) { scope = scope[namespaces.shift()]; } fn = scope; } else fn = window[functionName] || options.customFunctions[functionName]; if (typeof(fn) == 'function') return fn(field, rules, i, options); }, /** * Field match * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _equals: function(field, rules, i, options) { var equalsField = rules[i + 1]; if (field.val() != $("#" + equalsField).val()) return options.allrules.equals.alertText; }, /** * Check the maximum size (in characters) * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _maxSize: function(field, rules, i, options) { var max = rules[i + 1]; var len = field.val().length; if (len > max) { var rule = options.allrules.maxSize; return rule.alertText + max + rule.alertText2; } }, /** * Check the minimum size (in characters) * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _minSize: function(field, rules, i, options) { var min = rules[i + 1]; var len = field.val().length; if (len < min) { var rule = options.allrules.minSize; return rule.alertText + min + rule.alertText2; } }, /** * Check number minimum value * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _min: function(field, rules, i, options) { var min = parseFloat(rules[i + 1]); var len = parseFloat(field.val()); if (len < min) { var rule = options.allrules.min; if (rule.alertText2) return rule.alertText + min + rule.alertText2; return rule.alertText + min; } }, /** * Check number maximum value * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _max: function(field, rules, i, options) { var max = parseFloat(rules[i + 1]); var len = parseFloat(field.val()); if (len >max ) { var rule = options.allrules.max; if (rule.alertText2) return rule.alertText + max + rule.alertText2; //orefalo: to review, also do the translations return rule.alertText + max; } }, /** * Checks date is in the past * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _past: function(form, field, rules, i, options) { var p=rules[i + 1]; var fieldAlt = $(form.find("input[name='" + p.replace(/^#+/, '') + "']")); var pdate; if (p.toLowerCase() == "now") { pdate = new Date(); } else if (undefined != fieldAlt.val()) { if (fieldAlt.is(":disabled")) return; pdate = methods._parseDate(fieldAlt.val()); } else { pdate = methods._parseDate(p); } var vdate = methods._parseDate(field.val()); if (vdate > pdate ) { var rule = options.allrules.past; if (rule.alertText2) return rule.alertText + methods._dateToString(pdate) + rule.alertText2; return rule.alertText + methods._dateToString(pdate); } }, /** * Checks date is in the future * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _future: function(form, field, rules, i, options) { var p=rules[i + 1]; var fieldAlt = $(form.find("input[name='" + p.replace(/^#+/, '') + "']")); var pdate; if (p.toLowerCase() == "now") { pdate = new Date(); } else if (undefined != fieldAlt.val()) { if (fieldAlt.is(":disabled")) return; pdate = methods._parseDate(fieldAlt.val()); } else { pdate = methods._parseDate(p); } var vdate = methods._parseDate(field.val()); if (vdate < pdate ) { var rule = options.allrules.future; if (rule.alertText2) return rule.alertText + methods._dateToString(pdate) + rule.alertText2; return rule.alertText + methods._dateToString(pdate); } }, /** * Checks if valid date * * @param {string} date string * @return a bool based on determination of valid date */ _isDate: function (value) { var dateRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/); return dateRegEx.test(value); }, /** * Checks if valid date time * * @param {string} date string * @return a bool based on determination of valid date time */ _isDateTime: function (value){ var dateTimeRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/); return dateTimeRegEx.test(value); }, //Checks if the start date is before the end date //returns true if end is later than start _dateCompare: function (start, end) { return (new Date(start.toString()) < new Date(end.toString())); }, /** * Checks date range * * @param {jqObject} first field name * @param {jqObject} second field name * @return an error string if validation failed */ _dateRange: function (field, rules, i, options) { //are not both populated if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } //are not both dates if (!methods._isDate(options.firstOfGroup[0].value) || !methods._isDate(options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } //are both dates but range is off if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } }, /** * Checks date time range * * @param {jqObject} first field name * @param {jqObject} second field name * @return an error string if validation failed */ _dateTimeRange: function (field, rules, i, options) { //are not both populated if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } //are not both dates if (!methods._isDateTime(options.firstOfGroup[0].value) || !methods._isDateTime(options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } //are both dates but range is off if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; } }, /** * Max number of checkbox selected * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _maxCheckbox: function(form, field, rules, i, options) { var nbCheck = rules[i + 1]; var groupname = field.attr("name"); var groupSize = form.find("input[name='" + groupname + "']:checked").size(); if (groupSize > nbCheck) { options.showArrow = false; if (options.allrules.maxCheckbox.alertText2) return options.allrules.maxCheckbox.alertText + " " + nbCheck + " " + options.allrules.maxCheckbox.alertText2; return options.allrules.maxCheckbox.alertText; } }, /** * Min number of checkbox selected * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _minCheckbox: function(form, field, rules, i, options) { var nbCheck = rules[i + 1]; var groupname = field.attr("name"); var groupSize = form.find("input[name='" + groupname + "']:checked").size(); if (groupSize < nbCheck) { options.showArrow = false; return options.allrules.minCheckbox.alertText + " " + nbCheck + " " + options.allrules.minCheckbox.alertText2; } }, /** * Checks that it is a valid credit card number according to the * Luhn checksum algorithm. * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _creditCard: function(field, rules, i, options) { //spaces and dashes may be valid characters, but must be stripped to calculate the checksum. var valid = false, cardNumber = field.val().replace(/ +/g, '').replace(/-+/g, ''); var numDigits = cardNumber.length; if (numDigits >= 14 && numDigits <= 16 && parseInt(cardNumber) > 0) { var sum = 0, i = numDigits - 1, pos = 1, digit, luhn = new String(); do { digit = parseInt(cardNumber.charAt(i)); luhn += (pos++ % 2 == 0) ? digit * 2 : digit; } while (--i >= 0) for (i = 0; i < luhn.length; i++) { sum += parseInt(luhn.charAt(i)); } valid = sum % 10 == 0; } if (!valid) return options.allrules.creditCard.alertText; }, /** * Ajax field validation * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return nothing! the ajax validator handles the prompts itself */ _ajax: function(field, rules, i, options) { var errorSelector = rules[i + 1]; var rule = options.allrules[errorSelector]; var extraData = rule.extraData; var extraDataDynamic = rule.extraDataDynamic; var data = { "fieldId" : field.attr("id"), "fieldValue" : field.val() }; if (typeof extraData === "object") { $.extend(data, extraData); } else if (typeof extraData === "string") { var tempData = extraData.split("&"); for(var i = 0; i < tempData.length; i++) { var values = tempData[i].split("="); if (values[0] && values[0]) { data[values[0]] = values[1]; } } } if (extraDataDynamic) { var tmpData = []; var domIds = String(extraDataDynamic).split(","); for (var i = 0; i < domIds.length; i++) { var id = domIds[i]; if ($(id).length) { var inputValue = field.closest("form, .validationEngineContainer").find(id).val(); var keyValue = id.replace('#', '') + '=' + escape(inputValue); data[id.replace('#', '')] = inputValue; } } } // If a field change event triggered this we want to clear the cache for this ID if (options.eventTrigger == "field") { delete(options.ajaxValidCache[field.attr("id")]); } // If there is an error or if the the field is already validated, do not re-execute AJAX if (!options.isError && !methods._checkAjaxFieldStatus(field.attr("id"), options)) { $.ajax({ type: options.ajaxFormValidationMethod, url: rule.url, cache: false, dataType: "json", data: data, field: field, rule: rule, methods: methods, options: options, beforeSend: function() {}, error: function(data, transport) { methods._ajaxError(data, transport); }, success: function(json) { // asynchronously called on success, data is the json answer from the server var errorFieldId = json[0]; //var errorField = $($("#" + errorFieldId)[0]); var errorField = $("#"+ errorFieldId).eq(0); // make sure we found the element if (errorField.length == 1) { var status = json[1]; // read the optional msg from the server var msg = json[2]; if (!status) { // Houston we got a problem - display an red prompt options.ajaxValidCache[errorFieldId] = false; options.isError = true; // resolve the msg prompt if(msg) { if (options.allrules[msg]) { var txt = options.allrules[msg].alertText; if (txt) { msg = txt; } } } else msg = rule.alertText; if (options.showPrompts) methods._showPrompt(errorField, msg, "", true, options); } else { options.ajaxValidCache[errorFieldId] = true; // resolves the msg prompt if(msg) { if (options.allrules[msg]) { var txt = options.allrules[msg].alertTextOk; if (txt) { msg = txt; } } } else msg = rule.alertTextOk; if (options.showPrompts) { // see if we should display a green prompt if (msg) methods._showPrompt(errorField, msg, "pass", true, options); else methods._closePrompt(errorField); } // If a submit form triggered this, we want to re-submit the form if (options.eventTrigger == "submit") field.closest("form").submit(); } } errorField.trigger("jqv.field.result", [errorField, options.isError, msg]); } }); return rule.alertTextLoad; } }, /** * Common method to handle ajax errors * * @param {Object} data * @param {Object} transport */ _ajaxError: function(data, transport) { if(data.status == 0 && transport == null) alert("The page is not served from a server! ajax call failed"); else if(typeof console != "undefined") console.log("Ajax error: " + data.status + " " + transport); }, /** * date -> string * * @param {Object} date */ _dateToString: function(date) { return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate(); }, /** * Parses an ISO date * @param {String} d */ _parseDate: function(d) { var dateParts = d.split("-"); if(dateParts==d) dateParts = d.split("/"); if(dateParts==d) { dateParts = d.split("."); return new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]); } return new Date(dateParts[0], (dateParts[1] - 1) ,dateParts[2]); }, /** * Builds or updates a prompt with the given information * * @param {jqObject} field * @param {String} promptText html text to display type * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) * @param {boolean} ajaxed - use to mark fields than being validated with ajax * @param {Map} options user options */ _showPrompt: function(field, promptText, type, ajaxed, options, ajaxform) { var prompt = methods._getPrompt(field); // The ajax submit errors are not see has an error in the form, // When the form errors are returned, the engine see 2 bubbles, but those are ebing closed by the engine at the same time // Because no error was found befor submitting if(ajaxform) prompt = false; // Check that there is indded text if($.trim(promptText)){ if (prompt) methods._updatePrompt(field, prompt, promptText, type, ajaxed, options); else methods._buildPrompt(field, promptText, type, ajaxed, options); } }, /** * Builds and shades a prompt for the given field. * * @param {jqObject} field * @param {String} promptText html text to display type * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) * @param {boolean} ajaxed - use to mark fields than being validated with ajax * @param {Map} options user options */ _buildPrompt: function(field, promptText, type, ajaxed, options) { // create the prompt var prompt = $('
'); prompt.addClass(methods._getClassName(field.attr("id")) + "formError"); // add a class name to identify the parent form of the prompt prompt.addClass("parentForm"+methods._getClassName(field.closest('form, .validationEngineContainer').attr("id"))); prompt.addClass("formError"); switch (type) { case "pass": prompt.addClass("greenPopup"); break; case "load": prompt.addClass("blackPopup"); break; default: /* it has error */ //alert("unknown popup type:"+type); } if (ajaxed) prompt.addClass("ajaxed"); // create the prompt content var promptContent = $('
').addClass("formErrorContent").html(promptText).appendTo(prompt); // determine position type var positionType=field.data("promptPosition") || options.promptPosition; // create the css arrow pointing at the field // note that there is no triangle on max-checkbox and radio if (options.showArrow) { var arrow = $('
').addClass("formErrorArrow"); //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) if (typeof(positionType)=='string') { var pos=positionType.indexOf(":"); if(pos!=-1) positionType=positionType.substring(0,pos); } switch (positionType) { case "bottomLeft": case "bottomRight": prompt.find(".formErrorContent").before(arrow); arrow.addClass("formErrorArrowBottom").html('
'); break; case "topLeft": case "topRight": arrow.html('
'); prompt.append(arrow); break; } } // Add custom prompt class if (options.addPromptClass) prompt.addClass(options.addPromptClass); // Add custom prompt class defined in element var requiredOverride = field.attr('data-required-class'); if(requiredOverride !== undefined) { prompt.addClass(requiredOverride); } else { if(options.prettySelect) { if($('#' + field.attr('id')).next().is('select')) { var prettyOverrideClass = $('#' + field.attr('id').substr(options.usePrefix.length).substring(options.useSuffix.length)).attr('data-required-class'); if(prettyOverrideClass !== undefined) { prompt.addClass(prettyOverrideClass); } } } } prompt.css({ "opacity": 0 }); if(positionType === 'inline') { prompt.addClass("inline"); if(typeof field.attr('data-prompt-target') !== 'undefined' && $('#'+field.attr('data-prompt-target')).length > 0) { prompt.appendTo($('#'+field.attr('data-prompt-target'))); } else { field.after(prompt); } } else { field.before(prompt); } var pos = methods._calculatePosition(field, prompt, options); prompt.css({ 'position': positionType === 'inline' ? 'relative' : 'absolute', "top": pos.callerTopPosition, "left": pos.callerleftPosition, "marginTop": pos.marginTopSize, "opacity": 0 }).data("callerField", field); if (options.autoHidePrompt) { setTimeout(function(){ prompt.animate({ "opacity": 0 },function(){ prompt.closest('.formErrorOuter').remove(); prompt.remove(); }); }, options.autoHideDelay); } return prompt.animate({ "opacity": 0.87 }); }, /** * Updates the prompt text field - the field for which the prompt * @param {jqObject} field * @param {String} promptText html text to display type * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) * @param {boolean} ajaxed - use to mark fields than being validated with ajax * @param {Map} options user options */ _updatePrompt: function(field, prompt, promptText, type, ajaxed, options, noAnimation) { if (prompt) { if (typeof type !== "undefined") { if (type == "pass") prompt.addClass("greenPopup"); else prompt.removeClass("greenPopup"); if (type == "load") prompt.addClass("blackPopup"); else prompt.removeClass("blackPopup"); } if (ajaxed) prompt.addClass("ajaxed"); else prompt.removeClass("ajaxed"); prompt.find(".formErrorContent").html(promptText); var pos = methods._calculatePosition(field, prompt, options); var css = {"top": pos.callerTopPosition, "left": pos.callerleftPosition, "marginTop": pos.marginTopSize}; if (noAnimation) prompt.css(css); else prompt.animate(css); } }, /** * Closes the prompt associated with the given field * * @param {jqObject} * field */ _closePrompt: function(field) { var prompt = methods._getPrompt(field); if (prompt) prompt.fadeTo("fast", 0, function() { prompt.parent('.formErrorOuter').remove(); prompt.remove(); }); }, closePrompt: function(field) { return methods._closePrompt(field); }, /** * Returns the error prompt matching the field if any * * @param {jqObject} * field * @return undefined or the error prompt (jqObject) */ _getPrompt: function(field) { var formId = $(field).closest('form, .validationEngineContainer').attr('id'); var className = methods._getClassName(field.attr("id")) + "formError"; var match = $("." + methods._escapeExpression(className) + '.parentForm' + formId)[0]; if (match) return $(match); }, /** * Returns the escapade classname * * @param {selector} * className */ _escapeExpression: function (selector) { return selector.replace(/([#;&,\.\+\*\~':"\!\^$\[\]\(\)=>\|])/g, "\\$1"); }, /** * returns true if we are in a RTLed document * * @param {jqObject} field */ isRTL: function(field) { var $document = $(document); var $body = $('body'); var rtl = (field && field.hasClass('rtl')) || (field && (field.attr('dir') || '').toLowerCase()==='rtl') || $document.hasClass('rtl') || ($document.attr('dir') || '').toLowerCase()==='rtl' || $body.hasClass('rtl') || ($body.attr('dir') || '').toLowerCase()==='rtl'; return Boolean(rtl); }, /** * Calculates prompt position * * @param {jqObject} * field * @param {jqObject} * the prompt * @param {Map} * options * @return positions */ _calculatePosition: function (field, promptElmt, options) { var promptTopPosition, promptleftPosition, marginTopSize; var fieldWidth = field.width(); var fieldLeft = field.position().left; var fieldTop = field.position().top; var fieldHeight = field.height(); var promptHeight = promptElmt.height(); // is the form contained in an overflown container? promptTopPosition = promptleftPosition = 0; // compensation for the arrow marginTopSize = -promptHeight; //prompt positioning adjustment support //now you can adjust prompt position //usage: positionType:Xshift,Yshift //for example: // bottomLeft:+20 means bottomLeft position shifted by 20 pixels right horizontally // topRight:20, -15 means topRight position shifted by 20 pixels to right and 15 pixels to top //You can use +pixels, - pixels. If no sign is provided than + is default. var positionType=field.data("promptPosition") || options.promptPosition; var shift1=""; var shift2=""; var shiftX=0; var shiftY=0; if (typeof(positionType)=='string') { //do we have any position adjustments ? if (positionType.indexOf(":")!=-1) { shift1=positionType.substring(positionType.indexOf(":")+1); positionType=positionType.substring(0,positionType.indexOf(":")); //if any advanced positioning will be needed (percents or something else) - parser should be added here //for now we use simple parseInt() //do we have second parameter? if (shift1.indexOf(",") !=-1) { shift2=shift1.substring(shift1.indexOf(",") +1); shift1=shift1.substring(0,shift1.indexOf(",")); shiftY=parseInt(shift2); if (isNaN(shiftY)) shiftY=0; }; shiftX=parseInt(shift1); if (isNaN(shift1)) shift1=0; }; }; switch (positionType) { default: case "topRight": promptleftPosition += fieldLeft + fieldWidth - 30; promptTopPosition += fieldTop; break; case "topLeft": promptTopPosition += fieldTop; promptleftPosition += fieldLeft; break; case "centerRight": promptTopPosition = fieldTop+4; marginTopSize = 0; promptleftPosition= fieldLeft + field.outerWidth(true)+5; break; case "centerLeft": promptleftPosition = fieldLeft - (promptElmt.width() + 2); promptTopPosition = fieldTop+4; marginTopSize = 0; break; case "bottomLeft": promptTopPosition = fieldTop + field.height() + 5; marginTopSize = 0; promptleftPosition = fieldLeft; break; case "bottomRight": promptleftPosition = fieldLeft + fieldWidth - 30; promptTopPosition = fieldTop + field.height() + 5; marginTopSize = 0; break; case "inline": promptleftPosition = 0; promptTopPosition = 0; marginTopSize = 0; }; //apply adjusments if any promptleftPosition += shiftX; promptTopPosition += shiftY; return { "callerTopPosition": promptTopPosition + "px", "callerleftPosition": promptleftPosition + "px", "marginTopSize": marginTopSize + "px" }; }, /** * Saves the user options and variables in the form.data * * @param {jqObject} * form - the form where the user option should be saved * @param {Map} * options - the user options * @return the user options (extended from the defaults) */ _saveOptions: function(form, options) { // is there a language localisation ? if ($.validationEngineLanguage) var allRules = $.validationEngineLanguage.allRules; else $.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page"); // --- Internals DO NOT TOUCH or OVERLOAD --- // validation rules and i18 $.validationEngine.defaults.allrules = allRules; var userOptions = $.extend(true,{},$.validationEngine.defaults,options); form.data('jqv', userOptions); return userOptions; }, /** * Removes forbidden characters from class name * @param {String} className */ _getClassName: function(className) { if(className) return className.replace(/:/g, "_").replace(/\./g, "_"); }, /** * Escape special character for jQuery selector * http://totaldev.com/content/escaping-characters-get-valid-jquery-id * @param {String} selector */ _jqSelector: function(str){ return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); }, /** * Conditionally required field * * @param {jqObject} field * @param {Array[String]} rules * @param {int} i rules index * @param {Map} * user options * @return an error string if validation failed */ _condRequired: function(field, rules, i, options) { var idx, dependingField; for(idx = (i + 1); idx < rules.length; idx++) { dependingField = jQuery("#" + rules[idx]).first(); /* Use _required for determining wether dependingField has a value. * There is logic there for handling all field types, and default value; so we won't replicate that here * Indicate this special use by setting the last parameter to true so we only validate the dependingField on chackboxes and radio buttons (#462) */ if (dependingField.length && methods._required(dependingField, ["required"], 0, options, true) == undefined) { /* We now know any of the depending fields has a value, * so we can validate this field as per normal required code */ return methods._required(field, ["required"], 0, options); } } }, _submitButtonClick: function(event) { var button = $(this); var form = button.closest('form, .validationEngineContainer'); form.data("jqv_submitButton", button.attr("id")); } }; /** * Plugin entry point. * You may pass an action as a parameter or a list of options. * if none, the init and attach methods are being called. * Remember: if you pass options, the attached method is NOT called automatically * * @param {String} * method (optional) action */ $.fn.validationEngine = function(method) { var form = $(this); if(!form[0]) return form; // stop here if the form does not exist if (typeof(method) == 'string' && method.charAt(0) != '_' && methods[method]) { // make sure init is called once if(method != "showPrompt" && method != "hide" && method != "hideAll") methods.init.apply(form); return methods[method].apply(form, Array.prototype.slice.call(arguments, 1)); } else if (typeof method == 'object' || !method) { // default constructor with or without arguments methods.init.apply(form, arguments); return methods.attach.apply(form); } else { $.error('Method ' + method + ' does not exist in jQuery.validationEngine'); } }; // LEAK GLOBAL OPTIONS $.validationEngine= {fieldIdCounter: 0,defaults:{ // Name of the event triggering field validation validationEventTrigger: "blur", // Automatically scroll viewport to the first error scroll: true, // Focus on the first input focusFirstField:true, // Show prompts, set to false to disable prompts showPrompts: true, // Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs) validateNonVisibleFields: false, // Opening box position, possible locations are: topLeft, // topRight, bottomLeft, centerRight, bottomRight, inline // inline gets inserted after the validated field or into an element specified in data-prompt-target promptPosition: "topRight", bindMethod:"bind", // internal, automatically set to true when it parse a _ajax rule inlineAjax: false, // if set to true, the form data is sent asynchronously via ajax to the form.action url (get) ajaxFormValidation: false, // The url to send the submit ajax validation (default to action) ajaxFormValidationURL: false, // HTTP method used for ajax validation ajaxFormValidationMethod: 'get', // Ajax form validation callback method: boolean onComplete(form, status, errors, options) // retuns false if the form.submit event needs to be canceled. onAjaxFormComplete: $.noop, // called right before the ajax call, may return false to cancel onBeforeAjaxFormValidation: $.noop, // Stops form from submitting and execute function assiciated with it onValidationComplete: false, // Used when you have a form fields too close and the errors messages are on top of other disturbing viewing messages doNotShowAllErrosOnSubmit: false, // Object where you store custom messages to override the default error messages custom_error_messages:{}, // true if you want to vind the input fields binded: true, // set to true, when the prompt arrow needs to be displayed showArrow: true, // did one of the validation fail ? kept global to stop further ajax validations isError: false, // Limit how many displayed errors a field can have maxErrorsPerField: false, // Caches field validation status, typically only bad status are created. // the array is used during ajax form validation to detect issues early and prevent an expensive submit ajaxValidCache: {}, // Auto update prompt position after window resize autoPositionUpdate: false, InvalidFields: [], onFieldSuccess: false, onFieldFailure: false, onSuccess: false, onFailure: false, validateAttribute: "class", addSuccessCssClassToField: "", addFailureCssClassToField: "", // Auto-hide prompt autoHidePrompt: false, // Delay before auto-hide autoHideDelay: 10000, // Fade out duration while hiding the validations fadeDuration: 0.3, // Use Prettify select library prettySelect: false, // Add css class on prompt addPromptClass : "", // Custom ID uses prefix usePrefix: "", // Custom ID uses suffix useSuffix: "", // Only show one message per error prompt showOneMessage: false }}; $(function(){$.validationEngine.defaults.promptPosition = methods.isRTL()?'topLeft':"topRight"}); })(jQuery); (function($){ $.fn.validationEngineLanguage = function(){ }; $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* Необходимо заполнить", "alertTextCheckboxMultiple": "* Вы должны выбрать вариант", "alertTextCheckboxe": "* Необходимо отметить" }, "requiredInFunction": { "func": function(field, rules, i, options){ return (field.val() == "test") ? true : false; }, "alertText": "* Field must equal test" }, "minSize": { "regex": "none", "alertText": "* Минимум ", "alertText2": " символа(ов)" }, "maxSize": { "regex": "none", "alertText": "* Максимум ", "alertText2": " символа(ов)" }, "groupRequired": { "regex": "none", "alertText": "* You must fill one of the following fields" }, "min": { "regex": "none", "alertText": "* Минимальное значение " }, "max": { "regex": "none", "alertText": "* Максимальное значение " }, "past": { "regex": "none", "alertText": "* Дата до " }, "future": { "regex": "none", "alertText": "* Дата от " }, "maxCheckbox": { "regex": "none", "alertText": "* Нельзя выбрать столько вариантов" }, "minCheckbox": { "regex": "none", "alertText": "* Пожалуйста, выберите ", "alertText2": " опцию(ии)" }, "equals": { "regex": "none", "alertText": "* Поля не совпадают" }, "creditCard": { "regex": "none", "alertText": "* Неверный номер кредитной карты" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alertText": "* Неправильный формат телефона" }, "email": { // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "alertText": "* Неверный формат email" }, "integer": { "regex": /^[\-\+]?\d+$/, "alertText": "* Не целое число" }, "number": { // Number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, "alertText": "* Неправильное число с плавающей точкой" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, "alertText": "* Неправильная дата (должно быть в ДД.MM.ГГГГ формате)" }, "ipv4": { "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, "alertText": "* Неправильный IP-адрес" }, "url": { "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, "alertText": "* Неправильный URL" }, "onlyNumberSp": { "regex": /^[0-9\ ]+$/, "alertText": "* Только числа" }, "onlyLetterSp": { "regex": /^[a-zA-Z\u0400-\u04FF\ \']+$/, "alertText": "* Только буквы" }, "onlyLetterNumber": { "regex": /^[0-9a-zA-Z\u0400-\u04FF]+$/, "alertText": "* Запрещены специальные символы" }, // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings "ajaxUserCall": { "url": "ajaxValidateFieldUser", // you may want to pass extra data on the ajax call "extraData": "name=eric", "alertText": "* Этот пользователь уже занят", "alertTextLoad": "* Проверка, подождите..." }, "ajaxNameCall": { // remote json service location "url": "ajaxValidateFieldName", // error "alertText": "* Это имя уже занято", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* Это имя доступно", // speaks by itself "alertTextLoad": "* Проверка, подождите..." }, "validate2fields": { "alertText": "* Пожалуйста, введите HELLO" } }; } }; $.validationEngineLanguage.newLang(); })(jQuery); /*PULSE EFFECT*/ /*http://www.riaxe.com/demo/jspulse/*/ (function( $ ) { $.fn.pulse = function( beforeproperties, afterproperties, duration, repeat) { if (duration === undefined || duration < 0) duration = 500; return this.each(function() { var $this = jQuery(this); var beforeAnimComplete = true; var afterAnimComplete = false; var count = 0; var intervalID = 0; intervalID = setInterval( function startTimer() { if(!beforeAnimComplete) { $this.toggleClass(afterproperties); beforeAnimComplete = true; afterAnimComplete = false; } else { $this.toggleClass(afterproperties); beforeAnimComplete = false; afterAnimComplete = true; } count++; if (repeat != undefined && count >= repeat) { clearInterval(intervalID); count = 0; } }, duration ); $this.data("intervalID", intervalID); }); }; $.fn.stopPulse = function() { var $this = jQuery(this); var intervalID = $this.data("intervalID"); if(intervalID != undefined) clearInterval(intervalID); } })( jQuery ); /* http://jquerypulsate.kilianvalkhof.com/ */ /*(function( $ ){ var methods = { init: function(options) { var settings = { color: $(this).css("background-color"), reach: 20, speed: 1000, pause: 0, glow: true, repeat: true, onHover: false }; $(this).css({ "-moz-outline-radius": $(this).css("border-top-left-radius"), "-webkit-outline-radius": $(this).css("border-top-left-radius"), "outline-radius": $(this).css("border-top-left-radius") }); if (options) { $.extend(settings, options); } settings.color = $("
").css("background-color"); if(settings.repeat !== true && !isNaN(settings.repeat) && settings.repeat > 0) { settings.repeat -=1; } return this.each(function() { if(settings.onHover) { $(this).bind("mouseover", function () {pulse(settings, this, 0);}) .bind("mouseout", function (){$(this).pulsate("destroy");}); } else { pulse(settings, this, 0); } }); }, destroy: function() { return this.each(function() { clearTimeout(this.timer); $(this).css("outline",0); }); } }; var pulse = function(options, el, count) { var reach = options.reach, count = count>reach ? 0 : count, opacity = (reach-count)/reach, colorarr = options.color.split(","), color = "rgba(" + colorarr[0].split("(")[1] + "," + colorarr[1] + "," + colorarr[2].split(")")[0] + "," + opacity + ")", cssObj = { "outline": "2px solid " + color }; if(options.glow) { cssObj["box-shadow"] = "0px 0px " + parseInt((count/1.5)) + "px " + color; userAgent = navigator.userAgent || ''; if(/(chrome)[ \/]([\w.]+)/.test(userAgent.toLowerCase())) { cssObj["outline-offset"] = count + "px"; cssObj["outline-radius"] = "100 px"; } } else { cssObj["outline-offset"] = count + "px"; } $(el).css(cssObj); var innerfunc = function () { if(count>=reach && !options.repeat) { $(el).pulsate("destroy"); return false; } else if(count>=reach && options.repeat !== true && !isNaN(options.repeat) && options.repeat > 0) { options.repeat = options.repeat-1; } else if(options.pause && count>=reach) { pause(options, el, count+1); return false; } pulse(options, el, count+1); }; el.timer = setTimeout(innerfunc, options.speed/reach); }; var pause = function (options, el, count) { innerfunc = function () { pulse(options, el, count); }; setTimeout(innerfunc, options.pause); }; $.fn.pulsate = function( method ) { // Method calling logic if ( methods[method] ) { return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.pulsate' ); } }; })( jQuery );*/ /*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as anonymous module. define(['jquery'], factory); } else { // Browser globals. factory(jQuery); } }(function ($) { var pluses = /\+/g; function raw(s) { return s; } function decoded(s) { return decodeURIComponent(s.replace(pluses, ' ')); } function converted(s) { if (s.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { return config.json ? JSON.parse(s) : s; } catch(er) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ config.raw ? key : encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); var result = key ? undefined : {}; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = decode(parts.join('=')); if (key && key === name) { result = converted(cookie); break; } if (!key) { result[name] = converted(cookie); } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) !== undefined) { // Must not alter options, thus extending a fresh object... $.cookie(key, '', $.extend({}, options, { expires: -1 })); return true; } return false; }; })); function refreshCAPTCHAImage(image, targetID){ var rand=Math.random(); var newimage=image+rand; $("#"+targetID).html($("").attr("src", newimage)); } function getJsonObj(str) { try { //JSON.parse(str); var obj = $.parseJSON(str); } catch (e) { return false; } return obj; } /*$(document).on('keydown', function(evt) { if (evt.keyCode === $.ui.keyCode.ESCAPE) { $("#overlay").remove(); } });*/ (function($) { $.ModalOverlay = function() { var docHeight = $(document).height(); $("body").append("
"); $("#overlay") .height(docHeight) .css({ 'opacity' : 0.7, 'position': 'absolute', 'top': 0, 'left': 0, //'background-color': 'black', 'width': '100%', 'z-index': 100 }); /*$(document).keydown(function(evt) { if (evt.keyCode === $.ui.keyCode.ESCAPE) { $("#overlay").remove(); } });*/ }; $.ModalOverlayRemove = function(){ $("#overlay").fadeOut('slow'); $("#overlay").remove(); } $.SubmitTheForm = function(actionMode){ if(!actionMode){return false;} var formID = actionMode.replace('Submit_', ''); $("#"+formID).find(".submitButton:button").attr({type:'submit'}).click(); } $.ActivateTheForms = function(){ $('form input.submitButton:button').each(function(index, element){ $(this).attr({type:'submit'}); }) } $.ResetSystemMessageBox = function(){ $("#SystemMessage").hide(); $("#SystemMessage p").html(''); $("#SystemMessage").removeClass("SystemMessageSuccess SystemMessageError SystemMessageWarning"); } })(jQuery); /*function getPHPLang(langCode){ if(langCode.length<1){return false} var result = ''; $.ajax({ url: rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+langCode, }).done(function(response){ { return response; } }) }*/ $(function() { $(document).on("scroll", window, function(event) { var empty = parseInt($("#FooterBoxes").attr("data-loaded")); var termsEmpty = parseInt($("#AvizInfoFooterTerms").attr("data-loaded")); //console.log(empty); if(empty==0) { $("#FooterBoxes:in-viewport").load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.FooterBoxes'); $("#FooterBoxes:in-viewport").attr("data-loaded", "1"); } if(termsEmpty==0) { $("div#AvizInfoFooterTerms").load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.AvizInfoFooterTerms'); $("#AvizInfoFooterTerms").attr("data-loaded", "1"); } }); }); /* share42.com | 10.11.2013 | (c) Dimox */ window.onload=function(){e=document.getElementsByTagName('div');for(var k=0;k';e[k].innerHTML='
'+l+'
';var p=document.getElementById('share42');function m(){var top=Math.max(document.body.scrollTop,document.documentElement.scrollTop);if(top+(m2*1)'+settings.fixedCookieTypeLabel+"";preferences=JSON.parse(myCookiePrefs);$.each(settings.cookieTypes,function(index,field){if(field.type!==""&&field.value!==""){var cookieTypeDescription="";if(field.description!==false){cookieTypeDescription=' title="'+field.description+'"'}cookieTypes+='
  • "}});var cookieMessage='";setTimeout(function(){$($element).append(cookieMessage);$("#gdpr-cookie-message").hide().fadeIn("slow",function(){if(event=="reinit"){$("#gdpr-cookie-advanced").trigger("click");$.each(preferences,function(index,field){$("input#gdpr-cookietype-"+field).prop("checked",true)})}})},settings.delay);$("body").on("click","#gdpr-cookie-accept",function(){dropCookie(true,settings.expires,settings.domain);$('input[name="gdpr[]"][data-auto="on"]').prop("checked",true);var prefs=[];$.each($('input[name="gdpr[]"]').serializeArray(),function(i,field){prefs.push(field.value)});setCookie("cookieControlPrefs",encodeURIComponent(JSON.stringify(prefs)),365,settings.domain);settings.onAccept.call(this)});$("body").on("click","#gdpr-cookie-advanced",function(){$('input[name="gdpr[]"]:not(:disabled)').attr("data-auto","off").prop("checked",false);$("#gdpr-cookie-types").slideDown("fast",function(){$("#gdpr-cookie-advanced").prop("disabled",true)})})}else{var cookieVal=true;if(myCookie=="false"){cookieVal=false}dropCookie(cookieVal,settings.expires,settings.domain)}if(settings.uncheckBoxes===true){$('input[type="checkbox"].ihavecookies').prop("checked",false)}};$.fn.ihavecookies.cookie=function(){var preferences=getCookie("cookieControlPrefs");return JSON.parse(preferences)};$.fn.ihavecookies.preference=function(cookieTypeValue){var control=getCookie("cookieControl");var preferences=getCookie("cookieControlPrefs");preferences=JSON.parse(preferences);if(control===false){return false}if(preferences===false||preferences.indexOf(cookieTypeValue)===-1){return false}return true};var dropCookie=function(value,expiryDays,domain){setCookie("cookieControl",value,expiryDays,domain);$("#gdpr-cookie-message").fadeOut("fast",function(){$(this).remove()})};var setCookie=function(name,value,expiry_days,domain){var d=new Date;var d=new Date;d.setTime(d.getTime()+expiry_days*24*60*60*1e3);var expires="expires="+d.toUTCString();document.cookie=name+"="+value+";"+expires+";domain="+domain+";path=/";return getCookie(name)};var getCookie=function(name){var cookie_name=name+"=";var decodedCookie=decodeURIComponent(document.cookie);var ca=decodedCookie.split(";");for(var i=0;iparseFloat(/^\d\.\d+/i.exec(jQuery.fn.jquery))){var l=document.getElementsByTagName("head")[0],n=document.createElement("script");n.setAttribute("type","text/javascript");n.readyState?n.onreadystatechange=function(){if("loaded"==n.readyState||"complete"==n.readyState)n.onreadystatechange= null,loadHtml5Gallery(q)}:n.onload=function(){loadHtml5Gallery(q)};n.setAttribute("src",q+"jquery.js");l.appendChild(n)}else loadHtml5Gallery(q)})(); function loadHtml5Gallery(l){jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(d,c,a,e,b){return jQuery.easing[jQuery.easing.def](d,c,a,e,b)},easeInQuad:function(d,c,a,e,b){return e*(c/=b)*c+a},easeOutQuad:function(d,c,a,e,b){return-e*(c/=b)*(c-2)+a},easeInOutQuad:function(d,c,a,e,b){return 1>(c/=b/2)?e/2*c*c+a:-e/2*(--c*(c-2)-1)+a},easeInCubic:function(d,c,a,e,b){return e*(c/=b)*c*c+a},easeOutCubic:function(d,c,a,e,b){return e*((c=c/b-1)*c*c+1)+ a},easeInOutCubic:function(d,c,a,e,b){return 1>(c/=b/2)?e/2*c*c*c+a:e/2*((c-=2)*c*c+2)+a},easeInQuart:function(d,c,a,e,b){return e*(c/=b)*c*c*c+a},easeOutQuart:function(d,c,a,e,b){return-e*((c=c/b-1)*c*c*c-1)+a},easeInOutQuart:function(d,c,a,e,b){return 1>(c/=b/2)?e/2*c*c*c*c+a:-e/2*((c-=2)*c*c*c-2)+a},easeInQuint:function(d,c,a,e,b){return e*(c/=b)*c*c*c*c+a},easeOutQuint:function(d,c,a,e,b){return e*((c=c/b-1)*c*c*c*c+1)+a},easeInOutQuint:function(d,c,a,e,b){return 1>(c/=b/2)?e/2*c*c*c*c*c+a:e/ 2*((c-=2)*c*c*c*c+2)+a},easeInSine:function(d,c,a,e,b){return-e*Math.cos(c/b*(Math.PI/2))+e+a},easeOutSine:function(d,c,a,e,b){return e*Math.sin(c/b*(Math.PI/2))+a},easeInOutSine:function(d,c,a,e,b){return-e/2*(Math.cos(Math.PI*c/b)-1)+a},easeInExpo:function(d,c,a,e,b){return 0==c?a:e*Math.pow(2,10*(c/b-1))+a},easeOutExpo:function(d,c,a,e,b){return c==b?a+e:e*(-Math.pow(2,-10*c/b)+1)+a},easeInOutExpo:function(d,c,a,e,b){return 0==c?a:c==b?a+e:1>(c/=b/2)?e/2*Math.pow(2,10*(c-1))+a:e/2*(-Math.pow(2, -10*--c)+2)+a},easeInCirc:function(d,c,a,e,b){return-e*(Math.sqrt(1-(c/=b)*c)-1)+a},easeOutCirc:function(d,c,a,e,b){return e*Math.sqrt(1-(c=c/b-1)*c)+a},easeInOutCirc:function(d,c,a,e,b){return 1>(c/=b/2)?-e/2*(Math.sqrt(1-c*c)-1)+a:e/2*(Math.sqrt(1-(c-=2)*c)+1)+a},easeInElastic:function(d,c,a,e,b){d=1.70158;var k=0,h=e;if(0==c)return a;if(1==(c/=b))return a+e;k||(k=0.3*b);hc?-0.5*h*Math.pow(2,10*(c-=1))*Math.sin((c*b-d)*2*Math.PI/k)+a:0.5*h*Math.pow(2,-10*(c-=1))*Math.sin((c*b-d)*2*Math.PI/ k)+e+a},easeInBack:function(d,c,a,e,b,k){void 0==k&&(k=1.70158);return e*(c/=b)*c*((k+1)*c-k)+a},easeOutBack:function(d,c,a,e,b,k){void 0==k&&(k=1.70158);return e*((c=c/b-1)*c*((k+1)*c+k)+1)+a},easeInOutBack:function(d,c,a,e,b,k){void 0==k&&(k=1.70158);return 1>(c/=b/2)?e/2*c*c*(((k*=1.525)+1)*c-k)+a:e/2*((c-=2)*c*(((k*=1.525)+1)*c+k)+2)+a},easeInBounce:function(d,c,a,e,b){return e-jQuery.easing.easeOutBounce(d,b-c,0,e,b)+a},easeOutBounce:function(d,c,a,e,b){return(c/=b)<1/2.75?e*7.5625*c*c+a:c<2/ 2.75?e*(7.5625*(c-=1.5/2.75)*c+0.75)+a:c<2.5/2.75?e*(7.5625*(c-=2.25/2.75)*c+0.9375)+a:e*(7.5625*(c-=2.625/2.75)*c+0.984375)+a},easeInOutBounce:function(d,c,a,e,b){return ch?c.swipeRight&&c.swipeRight.call():c.swipeLeft&&c.swipeLeft.call());d(a)}function d(){curY=f=h=-1}var h=-1,f=-1;try{q(this).bind("touchstart",a),q(this).bind("touchmove",e),q(this).bind("touchend",b),q(this).bind("touchcancel",d)}catch(v){}})};var j=jQuery;j.fn.drag=function(d,c,a){var e="string"==typeof d?d:"",b=j.isFunction(d)?d:j.isFunction(c)?c:null;0!==e.indexOf("drag")&&(e="drag"+e);a=(d== b?c:a)||{};return b?this.bind(e,a,b):this.trigger(e)};var n=j.event,r=n.special,g=null,g=r.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:!1,drop:!0,click:!1},datakey:"dragdata",livekey:"livedrag",add:function(d){var c=j.data(this,g.datakey),a=d.data||{};c.related+=1;!c.live&&d.selector&&(c.live=!0,n.add(this,"draginit."+g.livekey,g.delegate));j.each(g.defaults,function(e){void 0!==a[e]&&(c[e]=a[e])})},remove:function(){j.data(this,g.datakey).related-=1},setup:function(){if(!j.data(this, g.datakey)){var d=j.extend({related:0},g.defaults);j.data(this,g.datakey,d);n.add(this,"mousedown",g.init,d);this.attachEvent&&this.attachEvent("ondragstart",g.dontstart)}},teardown:function(){j.data(this,g.datakey).related||(j.removeData(this,g.datakey),n.remove(this,"mousedown",g.init),n.remove(this,"draginit",g.delegate),g.textselect(!0),this.detachEvent&&this.detachEvent("ondragstart",g.dontstart))},init:function(d){var c=d.data,a;if(!(0j.inArray(a,c)&& c.push(a)});return!c.length?!1:j(c).bind("dragend."+g.livekey,function(){n.remove(this,"."+g.livekey)})},hijack:function(d,c,a,e,b){if(a){var k=d.originalEvent,h=d.type,f=c.indexOf("drop")?"drag":"drop",m,s=e||0,p,l;e=!isNaN(e)?e:a.interactions.length;d.type=c;d.originalEvent=null;a.results=[];do if((p=a.interactions[s])&&!("dragend"!==c&&p.cancelled))l=g.properties(d,a,p),p.results=[],j(b||p[f]||a.droppable).each(function(b,e){m=(l.target=e)?n.handle.call(e,d,l):null;!1===m?("drag"==f&&(p.cancelled= !0,a.propagates-=1),"drop"==c&&(p[f][b]=null)):"dropinit"==c&&p.droppable.push(g.element(m)||e);"dragstart"==c&&(p.proxy=j(g.element(m)||p.drag)[0]);p.results.push(m);delete d.result;if("dropinit"!==c)return m}),a.results[s]=g.flatten(p.results),"dropinit"==c&&(p.droppable=g.flatten(p.droppable)),"dragstart"==c&&!p.cancelled&&l.update();while(++s":"";a.options.watermarkcode+="
    ";a.options.freeversion?a.options.watermarkcode+=a.options.freemark:0");a.options.watermarkcode+="
    ";a.options.watermarkcode+=a.options.freeversion?"":"";a.createStyle();a.createMarkup();a.createImageToolbox();if(!(0>=a.elemArray.length)){a.createEvents();a.loadCarousel();a.savedElem=-1;a.curElem=-1;a.nextElem=-1;a.prevElem=-1;a.isPaused=!a.options.autoslide;a.isFullscreen=!1;var d=a.getParams(); a.slideRun(d.html5galleryid&&d.html5galleryid in a.elemArray?d.html5galleryid:0)}},initData:function(a){if(this.options.src&&0this.options.xml.indexOf("?")?"?":"&",this.options.xml+=Math.random());var e=this;d.ajax({type:"GET",url:this.options.xml,dataType:"xml",success:function(b){d(b).find("slide").each(function(a){e.elemArray.push([d(this).find("id").length?d(this).find("id").text():a,d(this).find("thumbnail").text(),d(this).find("file").text(),d(this).find("file-ogg").text(),d(this).find("file-webm").text(),d(this).find("link").text(),d(this).find("linktarget").text(),d(this).find("title").text(),d(this).find("information").length&& 0
    "); this.$gallery.appendTo(this.container);this.options.socialurlforeach||this.createSocialMedia();this.options.googleanalyticsaccount&&!window._gaq&&(window._gaq=window._gaq||[],window._gaq.push(["_setAccount",this.options.googleanalyticsaccount]),window._gaq.push(["_trackPageview"]),d.getScript(("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js"))},createSocialMedia:function(){d(".html5gallery-viral-"+this.id,this.$gallery).empty();var a=window.location.href; this.options.socialurlforeach&&(a+=(0>window.location.href.indexOf("?")?"?":"&")+"html5galleryid="+this.elemArray[this.curElem][0]);if(this.options.showsocialmedia&&this.options.showfacebooklike){var e="
    ")}this.options.showsocialmedia&&this.options.showtwitter&&(e=""),d.getScript("http://platform.twitter.com/widgets.js"));this.options.showsocialmedia&&this.options.showgoogleplus&&(e="
    "),d.getScript("https://apis.google.com/js/plusone.js"))},createEvents:function(){var a=this;d(".html5gallery-play-"+this.id,this.$gallery).click(function(){d(".html5gallery-play-"+a.id,a.$gallery).hide();d(".html5gallery-pause-"+a.id,a.$gallery).show();a.isPaused=!1;a.slideshowTimeout=setTimeout(function(){a.slideRun(-1)}, a.options.slideshowinterval);d(".html5gallery-timer-"+a.id,a.$gallery).css({width:0});a.slideTimerCount=0;a.options.showtimer&&(a.slideTimer=setInterval(function(){a.showSlideTimer()},50))});d(".html5gallery-pause-"+this.id,this.$gallery).click(function(){d(".html5gallery-play-"+a.id,a.$gallery).show();d(".html5gallery-pause-"+a.id,a.$gallery).hide();a.isPaused=!0;clearTimeout(a.slideshowTimeout);d(".html5gallery-timer-"+a.id,a.$gallery).css({width:0});clearInterval(a.slideTimer);a.slideTimerCount= 0});d(".html5gallery-lightbox-"+this.id,this.$gallery).click(function(){a.goFullscreen()});d(".html5gallery-left-"+this.id,this.$gallery).click(function(){a.slideRun(-2,!0)});d(".html5gallery-right-"+this.id,this.$gallery).click(function(){a.slideRun(-1,!0)});d(".html5gallery-box-"+this.id,this.$gallery).touchSwipe({swipeLeft:function(){a.slideRun(-1,!0)},swipeRight:function(){a.slideRun(-2,!0)}});d(".html5gallery-box-"+this.id,this.$gallery).hover(function(){a.onSlideshowOver();var d=a.elemArray[a.curElem][9]; ("always"==a.options.showimagetoolbox||"image"==a.options.showimagetoolbox&&1==d)&&a.showimagetoolbox(d)},function(){a.hideimagetoolbox()});d(".html5gallery-container-"+this.id).hover(function(){a.options.titleoverlay&&a.options.titleautohide&&d(".html5gallery-title-"+a.id,a.$gallery).fadeIn()},function(){a.options.titleoverlay&&a.options.titleautohide&&d(".html5gallery-title-"+a.id,a.$gallery).fadeOut()});d(".html5gallery-car-left-"+this.id,this.$gallery).css({"background-position":"0px 0px"});d(".html5gallery-car-right-"+ this.id,this.$gallery).css({"background-position":"0px 0px"});d(".html5gallery-car-left-"+this.id,this.$gallery).click(function(){a.carouselPrev()});d(".html5gallery-car-right-"+this.id,this.$gallery).click(function(){a.carouselNext()});d(".html5gallery-car-slider-"+this.id,this.$gallery).bind("drag",function(d,b){a.carouselSliderDrag(d,b)});d(".html5gallery-car-slider-bar-"+this.id,this.$gallery).click(function(d){a.carouselBarClicked(d)});d(".html5gallery-car-left-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"-32px 0px"})}, function(){d(this).css({"background-position":"0px 0px"})});d(".html5gallery-car-right-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"-32px 0px"})},function(){d(this).css({"background-position":"0px 0px"})})},createStyle:function(){switch(this.options.skin){case "vertical":this.createStyleVertical();break;default:this.createStyleDefault()}},createStyleVertical:function(){this.options.thumbimageborder=1;this.options.thumbimagewidth=this.options.thumbheight-8;this.options.thumbimageheight= this.options.thumbheight-8;this.options.isIE&&2>this.options.thumbimageborder&&(this.options.thumbimageborder=0);this.options.showtitle||(this.options.titleheight=0);if(!this.options.showsocialmedia||!this.options.showfacebooklike&&!this.options.showtwitter&&!this.options.showgoogleplus)this.options.socialheight=0;this.options.headerHeight=this.options.titleoverlay?this.options.socialheight:this.options.titleheight+this.options.socialheight;this.options.boxWidth=this.options.width;this.options.boxHeight= this.options.height+this.options.headerHeight;this.options.boxLeft=this.options.padding;this.options.boxTop=this.options.padding;this.options.showcarousel?(this.options.carouselWidth=this.options.thumbwidth,this.options.carouselHeight=this.options.height+this.options.headerHeight,this.options.carTop=0,this.options.carBottom=0,this.options.carAreaLength=this.options.carouselHeight-this.options.carTop-this.options.carBottom,this.options.carouselSlider=Math.floor(this.options.carAreaLength/(this.options.thumbheight+ this.options.thumbgap))=this.elemArray.length)){a=Math.floor(a/this.options.thumbShowNum)*this.options.thumbShowNum*(this.options.thumbheight+this.options.thumbgap);a>=this.options.thumbTotalHeight-this.options.thumbMaskHeight&&(a=this.options.thumbTotalHeight-this.options.thumbMaskHeight); var b=a/(this.elemArray.length*(this.options.thumbheight+this.options.thumbgap)-this.options.thumbMaskHeight),b=b*(this.options.carouselSliderMax-this.options.carouselSliderMin);d(".html5gallery-car-slider-"+this.id,this.$gallery).stop(!0).animate({top:b},300);d(".html5gallery-thumbs-"+this.id,this.$gallery).stop(!0).animate({marginTop:-1*a},300)}},this.carouselBarClicked=function(a){var b=d(".html5gallery-thumbs-"+this.id,this.$gallery);a.pageY>d(".html5gallery-car-slider-"+this.id,this.$gallery).offset().top? (a=-1*parseInt(b.css("margin-top"))+this.options.thumbShowNum*(this.options.thumbheight+this.options.thumbgap),a>=this.options.thumbTotalHeight-this.options.thumbMaskHeight&&(a=this.options.thumbTotalHeight-this.options.thumbMaskHeight)):(a=-1*parseInt(b.css("margin-top"))-this.options.thumbShowNum*(this.options.thumbheight+this.options.thumbgap),0>a&&(a=0));b.stop(!0).animate({marginTop:-a},500);a=a*(this.options.carouselSliderMax-this.options.carouselSliderMin)/(this.elemArray.length*(this.options.thumbheight+ this.options.thumbgap)-this.options.thumbMaskHeight);athis.options.carouselSliderMax&&(a=this.options.carouselSliderMax);d(".html5gallery-car-slider-"+this.id,this.$gallery).stop(!0).animate({top:a},500)},this.carouselSliderDrag=function(a,b){var e=b.offsetY-d(".html5gallery-car-slider-bar-"+this.id,this.$gallery).offset().top;ethis.options.carouselSliderMax&& (e=this.options.carouselSliderMax);d(".html5gallery-car-slider-"+this.id,this.$gallery).css({top:e});var c=this.elemArray.length*(this.options.thumbheight+this.options.thumbgap)-this.options.thumbMaskHeight,c=c*e/(this.options.carouselSliderMax-this.options.carouselSliderMin),c=Math.round(c/(this.options.thumbheight+this.options.thumbgap)),c=-1*c*(this.options.thumbheight+this.options.thumbgap);d(".html5gallery-thumbs-"+this.id,this.$gallery).stop(!0).animate({marginTop:c},300)},this.carouselPrev= function(){var a=d(".html5gallery-thumbs-"+this.id,this.$gallery);if(0==parseInt(a.css("margin-top")))a.animate({marginTop:"+="+Math.round(this.options.thumbMaskHeight/8)+"px"},100).animate({marginTop:0},500,"easeOutBounce");else{var b=-1*parseInt(a.css("margin-top"))-this.options.thumbShowNum*(this.options.thumbheight+this.options.thumbgap);0>b&&(b=0);a.animate({marginTop:-b},500,this.options.carouseleasing)}},this.carouselNext=function(){var a=d(".html5gallery-thumbs-"+this.id,this.$gallery);if(parseInt(a.css("margin-top"))== -(this.options.thumbTotalHeight-this.options.thumbMaskHeight))a.animate({marginTop:"-="+Math.round(this.options.thumbMaskHeight/8)+"px"},100).animate({marginTop:-(this.options.thumbTotalHeight-this.options.thumbMaskHeight)},500,"easeOutBounce");else{var b=-1*parseInt(a.css("margin-top"))+this.options.thumbShowNum*(this.options.thumbheight+this.options.thumbgap);b>=this.options.thumbTotalHeight-this.options.thumbMaskHeight&&(b=this.options.thumbTotalHeight-this.options.thumbMaskHeight);a.animate({marginTop:-b}, 500,this.options.carouseleasing)}}):b+=" .html5gallery-car-"+this.id+" { display:none; }";b=this.options.freeversion?b+(" .html5gallery-watermark-"+this.id+" {display:block; position:absolute; top:4px; left:4px; width:120px; text-align:center; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; filter:alpha(opacity=60); opacity:0.6; background-color:#333333; color:#ffffff; font:12px Armata, sans-serif, Arial;}"):0"+b+"")},createImageToolbox:function(){1>=this.elemArray.length&&(this.options.showplaybutton=this.options.showprevbutton=this.options.shownextbutton=!1);if("never"!=this.options.showimagetoolbox){var a;if("center"==this.options.imagetoolboxstyle)a=" .html5gallery-toolbox-"+this.id+" {display:none; overflow:hidden; position:relative; margin:0px auto; text-align:center; height:40px;}", a+=" .html5gallery-toolbox-bg-"+this.id+" {display:block; left:0px; top:0px; width:100%; height:100%; position:absolute; filter:alpha(opacity=60); opacity:0.6; background-color:#222222; }",a+=" .html5gallery-toolbox-buttons-"+this.id+" {display:block; margin:0px auto; height:100%;}",a+=" .html5gallery-play-"+this.id+" { position:relative; float:left; display:none; cursor:pointer; overflow:hidden; width:32px; height:32px; margin-left:2px; margin-right:2px; margin-top:"+Math.round(4)+"px; background:url('"+ this.options.skinfolder+"play.png') no-repeat top left; } ",a+=" .html5gallery-pause-"+this.id+" { position:relative; float:left; display:none; cursor:pointer; overflow:hidden; width:32px; height:32px; margin-left:2px; margin-right:2px; margin-top:"+Math.round(4)+"px; background:url('"+this.options.skinfolder+"pause.png') no-repeat top left; } ",a+=" .html5gallery-left-"+this.id+" { position:relative; float:left; display:none; cursor:pointer; overflow:hidden; width:32px; height:32px; margin-left:2px; margin-right:2px; margin-top:"+ Math.round(4)+"px; background:url('"+this.options.skinfolder+"prev.png') no-repeat top left; } ",a+=" .html5gallery-right-"+this.id+" { position:relative; float:left; display:none; cursor:pointer; overflow:hidden; width:32px; height:32px; margin-left:2px; margin-right:2px; margin-top:"+Math.round(4)+"px; background:url('"+this.options.skinfolder+"next.png') no-repeat top left; } ",a+=" .html5gallery-lightbox-"+this.id+" {position:relative; float:left; display:none; cursor:pointer; overflow:hidden; width:32px; height:32px; margin-left:2px; margin-right:2px; margin-top:"+ Math.round(4)+"px; background:url('"+this.options.skinfolder+"lightbox.png') no-repeat top left; } ";else{var e=Math.round(("bottom"==this.options.headerpos?0:this.options.headerHeight)+this.options.height/2-24),b=e+Math.round(this.options.height/2)-24,c=this.options.width-48,h=this.options.showfullscreenbutton?c-48:c;a=" .html5gallery-toolbox-"+this.id+" {display:none;}";a+=" .html5gallery-toolbox-bg-"+this.id+" {display:none;}";a+=" .html5gallery-toolbox-buttons-"+this.id+" {display:block;}";a+= " .html5gallery-play-"+this.id+" { position:absolute; display:none; cursor:pointer; top:"+b+"px; left:"+h+"px; width:48px; height:48px; background:url('"+this.options.skinfolder+"side_play.png') no-repeat top left;} ";a+=" .html5gallery-pause-"+this.id+" { position:absolute; display:none; cursor:pointer; top:"+b+"px; left:"+h+"px; width:48px; height:48px; background:url('"+this.options.skinfolder+"side_pause.png') no-repeat top left;} ";a+=" .html5gallery-left-"+this.id+" { position:absolute; display:none; cursor:pointer; top:"+ e+"px; left:0px; width:48px; height:48px; background:url('"+this.options.skinfolder+"side_prev.png') no-repeat center center;} ";a+=" .html5gallery-right-"+this.id+" { position:absolute; display:none; cursor:pointer; top:"+e+"px; left:"+c+"px; width:48px; height:48px; background:url('"+this.options.skinfolder+"side_next.png') no-repeat center center;} ";a+=" .html5gallery-lightbox-"+this.id+" {position:absolute; display:none; cursor:pointer; top:"+b+"px; left:"+c+"px; width:48px; height:48px; background:url('"+ this.options.skinfolder+"side_lightbox.png') no-repeat top left;} "}d(".html5gallery-play-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"right top"})},function(){d(this).css({"background-position":"left top"})});d(".html5gallery-pause-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"right top"})},function(){d(this).css({"background-position":"left top"})});d(".html5gallery-left-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"right top"})}, function(){d(this).css({"background-position":"left top"})});d(".html5gallery-right-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"right top"})},function(){d(this).css({"background-position":"left top"})});d(".html5gallery-lightbox-"+this.id,this.$gallery).hover(function(){d(this).css({"background-position":"right top"})},function(){d(this).css({"background-position":"left top"})});d("head").append("")}this.showimagetoolbox=function(a){if(this.options.showplaybutton|| this.options.showprevbutton||this.options.shownextbutton||this.options.showfullscreenbutton){if("center"==this.options.imagetoolboxstyle){var b=Math.round(("bottom"==this.options.headerpos?0:this.options.headerHeight)+this.options.height/2);if(6==a||7==a||8==a||9==a||10==a)b+=45;d(".html5gallery-toolbox-"+this.id,this.$gallery).css({top:b});b=0;this.options.showplaybutton&&1==a?(b+=36,this.isPaused?(d(".html5gallery-play-"+this.id,this.$gallery).show(),d(".html5gallery-pause-"+this.id,this.$gallery).hide()): (d(".html5gallery-play-"+this.id,this.$gallery).hide(),d(".html5gallery-pause-"+this.id,this.$gallery).show())):(d(".html5gallery-play-"+this.id,this.$gallery).hide(),d(".html5gallery-pause-"+this.id,this.$gallery).hide());this.options.showprevbutton?(b+=36,d(".html5gallery-left-"+this.id,this.$gallery).show()):d(".html5gallery-left-"+this.id,this.$gallery).hide();this.options.shownextbutton?(b+=36,d(".html5gallery-right-"+this.id,this.$gallery).show()):d(".html5gallery-right-"+this.id,this.$gallery).hide(); this.options.showfullscreenbutton&&1==a?(b+=36,d(".html5gallery-lightbox-"+this.id,this.$gallery).show()):d(".html5gallery-lightbox-"+this.id,this.$gallery).hide();d(".html5gallery-toolbox-"+this.id,this.$gallery).css({width:b+16});d(".html5gallery-toolbox-buttons-"+this.id,this.$gallery).css({width:b})}else this.options.showplaybutton&&1==a?this.isPaused?(d(".html5gallery-play-"+this.id,this.$gallery).show(),d(".html5gallery-pause-"+this.id,this.$gallery).hide()):(d(".html5gallery-play-"+this.id, this.$gallery).hide(),d(".html5gallery-pause-"+this.id,this.$gallery).show()):(d(".html5gallery-play-"+this.id,this.$gallery).hide(),d(".html5gallery-pause-"+this.id,this.$gallery).hide()),this.options.showprevbutton?d(".html5gallery-left-"+this.id,this.$gallery).show():d(".html5gallery-left-"+this.id,this.$gallery).hide(),this.options.shownextbutton?d(".html5gallery-right-"+this.id,this.$gallery).show():d(".html5gallery-right-"+this.id,this.$gallery).hide(),this.options.showfullscreenbutton&&1== a?d(".html5gallery-lightbox-"+this.id,this.$gallery).show():d(".html5gallery-lightbox-"+this.id,this.$gallery).hide();this.options.isIE678?d(".html5gallery-toolbox-"+this.id,this.$gallery).show():d(".html5gallery-toolbox-"+this.id,this.$gallery).fadeIn()}};this.hideimagetoolbox=function(){this.options.isIE678?d(".html5gallery-toolbox-"+this.id,this.$gallery).hide():d(".html5gallery-toolbox-"+this.id,this.$gallery).fadeOut()}},createStyleDefault:function(){this.options.thumbimageborder=1;this.options.thumbimagewidth= this.options.thumbwidth-2;this.options.thumbimageheight=this.options.thumbheight-2;this.options.isIE&&2>this.options.thumbimageborder&&(this.options.thumbimageborder=0);this.options.showtitle||(this.options.titleheight=0);if(!this.options.showsocialmedia||!this.options.showfacebooklike&&!this.options.showtwitter&&!this.options.showgoogleplus)this.options.socialheight=0;this.options.headerHeight=this.options.titleoverlay?this.options.socialheight:this.options.titleheight+this.options.socialheight; this.options.boxWidth=this.options.width;this.options.boxHeight=this.options.height+this.options.headerHeight;this.options.boxLeft=this.options.padding;this.options.boxTop=this.options.padding;this.options.showcarousel?(this.options.carouselWidth=this.options.width,this.options.carouselHeight=this.options.thumbheight+2*this.options.thumbmargin,this.options.carouselLeft=this.options.padding,this.options.carouselTop=this.options.padding+this.options.boxHeight+this.options.carouselmargin):(this.options.carouselWidth= 0,this.options.carouselHeight=0,this.options.carouselLeft=0,this.options.carouselTop=0,this.options.carouselmargin=0);this.options.totalWidth=this.options.width+2*this.options.padding;this.options.totalHeight=this.options.height+this.options.carouselHeight+this.options.carouselmargin+this.options.headerHeight+2*this.options.padding;this.options.containerWidth=this.options.totalWidth;this.options.containerHeight=this.options.totalHeight;this.container.css({width:this.options.containerWidth,height:this.options.containerHeight}); var a=0,e=0;this.options.elemTop=0;"top"==this.options.headerpos?(e=0,a=this.options.socialheight,this.options.elemTop=this.options.headerHeight):"bottom"==this.options.headerpos&&(this.options.elemTop=0,a=this.options.titleoverlay?this.options.height-this.options.titleheight:this.options.height,e=this.options.titleoverlay?this.options.height:this.options.height+this.options.titleheight);var b=" .html5gallery-container-"+this.id+" { display:block; position:absolute; left:0px; top:0px; width:"+this.options.totalWidth+ "px; height:"+this.options.totalHeight+"px; background:url('"+this.options.skinfolder+this.options.bgimage+"') center top; background-color:"+this.options.bgcolor+";}";this.options.galleryshadow&&(b+=" .html5gallery-container-"+this.id+" { -moz-box-shadow: 0px 2px 5px #aaa; -webkit-box-shadow: 0px 2px 5px #aaa; box-shadow: 0px 2px 5px #aaa;}");var b=b+(" .html5gallery-box-"+this.id+" {display:block; position:absolute; text-align:center; left:"+this.options.boxLeft+"px; top:"+this.options.boxTop+"px; width:"+ this.options.boxWidth+"px; height:"+this.options.boxHeight+"px;}"),c=Math.round(this.options.socialheight/2-12),b=b+(" .html5gallery-title-text-"+this.id+" "+this.options.titlecss+" .html5gallery-title-text-"+this.id+" "+this.options.titlecsslink+" .html5gallery-error-"+this.id+" "+this.options.errorcss),b=b+(" .html5gallery-fullscreen-title-"+this.id+""+this.options.titlefullscreencss+" .html5gallery-fullscreen-title-"+this.id+""+this.options.titlefullscreencsslink),b=b+(" .html5gallery-viral-"+ this.id+" {display:block; overflow:hidden; position:absolute; text-align:left; top:"+e+"px; left:0px; width:"+this.options.boxWidth+"px; height:"+this.options.socialheight+"px; padding-top:"+c+"px;}"),b=b+(" .html5gallery-title-"+this.id+" {display:"+(this.options.titleoverlay&&this.options.titleautohide?"none":"block")+"; overflow:hidden; position:absolute; top:"+a+"px; left:0px; width:"+this.options.boxWidth+"px; height:"+this.options.titleheight+"px; line-height:"+this.options.titleheight+"px;}"), b=b+(" .html5gallery-timer-"+this.id+" {display:block; position:absolute; top:"+String(this.options.elemTop+this.options.height-2)+"px; left:0px; width:0px; height:2px; background-color:#ccc; filter:alpha(opacity=60); opacity:0.6; }"),b=b+(" .html5gallery-elem-"+this.id+" {display:block; overflow:hidden; position:absolute; top:"+this.options.elemTop+"px; left:0px; width:"+this.options.width+"px; height:"+this.options.height+"px;}");this.options.isIE7||this.options.isIE6?(b+=" .html5gallery-loading-"+ this.id+" {display:none; }",b+=" .html5gallery-loading-center-"+this.id+" {display:none; }"):(b+=" .html5gallery-loading-"+this.id+" {display:block; position:absolute; top:4px; right:4px; width:100%; height:100%; background:url('"+this.options.skinfolder+"loading.gif') no-repeat top right;}",b+=" .html5gallery-loading-center-"+this.id+" {display:block; position:absolute; top:0px; left:0px; width:100%; height:100%; background:url('"+this.options.skinfolder+"loading_center.gif') no-repeat center center;}"); 0this.options.thumbTotalWidth&&(e=this.options.thumbMaskWidth/2-this.options.thumbTotalWidth/2),b+=".html5gallery-thumbs-"+this.id+" { position:relative; display:block; margin-left:"+e+"px; width:"+String(this.elemArray.length*(this.options.thumbwidth+this.options.thumbgap))+"px; top:"+Math.round(this.options.carouselHeight/2-this.options.thumbheight/2)+"px; }",a=Math.round((this.options.width- a-4)/2-this.options.thumbMaskWidth/2),b+=" .html5gallery-car-mask-"+this.id+" { position:absolute; display:block; text-align:left; overflow:hidden; left:"+a+"px; width:"+this.options.thumbMaskWidth+"px; top:0px; height:"+this.options.carouselHeight+"px;} ",b+=" .html5gallery-tn-"+this.id+" { display:block; float:left; margin-left:"+Math.round(this.options.thumbgap/2)+"px; margin-right:"+Math.round(this.options.thumbgap/2)+"px; text-align:center; cursor:pointer; width:"+this.options.thumbwidth+"px;height:"+ this.options.thumbheight+"px;overflow:hidden;}",this.options.thumbshadow&&(b+=" .html5gallery-tn-"+this.id+" { -moz-box-shadow: 0px 2px 5px #aaa; -webkit-box-shadow: 0px 2px 5px #aaa; box-shadow: 0px 2px 5px #aaa;}"),b+=" .html5gallery-tn-selected-"+this.id+" { display:block; float:left; margin-left:"+Math.round(this.options.thumbgap/2)+"px; margin-right:"+Math.round(this.options.thumbgap/2)+"px;text-align:center; cursor:pointer; width:"+this.options.thumbwidth+"px;height:"+this.options.thumbheight+ "px;overflow:hidden;}",this.options.thumbshadow&&(b+=" .html5gallery-tn-selected-"+this.id+" { -moz-box-shadow: 0px 2px 5px #aaa; -webkit-box-shadow: 0px 2px 5px #aaa; box-shadow: 0px 2px 5px #aaa;}"),b+=" .html5gallery-tn-selected-"+this.id+" .html5gallery-tn-img-"+this.id+" {background-color:"+this.options.thumbimagebordercolor+";} .html5gallery-tn-"+this.id+" img { filter:alpha(opacity="+Math.round(100*this.options.thumbopacity)+"); opacity:"+this.options.thumbopacity+"; } .html5gallery-tn-selected-"+ this.id+" img { filter:alpha(opacity=100); opacity:1; } ",a=Math.round(this.options.thumbheight/2-(this.options.thumbimageheight+2*this.options.thumbimageborder)/2),b+=" .html5gallery-tn-img-"+this.id+" {display:block; overflow:hidden; margin-top:"+a+"px; width:"+String(this.options.thumbimagewidth+2*this.options.thumbimageborder)+"px;height:"+String(this.options.thumbimageheight+2*this.options.thumbimageborder)+"px;}",this.options.thumbunselectedimagebordercolor&&(b+=" .html5gallery-tn-img-"+this.id+ " {background-color:"+this.options.thumbunselectedimagebordercolor+";}"),b+=" .html5gallery-tn-title-"+this.id+" {display:none;}",this.carouselHighlight=function(a){d("#html5gallery-tn-"+this.id+"-"+a,this.$gallery).removeClass("html5gallery-tn-"+this.id).addClass("html5gallery-tn-selected-"+this.id);this.options.thumbShowNum>=this.elemArray.length||(a=Math.floor(a/this.options.thumbShowNum)*this.options.thumbShowNum*(this.options.thumbwidth+this.options.thumbgap),a>=this.options.thumbTotalWidth- this.options.thumbMaskWidth+this.options.thumbgap&&(a=this.options.thumbTotalWidth-this.options.thumbMaskWidth+this.options.thumbgap),a=-a,d(".html5gallery-thumbs-"+this.id,this.$gallery).animate({marginLeft:a},500))},this.carouselPrev=function(){var a=d(".html5gallery-thumbs-"+this.id,this.$gallery);if(0==parseInt(a.css("margin-left")))a.animate({marginLeft:"+="+Math.round(this.options.thumbMaskWidth/8)+"px"},100).animate({marginLeft:0},500,"easeOutBounce");else{var b=-1*parseInt(a.css("margin-left"))- this.options.thumbShowNum*(this.options.thumbwidth+this.options.thumbgap);0>b&&(b=0);a.animate({marginLeft:-b},500,this.options.carouseleasing)}},this.carouselNext=function(){var a=d(".html5gallery-thumbs-"+this.id,this.$gallery);if(parseInt(a.css("margin-left"))==-(this.options.thumbTotalWidth-this.options.thumbMaskWidth+this.options.thumbgap))a.animate({marginLeft:"-="+Math.round(this.options.thumbMaskWidth/8)+"px"},100).animate({marginLeft:-(this.options.thumbTotalWidth-this.options.thumbMaskWidth+ this.options.thumbgap)},500,"easeOutBounce");else{var b=-1*parseInt(a.css("margin-left"))+this.options.thumbShowNum*(this.options.thumbwidth+this.options.thumbgap);b>=this.options.thumbTotalWidth-this.options.thumbMaskWidth+this.options.thumbgap&&(b=this.options.thumbTotalWidth-this.options.thumbMaskWidth+this.options.thumbgap);a.animate({marginLeft:-b},500,this.options.carouseleasing)}}):b+=" .html5gallery-car-"+this.id+" { display:none; }";b=this.options.freeversion?b+(" .html5gallery-watermark-"+ this.id+" {display:block; position:absolute; top:4px; left:4px; width:120px; text-align:center; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; filter:alpha(opacity=60); opacity:0.6; background-color:#333333; color:#ffffff; font:12px Armata, sans-serif, Arial;}"):0"+ b+"")},loadCarousel:function(){for(var a=this,e=d(".html5gallery-thumbs-"+this.id,this.$gallery),b=0;b
    ");c.appendTo(e);c.unbind("click").click(function(b){a.slideRun(d(this).data("index"));b.preventDefault()});c.hover(function(){a.onThumbOver();d(this).removeClass("html5gallery-tn-"+a.id).addClass("html5gallery-tn-selected-"+a.id)},function(){d(this).data("index")!== a.curElem&&d(this).removeClass("html5gallery-tn-selected-"+a.id).addClass("html5gallery-tn-"+a.id)});c=new Image;c.data=b;d(c).load(function(){var b=Math.max(a.options.thumbimagewidth/this.width,a.options.thumbimageheight/this.height),c=Math.round(b*this.width),b=Math.round(b*this.height),k=a.options.thumbshowplayonvideo&&1!=a.elemArray[this.data][9]?"
    ":"";d("#html5gallery-tn-"+a.id+"-"+this.data,e).append("
    "+k+"
    "+a.elemArray[this.data][7]+"
    ")});c.src=this.elemArray[b][1]}},goNormal:function(){clearTimeout(this.slideshowTimeout);d(".html5gallery-timer-"+ this.id,this.$gallery).css({width:0});clearInterval(this.slideTimer);this.slideTimerCount=0;this.isFullscreen=!1;var a=d(".html5gallery-elem-"+this.id,this.$fullscreen).empty().css({top:this.options.elemTop});d(".html5gallery-box-"+this.id,this.$gallery).prepend(a);this.slideRun(this.curElem);this.$fullscreen.remove();this.hideimagetoolbox()},goFullscreen:function(){this.hideimagetoolbox();clearTimeout(this.slideshowTimeout);d(".html5gallery-fullscreen-timer-"+this.id,this.$fullscreen).css({width:0}); clearInterval(this.slideTimer);this.slideTimerCount=0;this.isFullscreen=!0;this.fullscreenInitial=20;this.fullscreenMargin=10;this.fullscreenBarH=40;var a=this.elemArray[this.curElem][10],e=this.elemArray[this.curElem][11];this.fullscreenWidth=d(window).width()-2*this.fullscreenMargin;this.fullscreenHeight=d(window).height()-2*this.fullscreenMargin-this.fullscreenBarH;var b=Math.min(this.fullscreenWidth/a,this.fullscreenHeight/e);1>b&&(a*=b,e*=b);var b=Math.max(d(window).width(),d(document).width()), c=Math.max(d(window).height(),d(document).height()),h=d(window).scrollTop()+Math.round((d(window).height()-(e+2*this.fullscreenMargin+this.fullscreenBarH))/2);this.$fullscreen=d("
    "); this.$fullscreen.appendTo("body");var f=this;d(window).scroll(function(){var a=d(".html5gallery-fullscreen-box-"+f.id,f.$fullscreen),b=d(window).scrollTop()+Math.round((d(window).height()-a.height())/2);a.css({top:b})});var g=d(".html5gallery-elem-"+this.id,this.$gallery).empty().css({top:0});d(".html5gallery-fullscreen-box-"+this.id,this.$fullscreen).animate({height:e+2*this.fullscreenMargin},"slow",function(){d(this).animate({width:a+2*f.fullscreenMargin},"slow",function(){d(this).animate({height:"+="+ f.fullscreenBarH},"slow",function(){d(".html5gallery-fullscreen-elem-"+f.id,f.$fullscreen).prepend(g);f.slideRun(f.curElem)})})});d(".html5gallery-fullscreen-overlay-"+this.id,this.$fullscreen).click(function(){f.goNormal()});d(".html5gallery-fullscreen-box-"+this.id,this.$fullscreen).hover(function(){1this.curElem-1?this.elemArray.length- 1:this.curElem-1,this.options.random&&(a=Math.floor(Math.random()*this.elemArray.length),a!=this.curElem&&(this.prevElem=a))):-1==a?(this.prevElem=this.curElem,this.curElem=this.nextElem,this.nextElem=this.curElem+1>=this.elemArray.length?0:this.curElem+1,this.options.random&&(a=Math.floor(Math.random()*this.elemArray.length),a!=this.curElem&&(this.nextElem=a))):0<=a&&(this.curElem=a,this.prevElem=0>this.curElem-1?this.elemArray.length-1:this.curElem-1,this.nextElem=this.curElem+1>=this.elemArray.length? 0:this.curElem+1,this.options.random&&(a=Math.floor(Math.random()*this.elemArray.length),a!=this.curElem&&(this.prevElem=a),a=Math.floor(Math.random()*this.elemArray.length),a!=this.curElem&&(this.nextElem=a)))},showSlideTimer:function(){this.slideTimerCount++;this.isFullscreen?d(".html5gallery-fullscreen-timer-"+this.id,this.$fullscreen).width(Math.round(50*d(".html5gallery-fullscreen-elem-"+this.id,this.$fullscreen).width()*(this.slideTimerCount+1)/this.options.slideshowinterval)):d(".html5gallery-timer-"+ this.id,this.$gallery).width(Math.round(50*this.options.boxWidth*(this.slideTimerCount+1)/this.options.slideshowinterval))},slideRun:function(a,e){clearTimeout(this.slideshowTimeout);this.isFullscreen?d(".html5gallery-fullscreen-timer-"+this.id,this.$fullscreen).css({width:0}):d(".html5gallery-timer-"+this.id,this.$gallery).css({width:0});clearInterval(this.slideTimer);this.slideTimerCount=0;this.options.showcarousel&&0<=this.curElem&&d("#html5gallery-tn-"+this.id+"-"+this.curElem,this.$gallery).removeClass("html5gallery-tn-selected-"+ this.id).addClass("html5gallery-tn-"+this.id);this.calcIndex(a);this.options.socialurlforeach&&this.createSocialMedia();!this.isFullscreen&&this.options.showcarousel&&this.carouselHighlight(this.curElem);if(this.options.showtitle){var b=this.elemArray[this.curElem][8];this.options.shownumbering&&(b=this.options.numberingformat.replace("%NUM",this.curElem+1).replace("%TOTAL",this.elemArray.length)+" "+b);this.isFullscreen?d(".html5gallery-fullscreen-title-"+this.id,this.$fullscreen).html(b):d(".html5gallery-title-"+ this.id,this.$gallery).html("
    "+b+"
    ")}b=this.elemArray[this.curElem][9];if(!(0>b)){!this.isFullscreen&&e?"always"==this.options.showimagetoolbox?this.showimagetoolbox(b):"image"==this.options.showimagetoolbox&&1!=b&&this.hideimagetoolbox():this.hideimagetoolbox();this.onChange();1==b?this.showImage():5==b||6==b||7==b||8==b?this.showVideo(this.options.autoplayvideo):9==b?this.showYoutube(this.options.autoplayvideo):10==b?this.showVimeo(this.options.autoplayvideo): 2==b&&this.showSWF();this.prevElem in this.elemArray&&1==this.elemArray[this.prevElem][9]&&((new Image).src=this.elemArray[this.prevElem][2]);this.nextElem in this.elemArray&&1==this.elemArray[this.nextElem][9]&&((new Image).src=this.elemArray[this.nextElem][2]);var c=this;1==b&&(!this.isPaused&&1
    ").appendTo(a):d("
    ").appendTo(a);var c=this,b=new Image;d(b).load(function(){$preloading.remove();c.elemArray[c.curElem][10]=this.width;c.elemArray[c.curElem][11]=this.height;var b;c.isFullscreen?(b=Math.min(c.fullscreenWidth/this.width, c.fullscreenHeight/this.height),b=1"+c.options.watermarkcode+"");b=d(".html5gallery-elem-img-"+ c.id,a);b.length?(a.prepend(h),a.html5boxTransition(c.id,b,h,{effect:c.options.effect,easing:c.options.easing,duration:c.options.duration,direction:c.curElem>=c.savedElem,slide:c.options.slide},function(){})):a.html(h);c.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Image","Play",c.elemArray[c.curElem][7]])});d(b).error(function(){$preloading.remove();c.isFullscreen&&c.adjustFullscreen(c.options.width,c.options.height);a.html("
    The requested content cannot be found
    ");c.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Image","Error",c.elemArray[c.curElem][7]])});b.src=this.elemArray[this.curElem][2]},adjustFullscreen:function(a,c){var b=d(window).scrollTop()+Math.round((d(window).height()-(c+2*this.fullscreenMargin+this.fullscreenBarH))/2);d(".html5gallery-fullscreen-title-"+ this.id,this.$fullscreen).css({width:a-128});d(".html5gallery-fullscreen-box-"+this.id,this.$fullscreen).animate({width:a+2*this.fullscreenMargin,height:c+2*this.fullscreenMargin+this.fullscreenBarH,top:b},"slow");d(".html5gallery-fullscreen-elem-"+this.id,this.$fullscreen).animate({width:a,height:c},"slow");d(".html5gallery-fullscreen-next-"+this.id,this.$fullscreen).css({top:Math.round(c/2)});d(".html5gallery-fullscreen-prev-"+this.id,this.$fullscreen).css({top:Math.round(c/2)});d(".html5gallery-fullscreen-bar-"+ this.id,this.$fullscreen).animate({width:a,top:c+this.fullscreenMargin},"slow");d(".html5gallery-fullscreen-play-"+this.id,this.$fullscreen).css("display",this.isPaused&&1=this.elemArray.length||1!=this.elemArray[this.curElem][9]?"none":"block");d(".html5gallery-elem-"+this.id,this.$fullscreen).css({width:a,height:c})},showVideo:function(a){var c= this.isFullscreen?this.$fullscreen:this.$gallery;this.isFullscreen?this.adjustFullscreen(this.options.width,this.options.height):d(".html5gallery-elem-"+this.id,this.$gallery).css({width:this.options.width,height:this.options.height});d(".html5gallery-elem-"+this.id,c).html("
    "+this.options.watermarkcode);var b=!1;if(this.options.isMobile)b=!0;else if((this.options.html5player||!this.options.flashInstalled)&&this.options.html5VideoSupported)if(!this.options.isFirefox&&!this.options.isOpera||(this.options.isFirefox||this.options.isOpera)&&(this.elemArray[this.curElem][3]||this.elemArray[this.curElem][4]))b=!0;if(b){b=this.elemArray[this.curElem][2]; if(this.options.isFirefox||this.options.isOpera||!b)b=this.elemArray[this.curElem][4]?this.elemArray[this.curElem][4]:this.elemArray[this.curElem][3];this.embedHTML5Video(d(".html5gallery-elem-video-"+this.id,c),this.options.width,this.options.height,b,a)}else b=this.elemArray[this.curElem][2],"/"!=b.charAt(0)&&("http:"!=b.substring(0,5)&&"https:"!=b.substring(0,6))&&(b=this.options.htmlfolder+b),this.embedFlash(d(".html5gallery-elem-video-"+this.id,c),this.options.width,this.options.height,this.options.jsfolder+ "html5boxplayer.swf","transparent",{width:this.options.width,height:this.options.height,videofile:b,autoplay:a?"1":"0",errorcss:".html5box-error"+this.options.errorcss,id:this.id});this.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Video","Play",this.elemArray[this.curElem][7]])},showSWF:function(){var a=this.isFullscreen?this.$fullscreen:this.$gallery,c=this.elemArray[this.curElem][10],b=this.elemArray[this.curElem][11];this.isFullscreen?this.adjustFullscreen(c,b):d(".html5gallery-elem-"+ this.id,this.$gallery).css({width:this.options.width,height:this.options.height});var k=this.isFullscreen?0:Math.round((this.options.height-b)/2)+(this.options.slideshadow?4:0),g=this.isFullscreen?0:Math.round((this.options.width-c)/2)+(this.options.slideshadow?4:0);d(".html5gallery-elem-"+this.id,a).html("
    "+this.options.watermarkcode); this.embedFlash(d(".html5gallery-elem-flash-"+this.id,a),c,b,this.elemArray[this.curElem][2],"window",{});this.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Flash","Play",this.elemArray[this.curElem][7]])},prepareYoutubeHref:function(a){var d="",b=a.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/);b&&(b[7]&&11==b[7].length)&&(d=b[7]);d="http://www.youtube.com/embed/"+d;a=this.getYoutubeParams(a);var b=!0,c;for(c in a)b?(d+="?",b=!1):d+="&",d+= c+"="+a[c];return d},getYoutubeParams:function(a){var d={};if(0>a.indexOf("?"))return d;a=a.substring(a.indexOf("?")+1).split("&");for(var b=0;b
    "+this.options.watermarkcode);var g=this;if(!ASYouTubeIframeAPIReady&&(ASYouTubeTimeout+=100,3E3>ASYouTubeTimeout)){setTimeout(function(){g.showYoutube(a)},100);return}if(ASYouTubeIframeAPIReady){c=this.elemArray[this.curElem][2].match(/(\?v=|\/\d\/|\/embed\/|\/v\/|\.be\/)([a-zA-Z0-9\-\_]+)/)[2]; b=null;a&&(b=function(a){a.target.playVideo()});var h=this.getYoutubeParams(this.elemArray[this.curElem][2]),h=d.extend({autoplay:a?1:0,rel:0,wmode:"transparent"},h);new YT.Player("html5gallery-elem-video-"+this.id,{width:this.options.width,height:this.options.height,videoId:c,playerVars:h,events:{onReady:b,onStateChange:function(a){a.data==YT.PlayerState.ENDED&&(g.onVideoEnd(),g.isPaused||g.slideRun(-1))}}})}else b=this.prepareYoutubeHref(b),a&&(b=0>b.indexOf("?")?b+"?autoplay=1":b+"&autoplay=1"), b=0>b.indexOf("?")?b+"?wmode=transparent&rel=0":b+"&wmode=transparent&rel=0",d(".html5gallery-elem-video-"+this.id,c).html("");this.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Video","Play",this.elemArray[this.curElem][7]])},showVimeo:function(a){var c=this.isFullscreen?this.$fullscreen:this.$gallery;this.isFullscreen? this.adjustFullscreen(this.options.width,this.options.height):d(".html5gallery-elem-"+this.id,this.$gallery).css({width:this.options.width,height:this.options.height});var b=this.elemArray[this.curElem][2];a&&(b=0>b.indexOf("?")?b+"?autoplay=1":b+"&autoplay=1");d(".html5gallery-elem-"+this.id,c).html("
    "+this.options.watermarkcode);d(".html5gallery-elem-video-"+this.id,c).html("");this.options.googleanalyticsaccount&&window._gaq.push(["_trackEvent","Video","Play",this.elemArray[this.curElem][7]])}, checkType:function(a){return!a?-1:a.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i)?1:a.match(/[^\.]\.(swf)\s*$/i)?2:a.match(/[^\.]\.(mp3)\s*$/i)?3:a.match(/[^\.]\.(pdf)\s*$/i)?4:a.match(/\.(flv)(.*)?$/i)?5:a.match(/\.(mp4|m4v)(.*)?$/i)?6:a.match(/\.(ogv|ogg)(.*)?$/i)?7:a.match(/\.(webm)(.*)?$/i)?8:a.match(/\:\/\/.*(youtube\.com)/i)||a.match(/\:\/\/.*(youtu\.be)/i)?9:a.match(/\:\/\/.*(vimeo\.com)/i)?10:0},onChange:function(){if(this.options.onchange&&window[this.options.onchange]&&"function"==typeof window[this.options.onchange])window[this.options.onchange](this.elemArray[this.curElem])}, onSlideshowOver:function(){if(this.options.onslideshowover&&window[this.options.onslideshowover]&&"function"==typeof window[this.options.onslideshowover])window[this.options.onslideshowover](this.elemArray[this.curElem])},onThumbOver:function(){if(this.options.onthumbover&&window[this.options.onthumbover]&&"function"==typeof window[this.options.onthumbover])window[this.options.onthumbover](this.elemArray[this.curElem])},onVideoEnd:function(){if(this.options.onvideoend&&window[this.options.onvideoend]&& "function"==typeof window[this.options.onvideoend])window[this.options.onvideoend](this.elemArray[this.curElem])},embedHTML5Video:function(a,c,b,g,h){a.html("
    ");var f=this;this.options.isAndroid&&(d("
    ").appendTo(a).unbind("click").click(function(){d(this).hide();d("video",a)[0].play()}),d("video",a).unbind("play").bind("play",function(){d("#android-play-"+f.id,a).hide()}));d("video",a).unbind("ended").bind("ended",function(){f.onVideoEnd();f.isPaused||f.slideRun(-1)});d("video",a).get(0).setAttribute("src",g)},embedFlash:function(a,c,b,g,h,f){if(this.options.flashInstalled){var j={pluginspage:"http://www.adobe.com/go/getflashplayer",quality:"high", allowFullScreen:"true",allowScriptAccess:"always",type:"application/x-shockwave-flash"};j.width=c;j.height=b;j.src=g;j.wmode=h;j.flashVars=d.param(f);c="";for(var l in j)c+=l+"="+j[l]+" ";a.html("")}else a.html("
    The required Adobe Flash Player plugin is not installed
    Get Adobe Flash player
    ")}}; this.each(function(){var a=d(this);g=g||{};for(var e in g)e.toLowerCase()!==e&&(g[e.toLowerCase()]=g[e],delete g[e]);this.options=d.extend({},g);var b=this;d.each(a.data(),function(a,c){b.options[a.toLowerCase()]=c});"skin"in this.options&&(this.options.skin=this.options.skin.toLowerCase());e={skinfolder:"/templates/front/js/jquery/plugins/html5gallery/skins/darkness/",padding:12,bgcolor:"#444444",bgimage:"background.jpg",galleryshadow:!1,slideshadow:!1,headerpos:"bottom",titleoverlay:!1,titleautohide:!1,titlecss:" {color:#ffffff; font-size:16px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap; text-align:left;}", titlecsslink:" a {color:#ffffff;}",showcarousel:!0,carouselmargin:8,carouselbgtransparent:!1,carouselbgcolorstart:"#494f54",carouselbgcolorend:"#292c31",carouseltopborder:"#666666",carouselbottomborder:"#111111",thumbwidth:64,thumbheight:48,thumbgap:4,thumbmargin:6,thumbunselectedimagebordercolor:"",thumbimagebordercolor:"#cccccc",thumbshowplayonvideo:!0,thumbshadow:!1,thumbopacity:0.8};var k={padding:12,skinfolder:"/templates/front/js/jquery/plugins/html5gallery/skins/light/",bgcolor:"",bgimage:"",galleryshadow:!1,slideshadow:!0,showsocialmedia:!1, headerpos:"top",titleoverlay:!0,titleautohide:!0,titlecss:" {color:#ffffff; font-size:14px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap; text-align:left; padding-left:12px; background:rgb(102, 102, 102) transparent; background: rgba(102, 102, 102, 0.6); filter:'progid:DXImageTransform.Microsoft.gradient(startColorstr=#99666666, endColorstr=#99666666)'; -ms-filter:'progid:DXImageTransform.Microsoft.gradient(startColorstr=#99666666, endColorstr=#99666666)'; }",titlecsslink:" a {color:#ffffff;}", showcarousel:!0,carouselmargin:10,carouselbgtransparent:!0,thumbwidth:48,thumbheight:48,thumbgap:8,thumbmargin:12,thumbunselectedimagebordercolor:"",thumbimagebordercolor:"#ffffff",thumbshowplayonvideo:!0,thumbshadow:!1,thumbopacity:0.8},h={skinfolder:"/templates/front/js/jquery/plugins/html5gallery/skins/horizontal/",padding:6,bgcolor:"#ffffff",bgimage:"",galleryshadow:!0,slideshadow:!1,showsocialmedia:!1,headerpos:"top",titleoverlay:!0,titleautohide:!0,titlecss:" {color:#ffffff; font-size:14px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap; text-align:left; padding-left:12px; background:rgb(102, 102, 102) transparent; background: rgba(102, 102, 102, 0.6); filter:'progid:DXImageTransform.Microsoft.gradient(startColorstr=#99666666, endColorstr=#99666666)'; -ms-filter:'progid:DXImageTransform.Microsoft.gradient(startColorstr=#99666666, endColorstr=#99666666)'; }", titlecsslink:" a {color:#ffffff;}",showcarousel:!0,carouselmargin:0,carouselbgtransparent:!1,carouselbgcolorstart:"#494f54",carouselbgcolorend:"#292c31",carouseltopborder:"#666666",carouselbottomborder:"#111111",thumbwidth:64,thumbheight:48,thumbgap:4,thumbmargin:6,thumbunselectedimagebordercolor:"",thumbimagebordercolor:"#cccccc",thumbshowplayonvideo:!0,thumbshadow:!1,thumbopacity:0.8},f={skinfolder:"/templates/front/js/jquery/plugins/html5gallery/skins/vertical/",padding:12,bgcolor:"#444444",bgimage:"background.jpg",galleryshadow:!1,slideshadow:!1, headerpos:"bottom",titleoverlay:!1,titleautohide:!1,titlecss:" {color:#ffffff; font-size:16px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap; text-align:left;}",titlecsslink:" a {color:#ffffff;}",showcarousel:!0,carouselmargin:8,carouselposition:"right",carouselbgtransparent:!1,carouselbgcolorstart:"#494f54",carouselbgcolorend:"#292c31",carouseltopborder:"#666666",carouselbottomborder:"#111111",carouselhighlightbgcolorstart:"#999999",carouselhighlightbgcolorend:"#666666", carouselhighlighttopborder:"#cccccc",carouselhighlightbottomborder:"#444444",carouselhighlightbgimage:"",thumbwidth:148,thumbheight:48,thumbgap:2,thumbmargin:6,thumbunselectedimagebordercolor:"",thumbimagebordercolor:"#cccccc",thumbshowplayonvideo:!0,thumbshadow:!1,thumbopacity:0.8,thumbshowimage:!0,thumbshowtitle:!0,thumbtitlecss:"{text-align:center; color:#ffffff; font-size:12px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap;}"},j={skin:"horizontal",googlefonts:"Armata", src:"",xml:"",xmlnocache:!0,autoslide:!1,slideshowinterval:6E3,random:!1,borderradius:0,autoplayvideo:!0,html5player:!1,effect:"fade",easing:"easeOutCubic",duration:1500,slide:{duration:1E3,easing:"easeOutExpo"},width:480,height:270,showtimer:!0,resizemode:"fill",showtitle:!0,titleheight:45,errorcss:" {text-align:center; color:#ff0000; font-size:14px; font-family:Arial, sans-serif;}",titlefullscreencss:" {color:#333333; font-size:16px; font-family:Armata, sans-serif, Arial; overflow:hidden; white-space:nowrap; line-height:40px;}", titlefullscreencsslink:" a {color:#333333;}",shownumbering:1,numberingformat:"%NUM / %TOTAL",googleanalyticsaccount:"",showsocialmedia:!0,socialheight:30,socialurlforeach:!1,showfacebooklike:!0,facebooklikeurl:"",showtwitter:!0,twitterurl:"",twitterusername:"",twittervia:"html5box",showgoogleplus:!0,googleplusurl:"",showimagetoolbox:"always",imagetoolboxstyle:"side",showplaybutton:!0,showprevbutton:!0,shownextbutton:!0,showfullscreenbutton:!0,carouselbgtransparent:!0,carouselbgcolorstart:"#ffffff", carouselbgcolorend:"#ffffff",carouseltopborder:"#ffffff",carouselbottomborder:"#ffffff",carouselbgimage:"",carouseleasing:"easeOutCirc",version:"2.5",freeversion:false,freemark:"html5box.com",freelink:"http://html5box.com/html5gallery/watermark.php",watermark:""},j="vertical"==this.options.skin?d.extend(j,f):"light"==this.options.skin?d.extend(j,k):"horizontal"==this.options.skin?d.extend(j,h):"darkness"==this.options.skin?d.extend(j,e):d.extend(j,h);this.options=d.extend(j,this.options);this.options.htmlfolder= window.location.href.substr(0,window.location.href.lastIndexOf("/")+1);this.options.jsfolder=l;"/"!=this.options.skinfolder.charAt(0)&&("http:"!=this.options.skinfolder.substring(0,5)&&"https:"!=this.options.skinfolder.substring(0,6))&&(this.options.skinfolder=l+this.options.skinfolder);if(-1!=this.options.htmlfolder.indexOf("://html5box.com")||-1!=this.options.htmlfolder.indexOf("://www.html5box.com"))this.options.freeversion=!1;e=new c(a,this.options,u++);a.data("html5galleryobject",e);a.data("html5galleryid", u);html5GalleryObjects.addObject(e)});return this};jQuery(document).ready(function(){$(".html5gallery").html5gallery()})}var html5GalleryObjects=new function(){this.objects=[];this.addObject=function(l){this.objects.push(l)};this.loadNext=function(l){this.objects[l].onVideoEnd();this.objects[l].isPaused||this.objects[l].slideRun(-1)}};if("undefined"===typeof ASYouTubeIframeAPIReady)var ASYouTubeIframeAPIReady=!1,ASYouTubeTimeout=0,onYouTubeIframeAPIReady=function(){ASYouTubeIframeAPIReady=!0}; ///////scripts $(document).ready(function(){ var ww, wh; function wwh(){ ww = $(window).width(); wh = $(window).height(); } wwh(); $("#back-top, #back-topIcon").click(function () { $("html, body").animate({scrollTop: 0}, 1000); }); if($("#ResourceOfferNeyAdsenses").length>0){ if($("#ResourceOfferNeyAdsenses").height()>$("#ResourceOfferNeyAds").height()){ $("#ResourceOfferNeyAds").height($("#ResourceOfferNeyAdsenses").height()); } else { $("#ResourceOfferNeyAdsenses").height($("#ResourceOfferNeyAds").height()); } } //Search form var whats = $("#whats").attr('data-default-value'); if( $("#whats").val().length==0 ){ $("#whats").val(whats);} $(document).on("focusin focusout keypress click", "#whats, #searchbutton", function(e){ if(e.type=='focusin'){ var newwhats = $("#whats").val(); if(newwhats==whats){$("#whats").val('');} } if(e.type=='focusout'){ var newwhats = $("#whats").val(); if(newwhats.length==0){ $("#whats").val(whats); }else{ $("#whats").val(newwhats); } } if(e.type=='keypress'){ var newwhats = $("#whats").val(); if (e.which !== 0 && e.charCode !== 0) { } else if(e.keyCode==13/*Enter*/){ e.preventDefault(); //Submit the form if($("#whats").val().length>3){ $("#SearchForm").submit(); }else{ $.ResetSystemMessageBox(); $("#SystemMessage").addClass('SystemMessageError'); $("#SystemMessage p").load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'TypeAtLast4CharsInSearchField.resource.tip'); $("#SystemMessage").slideDown(); } } else if(e.keyCode==27){ $("#whats").val(''); } } if(e.type=='click' && $(this).attr('id')=='searchbutton'){ var newwhats = $("#whats").val(); if(newwhats==whats){ $.ResetSystemMessageBox(); $("#SystemMessage").addClass('SystemMessageError'); $("#SystemMessage p").load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'SearchFieldIsEmpty.resource.tip'); $("#SystemMessage").slideDown(); }else{ if($("#whats").val().length>3){ $("#SearchForm").submit(); }else{ $.ResetSystemMessageBox(); $("#SystemMessage").addClass('SystemMessageError'); $("#SystemMessage p").load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'TypeAtLast4CharsInSearchField.resource.tip'); $("#SystemMessage").slideDown(); } } } }) //Tooltips $(document).tooltip({ items: "[tooltip]", tooltipClass: 'tooltip_styling', show: { effect: "blind", duration: 200 }, content: function() { var element = $( this ); if ( element.is( "[tooltip]" ) ) { return element.attr( "tooltip" ); } } }); //CodKnopki $(document).on("focus click", "#CodKnopkiArea", function(){$("#CodKnopkiArea").select();}) //Some operations $("#search").width($(".searchline").width()-230-$("#searchLineCategory").width()-$("#searchLineLocation").width()-$("#searchbutton").width()); //if(1 || $("#Categories").css('display')!='none'){ var leftpos = $(".searchline").width()-20-$("#searchLineLocation").width()-$("#searchbutton").width()-parseInt($("#searchLineCategory").width()/2); $("#CatInd").css("left", leftpos); //} if($("#Categories").css('display')!='none'){ $("#searchLineCategory").find('div').addClass('open'); } //if(1 || $("#Locations").css('display')!='none'){ var leftpos = $(".searchline").width()-20-$("#searchbutton").width()-parseInt($("#searchLineLocation").width()/2); $("#LocInd").css("left", leftpos); //} $(document).on("click", "#SystemMessage div", function(){ $("#SystemMessage").slideUp(); }) $(document).on("click", "#searchLineCategory, #CloseCategoriesBox", function(){ if($("#searchLineCategory").find('div').hasClass('open')){ $("#searchLineCategory").find('div').removeClass('open'); } else{ $("#searchLineCategory").find('div').addClass('open'); if($("#CategoriesBox").is(':empty')){ var category = $("#searchLineCategory").attr('data-category'); if(category!='top') { var url = rooturl+"ahah"+LDTR+"boxid"+LDTR+"resource.getCategoriesTreeBox"+LDTR+"mode"+LDTR+"ahah"+LDTR+"category"+LDTR+category; } else { var url = rooturl+"ahah"+LDTR+"boxid"+LDTR+"resource.getCategoriesTreeBox"+LDTR+"mode"+LDTR+"ahah"; } $.ajax({ url: url, beforeSend: function () { $("#CategoriesBox").html($("#loading").html()).delay(1000); } }).done(function ( data ) { $("#CategoriesBox").html(data); $("#CategoriesBreadcrumbBox").html($("#AdPageBreadcrumbBox").html()); }); } } $("#Categories").slideToggle("slow"); }) $(document).on("click", "#searchLineLocation", function(){ if($("#searchLineLocation").find('div').hasClass('open')){ $("#searchLineLocation").find('div').removeClass('open'); } else{ $("#searchLineLocation").find('div').addClass('open'); //alert($("#LocationsBox").html()); if($("#LocationsBox").is(':empty')){ $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"core.getRegionsCenterBox"+LDTR+"mode"+LDTR+"ahah", beforeSend: function () { $("#LocationsBox").html($("#loading").html()).delay(1000); } }).done(function ( data ) { $("#LocationsBox").html(data); }); } } $("#Locations").slideToggle('fast', 'swing'); }) $(document).on("click", "#CloseLocationsBox", function(){ $("#searchLineLocation").find('div').removeClass('open'); $("#Locations").hide(); }) //Category click $(document).on("click", ".category, .subcategory, .location, .PrevNextBlock, .PageBlock, #back-top, .ResourceOfferItem", function(){ var attr = $(this).find('a').attr("href"); if(typeof attr !== 'undefined' && attr !== false && attr!=='http://www.google.com/privacy_ads.html') window.location = attr; }) if($("#ActiveCatInd")[0] && $("#subcategories")[0]) { var posL=$("div.categoryCurrent").position().left+$("div.categoryCurrent").width()/2; var posT=$("div.categoryCurrent").position().top+$("div.categoryCurrent").height()+7; $("#ActiveCatInd").css({"top": posT + "px","left": posL + "px", "z-index":1}).show(); } // $(window).scroll(function() { if ($(this).scrollTop()>400) { $('#back-top, #back-topIcon').fadeIn("slow"); } else { $('#back-top, #back-topIcon').fadeOut("slow"); } }); $(document).on("click keydown", "div.CloseBox", function(e){ //TODO var cancell=0; if( $(this).attr('id')=='CloseCategoriesBox' || $(this).attr('id')=='CloseLocationsBox' ){cancell=1;} if(e.type=='click' || (e.type=='keydown' && e.which=='27') ) { if(!cancell){ $(this).parent().hide().html(""); $.ModalOverlayRemove(); } } }) //Login box $(document).on("click", "#LoginBoxTitle, #LoginBoxButton, #CloseLoginBox, #LoginButtonOnDeniedPage", function(){ $.cookie("actionMode", ''); if ($('#LoginBox').is(":visible")) { $('#LoginBox').fadeOut('fast'); $('#LoginBox').html(''); $.ModalOverlayRemove(); } else{ $.ModalOverlay(); $('#LoginBox').css("z-index", "101").fadeIn('fast'); var Login = $.cookie("Login"); if(!Login){Login='';} $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.UserAreaPanel"+LDTR+"Login"+LDTR+Login+LDTR+"ahahaction"+LDTR+"checkemailform", beforeSend: function () { $("#LoginBox").html($("#loading").html()); } }).done(function ( data ) { $("#LoginBox").html(data); }).complete(function(){ //$("#loadingCenter").hide(); }); } }) $(document).on("click", "#LoginBoxPasswordReminderOpener", function(){ $('#LoginBox').show(); $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.UserAreaPanel"+LDTR+"Login"+LDTR+$.cookie("Login")+LDTR+"ahahaction"+LDTR+"passreminform", beforeSend: function () { $("#LoginBox").html($("#loading").html()); } }).done(function ( data ) { $("#LoginBox").html(data); }); }); $(document).on("click", "#LoginBoxPossibleProblemsOpener", function(){ $( "#LoginBoxPossibleProblems" ).dialog({ modal: false, width: 600, maxHeight: 600, open: function(){ $(".ui-dialog-titlebar-close").hide(); $(".ui-dialog-title").addClass('f_12'); $(".ui-dialog-content").addClass('f_12 align_left'); $(".ui-dialog-titlebar").hide(); }, close: function(event, ui) { $(this).dialog('destroy'); }, buttons: { Ok: function() { $( this ).dialog( "destroy" ); } } }).css("z-index",900); }) $(document).on("click", "#LoginBoxOpener", function(){ $('#LoginBox').show(); $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.UserAreaPanel"+LDTR+"Login"+LDTR+$.cookie("Login")+LDTR+"ahahaction"+LDTR+"loginpasswordform", beforeSend: function () { $("#LoginBox").html($("#loading").html()); } }).done(function ( data ) { $("#LoginBox").html(data); }); }); $(document).on("click mouseover mouseout", "#UserMenuOpener, #CloseMenuBox, #UserMenuBox", function(event){ if(event.type=='mouseover' && this.id=='UserMenuOpener') { $('#UserMenuBox').show(); } if(event.type=='click' && this.id=='CloseMenuBox') { $('#UserMenuBox').hide(); $('.FAQBox').hide(); } }) $(document).on("click", "a#UserMenuLogout", function(){ $.ajax({ type: "POST", url: rooturl+'ahah'+LDTR+'boxid'+LDTR+'session.logout'+LDTR+'actionMode'+LDTR+'logout'+LDTR+'mode'+LDTR+'ahah', beforeSend: function(){ $.ResetSystemMessageBox(); }, success: function (response){ var result = $.trim(response); if(result=='Y'){ $("#UserAreaWrapper").load(rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.UserAreaPanel"); setTimeout(function(){ window.location = rooturl }, 500); } } }) }) //Login eof //Register box $(".glowbox").pulse("box", "pulse", 800); $(document).on("blur", "#registrationForm #User"+DTR+"Email", function(){ $.ajax({ url: rooturl+'ahah'+LDTR+'boxid'+LDTR+'session.CheckEmailOnRegister'+LDTR+'mode'+LDTR+'ahah', data: $("#registrationForm").serialize(), type:"post", beforeSend: function(){$("#SystemMessage").removeClass("SystemMessageSuccess SystemMessageError SystemMessageWarning")}, success: function(response){ //Check the email in DB. If exists: tell user to login. var result = $.trim(response); if(result=='N' || !result) { //alert(result); } else { //alert(result); var obj = $.parseJSON(result); var Login = obj.Email; } if(Login){ $.cookie("Login", Login, { expires: 31 }); $("#LoginBox").load(rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.UserAreaPanel"+LDTR+"Login"+LDTR+Login+LDTR+"ahahaction"+LDTR+"loginpasswordform"); } } }); }) //Validation email box if($(".SystemMessageEmail")){ setTimeout(function(){ $(".SystemMessageEmail").slideDown() }, 1000); } $(document).on("click", "#ValidateEmailLink", function(e){ e.preventDefault(); if ($('#ValidateEmailBox').is(":visible")) {} else{ $('#ValidateEmailBox').fadeIn('fast'); $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.validateUserEmail", beforeSend: function () { $("#ValidateEmailBox").html($("#loading").html()); } }).done(function ( data ) { $("#ValidateEmailBox").html(data); }); } }); $(document).on("click", "a#SendValidationCodeAgain", function(e){ e.preventDefault(); var button = $(this).attr('data-popup-button'); $.ajax({ url: rooturl+"ahah"+LDTR+"boxid"+LDTR+"session.validateUserEmail"+LDTR+"ahahaction"+LDTR+"sendValidationCode", }).done(function ( response ) { var result = $.trim(response); if(result=="Y"){ $('
    ').dialog({ resizable: false, draggable: false, modal: true, title: "", minWidth: 500, position: { my: "center center", at: "left top", of: "a#WhyDontIReceiveValidatingCode" }, open: function(){ $(".ui-dialog-titlebar-close").hide(); $(".ui-dialog-title").addClass('f_12'); $(".ui-dialog-content").addClass('f_12 align_left'); }, buttons: [ { text: button, click: function() { $( this ).dialog( "destroy" ); } } ] }).load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'SendingValidationCodeAgainSucess.session.popup'); }else if(result=='N'){ $('
    ').dialog({ resizable: false, draggable: false, modal: true, title: "", open: function(){ $(".ui-dialog-titlebar-close").hide(); $(".ui-dialog-title").addClass('f_12'); $(".ui-dialog-content").addClass('f_12 align_left'); }, buttons: [ { text: button, click: function() { $( this ).dialog( "destroy" ); } } ] }).load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'SendingValidationCodeAgainError.session.popup'); } }); }); $(document).on("click", "a#WhyDontIReceiveValidatingCode", function(){ $('
    ').dialog({ resizable: false, draggable: false, modal: true, title: $(this).attr('data-popup-title'), minWidth: 700, position: { my: "center center", at: "left top", of: "a#WhyDontIReceiveValidatingCode" }, open: function(){ $(".ui-dialog-titlebar-close").hide(); $(".ui-dialog-title").addClass('f_12'); $(".ui-dialog-content").addClass('f_12 align_left'); }, buttons: [ { text: $(this).attr('data-popup-button'), click: function() { $( this ).dialog( "destroy" ); } }/*, { text: $(this).attr('data-popup-button'), click: function() { $( this ).dialog( "destroy" ); } }*/ ] }).load(rooturl+'ahah'+LDTR+'boxid'+LDTR+'core.langAHAH'+LDTR+'langCode'+LDTR+'WhyDontIReceiveValidatingCode.session.popup'); }); //Share42 block var linkedPos={}; function getLinkedPos(){ linkedPos = {x:$(".searchline").offset().left+$(".searchline").width(), y:$(".searchline").offset().top+$(".searchline").height()}; $(".share42init").css("position","fixed").css("top",linkedPos.y+90).css("left", linkedPos.x+5); } getLinkedPos(); $(window).scroll(function(){ getLinkedPos(); }); $(window).resize(function(){ getLinkedPos(); wwh(); admitad_pos(); }); //Ali Parteners: // if($("#epn_partener").length){ //$("#epn_partener").html(''); } if($("#bottom_bannerMD").length){ //$("#bottom_bannerMD").html(''); } if($("#bottom_bannerMDuser").length){ /*$("#bottom_bannerMDuser").html('');*/ } if($(".fab-ad").length){ //$(".fab-ad").html(''); //$(".fab-ad").html(''); } if($("#jooblelink").length){ //var jooble = 'Partner Jooble Joburi Romania'; //$("#jooblelink").html(jooble); } var admintadLinks =[ 'GearBest.com WW', 'GearBest.com WW', 'GearBest.com WW', 'Hotels Combined INT', 'GearBest.com WW', 'Hotels Combined INT', 'GearBest.com WW', 'GearBest.com WW' ]; var admitadPos = null; var admitadIdx = "-1"; function admitad_pos() { var left = parseInt($('#logo').offset().left-160-15); if(ww>1329 && wh>700){ $('.admitad').css('left', left+'px'); $('.admitad').show(); admitadPos = 1; }else{ $('.admitad').hide(); admitadPos = null; } console.log(admitadPos); } function admitad() { if(!admitadPos) return false; var item; //if($('.admitad').text().length>10 && $('.admitad').is(':visible') ){ if(admitadPos){ admitadIdx++; if(typeof admintadLinks[admitadIdx] === 'undefined'){ admitadIdx="0"; } } item = admintadLinks[admitadIdx]; if($('.admitad').is(':visible')){ $('.admitad').fadeOut(500, function(){ $('.admitad').html(item); $('.admitad').fadeIn(1000); }); }else{ $('.admitad').html(item); $('.admitad').fadeIn(1000); } //admitad_pos(); } /* admitad_pos(); admitad(); setInterval(function(){ admitad(); }, 10000); */ });