

 
/**************************/

function popUp(URL) {
//alert('popup');
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 0,top = 0');");
}



function Load_Left_Index_Menu()
{

str_Left_Menu="<table width='188' border='0' cellpadding='0' cellspacing='0' id='left'>";
var i_sub_cat_cnt=0;
//alert(GLB_main_catg_length);
for (var i_cat_cnt=0; (i_cat_cnt <GLB_main_catg_length) ; i_cat_cnt++)

{

if (product_main_category[i_cat_cnt][2] ==1)
{
/* str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td valign='middle' class='side-top'><table width='96%' border='0' align='right' cellpadding='0' cellspacing='0'>";
 str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td height='5' valign='middle' class='heading_wh'>" + product_main_category[i_cat_cnt][1].toString() + "</td>";
 str_Left_Menu=str_Left_Menu+"</tr>";
 str_Left_Menu=str_Left_Menu+"</table></td>";
 str_Left_Menu=str_Left_Menu+"</tr>";*/

 str_Left_Menu=str_Left_Menu+"              <tr>";
 str_Left_Menu=str_Left_Menu+"                <td height='20' bgcolor='#AA2598' ><table width='96%' border='0' align='center' cellpadding='0' cellspacing='0'>";
 str_Left_Menu=str_Left_Menu+"                  <tr>";
 str_Left_Menu=str_Left_Menu+"                    <td class='heading_wh' align='left'>" + product_main_category[i_cat_cnt][1].toString() + "</td>";
 str_Left_Menu=str_Left_Menu+"                  </tr>";
 str_Left_Menu=str_Left_Menu+"                </table></td>";
 str_Left_Menu=str_Left_Menu+"              </tr>";
 str_Left_Menu=str_Left_Menu+"              <tr>";
 str_Left_Menu=str_Left_Menu+"                <td height='1'></td>";
 str_Left_Menu=str_Left_Menu+"              </tr>";

/* str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td class='border_side_green'>";
 str_Left_Menu=str_Left_Menu+"<table width='97%' border='0' align='center' cellpadding='1' cellspacing='0' >";*/
}
var i_loop_cnt=0;
var i_cmg_soon=0;
var rowCnt=0;
//alert('i_cat_cnt'+i_cat_cnt);

//	 for (  ;(i_sub_cat_cnt <GLB_sub_catg_length) && (parseInt(product_sub_category[i_sub_cat_cnt][0])==parseInt(product_main_category[i_cat_cnt][3])) ; ++i_sub_cat_cnt)

	 for ( ; (i_sub_cat_cnt <GLB_sub_catg_length) && (parseInt(product_sub_category[i_sub_cat_cnt][0])==parseInt(product_main_category[i_cat_cnt][3])) ; ++i_sub_cat_cnt)
		{
//alert('('+ i_sub_cat_cnt +'<' + GLB_sub_catg_length + ')  &&' +  '(' + product_sub_category[i_sub_cat_cnt][0] + '==' + product_main_category[i_cat_cnt][3].toString() + ')' );
			if (product_main_category[i_cat_cnt][2].toString() == "1")
			{		
			  rowCnt=rowCnt+1;
if (rowCnt%2==1){bgcolor='#F8F5F8';}
else{bgcolor='#EEE8EE';}


  str_Left_Menu=str_Left_Menu+"			<tr>";
  str_Left_Menu=str_Left_Menu+"                <td height='20' bgcolor='"+bgcolor+"'><table width='80%' border='0' align='center' cellpadding='0' cellspacing='0'>";
  str_Left_Menu=str_Left_Menu+"                  <tr>";
  str_Left_Menu=str_Left_Menu+"                    <td width='9%'><img src='images/arrow.gif' width='4' height='8' /></td>";
  str_Left_Menu=str_Left_Menu+"                    <td width='91%'align='left' class='smalltext'><a title='"+product_sub_category[i_sub_cat_cnt][1].toString()+"' href='/asp/"+product_sub_category[i_sub_cat_cnt][4].toString()+"/products.asp'>"+product_sub_category[i_sub_cat_cnt][1].toString()+" </a></td>";
  str_Left_Menu=str_Left_Menu+"                  </tr>";
  str_Left_Menu=str_Left_Menu+"                </table></td>";
  str_Left_Menu=str_Left_Menu+"              </tr>";
  str_Left_Menu=str_Left_Menu+"              <tr>";
  str_Left_Menu=str_Left_Menu+"                <td height='1'></td>";
  str_Left_Menu=str_Left_Menu+"              </tr>";

			  /*str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td width='9%' height='21'><img src='http://www.123discountshop.com/images/arrow-pink.gif' width='10' height='13' /></td>";		

			  str_Left_Menu=str_Left_Menu+"<td width='91%' height='21'><a title='"+product_sub_category[i_sub_cat_cnt][1].toString()+"' href='/asp/"+product_sub_category[i_sub_cat_cnt][4]+"/products.asp'>"+product_sub_category[i_sub_cat_cnt][1].toString()+" </a> </td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td colspan='2' background='http://www.123discountshop.com/images/hrline.gif' height='1'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";*/
			  
			 }
			 else
			 {
			 if (product_main_category[i_cat_cnt][2] ==1)
			 {
			  if (i_cmg_soon<1)
			  {
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td width='9%' height='21'><img src='http://www.123discountshop.com/images/arrow-pink.gif' width='10' height='13' /></td>";		
			  str_Left_Menu=str_Left_Menu+"<td width='91%' height='21'>Coming soon</td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td colspan='2' background='http://www.123discountshop.com/images/hrline.gif' height='1'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  i_cmg_soon++;
			  }
			 }
			 }
		

		}
if (product_main_category[i_cat_cnt][2] ==1)
{
  		str_Left_Menu=str_Left_Menu+" <tr>";
		str_Left_Menu=str_Left_Menu+"                <td height='20' >&nbsp;</td>";
		str_Left_Menu=str_Left_Menu+"              </tr>";
/*		str_Left_Menu=str_Left_Menu+"</table></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td class='border_side_green' >&nbsp;</td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td width='11'><img src='http://www.123discountshop.com/images/side_bott_left.gif' width='11' height='10' /></td>";
		str_Left_Menu=str_Left_Menu+"<td background='http://www.123discountshop.com/images/side_bott_mid.gif'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
		str_Left_Menu=str_Left_Menu+"<td width='11'><img src='http://www.123discountshop.com/images/side_bott_right.gif' width='11' height='10' /></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"</table></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td>&nbsp;</td>";
		str_Left_Menu=str_Left_Menu+"</tr>";*/
}

}

str_Left_Menu=str_Left_Menu+"</table>";
//alert(str_Left_Menu);

}



function Load_Left_Menu()
{

str_Left_Menu="<table width='188' border='0' cellpadding='0' cellspacing='0' id='left'>";
var i_sub_cat_cnt=0;
//alert(GLB_main_catg_length);
for (var i_cat_cnt=0; (i_cat_cnt <GLB_main_catg_length) ; i_cat_cnt++)

{

if (product_main_category[i_cat_cnt][2] ==1)
{
 str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td valign='middle' class='side-top'><table width='96%' border='0' align='right' cellpadding='0' cellspacing='0'>";
 str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td height='5' valign='middle' class='heading_wh'>" + product_main_category[i_cat_cnt][1].toString() + "</td>";
 str_Left_Menu=str_Left_Menu+"</tr>";
 str_Left_Menu=str_Left_Menu+"</table></td>";
 str_Left_Menu=str_Left_Menu+"</tr>";

 str_Left_Menu=str_Left_Menu+"<tr>";
 str_Left_Menu=str_Left_Menu+"<td class='border_side_green'>";
 str_Left_Menu=str_Left_Menu+"<table width='97%' border='0' align='center' cellpadding='1' cellspacing='0' >";
}
var i_loop_cnt=0;
var i_cmg_soon=0;
//alert('i_cat_cnt'+i_cat_cnt);

//	 for (  ;(i_sub_cat_cnt <GLB_sub_catg_length) && (parseInt(product_sub_category[i_sub_cat_cnt][0])==parseInt(product_main_category[i_cat_cnt][3])) ; ++i_sub_cat_cnt)

	 for ( ; (i_sub_cat_cnt <GLB_sub_catg_length) && (parseInt(product_sub_category[i_sub_cat_cnt][0])==parseInt(product_main_category[i_cat_cnt][3])) ; ++i_sub_cat_cnt)
		{
//alert('('+ i_sub_cat_cnt +'<' + GLB_sub_catg_length + ')  &&' +  '(' + product_sub_category[i_sub_cat_cnt][0] + '==' + product_main_category[i_cat_cnt][3].toString() + ')' );
			if (product_main_category[i_cat_cnt][2].toString() == "1")
			{		
			  
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td width='9%' height='21'><img src='http://www.123discountshop.com/images/arrow-pink.gif' width='10' height='13' /></td>";		

			  str_Left_Menu=str_Left_Menu+"<td width='91%' height='21'><a title='"+product_sub_category[i_sub_cat_cnt][1].toString()+"' href='/asp/"+product_sub_category[i_sub_cat_cnt][4].toString()+"/products.asp'>"+product_sub_category[i_sub_cat_cnt][1].toString()+" </a> </td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td colspan='2' background='http://www.123discountshop.com/images/hrline.gif' height='1'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  
			 }
			 else
			 {
			 if (product_main_category[i_cat_cnt][2] ==1)
			 {
			  if (i_cmg_soon<1)
			  {
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td width='9%' height='21'><img src='http://www.123discountshop.com/images/arrow-pink.gif' width='10' height='13' /></td>";		
			  str_Left_Menu=str_Left_Menu+"<td width='91%' height='21'>Coming soon</td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  str_Left_Menu=str_Left_Menu+"<tr>";
			  str_Left_Menu=str_Left_Menu+"<td colspan='2' background='http://www.123discountshop.com/images/hrline.gif' height='1'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
			  str_Left_Menu=str_Left_Menu+"</tr>";
			  i_cmg_soon++;
			  }
			 }
			 }
		

		}
if (product_main_category[i_cat_cnt][2] ==1)
{
		str_Left_Menu=str_Left_Menu+"</table></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td class='border_side_green' >&nbsp;</td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td width='11'><img src='http://www.123discountshop.com/images/side_bott_left.gif' width='11' height='10' /></td>";
		str_Left_Menu=str_Left_Menu+"<td background='http://www.123discountshop.com/images/side_bott_mid.gif'><img src='http://www.123discountshop.com/images/spacer.gif' /></td>";
		str_Left_Menu=str_Left_Menu+"<td width='11'><img src='http://www.123discountshop.com/images/side_bott_right.gif' width='11' height='10' /></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"</table></td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
		str_Left_Menu=str_Left_Menu+"<tr>";
		str_Left_Menu=str_Left_Menu+"<td>&nbsp;</td>";
		str_Left_Menu=str_Left_Menu+"</tr>";
}

}

str_Left_Menu=str_Left_Menu+"</table>";
//alert(str_Left_Menu);

}


function loadHomeData()
{

var i_tot_items1=0;



if (s_Sub_Catg!="")
	{
	i_tot_items1=product_sub_category.length;
	//str_link="<span class='black12bold'  ><a class='black12bold' href='products.asp' >HOME</a> >> <a  class='black12bold' href='products.asp?s_Catg="+s_Catg+"'>"+product_main_category[s_Catg][1].toString()+"</a> >> " +product_sub_category[s_Sub_Catg][1].toString()+ "</span><br><br>";
	
////	str_link="<span class='black12bold' ><a class='black12bold' href='products.asp' >HOME</a> >> <a  class='black12bold' href='products.asp?s_catg="+s_Catg+"'>"+product_main_category[s_Catg][1].toString()+"</a> >> " +product_sub_category[s_Sub_Catg][1].toString()+ "</span><br><br>";
	//str_link=""
	
//	alert(str_link);
	//Home=>USB=>1GB **http://www.dev.123discountshop.co.uk/asp/products.asp?s_catg=product_sub_category[i_cat_cnt][0].toString()&s_sub_catg=product_sub_category[i_cat_cnt][2].toString()**

	}
else
	{
	i_tot_items1=product_main_category.length;
	
	//Home=>USB;
	if(s_Catg != "")
	{
		str_link="<span class='black12bold' valign='top'><a class='black12bold' href='products.asp'>HOME</a>>>"+product_main_category[s_Catg][1].toString()+"</span><br><br>";
	}



	}

var i_cat_cnt=1;
var i_Flag=0;


	for (var i_cat_cnt=0; (i_cat_cnt <i_tot_items1 ); ++i_cat_cnt)
	{
	//alert(product_sub_category[i_cat_cnt][2].toString());
	if (s_Sub_Catg!="")
	{
	
		i_Flag=((product_sub_category[i_cat_cnt][0].toString()==s_Catg) && (product_sub_category[i_cat_cnt][2].toString()==s_Sub_Catg || s_Sub_Catg==""));
		//alert(i_cat_cnt +' '+ s_Sub_Catg);
		
		}
	else 
//		i_Flag=(product_main_category[i_cat_cnt][0].toString()==s_Catg || s_Catg=="");
		i_Flag=((product_main_category[i_cat_cnt][0].toString()==s_Catg || s_Catg=="" ) && (product_main_category[i_cat_cnt][2].toString() == "1"));

    

	if (i_Flag)
	{
	
   		str_Load_Products=str_Load_Products+"<table  width='100%' border='0' cellspacing='0' cellpadding='0' valign='top'><tr>";
        	str_Load_Products=str_Load_Products+"<td valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='0' >";
        	str_Load_Products=str_Load_Products+"<tr>";
        	str_Load_Products=str_Load_Products+"<td width='163' class='category_head'><table width='96%' border='0' align='right' cellpadding='0' cellspacing='0'>";
      		str_Load_Products=str_Load_Products+"<tr>";
        	str_Load_Products=str_Load_Products+"<td height='28' valign='middle' class='heading_wh'>";
		var l_Catg_Id;
		
		if (s_Sub_Catg!= "")
		        {
				str_Load_Products=str_Load_Products+ product_sub_category[i_cat_cnt][1].toString() +"</td>";
				            //alert(s_Catg);
		              if (product_sub_category[i_cat_cnt][2]==s_Sub_Catg)
		            {
			         str_link="<span class='black12bold' ><a class='black12bold' href='products.asp' >HOME</a> >> <a  class='black12bold' href='products.asp'>"+product_main_category[s_p_id][1].toString()+"</a> >> " +product_sub_category[i_cat_cnt][1]+ "</span><br><br>";
			         }
			
			}
		else
			{
				str_Load_Products=str_Load_Products+ product_main_category[i_cat_cnt][1].toString() +"</td>";
				l_Catg_Id=product_main_category[i_cat_cnt][3].toString();//actual parent cat id
				
			}

      	str_Load_Products=str_Load_Products+"</tr>";

    	str_Load_Products=str_Load_Products+"</table></td>";


        str_Load_Products=str_Load_Products+"<td height='33' background='http://www.123discountshop.com/images/cat-mid.gif'>&nbsp;</td>";
        str_Load_Products=str_Load_Products+"<td width='8'><img src='http://www.123discountshop.com/images/cat-rightcurve.gif' width='8' height='33' /></td>";

        str_Load_Products=str_Load_Products+"</tr>";
        str_Load_Products=str_Load_Products+"</table></td>";
        str_Load_Products=str_Load_Products+"</tr>";

        //TR product starts

	var i_cnt=0;
	i_cnt=0;


var i_cnt_1=0;
str_Load_Products=str_Load_Products+"<tr>";
str_Load_Products=str_Load_Products+"<td class='border_side_purple'  ><table width='100%' border='0' align='center' cellpadding='2' cellspacing='4'>";
//alert(GLB_product_item_length);
for (var i_item_cnt=0 ;(i_item_cnt <GLB_product_item_length); i_item_cnt++)			
	{
	/*if (i_item_cnt==12)
	{
	    alert(product_item[i_item_cnt][7]);
	    alert(s_Sub_Catg+ "sub catg")
	    alert(l_Catg_Id+"l_cat_id");
	}*/
	
if (( product_item[i_item_cnt][7]==s_Catg || s_Catg=="" ) &&( product_item[i_item_cnt][8]==s_Sub_Catg || s_Sub_Catg=="" ) )
{		

						if((product_item[i_item_cnt][9]=="1"  && product_item[i_item_cnt][7]==l_Catg_Id && s_Catg=="" && s_Sub_Catg=="") || (s_Catg!="" || s_Sub_Catg!=""))
						{
							
							if (i_cnt_1%3 ==0)
							{

								 str_Load_Products=str_Load_Products+"<tr>";
							}
							i_cnt_1=i_cnt_1+1;


												 	 str_Load_Products=str_Load_Products+"<td width='32%' class='category_grey_border' align='center'><table width='130' border='0' cellspacing='0' cellpadding='0'>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td height='110' align='center'><a title='"+product_item[i_item_cnt][1]+"'  href='javascript:popUp("+'"/'+ product_item[i_item_cnt][13]+"/" + product_item[i_item_cnt][10]+ '"'+ ");' ><img alt='"+product_item[i_item_cnt][1]+"' src='/ebay/product_information"+product_item[i_item_cnt][6]+"' width='96' height='93' border='0'/></a></td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td align='center' class='sm-pink'><a title='"+product_item[i_item_cnt][1]+"'  href='javascript:popUp("+'"/'+ product_item[i_item_cnt][13]+"/" + product_item[i_item_cnt][10]+ '"'+ ");' >"+product_item[i_item_cnt][1]+"</a></td>";

													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td height='15' align='left' class='sm-lightgrey'>"+product_item[i_item_cnt][2]+"</td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td height='45' bgcolor='#F3F3F4' class='black12bold'><table width='98%' border='0' align='center' cellpadding='0' cellspacing='0'>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td align='center'>Retail Price</td>";
													 str_Load_Products=str_Load_Products+"<td align='center'>Save</td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td align='center'>£"+product_item[i_item_cnt][3]+" </td>";
													 str_Load_Products=str_Load_Products+"<td align='center'>£"+product_item[i_item_cnt][5]+"</td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"</table></td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td height='30' valign='top' bgcolor='#F3F3F4' class='black12bold'><table width='95%' border='0' cellspacing='0' cellpadding='0'>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td align='center' class='big-pink-14'>Our Price</td>";
													 str_Load_Products=str_Load_Products+"<td align='center' class='red20bold'>£"+product_item[i_item_cnt][4]+"</td>";
													 str_Load_Products=str_Load_Products+"</tr>";

													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td colspan=2 align='right' ><font color=red>incl VAT</font></td>";
													 str_Load_Products=str_Load_Products+"</tr>";

													 str_Load_Products=str_Load_Products+"</table></td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 str_Load_Products=str_Load_Products+"<td height='30' bgcolor='#E1E1E2'><table width='95%' border='0' align='center' cellpadding='0' cellspacing='0'>";
													 str_Load_Products=str_Load_Products+"<tr>";
													 //str_Load_Products=str_Load_Products+"<td><input size=3 value=1 maxlength=3 type=text name=txtQ"+ product_item[i_item_cnt][0]+" id=txtQ"+ product_item[i_item_cnt][0]+"><br><a  title='"+product_item[i_item_cnt][1]+"' href='javascript:popUp("+'"/'+product_item[i_item_cnt][13]+"/" + product_item[i_item_cnt][10]+ '"'+ ");'  class='link_blackbold'>More info</a><img src='http://www.123discountshop.com/images/arrow-black.gif' width='9' height='7' /></td>";
													 str_Load_Products=str_Load_Products+"<td><input size=3 value=1 maxlength=3 type=text name=txtQ"+ product_item[i_item_cnt][0]+" id=txtQ"+ product_item[i_item_cnt][0]+"><br><a  title='"+product_item[i_item_cnt][1]+"' href='http://www.123discountshop.com/asp/" + product_item[i_item_cnt][10].replace('.asp','')  + "/product_detail.asp" +"'  class='link_blackbold'>More info</a><img src='http://www.123discountshop.com/images/arrow-black.gif' width='9' height='7' /></td>";
														 document.getElementById("divHome_Page").innerHTML=str_Load_Products;
													//document.getElementById("divHome_Page").innerHTML=str_Load_Products;

													 str_Load_Products=str_Load_Products+"<td><img style='cursor: pointer' onclick=add_item("+i_item_cnt+",document.getElementById('txtQ" + product_item[i_item_cnt][0]+"').value,-1); src='http://www.123discountshop.com/images/button-buynow.gif' width='60' height='23' /></td>";
													 str_Load_Products=str_Load_Products+"</tr>";
													 str_Load_Products=str_Load_Products+"</table></td>";
													 str_Load_Products=str_Load_Products+"</tr>";
                    	 							 str_Load_Products=str_Load_Products+"</table></td>";


							 if (i_cnt_1%3 ==0)
							{
								str_Load_Products=str_Load_Products+"</tr>";
							}




						 }
			 		}


}//end of if
//alert(i_cnt_1);

if(i_cnt_1==0)
{
	str_Load_Products=str_Load_Products+"<tr><td align=center>Coming soon</td></tr>";


}
		str_Load_Products=str_Load_Products+"</table>";
 
     	str_Load_Products=str_Load_Products+"<tr>";
		str_Load_Products=str_Load_Products+"<td><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
	    str_Load_Products=str_Load_Products+"<tr>";
	    str_Load_Products=str_Load_Products+"<td width='8'><img src='http://www.123discountshop.com/images/cat-bott-left.gif' width='8' height='8' /></td>";
	    str_Load_Products=str_Load_Products+"<td background='http://www.123discountshop.com/images/cat-bott-mid.gif'><img src='http://www.123discountshop.com/images/spacer.gif' width='1' height='1' /></td>";
	    str_Load_Products=str_Load_Products+"<td width='8'><img src='http://www.123discountshop.com/images/cat-bott-right.gif' width='8' height='8' /></td>";
	    str_Load_Products=str_Load_Products+"</tr>";
		str_Load_Products=str_Load_Products+"</table></td>";
        str_Load_Products=str_Load_Products+"</tr>";


	}



}
//alert(str_Load_Products);

}


//'''''''''''''Ends



function build_array_from_global_var()
{
if (global_sess!="")
{
var product_data1=global_sess.split("/");
for (i=0; i <product_data1.length; i++)
my_shopping_cart[i]=product_data1[i].split("*");
tot_cart_items=product_data1.length;
}
else
tot_cart_items=0;
}

function list_product_data()
{
var str,i;
str="<table>";

for (i=0; i <3; i++)
{
str=str +  "<tr><td>" + product_item[i][1] + "...." + "<input type=button value=Buy  onclick='add_item(" + i.toString() + ",0,-1);'></input></td></tr>"  ;
}
str=str + "</table>";
product_list.innerHTML=str;
}

//function get_cart(l,price)
function get_cart(l,prod_name,price,prod_price)
{
//alert('m i on load');
var str,i;
var k9,amt=0;
//alert(price);
str="<table>";
if (tot_cart_items<=0 )
            str=str +  "<tr><td colspan=4>Cart is empty</td></tr>"  ;
else
{
            for (i=0; i <tot_cart_items; i++)
            if (my_shopping_cart[i][2]=="1") 
            {
                    k9=parseInt(my_shopping_cart[i][0]);//item id
                    //alert(my_shopping_cart[i][3]);
                    if (my_shopping_cart[i][3] == -1)//dnt override rice in DB
                    {
str=str +  "<tr><td width='141'>" + my_shopping_cart[i][4]   + " x " + my_shopping_cart[i][1]+"</td><td width='55'><span class='sign_head'> £ "+ my_shopping_cart[i][5] +"</span></td><td width='36'><a style='cursor: hand;cursor: pointer' class='red12bold' onclick='remove_item(" + i.toString() + ");'>X</a></td></tr>";
str=str +  " <tr><td bgcolor='#cfdfe7' height='1' colspan=4></td></tr>";


                       
//                      // org  str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" + my_shopping_cart[i][4]+" £ "+ my_shopping_cart[i][5] +"</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item(" + i.toString() + ");'>X</a></td></tr>"  ;
 
                      amt=amt+parseFloat(my_shopping_cart[i][5]) *parseFloat(my_shopping_cart[i][1]) ;
                       
                       
                    }
                    else //override price in DB- use sent price
                    {
                      //org  str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" + my_shopping_cart[i][4]+" £ "+ my_shopping_cart[i][5] +"</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item(" + i.toString() + ");'>X</a></td></tr>"  ;
str=str +  "<td width='141'>Complete Highway Code Book</td><td width='55'><span class='sign_head'>&pound;7.99</span></td><td width='36'><a href='#'  class='sign_head'>x</a></td></tr>";
str=str +  " <tr><td bgcolor='#cfdfe7' height='1' colspan=4></td></tr>";
                      
                       amt=amt+parseFloat(my_shopping_cart[i][5]) *parseFloat(my_shopping_cart[i][1]) ;
                    }

            }

           
}

str=str + "</table>";

document.getElementById("cart").innerHTML=str;
document.getElementById("product_value").innerHTML='£ '+(Math.round(amt*100)/100).toString();
//alert('here');
build_global_var_from_array();
}


function get_cart_dvd(l,prod_name,price,prod_price)
{
//alert('m i on load');
var str,i;
var k9,amt=0;
//alert(price);
str="<table>";
if (tot_cart_items<=0 )
            str=str +  "<tr><td colspan=4>Cart is empty</td></tr>"  ;
else
{
            for (i=0; i <tot_cart_items; i++)
            if (my_shopping_cart[i][2]=="1") 
            {
                    k9=parseInt(my_shopping_cart[i][0]);//item id
                    //alert(my_shopping_cart[i][3]);
                    if (my_shopping_cart[i][3] == -1)//dnt override rice in DB
                    {
str=str +  "<tr><td width='141'>" + my_shopping_cart[i][4]   + " x " + my_shopping_cart[i][1]+"</td><td width='55'><span class='sign_head'> £ "+ my_shopping_cart[i][5] +"</span></td><td width='36'><a style='cursor: hand;cursor: pointer' class='red12bold' onclick='remove_item_dvd(" + i.toString() + ");'>X</a></td></tr>";
str=str +  " <tr><td bgcolor='#cfdfe7' height='1' colspan=4></td></tr>";


                       
//                      // org  str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" + my_shopping_cart[i][4]+" £ "+ my_shopping_cart[i][5] +"</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item_dvd(" + i.toString() + ");'>X</a></td></tr>"  ;
 
                      amt=amt+parseFloat(my_shopping_cart[i][5]) *parseFloat(my_shopping_cart[i][1]) ;
                       
                       
                    }
                    else //override price in DB- use sent price
                    {
                      //org  str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" + my_shopping_cart[i][4]+" £ "+ my_shopping_cart[i][5] +"</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item_dvd(" + i.toString() + ");'>X</a></td></tr>"  ;
str=str +  "<td width='141'>Complete Highway Code Book</td><td width='55'><span class='sign_head'>&pound;7.99</span></td><td width='36'><a href='#'  class='sign_head'>x</a></td></tr>";
str=str +  " <tr><td bgcolor='#cfdfe7' height='1' colspan=4></td></tr>";
                      
                       amt=amt+parseFloat(my_shopping_cart[i][5]) *parseFloat(my_shopping_cart[i][1]) ;
                    }

            }

           
}

str=str + "</table>";

document.getElementById("cart").innerHTML=str;
document.getElementById("product_value").innerHTML='£ '+(Math.round(amt*100)/100).toString();
//alert('here');
build_global_var_from_array();
}



function roundNumber(inum) {
	var rnum = inum;
	var rlength = 2; // The number of decimal places to round to
	if (rnum > 8191 && rnum < 10485) {
		rnum = rnum-5000;
		var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
		newnumber = newnumber+5000;
	} else {
		var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	}
	return newnumber;
}


function build_global_var_from_array()
{
	if (tot_cart_items==0) 
		global_sess="";
	else
	for (i=0; i <tot_cart_items; i++)
	if (i==0)
		global_sess=my_shopping_cart[i][0] + "*" + my_shopping_cart[i][1] + "*" + my_shopping_cart[i][2] + "*" + my_shopping_cart[i][3] + "*" + my_shopping_cart[i][4] + "*" + my_shopping_cart[i][5];
	else
		global_sess=global_sess + "/" + my_shopping_cart[i][0] + "*" + my_shopping_cart[i][1] + "*" + my_shopping_cart[i][2] +"*" + my_shopping_cart[i][3] + "*" + my_shopping_cart[i][4] + "*" + my_shopping_cart[i][5];

//alert(global_sess);
post_data(global_sess);
}

function post_data(s)
{  

var objHTTP;
if (window.XMLHttpRequest) {
objHTTP= new XMLHttpRequest();
} else {
try { objHTTP= new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
try { objHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {
objHTTP= false; } }
}


/*  var objHTTP;//=new XMLHttpRequest();
  objHTTP=new ActiveXObject("Microsoft.XMLHTTP");
*/
  //objHTTP.open("POST","http://www.123discountshop.com/asp/post_sess_data.asp",false);
  objHTTP.open("POST","../asp/post_sess_data.asp",false);
  objHTTP.send("<xml cart='" + s + "' ></xml>");
  //alert('<%=session.Contents("my_shopping_cart")%>');
 //alert(objHTTP.responseText );
}

function get_item_id(folder_name)
{

for (var i_item_cnt=0 ;(i_item_cnt <GLB_product_item_length); i_item_cnt++)			
	{
	    if (product_item[i_item_cnt][10] == (folder_name + ".asp") )
	    {
	    	return i_item_cnt;
	    	i_item_cnt=GLB_product_item_length;
	    }	
	 }   
}


function add_item_buy(k,prod_name, l,price,prod_price)
{
 document.getElementsByName("account_id")[k-1].checked = true;
add_item (k,prod_name, l,price,prod_price);
}

function add_item(k,prod_name, l,price,prod_price)
//add_item(11,'prod name',1.99,
{
var WT_POSITIVE_NUMBER = /^[0-9]+\.*[0-9]*$/;

if (/^[0-9]+\.*[0-9]*$/.test(l.toString())  && l > 0){
var exists_flag=0,exists_i=0;
alert('This item will now be added to your shopping cart');

 
if (k>=1 && k<=5)
{
 	check_n_remove_item(k);
 
}
 

for (i=0; i <tot_cart_items; i++)
{
 

if (my_shopping_cart[i][0]==k) //check if item exists
{
    exists_flag=1;
    exists_i=i;	 
	break;
}

} 
if (exists_flag==1 ) 
{

        my_shopping_cart[exists_i][1]=(parseInt(my_shopping_cart[exists_i][1]) +parseInt(l) ).toString();
        //alert(my_shopping_cart[exists_i][3]);
        if ((parseFloat(my_shopping_cart[exists_i][3]) > parseFloat(price)) && price != -1)
        {
	        my_shopping_cart[exists_i][3]=price;        	
	        my_shopping_cart[exists_i][4]=prod_name;
	        my_shopping_cart[exists_i][5]=prod_price;	       
        }
}
 
if (exists_flag!=1 ) 
{ 
        my_shopping_cart[tot_cart_items][0]=k; //item
        my_shopping_cart[tot_cart_items][1]=l;//qty
        my_shopping_cart[tot_cart_items][2]="1";
        my_shopping_cart[tot_cart_items][3]=price;
        my_shopping_cart[tot_cart_items][4]=prod_name;        
        my_shopping_cart[tot_cart_items][5]=prod_price;       
        //alert('helo?');
        tot_cart_items=tot_cart_items+1;
}

get_cart(l,prod_name,price,prod_price);
UpdatePromoOffer();
}
else
{
alert('Please enter valid quantity');
}
}


function add_item_dvd(k,prod_name, l,price,prod_price)
//add_item(11,'prod name',1.99,
{
var WT_POSITIVE_NUMBER = /^[0-9]+\.*[0-9]*$/;

if (/^[0-9]+\.*[0-9]*$/.test(l.toString())  && l > 0){
var exists_flag=0,exists_i=0;
alert('This item will now be added to your shopping cart');

 
if (k>=1 && k<=5)
{
 	check_n_remove_item_dvd(k);
 
}
 

for (i=0; i <tot_cart_items; i++)
{
 

if (my_shopping_cart[i][0]==k) //check if item exists
{
    exists_flag=1;
    exists_i=i;	 
	break;
}

} 
if (exists_flag==1 ) 
{

        my_shopping_cart[exists_i][1]=(parseInt(my_shopping_cart[exists_i][1]) +parseInt(l) ).toString();
        //alert(my_shopping_cart[exists_i][3]);
        if ((parseFloat(my_shopping_cart[exists_i][3]) > parseFloat(price)) && price != -1)
        {
	        my_shopping_cart[exists_i][3]=price;        	
	        my_shopping_cart[exists_i][4]=prod_name;
	        my_shopping_cart[exists_i][5]=prod_price;	       
        }
}
 
if (exists_flag!=1 ) 
{ 
        my_shopping_cart[tot_cart_items][0]=k; //item
        my_shopping_cart[tot_cart_items][1]=l;//qty
        my_shopping_cart[tot_cart_items][2]="1";
        my_shopping_cart[tot_cart_items][3]=price;
        my_shopping_cart[tot_cart_items][4]=prod_name;        
        my_shopping_cart[tot_cart_items][5]=prod_price;       
        //alert('helo?');
        tot_cart_items=tot_cart_items+1;
}

get_cart(l,prod_name,price,prod_price);
//UpdatePromoOffer();
}
else
{
alert('Please enter valid quantity');
}
}

function clearRB(buttonGroup)
{
  for (i=0; i < buttonGroup.length; i++) {
 
    if (buttonGroup[i].checked == true) { // if a button in group is checked,
          buttonGroup[i].checked = false;  // uncheck it
      }
     
  }  
}

function check_n_remove_item(k)
{
	var exists;
	exists=0;
	
	for(i=0;i<tot_cart_items;i++)
	{
		 if (my_shopping_cart[i][0] >=1 && my_shopping_cart[i][0]<=5)
		{
			remove_item(i); 
			break;
		}	
	}
 
}



function check_n_remove_item_dvd(k)
{
	var exists;
	exists=0;
	
	for(i=0;i<tot_cart_items;i++)
	{
		 if (my_shopping_cart[i][0] >=1 && my_shopping_cart[i][0]<=5)
		{
			remove_item_dvd(i); 
			break;
		}	
	}
 
}


function remove_item(k)
{
//alert(k);
if (k<(tot_cart_items))
	for(i=k;i<tot_cart_items-1;i++)
	{
//alert(my_shopping_cart[i+1][0]);
		my_shopping_cart[i][0]=my_shopping_cart[i+1][0];
		my_shopping_cart[i][1]=my_shopping_cart[i+1][1];
		my_shopping_cart[i][2]=my_shopping_cart[i+1][2];
		my_shopping_cart[i][3]=my_shopping_cart[i+1][3];
		my_shopping_cart[i][4]=my_shopping_cart[i+1][4];
		my_shopping_cart[i][5]=my_shopping_cart[i+1][5];
//alert('X:'+ my_shopping_cart[i][0]);
	}
tot_cart_items=tot_cart_items-1;
//build_global_var_from_array();
get_cart(-1,-1);
UpdatePromoOffer();
}

function remove_item_dvd(k)
{
//alert(k);
if (k<(tot_cart_items))
	for(i=k;i<tot_cart_items-1;i++)
	{
//alert(my_shopping_cart[i+1][0]);
		my_shopping_cart[i][0]=my_shopping_cart[i+1][0];
		my_shopping_cart[i][1]=my_shopping_cart[i+1][1];
		my_shopping_cart[i][2]=my_shopping_cart[i+1][2];
		my_shopping_cart[i][3]=my_shopping_cart[i+1][3];
		my_shopping_cart[i][4]=my_shopping_cart[i+1][4];
		my_shopping_cart[i][5]=my_shopping_cart[i+1][5];
//alert('X:'+ my_shopping_cart[i][0]);
	}
tot_cart_items=tot_cart_items-1;
//build_global_var_from_array();
get_cart_dvd(-1,-1);
//UpdatePromoOffer();
}

function remove_item_from_view_cart(k)
{
	if (k<(tot_cart_items-1))
for(i=k;i<tot_cart_items;i++)
{
	my_shopping_cart[i][0]=my_shopping_cart[i+1][0];
	my_shopping_cart[i][1]=my_shopping_cart[i+1][1];
	my_shopping_cart[i][2]=my_shopping_cart[i+1][2];
}
	tot_cart_items=tot_cart_items-1;
	get_view_cart();
}

function get_view_cart()
{

var str,i;
var k9;
var amt=0;

//alert(global_sess);
//str="<table>";
str=" <table width='96%' border='0' align='center' cellpadding='0' cellspacing='0' valign='top'>";

if (tot_cart_items<=0 )
	str=str +  "<tr><td colspan=4>Your shopping cart is empty</td></tr>"  ;
else
{
for (i=0; i <tot_cart_items; i++)
	if (my_shopping_cart[i][2]=="1")
	{
	k9=parseInt(my_shopping_cart[i][0]);

	if (i%2 != 0)
	{
		str=str + "<tr bgcolor='#EEFFAC'>";
	}
	else
	{
		str=str + "<tr>";
	}


	str=str + "<td width='17%' height='20' align='center'>";//<img src='/ebay/product_information/a.gif' width='52' height='45' />";
	str=str +  "<td width='30%' class='black' valign='center' >&nbsp;&nbsp;&nbsp;" +my_shopping_cart[i][4]+ "</td>";
	//str=str +  "<td width='16%' class='black' align='center'>£" + product_item[k9][4] + " </td>" ;
	if (my_shopping_cart[i][3] != -1)
{
		str=str +  "<td width='16%' class='black' align='center'>£" + my_shopping_cart[i][5] + " </td>" ;

}
else
{
str=str +  "<td width='16%' class='black' align='center'>£" + my_shopping_cart[i][5] + " </td>" ;

}
	str=str +  "<td width='21%' class='black' align='center'>"+ my_shopping_cart[i][1] +"</td>" ; //qty
	str=str +  "<td width='21%' class='black'align='center' > <a style='cursor: pointer' class='red12bold' onclick='remove_item_from_view_cart(" + i.toString() + ");'>X</a></td>" ;
	str=str + "</tr>"

	//amt=amt+parseFloat(product_item[k9][4]) * parseFloat(my_shopping_cart[i][1]) ;
	if (my_shopping_cart[i][3] != -1)
	{
	amt=amt+parseFloat(my_shopping_cart[i][5]) * parseFloat(my_shopping_cart[i][1]) ;
}
else
{


amt=amt+parseFloat(my_shopping_cart[i][5]) * parseFloat(my_shopping_cart[i][1]) ;

}


	}


}

str=str + "</table>";

document.getElementById("cart").innerHTML=str;

document.getElementById("divCartTotal").innerHTML='';

document.getElementById("divCartTotal").innerHTML=Math.round(amt*100)/100;


document.getElementById("divFinalCheckoutTotal").innerHTML=+ roundNumber(Math.round(amt*100)/100 + Math.round(document.frmCheckOut.selShippingMethod.value*100)/100);
document.getElementById("divFinalCheckoutTotal").innerHTML=roundNumber(parseFloat(document.getElementById("divFinalCheckoutTotal").innerHTML)-parseFloat(document.getElementById("divDiscount").innerHTML));
//parseFloat(document.frmCheckOut.selShippingMethod.value);


build_global_var_from_array();



}



function build_paypal_var(me)
{


 var k9,amt=0;
 var strPaypal;
 strPaypal='';
var vCustom='';

// strPaypal='<form name="frmCheckOut" action="https://www.paypal.com/uk/cgi-bin/webscr?__track=_ext-enter:p/xcl/pay/buy-index-blank_reg:_xclick-user-submit" method="post" >'

 strPaypal=strPaypal + '<input type="hidden" name="business" value="info@theory-test.co.uk">';
 strPaypal=strPaypal + '<input type="hidden" name="cmd" value="_cart">';
 strPaypal=strPaypal + '<input type="hidden" name="upload" value="1">';
 if (tot_cart_items> 0 )
 {
//document.getElementById("txtPaypal").style.display="inline";

document.getElementById("txtPaypal").innerHTML="<b>Please wait...redirecting to paypal...</b>";
//alert(document.getElementById("txtPaypal").innerHTML);
 for (i=0; i <tot_cart_items; i++)
 	if (my_shopping_cart[i][2]=="1")//qty > 0
 	{
		k9=parseInt(my_shopping_cart[i][0]);
	
		//Assign here


if (document.getElementById("login") &&  (my_shopping_cart[i][0]>=1 && my_shopping_cart[i][0]<=5))
	{
		alert('You need to login or register to purchase instant online package');
		document.getElementById("login").focus();
		return false;
	}
	 
		strPaypal=strPaypal + '<input type="hidden" name="item_name_' + (parseInt(i) +1).toString() +'" value="'+ my_shopping_cart[i][4] +'">';
		if (my_shopping_cart[i][0] >=1 && my_shopping_cart[i][0] <=5)
		{
			strPaypal=strPaypal + '<input type="hidden" name="item_number_' + (parseInt(i) +1).toString() +'" value="'+my_shopping_cart[i][0].toString()+'">';	
		}
		else
		{
			strPaypal=strPaypal + '<input type="hidden" name="item_number_' + (parseInt(i) +1).toString() +'" value="'+my_shopping_cart[i][0].toString()+'">';	
		}
		strPaypal=strPaypal + '<input type="hidden" name="quantity_' + (parseInt(i) +1).toString() +'" value="'+my_shopping_cart[i][1]+'">';
		//strPaypal=strPaypal + '<input type="hidden" name="amount_' + (parseInt(i) +1).toString() +'" value="'+ my_shopping_cart[i][5] +'">';
		//alert(parseFloat(my_shopping_cart[i][5]) - (parseFloat(my_shopping_cart[i][5]) * 0.05) );
//alert(document.getElementById("hdnCheckPromo").value);
if (document.getElementById("hdnCheckPromo") && document.getElementById("hdnCheckPromo").value=="Y")
{

		strPaypal=strPaypal + '<input type="hidden" name="amount_' + (parseInt(i) +1).toString() +'" value="'+ roundNumber(parseFloat(my_shopping_cart[i][5]) - (parseFloat(my_shopping_cart[i][5]) * 0.05)) +'">';
}
else
{
strPaypal=strPaypal + '<input type="hidden" name="amount_' + (parseInt(i) +1).toString() +'" value="'+ my_shopping_cart[i][5] +'">';

}
	
		if (1==2)
		{
			if (my_shopping_cart[i][0].toString() == '55')
			
			{
				strPaypal=strPaypal + '<input type="hidden" name="tax_' + (parseInt(i) +1).toString() +'" value="0">';
				strPaypal=strPaypal + '<input type="hidden" name="amount_' + (parseInt(i) +1).toString() +'" value="'+ my_shopping_cart[i][5] +'">';
		
			}
			else
			{
			
				VAT= parseFloat(my_shopping_cart[i][5])* parseFloat(0.15);
				VAT2=Math.round(VAT*100)/100;
				price=parseFloat(my_shopping_cart[i][5])-parseFloat(VAT2);		
				strPaypal=strPaypal + '<input type="hidden" name="tax_' + (parseInt(i) +1).toString() +'" value="'+VAT2+'">';
				strPaypal=strPaypal + '<input type="hidden" name="amount_' + (parseInt(i) +1).toString() +'" value="'+ price +'">';
			
			}
		}

 	}
 
	strPaypal=strPaypal + '<input type="hidden" name="currency_code" value="GBP">';
	
	strPaypal=strPaypal + '<input type="hidden" name="discount_rate " value="5">';
	
	strPaypal=strPaypal + '<input type="hidden" name="return" value="http://www.theory-test.co.uk/asp/payment_thank_you.asp">';
	strPaypal=strPaypal + '<input type="hidden" name="cancel_return" value="http://www.theory-test.co.uk/asp/payment_cancel.asp">';

  
	strPaypal=strPaypal + '<input type="hidden" name="custom" value="'+assignCustom(me)+'">';

	document.getElementById("divForm").innerHTML=strPaypal;
	
	 // alert(strPaypal);
	document.frmCheckOut.submit();
 }
 else
 {
 	alert('Your shopping cart is empty');
 }


}

function onChangeUpdateCartTotal(selectObj)
{
	//alert('here');
//alert(roundNumber(parseFloat(document.frmCheckOut.selShippingMethod.value)));
	document.getElementById("divFinalCheckoutTotal").innerHTML= roundNumber(roundNumber(parseFloat(document.getElementById("divCartTotal").innerHTML)) + roundNumber(parseFloat(document.frmCheckOut.selShippingMethod.value)));
}

function add_item_and_checkout(k,l,price)
{ 

var exists_flag=0,exists_i=0;
alert('This item will now be added to your shopping cart');
for (i=0; i <tot_cart_items; i++)
if (my_shopping_cart[i][0]==k) //check if item exists
{
exists_flag=1;
exists_i=i;
}

if (exists_flag==1) 
{
my_shopping_cart[exists_i][1]=(parseInt(my_shopping_cart[exists_i][1]) +parseInt(l) ).toString();


if ((parseFloat(my_shopping_cart[exists_i][3]) > parseFloat(price)) && price != -1)
{

	my_shopping_cart[exists_i][3]=price;
}

}

else
{
my_shopping_cart[tot_cart_items][0]=k; //item
my_shopping_cart[tot_cart_items][1]=l;//qty

my_shopping_cart[tot_cart_items][2]="1";
my_shopping_cart[tot_cart_items][3]=price;
tot_cart_items=tot_cart_items+1;
}

//var str,i;
var k9,amt=0;

str="<table>";
if (tot_cart_items<=0 )
str=str +  "<tr><td colspan=4>Cart is empty</td></tr>"  ;
else
{
for (i=0; i <tot_cart_items; i++)
if (my_shopping_cart[i][2]=="1")
{
k9=parseInt(my_shopping_cart[i][0]);//item
//alert(k9);
if  (my_shopping_cart[i][3] == -1)
{
str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" +   product_item[k9][1] + " £" +product_item[k9][4] + "</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item(" + i.toString() + ");'>X</a></td></tr>"  ;
amt=amt+parseFloat(product_item[k9][4]) *parseFloat(my_shopping_cart[i][1]) ;
}
else
{
str=str +  "<tr><td valign=top>" + my_shopping_cart[i][1]   + " x </td><td width='130'>" +   product_item[k9][1] + " £" +parseFloat(my_shopping_cart[i][3]) + "</td><td> <a style='cursor: hand' class='red12bold' onclick='remove_item(" + i.toString() + ");'>X</a></td></tr>"  ;
amt=amt+parseFloat(my_shopping_cart[i][3]) *parseFloat(my_shopping_cart[i][1]) ;
}

}

//str=str +  "<tr><td colspan=4>____________________________</td></tr>"  ;
//str=str +  "<tr><td colspan=4> tot_cart_itemsal Invoice value : " + roundNumber(amt).toString() + "</td></tr>"  ;
}

str=str + "</table>";
//document.getElementById("cart").innerHTML=str;
//document.getElementById("product_value").innerHTML='£'+(Math.round(amt*100)/100).toString();
	if (tot_cart_items==0) 
		global_sess="";
	else
	for (i=0; i <tot_cart_items; i++)
	if (i==0)
		global_sess=my_shopping_cart[i][0] + "*" + my_shopping_cart[i][1] + "*" + my_shopping_cart[i][2] + "*" + my_shopping_cart[i][3] + "*" + my_shopping_cart[i][4] ;
	else
		global_sess=global_sess + "/" + my_shopping_cart[i][0] + "*" + my_shopping_cart[i][1] + "*" + my_shopping_cart[i][2] +"*" + my_shopping_cart[i][3] + "*" + my_shopping_cart[i][4] ;
//add_item("+i_item_cnt+",document.getElementById('txtQ" + product_item[i_item_cnt][0]+"').value,-1);
}
build_array_from_global_var();




