this.focus(); function show_flash(id) { document.getElementById(id).outerHTML = document.getElementById(id).outerHTML; } function printerFriendly(urlToOpen) { var x = (screen.width-800)/2, y = (screen.height-600)/2; OpenWin = this.open(urlToOpen, "CtrlWindow", "width=800,height=600,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function recommend(urlRecommandForThisArticle) { var x = (screen.width-400)/2, y = (screen.height-300)/2; OpenWin = this.open(urlRecommandForThisArticle, "CtrlWindow", "width=400,height=400,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } 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('
'); 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, packID, spID, q) {
var shoppingCartBox = $('shoppingCartBox');
shoppingCartBox.innerHTML = '';
var loading = $(document.createElement('img'));
//loading = $(loading);
loading.setStyle({'padding-top': '10px'});
loading.src = 'images/SCloader.gif';
shoppingCartBox.appendChild(loading);
var params = {'returnXML': 1 };
if(pID) {
params.pID = pID;
}
if(packID) {
params.packID = packID;
}
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');
shoppingCartBox.innerHTML = '';
if(rXML) {
if(document.all)
root = rXML.childNodes[1];
else
root = rXML.childNodes[0];
var items = $A(root.getElementsByTagName('item'));
if(items.length) {
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 fieldset = $(document.createElement('fieldset'));
fieldset.addClassName('cosCumparaturi');
switch(iType) {
case '3':
var packID = item.getElementsByTagName('packID')[0].firstChild.nodeValue;
fieldset.id = 'scpack_' + packID;
var _pImageSrc = item.getElementsByTagName('photoPath');
if(_pImageSrc.length) {
var pImageSrc = _pImageSrc[0].firstChild.nodeValue;
var pImage = $(document.createElement('img'));
pImage.addClassName('produs');
pImage.src = pImageSrc;
fieldset.appendChild(pImage);
}
var a = $(document.createElement('a'));
a.addClassName('produs');
a.href = baseHREF + 'index.html/products|pack?packID=' + packID;
var aText = document.createTextNode(iName);
a.appendChild(aText);
fieldset.appendChild(a);
var unitPriceText = document.createTextNode('Pret: ' + number_format(iUnitPrice, 2, ',', '.') + ' ' + iCurrency);
fieldset.appendChild(unitPriceText);
var br = $(document.createElement('br'));
fieldset.appendChild(br);
var quantity = document.createTextNode('Cantitate: ' + iQuantity);
fieldset.appendChild(quantity);
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 tEm = $(document.createElement('em'));
var removeImg = $(document.createElement('img'));
removeImg.src = 'images/butoane/sterge.gif';
removeImg.addClassName('anuleaza');
removeImg.alt = 'Anuleaza';
removeImg.title = 'Anuleaza';
removeImg.setStyle({'cursor':'pointer'});
removeImg.onclick = new Function('getShoppingCart( \'\', ' + packID + ', \'\', -' + iQuantity + ');');
tEm.appendChild(removeImg);
var subtotalText = document.createTextNode('SUBTOTAL: ');
tEm.appendChild(subtotalText);
var subtotal = $(document.createElement('span'));
subtotal.addClassName('rosu');
var subTotalPrice = document.createTextNode(number_format(iTotalPrice, 2, ',', '.') + ' ' + iCurrency);
subtotal.appendChild(subTotalPrice);
tEm.appendChild(subtotal);
fieldset.appendChild(tEm);
break;
case '4':
var pID = item.getElementsByTagName('productID')[0].firstChild.nodeValue;
fieldset.id = 'scspp_' + pID;
var _pImageSrc = item.getElementsByTagName('photoPath');
if(_pImageSrc.length) {
var pImageSrc = _pImageSrc[0].firstChild.nodeValue;
var pImage = $(document.createElement('img'));
pImage.addClassName('produs');
pImage.src = pImageSrc;
fieldset.appendChild(pImage);
}
var originalID = item.getElementsByTagName('originalID')[0].firstChild.nodeValue;
var a = $(document.createElement('a'));
a.addClassName('produs');
a.href = baseHREF + 'index.html/products|details?pID=' + originalID;
var aText = document.createTextNode(iName);
a.appendChild(aText);
fieldset.appendChild(a);
var unitPriceText = document.createTextNode('Pret: ' + number_format(iUnitPrice, 2, ',', '.') + ' ' + iCurrency);
fieldset.appendChild(unitPriceText);
var br = $(document.createElement('br'));
fieldset.appendChild(br);
var quantity = document.createTextNode('Cantitate: ' + iQuantity);
fieldset.appendChild(quantity);
var tEm = $(document.createElement('em'));
var removeImg = $(document.createElement('img'));
removeImg.src = 'images/butoane/sterge.gif';
removeImg.addClassName('anuleaza');
removeImg.alt = 'Anuleaza';
removeImg.title = 'Anuleaza';
removeImg.setStyle({'cursor':'pointer'});
removeImg.onclick = new Function('getShoppingCart(\'\', \'\', ' + pID + ', -' + iQuantity + ');');
tEm.appendChild(removeImg);
var subtotalText = document.createTextNode('SUBTOTAL: ');
tEm.appendChild(subtotalText);
var subtotal = $(document.createElement('span'));
subtotal.addClassName('rosu');
var subTotalPrice = document.createTextNode(number_format(iTotalPrice, 2, ',', '.') + ' ' + iCurrency);
subtotal.appendChild(subTotalPrice);
tEm.appendChild(subtotal);
fieldset.appendChild(tEm);
break;
default:
var pID = item.getElementsByTagName('productID')[0].firstChild.nodeValue;
fieldset.id = 'scp_' + pID;
var _pImageSrc = item.getElementsByTagName('photoPath');
if(_pImageSrc.length) {
var pImageSrc = _pImageSrc[0].firstChild.nodeValue;
var pImage = $(document.createElement('img'));
pImage.addClassName('produs');
pImage.src = pImageSrc;
fieldset.appendChild(pImage);
}
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);
fieldset.appendChild(a);
var unitPriceText = document.createTextNode('Pret: ' + number_format(iUnitPrice, 2, ',', '.') + ' ' + iCurrency);
fieldset.appendChild(unitPriceText);
var br = $(document.createElement('br'));
fieldset.appendChild(br);
var quantity = document.createTextNode('Cantitate: ' + iQuantity);
fieldset.appendChild(quantity);
var tEm = $(document.createElement('em'));
var removeImg = $(document.createElement('img'));
removeImg.src = 'images/butoane/sterge.gif';
removeImg.addClassName('anuleaza');
removeImg.alt = 'Anuleaza';
removeImg.title = 'Anuleaza';
removeImg.setStyle({'cursor':'pointer'});
removeImg.onclick = new Function('getShoppingCart(' + pID + ', \'\', \'\', -' + iQuantity + ');');
tEm.appendChild(removeImg);
var subtotalText = document.createTextNode('SUBTOTAL: ');
tEm.appendChild(subtotalText);
var subtotal = $(document.createElement('span'));
subtotal.addClassName('rosu');
var subTotalPrice = document.createTextNode(number_format(iTotalPrice, 2, ',', '.') + ' ' + iCurrency);
subtotal.appendChild(subTotalPrice);
tEm.appendChild(subtotal);
fieldset.appendChild(tEm);
break;
}
shoppingCartBox.appendChild(fieldset);
});
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 fTotalPrice = $(document.createElement('fieldset'));
var eTotalPrice = $(document.createElement('em'));
eTotalPrice.setStyle({'padding':'0px'});
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);
fTotalPrice.appendChild(eTotalPrice);
shoppingCartBox.appendChild(fTotalPrice);
var gotoSC = $(document.createElement('img'));
gotoSC.src = 'images/butoane/mergi_la_casa.gif';
gotoSC.alt = 'Mergi la casa';
gotoSC.title = 'Mergi la casa';
gotoSC.setStyle({'margin':'-2px 0px 0px 7px', 'cursor':'pointer'});
gotoSC.onclick = new Function("window.location = '" + baseHREF + "/index.html/shoppingcart'");
shoppingCartBox.appendChild(gotoSC);
} else {
var emptySC = $(document.createElement('img'));
emptySC.src = 'images/icons/cos_gol.gif';
emptySC.alt = 'Momentan cosul dvs. de cumparaturi este gol!';
emptySC.setStyle({'margin':'20px 0px 0px 0px'});
shoppingCartBox.appendChild(emptySC);
}
}
}
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(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, '', '', 1);
}
}
function addPackToCart(packID, 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_' + packID)) flyTarget = 'scpack_' + packID;
fly(floatingDiv, flyTarget, noResize);
}
getShoppingCart('', packID, '', 1);
}
}
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);
}
var aGrowMenu = new Array();
logoOverlayerSet = 0;
function LoadBig(el, targetID){
var hPosition = Position.cumulativeOffset($('header'));
// $('logoDisplayer_'+targetID).innerHTML = '';
if(!logoOverlayerSet){
var lPosition = Position.cumulativeOffset($('logouri'));
lPosition[0] = lPosition[0] - hPosition[0];
// alert(lPosition);
$('logoOverlayer').style.left = lPosition[0]+'px';
$('logoOverlayer').style.top = lPosition[1]+'px';
$('logoOverlayer').style.width = $('logouri').getWidth()+'px';
$('logoOverlayer').style.height = '50px';
logoOverlayerSet = 1;
}
$('logoOverlayer').style.display = '';
if(!$('logoDisplayer_'+targetID).innerHTML){
if(document.all)
var srcValue = el.rel;
else
var srcValue = el.readAttribute('rel');
aEl = document.createElement('a');
if(document.all) {
aEl.setAttribute('href', el.parentNode.href);
aEl.setAttribute('target', el.parentNode.target);
}
else {
aEl.writeAttribute('href', el.parentNode.readAttribute('href'));
aEl.writeAttribute('target', el.parentNode.readAttribute('target'));
}
imgEl = $(document.createElement('img'));
imgEl.writeAttribute('src', srcValue);
aEl.appendChild(imgEl);
$('logoDisplayer_'+targetID).appendChild(aEl);
var scPosition = Position.cumulativeOffset($(el));
scPosition[0] = scPosition[0] - hPosition[0] - $(el).getWidth()/4;
scPosition[1] = scPosition[1] - 7;
$('logoDisplayer_'+targetID).style.left = scPosition[0]+'px';
$('logoDisplayer_'+targetID).style.top = scPosition[1]+'px';
}
$('logoDisplayer_'+targetID).style.display = '';
setTimeout('LoadSmall(\''+targetID+'\', 1)', 50);
if(document.all)
$('logouri').style.filter = 'alpha(opacity=' + (0.4 * 100) + ')';
else
$('logouri').style.opacity = 0.4;
aGrowMenu[targetID] = 1;
}
function LoadSmall(targetID, check){
if(check && aGrowMenu[targetID]){
for(i=1; i |