		 prod_init = null;  //Compare Data Stucture

		function compare_skus(compareChkStr, partnerID) {

			var e;
			var err = [];

      if(prod_init==null){
        initProdArray();
        prod_init = "init";
      }

			if (product_id.length < 2)  { err[err.length] = "You need to select a minimum of 2 products for comparision"; }
			if (product_id.length > 5) { err[err.length] = "You can select a maximum of 5 products for comparision."; }

			// alert("  pp len " + product_id.length);
			if ((product_id.length < 2) || (product_id.length > 5) ) {
			   message = 'Please review the following:\n\n';
			   for (e=0; e<err.length; e++) {
			       n=e+1;
			       message += n + '. ' + err[e];
			   }
			   // alert(message);
		     document.select_compare_form.compareChecks.value = product_id.join();
			   document.select_compare_form.compare_maxed.value = "true";
			   document.select_compare_form.action = "../list/compare.html" ;
			   document.select_compare_form.submit();
			} else {
			  // reset the value
			  document.select_compare_form.compareChecks.value = product_id.join();
			  //alert("  pp " +  document.select_compare_form.compareChecks.value.split(",") + " comp : " + product_id.join() );
			  url = "../list/compare.html?";

			  if(partnerID!=null && partnerID.length>0 ){
			    url = url + "partner_id=" + partnerID + "&";
			  }

			  url = url + "compareChecks=" + compareChkStr + "&chk_Compare=" ;

        url += product_id.join("&chk_Compare=");
			  window.location = url;
		  }
		}

		function populateCompare(productID){
		    product_id[product_id.length++] = productID;
		}

		function unpopulateCompare(productID){
		    start = getIndex(productID, product_id);
		    product_id.splice(start,1)
		}

    function updateCompareChecks(p_oid, check) {
      if(prod_init==null){
        initProdArray();
        prod_init = "init";
      }

      if (p_oid != "" && p_oid != null) {
        document.select_compare_form.compareChecks.value = p_oid + ", " + document.select_compare_form.compareChecks.value;
      }
      if(check){
        populateCompare(p_oid);
      }else{
        unpopulateCompare(p_oid);
      }
      //alert("product_id  " + product_id + " compChecks" + document.select_compare_form.compareChecks.value);
    }


    function setCompareChecksFromArray(){
      if(prod_init==null){
        initProdArray();
        prod_init = "init";
      }
      document.select_compare_form.compareChecks.value = product_id.join();
    }

		function getIndex(value, array){
		    for(i=0;i<array.length;i++){
		        if(array[i] == value) return i;
		    }
		}

    function initProdArray(){
      if(document.select_compare_form.compareChecks.value == null || document.select_compare_form.compareChecks.value.length == 0){
        product_id = new Array();
      }else{
        product_id = document.select_compare_form.compareChecks.value.split(',');
      }
    }


