﻿

  
    
 function ShopcornDealType(ProdiD,url,PageNo,OrderBY) 
  {   
    
  //   product=  ""+website +"GetDealspopup.ashx?ProductId="+ProdiD+"&Pg="+PageNo+"&IsComparable=true&sid="+Math.random()+""
       product=  "../GetDealspopup.ashx?ProductId="+ProdiD+"&Pg="+PageNo+"&IsComparable=true&sid="+Math.random()+""     
  
  
    $(document).ready(function()
  { 
  $.ajaxSetup ({cache: false});
  $.ajax({
    method: "POST",
    url: product ,
   // contentType: "application/json; charset=utf-8",
   // dataType: "json",
   beforeSend : function(){
       $("div#GetProducts").fadeTo("slow", 100);
        $("div#mask").html('').show();
       //show image loading
  },
   success: function(response)
    //$('#mask')
          {   
             
               $("div#mask").html(response).show();
            
          }
});
   $("div#mask").bPopup({fadeSpeed:1, followSpeed:1,modalColor:'Black', opacity:0.8});


});

}


function UpdateLikeCount(LikeID)
{
    $(document).ready(function()
  { 
  $.ajaxSetup ({cache: false});
  $.ajax({
    method: "POST",
    url: "ProductRating.ashx?ProductID="+LikeID+"",
   success: function(response)
          {      $("a#a_"+LikeID+"").attr ('onclick', '');
                 $("p#p_Like_"+LikeID+"").attr('class', 'like-Image-click');
                  $("div#div_Like_"+LikeID+"").attr('class', 'like-count-click');      
               $("h1#likeCount_"+LikeID+"").html(response  + " </br>Likes").show();
              
         }
});

});




}
function showHide(type)
{  alerr
     if(type=="M")
     {
        $("#rightImage").show();
        $("#LeftImage").hide();
       $("div#LoadBrand").html("").show();
   }
   else
   {
      $("#Span2").hide();
     $("#Span1").show();
     $("div#LoadPrice").html("").show();
   }
}
  function onchangeCat(PageNo,OrderBY,PriceRange)
  { 

  var url =$("#ctl00_cp_hdnCategory").val();
    var Brandname =$("#ctl00_cp_hdnBrand").val();
     var product;
    
     if(PriceRange=="undefined" || PriceRange=="" ) 
     {
        if(Brandname=="undefined" || Brandname=="" )
        {
          product=  "../GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&Orderby="+OrderBY+""
       // product=  ""+website+"/GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&Orderby="+OrderBY+""
   
        }
        else
        {
        
         product=  "../GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&BrandName="+Brandname+""
        //  product=  ""+website+"/GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&BrandName="+Brandname+""
               
        }
    }
    else
    {
        if(Brandname=="undefined" || Brandname=="" )
        {
           product=  "../GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&Orderby="+OrderBY+"&priceRange="+PriceRange+""
    //    product=  ""+website+"/GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&Orderby="+OrderBY+"&priceRange="+PriceRange+""
           
        }
        else
        {
           product=  "../GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&BrandName="+Brandname+"&priceRange="+PriceRange+""
         // product=  ""+website+"/GetProductspop.ashx?CategoryName="+url+"&Pg="+PageNo+"&BrandName="+Brandname+"&priceRange="+PriceRange+""
           
        }
   
    
    }
    
  //alert(product);
    $(document).ready(function()
  { 
  $.ajaxSetup ({cache: false});
  $.ajax({
    method: "POST",
    url: product ,
   beforeSend : function(){
    $("#AjaxLoad").show();
       $("div#GetProducts").fadeTo("slow",0.22); //show image loading
  },
   success: function(response)
          {     $("#AjaxLoad").hide();
               
                 $("div#GetProducts").fadeTo("slow",1);
               $("div#GetProducts").html(response).show();
          }
});

});

}

function onchangeBrand(type,Code)
{ var CatID =$("#ctl00_cp_HdnCatID").val();
 var url =$("#ctl00_cp_hdnCategory").val();

  var website= $("#ctl00_cp_hdnUrl").val();
   if(website=='82.197.71.188')
{
website = 'http://82.197.71.188/shopcorntest';

}

     $(document).ready(function()
  { 
  $.ajaxSetup ({cache: false});
  $.ajax({
    method: "POST",
  //  url: ""+website +"ProductFinder.ashx?CatID="+CatID+"&url="+url +"&ManuFac=0&type="+type +"",
      url: "../ProductFinder.ashx?CatID="+CatID+"&url="+url +"&ManuFac=0&type="+type +"&CatCode="+Code +"",
   beforeSend : function(){
    if(type=="M")
    $("#ajaxBrand").show(); //show image loading
    else
    $("#ajaxPrice").show();
  },
   success: function(response)
          {   
              if(type=="M")
              { 
                $("#ajaxBrand").hide();
                $("#LeftImage").show();
               $("#rightImage").hide();
               $("div#LoadBrand").html(response).show();
              }
               else
               { 
               $("#ajaxPrice").hide();
                $("#Span2").show();
                $("#Span1").hide();
                 $("div#LoadPrice").html(response).show();
               }
         }
});

});

}


   /* Zoom Effects(pop) Effects */
   
   
    function LoadExtImgCategory(Website,imgCtrl, id, flag){
   imgCtrl.onload = null;
   
  imgCtrl.src =  ''+Website +'/images/products/'+id+'-'+flag+'-100-100.jpg';
  
  var imgSrc = imgCtrl.src.toLowerCase();

}
  
    function pop_close()
    { 
        $('#mask').hide();
    }
    
 function ZoomUpdate(zoomID)
 {  
$(document).ready(function() { 
 
    //select all the a tag with name equal to modal
    $('a[name=zoom_'+zoomID +']').click(function(e) {
        //Cancel the link behavior
       
        e.preventDefault();
        //Get the A tag
       
        var id = $(this).attr('href');
     
        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
   
        //Set height and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});
       
        //transition effect    
        $('#mask').fadeIn(100);   
        //$('#mask').fadeTo("slow",0.8); 
     
        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();
              
        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);
     
        //transition effect
        $(id).fadeIn(2000);
         
     
    });
     
    //if close button is clicked
   
     
    //if mask is clicked
   
     
});
 }
 
