var req; var req2; var continut_oferta = Array(); var variante = Array(); var nume_variante = Array(); var varianta_selectata = 0; var varianta_selectata_text=''; var marimi = Array(); var marime_selectata = 0; var marime_selectata_text=''; var modele = Array(); var preturi_modele = Array(); var model_selectat = 0; var model_selectat_text=''; var last_news=0; var show=1; var IE = (document.all) ? 1 : 0; function caracter(ch){ if ( (ch>=65 && ch <=90) || (ch>=97 && ch<=122) || (ch == 32) ||(ch == 39) ||(ch == 45) ||(ch == 0)||(ch == 8)||(ch == 222)) return true; return false; } function cifra(ch){ if ((ch>=48 && ch <=57) ||(ch == 0)||(ch == 8)) return true; return false; } function sector(ch){ if ((ch>=49 && ch <=54) ||(ch == 0)||(ch == 8)) return true; return false; } function validate(name,e){ if (IE) {e=window.event; var ch=e.keyCode; } else { ch=e.which; } if (name=='numai_alfanumeric' && !(caracter(ch) || cifra(ch))) return false; if (name=='numai_caractere' && !caracter(ch)) return false; if (name=='numai_cifre' && !cifra(ch)) return false; if (name=='numai_sector' && !sector(ch)) return false; return true; } var sitepath = root_path; function preview_image(old_size,new_size,id){ var oldsrc,newsrc; if(id) oldsrc = document.getElementById(id).src; else oldsrc = document.getElementById("imagine_mare").src; if (oldsrc.indexOf('no_image')>0){ return false; } else{ newsrc = oldsrc.replace("_"+old_size+".jpg","_"+new_size+".jpg"); window.open(sitepath+'Preview/?img='+newsrc,'zoom','scrollbars=yes,height=100,width=200,status=no,toolbar=no,menubar=no,location=no'); } } function make_oferta(id){ if (id){ document.getElementById('oferta').innerHTML=continut_oferta[id]; } } function change_image(old_size,new_size,obj){ var oldsrc; oldsrc = obj.src; if (oldsrc.indexOf('no_image')>0){ return false; } else{ newsrc = oldsrc.replace("_"+old_size+".jpg","_"+new_size+".jpg"); document.getElementById("imagine_mare").src = newsrc; } } function select_varianta(varianta){ if(varianta_selectata!=varianta){ if(document.getElementById('small_image_'+varianta)) change_image(1,3,document.getElementById('small_image_'+varianta)); if(varianta_selectata!=0 && document.getElementById('div_'+varianta_selectata)) document.getElementById('div_'+varianta_selectata).className='small_thumbnail'; varianta_selectata = varianta; varianta_selectata_text = variante[varianta]; if(document.getElementById('div_'+varianta)) document.getElementById('div_'+varianta).className='small_thumbnail_selected'; if(nume_variante[varianta_selectata] && document.getElementById('text_varianta')) document.getElementById('text_varianta').innerHTML=' '+nume_variante[varianta_selectata]; } //alert('Selectez varianta '+varianta_selectata_text+' cu codul '+varianta_selectata); } function select_marime(marime){ if(marime_selectata!=marime){ if(document.getElementById('marime_'+marime)) document.getElementById('marime_'+marime).checked=true; marime_selectata = marime; marime_selectata_text = marimi[marime]; if(document.getElementById('text_marime')) document.getElementById('text_marime').innerHTML=', marimea '+marime_selectata_text; } //alert('Selectez marimea '+marime_selectata_text+' cu codul '+marime_selectata); } function select_model(model){ if(model_selectat!=model){ if(document.getElementById('model_'+model)) document.getElementById('model_'+model).checked=true; model_selectat = model; model_selectat_text = modele[model]; if(preturi_modele[model]) document.getElementById('main_price').innerHTML = preturi_modele[model]; if(document.getElementById('text_model')) document.getElementById('text_model').innerHTML=', model '+model_selectat_text; } //alert('Selectez modelul '+model_selectat_text+' cu codul '+model_selectat+' si pretul '+ preturi_modele[model_selectat]); } function loadXMLDoc(url) { // Internet Explorer try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { req = null; } } // Mozailla/Safari if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } // Call the processChange() function when the page has loaded if (req != null) { req.onreadystatechange = processChange; req.open("GET", url, true); req.send(null); } } function processChange() { // The page has loaded and the HTTP status code is 200 OK if (req.readyState == 4 && req.status == 200) { // Write the contents of this URL to the searchResult layer document.getElementById("cos_cumparaturi_top_content").innerHTML = req.responseText; } } function loadXMLDoc2(url) { // Internet Explorer try { req2 = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req2 = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { req2 = null; } } // Mozailla/Safari if (!req2 && typeof XMLHttpRequest != "undefined") { req2 = new XMLHttpRequest(); } // Call the processChange2() function when the page has loaded if (req2 != null) { req2.onreadystatechange = processChange2; req2.open("GET", url, true); req2.send(null); } } function processChange2() { // The page has loaded and the HTTP status code is 200 OK if (req2.readyState == 4 && req2.status == 200) { // Write the contents of this URL to the searchResult layer document.getElementById("lista_produse_cos").innerHTML = req2.responseText; } } function adauga_in_cos(produs,varianta,marime,model,cantitate){ var url = 'Cos-Produse/'; if(cantitate<1 ) cantitate=1; if(document.getElementById('cantitate')){ document.getElementById('cantitate').value=1; } if(marime&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta+' si marimea '+marime); url = 'Cos-Produse/?produs='+produs+'&varianta='+varianta+'&marime='+marime+'&cantitate='+cantitate; } if(model&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta+' si modelul '+model); url = 'Cos-Produse/?produs='+produs+'&varianta='+varianta+'&modele[model]='+model+'&cantitate='+cantitate; } if(!marime &&!model&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta); url = 'Cos-Produse/?produs='+produs+'&varianta='+varianta+'&cantitate='+cantitate; } if(produs){ alert(cantitate + ' produs'+(cantitate>1?'e':'')+' a'+(cantitate>1?'u':'')+' fost adaugat'+(cantitate>1?'e':'')+' in cos.'); } //alert(url); loadXMLDoc(url) } function modifica_cos(produs,varianta,marime,model,cantitate){ var url = 'Cos-Produse/?advanced'; if(marime&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta+' si marimea '+marime); url = 'Cos-Produse/?advanced&produs='+produs+'&varianta='+varianta+'&marime='+marime+'&cantitate='+cantitate; } if(model&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta+' si modelul '+model); url = 'Cos-Produse/?advanced&produs='+produs+'&varianta='+varianta+'&model='+model+'&cantitate='+cantitate; } if(!marime &&!model&&produs){ //alert('Voi adauga in cos produsul cu id-ul '+produs+' varianta '+varianta); url = 'Cos-Produse/?advanced&produs='+produs+'&varianta='+varianta+'&cantitate='+cantitate; } //alert(url); loadXMLDoc2(url) } function focus_this(obj){ if(document.getElementById(obj)){ document.getElementById(obj).focus(); document.getElementById(obj).focus(); document.getElementById(obj).focus(); document.getElementById(obj).value=document.getElementById(obj).value; } } function show_lightbox(old_size,new_size,id){ var oldsrc,newsrc; if(id) oldsrc = document.getElementById(id).src; else oldsrc = document.getElementById("imagine_mare").src; if (oldsrc.indexOf('no_image')>0){ return false; } else{ newsrc = oldsrc.replace("_"+old_size+".jpg","_"+new_size+".jpg"); objLink = document.getElementById("preview"); objLink.href = newsrc; objLink.title = ""+document.getElementById("main_titlu").innerHTML+"
" + document.getElementById("main_lead").innerHTML; showLightbox (objLink); } } function show_hide(nr) { var id1='news_'+nr; var id2='link_'+nr; if(document.getElementById(id1).style.display=='none') document.getElementById(id1).style.display='block' ; else document.getElementById(id1).style.display='none' ; if(nr!=1) { if(document.getElementById(id2).style.display=='none') document.getElementById(id2).style.display='block' ; else document.getElementById(id2).style.display='none' ; } } function show_hide_cariere(nr) { var id1='cariere_'+nr; if(document.getElementById(id1).style.display=='none') document.getElementById(id1).style.display='block' ; else document.getElementById(id1).style.display='none' ; }