/* Cufon */
Cufon.replace('#mini-cart', {
fontFamily: 'Gotham-Medium'
});
Cufon.replace('h2.page-title', {
fontFamily: 'Gotham-Medium'
});
Cufon.replace('#content', {
fontFamily: 'Gotham-Medium'
});
Cufon.replace('ul li', {
fontFamily: 'Gotham-Medium',
hover: true,
hoverables: {
'li': true
},
separate: 'none',
ignore: {
'ul': true
},
hover: {
color: '#fff' //you can also switch fonts using the hover function
}
});
$(function() {
//Draggable Init
$("#draggable").draggable({
handle: ".handle",
containment: 'window',
/* Check to see if the box has ever been dragged (for use in the resize function) */
drag: function() {
$.data(this, 'dragged', true);
},
open: function() {
$.data(this, 'dragged', false);
}
});
$(".handle").hover(function() {
$(this).stop().animate({
"opacity": 1
});
}, function() {
$(this).stop().animate({
"opacity": .5
});
});
//COOKIE FUNCTIONS!
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
} else var expires = "";
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);
}
//Set the move cookies on drag
$('#draggable').draggable({
start: function(event, ui) {
createCookie("move-icon", "move-icon", 30);
}
});
//if the move-icon cookie exists, don't show the move icon!
if (readCookie("move-icon") != null) {
$('.handle').css('background-image', 'url(assets/images/black_square.gif)');
}
//Set the coordinate cookies on drag stop
$('#draggable').draggable({
stop: function(event, ui) {
createCookie("draggableX", ui.position.left, 0);
createCookie("draggableY", ui.position.top, 0);
}
});
/*
If the box has been moved on a previous page, use our Cookie Functions to set the position to the same as the previous page.
Else, center it.
*/
if (readCookie("draggableY") != null) {
$('#draggable').css({
top: readCookie("draggableY") * 1,
left: readCookie("draggableX") * 1
}).draggable({
stop: function(event, ui) {
createCookie("draggableX", ui.position.left, 0);
createCookie("draggableY", ui.position.top, 0);
}
});
} else {
$(window).resize(function() {
$("#draggable").each(function() {
if (!$.data(this, 'dragged')) $('#draggable').css({
position: 'absolute',
left: ($(window).width() - $('#draggable').outerWidth()) / 2,
top: ($(window).height() - $('#draggable').outerHeight()) / 2
});
});
});
// To initially run the function:
$(window).resize();
}
/* Old Centering Functionality that centered on resize no matter if the box had been dragged yet or not
$(window).resize(function(){
$('#draggable').css({
position:'absolute',
left: ($(window).width()
- $('#draggable').outerWidth())/2,
top: ($(window).height()
- $('#draggable').outerHeight())/2
});
});
// To initially run the function:
$(window).resize();
*/
});
/* Cufon */
Cufon.replace('#mini-cart', {fontFamily: 'Gotham-Medium'});
Cufon.replace('h2.page-title', {fontFamily: 'Gotham-Medium'});
Cufon.replace('#content', {fontFamily: 'Gotham-Medium'});
Cufon.replace('ul li',{
fontFamily:'Gotham-Medium',
hover:true,
hoverables:{'li':true},
separate:'none',
ignore:{
'ul':true
},
hover: {
color:'#fff' //you can also switch fonts using the hover function
}
});
$(function() {
//Draggable Init
$( "#draggable" ).draggable({
handle: ".handle",
containment: 'window',
/* Check to see if the box has ever been dragged (for use in the resize function) */
drag: function() {
$.data(this, 'dragged', true);
},
open: function() {
$.data(this, 'dragged', false);
}
});
$(".handle").hover(function(){
$(this).stop().animate({"opacity": 1});
},function(){
$(this).stop().animate({"opacity": .5});
});
//COOKIE FUNCTIONS!
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
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);
}
//Set the move cookies on drag
$('#draggable')
.draggable({ start: function (event, ui) {
createCookie("move-icon","move-icon", 30);
}
});
//if the move-icon cookie exists, don't show the move icon!
if(readCookie("move-icon") != null){
$('.handle').css('background-image', 'url(assets/images/black_square.gif)');
}
//Set the coordinate cookies on drag stop
$('#draggable')
.draggable({ stop: function (event, ui) {
createCookie("draggableX", ui.position.left, 0);
createCookie("draggableY", ui.position.top, 0);
}
});
/*
If the box has been moved on a previous page, use our Cookie Functions to set the position to the same as the previous page.
Else, center it.
*/
if(readCookie("draggableY") != null){
$('#draggable')
.css({ top: readCookie("draggableY")*1, left: readCookie("draggableX")*1 })
.draggable({ stop: function (event, ui) {
createCookie("draggableX", ui.position.left, 0);
createCookie("draggableY", ui.position.top, 0);
}
});
}else{
$(window).resize(function() {
$("#draggable").each(function() {
if(!$.data(this, 'dragged'))
$('#draggable').css({
position:'absolute',
left: ($(window).width()
- $('#draggable').outerWidth())/2,
top: ($(window).height()
- $('#draggable').outerHeight())/2
});
});
});
// To initially run the function:
$(window).resize();
}
/* Old Centering Functionality that centered on resize no matter if the box had been dragged yet or not
$(window).resize(function(){
$('#draggable').css({
position:'absolute',
left: ($(window).width()
- $('#draggable').outerWidth())/2,
top: ($(window).height()
- $('#draggable').outerHeight())/2
});
});
// To initially run the function:
$(window).resize();
*/
});