
 function midBox(){

 	   jQuery('.addProduct').click(function(){
	   		jQuery('#midBox').show(); 
			jQuery('#midBox .dragableBox').remove();
	   		var $this = jQuery(this).parent();
			var html = $this.html();
			var price = $this.find('.price').html();
			temp = Number(price) * .10; 
			price = Number(price) + Number(temp);
			price = price.toFixed(2);
	  		//alert(html);
			var z=0;
			var option="";
			 jQuery('#dropContent2 li').not(':first').each(function(){
				 z++;
				 option += "<option value='"+z+"'>"+z+"</option>";
			 });
			var cat = jQuery('#mycategoryid').html();
			
			jQuery('#midBox').append('<div class="dragableBox">'+html+'<div class="info">My price<input type="text" name="price" value="'+price+'"><br />Page<select id="myprice" name="page" >'+option+'</select><br />Category<select name="mycategoryid" id="mycategory"  >'+cat+'</select><br /><input type="submit" name="submitItem" id="submitItem" value="Add product"></br></div><div class="clear"></div></div>');
	   });
	   jQuery('#midBox #submitItem').click(function(){
	   		jQuery(this).parent().find(':input:first').val();
	   		var myprice = jQuery(this).parent().find(':input:first').val();
			//alert(myprice);
			var mypage = jQuery(this).parent().find('#myprice').val();
			//alert(mypage);
			var mycategory = jQuery(this).parent().find('#mycategory').val();
			//alert(mycategory);
			var myproduct = jQuery(this).parent().parent().find('#product_id').html();
			//alert(myremoveproduct);
			if(mycategory == '' || myprice== ''){
				alert('You need to pick a category or price');
			}else{
				jQuery.post("doba/wce.ajax.product.php", {myprice: myprice, mypage: mypage, mycategory:mycategory, myproduct:myproduct}, function(data){
					//alert(data);
					if(data.length >0) {	
						window.location.reload(true);
					}else{
						alert("didn't work")
					}
				});
				
			}
	   });
	   
 }
 jQuery(document).ready(function(){
 	jQuery('#available_products').click(function(){
		midBox();
	});
});

// remove removeproducts
function removeproduct(uniqueid, productId){
	//jQuery('.xprod').click(function(){
		jQuery.post("doba/wce.ajax.deleteproduct.php", {cmd: 'delete', id: uniqueid }, function(data){
			if(data == 'success'){
				$hide = jQuery("#ajaxedDragbox"+productId);
				$hide.hide('slow');
			}
		});
		//alert(uniqueid);
		
	//});
}
