Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/a/arhangel29/public_html/_shared/code/classes/60/AMI_DB.php on line 8

Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/a/arhangel29/public_html/_shared/code/classes/60/AMI_DB.php on line 8

Warning: Invalid argument supplied for foreach() in /home/a/arhangel29/public_html/_shared/code/classes/60/AMI_Response.php on line 8
/* * ATTENTION! This file is automatically created from several JavaScript files. * Find file path and name in the comments in the beginning of the each code block */ /* * FILE START: _shared/code/js/front_system.js */ if(typeof(DEBUG_BY_IP) == 'undefined'){ DEBUG_BY_IP = false; } function show_picture(script, src, alt, width, height) { if(src.indexOf('__gen=1|') > 0){ if((src.substring(0,7).toLowerCase()) == "http://" && (src.substring(0,8).toLowerCase() == "https://")){ script = src; }else if((script.substring(0,7).toLowerCase()) != "http://" && (script.substring(0,8).toLowerCase() != "https://")){ script = frontBaseHref + script; script = script + '?' + src; }else{ script = script + '?' + src; } }else{ script = src; } if(aMatches = script.match(/\.swf$/i)){ AMI.UI.MediaBox.open(decodeURIComponent(script), width, height); }else{ AMI.UI.MediaBox.open(decodeURIComponent(script)); } return; } function show_details(script) { if ( (script.substring(0,7).toLowerCase()) != "http://" && (script.substring(0,8).toLowerCase() != "https://" ) ){ script = frontBaseHref + script; } var w_width = 200; var w_height = 250; if (w_height > window.screen.availHeight) w_height = window.screen.availHeight; if (w_width > window.screen.availWidth) w_width = window.screen.availWidth; window.open(script, "pic", "resizable=yes, status=yes, scrollbars=yes, width=" + w_width + ", height=" + w_height); //return false; } function none(){ return false; } function isEmail(string) { // if (string.search(/^(\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+(;|,|$))+$/) != -1) if (string.search(/^(\w+[\w.-]*\@[A-Za-z0-9а-яёА-ЯЁ]+((\.|-+)[A-Za-z0-9а-яёА-ЯЁ]+)*\.[\-A-Za-z0-9а-яёА-ЯЁ]+(;|,|$))+$/) != -1) return true; else return false; } // // following functions will be deleted later // function collect_link(cform){ var vlink = ''; var first = 1; for(var i=0; i<= 0){ if(wrongPriceMsg != 'none' && wrongPriceMsg != undefined){ alert(wrongPriceMsg); } return; } } } this.prefix = ''; var resultUrl = frontBaseHref + url + '&qty=' + encodeURIComponent(qty) + (price != '' ? '&price=' + encodeURIComponent(price) : ''); this.sendRequest(resultUrl); }, addProp: function(url, itemId, propId, numPrice){ var resultUrl = resultUrl = frontBaseHref + url + '&qty='; if(itemId != 0 && document.forms[this.prefix + 'qty_' + itemId + '_' + propId + '_' + numPrice] && document.forms[this.prefix + 'qty_' + itemId + '_' + propId + '_' + numPrice].qty){ resultUrl += document.forms[this.prefix + 'qty_' + itemId + '_' + propId + '_' + numPrice].qty.value; }else{ resultUrl += '1'; } this.prefix = ''; this.sendRequest(resultUrl); }, /** * @access private */ sendRequest: function(url){ this.resultURL = url + '&eshop_cart_simple=1'; this.isCheckout = !(this.resultURL.indexOf('&eshop_special=') == -1 || this.resultURL.indexOf('&url=') >= 0); var pattern = "^(([^:/\\?#]+):)?(//(([^:/\\?#]*)(?::([^/\\?#]*))?))?([^\\?#]*)(\\?([^#]*))?(#(.*))?$"; rx = new RegExp(pattern), parts = rx.exec(this.resultURL), protocol = parts[1] || '', hostname = parts[5] || '', port = parts[6] ? ':' + parts[6] : '', path = parts[7] || '/'; args = parts[9] || ''; AMI.HTTPRequest.getContent( 'POST', protocol + '//' + hostname + port, 'modlink=' + path.substr(1) + (args != '' ? '&' + args : ''), this.ajaxCallback ); }, /** * @static */ ajaxCallback: function(status, content){ if(status == 1 && (cartStatusPos = content.indexOf('cart updated')) >= 0){ content = content.substr(cartStatusPos); amiSession.loadVariables(); var aVarNames = content.split('|'); amiCart.updateBlock(aVarNames[1], aVarNames[2]); var actionStatus = ''; for(i = 3; i < aVarNames.length; i++){ actionStatus += (i > 3 ? '|' : '') + aVarNames[i]; } if(typeof(onAddedToCartMessage) == 'function'){ onAddedToCartMessage(actionStatus); }else{ alert(actionStatus); } if(amiCart.isCheckout){ document.location = amiCart.resultURL.replace(/\?.*/, ''); }else if(!amiCart.useAJAX){ document.location.reload(); } } }, updateBlock: function(itemCountCookieName, totalCookieName){ var cartItemCount = amiSession.get(itemCountCookieName); if(document.getElementById('idEshopCartIsNotEmpty')){ document.getElementById('idEshopCartIsNotEmpty').style.display = (cartItemCount == '' || cartItemCount == 0 ? 'none' : 'block'); } if(document.getElementById('idEshopCartIsEmpty')){ document.getElementById('idEshopCartIsEmpty').style.display = (cartItemCount == '' || cartItemCount == 0 ? 'block' : 'none'); } if(cartItemCount != ''){ if(document.getElementById(itemCountCookieName)){ document.getElementById(itemCountCookieName).innerHTML = cartItemCount; } if(document.getElementById(totalCookieName)){ document.getElementById(totalCookieName).innerHTML = amiSession.get(totalCookieName); } if(document.getElementById('eshopCartEmpty')){ document.getElementById('eshopCartEmpty').style.display = (cartItemCount > 0 ? 'inline' : 'none'); } } if(typeof(onUpdateCartBlock) == 'function'){ // backward compatibility onUpdateCartBlock(cartItemCount, amiSession.get(totalCookieName)); }else if(typeof(this.onUpdateBlock) == 'function'){ this.onUpdateBlock(cartItemCount, amiSession.get(totalCookieName)); } } } /* backward compatibility { */ // @todo replace AddToCart by amiCart.add and delete this function function AddToCart(url, itemId, numPrice, wrongPriceMsg){ return amiCart.add(url, itemId, numPrice, wrongPriceMsg); } // @todo replace AddToCartProp by amiCart.addProp and delete this function function AddToCartProp(url, itemId, propId, numPrice){ return amiCart.addProp(url, itemId, propId, numPrice); } /* } backward compatibility */ /* ADVERTISING BLOCK */ var advCurTmStamp = new Date(); document.usedAdvData = ""; var isInnerHtmlSupported = -1; var shownAdvPlaces = ''; var shownAdvPlacesCnt = 0; var advReferrer = '' var advPlaceCnts = new Array(); if(document.referrer) advReferrer = document.referrer; function processShownAdvPlaces(shownAdvPlaces){ counter = 0; pos = -1; res = ""; while((pos = shownAdvPlaces.indexOf(';', pos+1)) >= 0){ if((pos1 = shownAdvPlaces.indexOf(';', pos+1)) < 0) pos1 = shownAdvPlaces.length; if(pos1-pos-1 > 0){ curAdvPlace = shownAdvPlaces.substr(pos+1, pos1-pos-1); if((cpos = curAdvPlace.indexOf('_')) >= 0){ counter = curAdvPlace.substr(cpos+1)-1; curAdvPlace = curAdvPlace.substr(0, cpos); } advPlaceCnts[curAdvPlace] = ++counter; res += ';'+curAdvPlace+"_"+counter; } } if(res.length > 0) res += ';'; return res; } function showAdvPlace(idPlace, viewURL){ if(isInnerHtmlSupported == -1){ if(document.body.innerHTML) isInnerHtmlSupported = 1; else isInnerHtmlSupported = 0; } // After the document is loaded (new scheme) if(isInnerHtmlSupported == 1){ shownAdvPlacesCnt ++; document.write(''); shownAdvPlaces += (shownAdvPlaces == '' ? ';' : '')+idPlace+';'; // Old scheme - inline method }else{ if (!document.usedAdvData) document.usedAdvData = ''; rndseed = new String(Math.random()); rndseed = rndseed.substring(2,11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"+viewURL+"aproc.php?action=view&rs="+advCurTmStamp.getTime()+rndseed+"&place="+idPlace+"&used="+document.usedAdvData+"&curl="+encodeURIComponent(viewURL)+"&referer="+encodeURIComponent(advReferrer)+"'><"+"/script>"); } } function showAdvBanner(id, content){ if(document.usedAdvData) document.usedAdvData += ','+id+','; else document.usedAdvData = ','+id+','; document.writeln(content); } function aLnkClick(lnkID){ var aLink = frontBaseHref+"aproc.php?action=lclick&id="+lnkID+"&page_url="+encodeURIComponent(document.location.href); advClick(aLink); } function advClick(clickURL){ rndseed = new String(Math.random()); rndseed = rndseed.substring(2,11); clickURL+="&rs="+advCurTmStamp.getTime()+rndseed; img = new Image(); img.src = clickURL; } var advPlacesContent = new Array(); var fillAdvPlaceWatcher = new Array(); function fillAdvPlace(idPlace, idCnt, placeContent){ if(advPlacesContent[idPlace+'_'+idCnt] == undefined) advPlacesContent[idPlace+'_'+idCnt] = placeContent; if(fillAdvPlaceWatcher[idPlace+'_'+idCnt] == undefined) fillAdvPlaceWatcher[idPlace+'_'+idCnt] = 0; if(document.getElementById && document.getElementById('advp_'+idPlace+'_'+idCnt) && document.getElementById('advp_'+idPlace+'_'+idCnt).innerHTML != undefined){ document.getElementById('advp_'+idPlace+'_'+idCnt).innerHTML = advPlacesContent[idPlace+'_'+idCnt]; }else{ fillAdvPlaceWatcher ++; if(fillAdvPlaceWatcher < 1000) setTimeout("fillAdvPlace('"+idPlace+"', '"+idCnt+"');", 100); } } /* MODULE ADVERTISEMENT PART [not in use] */ /* // String that contains module show data var modAdvIdsArr = new Array(); // Set item view function setView(modName, bodyType, id, idPlace){ if(isNaN(idPlace)) idPlace = 0; var isFound = 0; for(var i = 0; i < modAdvIdsArr.length; i++){ if(modAdvIdsArr[i][0] == modName){ modAdvIdsArr[i][1] += '|'+bodyType+id+','+idPlace; isFound = 1; break; } } if(!isFound) modAdvIdsArr[modAdvIdsArr.length] = new Array(modName, bodyType+id+','+idPlace); } // Process gathered adv IDs function processViewAdvIds(){ var retStr = ''; for(var i = 0; i < modAdvIdsArr.length; i++) retStr += (retStr != '' ? ';' : '')+modAdvIdsArr[i][0]+'='+modAdvIdsArr[i][1]; alert(retStr); return retStr; } */ // Returns cookie value function getPlainCookie(name){ // cookies are separated by semicolons var aCookie = document.cookie.split("; "); var value = ""; for (var i=0; i < aCookie.length; i++){ // a name/value pair (a crumb) is separated by an equal sign var aCrumb = aCookie[i].split("="); if (name == aCrumb[0]){ if(aCrumb[1] === undefined) { value = null; }else{ value = aCrumb[1]; } return value; } } // a cookie with the requested name does not exist return null; } function getCookie(name, useDecodeURIComponent){ var val = getPlainCookie(name); if(val != null){ if(useDecodeURIComponent){ val = decodeURIComponent(val); val = val.replace(/\+/g, ' '); }else{ val = decodeURIComponent(val); } } return val; } /* function updateCookieExpireTime(name, minutes){ var oDate = new Date(); if (typeof(minutes) != "undefined") oDate.setMinutes(oDate.getMinutes() + minutes); var val = getCookie(name); if(val != null){ _setCookie(name, val, "/", oDate); } } */ // {{{ window.onLoad events queue implementation var onLoadEvents = new Array (); var previousOnLoadEvent; function addOnLoadEvent(event) { onLoadEvents[onLoadEvents.length] = event; } function runOnLoadEventsQueue() { if (previousOnLoadEvent) { previousOnLoadEvent(); } for (var i = 0 ; i < onLoadEvents.length; i++) { onLoadEvents[i](); } } function savePreviousOnLoadEvent() { previousOnLoadEvent = window.onload; window.onload = runOnLoadEventsQueue; } // }}} function setCaptchaMD5Hash(sid) { var cookie = getCookie('captcha_' + sid); if (cookie != null && cookie.length) { clearInterval(eval("intervalId_" + sid)); eval("captcha_" + sid + " = cookie;"); var path = null; var domain = null; if (location) { domain = location.host; path = frontBaseHref.replace(/^\w+\:\/\/[^\/]+/, ''); } delCookie('captcha_' + sid, path, domain); } } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(val, fromIndex) { if (typeof(fromIndex) != 'number') { fromIndex = 0; } for (var index = fromIndex,len = this.length; index < len; index++) { if (this[index] == val) { return index; } } return -1; } } if (!Array.prototype.splice) { Array.prototype._splice = function(start) { if (start >= this.length) { return; } return this.slice(start); } Array.prototype._splice = function(start, deleteCount) { if (start >= this.length) { return; } return this.slice(0, start-1).concat(this.slice(start + deleteCount)); } } function cloneArray(source) { var destination = new Array(); for (var i = 0 ; i < source.length ; i++) { if (!(typeof(source[i]) == 'undefined')) { destination[i] = source[i]; } } return destination; } /* products comparison */ var mComparisonList = new Array (), mComparisonURL = ''; function compare(key) { if (compareProducts.indexOf(key) >= 0) { alert(compareInComparisonAlready); return false; } if (mComparisonList.length && !confirm(compareAddSelected)) { return false; } if (compareProducts.length == compareMaxQuantity) { alert(compareMaxMessage); return false; } if (mComparisonList.indexOf(key) < 0) { mComparisonList.push(key); } // check for different datasets if (compareDisallowDifferentDatasets && compareProducts.length > 0) { var datasetId = compareDatasetId; var _mComparisonList = cloneArray(mComparisonList); for (var i = 0, qty = _mComparisonList.length ; i < qty ; i++) { var p = _mComparisonList[i].split('-'); // p[2] is containing datasetId now if (!compareDatasetId) { compareDatasetId = p[2]; } if (compareDatasetId != p[2]) { if (!confirm(compareConfirmOtherDataset)) { return false; } break; } } } return mSubmitAddToCompare(); } function compareClear() { if (confirm(compareConfirmListClearing)) { document.location = location.pathname + '?action=compareClear'; } return false; } function mCompare(oCheckbox) { var key = oCheckbox.value; if (oCheckbox.checked) { // exclude duplicates if (compareProducts.indexOf(key) >= 0) { alert(compareInComparisonAlready); oCheckbox.checked = false; return false; } // check for max quantity of products to compare if (compareProducts.length == compareMaxQuantity) { alert(compareMaxMessage); oCheckbox.checked = false; return false; } // check for different datasets if (compareDisallowDifferentDatasets) { var p = key.split('-'); if ((compareProducts.length + mComparisonList.length) > 0 && p[2] != copmpareLastDatasetId && !confirm(compareConfirmOtherDataset)) { oCheckbox.checked = false; return false; } copmpareLastDatasetId = p[2]; // uncheck checked products having other dataset var _mComparisonList = cloneArray(mComparisonList); for (var i = 0, qty = _mComparisonList.length ; i < qty ; i++) { var p = _mComparisonList[i].split('-'); if (p[2] != copmpareLastDatasetId) { var o = document.getElementById('cmp_' + _mComparisonList[i]); o.checked = false; mCompare(o); } } // count real number of products to comapere after adding var _compareProducts = cloneArray(compareProducts); for (var i = 0, qty = compareProducts.length ; i < qty ; i++) { var p = compareProducts[i].split('-'); if (p[2] != copmpareLastDatasetId) { var index = _compareProducts.indexOf(compareProducts[i]); if (Array.prototype.splice) { _compareProducts.splice(index, 1); } else { _compareProducts = mComparisonList._splice(index, 1); } } } // check for max quantity of products to compare after manipulations if (_compareProducts.length + mComparisonList.length >= compareMaxQuantity) { alert(compareMaxMessage); oCheckbox.checked = false; return false; } } mComparisonList.push(key); } else { var index = mComparisonList.indexOf(key); if (index > -1) { if (Array.prototype.splice) { mComparisonList.splice(index, 1); } else { mComparisonList = mComparisonList._splice(index, 1); } copmpareLastDatasetId = compareDatasetId; } } } function mSubmitAddToCompare() { var qty = mComparisonList.length; if (!qty) { alert(compareListIsEmpty); return false; } var _mComparisonList = cloneArray(mComparisonList); // check for added already products and exclude its from mComparisonList for (var i = 0 ; i < qty ; i++) { var index = compareProducts.indexOf(_mComparisonList[i]); if (index >= 0) { // exclude duplicate product if (Array.prototype.splice) { mComparisonList.splice(_mComparisonList.indexOf(mComparisonList[i]), 1); } else { mComparisonList = mComparisonList._splice(_mComparisonList.indexOf(mComparisonList[i]), 1); } } } document.location = location.pathname + '?action=compare&products=' + _mComparisonList.join(';'); return false; } function mCompareSelected(url) { if (mComparisonList.length < 2) { if (mComparisonList.length < 1 && compareProducts.length > 1) { window.open(frontBaseHref + url + '?p=' + compareProducts.join(';') + '&h=&v=all&lay_id=100'); return false; } alert(compareListInsufficient); return false; } if (compareProducts.length && !confirm(compareConfirmPreviousClearing)) { return false; } window.open(frontBaseHref + url + '?p=' + mComparisonList.join(';') + '&h=&v=all&lay_id=100'); return false; } /* /products comparison */ function getXPos(elem){ x = 0; do { x += elem.offsetLeft; } while((elem = elem.offsetParent) != null); return x; } function getYPos(elem){ y = 0; do { y += elem.offsetTop; } while((elem = elem.offsetParent) != null); return y; } var calendarBlock; var calendarDateFieldName; function getCalendar(in_dateField, lang, dateFormat, divIdPrefix){ var elevPrefix = typeof(divIdPrefix) == 'undefined' ? '' : divIdPrefix; calendarTarget = in_dateField; calendarBlock = document.getElementById(elevPrefix + "calendar_block"); if(calendarBlock && (calendarBlock.style.display!="block" || (in_dateField.form.name + in_dateField.name!=calendarDateFieldName))){ calendarDateFieldName = in_dateField.form.name + in_dateField.name; cLeft = getXPos(calendarTarget)+calendarTarget.offsetWidth; cTop = getYPos(calendarTarget)+calendarTarget.offsetHeight; var dconfAddon = ''; if(typeof(dateFormat) != 'undefined' && dateFormat != ''){ dconfAddon = '&date_format='+dateFormat; } document.getElementById(elevPrefix + "calendar_block_frm").src = "calendar.php?v=2&lang="+lang+dconfAddon; calendarBlock.style.display="block"; var correctLeft = cLeft + calendarBlock.offsetWidth - document.body.scrollLeft - document.body.clientWidth; var correctTop = cTop + calendarBlock.offsetHeight - document.body.scrollTop - document.body.clientHeight; calendarBlock.style.left = cLeft - ((correctLeft > 0)?correctLeft:0) + 'px'; calendarBlock.style.top = cTop - ((correctTop > 0)?correctTop:0) + 'px'; document.getElementById(elevPrefix + "calendar_block_frm").contentWindow.document.body.focus(); }else if(calendarBlock){ calendarBlock.style.display="none"; } } function replaceDateTitle(objId){ var objObj = document.getElementById(objId); if(objObj){ var curDate = objObj.innerHTML; var rxToday = new RegExp(DATE_CONVERTION[2].replace(/\./g, "\\.")); var rxYesterday = new RegExp(DATE_CONVERTION[3].replace(/\./g, "\\.")); curDate = curDate.replace(rxToday, DATE_CONVERTION[0]); curDate = curDate.replace(rxYesterday, DATE_CONVERTION[1]); objObj.innerHTML = curDate; } } /* Пример использования календаря
дата:
*/ function saveURLHistory(){ var uh_prev_mod = getCookie('uh_prev_mod'); var uh_prev_url = getCookie('uh_prev_url'); var uh_curr_mod = getCookie('uh_curr_mod'); var uh_curr_url = getCookie('uh_curr_url'); delCookie('uh_prev_mod', "/"); delCookie('uh_prev_url', "/"); delCookie('uh_curr_mod', "/"); delCookie('uh_curr_url', "/"); if(uh_curr_mod == null){ setCookie('uh_prev_mod', active_module, "/"); setCookie('uh_prev_url', active_module_link, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); }else if(uh_curr_mod != active_module){ setCookie('uh_prev_mod', uh_curr_mod, "/"); setCookie('uh_prev_url', uh_curr_url, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); }else{ setCookie('uh_prev_mod', uh_prev_mod, "/"); setCookie('uh_prev_url', uh_prev_url, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); } } saveURLHistory(); function amiFrontCommonClass(){ this.serialize = function(oData){ var result = ''; if(typeof(oData) == "object"){ if(oData instanceof Array){ result += 'a'; for(var i = 0; i < oData.length; i++){ var item = oData[i].toString(); result += item.length.toString() + '.' + item; } }else{ result += 'o'; for(var oKey in oData){ result += oKey.length.toString() + '.' + oKey + oData[oKey].length.toString() + '.' + oData[oKey]; } } } return result; } this.unserialize = function(oString){ var oData = null; if(oString.charAt(0) == 'a' || oString.charAt(0) == 'o'){ var isArray = oString.charAt(0) == 'a'; if(isArray){ oData = new Array(); }else{ oData = new Object(); } var dataLength = ''; var isShouldBeKey = isArray ? false : true; var keyValue = ''; for(var i = 1; i < oString.length; i++){ if(oString.charAt(i).match(/\d/)){ dataLength += oString.charAt(i); }else if(oString.charAt(i) == '.'){ dataLength = parseInt(dataLength); if(isShouldBeKey){ keyValue = oString.substr(i + 1, dataLength); isShouldBeKey = false; }else{ if(isArray){ oData[oData.length] = decodeURIComponent(oString.substr(i + 1, dataLength)); }else{ oData[keyValue] = decodeURIComponent(oString.substr(i + 1, dataLength)); isShouldBeKey = true; } keyValue = ''; } i = i + dataLength; dataLength = ''; } } } return oData; } } var amiFrontCommon = new amiFrontCommonClass(); function amiSessionClass(cookieName, sessionCookieName, cookieDays, cookieHours){ this.sessionCookieName = sessionCookieName; this.cookieName = cookieName; this.cookieDays = cookieDays; this.cookieHours = cookieHours; this.variables = new Object(); this.init = function(){ this.loadVariables(); } this.setCookieName = function(value){ this.cookieName = value; } this.setCookieLifetime = function(iDays, iHours){ this.cookieDays = iDays; this.cookieHours = iHours; } this.set = function(name, value){ this.variables[name] = value; this.storeVariables(); } this.del = function(name){ delete this.variables[name]; this.storeVariables(); } this.get = function(name){ if(typeof(this.variables[name]) != 'undefined'){ return this.variables[name]; } return ''; } this.storeVariables = function(){ var sVariables = amiFrontCommon.serialize(this.variables); setCookie(this.cookieName, sVariables, '/', this.cookieDays, this.cookieHours, true); } this.loadVariables = function(){ var sessionCookie = getCookie(this.sessionCookieName); if(sessionCookie != null){ var sVariables = getCookie(this.cookieName, true); this.variables = new Object(); if(sVariables != null){ this.variables = amiFrontCommon.unserialize(sVariables); if(typeof(this.variables) != 'object'){ this.variables = new Object(); } } }else{ delCookie(this.cookieName); } } this.init(); } var amiSession = new amiSessionClass('user_session', sessionCookieName, 30, 0); //updateCookieExpireTime('user_session', sessionTimeout); function amiGetUsername(source){ var res; if(source == 'username'){ res = amiSession.get('username_cookie'); }else{ res = amiSession.get('firstname_cookie') + ' ' + amiSession.get('lastname_cookie'); res = res.replace(/^\s*/, '').replace(/\s*$/, ''); } return res; } var ratingForms = {}; function addRatingForm(formName, itemId){ ratingForms[formName] = itemId; } function checkRatingForms(moduleName){ var ratings = AMI.Browser.Cookie.get('moduleRatings'); if(ratings){ var modules = ratings.split(';'); for(var i=0; i 1)){ for(var j=1; j< 3; hexpair++) { var onebyte = value & 0xFF; // get low onebyte value >>= 8; // drop low onebyte var nybble2 = onebyte & 0x0F; // get low nybble (4 bits) var nybble1 = (onebyte >> 4) & 0x0F; // get high nybble hex_string += nybble1.toString(16); // convert nybble to hex hex_string += nybble2.toString(16); // convert nybble to hex } return hex_string.toUpperCase(); } function flagMapAdd(name, num, isCr){ if(!isNaN(num)){ mapID = -1; for(i = 0; i < flagNames.length; i++){ if(flagNames[i] == name){ mapID = i; break; } } if(mapID == -1){ mapID = flagNames.length; flagNames[mapID] = name; flagMaps[mapID] = new Array(); } if(flagMaps[mapID].length < num){ for(i = 0; i < num; i++) if(!flagMaps[mapID][i]) flagMaps[mapID][i] = 0; } if(!isCr) flagMaps[mapID][num-1] = 1; } } function arrToHex(arrIn){ realValTmp = ""; realVal = ""; var tmp = ""; var isLastProcessed = true; for(k = 1; k <= arrIn.length; k++){ isLastProcessed = false; tmp = arrIn[k-1]+tmp; if(k % 4 == 0){ realValTmp += parseInt(tmp, 2).toString(16); tmp = ""; isLastProcessed = true; } } if(!isLastProcessed) realValTmp += parseInt(tmp, 2).toString(16); hexZeroStart = true; for(k = realValTmp.length-1; k >= 0; k--){ if(realValTmp.substr(k, 1) != "0" || !hexZeroStart){ realVal += realValTmp.substr(k, 1); hexZeroStart = false; } } return realVal; } function CheckFilterForms(fform, isSearchForm, isOrder, skipOffestSetting) { var forceSubmitUrl; var _tmpVarName; _tmpVarName = fform.name + "_forceSubmitUrl"; forceSubmitUrl = eval("if(typeof("+_tmpVarName+") != 'undefined') {"+_tmpVarName+"} else {''}"); if(isOrder != 1) isOrder = 0; // special run over checkbox filter fields //if() for(var i=0; i<= 0){ val = (el.checked)?1:0; el.value = val; cname=el.name; if(fform.elements[cname] && (fform.elements[cname].type=='hidden')){ if(typeof(fform.elements["enc_"+cname])=='object') { fform.elements["enc_"+cname].value = val; } fform.elements[cname].value = val; } } } if(typeof(skipOffestSetting) == 'undefined'){ if(typeof(fform.elements['offset'])=='object') { fform.elements['offset'].value = 0; } if(typeof(fform.elements['enc_offset'])=='object') { fform.elements['enc_offset'].value = 0; } } // Create the submit URL flagNames = new Array(); flagMaps = new Array(); var submitURL = ''; if(forceSubmitUrl != '') { submitURL = forceSubmitUrl; }else{ submitURL = _cms_script_link; } for(var i=0; i < fform.length; i++){ el = fform.elements[i]; elName = el.name; if(el.name.indexOf("prop_") >= 0 && isOrder){ if((fpos = el.name.lastIndexOf("_x")) >= 0){ elName = el.name.substr(0, fpos); } elName += "[]"; } if(el.type == 'checkbox'){ if(el.checked){ if((fpos = el.name.indexOf("_flag_")) >= 0){ flagMapAdd(el.name.substr(0, fpos), parseInt(el.name.substr(fpos+6)), 0); }else if(el.value != ''){ submitURL += '&'+elName+'='+encodeURIComponent(el.value); } }else{ if((fpos = el.name.indexOf("_flag_")) >= 0){ flagMapAdd(el.name.substr(0, fpos), parseInt(el.name.substr(fpos+6)), 1); }else{ //if(el.name.indexOf("[]") <= 0) /* do not process array items */ // submitURL += '&'+elName+'='; } } }else if(el.type == 'select-one'){ if((fpos = el.name.indexOf("_flag")) >= 0){ flagMapAdd(el.name.substr(0, fpos), parseInt(el.value), 0); }else if(el.value != ''){ submitURL += '&'+elName+'='+encodeURIComponent(el.value); } }else if(el.type == 'select-multiple'){ fpos = el.name.indexOf("_flag"); for(k = 0; k < el.length; k++){ if(el.options[k].selected){ if(fpos >= 0){ flagMapAdd(el.name.substr(0, fpos), parseInt(el.options[k].value), 0); }else{ submitURL += '&'+encodeURIComponent(elName)+'='+encodeURIComponent(el.options[k].value); } } } }else if(el.type == 'radio'){ if(el.checked){ if((fpos = el.name.indexOf("_flag")) >= 0){ flagMapAdd(el.name.substr(0, fpos), parseInt(el.value), 0); }else{ submitURL += '&'+elName+'='+encodeURIComponent(el.value); } } }else{ if(el.name == "action" && ((!isOrder && fform.search_subcats && fform.search_subcats.checked) || isSearchForm)) { submitURL += '&action=search'; } else if(el.value != '' && elName != 'btnFlt_apply' && (!isOrder || el.name != "action" && el.name != "order")) { submitURL += '&'+elName+'='+encodeURIComponent(el.value); } } } for(i = 0; i < flagMaps.length; i++){ if(flagNames[i]){ submitURL += '&'+flagNames[i]+'=0x'+arrToHex(flagMaps[i]); } } if(isOrder) submitURL += 'eshop_special=1&action=add'; document.location.href=submitURL; return false; } function checkSearchForms(fform, fltFormName) { if(typeof(fltFormName) != 'undefined') { _cms_document_form = fltFormName; } else if(typeof(_cms_document_form) == 'undefined') { _cms_document_form = _cms_filter_form; } var sform = document.forms[_cms_document_form]; // special run over checkbox filter fields for(var i=0; iExample of inheriting classes: * parentClass = function(param1, param2){} * childClass = function(param1, param2){ * AMI.ModuleComponentCustom.superclass.constructor.call(this, param1, param2); * // Child class methods further * } * AMI.inherit(childClass, parentClass); * * @param {function} oChildClass Class that should be inherited. * @param {function} oParentClass Parent class object. * @returns {void} */ inherit: function(oChildClass, oParentClass){ var oTmp = function(){}; oTmp.prototype = oParentClass.prototype; oChildClass.prototype = new oTmp(); oChildClass.prototype.constructor = oChildClass; oChildClass.superclass = oParentClass.prototype; }, /** * Find element in DOM by id, class or tag. * * @param {string} search Search string in format "#idOfElement" or ".classNameOfElement" or "tagName". * @param {DOM object} oParent DOM element where target element will be searched. * @returns {mixed} Found element or null in case of search by ID, array of elements in other search cases. */ find: function(search, oParent){ oParent = oParent || document; if(search.lastIndexOf('[') >= 0){ var parts = search.match(/\[(.*)\]/ig); if(typeof(parts[0]) != 'undefined'){ parts = parts[0].split('='); if(parts.length == 2){ var attribute = parts[0].substr(1); var value = parts[1].substr(0, parts[1].length-1); } search = search.substr(0, search.lastIndexOf('[')); } } var result = null; var singleObject = false; if(search.length > 0){ if(search.substr(0, 1) == '#'){ result = document.getElementById(search.substr(1)); singleObject = true; }else if(search.substr(0, 1) == '.'){ search = search.substr(1); if(oParent.getElementsByClassName){ result = oParent.getElementsByClassName(search); }else{ var aElements = oParent.getElementsByTagName('*'); var aResult = []; for(var i = 0; i < aElements.length; i++){ var rx = new RegExp('(^| )' + search + '( |$)', 'i'); if(rx.test(aElements[i].className)){ aResult.push(aElements[i]); } } result = aResult; } }else{ result = oParent.getElementsByTagName(search); } }else{ result = oParent.getElementsByTagName('*'); } // Check attributes if needed if((result != null) && (typeof(attribute) != 'undefined') && (typeof(value) != 'undefined')){ var res = null; if(!singleObject){ for(var i=0; i < result.length; i++){ var element = result[i]; var val = (element.getAttribute && element.getAttribute(attribute)) || null; if( !val ) { var attrs = element.attributes; var length = attrs.length; for(var j = 0; j < length; j++){ if(attrs[j].nodeName === attribute){ val = attrs[j].nodeValue; } } } if(val == value){ if (res == null){ res = []; } res.push(element); } } result = res; }else{ if((typeof(result.attributes[attribute]) == 'undefined') || (result.attributes[attribute] != value)){ result = null; } } } return result; }, /** * Animated scroll to any object on page. * * @param {DOM object} oElement DOM element to scroll to. * @param {number} paddingLeftTop Padding from left and top (equal) that shold be left after scrolling if possible. * @returns {void} */ scrollTo: function(oElement, paddingLeftTop){ /** * @private */ this.move = function(){ this.step ++; if(this.step == this.numberOfSteps){ this.currentPosition[0] = this.aMoveTo[0]; this.currentPosition[1] = this.aMoveTo[1]; }else{ this.currentPosition[0] += (this.aMoveTo[0] - this.currentPosition[0]) / (this.numberOfSteps - this.step); this.currentPosition[1] += (this.aMoveTo[1] - this.currentPosition[1]) / (this.numberOfSteps - this.step); } AMI.Browser.setDocumentLeft(this.currentPosition[0]); AMI.Browser.setDocumentTop(this.currentPosition[1]); if(this.currentPosition[0] != this.aMoveTo[0] || this.currentPosition[1] != this.aMoveTo[1]){ setTimeout(function(_this){return function(){_this.move()}}(this), 10); } } this.oElement = oElement; this.numberOfSteps = 15; this.step = 0; if(typeof(this.oElement) == 'object'){ this.aMoveTo = AMI.Browser.getObjectPosition(this.oElement); if(typeof(paddingLeftTop) != 'undefined'){ this.aMoveTo[0] = Math.max(0, this.aMoveTo[0] - paddingLeftTop); this.aMoveTo[1] = Math.max(0, this.aMoveTo[1] - paddingLeftTop); } this.currentPosition = [AMI.Browser.getDocumentLeft(), AMI.Browser.getDocumentTop()]; this.move(); } } }; /* * FILE END: _shared/code/js/ami.js */ /* * FILE START: _shared/code/js/ami.browser.js */ AMI.Browser = { isIE: document.swapNode, isIOS: navigator.appVersion.indexOf('iPad;') >= 0 || navigator.appVersion.indexOf('iPhone;') >= 0 || navigator.appVersion.indexOf('iPod;') >= 0, isSensor: this.isIOS || navigator.appVersion.indexOf('Android') >= 0 || navigator.appVersion.indexOf('Symbian') >= 0 || navigator.appVersion.indexOf('Windows CE') >= 0, isLowResolution: screen.width <= 800 || screen.height <= 480, getWindowWidth : function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; } return oWindow.document.compatMode == 'CSS1Compat' ? oWindow.document.documentElement.clientWidth : oWindow.document.body.clientWidth; }, getWindowHeight : function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; } return oWindow.document.compatMode == 'CSS1Compat' ? oWindow.document.documentElement.clientHeight : oWindow.document.body.clientHeight; }, getDocumentWidth : function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; } return Math.max(oWindow.document.compatMode != 'CSS1Compat' ? oWindow.document.body.scrollWidth : oWindow.document.documentElement.scrollWidth, this.getWindowWidth(oWindow)); }, getDocumentHeight : function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; } return Math.max(oWindow.document.compatMode != 'CSS1Compat' ? oWindow.document.body.scrollHeight : oWindow.document.documentElement.scrollHeight, this.getWindowHeight(oWindow)); }, getDocumentLeft: function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; var oDocument = document; }else{ oDocument = oWindow.document; } return oWindow.pageXOffset || (oDocument.documentElement && oDocument.documentElement.scrollLeft) || (oDocument.body && oDocument.body.scrollLeft); }, getDocumentTop: function(oWindow){ if(typeof(oWindow) == 'undefined'){ oWindow = window; var oDocument = document; }else{ oDocument = oWindow.document; } return oWindow.pageYOffset || (oDocument.documentElement && oDocument.documentElement.scrollTop) || (oDocument.body && oDocument.body.scrollTop); }, setDocumentLeft: function(value){ if(document.documentElement){ document.documentElement.scrollLeft = value; }else if(document.body){ document.body.scrollLeft = value; } }, setDocumentTop: function(value){ if(document.documentElement){ document.documentElement.scrollTop = value; }else if(document.body){ document.body.scrollTop = value; } }, getPointerPosition : function(oEvent){ var aData = new Array(0, 0); oEvent = AMI.Browser.Event.validate(oEvent); if(oEvent.pageX || oEvent.pageY){ aData[0] = oEvent.pageX; aData[1] = oEvent.pageY; }else if(oEvent.clientX || oEvent.clientY){ aData[0] = oEvent.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; aData[1] = oEvent.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop; } return aData; }, getObjectPosition : function(oObject, bStopOnRelative){ if(typeof(bStopOnRelative) == 'undefined'){ bStopOnRelative = false; } var aData = new Array(0, 0); do{ if(bStopOnRelative){ var positionStyle = AMI.Browser.DOM.getStyle(oObject, 'position'); if(positionStyle == 'relative' || positionStyle == 'absolute' || positionStyle == 'fixed'){ break; } } aData[0] += oObject.offsetLeft; aData[1] += oObject.offsetTop; }while((oObject = oObject.offsetParent) != null); return aData; }, getCaretPosition : function(textObject){ var result = 0; textObject.focus(); if(textObject.selectionStart){ result = textObject.selectionStart; }else if(document.selection){ var rangeSelect = document.selection.createRange(); rangeSelect.collapse(true); var rangeObject = textObject.createTextRange(); if(rangeObject.inRange(rangeSelect)){ rangeObject.setEndPoint('EndToEnd', rangeSelect); result = rangeObject.text.length } } return result; }, setCaretPosition : function(textObject, position){ textObject.focus(); if(textObject.selectionStart){ textObject.selectionStart = position; textObject.selectionEnd = position; }else if(document.selection){ var rangeObject = textObject.createTextRange(); rangeObject.move('character', position); rangeObject.select(); } }, setOpacity: function(oElement, iOpacity){ if(typeof(oElement.style.MozOpacity) != "undefined"){ oElement.style.MozOpacity = iOpacity; }else if(typeof(oElement.style.opacity) != "undefined"){ oElement.style.opacity = iOpacity; }else if(typeof(oElement.style.KhtmlOpacity) != "undefined"){ oElement.style.KhtmlOpacity = iOpacity; }else{ oElement.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (iOpacity * 100) + ");"; } } } /* * FILE END: _shared/code/js/ami.browser.js */ /* * FILE START: _shared/code/js/ami.browser.cookie.js */ AMI.Browser.Cookie = { set : function(sName, sValue, iHours){ var oDate = new Date(); if(typeof(iHours) == "undefined"){ iHours = 1; } oDate.setHours(oDate.getHours() + iHours); this.del(sName); document.cookie = sName + "=" + escape(sValue) + "; path=/; expires="+oDate.toGMTString(); }, del : function(sName) { if(this.get(sName)){ document.cookie = sName + "=" + "; path=/ ;expires=Thu, 01-Jan-1970 00:00:01 GMT"; } }, get : function(sName){ var aCookie = document.cookie.split("; "); var value = ""; for(var i = 0; i < aCookie.length; i++){ var aCrumb = aCookie[i].split("="); if(sName == aCrumb[0]){ if(typeof(aCrumb[1]) == 'undefined'){ value = null; }else{ value = unescape(aCrumb[1]); } return value; } } return null; } } /* * FILE END: _shared/code/js/ami.browser.cookie.js */ /* * FILE START: _shared/code/js/ami.browser.event.js */ AMI.Browser.Event = { validate: function(oEvent){ return oEvent ? oEvent : window.event; }, getTarget: function(oEvent){ oEvent = this.validate(oEvent); return oEvent.srcElement || oEvent.target; }, fire: function(oTarget, sEvent){ if(document.createEventObject){ var oEvent = document.createEventObject(); oTarget.fireEvent('on' + sEvent, oEvent); }else if(document.createEvent){ var oEvent = document.createEvent("HTMLEvents"); oEvent.initEvent(sEvent, true, true); oTarget.dispatchEvent(oEvent); }else{ return false; } return true; }, addHandler: function(oTarget, sEvent, oHandler){ if(typeof(oTarget.addEventListener) != 'undefined'){ if(sEvent == 'mousewheel'){ // Mozilla hack oTarget.addEventListener('DOMMouseScroll', oHandler, false); } oTarget.addEventListener(sEvent, oHandler, false); }else{ oTarget.attachEvent('on' + sEvent, oHandler); } }, removeHandler: function(oTarget, sEvent, oHandler){ if(typeof(oTarget.removeEventListener) != 'undefined'){ if(sEvent == 'mousewheel'){ sEvent = 'DOMMouseScroll'; } oTarget.removeEventListener(sEvent, oHandler, false); }else if(oTarget.detachEvent){ oTarget.detachEvent('on' + sEvent, oHandler); } }, stopProcessing: function(oEvent){ oEvent = this.validate(oEvent); if(typeof(oEvent.stopPropagation) != 'undefined'){ oEvent.stopPropagation(); }else if(typeof(oEvent.cancelBubble) != 'undefined'){ oEvent.cancelBubble = true; } if(typeof(oEvent.preventDefault) != 'undefined'){ oEvent.preventDefault(); }else{ oEvent.returnValue = false; } } } /* * FILE END: _shared/code/js/ami.browser.event.js */ /* * FILE START: _shared/code/js/ami.browser.dom.js */ AMI.Browser.DOM = { create: function(sTagName, sId, sClassName, sStyles, oParentNode){ var oObject = document.createElement(sTagName); if(typeof(sId) != 'undefined' && sId != ''){ oObject.id = sId; } if(typeof(sClassName) != 'undefined' && sClassName != ''){ oObject.className = sClassName; } if(typeof(sStyles) != 'undefined' && sStyles != ''){ oObject.style.cssText = sStyles; } return oParentNode == null ? oObject : this.append(oParentNode, oObject); }, append: function(oParentNode, oNode){ return oParentNode.appendChild(oNode); }, remove: function(oNode){ oNode.parentNode.removeChild(oNode); return this; }, setInnerHTML: function(oNode, HTML){ var aJavaScripts = []; // TODO: get back comments replacement. Commented because amiro-template structure //HTML = HTML.replace(//ig, '').replace(/( Яндекс.Метрика