//ajax queue manager var ajaxQueue = $.manageAjax.create('queue', {queue: true,preventDoubbleRequests:true,cacheResponse: false}); var loadQueue=[]; var loadId=0; $(window).unload(function() { ajaxQueue.clear(true); }); var mouseX = 0; var mouseY = 0; jQuery(document).ready( function() { $("#MiddleLayouts").click( function(e) { mouseX = e.pageX; mouseY = e.pageY; }); }); function stopEvent(event){ if(event != null) { if ('stopPropagation' in event) { event.stopPropagation(); event.preventDefault(); } else { event.cancelBubble= true; event.returnValue= false; } } } /* * function changeImage(form,img,pathURL) { var infoText = "Favori Listesin"; * var onImg = "images/main/ico_favori01.gif"; var offImg = * "images/main/ico_favori02.gif"; var divId = "favoriText"; * * if (img.id == 'comparisonImg'){ infoText = "Karşılaştırma Listesin"; onImg = * "images/main/ico_karsilastir2.gif"; offImg = * "images/main/ico_karsilastir1.gif"; divId = "comparisonText"; } * * with(form){ img.src=pathURL; setTimeout('',3000); if (img.name==1) { * //alert(infoText + " eklenmiştir !!!"); * document.getElementById(divId).innerHTML = infoText+"den Çıkart "; * img.src=onImg; img.name=0; } else { //alert(infoText + " çıkarılmıştır !!!"); * document.getElementById(divId).innerHTML = infoText+"e Ekle"; img.src=offImg; * img.name=1; } } * * updateFrame('productSuggestions'); } */ /* AJAX */ function compareMe(psi, c, sc, img) { img.src = imageprop.working; if (img.name == 0) { remComp(psi, c, img); img.name = 1; } else { addComp(psi, c, sc, img); img.name = 0; } } function addComp(psi, c, sc, img) { comparison.addToComparison(psi, c, sc); img.src = imageprop.addCompareDetailPage; $('#comparisonText').html(errormsg.removeFromComparison); } function remComp(psi, c, img) { comparison.removeFromComparison(psi, c); img.src = imageprop.removeCompareDetailPage; $('comparisonText').html(errormsg.addToComparison); } function kangurumCompareMe(psi, c, sc, img) { img.src = imageprop.working; if (img.name == 0) { kangurumRemComp(psi, c, img); img.name = 1; } else { kangurumAddComp(psi, c, sc, img); img.name = 0; } } function kangurumRemComp(psi, c, img) { comparison.removeFromComparison(psi, c); img.src = imageprop.removeCompareListingPage; img.alt = errormsg.addToComparison; } function kangurumAddComp(psi, c, sc, img) { comparison.addToComparison(psi, c, sc); img.src = imageprop.addCompareListingPage; img.alt = errormsg.removeFromComparison; } function kangurumFavoriteMe(psi, img) { img.src = imageprop.working; favorites.addToFavorites(psi); if (img.name == 0) { img.name = 1; img.src = imageprop.activeFavoritesKangurum; img.alt = errormsg.addToFavorite; } else { img.name = 0; img.src = imageprop.passiveFavoritesKangurum; img.alt = errormsg.removeFromFavorite; } } function favoriteMe(psi, img) { img.src = imageprop.working; favorites.addToFavorites(psi); if (img.name == 0) { img.name = 1; img.src = imageprop.passiveFavoritesMigrosDetail; $('favoriText').html(errormsg.addToFavorite); } else { img.name = 0; img.src = imageprop.activeFavoritesMigrosDetail; $('favoriText').html(errormsg.removeFromFavorite); } } function changeFav(psi, img) { img.src = imageprop.working; favorites.addToFavorites(psi); if (img.name == 1) { img.name = 0; img.src = imageprop.activeFavoritesMigrosDetail; img.alt = errormsg.removeFromFavorite; } else { img.name = 1; img.src = imageprop.passiveFavoritesMigrosDetail; img.alt = errormsg.addToFavorite; } } function changeFavSmall(psi, img) { img.src = imageprop.working; favorites.addToFavorites(psi); if (img.name == 1) { img.name = 0; img.src = imageprop.activeFavoriteMigrosList; img.alt = errormsg.removeFromFavorite; } else { img.name = 1; img.src = imageprop.passiveFavoriteMigrosList; img.alt = errormsg.addToFavorite; } } /* AJAX */ /* ADDTOCART */ /* return true only if there is no filled or different from zero input texts with the name amounts*/ function checkAmounts(form, counter, prefix) { return $("form[name='" + form.name + "'] :input[name" + (counter != null ? "$='" + prefix + counter + "']" : "^='" + prefix + "']") + ":nonZero").length == 0; } /* return -1 if product has no stock. return 0 if given amount is bigger than the stock amount. otherwise returns 1 */ function checkStockAmounts(form, counter, prefix) { var returnFlag = 1; $("form[name='" + form.name + "'] :input[name" + (counter != null ? "$='" + prefix + counter + "']" : "^='" + prefix + "']") + ":filled:nonZero").each(function() { var inputPostfix = this.name.replace(prefix,''); var stockAmount = parseInt($("form[name='" + form.name + "'] :input[name$='stockAmount" + (inputPostfix != "" ? "_" + inputPostfix : "") + "']").val()); if($("form[name='" + form.name + "'] :input[name$='isOnStock" + (inputPostfix != "" ? "_" + inputPostfix : "") + "']").val() == "false") { returnFlag = -1; return; } if(stockAmount > 0 && parseInt(this.value) > stockAmount) { returnFlag = 0; return; } }); return returnFlag; } /* returns true if one of the input texts value is bigger than 99. if counter is specified, it checks only the specified input text.*/ function checkMaxAmount(form, counter, prefix) { return $("form[name='" + form.name + "'] :input[name" + (counter != null ? "$='" + prefix + counter + "']" : "^='" + prefix + "']") + ":maxCheck").length > 0; } function allInOneCheck(form, counter, prefix, showDefault) { var returnValue = errormsg.zeroAmount; if(showDefault === false) returnValue = ""; $("form[name='" + form.name + "'] :input[name" + (counter != null ? "='" + prefix + counter + "']" : "^='" + prefix + "']") + ":nonZero").each(function() { if (returnValue != "") returnValue = ""; var floatValue = parseFloat(this.value); if (floatValue > 99.9) { returnValue = errormsg.maxAmount;return false; } var inputPostfix = this.name.replace(prefix, ''); inputPostfix = (inputPostfix != "" ? "_" + inputPostfix : ""); var isOnStockElement = form.elements["isOnStock" + inputPostfix]; if (isOnStockElement != null && isOnStockElement.value == "false") { returnValue = errormsg.noStock;return false; } stockAmountElement = form.elements["stockAmount" + inputPostfix]; if(stockAmountElement != null) { var stockAmount = parseInt(form.elements["stockAmount" + inputPostfix].value); if (stockAmount > 0 && floatValue > stockAmount){ returnValue = errormsg.stockAmountExceeded;return false; } } }); return returnValue; } /* Apply amount check controls inside. if can't find any problem, returns false */ function showAmountWarnings(form, counter, prefix, showDefault) { if(prefix === null) prefix = "amounts_"; if(typeof showDefault === "undefined") showDefault = true; var errorMessage = allInOneCheck(form, counter, prefix, showDefault); if(errorMessage != "") { alert(errorMessage); return true; } return false; } function addToBasketMultipleSubmit(form,destUrl) { if(showAmountWarnings(form, null, null) == true) return true; document.forms[form.name].action = destUrl; document.forms[form.name].submit(); } function addToBasketMultiple(form, destUrl, productModelId) { if(showAmountWarnings(form, null, null) == true) return true; refreshBasket(form, destUrl, null, productModelId); return true; } function addToBasketMultipleGo(form, destUrl, attrUri, productModelId) { if (showAmountWarnings(form, null, null, false) != true) { document.getElementById('returnuri').value = attrUri; refreshBasket(form, destUrl, attrUri, productModelId); document.location = attrUri; } } function addToBasketMultipleTabGo(form, destUrl, attrUri, productModelId, targetTab, activeTab) { if(showAmountWarnings(form, null, null, false) != true) { document.getElementById('returnuri').value = attrUri; refreshBasket(form, destUrl, null, productModelId); tabChangeDynamic(targetTab, activeTab, attrUri); return true; } } function addToBasket(form, destUrl, productModelId) { if(showAmountWarnings(form, null, "amount") == true) return true; refreshBasket(form, destUrl, null, productModelId); return true; } function addToBasketForIconSepetOnProductListing(form, destUrl, counter,productModelId) { if(showAmountWarnings(form, counter, null) == true) return true; destUrl = destUrl + "&amount=" + $(":input[name$='amounts_"+counter+"']").val(); refreshBasket(null, destUrl, null, productModelId); return true; } function addToBasketUrl(destUrl, productModelId) { refreshBasket(null, destUrl, null, productModelId); } /* BASKET PROCESS */ function basketChangeDynamic(targetlink) { var basketContentObj = document.getElementById('MPL_Basket_Content'); var basketWorkingObj = document.getElementById('KNG_Basket_Working'); if (basketContentObj != null) { basketContentObj.style.display = "none"; basketWorkingObj.style.display = ""; } if (targetlink != "null"){ if(document.getElementById('basketOverlay')==undefined){ showBasketOverLay(); } dwrUtils.forwardPage(targetlink, basketContent); } } function basketContent(data) { var basketContentObj = document.getElementById('MPL_Basket_Content'); var basketWorkingObj = document.getElementById('KNG_Basket_Working'); if (basketContentObj != null) { basketWorkingObj.style.display = "none"; basketContentObj.style.display = ""; basketContentObj.innerHTML = data; } removeBasketOverLay(); if(loadQueue.length>0) $("#"+loadQueue.shift()).remove(); } function refreshBasket(form, destUrl, attrUri, productModelId) { var queryString = ""; var returnurival = ""; if (form != null){ returnurival = $('input[name=returnuri]').val(); $('input[name=returnuri]').val(""); queryString = $(form).serialize(); } ajaxQueue.add( { beforeSend: function (XMLHttpRequest) { showBasketOverLay(); waitingProductAdd(productModelId); //$('
').attr("id","basketOverlay").addClass('basket_modal_bg').appendTo("body").show(); //$("#MPL_Basket_Content").prepend($('
').attr("id","basketOverlay").addClass('basket_modal_bg').show()); }, url :destUrl, data :queryString, type :"POST", cache :false, success : function() { $(".basketDiv").css({'display' :''}); basketChangeDynamic('/dwrUpdateBasket.do'); $('input[name=returnuri]').val(returnurival); } }); } function showBasketOverLay(){ $('
').attr("id","basketOverlay").addClass('basket_modal_bg').appendTo("body").show(); } function removeBasketOverLay(){ $('#basketOverlay').remove(); } function waitingProductAdd(productModelId){ var loadDivId= "t-gen-1138" + (loadId++); if (productModelId != null) { $("
Sepetinize Ekleniyor
").prependTo(productModelId); var position = $(productModelId).position(); var width = $(productModelId).width(); var tmpWidth = 45; var positionLeft = (width / 2) - tmpWidth; $("#"+loadDivId).css( { 'left' :position.left, 'top' :position.top, 'width' :$(productModelId).width(), 'height' :$(productModelId).height(), 'padding-left' :$(productModelId).css('padding-left'), 'padding-right' :$(productModelId).css('padding-right'), 'padding-top' :$(productModelId).css('padding-top'), 'padding-bottom' :$(productModelId).css('padding-bottom'), 'margin-left' :$(productModelId).css('margin-left'), 'margin-right' :$(productModelId).css('margin-right'), 'margin-bottom' :$(productModelId).css('margin-bottom'), 'margin-top' :$(productModelId).css('margin-top') }); $(".t-lm-msg").css({'left' :positionLeft}); } else { if (mouseY == 0) { $("#MiddleLayouts").trigger('click'); } var winW = $(document).width(); $("
Sepetinize Ekleniyor
").prependTo('body'); $("#t-gen-1201").css('top', mouseY);$("#t-gen-1201").css('left', winW / 2 - $("#t-gen-1201").width() / 2);$("#t-gen-1201").fadeIn(2000); } loadQueue.push(loadDivId); } function submitSort(form, destUrl) { form.action = destUrl; form.submit(); } function openWindowNoEvent(destUrl, winName, winProps) { var win = window.open(destUrl, winName, winProps); win.focus(); return false; } function updateFrame(frameName) { if (frameName != '') { /* check if this is a framed page */ if ((top != self)) { /* decide which frame to update */ if (frameName == 'content') { parent.content.location.reload(); } else if (frameName == 'rightInformation') { parent.rightInformation.location.reload(); } else if (frameName == 'shoppingCarts') { parent.shoppingCarts.location.reload(); } else if (frameName == 'productSuggestions') { parent.productSuggestions.location.reload(); } } else { /* do nothing */ } } } function getCheckedRadio(theRadioGroup) { var val = null; for ( var i = 0; i < theRadioGroup.length; i++) { if (theRadioGroup[i].checked) { val = theRadioGroup[i].value; break; } /* if checked */ } /* for i */ return val; } var _pTitleYemek = new Image(); _pTitleYemek.src = 'images/main/TR/icon_title_yemek01.gif'; var _pCloseYemek = new Image(); _pCloseYemek.src = 'images/main/icon_y_pop_close01.gif'; var _pTitleOneri = new Image(); _pTitleOneri.src = 'images/main/TR/icon_title_oneriurun01.gif'; function yemekTarifPopUpShow(paramObj, tasteDetailPath, tasteImgPath, tasteName, productDetailPath, message01, message02) { var _main = document.getElementById('main'); var _x = getElementPos(paramObj, 'x'); var _mainX = getElementPos(_main, 'x'); var _y = getElementPos(paramObj, 'y'); var _tempDiv = document.getElementById('kangTempXY'); var _pCont = ''; _pCont = '
'; _pCont += '
\' width="176" height="40" />
'; _pCont += '
'; _pCont += '
'; _pCont += '
'; _pCont += '
'; _pCont += message01; _pCont += '

'; _pCont += ''; _pCont += ' '; _pCont += ' '; _pCont += ' '; _pCont += ' '; _pCont += '
 '; _pCont += tasteName; _pCont += '

'; _pCont += ''; _pCont += '
'; _pCont += '
'; /* alert('x:' + _x + '\ny:' + _y); */ _tempDiv.innerHTML = ''; _tempDiv.style.display = 'block'; _tempDiv.style.marginTop = _y + 'px'; _tempDiv.style.marginLeft = _x - _mainX + 'px'; _tempDiv.style.width = 230 + 'px'; _tempDiv.innerHTML = _pCont; } function yildizliPopUpShow(paramObj, productAdviceDetailPath, productAdviceImgPath, productAdviceName, productPrice, productPriceSymbol, productDetailPath, message01) { var _main = document.getElementById('main'); var _x = getElementPos(paramObj, 'x'); var _mainX = getElementPos(_main, 'x'); var _y = getElementPos(paramObj, 'y'); var _tempDiv = document.getElementById('kangTempXY'); var _pCont = ''; _pCont = '
'; _pCont += '
\' width="176" height="40" />
'; _pCont += '
'; _pCont += '
'; _pCont += ' '; _pCont += '
'; /* alert('x:' + _x + '\ny:' + _y); */ _tempDiv.innerHTML = ''; _tempDiv.style.display = 'block'; _tempDiv.style.marginTop = _y + 'px'; _tempDiv.style.marginLeft = _x - _mainX + 'px'; _tempDiv.style.width = 230 + 'px'; _tempDiv.innerHTML = _pCont; } function yemekTarifPopUpHide() { var _tempDiv = document.getElementById('kangTempXY'); _tempDiv.innerHTML = ''; _tempDiv.style.display = 'none'; }