$(document).ready(function() {
updateLatestProdsBox();
var ywlogo = filesPathVar+ "/global/images/catalogue/ywlogo.jpg";
var ywlogoOver = filesPathVar+ "/global/images/catalogue/ywlogo_over.jpg";

 $("#yonwooLogo").hover(
      function () {
        $(this).css('backgroundImage','url(' + ywlogoOver +')'); 
      
      }, 
      function () {
        $(this).css('backgroundImage','url(' + ywlogo +')'); 
      }
    );


$("#yonwooLogo").click(function()
{

  $.get(filesPathVar+'/global/includes/'+micrositeVar+'/catalogue/yonwoo.htm',"HTML",function(Data)
  {
    $("#ywBlock").html(Data).fadeIn('fast');


     $("#ywBlock .boxtop").append("<span>X</span>");


 var visitYWtext = "Visit Yonwoo\'s website";
switch(micrositeVar)
{
case "germany":
  visitYWtext = "Besuchen Sie die Website von Yonwoo";  break;
case "italy":
  visitYWtext = "Visiti il sito web di Yonwoo";  break;
case "turkey":
  visitYWtext = "Yonwoo\'s website"; break;
case "spain":
  visitYWtext = "Visite la página web de Yonwoo"; break;
case "france":
   visitYWtext = "Visiter le site web de Yonwoo"; break;
default:
   visitYWtext = "Visit Yonwoo\'s website";
}


     $("#ywBlock .boxbody").append("<a id=\"ywLink\" target=\"_blank\" href=\"http://www.yonwookorea.com/\">" + visitYWtext + "</a><div class=\"clearer\"></div>");




    $("#ywBlock .boxtop span").click(function()
       {
           $("#ywBlock").fadeOut('fast');
       });
       });
    });


$("#placeholder").scrollable({ 
     size: 1,
     vertical:true,
     loop: true,
     interval: 3500,
     speed: 1500,
    keyboard:false,   
    clickable: true
     
});




}); 

function updateLatestProdsBox()
{
           var myLatestProds = "";
           theLatestProds = readCookie('recentprods');
            if (theLatestProds != null) 
{
           theLatestProds = theLatestProds.replace('.1. ',' ');
           theLatestProds = theLatestProds.replace('.2. ',' ');
           theLatestProds = theLatestProds.replace('.3. ',' ');
           theLatestProds = theLatestProds.replace('.4. ',' ');
           theLatestProds = theLatestProds.replace('.5. ',' ');
          theLatestProds = theLatestProds.substring(0,theLatestProds.lastIndexOf(",")-1);

           var myLatestProds = theLatestProds.split(",");
         
       $("#placeholder").html("<div class=\"items\"></div>");
   if (myLatestProds.length>2)
   {
      for (i=0; i<myLatestProds.length-1; i++)
       {
        if (myLatestProds[i].indexOf(document.URL)== -1)
             $("#placeholder .items").append(myLatestProds[i]);
       }
     $(".recentProdCont").show();
    }
   else
   {
      $(".recentProdCont").hide();
    }
  
    }      
} 
