// MS: This script returns stock availability for 1 to 5 day template-->
function StockLevels(pItem)
{
var strIDs = 'Stock Message: '
{
if (pItem >= 1)
{
strIDs = '1-3 days (<b>' + pItem + ' in stock</b>)'
}
else
{
strIDs = '3-5 days'
}
}
return strIDs
}

// MS: This script returns stock availability for 1 to 14 day template-->
function StockLevels2(pItem)
{
var strIDs = 'Stock Message: '
{
if (pItem >= 1)
{
strIDs = '1-3 days (<b>' + pItem + ' in stock</b>)'
}
else
{
strIDs = '10-14 days'
}
}
return strIDs
}

// WM: This script returns stock availability for 1 to 4 Weeks template-->
function StockLevels3(pItem)
{
var strIDs = 'Stock Message: '
{
if (pItem >= 1)
{
strIDs = '1-3 days (<b>' + pItem + ' in stock</b>)'
}
else
{
strIDs = '4 Weeks'
}
}
return strIDs
}


// MS: This script returns item weight text-->
function ItemWeight(wItem)
{
wItem = wItem / 1000
wItem = FormatNumber(wItem,1)
if (wItem > 0)
{
return document.write("<LI>Weight: " + wItem + " kg<br>");
}
}


// MS: This script returns item weight text-->
function KeyGroup(zItem)
{
//zItem = zItem / 1000
//zItem = FormatNumber(zItem,1)
if (zItem != '')
{
return document.write("<LI>Key Group: " + zItem);
}
}


// MS: These scripts return RRP and saving text
function checkrrp(pItem, qItem)
{
pItem = pItem / 100
qItem = qItem.replace(/R&nbsp;/, "")
qItem = qItem.replace(/&#163;/, "")
qItem = qItem.replace(/&#46;/, ".")
qItem = qItem.replace(/&#44;/, "")
if (pItem > qItem)
{
pItem = FormatNumber(pItem,2)
return document.write("<BR><LI><span class='productinfo'>RRP: £" + pItem);
}
}


function Percent(pItem, qItem)
{
pItem = pItem / 100
qItem = qItem.replace(/R&nbsp;/, "")
qItem = qItem.replace(/&#163;/g, "")
qItem = qItem.replace(/&#46;/g, ".")
qItem = qItem.replace(/&#44;/g, "")
percent = 100 - ((qItem/pItem)*100)
percent = FormatPercent(percent,0)
if (percent > 0)
{
return document.write(" (<b>you save " + percent + "%</b>)</span>")
}
}



function FormatNumber(expr, decplaces)
{
var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
while (str.length <= decplaces)
{
str = "0" + str;
}
var decpoint = str.length - decplaces;
return str.substring(0,decpoint) + "." + str.substring(decpoint, str.length);
}



function FormatPercent(expr, decplaces)
{
var str2 = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
while (str2.length <= decplaces)
{
str2 = "0" + str2;
}
var decpoint = str2.length - decplaces;
return str2.substring(0,decpoint)
} 

// MS: This script returns quantity discount text-->
function QtyDiscount(qNum,qPerc)
{
if (qNum > 0)
{
return document.write("<LI>Qty Discount:<b> " + qPerc + "% off " + qNum + " or more</b><br>");
}
}
//
// Begin Of Popup Script For Live Help Popup
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=500,height=450');");
}
// End Of Popup Script -->

// WM: Brands A_Z Drop Down List
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

// WM: Red Price
function Redprice(Red1)
{
var Red = Red1;
if (Red == "Window Grilles")
{
return (Red);
}
else
{
return ("Doesn't work");
}
}
//-->
