<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

session_start();

include("../include/config.php");
include("../include/simpleimage.php");
include("../include/functions.php"); 

 validate_admin();

  

  if($_REQUEST['submitForm']=='yes'){
$plan_name="promotion";
  if($_REQUEST['id']=='add'){
        $i = 0;
		$obj->query("delete from tbl_promotion_data where type=2");
		$obj->query("delete from tbl_promotion_data where type=1");
		
		
		foreach ($_REQUEST['ing_value_c'] as $key => $val) {
            $i++;
			$ing_name_c = mysqli_real_escape_string($GLOBALS['conn'],$val);
			
            $ing_value_c = $ing_name_c;
			$ing_desc_c = $_REQUEST['ing_desc_c'][$key];
			$ing_short_c = $_REQUEST['ing_short_c'][$key];
		
			$ing_url_c = $_REQUEST['ing_url_c'][$key];
           
           if(!empty($ing_name_c) && !empty($ing_value_c)){
         
            $obj->query("INSERT INTO tbl_promotion_data set coupon_code='$ing_value_c ',main_description='$ing_desc_c',short_description='$ing_short_c',store_url='$ing_url_c',status=1,type=1");
       
		}
		}// for ecah loop
		
        foreach ($_REQUEST['ing_value'] as $key => $val) {
            $i++;
			$ing_name = mysqli_real_escape_string($GLOBALS['conn'],$val);
			
            $ing_value = $ing_name;
			$ing_desc = $_REQUEST['ing_desc'][$key];
			$ing_short = $_REQUEST['ing_short'][$key];
			$exist_icon = $_REQUEST['exist_icon'][$key];
			$ing_url = $_REQUEST['ing_url'][$key];
            $exist_id =$_REQUEST['exist_id'][$key];
            $ing_icon='';
           if(!empty($ing_name) && !empty($ing_value)){
                if ($_FILES['ing_icon']['size'][$key] > 0 && $_FILES['ing_icon']['error'][$key] == '') {
                   $product_pic = preg_replace('/[0-9\@\.\;\" "]+/', '', $plan_name);
                   $str = strtr( $product_pic, $unwanted_array );
                    $product_img_name = buildURL($str);
                    $Image = new SimpleImage();
                    $filename = $_FILES['ing_icon']['name'][$key];
    				$tempfilename=$_FILES['ing_icon']['tmp_name'][$key];
                    $ext = pathinfo($filename, PATHINFO_EXTENSION);
                    $ing_icon = time() . "-" . $product_img_name . $i . "." . $ext;
    				     //ftp start
    	           require_once __DIR__ . '/../include/S3Helper.php';
                    $s3Helper = new S3Helper(); // or however you instantiate it in your project
    
                    $tempFilePath = $_FILES['ing_icon']['tmp_name'][$key];
                    $destination  = 'upload_images/promotion';

                        if ($ing_icon != '') {
                            $s3Helper->upload($tempFilePath, $destination, $ing_icon);
                        }
        			if($ing_icon!=''){
        				$ing_icon=$ing_icon;
        			} else {
        				$ing_icon=$exist_icon;
        			}
		
            $obj->query("INSERT INTO tbl_promotion_data set coupon_code='$ing_value ',main_description='$ing_desc',short_description='$ing_short',store_logo='$ing_icon',store_url='$ing_url',status=1,type=2");
        
		
		}
		}// for ecah loop
	 
}
       }
      
	

 header("location:quicklly-promotion-addf.php");

exit();

  }      

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><?php echo SITE_TITLE; ?></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="css/admin.css" rel="stylesheet" type="text/css" />
<style>
        .clsTemplate {
            display: none;
        }

        .clsMenuBanners {
            border: 1px solid rgb(195, 195, 195);
            padding:5px;
            width: 450px;
            border-radius: 2px;
        }

            .clsMenuBanners a.clsAddBtn {
                background-color: #0971a2;
                color: #FFFFFF;
                font-family: Verdana, Arial, Helvetica, sans-serif;
                font-size: 12px;
                border-radius: 5px;
                text-decoration: none;
                outline: none;
                display: inline-block;
                padding: 3px 5px;
            }

            .clsMenuBanners a.clsRemoveBtn {
                margin-left: 5px;
                display: inline-block;
                width:18px;
                height: 18px;
                background-image: url(../images/del.png);
                background-repeat: no-repeat;
                background-size: contain;
                background-position: center center;
            }

            .clsMenuBanners .clsBanners .clsBanner {
                display: none;
                background-color: #fff;
                margin-bottom: 10px;
                border-bottom: 1px solid #ccc;
                padding-bottom: 5px;
                cursor:move;
            }
      </style>

      <style>
        .clsSizes {
            border: 1px solid rgb(195, 195, 195);
            width: 500px;
            border-radius: 2px;
            padding: 5px;
        }

        .clsSizes .clsSize {
            padding: 10px 10px 15px 10px;
            display: none;
            grid-template-columns: repeat(2, 1fr);
            grid-gap: 10px;
            border-bottom: 1px solid #ccc;
            margin-bottom: 10px;
        }

        .clsSizes .clsSize .clsLabel {
           padding: 0;
           margin: 0;
        }

        .clsSizes .clsSize .clsValue {
           width: 90%;
        }

        .clsSizes a.clsAddBtn {
            background-color: #0971a2;
            color: #FFFFFF;
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            border-radius: 5px;
            text-decoration: none;
            outline: none;
            display: inline-block;
            padding: 3px 5px;
        }

        .clsSizes a.clsRemoveBtn {
            margin-left: 5px;
            display: inline-block;
            width:18px;
            height: 18px;
            background-image: url(../images/del.png);
            background-repeat: no-repeat;
            background-size: contain;
            background-position: center center;
            margin-top: 18px;
        }

        .clsTfnCustomize {
            border: 1px solid rgb(195, 195, 195);
            padding:5px;
            width: 267px;
            border-radius: 2px;
        }

        .clsTfnCustomize a.clsAddBtn {
            background-color: #0971a2;
            color: #FFFFFF;
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            border-radius: 5px;
            text-decoration: none;
            outline: none;
            display: inline-block;
            padding: 3px 5px;
        }

        .clsTfnCustomize a.clsRemoveBtn {
            margin-left: 5px;
            display: inline-block;
            width:18px;
            height: 18px;
            background-image: url(../images/del.png);
            background-repeat: no-repeat;
            background-size: contain;
            background-position: center center;
        }

            .clsGrps .clsGrp {
                display:none;
                background-color: #eee;        
                margin-bottom: 10px;
            }

                .clsGrps .clsGrp p {
                    margin: 0;        
                    color:#000;
                }

                .clsGrps .clsGrp .clsGrp-Name {
                    padding: 10px;
                    background-color: #ddd;
                    display: flex;
                    align-items: center;
                }

                .clsGrps .clsGrp .clsGrp-Name input[type=text] {
                    flex: 1;
                    margin-left: 5px;
                }

                .clsGrps .clsContent {
                    padding: 10px;
                }

                .clsGrps .clsContent .clsItems {
                    margin:0;
                    padding: 0;
                    margin-left: 18px;
                }

                    .clsGrps .clsContent .clsItems li {
                        display:none;
                        margin-bottom: 3px;
                    }

                    .clsGrps .clsContent .clsItems li:last-child {
                        margin-bottom: 7px;
                    }

                        .clsGrps .clsContent .clsItems li div {
                            display: flex;
                            align-items: center;
                        }

                            .clsGrps .clsContent .clsItems li div input[type=text] {
                                flex: 1;           
                            }
							
      </style>
<script type="text/javascript" language="javascript">

function validate(obj)

{

if(getRadioValue('valid_for')=='Particular' && !obj.to_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/) ){

alert("Please enter valid email.");

	obj.to_email.focus();

	return false;

	

}



if(obj.valid_time.value==''){

alert("Please enter Number of Uses.");

obj.valid_time.focus();

return false;	

}



if(obj.discount.value==''){

alert("Please enter discount.");

obj.discount.focus();

return false;	

}



if(obj.minimum_purchase.value==''){

alert("Please enter minimum purchase amount.");

obj.minimum_purchase.focus();

return false;	

}





if(obj.expire_date.value==''){

alert("Please select expire date.");

obj.expire_date.focus();

return false;	

}



}

function getRadioValue(groupName) {

    var _result;

    try {

        var o_radio_group = document.getElementsByName(groupName);

        for (var a = 0; a < o_radio_group.length; a++) {

            if (o_radio_group[a].checked) {

                _result = o_radio_group[a].value;

                break;

            }

        }

    } catch (e) { }

    return _result;

}

            function addSize(){
                var template = $('#tempSize').html();
                $('.clsSizes-List').append(template);

                var dvLast = $('.clsSizes-List .clsSize:last-child');

                $(dvLast).slideDown('normal', function () {
                    $(this).css('display','grid');
                    $(this).find('input[type=text]')[0].focus();
                });
            }
			function addCoupons(){
                var template = $('#tempCoupon').html();
                $('.clsCoupon-List').append(template);

                var dvLast = $('.clsCoupon-List .clsSize:last-child');

                $(dvLast).slideDown('normal', function () {
                    $(this).css('display','grid');
                    $(this).find('input[type=text]')[0].focus();
                });
				$('.clsBgColor').spectrum({
  type: "component"
});
            }
function removeCoupon(lnk){
                if(confirm('Remove Coupon?')){
                    $(lnk).closest('.clsSize').slideUp('normal', function () {
                        if($(this)[0].dataset.id != '0')
                           $('#hdnCouponsRemoveIDs')[0].value = $('#hdnCouponsRemoveIDs').val() + $(this)[0].dataset.id + ',';

                        $(this).remove();
                    });
                }
            }
            function removeSize(lnk){
                if(confirm('Remove size?')){
                    $(lnk).closest('.clsSize').slideUp('normal', function () {
                        if($(this)[0].dataset.id != '0')
                           $('#hdnSizeRemoveIDs')[0].value = $('#hdnSizeRemoveIDs').val() + $(this)[0].dataset.id + ',';

                        $(this).remove();
                    });
                }
            }
			
</script>

</head>

<body>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">

<?php include("header.php") ?>

<tr>

	<td align="right" class="paddRtLt70" valign="top">

		<table width="99%" border="0" cellspacing="0" cellpadding="0">
         <tr>

							<td align="left" valign="middle" class="headingbg bodr text14">

					<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: Update Promotion 

					<span  style="float:right; padding-right:10px;">

					</span></td>

						</tr>

						

						<tr>

							<td height="100" align="left" valign="top" bgcolor="#f3f4f6" class="bodr">
</td>
                          </tr>
			<tr>

			

				<td align="right" valign="top">

					  <form name="frm" method="POST" enctype="multipart/form-data" action="" onsubmit="return validate(this)"><table width="100%" border="0" cellspacing="0" cellpadding="0">

						

						<input type="hidden" name="submitForm" value="yes" />

						<input type="hidden" name="id" value="add" />
						 <input type="hidden" name="hdnSizes" id="hdnSizes" value="">
                         <input type="hidden" name="hdnSizeRemoveIDs" id="hdnSizeRemoveIDs" value="">
						 <input type="hidden" name="hdnCoupons" id="hdnCoupons" value="">
                         <input type="hidden" name="hdnCouponsRemoveIDs" id="hdnCouponsRemoveIDs" value="">
 <tr>
<td align="right" style="padding:20px 0px 20px 0px;" class="paddBot11 paddRt14"><strong style="font-size:20px;">Coupons for you :</strong></td>
  </tr>
  
						            
			  
<?php $sqloption=$obj->query("SELECT * FROM tbl_promotion_data WHERE type=1 and status=1");
$numoption=$obj->numRows($sqloption);
if($numoption==0){ ?>
			   <tr>
                 
                  <td align="left" class="paddBot11">
				  <table>
				
				   <td><strong>Coupon Code:</strong> <input type="text" required name="ing_value_c[]" /></td>
				  <td><strong>Description:</strong> <input type="text" name="ing_desc_c[]" /></td>
				  <td><strong>Short Description:</strong> <input type="text" name="ing_short_c[]" /></td>
				  <td><strong>Url</strong> <input type="text" name="ing_url_c[]" /></td>
                  </tr>
				  <tr><td colspan="3" id="resultFieldc"></td></tr>
				  <tr>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="left" class="paddBot11">
                                     <a href="javascript:void(0)" id="addc"> <img src="images/add.png" title="Add More" border="0" /></a>&nbsp;
                                     <a href="javascript:void(0)" id="removec"> <img src="images/remove.png" title="Remove" border="0" /></a>
                                      </td>
							  </tr>
				  </table></td>
               </tr>
			   <?php }else{ ?>
			   <tr>
                  <td align="right" class="paddBot11 paddRt14"><strong>Coupon For You :</strong></td>
                 
                  <td align="left" class="paddBot11">
				 
				  <?php 
                                  $counter = 0;
                                  while($resultoption=$obj->fetchNextObject($sqloption)){  ?> 
                      <table class="addedfieldc" id="addedfieldc_<?php echo $counter;?>">
                                             
											 <tr>
											  <td><strong>Coupon Code:</strong> <input type="text" required name="ing_value_c[]" value="<?php echo $resultoption->coupon_code;?>"/></td>
				  <td><strong>Description:</strong> <input type="text" name="ing_desc_c[]" value="<?php echo $resultoption->main_description;?>"/></td>
				  <td><strong>Short Description:</strong> <input type="text" name="ing_short_c[]" value="<?php echo $resultoption->short_description;?>"/></td>
				  <td><strong>Url</strong> <input type="text" name="ing_url_c[]" value="<?php echo $resultoption->store_url;?>"/></td>

                                                  
                                            </tr>
                                        </table>
				  <?php 
                                  
                                  $counter++;
                                  } ?>
                    <table>
						   
				  <tr><td colspan="3" id="resultFieldc"></td></tr>
				  <tr>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="left" class="paddBot11">
                                     <a href="javascript:void(0)" id="addc"> <img src="images/add.png" title="Add More" border="0" /></a>&nbsp;
                                     <a href="javascript:void(0)" id="removec"> <img src="images/remove.png" title="Remove" border="0" /></a>
                                      </td>
							  </tr>
				  </table></td>
               </tr>
			   <?php } ?>
<tr>
<td align="right" style="padding:20px 0px 20px 0px;" class="paddBot11 paddRt14"><strong style="font-size:20px;">Store Deals :</strong></td>
  </tr>
  
						            
			  
<?php $sqloption=$obj->query("SELECT * FROM tbl_promotion_data WHERE type=2 and status=1");
$numoption=$obj->numRows($sqloption);
if($numoption==0){ ?>
			   <tr>
                 
                  <td align="left" class="paddBot11">
				  <table>
				  <tr><td><strong>Store Icon:</strong> <input type="hidden" name="exist_icon[]" value="" /><input type="hidden" name="exist_id[]" value="" />
				  <input type="file" name="ing_icon[]" width="100px" /></td>
				   <td><strong>Coupon Code:</strong> <input type="text"  name="ing_value[]" /></td>
				  <td><strong>Description:</strong> <input type="text" name="ing_desc[]" /></td>
				  <td><strong>Short Description:</strong> <input type="text" name="ing_short[]" /></td>
				  <td><strong>Url</strong> <input type="text" name="ing_url[]" /></td>
                  </tr>
				  <tr><td colspan="3" id="resultField"></td></tr>
				  <tr>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="left" class="paddBot11">
                                     <a href="javascript:void(0)" id="add"> <img src="images/add.png" title="Add More" border="0" /></a>&nbsp;
                                     <a href="javascript:void(0)" id="remove"> <img src="images/remove.png" title="Remove" border="0" /></a>
                                      </td>
							  </tr>
				  </table></td>
               </tr>
			   <?php }else{ ?>
			   <tr>
                  <td align="right" class="paddBot11 paddRt14"><strong>Store Deals :</strong></td>
                  <td align="left" class="paddBot11">
				 
				  <?php 
                                  $counter = 0;
                                  while($resultoption=$obj->fetchNextObject($sqloption)){  ?> 
                      <table class="addedfield" id="addedfield_<?php echo $counter;?>">
                                              <tr><td><strong>Store Icon:</strong> <input type="hidden" name="exist_icon[]" value="<?php echo $resultoption->store_logo; ?>" />
                                              <input type="hidden" name="exist_id[]" value="<?php echo $resultoption->id; ?>" />
                                              <input type="file" name="ing_icon[]"  width="100px" /><img width="40" src="<?php echo SITE_URL_CDN . '/upload_images/promotion/' . $resultoption->store_logo; ?>"></td> 
											 
											  <td><strong>Coupon Code:</strong> <input type="text" required name="ing_value[]" value="<?php echo $resultoption->coupon_code;?>"/></td>
				  <td><strong>Description:</strong> <input type="text" name="ing_desc[]" value="<?php echo $resultoption->main_description;?>"/></td>
				  <td><strong>Short Description:</strong> <input type="text" name="ing_short[]" value="<?php echo $resultoption->short_description;?>"/></td>
				  <td><strong>Url</strong> <input type="text" name="ing_url[]" value="<?php echo $resultoption->store_url;?>"/></td>

                                                  
                                            </tr>
                                        </table>
				  <?php 
                                  
                                  $counter++;
                                  } ?>
                    <table>
						   
				  <tr><td colspan="3" id="resultField"></td></tr>
				  <tr>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>
									  <td align="left" class="paddBot11">
                                     <a href="javascript:void(0)" id="add"> <img src="images/add.png" title="Add More" border="0" /></a>&nbsp;
                                     <a href="javascript:void(0)" id="remove"> <img src="images/remove.png" title="Remove" border="0" /></a>
                                      </td>
							  </tr>
				  </table></td>
               </tr>
			   <?php } ?>				   

									

									<tr>

									  <td align="right" class="paddRt14 paddBot11">&nbsp;</td>

									  <td align="left" class="paddBot11">&nbsp;</td>

							  </tr>

									<tr>

										<td width="18%" align="right" class="paddRt14 paddBot11">&nbsp;</td>

										<td width="82%" align="left" class="paddBot11">

											<input type="submit" name="submit" value="Submit"  class="submit" border="0" onclick="return setData();"/> 	                  		 &nbsp;&nbsp;

											<input name="Reset" type="reset" id="Reset" value="Reset" class="submit" border="0" /></td>

									</tr>

								</table></form>

							
						

						

					</table>

				</td>

			</tr>

		</table>

	</td>

</tr>

<?php include('footer.php'); ?>
<script>

                var sels = $('select.clsSelVal');
                for (i = 0; i < sels.length; i++) {
                   if(sels[i].dataset.val != '') {
                     sels[i].value = sels[i].dataset.val;
                     
                   
                }
				}

               $('.clsSizes-List .clsSize').css('display','grid');
			    $('.clsCoupon-List .clsSize').css('display','grid');
               $('.clsGrps .clsGrp').show();
               $('.clsGrps .clsGrp .clsItems li').show();
			   
			   
			   function setData(){
                // Sizes
                
                var sizes = $('.clsSizes-List .clsSize');
                var lstSizes = [];
				var coupons = $('.clsCoupon-List .clsSize');
                var lstCoupons = [];

                if(sizes.length > 0) {
                    for (var i = 0; i < sizes.length; i++) {
                        var _SizeName = $(sizes[i]).find('.clsSizeName').val().trim();

                        var s = {
                           ID: $(sizes[i])[0].dataset.id,
                           SizeName: _SizeName,
                           
                        }

                        lstSizes.push(s);
                    }

                    $('#hdnSizes').val(JSON.stringify(lstSizes));

                    if($('#hdnSizeRemoveIDs').val().trim() != '')
                        $('#hdnSizeRemoveIDs').val($('#hdnSizeRemoveIDs').val().trim().substring(0, $('#hdnSizeRemoveIDs').val().trim().length - 1));
                }
                else {
                  $('#hdnSizes').val('');

                  if(!$('#chkOnlyForAddOn')[0].checked){
                     alert('Add atleast one size!');
                     return false;
                  }
                }
			
				if(coupons.length > 0) {
                    for (var i = 0; i < coupons.length; i++) {
                        var _clsCode = $(coupons[i]).find('.clsCode').val().trim();
						 var _clsTitle = $(coupons[i]).find('.clsTitle').val().trim();
						 var _clsDiscount = $(coupons[i]).find('.clsDiscount').val().trim();
						 var _clsSortOrder = $(coupons[i]).find('.clsSortOrder').val().trim();
						 var _clsBgColor = $(coupons[i]).find('.clsBgColor').val().trim();
						 var _clsMinOrder = $(coupons[i]).find('.clsMinorder').val().trim();

                        var c = {
                           ID: $(coupons[i])[0].dataset.id,
                           CouponCode: _clsCode,
						    CouponTitle: _clsTitle,
							CouponDiscount: _clsDiscount,
							CouponSortOrder: _clsSortOrder,
							CouponBgColor: _clsBgColor,
							CouponMinOrder: _clsMinOrder,
							
                           
                        }

                        lstCoupons.push(c);
                    }

                    $('#hdnCoupons').val(JSON.stringify(lstCoupons));

                    if($('#hdnCouponsRemoveIDs').val().trim() != '')
                        $('#hdnCouponsRemoveIDs').val($('#hdnCouponsRemoveIDs').val().trim().substring(0, $('#hdnCouponsRemoveIDs').val().trim().length - 1));
                }
                else {
                  $('#hdnCoupons').val('');

                  if(!$('#chkOnlyForAddOn')[0].checked){
                     alert('Add atleast one size!');
                     return false;
                  }
                }

                
            }


</script>
   <script type="text/javascript">

	var counter = $(".addedfield").length;
	 $("#add").click(function(){
		 var tblid="addedfield_"+counter;$("#resultField").append('<table class="addedfield" width="100%" border="0" cellspacing="0" cellpadding="0" id="'+tblid+'" ><tr><td colspan="4" style="height:10px"></td></tr> <tr><td><strong>Store Icon:</strong> <input type="hidden" name="exist_icon[]" value="" /><input type="hidden" name="exist_id[]" value="" /><input type="file" name="ing_icon[]" width="100px" /></td><td><strong>Coupon Code:</strong> <input type="text" required name="ing_value[]" /></td><td><strong>Description:</strong> <input type="text" name="ing_desc[]" /></td><td><strong>Short Description:</strong> <input type="text" name="ing_short[]" /></td><td><strong>Url</strong> <input type="text" name="ing_url[]" /></td></tr></table>');
		 counter++;
		 })
		 $("#remove").click(function(){
		  counter=counter-1;
		  var tblid="#addedfield_"+counter;
		  $(tblid).remove();
		
		 })
		 var counter2 = $(".addedfieldc").length;
	 $("#addc").click(function(){
		 var tblid="addedfieldc_"+counter2;$("#resultFieldc").append('<table class="addedfieldc" width="100%" border="0" cellspacing="0" cellpadding="0" id="'+tblid+'" ><tr><td colspan="4" style="height:10px"></td></tr> <tr><td><strong>Coupon Code:</strong> <input type="text" required name="ing_value_c[]" /></td><td><strong>Description:</strong> <input type="text" name="ing_desc_c[]" /></td><td><strong>Short Description:</strong> <input type="text" name="ing_short_c[]" /></td><td><strong>Url</strong> <input type="text" name="ing_url_c[]" /></td></tr></table>');
		 counter2++;
		 })
		 $("#removec").click(function(){
		  counter2=counter2-1;
		  var tblid="#addedfieldc_"+counter2;
		  $(tblid).remove();
		
		 })
$('.clsBgColor').spectrum({
  type: "component"
});
</script>
</table>

</body>

</html>





