//--------------------------
// 11/19/06
// this is the xsell13f.js with some changes to the way 
// script comments are displayed in the code output.
// It still needs more work. 
// The Description editor collapsed page code into one long string, 
// and that causes the script to quit working.
// The solution is to make the script tolerate a single sentence.
//--------------------------



//--------------------------
//  copyright © 2005 isdntek.com
//  do not copy without permission
//--------------------------

	var quot="'";
	var quote='"';
	var key=0;
	var ebay=true;
	var siteflag=0;

	var auction = new Array();
	var cap     = new Array();
	var thumb   = new Array();
	var link    = new Array();
	var thRat   = new Array();
	
	var sameRatio=true;
	var maxThRatio=0;
	var sliderWidthRatio=0;
	var startaction=0;
	var galleryCode="";
	var selectedItem="BorderColor";
	var slideFontBolded;
	var slideFontFace;
	var slideFontSize;
	var compressscript=false;
	var storeReferral="";
	var xsell='<span style="font-family:sans-serif;color:gray;font-size:10px;">Free Cross-sell script from <a href=http://www.isdntek.com/tagbot/xsell.htm><font color=gray>ISDN*tek</font></a></span>'

//--------------------------
//  slider code variables
//--------------------------

	var scrollspeed ="30"   // 10fast to 50slow
 	var textcolor   ="#222222"
 	var slideborder ="#555555"
 	var slidebgcolor="#EEE9D9"
	var popupborder ="#BF8088"
	var slideshadow ="#704440"
	var slideaccent ="#B87880"   // "#AF7078"

	var j=0; 
	var thCnt=0
 	var CrossSellimages=new Array()	
	var AuctionNumber=new Array()
	var AuctionDescrp=new Array()
	var AuctionThumb=new Array()
	var AuctionLink=new Array()

	var borderWidth=2
 	var gallerywidth ="450"
	var selectedShape=80
	var thRatio=0.80

	var lgHt=80
	var thHt=lgHt*thRatio // 64
	var vSpc=4 // img padding
	var hSpc=2

	var thBorderWid=0 //-borders on slider pics
	var thBorderColor='none'

 	var sliderheight=""+lgHt+(vSpc*2)
 	var sliderwidth=0	
 	var scrollamount=-1
 	var slider1, slider2
 	var CrossSellStrip='<nobr>'+CrossSellimages.join("")+'</nobr>'

	var frameWidth=0  //-decorative frames
	var outerFrame1=""
	var outerFrame2=""
	var innerFrame1=""
	var innerFrame2=""
	var frameStyleBlock=""

//--------------------------
//  color routines
//--------------------------

function whichItemColors(){ //-show which color option is selected
	if (document.getElementById('selcol1').checked==true){selectedItem='BorderColor'}
	if (document.getElementById('selcol2').checked==true){selectedItem='GalleryColor'}
	if (document.getElementById('selcol3').checked==true){selectedItem='TextColor'}
}

function setColor(palettecolor) { //-this a user-defined function called from the palette module
	// it is used to tell the palette what to paint.
	// palettecolor will come from a style, so can be hex or RGB or none
	whichItemColors()
	document.getElementById(selectedItem).value=colorcode(palettecolor)
	document.getElementById(selectedItem).style.backgroundColor=colorcode(palettecolor)
}

function doDrab(){
	whichItemColors()
	drabColor(document.getElementById(selectedItem).value)
	setColor(document.getElementById('previewColor').style.backgroundColor)
}

function doNoColor(palettecolor){
	whichItemColors()
	document.getElementById(selectedItem).value="";
	document.getElementById(selectedItem).style.backgroundColor=""
}

function removeSpaces(word) { 
	word.replace(/ /g,"")
	return word
	//newword=""
	//for (i=0; i<word.length; i++){if (word.substr(i,1)!=" "){newword=newword+word.substr(i,1)} }
	//return newword
}

function checkHexColor(word) {var notHex=false
	hexstring="0123456789abcdef#"
	word=word.replace(/ /g,"")
	for (i=0; i<word.length; i++){if (hexstring.indexOf(word.substr(i,1).toLowerCase())<0){notHex=true}}
	if (notHex==false){if (word.length>0 && word.substr(0,1)!="#"){word="#"+word}}
	return word
}

//====================

/*

---sample Display options ----
http://cgi.ebay.at/ws/eBayISAPI.dll?ViewItem&item=5620453031
http://www.ebay.com.hk/viItem?ItemId=5817949908
http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=6219129478
http://www.ebay.se/viItem?ItemId=7554949630   ...old format

-----eBay sites------
http://www.ebay.com.au/
http://www.ebay.at/
http://www.ebay.be/ ....split
	http://www.benl.ebay.be/
	http://www.befr.ebay.be/
http://www.ebay.ca/
http://www.ebay.com.cn/
http://www.ebay.fr/
http://www.ebay.de/
http://www.ebay.in/
http://www.ebay.ie/
http://www.ebay.it/
http://www.ebay.nl/
http://www.ebay.pl/ <!-- points to UK site, but ok-->
http://www.es.ebay.com/
http://www.ebay.ch/
http://www.tw.ebay.com/
http://www.ebay.co.uk/
http://www.ebay.com/nz/ *<!-- use U.S. site -->
http://www.ebay.com/

http://www.ebay.com.hk/ ***  old format
http://www.ebay.com.my/ ***
http://www.ebay.ph/ ***
http://www.ebay.se/ ***

http://www.mercadolibre.com.ar/org-img/html/MLA/he.ml<!-- incompatible -->
http://www.mercadolivre.com.br/org-img/html/MLB/he.ml<!-- incompatible -->
http://www.mercadolibre.com.mx/org-img/html/MLM/he.ml<!-- incompatible -->
http://www.auction.co.kr/ ** <!-- incompatible -->
*/

//====================

var fieldnames=new Array("Thumb ","Link ","Auction ","Caption ","Clear ","for ") // for languages
function makeInputFields(fldname) {
	if (fldname) {fieldnames=fldname}
	InFields="<table><tr><td align=right><small>"
	for (var i=1; i<=20; i++){
	InFields=InFields+'<span id=th'+i+'><nobr>'+fieldnames[0]+i+' <input id=thumb'+i+'   type=text size=40 value="http://" onmousedown="clearHttp(this.id)" ></nobr><br></span>'
	InFields=InFields+'<span id=li'+i+'><nobr>'+fieldnames[1]+i+' <input id=link'+i+'    type=text size=40 value="http://" onmousedown="clearHttp(this.id)" ></nobr><br></span>'
	InFields=InFields+'<span id=au'+i+'><nobr>'+fieldnames[2]+i+' <input id=auction'+i+' type=text size=40 value="" ></nobr><br></span>'
	InFields=InFields+'<span id=ca'+i+'><nobr>'+fieldnames[3]+i+' <input id=cap'+i+'     type=text size=40 value="" ></nobr><br></span>'
	InFields=InFields+'<br>'
	if (i==10){InFields=InFields+'<center><input type=button value="'+fieldnames[4]+' &uarr;" onclick="ClearGallery(1,10);"></center></small></td><td>&nbsp;</td><td align=right><small>'}
	}
	InFields=InFields+'<center><input type=button value="'+fieldnames[4]+' &uarr;" onclick="ClearGallery(11,20);"></center></small></td></tr></table>'
    	// InFields=InFields+'<span onclick="LoadTest()" style="color:#f0f0f0;"><small>?</small></span>' //  *****for testing
	document.getElementById('inputFields').innerHTML=InFields
        LoadTestFields()
}


function LoadTestFields(){
	for (var i=1; i<=8; i++){
	document.getElementById('auction'+i).value=""+i+i+i+i+i+i+i+i+i+i
	document.getElementById('cap'+i    ).value=""+fieldnames[3]+fieldnames[5]+fieldnames[2]+i
	document.getElementById('thumb'+i  ).value="http://www.isdntek.com/tagbot/misc/bambi_100.jpg"
	document.getElementById('link'+i   ).value="http://www.isdntek.com/tagbot.htm"
	}
}

function LoadTest(){
	var test=new Array()
	test[1]="5416740590"
 	test[2]="5416228991"
 	test[3]="5416472506"
 	test[4]="5414079968"
 	test[5]="5414607329"
 	test[6]="5400530703"
 	test[7]="5401612331"
 	test[8]="5395935053"
 	//test[9]="5377599750"
	for (var i=1; i<=8; i++){document.getElementById('auction'+i).value=test[i]}
}



function clearHttp(item) {
	if (document.getElementById(item).value=="http://"){document.getElementById(item).value=""}
}

function ClearGallery(a,b) {
	for (var i=a; i<=b; i++){
	if (ebay==false){
		document.getElementById('thumb'+i).value=""
		document.getElementById('link'+i).value=""
		document.getElementById('cap'+i).value=""}
	else
		{document.getElementById('auction'+i).value=""
		document.getElementById('cap'+i).value=""}
	}
}


function importImages() {
	//--clear the arrays first
	for (var i=1; i<=20; i++){auction[i]="";cap[i]=""; AuctionNumber[i]="";AuctionDescrp[i]=""; AuctionThumb[i]=""; AuctionLink[i]=""; CrossSellimages[i]="";}	
	for (var i=1; i<=20; i++){  
	if (ebay==false){
	    if (document.getElementById('thumb'+i).value=="http://" || document.getElementById('thumb'+i).value=="")
	 	{thumb[i]=""; }else{thumb[i]=document.getElementById('thumb'+i).value; }
	    if (document.getElementById('link'+i).value=="http://" || document.getElementById('link'+i).value=="")
		{link[i]=""; }else{link[i]=document.getElementById('link'+i).value; }
	}else { if (document.getElementById('auction'+i).value!=""){auction[i]=document.getElementById('auction'+i).value.replace(/ /g,""); } }   
		if (document.getElementById('cap'+i).value!=""){ cap[i]=replaceQuoteLong(document.getElementById('cap'+i).value); }
	}
}

function importInputs(){
	slideFontFace=document.getElementById('fontFace').value
	slideFontSize=document.getElementById('FontSize').value+"px"
	if (document.getElementById('Bold').checked){slideFontBolded="bold"}else{slideFontBolded="normal"}

	newheight = parseInt(document.getElementById('CustomHeight').value)
	if (newheight>=10) {lgHt=newheight} 

	newratio = parseInt(document.getElementById('CustomRatio').value)
	if (newratio<50 || newratio>100) 
	{if (newratio<50){newratio=50}; if (newratio>100){newratio=100}; document.getElementById('CustomRatio').value=newratio}
	thRatio=newratio/100

	newwidth = parseInt(document.getElementById('CustomGalWid').value)
	if (newwidth>=50) {gallerywidth=""+newwidth} else {gallerywidth="50"}

	thHt =Math.round(lgHt*thRatio)
	sliderheight=""+lgHt+(vSpc*2)

 	slidebgcolor=checkHexColor(document.getElementById('GalleryColor').value)
 	slideborder =checkHexColor(document.getElementById('BorderColor' ).value)
 	textcolor   =checkHexColor(document.getElementById('TextColor'   ).value)
	  //--echo corrections back to form
	  document.getElementById('GalleryColor').value=slidebgcolor
	  document.getElementById('BorderColor' ).value=slideborder
	  document.getElementById('TextColor'   ).value=textcolor 
	borderWidth =parseInt(document.getElementById('BorderSize'   ).value)
	scrollspeed =parseInt(document.getElementById('ScrollerSpeed').value)
	if(document.getElementById('groupborders').checked==true){thBorderWid=1; thBorderColor=slideborder}else{thBorderWid=0;thBorderColor='none'}
	if(document.getElementById('compress1').checked==true){compressscript=true} else{compressscript=false}
	if (document.getElementById('country').value=="ebay.com.hk" ||
		document.getElementById('country').value=="ebay.com.my"||
		document.getElementById('country').value=="ebay.ph"||
		document.getElementById('country').value=="ebay.se")
		{siteflag=1} else {siteflag=0}
	if (document.getElementById('store').checked==true){storeReferral="&refid=store"}else{storeReferral=""}


}


function showebay() {
    for (var i=1; i<=20; i++){
	if (ebay==true){
	document.getElementById('th'+i).style.display="none"
	document.getElementById('li'+i).style.display="none"
	document.getElementById('au'+i).style.display="block"
	document.getElementById('storeref').style.visibility="visible"
	}else{
	document.getElementById('th'+i).style.display="block"
	document.getElementById('li'+i).style.display="block"
	document.getElementById('au'+i).style.display="none"
	document.getElementById('storeref').style.visibility="hidden"
	}
    }
    if (startaction){preloader();} //--call only after page load
}


function replaceQuote(testWord){var pos=-1; var newWord="";
	testWord=testWord.replace(/"/g,"&#34;");
	testWord=testWord.replace(/'/g,"&#39;");
	return testWord;
	//for (i=0; i<testWord.length; i++){
	//switch (testWord.substr(i,1)){
	//	case '"':newWord=newWord+'&#34;';   break
	//	case quot:newWord=newWord+'&#39;';  break
	//	default:newWord=newWord+testWord.substr(i,1)
	//}}
	//return newWord;
}
function replaceQuoteLong(testWord){var pos=-1; var newWord="";
	// need the extra ampersand for the tooltip alts.
	testWord=testWord.replace(/"/g,"&amp#34;");
	testWord=testWord.replace(/'/g,"&amp#39;");
	return testWord;
	//for (i=0; i<testWord.length; i++){
	//switch (testWord.substr(i,1)){
	//	case '"':newWord=newWord+'&amp#34;';   break
	//	case quot:newWord=newWord+'&amp#39;';  break
	//	default:newWord=newWord+testWord.substr(i,1)
	//}}
	//return newWord;
}

function pausecomp(millis) {
	// pause specified milliseconds.
	// since this delay merely churns cpu cycles, 
	// it may not actually help the preloader if the 
	// HTML can't execute until the /script closer.
	// May need human intervention for the preloader.
	date = new Date();
	var curDate = null;
	do { var curDate = new Date(); }
	while(curDate-date < millis);
}


//--------------------------
//  gallery routines
//--------------------------

// in order to use the variable sizes, we are going to need to preload the images
// and read the dimensions. The gallery code is then going to need both width and 
// height for each image. If a fixed height is used, then only the width will need
// to be carried with each thumb field. So add a width array to the user code.
// It may be possible to forego the width array if it is determined that all images
// are the same width. This would simulate the original gallery where every image 
// is the same size.
// The user is probably going to need to verify that all of the images have arrived.
// So add some sort of previewer where the user can say OK to all the images or 
// can hit a reload until the rest of the images arrive. [ok] [reload] [cancel to fix]
// probably a popup window or popopen block with an array of all thumbnails.
// Tell the user to click ok after they all appear. Of course, the user is probably 
// going to have all their own images in their cache anyway.


function MakeGallery() {
	//regenerateSampleFrame()
	makeSample()
	if (compressscript==false) {MakeCodes()} else {CompressCodes()}

}


function regenerateSampleFrame(){ //only needed for adding custom borders.
	document.getElementById('galleryView').innerHTML='<center>'+
	'<table id="slidewrap1" align="center" border="0" cellspacing="0" cellpadding="0" style="border:2px solid black;background-color:white; width:458px;" ><tr><td valign=top align=center>'+
	'<div id="slidewrap2"   style="position:relative;width:450px;height:88px;overflow:hidden;">'+
	'<div id="slidewrap3"   style="position:absolute;left:0px;bottom:0px;width:450px;height:88px;" onMouseover="scrollamount=0" onMouseout="scrollamount=-1">'+
	'<div id="slidegroup1"  style="position:absolute;left:0px;bottom:0px"></div>'+
	'<div id="slidegroup2"  style="position:absolute;left:-1000px;bottom:0px"></div>'+
	'<div id="blowup"       style="position:absolute;left:0px;bottom:0px;visibility:hidden;border:1px black solid;" onmouseout="unwow()"></div>'+
	'</div></div></td></tr><tr>'+
	'<td id="slidelabel" align="center" style="padding:2px;font-family:arial; font-size:14px; color:black" title="caption">'+
	'caption'+
	'</td></tr></table>'+xsell+'</center>'
}

function makeSample(){
	importImages() //at top of form
  	importInputs()
	fetchAuctionArray() //ok to repeat because of possible text changes
	buildSlider()

     //function reconfigureGallery(){
	//document.getElementById('slidewrap1').style.background="url('http://www.isdntek.com/tagbot/backgrounds/texture_palegold.gif')"
	document.getElementById('slidewrap1').style.backgroundColor=slidebgcolor
	document.getElementById('slidewrap1').style.borderColor=slideborder
	document.getElementById('slidewrap1').style.borderWidth=borderWidth+"px"
	document.getElementById('slidewrap1').style.width=(borderWidth+parseInt(gallerywidth))+"px"
	document.getElementById('slidewrap1').style.height=(lgHt+(vSpc*2)+ borderWidth)+"px"

	document.getElementById('slidewrap2').style.width =gallerywidth+"px"
	document.getElementById('slidewrap3').style.width =gallerywidth+"px"
	document.getElementById('slidewrap2').style.height=(lgHt+(vSpc*2)+borderWidth/2)+"px"
	document.getElementById('slidewrap3').style.height=(lgHt+(vSpc*2)+borderWidth/2)+"px"
	document.getElementById('slidegroup1').style.bottom=Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+"px"
	document.getElementById('slidegroup2').style.bottom=Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+"px" 

	document.getElementById('blowup').style.borderColor=slideborder
	document.getElementById('blowup').style.borderWidth=(borderWidth/2)+"px"
	document.getElementById('blowup').style.visibility="hidden"
	document.getElementById('blowup').style.bottom=(thBorderWid*2)+"px"

	document.getElementById('slidelabel').style.fontSize=slideFontSize
	document.getElementById('slidelabel').style.fontFamily=slideFontFace
	document.getElementById('slidelabel').style.fontWeight=slideFontBolded
	document.getElementById('slidelabel').style.color=textcolor
	document.getElementById('slidelabel').innerHTML=document.getElementById('defaultCaption').value
	document.getElementById('slidelabel').title=document.getElementById('defaultCaption').value
	clearInterval(startaction) // turn off slider
	startaction=setInterval("slideleft()",parseInt(scrollspeed))

}


function fetchAuctionArray() {//--page must load first
    if (ebay==true){
      for (var i=1; i<=auction.length; i++){if(auction[i]){
  	AuctionNumber[i]=auction[i]
  	AuctionDescrp[i]=cap[i]
	if (!AuctionDescrp[i]){AuctionDescrp[i]=document.getElementById('defaultCaption').value}
  	}
      }
    }
    else{
      for (var i=1; i<=thumb.length; i++){if(thumb[i]){
  	AuctionThumb[i] =thumb[i]
  	AuctionLink[i]  =link[i]
  	AuctionDescrp[i]=cap[i]
	if (!AuctionDescrp[i]){AuctionDescrp[i]=document.getElementById('defaultCaption').value}
  	}
      }
    }
}

function preloader() {
 	importImages();
	fetchAuctionArray();
	document.getElementById('showsampleimages').innerHTML=""
    	if (ebay==true){
 		for (var i=0; i<AuctionNumber.length; i++){if (AuctionNumber[i]){
		document.getElementById('showsampleimages').innerHTML=document.getElementById('showsampleimages').innerHTML+' <img id="preview'+i+'" src="http://thumbs.ebaystatic.com/pict/'+AuctionNumber[i]+'.jpg" alt='+i+' >'
    	}}}
    	else
    	{	for (var i=0; i<AuctionThumb.length; i++){if (AuctionThumb[i]){
	document.getElementById('showsampleimages').innerHTML=document.getElementById('showsampleimages').innerHTML+' <img id="preview'+i+'" src="'+AuctionThumb[i]+'" alt='+i+' >'
    	}}}
}


	

function readDim(){
	sliderWidthRatio=0; maxThRatio=0; sameRatio=true; var tempRatio=0
	for (var i=0; i<=20; i++){
	if (document.getElementById('preview'+i)){
	    thRat[i]=(Math.round(1000*document.getElementById('preview'+i).offsetWidth/document.getElementById('preview'+i).offsetHeight))/1000
	    sliderWidthRatio=sliderWidthRatio+thRat[i]
	    if (thRat[i]>maxThRatio){maxThRatio=thRat[i]}
	    //-- use this flag to determine if images are all the same size
	    if (tempRatio==0) {tempRatio=thRat[i]} else {if (thRat[i]!=tempRatio){sameRatio=false} }
	}}
}

function buildSlider() { 
	readDim()
	j=0; 
    if (ebay==true){
 	for (var i=0; i<AuctionNumber.length; i++){if (AuctionNumber[i]){j++;
		if (siteflag==0)
		{var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}
		else {var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}
		CrossSellimages[j]=sitelink+AuctionNumber[i]+'" target=_blank>'+
		'<img src="http://thumbs.ebaystatic.com/pict/'+AuctionNumber[i]+'.jpg"   height="'+thHt+'" width="'+Math.round(thHt*thRat[i])+'" hspace="'+hSpc+'" vspace="'+vSpc+'" border="0" '+
 		' style="border:'+thBorderWid+'px '+thBorderColor+' solid"'+
		' onmouseover="thumbwow( this.alt, this.offsetLeft, this.offsetWidth, this.title)" '+
		' title="'+AuctionDescrp[i]+'" alt="'+AuctionNumber[i]+'" ></a>'
		} thCnt=j
	}
    }
    else
    {
  	for (var i=0; i<AuctionThumb.length; i++){if (AuctionThumb[i]){j++;
		CrossSellimages[j]='<a href="'+AuctionLink[i]+'" target=_blank>'+
		'<img src="'+AuctionThumb[i]+'"  height="'+thHt+'" hspace="'+hSpc+'"  width="'+Math.round(thHt*thRat[i])+'" vspace="'+vSpc+'" border="0" '+
		' style="border:'+thBorderWid+'px '+thBorderColor+' solid"'+
		' onmouseover="thumbwow( this.alt, this.offsetLeft, this.offsetWidth,  this.title)" '+
		' title="'+AuctionDescrp[i]+'" alt="'+i+'" ></a>'
		} thCnt=j
	}
    }
    CrossSellStrip='<nobr>'+CrossSellimages.join("")+'</nobr>'

  //loadSliders
	slider1=document.getElementById("slidegroup1")
	slider2=document.getElementById("slidegroup2")
	slider1.innerHTML=CrossSellStrip	
	slider2.innerHTML=CrossSellStrip


  //resizeSlider
	sliderwidth=Math.round(sliderWidthRatio*thHt+(thCnt*(hSpc+thBorderWid)*2))
	if ((sliderwidth-(maxThRatio*thHt)-hSpc*2)<parseInt(gallerywidth)){gallerywidth=""+Math.round(Math.abs(sliderwidth-(maxThRatio*thHt)-hSpc*2))}
	document.getElementById('CustomGalWid').value=gallerywidth
	slider1.style.left="0px"  	
	slider2.style.left=sliderwidth+"px" 
}

function slideleft(){
	if (parseInt(slider1.style.left)>(sliderwidth*(-1)))  //not yet offscreen so still go left
	  {slider1.style.left=(parseInt(slider1.style.left)+scrollamount)+"px"} //so move left
	else
	  {slider1.style.left=(parseInt(slider2.style.left)+sliderwidth+scrollamount)+"px"} //else move to caboose
	if (parseInt(slider2.style.left)>(sliderwidth*(-1)))  
	  {slider2.style.left=(parseInt(slider2.style.left)+scrollamount)+"px"}
	else
	  {slider2.style.left=(parseInt(slider1.style.left)+sliderwidth)+"px"}
}


function thumbwow(num,thumOffset,thumSize, label){
	//--- use the image offset to locate the blowup
	if (parseInt(slider1.style.left)<=0) {
	    if (thumOffset+parseInt(slider1.style.left)>0-thumSize) {leftstart=thumOffset+parseInt(slider1.style.left)}
	    else{leftstart=thumOffset+parseInt(slider2.style.left)}
	}
	else{
	    if (thumOffset+parseInt(slider2.style.left)>0-thumSize) {leftstart=thumOffset+parseInt(slider2.style.left)}
	    else{leftstart=thumOffset+parseInt(slider1.style.left)}
	}
	document.getElementById("blowup").style.left=leftstart+thBorderWid+Math.round((thumSize-thumSize/thRatio-borderWidth)/2 )  

	if (ebay==true){
		if (siteflag==0){var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}
		else 		{var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}
		var innercode=sitelink+num+'" title="" target=_blank>'+
		'<img src="http://thumbs.ebaystatic.com/pict/'+num+'.jpg"  height="'+lgHt+'" border="0" ></a>'}
	else
		{var innercode='<a href="'+AuctionLink[num]+'" title="'+label+'" target=_blank>'+
		'<img src="'+AuctionThumb[num]+'"  height="'+lgHt+'" border="0" ></a>'}

	document.getElementById("blowup").innerHTML=innercode
	document.getElementById("blowup").style.visibility="visible"
	document.getElementById("slidelabel").innerHTML=label
}

function unwow(){
	document.getElementById("blowup").style.visibility="hidden"
	document.getElementById('slidelabel').innerHTML=document.getElementById('slidelabel').title
}



var langComment = new Array(10) // add language specific text strings for the output code
function initXsell(languagetext){
	// read in langComment[0] thru 9
}

function MakeCodes(){
  // if variable images, then add the array to the list
  // if fixed widths, then don't add the array, but the code that looks for the 
  // variable should be told to use a fixed width if the arrayed variable is not present.

  if (document.getElementById("Multi").checked){key="_"+Math.round(1000*Math.random());var multi=true} else{key=""; var multi=false}
  galleryCode=""	
  galleryCode=galleryCode+'\n <!--   BEGIN SLIDE SHOW  -->'
  galleryCode=galleryCode+'\n <center><'+'script language="JavaScript1.2">'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  if (multi==true) 
  {galleryCode=galleryCode+'\n /*     Free multi-copy cross-sell gallery from	*/'}
  else
  {galleryCode=galleryCode+'\n /*     Free cross-sell gallery from      	*/'}
  galleryCode=galleryCode+'\n /*     http://www.isdntek.com/etools.htm  	*/'
  galleryCode=galleryCode+'\n /*     copyright © 2005 ISDN*tek           	*/'
  galleryCode=galleryCode+'\n /*     Do not remove this notice.          	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*     This code has been tested in       	*/'
  galleryCode=galleryCode+'\n /*     Internet Explorer 6, FireFox 1,    	*/'
  galleryCode=galleryCode+'\n /*     Netscape 7, Opera 7, and eBay      	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  if (ebay==true){
  galleryCode=galleryCode+'\n; var AuctionNumb'+key+'=new Array() '
  galleryCode=galleryCode+'\n; var AuctionDesc'+key+'=new Array() '
  }else{
  galleryCode=galleryCode+'\n; var AuctionThum'+key+'=new Array() '
  galleryCode=galleryCode+'\n; var AuctionLink'+key+'=new Array() '
  galleryCode=galleryCode+'\n; var AuctionDesc'+key+'=new Array() '
  }
  galleryCode=galleryCode+'\n; var ImgWidRatio'+key+'=new Array() '
  if (sameRatio==true) {galleryCode=galleryCode+'\n;     ImgWidRatio'+key+'[0]="'+thRat[1]+'" '}
  		  else {galleryCode=galleryCode+'\n;     ImgWidRatio'+key+'[0]="1" '}
  galleryCode=galleryCode+'\n;'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*  ADD AUCTION NUMBERS AND DESCRIPTIONS   	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*  Change the values below to add           	*/'
  if (ebay==true){
  galleryCode=galleryCode+'\n /*  each auction number and its description.  	*/'
  }else{  
  galleryCode=galleryCode+'\n /*  each thumbnail image, link, and description.	*/'
  }
  galleryCode=galleryCode+'\n /*  Extra sets should be deleted. More can be added.	*/'
  galleryCode=galleryCode+'\n /*  Apostrophes and Quotes should be avoided, or else	*/'
  galleryCode=galleryCode+'\n /*  the following substitutions should be made:	*/'
  galleryCode=galleryCode+'\n /*  Apostrophe should be replaced with &#39;   	*/'
  galleryCode=galleryCode+'\n /*  Quote should be replaced with &#34;         	*/'

  galleryCode=galleryCode+'\n /* ==========================================	*/'

  if (ebay==true){
  for (var i=1; i<=AuctionNumber.length; i++){if(AuctionNumber[i]){
  	galleryCode=galleryCode+'\n; AuctionNumb'+key+'['+i+']="'+AuctionNumber[i]+'" '
  	galleryCode=galleryCode+'\n; AuctionDesc'+key+'['+i+']="'+AuctionDescrp[i]+'" '
  	if (sameRatio==false) {galleryCode=galleryCode+'\n; ImgWidRatio'+key+'['+i+']="'+thRat[i]+'" '}
  	}
      }
  }else{
  for (var i=1; i<=AuctionThumb.length; i++){if(AuctionThumb[i]){
  	galleryCode=galleryCode+'\n; AuctionThum'+key+'['+i+']="'+AuctionThumb[i]+'" '
  	galleryCode=galleryCode+'\n; AuctionLink'+key+'['+i+']="'+AuctionLink[i]+'" '
  	galleryCode=galleryCode+'\n; AuctionDesc'+key+'['+i+']="'+AuctionDescrp[i]+'" '
  	if (sameRatio==false) {galleryCode=galleryCode+'\n; ImgWidRatio'+key+'['+i+']="'+thRat[i]+'" '}
  	}
      }
  }
  galleryCode=galleryCode+'\n; '  
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*          SET UP APPEARANCE    		*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n; var scrollspeed'+key+' ="'+scrollspeed+ '" '
  galleryCode=galleryCode+'\n; var slideborder'+key+' ="'+slideborder+ '" '
  galleryCode=galleryCode+'\n; var slidebgcolor'+key+'="'+slidebgcolor+'" '
  galleryCode=galleryCode+'\n; var textcolor'+key+'   ="'+textcolor+   '" '
  galleryCode=galleryCode+'\n; var gallerywidth'+key+'="'+gallerywidth+'" '
  galleryCode=galleryCode+'\n; '  
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*     DO NOT EDIT BELOW THIS LINE 		*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  //galleryCode=galleryCode+'\n /*     '+langComment[0]+'      */'
  galleryCode=galleryCode+'\n var slider1'+key+', slider2'+key+', maxWid'+key+'=0; var sliderwidth'+key+'=0; '
  galleryCode=galleryCode+'\n var quot="'+quot+'"; var scrollamount'+key+'=-1; var thCnt'+key+'=0; '
  galleryCode=galleryCode+'\n var CrossSellimages'+key+'=new Array();'

  if (ebay==true){
  galleryCode=galleryCode+'\n for (var i=1; i<=AuctionNumb'+key+'.length; i++){if (AuctionNumb'+key+'[i]){thCnt'+key+'++;'
  galleryCode=galleryCode+'\n	if (!ImgWidRatio'+key+'[i]) {ImgWidRatio'+key+'[i]=ImgWidRatio'+key+'[0]};'
		if (siteflag==0){var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}else
				{var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}
  galleryCode=galleryCode+'\n	CrossSellimages'+key+'[thCnt'+key+']='+quot+sitelink+quot+'+AuctionNumb'+key+'[i]+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<img src="http://thumbs.ebaystatic.com/pict/'+quot+'+AuctionNumb'+key+'[i]+'+quot+'.jpg"  width="'+quot+'+Math.round('+thHt+'*ImgWidRatio'+key+'[i])+'+quot+'" height="'+thHt+'" hspace="'+hSpc+'" vspace="'+vSpc+'" border="0" '+quot+'+'   
  if (thBorderWid){  		galleryCode=galleryCode+'\n	'+quot+' style="border:'+thBorderWid+'px '+quot+'+slideborder'+key+'+'+quot+' solid"'+quot+'+' }
  galleryCode=galleryCode+'\n	'+quot+' onmouseover="thumbwow'+key+'(this.alt,this.offsetLeft,this.offsetWidth,'+quot+'+quot+AuctionDesc'+key+'[i]+quot+'+quot+')" '+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+' title="" alt="'+quot+'+AuctionNumb'+key+'[i]+'+quot+'" ></a>'+quot+';'
  galleryCode=galleryCode+'\n	sliderwidth'+key+'=sliderwidth'+key+'+Math.round(('+thHt+'*ImgWidRatio'+key+'[i])+'+(hSpc+thBorderWid)*2+');'
  galleryCode=galleryCode+'\n	if (ImgWidRatio'+key+'[i]>maxWid'+key+'){maxWid'+key+'=ImgWidRatio'+key+'[i]}' 
  galleryCode=galleryCode+'\n }};'
  }else{
  galleryCode=galleryCode+'\n for (var i=1; i<=AuctionThum'+key+'.length; i++){if (AuctionThum'+key+'[i]){thCnt'+key+'++;'
  galleryCode=galleryCode+'\n	if (!ImgWidRatio'+key+'[i]) {ImgWidRatio'+key+'[i]=ImgWidRatio'+key+'[0]};'
  galleryCode=galleryCode+'\n	CrossSellimages'+key+'[thCnt'+key+']='+quot+'<a href="'+quot+'+AuctionLink'+key+'[i]+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<img src="'+quot+'+AuctionThum'+key+'[i]+'+quot+'"  width="'+quot+'+Math.round('+thHt+'*ImgWidRatio'+key+'[i])+'+quot+'" height="'+thHt+'" hspace="'+hSpc+'" vspace="'+vSpc+'" border="0" '+quot+'+'
  if (thBorderWid){  		galleryCode=galleryCode+'\n	'+quot+' style="border:'+thBorderWid+'px '+quot+'+slideborder'+key+'+'+quot+' solid"'+quot+'+'    }
  galleryCode=galleryCode+'\n	'+quot+' onmouseover="thumbwow'+key+'(this.alt,this.offsetLeft,this.offsetWidth,'+quot+'+quot+AuctionDesc'+key+'[i]+quot+'+quot+')" '+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+' title="" alt="'+quot+'+i+'+quot+'" ></a>'+quot+';'
  galleryCode=galleryCode+'\n	sliderwidth'+key+'=sliderwidth'+key+'+Math.round(('+thHt+'*ImgWidRatio'+key+'[i])+'+(hSpc+thBorderWid)*2+');'
  galleryCode=galleryCode+'\n	if (ImgWidRatio'+key+'[i]>maxWid'+key+'){maxWid'+key+'=ImgWidRatio'+key+'[i]}' 
  galleryCode=galleryCode+'\n }};'
  }
  galleryCode=galleryCode+'\n var sliderheight'+key+'="'+(lgHt+(vSpc*2))+'"; '
  galleryCode=galleryCode+'\n var CrossSellStrip'+key+'='+quot+'<nobr>'+quot+'+CrossSellimages'+key+'.join("")+'+quot+'</nobr>'+quot+';' 
  galleryCode=galleryCode+'\n if (sliderwidth'+key+'-maxWid'+key+'*'+thHt+'<parseInt(gallerywidth'+key+')){gallerywidth'+key+'=Math.abs(sliderwidth'+key+'-maxWid'+key+'*'+thHt+')}'


  galleryCode=galleryCode+'\n function setupGallery'+key+'(){'
  galleryCode=galleryCode+'\n	document.write('+quot+'<table align="center" border="0" cellspacing="0" cellpadding="0" style="position:relative; border:'+borderWidth+'px solid '+quot+'+slideborder'+key+'+'+quot+'; background-color:'+quot+'+slidebgcolor'+key+'+'+quot+'; width:'+quot+'+(parseInt(gallerywidth'+key+')+'+borderWidth+')+'+quot+'px; height:'+(lgHt+(vSpc*2)+borderWidth+thBorderWid*2)+'px;"><tr><td valign="top" align="center">'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'<div style="position:relative;width:'+quot+'+gallerywidth'+key+'+'+quot+'px;height:'+Math.round(lgHt+(vSpc+thBorderWid)*2+borderWidth/2)+'px;overflow:hidden;">'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'<div style="position:absolute;left:0px;bottom:0px;width:'+quot+'+gallerywidth'+key+'+'+quot+'px;height:'+Math.round(lgHt+(vSpc+thBorderWid)*2+borderWidth/2)+'px;" onMouseover="scrollamount'+key+'=0" onMouseout="scrollamount'+key+'=-1">'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'<div id="slidegroup1'+key+'" style="position:absolute;left:0px;bottom:'+Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+'px;"></div>'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'<div id="slidegroup2'+key+'" style="position:absolute;left:-1000px;bottom:'+Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+'px;"></div>'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'<div id="blowup'+key+'" style="position:absolute;left:0px;bottom:'+(thBorderWid*2)+'px;visibility:hidden;border:'+(borderWidth/2)+'px '+quot+'+slideborder'+key+'+'+quot+' solid;" onmouseout="unwow'+key+'()"></div>'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'</div></div>'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'</td></tr><tr><td align="center" id="slidelabel'+key+'" style="padding:2px; font-family:'+slideFontFace+'; font-size:'+slideFontSize+'; font-weight:'+slideFontBolded+'; color:'+quot+'+textcolor'+key+'+'+quot+'" title="'+replaceQuote(document.getElementById('defaultCaption').value)+'">'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+replaceQuote(document.getElementById('defaultCaption').value)+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+'</td></tr></table>'+quot+');'
  galleryCode=galleryCode+'\n	document.write('+quot+xsell+quot+')'
  galleryCode=galleryCode+'\n };'

  galleryCode=galleryCode+'\n function loadimages'+key+'(){'
  galleryCode=galleryCode+'\n	slider1'+key+'=document.getElementById("slidegroup1'+key+'");'
  galleryCode=galleryCode+'\n	slider2'+key+'=document.getElementById("slidegroup2'+key+'");'
  galleryCode=galleryCode+'\n	slider1'+key+'.innerHTML=CrossSellStrip'+key+';	'
  galleryCode=galleryCode+'\n	slider2'+key+'.innerHTML=CrossSellStrip'+key+';	'
  galleryCode=galleryCode+'\n	slider2'+key+'.style.left=""+sliderwidth'+key+'+"px";  	'
  galleryCode=galleryCode+'\n	startaction'+key+'=setInterval("slideleft'+key+'()",parseInt(scrollspeed'+key+'));'
  galleryCode=galleryCode+'\n };'

  galleryCode=galleryCode+'\n function slideleft'+key+'(){'
  galleryCode=galleryCode+'\n	if (parseInt(slider1'+key+'.style.left)>(sliderwidth'+key+'*(-1)))  '
  galleryCode=galleryCode+'\n	  {slider1'+key+'.style.left=(parseInt(slider1'+key+'.style.left)+scrollamount'+key+')+"px"}'
  galleryCode=galleryCode+'\n	else'
  galleryCode=galleryCode+'\n	  {slider1'+key+'.style.left=(parseInt(slider2'+key+'.style.left)+sliderwidth'+key+'+scrollamount'+key+')+"px"}'
  
  galleryCode=galleryCode+'\n	if (parseInt(slider2'+key+'.style.left)>(sliderwidth'+key+'*(-1)))  '
  galleryCode=galleryCode+'\n	  {slider2'+key+'.style.left=(parseInt(slider2'+key+'.style.left)+scrollamount'+key+')+"px"}'
  galleryCode=galleryCode+'\n	else'
  galleryCode=galleryCode+'\n	  {slider2'+key+'.style.left=(parseInt(slider1'+key+'.style.left)+sliderwidth'+key+')+"px"}'
  galleryCode=galleryCode+'\n };'
  
 
  galleryCode=galleryCode+'\n function thumbwow'+key+'(num,thumOffset,thumSize,label){'
  galleryCode=galleryCode+'\n	if (parseInt(slider1'+key+'.style.left)<=0){'
  galleryCode=galleryCode+'\n	  if (thumOffset+parseInt(slider1'+key+'.style.left)>0-thumSize){leftstart=thumOffset+parseInt(slider1'+key+'.style.left)}else{leftstart=thumOffset+parseInt(slider2'+key+'.style.left)}'
  galleryCode=galleryCode+'\n	}'
  galleryCode=galleryCode+'\n	else {'
  galleryCode=galleryCode+'\n	  if (thumOffset+parseInt(slider2'+key+'.style.left)>0-thumSize){leftstart=thumOffset+parseInt(slider2'+key+'.style.left)}else{leftstart=thumOffset+parseInt(slider1'+key+'.style.left)}'
  galleryCode=galleryCode+'\n	};'
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").style.left=leftstart+'+thBorderWid+'+(Math.round((thumSize-thumSize/'+thRatio+'-'+borderWidth+')/2))+"px";'
  if (ebay==true){
		if (siteflag==0){var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}else
				{var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}
 
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").innerHTML='+quot+sitelink+quot+'+num+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n		'+quot+'<img src="http://thumbs.ebaystatic.com/pict/'+quot+'+num+'+quot+'.jpg" height="'+lgHt+'" border="0" ></a>'+quot+';'
  }else{
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").innerHTML='+quot+'<a href="'+quot+'+AuctionLink'+key+'[num]+'+quot+'" title="'+quot+'+label+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n		'+quot+'<img src="'+quot+'+AuctionThum'+key+'[num]+'+quot+'" height="'+lgHt+'" border="0" ></a>'+quot+';'
  }
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").style.visibility="visible";'
  galleryCode=galleryCode+'\n	document.getElementById("slidelabel'+key+'").innerHTML=label;'
  galleryCode=galleryCode+'\n };'
 
  galleryCode=galleryCode+'\n function unwow'+key+'(){document.getElementById("blowup'+key+'").style.visibility="hidden";'
  galleryCode=galleryCode+'\n	document.getElementById("slidelabel'+key+'").innerHTML=document.getElementById("slidelabel'+key+'").title'
  galleryCode=galleryCode+'\n };'
 
  galleryCode=galleryCode+'\n setupGallery'+key+'();'
  galleryCode=galleryCode+'\n loadimages'+key+'();'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*     End cross-sell gallery			*/'
  galleryCode=galleryCode+'\n /*     http://www.isdntek.com/etools.htm 	*/'
  galleryCode=galleryCode+'\n /*     copyright © 2005 ISDN*tek	    	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n <'+'/script> <span style="font-size:2px;color:gray">xsellx</span></center>'
  galleryCode=galleryCode+'\n <!--  END SLIDE SHOW -->'
	
  document.getElementById('HtmlCode').value=galleryCode
  document.getElementById('codesize').innerHTML=galleryCode.length
}


function CompressCodes(){

  if (document.getElementById("Multi").checked){key="_"+Math.round(1000*Math.random()); var multi=true} else{key="";var multi=false}
  galleryCode=""	
  galleryCode=galleryCode+'\n <!--   BEGIN SLIDE SHOW  -->'
  galleryCode=galleryCode+'\n <center><'+'script language="JavaScript1.2">'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  if (multi==true) 
  {galleryCode=galleryCode+'\n /*     Free multi-copy cross-sell gallery from	*/'}
  else
  {galleryCode=galleryCode+'\n /*     Free cross-sell gallery from 		*/'}
  galleryCode=galleryCode+'\n /*     http://www.isdntek.com/etools.htm  	*/'
  galleryCode=galleryCode+'\n /*     copyright © 2005 ISDN*tek	      	*/'
  galleryCode=galleryCode+'\n /*     Do not remove this notice.	      	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  if (ebay==true){
  	galleryCode=galleryCode+'\n var XaN'+key+'=new Array(""'
    for (var i=1; i<=AuctionNumber.length; i++){if(AuctionNumber[i]){
  	galleryCode=galleryCode+',"'+AuctionNumber[i]+'"'
  	}
      }
	galleryCode=galleryCode+');'
  	galleryCode=galleryCode+'\n var XaD'+key+'=new Array(""'
    for (var i=1; i<=AuctionNumber.length; i++){if(AuctionNumber[i]){
  	galleryCode=galleryCode+',"'+AuctionDescrp[i]+'"'
  	}
      }
	galleryCode=galleryCode+');'
    if (sameRatio==false) {
  	galleryCode=galleryCode+'\n var XaW'+key+'=new Array(""'
      for (var i=1; i<=AuctionNumber.length; i++){if(AuctionNumber[i]){
  	galleryCode=galleryCode+',"'+thRat[i]+'"'
  	}
       } 
	galleryCode=galleryCode+');'
      } else {galleryCode=galleryCode+'\n var XaW'+key+'=new Array("'+maxThRatio+'");'}

  }else{
  	galleryCode=galleryCode+'\n var XaT'+key+'=new Array(""'
    for (var i=1; i<=AuctionThumb.length; i++){if(AuctionThumb[i]){
  	galleryCode=galleryCode+',"'+AuctionThumb[i]+'"'
  	}
      }
	galleryCode=galleryCode+');'
  	galleryCode=galleryCode+'\n var XaL'+key+'=new Array(""'
    for (var i=1; i<=AuctionThumb.length; i++){if(AuctionThumb[i]){
  	galleryCode=galleryCode+',"'+AuctionLink[i]+'"'
  	}
      }
	galleryCode=galleryCode+');'
  	galleryCode=galleryCode+'\n var XaD'+key+'=new Array(""'
    for (var i=1; i<=AuctionThumb.length; i++){if(AuctionThumb[i]){
  	galleryCode=galleryCode+',"'+AuctionDescrp[i]+'"'
  	}
      }
	galleryCode=galleryCode+');'
    if (sameRatio==false) {
  	galleryCode=galleryCode+'\n var XaW'+key+'=new Array(""'
      for (var i=1; i<=AuctionThumb.length; i++){if(AuctionThumb[i]){
  	galleryCode=galleryCode+',"'+thRat[i]+'"'
  	}
       } 
	galleryCode=galleryCode+');'
      } else {galleryCode=galleryCode+'\n var XaW'+key+'=new Array("'+maxThRatio+'");'}

  }
 
  galleryCode=galleryCode+'\n /* ===========================================	*/'

  galleryCode=galleryCode+'\n var Xsl1'+key+', Xsl2'+key+';'
  galleryCode=galleryCode+' var quot="'+quot+'"; var Xsc'+key+'=-1; var XsI'+key+'=new Array();	'

  if (ebay==true){
		if (siteflag==0){var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}
		else 		{var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}

  galleryCode=galleryCode+'\n for (var i=1; i<=XaN'+key+'.length; i++){if (XaN'+key+'[i]){'
    if (sameRatio==true) {ThumbWidth=Math.round(thHt*maxThRatio)}else {
  ThumbWidth=quot+'+Math.round('+thHt+'*XaW'+key+'[i])+'+quot
  galleryCode=galleryCode+'\n	if (!XaW'+key+'[i]) {XaW'+key+'[i]=XaW'+key+'[0]}'
    }
  galleryCode=galleryCode+'\n	XsI'+key+'[i]='+quot+sitelink+quot+'+XaN'+key+'[i]+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<img src="http://thumbs.ebaystatic.com/pict/'+quot+'+XaN'+key+'[i]+'+quot+'.jpg" width="'+ThumbWidth+'" height="'+thHt+'" hspace="'+hSpc+'" vspace="'+vSpc+'" border="0" '+quot+'+'   
  if (thBorderWid){  		galleryCode=galleryCode+'\n	'+quot+' style="border:'+thBorderWid+'px '+slideborder+' solid"'+quot+'+' }
  galleryCode=galleryCode+'\n	'+quot+' onmouseover="Xwow'+key+'(this.alt,this.offsetLeft,this.offsetWidth,'+quot+'+quot+XaD'+key+'[i]+quot+'+quot+')" '+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+' title="" alt="'+quot+'+XaN'+key+'[i]+'+quot+'" ></a>'+quot
  galleryCode=galleryCode+'\n }}'
  }else{
  galleryCode=galleryCode+'\n for (var i=1; i<=XaT'+key+'.length; i++){if (XaT'+key+'[i]){'
    if (sameRatio==true) {ThumbWidth=Math.round(thHt*maxThRatio)}else {
  ThumbWidth=quot+'+Math.round('+thHt+'*XaW'+key+'[i])+'+quot
  galleryCode=galleryCode+'\n	if (!XaW'+key+'[i]) {XaW'+key+'[i]=XaW'+key+'[0]};'
    }
  galleryCode=galleryCode+'\n	XsI'+key+'[i]='+quot+'<a href="'+quot+'+XaL'+key+'[i]+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<img src="'+quot+'+XaT'+key+'[i]+'+quot+'" width="'+ThumbWidth+'" height="'+thHt+'" hspace="'+hSpc+'" vspace="'+vSpc+'" border="0" '+quot+'+'
  if (thBorderWid){  		galleryCode=galleryCode+'\n	'+quot+' style="border:'+thBorderWid+'px '+slideborder+' solid"'+quot+'+'    }
  galleryCode=galleryCode+'\n	'+quot+' onmouseover="Xwow'+key+'(this.alt,this.offsetLeft,this.offsetWidth,'+quot+'+quot+XaD'+key+'[i]+quot+'+quot+')" '+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+' title="" alt="'+quot+'+i+'+quot+'" ></a>'+quot
  galleryCode=galleryCode+'\n }};'
  }
  galleryCode=galleryCode+'\n var Xgp'+key+'='+quot+'<nobr>'+quot+'+XsI'+key+'.join("")+'+quot+'</nobr>'+quot+';' 


  galleryCode=galleryCode+'\n function setupGallery'+key+'(){'
  galleryCode=galleryCode+'\n	document.write('+quot+'<table align="center" border="0" cellspacing="0" cellpadding="0" style="position:relative;border:'+borderWidth+'px solid '+slideborder+';background-color:'+slidebgcolor+'; width:'+(parseInt(gallerywidth)+borderWidth)+'px; height:'+(lgHt+(vSpc*2)+borderWidth+thBorderWid*2)+'px;"><tr><td valign="top" align="center">'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<div style="position:relative;width:'+gallerywidth+'px;height:'+Math.round(lgHt+(vSpc+thBorderWid)*2+borderWidth/2)+'px;overflow:hidden;">'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<div style="position:absolute;left:0px;bottom:0px;width:'+gallerywidth+'px;height:'+Math.round(lgHt+(vSpc+thBorderWid)*2+borderWidth/2)+'px;" onMouseover="Xsc'+key+'=0" onMouseout="Xsc'+key+'=-1">'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<div id="sGp1'+key+'" style="position:absolute;width:'+sliderwidth+';left:0px;bottom:'+Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+'px;"></div>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<div id="sGp2'+key+'" style="position:absolute;width:'+sliderwidth+';left:-1000px;bottom:'+Math.round(((lgHt+borderWidth)-thHt)/2-vSpc+thBorderWid)+'px;"></div>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'<div id="blowup'+key+'" style="position:absolute;left:0px;bottom:'+(thBorderWid*2)+'px;visibility:hidden;border:'+(borderWidth/2)+'px '+slideborder+' solid;" onmouseout="unwow'+key+'()"></div>'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'</div></div></td></tr><tr><td align="center" id="sLbl'+key+'" style="padding:2px; font-family:'+slideFontFace+'; font-size:'+slideFontSize+'; font-weight:'+slideFontBolded+'; color:'+textcolor+'" title="'+replaceQuote(document.getElementById('defaultCaption').value)+'">'+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+replaceQuote(document.getElementById('defaultCaption').value)+quot+'+'
  galleryCode=galleryCode+'\n	'+quot+'</td></tr></table>'+xsell+quot+')'
  galleryCode=galleryCode+'\n };'

  galleryCode=galleryCode+'\n function loadimages'+key+'(){'
  galleryCode=galleryCode+'\n	Xsl1'+key+'=document.getElementById("sGp1'+key+'");'
  galleryCode=galleryCode+';  Xsl2'+key+'=document.getElementById("sGp2'+key+'");'
  galleryCode=galleryCode+'\n	Xsl1'+key+'.innerHTML=Xgp'+key+';'
  galleryCode=galleryCode+';  Xsl2'+key+'.innerHTML=Xgp'+key+';'
  galleryCode=galleryCode+'\n	Xsl2'+key+'.style.left="'+sliderwidth+'px";'
  galleryCode=galleryCode+';  startaction'+key+'=setInterval("Xmov'+key+'()",'+parseInt(scrollspeed)+');'
  galleryCode=galleryCode+'\n };'
  galleryCode=galleryCode+'\n function XsLt(n){n==1?a=parseInt(Xsl1'+key+'.style.left):a=parseInt(Xsl2'+key+'.style.left);return a};'

  galleryCode=galleryCode+'\n function Xmov'+key+'(){'
  galleryCode=galleryCode+'\n	if (XsLt(1)>('+sliderwidth*(-1)+'))  '
  galleryCode=galleryCode+'\n	  {Xsl1'+key+'.style.left=(XsLt(1)+Xsc'+key+')+"px"}'
  galleryCode=galleryCode+'\n	else{Xsl1'+key+'.style.left=(XsLt(2)+'+sliderwidth+'+Xsc'+key+')+"px"};'
  
  galleryCode=galleryCode+'\n	if (XsLt(2)>('+sliderwidth*(-1)+'))  '
  galleryCode=galleryCode+'\n	  {Xsl2'+key+'.style.left=(XsLt(2)+Xsc'+key+')+"px"}'
  galleryCode=galleryCode+'\n	else{Xsl2'+key+'.style.left=(XsLt(1)+'+sliderwidth+')+"px"}'
  galleryCode=galleryCode+'\n };'
  
 
  galleryCode=galleryCode+'\n function Xwow'+key+'(num,Xto,Xtw,label){'
  galleryCode=galleryCode+'\n	if (XsLt(1)<=0){ if (Xto+XsLt(1)>0-Xtw){xlt=Xto+XsLt(1)}else{xlt=Xto+XsLt(2)}}'
  galleryCode=galleryCode+'\n	else {if (Xto+XsLt(2)>0-Xtw){xlt=Xto+XsLt(2)}else{xlt=Xto+XsLt(1)}}'
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").style.left=xlt+'+thBorderWid+'+(Math.round((Xtw-Xtw/'+thRatio+'-'+borderWidth+')/2))+"px";'
  if (ebay==true){
		if (siteflag==0){var sitelink='<a href="http://cgi.'+document.getElementById('country').value+'/ws/eBayISAPI.dll?ViewItem'+storeReferral+'&item='}
		else 		{var sitelink='<a href="http://www.'+document.getElementById('country').value+'/viItem?ItemId='}
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").innerHTML='+quot+sitelink+quot+'+num+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n		'+quot+'<img src="http://thumbs.ebaystatic.com/pict/'+quot+'+num+'+quot+'.jpg" height="'+lgHt+'" border="0" ></a>'+quot+';'
  }else{
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").innerHTML='+quot+'<a href="'+quot+'+XaL'+key+'[num]+'+quot+'" title="'+quot+'+label+'+quot+'" target=_blank>'+quot+'+'
  galleryCode=galleryCode+'\n		'+quot+'<img src="'+quot+'+XaT'+key+'[num]+'+quot+'" height="'+lgHt+'" border="0" ></a>'+quot+';'
  }
  galleryCode=galleryCode+'\n	document.getElementById("blowup'+key+'").style.visibility="visible";'
  galleryCode=galleryCode+'\n	document.getElementById("sLbl'+key+'").innerHTML=label;'
  galleryCode=galleryCode+'\n };'
 
  galleryCode=galleryCode+'\n function unwow'+key+'(){document.getElementById("blowup'+key+'").style.visibility="hidden";'
  galleryCode=galleryCode+'\n	document.getElementById("sLbl'+key+'").innerHTML=document.getElementById("sLbl'+key+'").title'
  galleryCode=galleryCode+'\n };'
 
  galleryCode=galleryCode+'\n setupGallery'+key+'();loadimages'+key+'();'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n /*     End cross-sell gallery		   	*/'
  galleryCode=galleryCode+'\n /* ===========================================	*/'
  galleryCode=galleryCode+'\n <'+'/script> <span style="font-size:2px;color:gray">xsellx</span></center>'
  galleryCode=galleryCode+'\n <!--  END SLIDE SHOW -->'
	
  document.getElementById('HtmlCode').value=galleryCode
  document.getElementById('codesize').innerHTML=galleryCode.length
}



//--end
