﻿// JScript File
imgOpenScreen = new Image();
imgClosedScreen = new Image();
var baseText = null;
var DDSPEED = 10;
var DDTIMER = 15;
var MouseX;
var MouseY;
var scrollTop;
var map = null;
var mapInfo = '';
var mapMarker = null;
var map_to_htmls = [];
var map_from_htmls = [];
var gmarkers = [];
var map_htmls = [];
var marker_names = [];
var txtEmailObject = '';

//variables for menu
var ProductCategName='';
var bgImage='';
var BGClass;
var boardsBG;
//end -----------------
var currentResultDiv;
var ParrotDocTips = '<br><br><br><div class=midAlignLightBlue style="text-align:center; left:33%; position:absolute; width:50%"><h3>Tips:</h3><br>For better performance please reduce the date range.<br>&nbsp;</div>';
var ParrotOrderLoading = 'loading...' //'<br><br><br><br><div class=midAlignLightBlue style="text-align:center; left:33%; position:absolute; width:50%"><h3>Loading Orders...</h3><br>&nbsp;</div>';
var ParrotQuotesLoading = 'loading...' //'<br><br><br><br><div class=midAlignLightBlue style="text-align:center; left:33%; position:absolute; width:50%"><h3>Loading Quotes...</h3><br>&nbsp;</div>';
var ParrotCrdNotesLoading = 'loading...' //'<br><br><br><br><div class=midAlignLightBlue style="text-align:center; left:33%; position:absolute; width:50%"><h3>Loading Credit Notes...</h3><br>&nbsp;</div>';
var ParrotInvoiceLoading = 'loading...' //'<br><br><br><br><div class=midAlignLightBlue style="text-align:center; left:33%; position:absolute; width:50%"><h3>Loading Invoices...</h3><br>&nbsp;</div>';
function InitiateWS()
{
  ParrotWebClient.JScriptsServices.SetPageToBeOpened('home');
}
function showOrHideMenu(visible)
{
var myAccImg = document.getElementById("myAccountPic");
var childMenu1 = document.getElementById("tblDropMenu1");
var adminMenu = document.getElementById("tblAdminMenu");
var leftPosition;
var verticalPosition;
if (childMenu1!==null)
 {
 if (visible=='hide')
   {
    childMenu1.style.display = "none";
    adminMenu.style.display = "none";
   }
 else
   {
   childMenu1.style.display = "inline";
   leftPosition  = findMyAccountLeftPosition(myAccImg); 
   verticalPosition = findMyAccountTopPosition(myAccImg);
   childMenu1.style.left = leftPosition + 'px';
   childMenu1.style.top = verticalPosition +35; 
   adminMenu.style.left = leftPosition - 115 + 'px';  
   } 
 }
}
function hideMenu()
{
var myDiv  = document.getElementById("tblDropMenu1");
var tblAdmin = document.getElementById("tblAdminMenu");
if (myDiv!=null)
  myDiv.style.display = "none";    
  tblAdmin.style.display = "none";     
}
function showOrHideMenu2(visible)
{
var myDiv  = document.getElementById("tblDropMenu1");
var tblAdmin = document.getElementById("tblAdminMenu");
var tdAd  = document.getElementById("tdAdmin");
var tdAd2 = document.getElementById("tdArrow");
if (visible=='hide')
  {
  tblAdmin.style.display = "none";  
  myDiv.style.display = "none";    
  }
else
  {
  tblAdmin.style.display = "inline";
  myDiv.style.display = "inline";  
  tdAd.className = "blackBgWhiteText";
  //tdAd2.className = "blackBgWhiteText";
  }
}

//****Gets position x position for My Account Image 
function findMyAccountLeftPosition(obj)
{
var curleft = 0;
if(obj.offsetParent)
  while(1) 
  {
  curleft += obj.offsetLeft;
  if(!obj.offsetParent)
    break;
  obj = obj.offsetParent;
  }
else if(obj.x)
  curleft += obj.x; 
  return curleft;
}
//**** Gets position y for my account image
function findMyAccountTopPosition(obj)
{
var curtop = 0;
if(obj.offsetParent)
  while(1)
  {
  curtop += obj.offsetTop;
  if(!obj.offsetParent)
    break;
    obj = obj.offsetParent;
  }
else if(obj.y)
  curtop += obj.y;  
  return curtop;
}
//****Gets screen height  - resolution
function getScreenHeight()
{
if (window.screen.width == 800)
  {
return 590;
  }
if (window.screen.width == 1024)
  {
return 650;
  }
if (window.screen.width == 1152)
 {
return 700;
 }
 if (window.screen.width == 1280)
 {
return 790;
 }
}
function ShowInvoice(Document) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';

    var url = 'CustomerInvoices.aspx';
    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption+='scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    window.open(url + '?Inv=' + Document,"", sOption);
}
function ShowCreditNote(Document) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';

    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    window.open('CustomerInvoices.aspx?Crd=' + Document ,"",sOption);
}
function ShowScannedDoc(Document) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';
    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    window.open('ViewPOD.aspx?Pod=' + Document ,"",sOption);
}
function showSelectedImg(imgId)
{
document.getElementById("imgSelected").setAttribute("src",imgId);
var tdId = imgId + "TD";
var allTDs = document.getElementsByTagName("td");
for (var x=0;x<allTDs.length; x ++)
  {
  if (allTDs.item(x).id != tdId)
    {
    allTDs[x].style.backgroungcolor="#ffffff";
    }
  else
    {
    document.getElementById(tdId).style.backgroundColor="#da2728";
    }
  }
}
function printImg() {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';

    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    var imgUrl = document.getElementById("imgSelected").getAttribute("src");
    window.location.href='viewPOD.aspx?img=' + imgUrl;
}
function openHelpFile(HelpFile,point) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';
    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;

    if (HelpFile != null) {
        if (point != undefined) {
            window.open("help/" + HelpFile + "_help.aspx#" + point, "", sOption);
            return;
        }
        else if (point == undefined) {
        window.open("help/" + HelpFile + "_help.aspx", "", sOption);
    }
}
}
function getObj(name)
{
 if (document.getElementById) // test if browser supports document.getElementById
 {
  this.obj = document.getElementById(name);
 }
 else if (document.all) // test if browser supports document.all
 {
  this.obj = document.all[name];
 }
}
function checkedChanged(checkNo)
{
if (checkNo==0)
  {
var adminCheck = new getObj("<%=chkListNewUserRights.clientid%>_5");
var check1 = new getObj("<%=chkListNewUserRights.clientid%>_0");
var check2 = new getObj("<%=chkListNewUserRights.clientid%>_1");
var check3 = new getObj("<%=chkListNewUserRights.clientid%>_2");
var check4 = new getObj("<%=chkListNewUserRights.clientid%>_3");
var check5 = new getObj("<%=chkListNewUserRights.clientid%>_4");
var check6 = new getObj("<%=chkListNewUserRights.clientid%>_6");
var check7 = new getObj("<%=chkListNewUserRights.clientid%>_7");
var check8 = new getObj("<%=chkListNewUserRights.clientid%>_8");
var check9 = new getObj("<%=chkListNewUserRights.clientid%>_9");
  }    
if (adminCheck.obj.checked==true)
  {
  check1.obj.disabled=true;
  check1.obj.checked = false;  
  check2.obj.disabled=true;
  check2.obj.checked = false;  
  check3.obj.disabled=true;
  check3.obj.checked = false;  
  check4.obj.disabled=true;
  check4.obj.checked = false;  
  check5.obj.disabled=true; 
  check5.obj.checked = false; 
  check6.obj.checked = false;  
  check6.obj.disabled=true;
  check7.obj.checked = false;  
  check7.obj.disabled=true;   
  check8.obj.checked = false;  
  check8.obj.disabled=true;   
  check9.obj.checked = false;  
  check9.obj.disabled=true;   
  }
else
  {
  check1.obj.disabled=false;
  check2.obj.disabled=false;
  check3.obj.disabled=false;
  check4.obj.disabled=false;
  check5.obj.disabled=false; 
  check6.obj.disabled=false;   
  check7.obj.disabled=false;   
  check8.obj.disabled=false;   
  check9.obj.disabled=false;   
  }
}
function ShowOrder(orderNo)
{
if (orderNo==null)
{
  return false
}
var leftPosition = screen.availWidth * 0.10;
var topPosition = screen.height - screen.availHeight + 'px';
var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
var w = (screen.availWidth - (leftPosition * 2)) + 'px';

var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
var myTest = window.open('orderList.aspx?Order=' + orderNo,"OrdersAndQuotes",sOption);
if (!myTest) {
    alert('Your order could not be opened because a popup blocker was detected. On the Tools menu, point to Pop-up Blocker, and then click Turn On Pop-up Blocker to turn on the Pop-up Blocker.');
  } 
}
function ShowQuote(quoteNo) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';

    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    window.open('ViewQuotes.aspx?QteNo=' + quoteNo,"OrdersAndQuotes",sOption);
}
function SortCreditNotes(Colname)
{
if (Colname !='')
  {
  __doPostBack('',Colname);
  }
}
function showOrderMovement(orderNo) {
    var leftPosition = screen.availWidth * 0.10;
    var topPosition = screen.height - screen.availHeight + 'px';
    var h = screen.availHeight - (screen.availHeight * 0.25) + 'px';
    var w = (screen.availWidth - (leftPosition * 2)) + 'px';

    var sOption = 'toolbar=yes,location=no,directories=no,resizable=yes,menubar=no,';
    sOption += 'scrollbars=yes,width=' + w + ',height=' + h + ',left=' + leftPosition + 'px,top=' + topPosition;
    window.open('orderMovement.aspx?Order=' +orderNo+'&User=',"OrderMovement",sOption);
}
function cancelOrder(orderNo)
{
var agentUser = new getObj('Agent');
if (agentUser.obj != null){
  if (agentUser.obj.disabled == true){
    alert('You cannot cancel customer orders.');
    return;
    }
  }
var order = new getObj('HideOrderNo');
if (order == null){
  alert('Order ' + orderNo + ' cannot be cancelled at this moment. Please press F5 and open this page again.')
  return;
  }
order.obj.value = orderNo;

var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
var cntrlOrder = new getObj('HideOrderNo');
if(cntrlId.obj == null || cntrlCode.obj == null || cntrlOrder.obj == null){
  return;
  }
var UserId = cntrlId.obj.value;
var CustomerCode = cntrlCode.obj.value;
if (UserId < 0 || CustomerCode.length < 6){
  return;
  }
__doPostBack('<%=btnPost.clientId%>', orderNo);
}
function GetOrderCancellationInfo(result)
{
if (result.search('error') > -1 || result.search('Error') > -1){
  alert(result);
  return;
  }
result = result.replace('<br>','\n')  
if (confirm(result.replace('<br>','\n')) == true){
  var cntrlCancel  = new getObj('divCancelOrder');
  if (cntrlCancel.obj == null){
  alert('Order ' + orderNo + ' cannot be cancelled at this moment. Please press F5 and open this page again.');
  return;
  }  
  cntrlCancel.obj.style.left = screen.width * 0.25 + 'px';
  cntrlCancel.obj.style.top = screen.height /4 + 'px';
  cntrlCancel.obj.style.display = 'block';
  cntrlCancel.obj.className = 'fixedElement';
  //cntrlCancel.obj.style.position = 'absolute';
  }
}
function SubmitOrderCancellation()
{
var cntrlOrder = new getObj('HideOrderNo');
if (cntrlOrder == null){
  alert('Order ' + orderNo + ' cannot be cancelled at this moment. Please press F5 and open this page again.');
  return;
  }
var notes = new getObj('txtCancelNote');
if (notes == null){
  alert('Order ' + orderNo + ' cannot be cancelled at this moment. Please press F5 and open this page again.');
  return;
  }
var cntrlId = new getObj('hideUserID');
if(cntrlId.obj == null){
  alert('Order number not found.\nPlease close this window and try again.');
  return;
  }
ParrotWebClient.JScriptsServices.SubmitOrderCancellation(notes.obj.value,cntrlOrder.obj.value, cntrlId.obj.value, SubmitOrderCancelResult, FailedCallback);
}
function SubmitOrderCancelResult(result, eventArgs)
{
HideControl('divCancelOrder');
SetControlValue('txtCancelNote','');
DisableControl('btnYes');
if (result.length > 0) {
    OpenErrorWindow('', result);
  }
ShowOrderList()
}
function display(imgName, imgUrl,color)
{
GetImg(color);
if(document.images && typeof imgUrl != 'undefined')
{
document[imgName].src = imgUrl.src;
}
}    
function rollYellowLink(imgName, imgUrl)
{
if(document.images && typeof imgUrl != 'undefined')
  document[imgName].src = imgUrl.src;
}
function showEduBoard(typeID)
{
if(typeID>0)
{
document.getElementById("imgEduboard").setAttribute("src","images/products/boards/eduleaf" + typeID + ".jpg");
}
}
function ScreenAnimation(screen)
{
var ImgSrc = document.getElementById("imgScreen").getAttribute("src",false,"");
var imgClosed = ImgSrc.search(screen + 'Closed.jpg');
var imgOpening = ImgSrc.search(screen + 'Opening.gif');
var imgClosing = ImgSrc.search(screen + 'Closing.gif');
if (imgClosed != -1)
{
document.getElementById("imgScreen").setAttribute("src","images/Products/ElectronicMedia/" + screen + "Opening.gif");
document.getElementById("btnScreen").setAttribute("src","images/Products/ElectronicMedia/screenBtn2.jpg");
}
else if (imgOpening != -1)
{
document.getElementById("imgScreen").setAttribute("src","images/Products/ElectronicMedia/" + screen + "Closing.gif");
document.getElementById("btnScreen").setAttribute("src","images/Products/ElectronicMedia/screenBtn1.jpg");
}
else if (imgClosing != -1)
{
document.getElementById("imgScreen").setAttribute("src","images/Products/ElectronicMedia/" + screen + "Opening.gif");
document.getElementById("btnScreen").setAttribute("src","images/Products/ElectronicMedia/screenBtn2.jpg");
}
}
function showPrintPage()
{
var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
sOption+="scrollbars=yes,width=750,height=600,left=100,top=25";
var sWinHTML = $('#divPageContent');
// document.getElementById('<%=grdwithScroll.clientID').innerHTML;
var winprint=window.open("","",sOption);
winprint.document.open();
winprint.document.write('<html><LINK href=PrintCss/Parrot.css rel=Stylesheet><body onload="javascript:print();">');
winprint.document.write(sWinHTML.html());
winprint.document.write('<p style=text-align:center>Copyright &copy Parrot Product (pty) Ltd 2007.All rights reserved.</p>')
winprint.document.write('</body></html>');
winprint.document.close();
winprint.focus();
}
////
function disableOrderControlLinks(found)
{
if (found=='yes')
  {
  var OrderNo = document.getElementById("Order_No");
  if (OrderNo != null || OrderNo !='undefined')
    {
      OrderNo.href = "#";
      OrderNo.style.cursor = "text";
      OrderNo.style.color = "#000000";
    }
  var Date = document.getElementById("DeliveryDate");
  if (Date != null || Date)
    {
      Date.href = "#";
      Date.style.cursor = "text";
      Date.style.color = "#000000";  
    }
  var Order = document.getElementById("CustomerOrder");
  if (Order != null || Order != 'undefined')
    {
      Order.href = "#";
      Order.style.cursor = "text";
      Order.style.color = "#000000";
    }
  var Vat  = document.getElementById("IncVat");
  if (Var != null || Vat != 'undefined')
    {
      Vat.href = "#";
      Vat.style.cursor = "text";
      Vat.style.color = "#000000";
    }
  var Account = document.getElementById("AccStatus");
  if (Account != null || Account != 'undefined')
    {
      Account.href = "#";
      Account.style.cursor = "text";
      Account.style.color = "#000000";
    }
  var Stock = document.getElementById("StockStatus");
  if (Stock != null || Stock != 'undefined')
    {
      Stock.href = "#";
      Stock.style.cursor = "text";
      Stock.style.color = "#000000";  
    }
  var Status  = document.getElementById("OrderStatus");
  if (Status != null || Status != 'undefined')
    {
      Status.href = "#";
      Status.style.cursor = "text";
      Status.style.color = "#000000";  
    }
  var Picking = document.getElementById("PickStatusDesc");
  if (Picking != null || Picking != 'undefined')
    {
      Picking.href = "#";
      Picking.style.cursor = "text";
      Picking.style.color = "#000000";  
    }
  }
}
function DisableCheckBox(name)
{
var check;
var txtBox;
if (name=='1')
{
check = new getObj("<%=chkDeliveryDate.clientid%>");
}
else
{
check = new getObj("chkTaxnumber");
}
check.obj.disabled = true;
}
function getScreenWidth()
{
if (window.screen.width == 800)
  {
return 690
  }
if (window.screen.width == 1024)
  {
return 940
  }
if (window.screen.width == 1152)
 {
return 1000
 }
if (window.screen.width == 1280)
 {
return 950
 } 
}
function showLargeImg(sPicUrl)
{
window.open("popUp.html?" + sPicUrl,"", "top=30, left=200, resizable=0, height=200,width=300");
}

function grayOut(vis, options)    
{   
var optionsoptions = options || {};     
var zindex = options.zindex || 50;    
var opacity = options.opacity || 70;   
var opaque = (opacity / 100);    
var bgcolor = options.bgcolor || '#000000';    
var dark=document.getElementById('darkenScreenObject');   
if (!dark)    
  {   
  // The dark layer doesn't exist, it's never been created.  So we'll     
  // create it here and apply some basic styles.      
  var tbody = document.getElementsByTagName("body")[0];   
  var tnode = document.createElement('div');              
  tnode.style.position='absolute';   
  tnode.style.top='0px';   
  tnode.style.left='0px';      
  tnode.style.overflow='hidden';   
  tnode.style.display='none';   
  tnode.id='darkenScreenObject';   
  tnode.className = "Loading";
  tbody.appendChild(tnode);                               
  dark=document.getElementById('darkenScreenObject');       
  }     
if (vis)   
  {    
  var pageWidth='100%';    
  var pageHeight='100%';    
  dark.style.opacity=opaque;    
  dark.style.MozOpacity=opaque;          
  dark.style.filter='alpha(opacity='+opacity+')';    
  dark.style.zIndex=zindex;   
  dark.style.backgroundColor=bgcolor;    
  dark.style.width= pageWidth;     
  dark.style.height= pageHeight;    
  dark.style.display='block';      
  }   
else   
  {      
  dark.style.display='none';    
  }   
}   
function showErrorMsg(strTitle,strMsg) 
{
    OpenErrorWindow(strTitle, strMsg);
}
function closeWindow()
{
 window.close();
}
function EnableUpdateBtn(controlId,btn)
{
  document.getElementById(controlId).style.color = "#000000";
  document.getElementById(btn).disabled = false;
}

function moveCursor(e, BoxId){
var unicode=e.keyCode? e.keyCode : e.charCode
var IDPrefix; 
var IDSuffix = parseInt(getBoxIndex(BoxId));
if (IDSuffix > -1)
 {
 IDPrefix = BoxId.slice(0,BoxId.length-1);
 }
else
{
 IDPrefix = BoxId.slice(0,BoxId.length-1);
}
if (unicode!= 9 && unicode!= 20 && unicode!= 16 && unicode!= 17 && unicode!= 18 && unicode!= 32)
{
  var digit = String.fromCharCode(unicode);
  var txtBox; 
  var id;
  var isNumber = IsNumeric(digit);
  if (unicode > 95 && unicode < 106)
    {
    isNumber = true;
    }
  if (isNumber==true) 
    {
    id = BoxId + '';  
    }
  else
    {
    //move cursor to left if left arrow key is pressed
    if (unicode==37) 
      {
      if (IDSuffix > 2)
        {
        IDSuffix = IDSuffix - 2;        
        }
      else
        {
        BoxId = "ctl00_ctl00_ContentPlaceHolder1_TextContent_txtCsId5"; // 2nd last customercode box
        }  
      }
    //move cursor to right if right arrow key is pressed
    else if (unicode==39)
      {
        if (IDSuffix < 6)
        {
        //IDSuffix = IDSuffix + 1;        
        }
      }
    else
      {
      IDSuffix = IDSuffix - 1;
      }
    if (IDSuffix > -1)
      {
      id = IDPrefix + IDSuffix + '';
      }
    else
      {
      id = BoxId;
      }  
    }
  txtBox = new getObj(id);
  if (txtBox.obj != null)
    {  
    if (isNumber==false && unicode != 37 && unicode != 39)
      {
      txtBox.obj.innerText = "";
      }    
    txtBox.obj.focus(); 
    txtBox.obj.select();     
    }
  }
}
function getBoxIndex(ID)
{
  var BoxIndex = ID.slice(ID.length-1,ID.length)
  if (IsNumeric(BoxIndex)==true)
  {
  return BoxIndex;
  }
  else
  {
  return -1;
  }
}
function IsNumeric(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;

for (i = 0; i < sText.length && IsNumber == true; i++) 
  { 
  Char = sText.charAt(i); 
  if (ValidChars.indexOf(Char) == -1) 
    {
    IsNumber = false;
    }
  }
return IsNumber;
}
function resizeDiv(divId,Shopping)
{
var divElem = new getObj(divId);
var screenW = window.screen.width;
var intTopPartHeight = 220;
var newHeight;
newHeight = window.document.documentElement.clientHeight - intTopPartHeight;
if (newHeight < 536) {
    newHeight = 536;
    //height of the left menu
  }
if (Shopping)
 {
newHeight = newHeight-20;
 }
if(newHeight!= NaN && newHeight!=undefined) 
 { 
 divElem.obj.style.height = newHeight + 'px'; 
 } 
}
function RemoveDivScroll(divId,Shopping)
{
var divElem = new getObj(divId);
divElem.obj.className = "noscroll";
}

function showPopup(){
var popUp = document.getElementById("popupcontent");
var w = window.screen.width;
var h = window.screen.height;
popUp.style.width = "300px";
popUp.style.height = "200px";
if (baseText == null) baseText = popUp.innerHTML;
popUp.innerHTML = baseText + "<div id=\"statusbar\"><button onclick=\"hidePopup();\">Close window</div>";
var sbar = document.getElementById("statusbar");
sbar.style.marginTop = (parseInt(h)-40) + "px";
popUp.style.visibility = "visible";
}
function hidePopup()
{
 var popUp= document.getElementById("popupcontent");
 popUp.style.visibility = "hidden";
}
function Search(SearchPhrase)
{
if (SearchPhrase.length < 1 || SearchPhrase =='Search')
  {
 return;
  }
 else
  {
      window.location.href = 'Search.aspx?=SearchPhrase=' + SearchPhrase;
  } 
}
function ClearSearch(txtBoxID)
{
var txt  = document.getElementById(txtBoxID);
if (!txt.innerHTML.toLowerCase !='search')
  {
  txt.value='';
  }
txt.focus();
}    
function doClick(txtboxID, e)
{
var key; 
if(window.event) 
  key = window.event.keyCode; //IE    
else 
  key = e.which;
if (key == 13) //Enter key
  { 
  var txtSearch = document.getElementById(txtboxID); 
  if (txtSearch != null) 
    { //
    Search(txtSearch.value);
    event.keyCode = 0 
    } 
  }
}
function btnSearchClick(txtBoxID)
{
var txtSearch = new getObj(txtBoxID);
if (txtSearch.obj !=null)
  {
  OpenPageViaMenu(txtSearch.obj.value);  
  //Search(txtSearch.obj.value);
  }
}
function LoadGoogleSearch(txtID)
{
// Create a search control
var searchControl = new GSearchControl();

// site restricted web search with custom label
// and class suffix
var siteSearch = new GwebSearch();
var options = new GsearcherOptions(); 
siteSearch.setUserDefinedLabel("Parrot Products (Pty) Ltd");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("www.parrot.co.za");      
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);       
siteSearch.setResultSetSize(50);
searchControl.setLinkTarget(GSearch.LINK_TARGET_BLANK);

searchControl.addSearcher(siteSearch,options);     

// Establish a keep callback
//searchControl.setOnKeepCallback(null, DummyClipSearchResult);
// tell the searcher to draw itself and tell it where to attach

searchControl.draw(document.getElementById("searchcontrol"));

// execute an inital search
var QString = self.location.href.split("?SearchPhrase"); 
var SearchStr =''
if (txtID!=null)
  {
  var txtSearch = document.getElementById(txtID);
  if(txtSearch!=null)
    {
    SearchStr = txtSearch.value;
    }
  }
if (SearchStr=='')
  {
  if (QString.length>1)
    {
    SearchStr = (QString.length>0)?QString[1]:"";   
    SearchStr = SearchStr.replace(/=/,'');
    }
  }
if (SearchStr !='')
  {
  searchControl.execute(SearchStr);
  }
else
  {
  searchControl.execute("Parrot Products (Pty) Ltd");
  }
}
function DummyClipSearchResult(result) {}
function ScrollToTop(divID)
{
var elem = document.getElementById("<%=grdWithScroll.clientId%>");
if (elem!=null)
  {
  elem.scrollTop = 0;
  }
}
function getScrollTop(elementId)
{
    var elem = document.getElementById(elementId);
if (elem!=null)
  {
  return elem.scrollTop
  }
else
  {
  return 0;
  }  
}
function ShowDateControl(cntlID)
{
var extender = $find(cntlID);
if (extender!=null)
  {
  if(extender._isOpen)
    {extender.hide();}
  else
    {extender.show();}
  }
}
function GetDateFromControl(cntlID)
{
var txtDate = document.getElementById("<%=test.clientId%>");
if (txtDate!=null)
  {
  if (txtDate.value.length > 0)
    {  
    return txtDate.value;
    }
  else
    {
    return '';  
    }
  }
}
// main function to handle the mouse events on menu//
function highMenuItem(docName)
{
//var docName = window.location + '';
var menuItem;
var menuItemsName = '';
if (docName.search('company')> 0)
  {
  menuItemsName = 'CompanyBtn';
  }
else if (docName.search('home')> 0)
  {
  menuItemsName = 'HomeBtn';
  }
else if (docName.search('document')> 0)
  {
  menuItemsName = 'DocumentsBtn';
  }
else if (docName.search('catalogue')> 0)
  {
  menuItemsName = 'CatalogueBtn';
  }
else if (docName.search('contact')> 0)
  {
  menuItemsName = 'ContactUsBtn';
  }
else if (docName.search('myaccount')> 0)
  {
  menuItemsName = 'MyAccountBtn';
  }
if (menuItemsName != null && menuItemsName != '')
  {  
  menuItem = document.getElementById(menuItemsName);
  menuItem.className =  menuItemsName + 'Over';
  }
}
function highlightLogonBtn(image,Highlight)
{
var logonImg = document.getElementById(image);
if (logonImg == 'undefined' || logonImg == null)
{
  return;
}
if (Highlight == true)
{
  if (image == 'logonBtn')
  {
    logonImg.setAttribute("src", "images/logon_over.jpg");
    logonImg.setAttribute("onmouseover", "images/logon_over.jpg");
    logonImg.setAttribute("onmouseout", "images/logon_over.jpg");
  }
  else
  {
    logonImg.setAttribute("src", "images/logon_over.jpg");
  }
 }
else
 {
    logonImg.setAttribute("src", "images/logon_over.jpg");
 }
}
function ddMenu(id,d){
  var mainMnu = document.getElementById(id);
  var subMnu = document.getElementById(id + '_Content');
  
  clearInterval(subMnu.timer);
  if(d == 1){
    clearTimeout(mainMnu.timer);
    if(subMnu.maxh && subMnu.maxh <= subMnu.offsetHeight){return}
    else if(!subMnu.maxh){      
      subMnu.style.display = 'block';
      subMnu.style.height = 'auto';
      subMnu.maxh = subMnu.offsetHeight;
      subMnu.style.height = '0px';
      if (id == 'dlAdmin')
      {
       var myAccImg = document.getElementById("myAccountPic");
       //mainMnu.style.top = 400 + 'px'//(findMyAccountTopPosition(myAccImg) +35) + 'px';
       subMnu.style.left = (findMyAccountLeftPosition(mainMnu) - 150) + 'px';       
       subMnu.style.top = findMyAccountTopPosition(mainMnu) + 'px';       
       var sumMn = document.getElementById('MyAccountBtn_Content');
       sumMn.style.display = "inline";       
      }
      else
      {
       subMnu.style.left = findMyAccountLeftPosition(mainMnu) + 'px';       
      }      
    }
    subMnu.timer = setInterval(function(){ddSlide(subMnu,1)},DDTIMER);
    if (mainMnu.style.display != 'block')
      {
        mainMnu.style.display = 'block';
        mainMnu.style.height = 'auto';
      }
  }else{
  mainMnu.timer = setTimeout(function(){ddCollapse(subMnu)},50);        
  if (id == 'dlAdmin')  
    {
      ddMenu('MyAccountBtn',1)   
    }    
  }
}
// collapse the menu //
function ddCollapse(subMnu){
  subMnu.timer = setInterval(function(){ddSlide(subMnu,-1)},DDTIMER);  
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var mainMnu = document.getElementById(id);
  var subMnu = document.getElementById(id + '_Content');
  clearTimeout(mainMnu.timer);
  clearInterval(subMnu.timer);
if (subMnu.id == 'dlAdmin_Content')
 {
 var sumMn = document.getElementById('MyAccountBtn_Content');
 sumMn.style.display = "block";
 }
if(subMnu.offsetHeight < subMnu.maxh)
 {
 subMnu.timer = setInterval(function(){ddSlide(subMnu,1)},DDTIMER);
 }
}
// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}
function LargeDeliveryArea(area)
{
var imgbox = document.getElementById('imgbox');
var imgMap = document.getElementById('imgMap');
var img = document.createElement('img');
var divRight;
var divBottom;
var link;
var strlink;
var imgWidth;
var imgHeight;

img.src= '../images/delivery_' + area + '.gif';
imgbox.style.visibility='visible';
link = document.createElement('a');
strlink = area + ' ';
link.setAttribute("href","javascript:window.location='Default.aspx\?Area=" + area + "\&ProductPage=installationanddelivery';");
link.setAttribute("title","Click here to view the delivery schedule for this area");
link.appendChild(img)
imgWidth = img.getAttribute("width");
imgHeight = img.getAttribute("height");
//var divCoordinate = getScrollTop('<%=grdWithScroll.ClientID%>');
if (imgWidth == 0)
  {
  imgWidth = imgMap.getAttribute("width");    
  imgHeight = imgMap.getAttribute("height");    
  }
else
  {
  MouseX = MouseX - imgWidth;
  MouseY = MouseY - (imgHeight /2);
  }
MouseX = MouseX - imgWidth;    
MouseY = MouseY - imgHeight;
img.style.cursor = 'hand';
img.style.cursor = 'pointer';
if(img.addEventListener)
{
 img.addEventListener('mouseout',Out,false); 
}
else
{
 img.attachEvent('onmouseout',Out); 
}             
imgbox.innerHTML='';
imgbox.style.position= "absolute";
imgbox.style.left = MouseX;
imgbox.style.top = MouseY;
imgbox.appendChild(link);
}
function Out()
{
 document.getElementById("imgbox").style.visibility='hidden';  
}
function setDefaultDivCoordinates()
{
var imgbox = document.getElementById("imgbox");  
 if (imgbox != 'undefined' || imgbox != null)
 {
 imgbox.style.left= (window.screen.width /2) + 'px';
 imgbox.style.visibility='hidden'; 
 }
}
function CursorCoordinates(e) {
if (document.layers)
  {
  xCoord = e.x;
  yCoord = e.y;
}
else if (document.all)
  {
  xCoord = event.clientX;
  yCoord = event.clientY;
  }
else if (document.getElementById)
 {
   xCoord = e.clientX;
   yCoord = e.clientY;
  }
//self.status = "X= "+ xCoord + "  Y= " + yCoord; 
MouseX = xCoord;
MouseY = yCoord;
}

document.onmousemove = CursorCoordinates;
if(document.captureEvents) {document.captureEvents(Event.MOUSEMOVE);
}
function OpenPage(Url)
{
  window.location = Url;
}
function changeDeliveryArea(OptionAreas)
{
var area = (OptionAreas.options[OptionAreas.selectedIndex].value);
changeDeliveryAreaImg(area);
}
function changeDeliveryAreaImg(area)
{
var img  = document.getElementById('imgDelivery');
if (area == ''){return;}
if (img != 'undefined' || img != null)
  {
  img.setAttribute("src","images/delivery_" + area + ".jpg");
  }
}
function splitQString(ji) 
{
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) 
  {
    ft = gy[i].split("=");
    if (ft[0] == ji) 
    {
      changeDeliveryAreaImg(ft[1]);
      return;
    }
  }
}
function loadPage(page)
{
  window.location.href = 'Default.aspx?ProductPage=' + page;
}
function checkedCustomer(count)
{
var str;
var i;
var customerCheck = new getObj("ctl06_chkCustomers_0");
if (customerCheck== null || customerCheck=='undefined')
{
  return ;
}
if (customerCheck.obj != null)
 {
 if(customerCheck.obj.checked==true)
  {
  str = 'checked';
   for (i=0; i<(count-1);i++)
   {
   customerCheck = new getObj("<%=chkCustomers.clientId%>_" + (i+1));
   customerCheck.obj.disabled = true;
   customerCheck.obj.checked = false;
   }
  }
 else
  {
   for(i=0; i<count;i++)
   {
   customerCheck = new getObj("<%=chkCustomers.clientid%>_" + i);
   customerCheck.obj.disabled = false;
   }
  }
 } 
}
function hideMenuBox()
{
  new getObj("CategoryList").obj.style.visibility='hidden';  
}
function HideMenuWithImages()
{
var menuBox = new getObj('CategoryList');
if (menuBox != 'undefined' || menuBox != null)
  {
  menuBox.obj.innerHTML='';
  menuBox.obj.style.visibility = 'hidden'; 
  }
}
function ResizeMenuDiv(Show)
{
var menuBox = new getObj('CategoryList');
if (menuBox != 'undefined' || menuBox != null)
  {
  menuBox.obj.style.height = window.screen.height / 2.5 + 'px';
  menuBox.obj.style.width = window.screen.width / 2 + 'px';  
  if (Show == true)
    {
        menuBox.obj.style.visibility = 'visible';        
    }
  else
    {
    menuBox.obj.style.visibility = 'hidden'; 
    }  
  }
}
function PositionLoaderImage() {

    var intWidowHeight = jQuery(window).height();
    var intWidowWidth = jQuery(window).width();

    $('#imgLoading').css({ position: 'fixed', top: intWidowHeight * 0.3 + 'px', left: (intWidowWidth / 2) - 41 + 'px' });
    $('#galleryWrapper').css({ position: 'fixed', top: window.screen.height * 0.3 + 'px', left: (intWidowWidth / 2) - 200 + 'px' });
    var intPosLeft = (intWidowWidth / 2) //- ($('#divShoppingDetails').width() / 2);
    $('#divShoppingDetails').css({ width: '99%', top: intWidowHeight - $('#divShoppingDetails').height() + 'px', left: (intWidowWidth / 2) - 150 + 'px', position: 'fixed' });    
}
function EnableLightBox()
{
  $('a[rel^=lightbox]').lightBox();
}
function PositionElementToCenter(id)
{
var ele = new getObj(id);
if (ele != null)
  {
  ele.obj.style.position = 'absolute';
  ele.obj.style.top = screen.height * 0.3 + 'px';
  ele.obj.style.left = (screen.width  /2) - 41 + 'px';
  }
}
function checkMaxLength(e,MaxLength) 
{
var cnt = e.value.length + 1;
var charLeft = (MaxLength - cnt);
var txt = new getObj("notesTxt");
if (txt.obj != null)
  {
    txt.obj.innerText ="You have " + charLeft + " characters left."; 
    return (e.value.length<=MaxLength -2);
  }
}
function showRights(Right)
{
var spanSpace = new getObj(Right);
if (spanSpace.obj == null && Right!='All')
  {
  return;
  }
if (Right=='All')
 {
 var i;
 if (document.getElementById('rightslist') == null){
   return;
   }
 var chkRights = document.getElementById('rightslist').getElementsByTagName('li'); 
 for (i=0; i < chkRights.length; i++)
 {
  var chk = chkRights.item(i);
  chk.className = 'webRightAllow';  
 } 
 return;
 }
else 
 {
 spanSpace.obj.className = "webRightAllow";
 }
}
function FocusOnControl(ControlID)
{
  var cntrol = new getObj(ControlID);
  if (cntrol.obj != null)
  {
    cntrol.obj.focus();  
  }
}
function SetFocus(element) {
    window.scrollTo(0, document.body.scrollHeight);
    document.getElementById(element).focus();
    return true;
} 
//function detectPopupBlocker() {
//  var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
//  if (!myTest) {
//    alert("A popup blocker was detected.");
//  } else {
//    myTest.close();
//    alert("No popup blocker was detected.");
//  }
//}
//window.onload = detectPopupBlocker;
//eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7 m=\'J\';7 W=4Y.55.1L();6(W.2s("1A")!=-1){m=\'1A\'}F 6(W.2s("J")!=-1){m=\'J\'}F 6(W.2s("1E")!=-1){m=\'1E\'}F 6(W.2s("4R")!=-1){m=\'2g\'}7 1D=1q 5r();n 1o$(H){q 8.5p(H)};n D(2u,2Z){6(2u.3k){7 y=2u.3k[2Z];y=c(y)?y:\'K\'}F 6(1d.3j){7 2W=8.5b.3j(2u,1O);7 y=2W?2W[2Z]:1O}q y};n 2t(e){6(e.3w){7 r=e.3w();7 2i=0;7 2a=0;6(8.16&&(8.16.1x||8.16.1z)){2a=8.16.1z;2i=8.16.1x}F 6(8.1e&&(8.1e.1x||8.1e.1z)){2a=8.1e.1z;2i=8.1e.1x}q{\'u\':r.u+2i,\'I\':r.I+2a,\'2J\':r.2J+2i,\'22\':r.22+2a}}}n 38(e){7 x=0;7 y=0;6(m==\'J\'){y=e.2E;x=e.2K;6(8.16&&(8.16.1x||8.16.1z)){y=e.2E+8.16.1z;x=e.2K+8.16.1x}F 6(8.1e&&(8.1e.1x||8.1e.1z)){y=e.2E+8.1e.1z;x=e.2K+8.1e.1x}}F{y=e.2E;x=e.2K;y+=1d.5h;x+=1d.4o}q{\'x\':x,\'y\':y}}n 33(){q L};7 2S=n(){7 1h=23;6(!1h[1])1h=[4,1h[0]];1n(7 37 4p 1h[1])1h[0][37]=1h[1][37];q 1h[0]};n 1g(24,1c,25){6(m==\'2g\'||m==\'1A\'||m==\'1E\'){2Y{24.4r(1c,25,L)}2V(e){}}F 6(m==\'J\'){24.4n("32"+1c,25)}};n 2N(24,1c,25){6(m==\'2g\'||m==\'1A\'||m==\'1E\'){24.4m(1c,25,L)}F 6(m==\'J\'){24.4h("32"+1c,25)}};n 3G(){7 1T=[];1n(7 i=0;i<23.1m;i++)1n(7 j=0;j<23[i].1m;j++)1T.2U(23[i][j]);q 1T};n 3z(3b,3m){1T=[];1n(7 i=3m;i<3b.1m;i++)1T.2U(3b[i]);q 1T};n 1l(2X,3u){7 1h=3z(23,2);q n(){2X[3u].4l(2X,3G(1h,23))}};n 1S(e){6(m==\'2g\'||m==\'1E\'||m==\'1A\'){e.3n=N;e.4C();e.4D()}F 6(m==\'J\'){1d.1c.3n=N}};n Q(3t,3r,3p,3D,g){4.4z=\'2.2\';4.2z=L;4.E=1o$(3t);4.l=1o$(3r);4.9=1o$(3p);4.o=1o$(3D);4.C=0;4.g=g;6(!4.g["1s"]){4.g["1s"]=""}4.1i=0;4.17=0;4.O=0;4.S=0;4.V=20;4.4g=20;4.1r=0;4.1w=0;4.1y=\'\';4.P=1O;6(4.g["1W"]!=\'\'){4.P=8.1a(\'1M\');4.P.5.t=\'1C\';4.P.5.1p=\'1I\';4.P.1Y=\'3M\';4.P.5.2H=\'2G\';4.P.5.3q=\'3s\';4.P.2R=4.g["1X"]+\'<4w/><11 4x="0" 3a="\'+4.g["1X"]+\'" 1f="\'+4.g["1W"]+\'"/>\';4.E.1b(4.P)}4.4E=\'\';4.2C=L;1D.2U(4);4.2P=1l(4,"2F");4.2T=1l(4,"1R")};Q.13.3W=n(){2N(1d.8,"1R",4.2P);2N(4.E,"1R",4.2T);6(4.g["t"]=="1U"){1o$(4.E.H+"-3O").29(4.9)}F{4.E.29(4.9)}4.E.29(4.C)};Q.13.2F=n(e){7 r=38(e);7 x=r[\'x\'];7 y=r[\'y\'];7 X=0;7 Z=0;7 T=4.l;2f(T&&T.1Q!="3x"&&T.1Q!="3v"){X+=T.3A;Z+=T.3F;T=T.3l}6(m==\'J\'){7 r=2t(4.l);Z=r[\'u\'];X=r[\'I\']}Z+=c(D(4.l,\'2l\'));X+=c(D(4.l,\'3d\'));6(m!=\'J\'||!(8.1j&&\'2j\'==8.1j.1L())){Z+=c(D(4.l,\'2h\'));X+=c(D(4.l,\'2p\'))}6(x>c(Z+4.O)){4.2k();q L}6(x<c(Z)){4.2k();q L}6(y>c(X+4.S)){4.2k();q L}6(y<c(X)){4.2k();q L}6(m==\'J\'){4.E.5.26=1}q N};Q.13.30=n(e){1S(e);4.E.5.35=\'3y\'};Q.13.39=n(e){1S(e);4.E.5.35=\'45\'};Q.13.1R=n(e){1S(e);1n(i=0;i<1D.1m;i++){6(1D[i]!=4){1D[i].2F(e)}}6(4.g&&4.g["1B"]==N){6(4.E.5.35!=\'3y\'){q}}6(4.2z){q}6(!4.2F(e)){q}4.2z=N;7 2L=4.l;7 Z=0;7 X=0;6(m==\'2g\'||m==\'1A\'||m==\'1E\'){7 T=2L;2f(T.1Q!="3x"&&T.1Q!="3v"){X+=T.3A;Z+=T.3F;T=T.3l}}F{7 r=2t(4.l);Z=r[\'u\'];X=r[\'I\']}Z+=c(D(4.l,\'2l\'));X+=c(D(4.l,\'3d\'));6(m!=\'J\'||!(8.1j&&\'2j\'==8.1j.1L())){Z+=c(D(4.l,\'2h\'));X+=c(D(4.l,\'2p\'))}7 r=38(e);7 x=r[\'x\'];7 y=r[\'y\'];4.1r=x-Z;4.1w=y-X;6((4.1r+4.V/2)>=4.O){4.1r=4.O-4.V/2}6((4.1w+4.12/2)>=4.S){4.1w=4.S-4.12/2}6((4.1r-4.V/2)<=0){4.1r=4.V/2}6((4.1w-4.12/2)<=0){4.1w=4.12/2}34(1l(4,"3g"),10)};Q.13.3g=n(){7 28=4.1r-4.V/2;7 27=4.1w-4.12/2;7 2e=28*(4.1i/4.O);7 2B=27*(4.17/4.S);6(8.1e.4a==\'47\'){2e=(4.1r+4.V/2-4.O)*(4.1i/4.O)}28+=c(D(4.l,\'2l\'));27+=c(D(4.l,\'3d\'));6(m!=\'J\'||!(8.1j&&\'2j\'==8.1j.1L())){28+=c(D(4.l,\'2h\'));27+=c(D(4.l,\'2p\'))}4.C.5.u=28+\'v\';4.C.5.I=27+\'v\';4.C.5.1p="2r";6((4.1i-2e)<c(4.9.5.G)){2e=4.1i-c(4.9.5.G)}7 2c=0;6(4.g&&4.g["1s"]!=""){7 2c=19}6(4.17>(c(4.9.5.B)-2c)){6((4.17-2B)<(c(4.9.5.B)-2c)){2B=4.17-c(4.9.5.B)+2c}}4.o.5.u=(-2e)+\'v\';4.o.5.I=(-2B)+\'v\';4.9.5.I=4.1y;4.9.5.2H=\'2G\';4.9.5.1p=\'2r\';4.o.5.2H=\'2G\';4.o.5.1p=\'2r\';4.2z=L};n 3o(3c){7 3f="";1n(i=0;i<3c.1m;i++){3f+=5i.5j(14^3c.5e(i))}q 3f};Q.13.2k=n(){6(4.g&&4.g["1Z"]==N)q;6(4.C){4.C.5.1p="1I"}4.9.5.I=\'-1N\';6(m==\'J\'){4.E.5.26=0}};Q.13.2O=n(){4.V=c(4.9.5.G)/(4.1i/4.O);6(4.g&&4.g["1s"]!=""){4.12=(c(4.9.5.B)-19)/(4.17/4.S)}F{4.12=c(4.9.5.B)/(4.17/4.S)}6(4.V>4.O){4.V=4.O}6(4.12>4.S){4.12=4.S}4.V=2D.3e(4.V);4.12=2D.3e(4.12);6(!(8.1j&&\'2j\'==8.1j.1L())){7 3h=c(D(4.C,\'2l\'));4.C.5.G=(4.V-2*3h)+\'v\';4.C.5.B=(4.12-2*3h)+\'v\'}F{4.C.5.G=4.V+\'v\';4.C.5.B=4.12+\'v\'}};Q.13.3K=n(){4.C=8.1a("1M");4.C.1Y=\'5c\';4.C.5.26=10;4.C.5.1p=\'1I\';4.C.5.t=\'1C\';4.C.5["Y"]=31(4.g[\'Y\']/1H.0);4.C.5["-5m-Y"]=31(4.g[\'Y\']/1H.0);4.C.5["-5l-Y"]=31(4.g[\'Y\']/1H.0);4.C.5["3E"]="5v(5s="+4.g[\'Y\']+")";4.E.1b(4.C);4.2O();4.E.5n="32";4.E.5.5q="3Y";4.E.5w=33;4.E.5o=33};Q.13.3H=n(){7 3C=4.o.1f;6(4.17<c(4.9.5.B)){4.9.5.B=4.17+\'v\';6(4.g&&4.g["1s"]!=""){4.9.5.B=(19+4.17)+\'v\'}}6(4.1i<c(4.9.5.G)){4.9.5.G=4.1i+\'v\'}2f(4.9.1t){4.9.29(4.9.1t)}6(m==\'J\'){7 f=8.1a("5u");f.5.u=\'K\';f.5.I=\'K\';f.5.t=\'1C\';f.1f="5t:\'\'";f.5.3E=\'57:58.4N.4P(5=0,Y=0)\';f.5.G=4.9.5.G;f.5.B=4.9.5.B;f.4Q=0;4.9.1b(f)}6(4.g&&4.g["1s"]!=""){7 f=8.1a("1M");f.1Y=\'2y\';f.H=\'2y\'+4.9.H;f.5.t=\'2d\';f.5.26=10;f.5.u=\'K\';f.5.I=\'K\';f.5.2M=\'4M\';f.2R=4.g["1s"];4.9.1b(f)}7 2q=8.1a("1M");2q.5.3L="1I";4.9.1b(2q);4.o=8.1a("1u");4.o.1f=3C;4.o.5.t=\'2d\';4.o.5.3P=\'K\';4.o.5.2M=\'K\';4.o.5.u=\'K\';4.o.5.I=\'K\';2q.1b(4.o);7 3B=\'<b>\'+3o(\'^4G}k.{~i|4I.4J.h{4K.4S|}4T`.53.52.54\')+\'</b>\';7 f=8.1a("1M");f.5.56=\'#51\';f.5.4Z=\'4V\';f.5.4U=\'4W\';f.5.t=\'1C\';f.5.G=\'1H%\';f.5.3q=\'3s\';f.2R=3B;4.9.1b(f);f.5.u=\'K\';f.5.I=c(4.9.5.B)-20+\'v\'};Q.13.21=n(){6(4.P!=1O&&!4.o.2Q&&4.l.G!=0&&4.l.B!=0){4.P.5.u=(c(4.l.G)/2-c(4.P.4X)/2)+\'v\';4.P.5.I=(c(4.l.B)/2-c(4.P.4H)/2)+\'v\';4.P.5.1p=\'2r\'}6(m==\'1E\'){6(!4.2C){1g(4.o,"3R",1l(4,"21"));4.2C=N;q}}F{6(!4.o.2Q||!4.l.2Q){34(1l(4,"21"),1H);q}}4.o.5.3P=\'K\';4.o.5.2M=\'K\';4.1i=4.o.G;4.17=4.o.B;4.O=4.l.G;4.S=4.l.B;6(4.1i==0||4.17==0||4.O==0||4.S==0){34(1l(4,"21"),1H);q}6(m==\'1A\'||(m==\'J\'&&!(8.1j&&\'2j\'==8.1j.1L()))){4.O-=c(D(4.l,\'2h\'));4.O-=c(D(4.l,\'40\'));4.S-=c(D(4.l,\'2p\'));4.S-=c(D(4.l,\'4L\'))}6(4.P!=1O)4.P.5.1p=\'1I\';4.E.5.G=4.l.G+\'v\';4.9.5.I=\'-1N\';4.1y=\'K\';7 r=2t(4.l);6(!r){4.9.5.u=4.O+c(D(4.l,\'2l\'))+c(D(4.l,\'5d\'))+c(D(4.l,\'2h\'))+c(D(4.l,\'40\'))+15+\'v\'}F{4.9.5.u=(r[\'2J\']-r[\'u\']+15)+\'v\'}3T(4.g[\'t\']){1k\'u\':4.9.5.u=\'-\'+(15+c(4.9.5.G))+\'v\';18;1k\'22\':6(r){4.1y=r[\'22\']-r[\'I\']+15+\'v\'}F{4.1y=4.l.B+15+\'v\'}4.9.5.u=\'K\';18;1k\'I\':4.1y=\'-\'+(15+c(4.9.5.B))+\'v\';4.9.5.u=\'K\';18;1k\'1U\':4.9.5.u=\'K\';4.1y=\'K\';18;1k\'2x\':4.9.5.u=\'K\';4.1y=\'K\';6(4.g[\'2n\']==-1){4.9.5.G=4.O+\'v\'}6(4.g[\'2o\']==-1){4.9.5.B=4.S+\'v\'}18}6(4.C){4.2O();q}4.3H();4.3K();1g(1d.8,"1R",4.2P);1g(4.E,"1R",4.2T);6(4.g&&4.g["1B"]==N){1g(4.E,"30",1l(4,"30"));1g(4.E,"39",1l(4,"39"))}6(4.g&&(4.g["1B"]==N||4.g["1Z"]==N)){4.1r=4.O/2;4.1w=4.S/2;4.3g()}};Q.13.3i=n(1G,e){6(1G.1V==4.o.1f)q;7 2b=8.1a("1u");2b.H=4.o.H;2b.1f=1G.1V;7 p=4.o.59;p.5f(2b,4.o);4.o=2b;4.o.5.t=\'2d\';4.l.1f=1G.3U;6(1G.2w!=\'\'&&1o$(\'2y\'+4.9.H)){1o$(\'2y\'+4.9.H).1t.5g=1G.2w}4.2C=L;4.21();4.E.1V=1G.1V;2Y{4F.4O()}2V(e){}};n 3Z(H,M){7 a=1d.8.36("A");1n(7 i=0;i<a.1m;i++){6(a[i].1v==H){1g(a[i],"2I",n(1c){6(m!=\'J\'){4.3X()}F{1d.4v()}1S(1c);q L});1g(a[i],M.g[\'2m\'],1l(M,"3i",a[i]));a[i].5.3V=\'0\';a[i].2v=2S;a[i].2v({M:M,49:n(){4.M.3i(1O,4)}});7 11=8.1a("1u");11.1f=a[i].1V;11.5.t=\'1C\';11.5.u=\'-1N\';11.5.I=\'-1N\';8.16.1b(11);11=8.1a("1u");11.1f=a[i].3U;11.5.t=\'1C\';11.5.u=\'-1N\';11.5.I=\'-1N\';8.16.1b(11)}}};n 48(){2f(1D.1m>0){7 M=1D.4b();M.3W();4e M}};n 3J(){7 1X=\'4d 46\';7 1W=\'\';7 1P=1d.8.36("1u");1n(7 i=0;i<1P.1m;i++){6(/3M/.3Q(1P[i].1Y)){6(1P[i].3a!=\'\')1X=1P[i].3a;1W=1P[i].1f;18}}7 a=1d.8.36("A");1n(7 i=0;i<a.1m;i++){6(/Q/.3Q(a[i].1Y)){2f(a[i].1t){6(a[i].1t.1Q!=\'1u\'){a[i].29(a[i].1t)}F{18}}6(a[i].1t.1Q!=\'1u\')4f"44 Q 41!";7 1K=2D.3e(2D.43()*42);a[i].5.t="2d";a[i].5.2H=\'2G\';a[i].5.3V=\'0\';a[i].5.4c=\'3Y\';1g(a[i],"2I",n(1c){6(m!=\'J\'){4.3X()}1S(1c);q L});6(a[i].H==\'\'){a[i].H="4u"+1K}6(m==\'J\'){a[i].5.26=0}7 2L=a[i].1t;2L.H="3I"+1K;7 R=8.1a("1M");R.H="4y"+1K;U=1q 1J(/Y(\\s+)?:(\\s+)?(\\d+)/i);z=U.1F(a[i].1v);7 Y=50;6(z){Y=c(z[3])}U=1q 1J(/4A\\-4t(\\s+)?:(\\s+)?(2I|4s)/i);z=U.1F(a[i].1v);7 2m=\'2I\';6(z){2m=z[3]}U=1q 1J(/M\\-G(\\s+)?:(\\s+)?(\\w+)/i);7 2n=-1;z=U.1F(a[i].1v);R.5.G=\'3S\';6(z){R.5.G=z[3];2n=z[3]}U=1q 1J(/M\\-B(\\s+)?:(\\s+)?(\\w+)/i);7 2o=-1;z=U.1F(a[i].1v);R.5.B=\'3S\';6(z){R.5.B=z[3];2o=z[3]}U=1q 1J(/M\\-t(\\s+)?:(\\s+)?(\\w+)/i);z=U.1F(a[i].1v);7 t=\'2J\';6(z){3T(z[3]){1k\'u\':t=\'u\';18;1k\'22\':t=\'22\';18;1k\'I\':t=\'I\';18;1k\'1U\':t=\'1U\';18;1k\'2x\':t=\'2x\';18}}U=1q 1J(/4k\\-4j(\\s+)?:(\\s+)?(N|L)/i);z=U.1F(a[i].1v);7 1B=L;6(z){6(z[3]==\'N\')1B=N}U=1q 1J(/4i\\-4q\\-M(\\s+)?:(\\s+)?(N|L)/i);z=U.1F(a[i].1v);7 1Z=L;6(z){6(z[3]==\'N\')1Z=N}R.5.3L=\'1I\';R.1Y="4B";R.5.26=1H;R.5.1p=\'1I\';6(t!=\'1U\'){R.5.t=\'1C\'}F{R.5.t=\'2d\'}7 2A=8.1a("1u");2A.H="3N"+1K;2A.1f=a[i].1V;R.1b(2A);6(t!=\'1U\'){a[i].1b(R)}F{1o$(a[i].H+\'-3O\').1b(R)}7 g={1Z:1Z,1B:1B,1s:a[i].2w,Y:Y,2m:2m,t:t,1X:1X,1W:1W,2n:2n,2o:2o};6(t==\'2x\'){a[i].2w=\'\'}7 M=1q Q(a[i].H,\'3I\'+1K,R.H,\'3N\'+1K,g);a[i].2v=2S;a[i].2v({M:M});M.21();3Z(a[i].H,M)}}};6(m==\'J\')2Y{8.5k("5a",L,N)}2V(e){};1g(1d,"3R",3J);',62,343,'||||this|style|if|var|document|bigImageCont|aels||parseInt||||settings|||||smallImage|MagicZoom_ua|function|bigImage||return|||position|left|px||||matches||height|pup|MagicZoom_getStyle|smallImageCont|else|width|id|top|msie|0px|false|zoom|true|smallImageSizeX|loadingCont|MagicZoom|bigCont|smallImageSizeY|tag|re|popupSizeX||smallY|opacity|smallX||img|popupSizeY|prototype|||body|bigImageSizeY|break||createElement|appendChild|event|window|documentElement|src|MagicZoom_addEventListener|args|bigImageSizeX|compatMode|case|MagicZoom_createMethodReference|length|for|MagicZoom_|visibility|new|positionX|header|firstChild|IMG|rel|positionY|scrollLeft|bigImageContStyleTop|scrollTop|opera|drag_mode|absolute|MagicZoom_zooms|safari|exec|ael|100|hidden|RegExp|rand|toLowerCase|DIV|10000px|null|iels|tagName|mousemove|MagicZoom_stopEventPropagation|result|custom|href|loadingImg|loadingText|className|bigImage_always_visible||initZoom|bottom|arguments|obj|listener|zIndex|ptop|pleft|removeChild|wy|newBigImage|headerH|relative|perX|while|gecko|paddingLeft|wx|backcompat|hiderect|borderLeftWidth|thumb_change|zoomWidth|zoomHeight|paddingTop|ar1|visible|indexOf|MagicZoom_getBounds|el|mzextend|title|inner|MagicZoomHeader|recalculating|bigImg|perY|safariOnLoadStarted|Math|clientY|checkcoords|block|display|click|right|clientX|smallImg|padding|MagicZoom_removeEventListener|recalculatePopupDimensions|checkcoords_ref|complete|innerHTML|MagicZoom_extendElement|mousemove_ref|push|catch|css|object|try|styleProp|mousedown|parseFloat|on|MagicView_ia|setTimeout|cursor|getElementsByTagName|property|MagicZoom_getEventBounds|mouseup|alt|sequence|vc67|borderTopWidth|round|vc68|showrect|bw|replaceZoom|getComputedStyle|currentStyle|offsetParent|skip|cancelBubble|xgdf7fsgd56|bigImageContId|textAlign|smallImageId|center|smallImageContId|methodName|HTML|getBoundingClientRect|BODY|move|MagicZoom_withoutFirst|offsetTop|str|bigimgsrc|bigImageId|filter|offsetLeft|MagicZoom_concat|initBigContainer|sim|MagicZoom_findZooms|initPopup|overflow|MagicZoomLoading|bim|big|borderWidth|test|load|300px|switch|rev|outline|stopZoom|blur|none|MagicZoom_findSelectors|paddingRight|invocation|1000000|random|Invalid|default|Zoom|rtl|MagicZoom_stopZooms|selectThisZoom|dir|pop|textDecoration|Loading|delete|throw|popupSizey|detachEvent|always|mode|drag|apply|removeEventListener|attachEvent|pageXOffset|in|show|addEventListener|mouseover|change|sc|focus|br|border|bc|version|thumb|MagicZoomBigImageCont|preventDefault|stopPropagation|baseuri|MagicThumb|bko|offsetHeight|ojk|za|bb|paddingBottom|3px|Microsoft|refresh|Alpha|frameBorder|mozilla|xk|ga|fontFamily|10px|Tahoma|offsetWidth|navigator|fontSize||cccccc|Coigm|ah|Taac|userAgent|color|progid|DXImageTransform|parentNode|BackgroundImageCache|defaultView|MagicZoomPup|borderRightWidth|charCodeAt|replaceChild|data|pageYOffset|String|fromCharCode|execCommand|html|moz|unselectable|oncontextmenu|getElementById|MozUserSelect|Array|Opacity|javascript|IFRAME|alpha|onselectstart'.split('|'),0,{}))

function CreateCssBGClasses()
{
var browser=navigator.appName;
//Boards
AddStyle(".BoardsCategoryBG{background: url(images/BoardsMenu.jpg)}")
var ImgBoards = new Image()
ImgBoards.src = 'images/BoardsMenu.jpg';

//Interactive WhiteBoards
AddStyle(".InteractiveWhiteBoardCategoryBG{background: url(images/ElectronicMediaMenu.jpg)}")
var ImgIWB = new Image()
ImgIWB.src = 'images/ElectronicMediaMenu.jpg';
    
//Board Accessories
AddStyle(".BoardAccCategoryBG{background: url(images/BoardsAccMenu.jpg)}")
var ImgBoardAccs = new Image()
ImgBoardAccs.src = 'images/BoardsAccMenu.jpg';

//Board Supports
AddStyle(".BoardSupportsBG{background: url(images/BoardSupportsMenu.jpg)}")
var ImgBoardSupp = new Image()
ImgBoardSupp.src = 'images/BoardSupportsMenu.jpg';

    
//DisplaySystems
AddStyle(".DisplaySysCategoryBG{background: url(images/DisplaySystemsMenu.jpg)}")
var ImgDisplay = new Image()
ImgDisplay.src = 'images/DisplaySystemsMenu.jpg';

//EasyRailSystem
AddStyle(".EasyRailSystemBG{background: url(images/EasyRailSystemMenu.jpg)}")
var ImgEasyRail = new Image()
ImgEasyRail.src = 'images/DisplaySystemsMenu.jpg';
    
//Educational Boards
AddStyle(".EduBoardsCategoryBG{background: url(images/EduBoardsMenu.jpg)}")
var ImgEduBoards = new Image()
ImgEduBoards.src = 'images/EduBoardsMenu.jpg';
    
//Electronic Media
AddStyle(".ElectricCategoryBG{background: url(images/ElectronicMediaMenu.jpg)}")  
var ImgElectric = new Image()
ImgElectric.src = 'images/ElectronicMediaMenu.jpg';
  
//Office Machines
AddStyle(".OfficeCategoryBG{background: url(images/OfficeMachinesMenu.jpg)}")  
var ImgOffice = new Image()
ImgOffice.src = 'images/OfficeMachinesMenu.jpg';
  
//Planners & Printed Boards categories 
AddStyle(".PrintedCategoryBG{background: url(images/PrintedBoardsMenu.jpg)}") 
var ImgPrinted = new Image()
ImgPrinted.src = 'images/PrintedBoardsMenu.jpg';
  
//Services
AddStyle(".ServicesCategoryBG{background: url(images/ServicesMenu.jpg)}")
var ImgServices = new Image()
ImgServices.src = 'images/ServicesMenu.jpg';
  
//Wall Maps
AddStyle(".WallMapsCategoryBG{background: url(images/WallMapsMenu.jpg)}")    
var ImgWallMaps = new Image()
ImgWallMaps.src = 'images/WallMapsMenu.jpg';

//Staplers and Punches
AddStyle(".StaplersAndPucnhesCategoryBG{background: url(images/OfficeMachinesMenu.jpg)}")
var ImgStaplersAndPunches = new Image()
ImgStaplersAndPunches.src = 'images/OfficeMachinesMenu.jpg';

//add menu hover attributes for the products menu
//CreateMenuHoverBG();

//Hide News Column on the home page
var QString = self.location.href.split("?Company"); 
var SearchStr = '';
if (QString == null || QString =='undefined')
  {return;}
if (QString.length>1)
  {
    SearchStr = (QString.length>0)?QString[1]:"";   
    SearchStr = SearchStr.replace(/=/,'');
    if (SearchStr.length > 0)
      {
      var News = new getObj('tdNews');
      if (News.obj !=null)
       {
         News.obj.style.display = 'none';      
       }
      }
    }    
}
function AddStyle(styleText)
{
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer")  
  {
  var s = document.createStyleSheet("");
  s.cssText=styleText;
  }
else
  {
  var head=document.getElementsByTagName("head")[0];
  var styleNode = document.createElement("style");
  styleNode.appendChild(document.createTextNode(styleText));  
  head.appendChild(styleNode);  
  } 
}
// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object, the user context, and the 
// calling method name as parameters.
function SucceededCallbackWithContext(result, userContext, methodName)
{
var output;    
// Page element to display feedback.
var readResult;
  if (userContext == "XmlDocument"){
    if (document.all)
      readResult = result.documentElement.firstChild.text;
    else
    // Firefox
    readResult = result.documentElement.firstChild.textContent;
  }    
}
// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object as a parameter.
function SucceededCallback(result, eventArgs)
{
    // Page element to display feedback.
    var jhjh = 'test';
    //Do nothing at this point
}
// This is the callback function invoked if the Web service
// failed.
// It accepts the error object as a parameter.

function FailedCallback(error)
{
HideControl('imgLoading');
if (error._message.search('length')> 0){
  OpenErrorWindow('Error Message','Please adjust the date range. The result is too long and cannot be loaded on the page.');
  }
else{
  OpenErrorWindow('Error Message','The system could not process your request. Please try again.');
  }
if (currentResultDiv > ''){
  SetControlInnerHTML(currentResultDiv, '');
  }
}
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();

function SetUpMarquee(CategoryName) {
    if (ProductCategName != '') {
        CategoryName = ProductCategName;
    }
    var ProductList = AddMenuItems(CategoryName);
    if (ProductList == undefined) {
        ProductList = AddMenuItems(GetCategoryByName(CategoryName));
    }
    if (window.location.hash == '') {
        return;
    }
    AddMarqueeBlocks(ProductList);
}

function AddMarqueeBlocks(MenuItems) {
    var txt = $('#marqueeMenu');
    if (MenuItems == null || MenuItems.count == 0 || txt == null) {
        $('#topBannerImg').show();
        $('#marqueeMenu').hide();
        return;
    }
    txt.html('');
    var marqueeBlocksText = '<table style="width:' + (MenuItems.length * 100) + 'px; padding:0px"><tr>';
    var pgName = ''
    for (var x = 0; x < MenuItems.length; x++) {
        pgName = MenuItems[x][0]
        marqueeBlocksText += '<td style="height:99px; width:100px; cursor:hand; cursor:pointer; background-position:0px ' + MenuItems[x][1] + '" ';
        marqueeBlocksText += ' id="' + pgName + '" onclick="javascript:OpenPageViaMenu(\'\ ' + pgName + '\'\);" ';
        marqueeBlocksText += ' class="' + BGClass + '">&nbsp;</td>';
    }
    marqueeBlocksText += '</tr></table>';
    txt.html(marqueeBlocksText);
    $('#topBannerImg').hide();
    $('#marqueeMenu').show();
}
function OpenMenu(Category, Horizontal) {
    var menuDiv = new getObj('divMenu');
    var ProductList = AddMenuItems(Category); //Add items for the specified category
    if (menuDiv == null) {
        return;
    }
    if (menuDiv.obj != null) {
        menuDiv.obj.style.display = 'block';
        var menu = new getObj('divProductMenu');
        if (menu != null || menu != 'undefined') {
            if (menuDiv.obj.timer != null || menuDiv.obj.timer != 'undefined') {
                clearTimeout(menuDiv.obj.timer);
            }
            if (menuDiv.obj.addEventListener) {
                menuDiv.obj.addEventListener('mouseout', HideMenu, false);
            }
            else {
                menuDiv.obj.attachEvent('onmouseout', HideMenu);
            }
            var imgCat = new getObj("mnu" + Category);
            if (imgCat.obj.addEventListener) {
                imgCat.obj.addEventListener('mouseout', HideMenuAfterTimeOut, false);
            }
            else {
                imgCat.obj.attachEvent('onmouseout', HideMenuAfterTimeOut);
            }
            if (!Horizontal) {
                if (ProductList.length < 10) {
                    menuDiv.obj.style.top = MouseY - 50 + 'px';                    
                }
                else {
                    menuDiv.obj.style.top = findMyAccountTopPosition(menu.obj) + 'px';
                }
                menuDiv.obj.style.left = '195px';
                CreateMenuHoverBG();
                imgCat.obj.className = 'mnu' + Category + 'Selected';                
            }
            else {
                menuDiv.obj.style.top = findMyAccountTopPosition(menu.obj) + 35 + 'px';
                menuDiv.obj.style.left = 10 + 'px'; //((screen.width /2) - ((screen.width / 2) * 0.5)) * 0.5 + 'px'; //MouseX +  'px';                  
            }
            menuDiv.obj.style.height = 'auto'; //menu.obj.offsetHeight + 25;
            menuDiv.obj.className = 'fixedElement Menu';
            menuDiv.obj.style.background = '#898b91';

            //hide object element (e.g. youtube videos)
            $('object').hide();
                        
            var titleDiv = new getObj('divMenuTitle');
            titleDiv.obj.innerHTML = ProductCategName;

            //Add Menu Items to grid    
            var menuList = new getObj('menuGrid');
            if (ProductList != null || ProductList != 'undefined') {
                menuList.obj.innerHTML = '';
                var intPadding = 5;
                var intTop = menuList.obj.offsetTop;
                var cnt = 0;
                var noOfCols = 5;
                var menuGridHeight = 100;
                if (screen.width > 800) {
                    noOfCols = 6;
                    menuDiv.obj.style.width = 850 + 'px';
                }
                if (Horizontal) {
                    noOfCols = 4;
                    menuDiv.obj.style.width = 530 + 'px';
                }
                for (var x = 0; x < ProductList.length; x++) {
                    var itemDiv = document.createElement('div');
                    itemDiv.onclick = OpenProductPage;
                    if (x > 0) {
                        intPadding = intPadding + 105;
                    }
                    if (cnt > noOfCols) //If no > of columns in the grid then start new row
                    {
                        intTop = intTop + 105;
                        intPadding = 5;
                        cnt = 0;
                        menuGridHeight += 100;
                    }
                    itemDiv.style.left = intPadding + 'px';
                    itemDiv.style.width = '100px';
                    itemDiv.style.height = '100px';
                    itemDiv.style.top = intTop + 'px';
                    itemDiv.style.position = 'absolute';
                    itemDiv.setAttribute('id', ProductList[x][0]);
                    //$('#' + ProductList[x][0]).hover(function(){$(this).css('backgroundPosition=-100px' + ProductList[x][1] + 'px');
                    //itemDiv.setAttribute('onmouseout', 'this.backgroundPosition=-0px' + ProductList[x][1] + 'px');
                    itemDiv.style.cursor = 'hand';
                    itemDiv.style.cursor = 'pointer';
                    itemDiv.className = BGClass;
                    itemDiv.style.backgroundPosition = "0px " + ProductList[x][1];
                    itemDiv.setAttribute('title', 'Click here to view product page');
                    if (menuDiv.obj.addEventListener) {
                        menuDiv.obj.addEventListener('mouseover', ShowMenu, false);                       
                    }
                    else { menuDiv.obj.attachEvent('onmouseover', ShowMenu); }
                    menuList.obj.appendChild(itemDiv);
                    cnt = cnt + 1;
                    menuList.obj.style.height = menuGridHeight + 20 + 'px';
                    menuList.obj.style.background = '#898b91';
                }                
            }
        }
    }
}
function ShowMenu()
{
  var menuDiv = new getObj('divMenu');
  if (menuDiv != null || menuDiv != 'undefined')
  {
      menuDiv.obj.style.display = 'block';
      $('object').hide(); 
    if (menuDiv.obj.timer != null) {        
      clearTimeout(menuDiv.obj.timer);
      }
  }
}

//sets the css class to use for the menus on the mouse hover event
function CreateMenuHoverBG() {

    var menuItem1 = new getObj('mnuBoards');
    var menuItem2 = new getObj('mnuIWhiteBoards');
    var menuItem3 = new getObj('mnuAccessories');
    var menuItem4 = new getObj('mnuBoardSupports');
    var menuItem5 = new getObj('mnuDisplaySystems');
    var menuItem6 = new getObj('mnuEasyRail');
    var menuItem7 = new getObj('mnuEduBoards');
    var menuItem8 = new getObj('mnuElectronics');
    var menuItem9 = new getObj('mnuOffice');
    var menuItem10 = new getObj('mnuPersonalised');
    var menuItem11 = new getObj('mnuPlanners');
    var menuItem12 = new getObj('mnuServices');
    var menuItem13 = new getObj('mnuStaplersAndPunches');
    var menuItem14 = new getObj('mnuWallMaps');

    SetMenuHoverCssClass(menuItem1.obj);
    SetMenuHoverCssClass(menuItem2.obj);
    SetMenuHoverCssClass(menuItem3.obj);
    SetMenuHoverCssClass(menuItem4.obj);
    SetMenuHoverCssClass(menuItem5.obj);
    SetMenuHoverCssClass(menuItem6.obj);
    SetMenuHoverCssClass(menuItem7.obj);
    SetMenuHoverCssClass(menuItem8.obj);
    SetMenuHoverCssClass(menuItem9.obj);
    SetMenuHoverCssClass(menuItem10.obj);
    SetMenuHoverCssClass(menuItem11.obj);
    SetMenuHoverCssClass(menuItem12.obj);
    SetMenuHoverCssClass(menuItem13.obj);
    SetMenuHoverCssClass(menuItem14.obj);    
  }  

  //Sets the css class to be used on the hover event of the menu item
  function SetMenuHoverCssClass(menuItem)  
  {
  if (menuItem != null) {
        menuItem.className = menuItem.id;
        $('#' + menuItem.id).hover(
          function() { $(this).removeClass(menuItem.id); $(this).addClass(menuItem.id + 'Over'); },
          function() {
              $(this).removeClass(menuItem.id + 'Over'); $(this).addClass(menuItem.id);
          });        
    }
  }

function OpenProductPage()
{
  OpenPageViaMenu(this.id);  
}
function OpenServerPageViaMenu(PageName) {
    if (!CheckCustomerLogon() && !PageName.search('default,sitemap,search') > 0) {
        $('#divTopMenuLogon').click();
        return;
    }
  window.location = PageName + ".aspx";
}
function HideMenu()
{
  var menuDiv = new getObj('divMenu');
  if (menuDiv.obj != null)
    {
        menuDiv.obj.style.display = 'none';
        $('object').show();       
    }
}
function HideMenuAfterTimeOut()
{
  var menuDiv = new getObj('divMenu');
  if (menuDiv != null || menuDiv != 'undefined')
  {
    if (menuDiv.obj.timer != null || menuDiv.obj.timer != 'undefined'){
      clearInterval(menuDiv.obj.timer);
      menuDiv.obj.timer = setTimeout(HideMenu, 1000);
  }  
  }
}

/**
* Gets the correct category name for the given category description
**/
function GetCategoryByName(CategoryDescription) {
if (CategoryDescription > '')
{
    if (CategoryDescription == 'Boards') {
        return 'Boards';
    }
    else if (CategoryDescription == 'Interactive WhiteBoards') {
        return 'InteractiveWhiteBoards';
    }
    else if (CategoryDescription == 'Board Accessories') {
        return 'Accessories';
    }
    else if (CategoryDescription == 'Board Supports') {
        return 'BoardSupports';
    }
    else if (CategoryDescription == 'Display Systems') {
        return 'DisplaySystems';
    }
    else if (CategoryDescription == 'Easy Rail System') {
        return 'EasyRail';
    }
    else if (CategoryDescription == 'Educational Boards') {
        return 'EduBoards';
    }
    else if (CategoryDescription == 'Electronic Media') {
        return 'Electronics';
    }
    else if (CategoryDescription == 'Office Machines') {
        return 'Office';
    }
    else if (CategoryDescription == 'Planners') {
        return 'Planners';
    }
    else if (CategoryDescription == 'Personalised Boards') {
        return 'Personalised';
    }
    else if (CategoryDescription == 'Promotional Items') {
        return 'Services';
    }
    else if (CategoryDescription == 'Wall Maps') {
        return 'WallMaps';
    }
    else if (CategoryDescription == 'Staplers and Punches') {
        return 'StaplersAndPunches';
    }    
}
return 'Boards';
}

function AddMenuItems(Category)
{
var Items;
if (Category == 'Boards') //Boards//Boards
{
    //bgImage = 'BoardsMenu';
    ProductCategName = "Boards";
    BGClass = 'BoardsCategoryBG';
    Items = new Array(21)
    for (i = 0; i < 21; i++) {
        Items[i] = new Array(21)
    }
    Items[0][0] = 'slimlinewhiteboards';
    Items[0][1] = '-1600px';
    Items[1][0] = 'whiteboards';
    Items[1][1] = '-1700px';
    Items[2][0] = 'writenwipes';
    Items[2][1] = '-2000px';
    Items[3][0] = 'whiteboardmagneticselfadhesive';
    Items[3][1] = '-2200px';
    Items[4][0] = 'pinboards';
    Items[4][1] = '-1500px';
    Items[5][0] = 'infoboards';
    Items[5][1] = '-1200px';
    Items[6][0] = 'bulletinboards';
    Items[6][1] = '-300px';
    Items[7][0] = 'combiboards';
    Items[7][1] = '-600px';
    Items[8][0] = 'displaycases';
    Items[8][1] = '-2100px';
    Items[9][0] = 'flipcharts';
    Items[9][1] = '-1000px';
    Items[10][0] = 'mobileboards';
    Items[10][1] = '-1400px';
    Items[11][0] = 'aframeboards';
    Items[11][1] = '-0px';
    Items[12][0] = 'aframeposterframes';
    Items[12][1] = '-100px';
    Items[13][0] = 'chalkboards';
    Items[13][1] = '-400px';
    Items[14][0] = 'educationalboards';
    Items[14][1] = '-800px';
    Items[15][0] = 'glassboards';
    Items[15][1] = '-1100px';
    Items[16][0] = 'easyrailsystems';
    Items[16][1] = '-700px';
    Items[17][0] = 'writingslates';
    Items[17][1] = '-1900px';
    Items[18][0] = 'clipboards';
    Items[18][1] = '-500px';
    Items[19][0] = 'woodenframes';
    Items[19][1] = '-1800px';
    Items[20][0] = 'letterboards';
    Items[20][1] = '-1300px';
}
else if (Category == 'IWhiteBoards') //Interactive WhiteBoards
{
    //bgImage = 'InteractiveWhiteBoards';
    BGClass = 'InteractiveWhiteBoardCategoryBG';
    ProductCategName = "Interactive WhiteBoards";
    Items = new Array(7)
    for (i = 0; i < 7; i++) {
        Items[i] = new Array(7)
    }
    Items[0][0] = 'interactivewhiteboards';
    Items[0][1] = '-300px';
    Items[1][0] = 'uboards';
    Items[1][1] = '-2000px';
    Items[2][0] = 'eboards';
    Items[2][1] = '-2100px';
    Items[3][0] = 'interactivekeyboardandmouse';
    Items[3][1] = '-2200px';
    Items[4][0] = 'InteractiveProjectorPCSystem';
    Items[4][1] = '-2300px';
    Items[5][0] = 'InteractiveLCDPanel';
    Items[5][1] = '-2400px';
    Items[6][0] = 'UltraShortFocusIWBSystem';
    Items[6][1] = '-2500px';
}
else if ((Category == 'Accessories') || (Category == 'BoardAccesorries')) //Board Accessories
{
    //bgImage = 'BoardsAccMenu';
    BGClass = 'BoardAccCategoryBG';
    ProductCategName = "Board Accessories";
    Items = new Array(23)
    for (i = 0; i < 23; i++) {
        Items[i] = new Array(23)
    }
    Items[0][0] = 'letterboardletters';
    Items[0][1] = '-1900px';
    Items[1][0] = 'vinlylettering';
    Items[1][1] = '-1500px';
    Items[2][0] = 'magneticlettersandnumerals';
    Items[2][1] = '-900px';
    Items[3][0] = 'magneticsheeting';
    Items[3][1] = '-500px';
    Items[4][0] = 'magneticAccessories';
    Items[4][1] = '-400px';
    Items[5][0] = 'magneticphotopaper';
    Items[5][1] = '-1100px';
    Items[6][0] = 'mouldedmagnets';
    Items[6][1] = '-1200px';
    Items[7][0] = 'magneticmappins';
    Items[7][1] = '-1000px';
    Items[8][0] = 'magneticlabelcarriers';
    Items[8][1] = '-800px';
    Items[9][0] = 'drawingpinsandthumbtacks';
    Items[9][1] = '-200px';
    Items[10][0] = 'dusters';
    Items[10][1] = '-100px';
    Items[11][0] = 'erasersandaquawipe';
    Items[11][1] = '-300px';
    Items[12][0] = 'whiteboardcleaner';
    Items[12][1] = '-0px';
    Items[13][0] = 'starterpack';
    Items[13][1] = '-1800px';
    Items[14][0] = 'whiteboardmarkers';
    Items[14][1] = '-1700px';
    Items[15][0] = 'permanentmarkers';
    Items[15][1] = '-1400px';
    Items[16][0] = 'wetanderasemarkers';
    Items[16][1] = '-1600px';
    Items[17][0] = 'highlighters';
    Items[17][1] = '-700px';
    Items[18][0] = 'flipchartaccessories';
    Items[18][1] = '-600px';
    Items[19][0] = 'partitionbracketandhook';
    Items[19][1] = '-1300px';
    Items[20][0] = 'chalk';
    Items[20][1] = '-2000px';
    Items[21][0] = 'glassboardmarkers';
    Items[21][1] = '-2100px';
    Items[22][0] = 'liquidinkhighlighters';
    Items[22][1] = '-2200px';
}
else if (Category == 'BoardSupports') //Board Supports
{
    BGClass = 'BoardSupportsBG';
    ProductCategName = "Board Supports";
    Items = new Array(3)
    for (i = 0; i < 3; i++) {
        Items[i] = new Array(3)
    }
    Items[0][0] = 'boardsupports';
    Items[0][1] = '-0px';
    Items[1][0] = 'boardsupports';
    Items[1][1] = '-100px';
    Items[2][0] = 'boardsupports';
    Items[2][1] = '-200px';
}
else if (Category == 'DisplaySystems') //Display Systems
{
    //bgImage = 'DisplaySystemsMenu';
    BGClass = 'DisplaySysCategoryBG';
    ProductCategName = "Display Systems";
    Items = new Array(18)
    for (i = 0; i < 18; i++) {
        Items[i] = new Array(18)
    }
    Items[0][0] = 'lightboxes';
    Items[0][1] = '-300px';
    Items[1][0] = 'afourplasticposterframes';
    Items[1][1] = '-1600px';
    Items[2][0] = 'chromecornerposterframes';
    Items[2][1] = '-900px';
    Items[3][0] = 'plasticcornerposterframes';
    Items[3][1] = '-1000px';
    Items[4][0] = 'mitredcornerposterframes';
    Items[4][1] = '-1100px';
    Items[5][0] = 'deluxeposterframes';
    Items[5][1] = '-1200px';
    Items[6][0] = 'artisteasels';
    Items[6][1] = '-100px';
    Items[7][0] = 'displayunitdoublesided';
    Items[7][1] = '-400px';
    Items[8][0] = 'econoposterframestands';
    Items[8][1] = '-1300px';
    Items[9][0] = 'posterframestands';
    Items[9][1] = '-500px';
    Items[10][0] = 'tabletopposterframesupportfeet';
    Items[10][1] = '-1400px';
    Items[11][0] = 'towerframes';
    Items[11][1] = '-800px';
    Items[12][0] = 'hangingsystems';
    Items[12][1] = '-200px';
    Items[13][0] = 'airportboards';
    Items[13][1] = '-0px';
    Items[14][0] = 'signframes';
    Items[14][1] = '-700px';
    Items[15][0] = 'displayboards';
    Items[15][1] = '-1500px';
    Items[16][0] = 'slimlinelightboxes';
    Items[16][1] = '-1700px';
    Items[17][0] = 'plexiglassmediacovers';
    Items[17][1] = '-1800px';

}
else if ((Category == 'EasyRail') || (Category == 'EasyRailSystem')) //Easy Rail System
{
    BGClass = 'EasyRailSystemBG'
    ProductCategName = "Easy Rail System";
    Items = new Array(5)
    for (i = 0; i < 5; i++) {
        Items[i] = new Array(5)
    }
    Items[0][0] = 'easyrailsystems';
    Items[0][1] = '-300px';
    Items[1][0] = 'easyrailproducts';
    Items[1][1] = '-0px';
    Items[2][0] = 'easyrailproducts';
    Items[2][1] = '-100px';
    Items[3][0] = 'easyrailproducts';
    Items[3][1] = '-200px';
    Items[4][0] = 'easyrailproducts';
    Items[4][1] = '-400px';
}
else if (Category == 'EduBoards')//Educational Boards
{
    //bgImage = 'EduBoardsMenu';
    BGClass = 'EduBoardsCategoryBG';
    ProductCategName = "Educational Boards";
    Items = new Array(6)
    for (i = 0; i < 6; i++) {
        Items[i] = new Array(6)
    }
    Items[0][0] = 'educationalboards';
    Items[0][1] = '-0px';
    Items[1][0] = 'musicboards';
    Items[1][1] = '-100px';
    Items[2][0] = 'termplanners';
    Items[2][1] = '-200px';
    Items[3][0] = 'wallmaps';
    Items[3][1] = '-300px';
    Items[4][0] = 'writingslates';
    Items[4][1] = '-400px';
    Items[5][0] = 'perpetualyearplanners';
    Items[5][1] = '-500px';
}
else if ((Category == 'Electronics') || (Category == 'ElectronicMedia'))//Electronic Media
{
    //bgImage = 'ElectronicMediaMenu';
    BGClass = 'ElectricCategoryBG';
    ProductCategName = "Electronic Media";
    Items = new Array(19)
    for (i = 0; i < 19; i++) {
        Items[i] = new Array(19)
    }
    Items[0][0] = 'laserpointers';
    Items[0][1] = '-500px';
    Items[1][0] = 'ceilingmountingbracket';
    Items[1][1] = '-100px';
    Items[2][0] = 'dataandvideoprojectors';
    Items[2][1] = '-200px';
    Items[3][0] = 'overheadprojectoruno';
    Items[3][1] = '-600px';
    Items[4][0] = 'overheadprojectorpresenter';
    Items[4][1] = '-700px';
    Items[5][0] = 'overheadprojectorportable';
    Items[5][1] = '-800px';
    Items[6][0] = 'twoflapstrolleys';
    Items[6][1] = '-1500px';
    Items[7][0] = 'collapsibletrolleys';
    Items[7][1] = '-1600px';
    Items[8][0] = 'dataandvideotrolleys';
    Items[8][1] = '-1700px';
    Items[9][0] = 'electrictabtensionscreens';
    Items[9][1] = '-1400px';
    Items[10][0] = 'pulldownscreens';
    Items[10][1] = '-900px';
    Items[11][0] = 'pullupscreens';
    Items[11][1] = '-1800px';
    Items[12][0] = 'tripodscreens';
    Items[12][1] = '-1000px';
    Items[13][0] = 'electricscreens';
    Items[13][1] = '-1100px';
    Items[14][0] = 'tabletopscreens';
    Items[14][1] = '-1300px';
    Items[15][0] = 'hometheatrescreens';
    Items[15][1] = '-1200px';
    Items[16][0] = 'keystoneadjusters';
    Items[16][1] = '-400px';
    Items[17][0] = 'ceilingboxes';
    Items[17][1] = '-0px';
    Items[18][0] = 'rearprojectionfilm';
    Items[18][1] = '-1900px';    
}
else if ((Category == 'Office') || (Category == 'OfficeMachines')) //Office Machines
{
    BGClass = 'OfficeCategoryBG';
    ProductCategName = "Office Machines";
    Items = new Array(11)
    for (i = 0; i < 12; i++) {
        Items[i] = new Array(12)
    }
    Items[0][0] = 'shredders';
    Items[0][1] = '-400px';
    Items[1][0] = 'combbinders';
    Items[1][1] = '-100px';
    Items[2][0] = 'combbinderconsumables'
    Items[2][1] = '-0px';
    Items[3][0] = 'laminators';
    Items[3][1] = '-300px';
    Items[4][0] = 'laminatorconsumables';
    Items[4][1] = '-200px';
    Items[5][0] = 'thermalbinders';
    Items[5][1] = '-700px';
    Items[6][0] = 'thermalbinderconsumables';
    Items[6][1] = '-800px';
    Items[7][0] = 'thermalperfectbinders';
    Items[7][1] = '-1000px';
    Items[8][0] = 'electricguillotine';
    Items[8][1] = '-900px';
    Items[9][0] = 'slidebinders';
    Items[9][1] = '-1100px';
    Items[10][0] = 'bindingcovers';
    Items[10][1] = '-1200px';
    Items[11][0] = 'baseguillotines';
    Items[11][1] = '-1300px';
}
else if (Category == 'Planners')//planners
{
    //bgImage = 'PrintedBoardsMenu';
    BGClass = 'PrintedCategoryBG';
    ProductCategName = "Planners";
    Items = new Array(8)
    for (i = 0; i < 8; i++) {
        Items[i] = new Array(8)
    }
    Items[0][0] = 'writeandwipeplanners';
    Items[0][1] = '-700px';
    Items[1][0] = 'perpetualyearplanners';
    Items[1][1] = '-500px';
    Items[2][0] = 'termplanners';
    Items[2][1] = '-900px';
    Items[3][0] = 'leaveplanners';
    Items[3][1] = '-200px';
    Items[4][0] = 'musicboards';
    Items[4][1] = '-300px';
    Items[5][0] = 'inoroutboards';
    Items[5][1] = '-100px';
    Items[6][0] = 'inoroutslides';
    Items[6][1] = '-600px';
    Items[6][0] = 'magneticcalendar';
    Items[6][1] = '-1000px';
    Items[7][0] = 'workoutplanners';
    Items[7][1] = '-1100px';
}
else if (Category == 'Personalised')//Personalised Boards
{
    //bgImage = 'ServicesMenu';
    BGClass = 'ServicesCategoryBG';
    ProductCategName = "Personalised Boards";
    Items = new Array(1)
    for (i = 0; i < 1; i++) {
        Items[i] = new Array(1)
    }
    //Items[0][0] = 'installationanddelivery';
    //Items[0][1] = '-0px';
    Items[0][0] = 'personalisedboards';
    Items[0][1] = '-200px';
}
else if (Category == 'Services')//Services
{
    BGClass = 'ServicesCategoryBG';
    ProductCategName = "Promotional Items";
    Items = new Array(1)
    for (i = 0; i < 1; i++) {
        Items[i] = new Array(1)
    }
    Items[0][0] = 'promotionalitems';
    Items[0][1] = '-100px';
}
else if (Category == 'WallMaps')//Wall Maps
{
    //bgImage = 'WallMapsMenu';
    BGClass = 'WallMapsCategoryBG';
    ProductCategName = "Wall Maps";
    Items = new Array(2)
    for (i = 0; i < 2; i++) {
        Items[i] = new Array(2)
    }
    Items[0][0] = 'magneticmappins';
    Items[0][1] = '-0px';
    Items[1][0] = 'wallmaps';
    Items[1][1] = '-100px';
}
else if (Category == 'StaplersAndPunches')//Staplers and Punches
{
    //bgImage = 'WallMapsMenu';
    BGClass = 'StaplersAndPucnhesCategoryBG';
    ProductCategName = "Staplers and Punches";
    Items = new Array(2)
    for (i = 0; i < 2; i++) {
        Items[i] = new Array(2)
    }
    Items[0][0] = 'staplers';
    Items[0][1] = '-500px';
    Items[1][0] = 'punches';
    Items[1][1] = '-600px';
}
return Items;
}
function FindProductDivAndApplyStyle()
{
  var Categories=new Array(14)
  for (i=0; i <14; i++)
  {
    Categories[i]= new Array(14)
  }
  Categories[0] = 'Boards';
  Categories[1] = 'Accessories';
  Categories[2] = 'BoardSupports';
  Categories[3] = 'DisplaySystems';
  Categories[4] = 'EasyRail';
  Categories[5] = 'EduBoards';
  Categories[6] = 'Electronics';
  Categories[7] = 'Office';
  Categories[8] = 'Planners';
  Categories[9] = 'Personalised';
  Categories[10] = 'Printed';
  Categories[11] = 'Services';
  Categories[13] = 'StaplersAndPunches';
  Categories[14] = 'WallMaps';  
  var ProductList;
  for (var x=0; x < Categories.length; x ++)
  {
    ProductList = AddMenuItems(Categories[x]);
    ApplyStyles(ProductList);
  }  
}
function ApplyStyles(ProductList)
{
    if (ProductList == undefined) {
        return 0;
    }
  var divElement;  
  for (var x=0; x < ProductList.length; x ++)
  {
    divElement = new getObj(ProductList[x][0]);
    if (divElement.obj !== null)
      {
        divElement.obj.className = BGClass;
        divElement.obj.style.backgroundPosition = "0px " + ProductList[x][1];     
        divElement.obj.style.width = '100px';
        divElement.obj.style.height = '100px';
        divElement.obj.style.cursor = 'hand';
        divElement.obj.style.cursor = 'pointer';      
      }
  }  
}
function IncreaseElementWidth(itemId,Width)
{
  var divSearch = new getObj(itemId);
  if (divSearch == null)
  {
    return;
  }
  divSearch.obj.style.width = "200px";
  divSearch.obj.style.display = "block";
}

//Controls hoverhover event in screensrange page
function EnlargeImage(ItemName)
{
  ShowFishMenuItem(ItemName);  
}
function ShowFishMenuItem(imgName)
{
var ScreenType;
 if (imgName.search("pulldown") >-1)
 {
   ScreenType = "<strong>PULL DOWN SCREEN</strong><ul><li>Self Locking system is easy to use</li><li>Screen stays wrinkle-free, is flame retardant and mildew resistant</li><li>Black framed, black backed screen</li></ul>";   
 }
 else if (imgName.search("pullup") >-1)
 {
   ScreenType = "<strong>PULL UP SCREEN</strong><ul><li>Screen stays wrinkle-free, is flame retardant and mildew resistant</li><li>Durable metal case</li><li>Easy to store and to move</li></ul>";   
 } 
 else if (imgName.search("electric") >-1)
 {
   ScreenType = "<strong>ELECTRIC SCREEN</strong><ul><li>Remote and wall mounted controlled</li><li>The motor is quiet, secure and precise</li><li>The screen stays wrinkle-free, is flame retardant and mildew resistant</li>Black framed, black backed screen</li></ul>";   
 } 
 else if (imgName.search("tripod") >-1)
 {
   ScreenType = "<strong>TRIPOD SCREEN</strong><ul><li>The adjustable stand allows various heights suitable for every need</li><li>The screen hook has different angle positions for keystone adjustment</li><li>Black framed, black background screen</li></ul>";   
 } 
 else if (imgName.search("tabletop") >-1)
 {
   ScreenType = "<strong>TABLE TOP SCREEN</strong><ul><li>The screen has been designed to be placed on tabletops.</li><li>The aluminum alloy is strong and light, making it easy to transport</li><li>The screen is easy to assemble and the handy carry bag ensures that there will be no transportation issues</li><li>Ideal for presentations on the move</li></ul>";   
 }
 else if (imgName.search("cinemascreen") >-1)
 {
   ScreenType = "<strong>CINEMA STYLE/ HOME THEATRE SCREEN</strong><ul><li>Screen is stable and prevents wrinkles at the center of the screen</li><li>The projection surface utilizes a grey-scale PVC composite material which filters excess light to preserve the image</li><li>Ideal for home-theatre, wall mounted</li><li>Black Felt frame 65mm wide</ul>";   
 } 
 var lbl = new getObj('divCaption');
 var list = new getObj(imgName);
 if (list.obj == null){
   return;
   } 
 if (lbl.obj != null){
   lbl.obj.innerHTML = ScreenType;
   SetControlBGColourAndBorder(list.obj.id,'#f1f7fa');
   }   
} 
function AddLocationToHistory(location,loadPage){
  if (loadPage == null){
    loadPage = false;
  }
  if (location > ''){
    window.location.hash = location;
    if (document.getElementById("historyFrame") == null){
      return;
    }
    var doc = document.getElementById("historyFrame").contentWindow.document;
    doc.open('javascript:\'<html></html>\'');
    doc.write('<html><head><script type=text\/javascript\>parent.onFrameLoaded(' + location + '\',' + loadPage + ');</script></head><body></body></html>');
    doc.close();
  }  
}
function CacheImages()
{
var img1, img2, img3, img4;
img1 = new Image();
img1.src = 'images/Products/Boards/cleaningfluid.gif';   
img2 = new Image();
img2.src = 'images/Products/Boards/slimlineboard_corner.gif';   
img3 = new Image();
img3.src = 'images/Products/Boards/duster.gif';
img4 = new Image();
img4.src = 'images/Products/Boards/magnets_4.gif';
img5 = new Image();
img5.src = 'images/Products/Boards/marker_2.gif';  
}
function RollPicture(ParentImg, PicUrl)
{
  var imgFeature = document.getElementById('imgFeature');
  var divImg;
  divImg = new getObj('divFeature');
  if (imgFeature == null){
    imgFeature = document.createElement('img');
    imgFeature.id = 'imgFeature';
  }
  if (PicUrl != ''){
      var img = new getObj(ParentImg);
      if (img.obj == null) {
          OpenErrorWindow('Image not found', 'The roll over image (' + ParentImg + ') was not found.');
          return;
      }
    if (findMyAccountTopPosition(img.obj) < MouseY){
      divImg.obj.style.top = img.obj.offsetHeight;
      divImg.obj.style.left = img.obj.offsetLeft + img.obj.clientWidth;      
    }
    else{
      divImg.obj.style.top = MouseY;
      divImg.obj.style.left = MouseX;
    }
    imgFeature.src = 'images/' + PicUrl;    
    divImg.obj.style.background = '';
    divImg.obj.style.width = 'auto';
    divImg.obj.style.height = 'auto';
    divImg.obj.style.position = 'fixed';    
    divImg.obj.style.zIndex = "50";
    divImg.obj.appendChild(imgFeature);
    divImg.obj.style.display = 'block';
  }
  else
  {
    divImg.obj.style.display = 'none';
  }  
}
function RolloverSprite(ParentImg, Yposition)
{
  divImg = new getObj('divFeature');
  if (Yposition != ''){
    var img = new getObj(ParentImg);
    if (findMyAccountTopPosition(img.obj) < MouseY){
      divImg.obj.style.top = findMyAccountTopPosition(img.obj);
      divImg.obj.style.left = findMyAccountLeftPosition(img.obj);    
    }
    else{
      divImg.obj.style.top = MouseY;
      divImg.obj.style.left = MouseX;
    }
    divImg.obj.style.width = '100px';
    divImg.obj.style.height = '140px'; 
        
    if (ParentImg == 'withcastor'){
      divImg.obj.style.background = 'url(images/products/boards/Flipchart_Castors_Features.png)';      
      }
    if (ParentImg == 'flipchart'){
      divImg.obj.style.background = 'url(images/products/boards/Flipchart_features.png)';      
      }
    if (ParentImg == 'mobile'){    
      divImg.obj.style.background = 'url(images/products/boards/MobileBoard_Features.png)';      
    }  
    if (ParentImg == 'aframeAluminium' || ParentImg == 'aframeSteel' || ParentImg == 'aframePoster'){    
      divImg.obj.style.background = 'url(images/products/boards/Aframe_Features.png)';      
    }
    if (ParentImg == 'eduboard1' || ParentImg == 'eduboard2'){    
      divImg.obj.style.background = 'url(images/products/boards/eduboard_Features.png)';      
    }
    if (ParentImg == 'executiveboard'){
      divImg.obj.style.background = 'url(images/products/boards/executiveboard_Features.gif)';
    }
    if (ParentImg == 'easyrailScreen' || ParentImg =='easyrailFlipchart'){
      divImg.obj.style.background = 'url(images/products/boards/easyrail_Features.png)';
    }
    if (ParentImg.search('boardsupports') > -1){
      divImg.obj.style.background = 'url(images/products/boards/boardsupports_Features.gif)';
    }
    if (ParentImg.search('trolley') > -1){
      divImg.obj.style.background = 'url(images/products/electronicmedia/trolleys_features.gif)';
    }
    if (ParentImg.search('screen') > -1){
      divImg.obj.style.background = 'url(images/products/electronicmedia/screens_features.gif)';
    }
    if (ParentImg.search('display') > -1){
      divImg.obj.style.background = 'url(images/products/displaySystems/displaySystems_features.gif)';
    }
    if (ParentImg.search('promo') > -1){
      divImg.obj.style.background = 'url(images/products/services/promotionaItems_features.gif)';
    }
    if (ParentImg.search('printed') > -1){
      divImg.obj.style.background = 'url(images/products/printedboards/printedboards_features.gif)';
      divImg.obj.style.width = '200px';
      divImg.obj.style.height = '200px';
    }
    if (ParentImg.search('planner') > -1){
      divImg.obj.style.background = 'url(images/products/printedboards/planners_features.gif)';
      divImg.obj.style.width = '200px';
      divImg.obj.style.height = '200px';
    }    
    
    divImg.obj.style.backgroundPosition = '0px -'+ Yposition + 'px';  
    divImg.obj.innerHTML = '';
    divImg.obj.style.position = 'absolute';    
    divImg.obj.style.zIndex = "50";
    divImg.obj.style.display = 'block';
  }
  else
  {
    divImg.obj.style.display = 'none';
  }  
}
function UpdateMailLink(PageUrl){
var link = new getObj('lnkEmail');
  if (link.obj != null){
    link.href = 'mailto:?body=Thought you might find this web page from Parrot Products interesting: ' + PageUrl + '&Subject=Parrot Products Website';
  }  
}
function EnableCheckOutBtn(txtOrder,btnId){
  var btn = new getObj(btnId);
  var txt = new getObj(txtOrder);
  if (btn.obj == null){
    return;
    }
  if (txt.obj !== null){
    if (txt.obj.value == ''){ 
      if(txt.obj.innerText.length == 0){
        MakeControlRed(txtOrder)
        return;
      }   
      btn.obj.disabled = true;      
    }
    if (btn.obj != null){
    btn.obj.disabled = false;
    RestoreControlsColour(txt.obj.id);
    var tipRow = new getObj('tip');
    if (tipRow.obj != null){
      tipRow.obj.style.display = 'none';
      }    
    }
  }
}
function ShowShoppingList()
{
    var shopCtrl = new getObj('shopping');
    var intTop = 170; //screen.availHeight * 0.25;
    var intWidth = jQuery(window).width() - 230;  //- 211;  //211 is the width of the left menu
    var intHeight = jQuery(window).height() - (intTop + $('#divShoppingDetails').height() + 20); // ((intTop + 50) * 2);
    var intLeft = 211;
if (shopCtrl == null){
  return;
}
if (screen.availHeight <= 768) {
    topPosition = screen.availHeight * 0.25;
}
$('#CartDetails').css({ top: intTop + 'px', 
  left: intLeft + 'px', width: intWidth + 'px', height: intHeight + 'px',
  position:'fixed', background:'#e7e8e9', border:'solid 1px #000',padding:'5px'});
if ($("#CartDetails").is(':visible')) {
  $("#CartDetails").hide('slow');
  }
else{
  $("#CartDetails").show('slow');
  }
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Show Customer Orders
function ShowOrderList()
{
//if (!CheckCustomerLogon()) {
//  OpenPageViaMenu('login');
//  return;
//}
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
if(cntrlId.obj == null || cntrlCode.obj == null){
  return;
  }
var UserId = cntrlId.obj.value;
var CustomerCode = cntrlCode.obj.value;
if (UserId < 0 || CustomerCode.length < 6){
  return;
  }
DisplayControl('imgLoading');
SetControlInnerHTML('divOrdersAndQuotes', ParrotOrderLoading);
currentResultDiv = 'divOrdersAndQuotes';
ParrotWebClient.JScriptsServices.LoadOrders(CustomerCode, UserId, ListContent, FailedCallback);    
}
function ListContent(result, eventArgs)
{
HideControl('imgLoading');
SetControlValue('btnView','Refresh');  
SetControlInnerHTML('divOrdersAndQuotes' ,result);  
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Show Customer Quotes
function ShowQuoteList()
{
HideControl('divCancelOrder');
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
if(cntrlId.obj == null || cntrlCode.obj == null){
  return;
  }
var UserId = cntrlId.obj.value;
var CustomerCode = cntrlCode.obj.value;
if (UserId < 0 || CustomerCode.length < 6){
  return;
  }
DisplayControl('imgLoading');
SetControlInnerHTML('divOrdersAndQuotes', ParrotQuotesLoading);
currentResultDiv = 'divOrdersAndQuotes';
ParrotWebClient.JScriptsServices.LoadQuotes(CustomerCode, UserId, ListContent, FailedCallback);
}
function SetUserAndCustomer(id,code)
{
var userId = new getObj('hideUserID');
var customerId = new getObj('hidesCustomerCode');
if(userId.obj == null || customerId.obj == null){
  return;
  }
userId.obj.value = id;
customerId.obj.value = code;
}
function ShowOrdersOrQuotes()
{
HideControl('divCancelOrder');
var rdOrd = new getObj('rdOrders');
var rdQte = new getObj('rdQuotes');
if (rdOrd.obj == null || rdQte.obj == null){
  return;
  }
if (rdOrd.obj.checked){
  if (rdOrd.obj.disabled){
    OpenErrorWindow('No Permission','You do not have permission to view quotes. Please contact your administrator for assistance');
    return;
    }
  ShowOrderList()
  }  
else if(rdQte.obj.checked){
  if (rdQte.obj.disabled){
    OpenErrorWindow('No Permission','You do not have permission to view quotes. Please contact your administrator for assistance');
    return;
    }
  ShowQuoteList();
  }  
}
//--------++++++++++++++++++++++++++++++++++++++++++Lists files for the selected catalogue type (product/ screens)
function CatalogueList()
{
var catType = 'product';
var listCatType = new getObj('ddlCatalogueType');
var sortByProduct = new getObj('rbnProduct');
var sortByPage = new getObj('rbnPage');
var sortBy = 'ProductName'; //ProductName || PageNo

DisplayControl('imgLoading');
if (sortByProduct.obj != null || sortByPage.obj != null){
  if (sortByPage.obj.checked){
    sortBy = 'PageNo';
    }
  }
if (listCatType.obj != null){
  if (listCatType.obj.selectedIndex != 0){
    catType = 'screens';
    }  
  }
divOrdersAndQuotes = 'divCatalogue';
ParrotWebClient.JScriptsServices.ListCataloguePDFs(catType, sortBy, ListCatalogue, FailedCallback);
}
function ListCatalogue(result, eventArgs)
{
HideControl('imgLoading');
SetControlInnerHTML('divCatalogue',result);
}
//------ GETS or SETS dates for start and end date controls
function GetorSetDates(dateType,setDate)
{
var txtDay, txtMonth,txtYear;
var myDate = new Date();  
if(setDate != null){
  myDate = new Date(setDate);
  if (myDate == 'NaN'){
    myDate = new Date();
    }
  }
txtDay = new getObj('txtStartDay');
txtMonth = new getObj('ddlStartMonth');
txtYear = new getObj('txtStartYear');
if (dateType == 'end'){
  txtDay = new getObj('txtEndDay');
  txtMonth = new getObj('ddlEndMonth');
  txtYear = new getObj('txtEndYear');
  }
if(txtDay.obj != null || txtMonth.obj != null || txtYear.obj != null){
  txtDay.obj.value = myDate.getDate();
  txtMonth.obj.selectedIndex = myDate.getMonth();
  txtYear.obj.value = myDate.getFullYear();
  if (!txtYear.obj.value > 1999){
    txtYear.obj.value = 1900 + myDate.getYear()
    }  
  myDate = new Date (txtYear.obj.value, txtMonth.obj.selectedIndex,txtDay.obj.value) ; 
  }
return myDate;
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GETS list of INVOICES OR CREDIT NOTES
function ListAllInvoicesOrCrdNotes()
{
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
var cntrlAcc = new getObj('hideAcc');

var btnView = new getObj('btnView');
var dtStartDay, dtEndDay;
var dtStartMonth, dtEndMonth;
var dtStartYear, dtEndYear;

var ctlStartDay = new getObj('txtStartDay');
var ctlEndDay = new getObj('txtEndDay');
var ctlStartMonth = new getObj('ddlStartMonth');
var ctlEndMonth = new getObj('ddlEndMonth');
var ctlStartYear = new getObj('txtStartYear');
var ctlEndYear = new getObj('txtEndYear');
var dtToday = new Date();

if (ctlStartDay.obj == null || ctlStartMonth.obj == null || ctlStartYear.obj == null){
  dtStartDay = dtToday.getDay();
  dtStartMonth = dtToday.getMonth();
  dtStartYear = dtToday.getFullYear();
  if (!dtStartYear > 1999){
    dtStartYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtStartDay = ctlStartDay.obj.value;
  dtStartMonth = ctlStartMonth.obj.selectedIndex;
  dtStartYear = ctlStartYear.obj.value;
  }
if (ctlEndDay.obj == null || ctlEndMonth.obj == null || ctlEndYear.obj == null){
  dtEndDay = dtToday.getDay();
  dtEndMonth = dtToday.getMonth();
  dtEndYear = dtToday.getFullYear();
  if (!dtEndYear > 1999){
    dtEndYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtEndDay = ctlEndDay.obj.value;
  dtEndMonth = ctlEndMonth.obj.selectedIndex;
  dtEndYear = ctlEndYear.obj.value;  
  }

var dtStartDate = dtStartYear + '/' + (dtStartMonth +1) + '/' + dtStartDay;
var dtEndDate = dtEndYear + '/' + (dtEndMonth +1) + '/' + dtEndDay;;

if (new Date(dtStartDate) > new Date(dtEndDate)){
  dtEndDate = dtStartDate;
  GetorSetDates('end',dtStartDate);
  }

if(cntrlId.obj == null || cntrlCode.obj == null){
  return;
  }
var UserId = cntrlId.obj.value;
var CustomerCode = cntrlCode.obj.value;
if (UserId < 0 || CustomerCode.length < 6){
  return;
  }
DisplayControl('imgLoading');
if (cntrlId.obj == null || cntrlCode.obj == null){
  OpenErrorWindow('The system is unable to load your invoices','Please ensure that you have logged on correctly');
  return;
  }
var inv = new getObj('rbnInvoices');
if (inv.obj != null){
  if (inv.obj.checked){
    if (inv.obj.disabled){
      OpenErrorWindow('No Permission','You do not have permission to view invoices. Please contact your administrator for assistance.');
      return;
      }
  SetControlInnerHTML('divInvsAndCrdNotes', ParrotInvoiceLoading);
  currentResultDiv = 'divInvsAndCrdNotes';
  ParrotWebClient.JScriptsServices.LoadInvoices(cntrlCode.obj.value,-1,dtStartDate, dtEndDate,cntrlAcc.obj.value, cntrlId.obj.value, ListInvoicesOrCrdNotes, FailedCallback,'XmlDocument');      
    }
  }
var crd = new getObj('rbnCreditNotes');
if (crd.obj != null){
  if (crd.obj.checked){
    if (crd.obj.disabled){
        OpenErrorWindow('No Permission','You do not have permission to view credit notes. Please contact your administrator for assistance.');
        return;
        }
  SetControlInnerHTML('divInvsAndCrdNotes', ParrotCrdNotesLoading );
  currentResultDiv = 'divInvsAndCrdNotes';
  ParrotWebClient.JScriptsServices.LoadCreditNotes(cntrlCode.obj.value,-1,dtStartDate, dtEndDate,cntrlId.obj.value, ListInvoicesOrCrdNotes, FailedCallback,'XmlDocument');  
    }
  }
}
function ListInvoicesOrCrdNotes(result,userContext, methodName)
{
HideControl('imgLoading');
SetControlValue('btnView', 'Refresh');
if (userContext == "XmlDocument"){
  SetControlInnerHTML('divInvsAndCrdNotes', result[0]);
  }
else{
  SetControlInnerHTML('divInvsAndCrdNotes', '<span class=Message>No records found</span>');
  }
}
//------------SET Months & Years for dropdowns
function GetorSetMonthAndYears()
{
var dtToday = new Date();
var thisYear = dtToday.getFullYear();
if (!thisYear > 1999){
  thisYear = 1900 + dtToday.getYear()
  }
var ddlYears = new getObj('ddlYears');
if (ddlYears.obj != null){
  //ddlYears.obj.options = 0;
  for (i=thisYear; i > thisYear - 20; i--){
    var opt = new Option(i, i); 
    ddlYears.obj.options[ddlYears.obj.options.length] = opt;
    }
  }
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GETS Statements
function ShowStatements()
{
if (!ShowStatementDateControls()){
  return;
  }  
var dtMonth, dtYear;
var ctlYear = new getObj('ddlYears');
var ctlMonth = new getObj('ddlMonths');

if (ctlMonth.obj == null || ctlYear.obj == null){
  var dtToday = new Date();
  dtMonth = dtToday.getMonth();
  dtYear = dtToday.getFullYear();
  if (!dtYear > 1999){
    dtYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtMonth = ctlMonth.obj.selectedIndex;
  dtYear = ctlYear.obj.value;
  }
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
var cntrlControlAcc = new getObj('hideCntrlAcc');
var cntrlCustomerAcc = new getObj('hideCustAcc');
if (cntrlId.obj == null || cntrlCode.obj == null || cntrlControlAcc == null || cntrlCustomerAcc.obj == null){
  OpenErrorWindow('Unable to load statements.', 'Please ensure that you have logged on correctly.');
  return;
  }
DisplayControl('imgLoading');
dtMonth += 1;
currentResultDiv = 'divStatements';
ParrotWebClient.JScriptsServices.LoadStatements(cntrlCode.obj.value, cntrlControlAcc.obj.value, cntrlCustomerAcc.obj.value,dtYear,dtMonth, cntrlId.obj.value, ListStatements, FailedCallback,'XmlDocument');  
}
function daysInMonth(iMonth, iYear)
{
    var dd = new Date(iYear, iMonth, 0);
    return dd.getDate();
}

//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  GETS Detailed Ledger
function ShowDetailedLedger()
{
if (!ShowStatementDateControls()){
  return;
  }
var dtStartDay, dtEndDay;
var dtStartMonth, dtEndMonth;
var dtStartYear, dtEndYear;

var ctlStartDay = new getObj('txtStartDay');
var ctlEndDay = new getObj('txtEndDay');
var ctlStartMonth = new getObj('ddlStartMonth');
var ctlEndMonth = new getObj('ddlEndMonth');
var ctlStartYear = new getObj('txtStartYear');
var ctlEndYear = new getObj('txtEndYear');
var dtToday = new Date();

if (ctlStartDay.obj == null || ctlStartMonth.obj == null || ctlStartYear.obj == null){
  dtStartDay = dtToday.getDay();
  dtStartMonth = dtToday.getMonth();
  dtStartYear = dtToday.getFullYear();
  if (!dtStartYear > 1999){
    dtStartYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtStartDay = ctlStartDay.obj.value;
  dtStartMonth = ctlStartMonth.obj.selectedIndex;
  dtStartYear = ctlStartYear.obj.value;
  }
if (ctlEndDay.obj == null || ctlEndMonth.obj == null || ctlEndYear.obj == null){
  dtEndDay = dtToday.getDay();
  dtEndMonth = dtToday.getMonth();
  dtEndYear = dtToday.getFullYear();
  if (!dtEndYear > 1999){
    dtEndYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtEndDay = ctlEndDay.obj.value;
  dtEndMonth = ctlEndMonth.obj.selectedIndex;
  dtEndYear = ctlEndYear.obj.value;  
  }

var dtStartDate = dtStartYear + '/' + (dtStartMonth +1) + '/' + dtStartDay;
var dtEndDate = dtEndYear + '/' + (dtEndMonth +1) + '/' + dtEndDay;;

if (new Date(dtStartDate) > new Date(dtEndDate)){
  dtEndDate = dtStartDate;
  GetorSetDates('end',dtStartDate);
  }  
  
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
var cntrlControlAcc = new getObj('hideCntrlAcc');
var cntrlCustomerAcc = new getObj('hideCustAcc');
if (cntrlId.obj == null || cntrlCode.obj == null || cntrlControlAcc == null || cntrlCustomerAcc.obj == null){
  OpenErrorWindow('Unable to load statements.','Please ensure that you have logged on correctly.');
  return;
  }
DisplayControl('imgLoading');
SetControlInnerHTML('divStatements','');
currentResultDiv = 'divStatements';
ParrotWebClient.JScriptsServices.LoadDetailedLedger(cntrlCode.obj.value, dtStartDate, dtEndDate, cntrlControlAcc.obj.value, cntrlCustomerAcc.obj.value, cntrlId.obj.value, ListStatements, FailedCallback,"XmlDocument");  
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GETS Loyal Statement
function ShowLoyaltyStatement()
{
if (!ShowStatementDateControls()){
  return;
  }
var dtStartDay, dtEndDay;
var dtStartMonth, dtEndMonth;
var dtStartYear, dtEndYear;

var ctlStartDay = new getObj('txtStartDay');
var ctlEndDay = new getObj('txtEndDay');
var ctlStartMonth = new getObj('ddlStartMonth');
var ctlEndMonth = new getObj('ddlEndMonth');
var ctlStartYear = new getObj('txtStartYear');
var ctlEndYear = new getObj('txtEndYear');
var dtToday = new Date();

if (ctlStartDay.obj == null || ctlStartMonth.obj == null || ctlStartYear.obj == null){
  dtStartDay = dtToday.getDay();
  dtStartMonth = dtToday.getMonth();
  dtStartYear = dtToday.getFullYear();
  if (!dtStartYear > 1999){
    dtStartYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtStartDay = ctlStartDay.obj.value;
  dtStartMonth = ctlStartMonth.obj.selectedIndex;
  dtStartYear = ctlStartYear.obj.value;
  }
if (ctlEndDay.obj == null || ctlEndMonth.obj == null || ctlEndYear.obj == null){
  dtEndDay = dtToday.getDay();
  dtEndMonth = dtToday.getMonth();
  dtEndYear = dtToday.getFullYear();
  if (!dtEndYear > 1999){
    dtEndYear = 1900 + dtToday.getYear()
    }
  }
else{
  dtEndDay = ctlEndDay.obj.value;
  dtEndMonth = ctlEndMonth.obj.selectedIndex;
  dtEndYear = ctlEndYear.obj.value;  
  }

var dtStartDate = dtStartYear + '/' + (dtStartMonth +1) + '/' + dtStartDay;
var dtEndDate = dtEndYear + '/' + (dtEndMonth +1) + '/' + dtEndDay;;

if (dtStartDate > dtEndDate){
  dtEndDate = dtStartDate;
  GetorSetDates('end',dtStartDate);
  }  
var cntrlId = new getObj('hideUserID');
var cntrlCode = new getObj('hidesCustomerCode');
var cntrlLoyaltyAcc = new getObj('hideLoyalAcc');
if (cntrlId.obj == null || cntrlCode.obj == null || cntrlLoyaltyAcc == null){
  OpenErrorWindow('Unable to load statements.','Please ensure that you have logged on correctly.');
  return;
  }
DisplayControl('imgLoading');
currentResultDiv = 'divStatements';
ParrotWebClient.JScriptsServices.LoadLoyaltyStatement(cntrlCode.obj.value, dtStartDate, dtEndDate, cntrlLoyaltyAcc.obj.value, cntrlLoyaltyAcc.obj.value, cntrlId.obj.value, ListStatements, FailedCallback, 'XmlDocument');  
}
function ListStatements(result,userContext, methodName)
{
SetControlValue('btnViewStatements', 'Refresh');
if(userContext == 'XmlDocument')
{
var readResult;
if (userContext == "XmlDocument"){
  if (document.all)
    readResult = result.documentElement.nodeTypedValue; //result.documentElement.firstChild.text;
  else   // Firefox
    readResult = result.documentElement.firstChild.textContent;
    SetControlInnerHTML('divStatements', readResult);
    }
else{
  SetControlInnerHTML('divStatements', '<span class=Message>No records found</span>');
  }        
}
HideControl('imgLoading');
}
//----- Show Correct Date Control for Statements, Detailed Ledger and Loyalty Statements
//function ShowStatementDateControls(OpenDoc)
//{
//if (OpenDoc == null || OpenDoc == ''){
//  OpenDoc = false;
//}
//var rbnStatements, rbnDetailedLedger, rbnLoyalty;
//var checked = 0;
//rbnStatements = new getObj('rbnStatement');
//rbnDetailedLedger = new getObj('rbnDetailedLedger');
//rbnLoyalty = new getObj('rbnLoyalty');

//var cntrlBoxes = new getObj('divDateBoxes');
//var cntrlDropDowns = new getObj('divDateOptions');
//if (cntrlBoxes.obj == null || cntrlDropDowns.obj == null){
//  //OpenErrorWindow('Error Message','Error occured while attempting to load data. Please try again.');
//  return false;
//  }
//if (rbnStatements.obj != null && rbnStatements.obj.checked){
//  cntrlBoxes.obj.style.visibility = 'hidden';
//  cntrlDropDowns.obj.style.visibility = 'visible';
//  checked +=1;  
//  if (OpenDoc){
//    ShowStatements();
//    }  
//  }
//if (rbnDetailedLedger.obj != null && rbnDetailedLedger.obj.checked){ 
//  cntrlBoxes.obj.style.visibility = 'visible';
//  cntrlDropDowns.obj.style.visibility = 'hidden';
//  checked +=1;
//  if (OpenDoc){
//    ShowDetailedLedger();
//    }
//  }
//if (rbnLoyalty.obj != null && rbnLoyalty.obj.checked){
//  cntrlBoxes.obj.style.visibility = 'visible';
//  cntrlDropDowns.obj.style.visibility = 'hidden';
//  checked +=1;
//  if (OpenDoc){
//    ShowLoyaltyStatement();
//    }
//  }
//if (checked == 0){
//  alert('Please select Statements, Detailed Ledger or Loyalty options');
//  return false;  
//  }
//return true;
//}
function OpenErrorWindow(title, msg)
{
var ErrorWin = new getObj("popMsg");
if (ErrorWin.obj == null){
  ErrorWin = document.createElement("div");
  ErrorWin.setAttribute("id","popMsg");
    
  var btn = document.createElement("input");
  btn.setAttribute("type","button");
  btn.setAttribute("value","OK");
  btn.style.width = '50px';
  btn.onclick = CloseErrorWindow;
  
  var buttonDiv = document.createElement("div");
  buttonDiv.style.textAlign = 'center';
  buttonDiv.innerHTML = '<br>';
  buttonDiv.className = 'msgText';
  buttonDiv.style.filter='alpha(opacity='+ 95 +')';    
  buttonDiv.appendChild(btn);
  
  var headerDiv = document.createElement("div");
  headerDiv.setAttribute('id','msgTitle');
  headerDiv.className = 'msgTitle';
  headerDiv.style.background = '#e7e8e9';
  headerDiv.style.color = '#000';
  headerDiv.innerHTML = title; 
    
  var msgDiv = document.createElement("div");
  msgDiv.setAttribute('id','msgText');
  msgDiv.className = 'msgText';
  msgDiv.innerHTML = msg;
    
  ErrorWin.style.top = (screen.width * 0.25) + 'px';
  ErrorWin.style.left = (screen.height /2)  - 100 + 'px';
  ErrorWin.style.background='#e7e8e9';
  ErrorWin.style.padding = '5px';
  ErrorWin.style.border='solid 1px #000';
  ErrorWin.style.height='auto';
  ErrorWin.style.width = '400px';
    
  ErrorWin.appendChild(headerDiv);
  ErrorWin.appendChild(msgDiv);
  ErrorWin.appendChild(buttonDiv);
  ErrorWin.className = 'fixedElement';  
  
  var tbody = document.getElementsByTagName("body")[0];   
  tbody.appendChild(ErrorWin);    
  }   
else{
  var msgTitle = new getObj('msgTitle');
  if (msgTitle.obj != null){
    msgTitle.obj.innerHTML = title;
    }
  var msgText = new getObj('msgText');
  if (msgText.obj != null){
    msgText.obj.innerHTML = msg;
    }
  ErrorWin.obj.style.display = 'block';  
  }
}
function CloseErrorWindow()
{
  document.getElementById("popMsg").style.display='none';  
}
function AddUpdatePanelHandlers() {
    try {
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);    
    }
    catch (e) {
        return false;
    }  
}
function BeginRequestHandler(sender, args) 
{
var elem = new getObj('<%=grdWithScroll.clientid%>');
if (elem.obj != null){
  scrollTop=elem.obj.scrollTop;
  }
var loadProgress = new getObj("imgLoading");
if (loadProgress.obj != null){
  loadProgress.obj.style.display = "block";
  }
}
function EndRequestHandler(sender, args)
{
var elem = new getObj('<%=grdWithScroll.clientid%>');
if (elem.obj != null){
  scrollTop=elem.obj.scrollTop;
  }
var loadProgress = new getObj("imgLoading");
if (loadProgress.obj != null){
  loadProgress.obj.style.display = "none";
  }
}
function ChangeBGPosition(id, Position)
{
var td = document.getElementById(id);
var productFocusTD = new getObj('newsContent');
if (productFocusTD.obj != null){
  //testTD.obj.innerHTML = '';
  if (Position == ''){
     productFocusTD.obj.style.background = "url('../images/DefaultPageImages/InteractiveWhiteboard.jpg') no-repeat center";
     productFocusTD.obj.style.textAlign = 'left';
     return;
  }
  productFocusTD.obj.style.textAlign = 'center';  
  if(id.search('1')>0){
    productFocusTD.obj.innerHTML = '';    
    productFocusTD.obj.style.background = "url('../images/DefaultPageImages/Interactive_1.gif') no-repeat 0px 0px";
    } 
  else if (id.search('2')>0){
    productFocusTD.obj.style.background = "url('../images/DefaultPageImages/Interactive_2.gif') no-repeat 0px 0px";
    }
  else if (id.search('3')>0){
    productFocusTD.obj.style.background = "url('../images/DefaultPageImages/Interactive_3.gif') no-repeat 0px 0px";
    }
  else if (id.search('4')>0){
    productFocusTD.obj.style.background = "url('../images/DefaultPageImages/Interactive_4.gif') no-repeat 0px 0px";
    }
  productFocusTD.obj.style.backgroundPosition = 'center';
  td.style.backgroundPosition = Position;  
  productFocusTD.obj.style.height = '219px';
  }  
}
function OpenOrCloseSlider()
{
var imgSlider = new getObj('slider');
if (imgSlider != null){
   if (imgSlider.obj.src.search('closing') > -1){
    imgSlider.obj.src = 'images/Products/PrintedBoards/inOrOutSlide_opening.gif';
    }
  else{
    imgSlider.obj.src = 'images/Products/PrintedBoards/inOrOutSlide_closing.gif';
    }  
  } 
}
//=============================== COMMON FUNCTIONS: to hide, display, enable, disable, check or select, focu on controls
function RestoreControlsColour(id){
var cntrl = new getObj(id);
  if (cntrl.obj != null){
    cntrl.obj.style.background = '#fff';
    cntrl.obj.style.color = '#007799';    
  }  
}
function MakeControlRed(id){
var cntrl = new getObj(id);
  if (cntrl.obj != null){
    cntrl.obj.style.background = 'red';
    cntrl.obj.style.color = '#fff';    
  }  
}
function HideControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.style.display = 'none';
  }
}
function DisplayControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.style.display = 'block';
  }
}
function DisableControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.disabled = true;
  }
}
function EnableControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.disabled = false;
  }
}
function CheckOptionControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.checked = true;
  }
}
function UnCheckOptionControl(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.checked = false;
  }
}
function SetControlValue(id, newValue)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.value = newValue;
  }
}
function SetControlInnerHTML(id, newValue)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.innerHTML = newValue;
  }
}
function GetControlValue(id)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  return cntrl.obj.value;
  }
return '';
}
function SetControlBGColourAndBorder(id, colour)
{
var cntrl = new getObj(id);
if (cntrl.obj != null){
  cntrl.obj.style.background = colour;
  if (colour != '#fff'){
    cntrl.obj.style.border = 'solid 1px #007799';
    cntrl.obj.style.padding = '2px';
    }
  else{
   cntrl.obj.style.border = '0px';
    }
  }
}
function SetPromoBackground(ctrlID, backgroundStyle) {
    var divPromo = new getObj(ctrlID);
    if (divPromo != null && divPromo != 'undefined') {
        //divPromo.obj.style.background = backgroundStyle;
        //document.getElementById(ctrlID).style.backgroundImage = 'url(../images/Promotions/' + backgroundStyle + ')';
        document.getElementById(ctrlID).style.background = 'url(../images/Promotions/' + backgroundStyle + ') center no-repeat';
    }
}
//=============================== END 
function sendRequest(url)
{
var response = null;
url = 'ProductPages/' + url + '.html';
var connection = new ActiveXObject("Microsoft.XMLHTTP");
try{
  connection.open("GET", url, false);
  connection.send();
  if(connection.readyState == 4) response = connection.responseText;
  }
catch(e){
  alert("ERROR: The remote host could not be found or the connection was refused.");
  return false;
  }
//alert(response);
var cont = new getObj('content');
if (cont.obj !== null) cont.innerHTML = response;
return false;
}
function LoadHomePageImage()
{
if (screen.width > 1024){
  if ($('#imgBinder') != null){
    $('#imgBinder').attr('src','images/DefaultPageImages/SlideBinder_1024plus.jpg');
    $('#imgBinder').attr('onload', '');
  }
  $('#interactive').attr('src','images/DefaultPageImages/Interactive_1024plus.gif');  
  $('#interactive').attr('onload', '');
  }
EnableLightBox();  
}
function LoadPlannersImages()
{
if (window.screen.width > 1024){
  $('#printed').attr('src','images/Products/PrintedBoards/YearPLanner_large.jpg');  
  $('#printed').attr('onload', '');
  $('#mapYearPlanner').html("");
  $('#printed').css('cursor', 'default');
  HideControl('tip');
  }
}
//============================ lightbox gallery
function ShowGallery()
{
if ( $("#galleryWrapper").is(':visible')) {
  $("#galleryWrapper").hide('slow');  
  $("#imgToggle").attr('src','images/gallery_show.gif');
  $("#imgToggle").attr('title', 'Click here to open the slide show');
  }
else{
  if (location.hash == '' && window.location.href.search('default')>0) {location.hash='home'};
  if (createThumbnailList()){    
    $("#galleryWrapper").show('slow');  
    $("#imgToggle").attr('src', 'images/gallery_hide.gif');
    $("#imgToggle").attr('title', 'Click here to close the slide show');
    }
  }
}
function createThumbnailList()
{
var list = getGalleryList(location.hash.replace(/^#/,''));
if (list == null){
 OpenErrorWindow('No images', 'There are no images for this category');
 return false;
 }
$('#thumbNails').html("");
var galleryW;
for (i=0; i < list.length; i++)
  {
      $('<li><a href="images/' + list[i][0] + '" title="' + list[i][1] + '"><img src="images/' + list[i][2] + '" width="72" height="72" alt="' + list[i][1] + '"/></a></li>').appendTo('ul#thumbNails');
  galleryW += 72;
  } 
$('#thumbNails a').lightBox();
return true;
}
function getGalleryList(PageName)
{
var Items;
if (PageName == 'home' || PageName == 'displayboards') {
    Items = new Array(10)
    for (i = 0; i < 10; i++) 
    {
      Items[i] = new Array(10)
    }
    Items[0][0] = 'LifeStyle/DisplayBoards/DisplayBoards_10.jpg';
    Items[0][1] = 'Single Panel Display Board';
    Items[0][2] = 'LifeStyle/DisplayBoards/DisplayBoards_10_small.jpg';

    Items[1][0] = 'LifeStyle/DisplayBoards/DisplayBoards_9.jpg';
    Items[1][1] = '3 Panels Display Board';
    Items[1][2] = 'LifeStyle/DisplayBoards/DisplayBoards_9_small.jpg';

    Items[2][0] = 'LifeStyle/DisplayBoards/DisplayBoards_7.jpg';
    Items[2][1] = 'Clipset used to connect multiple Display Boards';
    Items[2][2] = 'LifeStyle/DisplayBoards/DisplayBoards_7_small.jpg';  
    
    Items[3][0] = 'LifeStyle/DisplayBoards/DisplayBoards_1.jpg';
    Items[3][1] = '6 Panels Display Boards';
    Items[3][2] = 'LifeStyle/DisplayBoards/DisplayBoards_1_small.jpg';

    Items[4][0] = 'LifeStyle/DisplayBoards/DisplayBoards_2.jpg';
    Items[4][1] = '7 Panels Display Boards (includes table top)';
    Items[4][2] = 'LifeStyle/DisplayBoards/DisplayBoards_2_small.jpg';

    Items[5][0] = 'LifeStyle/DisplayBoards/DisplayBoards_3.jpg';
    Items[5][1] = '6 Panels Display Boards (includes table top)';
    Items[5][2] = 'LifeStyle/DisplayBoards/DisplayBoards_3_small.jpg';

    Items[6][0] = 'LifeStyle/DisplayBoards/DisplayBoards_4.jpg';
    Items[6][1] = '6 Panels Display Boards';
    Items[6][2] = 'LifeStyle/DisplayBoards/DisplayBoards_4_small.jpg';

    Items[7][0] = 'LifeStyle/DisplayBoards/DisplayBoards_5.jpg';
    Items[7][1] = '3 Panels Display Boards';
    Items[7][2] = 'LifeStyle/DisplayBoards/DisplayBoards_5_small.jpg';

    Items[8][0] = 'LifeStyle/DisplayBoards/DisplayBoards_6.jpg';
    Items[8][1] = 'Single Panel Display Board';
    Items[8][2] = 'LifeStyle/DisplayBoards/DisplayBoards_6_small.jpg';    

    Items[9][0] = 'LifeStyle/DisplayBoards/DisplayBoards_8.jpg';
    Items[9][1] = 'Display Board Carry Bag';
    Items[9][2] = 'LifeStyle/DisplayBoards/DisplayBoards_8_small.jpg';  
 }
if (PageName == 'staplers'){
  Items=new Array(17)
  for (i=0; i <17; i++)
  {
    Items[i]= new Array(17)
  }
  Items[0][0] = 'Products/OfficeEquipments/StaplerDesktopLarge.jpg';
  Items[0][1] = 'Desktop Stapler Large 20 pages';
  Items[0][2] = 'Products/OfficeEquipments/StaplerDesktopLarge.jpg';

  Items[1][0] = 'Products/OfficeEquipments/StaplerDesktopMedium.jpg';
  Items[1][1] = 'Desktop Stapler Medium 20 pages';
  Items[1][2] = 'Products/OfficeEquipments/StaplerDesktopMedium.jpg';

  Items[2][0] = 'Products/OfficeEquipments/StaplerFrontLoad.jpg';
  Items[2][1] = 'Front Load Stapler 50 pages';
  Items[2][2] = 'Products/OfficeEquipments/StaplerFrontLoad.jpg';

  Items[3][0] = 'Products/OfficeEquipments/StaplerHeavyDuty100Pg.jpg';
  Items[3][1] = 'Heavy Duty Stapler 100 pages';
  Items[3][2] = 'Products/OfficeEquipments/StaplerHeavyDuty100Pg.jpg';

  Items[4][0] = 'Products/OfficeEquipments/StaplerHeavyDuty200Pg.jpg';
  Items[4][1] = 'Heavy Duty Stapler 200 pages';
  Items[4][2] = 'Products/OfficeEquipments/StaplerHeavyDuty200Pg.jpg';

  Items[5][0] = 'Products/OfficeEquipments/StaplerLongReach.jpg';
  Items[5][1] = 'Long Reach Stapler 20 pages';
  Items[5][2] = 'Products/OfficeEquipments/StaplerLongReach.jpg';

  Items[6][0] = 'Products/OfficeEquipments/StaplerMetallic.jpg';
  Items[6][1] = 'Desktop Stapler Large 20 pages';
  Items[6][2] = 'Products/OfficeEquipments/StaplerMetallic.jpg';

  Items[7][0] = 'Products/OfficeEquipments/StaplerMini.jpg';
  Items[7][1] = 'Stapler Mini 20 pages';
  Items[7][2] = 'Products/OfficeEquipments/StaplerMini.jpg';

  Items[8][0] = 'Products/OfficeEquipments/StaplerPlier20Pg.jpg';
  Items[8][1] = 'Plier Stapler 20 pages';
  Items[8][2] = 'Products/OfficeEquipments/StaplerPlier20Pg.jpg';

  Items[9][0] = 'Products/OfficeEquipments/StaplerPlier50Pg.jpg';
  Items[9][1] = 'Plier Stapler 50 pages';
  Items[9][2] = 'Products/OfficeEquipments/StaplerPlier50Pg.jpg';

  Items[10][0] = 'Products/OfficeEquipments/StaplerVertical.jpg';
  Items[10][1] = 'Desktop Stapler Vertical 20 pages';
  Items[10][2] = 'Products/OfficeEquipments/StaplerVertical.jpg';

  Items[11][0] = 'Products/OfficeEquipments/Staples.jpg';
  Items[11][1] = 'Staples';
  Items[11][2] = 'Products/OfficeEquipments/Staples.jpg';

  Items[12][0] = 'Products/OfficeEquipments/StapleRemover.jpg';
  Items[12][1] = 'Staple Remover';
  Items[12][2] = 'Products/OfficeEquipments/StapleRemover.jpg';

  Items[13][0] = 'Products/OfficeEquipments/10SheetPunch.jpg';
  Items[13][1] = '10 Sheet Punch';
  Items[13][2] = 'Products/OfficeEquipments/10SheetPunch.jpg';

  Items[14][0] = 'Products/OfficeEquipments/20SheetPunch.jpg';
  Items[14][1] = '20 Sheet Punch';
  Items[14][2] = 'Products/OfficeEquipments/20SheetPunch.jpg';

  Items[15][0] = 'Products/OfficeEquipments/30SheetPunch.jpg';
  Items[15][1] = '30 Sheet Punch';
  Items[15][2] = 'Products/OfficeEquipments/30SheetPunch.jpg';

  Items[16][0] = 'Products/OfficeEquipments/40SheetPunch.jpg';
  Items[16][1] = '40 Sheet Punch';
  Items[16][2] = 'Products/OfficeEquipments/40SheetPunch.jpg';
  }
if (PageName == 'shredders'){
  Items=new Array(8)
  for (i=0; i <8; i++)
  {
    Items[i]= new Array(8)
  }
  Items[0][0] = 'LifeStyle/Shredders/001.jpg';
  Items[0][1] = 'Shredder S515';
  Items[0][2] = 'LifeStyle/Shredders/001.jpg';
  
  Items[1][0] = 'LifeStyle/Shredders/002.jpg';
  Items[1][1] = 'Shredder S512';
  Items[1][2] = 'LifeStyle/Shredders/002.jpg';
  
  Items[2][0] = 'LifeStyle/Shredders/003.jpg';
  Items[2][1] = 'Shredder S512';
  Items[2][2] = 'LifeStyle/Shredders/003.jpg';
  
  Items[3][0] = 'LifeStyle/shredders/004.jpg';
  Items[3][1] = 'Shredder S512';
  Items[3][2] = 'LifeStyle/Shredders/004.jpg';
  
  Items[4][0] = 'LifeStyle/shredders/005.jpg';
  Items[4][1] = 'Shredder S210';
  Items[4][2] = 'LifeStyle/Shredders/005.jpg';
  
  Items[5][0] = 'LifeStyle/shredders/006.jpg';
  Items[5][1] = 'Shredder S210';
  Items[5][2] = 'LifeStyle/Shredders/006.jpg';
  
  Items[6][0] = 'LifeStyle/shredders/007.jpg';
  Items[6][1] = 'Shredder S210';
  Items[6][2] = 'LifeStyle/Shredders/007.jpg';
  
  Items[7][0] = 'LifeStyle/shredders/008.jpg';
  Items[7][1] = 'Shredder S231';
  Items[7][2] = 'LifeStyle/Shredders/008.jpg';
  
  Items[7][0] = 'LifeStyle/shredders/009.jpg';
  Items[7][1] = 'Shredder S231';
  Items[7][2] = 'LifeStyle/Shredders/009.jpg';
}
if (PageName == 'postertemplates') {
    Items = new Array(13)
    for (i = 0; i < 13; i++) {
        Items[i] = new Array(13)
    }
    Items[0][0] = 'Marketing/PosterTemplates/poster1_IWB_A4.jpg';
    Items[0][1] = 'Interactive WhiteBoard';
    Items[0][2] = 'Marketing/PosterTemplates/poster1_IWB_A4.jpg';

    Items[1][0] = 'Marketing/PosterTemplates/poster2_Shredders_A4.jpg';
    Items[1][1] = 'Shredders';
    Items[1][2] = 'Marketing/PosterTemplates/poster2_Shredders_A4.jpg';

    Items[2][0] = 'Marketing/PosterTemplates/poster3_bind_lam.jpg';
    Items[2][1] = 'Binders and Laminiators';
    Items[2][2] = 'Marketing/PosterTemplates/poster3_bind_lam.jpg';

    Items[3][0] = 'Marketing/PosterTemplates/poster4_Staplers_Punches_A4.jpg';
    Items[3][1] = 'Staplers and Punches';
    Items[3][2] = 'Marketing/PosterTemplates/poster4_Staplers_Punches_A4.jpg';

    Items[4][0] = 'Marketing/PosterTemplates/poster5_Laminators_A4.jpg';
    Items[4][1] = 'Laminators';
    Items[4][2] = 'Marketing/PosterTemplates/poster5_Laminators_A4.jpg';

    Items[5][0] = 'Marketing/PosterTemplates/poster6_DisplayBoards_A4.jpg';
    Items[5][1] = 'Display Boards';
    Items[5][2] = 'Marketing/PosterTemplates/poster6_DisplayBoards_A4.jpg';

    Items[6][0] = 'Marketing/PosterTemplates/poster7_Binders_A4.jpg';
    Items[6][1] = 'Binders';
    Items[6][2] = 'Marketing/PosterTemplates/poster7_Binders_A4.jpg';

    Items[7][0] = 'Marketing/PosterTemplates/poster8_Boards_A4.jpg';
    Items[7][1] = 'Boards';
    Items[7][2] = 'Marketing/PosterTemplates/poster8_Boards_A4.jpg';

    Items[8][0] = 'Marketing/PosterTemplates/poster9_Poster_Frames_A4.jpg';
    Items[8][1] = 'Poster Frames';
    Items[8][2] = 'Marketing/PosterTemplates/poster9_Poster_Frames_A4.jpg';

    Items[9][0] = 'Marketing/PosterTemplates/poster10_PresentationProducts_A4.jpg';
    Items[9][1] = 'Presentation Products';
    Items[9][2] = 'Marketing/PosterTemplates/poster10_PresentationProducts_A4.jpg';

    Items[10][0] = 'Marketing/PosterTemplates/poster11_RetailPacks_A4.jpg';
    Items[10][1] = 'Retail Packs';
    Items[10][2] = 'Marketing/PosterTemplates/poster11_RetailPacks_A4.jpg';

    Items[11][0] = 'Marketing/PosterTemplates/poster12_Markers_A4.jpg';
    Items[11][1] = 'Markers';
    Items[11][2] = 'Marketing/PosterTemplates/poster12_Markers_A4.jpg';

    Items[12][0] = 'Marketing/PosterTemplates/poster13_GraphicsBoards_A4.jpg';
    Items[12][1] = 'graphics Boards';
    Items[12][2] = 'Marketing/PosterTemplates/poster13_GraphicsBoards_A4.jpg';
}
return Items;
}
function ShowLiveMap() {
    window.open("test.html", "test", "width=" + getScreenWidth() - (getScreenWidth() * 0.4) + ",height=480px,left=" + (getScreenWidth() * 0.4) + "px,top=200px");
}
function NumericInput(e, id) {
    if (!e) e = window.event;
    if (e.keyCode > 31 && (e.keyCode < 48 || e.keyCode > 57)) {
        return false;
    } else {
        if (e.keyCode == 13) {
            var bt = document.getElementById(id);
            if (bt != null) {
                bt.click();
                return false;
            }
        }
    }
}
function EnableAddtoCartButton() {
    $("[id$='_txtStockCode']").keypress(check_submit).each(
   function() {
     check_submit(); 
   });
}
function check_submit() 
 { 
 if ($(this).val().length < 1) {
     $("[id$='_btnAddItem']").attr("disabled", true); 
  } 
  else {
      $("[id$='_btnAddItem']").removeAttr("disabled"); 
 }
}
function setXPosition() {
    alert('hi');
    var sideCol = document.getElementById('tblNews');
    var mainCol = document.getElementById('imgStaples');
    if (mainCol != null) {
        sideCol.style.top = mainCol.style.top;
    }
}
function ShowDocTypeControl(EntityCode,EntityType) {
    if (EntityCode == undefined) {
        OpenErrorWindow('No document type', 'There are no files for this documents.');
        $("#divDocuments").hide('slow');
        return;
    }

    var frm = new getObj('frmDocuments');
    frm.obj.src = 'DocTypeControl.aspx?DocNo=' + EntityCode + '&DocType=' + EntityType;
    frm.obj.style.width = '100%';
    frm.obj.style.height = '90%';

    var shopCtrl = new getObj('divDocuments');
    if (shopCtrl == null) {
        return;
    }
    var screenWidth = screen.width;
    
    $('#divDocuments').css({ top: '100px',
    left: screen.width * 0.25 + 'px', width: (screenWidth - (screenWidth * 0.5)) + 'px', height: screenWidth * 0.3 + 'px',
        position: 'fixed', background: '#e7e8e9', border: 'solid 1px #000', padding: '10px'
    });
    $('#divDocuments').addClass('fixedElement');
    if (! $("#divDocuments").is(':visible')) {
        $("#divDocuments").show('slow');
    }
}
function CloseDocControl() {
    if ($("#divDocuments").is(':visible')) {
        $("#divDocuments").hide('slow');
    }
}
function HideOrShowPriceList() {
    if (!CheckCustomerLogon()) {
        $("#tdPriceList").html("<span class=heading2>NB. The pricelist will only be available when you have logged on.</span><br><a onclick=$('#divTopMenuLogon').click(); class=lnkBtn>Click here to logon</a>");
    }
}
function ShowBeforePrintMessage() {
    OpenErrorWindow('Use printer icon below logo to print', 'Please use the printer icon below the logo to print this page correctly.<br><br><p align=center><img src=../images/Final-Parrot-Design_06.jpg /></p>');
}
var popupStatus = 0; 
function ActivatePopup() {
    //LOADING POPUP
    //Click the button event!
    $("#divTopMenuLogon").click(function() {
        //centering with css
        centerPopup();
        //load popup
        loadPopup();
    });
    //CLOSING POPUP

    //Click the x event!
    $("#popupClose").click(function() {
        disablePopup();
    });

    //Click out event!
    $("#backgroundPopup").click(function() {
        disablePopup();
    });

    //Press Escape event!
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup();
        }
    });
}

//loading popup with jQuery magic!
function loadPopup() {
    centerPopup();
    //loads popup only if it is disabled
    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $("#popupBox").fadeIn("slow");
        popupStatus = 1;

        SetFocusOnEmailTextBox();
    }
}

//disabling popup with jQuery magic!
function disablePopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        $("#popupBox").fadeOut("slow");
        popupStatus = 0;
    }
}
//centering popup
function centerPopup() {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupBox").height();
    var popupWidth = $("#popupBox").width();
    //centering
    $("#popupBox").css({
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2        
    });
    //only need force for IE6

    $("#backgroundPopup").css({
        "height": windowHeight
    });
}
function AdjustPageLayout() {
    $('#divMainPanel').css({ width: screen.width - 180 + 'px' });
    $('#divMarquee').css({ width: screen.width - 170 + 'px' });
    $('#divPageContent').css({ height: screen.clientHeight - 154 + 'px' });
    $('#txtSearch').mask('Search');
}
function LoadAspxPage(PageName) {
    $.ajax({
        url: PageName + ".aspx",
        success: function(data) {
            $("#divPageContent").html(data);
        }
    });
}
function LoadHtmlPage(PageName) {
    $.ajax({
        url: PageName + '.html',
        success: function(data) {
            $("#divPageContent").html(data);
        }
    });
}
function ShowOrHideTopMenuDropDown(MenuID) {
    if (MenuID.search('MyAccount') > 0) {
        $('#ddlmenuDocuments').hide();
        $('#ddlmenuDelearResources').hide();
    }
    else if (MenuID.search('Admin') > 0) {
        $('#ddlmenuDocuments').hide();
        $('#ddlmenuDelearResources').hide();
    }
    else if (MenuID.search('dealer') > 0) {
        $('#ddlmenuDelearResources').hide();
        $('#ddlmenuDocuments').hide();
    }
    else {
        $('#ddlmenuMyAccount').hide();
        $('#ddlmenuDelearResources').hide();
    }
    var menu = document.getElementById(MenuID);
    if (menu == null){
        return;
    }
    if (menu.style.display != 'block') {
        menu.style.top = '150px';
        menu.style.left = (MouseX - 100) + 'px';
        menu.style.position = 'absolute';
        menu.style.display = 'block';
    }
    else {
        menu.style.display = 'none';
    }
}
function SendEmail() {
    //$("lnkEmail").attr("href", 'mailto:?body=Thought you might find this web page from Parrot Products interesting: ' + window.location + '?ProductPage=' + window.location.hash + '&Subject=Parrot Products Website');
    $("lnkEmail").attr("href", 'logon.aspx');
    $("lnkEmail").click();
}
function UpdateFrameURL(pageName) {
    if (document.getElementById("historyFrame") == null) {
        return;
    }
    var doc = document.getElementById("historyFrame").contentWindow.document;
    doc.open("javascript:'<html></html>'");
    doc.write("<html><head><script type=\"text/javascript\">parent.onFrameLoaded('" + pageName + "');</script></head><body></body></html>");
    doc.close();
}
function onFrameLoaded(newHash) {
    var oldHash = window.location.hash.substring(1);
    if (newHash > '') {
        location.hash = newHash;
    }
    else if (newHash != location.hash.replace(/^#/, '')) {
        newHash = location.hash;
    }
    if (newHash != '' && newHash.replace('#', '') != oldHash && oldHash != '') {
        if (location.hash != newHash.replace('#', '')) {
            OpenPageViaMenu(newHash.replace('#', ''));
        }
    }
}
function ChangeLogonToLogOffunction() {
    // Add the page method call as an onclick handler for the div.
    $("#divTopMenuLogon").css({ backgroundPosition: '-815px -157px' });
    $("#divTopMenuLogon").unbind('click');
    $("#divTopMenuLogon").click(function() {
        OpenPageViaMenu('logoff');
    });
    $("#divTopMenuLogon").html('Log Off');
}
function expandcollapse(obj, row) {
    var div = document.getElementById(obj);
    var img = document.getElementById('img' + obj);

    if (div.style.display == "none") {
        div.style.display = "block";
        if (row == 'alt') {
            img.src = "../images/minus.gif";
        }
        else {
            img.src = "../images/minus.gif";
        }
        img.alt = "Close alternative products";
    }
    else {
        div.style.display = "none";
        if (row == 'alt') {
            img.src = "../images/plus.gif";
        }
        else {
            img.src = "../images/plus.gif";
        }
        img.alt = "Expand to show alternative products";
    }
}
function SetProductsGridStyles(HeaderStyle, RowStyle, AltRowStyle) {
    var tbl = $('#tblProducts');
    $('thead tr', tbl).addClass(HeaderStyle);

    $("#tblProducts tbody tr").hover(
    function() { $(this).removeClass(RowStyle); $(this).addClass(AltRowStyle); },
    function() { $(this).removeClass(AltRowStyle); $(this).addClass(RowStyle);    
    });
}
function SetItemCss(id, style) {
    var element = new getObj(id);
    element.obj.className = style;
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Get Customer's map coordinates
function SearchDealerByCustomerCode(CustomerCode) {
    if (CustomerCode == '' || CustomerCode == null) {
      return;
    }
    var UserId = -1;
    ParrotWebClient.JScriptsServices.GetCustomersMapCoordinates(CustomerCode, UserId, ShowNearestDealerOnMap, FailedCallback);
}
function ShowNearestDealerOnMap(result, eventArgs) {
    if (result.length < 1) {
        showErrorMsg('Error', result[0]);
    }
    if (map == null) {
        initializeAddressFinder();
    }
    if (result[0][6] == '') {
        showErrorMsg('Error', "This customers coordinates are not set");
        return;
    }
    var lat = 0;
    var lng = 0;
    var point = 0;
    var html = ''
    for (var i = 0; i < result.length; i++) {
        lat = parseFloat(result[i][6]);
        lng = parseFloat(result[i][7]);
        point = new GLatLng(lat, lng);
        marker_names[i] = result[i][0];
        html = CreateMarkerHtml(result[i]);
        createMarker(point, 'Marker' + i, html); //create marker        
        }
    lat = parseFloat(result[0][6]);
    lng = parseFloat(result[0][7]);
    point = new GLatLng(lat, lng);
    html = CreateMarkerHtml(result[0]);
    OpenMarker(0);
    //LoadMap(lat, lng, html);   // Load map    
}
function CreateMarkerHtml(arrayObj){
var html = '<h2>' + arrayObj[0] + '</h2><br><table><tr><td style="width:50%; text-align:center" valign=top>' + arrayObj[1] + '</td><td style="background:#e7e8e9;width:1px"></td><td>' + arrayObj[2] + '</td></tr></table>';
html += '<b>Tel:</b> ' + arrayObj[3] + '&nbsp;<b>Fax:</b> ' + arrayObj[4] + '&nbsp;<b>Email:</b> ' + arrayObj[5];
return html;
}
function initializeAddressFinder() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(37.4419, -122.1419), 15);
        map.enableScrollWheelZoom();
        geocoder = new GClientGeocoder();
        SetCoordinatesText("28.11591", "-26.20287");
        $('#ddlFrom').hide();
        $('#ddlTo').hide();
    }
}
function SearchAddress() {
    if (map == null) {
        initializeAddressFinder();
    }
    var Address = new getObj('txtAddress');
    var strAddress = Address.obj.value;
    var i;
    if (geocoder) {
        geocoder.getLatLng(
          strAddress,
          function(point) {
              if (!point) {
                  alert("We're sorry but '" + strAddress + "' cannot be found on Google Maps. Please try again.");
              } else {
                  map.panTo(point);
                  var center = new GLatLng(point.lat(), point.lng());
                  mapMarker = new GMarker(center, { draggable: true });
                  i = gmarkers.length;
                  createMarker(center, 'Marker' + i, strAddress);

                  map.addOverlay(mapMarker);

                  SetCoordinatesText(point.lat().toFixed(5), point.lng().toFixed(5));

                  mapMarker.openInfoWindowHtml(strAddress);

                  GEvent.addListener(mapMarker, "dragend", function() {
                      var point = mapMarker.getPoint();
                      map.panTo(point);
                      SetCoordinatesText(point.lat().toFixed(5), point.lng().toFixed(5));
                  });
                  i = gmarkers.length;
                  marker_names[i] = strAddress;
              }
          });
    }
}
function SearchByCoordinates(Latitude, Longitude, Caption) {
    var intLat = parseFloat(Latitude);
    var intLong = parseFloat(Longitude);
    if (map == null) {
        initializeAddressFinder();
    }
    LoadMap(intLat, intLong, Caption);
}
function LoadMap(Latitude, Longitude, Caption) {
    map.setCenter(new GLatLng(Latitude, Longitude), 15);
    var center = new GLatLng(Latitude, Longitude);
    if (gmarkers.length > 0 && gmarkers[0].getLatLng(0).y != Latitude) {
        mapMarker = new GMarker(center, { draggable: true });
        var i = gmarkers.length;
        marker_names = 'Marker' + i;
        createMarker(center, 'Marker' + i, Caption);
    }
    if (mapMarker == null) {
        mapMarker = new GMarker(center, { draggable: true });
        var i = gmarkers.length;
        marker_names = 'Marker' + i;
        createMarker(center, 'Marker' + i, Caption); 
    }
    //map.addOverlay(mapMarker);
    var point = mapMarker.getPoint();
    SetCoordinatesText(point.lat().toFixed(5), point.lng().toFixed(5));
    GEvent.addListener(mapMarker, "dragend", function() {
    var point = mapMarker.getPoint();
        map.panTo(point);
        SetCoordinatesText(point.lat().toFixed(5), point.lng().toFixed(5));
    });
    if (Caption != '') {
        mapMarker.openInfoWindowHtml(Caption);
    }
    LoadDirectionsDropDowns();
}
function LoadDirectionsDropDowns() {
    $('#ddlFrom').show('slow');
    $('#ddlTo').show('slow');
}
function SetCoordinatesText(Latitude, Longitude) {
    $('#tdLatitude').text(Latitude);
    $('#tdLongitude').text(Longitude);    
}
function clicked(overlay, latlng) {
    map.openInfoWindow();  
}
// ===== request the directions =====
function getDirections() {
    // ==== set the start and end locations ====
    var saddr = document.getElementById("saddr").value;
    var daddr = document.getElementById("daddr").value;
    LoadDirections(daddr,saddr);
}
function getDirectionForMarkers() {
    //var area = (OptionAreas.options[OptionAreas.selectedIndex].value);
    var intFrom = $('#ddlFrom').val();
    var point = gmarkers[intFrom].getPoint();
    intFrom = "Marker" + intFrom + '@' + point.y + ',' + point.x;
    var intTo = $('#ddlTo').val();
    point = gmarkers[intTo].getPoint();
    intTo = "Marker" + intTo + '@' + point.y + ',' + point.x;
    LoadDirections(intFrom, intTo);
}
function LoadDirections(FromAddress, ToAddress){
    // ==== Set up the walk and avoid highways options ====
    $('#divDirections').html('');
    var opts = {};
    if (document.getElementById("walk") != null) {
        if (document.getElementById("walk").checked) {
            opts.travelMode = G_TRAVEL_MODE_WALKING;
        }
        if (document.getElementById("highways").checked) {
            opts.avoidHighways = true;
        }
    }
    // === create a GDirections Object ===
    var gdir = new GDirections(map, document.getElementById("divDirections"));

    // === Array for decoding the failure codes ===
    var reasons = [];
    reasons[G_GEO_SUCCESS] = "Success";
    reasons[G_GEO_MISSING_ADDRESS] = "Missing Address: The address was either missing or had no value.";
    reasons[G_GEO_UNKNOWN_ADDRESS] = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
    reasons[G_GEO_UNAVAILABLE_ADDRESS] = "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
    reasons[G_GEO_BAD_KEY] = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
    reasons[G_GEO_TOO_MANY_QUERIES] = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
    reasons[G_GEO_SERVER_ERROR] = "Server error: The geocoding request could not be successfully processed.";
    reasons[G_GEO_BAD_REQUEST] = "A directions request could not be successfully parsed.";
    reasons[G_GEO_MISSING_QUERY] = "No query was specified in the input.";
    reasons[G_GEO_UNKNOWN_DIRECTIONS] = "The GDirections object could not compute directions between the points.";

    // === catch Directions errors ===
    GEvent.addListener(gdir, "error", function() {
        var code = gdir.getStatus().code;
        var reason = "Code " + code;
        if (reasons[code]) {
            reason = reasons[code]
        }

        alert("Failed to obtain directions, " + reason);
    });
    gdir.load('from: ' + FromAddress + ' to: '+ ToAddress , opts);    
}
function createMarker(point, name, html) {
    var i = gmarkers.length;
    mapMarker = new GMarker(point);

    // The info window version with the "to here" form open
    map_to_htmls[i] = html + '<br>Directions: <b>To here<\/b> - <a href="javascript:fromhere(' + i + ')">From here<\/a>' +
           '<br>Start address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT"><br>' +
           'Walk <input type="checkbox" name="walk" id="walk" /> &nbsp; Avoid Highways <input type="checkbox" name="highways" id="highways" />' +
           '<input type="hidden" id="daddr" value="' + name + "@" + point.lat() + ',' + point.lng() +
           '"/>';
    // The info window version with the "from here" form open
    map_from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here<\/a> - <b>From here<\/b>' +
           '<br>End address:<form action="javascript:getDirections()">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT"><br>' +
           'Walk <input type="checkbox" name="walk" id="walk" /> &nbsp; Avoid Highways <input type="checkbox" name="highways" id="highways" />' +
           '<input type="hidden" id="saddr" value="' + name + "@" + point.lat() + ',' + point.lng() +
           '"/>';
    // The inactive version of the direction info
    html = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here<\/a> - <a href="javascript:fromhere(' + i + ')">From here<\/a>';

    GEvent.addListener(mapMarker, "click", function() {
        OpenMarker(i);
    });
    // save the info we need to use later for the side_bar
    gmarkers.push(mapMarker);
    map_htmls[i] = html;
    // add a line to the side_bar html
    var str = ''
    if (i == 0) {
        str = '<a href="javascript:OpenMarker(' + i + ')"><strong>' + marker_names[i] + '</strong> - Customer<\/a><br><hr style=""color:#e7e8e9;height=1px"">';
        $('#ddlFrom').append('<option value=' + i + ' selected="selected">' + marker_names[i] + '</option>');
    }
    else {
        str = $('#divDealers').html() + '<a href="javascript:OpenMarker(' + i + ')">' + marker_names[i] + '<\/a><br>';
        $('#ddlTo').append('<option value='+ i + '>' + marker_names[i] + '</option>');
        $('#ddlTo').append(new Option(marker_names[i], i, true, true));        
    }    
    $('#divDealers').html(str);
    map.addOverlay(mapMarker);    
}
// functions that open the directions forms
function tohere(i) {
    gmarkers[i].openInfoWindowHtml(map_to_htmls[i]);
}
function fromhere(i) {
    gmarkers[i].openInfoWindowHtml(map_from_htmls[i]);
}
function OpenMarker(i) {
    gmarkers[i].openInfoWindowHtml(map_htmls[i]);
    var point = gmarkers[i].getPoint();
    map.panTo(point);
    LoadDirectionsDropDowns();
    SetCoordinatesText(point.x, point.y);
}
function GetHtmlContent() {
    $.get("../ProductPages/Whiteboards.html", '',
   function(data) {
    LoadHtmlContent(data);
   });}
function LoadHtmlContent(html) {
    $('#divContent').html(html);
}
function ClearHtmlContent() {
    $('#divContent').html('');
}
function saveImageAs(imgOrURL) {
    if (typeof imgOrURL == 'object') imgOrURL = imgOrURL.src;
    window.open('DownloadImage.aspx?img=' + imgOrURL, '');
}
//--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ File Name
function LargerImageExists(FileName) {
    if (FileName == '' || FileName == null) {
        return false;
    }

    ParrotWebClient.JScriptsServices.ImageFileExists(FileName, ImageFileExistsResult, FailedCallback);
}
function ImageFileExistsResult(result, eventArgs) {
    if (result != null && result.length > 0) {
        //$("#lnkDownload").hide();
        //'$("#lnkDownload").attr("href", "javascript:saveImageAs('" + result + "');");
        if ($("#lightbox-image")[0].href != null && linkHref > '') {
            var linkHref = $("#lightbox-image")[0].href.replace(".jpg", "_large.jpg");
            $("#lnkDownload").attr("href", "javascript:saveImageAs('" + linkHref + "');");            
        }
        else {
            $("#lnkDownload").attr("href", "javascript:saveImageAs('" + result + "');");            
        }
        
       $('#lightbox-image-download').show();
    }
}

function FindImagesInFolder(FolderOptions) {

    var FolderName = (FolderOptions.options[FolderOptions.selectedIndex].value);
    GetImagesInFolder(FolderName);
}
function GetImagesInFolder(FolderName) {
    if (FolderName == null || FolderName == '') {
        showErrorMsg("No files found", "No files were found for this category");
        return;
    }
    ParrotWebClient.JScriptsServices.FindImagesByFolder(FolderName, FolderSearchResult, FailedCallback);
}
function FolderSearchResult(result, eventArgs) {
    HideControl('imgLoading');
    if (result.length > 0) {
        SetControlInnerHTML('divDealerResources', result);
    }
    else {
        SetControlInnerHTML('divDealerResources', '<span class=Message>No images found</span>');
    }
}

function LoadPageName(Cntrl, PageName) {
    getObj(Cntrl).text = ProductCategName + ' >> ' + PageName;
}

function GetPromotion() {
    ParrotWebClient.JScriptsServices.ListWebPromotions(ShowWebPromotions, FailedWebPromotionsCallback);
}
function ShowWebPromotions(result, eventArgs) {
    if (result.length > 0) {
        var promoHeader = '<h3><strong><u>WEBSITE PROMOTION</u></strong> <br />Attention Dealers:  To Qualify for this special, log on to your profile and add the product to your cart. <br /></h3>';
        SetControlInnerHTML('divPromotions', promoHeader + result);
        $('#tblProductFocus').show('fast');
        $('#tdNews').hide('fast');
    }
    else {
        HideControl('divPromotions');
        $('#tblProductFocus').css('display', 'inline');
        $('#tdNews').css('display', 'inline');
    }
}
function FailedWebPromotionsCallback(error) {
    HideControl('divPromotions');    
}

/* Sets the instance of the local object (txtEmailObject)
KB - added - 11/11/2011 */
function SetEmailControl(txtEmailID, logonBtnId) {
    txtEmailObject = $('#' + txtEmailID);
    AttachKeyPressEvent(txtEmailID, logonBtnId);
}

function AttachKeyPressEvent(txtBoxObjId, LogonBtnId) {
    $('#' + txtBoxObjId).keypress(function (event) {
        if (event.which == 13) {
            $('#' + LogonBtnId).focus();
        }
    });
}


/* Sets the focus on the email text box when the logon box appears
KB - added - 11/11/2011 */
function SetFocusOnEmailTextBox() {
  if (txtEmailObject != null && txtEmailObject != 'undefined' && txtEmailObject != '')
    {
        txtEmailObject.focus();
    }
}

function SwitchImageSrc(FirstImageURL, SecondImageURL) {
    if ($('#imgProductFocus').attr('src') == FirstImageURL) {
        $('#imgProductFocus').attr('src', SecondImageURL);
    }
    else {
        $('#imgProductFocus').attr('src', FirstImageURL);
    }    
}



