activateMenu=function(nav){if(document.all&&document.getElementById(nav)&&document.getElementById(nav).currentStyle){var navroot=document.getElementById(nav);var lis=navroot.getElementsByTagName("LI");for(i=0;i<lis.length;i++){if(lis[i].lastChild.tagName=="UL"){lis[i].onmouseover=function(){this.lastChild.style.display="block";}
lis[i].onmouseout=function(){this.lastChild.style.display="none";}}}}}
window.onload=function(){activateMenu('nav');}
function change_manufacturer(manufacturer){document.getElementById('products').options.length=0;newoption=document.createElement('option');newoption.value=0;newoption.appendChild(document.createTextNode('Alegeti un produs...'));document.getElementById('products').appendChild(newoption);for(var id in products){if((manufacturer==0)||(products[id][0]==manufacturer)){newoption=document.createElement('option');newoption.value=id;if(manufacturer==0){newoption.appendChild(document.createTextNode(manufacturers[products[id][0]]+' '+products[id][1]));}
else{newoption.appendChild(document.createTextNode(products[id][1]));}
document.getElementById('products').appendChild(newoption);}}}
function tab(which){for(i=0;i<15;i++){if(document.getElementById('tab'+i)){document.getElementById('tab'+i).className='';}
if(document.getElementById('pane'+i)){document.getElementById('pane'+i).className='pane';}}
document.getElementById('tab'+which).className='selected';document.getElementById('tab'+which).blur();document.getElementById('pane'+which).className='panevisible';}
function isNumberKey(evt){var charCode=(evt.which)?evt.which:event.keyCode;if(charCode>31&&(charCode<48||charCode>57)){return false;}
return true;}
function contact_form(url){var popUpWidth=496;var popUpHeight=385;var popUpTop=(screen.height-popUpHeight)/2;var popUpLeft=(screen.width-popUpWidth)/2;window.open(url,'Contact','top='+popUpTop+',left='+popUpLeft+',height='+popUpHeight+',width='+popUpWidth+',scrollbars=no');}
function popup(url,title,features){window.open(url,title,features);}
function focus(targetId){document.getElementById(targetId).focus();}
function toggle(targetId){if(document.getElementById){target=document.getElementById(targetId);if(target.style.display=="block"){target.style.display="none";}
else{target.style.display="block";}}}
function decode_html(text){var newtext=text.replace(/&amp;/g,"&");newtext=newtext.replace(/&lt;/g,"<");newtext=newtext.replace(/&gt;/g,">");newtext=newtext.replace(/<br \/>/g,"\r\n");newtext=newtext.replace(/<br \/>/g,"\n");newtext=newtext.replace(/<br \/>/g,"\r");newtext=newtext.replace(/<br>/g,"\r\n");newtext=newtext.replace(/<br>/g,"\n");newtext=newtext.replace(/<br>/g,"\r");newtext=newtext.replace(/&quot;/g,"\"");newtext=newtext.replace(/&#039;/g,"'");return(newtext);}
function setState(which,state){document.getElementById(which).style.display=state;if(self["timer"+which]!=null)clearTimeout(self["timer"+which]);}
function checkValid(id,msg,regula,valoare){var prefix="* ";var suffix="\n";switch(regula){case'required':if(document.getElementById(id).value==""){return prefix+msg+suffix;}
break;case'select':if(document.getElementById(id).options[document.getElementById(id).selectedIndex].value==""){return prefix+msg+suffix;}
break;case'numeric':var validch="0123456789.-";var isNumber=true;var ch;var val=document.getElementById(id).value;for(i=0;i<val.length&&isNumber==true;i++){ch=val.charAt(i);if(validch.indexOf(ch)==-1){return prefix+msg+suffix;}}
break;case'email':var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;if(!filter.test(document.getElementById(id).value)){return prefix+msg+suffix;}
break;case'integer':var validch="0123456789";var isNumber=true;var ch;var val=document.getElementById(id).value;for(i=0;i<val.length&&isNumber==true;i++){ch=val.charAt(i);if(validch.indexOf(ch)==-1){return prefix+msg+suffix;}}
break;case'limitpercent':if(document.getElementById(id).value<0||document.getElementById(id).value>100){return prefix+msg+suffix;}
break;case'notzero':if(document.getElementById(id).value==0){return prefix+msg+suffix;}
break;case'date':msg=isDate(document.getElementById(id).value);if(msg!="0"){return prefix+msg+suffix;}
break;case'lessthan':if(document.getElementById(id).value>valoare){return prefix+msg+suffix;}
break;}
return"";}
function checkRegistration(){msg=checkValid('firstname','Completati prenumele','required');msg+=checkValid('lastname','Completati numele','required');msg+=checkValid('telephone','Completati numarul de telefon','required');msg+=checkValid('regemail','Completati adresa de e-mail','required');if(document.getElementById('email').value!=''){msg+=checkValid('regemail','Introduceti o adresa valida de e-mail','email');}
msg+=checkValid('regpassword','Completati parola','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkLogin(){msg=checkValid('password','Completati parola','required');msg+=checkValid('email','Completati adresa de e-mail','required');if(document.getElementById('email').value!=''){msg+=checkValid('email','Introduceti o adresa valida de e-mail','email');}
if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkAccount(){msg=checkValid('firstname','Completati prenumele dvs.','required');msg+=checkValid('lastname','Completati numele dvs.','required');msg+=checkValid('email','Completati adresa de e-mail','required');if(document.getElementById('email').value!=''){msg+=checkValid('email','Introduceti o adresa valida de e-mail','email');}
if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkPassword(){msg=checkValid('password','Completati parola actuala','required');msg+=checkValid('newpassword','Completati parola noua','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkAddress(){msg=checkValid('address','Completati adresa','required');msg+=checkValid('city','Completati orasul','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkCompany(){msg=checkValid('name','Completati nume firmei','required');msg+=checkValid('code','Completati codul unic de inregistrare','required');msg+=checkValid('registration','Completati numarul de inregistrare la Registrul Comertului','required');msg+=checkValid('bankaccount','Completati numarul contului bancar','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkComment(){msg=checkValid('customer_name','Completati numele dvs.','required');msg+=checkValid('customer_email','Completati adresa de e-mail','required');if(document.getElementById('customer_email').value!=''){msg+=checkValid('customer_email','Introduceti o adresa valida de e-mail','email');}
msg+=checkValid('customer_location','Completati locatia dvs.','required');msg+=checkValid('customer_comment','Scrieti un comentariu despre acest produs','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkRequestInfo(){msg=checkValid('customer_name','Completati numele dvs.','required');msg+=checkValid('customer_email','Completati adresa de e-mail','required');if(document.getElementById('customer_email').value!=''){msg+=checkValid('customer_email','Introduceti o adresa valida de e-mail','email');}
msg+=checkValid('request','Completati informatiile solicitate despre produs','required');if(msg!=''){alert(msg);return false;}
else{return true;}}
function checkRecommend(){msg=checkValid('name','Completati numele dvs.','required');msg+=checkValid('email','Completati adresa dvs de e-mail','required');if(document.getElementById('email').value!=''){msg+=checkValid('email','Introduceti o adresa valida de e-mail','email');}
msg+=checkValid('friend','Completati adresa de e-mail a prietenului','required');if(document.getElementById('friend').value!=''){msg+=checkValid('friend','Introduceti o adresa valida de e-mail','email');}
if(msg!=''){alert(msg);return false;}
else{return true;}}
function popup(url,winname,w,h){l=(screen.width-w)/2;t=(screen.height-h)/2;window.open(url,winname,'top='+t+',left='+l+',width='+w+',height='+h+',scrollbars=yes,menubar=no,toolbar=no,location=no,resizable=yes,status=no');}
function compare(id){w=screen.width-100;h=screen.height-130;popup('/compara/'+id,'compareWin',w,h);}
function comment(id){w=600;h=400;popup('/comenteaza/'+id,'commentWin',w,h);}
function info(id){w=600;h=400;popup('/cere-informatii/'+id+'/','requestInfoWin',w,h);}
function recommend(id){w=600;h=320;popup('/recomanda/'+id+'/','recommendWin',w,h);}
function gallery(id,file){w=700;h=500;popup('/galerie-imagini/'+id+'/'+file,'galleryWin',w,h);}