<!--
cbArray = new Array("4691","4977","4988","5239","5668","5228","5217","4702","4713");
ceArray = new Array("5272","7562","5316","4936","5401","4999","5032","5021","5010","5250","6023","5371","4749","5261","7133","7234","7335","6161","6080","4716","5709");
cnArray = new Array("5283","4903","7475","7687","5382","4848","5327","4958","4947","6274","4870","4859","4837","4782","4771","4738","6193","5294","5305","5338","5349","5360","4727","4892","4914","4793");
cpArray = new Array("4760","7777","4881","4804","4815","4826","4925");
crArray = new Array("5133","7094","6006","6401","5144","5155","5657");
sbArray = new Array("4966");
seArray = new Array("5416","5405","5037");
snArray = new Array("5039","5050","5061","5068");
srArray = new Array("5161","5172");
csArray = new Array("5390");

function findPageArray(productCat)
{
pageArray = null;
  switch(productCat)
  {
   case "cb":
    pageArray = cbArray;
    break;
   case "ce":
    pageArray = ceArray;
    break;
   case "cn":
    pageArray =cnArray;
    break;
   case "cp":
    pageArray =cpArray;
    break;
   case "cr":
    pageArray = crArray;
    break;
   case "sb":
    pageArray = sbArray;
    break;
   case "se":
    pageArray = seArray;
    break;
   case "sn":
    pageArray = snArray;
    break;
   case "sr":
    pageArray = srArray;
    break;
   case "cs":
    pageArray = csArray;
    break;
   default:
  }

 return pageArray;
}

function getNextPageLink(pageArray, currentNo)
{
 noNextPageLink = "";

 if(pageArray == null || pageArray.length < 2)
  return noNextPageLink;
 
 for(i=0;i<pageArray.length;i++)
  if(currentNo == pageArray[i])
  {
    if(i < pageArray.length - 1)
    {
     return ("<TD STYLE='background-color:#C0C0FF;width='87' align='right'><A HREF=JavaScript:parent.parent.show(" + pageArray[i+1] + ",0,0)>&nbsp;Next&nbsp</A></TD>");
    }
  }

 return noNextPageLink;
}

function getLinksTable(productCat, currentNo)
{
 //default value productCat=none and currentNo=-1, this means no page table is required
 if(productCat == "none" && currentNo== -1)
 {
  return "";
 }

 pageArray = findPageArray(productCat);
 if(pageArray == null || pageArray.length < 2)
 {
  return "";
  }

 //page block index, block 8 page number plus a more... sign
 pageBlockIndex = 0;
 pageIncrement = 0;
 for(i=0;i<pageArray.length;i++)
 {
  pageIncrement = pageIncrement + 1;

  if(pageIncrement == 8)
  {
    pageIncrement = 0;
    pageBlockIndex = pageBlockIndex + 1;
  }
  
  if(currentNo == pageArray[i])
  {
   break;
  }
 }
 

 linkTableCode = "<BR><TABLE bgcolor='#C0C0FF' width='550' cellspacing='0' cellpadding='0' ALIGN='center' ><TR valign='middle'><TD width='28'><IMG SRC='images/store/page/arrow_left.jpg' WIDTH='24' HEIGHT='22'  BORDER=0></TD><TD width='87'><A HREF=Javascript:parent.parent.backBut()>Back</A></TD>";

 linkTableCodeEnd = "</div></td><TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD>"+ getNextPageLink(pageArray ,currentNo)  +"<TD width='28' align='right'><IMG SRC='images/store/page/arrow_right.jpg' WIDTH='24' HEIGHT='22'  BORDER=0></TD></TR></TABLE><BR><BR><BR>";

 pageLinksCell = "<td style='width:320' align='left'><div><span style='color:#FF0000;font-family: Verdana, Arial, Helvetica, sans-serif;font-size:10pt;font-weight:bold'>&nbsp;&nbsp;Page :&nbsp;</span>";

 if(pageIncrement == 0 && pageBlockIndex > 0)
 {
   pageBlockIndex  = pageBlockIndex - 1;
 }
 pageTableStartPoint = pageBlockIndex * 8;

 for(i=pageTableStartPoint;i<pageArray.length;i++)
 {
  boldMark = "";
  if(currentNo == pageArray[i])
  {
    boldMark = "STYLE='font-size:10pt;color:#FF0000'";
  }

 if(i == (pageTableStartPoint + 7))
 {
   if(i == (pageArray.length - 1))
   {
     pageLinksCell = pageLinksCell + "<A " + boldMark + " HREF=JavaScript:parent.parent.show(" + pageArray[i] + ",0,0)>" + (i+1) + "</A>";
   }
   else
   {
   pageLinksCell = pageLinksCell + "<A " + boldMark + " HREF=JavaScript:parent.parent.show(" + pageArray[i] + ",0,0)>" + (i+1) + "</A><span  STYLE='color: #FFC999;width:1'>&nbsp;|&nbsp;</span><A HREF=JavaScript:parent.parent.show(" + pageArray[i+1] + ",0,0)>more...</A>";
  }
   break;
 }
 else if(i < pageArray.length - 1)
 {
   pageLinksCell = pageLinksCell + "<A " + boldMark + " HREF=JavaScript:parent.parent.show(" + pageArray[i] + ",0,0)>" + (i+1) + "</A><span  STYLE='color: #FFC999;width:1'>&nbsp;|&nbsp;</span>";
 }
 else
 {
  pageLinksCell = pageLinksCell + "<A " + boldMark + " HREF=JavaScript:parent.parent.show(" + pageArray[i] + ",0,0)>" + (i+1) + "</A>";
 }
 }

 return linkTableCode + pageLinksCell + linkTableCodeEnd ;
}

//for help info pages
function writeDocLinks()
{
  tableBegin = "<TABLE width='550' cellspacing='10' cellpadding='0' ALIGN='center' >";

  rowOne = "<TR><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(2557,0,0)>About Us</A></TD><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(877,0,0)>Contact Us</A></TD><TD width='150'>&nbsp;</TD></TR>";

  rowTwo = "<TR><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(879,0,0)>Delivery</A></TD><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(881,0,0)>Payment Method</A></TD><TD width='150'>&nbsp;</TD></TR>";

  rowThree = "<TR><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(2563,0,0)>Return Policy</A></TD><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(2565,0,0)>Ring Size Guide</A></TD><TD width='150'>&nbsp;</TD></TR>";

  rowFour = "<TR><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(2564,0,0)>Security and Privacy</A></TD><TD STYLE='background-color:#C0C0FF' align='left'><A HREF=JavaScript:parent.parent.show(883,0,0)>Terms and Conditions</A></TD><TD width='150'>&nbsp;</TD></TR>";

 tableEnd = "</TABLE><BR>";

 return tableBegin + rowOne + rowTwo + rowThree + rowFour + tableEnd;
}

//search page functions
function searchResultLinks(endNumber, totolResultFound)
{
resultPageStringPrefix="<FONT class='searchSmallFont'>Display results from <font color='red'>";
resultPageStringSuffix="</font> to <font color='red'>" + endNumber + "</font></FONT>";
searchPageStartPoint=0;

while(endNumber> 10)
{
endNumber=endNumber - 10;
searchPageStartPoint = searchPageStartPoint +10;
}

return resultPageStringPrefix + searchPageStartPoint + resultPageStringSuffix;
}

//use white color to hide the link, note, that 'if blocks' not catch difference, this is a not expexted result,
//in this unexpected case, simply use html hard code that font color = white
function whiteFontPreviousLink(endNumber, totolResultFound, linkName)
{
fontColor="<FONT color='#FFFFFF'>";
searchPageStartPoint=0;
endNumberCopy = endNumber;
while(endNumberCopy > 10)
{
endNumberCopy = endNumberCopy - 10;
searchPageStartPoint = searchPageStartPoint +10;
}

if(searchPageStartPoint > 10 && linkName == "previous")
{
fontColor="<FONT>";
}

if(totolResultFound >= endNumber && linkName == "next")
{
fontColor="<FONT>";
}

return fontColor;
}
//end  serach page functions

//-->
