var xmlProductFilter;
function GetXmlHttpObject(){
var xmlHttp=null;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e){
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
var filterByChoice="";
function displayByFilterMenu(productId,filterType,selectMenu,dept){
filterByChoice=filterType;
xmlProductFilter=GetXmlHttpObject();
var filterCriteria=selectMenu.options[selectMenu.options.selectedIndex].value;
var url="index.cgi";
url=url+"?productFilter="+filterType+"&prt="+productId+"&filterCriteria="+filterCriteria+"&dept="+dept;
//alert(url);
xmlProductFilter.onreadystatechange=displayProductsByFilterMenu;
xmlProductFilter.open("GET",url,true);
xmlProductFilter.send(null);
}
function displayProductsByFilterMenu(){
if (xmlProductFilter.readyState==4){
if(xmlProductFilter.responseText != "" || xmlProductFilter.responseText != false){
document.getElementById('productTableContainer').innerHTML=xmlProductFilter.responseText;
}
else{
alert("Unable to update products with your 'Filter by "+filterByChoice+"' choice");
}
}
return false;
}
/*~~~~~~~~~~~~~~~~~~~~~~~ additonal jQuery code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
department - category shopping menu
*/
$(function(){
var theMenuId='#prodMenu ul';
$(theMenuId+' li ul').hide();
var activeNode=$.cookie('activeMenu');
$('#'+activeNode+' ul').show();
$('#'+activeNode).addClass('activeMenu');
var activeItem=$.cookie('activeItem');
$('#'+activeItem).addClass('activeItem');
$(theMenuId+' li').each(function(){
var thisId=$(this).attr('id');
$(this).click(function(){
if($('#'+thisId+' ul').css('display') != 'none'){
$(theMenuId+' li ul').hide(0);
}
else{
$(theMenuId+' li ul').hide(0);
$('#'+thisId+' ul').show(0);
}
$.cookie('activeMenu',thisId);
});
$('#'+thisId+' ul li a').click(function(){
$.cookie('activeItem',$(this).parent().attr('id'));
});
});
});
/*
code for the the vat exemption purchase
if no vatExemtion cookie
append a div with id dialog to the body
add the content of the #dialog
set the dialog as a jQ-UI dialog with the button actions
add an on click event to all 'input' with 'class btnAdd' of 'type=image
display the VAT exempt form as another method of setting the cookie
when the user clicks the add to cart button the dialog opens
asking if the user is VAT exempt
A cooke is set with the result
if vatExempt cookie exists do nothing
*/
$(function () {
//if no vatExemtion cookie
if (!$.cookie('vatExemption')) {
// append a div with id dialog to the body
// add the content of the #dialog
$('body').append("
");
$('#dialog').attr('title', 'Are you eligible for VAT exemption?');
$('#dialog').append('
If you have a long-term illness or you’re disabled, you don’t have to pay VAT on certain goods and services that you buy in the UK. In general the equipment covered by this scheme are things that are of practical help to you because of your illness or disability. If claiming VAT Exemption, please ensure you read our VAT Exemption Scheme page for full details of the scheme and eligibility before placing an order.
By clicking Yes you confirm you or the person on whose behalf you are ordering goods qualifies for VAT exemption under the terms of the scheme, and you will not be charged VAT on qualifying items in your order. Please note there are penalties for making false declarations.
For those who do not meet the vat exemption criteria and those products which are not vat exempt items, vat at the standard rate will be added to the prices shown at the shopping basket stage i.e vat must be paid where applicable
');
// set the dialog as a jQ-UI dialog with the button actions
$('#dialog').dialog({
modal: true,
autoOpen: false,
width: 600,
buttons: {
"No, I am not VAT exempt": function () {
$.cookie('vatExemption', 'No');
$('#vatExemptForm').remove();
$('#' + formId).append('').submit();
$(this).dialog("close");
return true;
},
"Yes, I am VAT exempt": function () {
$.cookie('vatExemption', 'Yes');
$('#vatExemptForm').remove();
$('#' + formId).append('').submit();
$(this).dialog("close");
return true;
}
}
});
var formCounter = 0;
var formId;
var buttonId;
$('form.productRow').each(
function () {
formCounter++;
$(this).attr('id', 'productRow_' + formCounter);
$('#productRow_' + formCounter + ' input[type=image]')
.attr('id', 'addToBasket_' + formCounter)
.attr('rel', 'productRow_' + formCounter)
.click(function () {
buttonId = $(this).attr('id');
formId = $(this).attr('rel');
$('#dialog').dialog('open');
return false;
});
}
);
$(function(){
$('#multiProductForm input[type=image]')
.click(function () {
buttonId = 'addButton_1';
formId = 'multiProductForm';
$('#dialog').dialog('open');
return false;
});
}
);
// display the VAT exempt form as another method of setting the cookie
$('#vatExemptForm').show().click(function(){
$('#dialog').dialog('open');
});
}
else {
$('#vatExemptForm').remove();
}
});
/* remove the value of the keywords when taken focus to save manual deletion*/
$(function(){
$('#keywords').focusin(function(){
$(this).animate({opacity:1.0},250,function(){
$(this).attr('value','');
});
});
$('#keywords').focusout(function(){
var tv=$(this).attr('value');
if(tv == ''){
$(this).attr('value','Enter Keywords...');
}
});
});