﻿var TemplateMouseOver = 
{
    addData : function (p, position)
    {	
    if(p != null)
    {
	// old code
        $("div.MOwrapper").html("");
        if(p.Rows && parseInt(p.Rows.length) > 0)
        {  
            
            if(position == "right")
            {
                $("div.MOwrapper")
                //.append('<div class="rightarrow"><img src="../images/Right_arrow.png" alt="" /></div>')
                .append('<div class="rightarrow"><img src= ' + p.SitePath +"/images/Right_arrow.png" +' alt="" /></div>')
                .append
                (
                    $('<div class="rytbx"></div>')
                    .append('<div class="tp white">'+p.ItemName+'</div>')
                    .append
                    (
                        $('<div class="txtar"></div')
                        .append('<div class="srow price"><div class="xt">$'+p.ItemPrice+' </div></div>')
                        //'+ p.ItemEstimatedArrival+'
                        .append('<div class="est price"><div class="xt">Estimated Ship date  '+p.ItemEstimatedArrival+'  if Ordered Today By 3PM EST.</div></div>')
                        .append('<div class="stk"><div class="gr_11"><strong>Stock Number  : ' + p.StockNumber+'</strong></div> <div class="rytx price_11">&nbsp;</div></div>')
                    )
                    
                );
            }
            else
            {
                $("div.MOwrapper")
                .append('<div class="leftarrow"><img src='+ p.SitePath + "/images/left_arrow.png" + ' alt="" /></div>')
                .append
                (
                    $('<div class="rytbx"></div>')
                    .append('<div class="tp white">'+p.ItemName+'</div>')
                    .append
                    (
                        $('<div class="txtar"></div')
                        .append('<div class="srow price"><div class="xt">$'+p.ItemPrice+'</div></div>')
                        .append('<div class="est price"><div class="xt">Estimated Ship date  '+p.ItemEstimatedArrival+'  if Ordered Today By 3PM EST.</div></div>')
                        .append('<div class="stk"><div class="gr_11"><strong>Stock Number  : ' + p.StockNumber+'</strong></div> <div class="rytx price_11">&nbsp;</div></div>')
                    )
                );
            }
            $.each(p.Rows, function(i, Row)
            {
                if(Row.Text=="HEADING")
                {                    
                    $("div.MOwrapper div.rytbx div.txtar").append('<div class="hd"><div class="price"><strong>'+Row.label+'</strong></div> </div>');
                }
                else
                {
                    $("div.MOwrapper div.rytbx div.txtar").append('<div class="stp"><div class="gr_11"><strong>'+Row.label+'</strong></div> <div class="rytx price_11">'+Row.Text+'</div></div>');
                }
            });
        }
        }
        else
        {
            location.reload(true); 
        }
    },
    ShowMosueOver2:function(ItemID)
    {
       try
       { 
      
       uc_CompareProduct.GetItemInformationForPopUp(parseInt(ItemID), function(res){
        
       if(res.value == "error")
            {
                
            }
            else
            {  
               var p = eval("("+res.value+")");
                    
               TemplateMouseOver.addData(p);
               $("div.MOwrapper").show();
           }
        }); 
        }
        catch(e)
        {
            
        }    
        
    },
    ShowMosueOver:function(ItemID, obj, TemplateName)
    {       
           try
           {
//           if(isObject(uc_CompareProduct))
//           {
//               alert("exists");
//           }
//           else
//           {
//                alert("not exists");
//           }
            if (uc_CompareProduct != null && typeof uc_CompareProduct != "undefined") 
           // if (typeof uc_CompareProduct != "undefined") 
            {
                         uc_CompareProduct.GetItemInformationForPopUp(parseInt(ItemID), function(res){           
                       
                        
                        if(res.value == "error")
                        {
                            
                        }
                        else
                        {       
                            var p = eval("("+res.value+")");
                            
                            var offset = $(obj).offset();
                            var position = "left";
                            var divWidth = $("div.MOwrapper").width();
                            
                            if(offset.left < divWidth)
                            {
                                $("div.MOwrapper").css({"top":"" + (offset.top + 50) + "px","left":""+ (offset.left + 150) +"px"});
                            }
                            else if((screen.width - offset.left) < divWidth)
                            {
                                position = "right";
                                $("div.MOwrapper").css({"top":"" + (offset.top + 50) + "px","left":""+ (offset.left - 350) +"px"});
                            }
                            else
                            {
                                position = "right";
                                $("div.MOwrapper").css({"top":"" + (offset.top + 50) + "px","left":""+ (offset.left - 350) +"px"});
                            }
                            
                            TemplateMouseOver.addData(p, position);
                            $("div.MOwrapper").show();
                        }
                        
                    });  
            }
            else
            {
                 location.reload(true); 
            }
            
           
        }
        catch(e)
        {
            
        }
    },
    
    ShowMosueOut:function()
    {    
        
      $("div.MOwrapper").hide();
    }
};

$(document).ready(function () 
{
  $("div.MOwrapper").hide();
    
});

/*
{
    ItemID: '99266',
    ItemName: '0.09 Ct Round Loose Peridot',
    ItemPrice: '0',
    Rows: [
        {label:'Gemstone Information',Text:'HEADING'},
        {label:'Shape',Text:'Round'},
        {label:'Shape',Text:'Round'},
        {label:'Shape',Text:'Round'},
        {label:'Shape',Text:'Round'},
        {label:'Shape',Text:'Round'},
        {label:'Shape',Text:'Round'},
        {label:'Color Information',Text:'HEADING'},
        {label:'Shape',Text:'Round'}
    ]
}
*/


/*
{
TotalRecord: '2'
,StartRecord: '1'
,EndRecord: '3'
,PageSize: '3'
,View: true
,Remove: true,
RowHeaders:[
            {
                Rows:[
                        {label:'Price'}
                     ]
            }
            ,{
                label:'Ring Information'
                ,Rows:[
                        {label:'Metal'}
                        ,{label:'Rhodium'}
                        ,{label:'Actual Metal'}
                      ]
             }
             ,{
                label:'Gemstone Information'
                ,Rows:[
                        {label:'Shape'}
                        ,{label:'Setting Style'}
                        ,{label:'Minimum Carat Total Weight'}
                        ,{label:'Gemstone Dimensions'}
                        ,{label:'Gemstone'}
                        ,{label:'Average Color'}
                        ,{label:'Average Quality'}
                        ,{label:'Number of Stones'}
                    ]
              }
              ,{
                label:'Color Information'
                ,Rows:[
                        {label:'Color'}
                      ]
              }
          ]
          ,Cells: [
                    {
                        ItemID: '640'
                        ,ViewDetail:'http://192.168.0.15/Templates/Template4.aspx?ItemID=640'
                        ,Sections: [
                                        {
                                            label:'Header'
                                            ,Rows:[
                                                    {
                                                        Description:'Cts Diamond & 0.05 Cts Peridot Ring in 14K White Gold'
                                                        ,ImageUrl:'http://192.168.0.15/images/user_images/ZT289P.jpg'
                                                        ,ImageUrlBig:'http://192.168.0.15/images/user_images/ZT289P_large.jpg'
                                                    }
                                                  ]
                                        }
                                        ,{
                                            Rows:[
                                                    {
                                                        label:'Price'
                                                        ,Text:'$250.00'
                                                    }
                                                ]
                                        }
                                        ,{
                                            label:'Ring Information'
                                            ,Rows:[
                                                    {
                                                        label:'Metal'
                                                        ,Text:'14K Gold'
                                                    },
                                                    {
                                                        label:'Rhodium'
                                                        ,Text:'Yes'
                                                    },
                                                    {
                                                        label:'Actual Metal'
                                                        ,Text:'14K Gold White'
                                                    }
                                                   ]
                                        }
                                        ,{
                                            label:'Gemstone Information'
                                            ,Rows:[
                                                    {
                                                        label:'Shape'
                                                        ,Text:'Cushion-Checker Board'
                                                    }
                                                    ,{
                                                        label:'Setting Style'
                                                        ,Text:'Prong Setting'
                                                    }
                                                    ,{
                                                        label:'Minimum Carat Total Weight',Text:'0.05'
                                                    }
                                                    ,{
                                                        label:'Gemstone Dimensions'
                                                        ,Text:'6 mm'
                                                    }
                                                    ,{
                                                        label:'Gemstone'
                                                        ,Text:'Peridot'
                                                    }
                                                    ,{
                                                        label:'Average Color'
                                                        ,Text:'Medium-Dark Green'
                                                    }
                                                    ,{
                                                        label:'Average Quality'
                                                        ,Text:'AA'},{label:'Number of Stones',Text:'1'}]},{label:'Color Information',Rows:[{label:'Color',Text:'Green, White'}]}]},{ItemID: '677',ViewDetail:'http://192.168.0.15/Templates/Template4.aspx?ItemID=677',Sections: [{label:'Header',Rows:[{Description:'Cts Diamond & 0.08 Cts Peridot Ring in 14K White Gold',ImageUrl:'http://192.168.0.15/images/user_images/ZT290P.jpg',ImageUrlBig:'http://192.168.0.15/images/user_images/ZT290P_large.jpg'}]},{Rows:[{label:'Price',Text:'$550.00'}]},{label:'Ring Information',Rows:[{label:'Metal',Text:'14K Gold'},{label:'Rhodium',Text:'Yes'},{label:'Actual Metal',Text:'14K Gold White'}]},{label:'Gemstone Information',Rows:[{label:'Shape',Text:'Cushion-Checker Board'},{label:'Setting Style',Text:'Prong Setting'},{label:'Minimum Carat Total Weight',Text:'0.08'},{label:'Gemstone Dimensions',Text:'8 mm'},{label:'Gemstone',Text:'Peridot'},{label:'Average Color',Text:'Medium-Dark Green'},{label:'Average Quality',Text:'AA'},{label:'Number of Stones',Text:'1'}]},{label:'Color Information',Rows:[{label:'Color',Text:'Green, White'}]}]}]}

*/