 function LoadGallery(pictureName, imageFile) { var preload = document.getElementById('preload_'+current_preload); if(document.all) { document.getElementById('preloaded_img_'+current_preload).style.filter="blendTrans(duration=1)"; document.getElementById('preloaded_img_'+current_preload).filters.blendTrans.Apply(); document.getElementById('preloaded_img_'+current_preload).filters.blendTrans.Play(); } sty = preload.style; sty.display = 'none'; var new_preload = document.getElementById('preload_'+imageFile); if (document.all) { document.getElementById('preloaded_img_'+imageFile).style.filter="blendTrans(duration=1)"; document.getElementById('preloaded_img_'+imageFile).filters.blendTrans.Apply(); document.getElementById('preloaded_img_'+imageFile).filters.blendTrans.Play(); } sty = new_preload.style; sty.display = 'block'; current_preload = imageFile; } function popup2(topic) { aPopUp= window.open(topic,'PopupViewer','scrollbars=yes,location=no,status=no,menubar=0,directories=no,top=0,left=0,width=390,height=360,titlebar=no'); self.aNoteWin = aPopUp; return false; } function popup(topic, width, height) { aPopUp= window.open(topic,'PopupViewer','scrollbars=yes,location=no,status=no,menubar=0,directories=no,top=0,left=0,width='+width+',height='+height+',titlebar=no'); self.aNoteWin = aPopUp; return false; } function popupWindow(image_id, product_id) { LeftPosition = (screen.width) ? (screen.width-500)/2 : 0; TopPosition = (screen.height) ? (screen.height-500)/2 : 0; settings = 'height=570,width=540,top='+TopPosition+',left='+LeftPosition+',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1'; win = window.open("/view_image.html?image_id=" + image_id+ "&product_id="+product_id,null,settings); } function confirmAction(strMsg) { var bAnswer = confirm (strMsg); if (bAnswer) { return true; } else { return false; } } /* Generic Form Validation */ window.onload = attachFormHandlers; function attachFormHandlers() { if (document.getElementsByTagName) { var objForm = document.getElementsByTagName('form'); for (var iCounter=0; iCounter<objForm.length; iCounter++) { objForm[iCounter].onsubmit = function(){return checkForm(this);} } } } function checkForm(objForm) { var arClass, bValid; var objField = objForm.getElementsByTagName('*'); for (var iFieldCounter=0; iFieldCounter<objField.length; iFieldCounter++) { arClass = objField[iFieldCounter].className.split(' '); for (var iClassCounter=0; iClassCounter<arClass.length; iClassCounter++) { switch (arClass[iClassCounter]) { case 'fullname': bValid = isName(objField[iFieldCounter].value.replace(/^\s*|\s*$/g, '')); break; case 'string': bValid = isString(objField[iFieldCounter].value.replace(/^\s*|\s*$/g, '')); break; case 'number' : bValid = isNumber(objField[iFieldCounter].value); break; case 'email' : bValid = isEmail(objField[iFieldCounter].value); break; case 'telephone' : bValid = isTelephone(objField[iFieldCounter].value); break; case 'postcode' : bValid = isPostcode(objField[iFieldCounter].value); break; case 'password' : bValid = isPassword(objField[iFieldCounter].value); break; case 'check' : bValid = isChecked(objField[iFieldCounter].checked); break; default: bValid = true; } if (bValid == false) { s = new String(objField[iFieldCounter].name); s = s.replace(/_/g," "); alert('Please review the value you entered for ' + s); objField[iFieldCounter].select(); objField[iFieldCounter].focus(); return false; } } } return true; } function strpos( haystack, needle, offset) { var i = haystack.indexOf( needle, offset); return i >= 0 ? i : false; } function isName(strValue) { return (typeof strValue == 'string' && strpos(strValue,' ',0) !== false && strValue != '' && isNaN(strValue)); } function isString(strValue) { return (typeof strValue == 'string' && strValue != '' && isNaN(strValue)); } function isNumber(strValue) { return (!isNaN(strValue) && strValue != ''); } function isChecked(blnChecked) { return blnChecked; } function isTelephone(strValue) { return (strValue != ''); } function isPostcode(strValue) { if(document.getElementById('postcode_mandatory')) { if(document.getElementById('postcode_mandatory').style.visibility == 'hidden') { return true; } else { return (strValue.length >= 3); } } else { return (strValue.length >= 3); } } function isPassword(strValue) { return (strValue != ''); } function isEmail(strValue) { var objRE = /^[\w-\.\']{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,}$/; return (strValue != '' && objRE.test(strValue)); } function centralisedpopup(mypage, myname, w, h, scroll, status) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',menubar=no,location=no,resize=yes,status='+status+''; win = window.open(mypage, myname, winprops); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } }

function doChangeImage(img) {
  document.getElementById('image_left').innerHTML = '<img src="/javascript/'+img+'" border="0" align="middle" height="384" width="383" />';
}

function changeBestSellerImg(src,href)
{
  //alert(src);
  document.getElementById("top_product_img").src=src;
  document.getElementById("top_product_link").href=href;
  //document['sim2'].src=src;
  return;
}

function scrollUp(elem)
{
  var scroller = document.getElementById(elem);
  if (scroller.scrollTop > 0)
  {
    scroller.scrollTop = scroller.scrollTop - 97;
  }
}
function scrollDown(elem)
{
  var scroller = document.getElementById(elem);
  if (scroller.scrollTop < scroller.scrollHeight)
  {
    scroller.scrollTop = scroller.scrollTop + 97;
  }
}
