﻿
function ChangeDivDisplay(divId){var element=document.getElementById(divId);if(element==null){alert(templateStrings.GetUnableFindDivElement());return false;}
element.style.display=(element.style.display=="none")?"":"none";}
function AddProductToCart(productId,title,thumb){var qty=1;if(isNaN(qty)){alert("Quantità in formato errato!");qty=1;elementQty.value=qty;}
AddToCart(productId,title,qty,thumb);}
function AddEventOnObject(element,onEvent,eventCode){if(element==null){alert("Impossibile aggiundere un evento ad un oggetto vuoto!");return false;}
if(onEvent==null||eventCode==null){alert("Specificare l'evento e/o il codice da associare!");return false;}
if(element.addEventListener){onEvent=onEvent.substring(2);element.addEventListener(onEvent,eventCode,false);}else if(element.attachEvent)
element.attachEvent(onEvent,eventCode);return true;}
function IsAttributeNull(attribute){return(attribute==null||attribute.value=="null");}
function SetLocation(newUrl){document.location=newUrl;}
function ChangeLanguage(newLanguage){var thisLocation=document.location.toString();thisLocation=thisLocation.replace(/(lng=)(it|en)[&|#]/g,"");thisLocation=thisLocation.replace(/(lng=)(it|en)$/g,"");if(thisLocation.indexOf("?")==-1)
thisLocation+="?";thisLocation+=(thisLocation.match(/(&|\?)$/g))?"lng=":"&lng=";thisLocation+=newLanguage;SetLocation(thisLocation);}
function NewSampleSearch(){var description=document.getElementById('description_search');if(description==null){alert("Occorre specificare una chiave di ricerca!");return false;}
var keySearch=escape(description.value);SetLocation("search.aspx?description="+keySearch);}
