String.prototype.hashCode=function(){
var hash=0, i, chr;
if(this.length===0) return hash;
for (i=0; i < this.length; i++){
chr=this.charCodeAt(i);
hash=((hash << 5) - hash) + chr;
hash |=0;
}
return hash;
};
function createCookie(name,value,days){
var expires="";
if(days){
var date=new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires="; expires=" + date.toUTCString();
}
document.cookie=name + "=" + value + expires + "; path=/";
}
function readCookie(name){
var nameEQ=name + "=";
var ca=document.cookie.split(';');
for(var i=0;i < ca.length;i++){
var c=ca[i];
while (c.charAt(0)==' ') c=c.substring(1,c.length);
if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name){
createCookie(name,"",-1);
}
(function ($){
$(document).ready((function (){
$("a.set_video_watched").each(function(){
if(readCookie($(this).attr('href').hashCode())){
$(this).siblings(".watched_video_container").addClass('watched');
}else{
$(this).siblings(".watched_video_container").removeClass('watched');
}});
$('body').on('click', 'a.set_video_watched, .set_video_watched_wrap a.fancybox-vimeo', function (){
var video_href=$(this).attr('href');
var video_href_hash=video_href.hashCode();
createCookie(video_href_hash, '1', 7);
$(this).closest('.vc_row').find('.watched_video_container').addClass('watched');
});
}));
})(jQuery);