this.name='shRLSMainWnd'; this.focus(); function printerFriendly(urlToOpen) { var x = (screen.width-600)/2, y = (screen.height-400)/2; OpenWin = this.open(urlToOpen, "CtrlWindow", "width=600,height=300 toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function showPaymentDetails(n) { for (i=1; i<=3; i++) if (i == n) gE('detailsPayMethod' + i).style.display='block'; else gE('detailsPayMethod' + i).style.display='none'; } function checkUserAvailability(iType){ var iValue = $(iType).value; var baseHref = document.getElementsByTagName('base')[0].href; var strError = ''; if(iType == 'username' && (iValue.length < 3)) strError = 'Utilizatorul introdus este invalid'; if(iType == 'email' && (iValue.length < 6 || iValue.indexOf('@') == -1 || iValue.indexOf('.') == -1)) strError = 'Emailul introdus este invalid'; if(!strError && iValue.length < 3) strError = iType+'ul introdus trebuie sa aiba minim 3 caractere'; if(!strError) new Ajax.Request(baseHref+'index.html/account|AJAXUserAvailability', { method:'post', parameters: {'iType' : iType, 'iTypeValue' : iValue}, onSuccess: function(transport){ var response = transport.responseXML; var status = response.childNodes[0].childNodes[0].firstChild.nodeValue; var iError = response.childNodes[0].childNodes[1].firstChild.nodeValue; if(status == 'true') { $('avail_'+iType).style.color = '#6FAB04'; $('avail_'+iType).style.fontWeight = 'bold'; $('avail_'+iType).innerHTML = iError; } else { //report error $('avail_'+iType).innerHTML = ''; showToolTipFader(iType+' '+iError, $(iType)); } }, onFailure: function(){ } }); else showToolTipFader(strError, $(iType)); } function clearInfo(el){ // alert('avail_'+el.id); $('avail_'+el.id).innerHTML = ''; } function setAddressStatus(){ // var elAddressContainer = $('newAddressContainer'); var radioInput = document.shoppingCartFrm.addressID; if(radioInput.checked == true) new Effect.SlideDown('newAddressContainer'); else for (var i=0; i < radioInput.length; i++) if(radioInput[i].checked) if(radioInput[i].value > 0) new Effect.Fade('newAddressContainer'); else new Effect.Appear('newAddressContainer'); } function setBillStatus(){ var radioInput = document.shoppingCartFrm.billID; if(radioInput.checked == true) new Effect.SlideDown('newBillContainer'); else for (var i=0; i < radioInput.length; i++) if(radioInput[i].checked) if(radioInput[i].value > 0) new Effect.Fade('newBillContainer'); else new Effect.Appear('newBillContainer'); } function checkOrder(){ //checkin address setup var requiredFields = { 'addressID': { 'fullContainer':'addressFullContainer', 'fullContainerMsg':'Nu ati selectat nici o adresa de livrare', 'fields':{ 'city':'Nu ati completat Orasul', 'countyID':'Nu ati completat Judet/Sector', 'address':'Nu ati completat Adresa' } }, 'billID': { 'fullContainer':'billFullContainer', 'fullContainerMsg':'Nu ati selectat datele de facturare', 'fields':{ 'bname':'Nu ati completat numele', 'bcui':'Nu ati completat CUI / CNP', 'bcity':'Nu ati completat Orasul', 'bcountyID':'Nu ati completat Judet/Sector', 'baddress':'Nu ati completat Adresa' } }, 'deliveryMethodID': { 'fullContainer':'methodFullContainer', 'fullContainerMsg':'Nu ati selectat nici o metoda de livrare' }, 'paymentMethodID': { 'fullContainer':'paymentFullContainer', 'fullContainerMsg':'Nu ati selectat nici o metoda de plata' } } var error = false; requiredFields = $H(requiredFields); requiredFields.each(function(t) { var isChecked = 0; var m = document.shoppingCartFrm[t[0]]; if(m.length) { isChecked = 0; for(var i = 0; i < m.length && !isChecked; i++) { if(m[i].checked) isChecked = m[i].value; } if(!isChecked) { error = true; showToolTipFader(t[1].fullContainerMsg, $(t[1].fullContainer)); throw $break; } } else { if(m.checked) isChecked = -1; else { error = true; showToolTipFader(t[1].fullContainerMsg, $(t[1].fullContainer)); throw $break; } } var fieldError = 0; if(isChecked == -1) { var fields = $H(t[1].fields); fields.each(function(f) { var field = $(f[0]); if(field.tagName.toLowerCase() == 'select') var fv = parseInt($(field).value); else var fv = $(field).value; if(!fv) { fieldError = f[0]; throw $break; } }); if(fieldError) { error = true; showToolTipFader(fields[fieldError], $(fieldError)); $(fieldError).focus(); throw $break; } } }); if(!error) { document.shoppingCartFrm.submit(); return; } return false; } function checkAddress(){ //checkin address setup var requiredFields = { 'addressID': { 'fullContainer':'addressFullContainer', 'fullContainerMsg':'Nu ati selectat nici o adresa de livrare', 'fields':{ 'city':'Nu ati completat Orasul', 'countyID':'Nu ati completat Judet/Sector', 'address':'Nu ati completat Adresa' } } } var error = false; requiredFields = $H(requiredFields); requiredFields.each(function(t) { var isChecked = 0; var m = document.shoppingCartFrm[t[0]]; if(m.length) { isChecked = 0; for(var i = 0; i < m.length && !isChecked; i++) { if(m[i].checked) isChecked = m[i].value; } if(!isChecked) { error = true; showToolTipFader(t[1].fullContainerMsg, $(t[1].fullContainer)); throw $break; } } else { if(m.checked) isChecked = -1; else { error = true; showToolTipFader(t[1].fullContainerMsg, $(t[1].fullContainer)); throw $break; } } var fieldError = 0; if(isChecked == -1) { var fields = $H(t[1].fields); fields.each(function(f) { var field = $(f[0]); if(field.tagName.toLowerCase() == 'select') var fv = parseInt($(field).value); else var fv = $(field).value; if(!fv) { fieldError = f[0]; throw $break; } }); if(fieldError) { error = true; showToolTipFader(fields[fieldError], $(fieldError)); $(fieldError).focus(); throw $break; } } }); if(!error) { document.shoppingCartFrm.submit(); return; } return false; } function addDeliveryPrice(price) { new Effect.Appear('totalDeliveryTR'); $('totalDelivery').innerHTML = price; price = price.replace(".", "").replace(',', '.'); var totalToBePaid = $('totalCommand').innerHTML.replace(".", "").replace(',', '.'); totalToBePaid = totalToBePaid * 1 + price * 1; $('totalToBePaid').innerHTML = number_format(totalToBePaid, 2, ',', '.'); // $('totalDeliveryTR').show(); } this.focus(); function show_flash(id) { document.getElementById(id).outerHTML = document.getElementById(id).outerHTML; } function gE(el) { return document.getElementById(el); } //end browser user var globalTimeout = ""; function showToolTipFader(texty,obj,doNotCloseAfter) { if($('tooltipX')) { document.body.removeChild($('tooltipX')); window.clearTimeout(globalTimeout); } var newdiv = document.createElement('div'); newdiv.id="tooltipX"; newdiv.style.display = "none"; //generating table inside div if(document.all) { var tbl = document.createElement(''); var tbb = document.createElement("tbody"); } else { var tbl = document.createElement('table'); var tbb = document.createElement("tbody"); tbl.setAttribute('cellpadding','0'); tbl.setAttribute('cellspacing','0'); tbl.setAttribute('border','0'); } // create up arrow td var row = document.createElement('tr'); if(document.all) var cell = document.createElement('
'); else var cell = document.createElement('td'); cell.setAttribute('colspan','3'); //create img var nimg = document.createElement('img'); if(document.all) nimg.src="images/pop-up/sageata_sus.gif"; else nimg.src="images/pop-up/sageata_sus.png"; nimg.className="tooltipUpArrow"; nimg.id = "toolArrowU"; cell.appendChild(nimg); row.appendChild(cell); tbb.appendChild(row); //end create up arrow td //create top tooltip var row = document.createElement('tr'); var cell = document.createElement('td'); cell.className="tooltipCorner_ul"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipBar_u"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipCorner_ur"; row.appendChild(cell); tbb.appendChild(row); //end create top tooltip if(doNotCloseAfter) { var imgClose = "Detaliu utilizator"; //create close tooltip var row = document.createElement('tr'); var cell = document.createElement('td'); cell.className="tooltipBar_l"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipText"; cell.innerHTML=imgClose; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipBar_r"; row.appendChild(cell); tbb.appendChild(row); //end close tooltip } //create middle tooltip var row = document.createElement('tr'); var cell = document.createElement('td'); cell.className="tooltipBar_l"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipText"; cell.innerHTML=texty; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipBar_r"; row.appendChild(cell); tbb.appendChild(row); //end middle tooltip //create bottom tooltip var row = document.createElement('tr'); var cell = document.createElement('td'); cell.className="tooltipCorner_bl"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipBar_b"; row.appendChild(cell); var cell = document.createElement('td'); cell.className="tooltipCorner_br"; row.appendChild(cell); tbb.appendChild(row); //end create bottom tooltip // create down arrow td var row = document.createElement('tr'); if(document.all) var cell = document.createElement(''); else var cell = document.createElement('td'); cell.setAttribute('colspan','3'); //create img var nimg = document.createElement('img'); if(document.all) nimg.src="images/pop-up/sageata_jos.gif"; else nimg.src="images/pop-up/sageata_jos.png"; nimg.className="tooltipDownArrow"; nimg.id = "toolArrowD"; cell.appendChild(nimg); row.appendChild(cell); tbb.appendChild(row); //end create down arrow td tbl.appendChild(tbb); newdiv.appendChild(tbl); newdiv.className ="tooltipDiv"; //add tooltip to document document.body.appendChild(newdiv); //position tooltip setPopupPosition(obj,newdiv); Effect.Appear(newdiv.id,{duration:.2}); //set fade out if(!doNotCloseAfter) globalTimeout = window.setTimeout('Effect.Fade(\'tooltipX\', {duration:.3,from:1.0, to:0.0})',2500); //======================================== } function setPopupPosition(el, x) { var direction = "up"; var position = Position.cumulativeOffset(el); var scrollY = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop; var viewHeight = (navigator.userAgent.toLowerCase().indexOf("safari") != -1 && window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight; x.style.left = position[0]-40 + "px"; var popupTop = position[1] + Element.getHeight(el); if((popupTop + x.offsetHeight > scrollY + viewHeight) && (position[1] - x.offsetHeight > scrollY)) { popupTop = position[1] - x.offsetHeight ; } if(popupTop > (scrollY + Element.getHeight(x) + 40 + Element.getHeight(el))) { direction="down"; $('toolArrowD').style.visibility = "visible"; } else { $('toolArrowU').style.visibility = "visible"; } if(direction == "up") x.style.top = (popupTop+30) + "px"; else x.style.top = (popupTop - Element.getHeight(x) - (document.all ? 15 : 25) - Element.getHeight(el)) + "px"; } function hidePopup() { if($('tooltipX')) { document.body.removeChild($('tooltipX')); window.clearTimeout(globalTimeout); } } String.prototype.trim = function() { var _ret = this.replace(/^\s+|\s+$/g, ''); return _ret.replace(/^(\ \;)+|(\ \;)+$/g, ''); } function getShoppingCart(pID, soID, spID, q) { var shoppingCartBox = $('shoppingCartBox'); shoppingCartBox.innerHTML = ''; if(document.all) { var cdiv = $(document.createElement('
')); }else{ var cdiv = $(document.createElement('div')); cdiv.setAttribute('align', 'center'); } var loading = $(document.createElement('img')); //loading = $(loading); loading.setStyle({'padding-top': '10px'}); loading.src = 'images/SCloader.gif'; cdiv.appendChild(loading); shoppingCartBox.appendChild(cdiv); var params = {'returnXML': 1 }; if(pID) { params.pID = pID; } if(soID) { params.soID = soID; } if(spID) { params.spID = spID; } if(q) { params.quantity = q; } new Ajax.Request(document.getElementsByTagName('base')[0].href+'index.html/shoppingcart|displayShoppingCart', { method:'post', parameters: params, onSuccess: function(transport){ var response = transport.responseXML; displayShoppingCart(response); }, onFailure: function(){ } }); } function displayShoppingCart(rXML) { var baseHREF = document.getElementsByTagName('base')[0].href; var shoppingCartBox = $('shoppingCartBox'); if($('cumcumpar').value == "true"){ cumCumparTXT = " | Cum Cumpar?"; cumCumparTXT2 = "Cum Cumpar?"; }else{ cumCumparTXT = ""; cumCumparTXT2 = ""; } if(rXML) { if(document.all) root = rXML.childNodes[1]; else root = rXML.childNodes[0]; var totalPrice = root.getElementsByTagName('totalPrice')[0].firstChild.nodeValue; var count = root.getElementsByTagName('count')[0].firstChild.nodeValue; if(count > 0){ shoppingCartBox.innerHTML ="

Momentan cosul dvs contine " + count + " produse dinstincte cu o valoare totala de " + totalPrice + " RON
mergi la casa" + cumCumparTXT + "

"; }else{ shoppingCartBox.innerHTML = ''; } } if(document.all) { var ldiv = $(document.createElement('
')); var tbl = $(document.createElement('')); var tbb = $(document.createElement('tbody')); } else { var ldiv = $(document.createElement('div')); ldiv.setAttribute('class','containerCos'); var tbl = $(document.createElement('table')); var tbb = $(document.createElement('tbody')); tbl.setAttribute('class','cosCumparaturiMic'); tbl.setAttribute('cellpadding','1'); tbl.setAttribute('cellspacing','1'); } if(rXML) { var items = $A(root.getElementsByTagName('item')); if(items.length) { var row = $(document.createElement('tr')); if(document.all) { var cell = $(document.createElement('
')); }else{ var cell = $(document.createElement('th')); cell.setAttribute('colspan', '2'); cell.setStyle({'width':'132px'}); } cell.innerHTML="Descriere"; row.appendChild(cell); if(document.all) { var cell = $(document.createElement('')); }else{ var cell = $(document.createElement('th')); cell.setStyle({'width':'55px'}); } cell.innerHTML="Pret"; row.appendChild(cell); tbb.appendChild(row); items.each( function(item) { var iType = item.getElementsByTagName('type')[0].firstChild.nodeValue; var iName = item.getElementsByTagName('name')[0].firstChild.nodeValue; var iUnitPrice = item.getElementsByTagName('unitPrice')[0].firstChild.nodeValue; var iTotalPrice = item.getElementsByTagName('totalPrice')[0].firstChild.nodeValue; var iCurrency = item.getElementsByTagName('currency')[0].firstChild.nodeValue; var iQuantity = item.getElementsByTagName('quantity')[0].firstChild.nodeValue; var ioutofstock = item.getElementsByTagName('outOfStock')[0].firstChild.nodeValue; switch(iType) { case '2': var packID = item.getElementsByTagName('packID')[0].firstChild.nodeValue; var row = $(document.createElement('tr')); row.setAttribute('id', 'scpack_' + packID); var cell = $(document.createElement('td')); var removeImg = $(document.createElement('img')); removeImg.src = 'images/butoane/sterge_din_cos.gif'; removeImg.addClassName('anuleaza'); removeImg.alt = 'Anuleaza'; removeImg.title = 'Anuleaza'; removeImg.setStyle({'cursor':'pointer'}); removeImg.onclick = new Function('getShoppingCart( \'\', ' + packID + ', \'\', -' + iQuantity + ');'); cell.appendChild(removeImg); row.appendChild(cell); var packAccessories = item.getElementsByTagName('accesories')[0]; var accesories = $A(packAccessories.getElementsByTagName('accessory')); var cell = $(document.createElement('td')); var a = $(document.createElement('a')); a.addClassName('produs'); a.href = baseHREF + 'index.html/products|pack?packID=' + packID; if(accesories.length > 1) var aText = document.createTextNode('Pachet ' + iName); else var aText = document.createTextNode(iName); a.appendChild(aText); cell.appendChild(a); row.appendChild(cell); // var packItemsDL = $(document.createElement('dl')); // var product = item.getElementsByTagName('product')[0]; // var productName = document.createTextNode(product.getElementsByTagName('name')[0].firstChild.nodeValue); // var dt = $(document.createElement('dt')); // var a = $(document.createElement('a')); // var pID = product.getElementsByTagName('productID')[0].firstChild.nodeValue; // a.href = baseHREF + 'index.html/products|details?pID=' + pID; // a.appendChild(productName); // dt.appendChild(a); // packItemsDL.appendChild(dt); //var packAccessories = item.getElementsByTagName('accesories')[0]; //var accesories = $A(packAccessories.getElementsByTagName('accessory')); // accesories.each(function(accessory){ // var aID = accessory.getElementsByTagName('productID')[0].firstChild.nodeValue; // var aName = document.createTextNode(accessory.getElementsByTagName('name')[0].firstChild.nodeValue); // var dd = $(document.createElement('dd')); // var a = $(document.createElement('a')); // a.href = baseHREF + 'index.html/products|details?pID=' + aID; // a.appendChild(aName); // dd.appendChild(a); // packItemsDL.appendChild(dd); // }); // fieldset.appendChild(packItemsDL); var cell = $(document.createElement('td')); var subtotal = $(document.createElement('span')); var subTotalPrice = document.createTextNode(number_format(iTotalPrice, 2, ',', '.') + ' ' + iCurrency); subtotal.appendChild(subTotalPrice); cell.appendChild(subtotal); row.appendChild(cell); tbb.appendChild(row); if(ioutofstock > 0){ var row = $(document.createElement('tr')); var cell = $(document.createElement('td')); row.appendChild(cell); if(document.all) { var cell = $(document.createElement('')); }else{ var cell = $(document.createElement('td')); cell.setAttribute('colspan', '2'); } var warning = $(document.createElement('span')); warning.innerHTML="*stoc limitat la "+iQuantity+" bucati"; cell.appendChild(warning); row.appendChild(cell); tbb.appendChild(row); } break; default: var pID = item.getElementsByTagName('productID')[0].firstChild.nodeValue; var row = $(document.createElement('tr')); row.setAttribute('id', 'scp_' + pID); var cell = $(document.createElement('td')); var removeImg = $(document.createElement('img')); removeImg.src = 'images/butoane/sterge_din_cos.gif'; removeImg.addClassName('anuleaza'); removeImg.alt = 'Anuleaza'; removeImg.title = 'Anuleaza'; removeImg.setStyle({'cursor':'pointer'}); removeImg.onclick = new Function('getShoppingCart(' + pID + ', \'\', \'\', -' + iQuantity + ');'); cell.appendChild(removeImg); row.appendChild(cell); var cell = $(document.createElement('td')); var a = $(document.createElement('a')); a.addClassName('produs'); a.href = baseHREF + 'index.html/products|details?pID=' + pID; var aText = document.createTextNode(iName); a.appendChild(aText); cell.appendChild(a); row.appendChild(cell); var cell = $(document.createElement('td')); var subtotal = $(document.createElement('span')); var subTotalPrice = document.createTextNode(number_format(iTotalPrice, 2, ',', '.') + ' ' + iCurrency); subtotal.appendChild(subTotalPrice); cell.appendChild(subtotal); row.appendChild(cell); tbb.appendChild(row); if(ioutofstock > 0){ var row = $(document.createElement('tr')); var cell = $(document.createElement('td')); row.appendChild(cell); if(document.all) { var cell = $(document.createElement('')); }else{ var cell = $(document.createElement('td')); cell.setAttribute('colspan', '2'); } var warning = $(document.createElement('span')); warning.innerHTML="*stoc limitat la "+iQuantity+" bucati"; cell.appendChild(warning); row.appendChild(cell); tbb.appendChild(row); } break; } }); var currency = root.getElementsByTagName('currency')[0].firstChild.nodeValue; var totalPrice = root.getElementsByTagName('totalPrice')[0].firstChild.nodeValue; var count = root.getElementsByTagName('count')[0].firstChild.nodeValue; var row = $(document.createElement('tr')); if(document.all) { var cell = $(document.createElement('')); }else{ var cell = $(document.createElement('td')); cell.setAttribute('colspan', '3'); } cell.setAttribute('align', 'right'); cell.setAttribute('class', 'total'); var eTotalPrice = $(document.createElement('strong')); tTotalPrice = document.createTextNode('TOTAL: '); eTotalPrice.appendChild(tTotalPrice); var sTotalPrice = $(document.createElement('span')); sTotalPrice.addClassName('rosu'); var totalPriceText = document.createTextNode(number_format(totalPrice, 2, ',', '.') + ' ' + currency); sTotalPrice.appendChild(totalPriceText); eTotalPrice.appendChild(sTotalPrice); cell.appendChild(eTotalPrice); row.appendChild(cell); tbb.appendChild(row); } else { var row = $(document.createElement('tr')); if(document.all) { var cell = $(document.createElement('')); }else{ var cell = $(document.createElement('td')); cell.setAttribute('class', 'cosGol'); } cell.innerHTML="Momentan cosul dumneavostra de cumparaturi este gol

" + cumCumparTXT2; row.appendChild(cell); tbb.appendChild(row); } } tbl.appendChild(tbb); ldiv.appendChild(tbl); shoppingCartBox.appendChild(ldiv); } function number_format(a, b, c, d) { a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b); e = a + ''; f = e.split('.'); if (!f[0]) { f[0] = '0'; } if (!f[1]) { f[1] = ''; } if (f[1].length < b) { g = f[1]; for (i=f[1].length + 1; i <= b; i++) { g += '0'; } f[1] = g; } if(d != '' && f[0].length > 3) { h = f[0]; f[0] = ''; for(j = 3; j < h.length; j+=3) { i = h.slice(h.length - j, h.length - j + 3); f[0] = d + i + f[0] + ''; } j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3)); f[0] = j + f[0]; } c = (b <= 0) ? '' : c; return f[0] + c + f[1]; } function addProductToCart(q, pID, imgSrc, source, noResize) { source = $(source); if($('floatingDiv')) { return false; } else { if(imgSrc) { source.src = imgSrc; var floatingDiv = $(document.createElement('div')); floatingDiv.id = 'floatingDiv'; var img = $(document.createElement('img')); img.src = imgSrc; floatingDiv.appendChild(img); var mainPhotoPos = Position.cumulativeOffset(source); floatingDiv.setStyle({'position': 'absolute', 'top': mainPhotoPos[1] + 'px', 'left': mainPhotoPos[0] + 'px'}); document.body.appendChild(floatingDiv); var flyTarget = 'shoppingCartBox'; if($('scp_' + pID)) flyTarget = 'scp_' + pID; fly(floatingDiv, flyTarget, noResize); } getShoppingCart(pID, '', '', q.value); } } function addPackToCart(q, soID, imgSrc, source, noResize) { source = $(source); if($('floatingDiv')) { return false; } else { if(imgSrc) { source.src = imgSrc; var floatingDiv = $(document.createElement('div')); floatingDiv.id = 'floatingDiv'; var img = $(document.createElement('img')); img.src = imgSrc; floatingDiv.appendChild(img); var mainPhotoPos = Position.cumulativeOffset(source); floatingDiv.setStyle({'position': 'absolute', 'top': mainPhotoPos[1] + 'px', 'left': mainPhotoPos[0] + 'px'}); document.body.appendChild(floatingDiv); var flyTarget = 'shoppingCartBox'; if($('scpack_' + soID)) flyTarget = 'scpack_' + soID; fly(floatingDiv, flyTarget, noResize); } getShoppingCart('', soID, '', q.value); } } function fly(elID, target, noResize) { elID = $(elID) var scPosition = Position.cumulativeOffset($(target)); new Effect.Move (elID,{ x: scPosition[0], y: scPosition[1], mode: 'absolute', transition: Effect.Transitions.sinoidal}); if(!noResize) new Effect.Scale(elID.firstDescendant(), 20); setTimeout('document.body.removeChild($(\'' + elID.id + '\'))', 1000); } //COOKIES function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return ''; } function eraseCookie(name) { createCookie(name,"",-1); }