var Euronics = {
swapImg : function(m, n){ /* swap per immagini */
m = m.getElementsByTagName("IMG");
m[0].src = n;
},
getElementsByClassName : function(cl){ /* trova classe */
var retnode = [];
var myclass = new RegExp('\\b' + cl + '\\b');
var elem = document.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) {
retnode.push(elem[i]);
}
}
return retnode;
},
showLabel : function(e){ /* mostra label (cellulare) */
if (e == 'one') {
document.getElementById('one').className = 'on';
document.getElementById('two').className = 'off';
if(document.getElementById('three')){
document.getElementById('three').className = 'off';
}
document.getElementById('linkLabel').getElementsByTagName('li')[0].className = 'on';
document.getElementById('linkLabel').getElementsByTagName('li')[1].className = 'off';
if(document.getElementById('linkLabel').getElementsByTagName('li')[2]){
document.getElementById('linkLabel').getElementsByTagName('li')[2].className = 'off';
}
};
if (e == 'two') {
document.getElementById('one').className = 'off';
if(document.getElementById('three')){
document.getElementById('three').className = 'off';
}
document.getElementById('two').className = 'on';
document.getElementById('linkLabel').getElementsByTagName('li')[0].className = 'off';
document.getElementById('linkLabel').getElementsByTagName('li')[1].className = 'on';
if(document.getElementById('linkLabel').getElementsByTagName('li')[2]){
document.getElementById('linkLabel').getElementsByTagName('li')[2].className = 'off';
}
};
if (e == 'three') {
document.getElementById('one').className = 'off';
document.getElementById('two').className = 'off';
if(document.getElementById('three')){
document.getElementById('three').className = 'on';
}
document.getElementById('linkLabel').getElementsByTagName('li')[0].className = 'off';
document.getElementById('linkLabel').getElementsByTagName('li')[1].className = 'off';
if(document.getElementById('linkLabel').getElementsByTagName('li')[2]){
document.getElementById('linkLabel').getElementsByTagName('li')[2].className = 'on';
}
};
},
chStars : function(a,b){ /* cambia rank */
b.parentNode.className = 'stars ' + a;
},
resetStars : function(a,b){ /* resetta rank */
if (a) {
b.className = 'stars ' + a;
}
else {
b.className = 'stars';
}
},
zoomThis : function(a){
this.getElementsByClassName('on')[0].className = '';
document.getElementById('photoZoom').src = a.firstChild.src.split('_th')[0]+a.firstChild.src.split('_th')[1];
a.className = 'on';
},
zoomThisImage : function(a){
this.getElementsByClassName('on')[0].className = '';
var imagePath=a.firstChild.src.split('_th')[0]+a.firstChild.src.split('_th')[1];
imagePath=imagePath.replace('width=78','width=500').replace('height=78','height=500').replace('undefined','');
document.getElementById('photoZoom').src = imagePath;
a.className = 'on';
},
openWindow : function(url){
finestra=window.open(url,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=610,height=550");
finestra.focus();
},
submitCart : function(){
if(document.getElementById('accepted')){
document.getElementById('errore').style.display = "block";
if(document.getElementById('accepted').checked){
document.shoppingCart.submit();
}else{
document.getElementById('errore').style.display = "none";
document.getElementById('erroreCond').style.display = "block";
}
}
},
clickAndPay: function(){
if(noPrenotaSubmit) {
document.getElementById('pPPulsPaga').style.display='none';
return true;
}
if(document.getElementById('orderInfo.accepted')){
//document.getElementById('errore').style.display = "block";
if(document.getElementById('orderInfo.accepted').checked){
//alert('accepted checked');
//document.shoppingCart.submit();
//document.getElementById('pPPulsBack').style.display='none';
document.getElementById('clickAndPayForm').submit();
return true;
}else{
//alert('accepted not checked');
//document.getElementById('errore').style.display = "none";
document.getElementById('erroreCond').style.display = "block";
return false;
}
}
return false;
},
submitPayPal : function(){
if(document.getElementById('accepted')){
document.getElementById('errore').style.display = "block";
if(document.getElementById('accepted').checked){
document.shoppingCart.cartAction.value = "payPalCartCheckout";
document.shoppingCart.submit();
}else{
document.getElementById('errore').style.display = "none";
document.getElementById('erroreCond').style.display = "block";
}
}
},
openPop : function(a){
if(navigator.appName == "Microsoft Internet Explorer"){
offTop = document.documentElement.scrollTop+10;
}else{
offTop = window.pageYOffset+10;
};
divCont = Builder.node('div',{id:'contPop',style:'display: block; position:absolute; top:0; left:0; z-index:100; background:red; filter:alpha(opacity=0);-moz-opacity:.0;opacity:.0; width:100%; height:'+document.body.clientHeight+'px;'});
popUp = Builder.node('div',{id:'popUp',style:'display: block; position: absolute; z-index: 101; top: '+offTop+'px; left: '+Math.ceil((document.body.clientWidth-790)/2)+'px; width:790px; height:390px; background:#eee; padding:10px; border-bottom:2px solid #666; border-right:2px solid #666;'});
closeDiv = Builder.node('div',{id:'closeDiv',style:'display: block; width:790px; height:20px; text-align:right;'});
btnClose = Builder.node('a',{href:'javascript:void(0);',id:'close'},'chiudi');
btnPrint = Builder.node('a',{href:'javascript:void(0);',id:'print'},'stampa');
popupLayer = Builder.node('div',{id:'popupLayer',style:'display: block; width:780px; height:355px; background:#fff; overflow:auto; padding:5px;'});
stealth=Builder.node('iframe',{name:'popstampa',id:'popstampa',src:'',width:'1',height:'1',frameborder:'0'});
$('content').appendChild(divCont);
closeDiv.appendChild(btnPrint);
closeDiv.appendChild(btnClose);
popUp.appendChild(stealth);
popUp.appendChild(closeDiv);
popUp.appendChild(popupLayer);
$('content').appendChild(popUp);
url = a.href;
$('popupLayer').innerHTML = '
Caricamento...

';
new Ajax.Updater('popupLayer',url,{method:'get',evalScripts:true});
$('popstampa').src=url;
$('print').onclick = function(){
window.frames['popstampa'].focus();
window.frames['popstampa'].print();
/*
http://www.sviluppo.euronics.it/acquistaonline/print-popup.ep?urlPopup=popup/navigare.html
"/acquistaonline/template-resources/popup/navigare.html"
"/pupup/navigare.html"
*/
}
$('close').onclick = $('contPop').onclick = function(){
Element.remove('contPop');
Element.remove('popUp');
}
},
openWait : function(){
if(navigator.appName == "Microsoft Internet Explorer"){
offTop = document.documentElement.scrollTop+10;
}else{
offTop = window.pageYOffset+10;
};
divCont = Builder.node('div',{id:'contPop',style:'display: block; position:absolute; top:0; left:0; z-index:100; background:#ffffff; filter:alpha(opacity=30);-moz-opacity:.3;opacity:.3; width:100%; height:'+document.body.clientHeight+'px;'});
popUp = Builder.node('div',{id:'popUp',style:'display: block; position: absolute; z-index: 101; top: '+offTop+'px; left: '+Math.ceil((document.body.clientWidth-460)/2)+'px; width:460px; height:270px; background:#fff; padding:10px; border:20px solid #eee; '});
popupLayer = Builder.node('div',{id:'popupLayer',style:'display: block; width:450px; height:235px; overflow:auto; padding:5px;'});
$('content').appendChild(divCont);
popUp.appendChild(popupLayer);
$('content').appendChild(popUp);
$('popupLayer').innerHTML = 'Aggiornamento carrello...

';
},
closeWait : function(){
Element.remove('contPop');
Element.remove('popUp');
},
openInPop : function(a){
url = a.href;
$('popupLayer').innerHTML = 'Caricamento...

';
new Ajax.Updater('popupLayer',url,{method:'get',evalScripts:true});
$('popstampa').src=url;
},
createLoad : function (txt){
if(navigator.appName == "Microsoft Internet Explorer"){
offTop = document.documentElement.scrollTop+10;
}else{
offTop = window.pageYOffset+10;
};
var lbHeight = screen.height;
//alert("boxname:"+boxName+" | txt="+txt);
var boxLoading = Builder.node('div',{className:'boxLoading', id: 'contLoader'});
// document.body.style.overflow= "hidden";
boxLoading.innerHTML = txt;
//boxLoading.style.height = lbHeight+"px";
$('loader').style.top=offTop+"px";
$('loader').appendChild(boxLoading);
Element.show('loader');
},
removeLoad : function (boxName){
//alert("boxname:"+boxName);
var myLoading = $(boxName).getElementsByClassName('boxLoading')[0];
Element.hide(myLoading);
$('contLoader').remove();
Element.hide('loader');
document.body.style.overflow = "auto";
},
accordion : function(a){
nLi = Element.next(a).getElementsByTagName('li');
h = nLi.length*15;
if(Element.next(a).style.height.split('px')[0] == 0){
Element.next(a).style.height = h+"px";
}else{
Element.next(a).style.height = "0px";
}
},
trasforma : function (){
if ($("keyWordsSearch").value.length<2) {
alert("Inserire una parola chiave con almeno 2 caratteri per effettuare la ricerca.");
return false;
} else {
a=document.getElementById("keyWordsSearch").value;
a=a.toUpperCase();
document.getElementById("keyWordsSearch").value = a;
return true;
}
},
contrCell : function(a) {
b=$("newAddress.prefCellulare").selectedIndex;
if (a.value!="" && b==0) {
alert("Inserire anche il prefisso del cellulare.");
$("newAddress.prefCellulare").focus();
}
},
contrCellSel : function(a) {
a=a.selectedIndex;
b=$("newAddress.cellulare").value;
if (b=="" && a!=0) {
alert("Inserire anche il numero di cellulare.");
$("newAddress.cellulare").focus();
}
},
/*metodo per tracciamento banner*/
/* banner counter */
call: function (a,p1,p2,p4,b) {
var url = escape(a.href);
var p2=window.location;
var p3="commerce"
if(b=='new'){a.target = '_blank'};
var params = "id="+p4+"&bannerLancio="+p1+"&requestPath="+p2+"&sito="+p3+"&dest="+url;
var urlServer="http://www.euronics.it/utility/banner_counter_commerce.jsp?";
var urlBannerTrack=urlServer+params;
/*
new Ajax.Request(urlBannerTrack, {
method: 'get',
onComplete: function() {
window.location.href = url;
}
});
*/
if(url.match(/\/newsletter\//)){
var popup=window.open(a.href, '_popupW', 'width=560,height=400');
}
else{
window.location.href = urlBannerTrack;
}
}
/* fine metodi */
}
/* WORKAROUND FLASH PER IE (activx) */
function addFlash(path,larghezza,altezza,transp,variabili,name){
document.write('');
};
var otherMoreOpen = 0;
function setTxt(low,high,tot) {
$('gaugeLow').value = low;
$('gaugeHigh').value = high;
$('gaugeOccours').innerHTML = tot;
}
function clearTxt() {
$('gaugeLow').value = '';
$('gaugeHigh').value = '';
$('gaugeOccours').innerHTML = '-';
}
var otherAct = ''
function showOtherSimple(other){
if(otherAct=='') {
$(other).addClassName('hidElement');
} else {
$(otherAct).removeClassName('hidElement');
$(other).addClassName('hidElement');
}
otherAct = other;
filtro = $(other).up('DIV.item');
filtro = $(filtro).select('.filterSimpleOver');
$(filtro).each(function (s) {s.removeClassName('hidElement')});
}
function hideOtherSimple(contr){
filtro = $(contr).up('DIV.item');
filtro = $(filtro).select('.filterSimpleOver');
$(filtro).each(function (s) {s.addClassName('hidElement')});
$(otherAct).removeClassName('hidElement');
}
var otherParamsAct = 0;
function showOnlyThisOther(obj) {
otherParamsAct=obj;
$('otherParamsTitle').innerHTML = $(obj).innerHTML;
filtro = $(obj).up('DIV.item');
filtroB = $(filtro).select('.filterSimpleOver');
filtro = $(filtro).select('.filterAlways');
$(filtro).each(function (s) {s.addClassName('hidElement')});
if (otherMoreOpen==1) {
$(filtroB).each(function (s) {s.addClassName('hidElement')});
}
$(obj).up('li.filterAlways').removeClassName('hidElement');
$(obj).addClassName('hidElement');
$(obj).up('li.filterAlways').down('.subFilter').removeClassName('hidElement');
$('moreOtherParams').addClassName('hidElement');
}
function clearOther() {
$('otherParamsTitle').innerHTML = 'Altri Parametri';
filtro = $(otherParamsAct).up('DIV.item');
filtroB = $(filtro).select('.filterSimpleOver');
filtro = $(filtro).select('.filterAlways');
$(filtro).each(function (s) {s.removeClassName('hidElement')});
if (otherMoreOpen==1) {
$(filtroB).each(function (s) {s.removeClassName('hidElement')});
}
$(otherParamsAct).up('li.filterAlways').removeClassName('hidElement');
$(otherParamsAct).removeClassName('hidElement');
$(otherParamsAct).removeClassName('hidElement');
$(otherParamsAct).up('li.filterAlways').down('.subFilter').addClassName('hidElement');
$('moreOtherParams').removeClassName('hidElement')
}
function showAllThisOther(obj) {
otherParamsAct=obj;
$('otherParamsTitle').innerHTML = $(obj).innerHTML;
filtro = $(obj).up('DIV.item');
filtroA = $(filtro).select('.filterAlways');
filtro = $(filtro).select('.filterSimpleOver');
$(filtroA).each(function (s) {s.addClassName('hidElement')});
$(filtro).each(function (s) {s.addClassName('hidElement')});
$(obj).up('li.filterSimpleOver').removeClassName('hidElement');
$(obj).addClassName('hidElement');
$(obj).up('li.filterSimpleOver').down('.subFilter').removeClassName('hidElement');
//$('noMoreOtherParams').addClassName('hidElement');
}
function clearAllOther() {
$('otherParamsTitle').innerHTML = 'Altri Parametri';
filtro = $(otherParamsAct).up('DIV.item');
filtroA = $(filtro).select('.filterAlways');
$(filtroA).each(function (s) {s.removeClassName('hidElement')});
filtro = $(filtro).select('.filterSimpleOver');
$(filtro).each(function (s) {s.removeClassName('hidElement')});
$(otherParamsAct).up('li.filterSimpleOver').removeClassName('hidElement');
$(otherParamsAct).removeClassName('hidElement');
$(otherParamsAct).removeClassName('hidElement');
$(otherParamsAct).up('li.filterSimpleOver').down('.subFilter').addClassName('hidElement');
//$('noMoreOtherParams').removeClassName('hidElement')
}
function addbookmark(a,b)
{
if (window.sidebar) // Mozilla Firefox
{
window.sidebar.addPanel(b, a, "");
}
else if (window.external) // Internet Explorer
{
window.external.AddFavorite(a, b);
}
else if (window.opera && window.print) // Opera
{
var elem = document.createElement('a');
elem.setAttribute('href', a);
elem.setAttribute('title', b);
elem.setAttribute('rel', 'sidebar');
elem.click();
}
}