String.prototype.trim=function(){a=this.replace(/^\s+/,"");return a.replace(/\s+$/,"")};function showhide2(id,img){el=document.getElementById(id);img=document.getElementById(img);if(el.style.display=="none"){el.style.display="block";img.src="/images/menum.gif"}else{el.style.display="none";img.src="/images/menup.gif"}}function showhide(id){el=document.getElementById(id);if(el.style.display=="none"){el.style.display="block"}else{el.style.display="none"}}function filtreaza_producator(filtru_select){document.location=filtru_select.options[filtru_select.selectedIndex].value}function kaka(){showhide("step1");setTimeout("showhide('step1')",500)}function informatii_suplimentare(url,popUpWidth,popUpHeight){var popUpTop=(screen.height-popUpHeight)/2;var popUpLeft=(screen.width-popUpWidth)/2;window.open(url,"anunta","top="+popUpTop+",left="+popUpLeft+",height="+popUpHeight+",width="+popUpWidth+",scrollbars=no")}var timeout=1;var offset=155/2;var wait=5000;var imagini=new Array();var fixLeft=new Array();var imgLeft=new Array();var imgWidth=620;var imgHeight=243;function init(){var scrollingDiv=document.getElementById("scrollingDiv");imagini=scrollingDiv.getElementsByTagName("img");imgWidth=620;imgHeight=243;for(var i=0;i<imagini.length;i++){fixLeft[i]=imgWidth*i;imgLeft[i]=fixLeft[i];imagini[i].style.left=imgLeft[i]+"px";imagini[i].style.top=0+"px";imagini[i].style.display="block"}window.setTimeout("myScroll()",wait)}function myScroll(){var interval=timeout;for(var i=0;i<imagini.length;i++){imgLeft[i]-=offset;imagini[i].style.left=imgLeft[i]+"px";if(imgLeft[i]<(-1)*imgWidth){imgLeft[i]=fixLeft[imagini.length-1]}if(imgLeft[i]==0){interval=wait}}window.setTimeout("myScroll()",interval)}var searchEngineUrl="/magazin/online/ajax_search.html";var overBgColor="green";var numberOfHints=6;var searchForm="searchForm";var artcoreSuggestCanRun=1;var xmlHttp;var suggestionsDiv;var searchTxt;var oldSearchRequest="";var selectedHint=-1;var hintsIds="rezultat";var sageataSus=38;var sageataJos=40;var rezultate=new Array();var rezultTrun=new Array();var canUpdate=0;function initArtcoreSuggest(){ajaxFunction();if(artcoreSuggestCanRun==1){suggestionsDiv=document.getElementById("sDiv");searchTxt=window.document.getElementById("ce");searchForm=window.document.getElementById("searchForm");window.setInterval("showHint()",400)}}function ajaxFunction(){try{xmlHttp=new XMLHttpRequest()}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){artcoreSuggestCanRun=0;return}}}xmlHttp.onreadystatechange=function(){updateSuggestions()}}function updateSuggestions(){if((xmlHttp.readyState==4)||canUpdate==1){var txt=xmlHttp.responseText;var tmp="";var contor=0;rezultate=txt.split("\n");numberOfHints=rezultate.length;if(numberOfHints<3){artcoreSuggestCanRun=1;suggestionsDiv.style.display="none";return}truncateHints();while(contor<numberOfHints){tmp+='<div id="rezultat'+contor+'" class="rezultat" onclick="hintOnClick('+contor+')" onmouseout="outHints()" onmouseover="hintMouseOver('+contor+')">';tmp+=rezultTrun[contor];tmp+="</div>";contor++}suggestionsDiv.innerHTML=tmp;var ctrlDiv='<div style="font-family:verdana;font-size:10px;text-align:right">';ctrlDiv+='<a style="color:green;" href="javascript:searchForm.submit()" title="Afiseaza toate rezultatele">Toate rezultatele</a> | ';ctrlDiv+='<a style="color:green;" href="javascript:hideHints()" title="Ascunde \'Artcore Suggest\' (ESC)">Ascunde</a> | ';ctrlDiv+='<a style="color:green;" href="javascript:disableHints()" title="Opreste \'Artcore Suggest\'">Opreste</a>';suggestionsDiv.innerHTML+=ctrlDiv;suggestionsDiv.style.display="block";artcoreSuggestCanRun=1}}function showHint(){var str=searchTxt.value;if(artcoreSuggestCanRun==0){return}if(str==oldSearchRequest){return}if((str.length==0)||(str==" produs cautat")){suggestionsDiv.innerHTML="";suggestionsDiv.style.display="none";oldSearchRequest="";return}if(refineResults(str)){canUpdate=1;updateSuggestions();oldSearchRequest=str;return}else{canUpdate=0}artcoreSuggestCanRun=0;ajaxFunction();var url=searchEngineUrl+"";url+="?q="+str;url+="&sid="+Math.random();try{xmlHttp.open("GET",url,true);xmlHttp.send(null);url="";oldSearchRequest=str}catch(e){alert(e)}}function hideHints(){suggestionsDiv.style.display="none"}function disableHints(){suggestionsDiv.style.display="none";artcoreSuggestCanRun=0}function hintMouseOver(e){var x=document.getElementById(hintsIds+e);x.style.backgroundColor=overBgColor+"";x.style.color="white";selectedHint=e}function hintMouseOut(e){try{var x=document.getElementById(hintsIds+e);x.style.backgroundColor="white";x.style.color="green"}catch(E){alert(e+"\n"+E)}}function outHints(){for(var i=0;i<numberOfHints;i++){try{var x=document.getElementById(hintsIds+i);x.style.backgroundColor="white";x.style.color="green"}catch(E){}}}function hintOnClick(e){artcoreSuggestCanRun=0;searchTxt.value=(rezultate[e]).trim().substring(rezultate[e].indexOf("*</span>"));hideHints();searchForm.submit()}function removeBold(t){var s=t;return t.trim()}function selectAHint(e){var keynum;if(window.event){keynum=e.keyCode}else{if(e.which){keynum=e.which}}outHints();if(keynum==sageataJos){artcoreSuggestCanRun=0;selectedHint++;var max=numberOfHints-3;if(selectedHint>max){selectedHint=max}searchTxt.value=(rezultate[selectedHint]).trim().substring(rezultate[selectedHint].indexOf("*</span>"));hintMouseOver(selectedHint);return}if(keynum==sageataSus){artcoreSuggestCanRun=0;selectedHint--;if(selectedHint<0){selectedHint=0}searchTxt.value=(rezultate[selectedHint]).trim().substring(rezultate[selectedHint].indexOf("*</span>"));hintMouseOver(selectedHint);return}if(keynum==27){hideHints();return}artcoreSuggestCanRun=1;selectedHint=-1}function truncateHints(){for(var i=0;i<rezultate.length;i++){rezultTrun[i]=rezultate[i]}}function refineResults(e){return false}function txtFocus(e,defaultValue){if(e.value==defaultValue){e.value=""}e.style.backgroundColor="#FEFE88"}function txtBlur(e,defaultValue){if(e.value==""||e.value==" "){e.value=defaultValue}e.style.backgroundColor="white"};
