function vi_html_touchpad(thumb_filename, upmove,s_fileName,realImageWidth,starting_width,starting_height,meas_data,units,zoom_factor,buy_text,sku_text,s_fileName2,col_data,info_data,hotspot_data)
{
	var ext="";
	var fsl="";
	//var p_a="&#x70;&#x6f;&#x73;&#x69;&#x74;&#x69;&#x6f;&#x6e;:&#x61;&#x62;&#x73;&#x6f;&#x6c;&#x75;&#x74;&#x65;;";
	var p_a="position:absolute;";
	var up = upmove;
	var image_number = 1;
	var v_y = 0;
	var ac = 0;
	try{if(tc){}}catch(e_tc){tc = "tc/";}
	var wx = 0;
	var hx = 0;

	var hp_x;
	var he_x;
	var hu_x;
	var hx_x;
	var hy_x;
	var vp_x;
	var ve_x;
	var vu_x;
	var vx_x;
	var vy_x;

	var ih=0;
	var pnm=0;
	var hot_x;
	var hot_y;
	var hot_t;

	image_array = s_fileName;
	image_number = image_array.length;
	measure_array = meas_data;

	color_array = col_data;

	temp_col_array = new Array();
	for(i=0;i<color_array.length;i++)
	{
		if(color_array[i]!='' && color_array[i+1]!='' && color_array[i+2]!='')
		{
			temp_col_array[i] = color_array[i];
			temp_col_array[i+1] = color_array[i+1];
			temp_col_array[i+2] = color_array[i+2];
		}
		i++;
		i++;
	}
	color_array=temp_col_array;

	var in_color = color_array.length;

	hotspot_array = hotspot_data;

	info_array = info_data;

	temp_info_array = new Array();
	for(i=0;i<info_array.length;i++)
	{
		if(info_array[i]!='' && info_array[i+1]!='' && info_array[i+2]!='')
		{
			temp_info_array[i] = info_array[i];
			temp_info_array[i+1] = info_array[i+1];
			temp_info_array[i+2] = info_array[i+2];
		}
		i++;
		i++;
	}
	info_array=temp_info_array;

	thumb_array = thumb_filename;

	var buystring = buy_text;

	var itop = 0;
	var bt="";
	var t_p="transparentpixel.gif";
	var controls_zoom_2Db="Touchpad2D.gif";
	var bam_zb="m_zb.gif";
	var redpixel="redpixel.gif";
	var control_color_2Db="controlbox.gif";
	var control_color_2Db_h=15;
	var control_hotspots_2Db="controlbox.gif";
	var control_hotspots_2Db_h=30;
	var hss_1="osq.gif";
	var hss_1_large_h="osq_large.gif";
	var controls_measure_3D="measure.gif";
	var controls_color_3D="inform.gif";
	var controls_hotspots_3D="hotspots.gif";
	var bam_zz="osq.gif";

	var control_buy_2D="buy2D.gif";
	var control_buy_3D="buy3D.gif";

	var bam_zz_h=18;

	var Actual_Width = realImageWidth*1;
	var Starting_Height = starting_height*1;
	var Starting_Size = starting_width*1;
	var Actual_Height = Actual_Width * Starting_Height/Starting_Size;

	var controls_top_3D="touchpad3D.gif";

	var vn=6;
	if(image_number == 1)
	{
		vn=14;
	}
	var tw_w=40;
	var tw_h=140/vn;
	var tw_ht=9;
	var tw_l=40;
	var th_l=88;
	var th_h=23;

	var left_3D = -12;
	var left_2D = -5;
	var t_m_2D = 15;
	var t_c_w_2D = 9;
	var t_m_3D = bam_zz_h;
	//var t_c_3D = 24;
	var t_c_3D = 19;
	//var t_h_3D = 18;
	var t_h_3D = 30;
	var t_i_3D = 19;

	var top_ia = 0;
	var top_ia_move = Actual_Height/(vn*4);
	var w_add = (Actual_Width - Starting_Size)/(vn-1);

	var h_add = (Actual_Height - Starting_Height)/(vn-1);

	wArray = new Array(vn+1);
	hArray = new Array(vn+1);

	var w1 = Starting_Size * 1;
	wArray[0]=w1;

	var h1 = Starting_Height;
	hArray[0]=h1;

	var ws = w1;

	for(var i=1;i<vn;i++)
	{
		ws+=w_add;
		wArray[i]=ws;
	}

	var hs = h1;
	for(var i=1;i<vn;i++)
	{
		hs=hs+h_add;
		hArray[i]=hs;
	}

	var top_ia_move_end;
	var ddt="";

	if(up == 1)
	{
		ddt="o";
		top_ia_move_end = (vn-1)*Actual_Height/(vn*4);
	}
	else
	{
		ddt="o";
		top_ia_move_end = 0;
	}

	div_pos_w=200;
	if(image_number == 1)
	{
		var div_position = 0;
		if(v_y == 1)
		{
			div_position = (Actual_Height*1)+300;
		}
		else if(Starting_Height > 286)
		{
			div_position = Starting_Height;
		}
		else
		{
			div_position = 286;
		}

		//bt="<STYLE type=text/css> ."+ddt+"{visibility:hidden;} 	."+ddt+" A{text-decoration:none;} ."+ddt+" A:hover{visibility:visible;} .i"+ddt+" A:visited{visibility:hidden;color:#666666;display:block;} .i"+ddt+"{visibility:hidden;color:white;display:block;} .i"+ddt+" A{color:#666666;display:block;text-decoration:none;font-size:12px;} .i"+ddt+" A:hover{visibility:visible;color:black; display:block;}</STYLE>";
		bt="<STYLE type=text/css> ."+ddt+"{visibility:hidden;} a."+ddt+":hover{text-decoration:none;visibility:visible;} .i"+ddt+" A:visited{visibility:hidden;color:#666666;display:block;} .i"+ddt+"{color:#666666;visibility:hidden;display:block;} a.i"+ddt+":hover{visibility:visible;color:black; display:block;}</STYLE>";

		bt+="<div style=\"height:"+div_position+"px; width:"+div_pos_w+"px; position:relative; left:"+(-(left_2D))+"px;\">";
		bt+="<div style=\""+p_a+"\">";

		var pos_control = 0;

		bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
		bt+="<A href=\""+u_x+"\">";
		bt+="<img border=\"0\" style=\"left:"+left_2D+"px; visibility:visible;"+p_a+"top:"+pos_control+"px;\" src=\""+tc+""+controls_zoom_2Db+"\">";
		bt+="</A>";
		bt+="</DIV>";

		var t=0;

		for(var i=0;i<vn;i++)
		{
			wx=wArray[i];
			hx=hArray[i];

			vcursor="crosshair";
			if(i==0)
			{
				//bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
				bt+="<A href="+u_x+" class="+ddt+" style=\"visibility:visible;\" >";
			}
			else
			{
				//bt+="<DIV class="+ddt+">";
				if(i>=(vn-2))
				{
					bt+="<A href=\"http://www.irisize.com\" target=\"_blank\" class="+ddt+">";
					vcursor="hand";
				}
				else{bt+="<A href="+u_x+" class="+ddt+">";}
			}



			bt+="<img border=0 style=\"top:"+t+"px;cursor:"+vcursor+";visibility:visible;"+p_a+"width:"+tw_w+"px;height:"+tw_h+"px;\" src=\""+tc+""+t_p+"\">";

			if(i == 0)
			{
				//sm_filename = image_array[0];
				sm_filename = thumb_array[0];
				//sm_filename = sm_filename.replace(".jpg","s.jpg");
				//sm_filename = sm_filename.replace(".Jpg","s.Jpg");
				bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+sm_filename+"\">";
			}
			else
			{
				bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";
			}

			bt+="</A>";

			//bt+="</DIV>";

			t+=tw_h;

			if(up == 1)
			{
				top_ia = top_ia - top_ia_move;
			}
			else
			{
				top_ia = 0;
			}
		}

		t=t-3;

		if(up == 1)
		{
			top_ia = top_ia + top_ia_move;
		}

		ac = 0;

		//MEASURE

		//bt+="<DIV class="+ddt+">";
		bt+="<A href="+u_x+" class="+ddt+">";
		bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+(image_array[0])+"\">";

		if(measure_array != null)
		{
			for(var ii=1;ii<=image_number;ii++)
			{
				var xi = ii - 1;
				if(measure_array[1] != null && measure_array[1] != "")
				{
					if(measure_array[2] != "") hp_x = measure_array[2]*1;
					else hp_x = 0;

					if(measure_array[3] != "") hx_x = measure_array[3]*1;
					else hx_x = 0;

					if(measure_array[4] != "") hy_x = measure_array[4]*1;
					else hy_x = 0;

					he_x = measure_array[5];
					if(he_x == null || he_x == "undefined") he_x = "";

					hu_x = measure_array[6];
					if(hu_x == null || hu_x == "undefined") hu_x = "";

					if(measure_array[7] != "") vp_x = measure_array[7]*1;
					else vp_x = 0;

					if(measure_array[8] != "") vx_x = measure_array[8]*1;
					else vx_x = 0;

					if(measure_array[9] != "") vy_x = measure_array[9]*1;
					else vy_x = 0;

					ve_x = measure_array[10];
					if(ve_x == null || ve_x == "") ve_x = "";

					vu_x = measure_array[11];
					if(vu_x == null || vu_x == "") vu_x = "";
				}
				else
				{
					hp_x = 0;
					he_x = "";
					hu_x = "";
					hx_x = 0;
					hy_x = 0;
					vp_x = 0;
					ve_x = "";
					vu_x = "";
					vx_x = 0;
					vy_x = 0;
				}

				hx_x = (hx_x*1)+tw_l;
				hy_x = (hy_x-top_ia_move_end);
				var hx_t = hx_x + (hp_x/2);
				var hy_t = (hy_x*1) + 4;
				var h_text = he_x  + " " + hu_x;
				var h_tn = h_text.length*4/2;
				hx_t = hx_t - h_tn;

				vx_x = (vx_x*1)+tw_l;
				vy_x = (vy_x-top_ia_move_end);

				var vx_x1 = vx_x - 1;
				var vx_t = (vx_x*1) + 4;
				var vy_t = (vy_x*1) + (vp_x/2) - 4;
				var v_text = ve_x  + " " + vu_x;
				var vy_x2 = (vy_x*1) + (vp_x*1);

				var hhh=0;
				var vvv=0;

				if(hp_x != 0  && he_x != null && he_x != "undefined" && he_x !="")
				{
					hhh = 1;
				}
				if(vp_x != 0 && ve_x != null && ve_x != "undefined" && ve_x !="")
				{
					vvv = 1;
				}
				if(hhh == 1 || vvv == 1)
				{
					//bt+="<img border=0 src=\""+tc+""+bam_zb+"\" style=\"top:"+t+"px;left:0px;visibility:visible;"+p_a+"cursor:crosshair;\">";
					bt+="<img border=0 src=\""+tc+""+bam_zb+"\" style=\"top:"+t+"px;left:"+left_2D+"px;visibility:visible;"+p_a+"cursor:crosshair;\">";

					//t=t+11;
					t=t+t_m_2D;
					//ac=2;
				}
				if(hp_x != 0 && he_x != null && he_x != "undefined" && he_x !="")
				{
					bt+="<span style=\"width:"+(hp_x+4)+"px;"+p_a+"left:"+(hx_x)+"px;top:"+hy_x+"px;color:red;text-decoration:none;\"><img align=middle border=0 src=\""+tc+""+redpixel+"\" width=\"2\" height=\"4\"><img align=middle border=0 src=\""+tc+""+redpixel+"\" width=\""+hp_x+"\" height=\"2\"><img align=middle border=\"0\" src=\""+tc+""+redpixel+"\" width=\"2\" height=\"4\"></span>";
					bt+="<span style=\""+p_a+"left:"+(hx_t)+"px;top:"+hy_t+"px;color:red;text-decoration:none;font-family:arial;font-size:12px;\">"+h_text+"</span>";
				}
				if(vp_x != 0 && ve_x != null && ve_x != "undefined" && ve_x !="")
				{
					bt+="<img style=\""+p_a+"left:"+vx_x1+"px;top:"+vy_x+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=4 height=2><img style=\""+p_a+"left:"+vx_x+"px;top:"+vy_x+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=2 height="+vp_x+"><img style=\""+p_a+"left:"+vx_x1+"px;top:"+(vy_x2)+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=4 height=2>";
					bt+="<span valign=top align=left style=\""+p_a+"left:"+vx_t+"px;top:"+vy_t+"px;color:red;text-decoration:none;font-family:arial;font-size:12px;width:"+(h_tn*3)+"px;\">"+v_text+"</span>";
				}
			}
		}
		bt+="</A>";
		//bt+="</DIV>";

		//PUT IN THE COLOR CONTROL PAD MENU

		if(color_array.length > 0 && color_array != null)
		{
			///bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
			///bt+="<A href="+u_x+">";
			//bt+="<img border=0 style=\"top:"+t+"px;left:0px;visibility:visible;"+p_a+"width:"+tw_w+"px;height:"+control_color_2Db_h+"px;cursor:crosshair;\" src=\""+tc+""+control_color_2Db+"\">";
			bt+="<img border=0 style=\"top:"+t+"px;left:"+left_2D+"px;visibility:visible;"+p_a+"width:"+(tw_w-left_2D)+"px;height:"+control_color_2Db_h+"px;cursor:crosshair;\" src=\""+tc+""+control_color_2Db+"\">";
			///bt+="</A>";
			///bt+="</DIV>";
			//ac = 24;
			ac = t_m_2D;
		}

		//PUT IN THE HOTSPOTS CONTROL PAD MENU

		if(hotspot_array != null)
		{
			if(hotspot_array[0]!= null)
			{
				var i=0;
				while(i<hotspot_array.length)
				{
					i=i+2;
					hot_x= hotspot_array[i]*1;

					i++;

					hot_y = hotspot_array[i]*1;

					i++;

					if(hotspot_array[i] != null && hotspot_array[i] != "")
					{
						hot_t = hotspot_array[i];
					}
					else
					{
						hot_t = "";
					}
					i++;

					if(hot_x != 0)
					{
						if(hot_t != "")
						{
							if(hot_t != "" && hot_t != null && hot_t != "undefined")
							{
								pnm = 1;
							}
							ih+=tw_ht;
						}
					}
				}
			}

			if(pnm == 1)
			{
				///bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
				///bt+="<A href="+u_x+">";
				//bt+="<img border=0 style=\"top:"+(t*1+ac)+"px;left:0px;visibility:visible;"+p_a+"width:"+tw_w+"px;height"+control_hotspots_2Db_h+":px;cursor:crosshair;\" src=\""+tc+""+control_hotspots_2Db+"\">";
				bt+="<img border=0 style=\"top:"+(t*1+ac)+"px;left:"+left_2D+"px;visibility:visible;"+p_a+"width:"+(tw_w-left_2D)+"px;height"+control_hotspots_2Db_h+":px;cursor:crosshair;\" src=\""+tc+""+control_hotspots_2Db+"\">";
				///bt+="</A>";
				///bt+="</DIV>";
			}
		}

		//BACKGROUND TO COLOR AND HOTSPOTS COMBINED

		///bt+="<DIV class="+ddt+">";
		bt+="<A href="+u_x+" class="+ddt+">";
		bt+="<img border=0 style=\"top:"+t+"px;left:0px;visibility:visible;"+p_a+"width:"+tw_w+"px;height:54px;cursor:crosshair;\" src=\""+tc+""+t_p+"\">";
		bt+="<img border=0 style=\"top:"+(t*1+48)+"px;"+p_a+"width:144px;height:500px;\" src=\""+tc+""+t_p+"\">";
		bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";

		bt+="</A>";
		///bt+="</DIV>";

		//COLOR

		if(color_array != null && color_array[0] != "" && color_array[0] != "undefined")
		{
			var ic = 0;
			var cx = 0;
			var pnc = 0;
			while(ic < in_color-1)
			{
				ic++;
				///bt+="<DIV class="+ddt+">";
				bt+="<A href="+u_x+" class="+ddt+">";
				if(color_array[ic].indexOf('.')<0 || color_array[ic].indexOf('#')>1)
				{
					bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background:"+color_array[ic]+";top:"+(t*1+3)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:"+t_c_w_2D+"px;height:"+(tw_h-2)+"px;cursor:crosshair;\">";
				}
				else
				{
					bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background-image:url("+color_array[ic]+");top:"+(t*1+3)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:"+t_c_w_2D+"px;height:"+(tw_h-2)+"px;cursor:crosshair;\">";
				}

				cx+=t_c_w_2D;
				ic++;

				bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+color_array[ic]+ext+"\">";

				ic++;
				bt+="</A>";
				//bt+="</DIV>";

				pnc = 1;
			}
			if(pnc==1)
			{
				//t=t+24;
				t=t+t_m_2D;
			}

		}

		//HOTSPOTS

		if(hotspot_array != null)
		{
			if(hotspot_array[0] != null && hotspot_array[0] != ""  && hotspot_array[0] != "undefined")
			{
				var i=0;
				ih=0;
				pnm=0;
				while(i<hotspot_array.length-1)
				{
					i=i+2;
					hot_x= hotspot_array[i]*1;

					i++;

					hot_y = hotspot_array[i]*1;

					i++;

					if(hotspot_array[i] != null && hotspot_array[i] != "")
					{
						hot_t = hotspot_array[i];
					}
					else
					{
						hot_t = "";
					}

					i++;


					if(hot_x != 0)
					{
						if(hot_t != "")
						{
							hot_x = hot_x*1+tw_l;
							hot_y = hot_y*1-top_ia_move_end;

							//bt+="<DIV class="+ddt+">";
							bt+="<A href="+u_x+" class="+ddt+">";
							bt+="<img border=0 style=\"top:"+t+"px;left:"+ih+"px;"+p_a+"width:244px;height:130px;\" src=\""+tc+""+t_p+"\">";
							bt+="<img border=0 src=\""+tc+""+hss_1+"\" style=\"top:"+(t+3)+"px;left:"+ih+"px;visibility:visible;"+p_a+"cursor:crosshair;\">";
							bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";



							bt+="<img  style=\""+p_a+"top:"+(hot_y-18)+"px;left:"+(hot_x-9)+"px;\" border=0 src=\""+tc+""+hss_1_large_h+"\">";
							bt+="<span style=\""+p_a+"top:"+(hot_y-18)+"px;left:"+(hot_x+19)+"px;\">";
							bt+="<div valign=top align=center style=\"border:2px solid black;background-color:white;cursor:hand;padding:3px;\">";
							if(hot_t != "" && hot_t != null && hot_t != "undefined")
							{
								bt+="<table cellpadding=0 cellspacing=0><tr><td align=center><font style=\"font-family:arial;font-size:12px;\">"+URLDecode(hot_t)+"</font></td></tr></table>";
								pnm = 1;
							}
							bt+="</div>";
							bt+="</span>";

							bt+="</A>";
							//bt+="</DIV>";
							ih+=tw_ht;
						}
					}
				}
			}

			if(pnm == 1)
			{
				t=t+t_m_2D;
			}
		}

		//INFO

		if(info_array != null)
		{
			if(info_array[0] != null && info_array[0] != "" && info_array[0] != "undefined")
			{
				itop=t;
				var i=0;
				while(i < info_array.length)
				{
					i++;
					///bt+="<DIV class=i"+ddt+">";
					bt+="<A href="+u_x+" class=i"+ddt+">";
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";

					bt+="<img border=0 style=\"left:"+left_2D+"px;top:"+(itop)+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+control_color_2Db+"\">";
					bt+="<span style=\"overflow:hidden;left:0px;top:"+itop+"px;width:34px;height:24px;padding:0px;font-family:arial;font-size:10px;font-weight:normal;"+p_a+" visibility:visible;text-decoration:none;cursor:default;text-align:center\">"+info_array[i]+"</span>";
					bt+="<img  style=\""+p_a+"left:50px;top:"+itop+"px;\" src=\""+tc+""+t_p+"\" width=10 height=20 border=0>";
					bt+="<span style=\"overflow:hidden;top:0px;left:190px;width:300px;height:160px;padding:3px;border: black 1px solid;text-decoration:none;text-align:center;color: black;background:white;"+p_a+"\"><center><table><tr><td><pre><font face=\"arial\">";

					i++;

					bt+=URLDecode(info_array[i]);
					bt+="</font></pre></td></tr></table></center></span>";
					bt+="</A>";
					///bt+="</DIV>";

					i++;
					itop+=t_m_2D;
				}
			}
		}

		if(buystring != null && buystring != "")
		{
				if(itop==0)itop=t;
				bt+="<A href="+buystring+" class=i"+ddt+">";
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+tw_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";
					bt+="<img border=0 style=\"left:"+(left_2D+1)+"px;top:"+(itop)+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+control_buy_2D+"\">";
				bt+="</A>";

		}

		bt+="</div>";
		bt+="</div>";

	}//END of image 1
	else if(image_number > 1)
	{
		var div_position = 0;
		if(v_y == 1)
		{
			div_position = (Actual_Height*1)+300;
		}
		else if(Starting_Height > 300)
		{
			div_position = Starting_Height;
		}
		else
		{
			div_position = 300;
		}


		//bt="<STYLE type=text/css>."+ddt+"{visibility:hidden;}."+ddt+"A:hover{visibility:visible;}.i"+ddt+" A:visited{visibility:hidden;color:#666666;display:block;background:#CCCCCC;}.i"+ddt+"{visibility:hidden;color:white;background:#CCCCCC;display:block;}.i"+ddt+" A{color:#666666;display:block; background:#CCCCCC;text-decoration:none;font-size:12px;}.i"+ddt+" A:hover{visibility:visible;color:black; background:#CCCCCC;display:block;}</STYLE>";
		bt="<STYLE type=text/css>."+ddt+"{visibility:hidden;} a."+ddt+":hover{visibility:visible;}.i"+ddt+"{text-decoration:none;visibility:hidden;color:#666666;background:#CCCCCC;display:block;}a.i"+ddt+":hover{visibility:visible;color:black; background:#CCCCCC;display:block;}</STYLE>";


		bt+="<div style=\"height:"+div_position+"px; width:"+div_pos_w+"px; position:relative; left:-"+left_3D+"px;\">";
		bt+="<div style=\""+p_a+"\">";

		//bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
		//bt+="<A href="+u_x+">";
		bt+="<img border=0 style=\"left:"+left_3D+"px;top:0px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_top_3D+"\">";
		//bt+="</A>";
		//bt+="</DIV>";

		//**START OF SETTING UP 3D CONTROL PAD

		var t=0;
		var l=0;

		var l_add=th_l/(image_array.length-1);

		for(var i=1;i<=vn;i++)
		{
			t+=th_h;
		}

		//MEASURE

		if(measure_array != null)
		{
			l=0;
			var tnm = 0;
			for(var ii=0;ii<=image_number;ii++)
			{
				var xi = ii;
				var xii=-1;

				for(var mi = 0; mi<measure_array.length; mi++)
				{
					mi=mi+1;
					if((ii+1) == measure_array[mi])
					{
						xii = mi;

					}

					mi=mi+10;
				}

				if(xii != -1)
				{
					xii++;
					if(measure_array[xii] != "") hp_x = measure_array[xii]*1;
					else hp_x = 0;

					xii++;
					if(measure_array[xii] != "") hx_x = measure_array[xii]*1;
					else hx_x = 0;

					xii++;
					if(measure_array[xii] != "") hy_x = measure_array[xii]*1;
					else hy_x = 0;

					xii++;
					he_x = measure_array[xii];
					if(he_x == null || he_x == "undefined") he_x = "";

					xii++;
					hu_x = measure_array[xii];
					if(hu_x == null || hu_x == "undefined") hu_x = "";

					xii++;
					if(measure_array[xii] != "") vp_x = measure_array[xii]*1;
					else vp_x = 0;

					xii++;
					if(measure_array[xii] != "") vx_x = measure_array[xii]*1;
					else vx_x = 0;

					xii++;
					if(measure_array[xii] != "") vy_x = measure_array[xii]*1;
					else vy_x = 0;

					xii++;
					ve_x = measure_array[xii];
					if(ve_x == null || ve_x == "") ve_x = "";

					xii++;
					vu_x = measure_array[xii];
					if(vu_x == null || vu_x == "") vu_x = "";

				}
				else
				{
					hp_x = 0;
					he_x = "";
					hu_x = "";
					hx_x = 0;
					hy_x = 0;
					vp_x = 0;
					ve_x = "";
					vu_x = "";
					vx_x = 0;
					vy_x = 0;
				}

				hx_x = (hx_x*1)+th_l;
				hy_x = (hy_x-top_ia_move_end);
				var hx_t = hx_x + (hp_x/2);
				var hy_t = (hy_x*1) + 4;
				var h_text = he_x  + " " + hu_x;
				var h_tn = h_text.length*4/2;
				hx_t = hx_t - h_tn;

				vx_x = (vx_x*1)+th_l;
				vy_x = vy_x-top_ia_move_end;
				var vx_x1 = vx_x - 1;
				var vx_t = (vx_x*1) + 4;
				var vy_t = (vy_x*1) + (vp_x/2) - 4;
				var v_text = ve_x  + " " + vu_x;
				var vy_x2 = (vy_x*1) + (vp_x*1);

				if((hp_x != 0  && he_x != null && he_x != "undefined" && he_x !="")||(vp_x != 0  && ve_x != null && ve_x != "undefined" && ve_x !=""))
				{
					if(tnm == 0)
					{
						bt+="<img border=0 style=\"left:"+left_3D+"px;top:"+t+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_measure_3D+"\">";
						tnm = 1;
					}
				}
			}
			if(tnm == 1)
			{
				t = t + t_m_3D;
			}
		}

		//COLOR
		if(color_array[0] != "" && color_array[0] != "undefined")
		{
			var tnc = 0;

			var ic = 0;
			var cx = 0;
			var tx = t+1;

			for(var i=0;i<in_color;i++)
			{
				if(tnc == 0)
				{
					bt+="<img border=0 style=\"left:"+left_3D+"px;top:"+t+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_color_3D+"\">";
					tnc = 1;
				}
			}

			if(tnc == 1)
			{
				t=t+t_c_3D;
			}
		}

		if(hotspot_array != null)
		{
			var tnh = 0;

			if(hotspot_array[0]!= null)
			{

				var i=0;
				ih=0;

				var mm=0;
				while(i<hotspot_array.length)
				{
					i=i+2;
					hot_x= hotspot_array[i]*1;

					i++;

					hot_y = hotspot_array[i]*1;

					i++;
					if(hotspot_array[i] != null && hotspot_array[i] != "")
					{
						hot_t = hotspot_array[i];
					}
					else
					{
						hot_t = "";
					}
					i++;

					if(hot_x != 0)
					{
						if(hot_t != "")
						{
							if(tnh == 0)
							{
								//bt+="<img border=0 style=\"width:"+(-left_3D*1+th_l*1)+"px; height:"+t_h_3D+";left:"+left_3D+"px;top:"+t+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_hotspots_3D+"\">";
								bt+="<img border=0 style=\"left:"+left_3D+"px;top:"+t+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_hotspots_3D+"\">";
								tnh = 1;
							}
						}
					}
					ih+=l_add;
					mm++;
				}
			}
			if(tnh == 1)
			{
				t=t+t_h_3D;
			}
		}

		//END OF SETTING UP 3D CONTROL PAD

		t=0;
		l=0;
		l_add=(th_l-12)/(image_array.length);

		for(var i=0;i<vn;i++)
		{
			wx=parseInt(wArray[i]);
			hx=parseInt(hArray[i]);

			l=0;

			for(var ii=0;ii<(image_array.length);ii++)
			{
				/**
				if(i==0 && ii==0)
				{
					bt+="<DIV style=\"visibility:visible;\" class="+ddt+">";
				}
				else
				{
					bt+="<DIV class="+ddt+">";
				}
				**/

				vcursor = "crosshair";
				if(i==(vn-1) && (ii >= (image_array.length/3) && ii <= (image_array.length*2/3)))
				{
					bt+="<A href=\"http://www.irisize.com\" target=\"_blank\" class=\""+ddt+"\">";
					vcursor="hand";

				}
				else
				{
					bt+="<A href="+u_x+" class=\""+ddt+"\">";
					//alert("<A href="+u_x+" class="+ddt+">");
				}


				if(ii==image_array.length-1)
				bt+="<img border=0 style=\"top:"+t+"px;left:"+l+"px;cursor:"+vcursor+";visibility:visible;"+p_a+"width:"+((l_add)+2+12)+"px;height:"+th_h+"px;\" src=\""+tc+""+t_p+"\">";
				else
				bt+="<img border=0 style=\"top:"+t+"px;left:"+l+"px;cursor:"+vcursor+";visibility:visible;"+p_a+"width:"+((l_add)+2)+"px;height:"+th_h+"px;\" src=\""+tc+""+t_p+"\">";


				if(i==0 && ii==0)
				{
					var sm_filename = thumb_array[0];
					//sm_filename = sm_filename.replace(".jpg","s.jpg");
					//sm_filename = sm_filename.replace(".Jpg","s.Jpg");

					bt+="<img border=0 style=\"visibility:visible; width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+sm_filename+"\">";
				}
				else
				{
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[ii]+"\">";
				}
				bt+="</A>";

				/**
				bt+="</DIV>";
				**/

				l+=l_add;
			}

			t+=th_h;

			if(up == 1)
			{
				top_ia = top_ia - top_ia_move;
			}
			else
			{
				top_ia = 0;
			}
		}


		if(up == 1)
		{
			top_ia = top_ia + top_ia_move;
		}
		l=0;
		for(var ii=0;ii<(image_array.length);ii++)
		{
			//bt+="<DIV class="+ddt+">";

			//bt+="<A href="+u_x+">";
			bt+="<A href="+u_x+" class="+ddt+">";

			if(ii==image_array.length-1)
			bt+="<img border=0 style=\"top:"+t+"px;left:"+l+"px;cursor:crosshair;visibility:visible;"+p_a+"width:"+((l_add)+2+12)+"px;height:158px;cursor:crosshair;\" src=\""+tc+""+t_p+"\">";
			else
			bt+="<img border=0 style=\"top:"+t+"px;left:"+l+"px;cursor:crosshair;visibility:visible;"+p_a+"width:"+((l_add)+2)+"px;height:158px;cursor:crosshair;\" src=\""+tc+""+t_p+"\">";

			bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[ii]+"\">";
			bt+="</A>";
			//bt+="</DIV>";
			l+=l_add;
		}


		//MEASURE

		if(measure_array != null)
		{
			l=0;
			var tnm = 0;
			for(var ii=0;ii<image_number;ii++)
			{
				var xi = ii;
				var xii=-1;
				for(var mi = 0; mi<measure_array.length; mi++)
				{
					mi=mi+1;
					if((ii+1) == measure_array[mi])
					{
						xii = mi;

					}

					mi=mi+10;

				}
				if(xii != -1)
				{
					xii++;
					if(measure_array[xii] != "") hp_x = measure_array[xii]*1;
					else hp_x = 0;

					xii++;
					if(measure_array[xii] != "") hx_x = measure_array[xii]*1;
					else hx_x = 0;

					xii++;
					if(measure_array[xii] != "") hy_x = measure_array[xii]*1;
					else hy_x = 0;

					xii++;
					he_x = measure_array[xii];
					if(he_x == null || he_x == "undefined") he_x = "";

					xii++;
					hu_x = measure_array[xii];
					if(hu_x == null || hu_x == "undefined") hu_x = "";

					xii++;
					if(measure_array[xii] != "") vp_x = measure_array[xii]*1;
					else vp_x = 0;

					xii++;
					if(measure_array[xii] != "") vx_x = measure_array[xii]*1;
					else vx_x = 0;

					xii++;
					if(measure_array[xii] != "") vy_x = measure_array[xii]*1;
					else vy_x = 0;

					xii++;
					ve_x = measure_array[xii];
					if(ve_x == null || ve_x == "") ve_x = "";

					xii++;
					vu_x = measure_array[xii];
					if(vu_x == null || vu_x == "") vu_x = "";
				}
				else
				{
					hp_x = 0;
					he_x = "";
					hu_x = "";
					hx_x = 0;
					hy_x = 0;
					vp_x = 0;
					ve_x = "";
					vu_x = "";
					vx_x = 0;
					vy_x = 0;
				}

				hx_x = (hx_x*1)+th_l;
				hy_x = (hy_x-top_ia_move_end);
				var hx_t = hx_x + (hp_x/2);
				var hy_t = (hy_x*1) + 4;
				var h_text = he_x  + " " + hu_x;
				var h_tn = h_text.length*4/2;
				hx_t = hx_t - h_tn;

				vx_x = (vx_x*1)+th_l;
				vy_x = vy_x-top_ia_move_end;
				var vx_x1 = vx_x - 1;
				var vx_t = (vx_x*1) + 4;
				var vy_t = (vy_x*1) + (vp_x/2) - 4;
				var v_text = ve_x  + " " + vu_x;
				var vy_x2 = (vy_x*1) + (vp_x*1);

				//bt+="<DIV class="+ddt+">";
				//bt+="<A href="+u_x+">";
				bt+="<A href="+u_x+" class="+ddt+">";

				if((hp_x != 0  && he_x != null && he_x != "undefined" && he_x !="") || (vp_x != 0 && ve_x != null && ve_x != "undefined" && ve_x !=""))
				{
					if(tnm == 0)
					{
						tnm = 1;
					}
					//bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+"/"+(image_array[xi])+"\">";
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+(image_array[xi])+"\">";
					//bt+="<img border=0 src=\""+tc+""+bam_zz+"\" style=\"height:"+bam_zz_h+"px;width:"+((l_add)+1)+"px;top:"+t+"px;left:"+l+"px;visibility:visible;"+p_a+"cursor:crosshair;\">";
					bt+="<img border=0 src=\""+tc+""+bam_zz+"\" style=\"top:"+(t*1+8)+"px;left:"+l+"px;visibility:visible;"+p_a+"cursor:crosshair;\">";
				}

				if(hp_x != 0 && he_x != null && he_x != "undefined" && he_x !="")
				{
					bt+="<span style=\"width:"+(hp_x+4)+"px;"+p_a+"left:"+(hx_x)+"px;top:"+(hy_x-4)+"px;color:red;text-decoration:none;\"><img align=middle border=0 src=\""+tc+""+redpixel+"\" width=\"2\" height=\"4\"><img align=middle border=0 src=\""+tc+""+redpixel+"\" width=\""+hp_x+"\" height=\"2\"><img align=middle border=\"0\" src=\""+tc+""+redpixel+"\" width=\"2\" height=\"4\"></span>";
					bt+="<span style=\""+p_a+"left:"+(hx_t)+"px;top:"+hy_t+"px;color:red;text-decoration:none;font-family:arial;font-size:12px;width:"+(h_tn*3)+"px;\">"+h_text+"</span>";
				}
				if(vp_x != 0 && ve_x != null && ve_x != "undefined" && ve_x !="")
				{
					bt+="<img style=\""+p_a+"left:"+vx_x1+"px;top:"+vy_x+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=4 height=2><img style=\""+p_a+"left:"+vx_x+"px;top:"+vy_x+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=2 height="+vp_x+"><img style=\""+p_a+"left:"+vx_x1+"px;top:"+(vy_x2)+"px;\" align=middle border=0 src=\""+tc+""+redpixel+"\" width=4 height=2>";
					bt+="<span valign=top align=left style=\""+p_a+"left:"+vx_t+"px;top:"+vy_t+"px;color:red;text-decoration:none;font-family:arial;font-size:12px;\">"+v_text+"</span>";
				}

				bt+="</A>";
				//bt+="</DIV>";

				l+=l_add;
			}
			if(tnm == 1)
			{
				t = t + t_m_3D;
			}
		}


		//COLOR
		if(color_array[0] != "" && color_array[0] != "undefined")
		{
			var tnc = 0;
			var ic = 0;
			var co = 0;
			var cx = 0;
			var tx = t+1;
			var icx = 1;

		//	for(ic=0;ic<in_color;ic++)
		//	{
		//
		//		if(co==(image_number+2))
		//		{
		//			co=0;
		//			cx=0;
		//			tx+=6;
		//		}
		//
		//		if(co==0)
		//		{
		//			co=2;
		//			ic++;
		//			icx=ic;
		//			ic++;
		//		}
		//		if(tnc == 0)
		//		{
		//			tnc = 1;
		//		}
		//		bt+="<DIV class="+ddt+">";
		//		bt+="<A href="+u_x+">";
		//		bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background:"+color_array[icx]+";top:"+tx+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:"+(((th_l)/(image_number))+1)+"px;height:6px;cursor:crosshair;\">";
		//		cx=cx+l_add;
		//		bt+="<img border=0 style=\"top:200px;"+p_a+"width:"+th_l+"px;height:500px;\" src=\""+tc+""+t_p+"\">";
		//		bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+color_array[ic]+ext+"\">";
		//		co++;

		//		bt+="</A>";
		//		bt+="</DIV>";
		//	}


		//	if(tnc == 1)
		//	{
		//		t=t+t_c_3D;
		//	}



			var ic = 0;
			var cx = 0;
			var pnc = 0;
			while(ic < in_color-1)
			{
				ic++;
				//bt+="<DIV class="+ddt+">";
				//bt+="<A href="+u_x+">";
				bt+="<A href="+u_x+" class="+ddt+">";
				//bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background:"+color_array[ic]+";top:"+(t*1+8)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:13px;height:"+(tw_h/2)+"px;cursor:crosshair;\">";

				if(color_array[ic].indexOf('.')<0 || color_array[ic].indexOf('#')>1)
				{
					bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background-color:"+color_array[ic]+";top:"+(t*1+3)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:13px;height:"+(tw_h/2)+"px;cursor:crosshair;\">";
				}
				else
				{
					bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background-image:url("+color_array[ic]+");top:"+(t*1+3)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:13px;height:"+(tw_h/2)+"px;cursor:crosshair;\">";
				}

				//bt+="<img border=0 src=\""+tc+""+t_p+"\" style=\"background-color:"+color_array[ic]+";top:"+(t*1+5)+"px;left:"+cx+"px;visibility:visible;"+p_a+" width:13px;height:"+(tw_h/3)+"px;cursor:crosshair;\">";

				cx+=13;
				ic++;

				//bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+"/"+color_array[ic]+ext+"\">";
				bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+color_array[ic]+ext+"\">";

				ic++;
				bt+="</A>";
				//bt+="</DIV>";


				pnc = 1;
			}
			if(pnc==1)
			{
				t=t+t_c_3D;
			}


		}

		//HOTSPOTS 3D
		if(hotspot_array != null)
		{
			var tnh = 0;
			ih=0;
			for(var ia=1; ia<=image_number; ia++)
			{
				var i=0;
				var ho = 0;
				//var htop=-9;
				var htop=-3;
				for(i=0; i<hotspot_array.length; i++)
				{
					i++;

					if(hotspot_array[i] == ia)
					{
						ho = 1;
					}
					else
					{
						ho = 0;
					}

					if(ho == 1)
					{
						i++;
						hot_x= hotspot_array[i]*1;


						i++;
						hot_y = hotspot_array[i]*1;

						i++;
						if(hotspot_array[i] != null && hotspot_array[i] != "")
						{
							hot_t = hotspot_array[i];
							htop=htop+6;
						}
						else
						{
							hot_t = "";
						}




						if(hot_x != 0)
						{
							if(hot_t != "")
							{
								if(tnh == 0)
								{
									tnh = 1;
								}

								hot_x = hot_x*1+th_l;
								hot_y = hot_y*1-top_ia_move_end;
								//bt+="<DIV class="+ddt+">";
								//bt+="<A href="+u_x+">";
								bt+="<A href="+u_x+" class="+ddt+">";
								bt+="<img border=0 style=\"top:"+(t+htop)+"px;left:"+ih+"px;"+p_a+"width:249px;height:140px;\" src=\""+tc+""+t_p+"\">";
								bt+="<img border=0 src=\""+tc+""+hss_1+"\" style=\"top:"+(t+htop)+"px;left:"+ih+"px;visibility:visible;"+p_a+"cursor:crosshair;\">";
								bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[(ia-1)]+"\">";

								bt+="<img  style=\""+p_a+"top:"+(hot_y-18)+"px;left:"+(hot_x-9)+"px;\" border=0 src=\""+tc+""+hss_1_large_h+"\">";
								bt+="<span style=\""+p_a+"top:"+(hot_y-18)+"px;left:"+(hot_x+19)+"px;\">";
								bt+="<div align=center style=\"border:2px solid black;background-color:white;cursor:hand;padding:3px;\">";


								if(hot_t != "" && hot_t != null && hot_t != "undefined")
									bt+="<table cellpadding=0 cellspacing=0><tr><td align=center><font style=\"font-family:arial;font-size:12px;\">"+URLDecode(hot_t)+"</font></td></tr></table>";
								bt+="</div>";
								bt+="</span>";

								bt+="</A>";
								//bt+="</DIV>";


							}
						}
					}
					else
					{
						i=i+3;
					}
				}
				ih+=l_add;
			}

			if(tnh == 1)
			{
				t=t+t_h_3D;
			}

		}

		if(info_array != null)
		{
			if(info_array[0] != null && info_array[0] != "" && info_array[0] != "undefined")
			{
				itop=t;

				var i=0;

				while(i < info_array.length)
				{
					i++;
					//bt+="<DIV class=i"+ddt+">";
					bt+="<A href="+u_x+" class=i"+ddt+">";
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";

					bt+="<img border=0 style=\"left:"+left_3D+"px;top:"+(itop)+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+controls_color_3D+"\">";
					bt+="<span style=\"overflow:hidden;left:-5px;top:"+itop+"px;width:80px;height:24px;padding:2px;font-family:verdana;font-size:10px;font-weight:normal;"+p_a+" visibility:visible;text-decoration:none;text-align:center;cursor:default;\">"+info_array[i]+"</span>";
					bt+="<img  style=\""+p_a+"left:50px;top:"+(t+85)+"px;\" src=\""+tc+""+t_p+"\" width="+th_l+" height=90 border=0>";
					bt+="<span style=\"overflow:hidden;top:0px;left:290px;width:300px;height:160px;padding:3px;border: black 1px solid;text-decoration:none;color: black;background:white;"+p_a+"\"><center><table><tr><td><pre><font face=\"arial\">";

					i++;


					var temp_bt = URLDecode(info_array[i]);
					temp_bt = temp_bt.replace("vi_quote","'");
					temp_bt = temp_bt.replace("vi_dquote","\"");

					bt+= temp_bt;

					bt+="</font></pre></td></tr></table></center></span>";
					bt+="</A>";
					//bt+="</DIV>";

					i++;

					itop+=t_i_3D;
				}
			}
		}

		if(buystring != null && buystring != "")
		{
				if(itop==0)itop=t;
				bt+="<A href="+buystring+" class=i"+ddt+">";
					bt+="<img border=0 style=\"width:"+(wx)+"px;height:"+(hx)+"px;left:"+th_l+"px;top:"+(top_ia)+"px;"+p_a+"\" src=\""+u_u+d_dir+fsl+image_array[0]+"\">";
					bt+="<img border=0 style=\"left:"+(left_3D)+"px;top:"+(itop)+"px;visibility:visible;"+p_a+"\" src=\""+tc+""+control_buy_3D+"\">";
				bt+="</A>";

		}



		bt+="</div>";
		bt+="</div>";
	}
	return bt;
}


function URLDecode(str)
{
   var HEXCHARS = "0123456789ABCDEFabcdef";
   var encoded = str;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2)
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( "Bad escape combination near ..." + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	}
   return plaintext;
};