// stores the reference to the XMLHttpRequest object
var xmlHttp = createXmlHttpRequestObject();
// variable to store product id 
var onload_prod_id = new Array();
// variable to store product name 
var onload_prod_name = new Array();
// variable to store the product number
var onload_prod_num = new Array();
// variable to store the images in the array 
var onload_prod_img = new Array();
var onload_prod_img1 = new Array();
var onload_prod_img2 = new Array();
var onload_prod_img3 = new Array();
var onload_prod_img4 = new Array();
var onload_prod_img5 = new Array();
var onload_prod_img6 = new Array();
// variable to store the description 
var onload_prod_description = new Array();
// variable to store colour in the array
var onload_prod_colour = new Array();
// variable to store the claroty of the diamond 
var onload_prod_clarity= new Array();
// variable to store the carat weight
var onload_prod_cw = new Array();
// variable to store shank style
var onload_prod_shank = new Array();
// variable to store setting
var onload_prod_setting = new Array();
// variable to diamonds measurement
var onload_prod_measurement = new Array();
// variable to diamonds price
var onload_prod_price = new Array();
// variable to diamonds reference number
var onload_prod_ref = new Array();
// variable to diamonds reference number
var blowers_contact = "01482221980";
// variable calculating the total number of products
var onload_product_total = '';
// calulating the total no of pages
var total_pages = '';
// no of pages 
var display_prod = '5';
var totalperpages = '';
var display_perpage = '5';
// main category product image variable
var product_image = new Array();

// maindivimage and maindivtitle variable
var maindivimg = '';
var maindivtitle = '';

var myDiv = '';

// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject()
{
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // if running Internet Explorer
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp = false;
    }
  }
  // if running Mozilla or other browsers
  else
  {
    try
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e)
    {
      xmlHttp = false;
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest object.");
  else
    return xmlHttp;
}

function onload_product(category)
{
	//alert("onload product - "+category);
	language_id='1';
	/*
	var rep_string = "#";
	var myOldString = category;

	var myNewString = myOldString.replace(/&/, rep_string);
	alert(myNewString);
	*/
	/*
	onload_prod_img = '';
	onload_prod_img1 = '';
	onload_prod_img2 = '';
	onload_prod_img3 = '';
	onload_prod_img4 = '';
	onload_prod_img5 = '';
	onload_prod_img6 = '';
	*/

	// only continue if xmlHttp isn't void
	if (xmlHttp)
	{
		// try to connect to the server
		try
		{

			//  var url = "language="+cat_lang+"&cat_number="+cat_num;
			//   var url = "language="+cat_lang;
			// ////alert(url); 
			// execute the quickstart.php page from the server
			xmlHttp.open("GET", "./xml/get_product_list_xml.php?product_name="+category+"&language="+language_id , true);
			document.getElementById('mainbodycontentright').innerHTML = '<img src="./images/waiting.gif">';
			// define the method to handle server responses
			xmlHttp.onreadystatechange =  onload_handleproduct_list;
			// make the server request
			xmlHttp.send(null);
		}
		// display the error in case of failure
		catch (e)
		{
			alert("Can't connect to server:\n" + e.toString());
		}
	}

}

// function called when the state of the HTTP request changes
function onload_handleproduct_list()
{
  //  ////alert("request");
  // when readyState is 4, we are ready to read the server response
  if (xmlHttp.readyState == 4)
  {
    // continue only if HTTP status is "OK"
    if (xmlHttp.status == 200)
    {
      try
      {
        // do something with the response from the server
        onload_handleproductResponse();
      }
      catch(e)
      {
        // display error message
        //alert("Error reading the response: " + e.toString());
      }
    }
    else
    {
      // display status message
      alert("There was a problem retrieving the data:\n" +
            xmlHttp.statusText);
    }
  }
}

// handles the response received from the server
function onload_handleproductResponse()
{

 // ////alert("handle");

  // read the message from the server
  var xmlResponse = xmlHttp.responseXML;
  // catching potential errors with IE and Opera
  if (!xmlResponse || !xmlResponse.documentElement)
    throw("Invalid XML structure:\n" + xmlHttp.responseText);
  // catching potential errors with Firefox
  var rootNodeName = xmlResponse.documentElement.nodeName;
  if (rootNodeName == "parsererror")
    throw("Invalid XML structure:\n" + xmlHttp.responseText);
  // obtain the XML's document element
  xmlRoot = xmlResponse.documentElement;
      
  product = xmlRoot.getElementsByTagName("Product")[0].firstChild.data;
  //alert("Category Name - "+product);
  product_image = xmlRoot.getElementsByTagName("Product-Image")[0].firstChild.data;
  //alert(product_image);
  onload_product_total = xmlRoot.getElementsByTagName("sub-product-total")[0].firstChild.data;
  //alert("total  - "+onload_product_total);

  // calulating the page no
  total_pages = Math.ceil(onload_product_total/display_prod);
  //alert("Total No of Pages - "+total_pages);
 
  
  
  
  if (product != "N/A") {
  	//alert("appending main image and title");
  	document.getElementById("title").innerHTML = ''; 
    var main_html = '';
    main_html = "<div class=\"title\" id=\"title\" style=\"width: 450px;\">"+product+"</div>";
    maindivtitle = document.getElementById("mainbodyheader"); 
    maindivtitle.innerHTML = '';
    maindivtitle.innerHTML = main_html;
	
	document.getElementById("mainbodycontentright").innerHTML= '';

	
  	var main_img = '';
	if (product_image != 'N/A') {
		// Ravi Bkp//main_img = "<img src=\"images/" + product_image + "\" width=\"485\" height=\"262\" name=\"" + product_image + "\" border=\"0\" />";
		main_img = "<img src=\"images/" + product_image + "\" name=\"" + product_image + "\" border=\"0\" />";
		maindivimg = document.getElementById("mainbodycontentright");
		maindivimg.innerHTML = main_img;
	}
	else{
		main_img = "<img src=\"images/ring-big.gif\" width=\"485\" height=\"262\" border=\"0\" />";
		maindivimg = document.getElementById("mainbodycontentright");
		maindivimg.innerHTML = main_img;
	}
	
	// appending the Browse title
	//var browse = '';
	//var browse_title = ''
	//browse_title = "BROWSE OUR "+product;
	//browse = document.getElementById("bottomtitle");
	//browse.innerHTML = browse_title;
	
  }
  else{
  	
	//alert("appending main image and title");
  	document.getElementById("title").innerHTML = ''; 
    var main_html = '';
    main_html = "<div class=\"title\" id=\"title\" style=\"width: 350px;\">"+product+"</div>";
    maindivtitle = document.getElementById("mainbodyheader"); 
    maindivtitle.innerHTML = '';
    maindivtitle.innerHTML = main_html;
	
	document.getElementById("mainbodycontentright").innerHTML= '';
  	var main_img = '';
	if (product_image != 'N/A') {
		main_img = "<img src=\"images/" + product_image + "\" width=\"485\" height=\"262\" name=\"" + product_image + "\" border=\"0\" />";
		maindivimg = document.getElementById("mainbodycontentright");
		maindivimg.innerHTML = main_img;
	}
	else{
		main_img = "<img src=\"images/ring-big.gif\" width=\"485\" height=\"262\" border=\"0\" />";
		maindivimg = document.getElementById("mainbodycontentright");
		maindivimg.innerHTML = main_img;
	}
	
	// appending the Browse title
	//var browse = '';
	//var browse_title = ''
	//browse_title = "BROWSE OUR "+product;
	//browse = document.getElementById("bottomtitle");
	//browse.innerHTML = browse_title;
	
  }

 
  if(xmlRoot.getElementsByTagName("sub-product-total")[0].firstChild.data == "No Products Present"){
  	  document.getElementById("bottomcontentright").innerHTML = '';
	  document.getElementById("bottomcontentleft").innerHTML = '';
  	  document.getElementById("prodnav").innerHTML = '';
	  var html = '';
  	  html = html +"<li class=\"prodnavimg\">No Products Present</li>";
      myDiv = document.getElementById("prodnav");
	  myDiv.innerHTML = html;	 
	 // document.getElementById("bottomtitle").innerHTML = '';
  }
  else{
  	
	  	document.getElementById("prodnav").innerHTML = '';
		
		for (var i=0;i<onload_product_total ;i++ )
		  {
			  var  onload_productid = xmlRoot.getElementsByTagName("product-id");
			  onload_prod_id[i] = onload_productid.item(i).firstChild.data;
		      //alert(onload_prod_id[i]);
			  
			  var  onload_product_num = xmlRoot.getElementsByTagName("product-no");
			  onload_prod_num[i] = onload_product_num.item(i).firstChild.data;
		  //  alert(sub_productname_value[i]);
			  
			  var  onload_product_name = xmlRoot.getElementsByTagName("product-name");
			  onload_prod_name[i] = onload_product_name.item(i).firstChild.data;
		  //  alert(sub_productname_value[i]);
	
		      var onload_product_desc = xmlRoot.getElementsByTagName("product-des");
			  onload_prod_description[i] = onload_product_desc.item(i).firstChild.data;	
			  
			  var onload_product_pr = xmlRoot.getElementsByTagName("product-price");
			  onload_prod_price[i] = onload_product_pr.item(i).firstChild.data;	  
	
		      var  onload_product_image = xmlRoot.getElementsByTagName("product-image");
			  onload_prod_img[i] = onload_product_image.item(i).firstChild.data;
		      //alert(onload_prod_img[i]);
		  
		  	  var  onload_product_image1 = xmlRoot.getElementsByTagName("product-image1");
			  onload_prod_img1[i] = onload_product_image1.item(i).firstChild.data;
		  		//alert(onload_prod_img1[i]);
		  
		      var  onload_product_image2 = xmlRoot.getElementsByTagName("product-image2");
			  onload_prod_img2[i] = onload_product_image2.item(i).firstChild.data;
		  //alert(onload_prod_img2[i]);
		  
		      var  onload_product_image3 = xmlRoot.getElementsByTagName("product-image3");
			  onload_prod_img3[i] = onload_product_image3.item(i).firstChild.data;
		  //  alert(sub_productname_value[i]);
		  
		      var  onload_product_image4 = xmlRoot.getElementsByTagName("product-image4");
			  onload_prod_img4[i] = onload_product_image4.item(i).firstChild.data;
		  //  alert(sub_productname_value[i]);
		  
		      var  onload_product_image5 = xmlRoot.getElementsByTagName("product-image5");
			  onload_prod_img5[i] = onload_product_image5.item(i).firstChild.data;
		      //alert(onload_prod_img5[i]);
		  
		      var  onload_product_image6 = xmlRoot.getElementsByTagName("product-image6");
			  onload_prod_img6[i] = onload_product_image6.item(i).firstChild.data;
		  //  alert(sub_productname_value[i]);
		  
		  	  var onload_product_col = xmlRoot.getElementsByTagName("product-colour");
			  onload_prod_colour[i] = onload_product_col.item(i).firstChild.data;		  
			  
			  var onload_product_clar = xmlRoot.getElementsByTagName("product-clarity");
			  onload_prod_clarity[i] = onload_product_clar.item(i).firstChild.data;
			  
			  var onload_product_carw = xmlRoot.getElementsByTagName("product-cw");
			  onload_prod_cw[i] = onload_product_carw.item(i).firstChild.data;
			  
			  var onload_product_ss = xmlRoot.getElementsByTagName("product-ss");
			  onload_prod_shank[i] = onload_product_ss.item(i).firstChild.data;
			  
			  var onload_product_set = xmlRoot.getElementsByTagName("product-setting");
			  onload_prod_setting[i] = onload_product_set.item(i).firstChild.data;
			  
			  var onload_product_m = xmlRoot.getElementsByTagName("product-m");
			  onload_prod_measurement[i] = onload_product_m.item(i).firstChild.data;
				  
			  var onload_product_rn = xmlRoot.getElementsByTagName("product-rn");
			  onload_prod_ref[i] = onload_product_rn.item(i).firstChild.data;
		  }
		  
		if(onload_product_total <= 5){
			var start_index = '0';
			var last_index = onload_product_total;
			var total_index = onload_product_total;
			load_images(onload_product_total, start_index, last_index);
		}
		else{
			var start_index = '0';
			var last_index = '5';
			var total_index = onload_product_total;
			load_images(onload_product_total, start_index, last_index);
			
			var html = '';
			var myDiv = '';
			html = html + "<a href=\"Javascript:Next('2');\"><img src=\"images/arrow-02-right.gif\" width=\"10\" height=\"11\" border=\"0\"></a>";
			myDiv = document.getElementById("bottomcontentright");
			myDiv.innerHTML = html;
		}
  }  
  
  
}

function load_images(image_total, start, end){
	//alert("more than 6 "+image_total+" start - "+start+" last -"+end);
	var myDiv = '';
	var html = '';
	for(var j=start;j< end;j++)
	{
		//////alert(j);
		if(onload_prod_img[j] != 'N/A')
		{
			html = html +"<li class=\"prodnavimg\"><img src=\"images/"+onload_prod_img[j]+"\" name=\""+onload_prod_name[j]+"\" border=\"0\" width=\"168\" height=\"119\" onClick=\"Product('"+j+"')\" /></li>";			
			myDiv = document.getElementById("prodnav");
		}
		else
		{
			html = html +"<li class=\"prodnavimg\"><img src=\"images/no-image.jpg\" border=\"0\" width=\"168\" height=\"119\" onClick=\"Product('"+j+"')\" /></li>";			
			myDiv = document.getElementById("prodnav");
		}
	}
	myDiv.innerHTML = html;
}

function Next(page_no){
	//alert(page_no)
	if(page_no == '1'){
		var start_index = '0';
		if(onload_product_total <= 5){
			last_index = onload_product_total;
		}
		else{
			last_index = '5';
		}
		var total_index = onload_product_total;
		load_images(onload_product_total, start_index, last_index);
	}
	else if(parseInt(page_no) < total_pages){
		//alert("not the last page")
		//alert(page_no)
		var prev_pageno = ''
		prev_pageno = parseInt(page_no)-1;
		var next_pageno = ''
		next_pageno = parseInt(page_no) + 1;
		
		var total_index = '';
		var start_index = '';
		var last_index = '';
		total_index = parseInt(page_no) * display_prod;
		start_index = total_index - parseInt(display_perpage);
		last_index = start_index + parseInt(display_perpage);
		//alert(total_index, start_index, last_index);
		//alert(start_index);
		//alert(last_index);
		load_images('', start_index, last_index);
		
		// appending the next image
		var next_img = '';
		var nextimg = '';
		nextimg = nextimg + "<a href=\"Javascript:Next('"+next_pageno+"');\"><img src=\"images/arrow-02-right.gif\" width=\"10\" height=\"11\" border=\"0\"></a>";
		next_img = document.getElementById("bottomcontentright");
		next_img.innerHTML = nextimg;
		
		// appending the previous image
		var prev_img = '';
		var previmg = '';
		previmg = previmg + "<a href=\"Javascript:Prev('"+prev_pageno+"');\"><img src=\"images/arrow-02-left.gif\" width=\"10\" height=\"11\" border=\"0\">";
		prev_img = document.getElementById("bottomcontentleft");
		prev_img.innerHTML = previmg;
	}
	else if(page_no == total_pages){
		var prev_pageno = ''
		prev_pageno = parseInt(page_no) - 1;
		var total_index = page_no * display_prod;
		var start_index = total_index - display_perpage;
		var last_index = onload_product_total;
		load_images('', start_index, last_index);
		
		//clearing the next icon 
		document.getElementById("bottomcontentright").innerHTML = '';
		// appending the previous page
		var html = '';
		var myDiv = '';
		html = html + "<a href=\"Javascript:Prev('"+prev_pageno+"');\"><img src=\"images/arrow-02-left.gif\" width=\"10\" height=\"11\" border=\"0\"></a>";
		myDiv = document.getElementById("bottomcontentleft");
		myDiv.innerHTML = html;
	}
}

function Prev(page_no){
	//alert("previous - "+page_no);
	if(page_no == '1'){
		var start_index = '0';
		if(onload_product_total <= 5){
			last_index = onload_product_total;
		}
		else{
			last_index = '5';
		}
		var total_index = onload_product_total;
		load_images(onload_product_total, start_index, last_index);
		
		var next_no = '';
		next_no = parseInt(page_no) + 1;
		
		// clearing the previous button
		document.getElementById("bottomcontentleft").innerHTML = '';
		//adding the next button		
		var next = '';
		var next_img = '';
		next_img = next + "<a href=\"Javascript:Next('"+next_no+"');\"><img src=\"images/arrow-02-right.gif\" width=\"10\" height=\"11\" border=\"0\">";
		next = document.getElementById("bottomcontentright");
		next.innerHTML = next_img;
	}
	else if(page_no < total_pages){
		var prev_pageno = ''
		prev_pageno = parseInt(page_no) - 1;
		var next_pageno = ''
		next_pageno = parseInt(page_no) + 1;
		var total_index = '';
		var start_index = '';
		var last_index = '';
		total_index = parseInt(page_no) * display_prod;
		start_index = total_index - parseInt(display_perpage);
		last_index = start_index + parseInt(display_perpage);
		//alert(total_index, start_index, last_index);
		//alert(start_index);
		//alert(last_index);
		load_images('', start_index, last_index);
		
		// appending the next image
		var next_img = '';
		var nextimg = '';
		nextimg = nextimg + "<a href=\"Javascript:Next('"+next_pageno+"');\"><img src=\"images/arrow-02-right.gif\" width=\"10\" height=\"11\" border=\"0\">";
		next_img = document.getElementById("bottomcontentright");
		next_img.innerHTML = nextimg;
		
		// appending the previous image
		var prev_img = '';
		var previmg = '';
		previmg = previmg + "<a href=\"Javascript:Prev('"+prev_pageno+"');\"><img src=\"images/arrow-02-left.gif\" width=\"10\" height=\"11\" border=\"0\">";
		prev_img = document.getElementById("bottomcontentleft");
		prev_img.innerHTML = previmg;
	}
}

function Product(number){
	//alert(number);
	var html = '';
	html = "<div class=\"mainbodycontentrightls\">";
	html = html +"<div class=\"otherviews\">";

	// clearing the browese option 
	document.getElementById("bottomtitle").innerHTML = '';

	//html = html + "";
	/*
	var first_thumb = '';
	first_thumb = "images/"+onload_prod_img1[number];

	var two_thumb = '';
	two_thumb = "images/"+onload_prod_img3[number];

	var three_thumb = '';
	three_thumb = "images/"+onload_prod_img5[number];
	*/
	// 
	
	
 
	
	if(  ( onload_prod_img2[number] !="N/A" && onload_prod_img4[number] !="N/A") ||  ( onload_prod_img2[number] !="N/A" && onload_prod_img6[number] !="N/A") ||  ( onload_prod_img4[number] !="N/A" && onload_prod_img6[number] !="N/A")  )
	{
		if(onload_prod_img2[number] != "N/A"){
			html = html + "Other Views:&nbsp;&nbsp<a href=\"Javascript:ThumgImage('"+number+"','1')\"><img src=\"images/"+onload_prod_img2[number]+"\" width=\"29\" height=\"29\" border=\"0\" ></a>";
		}
		
		if(onload_prod_img4[number] != "N/A"){
			
			html = html + "&nbsp;&nbsp<a href=\"Javascript:ThumgImage('"+number+"','2')\"><img src=\"images/"+onload_prod_img4[number]+"\" width=\"29\" height=\"29\" border=\"0\" ></a>";
		}
		if(onload_prod_img6[number] != "N/A"){
			html = html + "&nbsp;&nbsp<a href=\"Javascript:ThumgImage('"+number+"','3')\"><img src=\"images/"+onload_prod_img6[number]+"\" width=\"29\" height=\"29\" border=\"0\" ></a>";
		}
	}
	/*
	if(onload_prod_img2[number] != 'N/A'){
		html = html + "Other Views:&nbsp;&nbsp<a href=\"Javascript:blendimage('blenddiv', 'blendimage', '"+first_thumb+"', 200)\"><img src=\"images/"+onload_prod_img2[number]+"\" width=\"29\" height=\"29\" border=\"0\" onClick=\"blendimage('blenddiv', 'blendimage', '"+first_thumb+"', 200)\"></a>";
	}
	if(onload_prod_img4[number] != 'N/A'){
		html = html + "&nbsp;&nbsp<a href=\"Javascript:blendimage('blenddiv', 'blendimage', '"+two_thumb+"', 400)\"><img src=\"images/"+onload_prod_img4[number]+"\" width=\"29\" height=\"29\" border=\"0\" onClick=\"blendimage('blenddiv', 'blendimage', '"+two_thumb+"', 400)\"></a>";
	}
	if(onload_prod_img6[number] != 'N/A'){
		html = html + "&nbsp;&nbsp<a href=\"Javascript:blendimage('blenddiv', 'blendimage', '"+three_thumb+"', 600)\"><img src=\"images/"+onload_prod_img6[number]+"\" width=\"29\" height=\"29\" border=\"0\" onClick=\"blendimage('blenddiv', 'blendimage', '"+three_thumb+"', 600)\"></a>";
	}*/
	//<img src=\"images/"+onload_prod_img[number]+"\" width=\"29\" height=\"29\">&nbsp;&nbsp;<img src=\"images/ring-view-01.gif\" width=\"29\" height=\"29\">";
	html = html + "</div>";
	html = html + "<div class=\"mainimage\" id=\"mainimage\">";
	if(onload_prod_img1[number] != 'N/A')
	{
		html = html + "<img src=\"images/"+onload_prod_img1[number]+"\" width=\"330\" height=\"250\">";
		html = html + "</div>";
	}
	else
	{
		html = html + "<img src=\"images/no-image-main.jpg\" width=\"330\" height=\"250\">";
		html = html + "</div>";
	}
	/*
	html = html + "<div class=\"mainimage\" style=\"background-image: url(images/"+onload_prod_img1[number]+"); background-repeat: no-repeat; width=\"330\" height=\"250\";\" id=\"blenddiv\">";
	html = html + "<img src=\"images/"+onload_prod_img1[number]+"\" id=\"blendimage\" style=\"border: 0 none; filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0;\" width=\"330\" height=\"250\">";
	html = html + "</div>";
	*/
	html = html + "</div>";
	
	html = html + "<div class=\"mainbodycontentrightrs\">";
	html = html + "<div class=\"mainbodycontentrightrsprodtitle\">";
	if (onload_prod_description[number] != "N/A") {
		html = html + onload_prod_description[number];
	}
	else {
		html = html + "";
	}
    html = html + "</div>";
	
	html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
	if (onload_prod_colour[number] != "N/A") {
		html = html + "COLOUR: "+onload_prod_colour[number];
	}
	html = html + "</div>";

	
	if (onload_prod_clarity[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";	
		html = html + "CLARITY: "+onload_prod_clarity[number];
		html = html + "</div>";
	}
	/*else{
		html = html + "CLARITY: ";
	}*/


	


	if (onload_prod_cw[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "CARAT WEIGHT: "+onload_prod_cw[number];
		html = html + "</div>";	
	}
	/*else{
		html = html + "CARAT WEIGHT: ";
	}*/


	

	
	if (onload_prod_shank[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "SHANK STYLE: "+onload_prod_shank[number];
		html = html + "</div>";
	}
	/*else{
		html = html + "SHANK STYLE: ";
	}*/	


		


	if (onload_prod_setting[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "SETTING: "+onload_prod_setting[number];
		html = html + "</div>";	
	}
	/*else{
		html = html + "SETTING: ";
	}*/	
00

		


	if (onload_prod_measurement[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "MEASUREMENTS: "+onload_prod_measurement[number];
		html = html + "</div>";		
	}
	/*else{
		html = html + "MEASUREMENTS: ";
	}*/	


	
	

	if (onload_prod_price[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "PRICE: &pound;"+onload_prod_price[number];
		html = html + "</div>";
	}
	/*else{
		html = html + "PRICE: ";
	}*/	

	
	

	if (onload_prod_ref[number] != "N/A") {
		html = html + "<div class=\"mainbodycontentrightrsprodvalue\">";
		html = html + "REFERENCE NUMBER: "+onload_prod_ref[number];
		html = html + "</div>";	
	}
	/*else{
		html = html + "REFERENCE NUMBER: ";
	}*/	
	

		

	html = html + "<div class=\"mainbodycontentrightrscontact\">";
	html = html + "<a href=\"contact-us.php?category="+product+"&products_id="+onload_prod_id[number]+"\">Contact Us</a> <span class=\"blacklink\">for this item</span>";
	html = html + "</div>";
	
	//html = html + "<div><a href=\"shopping_cart.php?sort=2a&action=buy_now&products_id="+onload_prod_id[number]+"\" >Buy Now</a></div>";
	
	html = html + "</div>";
	document.getElementById("mainbodycontentright").innerHTML = html;
	
	/*
	
	//////alert('number - '+number);
	  //clearing the product before dispalying a new product 
	  document.getElementById("mainimage").innerHTML = '';
	  
	  // appending the table which append the first item
	  var first_product = '';
	  var myDiv='';

	  first_product = first_product + "<table width=\"100%\" border=\"1\"><tbody>";
	  first_product = first_product + "<tr><td width=\"50%\">"+onload_prod_name[number]+"</td><td align=\"right\" valign=\"middle\">"+blowers_contact+"</td></tr>";
	  // first tr which append 10 rows and the first td
	 
	  if(onload_prod_description[number] != "N/A")
	  {
	  	 first_product = first_product + "<tr><td rowspan=\"10\" align=\"middle\" valign=\"top\"><img src=\"images/"+onload_prod_img[number]+"\" width=\"250px\" ></td><td>"+onload_prod_description[number]+"</td></tr>";
	  }
	  else
	  {
		 first_product = first_product + "<tr><td rowspan=\"10\" align=\"middle\" valign=\"top\"><img src=\"images/"+onload_prod_img[number]+"\" width=\"250px\" ></td><td></td></tr>";
	  }
	  
	  // appending the next 10 rows to add the data
	  if(onload_prod_colour[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Colour: "+onload_prod_colour[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Colour: </td></tr>";	
	  }
	  
	  if(onload_prod_clarity[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Clarity: "+onload_prod_clarity[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Clarity: </td></tr>";	
	  }
	  
	  if(onload_prod_cw[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Carat Weight: "+onload_prod_cw[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Carat Weight: </td></tr>";	
	  }
	  
	  if(onload_prod_shank[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Shank Style: "+onload_prod_shank[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Shank Style: </td></tr>";	
	  }
	  
	  if(onload_prod_setting[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Setting: "+onload_prod_setting[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Setting: </td></tr>";	
	  }
	  
	  if(onload_prod_measurement[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Measurements: "+onload_prod_measurement[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Measurements: </td></tr>";	
	  }
	  
	  if(onload_prod_price[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Price: "+onload_prod_price[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Price: </td></tr>";	
	  }
	  
	  if(onload_prod_ref[number] != "N/A")
	  {
	  	first_product = first_product + "<tr><td>Reference: "+onload_prod_ref[number]+"</td></tr>";	
	  }
	  else
	  {
		first_product = first_product + "<tr><td>Reference: </td></tr>";	
	  }

	  first_product = first_product + "<tr><td><b><a href=\"#\" >Contact Us</a></b> for this item</td></tr>";

	  first_product = first_product + "</tbody></table>";
	  myDiv = document.getElementById("mainimage");
	  myDiv.innerHTML = first_product;
	  //////alert("end of tab");
	  
	  */
}
/*
function blendimage(divid, imageid, imagefile, millisec) 
{
    var speed = Math.round(millisec / 100);
    var timer = 10;    
    //set the current image as background
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";    
    //make image transparent    
	changeOpac(0, imageid);    
    //make new image
    document.getElementById(imageid).src = imagefile;
    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }	
} 
function changeOpac(opacity, id) 
{
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
*/
function ThumgImage(num, image_no){
	
	var no = '';
	var imgno = '';
	no = parseInt(num);
	imgno = parseInt(image_no);
	//alert(no+" , "+imgno);
	
	if ((onload_prod_img1[no] != '') && (imgno == '1')) {
		var first_thumb = '';
		first_thumb = "images/" + onload_prod_img1[no];
		//alert(first_thumb);
		document.getElementById("mainimage").innerHTML = '';
		document.getElementById('mainimage').innerHTML = '<img src="./images/waiting.gif">';
		document.getElementById("mainimage").innerHTML = "<img src=\""+first_thumb+"\" width=\"330\" height=\"250\">";
	}
	else if ((onload_prod_img2[no] != '') && (imgno == '2')){
		var two_thumb = '';
		two_thumb = "images/" + onload_prod_img3[no];
		//alert(two_thumb);
		document.getElementById("mainimage").innerHTML = '';
		document.getElementById('mainimage').innerHTML = '<img src="./images/waiting.gif">';
		document.getElementById("mainimage").innerHTML = "<img src=\""+two_thumb+"\" width=\"330\" height=\"250\">";
	}
	else if ((onload_prod_img3[no] != '') && (imgno == '3')){
		var three_thumb = '';
		three_thumb = "images/" + onload_prod_img5[no];
		//alert(three_thumb);
		document.getElementById("mainimage").innerHTML = '';
		document.getElementById('mainimage').innerHTML = '<img src="./images/waiting.gif">';
		document.getElementById("mainimage").innerHTML = "<img src=\""+three_thumb+"\" width=\"330\" height=\"250\">";

	}
	
}


