var propertyCount=new Array();var searchedCustomNo="";var searchedCustomValue="";var propertyList=new Array();var countedProps=0;var shippingTotalProductsNo=1;var currentShippingItem=1;var lastQuickSearchKwd='';var quickSearchIframe=null;var filterValuesUL=new Array();var ajaxSiteRoot='';function BasketTotalCallback(res)
{if(res&&res.value)
{var totalsContainer=document.getElementById("headerBasket");if(totalsContainer)
{totalsContainer.innerHTML=res.value;}}}
function CalculateBasketTotals()
{Header.GetBasketTotal(BasketTotalCallback);}
function SetPageCallBack(res)
{}
function SetLastVisitedPage()
{if(typeof MasterPage!="undefined"&&MasterPage!=null)
{MasterPage.SetLastVisitedPage(window.location.pathname,SetPageCallBack);}}
function ErrorMessageCallBack(res)
{var ajaxErrorDiv=document.getElementById("ajaxError");if(ajaxErrorDiv&&res.value)
{var errorUL=ajaxErrorDiv.getElementsByTagName("ul");if(errorUL[0])
{errorUL[0].innerHTML="";for(var i=0;i<res.value.length;i++)
{if(res.value[i].Field!=null)
{errorUL[0].innerHTML+="<li>"+res.value[i].Field+" - "+res.value[i].Message+"</li>";}
else
{errorUL[0].innerHTML+="<li>"+res.value[i].Message+"</li>";}}}
ajaxErrorDiv.className=ajaxErrorDiv.className.replace("hide","");}}
function GetErrorMessage()
{if(BasketPage)
{BasketPage.GetErrorMessage(ErrorMessageCallBack);}}
function CouponsCallBack(res)
{var basketCoupons=document.getElementById("basketCoupons");var getErrorMessage=false;if(basketCoupons)
{if(res&&res.value)
{if(res.value.length>0)
{var htmlCoupons=basketCoupons.getElementsByTagName("DIV");if(htmlCoupons.length>0)
{for(var i=0;i<htmlCoupons.length;i++)
{var div=htmlCoupons[i];if(div.id!="")
{if(!CouponExistsInCollection(div.id,res.value))
{basketCoupons.removeChild(div);getErrorMessage=true;}}}}}
else
{basketCoupons.innerHTML="";basketCoupons.className+=" hide";getErrorMessage=true;}}}
if(getErrorMessage)
{GetErrorMessage();}}
function GetBasketCoupons()
{var basketCoupons=document.getElementById("basketCoupons");if(basketCoupons&&BasketPage)
{BasketPage.GetRemovedCoupons(CouponsCallBack);}}
function CouponExistsInCollection(couponCode,couponCollection)
{if(couponCollection==null||couponCollection.length==0)
return false;else
{for(var i=0;i<couponCollection.length;i++)
{if(couponCollection[i].Code==couponCode)
{return true;}}}
return false;}
function AddProductCountToProperty(productNo,customNo)
{if(propertyCount&&propertyCount.length>0)
{for(var i=0;i<propertyCount.length;i++)
{var elem=propertyCount[i].split('^');if(elem[0]==customNo)
{elem[1]+=productNo;propertyCount[i]=elem[0]+"^"+elem[1];break;}}}}
function HideExcessHTML()
{if(propertyCount&&propertyCount.length>0)
{for(var i=0;i<propertyCount.length;i++)
{var elem=propertyCount[i].split('^');if(elem[1]==0)
{var mainPropContainer=document.getElementById('rnk-filter-'+elem[0].replace('span-',''));if(mainPropContainer)
{mainPropContainer.className="hide";}}}}}
function IncreaseAddedNo()
{countedProps++;if(countedProps==propertyList.length)
{HideExcessHTML();}}
function ProductCountCallBack(res)
{if(res&&res.value)
{if(res.value!='')
{var ret=res.value.split("^");if(ret&&ret.length==3)
{var currentProperty=document.getElementById(ret[0]+"-"+ret[1]);var propertyLI=document.getElementById("li-"+ret[0]+"-"+ret[1]);if(ret[2]>0)
{if(currentProperty)
{currentProperty.innerHTML=ret[2];AddProductCountToProperty(ret[2],ret[0]);}}
else
{propertyLI.className="hide";}
IncreaseAddedNo();}}}}
function AddCustomToArray()
{if(searchedCustomNo&&searchedCustomNo!='')
{if(propertyCount&&propertyCount.length>0)
{var customFound=false;for(var i=0;i<propertyCount.length;i++)
{if(propertyCount[i].indexOf(searchedCustomNo)!=-1)
{customFound=true;break;}}
if(customFound==false)
{propertyCount.push(searchedCustomNo+"^0");}}
else
{propertyCount.push(searchedCustomNo+"^0");}}}
function ProductCount(customNo,customValue,addSqlString)
{if(typeof SearchFilters!="undefined"&&SearchFilters!==null)
{searchedCustomNo=customNo;searchedCustomValue=customValue;AddCustomToArray();SearchFilters.GetProductNumberForValue(customNo,customValue,addSqlString,ProductCountCallBack);}
else
{document.write("");}}
function AddPropertyToArray(customNo,customValue,addSqlString)
{var propertyLine=new Array();propertyLine[0]=customNo;propertyLine[1]=customValue;propertyLine[2]=addSqlString;propertyList.push(propertyLine);var test='';}
function AddFilterValueUL(ulElement)
{if(ulElement)
{var addElement=true;for(var i=0;i<filterValuesUL.length;i++)
{if(filterValuesUL[i]==ulElement)
{addElement=false;break;}}
if(addElement==true)
{filterValuesUL.push(ulElement);}}}
function SetFilterHMTL(productNoResult)
{if(productNoResult&&productNoResult.length==4)
{var currentProperty=document.getElementById(productNoResult[0]+"-"+productNoResult[1]);var propertyLI=document.getElementById("li-"+productNoResult[0].replace("span-","")+"-"+productNoResult[1]);if(productNoResult[3]>0)
{if(currentProperty)
{currentProperty.innerHTML=productNoResult[3];AddProductCountToProperty(productNoResult[3],productNoResult[0]);}}
else
{if(propertyLI)
{var liParent=null;if(typeof propertyLI.parentElement!='undefined'&&propertyLI.parentElement!=null)
{liParent=propertyLI.parentElement;}
else
{liParent=propertyLI.parentNode;}
AddFilterValueUL(liParent);propertyLI.className="hide";}}
IncreaseAddedNo();}}
function CountProductsCallBack(res)
{if(res&&res.value&&res.value.length>0)
{for(var i=0;i<res.value.length;i++)
{SetFilterHMTL(res.value[i]);}
HideUsingClass('rnk_filter_loader');ShowUsingClass('rnk_applied_filters');ShowUsingClass('rnk_search_filter');}}
function CountProducts(totalAddedProperties)
{if(typeof AjaxPro!="undefined"&&AjaxPro!==null)
{AjaxPro.timeoutPeriod=15000;AjaxPro.onTimeout=function(b,res){return false;}}
HideUsingClass('rnk_applied_filters');HideUsingClass('rnk_search_filter');ShowUsingClass('rnk_filter_loader');if(propertyList&&propertyList.length==totalAddedProperties)
{for(var i=0;i<propertyList.length;i++)
{searchedCustomNo=propertyList[i][0];searchedCustomValue=propertyList[i][1];AddCustomToArray();}
if(typeof SearchFilters!="undefined"&&SearchFilters!==null)
{SearchFilters.GetProductNumberForFilterList(propertyList,CountProductsCallBack);}}}
function ProductPageSetFilters(totalAddedProperties,categoryId)
{if(typeof AjaxPro!="undefined"&&AjaxPro!==null)
{AjaxPro.timeoutPeriod=15000;AjaxPro.onTimeout=function(b,res){return false;}}
HideUsingClass('rnk_applied_filters');HideUsingClass('rnk_search_filter');ShowUsingClass('rnk_filter_loader');if(propertyList&&propertyList.length==totalAddedProperties)
{for(var i=0;i<propertyList.length;i++)
{searchedCustomNo=propertyList[i][0];searchedCustomValue=propertyList[i][1];AddCustomToArray();}
if(typeof SearchFilters!="undefined"&&SearchFilters!==null)
{SearchFilters.GetProductNumberForFilterList(propertyList,categoryId,CountProductsCallBack);}}}
function GetShippingTaxCallBack(res)
{if(res&&res.value)
{HideUsingClass('rnk_loader');RemoveIframe('rnk-shipping-popup');HideUsingClass('rnk-shipping-popup');if(shippingTotalProductsNo==1)
{if(res.value.length>1)
{var productPageOutput=document.getElementById('tax-'+currentShippingItem);var prodPageLink=document.getElementById('shippLink-'+currentShippingItem);if(productPageOutput)
{productPageOutput.innerHTML=res.value[1]+'&nbsp;';}
if(prodPageLink)
{prodPageLink.innerHTML='alt oras';}}}
else
{for(var i=0;i<shippingTotalProductsNo;i++)
{var productPageOutput=document.getElementById('tax-'+(i+1));var prodPageLink=document.getElementById('shippLink-'+(i+1));if(productPageOutput)
{productPageOutput.innerHTML=res.value[i]+'&nbsp;';}
if(prodPageLink)
{prodPageLink.innerHTML='alt oras';}}}}
shippingTotalProductsNo=1;}
function GetShippingTax(cityDDL,stateDDLId,productWeight)
{var weigths=productWeight.split("^");shippingTotalProductsNo=weigths.length;var stateDDL=document.getElementById(stateDDLId);if(typeof Header!="undefined"&&Header!=null&&cityDDL!=null&&stateDDL!=null)
{if(cityDDL.options[cityDDL.selectedIndex].value>0&&stateDDL.options[stateDDL.selectedIndex].value)
{ShowUsingClass('rnk_loader');var cityId=cityDDL.options[cityDDL.selectedIndex].value;var cityName=cityDDL.options[cityDDL.selectedIndex].text;var stateId=stateDDL.options[stateDDL.selectedIndex].value;var stateName=stateDDL.options[stateDDL.selectedIndex].text;if(shippingTotalProductsNo==1)
{Header.GetShippingTotal(stateId,stateName,cityId,cityName,productWeight,GetShippingTaxCallBack);}
else
{Header.GetMultiShippingTotal(stateId,stateName,cityId,cityName,weigths,GetShippingTaxCallBack);}}}}
function QuickSearchCallBack(res)
{if(res&&res.value)
{quickSearchResNo=parseInt(res.value[0]);var quickHolder=document.getElementById('quickSearch');if(quickSearchResNo>0)
{if(quickHolder)
{quickHolder.innerHTML=res.value[1];if(quickHolder.className.indexOf('hideDiv')>0)
{ShowUsingClass('quickSearch');}
if(IsIE())
{var parent=quickHolder.parentElement;var iFrame=document.createElement("IFRAME");iFrame.setAttribute("src","javascript:'<html></html>'");iFrame.setAttribute("border","0");iFrame.className="quick_search_iFrame";iFrame.style.height=quickHolder.offsetHeight-5;if(quickSearchIframe!=null)
{parent.removeChild(quickSearchIframe);}
quickSearchIframe=iFrame;parent.appendChild(iFrame);}
var link=document.getElementById('quick_search_a'+res.value[0]);if(link)
{link.focus();}}}
else
{if(IsIE())
{var parent=quickHolder.parentElement;if(quickSearchIframe!=null)
{parent.removeChild(quickSearchIframe);quickSearchIframe=null;}}
quickHolder.innerHTML='';HideUsingClass('quickSearch');}}}
function QuickSearch(kwd,minLength,siteRoot,e)
{var key;if(window.event){key=e.keyCode;}
else if(e.which){key=e.which;}
var input=document.getElementById('ctl00_header_kwd');if((key>=48&&key<=57)||(key>=65&&key<=90)||(key>=96&&key<=105)||(key==8)||(key==46)||(key==190)||(key==222)||(key==109))
{quickSearchCurrentLink=-1;if(kwd.length>=minLength)
{if(lastQuickSearchKwd!=kwd)
{if(typeof SearchBox!="undefined"&&SearchBox!=null)
{lastQuickSearchKwd=kwd;input.setAttribute("autocomplete","off");SearchBox.QuickSearch(kwd,QuickSearchCallBack);}}}
else
{input.removeAttribute("autocomplete");lastQuickSearchKwd='';quickSearchResNo=0;quickSearchCurrentLink=-1;if(IsIE())
{var quickHolder=document.getElementById('quickSearch');var parent=quickHolder.parentElement;if(quickSearchIframe!=null)
{parent.removeChild(quickSearchIframe);quickSearchIframe=null;}}
HideUsingClass('quickSearch');}
return true;}
else
{if(key==13&&input)
{CrossPostASPForm(siteRoot+'/c-All-page-1.aspx');return false;}}}
function ProductDetailsCallBack(res)
{if(res&&res.value)
{if(res.value.length==2)
{var overDetails=document.getElementById('overDetailsStart');if(overDetails)
{var imageHolder=document.createElement('DIV');imageHolder.className='floatleft overImageHolder';var image200=document.createElement('IMG');image200.src=res.value[0];imageHolder.appendChild(image200);overDetails.appendChild(imageHolder);var detailsHolder=document.createElement('DIV');detailsHolder.className='floatleft homeOverDetails';detailsHolder.innerHTML=res.value[1];overDetails.appendChild(detailsHolder);ShowUsingClass('overDetailsStart');HideUsingClass('overLoaderImage');}}}
else
{}}
function LoadProductDetails(prodIndex,specialCode,link)
{if(typeof HomePage!="undefined"&&HomePage!=null)
{HomePage.AjaxProductDetails(prodIndex,specialCode,ProductDetailsCallBack);return'<div class="homeOverProductDetails"><div id="overDetailsStart" class="hideDiv"></div><div id="overLoaderImage" class="overHomeLoader"><img src="'+ajaxSiteRoot+'/images/filter-loader.gif" alt="Loading ..." /></div></div>';}
else
{return link.title;}}
function GetSpecialProductsCallBack(res)
{if(res&&res.value)
{var previousPageId='page_'+(res.value[1]-res.value[6]);var prevPageElem=document.getElementById(previousPageId);if(res.value[9]==null)
{fade(previousPageId,1000);return;}
if(prevPageElem)
{var parentElement=null;if(typeof prevPageElem.parentElement!='undefined'&&prevPageElem.parentElement!=null)
{parentElement=prevPageElem.parentElement;}
else
{parentElement=prevPageElem.parentNode;}
if(parentElement)
{var newPageId='page_'+res.value[1];var newDiv=document.createElement('div');newDiv.className='innerSpecial';newDiv.id=newPageId;newDiv.style.width=res.value[8]*138+'px';newDiv.innerHTML=res.value[9];if(res.value[5]==true)
{newDiv.style.opacity='0';newDiv.style.filter='alpha(opacity = 0)';newDiv.FadeState=-2;}
var leftNavId=res.value[0].replace('right','left');var rightNavId=res.value[0].replace('left','right');var leftNav=document.getElementById(leftNavId);var rightNav=document.getElementById(rightNavId);if(leftNav)
{if(res.value[1]-1>=1)
{leftNav.onclick=function(){GetSpecialProducts(this,res.value[1]-1,res.value[5],res.value[3],res.value[4],res.value[2],-1);return false;}
leftNav.style.cursor='pointer';leftNav.title='Produsele anterioare';}
else
{leftNav.onclick=function(){return false;}
leftNav.style.cursor='default';leftNav.title='';}}
if(rightNav)
{if((res.value[1]<res.value[7]))
{rightNav.onclick=function(){GetSpecialProducts(this,res.value[1]+1,res.value[5],res.value[3],res.value[4],res.value[2],1);return false;}
rightNav.style.cursor='pointer';rightNav.title='Produsele urmatoare';}
else
{rightNav.onclick=function(){return false;}
rightNav.style.cursor='default';rightNav.title='';}}
if(res.value[5]==true)
{parentElement.removeChild(prevPageElem);parentElement.appendChild(newDiv);fade(newPageId,1300);}
else
{parentElement.removeChild(prevPageElem);parentElement.appendChild(newDiv);}}}}}
function GetSpecialProducts(navButton,pageNo,useFade,cacheKey,specialCode,productNo,direction)
{navButton.onclick=function(){return false;}
navButton.style.cursor='default';navButton.title='';if(useFade==true)
{var containerId='page_'+(pageNo-direction);var currentPageElement=document.getElementById(containerId);if(currentPageElement)
{currentPageElement.FadeState=2;fade(containerId,800);}}
if(typeof HomeSpecialProducts!="undefined"&&HomeSpecialProducts!=null)
{var t=setTimeout("HomeSpecialProducts.GetSpecialProducts('"+navButton.id+"', "+pageNo+", "+productNo+", '"+cacheKey+"', '"+specialCode+"', "+useFade+", "+direction+", GetSpecialProductsCallBack)",800);}}