﻿$(document).ready(function() {
    //Full Caption Sliding (Hidden to Visible)
    $('.pcspot').hover(function() {
        $(".pcspot_curtain", this).stop().animate({ top: '70px' }, { queue: false, duration: 160 });
    }, function() {
        $(".pcspot_curtain", this).stop().animate({ top: '180px' }, { queue: false, duration: 160 });
    });
    $('.pcspot_curtain_host').click(function(){
    
    var pcid = ($(this).attr("pc"));
    var pcimage = ($("#SRC_" + pcid));
    
    //fill left column
    $("#productLogo").html($(".pcspot_curtain_host[pc='" + pcid + "'] .pcspot_image").html());
    $("#coName").html($(".pcspot_curtain_host[pc='" + pcid + "'] .companyname").html());
    $("#coName").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #companyUrl").attr('href'));
    $("#coAddress").html($(".pcspot_curtain_host[pc='" + pcid + "'] .companyaddress").html());
    $("#coUrl").html($(".pcspot_curtain_host[pc='" + pcid + "'] #companyUrl").text());
    $("#coUrl").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #companyUrl").attr('href'));
    
    //fill upper product area 
    $("#prodTitle").html($(".pcspot_curtain_host[pc='" + pcid + "'] .productname").html());
    $("#prodTitle").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #productUrl").attr('href'));
    $("#prodMsg").html($(".pcspot_curtain_host[pc='" + pcid + "'] .salesMessage").html());
    $("#productLink").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #productUrl").attr('href'));
    $("#productLink").html(('Learn more about the ' ) + ($(".pcspot_curtain_host[pc='" + pcid + "'] #prodCaption").html()));
    
    //fill lower company area
    $("#coTitle").html($(".pcspot_curtain_host[pc='" + pcid + "'] .companyname").html());
    $("#coTitle").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #companyUrl").attr('href'));
    $("#coMsg").html($(".pcspot_curtain_host[pc='" + pcid + "'] .companymessage").html());
    $("#coLink").html(('Visit ' ) + ($(".pcspot_curtain_host[pc='" + pcid + "'] .companyname").html()));
    $("#coLink").attr("href",$(".pcspot_curtain_host[pc='" + pcid + "'] #companyUrl").attr('href'));
        
    $.facebox({div:'#productDetails'});
   
    
    $(document).bind('close.facebox', function() { $('#productDetails','#companyInfo','#coName','#coMessages','#prodSalesMsg').html(''); })
    
    });
});

//jQuery(document).trigger('close.facebox');
//$('#facebox .content').empty();