| Current Path : /home/sunflowe/www2/vacancesfloride/_AncienSite/templates/ariolite/js/ |
| Current File : /home/sunflowe/www2/vacancesfloride/_AncienSite/templates/ariolite/js/switcher.js |
/**
* @version $Id: templateCore.js 205 2006-07-13 12:11:24Z danial $
* @package JJ Flex
* @Copyright (C) 2006 JoomlaJunkie.com & Clexus New Media - All rights reserved
* @license Released as a commercial addon
* @link http://www.joomlajunkie.com & http://www.clexus.com
**/
/*
* Helper Functions
*/
jQuery.noConflict();
function switchFont(newFont)
{
//$("body").removeClass().addClass(newFont);
jQuery(document).ready(function(){
jQuery("body").removeClass().addClass(newFont);
});
createCookie('font_size', newFont, 365);
return false;
}
function switchStylestyle(styleName, cmode, availStyles)
{
jQuery('link[@rel*=style][@title]').each(function(i)
{
if (in_array(this.getAttribute('title'), availStyles))
{
this.disabled = true;
if (this.getAttribute('title') == styleName)
{
this.disabled = false;
}
}
});
createCookie('style_' + cmode, styleName, 365);
}
// cookie functions http://www.quirksmode.org/js/cookies.html
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);
}
// /cookie functions
function in_array(needle, haystack)
{
for (h in haystack)
{
if (haystack[h] == needle)
{
return true;
}
}
return false;
}
/*
* Continue
*/
var style_id_list_c = new Array("red", "blue", "green", "orange");
jQuery.preloadImages = function()
{
for (var i = 0; i < arguments.length; i++)
{
img = new Image();
img.src = arguments[i];
}
};
jQuery('.sizeswitch').each(function(i)
{
style_id_list_s[i] = $(this).rel();
});
//initilizing the active states
//var defCol = readCookie("style_color") ? readCookie("style_color") : color;
var defSiz = readCookie("font_size") ? readCookie("font_size") : text_size;
//switchStylestyle(defCol, "color", style_id_list_c);
switchFont(defSiz);
jQuery(document).ready(function()
{
jQuery('.styleswitch').click(function()
{
switchStylestyle(this.getAttribute("rel"), "color", style_id_list_c);
jQuery('.styleswitch').removeClass("active-option");
jQuery(this).addClass("active-option");
return false;
});
jQuery('.fontswitch').click(function()
{
switchFont(this.getAttribute("rel"));
jQuery('.fontswitch').removeClass("active-option");
jQuery(this).addClass("active-option");
return false;
});
jQuery('.sizeswitch').click(function()
{
switchStylestyle(this.getAttribute("rel"), "size", style_id_list_s);
jQuery('.sizeswitch').removeClass("active-option");
jQuery(this).addClass("active-option");
return false;
});
// jQuery(".styleswitch[@rel*=" + defCol + "]").addClass("active-option");
jQuery(".fontswitch[@rel*=" + defSiz + "]").addClass("active-option");
});