Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

$(document).ready(function() {

$("#addtoresearch_submit").click(function(e){
  var product_id = $("#product_id").val();
  var get_url = "../myresearch/" + product_id;

  jQuery.ajax({
       url: get_url,
       type: "POST",
       contentType: "text/html",
       cache: false,
       success: function(html){
            if(html==1){
                alert("Item Added sucessfully");
                alert("return html is" + html)
                alert("Item Added sucessfully");
            }else{
                 alert("Sorry! Unexpected Error. Try again!");
            }
       }
  });
});
  return false;
});


var i=0;
var hh=265;
$(function()
{
     
     $('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
     $('#pane2').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
     $('#pane3').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
     $('#pane4').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
     var animActive = false;
     
     $('#pane1').scroll(function(){
          
          if (animActive == false &&  $("#pane1").offset().top < hh){
               animActive = true;
               
               $('div#pane1').fadeOut(100, function () {
                    addThreeResearch('resDiv');
                    i++;hh=hh-265;
                    var scrl = setTimeout( function(){
                         animActive = false;
                         $('div#pane1').fadeIn(500);
                    }, 500);
               });
     }
     });
     
     
     });





var selectCount=0;
var count=11;
var idCount=4;
var delCount=4;
function addNewResearch(vid){
alert(vid);
var html=document.getElementById(vid).innerHTML;
var newId="res"+idCount;
html = html+'';
var newCId="c"+idCount;
html = html.replace(/removeid/i,newId)
html = html.replace(/ccc/i,newCId)
$('#pane1').append(html);
if(delCount < 4){
     var ss = $('.jScrollPaneContainer').height();
     ss=ss+89;
     $('#pane1').parent().height(ss);
}
$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
idCount++;
delCount++;
}

function addThreeResearch(vid){
var html=document.getElementById(vid).innerHTML;
var newCId="c"+idCount;
var newId="res"+idCount;
idCount++;
var newCId1="c"+idCount;
var newId1="res"+idCount;
idCount++;
var newCId2="c"+idCount;
var newId2="res"+idCount;

html = html+'';
var html1=html+'';
var html2=html+'';

html = html.replace(/removeid/i,newId);
html = html.replace(/ccc/i,newCId);

html1 = html1.replace(/removeid/i,newId1);
html1 = html1.replace(/ccc/i,newCId1);

html2 = html2.replace(/removeid/i,newId2);
html2 = html2.replace(/ccc/i,newCId2);
var comphtml=html+html1+html2;
$('#pane1').append(comphtml);
if(delCount < 4){
     var ss = $('.jScrollPaneContainer').height();
     ss=ss+(3*89);
     $('#pane1').parent().height(ss);
}
$('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
idCount++;
delCount=delCount+3;
}


function deleteBox(){
var conf=confirm("Are you sure to delete selected item?");
if(conf){
     for(var i=1;i<50;i++){
     var id="c"+i;
     var checkBox=document.getElementById(id);
          if(checkBox != null){
          if(checkBox.checked){
               var tid="res"+i;
               if(document.getElementById(tid).style.display != 'none'){
                    document.getElementById(tid).style.display='none';
                    selectCount=parseInt(selectCount+1);
                    delCount--;
               }
               }
          }

     }

     if(delCount <= 3){
          //var ss = $('.jScrollPaneContainer').height();
          var setVal = ((89)*(delCount-1));
          $('#pane1').parent().height(setVal);
     }
     selectCount=0;
     $('#pane1').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});


}
}