xmlDoc=loadXMLDoc('catalogue.xml');

var pg_num_arr;
var pg_num_divid;
var no_of_pgs;
var pg_id;
function show(param1,param2)
{
	pg_num_arr=new Array();
	pg_num_divid=new Array();
	pg_id=new Array();
	frm=document.frm1;
	var str='';
	x=xmlDoc.getElementsByTagName("reward");
	x2=xmlDoc.getElementsByTagName("bonuspartner");
	
	//alert(document.getElementById('categ'));
	//alert(xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue)
	if (param1=='rewards_cat')
	{
		
		var max=0;
		for (i=0;i<x.length;i++)
		{
			txt=xmlDoc.getElementsByTagName("reward")[i].getAttribute("category");
			txt1=xmlDoc.getElementsByTagName("reward")[i].getAttribute("pointrange");
			//alert(txt+", "+txt1)
			if (frm.categ.selectedIndex!=0 && frm.points.selectedIndex==0)
			{
				if (frm.categ.options[frm.categ.selectedIndex].value==txt)
				{
					max++;
				}
			}
			if (frm.categ.selectedIndex==0 && frm.points.selectedIndex!=0)
			{
				if (frm.points.options[frm.points.selectedIndex].value==txt1)
				{
					max++;
				}
			}
			if (frm.categ.selectedIndex!=0 && frm.points.selectedIndex!=0)
			{
				if (frm.categ.options[frm.categ.selectedIndex].value==txt && frm.points.options[frm.points.selectedIndex].value==txt1)
				{
					max++;
				}
			}
			if (frm.categ.selectedIndex==1 && frm.points.selectedIndex!=0)
			{
				if (frm.points.options[frm.points.selectedIndex].value==txt1)
				{
					max++;
				}
			}
			if (frm.categ.selectedIndex==1 && frm.points.selectedIndex==0)
			{
					max++;
			}
		}
		//alert(max);
		no_of_pgs=Math.ceil(max/10);
		//alert(no_of_pgs)
		if(no_of_pgs!=0)
		{


			str='<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr valign="top"><td style="background-image: url(\'images/tab_left_mid_bg.gif\');"><img src="images/tab_top_left_cur.gif" border="0" alt=""></td><td valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td colspan="15"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="1%" style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td width="3%" style="background-image: url(\'images/tab_top_mid_bg.gif\');" align="center" class="leftnavhd"><b>Code</b></td><td colspan="2" width="1%" style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td width="480" style="background-image: url(\'images/tab_top_mid_bg.gif\');" height="30" colspan="2" class="leftnavhd" align="center"><b>Item</b></td><td colspan="2" style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td width="10%" style="background-image: url(\'images/tab_top_mid_bg.gif\');" class="leftnavhd" align="center"><b>Points</b></td><td colspan="2" style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg.gif\');" align="center" class="leftnavhd"><img src="images/charge_plus1.gif" width="17" height="17" border="0" alt="" align="absmiddle">&nbsp;<b>Charge</b></td><td style="background-image: url(\'images/tab_top_mid_bg.gif\');" width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

			//str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

			str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td width="1" valign="top"></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td width="1" valign="top"></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td width="1" valign="top"></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

			pg_num=1;
			count=1;
			prevcount='';
			preloadimg='';
			for (i=0;i<x.length;i++)
			{
				txt=xmlDoc.getElementsByTagName("reward")[i].getAttribute("category");
				txt1=xmlDoc.getElementsByTagName("reward")[i].getAttribute("pointrange");
				//alert(txt1+", "+frm.points.options[frm.points.selectedIndex].value)
				//alert(txt+", "+frm.categ.options[frm.categ.selectedIndex].value)

				if (frm.categ.selectedIndex!=0 && frm.points.selectedIndex==0)
				{
					if (frm.categ.options[frm.categ.selectedIndex].value==txt && count<=10)
					{
						if (pg_num==1)
						{
							disp=' style="display:;';
						}
						else
						{
							disp=' style="display:none;';
						}
						if (count==1)
						{
							//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
							str+='<tr id="item_pg'+pg_num+'"'+disp+'"><td colspan="16"><table cellpadding="0" cellspacing="0" border="0">';
						}
						v1=xmlDoc.getElementsByTagName("code")[i].childNodes[0].nodeValue;
						img_icon=xmlDoc.getElementsByTagName("productimage")[i].childNodes[0].nodeValue;
						v2=xmlDoc.getElementsByTagName("product")[i].childNodes[0].nodeValue;
						v3=xmlDoc.getElementsByTagName("points")[i].childNodes[0].nodeValue;
						v4=xmlDoc.getElementsByTagName("charge")[i].childNodes[0].nodeValue;
						//alert(img_icon);
						str+='<tr valign="top"><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td class="bodytxt3" width="26"><b>'+v1+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" width="415">'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="72"><b>'+v3+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="58"><b>'+v4+'</b></td><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

						str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';
						//preloadimg+="'images/"+v1+".gif',";
						//alert(str);
						//alert(count);
						count++;
					}
				}
				if (frm.categ.selectedIndex==0 && frm.points.selectedIndex!=0)
				{
					if (frm.points.options[frm.points.selectedIndex].value==txt1 && count<=10)
					{
				//alert(count)
						if (pg_num==1)
						{
							disp=' style="display:;';
						}
						else
						{
							disp=' style="display:none;';
						}
						if (count==1)
						{
							//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
							str+='<tr id="item_pg'+pg_num+'"'+disp+'"><td colspan="16"><table cellpadding="0" cellspacing="0" border="0">';
						}
						v1=xmlDoc.getElementsByTagName("code")[i].childNodes[0].nodeValue;
						img_icon=xmlDoc.getElementsByTagName("productimage")[i].childNodes[0].nodeValue;
						v2=xmlDoc.getElementsByTagName("product")[i].childNodes[0].nodeValue;
						v3=xmlDoc.getElementsByTagName("points")[i].childNodes[0].nodeValue;
						v4=xmlDoc.getElementsByTagName("charge")[i].childNodes[0].nodeValue;
						str+='<tr valign="top"><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td class="bodytxt3" width="26"><b>'+v1+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" width="415">'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="72"><b>'+v3+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="58"><b>'+v4+'</b></td><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

						str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';
						//preloadimg+="'images/"+v1+".gif',";
						//alert(str);
						//alert(count);
						count++;
					}
				}
				if (frm.categ.selectedIndex!=0 && frm.points.selectedIndex!=0)
				{
					if (frm.categ.options[frm.categ.selectedIndex].value==txt && frm.points.options[frm.points.selectedIndex].value==txt1 && count<=10)
					{
						if (pg_num==1)
						{
							disp=' style="display:;';
						}
						else
						{
							disp=' style="display:none;';
						}
						if (count==1)
						{
							//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
							str+='<tr id="item_pg'+pg_num+'"'+disp+'"><td colspan="16"><table cellpadding="0" cellspacing="0" border="0">';
						}
						v1=xmlDoc.getElementsByTagName("code")[i].childNodes[0].nodeValue;
						img_icon=xmlDoc.getElementsByTagName("productimage")[i].childNodes[0].nodeValue;
						v2=xmlDoc.getElementsByTagName("product")[i].childNodes[0].nodeValue;
						v3=xmlDoc.getElementsByTagName("points")[i].childNodes[0].nodeValue;
						v4=xmlDoc.getElementsByTagName("charge")[i].childNodes[0].nodeValue;
						str+='<tr valign="top"><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td class="bodytxt3" width="26"><b>'+v1+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" width="415">'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="72"><b>'+v3+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="58"><b>'+v4+'</b></td><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

						str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';
						//preloadimg+="'images/"+v1+".gif',";
						//alert(str);
						//alert(count);
						count++;
					}
				}

				//All categories
				if (frm.categ.selectedIndex==1 && frm.points.selectedIndex!=0)
				{
					if (frm.points.options[frm.points.selectedIndex].value==txt1 && count<=10)
					{
						if (pg_num==1)
						{
							disp=' style="display:;';
						}
						else
						{
							disp=' style="display:none;';
						}
						if (count==1)
						{
							//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
							str+='<tr id="item_pg'+pg_num+'"'+disp+'"><td colspan="16"><table cellpadding="0" cellspacing="0" border="0">';
						}
						v1=xmlDoc.getElementsByTagName("code")[i].childNodes[0].nodeValue;
						img_icon=xmlDoc.getElementsByTagName("productimage")[i].childNodes[0].nodeValue;
						v2=xmlDoc.getElementsByTagName("product")[i].childNodes[0].nodeValue;
						v3=xmlDoc.getElementsByTagName("points")[i].childNodes[0].nodeValue;
						v4=xmlDoc.getElementsByTagName("charge")[i].childNodes[0].nodeValue;
						str+='<tr valign="top"><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td class="bodytxt3" width="26"><b>'+v1+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" width="415">'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="72"><b>'+v3+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="58"><b>'+v4+'</b></td><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

						str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';
						//preloadimg+="'images/"+v1+".gif',";
						//alert(str);
						//alert(count);
						count++;
					}
				}

				if (frm.categ.selectedIndex==1 && frm.points.selectedIndex==0)
				{
					if (count<=10)
					{
						if (pg_num==1)
						{
							disp=' style="display:;';
						}
						else
						{
							disp=' style="display:none;';
						}
						if (count==1)
						{
							//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
							str+='<tr id="item_pg'+pg_num+'"'+disp+'"><td colspan="16"><table cellpadding="0" cellspacing="0" border="0">';
						}
						
						v1=xmlDoc.getElementsByTagName("code")[i].childNodes[0].nodeValue;
						//alert(v1);
						img_icon=xmlDoc.getElementsByTagName("productimage")[i].childNodes[0].nodeValue;
						v2=xmlDoc.getElementsByTagName("product")[i].childNodes[0].nodeValue;
						v3=xmlDoc.getElementsByTagName("points")[i].childNodes[0].nodeValue;
						v4=xmlDoc.getElementsByTagName("charge")[i].childNodes[0].nodeValue;
						//alert("v4"+v4 +" ,count"+ count)
						str+='<tr valign="top"><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td class="bodytxt3" width="26"><b>'+v1+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" width="415">'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="72"><b>'+v3+'</b></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td>';

						str+='<td class="bodytxt3" align="center" width="58"><b>'+v4+'</b></td><td width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

						str+='<tr><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td valign="top"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td style="background-image: url(\'images/dotline_v.gif\');" width="1" valign="top"><img src="images/dotline_v.gif" width="1" height="3" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td><td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';
						//preloadimg+="'images/"+v1+".gif',";
						//alert(str);
						//alert(count);
						count++;
					}
				}
				//alert("count"+count+"no_of_pgs" + no_of_pgs+" "+ "pg_num" + pg_num)
				if (count==11)
				{
				//alert(count)
					count=1;
					pg_num++;
					str+='</table></td></tr>';
				}
			}
			if (count!=11 && no_of_pgs!=(pg_num-1))
			{
				//alert("sec"+count)
				str+='</table></td></tr>';
			}
			str+='<tr><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td></tr></table></td></tr></table></td><td style="background-image: url(\'images/tab_rig_mid_bg.gif\');" align="right" valign="top"><img src="images/tab_top_rig_cur.gif" border="0" alt=""></td></tr><tr><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" width="1%"><img src="images/tab_bot_left_cur.gif" border="0" alt=""></td><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" ><img src="images/tab_bot_mid_bg.gif" border="0" alt=""></td><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" align="right" width="1%"><img src="images/tab_bot_rig_cur.gif" border="0" alt=""></td></tr></table>';
			//alert(str);
			document.getElementById('list').innerHTML=str;
			//document.frm1.content.value=str;
			str2='<table cellpadding="5" cellspacing="0" border="0"><tr>';
			if (no_of_pgs!=1)
			{
				str2+='<td id="prev" class="bodytxt1"><a href="javascript:;" onclick="show_pg(\'item_pg1\');" class="bodytxt1">&lt;&lt; Back</a></td>'
			}
			//alert(no_of_pgs);
			for (j=1;j<=no_of_pgs;j++)
			{
				str2+='<td class="bodytxt1" id="pgid'+j+'"';
				if (j>10)
				{
					str2+=' style="display:none;"><a href="javascript:;" onclick="show_pg(\'item_pg'+j+'\');" class="bodytxt1" id="pgnum_div'+j+'">'+j+'</a></td>';
				}
				else
				{
					str2+='><a href="javascript:;" onclick="show_pg(\'item_pg'+j+'\');" class="bodytxt1" id="pgnum_div'+j+'">'+j+'</a></td>';
				}

				pg_num_arr[j-1]='item_pg'+j;
				pg_num_divid[j-1]='pgnum_div'+j;
				pg_id[j-1]='pgid'+j;
			}
			//alert(pg_id.length)
			//alert(str2)
			if (no_of_pgs!=1)
			{
				str2+='<td id="next" class="bodytxt1"><a href="javascript:;" onclick="show_pg(\'item_pg2\');" class="bodytxt1">Next &gt;&gt;</a></td></tr></table>';
			}
		//alert(str2);
			document.getElementById('pg_nav').innerHTML=str2;
		}
		else
		{
			document.getElementById('list').innerHTML="No results found";
			document.getElementById('pg_nav').innerHTML='';
		}
		show_pg('item_pg1');
	}

	//Bonus catalogue
	if (param1=='bonus_cat')
	{
		//alert(param2)
		var max=0;
		for (i=0;i<x2.length;i++)
		{
			txt=xmlDoc.getElementsByTagName("bonuspartner")[i].getAttribute("category");
			//alert(txt)
			if (param2==txt)
			{
				max++;
			}
		}
		//alert(max);
		no_of_pgs=Math.ceil(max/10);
		//alert(no_of_pgs)
		if(no_of_pgs!=0)
		{

			str='<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr valign="top"><td style="background-image: url(\'images/tab_left_mid_bg.gif\');"><img src="images/tab_top_left_cur2.gif" border="0" alt=""></td><td valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td colspan="15"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="1%" style="background-image: url(\'images/tab_top_mid_bg2.gif\');"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td><td width="3%" style="background-image: url(\'images/tab_top_mid_bg2.gif\');" align="center" class="leftnavhd2"><img src="images/txthd_bonus_partner.gif" border="0" alt=""></td><td colspan="2" width="1%" style="background-image: url(\'images/tab_top_mid_bg2.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg2.gif\');"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td><td width="480" style="background-image: url(\'images/tab_top_mid_bg2.gif\');" height="30" colspan="2" class="leftnavhd2" align="center"><img src="images/txthd_desc.gif" border="0" alt=""></td><td style="background-image: url(\'images/tab_top_mid_bg2.gif\');" width="1%"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td></tr>';

			str+='<tr><td valign="top"><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td width="1" valign="top"></td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td><td><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td></tr>';

			pg_num=1;
			count=1;
			prevcount='';
			preloadimg='';
			imgvar='';
			for (i=0;i<x2.length;i++)
			{
				txt=xmlDoc.getElementsByTagName("bonuspartner")[i].getAttribute("category");
				//alert(txt1+", "+frm.points.options[frm.points.selectedIndex].value)
				//alert(txt+", "+frm.categ.options[frm.categ.selectedIndex].value)

				if (param2==txt && count<=10)
				{
					if (pg_num==1)
					{
						disp=' style="display:;';
					}
					else
					{
						disp=' style="display:none;';
					}
					if (count==1)
					{
						//str+='<tr id="pg'+pg_num+'"'+disp+'"><td colspan="4"><table width="100%">';
						str+='<tr id="bonus_item_pg'+pg_num+'"'+disp+'"><td colspan="8"><table width="100%" cellpadding="0" cellspacing="0" border="0">';
					}
					img_icon=xmlDoc.getElementsByTagName("productimage_bonus")[i].childNodes[0].nodeValue;
					v2=xmlDoc.getElementsByTagName("product_bonus")[i].childNodes[0].nodeValue;
					//alert(img_icon);

					str+='<tr valign="top"><td valign="top" width="100" class="bodytxt3">'+img_icon+'</td><td class="bodytxt3" >'+v2+'</td><td width="10"><img src="images/spacer.gif" width="10" height="1" border="0" alt=""></td></tr>';

					str+='<tr valign="top"><td colspan="6"><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td></tr><tr valign="top"><td colspan="6" style="background-image: url(\'images/dotline_h.gif\');"><img src="images/dotline_h.gif" width="3" height="1" border="0" alt=""></td></tr><tr valign="top"><td colspan="6"><img src="images/spacer.gif" width="1" height="5" border="0" alt=""></td></tr>';
					imgvar+=img_icon
					//alert(str);
					//alert(count);
					count++;
				}
				//alert("count"+count+"no_of_pgs" + no_of_pgs+" "+ "pg_num" + pg_num)
				if (count==11)
				{
				//alert(count)
					count=1;
					pg_num++;
					str+='</table></td></tr>';
				}
			}
			if (count!=11 && no_of_pgs!=(pg_num-1))
			{
				//alert("sec"+count)
				str+='</table></td></tr>';
			}
			str+='<tr><td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td></tr></table></td></tr></table></td><td style="background-image: url(\'images/tab_rig_mid_bg.gif\');" align="right" valign="top"><img src="images/tab_top_rig_cur2.gif" border="0" alt=""></td></tr><tr><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" width="1%"><img src="images/tab_bot_left_cur.gif" border="0" alt=""></td><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" ><img src="images/tab_bot_mid_bg.gif" border="0" alt=""></td><td style="background-image: url(\'images/tab_bot_mid_bg.gif\');" align="right" width="1%"><img src="images/tab_bot_rig_cur.gif" border="0" alt=""></td></tr></table>';
			//alert(str);
			document.getElementById('bonus_list').innerHTML=str;
			//document.frm1.content.value=str;
			str2='<table cellpadding="5" cellspacing="0" border="0"><tr>';
			if (no_of_pgs!=1)
			{
				str2+='<td id="bonus_prev" class="bodytxt1"><a href="javascript:;" onclick="show_pg_bonus(\'bonus_item_pg1\');" class="bodytxt1">&lt;&lt; Back</a></td>'
			}
			//alert(no_of_pgs);
			for (j=1;j<=no_of_pgs;j++)
			{
				str2+='<td class="bodytxt1" id="bonus_pgid'+j+'"';
				if (j>10)
				{
					str2+=' style="display:none;"><a href="javascript:;" onclick="show_pg_bonus(\'bonus_item_pg'+j+'\');" class="bodytxt1" id="bonus_pgnum_div'+j+'">'+j+'</a></td>';
				}
				else
				{
					str2+='><a href="javascript:;" onclick="show_pg_bonus(\'bonus_item_pg'+j+'\');" class="bodytxt1" id="bonus_pgnum_div'+j+'">'+j+'</a></td>';
				}

				pg_num_arr[j-1]='bonus_item_pg'+j;
				pg_num_divid[j-1]='bonus_pgnum_div'+j;
				pg_id[j-1]='bonus_pgid'+j;
			}
			//alert(pg_id.length)
			//alert(str2)
			if (no_of_pgs!=1)
			{
				str2+='<td id="bonus_next" class="bodytxt1"><a href="javascript:;" onclick="show_pg_bonus(\'bonus_item_pg2\');" class="bodytxt1">Next &gt;&gt;</a></td></tr></table>';
			}
		//alert(str2);
			document.getElementById('bonus_pg_nav').innerHTML=str2;
		}
		else
		{
			document.getElementById('bonus_list').innerHTML="No results found";
			document.getElementById('bonus_pg_nav').innerHTML='';
		}
		
		//alert(imgvar);
		show_pg_bonus('bonus_item_pg1');
	}

		//pgs_display=no_of_pgs/10;
		//alert(pgs_display);
		//pgs_display=pgs_display+' ';
		//alert(preloadimg);
		//alert("pg round"+pgs_display.substr(0,1));
		//alert("pg"+pgs_display.substr(2,1));
	//preloadimg=preloadimg.substr(0,preloadimg.length-1);
}

var prevpg='0';
var prevpgnumber='';
function show_pg(obj)
{
//alert(pg_num_arr.length);
//alert(pg_num_arr[pg_num_arr.length-1]);
//alert(pg_num_divid.length);

	var pgnumber;
	for (i=0;i<pg_num_arr.length;i++)
	{
//alert(pg_num_divid[i]);
		var pg_num_id=document.getElementById(pg_num_arr[i]);
		var pg_num_divid_id=document.getElementById(pg_num_divid[i]);
		if (obj==pg_num_arr[i])
		{
			pgnumber=i;
			pg_num_id.style.display='';
			pg_num_divid_id.style.fontWeight='bold';
			//alert(i);
			if (i>=0 && no_of_pgs!=1)
			{
				document.getElementById('prev').innerHTML='<a href="javascript:;" onclick="show_pg(\''+pg_num_arr[i-1]+'\');" class="lbluetxt1">&lt;&lt; Back</a>';
				if ((i+1)==1)
				{
					document.getElementById('prev').innerHTML='<a href="javascript:;" onclick="show_pg(\''+pg_num_arr[i]+'\');" class="lbluetxt1">&lt;&lt; Back</a>';
				}
			}
			if (i<=pg_num_arr.length && no_of_pgs!=1)
			{
				//alert(i +" ,"+pg_num_arr.length);
				document.getElementById('next').innerHTML='<a href="javascript:;" onclick="show_pg(\''+pg_num_arr[i+1]+'\');" class="lbluetxt1">Next &gt;&gt;</a>';
				if ((i+1)==no_of_pgs)
				{
					//alert(no_of_pgs +", "+ (i+1))
					document.getElementById('next').innerHTML='<a href="javascript:;" onclick="show_pg(\''+pg_num_arr[i]+'\');" class="lbluetxt1">Next &gt;&gt;</a>';
				}
			}
		}
		else
		{//alert(pg_num_arr[i]);
			pg_num_id.style.display='none';
			pg_num_divid_id.style.fontWeight='normal';
		}
		
	}
	var pgdivider=new Array(10,20,30,40,50,60);
	var pgdivider2=new Array(9,19,29,39,49,59);
	
	for (k=0;k<pgdivider.length;k++)
	{
		//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber);
		if (pgnumber==pgdivider[k] && pgnumber>prevpgnumber)
		{
			//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber+"greater");
			for (j=0;j<pgnumber;j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_prev=document.getElementById(pg_id[j]);
					pgs_prev.style.display='none';
				}
			}
			for (j=pgnumber;j<(pgnumber+10);j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_next=document.getElementById(pg_id[j]);
					pgs_next.style.display='';
				}
			}
		}
		if (pgnumber==pgdivider2[k] && pgnumber<prevpgnumber)
		{
			//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber+"lesser");
			for (j=pgnumber;j<pg_num_arr.length;j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_prev=document.getElementById(pg_id[j]);
					pgs_prev.style.display='none';
				}
			}
			for (j=pgnumber;j>(pgnumber-10);j--)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_next=document.getElementById(pg_id[j]);
					pgs_next.style.display='';
				}
			}
		}
	}
	for (a=0;a<pg_num_arr.length;a++)
	{
		if (pg_num_arr[a]==obj)
		{
			prevpgnumber=a;
		}
	}
	if ((pgnumber+1)==no_of_pgs && no_of_pgs!=1)
	{
		//alert(no_of_pgs +", "+ (i+1))
		document.getElementById('next').innerHTML='';
	}
}

var prevpg2='0';
var prevpgnumber2='';
function show_pg_bonus(obj)
{
//alert(pg_num_arr.length);
//alert(pg_num_arr[pg_num_arr.length-1]);
//alert(pg_num_divid.length);

	var pgnumber;
	for (i=0;i<pg_num_arr.length;i++)
	{
//alert(pg_num_divid[i]);
		var pg_num_id=document.getElementById(pg_num_arr[i]);
		var pg_num_divid_id=document.getElementById(pg_num_divid[i]);
		if (obj==pg_num_arr[i])
		{
			pgnumber=i;
			pg_num_id.style.display='';
			pg_num_divid_id.style.fontWeight='bold';
			//alert(i);
			if (i>=0 && no_of_pgs!=1)
			{
				document.getElementById('bonus_prev').innerHTML='<a href="javascript:;" onclick="show_pg_bonus(\''+pg_num_arr[i-1]+'\');" class="lbluetxt1">&lt;&lt; Back</a>';
				if ((i+1)==1)
				{
					document.getElementById('bonus_prev').innerHTML='<a href="javascript:;" onclick="show_pg_bonus(\''+pg_num_arr[i]+'\');" class="lbluetxt1">&lt;&lt; Back</a>';
				}
			}
			if (i<=pg_num_arr.length && no_of_pgs!=1)
			{
				//alert(i +" ,"+pg_num_arr.length);
				document.getElementById('bonus_next').innerHTML='<a href="javascript:;" onclick="show_pg_bonus(\''+pg_num_arr[i+1]+'\');" class="lbluetxt1">Next &gt;&gt;</a>';
				if ((i+1)==no_of_pgs)
				{
					//alert(no_of_pgs +", "+ (i+1))
					document.getElementById('bonus_next').innerHTML='<a href="javascript:;" onclick="show_pg_bonus(\''+pg_num_arr[i]+'\');" class="lbluetxt1">Next &gt;&gt;</a>';
				}
			}
		}
		else
		{//alert(pg_num_arr[i]);
			pg_num_id.style.display='none';
			pg_num_divid_id.style.fontWeight='normal';
		}
		
	}
	var pgdivider=new Array(10,20,30,40,50,60);
	var pgdivider2=new Array(9,19,29,39,49,59);
	
	for (k=0;k<pgdivider.length;k++)
	{
		//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber);
		if (pgnumber==pgdivider[k] && pgnumber>prevpgnumber)
		{
			//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber+"greater");
			for (j=0;j<pgnumber;j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_prev=document.getElementById(pg_id[j]);
					pgs_prev.style.display='none';
				}
			}
			for (j=pgnumber;j<(pgnumber+10);j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_next=document.getElementById(pg_id[j]);
					pgs_next.style.display='';
				}
			}
		}
		if (pgnumber==pgdivider2[k] && pgnumber<prevpgnumber)
		{
			//alert("pgnumber"+pgnumber+"prevpgnumber"+prevpgnumber+"lesser");
			for (j=pgnumber;j<pg_num_arr.length;j++)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_prev=document.getElementById(pg_id[j]);
					pgs_prev.style.display='none';
				}
			}
			for (j=pgnumber;j>(pgnumber-10);j--)
			{
				if (j<pg_num_arr.length)
				{
					var pgs_next=document.getElementById(pg_id[j]);
					pgs_next.style.display='';
				}
			}
		}
	}
	for (a=0;a<pg_num_arr.length;a++)
	{
		if (pg_num_arr[a]==obj)
		{
			prevpgnumber=a;
		}
	}
	if ((pgnumber+1)==no_of_pgs && no_of_pgs!=1)
	{
		//alert(no_of_pgs +", "+ (i+1))
		document.getElementById('bonus_next').innerHTML='';
	}
}
