function weGotThorns(id,cat,cname)
{
var catA = "<a class='catlink' href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "'><img src='/images/";
var catD = "lnk.jpg'><br>";
var catE = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var GotStuck = catA + newstr + catB + id + catC + id + catD + str + catE;
if (cat==4)
{document.write(GotStuck);}
else
{document.write('');}
}


function weGotSpirit2(id,cat,cname)
{
var catA = "<a class='catlink' href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "2'><img src='/images/";
var catD = "lnk.jpg'><br>";
var catE = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var GotSpirit = catA + newstr + catB + id + catC + id + catD + str + catE;
if (cat==1)
{document.write(GotSpirit);}
else
{document.write('');}
}

function readyOK2(id,cat,cname)
{
var catA = "<a class='catlink' href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "2'><img src='/images/";
var catD = "lnk.jpg'><br>";
var catE = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var GotSpirit = catA + newstr + catB + id + catC + id + catD + str + catE;
if (cat==3)
{document.write(GotSpirit);}
else
{document.write('');}
}

function getUpEatJelly2(id,cat,cname)
{
var catA = "<a class='catlink' href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "2'><img src='/images/";
var catD = "lnk.jpg'><br>";
var catE = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var GotSpirit = catA + newstr + catB + id + catC + id + catD + str + catE;
if (cat==2)
{document.write(GotSpirit);}
else
{document.write('');}
}




function weGotSpirit(id,cat,cname)
{

var catA = "<a href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "'>";
var catD = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var GotSpirit = catA + newstr + catB + id + catC + str + catD;
if (cat==1)
{document.write(GotSpirit);}
else
{document.write('');}
}

function readyOK(id,cat,cname)
{

var catA = "<a href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "'>";
var catD = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var ready = catA + newstr + catB + id + catC + str + catD;
if (cat==3)
{document.write(ready);}
else
{document.write('');}
}

function getUpEatJelly(id,cat,cname)
{

var catA = "<a href='http://www.kycshop.com/servlet/the-"
var catB = "/Categories' id='";
var catC = "'>";
var catD = "</a><br>";
var str = cname
var newstr = str.replace(/ /g,'-')
var ready = catA + newstr + catB + id + catC + str + catD;
if (cat==2)
{document.write(ready);}
else
{document.write('');}
}




var currentDate = new Date();
var dayNum = 21;
var dateCalc = 86400000;
var timeEval = dayNum * dateCalc;

var BdateArr = new Array();
var BnumArr = new Array();
var BsubArr = new Array();
var BabbArr = new Array();
		


function ltlt(){
while (DateArr.length){
var temBdate = DateArr.pop();
var temBnum = NumArr.pop();
var temBsub = SubArr.pop();
var temBabb = AbbArr.pop();
if ((currentDate - temBdate) < timeEval) BdateArr.push(temBdate) + BnumArr.push(temBnum) + BsubArr.push(temBsub) + BabbArr.push(temBabb);
}

};

var newDivBeg = "<DIV class='desLibCat'>\
<H2>New Designs</H2>";

var Wcel1 = '<A class="desLibCell" href="#';
var Wcel1a = '">';
var Xcel1 = '<IMG class="desThn" src="http://www.kenyoungco.com/library/thn_lib';
var Xcel2 = '.jpg"/>';
var Ycel1 = '<SPAN class="desTitle">';
var Ycel2 = '</SPAN>';
var Wcel2 = '</A>';

var Mcel1 = '<A class="desLibCell" href="javascript: Lucy(';
var Mcel2 = ')" onClick="window.location.hash = ';
var Mcel2a = ';">\
<IMG class="desThn" src="http://www.kenyoungco.com/library/thn_lib';
var Mcel3 = '.jpg"/><SPAN class="desTitle">';
var Mcel4 = '</SPAN></A>';






var newDivEnd = "<P class='clearme'/>\
</DIV>";

function genCode5()
{
var melCode = "";
var Mhash = "";
for(k=0; k<BnumArr.length; k++)

{
if ((currentDate - BdateArr[k])<timeEval)
{
Mhash = "'" + BabbArr[k] + "'";
melCode += Mcel1 + "'" + BnumArr[k] + "','" + BabbArr[k] + "'," + BabbArr[k] + Mcel2 + Mhash + Mcel2a + BnumArr[k] + Mcel3 + BsubArr[k] + Mcel4;}
else
{melCode = "";}
}
return(melCode);
}



function genCode6()
{
var celCode = "";
for(k=0; k<BnumArr.length; k++)
{
if ((currentDate - BdateArr[k])<timeEval)
{celCode += Wcel1 + BabbArr[k] + Wcel1a + Xcel1 + BnumArr[k] + Xcel2 + Ycel1 + BsubArr[k] + Ycel2 + Wcel2;}
else
{celCode = "";}
}

return(celCode);
}



function genCode7()
{
var divCode = "";

if (BdateArr.length > 0)
{divCode = newDivBeg + genCode5() + newDivEnd;}
else{divCode = "";}
document.write(divCode);
}








function spellMe(valu){
var col = ""
if (valu == 1){col = " Color"}
else if (valu > 1){col = " Colors"}
document.write(col);
}

function closer(){window.close();}


//DesLib detail pop-up
		
function Desi(iNum, iArr, iTitle){

var pIndex = iArr.indexOf('"' + iNum + '"');
var pTitle = iTitle[pIndex];
var l = pTitle.length;
xTitle = pTitle.slice(1,l-1);

bigpic = window.document.open("","Gallery","width=600, height=650, status=yes, resizable=no");
var win = '<html>\n\
<head>\n\
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">\n\
<link href="http://www.kenyoungco.com/KYC3Main.css" rel="stylesheet" type="text/css" media="all">\n\
<script type="text/javascript" src="http://www.kenyoungco.com/zbJavaScript.js">\n\
</script>\n\
<script type="text/javascript">\n\
var TitleArray = [' + iTitle + '];\n\
var NumArray = [' + iArr + '];\n\
var i = NumArray.length;\n\
var j = NumArray.indexOf("' + iNum + '");\n\
var PicSrcA = "http://www.kenyoungco.com/library/pic_lib";\n\
var PicSrcB = ".jpg";\n\
\n\
function nPic(){\n\
if (j+1<i){j++}\n\
else{j=0}\n\
document.bigPic.src= PicSrcA + NumArray[j] + PicSrcB;\n\
document.title = TitleArray[j];\n\
document.getElementById("Gtitle").innerHTML=TitleArray[j];\n\
}\n\
\n\
function pPic(){\n\
if (j>0){j--}\n\
else{j=i-1}\n\
document.bigPic.src= PicSrcA + NumArray[j] + PicSrcB;\n\
document.title = TitleArray[j];\n\
document.getElementById("Gtitle").innerHTML=TitleArray[j];\n\
}\n\
\n\
</script>\n\
<title>' + xTitle + '</title>\n\
</head>\n\
<body class="gallery">\n\
<img src="http://www.kenyoungco.com/library/pic_lib' + iNum + '.jpg" class="Despic" name="bigPic">\n\
<p id="Gtitle">' + xTitle + '</p>\n\
<div class="PicBtn">\n\
<a class="pmo" href="JavaScript:pPic()">&laquo; Previous</a>\n\
<a class="nmo" href="JavaScript:nPic()">Next &raquo;</a>\n\
<a class="CloseMe" href="JavaScript:closer()">Close Window</a><br><br>\n\
</div>\n\
</body></html>\n';
bigpic.focus();
bigpic.document.write(win);
bigpic.document.close();

}


//Date dependent New Designs detail pop-up

function Lucy(iNum, iSub, iArr, iTitle){

/*var pIndex = iArr.indexOf('"' + iNum + '"');
var pTitle = iTitle[pIndex];
var l = pTitle.length;
xTitle = pTitle.slice(1,l-1);

bigpic = window.document.open("","Gallery","width=600, height=600, status=no, resizable=no");
var win = '<html>\n\
<head>\n\
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">\n\
<title>' + xTitle + '</title>\n\
<link href="http://www.kenyoungco.com/KYC3Main.css" rel="stylesheet" type="text/css" media="all">\n\
<script type="text/javascript" src="http://www.kenyoungco.com/zbJavaScript.js">\n\
</script>\n\
<script type="text/javascript">\n\
function closer(){window.close();}\n\
var NumArray = [' + iArr + '];\n\
var i = NumArray.length;\n\
var j = NumArray.indexOf("' + iNum + '");\n\
var PicSrcA = "http://www.kenyoungco.com/library/pic_lib";\n\
var PicSrcB = ".jpg";\n\
\n\
function nPic(){\n\
if (j<i-1){j++}\n\
document.bigPic.src= PicSrcA + NumArray[j] + PicSrcB;\n\
}\n\
\n
function pPic(){\n\
if (j>0){j--}\n\
document.bigPic.src= PicSrcA + NumArray[j] + PicSrcB;\n\
}\n\
\n\
</script>\n\
</head>\n\
<body class="gallery">\n\
<img src="http://www.kenyoungco.com/library/pic_lib' + iNum + '.jpg" class="Despic" name="bigPic">\n\
<div class="PicBtn">\n\
<a class="pmo" href="JavaScript:pPic()">&laquo; Previous</a>\n\
<a class="nmo" href="JavaScript:nPic()">Next &raquo;</a>\n\
<a class="CloseMe" href="JavaScript:closer()">Close Window</a><br><br>\n\
</div>\n\
</body></html>';
bigpic.document.write(win);
bigpic.document.close();
bigpic.focus();*/
}




//Random DesLib thumbnails on Homepage

var sumnum = 245;
var Xvar = 5
var Yvar = 1/Xvar;
var Xcon = sumnum *Yvar;
var Xnum = Xcon * Math.random();
var Anum = Math.round((Xcon * Math.random())+1);
var Bnum =  Math.round((Xcon * Math.random()) + 20);
var Cnum =  Math.round((Xcon * Math.random()) + 40);
var Dnum =  Math.round((Xcon * Math.random()) + 60);
var Enum =  Math.round((Xcon * Math.random()) + 80);


function pad(n) {
var Apad = "<a href='http://www.kycshop.com/servlet/the-template/DesignGallery/Page'><img src='http://www.kenyoungco.com/library/thn_lib";
var Bpad = ".jpg'></a>";
var Cpad = "";
   
    s = n.toString();
    if (s.length < 3) {
        s = ('000' + n.toString()).slice(-3);
    }
Cpad = Apad + s + Bpad;
   document.write(Cpad) ;
   };
   
   
   function WTpad(n) {
var Apad = "<a href='http://kenyoungco.com/WTdesLib1.php'><img src='http://www.kenyoungco.com/library/thn_lib";
var Bpad = ".jpg'></a>";
var Cpad = "";
   
    s = n.toString();
    if (s.length < 3) {
        s = ('000' + n.toString()).slice(-3);
    }
Cpad = Apad + s + Bpad;
   document.write(Cpad) ;
   };



//Alternate product image. Use with ProStores SKU number

function altPic(iSku){
var val = iSku;
var nam = "<img src='http://www.kycshop.com/catalog/";
var gNam = "med.jpg'>";
var skuPic = nam + val + gNam;
document.write(skuPic);
}





